@babel/plugin-proposal-json-modules
Advanced tools
Comparing version
import * as _babel_core from '@babel/core'; | ||
declare const _default: (api: _babel_core.PluginAPI, options: {}, dirname: string) => _babel_core.PluginObject<_babel_core.PluginPass<{}>>; | ||
//# sourceMappingURL=index.d.ts.map | ||
interface Options { | ||
uncheckedRequire: boolean; | ||
} | ||
declare const _default: (api: _babel_core.PluginAPI, options: Options, dirname: string) => _babel_core.PluginObject<object & _babel_core.PluginPass>; | ||
export { _default as default }; | ||
export { type Options, _default as default }; |
@@ -5,3 +5,3 @@ import { declare } from '@babel/helper-plugin-utils'; | ||
var index = declare(api => { | ||
var index = declare((api, options) => { | ||
const { | ||
@@ -11,3 +11,3 @@ types: t, | ||
} = api; | ||
api.assertVersion("8.0.0-alpha.11"); | ||
api.assertVersion("8.0.0-alpha.12"); | ||
const targets = api.targets(); | ||
@@ -17,2 +17,3 @@ let helperESM; | ||
const transformers = { | ||
commonJS: options.uncheckedRequire ? (require, specifier) => t.callExpression(require, [specifier]) : null, | ||
webFetch: fetch => template.expression.ast`${fetch}.then(r => r.json())`, | ||
@@ -86,2 +87,3 @@ nodeFsSync: read => template.expression.ast`JSON.parse(${read})`, | ||
} | ||
if (data.length === 0) return; | ||
const decl = buildParallelStaticImports(data, helper.needsAwait); | ||
@@ -88,0 +90,0 @@ if (decl) path.unshiftContainer("body", decl); |
{ | ||
"name": "@babel/plugin-proposal-json-modules", | ||
"version": "8.0.0-alpha.11", | ||
"version": "8.0.0-alpha.12", | ||
"description": "Transform json modules imports (`import '...' with { type: 'json' }`) to work in browsers and Node.js.", | ||
@@ -35,12 +35,12 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-import-to-platform-api": "^8.0.0-alpha.11", | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.11", | ||
"@babel/plugin-syntax-import-attributes": "^8.0.0-alpha.11" | ||
"@babel/helper-import-to-platform-api": "^8.0.0-alpha.12", | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.12", | ||
"@babel/plugin-syntax-import-attributes": "^8.0.0-alpha.12" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^8.0.0-alpha.11" | ||
"@babel/core": "^8.0.0-alpha.12" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^8.0.0-alpha.11", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.11", | ||
"@babel/core": "^8.0.0-alpha.12", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.12", | ||
"babel-plugin-polyfill-corejs3": "^0.10.4" | ||
@@ -47,0 +47,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
119
3.48%78799
-3.03%