@types/node 13.9.8 → 13.11.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/async_hooks.d.ts +101 -0
- node/fs.d.ts +70 -5
- node/index.d.ts +1 -1
- node/os.d.ts +8 -0
- node/package.json +2 -2
- node/tls.d.ts +8 -0
- node/ts3.5/wasi.d.ts +9 -0
- node/vm.d.ts +34 -0
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Thu, 02 Apr 2020 16:50:50 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
|
14
14
|
|
node/async_hooks.d.ts
CHANGED
|
@@ -143,4 +143,105 @@ declare module "async_hooks" {
|
|
|
143
143
|
*/
|
|
144
144
|
triggerAsyncId(): number;
|
|
145
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* When having multiple instances of `AsyncLocalStorage`, they are independent
|
|
149
|
+
* from each other. It is safe to instantiate this class multiple times.
|
|
150
|
+
*/
|
|
151
|
+
class AsyncLocalStorage<T> {
|
|
152
|
+
/**
|
|
153
|
+
* This method disables the instance of `AsyncLocalStorage`. All subsequent calls
|
|
154
|
+
* to `asyncLocalStorage.getStore()` will return `undefined` until
|
|
155
|
+
* `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()`
|
|
156
|
+
* is called again.
|
|
157
|
+
*
|
|
158
|
+
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
|
159
|
+
* instance will be exited.
|
|
160
|
+
*
|
|
161
|
+
* Calling `asyncLocalStorage.disable()` is required before the
|
|
162
|
+
* `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
|
163
|
+
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
|
164
|
+
* along with the corresponding async resources.
|
|
165
|
+
*
|
|
166
|
+
* This method is to be used when the `asyncLocalStorage` is not in use anymore
|
|
167
|
+
* in the current process.
|
|
168
|
+
*/
|
|
169
|
+
disable(): void;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* This method returns the current store.
|
|
173
|
+
* If this method is called outside of an asynchronous context initialized by
|
|
174
|
+
* calling `asyncLocalStorage.run` or `asyncLocalStorage.runAndReturn`, it will
|
|
175
|
+
* return `undefined`.
|
|
176
|
+
*/
|
|
177
|
+
getStore(): T | undefined;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Calling `asyncLocalStorage.run(callback)` will create a new asynchronous
|
|
181
|
+
* context.
|
|
182
|
+
* Within the callback function and the asynchronous operations from the callback,
|
|
183
|
+
* `asyncLocalStorage.getStore()` will return an instance of `Map` known as
|
|
184
|
+
* "the store". This store will be persistent through the following
|
|
185
|
+
* asynchronous calls.
|
|
186
|
+
*
|
|
187
|
+
* The callback will be ran asynchronously. Optionally, arguments can be passed
|
|
188
|
+
* to the function. They will be passed to the callback function.
|
|
189
|
+
*
|
|
190
|
+
* If an error is thrown by the callback function, it will not be caught by
|
|
191
|
+
* a `try/catch` block as the callback is ran in a new asynchronous resource.
|
|
192
|
+
* Also, the stacktrace will be impacted by the asynchronous call.
|
|
193
|
+
*/
|
|
194
|
+
// TODO: Apply generic vararg once available
|
|
195
|
+
run(store: T, callback: (...args: any[]) => void, ...args: any[]): void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Calling `asyncLocalStorage.exit(callback)` will create a new asynchronous
|
|
199
|
+
* context.
|
|
200
|
+
* Within the callback function and the asynchronous operations from the callback,
|
|
201
|
+
* `asyncLocalStorage.getStore()` will return `undefined`.
|
|
202
|
+
*
|
|
203
|
+
* The callback will be ran asynchronously. Optionally, arguments can be passed
|
|
204
|
+
* to the function. They will be passed to the callback function.
|
|
205
|
+
*
|
|
206
|
+
* If an error is thrown by the callback function, it will not be caught by
|
|
207
|
+
* a `try/catch` block as the callback is ran in a new asynchronous resource.
|
|
208
|
+
* Also, the stacktrace will be impacted by the asynchronous call.
|
|
209
|
+
*/
|
|
210
|
+
exit(callback: (...args: any[]) => void, ...args: any[]): void;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* This methods runs a function synchronously within a context and return its
|
|
214
|
+
* return value. The store is not accessible outside of the callback function or
|
|
215
|
+
* the asynchronous operations created within the callback.
|
|
216
|
+
*
|
|
217
|
+
* Optionally, arguments can be passed to the function. They will be passed to
|
|
218
|
+
* the callback function.
|
|
219
|
+
*
|
|
220
|
+
* If the callback function throws an error, it will be thrown by
|
|
221
|
+
* `runSyncAndReturn` too. The stacktrace will not be impacted by this call and
|
|
222
|
+
* the context will be exited.
|
|
223
|
+
*/
|
|
224
|
+
runSyncAndReturn<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* This methods runs a function synchronously outside of a context and return its
|
|
228
|
+
* return value. The store is not accessible within the callback function or
|
|
229
|
+
* the asynchronous operations created within the callback.
|
|
230
|
+
*
|
|
231
|
+
* Optionally, arguments can be passed to the function. They will be passed to
|
|
232
|
+
* the callback function.
|
|
233
|
+
*
|
|
234
|
+
* If the callback function throws an error, it will be thrown by
|
|
235
|
+
* `exitSyncAndReturn` too. The stacktrace will not be impacted by this call and
|
|
236
|
+
* the context will be re-entered.
|
|
237
|
+
*/
|
|
238
|
+
exitSyncAndReturn<R>(callback: (...args: any[]) => R, ...args: any[]): R;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Calling `asyncLocalStorage.enterWith(store)` will transition into the context
|
|
242
|
+
* for the remainder of the current synchronous execution and will persist
|
|
243
|
+
* through any following asynchronous calls.
|
|
244
|
+
*/
|
|
245
|
+
enterWith(store: T): void;
|
|
246
|
+
}
|
|
146
247
|
}
|
node/fs.d.ts
CHANGED
|
@@ -855,12 +855,13 @@ declare module "fs" {
|
|
|
855
855
|
interface MakeDirectoryOptions {
|
|
856
856
|
/**
|
|
857
857
|
* Indicates whether parent folders should be created.
|
|
858
|
+
* If a folder was created, the path to the first created folder will be returned.
|
|
858
859
|
* @default false
|
|
859
860
|
*/
|
|
860
861
|
recursive?: boolean;
|
|
861
862
|
/**
|
|
862
863
|
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
863
|
-
* @default 0o777
|
|
864
|
+
* @default 0o777
|
|
864
865
|
*/
|
|
865
866
|
mode?: number | string;
|
|
866
867
|
}
|
|
@@ -871,7 +872,23 @@ declare module "fs" {
|
|
|
871
872
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
872
873
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
873
874
|
*/
|
|
874
|
-
function mkdir(path: PathLike, options:
|
|
875
|
+
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path: string) => void): void;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
879
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
880
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
881
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
882
|
+
*/
|
|
883
|
+
function mkdir(path: PathLike, options: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
887
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
888
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
889
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
890
|
+
*/
|
|
891
|
+
function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path: string | undefined) => void): void;
|
|
875
892
|
|
|
876
893
|
/**
|
|
877
894
|
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
|
|
@@ -887,7 +904,23 @@ declare module "fs" {
|
|
|
887
904
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
888
905
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
889
906
|
*/
|
|
890
|
-
function __promisify__(path: PathLike, options
|
|
907
|
+
function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
911
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
912
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
913
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
914
|
+
*/
|
|
915
|
+
function __promisify__(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
919
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
920
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
921
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
922
|
+
*/
|
|
923
|
+
function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<string | undefined>;
|
|
891
924
|
}
|
|
892
925
|
|
|
893
926
|
/**
|
|
@@ -896,7 +929,23 @@ declare module "fs" {
|
|
|
896
929
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
897
930
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
898
931
|
*/
|
|
899
|
-
function mkdirSync(path: PathLike, options
|
|
932
|
+
function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Synchronous mkdir(2) - create a directory.
|
|
936
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
937
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
938
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
939
|
+
*/
|
|
940
|
+
function mkdirSync(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): void;
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Synchronous mkdir(2) - create a directory.
|
|
944
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
945
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
946
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
947
|
+
*/
|
|
948
|
+
function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): string | undefined;
|
|
900
949
|
|
|
901
950
|
/**
|
|
902
951
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -2278,7 +2327,23 @@ declare module "fs" {
|
|
|
2278
2327
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
2279
2328
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
2280
2329
|
*/
|
|
2281
|
-
function mkdir(path: PathLike, options
|
|
2330
|
+
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
|
|
2331
|
+
|
|
2332
|
+
/**
|
|
2333
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
2334
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2335
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
2336
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
2337
|
+
*/
|
|
2338
|
+
function mkdir(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
2342
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2343
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
2344
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
2345
|
+
*/
|
|
2346
|
+
function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<string | undefined>;
|
|
2282
2347
|
|
|
2283
2348
|
/**
|
|
2284
2349
|
* Asynchronous readdir(3) - read a directory.
|
node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 13.
|
|
1
|
+
// Type definitions for non-npm package Node.js 13.11
|
|
2
2
|
// Project: http://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
node/os.d.ts
CHANGED
|
@@ -209,6 +209,14 @@ declare module "os" {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
function arch(): string;
|
|
212
|
+
/**
|
|
213
|
+
* Returns a string identifying the kernel version.
|
|
214
|
+
* On POSIX systems, the operating system release is determined by calling
|
|
215
|
+
* [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available,
|
|
216
|
+
* `GetVersionExW()` will be used. See
|
|
217
|
+
* https://en.wikipedia.org/wiki/Uname#Examples for more information.
|
|
218
|
+
*/
|
|
219
|
+
function version(): string;
|
|
212
220
|
function platform(): NodeJS.Platform;
|
|
213
221
|
function tmpdir(): string;
|
|
214
222
|
const EOL: string;
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.0",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"contributors": [
|
|
@@ -241,6 +241,6 @@
|
|
|
241
241
|
},
|
|
242
242
|
"scripts": {},
|
|
243
243
|
"dependencies": {},
|
|
244
|
-
"typesPublisherContentHash": "
|
|
244
|
+
"typesPublisherContentHash": "0fbeeb0b6e4acddc36e24b1455120076db2e6b76112dcb47230f57c67093c74e",
|
|
245
245
|
"typeScriptVersion": "2.8"
|
|
246
246
|
}
|
node/tls.d.ts
CHANGED
|
@@ -297,6 +297,14 @@ declare module "tls" {
|
|
|
297
297
|
*/
|
|
298
298
|
enableTrace(): void;
|
|
299
299
|
|
|
300
|
+
/**
|
|
301
|
+
* @param length number of bytes to retrieve from keying material
|
|
302
|
+
* @param label an application specific label, typically this will be a value from the
|
|
303
|
+
* [IANA Exporter Label Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels).
|
|
304
|
+
* @param context optionally provide a context.
|
|
305
|
+
*/
|
|
306
|
+
exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
|
|
307
|
+
|
|
300
308
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
301
309
|
addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
|
|
302
310
|
addListener(event: "secureConnect", listener: () => void): this;
|
node/ts3.5/wasi.d.ts
CHANGED
|
@@ -20,6 +20,15 @@ declare module 'wasi' {
|
|
|
20
20
|
preopens?: {
|
|
21
21
|
[key: string]: string;
|
|
22
22
|
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* By default, WASI applications terminate the Node.js
|
|
26
|
+
* process via the `__wasi_proc_exit()` function. Setting this option to `true`
|
|
27
|
+
* causes `wasi.start()` to return the exit code rather than terminate the
|
|
28
|
+
* process.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
returnOnExit?: boolean;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
class WASI {
|
node/vm.d.ts
CHANGED
|
@@ -94,6 +94,23 @@ declare module "vm" {
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
type MeasureMemoryMode = 'summary' | 'detailed';
|
|
98
|
+
|
|
99
|
+
interface MeasureMemoryOptions {
|
|
100
|
+
/**
|
|
101
|
+
* @default 'summary'
|
|
102
|
+
*/
|
|
103
|
+
mode?: MeasureMemoryMode;
|
|
104
|
+
context?: Context;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface MemoryMeasurement {
|
|
108
|
+
total: {
|
|
109
|
+
jsMemoryEstimate: number;
|
|
110
|
+
jsMemoryRange: [number, number];
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
97
114
|
class Script {
|
|
98
115
|
constructor(code: string, options?: ScriptOptions);
|
|
99
116
|
runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
|
|
@@ -107,4 +124,21 @@ declare module "vm" {
|
|
|
107
124
|
function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
|
|
108
125
|
function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
|
|
109
126
|
function compileFunction(code: string, params?: string[], options?: CompileFunctionOptions): Function;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Measure the memory known to V8 and used by the current execution context or a specified context.
|
|
130
|
+
*
|
|
131
|
+
* The format of the object that the returned Promise may resolve with is
|
|
132
|
+
* specific to the V8 engine and may change from one version of V8 to the next.
|
|
133
|
+
*
|
|
134
|
+
* The returned result is different from the statistics returned by
|
|
135
|
+
* `v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measures
|
|
136
|
+
* the memory reachable by V8 from a specific context, while
|
|
137
|
+
* `v8.getHeapSpaceStatistics()` measures the memory used by an instance
|
|
138
|
+
* of V8 engine, which can switch among multiple contexts that reference
|
|
139
|
+
* objects in the heap of one engine.
|
|
140
|
+
*
|
|
141
|
+
* @experimental
|
|
142
|
+
*/
|
|
143
|
+
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
|
|
110
144
|
}
|