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

worker: remove --experimental-worker flag #25361

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/misc/startup.js
Expand Up @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
mode: ['process', 'worker']
}, {
flags: ['--expose-internals', '--experimental-worker'] // for workers
flags: ['--expose-internals'] // for workers
addaleax marked this conversation as resolved.
Show resolved Hide resolved
});

function spawnProcess(script) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/worker/echo.js
Expand Up @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
payload: ['string', 'object'],
sendsPerBroadcast: [1, 10],
n: [1e5]
}, { flags: ['--experimental-worker'] });
});

const workerPath = path.resolve(__dirname, '..', 'fixtures', 'echo.worker.js');

Expand Down
8 changes: 0 additions & 8 deletions doc/api/cli.md
Expand Up @@ -104,13 +104,6 @@ added: v9.6.0

Enable experimental ES Module support in the `vm` module.

### `--experimental-worker`
<!-- YAML
added: v10.5.0
-->

Enable experimental worker threads using the `worker_threads` module.

### `--force-fips`
<!-- YAML
added: v6.0.0
Expand Down Expand Up @@ -620,7 +613,6 @@ Node.js options that are allowed are:
- `--experimental-modules`
- `--experimental-repl-await`
- `--experimental-vm-modules`
- `--experimental-worker`
- `--force-fips`
- `--icu-data-dir`
- `--inspect`
Expand Down
2 changes: 1 addition & 1 deletion doc/api/worker_threads.md
Expand Up @@ -6,7 +6,7 @@

The `worker` module provides a way to create multiple environments running
on independent threads, and to create message channels between them. It
can be accessed using the `--experimental-worker` flag and:
can be accessed using:

```js
const worker = require('worker_threads');
Expand Down
3 changes: 0 additions & 3 deletions doc/node.1
Expand Up @@ -94,9 +94,6 @@ keyword support in REPL.
.It Fl -experimental-vm-modules
Enable experimental ES module support in VM module.
.
.It Fl -experimental-worker
Enable experimental worker threads using worker_threads module.
.
.It Fl -force-fips
Force FIPS-compliant crypto on startup
(Cannot be disabled from script code).
Expand Down
3 changes: 1 addition & 2 deletions lib/internal/bootstrap/loaders.js
Expand Up @@ -253,8 +253,7 @@ if (config.exposeInternals) {
};

NativeModule.isInternal = function(id) {
return id.startsWith('internal/') ||
(id === 'worker_threads' && !config.experimentalWorker);
return id.startsWith('internal/');
};
}

Expand Down
4 changes: 1 addition & 3 deletions lib/internal/bootstrap/node.js
Expand Up @@ -187,9 +187,7 @@ function startup() {
setupQueueMicrotask();
}

if (getOptionValue('--experimental-worker')) {
setupDOMException();
}
setupDOMException();

// On OpenBSD process.execPath will be relative unless we
// get the full path before process.execPath is used.
Expand Down
9 changes: 1 addition & 8 deletions lib/internal/modules/cjs/helpers.js
Expand Up @@ -9,8 +9,6 @@ const {
CHAR_HASH,
} = require('internal/constants');

const { getOptionValue } = require('internal/options');

// Invoke with makeRequireFunction(module) where |module| is the Module object
// to use as the context for the require() function.
function makeRequireFunction(mod) {
Expand Down Expand Up @@ -100,14 +98,9 @@ const builtinLibs = [
'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'http2', 'https', 'net',
'os', 'path', 'perf_hooks', 'punycode', 'querystring', 'readline', 'repl',
'stream', 'string_decoder', 'tls', 'trace_events', 'tty', 'url', 'util',
'v8', 'vm', 'zlib'
'v8', 'vm', 'worker_threads', 'zlib'
];

if (getOptionValue('--experimental-worker')) {
builtinLibs.push('worker_threads');
builtinLibs.sort();
}

if (typeof internalBinding('inspector').open === 'function') {
builtinLibs.push('inspector');
builtinLibs.sort();
Expand Down
3 changes: 0 additions & 3 deletions src/node_config.cc
Expand Up @@ -85,9 +85,6 @@ static void Initialize(Local<Object> target,
if (env->options()->experimental_vm_modules)
READONLY_TRUE_PROPERTY(target, "experimentalVMModules");

if (env->options()->experimental_worker)
READONLY_TRUE_PROPERTY(target, "experimentalWorker");

if (env->options()->experimental_repl_await)
READONLY_TRUE_PROPERTY(target, "experimentalREPLAwait");

Expand Down
5 changes: 1 addition & 4 deletions src/node_options.cc
Expand Up @@ -104,10 +104,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental ES Module support in vm module",
&EnvironmentOptions::experimental_vm_modules,
kAllowedInEnvironment);
AddOption("--experimental-worker",
"experimental threaded Worker support",
&EnvironmentOptions::experimental_worker,
kAllowedInEnvironment);
AddOption("--experimental-worker", "", NoOp{}, kAllowedInEnvironment);
AddOption("--expose-internals", "", &EnvironmentOptions::expose_internals);
AddOption("--http-parser",
"Select which HTTP parser to use; either 'legacy' or 'llhttp' "
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Expand Up @@ -95,7 +95,6 @@ class EnvironmentOptions : public Options {
bool experimental_modules = false;
bool experimental_repl_await = false;
bool experimental_vm_modules = false;
bool experimental_worker = false;
bool expose_internals = false;
std::string http_parser = "llhttp";
bool no_deprecation = false;
Expand Down
4 changes: 1 addition & 3 deletions test/abort/test-addon-uv-handle-leak.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down Expand Up @@ -36,8 +35,7 @@ if (process.argv[2] === 'child') {
binding.leakHandle(0x42);
`, { eval: true });
} else {
const child = cp.spawnSync(process.execPath,
['--experimental-worker', __filename, 'child']);
const child = cp.spawnSync(process.execPath, [__filename, 'child']);
const stderr = child.stderr.toString();

assert.strictEqual(child.stdout.toString(), '');
Expand Down
1 change: 0 additions & 1 deletion test/addons/hello-world/test-worker.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
Expand Down
2 changes: 0 additions & 2 deletions test/addons/worker-addon/test.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
Expand All @@ -11,7 +10,6 @@ if (process.argv[2] === 'child') {
new Worker(`require(${JSON.stringify(binding)});`, { eval: true });
} else {
const proc = child_process.spawnSync(process.execPath, [
'--experimental-worker',
__filename,
'child'
]);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-async-wrap-missing-method.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-heapdump-worker.js
@@ -1,4 +1,4 @@
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
'use strict';
require('../common');
const { validateSnapshotNodes } = require('../common/heap');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-module-cjs-helpers.js
@@ -1,5 +1,5 @@
'use strict';
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-trace-events-api-worker-disabled.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
4 changes: 1 addition & 3 deletions test/parallel/test-trace-events-worker-metadata.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand All @@ -15,8 +14,7 @@ if (isMainThread) {
process.chdir(tmpdir.path);

const proc = cp.spawn(process.execPath,
[ '--experimental-worker',
'--trace-event-categories', 'node',
[ '--trace-event-categories', 'node',
'-e', CODE ]);
proc.once('exit', common.mustCall(() => {
assert(fs.existsSync(FILE_NAME));
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-v8-coverage.js
Expand Up @@ -87,7 +87,6 @@ function nextdir() {
{
const coverageDirectory = path.join(tmpdir.path, nextdir());
const output = spawnSync(process.execPath, [
'--experimental-worker',
require.resolve('../fixtures/v8-coverage/worker')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
assert.strictEqual(output.status, 0);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-cleanup-handles.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
5 changes: 2 additions & 3 deletions test/parallel/test-worker-debug.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

Expand Down Expand Up @@ -154,9 +153,9 @@ async function testBasicWorkerDebug(session, post) {
await workerSession.post('Debugger.enable');
await workerSession.post('Runtime.enable');
await workerSession.waitForBreakAfterCommand(
'Runtime.runIfWaitingForDebugger', __filename, 2);
'Runtime.runIfWaitingForDebugger', __filename, 1);
await workerSession.waitForBreakAfterCommand(
'Debugger.resume', __filename, 27); // V8 line number is zero-based
'Debugger.resume', __filename, 26); // V8 line number is zero-based
assert.strictEqual(await consolePromise, workerMessage);
workerSession.post('Debugger.resume');
await Promise.all([worker, detached, contextEvents]);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-dns-terminate.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-esmodule.js
@@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-modules
// Flags: --experimental-modules
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-exit-code.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-invalid-workerdata.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-memory.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
@@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-channel.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-arraybuffer.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-drain.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');

Expand Down
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-transfer-closed.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-transfer-self.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-transfer-target.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-wasm-module.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-message-port-wasm-threads.js
@@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-wasm-threads
// Flags: --experimental-wasm-threads
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const { Worker, MessageChannel } = require('worker_threads');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-nexttick-terminate.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-onmessage-not-a-function.js
Expand Up @@ -3,7 +3,6 @@
// listener from holding the event loop open. This test confirms that
// functionality.

// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker, parentPort } = require('worker_threads');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-onmessage.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-parent-port-ref.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const assert = require('assert');
const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-relative-path-double-dot.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-relative-path.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-stdio.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-syntax-error-file.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-syntax-error.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-type-check.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-uncaught-exception-async.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-uncaught-exception.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-unsupported-path.js
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const path = require('path');
Expand Down