Skip to content

Commit d9cf2df

Browse files
committed
Drop old versions
1 parent a37aa37 commit d9cf2df

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313
- 23
1414
- 22
1515
- 20
16-
- 18
17-
- 16
1816
steps:
1917
- uses: actions/checkout@v4
2018
- uses: actions/setup-node@v4

index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default function makeSynchronous(function_) {
1111
const serializedArguments = v8.serialize(arguments_).toString('hex');
1212
const subsume = new Subsume();
1313

14-
// TODO: Use top-level await here when targeting Node.js 14.
1514
const input = `
1615
import v8 from 'node:v8';
1716
import Subsume from 'subsume';
@@ -23,15 +22,13 @@ export default function makeSynchronous(function_) {
2322
process.stdout.write(subsume.compose(serialized));
2423
};
2524
26-
(async () => {
27-
try {
28-
const arguments_ = v8.deserialize(Buffer.from('${serializedArguments}', 'hex'));
29-
const result = await (${function_})(...arguments_);
30-
send({result});
31-
} catch (error) {
32-
send({error});
33-
}
34-
})();
25+
try {
26+
const arguments_ = v8.deserialize(Buffer.from('${serializedArguments}', 'hex'));
27+
const result = await (${function_})(...arguments_);
28+
send({result});
29+
} catch (error) {
30+
send({error});
31+
}
3532
`;
3633

3734
const {error: subprocessError, stdout, stderr} = childProcess.spawnSync(process.execPath, ['--input-type=module', '-'], {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
},
2424
"engines": {
25-
"node": ">=16.0.0"
25+
"node": ">=20.0.0"
2626
},
2727
"scripts": {
2828
"test": "xo && ava && tsd"

worker.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,10 @@ function makeSynchronous(function_) {
2828
function createWorker() {
2929
if (!cache) {
3030
const code = `
31-
import(${JSON.stringify(import.meta.url)})
32-
.then(({default: setupWorker}) => setupWorker(${function_}));
33-
`;
34-
35-
// TODO: Use this one when targeting Node.js 20.
36-
// const code = `
37-
// import setupWorker from ${JSON.stringify(import.meta.url)};
31+
import setupWorker from ${JSON.stringify(import.meta.url)};
3832
39-
// setupWorker(${function_});
40-
// `;
33+
setupWorker(${function_});
34+
`;
4135

4236
const worker = new Worker(code, {
4337
eval: true,

0 commit comments

Comments
 (0)