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 <vinyldarkscratch@gmail.com>
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <vinyldarkscratch@gmail.com>
|
@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.
✅ 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.
✅ Makes sense based on parent change.
| "nodejs": { | ||
| "version_added": "11.7.0" | ||
| }, |
There was a problem hiding this comment.
✅ 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`." |
| "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.
✅ 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`." | ||
| } | ||
| ], |
| "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.
✅ 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." |
Co-authored-by: Claas Augner <495429+caugner@users.noreply.github.com>
WorkerWorker + 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
errorevent is confirmed with the intial pr nodejs/node#20876the data for
messageerrorevent 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