Skip to content

Commit

Permalink
worker: remove --experimental-worker flag
Browse files Browse the repository at this point in the history
Having an experimental feature behind a flag makes change
if we are expecting significant breaking changes to its API.

Since the Worker API has been essentially stable since
its initial introduction, and no noticeable doubt about
possibly not keeping the feature around has been voiced,
removing the flag and thereby reducing the barrier to experimentation,
and consequently receiving feedback on the implementation,
seems like a good idea.

PR-URL: #25361
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Shingo Inoue <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Masashi Hirano <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
addaleax authored and BridgeAR committed Jan 17, 2019
1 parent 6cdaf03 commit 243f902
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 21 deletions.
3 changes: 1 addition & 2 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,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
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,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
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,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
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class EnvironmentOptions : public Options {
bool experimental_modules = false;
bool experimental_repl_await = false;
bool experimental_vm_modules = false;
bool experimental_worker = true;
bool expose_internals = false;
std::string http_parser =
#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT
Expand Down

0 comments on commit 243f902

Please sign in to comment.