Skip to content

Commit 0869525

Browse files
committed
docs: add missing llm_description
1 parent 0eeccd2 commit 0869525

File tree

6 files changed

+78
-66
lines changed

6 files changed

+78
-66
lines changed

doc/api/async_context.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
77
<!-- source_link=lib/async_hooks.js -->
88

9+
<!-- llm_description=Tracks asynchronous execution context. Enables storing and propagating state across async operations like callbacks and promises. Useful for request tracking, logging, or context management. Provides AsyncLocalStorage for scoped storage and AsyncResource for custom async context binding. -->
10+
911
## Introduction
1012

1113
These classes are used to associate state and propagate it throughout

doc/api/esm.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
<!--introduced_in=v8.5.0-->
44

5+
<!-- llm_description=Provides support for ECMAScript modules in Node.js, enabling standards-based module syntax (import/export) and interoperability with CommonJS. -->
6+
57
<!-- type=misc -->
68

79
<!-- YAML

doc/api/module.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
<!--introduced_in=v12.20.0-->
44

5+
<!-- llm_description=Provides utilities for interacting with Node.js modules, including support for module creation, resolution, customization hooks, and compile caching. Enables advanced module loading behavior. -->
6+
57
<!-- YAML
68
added: v0.3.7
79
-->

doc/api/packages.md

Lines changed: 68 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
<!-- type=misc -->
66

7+
<!-- llm_description=Defines how Node.js resolves and loads modules via fields like type, exports, and imports. Controls module format, entry points, and package encapsulation. -->
8+
79
<!-- YAML
810
changes:
911
- version:
@@ -61,15 +63,15 @@ Node.js will treat the following as [ES modules][] when passed to `node` as the
6163
initial input, or when referenced by `import` statements or `import()`
6264
expressions:
6365

64-
* Files with an `.mjs` extension.
66+
- Files with an `.mjs` extension.
6567

66-
* Files with a `.js` extension when the nearest parent `package.json` file
68+
- Files with a `.js` extension when the nearest parent `package.json` file
6769
contains a top-level [`"type"`][] field with a value of `"module"`.
6870

69-
* Strings passed in as an argument to `--eval`, or piped to `node` via `STDIN`,
71+
- Strings passed in as an argument to `--eval`, or piped to `node` via `STDIN`,
7072
with the flag `--input-type=module`.
7173

72-
* Code containing syntax only successfully parsed as [ES modules][], such as
74+
- Code containing syntax only successfully parsed as [ES modules][], such as
7375
`import` or `export` statements or `import.meta`, with no explicit marker of
7476
how it should be interpreted. Explicit markers are `.mjs` or `.cjs`
7577
extensions, `package.json` `"type"` fields with either `"module"` or
@@ -81,15 +83,15 @@ Node.js will treat the following as [CommonJS][] when passed to `node` as the
8183
initial input, or when referenced by `import` statements or `import()`
8284
expressions:
8385

84-
* Files with a `.cjs` extension.
86+
- Files with a `.cjs` extension.
8587

86-
* Files with a `.js` extension when the nearest parent `package.json` file
88+
- Files with a `.js` extension when the nearest parent `package.json` file
8789
contains a top-level field [`"type"`][] with a value of `"commonjs"`.
8890

89-
* Strings passed in as an argument to `--eval` or `--print`, or piped to `node`
91+
- Strings passed in as an argument to `--eval` or `--print`, or piped to `node`
9092
via `STDIN`, with the flag `--input-type=commonjs`.
9193

92-
* Files with a `.js` extension with no parent `package.json` file or where the
94+
- Files with a `.js` extension with no parent `package.json` file or where the
9395
nearest parent `package.json` file lacks a `type` field, and where the code
9496
can evaluate successfully as CommonJS. In other words, Node.js tries to run
9597
such "ambiguous" files as CommonJS first, and will retry evaluating them as ES
@@ -127,19 +129,19 @@ as an ES module.
127129

128130
Ambiguous input is defined as:
129131

130-
* Files with a `.js` extension or no extension; and either no controlling
132+
- Files with a `.js` extension or no extension; and either no controlling
131133
`package.json` file or one that lacks a `type` field.
132-
* String input (`--eval` or `STDIN`) when `--input-type`is not specified.
134+
- String input (`--eval` or `STDIN`) when `--input-type`is not specified.
133135

134136
ES module syntax is defined as syntax that would throw when evaluated as
135137
CommonJS. This includes the following:
136138

137-
* `import` statements (but _not_ `import()` expressions, which are valid in
139+
- `import` statements (but _not_ `import()` expressions, which are valid in
138140
CommonJS).
139-
* `export` statements.
140-
* `import.meta` references.
141-
* `await` at the top level of a module.
142-
* Lexical redeclarations of the CommonJS wrapper variables (`require`, `module`,
141+
- `export` statements.
142+
- `import.meta` references.
143+
- `await` at the top level of a module.
144+
- Lexical redeclarations of the CommonJS wrapper variables (`require`, `module`,
143145
`exports`, `__dirname`, `__filename`).
144146

145147
### Modules loaders
@@ -148,36 +150,36 @@ Node.js has two systems for resolving a specifier and loading modules.
148150

149151
There is the CommonJS module loader:
150152

151-
* It is fully synchronous.
152-
* It is responsible for handling `require()` calls.
153-
* It is monkey patchable.
154-
* It supports [folders as modules][].
155-
* When resolving a specifier, if no exact match is found, it will try to add
153+
- It is fully synchronous.
154+
- It is responsible for handling `require()` calls.
155+
- It is monkey patchable.
156+
- It supports [folders as modules][].
157+
- When resolving a specifier, if no exact match is found, it will try to add
156158
extensions (`.js`, `.json`, and finally `.node`) and then attempt to resolve
157159
[folders as modules][].
158-
* It treats `.json` as JSON text files.
159-
* `.node` files are interpreted as compiled addon modules loaded with
160+
- It treats `.json` as JSON text files.
161+
- `.node` files are interpreted as compiled addon modules loaded with
160162
`process.dlopen()`.
161-
* It treats all files that lack `.json` or `.node` extensions as JavaScript
163+
- It treats all files that lack `.json` or `.node` extensions as JavaScript
162164
text files.
163-
* It can only be used to [load ECMAScript modules from CommonJS modules][] if
165+
- It can only be used to [load ECMAScript modules from CommonJS modules][] if
164166
the module graph is synchronous (that contains no top-level `await`).
165167
When used to load a JavaScript text file that is not an ECMAScript module,
166168
the file will be loaded as a CommonJS module.
167169

168170
There is the ECMAScript module loader:
169171

170-
* It is asynchronous, unless it's being used to load modules for `require()`.
171-
* It is responsible for handling `import` statements and `import()` expressions.
172-
* It is not monkey patchable, can be customized using [loader hooks][].
173-
* It does not support folders as modules, directory indexes (e.g.
172+
- It is asynchronous, unless it's being used to load modules for `require()`.
173+
- It is responsible for handling `import` statements and `import()` expressions.
174+
- It is not monkey patchable, can be customized using [loader hooks][].
175+
- It does not support folders as modules, directory indexes (e.g.
174176
`'./startup/index.js'`) must be fully specified.
175-
* It does no extension searching. A file extension must be provided
177+
- It does no extension searching. A file extension must be provided
176178
when the specifier is a relative or absolute file URL.
177-
* It can load JSON modules, but an import type attribute is required.
178-
* It accepts only `.js`, `.mjs`, and `.cjs` extensions for JavaScript text
179+
- It can load JSON modules, but an import type attribute is required.
180+
- It accepts only `.js`, `.mjs`, and `.cjs` extensions for JavaScript text
179181
files.
180-
* It can be used to load JavaScript CommonJS modules. Such modules
182+
- It can be used to load JavaScript CommonJS modules. Such modules
181183
are passed through the `cjs-module-lexer` to try to identify named exports,
182184
which are available if they can be determined through static analysis.
183185
Imported CommonJS modules have their URLs converted to absolute
@@ -229,12 +231,12 @@ import 'commonjs-package/src/index.mjs';
229231
The `.mjs` and `.cjs` extensions can be used to mix types within the same
230232
package:
231233

232-
* Within a `"type": "module"` package, Node.js can be instructed to
234+
- Within a `"type": "module"` package, Node.js can be instructed to
233235
interpret a particular file as [CommonJS][] by naming it with a `.cjs`
234236
extension (since both `.js` and `.mjs` files are treated as ES modules within
235237
a `"module"` package).
236238

237-
* Within a `"type": "commonjs"` package, Node.js can be instructed to
239+
- Within a `"type": "commonjs"` package, Node.js can be instructed to
238240
interpret a particular file as an [ES module][] by naming it with an `.mjs`
239241
extension (since both `.js` and `.cjs` files are treated as CommonJS within a
240242
`"commonjs"` package).
@@ -449,8 +451,8 @@ keys) must be relative URL strings starting with `./`.
449451
{
450452
"name": "my-package",
451453
"exports": {
452-
".": "./dist/main.js", // Correct
453-
"./feature": "./lib/feature.js", // Correct
454+
".": "./dist/main.js", // Correct
455+
"./feature": "./lib/feature.js" // Correct
454456
// "./origin-relative": "/dist/main.js", // Incorrect: Must start with ./
455457
// "./absolute": "file:///dev/null", // Incorrect: Must start with ./
456458
// "./outside": "../common/util.js" // Incorrect: Must start with ./
@@ -460,9 +462,9 @@ keys) must be relative URL strings starting with `./`.
460462

461463
Reasons for this behavior include:
462464

463-
* **Security:** Prevents exporting arbitrary files from outside the
465+
- **Security:** Prevents exporting arbitrary files from outside the
464466
package's own directory.
465-
* **Encapsulation:** Ensures all exported paths are resolved relative to
467+
- **Encapsulation:** Ensures all exported paths are resolved relative to
466468
the package root, making the package self-contained.
467469

468470
##### No path traversal or invalid segments
@@ -673,28 +675,28 @@ For example, a package that wants to provide different ES module exports for
673675
Node.js implements the following conditions, listed in order from most
674676
specific to least specific as conditions should be defined:
675677

676-
* `"node-addons"` - similar to `"node"` and matches for any Node.js environment.
678+
- `"node-addons"` - similar to `"node"` and matches for any Node.js environment.
677679
This condition can be used to provide an entry point which uses native C++
678680
addons as opposed to an entry point which is more universal and doesn't rely
679681
on native addons. This condition can be disabled via the
680682
[`--no-addons` flag][].
681-
* `"node"` - matches for any Node.js environment. Can be a CommonJS or ES
683+
- `"node"` - matches for any Node.js environment. Can be a CommonJS or ES
682684
module file. _In most cases explicitly calling out the Node.js platform is
683685
not necessary._
684-
* `"import"` - matches when the package is loaded via `import` or
686+
- `"import"` - matches when the package is loaded via `import` or
685687
`import()`, or via any top-level import or resolve operation by the
686688
ECMAScript module loader. Applies regardless of the module format of the
687689
target file. _Always mutually exclusive with `"require"`._
688-
* `"require"` - matches when the package is loaded via `require()`. The
690+
- `"require"` - matches when the package is loaded via `require()`. The
689691
referenced file should be loadable with `require()` although the condition
690692
matches regardless of the module format of the target file. Expected
691693
formats include CommonJS, JSON, native addons, and ES modules. _Always mutually
692694
exclusive with `"import"`._
693-
* `"module-sync"` - matches no matter the package is loaded via `import`,
695+
- `"module-sync"` - matches no matter the package is loaded via `import`,
694696
`import()` or `require()`. The format is expected to be ES modules that does
695697
not contain top-level await in its module graph - if it does,
696698
`ERR_REQUIRE_ASYNC_MODULE` will be thrown when the module is `require()`-ed.
697-
* `"default"` - the generic fallback that always matches. Can be a CommonJS
699+
- `"default"` - the generic fallback that always matches. Can be a CommonJS
698700
or ES module file. _This condition should always come last._
699701

700702
Within the [`"exports"`][] object, key order is significant. During condition
@@ -809,14 +811,14 @@ Since custom package conditions require clear definitions to ensure correct
809811
usage, a list of common known package conditions and their strict definitions
810812
is provided below to assist with ecosystem coordination.
811813

812-
* `"types"` - can be used by typing systems to resolve the typing file for
814+
- `"types"` - can be used by typing systems to resolve the typing file for
813815
the given export. _This condition should always be included first._
814-
* `"browser"` - any web browser environment.
815-
* `"development"` - can be used to define a development-only environment
816+
- `"browser"` - any web browser environment.
817+
- `"development"` - can be used to define a development-only environment
816818
entry point, for example to provide additional debugging context such as
817819
better error messages when running in a development mode. _Must always be
818820
mutually exclusive with `"production"`._
819-
* `"production"` - can be used to define a production environment entry
821+
- `"production"` - can be used to define a production environment entry
820822
point. _Must always be mutually exclusive with `"development"`._
821823

822824
For other runtimes, platform-specific condition key definitions are maintained
@@ -826,16 +828,16 @@ New conditions definitions may be added to this list by creating a pull request
826828
to the [Node.js documentation for this section][]. The requirements for listing
827829
a new condition definition here are that:
828830

829-
* The definition should be clear and unambiguous for all implementers.
830-
* The use case for why the condition is needed should be clearly justified.
831-
* There should exist sufficient existing implementation usage.
832-
* The condition name should not conflict with another condition definition or
831+
- The definition should be clear and unambiguous for all implementers.
832+
- The use case for why the condition is needed should be clearly justified.
833+
- There should exist sufficient existing implementation usage.
834+
- The condition name should not conflict with another condition definition or
833835
condition in wide usage.
834-
* The listing of the condition definition should provide a coordination
836+
- The listing of the condition definition should provide a coordination
835837
benefit to the ecosystem that wouldn't otherwise be possible. For example,
836838
this would not necessarily be the case for company-specific or
837839
application-specific conditions.
838-
* The condition should be such that a Node.js user would expect it to be in
840+
- The condition should be such that a Node.js user would expect it to be in
839841
Node.js core documentation. The `"types"` condition is a good example: It
840842
doesn't really belong in the [Runtime Keys][] proposal but is a good fit
841843
here in the Node.js docs.
@@ -939,15 +941,15 @@ additional fields which are ignored by Node.js and not documented here.
939941

940942
The following fields in `package.json` files are used in Node.js:
941943

942-
* [`"name"`][] - Relevant when using named imports within a package. Also used
944+
- [`"name"`][] - Relevant when using named imports within a package. Also used
943945
by package managers as the name of the package.
944-
* [`"main"`][] - The default module when loading the package, if exports is not
946+
- [`"main"`][] - The default module when loading the package, if exports is not
945947
specified, and in versions of Node.js prior to the introduction of exports.
946-
* [`"type"`][] - The package type determining whether to load `.js` files as
948+
- [`"type"`][] - The package type determining whether to load `.js` files as
947949
CommonJS or ES modules.
948-
* [`"exports"`][] - Package exports and conditional exports. When present,
950+
- [`"exports"`][] - Package exports and conditional exports. When present,
949951
limits which submodules can be loaded from within the package.
950-
* [`"imports"`][] - Package imports, for use by modules within the package
952+
- [`"imports"`][] - Package imports, for use by modules within the package
951953
itself.
952954

953955
### `"name"`
@@ -964,7 +966,7 @@ changes:
964966
description: Remove the `--experimental-resolve-self` option.
965967
-->
966968

967-
* Type: {string}
969+
- Type: {string}
968970

969971
```json
970972
{
@@ -985,7 +987,7 @@ The `"name"` field can be used in addition to the [`"exports"`][] field to
985987
added: v0.4.0
986988
-->
987989

988-
* Type: {string}
990+
- Type: {string}
989991

990992
```json
991993
{
@@ -994,7 +996,7 @@ added: v0.4.0
994996
```
995997

996998
The `"main"` field defines the entry point of a package when imported by name
997-
via a `node_modules` lookup. Its value is a path.
999+
via a `node_modules` lookup. Its value is a path.
9981000

9991001
When a package has an [`"exports"`][] field, this will take precedence over the
10001002
`"main"` field when importing the package by name.
@@ -1019,7 +1021,7 @@ changes:
10191021
description: Unflag `--experimental-modules`.
10201022
-->
10211023

1022-
* Type: {string}
1024+
- Type: {string}
10231025

10241026
The `"type"` field defines the module format that Node.js uses for all
10251027
`.js` files that have that `package.json` file as their nearest parent.
@@ -1030,7 +1032,7 @@ Files ending with `.js` are loaded as ES modules when the nearest parent
10301032

10311033
The nearest parent `package.json` is defined as the first `package.json` found
10321034
when searching in the current folder, that folder's parent, and so on up
1033-
until a node\_modules folder or the volume root is reached.
1035+
until a node_modules folder or the volume root is reached.
10341036

10351037
```json
10361038
// package.json
@@ -1092,7 +1094,7 @@ changes:
10921094
description: Implement conditional exports.
10931095
-->
10941096

1095-
* Type: {Object|string|string\[]}
1097+
- Type: {Object|string|string\[]}
10961098

10971099
```json
10981100
{
@@ -1121,7 +1123,7 @@ added:
11211123
- v12.19.0
11221124
-->
11231125

1124-
* Type: {Object}
1126+
- Type: {Object}
11251127

11261128
```json
11271129
// package.json

doc/api/synopsis.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Usage and example
22

3+
<!-- llm_description=Overview of basic Node.js usage via CLI. Illustrates how to run scripts and provides a simple web server example. -->
4+
35
## Usage
46

57
<!--introduced_in=v0.10.0-->

doc/api/typescript.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ changes:
1515

1616
<!--introduced_in=v22.6.0-->
1717

18+
<!-- llm_description=Provides lightweight TypeScript support in Node.js via type stripping. Enables execution of .ts files without type checking or full compiler features. -->
19+
1820
> Stability: 1.2 - Release candidate
1921
2022
## Enabling

0 commit comments

Comments
 (0)