@babel/plugin-proposal-class-static-block
Advanced tools
Comparing version 7.12.13 to 7.13.11
@@ -43,19 +43,17 @@ "use strict"; | ||
const privateNames = new Set(); | ||
let staticBlockPath; | ||
const body = classBody.get("body"); | ||
for (const path of classBody.get("body")) { | ||
for (const path of body) { | ||
if (path.isPrivate()) { | ||
privateNames.add(path.get("key.id").node.name); | ||
} else if (path.isStaticBlock()) { | ||
staticBlockPath = path; | ||
} | ||
} | ||
if (!staticBlockPath) { | ||
return; | ||
for (const path of body) { | ||
if (!path.isStaticBlock()) continue; | ||
const staticBlockPrivateId = generateUid(scope, privateNames); | ||
privateNames.add(staticBlockPrivateId); | ||
const staticBlockRef = t.privateName(t.identifier(staticBlockPrivateId)); | ||
path.replaceWith(t.classPrivateProperty(staticBlockRef, template.expression.ast`(() => { ${path.node.body} })()`, [], true)); | ||
} | ||
const staticBlockRef = t.privateName(t.identifier(generateUid(scope, privateNames))); | ||
classBody.pushContainer("body", t.classPrivateProperty(staticBlockRef, template.expression.ast`(() => { ${staticBlockPath.node.body} })()`, [], true)); | ||
staticBlockPath.remove(); | ||
} | ||
@@ -62,0 +60,0 @@ |
{ | ||
"name": "@babel/plugin-proposal-class-static-block", | ||
"version": "7.12.13", | ||
"version": "7.13.11", | ||
"description": "Allow parsing of class static blocks", | ||
@@ -22,3 +22,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.12.13", | ||
"@babel/helper-plugin-utils": "^7.13.0", | ||
"@babel/plugin-syntax-class-static-block": "^7.12.13" | ||
@@ -30,6 +30,6 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "7.12.13", | ||
"@babel/helper-plugin-test-runner": "7.12.13" | ||
"@babel/core": "7.13.10", | ||
"@babel/helper-plugin-test-runner": "7.13.10" | ||
}, | ||
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-class-static-block" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4044
51