Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c09f3dc
doc: put release script specifics in details
MylesBorins Sep 18, 2020
2a4ae09
doc: update crypto.createSecretKey accepted types
panva Sep 17, 2020
68ea7f5
module: fix crash on multiline named cjs imports
ctavan Sep 18, 2020
9d91842
tools,doc: upgrade dependencies
aduh95 Sep 17, 2020
c5d27e1
tools,doc: enforce alphabetical order for md refs
aduh95 Sep 17, 2020
ec6b78a
doc: add `socket.readyState`
clarkkozak Sep 18, 2020
0c4540b
doc: fix heading space bug in assert.md
tlhunter Sep 23, 2020
7f35573
tools: ignore build folder when checking links
Sep 23, 2020
1893449
doc: revise dependency redirection text in policy.md
Trott Sep 20, 2020
b4514d4
doc: replace "this guide" link text with guide title
Trott Sep 21, 2020
b9d767c
doc: change type of child_process.signalCode to string
Sep 16, 2020
ef0d2ef
doc: move package config docs to separate page
aduh95 Aug 7, 2020
ab7d0e9
meta: update module pages in CODEOWNERS
aduh95 Aug 26, 2020
1d1ce1f
doc: document support for package.json fields
aduh95 Aug 7, 2020
5057318
module: exports pattern support
guybedford Aug 12, 2020
d7282c0
doc: edit subpath export patterns introduction
Trott Sep 18, 2020
dd53036
doc: fixup lutimes metadata
addaleax Sep 24, 2020
a8d3a7f
doc: put landing specifics in details tag
Trott Sep 25, 2020
0a847ca
doc: update napi_make_callback documentation
Flarna Sep 23, 2020
6dc6dad
doc: avoid referring to C array size
tniessen Sep 22, 2020
482ce6c
doc: improve N-API string-to-native doc
Sep 23, 2020
5da5d41
doc: refine require/import conditions constraints
guybedford Sep 23, 2020
353a567
deps: upgrade to c-ares v1.16.1
codebytere Sep 24, 2020
0d8eaa3
src: allow N-API addon in `AddLinkedBinding()`
addaleax Sep 22, 2020
1e1cb94
src: fix incorrect SIGSEGV handling in NODE_USE_V8_WASM_TRAP_HANDLER
korniltsev Sep 21, 2020
d7c28c9
test,child_process: add tests for signalCode value
Trott Sep 24, 2020
1758ac8
doc: added version 7 to N-API version matrix
NickNaso Sep 23, 2020
87dfed0
doc: add gpg key export directions to releases doc
danielleadams Sep 22, 2020
19b95a7
deps: upgrade to libuv 1.40.0
cjihrig Sep 25, 2020
f2635b3
test: replace annonymous functions with arrow
PoojaDurgad Aug 25, 2020
857e321
doc: set encoding to hex before piping hash
vbarzana Sep 25, 2020
86ac749
doc: add history entry for breaking destroy() change
kanongil Sep 24, 2020
0f4ecaa
repl: standardize Control key indications
Trott Sep 19, 2020
010173a
doc: edit n-api.md for minor improvements
Trott Sep 26, 2020
f551f52
module: named exports for CJS via static analysis
guybedford May 15, 2020
80eb221
tools: update ESLint to 7.10.0
cjihrig Sep 26, 2020
70ad69b
doc: outline when origin is set to unhandledRejection
mlarcher Sep 22, 2020
99a79e3
fs: fix fs.promises.writeFile with typed arrays
targos Sep 27, 2020
46a4154
doc: packages docs feedback
guybedford Sep 27, 2020
02db136
doc: alphabetize error list
Trott Sep 15, 2020
2e10616
doc: remove http2 non-link anchor tags
Trott Sep 12, 2020
c048607
2020-09-29, Version 14.13.0 (Current)
MylesBorins Sep 29, 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: document support for package.json fields
Fixes: #33143

PR-URL: #34970
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
aduh95 authored and MylesBorins committed Sep 24, 2020
commit 1d1ce1fc2cff5935644b0c019cdefdfbea34f046
17 changes: 9 additions & 8 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1391,13 +1391,13 @@ An invalid or unknown file encoding was passed.
<a id="ERR_INVALID_PACKAGE_CONFIG"></a>
### `ERR_INVALID_PACKAGE_CONFIG`

An invalid `package.json` file failed parsing.
An invalid [`package.json`][] file was found which failed parsing.

<a id="ERR_INVALID_PACKAGE_TARGET"></a>
### `ERR_INVALID_PACKAGE_TARGET`

The `package.json` [exports][] field contains an invalid target mapping value
for the attempted module resolution.
The `package.json` [`"exports"`][] field contains an invalid target mapping
value for the attempted module resolution.

<a id="ERR_INVALID_PERFORMANCE_MARK"></a>
### `ERR_INVALID_PERFORMANCE_MARK`
Expand Down Expand Up @@ -1712,13 +1712,13 @@ A given value is out of the accepted range.
<a id="ERR_PACKAGE_IMPORT_NOT_DEFINED"></a>
### `ERR_PACKAGE_IMPORT_NOT_DEFINED`

The `package.json` ["imports" field][] does not define the given internal
The `package.json` [`"imports"`][] field does not define the given internal
package specifier mapping.

<a id="ERR_PACKAGE_PATH_NOT_EXPORTED"></a>
### `ERR_PACKAGE_PATH_NOT_EXPORTED`

The `package.json` [exports][] field does not export the requested subpath.
The `package.json` [`"exports"`][] field does not export the requested subpath.
Because exports are encapsulated, private internal modules that are not exported
cannot be imported through the package resolution, unless using an absolute URL.

Expand Down Expand Up @@ -2074,7 +2074,7 @@ signal (such as [`subprocess.kill()`][]).

`import` a directory URL is unsupported. Instead,
[self-reference a package using its name][] and [define a custom subpath][] in
the `"exports"` field of the `package.json` file.
the [`"exports"`][] field of the [`package.json`][] file.

<!-- eslint-skip -->
```js
Expand Down Expand Up @@ -2560,7 +2560,8 @@ closed.
[crypto digest algorithm]: crypto.html#crypto_crypto_gethashes
[domains]: domain.html
[event emitter-based]: events.html#events_class_eventemitter
[exports]: packages.html#packages_package_entry_points
[`package.json`]: packages.html#packages_node_js_package_json_field_definitions
[`"exports"`]: packages.html#packages_exports
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
[policy]: policy.html
[stream-based]: stream.html
Expand All @@ -2570,4 +2571,4 @@ closed.
[vm]: vm.html
[self-reference a package using its name]: packages.html#packages_self_referencing_a_package_using_its_name
[define a custom subpath]: packages.html#packages_subpath_exports
["imports" field]: packages.html#packages_internal_package_imports
[`"imports"`]: packages.html#packages_imports
11 changes: 7 additions & 4 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ specifier resolution, and default behavior.

Node.js treats JavaScript code as CommonJS modules by default.
Authors can tell Node.js to treat JavaScript code as ECMAScript modules
via the `.mjs` file extension, the `package.json` `"type"` field, or the
via the `.mjs` file extension, the `package.json` [`"type"`][] field, or the
`--input-type` flag. See
[Modules: Packages](packages.html#packages_determining_module_system) for more
details.
Expand Down Expand Up @@ -253,9 +253,9 @@ can either be an URL-style relative path like `'./file.mjs'` or a package name
like `'fs'`.

Like in CommonJS, files within packages can be accessed by appending a path to
the package name; unless the package’s `package.json` contains an `"exports"`
field, in which case files within packages need to be accessed via the path
defined in `"exports"`.
the package name; unless the package’s [`package.json`][] contains an
[`"exports"`][] field, in which case files within packages need to be accessed
via the path defined in [`"exports"`][].

```js
import { sin, cos } from 'geometry/trigonometry-functions.mjs';
Expand Down Expand Up @@ -1159,3 +1159,6 @@ success!
[6.1.7 Array Index]: https://tc39.es/ecma262/#integer-index
[Top-Level Await]: https://github.com/tc39/proposal-top-level-await
[Core modules]: modules.html#modules_core_modules
[`package.json`]: packages.html#packages_node_js_package_json_field_definitions
[`"exports"`]: packages.html#packages_exports
[`"type"`]: packages.html#packages_type
12 changes: 7 additions & 5 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ directories, and then provide a single entry point to those directories.
There are three ways in which a folder may be passed to `require()` as
an argument.

The first is to create a `package.json` file in the root of the folder,
which specifies a `main` module. An example `package.json` file might
The first is to create a [`package.json`][] file in the root of the folder,
which specifies a `main` module. An example [`package.json`][] file might
look like this:

```json
Expand All @@ -405,10 +405,10 @@ If this was in a folder at `./some-library`, then

This is the extent of the awareness of `package.json` files within Node.js.

If there is no `package.json` file present in the directory, or if the
`'main'` entry is missing or cannot be resolved, then Node.js
If there is no [`package.json`][] file present in the directory, or if the
[`"main"`][] entry is missing or cannot be resolved, then Node.js
will attempt to load an `index.js` or `index.node` file out of that
directory. For example, if there was no `package.json` file in the above
directory. For example, if there was no [`package.json`][] file in the previous
example, then `require('./some-library')` would attempt to load:

* `./some-library/index.js`
Expand Down Expand Up @@ -986,3 +986,5 @@ This section was moved to
[module resolution]: #modules_all_together
[native addons]: addons.html
[`require.main`]: #modules_require_main
[`package.json`]: packages.html#packages_node_js_package_json_field_definitions
[`"main"`]: packages.html#packages_main
Loading