Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE: Change textlint-scirpts output target #1345

Merged
merged 13 commits into from
Feb 1, 2024

Conversation

azu
Copy link
Member

@azu azu commented Feb 1, 2024

Summary

textlint-script builds output ES2022-compatible code.
Previously, the output is ES2015-compatible code.

Modern browsers and Node.js LTS support ES2022.

Details

In this PR, the target code for textlint-script output is changed to Node.js v18.14.0 or later.

This will reduce the cost of output code size and runtime.
The default target is the minimum version of node.js supported by the text link.
In other words, it is Node.js v18.14.0>=.
Runtime(browser/node.js) require to support ES2022+.

close #1344
refs #1200

@azu azu added the Type: Breaking Change Includes breaking changes label Feb 1, 2024
function _default(context, options = {}) {
const { Syntax, RuleError, report, getSource } = context;
return {
async [Syntax.Document](node) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The output remain native async await.

Comment on lines 9 to 13
{
// For async/await support
// https://babeljs.io/docs/en/babel-preset-env#targetsesmodules
targets: {
esmodules: true
// Same version with textlint's supported Node.js version
node: "18.14.0"
},
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 main change.

  • ES2015 → ES2022

Comment on lines +36 to +38
"engines": {
"node": ">=18.19.0"
},
Copy link
Member Author

@azu azu Feb 1, 2024

Choose a reason for hiding this comment

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

textlint-scriptsr requires latest Node.js 18.x.
In the future, we might implement the hook processing using the node:module register API, so I'm choosing the latest version, 18.19.0.

@azu azu changed the title BREAKING CHANGE: Change textlint-scirpt output target BREAKING CHANGE: Change textlint-scirpts output target Feb 1, 2024
@azu azu merged commit 1db0093 into master Feb 1, 2024
17 checks passed
@azu azu deleted the textlint-script-target branch February 1, 2024 13:55
@github-actions github-actions bot mentioned this pull request Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Breaking Change Includes breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update textlint-script default target
1 participant