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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/babel-core/src/config/files/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ function* readConfigCode(

// @ts-expect-error todo(flow->ts)
if (typeof options.then === "function") {
// @ts-expect-error We use ?. in case options is a thenable
// but not a promise
// @ts-expect-error We use ?. in case options is a thenable but not a promise
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to trigger a babel/core release, as per #16694 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, I have a dedicate PR for that purpose: #16696

options.catch?.(() => {});

throw new ConfigError(
Expand Down
1 change: 1 addition & 0 deletions packages/babel-traverse/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./path/context.ts"; // We have some cycles, this ensures correct order to avoid TDZ
import * as visitors from "./visitors.ts";
import {
VISITOR_KEYS,
Expand Down
11 changes: 10 additions & 1 deletion packages/babel-traverse/src/scope/lib/renamer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { NodePath, Visitor } from "../../index.ts";
import { traverseNode } from "../../traverse-node.ts";
import { explode } from "../../visitors.ts";
import type { Identifier } from "@babel/types";
import { requeueComputedKeyAndDecorators } from "../../path/context.ts";

const renameVisitor: Visitor<Renamer> = {
ReferencedIdentifier({ node }, state) {
Expand All @@ -21,7 +22,15 @@ const renameVisitor: Visitor<Renamer> = {
) {
path.skip();
if (path.isMethod()) {
path.requeueComputedKeyAndDecorators();
if (
!process.env.BABEL_8_BREAKING &&
!path.requeueComputedKeyAndDecorators
) {
// See https://github.com/babel/babel/issues/16694
requeueComputedKeyAndDecorators.call(path);
} else {
path.requeueComputedKeyAndDecorators();
}
}
}
},
Expand Down
21 changes: 19 additions & 2 deletions packages/babel-traverse/src/visitors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "@babel/types";
import type { ExplodedVisitor, NodePath, Visitor } from "./index.ts";
import type { ExplVisitNode, VisitNodeFunction, VisitPhase } from "./types.ts";
import { requeueComputedKeyAndDecorators } from "./path/context.ts";

type VIRTUAL_TYPES = keyof typeof virtualTypes;
function isVirtualType(type: string): type is VIRTUAL_TYPES {
Expand Down Expand Up @@ -406,13 +407,29 @@ const _environmentVisitor: Visitor = {

path.skip();
if (path.isMethod()) {
path.requeueComputedKeyAndDecorators();
if (
!process.env.BABEL_8_BREAKING &&
!path.requeueComputedKeyAndDecorators
) {
// See https://github.com/babel/babel/issues/16694
requeueComputedKeyAndDecorators.call(path);
} else {
path.requeueComputedKeyAndDecorators();
}
}
},
Property(path) {
if (path.isObjectProperty()) return;
path.skip();
path.requeueComputedKeyAndDecorators();
if (
!process.env.BABEL_8_BREAKING &&
!path.requeueComputedKeyAndDecorators
) {
// See https://github.com/babel/babel/issues/16694
requeueComputedKeyAndDecorators.call(path);
} else {
path.requeueComputedKeyAndDecorators();
}
},
};

Expand Down