-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Node.js 11.7+ supports Worker
+ related updates
#25012
Conversation
This pull request has merge conflicts that must be resolved before it can be merged. |
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]>
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]>
@queengooborg Can you PTAL at this PR when you have a moment? |
"nodejs": { | ||
"version_added": "11.7.0", | ||
"partial_implementation": true, | ||
"notes": [ | ||
"Inherits from a Node `EventEmitter` instead of DOM `EventTarget`.", | ||
"Also supports CommonJS modules, enabled for files ending with `.cjs` and for files ending with `.js` when the nearest parent `package.json` file contains a top-level field `\"type\"` with a value not of `\"commonjs\"`.", | ||
"Available as a part of the `worker_threads` module." | ||
] | ||
}, |
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.
✅ Verified that worker_threads.Worker
exists in v12.0.0, which seems to be the gist of this change.
"nodejs": { | ||
"version_added": "11.7.0", | ||
"partial_implementation": true, | ||
"notes": "Takes entirely different options parameters." | ||
}, |
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.
✅ Makes sense based on parent change.
"nodejs": { | ||
"version_added": "11.7.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.
✅ Verified locally with this worker.js
, created via new worker_threads.Worker('./worker.js')
:
const { Worker } = require('worker_threads');
const { writeFileSync } = require('fs');
writeFileSync('./worker.log', Worker, 'utf-8');
"version_added": "11.7.0", | ||
"partial_implementation": true, | ||
"notes": "Supports the event, but only via Node `EventEmitter`." |
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.
✅ Verified locally.
"nodejs": { | ||
"version_added": "11.7.0", | ||
"partial_implementation": true, | ||
"notes": "Supports the event, but only via Node `EventEmitter`." | ||
}, |
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.
✅ Makes sense based on parent change.
"nodejs": [ | ||
{ | ||
"version_added": "14.5.0", | ||
"partial_implementation": true, | ||
"notes": "Supports the event, but only via Node `EventEmitter`." | ||
}, | ||
{ | ||
"version_added": "12.19.0", | ||
"version_removed": "13.0.0", | ||
"partial_implementation": true, | ||
"notes": "Supports the event, but only via Node `EventEmitter`." | ||
} | ||
], |
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.
✅ Verified via the referenced PR.
api/Worker.json
Outdated
"nodejs": { | ||
"version_added": "11.7.0", | ||
"partial_implementation": true, | ||
"notes": [ | ||
"The options parameter is not supported; the second parameter may only be an array of objects to transfer.", | ||
"Only supports transferring `ArrayBuffer` and `MessagePort` objects." | ||
] | ||
}, |
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.
✅ Makes sense based on parent change.
New note:
The options parameter is not supported; the second parameter may only be an array of objects to transfer.
}, | ||
{ | ||
"version_added": "11.7.0", | ||
"partial_implementation": true, | ||
"notes": "Also takes an optional callback to be executed when the worker has terminated." | ||
"notes": "Takes an optional callback parameter to be executed when the worker has terminated." |
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.
✅ Both verified locally.
Co-authored-by: Claas Augner <[email protected]>
Worker
Worker
+ related updates
Requested changes were applied.
Summary
update the data for
Worker
, as there is already a ecmascript_modules field shows the ESM supportthe data for
error
event is confirmed with the intial pr nodejs/node#20876the data for
messageerror
event andterminate()
method come from the documentation, also confirmed by release and impl prhttps://nodejs.org/zh-cn/blog/release/v12.19.0
https://nodejs.org/zh-cn/blog/release/v14.5.0
nodejs/node#33772
https://nodejs.org/zh-cn/blog/release/v12.5.0
nodejs/node#28021
Test results and supporting details
confirmed by landing PRs and release notes
also test in local node runtime:
Related issues