@babel/plugin-proposal-json-modules
Advanced tools
Comparing version
@@ -10,3 +10,3 @@ "use strict"; | ||
var _helperImportToPlatformApi = require("@babel/helper-import-to-platform-api"); | ||
var _default = exports.default = (0, _helperPluginUtils.declare)(api => { | ||
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => { | ||
const { | ||
@@ -21,2 +21,3 @@ types: t, | ||
const transformers = { | ||
commonJS: options.uncheckedRequire ? (require, specifier) => t.callExpression(require, [specifier]) : null, | ||
webFetch: fetch => template.expression.ast`${fetch}.then(r => r.json())`, | ||
@@ -93,2 +94,3 @@ nodeFsSync: read => template.expression.ast`JSON.parse(${read})`, | ||
} | ||
if (data.length === 0) return; | ||
const decl = (0, _helperImportToPlatformApi.buildParallelStaticImports)(data, helper.needsAwait); | ||
@@ -95,0 +97,0 @@ if (decl) path.unshiftContainer("body", decl); |
{ | ||
"name": "@babel/plugin-proposal-json-modules", | ||
"version": "7.24.7", | ||
"version": "7.25.0", | ||
"description": "Transform json modules imports (`import '...' with { type: 'json' }`) to work in browsers and Node.js.", | ||
@@ -35,4 +35,4 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-import-to-platform-api": "^7.24.7", | ||
"@babel/helper-plugin-utils": "^7.24.7", | ||
"@babel/helper-import-to-platform-api": "^7.25.0", | ||
"@babel/helper-plugin-utils": "^7.24.8", | ||
"@babel/plugin-syntax-import-attributes": "^7.24.7" | ||
@@ -44,3 +44,3 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.24.7", | ||
"@babel/core": "^7.24.9", | ||
"@babel/helper-plugin-test-runner": "^7.24.7", | ||
@@ -47,0 +47,0 @@ "babel-plugin-polyfill-corejs3": "^0.10.4" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
120
1.69%78816
-3.23%