amis-rpc-design/node_modules/@babel/preset-react/lib/index.js.map

1 line
6.9 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"file":"index.js","sources":["../src/normalize-options.ts","../src/index.ts"],"sourcesContent":["import {\n OptionValidator,\n findSuggestion,\n} from \"@babel/helper-validator-option\";\nconst v = new OptionValidator(\"@babel/preset-react\");\n\nexport default function normalizeOptions(options: any = {}) {\n if (process.env.BABEL_8_BREAKING) {\n if (\"useSpread\" in options) {\n throw new Error(\n '@babel/preset-react: Since Babel 8, an inline object with spread elements is always used, and the \"useSpread\" option is no longer available. Please remove it from your config.',\n );\n }\n\n if (\"useBuiltIns\" in options) {\n const useBuiltInsFormatted = JSON.stringify(options.useBuiltIns);\n throw new Error(\n `@babel/preset-react: Since \"useBuiltIns\" is removed in Babel 8, you can remove it from the config.\n- Babel 8 now transforms JSX spread to object spread. If you need to transpile object spread with\n\\`useBuiltIns: ${useBuiltInsFormatted}\\`, you can use the following config\n{\n \"plugins\": [\n [\"@babel/plugin-transform-object-rest-spread\", { \"loose\": true, \"useBuiltIns\": ${useBuiltInsFormatted} }]\n ],\n \"presets\": [\"@babel/preset-react\"]\n}`,\n );\n }\n\n const TopLevelOptions = {\n development: \"development\",\n importSource: \"importSource\",\n pragma: \"pragma\",\n pragmaFrag: \"pragmaFrag\",\n pure: \"pure\",\n runtime: \"runtime\",\n throwIfNamespace: \"throwIfNamespace\",\n };\n v.validateTopLevelOptions(options, TopLevelOptions);\n const development = v.validateBooleanOption(\n TopLevelOptions.development,\n options.development,\n false,\n );\n let importSource = v.validateStringOption(\n TopLevelOptions.importSource,\n options.importSource,\n );\n let pragma = v.validateStringOption(TopLevelOptions.pragma, options.pragma);\n let pragmaFrag = v.validateStringOption(\n TopLevelOptions.pragmaFrag,\n options.pragmaFrag,\n );\n const pure = v.validateBooleanOption(TopLevelOptions.pure, options.pure);\n const runtime = v.validateStringOption(\n TopLevelOptions.runtime,\n options.runtime,\n \"automatic\",\n );\n const throwIfNamespace = v.validateBooleanOption(\n TopLevelOptions.throwIfNamespace,\n options.throwIfNamespace,\n true,\n );\n\n const validRuntime = [\"classic\", \"automatic\"];\n\n if (runtime === \"classic\") {\n pragma = pragma || \"React.createElement\";\n pragmaFrag = pragmaFrag || \"React.Fragment\";\n } else if (runtime === \"automatic\") {\n importSource = importSource || \"react\";\n } else {\n throw new Error(\n `@babel/preset-react: 'runtime' must be one of ['automatic', 'classic'] but we have '${runtime}'\\n` +\n `- Did you mean '${findSuggestion(runtime, validRuntime)}'?`,\n );\n }\n\n return {\n development,\n importSource,\n pragma,\n pragmaFrag,\n pure,\n runtime,\n throwIfNamespace,\n };\n } else {\n let { pragma, pragmaFrag } = options;\n\n const {\n pure,\n throwIfNamespace = true,\n runtime = \"classic\",\n importSource,\n useBuiltIns,\n useSpread,\n } = options;\n\n if (runtime === \"classic\") {\n pragma = pragma || \"React.createElement\";\n pragmaFrag = pragmaFrag || \"React.Fragment\";\n }\n\n const development = !!options.development;\n\n return {\n development,\n importSource,\n pragma,\n pragmaFrag,\n pure,\n runtime,\n throwIfNamespace,\n useBuiltIns,\n useSpread,\n };\n }\n}\n","import { declarePreset } from \"@babel/helper-plugin-utils\";\nimport transformReactJSX from \"@babel/plugin-transform-react-jsx\";\nimport transformReactJSXDevelopment from \"@babel/plugin-transform-react-jsx-development\";\nimport transformReactDisplayName from \"@babel/plugin-transform-react-display-name\";\nimport transformReactPure from \"@babel/plugin-trans