7
7
<!-- YAML
8
8
added: v8.5.0
9
9
changes:
10
- - version: v20.18.3
10
+ - version: REPLACEME
11
11
pr-url: https://github.com/nodejs/node/pull/55333
12
12
description: Import attributes are no longer experimental.
13
- - version: v20.10.0
13
+ - version:
14
+ - v21.0.0
15
+ - v20.10.0
16
+ - v18.20.0
14
17
pr-url: https://github.com/nodejs/node/pull/50140
15
18
description: Add experimental support for import attributes.
16
- - version: v20.0.0
19
+ - version:
20
+ - v20.0.0
21
+ - v18.19.0
17
22
pr-url: https://github.com/nodejs/node/pull/44710
18
23
description: Module customization hooks are executed off the main thread.
19
24
- version:
@@ -260,7 +265,10 @@ added:
260
265
- v17.1.0
261
266
- v16.14.0
262
267
changes:
263
- - version: v20.10.0
268
+ - version:
269
+ - v21.0.0
270
+ - v20.10.0
271
+ - v18.20.0
264
272
pr-url: https://github.com/nodejs/node/pull/50140
265
273
description: Switch from Import Assertions to Import Attributes.
266
274
-->
@@ -330,12 +338,14 @@ modules it can be used to load ES modules.
330
338
* {Object}
331
339
332
340
The ` import.meta ` meta property is an ` Object ` that contains the following
333
- properties. It is only supported in ES modules.
341
+ properties.
334
342
335
343
### ` import.meta.dirname `
336
344
337
345
<!-- YAML
338
- added: v20.11.0
346
+ added:
347
+ - v21.2.0
348
+ - v20.11.0
339
349
-->
340
350
341
351
> Stability: 1.2 - Release candidate
@@ -348,7 +358,9 @@ added: v20.11.0
348
358
### ` import.meta.filename `
349
359
350
360
<!-- YAML
351
- added: v20.11.0
361
+ added:
362
+ - v21.2.0
363
+ - v20.11.0
352
364
-->
353
365
354
366
> Stability: 1.2 - Release candidate
@@ -382,15 +394,21 @@ added:
382
394
- v13.9.0
383
395
- v12.16.2
384
396
changes:
385
- - version: v20.6.0
397
+ - version:
398
+ - v20.6.0
399
+ - v18.19.0
386
400
pr-url: https://github.com/nodejs/node/pull/49028
387
- description: Unflag ` import.meta.resolve` , with ` parentURL` parameter still
388
- flagged.
389
- - version: v20.6.0
401
+ description: No longer behind ` --experimental-import-meta-resolve` CLI flag,
402
+ except for the non-standard ` parentURL` parameter.
403
+ - version:
404
+ - v20.6.0
405
+ - v18.19.0
390
406
pr-url: https://github.com/nodejs/node/pull/49038
391
407
description: This API no longer throws when targeting ` file:` URLs that do
392
408
not map to an existing file on the local FS.
393
- - version: v20.0.0
409
+ - version:
410
+ - v20.0.0
411
+ - v18.19.0
394
412
pr-url: https://github.com/nodejs/node/pull/44710
395
413
description: This API now returns a string synchronously instead of a Promise.
396
414
- version:
@@ -593,7 +611,7 @@ separate cache.
593
611
594
612
<!-- YAML
595
613
changes:
596
- - version: v20.18.3
614
+ - version: REPLACEME
597
615
pr-url: https://github.com/nodejs/node/pull/55333
598
616
description: JSON modules are no longer experimental.
599
617
-->
@@ -686,71 +704,6 @@ spawn(execPath, [
686
704
});
687
705
` ` `
688
706
689
- ## HTTPS and HTTP imports
690
-
691
- > Stability: 1 - Experimental
692
-
693
- Importing network based modules using ` https: ` and ` http: ` is supported under
694
- the ` -- experimental- network- imports` flag. This allows web browser-like imports
695
- to work in Node.js with a few differences due to application stability and
696
- security concerns that are different when running in a privileged environment
697
- instead of a browser sandbox.
698
-
699
- ### Imports are limited to HTTP/1
700
-
701
- Automatic protocol negotiation for HTTP/2 and HTTP/3 is not yet supported.
702
-
703
- ### HTTP is limited to loopback addresses
704
-
705
- ` http: ` is vulnerable to man-in-the-middle attacks and is not allowed to be
706
- used for addresses outside of the IPv4 address ` 127.0 .0 .0 / 8 ` (` 127.0 .0 .1 ` to
707
- ` 127.255 .255 .255 ` ) and the IPv6 address ` :: 1 ` . Support for ` http: ` is intended
708
- to be used for local development.
709
-
710
- ### Authentication is never sent to the destination server.
711
-
712
- ` Authorization` , ` Cookie` , and ` Proxy - Authorization` headers are not sent to the
713
- server. Avoid including user info in parts of imported URLs. A security model
714
- for safely using these on the server is being worked on.
715
-
716
- ### CORS is never checked on the destination server
717
-
718
- CORS is designed to allow a server to limit the consumers of an API to a
719
- specific set of hosts. This is not supported as it does not make sense for a
720
- server-based implementation.
721
-
722
- ### Cannot load non-network dependencies
723
-
724
- These modules cannot access other modules that are not over ` http: ` or ` https: ` .
725
- To still access local modules while avoiding the security concern, pass in
726
- references to the local dependencies:
727
-
728
- ` ` ` mjs
729
- // file.mjs
730
- import worker_threads from ' node:worker_threads' ;
731
- import { configure , resize } from ' https://example.com/imagelib.mjs' ;
732
- configure ({ worker_threads });
733
- ` ` `
734
-
735
- ` ` ` mjs
736
- // https://example.com/imagelib.mjs
737
- let worker_threads;
738
- export function configure (opts ) {
739
- worker_threads = opts .worker_threads ;
740
- }
741
- export function resize (img , size ) {
742
- // Perform resizing in worker_thread to avoid main thread blocking
743
- }
744
- ` ` `
745
-
746
- ### Network-based loading is not enabled by default
747
-
748
- For now, the ` -- experimental- network- imports` flag is required to enable loading
749
- resources over ` http: ` or ` https: ` . In the future, a different mechanism will be
750
- used to enforce this. Opt-in is required to prevent transitive dependencies
751
- inadvertently using potentially mutable state that could affect reliability
752
- of Node.js applications.
753
-
754
707
<i id="esm_experimental_loaders"></i>
755
708
756
709
## Loaders
@@ -793,8 +746,7 @@ does not determine whether the resolved URL protocol can be loaded,
793
746
or whether the file extensions are permitted, instead these validations
794
747
are applied by Node.js during the load phase
795
748
(for example, if it was asked to load a URL that has a protocol that is
796
- not ` file: ` , ` data: ` , ` node: ` , or if ` -- experimental- network- imports`
797
- is enabled, ` https: ` ).
749
+ not ` file: ` , ` data: ` or ` node: ` .
798
750
799
751
The algorithm also tries to determine the format of the file based
800
752
on the extension (see ` ESM_FILE_FORMAT ` algorithm below). If it does
0 commit comments