Skip to content

Commit 26a1dc8

Browse files
committed
vfs: unflag
Signed-off-by: Matteo Collina <hello@matteocollina.com>
1 parent 95279e7 commit 26a1dc8

134 files changed

Lines changed: 182 additions & 225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎doc/api/cli.md‎

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ so mounting one is gated on its own flag rather than on `--allow-fs-read` or
285285
`--allow-fs-write`.
286286

287287
```console
288-
$ node --experimental-vfs --permission --allow-fs-vfs app.js
288+
$ node --permission --allow-fs-vfs app.js
289289
```
290290

291291
### `--allow-fs-write`
@@ -1671,16 +1671,6 @@ with AND, so a test must satisfy every expression to run.
16711671
A malformed expression causes the test runner to exit with a non-zero status
16721672
before running any tests.
16731673

1674-
### `--experimental-vfs`
1675-
1676-
<!-- YAML
1677-
added: v26.4.0
1678-
-->
1679-
1680-
> Stability: 1 - Experimental
1681-
1682-
Enable the experimental [`node:vfs`][] module.
1683-
16841674
### `--experimental-vm-modules`
16851675

16861676
<!-- YAML
@@ -3859,7 +3849,7 @@ added: v26.10.0
38593849

38603850
* `source` {string} A directory or an archive file to mount and run.
38613851

3862-
Requires [`--experimental-vfs`][]. May be given at most once.
3852+
May be given at most once.
38633853

38643854
Mounts `source` as a virtual file system ([`node:vfs`][]), and runs the entry
38653855
point and all subsequent `require()`/`import` resolution against that mount
@@ -3894,18 +3884,17 @@ same thing in all of them.
38943884

38953885
A worker created with its own `execArgv` inherits none of the parent's options,
38963886
and so does not mount the source at all. To run a script from the mount, such a
3897-
worker must be given the same options again, `--experimental-vfs` and
3898-
`--vfs-load`; without them, that thread has no mount for the script to come
3899-
from, and the worker fails to load it. `--experimental-vfs` is also what makes
3900-
[`node:vfs`][] available to the worker's own code. A worker whose script comes
3901-
from anywhere else, such as the real file system, needs nothing added.
3887+
worker must be given `--vfs-load` again; without it, that thread has no mount
3888+
for the script to come from, and the worker fails to load it. [`node:vfs`][] is
3889+
available to worker code without an experimental flag. A worker whose script
3890+
comes from anywhere else, such as the real file system, needs nothing added.
39023891

39033892
`--vfs-load` is not permitted in [`NODE_OPTIONS`][]: which entry point runs is
39043893
the command line's decision, and the environment must not be able to redirect
39053894
it.
39063895

39073896
```console
3908-
$ node --experimental-vfs --vfs-load=app.zip
3897+
$ node --vfs-load=app.zip
39093898
```
39103899

39113900
### `--watch`
@@ -4231,7 +4220,6 @@ one is included in the list below.
42314220
* `--experimental-stream-iter`
42324221
* `--experimental-test-isolation`
42334222
* `--experimental-top-level-await`
4234-
* `--experimental-vfs`
42354223
* `--experimental-vm-modules`
42364224
* `--experimental-wasi-unstable-preview1`
42374225
* `--experimental-web-worker`
@@ -4864,7 +4852,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
48644852
[`--env-file-if-exists`]: #--env-file-if-existsfile
48654853
[`--env-file`]: #--env-filefile
48664854
[`--experimental-sea-config`]: single-executable-applications.md#1-generating-single-executable-preparation-blobs
4867-
[`--experimental-vfs`]: #--experimental-vfs
48684855
[`--heap-prof-dir`]: #--heap-prof-dir
48694856
[`--import`]: #--importmodule
48704857
[`--no-require-module`]: #--no-require-module

‎doc/api/vfs.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import vfs from 'node:vfs';
2424
const vfs = require('node:vfs');
2525
```
2626

27-
This module is only available under the `node:` scheme, and only when Node.js
28-
is started with the `--experimental-vfs` flag.
27+
This module is only available under the `node:` scheme. Loading it emits an
28+
`ExperimentalWarning`.
2929

3030
## Security
3131

@@ -77,8 +77,9 @@ added: v26.4.0
7777
* `provider` {VirtualProvider} The provider to use. **Default:**
7878
`new MemoryProvider()`.
7979
* `options` {Object}
80-
* `emitExperimentalWarning` {boolean} Whether to emit the experimental
81-
warning when the instance is created. **Default:** `true`.
80+
* `emitExperimentalWarning` {boolean} Whether to emit an experimental warning
81+
when an instance is created. **Default:** `true`. Loading `node:vfs` emits
82+
the warning regardless of this option.
8283
* Returns: {VirtualFileSystem}
8384

8485
Convenience factory equivalent to `new VirtualFileSystem(provider, options)`.
@@ -148,7 +149,7 @@ vfs.registerProvider({
148149
```
149150

150151
```console
151-
$ node --experimental-vfs --require ./provider.js \
152+
$ node --require ./provider.js \
152153
--vfs-load archive.customfmt
153154
```
154155

@@ -193,8 +194,9 @@ added: v26.4.0
193194
* `provider` {VirtualProvider} The provider to use. **Default:**
194195
`new MemoryProvider()`.
195196
* `options` {Object}
196-
* `emitExperimentalWarning` {boolean} Whether to emit the experimental
197-
warning. **Default:** `true`.
197+
* `emitExperimentalWarning` {boolean} Whether to emit an experimental warning
198+
when an instance is created. **Default:** `true`. Loading `node:vfs` emits
199+
the warning regardless of this option.
198200

199201
### `vfs.mount()`
200202

‎doc/node.1‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ A mounted VFS serves paths that the file system permissions do not describe,
174174
so mounting one is gated on its own flag rather than on \fB--allow-fs-read\fR or
175175
\fB--allow-fs-write\fR.
176176
.Bd -literal
177-
$ node --experimental-vfs --permission --allow-fs-vfs app.js
177+
$ node --permission --allow-fs-vfs app.js
178178
.Ed
179179
.
180180
.It Fl -allow-fs-write
@@ -896,9 +896,6 @@ with AND, so a test must satisfy every expression to run.
896896
A malformed expression causes the test runner to exit with a non-zero status
897897
before running any tests.
898898
.
899-
.It Fl -experimental-vfs
900-
Enable the experimental \fBnode:vfs\fR module.
901-
.
902899
.It Fl -experimental-vm-modules
903900
Enable experimental ES Module support in the \fBnode:vm\fR module.
904901
.
@@ -1932,7 +1929,7 @@ Print node's version.
19321929
.It
19331930
\fBsource\fR \fB{string}\fR A directory or an archive file to mount and run.
19341931
.El
1935-
Requires \fB--experimental-vfs\fR. May be given at most once.
1932+
May be given at most once.
19361933
Mounts \fBsource\fR as a virtual file system (\fBnode:vfs\fR), and runs the entry
19371934
point and all subsequent \fBrequire()\fR/\fBimport\fR resolution against that mount
19381935
rather than the real file system. The mount is placed at a reserved mount point
@@ -1963,16 +1960,15 @@ mounts it, whatever else that thread mounts, so a path into the mount means the
19631960
same thing in all of them.
19641961
A worker created with its own \fBexecArgv\fR inherits none of the parent's options,
19651962
and so does not mount the source at all. To run a script from the mount, such a
1966-
worker must be given the same options again, \fB--experimental-vfs\fR and
1967-
\fB--vfs-load\fR; without them, that thread has no mount for the script to come
1968-
from, and the worker fails to load it. \fB--experimental-vfs\fR is also what makes
1969-
\fBnode:vfs\fR available to the worker's own code. A worker whose script comes
1970-
from anywhere else, such as the real file system, needs nothing added.
1963+
worker must be given \fB--vfs-load\fR again; without it, that thread has no mount
1964+
for the script to come from, and the worker fails to load it. \fBnode:vfs\fR is
1965+
available to worker code without an experimental flag. A worker whose script
1966+
comes from anywhere else, such as the real file system, needs nothing added.
19711967
\fB--vfs-load\fR is not permitted in \fBNODE_OPTIONS\fR: which entry point runs is
19721968
the command line's decision, and the environment must not be able to redirect
19731969
it.
19741970
.Bd -literal
1975-
$ node --experimental-vfs --vfs-load=app.zip
1971+
$ node --vfs-load=app.zip
19761972
.Ed
19771973
.
19781974
.It Fl -watch
@@ -2228,8 +2224,6 @@ one is included in the list below.
22282224
.It
22292225
\fB--experimental-top-level-await\fR
22302226
.It
2231-
\fB--experimental-vfs\fR
2232-
.It
22332227
\fB--experimental-vm-modules\fR
22342228
.It
22352229
\fB--experimental-wasi-unstable-preview1\fR

‎lib/internal/process/pre_execution.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,6 @@ function setupQuic() {
524524
}
525525

526526
function setupVfs() {
527-
if (!getOptionValue('--experimental-vfs')) {
528-
return;
529-
}
530-
531527
const { BuiltinModule } = require('internal/bootstrap/realm');
532528
BuiltinModule.allowRequireByUsers('vfs');
533529
}

‎lib/internal/vfs/file_system.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const {
1515
ERR_INVALID_STATE,
1616
},
1717
} = require('internal/errors');
18-
const { validateBoolean } = require('internal/validators');
1918
const { MemoryProvider } = require('internal/vfs/providers/memory');
2019
const path = require('path');
2120
const { posix: pathPosix, resolve: resolvePath, sep, toNamespacedPath } = path;
@@ -39,6 +38,7 @@ const {
3938
const { VirtualReadStream, VirtualWriteStream } = require('internal/vfs/streams');
4039
const { VirtualDir } = require('internal/vfs/dir');
4140
const { emitExperimentalWarning, kEmptyObject } = require('internal/util');
41+
const { validateBoolean } = require('internal/validators');
4242
let debug = require('internal/util/debuglog').debuglog('vfs', (fn) => {
4343
debug = fn;
4444
});
@@ -111,7 +111,6 @@ class VirtualFileSystem {
111111
/**
112112
* @param {VirtualProvider|object} [providerOrOptions] The provider to use, or options
113113
* @param {object} [options] Configuration options
114-
* @param {boolean} [options.emitExperimentalWarning] Emit the experimental warning (default: true)
115114
*/
116115
constructor(providerOrOptions, options = kEmptyObject) {
117116
let provider = null;

‎lib/vfs.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const {
44
FunctionPrototypeSymbolHasInstance,
55
} = primordials;
66

7+
const { emitExperimentalWarning } = require('internal/util');
8+
emitExperimentalWarning('VirtualFileSystem');
9+
710
const { VirtualFileSystem } = require('internal/vfs/file_system');
811
const { VirtualProvider } = require('internal/vfs/provider');
912
const { MemoryProvider } = require('internal/vfs/providers/memory');

‎src/node.cc‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,9 +1049,6 @@ static ExitCode InitializeNodeWithArgsInternal(
10491049
// count below needs the arguments the command line itself gave.
10501050
{
10511051
auto* env_options = per_process::cli_options->per_isolate->per_env.get();
1052-
if (!env_options->experimental_vfs && env_options->vfs_load) {
1053-
errors->push_back("--vfs-load requires --experimental-vfs");
1054-
}
10551052
// A second --vfs-load would silently replace the first, and the option
10561053
// itself cannot say how often it was given; count it in the node options
10571054
// the command line yielded.

‎src/node_options.cc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,9 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
789789
NoOp{},
790790
#endif
791791
kAllowedInEnvvar);
792+
// Retained as a no-op for compatibility; node:vfs is no longer gated.
792793
AddOption("--experimental-vfs",
793-
"experimental node:vfs module",
794+
"",
794795
BOOL_FIELD(experimental_vfs),
795796
kAllowedInEnvvar);
796797
// Choosing the entry point is the command line's alone: an environment
@@ -801,7 +802,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
801802
AddOption("--vfs-load",
802803
"mount a directory or archive as a virtual file system and run the "
803804
"entry point and module resolution against it instead of the real "
804-
"file system (may be given once; requires --experimental-vfs)",
805+
"file system (may be given once)",
805806
&EnvironmentOptions::vfs_load_source,
806807
kDisallowedInEnvvar);
807808
AddOption("[vfs_load_set]", "", BOOL_FIELD(vfs_load));

‎test/ffi/test-ffi-vfs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --experimental-vfs
1+
// Flags: --disable-warning=ExperimentalWarning
22
'use strict';
33
const common = require('../common');
44
common.skipIfFFIMissing();

‎test/parallel/test-module-builtin-experimental.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --disable-warning=ExperimentalWarning
12
'use strict';
23

34
const common = require('../common');
@@ -8,7 +9,6 @@ const experimentalBuiltins = [
89
['bench/reporters', '--experimental-bench', true],
910
['dtls', '--experimental-dtls', common.hasDtls],
1011
['quic', '--experimental-quic', common.hasQuic],
11-
['vfs', '--experimental-vfs', true],
1212
].filter(([, , available]) => available);
1313

1414
for (const [id, flag] of experimentalBuiltins) {
@@ -51,7 +51,7 @@ if (common.hasFFI) {
5151
], { status: 0 });
5252
}
5353

54-
const schemeOnlyBuiltins = ['node:test', 'node:sea'];
54+
const schemeOnlyBuiltins = ['node:test', 'node:sea', 'node:vfs'];
5555
if (common.hasFFI) {
5656
schemeOnlyBuiltins.push('node:ffi');
5757
}

0 commit comments

Comments
 (0)