Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
af360ac
doc: make minor edits for consistency
Trott Sep 27, 2020
91b820e
esm: use "node:" namespace for builtins
guybedford Sep 28, 2020
e4a4f81
fs: use Promise.resolve from primordials
targos Sep 27, 2020
998b24e
doc: align to function signature
anlexN Aug 26, 2020
4d29fb5
tools: add pythonenv to .gitignore
targos Sep 28, 2020
79e3e50
doc: update example ICU URL
watilde Sep 27, 2020
4aed176
src: document required else block at src/node_platform.cc
juanarbol Aug 24, 2020
a4e5a3a
tools: exclude gyp from markdown link checker
targos Sep 30, 2020
7dc6b2f
build: add support for section ordering
Jan 6, 2020
f23a0e2
module: refine module type mismatch error cases
guybedford Sep 30, 2020
ce789f1
doc: use .md extension for internal links
aduh95 Sep 14, 2020
5a730b5
doc: sort md references in ASCII order
aduh95 Sep 17, 2020
166f14a
tools: check links in api docs
aduh95 Sep 22, 2020
05e08bd
console: add Symbol.toStringTag property
Leko Sep 28, 2020
d642788
doc: unhide resolver spec
guybedford Sep 26, 2020
86f2f83
doc: implement fancier rendering for keys
Trott Sep 28, 2020
95c62a1
doc: copyedit esm.md
Trott Sep 29, 2020
f36476d
build: fix CQ after latest ncu release
mmarchini Oct 2, 2020
35b62ef
doc: importable node protocol URLs
bmeck Sep 30, 2020
a11ddee
doc: update contact information for richardlau
richardlau Oct 1, 2020
2302206
meta: add startup team in CODEOWNERS
joyeecheung Sep 29, 2020
368a3ae
doc: update contact information for @BethGriggs
BethGriggs Oct 1, 2020
4dbb3a9
doc: copyedit packages.md
Trott Sep 30, 2020
6e9e5c3
tools,doc: fix broken link in module.html
Trott Oct 1, 2020
5a85d4f
src: make MakeCallback() check can_call_into_js before getting method
addaleax Sep 30, 2020
1f15e34
crypto: set env values in KeyObject Deserialize method
ThakurKarthik Sep 28, 2020
862b75d
doc: added details around console.timeEnd changes
yashLadha Sep 3, 2020
fcbdb06
fs: remove experimental from rmdir recursive
Oct 1, 2020
a01154e
crypto: fix KeyObject garbage collection
addaleax Oct 3, 2020
7bbf8ee
src: remove invalid ToLocalChecked in EmitBeforeExit
addaleax Oct 3, 2020
38a5715
doc: avoid using deprecated connection property
lpinca Oct 1, 2020
541ce17
doc: add entry to console.timeEnd() changes array
lpinca Oct 1, 2020
e40876a
doc: specify how to detect EOF
lpinca Oct 1, 2020
85062b3
deps: update llhttp to 2.1.3
indutny Sep 30, 2020
3f95440
doc: fix conditional exports flag removal version
aduh95 Sep 30, 2020
f29451d
fs: simplify realpathSync
himself65 Sep 29, 2020
190d46b
tools: update gyp to 0.2.0
ryzokuken Apr 7, 2020
7361a3f
tools: update gyp-next to v0.2.1
ryzokuken May 17, 2020
3e75907
tools: update gyp-next to v0.3.0
ryzokuken Jun 15, 2020
ad8fce6
tools: update gyp to v0.4.0
ryzokuken Jul 15, 2020
5f1d792
tools: update gyp to v0.5.0
ryzokuken Sep 30, 2020
62ddc77
meta: add nodejs/streams to CODEOWNERS
mcollina Sep 29, 2020
1313c8c
doc: update sxa's email address to Red Hat from IBM
Oct 1, 2020
f499302
tools: fix typo in error message
aduh95 Sep 29, 2020
885840b
doc: adopt MDN style for kbd elements
Trott Oct 2, 2020
91ef862
doc: mention adding YAML for APIs in PR contributing guide
lundibundi Oct 2, 2020
5c879a9
module: fix builtin reexport tracing
guybedford Oct 4, 2020
f08577c
doc: update AUTHORS list
addaleax Sep 21, 2020
fbb9dd9
src: fix aliased buffer import warning in env.h
yashLadha Oct 1, 2020
53e27b3
doc,esm: add history support info
aduh95 Sep 28, 2020
0ac5fa7
module: update to [email protected]
guybedford Oct 4, 2020
6585b16
doc: improve eventLoopUtilization documentation
puzpuzpuz Oct 3, 2020
5790c40
tools: add missing uv_setup_argv() calls
addaleax Oct 4, 2020
e09f7f0
src: limit GetProcessTitle() result to 1MB
addaleax Oct 4, 2020
541be52
fs: do not throw exception after creating FSReqCallback
addaleax Oct 3, 2020
27cd99b
test: improve test coverage for eventtarget
juanarbol Jun 5, 2020
8e3a81e
http2,tls: store WriteWrap using BaseObjectPtr
addaleax Oct 3, 2020
392c881
src: use env->ThrowUVException in pipe_wrap
jasnell Oct 4, 2020
3f62f99
src: more idiomatic error pattern in node_wasi
jasnell Oct 4, 2020
a995dd7
doc: revise introductory child_process text
Trott Sep 25, 2020
552ebaf
test: update wpt tests for encoding
watilde Sep 24, 2020
7c5f319
2020-10-07, Version 14.13.1 (Current)
danielleadams Oct 6, 2020
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
Prev Previous commit
Next Next commit
doc: copyedit esm.md
This provides a number of minor style adjustments and small corrections
to esm.md text.

Co-authored-by: Guy Bedford <[email protected]>

PR-URL: #35414
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Derek Lewis <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
  • Loading branch information
Trott authored and danielleadams committed Oct 6, 2020
commit 95c62a1dca871277ccad37ac8403ec2f3dbcc3da
70 changes: 31 additions & 39 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ added: v12.10.0

* `text/javascript` for ES Modules
* `application/json` for JSON
* `application/wasm` for WASM.
* `application/wasm` for Wasm

`data:` URLs only resolve [_Bare specifiers_][Terminology] for builtin modules
and [_Absolute specifiers_][Terminology]. Resolving
[_Relative specifiers_][Terminology] will not work because `data:` is not a
[_Relative specifiers_][Terminology] does not work because `data:` is not a
[special scheme][]. For example, attempting to load `./foo`
from `data:text/javascript,import "./foo";` will fail to resolve since there
from `data:text/javascript,import "./foo";` fails to resolve because there
is no concept of relative resolution for `data:` URLs. An example of a `data:`
URLs being used is:

Expand Down Expand Up @@ -200,7 +200,7 @@ from which to resolve from:
})();
```

This function is asynchronous since the ES module resolver in Node.js is
This function is asynchronous because the ES module resolver in Node.js is
asynchronous. With the introduction of [Top-Level Await][], these use cases
will be easier as they won't require an async function wrapper.

Expand All @@ -219,8 +219,8 @@ ES modules are resolved and cached based upon
[URL](https://url.spec.whatwg.org/) semantics. This means that files containing
special characters such as `#` and `?` need to be escaped.

Modules will be loaded multiple times if the `import` specifier used to resolve
them have a different query or fragment.
Modules are loaded multiple times if the `import` specifier used to resolve
them has a different query or fragment.

```js
import './foo.mjs?query=1'; // loads ./foo.mjs with query of "?query=1"
Expand Down Expand Up @@ -295,8 +295,8 @@ console.log(cjs === cjsSugar);
// true
```

The ECMAScript Module Namespace representation of a CommonJS module will always
be a namespace with a `default` export key pointing to the CommonJS
The ECMAScript Module Namespace representation of a CommonJS module is always
a namespace with a `default` export key pointing to the CommonJS
`module.exports` value.

This Module Namespace Exotic Object can be directly observed either when using
Expand All @@ -312,19 +312,19 @@ console.log(m === await import('cjs'));
// true
```

For better compatibility with existing usage in the JS ecosystem, Node.js will
in addition attempt to determine the CommonJS named exports of every imported
For better compatibility with existing usage in the JS ecosystem, Node.js
in addition attempts to determine the CommonJS named exports of every imported
CommonJS module to provide them as separate ES module exports using a static
analysis process.

For example, a CommonJS module written:
For example, consider a CommonJS module written:

```js
// cjs.cjs
exports.name = 'exported';
```

will support named imports in ES modules:
The preceding module supports named imports in ES modules:

<!-- eslint-disable no-duplicate-imports -->
```js
Expand All @@ -348,8 +348,8 @@ directly on the ES module namespace when the module is imported.
Live binding updates or new exports added to `module.exports` are not detected
for these named exports.

The detection of named exports is based on common syntax patterns but will not
always correctly detect named exports, in these cases using the default
The detection of named exports is based on common syntax patterns but does not
always correctly detect named exports. In these cases, using the default
import form described above can be a better option.

Named exports detection covers many common export patterns, reexport patterns
Expand All @@ -358,7 +358,7 @@ semantics implemented.

## Builtin modules

[Core modules][] will provide named exports of their public API. A
[Core modules][] provide named exports of their public API. A
default export is also provided which is the value of the CommonJS exports.
The default export can be used for, among other things, modifying the named
exports. Named exports of builtin modules are updated only by calling
Expand Down Expand Up @@ -415,11 +415,11 @@ and are loaded using the CJS loader. [WHATWG JSON modules specification][] are
still being standardized, and are experimentally supported by including the
additional flag `--experimental-json-modules` when running Node.js.

When the `--experimental-json-modules` flag is included both the
`commonjs` and `module` mode will use the new experimental JSON
loader. The imported JSON only exposes a `default`, there is no
When the `--experimental-json-modules` flag is included, both the
`commonjs` and `module` mode use the new experimental JSON
loader. The imported JSON only exposes a `default`. There is no
support for named exports. A cache entry is created in the CommonJS
cache, to avoid duplication. The same object will be returned in
cache to avoid duplication. The same object is returned in
CommonJS if the JSON module has already been imported from the
same path.

Expand Down Expand Up @@ -523,7 +523,7 @@ The `conditions` property on the `context` is an array of conditions for
for looking up conditional mappings elsewhere or to modify the list when calling
the default resolution logic.

The current [package exports conditions][Conditional Exports] will always be in
The current [package exports conditions][Conditional Exports] are always in
the `context.conditions` array passed into the hook. To guarantee _default
Node.js module specifier resolution behavior_ when calling `defaultResolve`, the
`context.conditions` array passed to it _must_ include _all_ elements of the
Expand Down Expand Up @@ -593,7 +593,7 @@ Note: These types all correspond to classes defined in ECMAScript.
* The specific [`TypedArray`][] object is a [`Uint8Array`][].

Note: If the source value of a text-based format (i.e., `'json'`, `'module'`) is
not a string, it will be converted to a string using [`util.TextDecoder`][].
not a string, it is converted to a string using [`util.TextDecoder`][].

```js
/**
Expand Down Expand Up @@ -704,15 +704,15 @@ export async function transformSource(source, context, defaultTransformSource) {

* Returns: {string}

Sometimes it can be necessary to run some code inside of the same global scope
that the application will run in. This hook allows to return a string that will
be ran as sloppy-mode script on startup.
Sometimes it might be necessary to run some code inside of the same global scope
that the application runs in. This hook allows the return of a string that is
run as sloppy-mode script on startup.

Similar to how CommonJS wrappers work, the code runs in an implicit function
scope. The only argument is a `require`-like function that can be used to load
builtins like "fs": `getBuiltin(request: string)`.

If the code needs more advanced `require` features, it will have to construct
If the code needs more advanced `require` features, it has to construct
its own `require` using `module.createRequire()`.

```js
Expand Down Expand Up @@ -807,13 +807,9 @@ import { VERSION } from 'https://coffeescript.org/browser-compiler-modern/coffee
console.log(VERSION);
```

With this loader, running:

```bash
node --experimental-loader ./https-loader.mjs ./main.mjs
```

Will print the current version of CoffeeScript per the module at the URL in
With the preceding loader, running
`node --experimental-loader ./https-loader.mjs ./main.mjs`
prints the current version of CoffeeScript per the module at the URL in
`main.mjs`.

#### Transpiler loader
Expand Down Expand Up @@ -894,13 +890,9 @@ console.log "Brought to you by Node.js version #{version}"
export scream = (str) -> str.toUpperCase()
```

With this loader, running:

```console
node --experimental-loader ./coffeescript-loader.mjs main.coffee
```

Will cause `main.coffee` to be turned into JavaScript after its source code is
With the preceding loader, running
`node --experimental-loader ./coffeescript-loader.mjs main.coffee`
causes `main.coffee` to be turned into JavaScript after its source code is
loaded from disk but before Node.js executes it; and so on for any `.coffee`,
`.litcoffee` or `.coffee.md` files referenced via `import` statements of any
loaded file.
Expand Down