@babel/plugin-proposal-json-modules
Advanced tools
Comparing version
@@ -1,11 +0,6 @@ | ||
"use strict"; | ||
import { declare } from '@babel/helper-plugin-utils'; | ||
import syntaxImportAttributes from '@babel/plugin-syntax-import-attributes'; | ||
import { buildParallelStaticImports, importToPlatformApi } from '@babel/helper-import-to-platform-api'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _pluginSyntaxImportAttributes = require("@babel/plugin-syntax-import-attributes"); | ||
var _helperImportToPlatformApi = require("@babel/helper-import-to-platform-api"); | ||
var _default = exports.default = (0, _helperPluginUtils.declare)(api => { | ||
var index = declare(api => { | ||
const { | ||
@@ -15,3 +10,3 @@ types: t, | ||
} = api; | ||
api.assertVersion("^7.22.0"); | ||
api.assertVersion("8.0.0-alpha.7"); | ||
const targets = api.targets(); | ||
@@ -28,8 +23,6 @@ let helperESM; | ||
if (modules === "commonjs") { | ||
var _helperCJS; | ||
return (_helperCJS = helperCJS) != null ? _helperCJS : helperCJS = (0, _helperImportToPlatformApi.importToPlatformApi)(targets, transformers, true); | ||
return helperCJS ??= importToPlatformApi(targets, transformers, true); | ||
} | ||
if (modules == null) { | ||
var _helperESM; | ||
return (_helperESM = helperESM) != null ? _helperESM : helperESM = (0, _helperImportToPlatformApi.importToPlatformApi)(targets, transformers, false); | ||
return helperESM ??= importToPlatformApi(targets, transformers, false); | ||
} | ||
@@ -44,7 +37,7 @@ throw new Error(`@babel/plugin-proposal-json-modules can only be used when not ` + `compiling modules, or when compiling them to CommonJS.`); | ||
function hasTypeJson(attributes) { | ||
return !!(attributes != null && attributes.some(attr => getAttributeKey(attr) === "type" && attr.value.value === "json")); | ||
return !!attributes?.some(attr => getAttributeKey(attr) === "type" && attr.value.value === "json"); | ||
} | ||
return { | ||
name: "proposal-json-modules", | ||
inherits: _pluginSyntaxImportAttributes.default, | ||
inherits: syntaxImportAttributes, | ||
visitor: { | ||
@@ -56,3 +49,2 @@ Program(path) { | ||
for (const decl of path.get("body")) { | ||
var _id; | ||
if (!decl.isImportDeclaration()) continue; | ||
@@ -78,3 +70,3 @@ const attributes = decl.node.attributes || decl.node.assertions; | ||
} | ||
(_id = id) != null ? _id : id = path.scope.generateUidIdentifier("_"); | ||
id ??= path.scope.generateUidIdentifier("_"); | ||
let fetch = helper.buildFetch(decl.node.source, path); | ||
@@ -96,3 +88,3 @@ if (needsNS) { | ||
} | ||
const decl = (0, _helperImportToPlatformApi.buildParallelStaticImports)(data, helper.needsAwait); | ||
const decl = buildParallelStaticImports(data, helper.needsAwait); | ||
if (decl) path.unshiftContainer("body", decl); | ||
@@ -104,2 +96,3 @@ } | ||
export { index as default }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-proposal-json-modules", | ||
"version": "7.24.0", | ||
"version": "8.0.0-alpha.7", | ||
"description": "Transform json modules imports (`import '...' with { type: 'json' }`) to work in browsers and Node.js.", | ||
@@ -32,19 +32,19 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-import-to-platform-api": "^7.24.0", | ||
"@babel/helper-plugin-utils": "^7.24.0", | ||
"@babel/plugin-syntax-import-attributes": "^7.23.3" | ||
"@babel/helper-import-to-platform-api": "^8.0.0-alpha.7", | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.7", | ||
"@babel/plugin-syntax-import-attributes": "^8.0.0-alpha.7" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.22.0" | ||
"@babel/core": "^8.0.0-alpha.7" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.24.0", | ||
"@babel/helper-plugin-test-runner": "^7.22.5", | ||
"@babel/core": "^8.0.0-alpha.7", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.7", | ||
"babel-plugin-polyfill-corejs3": "^0.8.7" | ||
}, | ||
"engines": { | ||
"node": ">=6.9.0" | ||
"node": "^16.20.0 || ^18.16.0 || >=20.0.0" | ||
}, | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
"type": "commonjs" | ||
"type": "module" | ||
} |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Yes
NaN14710
-1.97%89
-7.29%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated