@babel/plugin-transform-block-scoping
Advanced tools
Comparing version
@@ -469,3 +469,3 @@ import { declare } from '@babel/helper-plugin-utils'; | ||
var index = declare((api, opts) => { | ||
api.assertVersion("8.0.0-alpha.17"); | ||
api.assertVersion("8.0.0-beta.0"); | ||
const { | ||
@@ -508,3 +508,3 @@ throwIfClosureRequired = false, | ||
const updatedBindingsUsages = new Map(); | ||
if (headPath && isBlockScoped(headPath.node)) { | ||
if (headPath && isBlockScoped(headPath)) { | ||
const names = Object.keys(headPath.getBindingIdentifiers()); | ||
@@ -582,3 +582,3 @@ const headScope = headPath.scope; | ||
function transformBlockScopedVariable(path, state, tdzEnabled) { | ||
if (!isBlockScoped(path.node)) return; | ||
if (!isBlockScoped(path)) return; | ||
const dynamicTDZNames = validateUsage(path, state, tdzEnabled); | ||
@@ -630,8 +630,13 @@ path.node.kind = "var"; | ||
} | ||
function isBlockScoped(node) { | ||
function isBlockScoped(path) { | ||
const { | ||
node | ||
} = path; | ||
if (!types.isVariableDeclaration(node)) return false; | ||
if (node[types.BLOCK_SCOPED_SYMBOL]) { | ||
return true; | ||
} | ||
if (!isLetOrConst(node.kind) && node.kind !== "using") { | ||
const { | ||
kind | ||
} = node; | ||
if (kind === "using" || kind === "await using") { | ||
throw path.buildCodeFrameError(`The ${kind} declaration should be first transformed by \`@babel/plugin-proposal-explicit-resource-management\`.`); | ||
} else if (!isLetOrConst(kind)) { | ||
return false; | ||
@@ -638,0 +643,0 @@ } |
{ | ||
"name": "@babel/plugin-transform-block-scoping", | ||
"version": "8.0.0-alpha.17", | ||
"version": "8.0.0-beta.0", | ||
"description": "Compile ES2015 block scoping (const and let) to ES5", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.17" | ||
"@babel/helper-plugin-utils": "^8.0.0-beta.0" | ||
}, | ||
@@ -24,11 +24,11 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@babel/core": "^8.0.0-alpha.17" | ||
"@babel/core": "^8.0.0-beta.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^8.0.0-alpha.17", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.17", | ||
"@babel/traverse": "^8.0.0-alpha.17" | ||
"@babel/core": "^8.0.0-beta.0", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-beta.0", | ||
"@babel/traverse": "^8.0.0-beta.0" | ||
}, | ||
"engines": { | ||
"node": "^18.20.0 || ^20.17.0 || >=22.8.0" | ||
"node": "^20.19.0 || >=22.12.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "author": "The Babel Team (https://babel.dev/team)", |
Sorry, the diff of this file is not supported yet
86254
0.46%647
0.78%+ Added
- Removed