-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Conversation
…tible with Node.js 18 or later. It aims to reduce output code size
function _default(context, options = {}) { | ||
const { Syntax, RuleError, report, getSource } = context; | ||
return { | ||
async [Syntax.Document](node) { |
There was a problem hiding this comment.
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.
{ | ||
// 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" | ||
}, |
There was a problem hiding this comment.
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
"engines": { | ||
"node": ">=18.19.0" | ||
}, |
There was a problem hiding this comment.
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.
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