@babel/helper-create-class-features-plugin
Advanced tools
Comparing version 7.18.0 to 7.18.6
@@ -85,9 +85,9 @@ "use strict"; | ||
_core.types.toExpression(node); | ||
const transformed = _core.types.toExpression(node); | ||
properties.push(prop("value", (0, _helperFunctionName.default)({ | ||
node, | ||
node: transformed, | ||
id, | ||
scope | ||
}) || node)); | ||
}) || transformed)); | ||
} else if (_core.types.isClassProperty(node) && node.value) { | ||
@@ -94,0 +94,0 @@ properties.push(method("value", _core.template.statements.ast`return ${node.value}`)); |
@@ -127,3 +127,3 @@ "use strict"; | ||
if (decoratorPath && !hasFeature(file, FEATURES.decorators)) { | ||
throw path.buildCodeFrameError("Decorators are not enabled." + "\nIf you are using " + '["@babel/plugin-proposal-decorators", { "legacy": true }], ' + 'make sure it comes *before* "@babel/plugin-proposal-class-properties" ' + "and enable loose mode, like so:\n" + '\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n' + '\t["@babel/plugin-proposal-class-properties", { "loose": true }]'); | ||
throw path.buildCodeFrameError("Decorators are not enabled." + "\nIf you are using " + '["@babel/plugin-proposal-decorators", { "version": "legacy" }], ' + 'make sure it comes *before* "@babel/plugin-proposal-class-properties" ' + "and enable loose mode, like so:\n" + '\t["@babel/plugin-proposal-decorators", { "version": "legacy" }]\n' + '\t["@babel/plugin-proposal-class-properties", { "loose": true }]'); | ||
} | ||
@@ -130,0 +130,0 @@ |
@@ -42,3 +42,3 @@ "use strict"; | ||
const version = "7.18.0".split(".").reduce((v, x) => v * 1e5 + +x, 0); | ||
const version = "7.18.6".split(".").reduce((v, x) => v * 1e5 + +x, 0); | ||
const versionKey = "@babel/plugin-class-features/version"; | ||
@@ -154,3 +154,5 @@ | ||
if (!props.length && !isDecorated) return; | ||
{ | ||
if (!props.length && !isDecorated) return; | ||
} | ||
const innerBinding = path.node.id; | ||
@@ -174,17 +176,18 @@ let ref; | ||
let keysNodes, staticNodes, instanceNodes, pureStaticNodes, wrapClass; | ||
if (isDecorated) { | ||
staticNodes = pureStaticNodes = keysNodes = []; | ||
({ | ||
instanceNodes, | ||
wrapClass | ||
} = (0, _decorators.buildDecoratedClass)(ref, path, elements, file)); | ||
} else { | ||
keysNodes = (0, _misc.extractComputedKeys)(path, computedPaths, file); | ||
({ | ||
staticNodes, | ||
pureStaticNodes, | ||
instanceNodes, | ||
wrapClass | ||
} = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, file, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, constantSuper != null ? constantSuper : loose, innerBinding)); | ||
{ | ||
if (isDecorated) { | ||
staticNodes = pureStaticNodes = keysNodes = []; | ||
({ | ||
instanceNodes, | ||
wrapClass | ||
} = (0, _decorators.buildDecoratedClass)(ref, path, elements, file)); | ||
} else { | ||
keysNodes = (0, _misc.extractComputedKeys)(path, computedPaths, file); | ||
({ | ||
staticNodes, | ||
pureStaticNodes, | ||
instanceNodes, | ||
wrapClass | ||
} = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, file, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, constantSuper != null ? constantSuper : loose, innerBinding)); | ||
} | ||
} | ||
@@ -194,3 +197,5 @@ | ||
(0, _misc.injectInitialization)(path, constructor, instanceNodes, (referenceVisitor, state) => { | ||
if (isDecorated) return; | ||
{ | ||
if (isDecorated) return; | ||
} | ||
@@ -219,10 +224,12 @@ for (const prop of props) { | ||
}) { | ||
if (file.get(versionKey) !== version) return; | ||
const decl = path.get("declaration"); | ||
{ | ||
if (file.get(versionKey) !== version) return; | ||
const decl = path.get("declaration"); | ||
if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) { | ||
if (decl.node.id) { | ||
(0, _helperSplitExportDeclaration.default)(path); | ||
} else { | ||
decl.node.type = "ClassExpression"; | ||
if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) { | ||
if (decl.node.id) { | ||
(0, _helperSplitExportDeclaration.default)(path); | ||
} else { | ||
decl.node.type = "ClassExpression"; | ||
} | ||
} | ||
@@ -229,0 +236,0 @@ } |
{ | ||
"name": "@babel/helper-create-class-features-plugin", | ||
"version": "7.18.0", | ||
"version": "7.18.6", | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
@@ -21,9 +21,9 @@ "license": "MIT", | ||
"dependencies": { | ||
"@babel/helper-annotate-as-pure": "^7.16.7", | ||
"@babel/helper-environment-visitor": "^7.16.7", | ||
"@babel/helper-function-name": "^7.17.9", | ||
"@babel/helper-member-expression-to-functions": "^7.17.7", | ||
"@babel/helper-optimise-call-expression": "^7.16.7", | ||
"@babel/helper-replace-supers": "^7.16.7", | ||
"@babel/helper-split-export-declaration": "^7.16.7" | ||
"@babel/helper-annotate-as-pure": "^7.18.6", | ||
"@babel/helper-environment-visitor": "^7.18.6", | ||
"@babel/helper-function-name": "^7.18.6", | ||
"@babel/helper-member-expression-to-functions": "^7.18.6", | ||
"@babel/helper-optimise-call-expression": "^7.18.6", | ||
"@babel/helper-replace-supers": "^7.18.6", | ||
"@babel/helper-split-export-declaration": "^7.18.6" | ||
}, | ||
@@ -34,10 +34,11 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "^7.18.0", | ||
"@babel/helper-plugin-test-runner": "^7.16.7", | ||
"@babel/core": "^7.18.6", | ||
"@babel/helper-plugin-test-runner": "^7.18.6", | ||
"@babel/plugin-syntax-class-static-block": "^7.14.5", | ||
"@babel/preset-env": "^7.18.0" | ||
"@babel/preset-env": "^7.18.6" | ||
}, | ||
"engines": { | ||
"node": ">=6.9.0" | ||
} | ||
}, | ||
"type": "commonjs" | ||
} |
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
54245
1362