@types/node 20.12.7 → 20.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/util.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * ```js
7
7
  * const util = require('node:util');
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/util.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/util.js)
10
10
  */
11
11
  declare module "util" {
12
12
  import * as types from "node:util/types";
@@ -110,7 +110,7 @@ declare module "util" {
110
110
  }
111
111
  /**
112
112
  * The `util.format()` method returns a formatted string using the first argument
113
- * as a `printf`\-like format string which can contain zero or more format
113
+ * as a `printf`-like format string which can contain zero or more format
114
114
  * specifiers. Each specifier is replaced with the converted value from the
115
115
  * corresponding argument. Supported specifiers are:
116
116
  *
@@ -121,7 +121,7 @@ declare module "util" {
121
121
  * // Returns: 'foo:%s'
122
122
  * ```
123
123
  *
124
- * Values that are not part of the format string are formatted using`util.inspect()` if their type is not `string`.
124
+ * Values that are not part of the format string are formatted using `util.inspect()` if their type is not `string`.
125
125
  *
126
126
  * If there are more arguments passed to the `util.format()` method than the
127
127
  * number of specifiers, the extra arguments are concatenated to the returned
@@ -132,7 +132,7 @@ declare module "util" {
132
132
  * // Returns: 'foo:bar baz'
133
133
  * ```
134
134
  *
135
- * If the first argument does not contain a valid format specifier, `util.format()`returns a string that is the concatenation of all arguments separated by spaces:
135
+ * If the first argument does not contain a valid format specifier, `util.format()` returns a string that is the concatenation of all arguments separated by spaces:
136
136
  *
137
137
  * ```js
138
138
  * util.format(1, 2, 3);
@@ -265,7 +265,7 @@ declare module "util" {
265
265
  * The `util.inspect()` method returns a string representation of `object` that is
266
266
  * intended for debugging. The output of `util.inspect` may change at any time
267
267
  * and should not be depended upon programmatically. Additional `options` may be
268
- * passed that alter the result.`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make
268
+ * passed that alter the result. `util.inspect()` will use the constructor's name and/or `@@toStringTag` to make
269
269
  * an identifiable tag for an inspected value.
270
270
  *
271
271
  * ```js
@@ -507,7 +507,7 @@ declare module "util" {
507
507
  */
508
508
  export function isDate(object: unknown): object is Date;
509
509
  /**
510
- * Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`.
510
+ * Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`.
511
511
  *
512
512
  * ```js
513
513
  * const util = require('node:util');
@@ -521,7 +521,7 @@ declare module "util" {
521
521
  * ```
522
522
  *
523
523
  * This method relies on `Object.prototype.toString()` behavior. It is
524
- * possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`.
524
+ * possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`.
525
525
  *
526
526
  * ```js
527
527
  * const util = require('node:util');
@@ -538,11 +538,11 @@ declare module "util" {
538
538
  */
539
539
  export function isError(object: unknown): object is Error;
540
540
  /**
541
- * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and`extends` keywords to get language level inheritance support. Also note
541
+ * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and `extends` keywords to get language level inheritance support. Also note
542
542
  * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179).
543
543
  *
544
544
  * Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The
545
- * prototype of `constructor` will be set to a new object created from`superConstructor`.
545
+ * prototype of `constructor` will be set to a new object created from `superConstructor`.
546
546
  *
547
547
  * This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`.
548
548
  * As an additional convenience, `superConstructor` will be accessible
@@ -693,7 +693,7 @@ declare module "util" {
693
693
  */
694
694
  export function isBuffer(object: unknown): object is Buffer;
695
695
  /**
696
- * Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`.
696
+ * Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`.
697
697
  *
698
698
  * ```js
699
699
  * const util = require('node:util');
@@ -881,7 +881,7 @@ declare module "util" {
881
881
  * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');
882
882
  * ```
883
883
  *
884
- * When called, `util.deprecate()` will return a function that will emit a`DeprecationWarning` using the `'warning'` event. The warning will
884
+ * When called, `util.deprecate()` will return a function that will emit a `DeprecationWarning` using the `'warning'` event. The warning will
885
885
  * be emitted and printed to `stderr` the first time the returned function is
886
886
  * called. After the warning is emitted, the wrapped function is called without
887
887
  * emitting a warning.
@@ -907,10 +907,10 @@ declare module "util" {
907
907
  * stack trace are printed to `stderr` the first time the deprecated function is
908
908
  * called.
909
909
  *
910
- * If the `--throw-deprecation` command-line flag is set, or the`process.throwDeprecation` property is set to `true`, then an exception will be
910
+ * If the `--throw-deprecation` command-line flag is set, or the `process.throwDeprecation` property is set to `true`, then an exception will be
911
911
  * thrown when the deprecated function is called.
912
912
  *
913
- * The `--throw-deprecation` command-line flag and `process.throwDeprecation`property take precedence over `--trace-deprecation` and`process.traceDeprecation`.
913
+ * The `--throw-deprecation` command-line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation` and `process.traceDeprecation`.
914
914
  * @since v0.8.0
915
915
  * @param fn The function that is being deprecated.
916
916
  * @param msg A warning message to display when the deprecated function is invoked.
@@ -941,7 +941,7 @@ declare module "util" {
941
941
  * Takes an `async` function (or a function that returns a `Promise`) and returns a
942
942
  * function following the error-first callback style, i.e. taking
943
943
  * an `(err, value) => ...` callback as the last argument. In the callback, the
944
- * first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value.
944
+ * first argument will be the rejection reason (or `null` if the `Promise` resolved), and the second argument will be the resolved value.
945
945
  *
946
946
  * ```js
947
947
  * const util = require('node:util');
@@ -968,7 +968,7 @@ declare module "util" {
968
968
  *
969
969
  * Since `null` has a special meaning as the first argument to a callback, if a
970
970
  * wrapped function rejects a `Promise` with a falsy value as a reason, the value
971
- * is wrapped in an `Error` with the original value stored in a field named`reason`.
971
+ * is wrapped in an `Error` with the original value stored in a field named `reason`.
972
972
  *
973
973
  * ```js
974
974
  * function fn() {
@@ -1097,10 +1097,10 @@ declare module "util" {
1097
1097
  * callStat();
1098
1098
  * ```
1099
1099
  *
1100
- * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`.
1100
+ * If there is an `original[util.promisify.custom]` property present, `promisify` will return its value, see `Custom promisified functions`.
1101
1101
  *
1102
1102
  * `promisify()` assumes that `original` is a function taking a callback as its
1103
- * final argument in all cases. If `original` is not a function, `promisify()`will throw an error. If `original` is a function but its last argument is not
1103
+ * final argument in all cases. If `original` is not a function, `promisify()` will throw an error. If `original` is a function but its last argument is not
1104
1104
  * an error-first callback, it will still be passed an error-first
1105
1105
  * callback as its last argument.
1106
1106
  *
@@ -1173,6 +1173,99 @@ declare module "util" {
1173
1173
  */
1174
1174
  const custom: unique symbol;
1175
1175
  }
1176
+ /**
1177
+ * Stability: 1.1 - Active development
1178
+ * Given an example `.env` file:
1179
+ *
1180
+ * ```js
1181
+ * const { parseEnv } = require('node:util');
1182
+ *
1183
+ * parseEnv('HELLO=world\nHELLO=oh my\n');
1184
+ * // Returns: { HELLO: 'oh my' }
1185
+ * ```
1186
+ * @param content The raw contents of a `.env` file.
1187
+ * @since v20.12.0
1188
+ */
1189
+ export function parseEnv(content: string): object;
1190
+ // https://nodejs.org/docs/latest/api/util.html#foreground-colors
1191
+ type ForegroundColors =
1192
+ | "black"
1193
+ | "blackBright"
1194
+ | "blue"
1195
+ | "blueBright"
1196
+ | "cyan"
1197
+ | "cyanBright"
1198
+ | "gray"
1199
+ | "green"
1200
+ | "greenBright"
1201
+ | "grey"
1202
+ | "magenta"
1203
+ | "magentaBright"
1204
+ | "red"
1205
+ | "redBright"
1206
+ | "white"
1207
+ | "whiteBright"
1208
+ | "yellow"
1209
+ | "yellowBright";
1210
+ // https://nodejs.org/docs/latest/api/util.html#background-colors
1211
+ type BackgroundColors =
1212
+ | "bgBlack"
1213
+ | "bgBlackBright"
1214
+ | "bgBlue"
1215
+ | "bgBlueBright"
1216
+ | "bgCyan"
1217
+ | "bgCyanBright"
1218
+ | "bgGray"
1219
+ | "bgGreen"
1220
+ | "bgGreenBright"
1221
+ | "bgGrey"
1222
+ | "bgMagenta"
1223
+ | "bgMagentaBright"
1224
+ | "bgRed"
1225
+ | "bgRedBright"
1226
+ | "bgWhite"
1227
+ | "bgWhiteBright"
1228
+ | "bgYellow"
1229
+ | "bgYellowBright";
1230
+ // https://nodejs.org/docs/latest/api/util.html#modifiers
1231
+ type Modifiers =
1232
+ | "blink"
1233
+ | "bold"
1234
+ | "dim"
1235
+ | "doubleunderline"
1236
+ | "framed"
1237
+ | "hidden"
1238
+ | "inverse"
1239
+ | "italic"
1240
+ | "overlined"
1241
+ | "reset"
1242
+ | "strikethrough"
1243
+ | "underline";
1244
+ /**
1245
+ * Stability: 1.1 - Active development
1246
+ *
1247
+ * This function returns a formatted text considering the `format` passed.
1248
+ *
1249
+ * ```js
1250
+ * const { styleText } = require('node:util');
1251
+ * const errorMessage = styleText('red', 'Error! Error!');
1252
+ * console.log(errorMessage);
1253
+ * ```
1254
+ *
1255
+ * `util.inspect.colors` also provides text formats such as `italic`, and `underline` and you can combine both:
1256
+ *
1257
+ * ```js
1258
+ * console.log(
1259
+ * util.styleText('underline', util.styleText('italic', 'My italic underlined message')),
1260
+ * );
1261
+ * ```
1262
+ *
1263
+ * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v20.x/api/util.html#modifiers).
1264
+ * @param format A text format defined in `util.inspect.colors`.
1265
+ * @param text The text to to be formatted.
1266
+ * @since v20.12.0
1267
+ */
1268
+ export function styleText(format: ForegroundColors | BackgroundColors | Modifiers, text: string): string;
1176
1269
  /**
1177
1270
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
1178
1271
  *
@@ -1210,7 +1303,7 @@ declare module "util" {
1210
1303
  * incomplete byte sequences occurring at the end of the `input` are buffered
1211
1304
  * internally and emitted after the next call to `textDecoder.decode()`.
1212
1305
  *
1213
- * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a`TypeError` being thrown.
1306
+ * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown.
1214
1307
  * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data.
1215
1308
  */
1216
1309
  decode(
@@ -1589,7 +1682,7 @@ declare module "util" {
1589
1682
  toString(): string;
1590
1683
  }
1591
1684
  /**
1592
- * The `MIMEParams` API provides read and write access to the parameters of a`MIMEType`.
1685
+ * The `MIMEParams` API provides read and write access to the parameters of a `MIMEType`.
1593
1686
  * @since v19.1.0, v18.13.0
1594
1687
  */
1595
1688
  export class MIMEParams {
@@ -1630,7 +1723,7 @@ declare module "util" {
1630
1723
  */
1631
1724
  keys(): IterableIterator<string>;
1632
1725
  /**
1633
- * Sets the value in the `MIMEParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`,
1726
+ * Sets the value in the `MIMEParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`,
1634
1727
  * set the first such pair's value to `value`.
1635
1728
  *
1636
1729
  * ```js
@@ -1965,8 +2058,8 @@ declare module "util/types" {
1965
2058
  * console.log(util.types.isNativeError(new MyError())); // true
1966
2059
  * ```
1967
2060
  *
1968
- * A value being `instanceof` a native error class is not equivalent to `isNativeError()`returning `true` for that value. `isNativeError()` returns `true` for errors
1969
- * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`for these errors:
2061
+ * A value being `instanceof` a native error class is not equivalent to `isNativeError()` returning `true` for that value. `isNativeError()` returns `true` for errors
2062
+ * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false` for these errors:
1970
2063
  *
1971
2064
  * ```js
1972
2065
  * const vm = require('node:vm');
node/v8.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * ```js
5
5
  * const v8 = require('node:v8');
6
6
  * ```
7
- * @see [source](https://github.com/nodejs/node/blob/v20.11.0/lib/v8.js)
7
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/v8.js)
8
8
  */
9
9
  declare module "v8" {
10
10
  import { Readable } from "node:stream";
@@ -70,7 +70,7 @@ declare module "v8" {
70
70
  /**
71
71
  * Returns an object with the following properties:
72
72
  *
73
- * `does_zap_garbage` is a 0/1 boolean, which signifies whether the`--zap_code_space` option is enabled or not. This makes V8 overwrite heap
73
+ * `does_zap_garbage` is a 0/1 boolean, which signifies whether the `--zap_code_space` option is enabled or not. This makes V8 overwrite heap
74
74
  * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger
75
75
  * because it continuously touches all heap pages and that makes them less likely
76
76
  * to get swapped out by the operating system.
@@ -170,7 +170,7 @@ declare module "v8" {
170
170
  * after the VM has started may result in unpredictable behavior, including
171
171
  * crashes and data loss; or it may simply do nothing.
172
172
  *
173
- * The V8 options available for a version of Node.js may be determined by running`node --v8-options`.
173
+ * The V8 options available for a version of Node.js may be determined by running `node --v8-options`.
174
174
  *
175
175
  * Usage:
176
176
  *
@@ -356,7 +356,7 @@ declare module "v8" {
356
356
  transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
357
357
  /**
358
358
  * Reads the underlying wire format version. Likely mostly to be useful to
359
- * legacy code reading old wire format versions. May not be called before`.readHeader()`.
359
+ * legacy code reading old wire format versions. May not be called before `.readHeader()`.
360
360
  */
361
361
  getWireFormatVersion(): number;
362
362
  /**
@@ -365,7 +365,7 @@ declare module "v8" {
365
365
  */
366
366
  readUint32(): number;
367
367
  /**
368
- * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`with two 32-bit unsigned integer entries.
368
+ * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]` with two 32-bit unsigned integer entries.
369
369
  * For use inside of a custom `deserializer._readHostObject()`.
370
370
  */
371
371
  readUint64(): [number, number];
@@ -438,7 +438,7 @@ declare module "v8" {
438
438
  */
439
439
  start(): void;
440
440
  /**
441
- * Stop collecting GC data and return an object.The content of object
441
+ * Stop collecting GC data and return an object. The content of object
442
442
  * is as follows.
443
443
  *
444
444
  * ```json
node/vm.d.ts CHANGED
@@ -34,7 +34,7 @@
34
34
  *
35
35
  * console.log(x); // 1; y is not defined.
36
36
  * ```
37
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/vm.js)
37
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/vm.js)
38
38
  */
39
39
  declare module "vm" {
40
40
  import { ImportAttributes } from "node:module";
@@ -42,12 +42,12 @@ declare module "vm" {
42
42
  interface BaseOptions {
43
43
  /**
44
44
  * Specifies the filename used in stack traces produced by this script.
45
- * Default: `''`.
45
+ * @default ''
46
46
  */
47
47
  filename?: string | undefined;
48
48
  /**
49
49
  * Specifies the line number offset that is displayed in stack traces produced by this script.
50
- * Default: `0`.
50
+ * @default 0
51
51
  */
52
52
  lineOffset?: number | undefined;
53
53
  /**
@@ -64,17 +64,19 @@ declare module "vm" {
64
64
  /** @deprecated in favor of `script.createCachedData()` */
65
65
  produceCachedData?: boolean | undefined;
66
66
  /**
67
- * Called during evaluation of this module when `import()` is called.
68
- * If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`.
67
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
68
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
69
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v20.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
69
70
  */
70
71
  importModuleDynamically?:
71
72
  | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module)
73
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
72
74
  | undefined;
73
75
  }
74
76
  interface RunningScriptOptions extends BaseOptions {
75
77
  /**
76
78
  * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace.
77
- * Default: `true`.
79
+ * @default true
78
80
  */
79
81
  displayErrors?: boolean | undefined;
80
82
  /**
@@ -86,7 +88,7 @@ declare module "vm" {
86
88
  * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received.
87
89
  * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that.
88
90
  * If execution is terminated, an `Error` will be thrown.
89
- * Default: `false`.
91
+ * @default false
90
92
  */
91
93
  breakOnSigint?: boolean | undefined;
92
94
  }
@@ -122,7 +124,7 @@ declare module "vm" {
122
124
  cachedData?: Buffer | undefined;
123
125
  /**
124
126
  * Specifies whether to produce new cache data.
125
- * Default: `false`,
127
+ * @default false
126
128
  */
127
129
  produceCachedData?: boolean | undefined;
128
130
  /**
@@ -193,7 +195,7 @@ declare module "vm" {
193
195
  class Script {
194
196
  constructor(code: string, options?: ScriptOptions | string);
195
197
  /**
196
- * Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access
198
+ * Runs the compiled code contained by the `vm.Script` object within the given `contextifiedObject` and returns the result. Running code does not have access
197
199
  * to local scope.
198
200
  *
199
201
  * The following example compiles code that increments a global variable, sets
@@ -281,7 +283,7 @@ declare module "vm" {
281
283
  */
282
284
  runInThisContext(options?: RunningScriptOptions): any;
283
285
  /**
284
- * Creates a code cache that can be used with the `Script` constructor's`cachedData` option. Returns a `Buffer`. This method may be called at any
286
+ * Creates a code cache that can be used with the `Script` constructor's `cachedData` option. Returns a `Buffer`. This method may be called at any
285
287
  * time and any number of times.
286
288
  *
287
289
  * The code cache of the `Script` doesn't contain any JavaScript observable
@@ -319,7 +321,7 @@ declare module "vm" {
319
321
  cachedDataProduced?: boolean | undefined;
320
322
  /**
321
323
  * When `cachedData` is supplied to create the `vm.Script`, this value will be set
322
- * to either `true` or `false` depending on acceptance of the data by V8\.
324
+ * to either `true` or `false` depending on acceptance of the data by V8.
323
325
  * Otherwise the value is `undefined`.
324
326
  * @since v5.7.0
325
327
  */
@@ -472,9 +474,9 @@ declare module "vm" {
472
474
  * // Prints: evalResult: 'eval', localVar: 'eval'
473
475
  * ```
474
476
  *
475
- * Because `vm.runInThisContext()` does not have access to the local scope,`localVar` is unchanged. In contrast,
477
+ * Because `vm.runInThisContext()` does not have access to the local scope, `localVar` is unchanged. In contrast,
476
478
  * [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) _does_ have access to the
477
- * local scope, so the value `localVar` is changed. In this way`vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`.
479
+ * local scope, so the value `localVar` is changed. In this way `vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`.
478
480
  *
479
481
  * ## Example: Running an HTTP server within a VM
480
482
  *
@@ -536,7 +538,7 @@ declare module "vm" {
536
538
  * The format of the object that the returned Promise may resolve with is
537
539
  * specific to the V8 engine and may change from one version of V8 to the next.
538
540
  *
539
- * The returned result is different from the statistics returned by`v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measure the
541
+ * The returned result is different from the statistics returned by `v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measure the
540
542
  * memory reachable by each V8 specific contexts in the current instance of
541
543
  * the V8 engine, while the result of `v8.getHeapSpaceStatistics()` measure
542
544
  * the memory occupied by each heap space in the current V8 instance.
@@ -604,7 +606,7 @@ declare module "vm" {
604
606
  * flag enabled.
605
607
  *
606
608
  * The `vm.Module` class provides a low-level interface for using
607
- * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as
609
+ * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as
608
610
  * defined in the ECMAScript
609
611
  * specification.
610
612
  *
@@ -742,7 +744,7 @@ declare module "vm" {
742
744
  * * `'errored'`: The module has been evaluated, but an exception was thrown.
743
745
  *
744
746
  * Other than `'errored'`, this status string corresponds to the specification's [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)'s `[[Status]]` field. `'errored'`
745
- * corresponds to`'evaluated'` in the specification, but with `[[EvaluationError]]` set to a
747
+ * corresponds to `'evaluated'` in the specification, but with `[[EvaluationError]]` set to a
746
748
  * value that is not `undefined`.
747
749
  */
748
750
  status: ModuleStatus;
@@ -775,7 +777,7 @@ declare module "vm" {
775
777
  * * Its `status` must not be `'errored'`.
776
778
  *
777
779
  * If the returned `Module`'s `status` is `'unlinked'`, this method will be
778
- * recursively called on the returned `Module` with the same provided `linker`function.
780
+ * recursively called on the returned `Module` with the same provided `linker` function.
779
781
  *
780
782
  * `link()` returns a `Promise` that will either get resolved when all linking
781
783
  * instances resolve to a valid `Module`, or rejected if the linker function either
@@ -897,6 +899,22 @@ declare module "vm" {
897
899
  */
898
900
  setExport(name: string, value: any): void;
899
901
  }
902
+ /**
903
+ * Returns an object containing commonly used constants for VM operations.
904
+ * @since v20.12.0
905
+ */
906
+ namespace constants {
907
+ /**
908
+ * Stability: 1.1 - Active development
909
+ *
910
+ * A constant that can be used as the `importModuleDynamically` option to `vm.Script`
911
+ * and `vm.compileFunction()` so that Node.js uses the default ESM loader from the main
912
+ * context to load the requested module.
913
+ *
914
+ * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v20.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
915
+ */
916
+ const USE_MAIN_CONTEXT_DEFAULT_LOADER: number;
917
+ }
900
918
  }
901
919
  declare module "node:vm" {
902
920
  export * from "vm";
node/wasi.d.ts CHANGED
@@ -67,7 +67,7 @@
67
67
  * wat2wasm demo.wat
68
68
  * ```
69
69
  * @experimental
70
- * @see [source](https://github.com/nodejs/node/blob/v20.11.1/lib/wasi.js)
70
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/wasi.js)
71
71
  */
72
72
  declare module "wasi" {
73
73
  interface WASIOptions {
node/worker_threads.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * asynchronous I/O operations are more efficient than Workers can be.
12
12
  *
13
13
  * Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
14
- * so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer`instances.
14
+ * so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
15
15
  *
16
16
  * ```js
17
17
  * const {
@@ -49,7 +49,7 @@
49
49
  *
50
50
  * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
51
51
  * specifically `argv` and `execArgv` options.
52
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/worker_threads.js)
52
+ * @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/worker_threads.js)
53
53
  */
54
54
  declare module "worker_threads" {
55
55
  import { Blob } from "node:buffer";
@@ -69,7 +69,7 @@ declare module "worker_threads" {
69
69
  /**
70
70
  * Instances of the `worker.MessageChannel` class represent an asynchronous,
71
71
  * two-way communications channel.
72
- * The `MessageChannel` has no methods of its own. `new MessageChannel()`yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
72
+ * The `MessageChannel` has no methods of its own. `new MessageChannel()` yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
73
73
  *
74
74
  * ```js
75
75
  * const { MessageChannel } = require('node:worker_threads');
@@ -92,7 +92,7 @@ declare module "worker_threads" {
92
92
  /**
93
93
  * Instances of the `worker.MessagePort` class represent one end of an
94
94
  * asynchronous, two-way communications channel. It can be used to transfer
95
- * structured data, memory regions and other `MessagePort`s between different `Worker` s.
95
+ * structured data, memory regions and other `MessagePort`s between different `Worker`s.
96
96
  *
97
97
  * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
98
98
  * @since v10.5.0
@@ -100,7 +100,7 @@ declare module "worker_threads" {
100
100
  class MessagePort extends EventEmitter {
101
101
  /**
102
102
  * Disables further sending of messages on either side of the connection.
103
- * This method can be called when no further communication will happen over this`MessagePort`.
103
+ * This method can be called when no further communication will happen over this `MessagePort`.
104
104
  *
105
105
  * The `'close' event` is emitted on both `MessagePort` instances that
106
106
  * are part of the channel.
@@ -108,13 +108,13 @@ declare module "worker_threads" {
108
108
  */
109
109
  close(): void;
110
110
  /**
111
- * Sends a JavaScript value to the receiving side of this channel.`value` is transferred in a way which is compatible with
111
+ * Sends a JavaScript value to the receiving side of this channel. `value` is transferred in a way which is compatible with
112
112
  * the [HTML structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
113
113
  *
114
114
  * In particular, the significant differences to `JSON` are:
115
115
  *
116
116
  * * `value` may contain circular references.
117
- * * `value` may contain instances of builtin JS types such as `RegExp`s,`BigInt`s, `Map`s, `Set`s, etc.
117
+ * * `value` may contain instances of builtin JS types such as `RegExp`s, `BigInt`s, `Map`s, `Set`s, etc.
118
118
  * * `value` may contain typed arrays, both using `ArrayBuffer`s
119
119
  * and `SharedArrayBuffer`s.
120
120
  * * `value` may contain [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) instances.
@@ -140,7 +140,7 @@ declare module "worker_threads" {
140
140
  * If `value` contains [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances, those are accessible
141
141
  * from either thread. They cannot be listed in `transferList`.
142
142
  *
143
- * `value` may still contain `ArrayBuffer` instances that are not in`transferList`; in that case, the underlying memory is copied rather than moved.
143
+ * `value` may still contain `ArrayBuffer` instances that are not in `transferList`; in that case, the underlying memory is copied rather than moved.
144
144
  *
145
145
  * ```js
146
146
  * const { MessageChannel } = require('node:worker_threads');
@@ -186,16 +186,16 @@ declare module "worker_threads" {
186
186
  ref(): void;
187
187
  /**
188
188
  * Calling `unref()` on a port allows the thread to exit if this is the only
189
- * active handle in the event system. If the port is already `unref()`ed calling`unref()` again has no effect.
189
+ * active handle in the event system. If the port is already `unref()`ed calling `unref()` again has no effect.
190
190
  *
191
- * If listeners are attached or removed using `.on('message')`, the port is`ref()`ed and `unref()`ed automatically depending on whether
191
+ * If listeners are attached or removed using `.on('message')`, the port is `ref()`ed and `unref()`ed automatically depending on whether
192
192
  * listeners for the event exist.
193
193
  * @since v10.5.0
194
194
  */
195
195
  unref(): void;
196
196
  /**
197
197
  * Starts receiving messages on this `MessagePort`. When using this port
198
- * as an event emitter, this is called automatically once `'message'`listeners are attached.
198
+ * as an event emitter, this is called automatically once `'message'` listeners are attached.
199
199
  *
200
200
  * This method exists for parity with the Web `MessagePort` API. In Node.js,
201
201
  * it is only useful for ignoring messages when no event listener is present.
@@ -415,7 +415,7 @@ declare module "worker_threads" {
415
415
  ref(): void;
416
416
  /**
417
417
  * Calling `unref()` on a worker allows the thread to exit if this is the only
418
- * active handle in the event system. If the worker is already `unref()`ed calling`unref()` again has no effect.
418
+ * active handle in the event system. If the worker is already `unref()`ed calling `unref()` again has no effect.
419
419
  * @since v10.5.0
420
420
  */
421
421
  unref(): void;
@@ -574,7 +574,7 @@ declare module "worker_threads" {
574
574
  */
575
575
  function markAsUntransferable(object: object): void;
576
576
  /**
577
- * Transfer a `MessagePort` to a different `vm` Context. The original `port`object is rendered unusable, and the returned `MessagePort` instance
577
+ * Transfer a `MessagePort` to a different `vm` Context. The original `port` object is rendered unusable, and the returned `MessagePort` instance
578
578
  * takes its place.
579
579
  *
580
580
  * The returned `MessagePort` is an object in the target context and
@@ -592,7 +592,7 @@ declare module "worker_threads" {
592
592
  function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
593
593
  /**
594
594
  * Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
595
- * that contains the message payload, corresponding to the oldest message in the`MessagePort`'s queue.
595
+ * that contains the message payload, corresponding to the oldest message in the `MessagePort`'s queue.
596
596
  *
597
597
  * ```js
598
598
  * const { MessageChannel, receiveMessageOnPort } = require('node:worker_threads');
@@ -605,7 +605,7 @@ declare module "worker_threads" {
605
605
  * // Prints: undefined
606
606
  * ```
607
607
  *
608
- * When this function is used, no `'message'` event is emitted and the`onmessage` listener is not invoked.
608
+ * When this function is used, no `'message'` event is emitted and the `onmessage` listener is not invoked.
609
609
  * @since v12.3.0
610
610
  */
611
611
  function receiveMessageOnPort(port: MessagePort):
@@ -640,7 +640,7 @@ declare module "worker_threads" {
640
640
  */
641
641
  function getEnvironmentData(key: Serializable): Serializable;
642
642
  /**
643
- * The `worker.setEnvironmentData()` API sets the content of`worker.getEnvironmentData()` in the current thread and all new `Worker`instances spawned from the current context.
643
+ * The `worker.setEnvironmentData()` API sets the content of `worker.getEnvironmentData()` in the current thread and all new `Worker` instances spawned from the current context.
644
644
  * @since v15.12.0, v14.18.0
645
645
  * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
646
646
  * @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value