Skip to content

Commit

Permalink
cli: remove --no-experimental-fetch flag
Browse files Browse the repository at this point in the history
PR-URL: nodejs#52611
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matthew Aitken <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
panva authored Apr 22, 2024
1 parent 01c281f commit 3115041
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 42 deletions.
10 changes: 0 additions & 10 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1364,14 +1364,6 @@ added: v0.8.0

Silence deprecation warnings.

### `--no-experimental-fetch`

<!-- YAML
added: v18.0.0
-->

Disable exposition of [Fetch API][] on the global scope.

### `--no-experimental-global-customevent`

<!-- YAML
Expand Down Expand Up @@ -2690,7 +2682,6 @@ one is included in the list below.
* `--network-family-autoselection-attempt-timeout`
* `--no-addons`
* `--no-deprecation`
* `--no-experimental-fetch`
* `--no-experimental-global-customevent`
* `--no-experimental-global-navigator`
* `--no-experimental-repl-await`
Expand Down Expand Up @@ -3166,7 +3157,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
[DEP0025 warning]: deprecations.md#dep0025-requirenodesys
[ECMAScript module]: esm.md#modules-ecmascript-modules
[ExperimentalWarning: `vm.measureMemory` is an experimental feature]: vm.md#vmmeasurememoryoptions
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[File System Permissions]: permissions.md#file-system-permissions
[Loading ECMAScript modules using `require()`]: modules.md#loading-ecmascript-modules-using-require
[Module customization hooks]: module.md#customization-hooks
Expand Down
3 changes: 0 additions & 3 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ Use this flag to enable ShadowRealm support.
.It Fl -experimental-test-coverage
Enable code coverage in the test runner.
.
.It Fl -no-experimental-fetch
Disable experimental support for the Fetch API.
.
.It Fl -no-experimental-websocket
Disable experimental support for the WebSocket API.
.
Expand Down
13 changes: 2 additions & 11 deletions lib/internal/process/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function prepareExecution(options) {
setupInspectorHooks();
setupNavigator();
setupWarningHandler();
setupUndici();
setupWebsocket();
setupCustomEvent();
setupCodeCoverage();
setupDebugEnv();
Expand Down Expand Up @@ -308,17 +308,8 @@ function setupWarningHandler() {
}
}

// https://fetch.spec.whatwg.org/
// https://websockets.spec.whatwg.org/
function setupUndici() {
if (getOptionValue('--no-experimental-fetch')) {
delete globalThis.fetch;
delete globalThis.FormData;
delete globalThis.Headers;
delete globalThis.Request;
delete globalThis.Response;
}

function setupWebsocket() {
if (getOptionValue('--no-experimental-websocket')) {
delete globalThis.WebSocket;
}
Expand Down
6 changes: 1 addition & 5 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
&EnvironmentOptions::enable_source_maps,
kAllowedInEnvvar);
AddOption("--experimental-abortcontroller", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-fetch",
"experimental Fetch API",
&EnvironmentOptions::experimental_fetch,
kAllowedInEnvvar,
true);
AddOption("--experimental-fetch", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-websocket",
"experimental WebSocket API",
&EnvironmentOptions::experimental_websocket,
Expand Down
13 changes: 0 additions & 13 deletions test/parallel/test-fetch-disabled.mjs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const undocumented = difference(process.allowedNodeEnvironmentFlags,
assert(undocumented.delete('--debug-arraybuffer-allocations'));
assert(undocumented.delete('--no-debug-arraybuffer-allocations'));
assert(undocumented.delete('--es-module-specifier-resolution'));
assert(undocumented.delete('--experimental-fetch'));
assert(undocumented.delete('--experimental-global-webcrypto'));
assert(undocumented.delete('--experimental-report'));
assert(undocumented.delete('--experimental-worker'));
Expand Down

0 comments on commit 3115041

Please sign in to comment.