Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e15165

Browse files
Require exact Babel 8 version in assertVersion (#15955)
1 parent 418dd21 commit 1e15165

110 files changed

Lines changed: 545 additions & 118 deletions

File tree

  • eslint/babel-eslint-parser/src
  • packages
    • babel-core/src/config/helpers
    • babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/src
    • babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src
    • babel-plugin-external-helpers/src
    • babel-plugin-proposal-async-do-expressions/src
    • babel-plugin-proposal-decorators/src
    • babel-plugin-proposal-destructuring-private/src
    • babel-plugin-proposal-do-expressions/src
    • babel-plugin-proposal-duplicate-named-capturing-groups-regex/src
    • babel-plugin-proposal-explicit-resource-management/src
    • babel-plugin-proposal-export-default-from/src
    • babel-plugin-proposal-function-bind/src
    • babel-plugin-proposal-function-sent/src
    • babel-plugin-proposal-import-attributes-to-assertions/src
    • babel-plugin-proposal-partial-application/src
    • babel-plugin-proposal-pipeline-operator/src
    • babel-plugin-proposal-record-and-tuple/src
    • babel-plugin-proposal-regexp-modifiers/src
    • babel-plugin-proposal-throw-expressions/src
    • babel-plugin-syntax-async-do-expressions/src
    • babel-plugin-syntax-decimal/src
    • babel-plugin-syntax-decorators/src
    • babel-plugin-syntax-destructuring-private/src
    • babel-plugin-syntax-do-expressions/src
    • babel-plugin-syntax-explicit-resource-management/src
    • babel-plugin-syntax-export-default-from/src
    • babel-plugin-syntax-flow/src
    • babel-plugin-syntax-function-bind/src
    • babel-plugin-syntax-function-sent/src
    • babel-plugin-syntax-import-assertions/src
    • babel-plugin-syntax-import-attributes/src
    • babel-plugin-syntax-import-reflection/src
    • babel-plugin-syntax-jsx/src
    • babel-plugin-syntax-module-blocks/src
    • babel-plugin-syntax-partial-application/src
    • babel-plugin-syntax-pipeline-operator/src
    • babel-plugin-syntax-record-and-tuple/src
    • babel-plugin-syntax-throw-expressions/src
    • babel-plugin-syntax-typescript/src
    • babel-plugin-transform-arrow-functions/src
    • babel-plugin-transform-async-generator-functions/src
    • babel-plugin-transform-async-to-generator/src
    • babel-plugin-transform-block-scoped-functions/src
    • babel-plugin-transform-block-scoping/src
    • babel-plugin-transform-class-properties/src
    • babel-plugin-transform-class-static-block/src
    • babel-plugin-transform-classes/src
    • babel-plugin-transform-computed-properties/src
    • babel-plugin-transform-destructuring/src
    • babel-plugin-transform-dotall-regex/src
    • babel-plugin-transform-duplicate-keys/src
    • babel-plugin-transform-dynamic-import/src
    • babel-plugin-transform-exponentiation-operator/src
    • babel-plugin-transform-export-namespace-from/src
    • babel-plugin-transform-flow-comments/src
    • babel-plugin-transform-flow-strip-types/src
    • babel-plugin-transform-for-of/src
    • babel-plugin-transform-function-name/src
    • babel-plugin-transform-instanceof/src
    • babel-plugin-transform-jscript/src
    • babel-plugin-transform-json-strings/src
    • babel-plugin-transform-literals/src
    • babel-plugin-transform-logical-assignment-operators/src
    • babel-plugin-transform-member-expression-literals/src
    • babel-plugin-transform-modules-amd/src
    • babel-plugin-transform-modules-commonjs/src
    • babel-plugin-transform-modules-systemjs/src
    • babel-plugin-transform-modules-umd/src
    • babel-plugin-transform-new-target/src
    • babel-plugin-transform-nullish-coalescing-operator/src
    • babel-plugin-transform-numeric-separator/src
    • babel-plugin-transform-object-assign/src
    • babel-plugin-transform-object-rest-spread/src
    • babel-plugin-transform-object-set-prototype-of-to-assign/src
    • babel-plugin-transform-object-super/src
    • babel-plugin-transform-optional-catch-binding/src
    • babel-plugin-transform-optional-chaining/src
    • babel-plugin-transform-parameters/src
    • babel-plugin-transform-private-methods/src
    • babel-plugin-transform-private-property-in-object/src
    • babel-plugin-transform-property-literals/src
    • babel-plugin-transform-property-mutators/src
    • babel-plugin-transform-proto-to-assign/src
    • babel-plugin-transform-react-constant-elements/src
    • babel-plugin-transform-react-display-name/src
    • babel-plugin-transform-react-inline-elements/src
    • babel-plugin-transform-react-jsx-compat/src
    • babel-plugin-transform-react-jsx-self/src
    • babel-plugin-transform-react-jsx-source/src
    • babel-plugin-transform-react-pure-annotations/src
    • babel-plugin-transform-regenerator/src
    • babel-plugin-transform-reserved-words/src
    • babel-plugin-transform-runtime/src
    • babel-plugin-transform-shorthand-properties/src
    • babel-plugin-transform-spread/src
    • babel-plugin-transform-sticky-regex/src
    • babel-plugin-transform-strict-mode/src
    • babel-plugin-transform-template-literals/src
    • babel-plugin-transform-typeof-symbol/src
    • babel-plugin-transform-typescript/src
    • babel-plugin-transform-unicode-escapes/src
    • babel-plugin-transform-unicode-property-regex/src
    • babel-plugin-transform-unicode-regex/src
    • babel-plugin-transform-unicode-sets-regex/src
    • babel-preset-env/src
    • babel-preset-flow/src
    • babel-preset-react/src
    • babel-preset-typescript/src

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint/babel-eslint-parser/src/parse.cjs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ let isRunningMinSupportedCoreVersion = null;
1313

1414
module.exports = function parse(code, options, client) {
1515
// Ensure we're using a version of `@babel/core` that includes `parse()` and `tokTypes`.
16-
let minSupportedCoreVersion = ">=7.2.0";
17-
// TODO(Babel 8): Update all the version checks
18-
if (process.env.BABEL_8_BREAKING) {
19-
minSupportedCoreVersion += " || >=8.0.0-0";
20-
}
16+
const minSupportedCoreVersion =
17+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
18+
? PACKAGE_JSON.version
19+
: ">=7.2.0";
2120

2221
if (typeof isRunningMinSupportedCoreVersion !== "boolean") {
2322
isRunningMinSupportedCoreVersion = semver.satisfies(

packages/babel-core/src/config/helpers/config-api.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ function assertVersion(range: string | number): void {
120120
if (typeof range !== "string") {
121121
throw new Error("Expected string or integer value.");
122122
}
123-
// TODO(Babel 8): Update all the version checks
124-
if (process.env.BABEL_8_BREAKING) {
125-
range += ` || ^8.0.0-0`;
126-
}
127123

128124
if (semver.satisfies(coreVersion, range)) return;
129125

packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { declare } from "@babel/helper-plugin-utils";
22
import { shouldTransform } from "./util.ts";
33

44
export default declare(api => {
5-
api.assertVersion("^7.16.0");
5+
api.assertVersion(
6+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
7+
? PACKAGE_JSON.version
8+
: "^7.16.0",
9+
);
610

711
return {
812
name: "plugin-bugfix-safari-id-destructuring-collision-in-function-expression",

packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import type { NodePath } from "@babel/traverse";
55
import type * as t from "@babel/types";
66

77
export default declare(api => {
8-
api.assertVersion(7);
8+
api.assertVersion(
9+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
10+
? PACKAGE_JSON.version
11+
: 7,
12+
);
913

1014
const noDocumentAll = api.assumption("noDocumentAll") ?? false;
1115
const pureGetters = api.assumption("pureGetters") ?? false;

packages/babel-plugin-external-helpers/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export interface Options {
77
}
88

99
export default declare((api, options: Options) => {
10-
api.assertVersion(7);
10+
api.assertVersion(
11+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
12+
? PACKAGE_JSON.version
13+
: 7,
14+
);
1115

1216
const { helperVersion = "7.0.0-beta.0", whitelist = false } = options;
1317

packages/babel-plugin-proposal-async-do-expressions/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import hoistVariables from "@babel/helper-hoist-variables";
44
import type * as t from "@babel/types";
55

66
export default declare(({ types: t, assertVersion }) => {
7-
assertVersion("^7.13.0");
7+
assertVersion(
8+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
9+
? PACKAGE_JSON.version
10+
: "^7.13.0",
11+
);
812

913
return {
1014
name: "proposal-async-do-expressions",

packages/babel-plugin-proposal-decorators/src/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ interface Options extends SyntaxOptions {
1818
export type { Options };
1919

2020
export default declare((api, options: Options) => {
21-
api.assertVersion(7);
21+
api.assertVersion(
22+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
23+
? PACKAGE_JSON.version
24+
: 7,
25+
);
2226

2327
// Options are validated in @babel/plugin-syntax-decorators
2428
if (!process.env.BABEL_8_BREAKING) {
@@ -45,7 +49,11 @@ export default declare((api, options: Options) => {
4549
) {
4650
return transformer2023_05(api, options, version);
4751
} else if (!process.env.BABEL_8_BREAKING) {
48-
api.assertVersion("^7.0.2");
52+
api.assertVersion(
53+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
54+
? PACKAGE_JSON.version
55+
: "^7.0.2",
56+
);
4957
return createClassFeaturePlugin({
5058
name: "proposal-decorators",
5159

packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ export default function (
12051205
version: "2023-05" | "2023-01" | "2022-03" | "2021-12",
12061206
): PluginObject {
12071207
if (process.env.BABEL_8_BREAKING) {
1208-
assertVersion("^7.21.0");
1208+
assertVersion(process.env.IS_PUBLISH ? PACKAGE_JSON.version : "^7.21.0");
12091209
} else {
12101210
if (version === "2023-05" || version === "2023-01") {
12111211
assertVersion("^7.21.0");

packages/babel-plugin-proposal-destructuring-private/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ import type { NodePath, Visitor } from "@babel/traverse";
1414
import type * as t from "@babel/types";
1515

1616
export default declare(function ({ assertVersion, assumption, types: t }) {
17-
assertVersion("^7.17.0");
17+
assertVersion(
18+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
19+
? PACKAGE_JSON.version
20+
: "^7.17.0",
21+
);
1822
const {
1923
assignmentExpression,
2024
assignmentPattern,

packages/babel-plugin-proposal-do-expressions/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { declare } from "@babel/helper-plugin-utils";
22
import syntaxDoExpressions from "@babel/plugin-syntax-do-expressions";
33

44
export default declare(api => {
5-
api.assertVersion(7);
5+
api.assertVersion(
6+
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
7+
? PACKAGE_JSON.version
8+
: 7,
9+
);
610

711
return {
812
name: "proposal-do-expressions",

0 commit comments

Comments
 (0)