Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1516,19 +1516,6 @@ passing a second `parentURL` argument for contextual resolution.

Previously gated the entire `import.meta.resolve` feature.

### `--experimental-import-text`

<!-- YAML
added:
- v26.5.0
- v24.19.0
-->

> Stability: 1.0 - Early development

Enable experimental support for importing modules with
`with { type: 'text' }`.

### `--experimental-inspector-network-resource`

<!-- YAML
Expand Down Expand Up @@ -2333,6 +2320,20 @@ added: v21.2.0

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

### `--no-experimental-import-text`

<!-- YAML
added:
- v26.5.0
- v24.19.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/67778
description: Text imports are unflagged but still experimental.
-->

Disable importing modules with `with { type: 'text' }`.

### `--no-experimental-require-module`

<!-- YAML
Expand Down Expand Up @@ -4369,7 +4370,6 @@ one is included in the list below.
* `--experimental-dtls`
* `--experimental-eventsource`
* `--experimental-import-meta-resolve`
* `--experimental-import-text`
* `--experimental-json-modules`
* `--experimental-modules`
* `--experimental-package-map`
Expand Down Expand Up @@ -4414,6 +4414,7 @@ one is included in the list below.
* `--no-deprecation`
* `--no-experimental-ffi`
* `--no-experimental-global-navigator`
* `--no-experimental-import-text`
* `--no-experimental-sqlite`
* `--no-experimental-strip-types`
* `--no-experimental-vfs`
Expand Down
16 changes: 14 additions & 2 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,20 @@ imported from the same path.

## Text modules

> Stability: 1.0 - Early development
<!-- YAML
added:
- v26.5.0
- v24.19.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/67778
description: Text modules no longer require the `--experimental-import-text`
flag.
-->

> Stability: 1.2 - Release candidate

Text modules are available behind the `--experimental-import-text` flag.
Text modules can be disabled with the [`--no-experimental-import-text`][] flag.

Text files can be referenced by `import`:

Expand Down Expand Up @@ -1341,6 +1352,7 @@ resolution for ESM specifiers.
[`"type"`]: packages.md#type
[`--experimental-package-map`]: cli.md#--experimental-package-mappath
[`--input-type`]: cli.md#--input-typetype
[`--no-experimental-import-text`]: cli.md#--no-experimental-import-text
[`data:` URLs]: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data
[`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
[`import()`]: #import-expressions
Expand Down
11 changes: 5 additions & 6 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,6 @@ Enable experimental \fBimport.meta.resolve()\fR parent URL support, which allows
passing a second \fBparentURL\fR argument for contextual resolution.
Previously gated the entire \fBimport.meta.resolve\fR feature.
.
.It Fl -experimental-import-text
Enable experimental support for importing modules with
\fBwith { type: 'text' }\fR.
.
.It Fl -experimental-inspector-network-resource
Enable experimental support for inspector network resources.
.
Expand Down Expand Up @@ -1249,6 +1245,9 @@ This flag is only available in builds with FFI support.
.It Fl -no-experimental-global-navigator
Disable exposition of Navigator API on the global scope.
.
.It Fl -no-experimental-import-text
Disable importing modules with \fBwith { type: 'text' }\fR.
.
.It Fl -no-experimental-require-module
Legacy alias for \fB--no-require-module\fR.
.
Expand Down Expand Up @@ -2318,8 +2317,6 @@ one is included in the list below.
.It
\fB--experimental-import-meta-resolve\fR
.It
\fB--experimental-import-text\fR
.It
\fB--experimental-json-modules\fR
.It
\fB--experimental-modules\fR
Expand Down Expand Up @@ -2408,6 +2405,8 @@ one is included in the list below.
.It
\fB--no-experimental-global-navigator\fR
.It
\fB--no-experimental-import-text\fR
.It
\fB--no-experimental-sqlite\fR
.It
\fB--no-experimental-strip-types\fR
Expand Down
3 changes: 2 additions & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental support for importing source as text with import "
"attributes",
BOOL_FIELD(experimental_import_text),
kAllowedInEnvvar);
kAllowedInEnvvar,
true);
AddOption("--experimental-import-meta-resolve",
"experimental ES Module import.meta.resolve() parentURL support",
BOOL_FIELD(experimental_import_meta_resolve),
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class EnvironmentOptions : public Options {
DEFINE_BOOL_FIELD(experimental_quic) = EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(experimental_global_navigator) = true;
DEFINE_BOOL_FIELD(experimental_global_web_crypto) = true;
DEFINE_BOOL_FIELD(experimental_import_text) = EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(experimental_import_text) = true;
DEFINE_BOOL_FIELD(experimental_import_meta_resolve) =
EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(entry_is_url) = false;
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-defer-import-text-module.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --js-defer-import-eval --experimental-import-text
// Flags: --js-defer-import-eval

// Test that uses import.defer for a text module. Currently
// defer importing of a synthetic module should be a no-op
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-internals --experimental-import-text
// Flags: --expose-internals
'use strict';
require('../common');

Expand Down
1 change: 1 addition & 0 deletions test/es-module/test-esm-import-text-disabled.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --no-experimental-import-text
import '../common/index.mjs';
import assert from 'assert';

Expand Down
1 change: 0 additions & 1 deletion test/es-module/test-esm-import-text.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-import-text
import '../common/index.mjs';
import assert from 'assert';

Expand Down
3 changes: 2 additions & 1 deletion test/es-module/test-esm-loader-text-format.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Flags: --no-experimental-import-text
import '../common/index.mjs';
import assert from 'node:assert';
import { registerHooks } from 'node:module';

// A user loader can use `text` with and without import attributes without the feature flag.
// A user loader can use `text` with and without import attributes when the feature is disabled.

registerHooks({
load(url, context, nextLoad) {
Expand Down
Loading