diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-12-21 22:46:53 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-12-21 22:46:53 +0800 |
| commit | f06956efd2dc4bf77244a9fcce2b883a00b925af (patch) | |
| tree | 0123cb73ce67f1f4b17e1d6cbabff076ee44e31b /node_modules/@babel/helper-create-class-features-plugin/lib/features.js | |
| parent | 8d980c13970c15b6d2312b6fc4ac51698dd0d220 (diff) | |
updated node modules
Diffstat (limited to 'node_modules/@babel/helper-create-class-features-plugin/lib/features.js')
| -rw-r--r-- | node_modules/@babel/helper-create-class-features-plugin/lib/features.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/features.js b/node_modules/@babel/helper-create-class-features-plugin/lib/features.js index a4460a6f..047b4d5b 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/features.js +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/features.js @@ -8,18 +8,24 @@ exports.enableFeature = enableFeature; exports.isLoose = isLoose; exports.shouldTransform = shouldTransform; var _decorators = require("./decorators.js"); -const FEATURES = Object.freeze({ +const FEATURES = exports.FEATURES = Object.freeze({ fields: 1 << 1, privateMethods: 1 << 2, decorators: 1 << 3, privateIn: 1 << 4, staticBlocks: 1 << 5 }); -exports.FEATURES = FEATURES; const featuresSameLoose = new Map([[FEATURES.fields, "@babel/plugin-transform-class-properties"], [FEATURES.privateMethods, "@babel/plugin-transform-private-methods"], [FEATURES.privateIn, "@babel/plugin-transform-private-property-in-object"]]); const featuresKey = "@babel/plugin-class-features/featuresKey"; const looseKey = "@babel/plugin-class-features/looseKey"; -const looseLowPriorityKey = "@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing"; +{ + var looseLowPriorityKey = "@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing"; +} +{ + var canIgnoreLoose = function (file, feature) { + return !!(file.get(looseLowPriorityKey) & feature); + }; +} function enableFeature(file, feature, loose) { if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) { file.set(featuresKey, file.get(featuresKey) | feature); @@ -34,17 +40,19 @@ function enableFeature(file, feature, loose) { } } let resolvedLoose; - let higherPriorityPluginName; for (const [mask, name] of featuresSameLoose) { if (!hasFeature(file, mask)) continue; + { + if (canIgnoreLoose(file, mask)) continue; + } const loose = isLoose(file, mask); - if (canIgnoreLoose(file, mask)) { - continue; - } else if (resolvedLoose === !loose) { + if (resolvedLoose === !loose) { throw new Error("'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, " + "@babel/plugin-transform-private-methods and " + "@babel/plugin-transform-private-property-in-object (when they are enabled)."); } else { resolvedLoose = loose; - higherPriorityPluginName = name; + { + var higherPriorityPluginName = name; + } } } if (resolvedLoose !== undefined) { @@ -64,10 +72,9 @@ function isLoose(file, feature) { } function setLoose(file, feature, loose) { if (loose) file.set(looseKey, file.get(looseKey) | feature);else file.set(looseKey, file.get(looseKey) & ~feature); - file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) & ~feature); -} -function canIgnoreLoose(file, feature) { - return !!(file.get(looseLowPriorityKey) & feature); + { + file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) & ~feature); + } } function shouldTransform(path, file) { let decoratorPath = null; |
