omegon 0.8.4 → 0.9.1
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.
- package/extensions/cleave/dispatcher.ts +213 -20
- package/extensions/cleave/rpc-child.ts +269 -0
- package/extensions/cleave/types.ts +52 -0
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +11 -5
- package/node_modules/@types/node/assert.d.ts +173 -50
- package/node_modules/@types/node/async_hooks.d.ts +8 -28
- package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/buffer.d.ts +168 -44
- package/node_modules/@types/node/child_process.d.ts +70 -27
- package/node_modules/@types/node/cluster.d.ts +332 -240
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
- package/node_modules/@types/node/console.d.ts +350 -49
- package/node_modules/@types/node/constants.d.ts +4 -3
- package/node_modules/@types/node/crypto.d.ts +1110 -630
- package/node_modules/@types/node/dgram.d.ts +51 -15
- package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
- package/node_modules/@types/node/dns/promises.d.ts +4 -4
- package/node_modules/@types/node/dns.d.ts +133 -132
- package/node_modules/@types/node/domain.d.ts +17 -13
- package/node_modules/@types/node/events.d.ts +663 -734
- package/node_modules/@types/node/fs/promises.d.ts +9 -43
- package/node_modules/@types/node/fs.d.ts +411 -628
- package/node_modules/@types/node/globals.d.ts +30 -8
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
- package/node_modules/@types/node/http.d.ts +265 -364
- package/node_modules/@types/node/http2.d.ts +715 -551
- package/node_modules/@types/node/https.d.ts +239 -65
- package/node_modules/@types/node/index.d.ts +6 -24
- package/node_modules/@types/node/inspector.d.ts +53 -69
- package/node_modules/@types/node/inspector.generated.d.ts +410 -759
- package/node_modules/@types/node/module.d.ts +186 -52
- package/node_modules/@types/node/net.d.ts +194 -70
- package/node_modules/@types/node/os.d.ts +11 -12
- package/node_modules/@types/node/package.json +3 -13
- package/node_modules/@types/node/path.d.ts +133 -120
- package/node_modules/@types/node/perf_hooks.d.ts +643 -318
- package/node_modules/@types/node/process.d.ts +132 -223
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/node/readline.d.ts +120 -68
- package/node_modules/@types/node/repl.d.ts +100 -87
- package/node_modules/@types/node/sea.d.ts +1 -10
- package/node_modules/@types/node/sqlite.d.ts +19 -363
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +15 -136
- package/node_modules/@types/node/stream/web.d.ts +502 -176
- package/node_modules/@types/node/stream.d.ts +475 -581
- package/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +196 -308
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +132 -4
- package/node_modules/@types/node/tls.d.ts +226 -110
- package/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
- package/node_modules/@types/node/tty.d.ts +16 -58
- package/node_modules/@types/node/url.d.ts +573 -130
- package/node_modules/@types/node/util.d.ts +1100 -181
- package/node_modules/@types/node/v8.d.ts +8 -76
- package/node_modules/@types/node/vm.d.ts +72 -280
- package/node_modules/@types/node/wasi.d.ts +4 -25
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
- package/node_modules/@types/node/web-globals/events.d.ts +0 -9
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
- package/node_modules/@types/node/worker_threads.d.ts +335 -268
- package/node_modules/@types/node/zlib.d.ts +74 -9
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +12 -13
- package/node_modules/undici-types/client.d.ts +19 -19
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
- package/node_modules/undici-types/dispatcher.d.ts +103 -123
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici-types/errors.d.ts +54 -66
- package/node_modules/undici-types/eventsource.d.ts +4 -9
- package/node_modules/undici-types/fetch.d.ts +20 -22
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +7 -7
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/handlers.d.ts +8 -8
- package/node_modules/undici-types/header.d.ts +1 -157
- package/node_modules/undici-types/index.d.ts +47 -64
- package/node_modules/undici-types/interceptors.d.ts +8 -64
- package/node_modules/undici-types/mock-agent.d.ts +18 -36
- package/node_modules/undici-types/mock-client.d.ts +4 -6
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
- package/node_modules/undici-types/mock-pool.d.ts +4 -6
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +4 -0
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +13 -15
- package/node_modules/undici-types/proxy-agent.d.ts +4 -5
- package/node_modules/undici-types/readable.d.ts +16 -19
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +10 -19
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/webidl.d.ts +29 -142
- package/node_modules/undici-types/websocket.d.ts +10 -46
- package/package.json +2 -1
- package/scripts/check-vendor-dist.mjs +56 -0
- package/skills/cleave/SKILL.md +62 -2
- package/node_modules/@types/node/inspector/promises.d.ts +0 -41
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/quic.d.ts +0 -910
- package/node_modules/@types/node/test/reporters.d.ts +0 -96
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
- package/node_modules/undici-types/utility.d.ts +0 -7
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
|
|
2
|
+
// Otherwise, use the types from node.
|
|
3
|
+
type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
|
|
4
|
+
type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
|
|
3
8
|
* Node.js APIs support `Buffer`s.
|
|
@@ -41,10 +46,11 @@
|
|
|
41
46
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
|
42
47
|
* const buf7 = Buffer.from('tést', 'latin1');
|
|
43
48
|
* ```
|
|
44
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
49
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/buffer.js)
|
|
45
50
|
*/
|
|
46
|
-
declare module "
|
|
47
|
-
import {
|
|
51
|
+
declare module "buffer" {
|
|
52
|
+
import { BinaryLike } from "node:crypto";
|
|
53
|
+
import { ReadableStream as WebReadableStream } from "node:stream/web";
|
|
48
54
|
/**
|
|
49
55
|
* This function returns `true` if `input` contains only valid UTF-8-encoded data,
|
|
50
56
|
* including the case in which `input` is empty.
|
|
@@ -120,11 +126,115 @@ declare module "node:buffer" {
|
|
|
120
126
|
*/
|
|
121
127
|
export function resolveObjectURL(id: string): Blob | undefined;
|
|
122
128
|
export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
/**
|
|
130
|
+
* @experimental
|
|
131
|
+
*/
|
|
132
|
+
export interface BlobOptions {
|
|
133
|
+
/**
|
|
134
|
+
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
|
|
135
|
+
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
|
|
136
|
+
*/
|
|
137
|
+
endings?: "transparent" | "native";
|
|
138
|
+
/**
|
|
139
|
+
* The Blob content-type. The intent is for `type` to convey
|
|
140
|
+
* the MIME media type of the data, however no validation of the type format
|
|
141
|
+
* is performed.
|
|
142
|
+
*/
|
|
143
|
+
type?: string | undefined;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A `Blob` encapsulates immutable, raw data that can be safely shared across
|
|
147
|
+
* multiple worker threads.
|
|
148
|
+
* @since v15.7.0, v14.18.0
|
|
149
|
+
*/
|
|
150
|
+
export class Blob {
|
|
151
|
+
/**
|
|
152
|
+
* The total size of the `Blob` in bytes.
|
|
153
|
+
* @since v15.7.0, v14.18.0
|
|
154
|
+
*/
|
|
155
|
+
readonly size: number;
|
|
156
|
+
/**
|
|
157
|
+
* The content-type of the `Blob`.
|
|
158
|
+
* @since v15.7.0, v14.18.0
|
|
159
|
+
*/
|
|
160
|
+
readonly type: string;
|
|
161
|
+
/**
|
|
162
|
+
* Creates a new `Blob` object containing a concatenation of the given sources.
|
|
163
|
+
*
|
|
164
|
+
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
|
|
165
|
+
* the 'Blob' and can therefore be safely modified after the 'Blob' is created.
|
|
166
|
+
*
|
|
167
|
+
* String sources are also copied into the `Blob`.
|
|
168
|
+
*/
|
|
169
|
+
constructor(sources: Array<ArrayBuffer | BinaryLike | Blob>, options?: BlobOptions);
|
|
170
|
+
/**
|
|
171
|
+
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
|
|
172
|
+
* the `Blob` data.
|
|
173
|
+
* @since v15.7.0, v14.18.0
|
|
174
|
+
*/
|
|
175
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
176
|
+
/**
|
|
177
|
+
* The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
|
|
178
|
+
*
|
|
179
|
+
* ```js
|
|
180
|
+
* const blob = new Blob(['hello']);
|
|
181
|
+
* blob.bytes().then((bytes) => {
|
|
182
|
+
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
bytes(): Promise<Uint8Array>;
|
|
187
|
+
/**
|
|
188
|
+
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
|
|
189
|
+
* data. The original `Blob` is not altered.
|
|
190
|
+
* @since v15.7.0, v14.18.0
|
|
191
|
+
* @param start The starting index.
|
|
192
|
+
* @param end The ending index.
|
|
193
|
+
* @param type The content-type for the new `Blob`
|
|
194
|
+
*/
|
|
195
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
196
|
+
/**
|
|
197
|
+
* Returns a promise that fulfills with the contents of the `Blob` decoded as a
|
|
198
|
+
* UTF-8 string.
|
|
199
|
+
* @since v15.7.0, v14.18.0
|
|
200
|
+
*/
|
|
201
|
+
text(): Promise<string>;
|
|
202
|
+
/**
|
|
203
|
+
* Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
|
|
204
|
+
* @since v16.7.0
|
|
205
|
+
*/
|
|
206
|
+
stream(): WebReadableStream;
|
|
207
|
+
}
|
|
208
|
+
export interface FileOptions {
|
|
209
|
+
/**
|
|
210
|
+
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
|
|
211
|
+
* converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
|
|
212
|
+
*/
|
|
213
|
+
endings?: "native" | "transparent";
|
|
214
|
+
/** The File content-type. */
|
|
215
|
+
type?: string;
|
|
216
|
+
/** The last modified date of the file. `Default`: Date.now(). */
|
|
217
|
+
lastModified?: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
|
|
221
|
+
* @since v19.2.0, v18.13.0
|
|
222
|
+
*/
|
|
223
|
+
export class File extends Blob {
|
|
224
|
+
constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
|
|
225
|
+
/**
|
|
226
|
+
* The name of the `File`.
|
|
227
|
+
* @since v19.2.0, v18.13.0
|
|
228
|
+
*/
|
|
229
|
+
readonly name: string;
|
|
230
|
+
/**
|
|
231
|
+
* The last modified date of the `File`.
|
|
232
|
+
* @since v19.2.0, v18.13.0
|
|
233
|
+
*/
|
|
234
|
+
readonly lastModified: number;
|
|
235
|
+
}
|
|
236
|
+
export import atob = globalThis.atob;
|
|
237
|
+
export import btoa = globalThis.btoa;
|
|
128
238
|
export type WithImplicitCoercion<T> =
|
|
129
239
|
| T
|
|
130
240
|
| { valueOf(): T }
|
|
@@ -1769,42 +1879,56 @@ declare module "node:buffer" {
|
|
|
1769
1879
|
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
|
|
1770
1880
|
}
|
|
1771
1881
|
var Buffer: BufferConstructor;
|
|
1882
|
+
/**
|
|
1883
|
+
* Decodes a string of Base64-encoded data into bytes, and encodes those bytes
|
|
1884
|
+
* into a string using Latin-1 (ISO-8859-1).
|
|
1885
|
+
*
|
|
1886
|
+
* The `data` may be any JavaScript-value that can be coerced into a string.
|
|
1887
|
+
*
|
|
1888
|
+
* **This function is only provided for compatibility with legacy web platform APIs**
|
|
1889
|
+
* **and should never be used in new code, because they use strings to represent**
|
|
1890
|
+
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
|
1891
|
+
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
|
1892
|
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
|
1893
|
+
* @since v15.13.0, v14.17.0
|
|
1894
|
+
* @legacy Use `Buffer.from(data, 'base64')` instead.
|
|
1895
|
+
* @param data The Base64-encoded input string.
|
|
1896
|
+
*/
|
|
1897
|
+
function atob(data: string): string;
|
|
1898
|
+
/**
|
|
1899
|
+
* Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes
|
|
1900
|
+
* into a string using Base64.
|
|
1901
|
+
*
|
|
1902
|
+
* The `data` may be any JavaScript-value that can be coerced into a string.
|
|
1903
|
+
*
|
|
1904
|
+
* **This function is only provided for compatibility with legacy web platform APIs**
|
|
1905
|
+
* **and should never be used in new code, because they use strings to represent**
|
|
1906
|
+
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
|
1907
|
+
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
|
1908
|
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
|
1909
|
+
* @since v15.13.0, v14.17.0
|
|
1910
|
+
* @legacy Use `buf.toString('base64')` instead.
|
|
1911
|
+
* @param data An ASCII (Latin1) string.
|
|
1912
|
+
*/
|
|
1913
|
+
function btoa(data: string): string;
|
|
1914
|
+
interface Blob extends _Blob {}
|
|
1915
|
+
/**
|
|
1916
|
+
* `Blob` class is a global reference for `import { Blob } from 'node:buffer'`
|
|
1917
|
+
* https://nodejs.org/api/buffer.html#class-blob
|
|
1918
|
+
* @since v18.0.0
|
|
1919
|
+
*/
|
|
1920
|
+
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
|
|
1921
|
+
: typeof import("buffer").Blob;
|
|
1922
|
+
interface File extends _File {}
|
|
1923
|
+
/**
|
|
1924
|
+
* `File` class is a global reference for `import { File } from 'node:buffer'`
|
|
1925
|
+
* https://nodejs.org/api/buffer.html#class-file
|
|
1926
|
+
* @since v20.0.0
|
|
1927
|
+
*/
|
|
1928
|
+
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
|
|
1929
|
+
: typeof import("buffer").File;
|
|
1772
1930
|
}
|
|
1773
|
-
// #region web types
|
|
1774
|
-
export type BlobPart = NodeJS.BufferSource | Blob | string;
|
|
1775
|
-
export interface BlobPropertyBag {
|
|
1776
|
-
endings?: "native" | "transparent";
|
|
1777
|
-
type?: string;
|
|
1778
|
-
}
|
|
1779
|
-
export interface FilePropertyBag extends BlobPropertyBag {
|
|
1780
|
-
lastModified?: number;
|
|
1781
|
-
}
|
|
1782
|
-
export interface Blob {
|
|
1783
|
-
readonly size: number;
|
|
1784
|
-
readonly type: string;
|
|
1785
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1786
|
-
bytes(): Promise<NodeJS.NonSharedUint8Array>;
|
|
1787
|
-
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
1788
|
-
stream(): ReadableStream<NodeJS.NonSharedUint8Array>;
|
|
1789
|
-
text(): Promise<string>;
|
|
1790
|
-
}
|
|
1791
|
-
export var Blob: {
|
|
1792
|
-
prototype: Blob;
|
|
1793
|
-
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
|
1794
|
-
};
|
|
1795
|
-
export interface File extends Blob {
|
|
1796
|
-
readonly lastModified: number;
|
|
1797
|
-
readonly name: string;
|
|
1798
|
-
readonly webkitRelativePath: string;
|
|
1799
|
-
}
|
|
1800
|
-
export var File: {
|
|
1801
|
-
prototype: File;
|
|
1802
|
-
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
|
1803
|
-
};
|
|
1804
|
-
export import atob = globalThis.atob;
|
|
1805
|
-
export import btoa = globalThis.btoa;
|
|
1806
|
-
// #endregion
|
|
1807
1931
|
}
|
|
1808
|
-
declare module "buffer" {
|
|
1809
|
-
export * from "
|
|
1932
|
+
declare module "node:buffer" {
|
|
1933
|
+
export * from "buffer";
|
|
1810
1934
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
7
|
* import { spawn } from 'node:child_process';
|
|
8
|
-
* import { once } from 'node:events';
|
|
9
8
|
* const ls = spawn('ls', ['-lh', '/usr']);
|
|
10
9
|
*
|
|
11
10
|
* ls.stdout.on('data', (data) => {
|
|
@@ -16,8 +15,9 @@
|
|
|
16
15
|
* console.error(`stderr: ${data}`);
|
|
17
16
|
* });
|
|
18
17
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* ls.on('close', (code) => {
|
|
19
|
+
* console.log(`child process exited with code ${code}`);
|
|
20
|
+
* });
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
|
|
@@ -63,25 +63,17 @@
|
|
|
63
63
|
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
|
64
64
|
* the synchronous methods can have significant impact on performance due to
|
|
65
65
|
* stalling the event loop while spawned processes complete.
|
|
66
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
66
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js)
|
|
67
67
|
*/
|
|
68
|
-
declare module "
|
|
68
|
+
declare module "child_process" {
|
|
69
69
|
import { NonSharedBuffer } from "node:buffer";
|
|
70
|
+
import { Abortable, EventEmitter } from "node:events";
|
|
70
71
|
import * as dgram from "node:dgram";
|
|
71
|
-
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
|
72
72
|
import * as net from "node:net";
|
|
73
73
|
import { Readable, Stream, Writable } from "node:stream";
|
|
74
74
|
import { URL } from "node:url";
|
|
75
75
|
type Serializable = string | object | number | boolean | bigint;
|
|
76
76
|
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
|
77
|
-
interface ChildProcessEventMap {
|
|
78
|
-
"close": [code: number | null, signal: NodeJS.Signals | null];
|
|
79
|
-
"disconnect": [];
|
|
80
|
-
"error": [err: Error];
|
|
81
|
-
"exit": [code: number | null, signal: NodeJS.Signals | null];
|
|
82
|
-
"message": [message: Serializable, sendHandle: SendHandle];
|
|
83
|
-
"spawn": [];
|
|
84
|
-
}
|
|
85
77
|
/**
|
|
86
78
|
* Instances of the `ChildProcess` represent spawned child processes.
|
|
87
79
|
*
|
|
@@ -90,7 +82,7 @@ declare module "node:child_process" {
|
|
|
90
82
|
* instances of `ChildProcess`.
|
|
91
83
|
* @since v2.2.0
|
|
92
84
|
*/
|
|
93
|
-
class ChildProcess
|
|
85
|
+
class ChildProcess extends EventEmitter {
|
|
94
86
|
/**
|
|
95
87
|
* A `Writable Stream` that represents the child process's `stdin`.
|
|
96
88
|
*
|
|
@@ -228,11 +220,6 @@ declare module "node:child_process" {
|
|
|
228
220
|
/**
|
|
229
221
|
* The `subprocess.exitCode` property indicates the exit code of the child process.
|
|
230
222
|
* If the child process is still running, the field will be `null`.
|
|
231
|
-
*
|
|
232
|
-
* When the child process is terminated by a signal, `subprocess.exitCode` will be
|
|
233
|
-
* `null` and `subprocess.signalCode` will be set. To get the corresponding
|
|
234
|
-
* POSIX exit code, use
|
|
235
|
-
* `util.convertProcessSignalToExitCode(subprocess.signalCode)`.
|
|
236
223
|
*/
|
|
237
224
|
readonly exitCode: number | null;
|
|
238
225
|
/**
|
|
@@ -471,7 +458,7 @@ declare module "node:child_process" {
|
|
|
471
458
|
* as the connection may have been closed during the time it takes to send the
|
|
472
459
|
* connection to the child.
|
|
473
460
|
* @since v0.5.9
|
|
474
|
-
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-
|
|
461
|
+
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v22.x/api/dgram.html#class-dgramsocket) object.
|
|
475
462
|
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
|
476
463
|
*/
|
|
477
464
|
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
|
@@ -537,8 +524,64 @@ declare module "node:child_process" {
|
|
|
537
524
|
* @since v0.7.10
|
|
538
525
|
*/
|
|
539
526
|
ref(): void;
|
|
527
|
+
/**
|
|
528
|
+
* events.EventEmitter
|
|
529
|
+
* 1. close
|
|
530
|
+
* 2. disconnect
|
|
531
|
+
* 3. error
|
|
532
|
+
* 4. exit
|
|
533
|
+
* 5. message
|
|
534
|
+
* 6. spawn
|
|
535
|
+
*/
|
|
536
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
537
|
+
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
538
|
+
addListener(event: "disconnect", listener: () => void): this;
|
|
539
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
540
|
+
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
541
|
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
542
|
+
addListener(event: "spawn", listener: () => void): this;
|
|
543
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
|
544
|
+
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
|
545
|
+
emit(event: "disconnect"): boolean;
|
|
546
|
+
emit(event: "error", err: Error): boolean;
|
|
547
|
+
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
|
548
|
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
|
549
|
+
emit(event: "spawn", listener: () => void): boolean;
|
|
550
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
551
|
+
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
552
|
+
on(event: "disconnect", listener: () => void): this;
|
|
553
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
554
|
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
555
|
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
556
|
+
on(event: "spawn", listener: () => void): this;
|
|
557
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
558
|
+
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
559
|
+
once(event: "disconnect", listener: () => void): this;
|
|
560
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
561
|
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
562
|
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
563
|
+
once(event: "spawn", listener: () => void): this;
|
|
564
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
565
|
+
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
566
|
+
prependListener(event: "disconnect", listener: () => void): this;
|
|
567
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
568
|
+
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
569
|
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
570
|
+
prependListener(event: "spawn", listener: () => void): this;
|
|
571
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
572
|
+
prependOnceListener(
|
|
573
|
+
event: "close",
|
|
574
|
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
|
575
|
+
): this;
|
|
576
|
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
|
577
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
578
|
+
prependOnceListener(
|
|
579
|
+
event: "exit",
|
|
580
|
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
|
581
|
+
): this;
|
|
582
|
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
583
|
+
prependOnceListener(event: "spawn", listener: () => void): this;
|
|
540
584
|
}
|
|
541
|
-
interface ChildProcess extends InternalEventEmitter<ChildProcessEventMap> {}
|
|
542
585
|
// return this object when stdio option is undefined or not specified
|
|
543
586
|
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
|
544
587
|
stdin: Writable;
|
|
@@ -676,7 +719,6 @@ declare module "node:child_process" {
|
|
|
676
719
|
*
|
|
677
720
|
* ```js
|
|
678
721
|
* import { spawn } from 'node:child_process';
|
|
679
|
-
* import { once } from 'node:events';
|
|
680
722
|
* const ls = spawn('ls', ['-lh', '/usr']);
|
|
681
723
|
*
|
|
682
724
|
* ls.stdout.on('data', (data) => {
|
|
@@ -687,8 +729,9 @@ declare module "node:child_process" {
|
|
|
687
729
|
* console.error(`stderr: ${data}`);
|
|
688
730
|
* });
|
|
689
731
|
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
732
|
+
* ls.on('close', (code) => {
|
|
733
|
+
* console.log(`child process exited with code ${code}`);
|
|
734
|
+
* });
|
|
692
735
|
* ```
|
|
693
736
|
*
|
|
694
737
|
* Example: A very elaborate way to run `ps ax | grep ssh`
|
|
@@ -1428,6 +1471,6 @@ declare module "node:child_process" {
|
|
|
1428
1471
|
options?: ExecFileSyncOptions,
|
|
1429
1472
|
): string | NonSharedBuffer;
|
|
1430
1473
|
}
|
|
1431
|
-
declare module "child_process" {
|
|
1432
|
-
export * from "
|
|
1474
|
+
declare module "node:child_process" {
|
|
1475
|
+
export * from "child_process";
|
|
1433
1476
|
}
|