Fixed version coercion (which would cause issues later on when babel internally checkes if this csx-version qualifies for the desired version)
This commit is contained in:
@@ -7,7 +7,7 @@ import packageJson from "../package.json";
|
||||
const SUPPORTED_BABEL_VERSION_RANGE =
|
||||
packageJson.peerDependencies["@babel/core"];
|
||||
const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies(
|
||||
CURRENT_BABEL_VERSION,
|
||||
semver.coerce(CURRENT_BABEL_VERSION).raw,
|
||||
SUPPORTED_BABEL_VERSION_RANGE,
|
||||
);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ function assertVersion(range: string | number): void {
|
||||
throw new Error("Expected string or integer value.");
|
||||
}
|
||||
|
||||
if (semver.satisfies(coreVersion, range)) return;
|
||||
if (semver.satisfies(semver.coerce(coreVersion).raw, range)) return;
|
||||
|
||||
const limit = Error.stackTraceLimit;
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
"@babel/helper-optimise-call-expression": "^7.8.3",
|
||||
"@babel/helper-plugin-utils": "^7.8.3",
|
||||
"@babel/helper-replace-supers": "^7.8.3",
|
||||
"@babel/helper-split-export-declaration": "^7.8.3"
|
||||
"@babel/helper-split-export-declaration": "^7.8.3",
|
||||
"semver": "^5.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import nameFunction from "@babel/helper-function-name";
|
||||
import splitExportDeclaration from "@babel/helper-split-export-declaration";
|
||||
import semver from "semver";
|
||||
import {
|
||||
buildPrivateNamesNodes,
|
||||
buildPrivateNamesMap,
|
||||
@@ -27,7 +28,10 @@ export { FEATURES, injectInitialization };
|
||||
// as 70000100005. This method is easier than using a semver-parsing
|
||||
// package, but it breaks if we release x.y.z where x, y or z are
|
||||
// greater than 99_999.
|
||||
const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0);
|
||||
const version = semver
|
||||
.coerce(pkg.version)
|
||||
.raw.split(".")
|
||||
.reduce((v, x) => v * 1e5 + +x, 0);
|
||||
const versionKey = "@babel/plugin-class-features/version";
|
||||
|
||||
export function createClassFeaturePlugin({
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-regex": "^7.8.3",
|
||||
"regexpu-core": "^4.6.0"
|
||||
"regexpu-core": "^4.6.0",
|
||||
"semver": "^5.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import semver from "semver";
|
||||
import rewritePattern from "regexpu-core";
|
||||
import {
|
||||
featuresKey,
|
||||
@@ -16,7 +17,10 @@ import { pullFlag } from "@babel/helper-regex";
|
||||
// as 70000100005. This method is easier than using a semver-parsing
|
||||
// package, but it breaks if we release x.y.z where x, y or z are
|
||||
// greater than 99_999.
|
||||
const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0);
|
||||
const version = semver
|
||||
.coerce(pkg.version)
|
||||
.raw.split(".")
|
||||
.reduce((v, x) => v * 1e5 + +x, 0);
|
||||
const versionKey = "@babel/plugin-regexp-features/version";
|
||||
|
||||
export function createRegExpFeaturePlugin({ name, feature, options = {} }) {
|
||||
|
||||
Reference in New Issue
Block a user