Skip to content

Commit fae9252

Browse files
committed
vfs: unflag
Signed-off-by: Matteo Collina <hello@matteocollina.com>
1 parent ebef774 commit fae9252

133 files changed

Lines changed: 185 additions & 238 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: 6 additions & 18 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
@@ -3793,7 +3783,7 @@ added: REPLACEME
37933783

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

3796-
Requires [`--experimental-vfs`][]. May be given at most once.
3786+
May be given at most once.
37973787

37983788
Mounts `source` exactly as [`--vfs-mount`][] does, and additionally runs the
37993789
entry point and all subsequent `require()`/`import` resolution against that
@@ -3817,8 +3807,8 @@ the command line's decision, and the environment must not be able to redirect
38173807
it.
38183808

38193809
```console
3820-
$ node --experimental-vfs --vfs-load=app.zip
3821-
$ node --experimental-vfs --vfs-mount=lib.zip --vfs-load=app.zip
3810+
$ node --vfs-load=app.zip
3811+
$ node --vfs-mount=lib.zip --vfs-load=app.zip
38223812
```
38233813

38243814
### `--vfs-mount=source`
@@ -3829,7 +3819,7 @@ added: REPLACEME
38293819

38303820
* `source` {string} A directory or an archive file to mount.
38313821

3832-
Requires [`--experimental-vfs`][]. May be repeated to mount several sources.
3822+
May be repeated to mount several sources.
38333823

38343824
Mounts `source` as a virtual file system ([`node:vfs`][]). Each mount is placed
38353825
at a reserved mount point assigned by Node.js, so mounts never shadow real
@@ -3839,7 +3829,7 @@ point; use [`--vfs-load`][] for the source to run from.
38393829
`--vfs-mount` and [`--vfs-load`][] mount in the order they are written, so
38403830

38413831
```console
3842-
$ node --experimental-vfs --vfs-mount=a --vfs-load=b --vfs-mount=c
3832+
$ node --vfs-mount=a --vfs-load=b --vfs-mount=c
38433833
```
38443834

38453835
mounts `a`, `b` and `c` in that order and runs `b`. Mounts contributed by
@@ -4180,7 +4170,6 @@ one is included in the list below.
41804170
* `--experimental-stream-iter`
41814171
* `--experimental-test-isolation`
41824172
* `--experimental-top-level-await`
4183-
* `--experimental-vfs`
41844173
* `--experimental-vm-modules`
41854174
* `--experimental-wasi-unstable-preview1`
41864175
* `--experimental-web-worker`
@@ -4813,7 +4802,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
48134802
[`--env-file-if-exists`]: #--env-file-if-existsfile
48144803
[`--env-file`]: #--env-filefile
48154804
[`--experimental-sea-config`]: single-executable-applications.md#1-generating-single-executable-preparation-blobs
4816-
[`--experimental-vfs`]: #--experimental-vfs
48174805
[`--heap-prof-dir`]: #--heap-prof-dir
48184806
[`--import`]: #--importmodule
48194807
[`--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

@@ -170,8 +171,9 @@ added: v26.4.0
170171
* `provider` {VirtualProvider} The provider to use. **Default:**
171172
`new MemoryProvider()`.
172173
* `options` {Object}
173-
* `emitExperimentalWarning` {boolean} Whether to emit the experimental
174-
warning. **Default:** `true`.
174+
* `emitExperimentalWarning` {boolean} Whether to emit an experimental warning
175+
when an instance is created. **Default:** `true`. Loading `node:vfs` emits
176+
the warning regardless of this option.
175177

176178
### `vfs.mount()`
177179

‎doc/node.1‎

Lines changed: 6 additions & 11 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
.
@@ -1887,7 +1884,7 @@ Print node's version.
18871884
.It
18881885
\fBsource\fR \fB{string}\fR A directory or an archive file to mount and run.
18891886
.El
1890-
Requires \fB--experimental-vfs\fR. May be given at most once.
1887+
May be given at most once.
18911888
Mounts \fBsource\fR exactly as \fB--vfs-mount\fR does, and additionally runs the
18921889
entry point and all subsequent \fBrequire()\fR/\fBimport\fR resolution against that
18931890
mount rather than the real file system. The entry point is taken from the mount
@@ -1905,23 +1902,23 @@ same mounts, in the same order, and runs its own entry point.
19051902
the command line's decision, and the environment must not be able to redirect
19061903
it.
19071904
.Bd -literal
1908-
$ node --experimental-vfs --vfs-load=app.zip
1909-
$ node --experimental-vfs --vfs-mount=lib.zip --vfs-load=app.zip
1905+
$ node --vfs-load=app.zip
1906+
$ node --vfs-mount=lib.zip --vfs-load=app.zip
19101907
.Ed
19111908
.
19121909
.It Fl -vfs-mount Ns = Ns Ar source
19131910
.Bl -bullet
19141911
.It
19151912
\fBsource\fR \fB{string}\fR A directory or an archive file to mount.
19161913
.El
1917-
Requires \fB--experimental-vfs\fR. May be repeated to mount several sources.
1914+
May be repeated to mount several sources.
19181915
Mounts \fBsource\fR as a virtual file system (\fBnode:vfs\fR). Each mount is placed
19191916
at a reserved mount point assigned by Node.js, so mounts never shadow real
19201917
paths and no target can be chosen. Mounting alone does not change the entry
19211918
point; use \fB--vfs-load\fR for the source to run from.
19221919
\fB--vfs-mount\fR and \fB--vfs-load\fR mount in the order they are written, so
19231920
.Bd -literal
1924-
$ node --experimental-vfs --vfs-mount=a --vfs-load=b --vfs-mount=c
1921+
$ node --vfs-mount=a --vfs-load=b --vfs-mount=c
19251922
.Ed
19261923
mounts \fBa\fR, \fBb\fR and \fBc\fR in that order and runs \fBb\fR. Mounts contributed by
19271924
\fBNODE_OPTIONS\fR are mounted before the command line's.
@@ -2192,8 +2189,6 @@ one is included in the list below.
21922189
.It
21932190
\fB--experimental-top-level-await\fR
21942191
.It
2195-
\fB--experimental-vfs\fR
2196-
.It
21972192
\fB--experimental-vm-modules\fR
21982193
.It
21992194
\fB--experimental-wasi-unstable-preview1\fR

‎lib/internal/process/pre_execution.js‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ function finishVfsMounts() {
262262

263263
const entries = getOptionValue('--vfs-mount');
264264
if (entries.length === 0) return;
265-
emitExperimentalWarning('--vfs-mount');
266265

267266
const fs = require('fs');
268267
const path = require('path');
@@ -288,7 +287,7 @@ function finishVfsMounts() {
288287
if (provider === null) {
289288
throw new ERR_VFS_INVALID_TARGET(resolvedSource);
290289
}
291-
const vfs = new VirtualFileSystem(provider, { emitExperimentalWarning: false });
290+
const vfs = new VirtualFileSystem(provider);
292291
const mountPoint = vfs.mount();
293292
// The mount --vfs-load contributed is what the entry is require()d from;
294293
// process.argv[1] names the real source instead, since the reserved mount
@@ -559,10 +558,6 @@ function setupQuic() {
559558
}
560559

561560
function setupVfs() {
562-
if (!getOptionValue('--experimental-vfs')) {
563-
return;
564-
}
565-
566561
const { BuiltinModule } = require('internal/bootstrap/realm');
567562
BuiltinModule.allowRequireByUsers('vfs');
568563
}

‎lib/internal/vfs/file_system.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const {
1313
ERR_INVALID_STATE,
1414
},
1515
} = require('internal/errors');
16-
const { validateBoolean } = require('internal/validators');
1716
const { MemoryProvider } = require('internal/vfs/providers/memory');
1817
const path = require('path');
1918
const { posix: pathPosix, resolve: resolvePath, sep, toNamespacedPath } = path;
@@ -35,6 +34,7 @@ const {
3534
const { VirtualReadStream, VirtualWriteStream } = require('internal/vfs/streams');
3635
const { VirtualDir } = require('internal/vfs/dir');
3736
const { emitExperimentalWarning, kEmptyObject } = require('internal/util');
37+
const { validateBoolean } = require('internal/validators');
3838
let debug = require('internal/util/debuglog').debuglog('vfs', (fn) => {
3939
debug = fn;
4040
});
@@ -94,7 +94,6 @@ class VirtualFileSystem {
9494
/**
9595
* @param {VirtualProvider|object} [providerOrOptions] The provider to use, or options
9696
* @param {object} [options] Configuration options
97-
* @param {boolean} [options.emitExperimentalWarning] Emit the experimental warning (default: true)
9897
*/
9998
constructor(providerOrOptions, options = kEmptyObject) {
10099
let provider = null;

‎lib/internal/vfs/sea.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ function initSeaVfs(options = kEmptyObject) {
4141
const { SEAProvider } = require('internal/vfs/providers/sea');
4242

4343
const provider = new SEAProvider({ extraFiles: options.extraFiles });
44-
// The SEA warning already covers the feature; don't emit the
45-
// VirtualFileSystem experimental warning for the implicit SEA mount.
44+
// SEA has its own experimental warning; don't emit another for this mount.
4645
const vfs = new VirtualFileSystem(provider, {
4746
emitExperimentalWarning: false,
4847
});

‎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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,22 +1036,8 @@ static ExitCode InitializeNodeWithArgsInternal(
10361036
CheckGlobalBenchOptions(errors);
10371037
if (!errors->empty()) return ExitCode::kInvalidCommandLineArgument;
10381038

1039-
// Checked here rather than in EnvironmentOptions::CheckOptions(), which runs
1040-
// at the end of every parse: NODE_OPTIONS is parsed before the command line,
1041-
// so a check there would reject `NODE_OPTIONS=--vfs-mount=x node
1042-
// --experimental-vfs` for an --experimental-vfs it had not read yet. These
1043-
// options only make sense as a set, so they are validated once all of them
1044-
// are in.
10451039
{
10461040
auto* env_options = per_process::cli_options->per_isolate->per_env.get();
1047-
if (!env_options->experimental_vfs) {
1048-
if (!env_options->vfs_mounts.empty()) {
1049-
errors->push_back("--vfs-mount requires --experimental-vfs");
1050-
}
1051-
if (env_options->vfs_load) {
1052-
errors->push_back("--vfs-load requires --experimental-vfs");
1053-
}
1054-
}
10551041
// --vfs-load shares vfs_mounts with --vfs-mount, so the options themselves
10561042
// cannot say how often it was given; count it in the node options the
10571043
// command line yielded. A second one would silently win over the first.

‎src/node_options.cc‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,9 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
687687
NoOp{},
688688
#endif
689689
kAllowedInEnvvar);
690+
// Retained as a no-op for compatibility; node:vfs is no longer experimental.
690691
AddOption("--experimental-vfs",
691-
"experimental node:vfs module",
692+
"",
692693
BOOL_FIELD(experimental_vfs),
693694
kAllowedInEnvvar);
694695
// --vfs-mount and --vfs-load both append to vfs_mounts, so the list holds
@@ -697,7 +698,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
697698
// rather than an index the user has to count out.
698699
AddOption("--vfs-mount",
699700
"mount a directory or archive as a virtual file system "
700-
"(option can be repeated; requires --experimental-vfs)",
701+
"(option can be repeated)",
701702
&EnvironmentOptions::vfs_mounts,
702703
kAllowedInEnvvar);
703704
// Choosing the entry point is the command line's alone: an environment
@@ -706,7 +707,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
706707
AddOption("--vfs-load",
707708
"mount a directory or archive as a virtual file system and run the "
708709
"entry point and module resolution against it instead of the real "
709-
"file system (may be given once; requires --experimental-vfs)",
710+
"file system (may be given once)",
710711
&EnvironmentOptions::vfs_mounts,
711712
kDisallowedInEnvvar);
712713
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();

0 commit comments

Comments
 (0)