You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@babel/plugin-transform-runtime

Package Overview
Dependencies
Maintainers
4
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-runtime - npm Package Compare versions

Comparing version
8.0.0-rc.2
to
8.0.0-rc.3
+1
-1
lib/get-runtime-path/browser.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"browser.js","sources":["../../src/get-runtime-path/browser.ts"],"sourcesContent":["export default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n resolveFSPath();\n}\n\nexport function resolveFSPath() {\n throw new Error(\n \"The 'absoluteRuntime' option is not supported when using @babel/standalone.\",\n );\n}\n"],"names":["moduleName","dirname","absoluteRuntime","resolveFSPath","Error"],"mappings":"AAAe,kBACbA,UAAkB,EAClBC,OAAe,EACfC,eAAiC,EACjC;AACA,EAAA,IAAIA,eAAe,KAAK,KAAK,EAAE,OAAOF,UAAU,CAAA;AAEhDG,EAAAA,aAAa,EAAE,CAAA;AACjB,CAAA;AAEO,SAASA,aAAaA,GAAG;AAC9B,EAAA,MAAM,IAAIC,KAAK,CACb,6EACF,CAAC,CAAA;AACH;;;;"}
{"version":3,"file":"browser.js","sources":["../../src/get-runtime-path/browser.ts"],"sourcesContent":["export default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n resolveFSPath();\n}\n\nexport function resolveFSPath() {\n throw new Error(\n \"The 'absoluteRuntime' option is not supported when using @babel/standalone.\",\n );\n}\n"],"names":["moduleName","dirname","absoluteRuntime","resolveFSPath","Error"],"mappings":"AAAe,kBACbA,UAAkB,EAClBC,OAAe,EACfC,eAAiC,EACjC;AACA,EAAA,IAAIA,eAAe,KAAK,KAAK,EAAE,OAAOF,UAAU;AAEhDG,EAAAA,aAAa,EAAE;AACjB;AAEO,SAASA,aAAaA,GAAG;AAC9B,EAAA,MAAM,IAAIC,KAAK,CACb,6EACF,CAAC;AACH;;;;"}
import path from 'node:path';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const require$1 = createRequire(import.meta.url);
function index (moduleName, dirname, absoluteRuntime) {

@@ -11,3 +11,3 @@ if (absoluteRuntime === false) return moduleName;

try {
return path.dirname(require.resolve(`${moduleName}/package.json`, {
return path.dirname(require$1.resolve(`${moduleName}/package.json`, {
paths: [dirname]

@@ -25,3 +25,3 @@ })).replace(/\\/g, "/");

function resolveFSPath(path) {
return require.resolve(path).replace(/\\/g, "/");
return require$1.resolve(path).replace(/\\/g, "/");
}

@@ -28,0 +28,0 @@

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sources":["../../src/get-runtime-path/index.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { createRequire } from \"node:module\";\nconst require = createRequire(import.meta.url);\n\nexport default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n return resolveAbsoluteRuntime(\n moduleName,\n path.resolve(dirname, absoluteRuntime === true ? \".\" : absoluteRuntime),\n );\n}\n\nfunction resolveAbsoluteRuntime(moduleName: string, dirname: string) {\n try {\n return path\n .dirname(\n require.resolve(`${moduleName}/package.json`, { paths: [dirname] }),\n )\n .replace(/\\\\/g, \"/\");\n } catch (err) {\n if (err.code !== \"MODULE_NOT_FOUND\") throw err;\n\n throw Object.assign(\n new Error(`Failed to resolve \"${moduleName}\" relative to \"${dirname}\"`),\n {\n code: \"BABEL_RUNTIME_NOT_FOUND\",\n runtime: moduleName,\n dirname,\n },\n );\n }\n}\n\nexport function resolveFSPath(path: string) {\n return require.resolve(path).replace(/\\\\/g, \"/\");\n}\n"],"names":["require","createRequire","import","meta","url","moduleName","dirname","absoluteRuntime","resolveAbsoluteRuntime","path","resolve","paths","replace","err","code","Object","assign","Error","runtime","resolveFSPath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sourcesContent":["import path from \"node:path\";\n\nimport { createRequire } from \"node:module\";\nconst require = createRequire(import.meta.url);\n\nexport default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n return resolveAbsoluteRuntime(\n moduleName,\n path.resolve(dirname, absoluteRuntime === true ? \".\" : absoluteRuntime),\n );\n}\n\nfunction resolveAbsoluteRuntime(moduleName: string, dirname: string) {\n try {\n return path\n .dirname(\n require.resolve(`${moduleName}/package.json`, { paths: [dirname] }),\n )\n .replace(/\\\\/g, \"/\");\n } catch (err) {\n if (err.code !== \"MODULE_NOT_FOUND\") throw err;\n\n throw Object.assign(\n new Error(`Failed to resolve \"${moduleName}\" relative to \"${dirname}\"`),\n {\n code: \"BABEL_RUNTIME_NOT_FOUND\",\n runtime: moduleName,\n dirname,\n },\n );\n }\n}\n\nexport function resolveFSPath(path: string) {\n return require.resolve(path).replace(/\\\\/g, \"/\");\n}\n"],"names":["require","createRequire","import","meta","url","moduleName","dirname","absoluteRuntime","resolveAbsoluteRuntime","path","resolve","paths","replace","err","code","Object","assign","Error","runtime","resolveFSPath"],"mappings":";;;AAGA,MAAMA,SAAO,GAAGC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE/B,gBACbC,UAAkB,EAClBC,OAAe,EACfC,eAAiC,EACjC;AACA,EAAA,IAAIA,eAAe,KAAK,KAAK,EAAE,OAAOF,UAAU;AAEhD,EAAA,OAAOG,sBAAsB,CAC3BH,UAAU,EACVI,IAAI,CAACC,OAAO,CAACJ,OAAO,EAAEC,eAAe,KAAK,IAAI,GAAG,GAAG,GAAGA,eAAe,CACxE,CAAC;AACH;AAEA,SAASC,sBAAsBA,CAACH,UAAkB,EAAEC,OAAe,EAAE;EACnE,IAAI;IACF,OAAOG,IAAI,CACRH,OAAO,CACNN,SAAO,CAACU,OAAO,CAAC,CAAA,EAAGL,UAAU,CAAA,aAAA,CAAe,EAAE;MAAEM,KAAK,EAAE,CAACL,OAAO;KAAG,CACpE,CAAC,CACAM,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EACxB,CAAC,CAAC,OAAOC,GAAG,EAAE;AACZ,IAAA,IAAIA,GAAG,CAACC,IAAI,KAAK,kBAAkB,EAAE,MAAMD,GAAG;AAE9C,IAAA,MAAME,MAAM,CAACC,MAAM,CACjB,IAAIC,KAAK,CAAC,CAAA,mBAAA,EAAsBZ,UAAU,CAAA,eAAA,EAAkBC,OAAO,CAAA,CAAA,CAAG,CAAC,EACvE;AACEQ,MAAAA,IAAI,EAAE,yBAAyB;AAC/BI,MAAAA,OAAO,EAAEb,UAAU;AACnBC,MAAAA;AACF,KACF,CAAC;AACH,EAAA;AACF;AAEO,SAASa,aAAaA,CAACV,IAAY,EAAE;AAC1C,EAAA,OAAOT,SAAO,CAACU,OAAO,CAACD,IAAI,CAAC,CAACG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AAClD;;;;"}

@@ -7,3 +7,3 @@ import { declare } from '@babel/helper-plugin-utils';

var index = declare((api, options, dirname) => {
api.assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-rc.2");
api.assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-rc.3");
const {

@@ -10,0 +10,0 @@ version: runtimeVersion = "8.0.0-beta.0",

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { addDefault, isModule } from \"@babel/helper-module-imports\";\nimport { types as t } from \"@babel/core\";\n\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport getRuntimePath, { resolveFSPath } from \"#get-runtime-path\";\n\nexport interface Options {\n absoluteRuntime?: boolean;\n corejs?: string | number | { version: string | number; proposals?: boolean };\n helpers?: boolean;\n version?: string;\n moduleName?: null | string;\n}\n\nexport default declare((api, options: Options, dirname) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const {\n version: runtimeVersion = \"8.0.0-beta.0\",\n absoluteRuntime = false,\n moduleName = null,\n } = options;\n\n if (\n typeof absoluteRuntime !== \"boolean\" &&\n typeof absoluteRuntime !== \"string\"\n ) {\n throw new Error(\n \"The 'absoluteRuntime' option must be undefined, a boolean, or a string.\",\n );\n }\n\n if (typeof runtimeVersion !== \"string\") {\n throw new Error(`The 'version' option must be a version string.`);\n }\n\n if (moduleName !== null && typeof moduleName !== \"string\") {\n throw new Error(\"The 'moduleName' option must be null or a string.\");\n }\n\n if (Object.hasOwn(options, \"useBuiltIns\")) {\n // @ts-expect-error deprecated options\n if (options.useBuiltIns) {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. The @babel/runtime \" +\n \"module now uses builtins by default.\",\n );\n } else {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"polyfill\")) {\n // @ts-expect-error deprecated options\n if (options.polyfill === false) {\n throw new Error(\n \"The 'polyfill' option has been removed. The @babel/runtime \" +\n \"module now skips polyfilling by default.\",\n );\n } else {\n throw new Error(\n \"The 'polyfill' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"regenerator\")) {\n throw new Error(\n \"The 'regenerator' option has been removed. The generators transform \" +\n \"no longers relies on a 'regeneratorRuntime' global. \" +\n \"If you still need to replace imports to the 'regeneratorRuntime' \" +\n \"global, you can use babel-plugin-polyfill-regenerator.\",\n );\n }\n\n if (Object.hasOwn(options, \"useESModules\")) {\n throw new Error(\n \"The 'useESModules' option has been removed. @babel/runtime now uses \" +\n \"package.json#exports to support both CommonJS and ESM helpers.\",\n );\n }\n\n if (Object.hasOwn(options, \"helpers\")) {\n throw new Error(\n \"The 'helpers' option has been removed. \" +\n \"Remove the plugin from your config if \" +\n \"you want to disable helpers import injection.\",\n );\n }\n\n const HEADER_HELPERS = new Set([\n \"interopRequireWildcard\",\n \"interopRequireDefault\",\n ]);\n\n return {\n name: \"transform-runtime\",\n\n inherits: undefined,\n pre(file) {\n let modulePath: string;\n\n file.set(\"helperGenerator\", (name: string) => {\n modulePath ??= getRuntimePath(\n moduleName ??\n file.get(\"runtimeHelpersModuleName\") ??\n \"@babel/runtime\",\n dirname,\n absoluteRuntime,\n );\n\n // If the helper didn't exist yet at the version given, we bail\n // out and let Babel either insert it directly, or throw an error\n // so that plugins can handle that case properly.\n\n if (!file.availableHelper(name, runtimeVersion)) return;\n\n // Explicitly set the CommonJS interop helpers to their reserve\n // blockHoist of 4 so they are guaranteed to exist\n // when other things used them to import.\n const blockHoist =\n HEADER_HELPERS.has(name) && !isModule(file.path) ? 4 : undefined;\n\n let helperPath = `${modulePath}/helpers/${name}`;\n if (absoluteRuntime) helperPath = resolveFSPath(helperPath);\n\n return addDefaultImport(helperPath, name, blockHoist, true);\n });\n\n const cache = new Map();\n\n function addDefaultImport(\n source: string,\n nameHint: string,\n blockHoist: number,\n isHelper = false,\n ) {\n // If something on the page adds a helper when the file is an ES6\n // file, we can't reused the cached helper name after things have been\n // transformed because it has almost certainly been renamed.\n const cacheKey = isModule(file.path);\n const key = `${source}:${nameHint}:${cacheKey || \"\"}`;\n\n let cached = cache.get(key);\n if (cached) {\n cached = t.cloneNode(cached);\n } else {\n cached = addDefault(file.path, source, {\n importedInterop: isHelper ? \"compiled\" : \"uncompiled\",\n nameHint,\n blockHoist,\n });\n\n cache.set(key, cached);\n }\n return cached;\n }\n },\n };\n});\n"],"names":["declare","api","options","dirname","assertVersion","version","runtimeVersion","absoluteRuntime","moduleName","Error","Object","hasOwn","useBuiltIns","polyfill","HEADER_HELPERS","Set","name","inherits","undefined","pre","file","modulePath","set","getRuntimePath","get","availableHelper","blockHoist","has","isModule","path","helperPath","resolveFSPath","addDefaultImport","cache","Map","source","nameHint","isHelper","cacheKey","key","cached","t","cloneNode","addDefault","importedInterop"],"mappings":";;;;;AAeA,YAAeA,OAAO,CAAC,CAAC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AYL,IAAI,CAAE,CAAA,CAAA;AAChD,QAAA,IAAIT,eAAe,EAAEuB,UAAU,GAAGC,aAAa,CAACD,UAAU,CAAC,CAAA;QAE3D,OAAOE,gBAAgB,CAACF,UAAU,EAAEd,IAAI,EAAEU,UAAU,EAAE,IAAI,CAAC,CAAA;AAC7D,OAAC,CAAC,CAAA;AAEF,MAAA,MAAMO,KAAK,GAAG,IAAIC,GAAG,EAAE,CAAA;MAEvB,SAASF,gBAAgBA,CACvBG,MAAc,EACdC,QAAgB,EAChBV,UAAkB,EAClBW,QAAQ,GAAG,KAAK,EAChB;AAIA,QAAA,MAAMC,QAAQ,GAAGV,QAAQ,CAACR,IAAI,CAACS,IAAI,CAAC,CAAA;QACpC,MAAMU,GAAG,GAAG,CAAA,EAAGJ,MAAM,CAAA,CAAA,EAAIC,QAAQ,CAAIE,CAAAA,EAAAA,QAAQ,IAAI,EAAE,CAAE,CAAA,CAAA;AAErD,QAAA,IAAIE,MAAM,GAAGP,KAAK,CAACT,GAAG,CAACe,GAAG,CAAC,CAAA;AAC3B,QAAA,IAAIC,MAAM,EAAE;AACVA,UAAAA,MAAM,GAAGC,KAAC,CAACC,SAAS,CAACF,MAAM,CAAC,CAAA;AAC9B,SAAC,MAAM;UACLA,MAAM,GAAGG,UAAU,CAACvB,IAAI,CAACS,IAAI,EAAEM,MAAM,EAAE;AACrCS,YAAAA,eAAe,EAAEP,QAAQ,GAAG,UAAU,GAAG,YAAY;YACrDD,QAAQ;AACRV,YAAAA,UAAAA;AACF,WAAC,CAAC,CAAA;AAEFO,UAAAA,KAAK,CAACX,GAAG,CAACiB,GAAG,EAAEC,MAAM,CAAC,CAAA;AACxB,SAAA;AACA,QAAA,OAAOA,MAAM,CAAA;AACf,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAC,CAAC;;;;"}
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { addDefault, isModule } from \"@babel/helper-module-imports\";\nimport { types as t } from \"@babel/core\";\n\n// eslint-disable-next-line import/no-unresolved\nimport getRuntimePath, { resolveFSPath } from \"#get-runtime-path\";\n\nexport interface Options {\n absoluteRuntime?: boolean;\n corejs?: string | number | { version: string | number; proposals?: boolean };\n helpers?: boolean;\n version?: string;\n moduleName?: null | string;\n}\n\nexport default declare((api, options: Options, dirname) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const {\n version: runtimeVersion = \"8.0.0-beta.0\",\n absoluteRuntime = false,\n moduleName = null,\n } = options;\n\n if (\n typeof absoluteRuntime !== \"boolean\" &&\n typeof absoluteRuntime !== \"string\"\n ) {\n throw new Error(\n \"The 'absoluteRuntime' option must be undefined, a boolean, or a string.\",\n );\n }\n\n if (typeof runtimeVersion !== \"string\") {\n throw new Error(`The 'version' option must be a version string.`);\n }\n\n if (moduleName !== null && typeof moduleName !== \"string\") {\n throw new Error(\"The 'moduleName' option must be null or a string.\");\n }\n\n if (Object.hasOwn(options, \"useBuiltIns\")) {\n // @ts-expect-error deprecated options\n if (options.useBuiltIns) {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. The @babel/runtime \" +\n \"module now uses builtins by default.\",\n );\n } else {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"polyfill\")) {\n // @ts-expect-error deprecated options\n if (options.polyfill === false) {\n throw new Error(\n \"The 'polyfill' option has been removed. The @babel/runtime \" +\n \"module now skips polyfilling by default.\",\n );\n } else {\n throw new Error(\n \"The 'polyfill' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"regenerator\")) {\n throw new Error(\n \"The 'regenerator' option has been removed. The generators transform \" +\n \"no longers relies on a 'regeneratorRuntime' global. \" +\n \"If you still need to replace imports to the 'regeneratorRuntime' \" +\n \"global, you can use babel-plugin-polyfill-regenerator.\",\n );\n }\n\n if (Object.hasOwn(options, \"useESModules\")) {\n throw new Error(\n \"The 'useESModules' option has been removed. @babel/runtime now uses \" +\n \"package.json#exports to support both CommonJS and ESM helpers.\",\n );\n }\n\n if (Object.hasOwn(options, \"helpers\")) {\n throw new Error(\n \"The 'helpers' option has been removed. \" +\n \"Remove the plugin from your config if \" +\n \"you want to disable helpers import injection.\",\n );\n }\n\n const HEADER_HELPERS = new Set([\n \"interopRequireWildcard\",\n \"interopRequireDefault\",\n ]);\n\n return {\n name: \"transform-runtime\",\n\n inherits: undefined,\n pre(file) {\n let modulePath: string;\n\n file.set(\"helperGenerator\", (name: string) => {\n modulePath ??= getRuntimePath(\n moduleName ??\n file.get(\"runtimeHelpersModuleName\") ??\n \"@babel/runtime\",\n dirname,\n absoluteRuntime,\n );\n\n // If the helper didn't exist yet at the version given, we bail\n // out and let Babel either insert it directly, or throw an error\n // so that plugins can handle that case properly.\n\n if (!file.availableHelper(name, runtimeVersion)) return;\n\n // Explicitly set the CommonJS interop helpers to their reserve\n // blockHoist of 4 so they are guaranteed to exist\n // when other things used them to import.\n const blockHoist =\n HEADER_HELPERS.has(name) && !isModule(file.path) ? 4 : undefined;\n\n let helperPath = `${modulePath}/helpers/${name}`;\n if (absoluteRuntime) helperPath = resolveFSPath(helperPath);\n\n return addDefaultImport(helperPath, name, blockHoist, true);\n });\n\n const cache = new Map();\n\n function addDefaultImport(\n source: string,\n nameHint: string,\n blockHoist: number | undefined,\n isHelper = false,\n ) {\n // If something on the page adds a helper when the file is an ES6\n // file, we can't reused the cached helper name after things have been\n // transformed because it has almost certainly been renamed.\n const cacheKey = isModule(file.path);\n const key = `${source}:${nameHint}:${cacheKey || \"\"}`;\n\n let cached = cache.get(key);\n if (cached) {\n cached = t.cloneNode(cached);\n } else {\n cached = addDefault(file.path, source, {\n importedInterop: isHelper ? \"compiled\" : \"uncompiled\",\n nameHint,\n blockHoist,\n });\n\n cache.set(key, cached);\n }\n return cached;\n }\n },\n };\n});\n"],"names":["declare","api","options","dirname","assertVersion","version","runtimeVersion","absoluteRuntime","moduleName","Error","Object","hasOwn","useBuiltIns","polyfill","HEADER_HELPERS","Set","name","inherits","undefined","pre","file","modulePath","set","getRuntimePath","get","availableHelper","blockHoist","has","isModule","path","helperPath","resolveFSPath","addDefaultImport","cache","Map","source","nameHint","isHelper","cacheKey","key","cached","t","cloneNode","addDefault","importedInterop"],"mappings":";;;;;AAeA,YAAeA,OAAO,CAAC,CAACC,GAAG,EAAEC,OAAgB,EAAEC,OAAO,KAAK;EACzDF,GAAG,CAACG,aAAa,CAAA,kCAAoB,CAAC;EAEtC,MAAM;IACJC,OAAO,EAAEC,cAAc,GAAG,cAAc;AACxCC,IAAAA,eAAe,GAAG,KAAK;AACvBC,IAAAA,UAAU,GAAG;AACf,GAAC,GAAGN,OAAO;EAEX,IACE,OAAOK,eAAe,KAAK,SAAS,IACpC,OAAOA,eAAe,KAAK,QAAQ,EACnC;AACA,IAAA,MAAM,IAAIE,KAAK,CACb,yEACF,CAAC;AACH,EAAA;AAEA,EAAA,IAAI,OAAOH,cAAc,KAAK,QAAQ,EAAE;AACtC,IAAA,MAAM,IAAIG,KAAK,CAAC,CAAA,8CAAA,CAAgD,CAAC;AACnE,EAAA;EAEA,IAAID,UAAU,KAAK,IAAI,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;AACzD,IAAA,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;AACtE,EAAA;EAEA,IAAIC,MAAM,CAACC,MAAM,CAACT,OAAO,EAAE,aAAa,CAAC,EAAE;IAEzC,IAAIA,OAAO,CAACU,WAAW,EAAE;AACvB,MAAA,MAAM,IAAIH,KAAK,CACb,gEAAgE,GAC9D,sCACJ,CAAC;AACH,IAAA,CAAC,MAAM;AACL,MAAA,MAAM,IAAIA,KAAK,CACb,6DAA6D,GAC3D,uDACJ,CAAC;AACH,IAAA;AACF,EAAA;EAEA,IAAIC,MAAM,CAACC,MAAM,CAACT,OAAO,EAA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CAAC,CAAC;;;;"}
{
"name": "@babel/plugin-transform-runtime",
"version": "8.0.0-rc.2",
"version": "8.0.0-rc.3",
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals",

@@ -19,15 +19,15 @@ "repository": {

"dependencies": {
"@babel/helper-module-imports": "^8.0.0-rc.2",
"@babel/helper-plugin-utils": "^8.0.0-rc.2"
"@babel/helper-module-imports": "^8.0.0-rc.3",
"@babel/helper-plugin-utils": "^8.0.0-rc.3"
},
"peerDependencies": {
"@babel/core": "^8.0.0-rc.2"
"@babel/core": "^8.0.0-rc.3"
},
"devDependencies": {
"@babel/core": "^8.0.0-rc.2",
"@babel/helper-plugin-test-runner": "^8.0.0-rc.2",
"@babel/helpers": "^8.0.0-rc.2",
"@babel/preset-env": "^8.0.0-rc.2",
"@babel/runtime": "^8.0.0-rc.2",
"@babel/runtime-corejs3": "^8.0.0-rc.2",
"@babel/core": "^8.0.0-rc.3",
"@babel/helper-plugin-test-runner": "^8.0.0-rc.3",
"@babel/helpers": "^8.0.0-rc.3",
"@babel/preset-env": "^8.0.0-rc.3",
"@babel/runtime": "^8.0.0-rc.3",
"@babel/runtime-corejs3": "^8.0.0-rc.3",
"babel-plugin-polyfill-corejs3": "^0.14.0"

@@ -34,0 +34,0 @@ },