@types/node 18.17.5 → 18.17.7

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 v18.17/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 11 Aug 2023 19:32:49 GMT
11
+ * Last updated: Tue, 22 Aug 2023 09:03:16 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node v18.17/fs.d.ts CHANGED
@@ -220,6 +220,11 @@ declare module 'fs' {
220
220
  * @since v10.10.0
221
221
  */
222
222
  name: string;
223
+ /**
224
+ * The base path that this `fs.Dirent` object refers to.
225
+ * @since v18.17.0
226
+ */
227
+ path: string;
223
228
  }
224
229
  /**
225
230
  * A class representing a directory stream.
node v18.17/module.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  declare module 'module' {
5
5
  import { URL } from 'node:url';
6
+ import { MessagePort } from 'node:worker_threads';
6
7
  namespace Module {
7
8
  /**
8
9
  * The `module.syncBuiltinESMExports()` method updates all the live bindings for
@@ -78,6 +79,101 @@ declare module 'module' {
78
79
  */
79
80
  findEntry(line: number, column: number): SourceMapping;
80
81
  }
82
+ type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
83
+ type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
84
+ interface GlobalPreloadContext {
85
+ port: MessagePort;
86
+ }
87
+ /**
88
+ * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
89
+ * This hook allows the return of a string that is run as a sloppy-mode script on startup.
90
+ *
91
+ * @param context Information to assist the preload code
92
+ * @return Code to run before application startup
93
+ */
94
+ type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
95
+ interface ResolveHookContext {
96
+ /**
97
+ * Export conditions of the relevant `package.json`
98
+ */
99
+ conditions: string[];
100
+ /**
101
+ * An object whose key-value pairs represent the assertions for the module to import
102
+ */
103
+ importAssertions: Object;
104
+ /**
105
+ * The module importing this one, or undefined if this is the Node.js entry point
106
+ */
107
+ parentURL: string | undefined;
108
+ }
109
+ interface ResolveFnOutput {
110
+ /**
111
+ * A hint to the load hook (it might be ignored)
112
+ */
113
+ format?: ModuleFormat | null | undefined;
114
+ /**
115
+ * The import assertions to use when caching the module (optional; if excluded the input will be used)
116
+ */
117
+ importAssertions?: Object | undefined;
118
+ /**
119
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
120
+ * @default false
121
+ */
122
+ shortCircuit?: boolean | undefined;
123
+ /**
124
+ * The absolute URL to which this input resolves
125
+ */
126
+ url: string;
127
+ }
128
+ /**
129
+ * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
130
+ * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
131
+ * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
132
+ *
133
+ * @param specifier The specified URL path of the module to be resolved
134
+ * @param context
135
+ * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
136
+ */
137
+ type ResolveHook = (
138
+ specifier: string,
139
+ context: ResolveHookContext,
140
+ nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput
141
+ ) => ResolveFnOutput | Promise<ResolveFnOutput>;
142
+ interface LoadHookContext {
143
+ /**
144
+ * Export conditions of the relevant `package.json`
145
+ */
146
+ conditions: string[];
147
+ /**
148
+ * The format optionally supplied by the `resolve` hook chain
149
+ */
150
+ format: ModuleFormat;
151
+ /**
152
+ * An object whose key-value pairs represent the assertions for the module to import
153
+ */
154
+ importAssertions: Object;
155
+ }
156
+ interface LoadFnOutput {
157
+ format: ModuleFormat;
158
+ /**
159
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
160
+ * @default false
161
+ */
162
+ shortCircuit?: boolean | undefined;
163
+ /**
164
+ * The source for Node.js to evaluate
165
+ */
166
+ source?: ModuleSource;
167
+ }
168
+ /**
169
+ * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
170
+ * It is also in charge of validating the import assertion.
171
+ *
172
+ * @param url The URL/path of the module to be loaded
173
+ * @param context Metadata about the module
174
+ * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
175
+ */
176
+ type LoadHook = (url: string, context: LoadHookContext, nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput) => LoadFnOutput | Promise<LoadFnOutput>;
81
177
  }
82
178
  interface Module extends NodeModule {}
83
179
  class Module {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.17.5",
3
+ "version": "18.17.7",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -232,6 +232,6 @@
232
232
  },
233
233
  "scripts": {},
234
234
  "dependencies": {},
235
- "typesPublisherContentHash": "134b61f8d9c523fe410807fef906f553b8dce3dcc27e06d9f30d16b2d15f0872",
235
+ "typesPublisherContentHash": "9862e6d633e8baa4b42ed1ca1d6a29bfd454d63f204ec9c3a2801c8d9bd8d013",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
@@ -220,6 +220,11 @@ declare module 'fs' {
220
220
  * @since v10.10.0
221
221
  */
222
222
  name: string;
223
+ /**
224
+ * The base path that this `fs.Dirent` object refers to.
225
+ * @since v18.17.0
226
+ */
227
+ path: string;
223
228
  }
224
229
  /**
225
230
  * A class representing a directory stream.
@@ -3,6 +3,7 @@
3
3
  */
4
4
  declare module 'module' {
5
5
  import { URL } from 'node:url';
6
+ import { MessagePort } from 'node:worker_threads';
6
7
  namespace Module {
7
8
  /**
8
9
  * The `module.syncBuiltinESMExports()` method updates all the live bindings for
@@ -78,6 +79,101 @@ declare module 'module' {
78
79
  */
79
80
  findEntry(line: number, column: number): SourceMapping;
80
81
  }
82
+ type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
83
+ type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
84
+ interface GlobalPreloadContext {
85
+ port: MessagePort;
86
+ }
87
+ /**
88
+ * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
89
+ * This hook allows the return of a string that is run as a sloppy-mode script on startup.
90
+ *
91
+ * @param context Information to assist the preload code
92
+ * @return Code to run before application startup
93
+ */
94
+ type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
95
+ interface ResolveHookContext {
96
+ /**
97
+ * Export conditions of the relevant `package.json`
98
+ */
99
+ conditions: string[];
100
+ /**
101
+ * An object whose key-value pairs represent the assertions for the module to import
102
+ */
103
+ importAssertions: Object;
104
+ /**
105
+ * The module importing this one, or undefined if this is the Node.js entry point
106
+ */
107
+ parentURL: string | undefined;
108
+ }
109
+ interface ResolveFnOutput {
110
+ /**
111
+ * A hint to the load hook (it might be ignored)
112
+ */
113
+ format?: ModuleFormat | null | undefined;
114
+ /**
115
+ * The import assertions to use when caching the module (optional; if excluded the input will be used)
116
+ */
117
+ importAssertions?: Object | undefined;
118
+ /**
119
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
120
+ * @default false
121
+ */
122
+ shortCircuit?: boolean | undefined;
123
+ /**
124
+ * The absolute URL to which this input resolves
125
+ */
126
+ url: string;
127
+ }
128
+ /**
129
+ * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
130
+ * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
131
+ * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
132
+ *
133
+ * @param specifier The specified URL path of the module to be resolved
134
+ * @param context
135
+ * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
136
+ */
137
+ type ResolveHook = (
138
+ specifier: string,
139
+ context: ResolveHookContext,
140
+ nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput
141
+ ) => ResolveFnOutput | Promise<ResolveFnOutput>;
142
+ interface LoadHookContext {
143
+ /**
144
+ * Export conditions of the relevant `package.json`
145
+ */
146
+ conditions: string[];
147
+ /**
148
+ * The format optionally supplied by the `resolve` hook chain
149
+ */
150
+ format: ModuleFormat;
151
+ /**
152
+ * An object whose key-value pairs represent the assertions for the module to import
153
+ */
154
+ importAssertions: Object;
155
+ }
156
+ interface LoadFnOutput {
157
+ format: ModuleFormat;
158
+ /**
159
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
160
+ * @default false
161
+ */
162
+ shortCircuit?: boolean | undefined;
163
+ /**
164
+ * The source for Node.js to evaluate
165
+ */
166
+ source?: ModuleSource;
167
+ }
168
+ /**
169
+ * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
170
+ * It is also in charge of validating the import assertion.
171
+ *
172
+ * @param url The URL/path of the module to be loaded
173
+ * @param context Metadata about the module
174
+ * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
175
+ */
176
+ type LoadHook = (url: string, context: LoadHookContext, nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput) => LoadFnOutput | Promise<LoadFnOutput>;
81
177
  }
82
178
  interface Module extends NodeModule {}
83
179
  class Module {