| | |
| | | throw new Error(`The 'version' option must be a version string.`); |
| | | } |
| | | |
| | | const DUAL_MODE_RUNTIME = "7.13.0"; |
| | | const supportsCJSDefault = (0, _helpers.hasMinVersion)(DUAL_MODE_RUNTIME, runtimeVersion); |
| | | { |
| | | const DUAL_MODE_RUNTIME = "7.13.0"; |
| | | var supportsCJSDefault = (0, _helpers.hasMinVersion)(DUAL_MODE_RUNTIME, runtimeVersion); |
| | | } |
| | | |
| | | function has(obj, key) { |
| | | return Object.prototype.hasOwnProperty.call(obj, key); |
| | | } |
| | | |
| | | if (has(options, "useBuiltIns")) { |
| | | if (options.useBuiltIns) { |
| | | if (options["useBuiltIns"]) { |
| | | throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime " + "module now uses builtins by default."); |
| | | } else { |
| | | throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime."); |
| | |
| | | } |
| | | |
| | | if (has(options, "polyfill")) { |
| | | if (options.polyfill === false) { |
| | | if (options["polyfill"] === false) { |
| | | throw new Error("The 'polyfill' option has been removed. The @babel/runtime " + "module now skips polyfilling by default."); |
| | | } else { |
| | | throw new Error("The 'polyfill' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime."); |
| | |
| | | }; |
| | | } |
| | | |
| | | const corejsExt = absoluteRuntime ? ".js" : ""; |
| | | return { |
| | | name: "transform-runtime", |
| | | inherits: injectCoreJS2 ? createCorejsPlgin(pluginCorejs2, { |
| | | method: "usage-pure", |
| | | absoluteImports: absoluteRuntime ? modulePath : false, |
| | | [pluginsCompat]: { |
| | | runtimeVersion, |
| | | useBabelRuntime: modulePath, |
| | | ext: corejsExt |
| | | ext: "" |
| | | } |
| | | }, createRegeneratorPlugin({ |
| | | method: "usage-pure", |
| | | absoluteImports: absoluteRuntime ? modulePath : false, |
| | | [pluginsCompat]: { |
| | | useBabelRuntime: modulePath |
| | | } |
| | |
| | | method: "usage-pure", |
| | | version: 3, |
| | | proposals, |
| | | absoluteImports: absoluteRuntime ? modulePath : false, |
| | | [pluginsCompat]: { |
| | | useBabelRuntime: modulePath, |
| | | ext: corejsExt |
| | | ext: "" |
| | | } |
| | | }, createRegeneratorPlugin({ |
| | | method: "usage-pure", |
| | | absoluteImports: absoluteRuntime ? modulePath : false, |
| | | [pluginsCompat]: { |
| | | useBabelRuntime: modulePath |
| | | } |
| | | })) : createRegeneratorPlugin({ |
| | | method: "usage-pure", |
| | | absoluteImports: absoluteRuntime ? modulePath : false, |
| | | [pluginsCompat]: { |
| | | useBabelRuntime: modulePath |
| | | } |
| | |
| | | const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1; |
| | | const blockHoist = isInteropHelper && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined; |
| | | const helpersDir = esModules && file.path.node.sourceType === "module" ? "helpers/esm" : "helpers"; |
| | | return addDefaultImport(`${modulePath}/${helpersDir}/${name}`, name, blockHoist, true); |
| | | let helperPath = `${modulePath}/${helpersDir}/${name}`; |
| | | if (absoluteRuntime) helperPath = (0, _getRuntimePath.resolveFSPath)(helperPath); |
| | | return addDefaultImport(helperPath, name, blockHoist, true); |
| | | }); |
| | | const cache = new Map(); |
| | | |