@types/node 25.3.4 → 25.4.0

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/module.d.ts CHANGED
@@ -383,59 +383,18 @@ declare module "node:module" {
383
383
  | "module-typescript"
384
384
  | "wasm";
385
385
  type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
386
- /**
387
- * The `initialize` hook provides a way to define a custom function that runs in
388
- * the hooks thread when the hooks module is initialized. Initialization happens
389
- * when the hooks module is registered via {@link register}.
390
- *
391
- * This hook can receive data from a {@link register} invocation, including
392
- * ports and other transferable objects. The return value of `initialize` can be a
393
- * `Promise`, in which case it will be awaited before the main application thread
394
- * execution resumes.
395
- */
396
386
  type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
397
387
  interface ResolveHookContext {
398
- /**
399
- * Export conditions of the relevant `package.json`
400
- */
401
388
  conditions: string[];
402
- /**
403
- * An object whose key-value pairs represent the assertions for the module to import
404
- */
405
389
  importAttributes: ImportAttributes;
406
- /**
407
- * The module importing this one, or undefined if this is the Node.js entry point
408
- */
409
390
  parentURL: string | undefined;
410
391
  }
411
392
  interface ResolveFnOutput {
412
- /**
413
- * A hint to the load hook (it might be ignored); can be an intermediary value.
414
- */
415
393
  format?: string | null | undefined;
416
- /**
417
- * The import attributes to use when caching the module (optional; if excluded the input will be used)
418
- */
419
394
  importAttributes?: ImportAttributes | undefined;
420
- /**
421
- * A signal that this hook intends to terminate the chain of `resolve` hooks.
422
- * @default false
423
- */
424
395
  shortCircuit?: boolean | undefined;
425
- /**
426
- * The absolute URL to which this input resolves
427
- */
428
396
  url: string;
429
397
  }
430
- /**
431
- * The `resolve` hook chain is responsible for telling Node.js where to find and
432
- * how to cache a given `import` statement or expression, or `require` call. It can
433
- * optionally return a format (such as `'module'`) as a hint to the `load` hook. If
434
- * a format is specified, the `load` hook is ultimately responsible for providing
435
- * the final `format` value (and it is free to ignore the hint provided by
436
- * `resolve`); if `resolve` provides a `format`, a custom `load` hook is required
437
- * even if only to pass the value to the Node.js default `load` hook.
438
- */
439
398
  type ResolveHook = (
440
399
  specifier: string,
441
400
  context: ResolveHookContext,
@@ -453,36 +412,15 @@ declare module "node:module" {
453
412
  ) => ResolveFnOutput,
454
413
  ) => ResolveFnOutput;
455
414
  interface LoadHookContext {
456
- /**
457
- * Export conditions of the relevant `package.json`
458
- */
459
415
  conditions: string[];
460
- /**
461
- * The format optionally supplied by the `resolve` hook chain (can be an intermediary value).
462
- */
463
416
  format: string | null | undefined;
464
- /**
465
- * An object whose key-value pairs represent the assertions for the module to import
466
- */
467
417
  importAttributes: ImportAttributes;
468
418
  }
469
419
  interface LoadFnOutput {
470
420
  format: string | null | undefined;
471
- /**
472
- * A signal that this hook intends to terminate the chain of `resolve` hooks.
473
- * @default false
474
- */
475
421
  shortCircuit?: boolean | undefined;
476
- /**
477
- * The source for Node.js to evaluate
478
- */
479
422
  source?: ModuleSource | undefined;
480
423
  }
481
- /**
482
- * The `load` hook provides a way to define a custom method of determining how a
483
- * URL should be interpreted, retrieved, and parsed. It is also in charge of
484
- * validating the import attributes.
485
- */
486
424
  type LoadHook = (
487
425
  url: string,
488
426
  context: LoadHookContext,
node/net.d.ts CHANGED
@@ -34,6 +34,10 @@ declare module "node:net" {
34
34
  readable?: boolean | undefined;
35
35
  writable?: boolean | undefined;
36
36
  signal?: AbortSignal | undefined;
37
+ noDelay?: boolean | undefined;
38
+ keepAlive?: boolean | undefined;
39
+ keepAliveInitialDelay?: number | undefined;
40
+ blockList?: BlockList | undefined;
37
41
  }
38
42
  interface OnReadOpts {
39
43
  buffer: Uint8Array | (() => Uint8Array);
@@ -52,9 +56,6 @@ declare module "node:net" {
52
56
  hints?: number | undefined;
53
57
  family?: number | undefined;
54
58
  lookup?: LookupFunction | undefined;
55
- noDelay?: boolean | undefined;
56
- keepAlive?: boolean | undefined;
57
- keepAliveInitialDelay?: number | undefined;
58
59
  /**
59
60
  * @since v18.13.0
60
61
  */
@@ -63,7 +64,6 @@ declare module "node:net" {
63
64
  * @since v18.13.0
64
65
  */
65
66
  autoSelectFamilyAttemptTimeout?: number | undefined;
66
- blockList?: BlockList | undefined;
67
67
  }
68
68
  interface IpcSocketConnectOpts {
69
69
  path: string;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "25.3.4",
3
+ "version": "25.4.0",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -150,6 +150,6 @@
150
150
  "undici-types": "~7.18.0"
151
151
  },
152
152
  "peerDependencies": {},
153
- "typesPublisherContentHash": "0ea976f122d601d7b69efe9464b7baa0201319470ae3de5d3e363ceb8816bce9",
153
+ "typesPublisherContentHash": "1e76219e2880c49d08637c8e24009f811139066d7fbe688992e8d39f76ecab42",
154
154
  "typeScriptVersion": "5.2"
155
155
  }
node/process.d.ts CHANGED
@@ -1861,6 +1861,24 @@ declare module "node:process" {
1861
1861
  */
1862
1862
  readonly release: ProcessRelease;
1863
1863
  readonly features: ProcessFeatures;
1864
+ /**
1865
+ * The `process.traceProcessWarnings` property indicates whether the `--trace-warnings` flag
1866
+ * is set on the current Node.js process. This property allows programmatic control over the
1867
+ * tracing of warnings, enabling or disabling stack traces for warnings at runtime.
1868
+ *
1869
+ * ```js
1870
+ * // Enable trace warnings
1871
+ * process.traceProcessWarnings = true;
1872
+ *
1873
+ * // Emit a warning with a stack trace
1874
+ * process.emitWarning('Warning with stack trace');
1875
+ *
1876
+ * // Disable trace warnings
1877
+ * process.traceProcessWarnings = false;
1878
+ * ```
1879
+ * @since v6.10.0
1880
+ */
1881
+ traceProcessWarnings: boolean;
1864
1882
  /**
1865
1883
  * `process.umask()` returns the Node.js process's file mode creation mask. Child
1866
1884
  * processes inherit the mask from the parent process.
node/readline.d.ts CHANGED
@@ -44,6 +44,7 @@ declare module "node:readline" {
44
44
  }
45
45
  interface InterfaceEventMap {
46
46
  "close": [];
47
+ "error": [error: Error];
47
48
  "history": [history: string[]];
48
49
  "line": [input: string];
49
50
  "pause": [];
node/sqlite.d.ts CHANGED
@@ -429,15 +429,68 @@ declare module "node:sqlite" {
429
429
  */
430
430
  prepare(sql: string): StatementSync;
431
431
  /**
432
- * Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for
433
- * storing prepared statements. This allows for the efficient reuse of prepared
434
- * statements by tagging them with a unique identifier.
432
+ * Creates a new {@link SQLTagStore}, which is a Least Recently Used (LRU) cache
433
+ * for storing prepared statements. This allows for the efficient reuse of
434
+ * prepared statements by tagging them with a unique identifier.
435
435
  *
436
436
  * When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared
437
- * statement for that specific SQL string already exists in the cache. If it does,
438
- * the cached statement is used. If not, a new prepared statement is created,
439
- * executed, and then stored in the cache for future use. This mechanism helps to
440
- * avoid the overhead of repeatedly parsing and preparing the same SQL statements.
437
+ * statement for the corresponding SQL query string already exists in the cache.
438
+ * If it does, the cached statement is used. If not, a new prepared statement is
439
+ * created, executed, and then stored in the cache for future use. This mechanism
440
+ * helps to avoid the overhead of repeatedly parsing and preparing the same SQL
441
+ * statements.
442
+ *
443
+ * Tagged statements bind the placeholder values from the template literal as
444
+ * parameters to the underlying prepared statement. For example:
445
+ *
446
+ * ```js
447
+ * sqlTagStore.get`SELECT ${value}`;
448
+ * ```
449
+ *
450
+ * is equivalent to:
451
+ *
452
+ * ```js
453
+ * db.prepare('SELECT ?').get(value);
454
+ * ```
455
+ *
456
+ * However, in the first example, the tag store will cache the underlying prepared
457
+ * statement for future use.
458
+ *
459
+ * > **Note:** The `${value}` syntax in tagged statements _binds_ a parameter to
460
+ * > the prepared statement. This differs from its behavior in _untagged_ template
461
+ * > literals, where it performs string interpolation.
462
+ * >
463
+ * > ```js
464
+ * > // This a safe example of binding a parameter to a tagged statement.
465
+ * > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`;
466
+ * >
467
+ * > // This is an *unsafe* example of an untagged template string.
468
+ * > // `id` is interpolated into the query text as a string.
469
+ * > // This can lead to SQL injection and data corruption.
470
+ * > db.run(`INSERT INTO t1 (id) VALUES (${id})`);
471
+ * > ```
472
+ *
473
+ * The tag store will match a statement from the cache if the query strings
474
+ * (including the positions of any bound placeholders) are identical.
475
+ *
476
+ * ```js
477
+ * // The following statements will match in the cache:
478
+ * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
479
+ * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`;
480
+ *
481
+ * // The following statements will not match, as the query strings
482
+ * // and bound placeholders differ:
483
+ * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
484
+ * sqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`;
485
+ *
486
+ * // The following statements will not match, as matches are case-sensitive:
487
+ * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
488
+ * sqlTagStore.get`select * from t1 where id = ${id} and active = 1`;
489
+ * ```
490
+ *
491
+ * The only way of binding parameters in tagged statements is with the `${value}`
492
+ * syntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query
493
+ * string itself.
441
494
  *
442
495
  * ```js
443
496
  * import { DatabaseSync } from 'node:sqlite';
@@ -453,8 +506,8 @@ declare module "node:sqlite" {
453
506
  * sql.run`INSERT INTO users VALUES (2, 'Bob')`;
454
507
  *
455
508
  * // Using the 'get' method to retrieve a single row.
456
- * const id = 1;
457
- * const user = sql.get`SELECT * FROM users WHERE id = ${id}`;
509
+ * const name = 'Alice';
510
+ * const user = sql.get`SELECT * FROM users WHERE name = ${name}`;
458
511
  * console.log(user); // { id: 1, name: 'Alice' }
459
512
  *
460
513
  * // Using the 'all' method to retrieve all rows.
@@ -543,26 +596,39 @@ declare module "node:sqlite" {
543
596
  * [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).
544
597
  */
545
598
  close(): void;
599
+ /**
600
+ * Closes the session. If the session is already closed, does nothing.
601
+ * @since v24.9.0
602
+ */
603
+ [Symbol.dispose](): void;
546
604
  }
547
605
  /**
548
606
  * This class represents a single LRU (Least Recently Used) cache for storing
549
607
  * prepared statements.
550
608
  *
551
- * Instances of this class are created via the database.createSQLTagStore() method,
552
- * not by using a constructor. The store caches prepared statements based on the
553
- * provided SQL query string. When the same query is seen again, the store
609
+ * Instances of this class are created via the `database.createTagStore()`
610
+ * method, not by using a constructor. The store caches prepared statements based
611
+ * on the provided SQL query string. When the same query is seen again, the store
554
612
  * retrieves the cached statement and safely applies the new values through
555
613
  * parameter binding, thereby preventing attacks like SQL injection.
556
614
  *
557
615
  * The cache has a maxSize that defaults to 1000 statements, but a custom size can
558
- * be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this
616
+ * be provided (e.g., `database.createTagStore(100)`). All APIs exposed by this
559
617
  * class execute synchronously.
560
618
  * @since v24.9.0
561
619
  */
562
620
  interface SQLTagStore {
563
621
  /**
564
- * Executes the given SQL query and returns all resulting rows as an array of objects.
622
+ * Executes the given SQL query and returns all resulting rows as an array of
623
+ * objects.
624
+ *
625
+ * This function is intended to be used as a template literal tag, not to be
626
+ * called directly.
565
627
  * @since v24.9.0
628
+ * @param stringElements Template literal elements containing the SQL
629
+ * query.
630
+ * @param boundParameters Parameter values to be bound to placeholders in the template string.
631
+ * @returns An array of objects representing the rows returned by the query.
566
632
  */
567
633
  all(
568
634
  stringElements: TemplateStringsArray,
@@ -570,7 +636,15 @@ declare module "node:sqlite" {
570
636
  ): Record<string, SQLOutputValue>[];
571
637
  /**
572
638
  * Executes the given SQL query and returns the first resulting row as an object.
639
+ *
640
+ * This function is intended to be used as a template literal tag, not to be
641
+ * called directly.
573
642
  * @since v24.9.0
643
+ * @param stringElements Template literal elements containing the SQL
644
+ * query.
645
+ * @param boundParameters Parameter values to be bound to placeholders in the template string.
646
+ * @returns An object representing the first row returned by
647
+ * the query, or `undefined` if no rows are returned.
574
648
  */
575
649
  get(
576
650
  stringElements: TemplateStringsArray,
@@ -578,7 +652,14 @@ declare module "node:sqlite" {
578
652
  ): Record<string, SQLOutputValue> | undefined;
579
653
  /**
580
654
  * Executes the given SQL query and returns an iterator over the resulting rows.
655
+ *
656
+ * This function is intended to be used as a template literal tag, not to be
657
+ * called directly.
581
658
  * @since v24.9.0
659
+ * @param stringElements Template literal elements containing the SQL
660
+ * query.
661
+ * @param boundParameters Parameter values to be bound to placeholders in the template string.
662
+ * @returns An iterator that yields objects representing the rows returned by the query.
582
663
  */
583
664
  iterate(
584
665
  stringElements: TemplateStringsArray,
@@ -586,15 +667,21 @@ declare module "node:sqlite" {
586
667
  ): NodeJS.Iterator<Record<string, SQLOutputValue>>;
587
668
  /**
588
669
  * Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
670
+ *
671
+ * This function is intended to be used as a template literal tag, not to be
672
+ * called directly.
589
673
  * @since v24.9.0
674
+ * @param stringElements Template literal elements containing the SQL
675
+ * query.
676
+ * @param boundParameters Parameter values to be bound to placeholders in the template string.
677
+ * @returns An object containing information about the execution, including `changes` and `lastInsertRowid`.
590
678
  */
591
679
  run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges;
592
680
  /**
593
681
  * A read-only property that returns the number of prepared statements currently in the cache.
594
682
  * @since v24.9.0
595
- * @returns The maximum number of prepared statements the cache can hold.
596
683
  */
597
- size(): number;
684
+ readonly size: number;
598
685
  /**
599
686
  * A read-only property that returns the maximum number of prepared statements the cache can hold.
600
687
  * @since v24.9.0
node/stream.d.ts CHANGED
@@ -81,6 +81,7 @@ declare module "node:stream" {
81
81
  interface ArrayOptions extends ReadableOperatorOptions {}
82
82
  interface ReadableToWebOptions {
83
83
  strategy?: web.QueuingStrategy | undefined;
84
+ type?: web.ReadableStreamType | undefined;
84
85
  }
85
86
  interface ReadableEventMap {
86
87
  "close": [];
@@ -485,13 +486,18 @@ declare module "node:stream" {
485
486
  * }
486
487
  * }
487
488
  *
488
- * const wordsStream = Readable.from(['this is', 'compose as operator']).compose(splitToWords);
489
+ * const wordsStream = Readable.from(['text passed through', 'composed stream']).compose(splitToWords);
489
490
  * const words = await wordsStream.toArray();
490
491
  *
491
- * console.log(words); // prints ['this', 'is', 'compose', 'as', 'operator']
492
+ * console.log(words); // prints ['text', 'passed', 'through', 'composed', 'stream']
492
493
  * ```
493
494
  *
494
- * See [`stream.compose`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information.
495
+ * `readable.compose(s)` is equivalent to `stream.compose(readable, s)`.
496
+ *
497
+ * This method also allows for an `AbortSignal` to be provided, which will destroy
498
+ * the composed stream when aborted.
499
+ *
500
+ * See [`stream.compose(...streams)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information.
495
501
  * @since v19.1.0, v18.13.0
496
502
  * @returns a stream composed with the stream `stream`.
497
503
  */
@@ -1056,6 +1062,9 @@ declare module "node:stream" {
1056
1062
  writableHighWaterMark?: number | undefined;
1057
1063
  writableCorked?: number | undefined;
1058
1064
  }
1065
+ interface DuplexToWebOptions {
1066
+ type?: web.ReadableStreamType | undefined;
1067
+ }
1059
1068
  interface DuplexEventMap extends ReadableEventMap, WritableEventMap {}
1060
1069
  /**
1061
1070
  * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
@@ -1109,7 +1118,7 @@ declare module "node:stream" {
1109
1118
  * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
1110
1119
  * @since v17.0.0
1111
1120
  */
1112
- static toWeb(streamDuplex: NodeJS.ReadWriteStream): web.ReadableWritablePair;
1121
+ static toWeb(streamDuplex: NodeJS.ReadWriteStream, options?: DuplexToWebOptions): web.ReadableWritablePair;
1113
1122
  /**
1114
1123
  * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
1115
1124
  * @since v17.0.0
@@ -1653,7 +1662,8 @@ declare module "node:stream" {
1653
1662
  * console.log(res); // prints 'HELLOWORLD'
1654
1663
  * ```
1655
1664
  *
1656
- * See [`readable.compose(stream)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#readablecomposestream-options) for `stream.compose` as operator.
1665
+ * For convenience, the `readable.compose(stream)` method is available on
1666
+ * `Readable` and `Duplex` streams as a wrapper for this function.
1657
1667
  * @since v16.9.0
1658
1668
  * @experimental
1659
1669
  */
node/test.d.ts CHANGED
@@ -237,7 +237,7 @@ declare module "node:test" {
237
237
  }
238
238
  interface RunOptions {
239
239
  /**
240
- * If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file.
240
+ * If a number is provided, then that many tests would run asynchronously (they are still managed by the single-threaded event loop).
241
241
  * If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time.
242
242
  * @default false
243
243
  */
@@ -480,7 +480,7 @@ declare module "node:test" {
480
480
  }
481
481
  namespace EventData {
482
482
  interface Error extends globalThis.Error {
483
- cause: globalThis.Error;
483
+ cause: unknown;
484
484
  }
485
485
  interface LocationInfo {
486
486
  /**
@@ -969,7 +969,6 @@ declare module "node:test" {
969
969
  * @since v22.2.0, v20.15.0
970
970
  */
971
971
  readonly assert: TestContextAssert;
972
- readonly attempt: number;
973
972
  /**
974
973
  * This function is used to create a hook running before subtest of the current test.
975
974
  * @param fn The hook function. The first argument to this function is a `TestContext` object.
@@ -1032,6 +1031,21 @@ declare module "node:test" {
1032
1031
  * @since v18.8.0, v16.18.0
1033
1032
  */
1034
1033
  readonly name: string;
1034
+ /**
1035
+ * Indicated whether the test succeeded.
1036
+ * @since v21.7.0, v20.12.0
1037
+ */
1038
+ readonly passed: boolean;
1039
+ /**
1040
+ * The failure reason for the test/case; wrapped and available via `context.error.cause`.
1041
+ * @since v21.7.0, v20.12.0
1042
+ */
1043
+ readonly error: EventData.Error | null;
1044
+ /**
1045
+ * Number of times the test has been attempted.
1046
+ * @since v21.7.0, v20.12.0
1047
+ */
1048
+ readonly attempt: number;
1035
1049
  /**
1036
1050
  * This function is used to set the number of assertions and subtests that are expected to run
1037
1051
  * within the test. If the number of assertions and subtests that run does not match the
@@ -1286,6 +1300,11 @@ declare module "node:test" {
1286
1300
  * @since v22.6.0
1287
1301
  */
1288
1302
  readonly filePath: string | undefined;
1303
+ /**
1304
+ * The name of the suite and each of its ancestors, separated by `>`.
1305
+ * @since v22.3.0, v20.16.0
1306
+ */
1307
+ readonly fullName: string;
1289
1308
  /**
1290
1309
  * The name of the suite.
1291
1310
  * @since v18.8.0, v16.18.0
@@ -1353,7 +1372,7 @@ declare module "node:test" {
1353
1372
  * describe('tests', async () => {
1354
1373
  * before(() => console.log('about to run some test'));
1355
1374
  * it('is a subtest', () => {
1356
- * assert.ok('some relevant assertion here');
1375
+ * // Some relevant assertion here
1357
1376
  * });
1358
1377
  * });
1359
1378
  * ```
@@ -1369,7 +1388,7 @@ declare module "node:test" {
1369
1388
  * describe('tests', async () => {
1370
1389
  * after(() => console.log('finished running tests'));
1371
1390
  * it('is a subtest', () => {
1372
- * assert.ok('some relevant assertion here');
1391
+ * // Some relevant assertion here
1373
1392
  * });
1374
1393
  * });
1375
1394
  * ```
@@ -1385,7 +1404,7 @@ declare module "node:test" {
1385
1404
  * describe('tests', async () => {
1386
1405
  * beforeEach(() => console.log('about to run a test'));
1387
1406
  * it('is a subtest', () => {
1388
- * assert.ok('some relevant assertion here');
1407
+ * // Some relevant assertion here
1389
1408
  * });
1390
1409
  * });
1391
1410
  * ```
@@ -1402,7 +1421,7 @@ declare module "node:test" {
1402
1421
  * describe('tests', async () => {
1403
1422
  * afterEach(() => console.log('finished running a test'));
1404
1423
  * it('is a subtest', () => {
1405
- * assert.ok('some relevant assertion here');
1424
+ * // Some relevant assertion here
1406
1425
  * });
1407
1426
  * });
1408
1427
  * ```
@@ -2034,24 +2053,28 @@ declare module "node:test" {
2034
2053
  */
2035
2054
  enable(options?: MockTimersOptions): void;
2036
2055
  /**
2037
- * You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer.
2038
- * Note: This method will execute any mocked timers that are in the past from the new time.
2039
- * In the below example we are setting a new time for the mocked date.
2056
+ * Sets the current Unix timestamp that will be used as reference for any mocked
2057
+ * `Date` objects.
2058
+ *
2040
2059
  * ```js
2041
2060
  * import assert from 'node:assert';
2042
2061
  * import { test } from 'node:test';
2043
- * test('sets the time of a date object', (context) => {
2044
- * // Optionally choose what to mock
2045
- * context.mock.timers.enable({ apis: ['Date'], now: 100 });
2046
- * assert.strictEqual(Date.now(), 100);
2047
- * // Advance in time will also advance the date
2048
- * context.mock.timers.setTime(1000);
2049
- * context.mock.timers.tick(200);
2050
- * assert.strictEqual(Date.now(), 1200);
2062
+ *
2063
+ * test('runAll functions following the given order', (context) => {
2064
+ * const now = Date.now();
2065
+ * const setTime = 1000;
2066
+ * // Date.now is not mocked
2067
+ * assert.deepStrictEqual(Date.now(), now);
2068
+ *
2069
+ * context.mock.timers.enable({ apis: ['Date'] });
2070
+ * context.mock.timers.setTime(setTime);
2071
+ * // Date.now is now 1000
2072
+ * assert.strictEqual(Date.now(), setTime);
2051
2073
  * });
2052
2074
  * ```
2075
+ * @since v21.2.0, v20.11.0
2053
2076
  */
2054
- setTime(time: number): void;
2077
+ setTime(milliseconds: number): void;
2055
2078
  /**
2056
2079
  * This function restores the default behavior of all mocks that were previously
2057
2080
  * created by this `MockTimers` instance and disassociates the mocks
node/tls.d.ts CHANGED
@@ -551,8 +551,12 @@ declare module "node:tls" {
551
551
  */
552
552
  requestCert?: boolean | undefined;
553
553
  /**
554
- * An array of strings or a Buffer naming possible ALPN protocols.
555
- * (Protocols should be ordered by their priority.)
554
+ * An array of strings, or a single `Buffer`, `TypedArray`, or `DataView` containing the supported
555
+ * ALPN protocols. Buffers should have the format `[len][name][len][name]...`
556
+ * e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the
557
+ * next protocol name. Passing an array is usually much simpler, e.g.
558
+ * `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher
559
+ * preference than those later.
556
560
  */
557
561
  ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined;
558
562
  /**
node/url.d.ts CHANGED
@@ -334,6 +334,19 @@ declare module "node:url" {
334
334
  * new URL('file:///hello world').pathname; // Incorrect: /hello%20world
335
335
  * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
336
336
  * ```
337
+ *
338
+ * **Security Considerations:**
339
+ *
340
+ * This function decodes percent-encoded characters, including encoded dot-segments
341
+ * (`%2e` as `.` and `%2e%2e` as `..`), and then normalizes the resulting path.
342
+ * This means that encoded directory traversal sequences (such as `%2e%2e`) are
343
+ * decoded and processed as actual path traversal, even though encoded slashes
344
+ * (`%2F`, `%5C`) are correctly rejected.
345
+ *
346
+ * **Applications must not rely on `fileURLToPath()` alone to prevent directory
347
+ * traversal attacks.** Always perform explicit path validation and security checks
348
+ * on the returned path value to ensure it remains within expected boundaries
349
+ * before using it for file system operations.
337
350
  * @since v10.12.0
338
351
  * @param url The file URL string or URL object to convert to a path.
339
352
  * @return The fully-resolved platform-specific Node.js file path.
@@ -344,6 +357,15 @@ declare module "node:url" {
344
357
  * representation of the path, a `Buffer` is returned. This conversion is
345
358
  * helpful when the input URL contains percent-encoded segments that are
346
359
  * not valid UTF-8 / Unicode sequences.
360
+ *
361
+ * **Security Considerations:**
362
+ *
363
+ * This function has the same security considerations as `url.fileURLToPath()`.
364
+ * It decodes percent-encoded characters, including encoded dot-segments
365
+ * (`%2e` as `.` and `%2e%2e` as `..`), and normalizes the path. **Applications
366
+ * must not rely on this function alone to prevent directory traversal attacks.**
367
+ * Always perform explicit path validation on the returned buffer value before
368
+ * using it for file system operations.
347
369
  * @since v24.3.0
348
370
  * @param url The file URL string or URL object to convert to a path.
349
371
  * @returns The fully-resolved platform-specific Node.js file path