@babel/helper-module-transforms
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import assert from 'assert'; | ||
import assert from 'node:assert'; | ||
import { types, template } from '@babel/core'; | ||
@@ -6,3 +6,3 @@ import { isModule } from '@babel/helper-module-imports'; | ||
import traverse, { visitors } from '@babel/traverse'; | ||
import { basename, extname } from 'path'; | ||
import { basename, extname } from 'node:path'; | ||
import { isIdentifierName } from '@babel/helper-validator-identifier'; | ||
@@ -599,3 +599,5 @@ | ||
const bindingKindLookup = new Map(); | ||
programPath.get("body").forEach(child => { | ||
const programScope = programPath.scope; | ||
const programChildren = programPath.get("body"); | ||
programChildren.forEach(child => { | ||
let kind; | ||
@@ -642,3 +644,3 @@ if (child.isImportDeclaration()) { | ||
if (!metadata) { | ||
const kind = bindingKindLookup.get(localName); | ||
const kind = bindingKindLookup.get(localName) ?? programScope.getBinding(localName)?.kind; | ||
if (kind === undefined) { | ||
@@ -655,3 +657,3 @@ throw idPath.buildCodeFrameError(`Exporting local "${localName}", which is not declared.`); | ||
}; | ||
programPath.get("body").forEach(child => { | ||
programChildren.forEach(child => { | ||
if (child.isExportNamedDeclaration() && (initializeReexports || !child.node.source)) { | ||
@@ -658,0 +660,0 @@ if (child.node.declaration) { |
{ | ||
"name": "@babel/helper-module-transforms", | ||
"version": "8.0.0-alpha.17", | ||
"version": "8.0.0-beta.0", | ||
"description": "Babel helper functions for implementing ES6 module transformations", | ||
@@ -18,14 +18,14 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"dependencies": { | ||
"@babel/helper-module-imports": "^8.0.0-alpha.17", | ||
"@babel/helper-validator-identifier": "^8.0.0-alpha.17", | ||
"@babel/traverse": "^8.0.0-alpha.17" | ||
"@babel/helper-module-imports": "^8.0.0-beta.0", | ||
"@babel/helper-validator-identifier": "^8.0.0-beta.0", | ||
"@babel/traverse": "^8.0.0-beta.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^8.0.0-alpha.17" | ||
"@babel/core": "^8.0.0-beta.0" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^8.0.0-alpha.17" | ||
"@babel/core": "^8.0.0-beta.0" | ||
}, | ||
"engines": { | ||
"node": "^18.20.0 || ^20.17.0 || >=22.8.0" | ||
"node": "^20.19.0 || >=22.12.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
164556
0.41%1242
0.16%