[79a0317] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
| 4 |
|
---|
| 5 | var helperPluginUtils = require('@babel/helper-plugin-utils');
|
---|
| 6 | var transformReactJSX = require('@babel/plugin-transform-react-jsx');
|
---|
| 7 | var transformReactJSXDevelopment = require('@babel/plugin-transform-react-jsx-development');
|
---|
| 8 | var transformReactDisplayName = require('@babel/plugin-transform-react-display-name');
|
---|
| 9 | var transformReactPure = require('@babel/plugin-transform-react-pure-annotations');
|
---|
| 10 | var helperValidatorOption = require('@babel/helper-validator-option');
|
---|
| 11 |
|
---|
| 12 | function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
---|
| 13 |
|
---|
| 14 | var transformReactJSX__default = /*#__PURE__*/_interopDefault(transformReactJSX);
|
---|
| 15 | var transformReactJSXDevelopment__default = /*#__PURE__*/_interopDefault(transformReactJSXDevelopment);
|
---|
| 16 | var transformReactDisplayName__default = /*#__PURE__*/_interopDefault(transformReactDisplayName);
|
---|
| 17 | var transformReactPure__default = /*#__PURE__*/_interopDefault(transformReactPure);
|
---|
| 18 |
|
---|
| 19 | new helperValidatorOption.OptionValidator("@babel/preset-react");
|
---|
| 20 | function normalizeOptions(options = {}) {
|
---|
| 21 | {
|
---|
| 22 | let {
|
---|
| 23 | pragma,
|
---|
| 24 | pragmaFrag
|
---|
| 25 | } = options;
|
---|
| 26 | const {
|
---|
| 27 | pure,
|
---|
| 28 | throwIfNamespace = true,
|
---|
| 29 | runtime = "classic",
|
---|
| 30 | importSource,
|
---|
| 31 | useBuiltIns,
|
---|
| 32 | useSpread
|
---|
| 33 | } = options;
|
---|
| 34 | if (runtime === "classic") {
|
---|
| 35 | pragma = pragma || "React.createElement";
|
---|
| 36 | pragmaFrag = pragmaFrag || "React.Fragment";
|
---|
| 37 | }
|
---|
| 38 | const development = options.development == null ? undefined : !!options.development;
|
---|
| 39 | return {
|
---|
| 40 | development,
|
---|
| 41 | importSource,
|
---|
| 42 | pragma,
|
---|
| 43 | pragmaFrag,
|
---|
| 44 | pure,
|
---|
| 45 | runtime,
|
---|
| 46 | throwIfNamespace,
|
---|
| 47 | useBuiltIns,
|
---|
| 48 | useSpread
|
---|
| 49 | };
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | var index = helperPluginUtils.declarePreset((api, opts) => {
|
---|
| 54 | api.assertVersion(7);
|
---|
| 55 | const {
|
---|
| 56 | development = false,
|
---|
| 57 | importSource,
|
---|
| 58 | pragma,
|
---|
| 59 | pragmaFrag,
|
---|
| 60 | pure,
|
---|
| 61 | runtime,
|
---|
| 62 | throwIfNamespace
|
---|
| 63 | } = normalizeOptions(opts);
|
---|
| 64 | return {
|
---|
| 65 | plugins: [[development ? transformReactJSXDevelopment__default.default : transformReactJSX__default.default, {
|
---|
| 66 | importSource,
|
---|
| 67 | pragma,
|
---|
| 68 | pragmaFrag,
|
---|
| 69 | runtime,
|
---|
| 70 | throwIfNamespace,
|
---|
| 71 | pure,
|
---|
| 72 | useBuiltIns: !!opts.useBuiltIns,
|
---|
| 73 | useSpread: opts.useSpread
|
---|
| 74 | }], transformReactDisplayName__default.default, pure !== false && transformReactPure__default.default].filter(Boolean)
|
---|
| 75 | };
|
---|
| 76 | });
|
---|
| 77 |
|
---|
| 78 | exports.default = index;
|
---|
| 79 | //# sourceMappingURL=index.js.map
|
---|