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

Skip to content

Remove BABEL_TYPES_8_BREAKING flag and enable it by default#16817

Merged
nicolo-ribaudo merged 5 commits into
babel:mainfrom
liuxingbaoyu:BABEL_TYPES_8_BREAKING
Sep 16, 2024
Merged

Remove BABEL_TYPES_8_BREAKING flag and enable it by default#16817
nicolo-ribaudo merged 5 commits into
babel:mainfrom
liuxingbaoyu:BABEL_TYPES_8_BREAKING

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu commented Sep 8, 2024

Q                       A
Fixed Issues? Fixes #16097
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Sep 8, 2024

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57948

),
),
default: !process.env.BABEL_TYPES_8_BREAKING ? [] : undefined,
default: !process.env.BABEL_8_BREAKING ? [] : undefined,
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo Sep 8, 2024

Choose a reason for hiding this comment

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

Can we warn if somebody uses the old one? Like, with this at the beginning of the file:

if (!process.env.BABEL_8_BREAKING && process.env.BABEL_TYPES_8_BREAKING) {
  console.warn("BABEL_TYPES_8_BREAKING is not supported anymore. Use the latest Babel 8.0.0 pre-release instead!");
}

Comment on lines 51 to 53
if (!process.env.BABEL_8_BREAKING) {
return assertValueType("string");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets use a if...else, so that the else block can be removed at build time.

assertValueType("string"),
Object.assign(
function (node, key, val) {
const invalid = /[^gimsuy]/.exec(val);
Copy link
Copy Markdown
Member Author

@liuxingbaoyu liuxingbaoyu Sep 9, 2024

Choose a reason for hiding this comment

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

Something seems wrong here, at least has v?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

v and d

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

Do you think it's fine to merge this in a patch release? People shouldn't rely on this flag on production anyway.

@nicolo-ribaudo
Copy link
Copy Markdown
Member

Actually, looking at https://github.com/search?q=BABEL_TYPES_8_BREAKING&type=code there is significant usage of this flag, even set to true.

@liuxingbaoyu Would it be ok for what we need to do process.end.BABEL_8_BREAKING || process.env.BABEL_TYPES_8_BREAKING, so that the flag is still present in Babel 7?

@liuxingbaoyu
Copy link
Copy Markdown
Member Author

@liuxingbaoyu Would it be ok for what we need to do process.end.BABEL_8_BREAKING || process.env.BABEL_TYPES_8_BREAKING, so that the flag is still present in Babel 7?

It's fine for me.

Also it seems that BABEL_TYPES_8_BREAKING will only make node validation stricter, and even without it there may not be any breaking changes.

@liuxingbaoyu
Copy link
Copy Markdown
Member Author

It occurs to me that this still can't be avoided #16097. 😭

@nicolo-ribaudo nicolo-ribaudo added the PR: Internal (next major) 🏠 A type of pull request used for our changelog categories for next major release label Sep 12, 2024
@nicolo-ribaudo nicolo-ribaudo changed the title Migrate BABEL_TYPES_8_BREAKING to BABEL_8_BREAKING Remove BABEL_TYPES_8_BREAKING flag and enable it by default Sep 12, 2024
Comment on lines +1665 to +1672
assertions: {
deprecated: true,
optional: true,
validate: chain(
assertValueType("array"),
assertEach(assertNodeType("ImportAttribute")),
),
},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I reverted the changes from a previous PR to this and added deprecated, because otherwise any would break our type system.

@nicolo-ribaudo nicolo-ribaudo merged commit 506bf91 into babel:main Sep 16, 2024
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 17, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal (next major) 🏠 A type of pull request used for our changelog categories for next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BABEL_TYPES_8_BREAKING has performance impact

4 participants