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 <yagiz.nizipli@sentry.io>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
panva committed 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.