summaryrefslogtreecommitdiff
path: root/node_modules/@babel/helper-create-class-features-plugin/lib/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/helper-create-class-features-plugin/lib/index.js')
-rw-r--r--node_modules/@babel/helper-create-class-features-plugin/lib/index.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/index.js b/node_modules/@babel/helper-create-class-features-plugin/lib/index.js
index 69bff6fe..5100f585 100644
--- a/node_modules/@babel/helper-create-class-features-plugin/lib/index.js
+++ b/node_modules/@babel/helper-create-class-features-plugin/lib/index.js
@@ -31,9 +31,10 @@ Object.defineProperty(exports, "injectInitialization", {
var _core = require("@babel/core");
var _helperFunctionName = require("@babel/helper-function-name");
var _helperSplitExportDeclaration = require("@babel/helper-split-export-declaration");
+var _decorators = require("./decorators.js");
var _semver = require("semver");
var _fields = require("./fields.js");
-var _decorators = require("./decorators.js");
+var _decorators2 = require("./decorators-2018-09.js");
var _misc = require("./misc.js");
var _features = require("./features.js");
var _typescript = require("./typescript.js");
@@ -44,8 +45,18 @@ function createClassFeaturePlugin({
loose,
manipulateOptions,
api,
- inherits
+ inherits,
+ decoratorVersion
}) {
+ if (feature & _features.FEATURES.decorators) {
+ {
+ if (decoratorVersion === "2021-12" || decoratorVersion === "2022-03" || decoratorVersion === "2023-01" || decoratorVersion === "2023-05") {
+ return (0, _decorators.default)(api, {
+ loose
+ }, decoratorVersion, inherits);
+ }
+ }
+ }
{
var _api;
(_api = api) != null ? _api : api = {
@@ -84,12 +95,12 @@ function createClassFeaturePlugin({
(0, _features.enableFeature)(file, feature, loose);
{
if (typeof file.get(versionKey) === "number") {
- file.set(versionKey, "7.23.6");
+ file.set(versionKey, "7.23.7");
return;
}
}
- if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.23.6")) {
- file.set(versionKey, "7.23.6");
+ if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.23.7")) {
+ file.set(versionKey, "7.23.7");
}
},
visitor: {
@@ -97,13 +108,13 @@ function createClassFeaturePlugin({
file
}) {
var _ref;
- if (file.get(versionKey) !== "7.23.6") return;
+ if (file.get(versionKey) !== "7.23.7") return;
if (!(0, _features.shouldTransform)(path, file)) return;
const pathIsClassDeclaration = path.isClassDeclaration();
if (pathIsClassDeclaration) (0, _typescript.assertFieldTransformed)(path);
const loose = (0, _features.isLoose)(file, feature);
let constructor;
- const isDecorated = (0, _decorators.hasDecorators)(path.node);
+ const isDecorated = (0, _decorators2.hasDecorators)(path.node);
const props = [];
const elements = [];
const computedPaths = [];
@@ -173,7 +184,7 @@ function createClassFeaturePlugin({
({
instanceNodes,
wrapClass
- } = (0, _decorators.buildDecoratedClass)(classRefForDefine, path, elements, file));
+ } = (0, _decorators2.buildDecoratedClass)(classRefForDefine, path, elements, file));
} else {
keysNodes = (0, _misc.extractComputedKeys)(path, computedPaths, file);
({
@@ -213,9 +224,9 @@ function createClassFeaturePlugin({
file
}) {
{
- if (file.get(versionKey) !== "7.23.6") return;
+ if (file.get(versionKey) !== "7.23.7") return;
const decl = path.get("declaration");
- if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) {
+ if (decl.isClassDeclaration() && (0, _decorators2.hasDecorators)(decl.node)) {
if (decl.node.id) {
(0, _helperSplitExportDeclaration.default)(path);
} else {