@types/node 24.7.2 → 24.8.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/README.md +1 -1
- node/crypto.d.ts +356 -25
- node/diagnostics_channel.d.ts +0 -2
- node/http2.d.ts +144 -26
- node/package.json +2 -2
- node/sea.d.ts +9 -0
- node/stream.d.ts +9 -1
- node/v8.d.ts +16 -0
- node/vm.d.ts +128 -38
- node/worker_threads.d.ts +39 -1
node/worker_threads.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ declare module "worker_threads" {
|
|
|
62
62
|
import { Readable, Writable } from "node:stream";
|
|
63
63
|
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
|
|
64
64
|
import { URL } from "node:url";
|
|
65
|
-
import { HeapInfo } from "node:v8";
|
|
65
|
+
import { CPUProfileHandle, HeapInfo } from "node:v8";
|
|
66
66
|
import { MessageEvent } from "undici-types";
|
|
67
67
|
const isInternalThread: boolean;
|
|
68
68
|
const isMainThread: boolean;
|
|
@@ -469,6 +469,44 @@ declare module "worker_threads" {
|
|
|
469
469
|
* @since v24.0.0
|
|
470
470
|
*/
|
|
471
471
|
getHeapStatistics(): Promise<HeapInfo>;
|
|
472
|
+
/**
|
|
473
|
+
* Starting a CPU profile then return a Promise that fulfills with an error
|
|
474
|
+
* or an `CPUProfileHandle` object. This API supports `await using` syntax.
|
|
475
|
+
*
|
|
476
|
+
* ```js
|
|
477
|
+
* const { Worker } = require('node:worker_threads');
|
|
478
|
+
*
|
|
479
|
+
* const worker = new Worker(`
|
|
480
|
+
* const { parentPort } = require('worker_threads');
|
|
481
|
+
* parentPort.on('message', () => {});
|
|
482
|
+
* `, { eval: true });
|
|
483
|
+
*
|
|
484
|
+
* worker.on('online', async () => {
|
|
485
|
+
* const handle = await worker.startCpuProfile();
|
|
486
|
+
* const profile = await handle.stop();
|
|
487
|
+
* console.log(profile);
|
|
488
|
+
* worker.terminate();
|
|
489
|
+
* });
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* `await using` example.
|
|
493
|
+
*
|
|
494
|
+
* ```js
|
|
495
|
+
* const { Worker } = require('node::worker_threads');
|
|
496
|
+
*
|
|
497
|
+
* const w = new Worker(`
|
|
498
|
+
* const { parentPort } = require('worker_threads');
|
|
499
|
+
* parentPort.on('message', () => {});
|
|
500
|
+
* `, { eval: true });
|
|
501
|
+
*
|
|
502
|
+
* w.on('online', async () => {
|
|
503
|
+
* // Stop profile automatically when return and profile will be discarded
|
|
504
|
+
* await using handle = await w.startCpuProfile();
|
|
505
|
+
* });
|
|
506
|
+
* ```
|
|
507
|
+
* @since v24.8.0
|
|
508
|
+
*/
|
|
509
|
+
startCpuProfile(): Promise<CPUProfileHandle>;
|
|
472
510
|
/**
|
|
473
511
|
* Calls `worker.terminate()` when the dispose scope is exited.
|
|
474
512
|
*
|