@deepseek-ai/dsh-experimental-webworker-runtime 0.1.6-alpha.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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +75 -0
- package/README.zh.md +75 -0
- package/lib/client.js +854 -0
- package/lib/index.js +3506 -0
- package/lib/types/client/apply-injections.d.ts +15 -0
- package/lib/types/client/client.d.ts +102 -0
- package/lib/types/client/index.d.ts +66 -0
- package/lib/types/client/source-chooser.d.ts +8 -0
- package/lib/types/compile/transform.d.ts +39 -0
- package/lib/types/fixture-manifest.d.ts +26 -0
- package/lib/types/image-layout.d.ts +43 -0
- package/lib/types/index.d.ts +23 -0
- package/lib/types/module-proxies.d.ts +25 -0
- package/lib/types/module-system/module-loader.d.ts +177 -0
- package/lib/types/module-system/posix-path.d.ts +98 -0
- package/lib/types/node/builtin_modules/implemented/abort-error.d.ts +11 -0
- package/lib/types/node/builtin_modules/implemented/async_hooks.d.ts +174 -0
- package/lib/types/node/builtin_modules/implemented/buffer.d.ts +28 -0
- package/lib/types/node/builtin_modules/implemented/child_process.d.ts +178 -0
- package/lib/types/node/builtin_modules/implemented/crypto.d.ts +53 -0
- package/lib/types/node/builtin_modules/implemented/events.d.ts +84 -0
- package/lib/types/node/builtin_modules/implemented/fs/promises.d.ts +39 -0
- package/lib/types/node/builtin_modules/implemented/fs-watch.d.ts +119 -0
- package/lib/types/node/builtin_modules/implemented/fs.d.ts +502 -0
- package/lib/types/node/builtin_modules/implemented/http.d.ts +113 -0
- package/lib/types/node/builtin_modules/implemented/module.d.ts +50 -0
- package/lib/types/node/builtin_modules/implemented/os.d.ts +115 -0
- package/lib/types/node/builtin_modules/implemented/path.d.ts +138 -0
- package/lib/types/node/builtin_modules/implemented/perf_hooks.d.ts +13 -0
- package/lib/types/node/builtin_modules/implemented/stream.d.ts +22 -0
- package/lib/types/node/builtin_modules/implemented/timers/promises.d.ts +36 -0
- package/lib/types/node/builtin_modules/implemented/tty.d.ts +18 -0
- package/lib/types/node/builtin_modules/implemented/url.d.ts +61 -0
- package/lib/types/node/builtin_modules/implemented/util/types.d.ts +12 -0
- package/lib/types/node/builtin_modules/implemented/util.d.ts +95 -0
- package/lib/types/node/builtin_modules/implemented/zlib.d.ts +65 -0
- package/lib/types/node/builtin_modules/mock/dns/promises.d.ts +10 -0
- package/lib/types/node/builtin_modules/mock/net.d.ts +61 -0
- package/lib/types/node/builtin_modules/mock/sqlite.d.ts +19 -0
- package/lib/types/node/builtin_modules/mock/vm.d.ts +25 -0
- package/lib/types/node/builtin_modules/mock/worker_threads.d.ts +34 -0
- package/lib/types/node/builtins.d.ts +13 -0
- package/lib/types/node/external_packages/koffi.d.ts +63 -0
- package/lib/types/node/external_packages/node-addon-system-flock.d.ts +19 -0
- package/lib/types/node/external_packages/node-pty.d.ts +13 -0
- package/lib/types/node/external_packages/pi-ai.d.ts +51 -0
- package/lib/types/node/external_packages/replaced-externals.d.ts +9 -0
- package/lib/types/node/external_packages/ripgrep.d.ts +16 -0
- package/lib/types/node/external_packages/sharp.d.ts +6 -0
- package/lib/types/node/external_packages/ws.d.ts +38 -0
- package/lib/types/node/globals/crypto.d.ts +3 -0
- package/lib/types/node/globals/process.d.ts +78 -0
- package/lib/types/node/globals/timers.d.ts +10 -0
- package/lib/types/node/notImplementedFail.d.ts +34 -0
- package/lib/types/node/process-table.d.ts +50 -0
- package/lib/types/polyfill/async-context/als-runtime.d.ts +45 -0
- package/lib/types/polyfill/async-context/async-context-hooks.d.ts +6 -0
- package/lib/types/shell/ast.d.ts +23 -0
- package/lib/types/shell/expand.d.ts +65 -0
- package/lib/types/shell/fs-access.d.ts +43 -0
- package/lib/types/shell/interpret.d.ts +54 -0
- package/lib/types/shell/process/child.d.ts +26 -0
- package/lib/types/shell/process/host.d.ts +58 -0
- package/lib/types/shell/process/landlock.d.ts +33 -0
- package/lib/types/shell/process/protocol.d.ts +74 -0
- package/lib/types/shell/process/virtual-executables.d.ts +49 -0
- package/lib/types/shell/programs/builtins.d.ts +9 -0
- package/lib/types/shell/programs/files.d.ts +11 -0
- package/lib/types/shell/programs/index.d.ts +14 -0
- package/lib/types/shell/programs/options.d.ts +40 -0
- package/lib/types/shell/programs/text.d.ts +9 -0
- package/lib/types/shell/types.d.ts +138 -0
- package/lib/types/storage/active.d.ts +18 -0
- package/lib/types/storage/image-gzip.d.ts +39 -0
- package/lib/types/storage/memory.d.ts +308 -0
- package/lib/types/storage/paths.d.ts +18 -0
- package/lib/types/storage/tar.d.ts +41 -0
- package/lib/types/storage/types.d.ts +279 -0
- package/lib/types/transport/frames.d.ts +108 -0
- package/lib/types/transport/synthetic-http.d.ts +50 -0
- package/lib/types/transport/tunnel.d.ts +132 -0
- package/lib/types/worker-host.d.ts +165 -0
- package/lib/types/worker.d.ts +2 -0
- package/lib/worker.js +21879 -0
- package/package.json +73 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import type { VfsBigIntStats, VfsStatOptions, VfsStats, VfsWriteOptions } from '../../../storage/types.ts';
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
import { Readable, Writable } from './stream.ts';
|
|
4
|
+
import { FSWatcher, StatWatcher, unwatchFile, watch, watchAsync, watchFile } from './fs-watch.ts';
|
|
5
|
+
export { FSWatcher, StatWatcher, unwatchFile, watch, watchFile };
|
|
6
|
+
type PathArg = string | URL | Uint8Array;
|
|
7
|
+
type EncodingOption = BufferEncoding | {
|
|
8
|
+
encoding?: BufferEncoding | null;
|
|
9
|
+
} | null | undefined;
|
|
10
|
+
/** Node `Dirent` subset returned by `readdirSync(dir, { withFileTypes: true })`. */
|
|
11
|
+
export declare class Dirent {
|
|
12
|
+
/** Entry name, without its directory. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** Directory this entry was listed from. */
|
|
15
|
+
readonly parentPath: string;
|
|
16
|
+
private readonly file;
|
|
17
|
+
/**
|
|
18
|
+
* Build one directory entry.
|
|
19
|
+
* @param name - entry name.
|
|
20
|
+
* @param parentPath - directory holding it.
|
|
21
|
+
* @param file - whether the entry is a regular file.
|
|
22
|
+
*/
|
|
23
|
+
constructor(name: string, parentPath: string, file: boolean);
|
|
24
|
+
/**
|
|
25
|
+
* Entry kind, as `readdirSync` observed it.
|
|
26
|
+
* @returns Whether the entry is a regular file.
|
|
27
|
+
*/
|
|
28
|
+
isFile(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Entry kind, as `readdirSync` observed it.
|
|
31
|
+
* @returns Whether the entry is a directory.
|
|
32
|
+
*/
|
|
33
|
+
isDirectory(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Symlink test, answered from the image's own shape.
|
|
36
|
+
* @returns False — the image is materialized without symlinks.
|
|
37
|
+
*/
|
|
38
|
+
isSymbolicLink(): boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Access-mode constants; the VFS has no permission model, so all bits pass. */
|
|
41
|
+
export declare const constants: {
|
|
42
|
+
F_OK: number;
|
|
43
|
+
R_OK: number;
|
|
44
|
+
W_OK: number;
|
|
45
|
+
X_OK: number;
|
|
46
|
+
COPYFILE_EXCL: number;
|
|
47
|
+
O_RDONLY: number;
|
|
48
|
+
O_WRONLY: number;
|
|
49
|
+
O_RDWR: number;
|
|
50
|
+
O_CREAT: number;
|
|
51
|
+
O_TRUNC: number;
|
|
52
|
+
O_APPEND: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Read a file.
|
|
56
|
+
* @param path - file path.
|
|
57
|
+
* @param options - encoding, or an options object carrying one.
|
|
58
|
+
* @returns bytes, or text when an encoding is given.
|
|
59
|
+
*/
|
|
60
|
+
export declare function readFileSync(path: PathArg, options?: EncodingOption): Buffer | string;
|
|
61
|
+
/**
|
|
62
|
+
* Write a file.
|
|
63
|
+
* @param path - file path.
|
|
64
|
+
* @param data - bytes or text.
|
|
65
|
+
* @param options - write flag and creation mode, forwarded to the VFS.
|
|
66
|
+
*/
|
|
67
|
+
export declare function writeFileSync(path: PathArg, data: string | Uint8Array, options?: VfsWriteOptions): void;
|
|
68
|
+
/**
|
|
69
|
+
* Append to a file, creating it when absent.
|
|
70
|
+
* @param path - file path.
|
|
71
|
+
* @param data - bytes or text.
|
|
72
|
+
*/
|
|
73
|
+
export declare function appendFileSync(path: PathArg, data: string | Uint8Array): void;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a path exists.
|
|
76
|
+
* @param path - the path.
|
|
77
|
+
* @returns true when present.
|
|
78
|
+
*/
|
|
79
|
+
export declare function existsSync(path: PathArg): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Stat a path.
|
|
82
|
+
* @param path - the path.
|
|
83
|
+
* @param options - `bigint` selects the BigInt stats the filesystem service reads.
|
|
84
|
+
* @returns the stats, in the plain or BigInt shape.
|
|
85
|
+
*/
|
|
86
|
+
export declare function statSync(path: PathArg, options?: VfsStatOptions): VfsStats | VfsBigIntStats;
|
|
87
|
+
/**
|
|
88
|
+
* Read stats through Node's callback form.
|
|
89
|
+
* @param path - Path to stat.
|
|
90
|
+
* @param optionsOrCallback - Stat options or the completion callback.
|
|
91
|
+
* @param maybeCallback - Completion callback when options are present.
|
|
92
|
+
*/
|
|
93
|
+
export declare function stat(path: PathArg, optionsOrCallback: VfsStatOptions | ((error: NodeJS.ErrnoException | null, stats?: VfsStats | VfsBigIntStats) => void), maybeCallback?: (error: NodeJS.ErrnoException | null, stats?: VfsStats | VfsBigIntStats) => void): void;
|
|
94
|
+
/**
|
|
95
|
+
* Change an entry's permission bits; stat reads back exactly what was set.
|
|
96
|
+
* @param path - the path.
|
|
97
|
+
* @param mode - new permission bits (`0o777` mask), numeric or Node's octal string form.
|
|
98
|
+
*/
|
|
99
|
+
export declare function chmodSync(path: PathArg, mode: number | string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Stat a path without following symlinks (the image has none).
|
|
102
|
+
* @param path - the path.
|
|
103
|
+
* @param options - `bigint` selects the BigInt stats the filesystem service reads.
|
|
104
|
+
* @returns the stats, in the plain or BigInt shape.
|
|
105
|
+
*/
|
|
106
|
+
export declare function lstatSync(path: PathArg, options?: VfsStatOptions): VfsStats | VfsBigIntStats;
|
|
107
|
+
/**
|
|
108
|
+
* Read link stats through Node's callback form; this symlink-free VFS delegates to stat.
|
|
109
|
+
* @param path - Path to stat.
|
|
110
|
+
* @param optionsOrCallback - Stat options or the completion callback.
|
|
111
|
+
* @param maybeCallback - Completion callback when options are present.
|
|
112
|
+
*/
|
|
113
|
+
export declare function lstat(path: PathArg, optionsOrCallback: VfsStatOptions | ((error: NodeJS.ErrnoException | null, stats?: VfsStats | VfsBigIntStats) => void), maybeCallback?: (error: NodeJS.ErrnoException | null, stats?: VfsStats | VfsBigIntStats) => void): void;
|
|
114
|
+
/**
|
|
115
|
+
* Canonical path (normalization only: the image is symlink-free).
|
|
116
|
+
* @param path - the path.
|
|
117
|
+
* @returns the resolved path.
|
|
118
|
+
*/
|
|
119
|
+
export declare function realpathSync(path: PathArg): string;
|
|
120
|
+
/**
|
|
121
|
+
* Resolve a UTF-8 path through Node's callback form and its native alias.
|
|
122
|
+
* @param path - Path in the symlink-free VFS.
|
|
123
|
+
* @param callback - Asynchronous completion with the canonical path or filesystem error.
|
|
124
|
+
*/
|
|
125
|
+
export declare function realpath(path: PathArg, callback: (error: NodeJS.ErrnoException | null, path?: string) => void): void;
|
|
126
|
+
export declare namespace realpath {
|
|
127
|
+
var native: typeof realpath;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* List a directory.
|
|
131
|
+
* @param path - directory path.
|
|
132
|
+
* @param options - `withFileTypes` selects Dirent objects.
|
|
133
|
+
* @returns names, or Dirent objects.
|
|
134
|
+
*/
|
|
135
|
+
export declare function readdirSync(path: PathArg, options?: {
|
|
136
|
+
withFileTypes?: boolean;
|
|
137
|
+
} | BufferEncoding | null): string[] | Dirent[];
|
|
138
|
+
/**
|
|
139
|
+
* Create a directory.
|
|
140
|
+
* @param path - directory path.
|
|
141
|
+
* @param options - `recursive` creates parents.
|
|
142
|
+
* @returns the first created path when recursive, else undefined.
|
|
143
|
+
*/
|
|
144
|
+
export declare function mkdirSync(path: PathArg, options?: {
|
|
145
|
+
recursive?: boolean;
|
|
146
|
+
mode?: number;
|
|
147
|
+
}): string | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Create a uniquely named directory.
|
|
150
|
+
* @param prefix - path prefix; six random characters are appended.
|
|
151
|
+
* @returns the created directory path.
|
|
152
|
+
*/
|
|
153
|
+
export declare function mkdtempSync(prefix: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* Remove a file or directory.
|
|
156
|
+
* @param path - the path.
|
|
157
|
+
* @param options - `recursive`/`force`, as in Node.
|
|
158
|
+
*/
|
|
159
|
+
export declare function rmSync(path: PathArg, options?: {
|
|
160
|
+
recursive?: boolean;
|
|
161
|
+
force?: boolean;
|
|
162
|
+
}): void;
|
|
163
|
+
/**
|
|
164
|
+
* Remove a file.
|
|
165
|
+
* @param path - the path.
|
|
166
|
+
*/
|
|
167
|
+
export declare function unlinkSync(path: PathArg): void;
|
|
168
|
+
/**
|
|
169
|
+
* Rename a path.
|
|
170
|
+
* @param from - source path.
|
|
171
|
+
* @param to - target path.
|
|
172
|
+
*/
|
|
173
|
+
export declare function renameSync(from: PathArg, to: PathArg): void;
|
|
174
|
+
/**
|
|
175
|
+
* Access check: existence only.
|
|
176
|
+
* @param path - the path.
|
|
177
|
+
*/
|
|
178
|
+
export declare function accessSync(path: PathArg): void;
|
|
179
|
+
/**
|
|
180
|
+
* Open a file descriptor.
|
|
181
|
+
* @param path - file path.
|
|
182
|
+
* @param flags - Node flag string: 'r', 'w', 'a', with optional '+' and the
|
|
183
|
+
* exclusive 'x' (create-only) modifier.
|
|
184
|
+
* @param mode - creation permission bits.
|
|
185
|
+
* @returns the descriptor.
|
|
186
|
+
*/
|
|
187
|
+
export declare function openSync(path: PathArg, flags?: string, mode?: number): number;
|
|
188
|
+
/**
|
|
189
|
+
* Read from a descriptor.
|
|
190
|
+
* @param fd - descriptor.
|
|
191
|
+
* @param buffer - destination.
|
|
192
|
+
* @param offset - destination offset.
|
|
193
|
+
* @param length - byte count.
|
|
194
|
+
* @param position - file position, or null to continue from the cursor.
|
|
195
|
+
* @returns bytes read.
|
|
196
|
+
*/
|
|
197
|
+
export declare function readSync(fd: number, buffer: Uint8Array, offset?: number, length?: number, position?: number | null): number;
|
|
198
|
+
/**
|
|
199
|
+
* Write through a descriptor.
|
|
200
|
+
* @param fd - descriptor.
|
|
201
|
+
* @param data - bytes or text.
|
|
202
|
+
* @returns bytes written.
|
|
203
|
+
*/
|
|
204
|
+
export declare function writeSync(fd: number, data: string | Uint8Array): number;
|
|
205
|
+
/**
|
|
206
|
+
* Close a descriptor.
|
|
207
|
+
* @param fd - descriptor.
|
|
208
|
+
*/
|
|
209
|
+
export declare function closeSync(fd: number): void;
|
|
210
|
+
/**
|
|
211
|
+
* Create a second name for one file identity.
|
|
212
|
+
* @param from - existing path.
|
|
213
|
+
* @param to - new path.
|
|
214
|
+
*/
|
|
215
|
+
export declare function linkSync(from: PathArg, to: PathArg): void;
|
|
216
|
+
/**
|
|
217
|
+
* Open file handle (`fs.FileHandle` subset): the atomic-write and durability
|
|
218
|
+
* pair the storage backends use. `sync`/`datasync` settle the active VFS's
|
|
219
|
+
* optional write-behind sink.
|
|
220
|
+
*/
|
|
221
|
+
export interface FileHandle {
|
|
222
|
+
readonly fd: number;
|
|
223
|
+
readFile(options?: EncodingOption): Promise<Buffer | string>;
|
|
224
|
+
writeFile(data: string | Uint8Array, encoding?: BufferEncoding): Promise<void>;
|
|
225
|
+
write(data: string | Uint8Array): Promise<{
|
|
226
|
+
bytesWritten: number;
|
|
227
|
+
}>;
|
|
228
|
+
read(buffer: Uint8Array, offset?: number, length?: number, position?: number | null): Promise<{
|
|
229
|
+
bytesRead: number;
|
|
230
|
+
buffer: Uint8Array;
|
|
231
|
+
}>;
|
|
232
|
+
chmod(mode: number | string): Promise<void>;
|
|
233
|
+
stat(options?: VfsStatOptions): Promise<VfsStats | VfsBigIntStats>;
|
|
234
|
+
truncate(length?: number): Promise<void>;
|
|
235
|
+
sync(): Promise<void>;
|
|
236
|
+
datasync(): Promise<void>;
|
|
237
|
+
close(): Promise<void>;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Open a file handle. Directories open read-only, which is what the durability
|
|
241
|
+
* helpers do before an fsync.
|
|
242
|
+
* @param path - file or directory path.
|
|
243
|
+
* @param flags - Node flag string.
|
|
244
|
+
* @param mode - creation permission bits.
|
|
245
|
+
* @returns the handle.
|
|
246
|
+
*/
|
|
247
|
+
export declare function openHandleSync(path: PathArg, flags?: string, mode?: number): FileHandle;
|
|
248
|
+
/** Options supported by the VFS-backed read stream. */
|
|
249
|
+
export interface ReadStreamOptions {
|
|
250
|
+
flags?: string;
|
|
251
|
+
encoding?: BufferEncoding | null;
|
|
252
|
+
autoClose?: boolean;
|
|
253
|
+
emitClose?: boolean;
|
|
254
|
+
start?: number;
|
|
255
|
+
end?: number;
|
|
256
|
+
highWaterMark?: number;
|
|
257
|
+
signal?: AbortSignal;
|
|
258
|
+
}
|
|
259
|
+
/** Options supported by the VFS-backed write stream. */
|
|
260
|
+
export interface WriteStreamOptions {
|
|
261
|
+
flags?: string;
|
|
262
|
+
encoding?: BufferEncoding | null;
|
|
263
|
+
mode?: number;
|
|
264
|
+
autoClose?: boolean;
|
|
265
|
+
emitClose?: boolean;
|
|
266
|
+
start?: number;
|
|
267
|
+
highWaterMark?: number;
|
|
268
|
+
signal?: AbortSignal;
|
|
269
|
+
}
|
|
270
|
+
/** Read stream over one VFS file. */
|
|
271
|
+
export declare class ReadStream extends Readable {
|
|
272
|
+
/** Resolved path opened by this stream. */
|
|
273
|
+
readonly path: string;
|
|
274
|
+
/** Open descriptor, or null before open and after close. */
|
|
275
|
+
fd: number | null;
|
|
276
|
+
/** Whether the descriptor is still waiting to open. */
|
|
277
|
+
pending: boolean;
|
|
278
|
+
/** Bytes delivered by this stream. */
|
|
279
|
+
bytesRead: number;
|
|
280
|
+
private readonly start;
|
|
281
|
+
private readonly end;
|
|
282
|
+
private readonly flags;
|
|
283
|
+
private readonly signal;
|
|
284
|
+
private readonly onAbort;
|
|
285
|
+
private position;
|
|
286
|
+
constructor(path: PathArg, options?: ReadStreamOptions);
|
|
287
|
+
_construct(callback: (error?: Error | null) => void): void;
|
|
288
|
+
_read(size: number): void;
|
|
289
|
+
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
|
290
|
+
/**
|
|
291
|
+
* Close the stream and release its descriptor.
|
|
292
|
+
* @param callback - Optional completion callback after `close`.
|
|
293
|
+
*/
|
|
294
|
+
close(callback?: (error?: NodeJS.ErrnoException | null) => void): void;
|
|
295
|
+
}
|
|
296
|
+
/** Writable stream committing chunks through the VFS file-descriptor face. */
|
|
297
|
+
export declare class WriteStream extends Writable {
|
|
298
|
+
/** Resolved path opened by this stream. */
|
|
299
|
+
readonly path: string;
|
|
300
|
+
/** Open descriptor, or null before open and after close. */
|
|
301
|
+
fd: number | null;
|
|
302
|
+
/** Whether the descriptor is still waiting to open. */
|
|
303
|
+
pending: boolean;
|
|
304
|
+
/** Bytes committed by this stream. */
|
|
305
|
+
bytesWritten: number;
|
|
306
|
+
private readonly flags;
|
|
307
|
+
private readonly mode;
|
|
308
|
+
private readonly start;
|
|
309
|
+
private readonly signal;
|
|
310
|
+
private readonly onAbort;
|
|
311
|
+
constructor(path: PathArg, options?: WriteStreamOptions);
|
|
312
|
+
_construct(callback: (error?: Error | null) => void): void;
|
|
313
|
+
_write(chunk: string | Uint8Array, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
314
|
+
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
|
|
315
|
+
/**
|
|
316
|
+
* Close the stream and release its descriptor.
|
|
317
|
+
* @param callback - Optional completion callback after `close`.
|
|
318
|
+
*/
|
|
319
|
+
close(callback?: (error?: NodeJS.ErrnoException | null) => void): void;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Create a Node-compatible readable file stream over the VFS.
|
|
323
|
+
* @param path - File path.
|
|
324
|
+
* @param options - Encoding, range, open, buffer, and abort options.
|
|
325
|
+
* @returns The readable file stream.
|
|
326
|
+
*/
|
|
327
|
+
export declare function createReadStream(path: PathArg, options?: ReadStreamOptions | BufferEncoding): ReadStream;
|
|
328
|
+
/**
|
|
329
|
+
* Create a Node-compatible writable file stream over the VFS.
|
|
330
|
+
* @param path - File path.
|
|
331
|
+
* @param options - Encoding, open, buffer, and abort options.
|
|
332
|
+
* @returns The writable file stream.
|
|
333
|
+
*/
|
|
334
|
+
export declare function createWriteStream(path: PathArg, options?: WriteStreamOptions | BufferEncoding): WriteStream;
|
|
335
|
+
/** Open directory handle (`fs.Dir` subset): iteration plus the close pair. */
|
|
336
|
+
export interface Dir {
|
|
337
|
+
readonly path: string;
|
|
338
|
+
read(): Promise<Dirent | null>;
|
|
339
|
+
close(): Promise<void>;
|
|
340
|
+
closeSync(): void;
|
|
341
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Open a directory handle. Callers use it to assert "this path is a directory"
|
|
345
|
+
* and to walk entries; the listing is taken once, since the VFS has no external
|
|
346
|
+
* writer to race with.
|
|
347
|
+
* @param path - directory path.
|
|
348
|
+
* @returns the handle.
|
|
349
|
+
*/
|
|
350
|
+
export declare function opendirSync(path: PathArg): Dir;
|
|
351
|
+
/**
|
|
352
|
+
* Promise face (`node:fs/promises`) over the same VFS. Each member answers the
|
|
353
|
+
* union the VFS produces rather than Node's encoding-dependent overloads, so the
|
|
354
|
+
* check here is that every name is a real `node:fs/promises` export.
|
|
355
|
+
*/
|
|
356
|
+
export declare const promises: {
|
|
357
|
+
readFile: (path: PathArg, options?: EncodingOption) => Promise<Buffer | string>;
|
|
358
|
+
writeFile: (path: PathArg, data: string | Uint8Array, options?: {
|
|
359
|
+
flag?: string;
|
|
360
|
+
mode?: number;
|
|
361
|
+
} | BufferEncoding | null) => Promise<void>;
|
|
362
|
+
appendFile: (path: PathArg, data: string | Uint8Array) => Promise<void>;
|
|
363
|
+
mkdir: (path: PathArg, options?: {
|
|
364
|
+
recursive?: boolean;
|
|
365
|
+
mode?: number;
|
|
366
|
+
}) => Promise<string | undefined>;
|
|
367
|
+
mkdtemp: (prefix: string) => Promise<string>;
|
|
368
|
+
readdir: (path: PathArg, options?: {
|
|
369
|
+
withFileTypes?: boolean;
|
|
370
|
+
} | BufferEncoding) => Promise<string[] | Dirent[]>;
|
|
371
|
+
stat: (path: PathArg, options?: VfsStatOptions) => Promise<VfsStats | VfsBigIntStats>;
|
|
372
|
+
lstat: (path: PathArg, options?: VfsStatOptions) => Promise<VfsStats | VfsBigIntStats>;
|
|
373
|
+
realpath: (path: PathArg) => Promise<string>;
|
|
374
|
+
rm: (path: PathArg, options?: {
|
|
375
|
+
recursive?: boolean;
|
|
376
|
+
force?: boolean;
|
|
377
|
+
}) => Promise<void>;
|
|
378
|
+
unlink: (path: PathArg) => Promise<void>;
|
|
379
|
+
rename: (from: PathArg, to: PathArg) => Promise<void>;
|
|
380
|
+
access: (path: PathArg) => Promise<void>;
|
|
381
|
+
chmod: (path: PathArg, mode: number | string) => Promise<void>;
|
|
382
|
+
cp: (from: PathArg, to: PathArg) => Promise<void>;
|
|
383
|
+
link: (from: PathArg, to: PathArg) => Promise<void>;
|
|
384
|
+
open: (path: PathArg, flags?: string, mode?: number) => Promise<FileHandle>;
|
|
385
|
+
opendir: (path: PathArg) => Promise<Dir>;
|
|
386
|
+
truncate: (path: PathArg, length?: number) => Promise<void>;
|
|
387
|
+
watch: typeof watchAsync;
|
|
388
|
+
constants: {
|
|
389
|
+
F_OK: number;
|
|
390
|
+
R_OK: number;
|
|
391
|
+
W_OK: number;
|
|
392
|
+
X_OK: number;
|
|
393
|
+
COPYFILE_EXCL: number;
|
|
394
|
+
O_RDONLY: number;
|
|
395
|
+
O_WRONLY: number;
|
|
396
|
+
O_RDWR: number;
|
|
397
|
+
O_CREAT: number;
|
|
398
|
+
O_TRUNC: number;
|
|
399
|
+
O_APPEND: number;
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
/** CommonJS interop marker: the worker loader hands `default` to default imports (see ./builtins.ts). */
|
|
403
|
+
export declare const __esModule = true;
|
|
404
|
+
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
405
|
+
declare const _default: {
|
|
406
|
+
constants: {
|
|
407
|
+
F_OK: number;
|
|
408
|
+
R_OK: number;
|
|
409
|
+
W_OK: number;
|
|
410
|
+
X_OK: number;
|
|
411
|
+
COPYFILE_EXCL: number;
|
|
412
|
+
O_RDONLY: number;
|
|
413
|
+
O_WRONLY: number;
|
|
414
|
+
O_RDWR: number;
|
|
415
|
+
O_CREAT: number;
|
|
416
|
+
O_TRUNC: number;
|
|
417
|
+
O_APPEND: number;
|
|
418
|
+
};
|
|
419
|
+
promises: {
|
|
420
|
+
readFile: (path: PathArg, options?: EncodingOption) => Promise<Buffer | string>;
|
|
421
|
+
writeFile: (path: PathArg, data: string | Uint8Array, options?: {
|
|
422
|
+
flag?: string;
|
|
423
|
+
mode?: number;
|
|
424
|
+
} | BufferEncoding | null) => Promise<void>;
|
|
425
|
+
appendFile: (path: PathArg, data: string | Uint8Array) => Promise<void>;
|
|
426
|
+
mkdir: (path: PathArg, options?: {
|
|
427
|
+
recursive?: boolean;
|
|
428
|
+
mode?: number;
|
|
429
|
+
}) => Promise<string | undefined>;
|
|
430
|
+
mkdtemp: (prefix: string) => Promise<string>;
|
|
431
|
+
readdir: (path: PathArg, options?: {
|
|
432
|
+
withFileTypes?: boolean;
|
|
433
|
+
} | BufferEncoding) => Promise<string[] | Dirent[]>;
|
|
434
|
+
stat: (path: PathArg, options?: VfsStatOptions) => Promise<VfsStats | VfsBigIntStats>;
|
|
435
|
+
lstat: (path: PathArg, options?: VfsStatOptions) => Promise<VfsStats | VfsBigIntStats>;
|
|
436
|
+
realpath: (path: PathArg) => Promise<string>;
|
|
437
|
+
rm: (path: PathArg, options?: {
|
|
438
|
+
recursive?: boolean;
|
|
439
|
+
force?: boolean;
|
|
440
|
+
}) => Promise<void>;
|
|
441
|
+
unlink: (path: PathArg) => Promise<void>;
|
|
442
|
+
rename: (from: PathArg, to: PathArg) => Promise<void>;
|
|
443
|
+
access: (path: PathArg) => Promise<void>;
|
|
444
|
+
chmod: (path: PathArg, mode: number | string) => Promise<void>;
|
|
445
|
+
cp: (from: PathArg, to: PathArg) => Promise<void>;
|
|
446
|
+
link: (from: PathArg, to: PathArg) => Promise<void>;
|
|
447
|
+
open: (path: PathArg, flags?: string, mode?: number) => Promise<FileHandle>;
|
|
448
|
+
opendir: (path: PathArg) => Promise<Dir>;
|
|
449
|
+
truncate: (path: PathArg, length?: number) => Promise<void>;
|
|
450
|
+
watch: typeof watchAsync;
|
|
451
|
+
constants: {
|
|
452
|
+
F_OK: number;
|
|
453
|
+
R_OK: number;
|
|
454
|
+
W_OK: number;
|
|
455
|
+
X_OK: number;
|
|
456
|
+
COPYFILE_EXCL: number;
|
|
457
|
+
O_RDONLY: number;
|
|
458
|
+
O_WRONLY: number;
|
|
459
|
+
O_RDWR: number;
|
|
460
|
+
O_CREAT: number;
|
|
461
|
+
O_TRUNC: number;
|
|
462
|
+
O_APPEND: number;
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
Dirent: typeof Dirent;
|
|
466
|
+
FSWatcher: typeof FSWatcher;
|
|
467
|
+
StatWatcher: typeof StatWatcher;
|
|
468
|
+
ReadStream: typeof ReadStream;
|
|
469
|
+
WriteStream: typeof WriteStream;
|
|
470
|
+
readFileSync: typeof readFileSync;
|
|
471
|
+
writeFileSync: typeof writeFileSync;
|
|
472
|
+
appendFileSync: typeof appendFileSync;
|
|
473
|
+
existsSync: typeof existsSync;
|
|
474
|
+
statSync: typeof statSync;
|
|
475
|
+
stat: typeof stat;
|
|
476
|
+
lstatSync: typeof lstatSync;
|
|
477
|
+
lstat: typeof lstat;
|
|
478
|
+
realpathSync: typeof realpathSync;
|
|
479
|
+
realpath: typeof realpath;
|
|
480
|
+
chmodSync: typeof chmodSync;
|
|
481
|
+
readdirSync: typeof readdirSync;
|
|
482
|
+
mkdirSync: typeof mkdirSync;
|
|
483
|
+
mkdtempSync: typeof mkdtempSync;
|
|
484
|
+
rmSync: typeof rmSync;
|
|
485
|
+
unlinkSync: typeof unlinkSync;
|
|
486
|
+
renameSync: typeof renameSync;
|
|
487
|
+
accessSync: typeof accessSync;
|
|
488
|
+
opendirSync: typeof opendirSync;
|
|
489
|
+
openHandleSync: typeof openHandleSync;
|
|
490
|
+
linkSync: typeof linkSync;
|
|
491
|
+
openSync: typeof openSync;
|
|
492
|
+
readSync: typeof readSync;
|
|
493
|
+
writeSync: typeof writeSync;
|
|
494
|
+
closeSync: typeof closeSync;
|
|
495
|
+
watch: typeof watch;
|
|
496
|
+
watchFile: typeof watchFile;
|
|
497
|
+
unwatchFile: typeof unwatchFile;
|
|
498
|
+
createReadStream: typeof createReadStream;
|
|
499
|
+
createWriteStream: typeof createWriteStream;
|
|
500
|
+
};
|
|
501
|
+
export default _default;
|
|
502
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `node:http` for the worker: `createServer` returns a Server whose `listen`
|
|
3
|
+
* succeeds immediately without a socket, and retains the captured request
|
|
4
|
+
* listener so the tunnel server can feed synthesized requests into the real
|
|
5
|
+
* route table. The fake Server exposes only the members those routes read.
|
|
6
|
+
* The worker entry hands {@link whenRequestListener} to the host assembly, so the
|
|
7
|
+
* package never reaches back into this app.
|
|
8
|
+
*/
|
|
9
|
+
import type { RequestListener } from '../../../transport/synthetic-http.ts';
|
|
10
|
+
type Listener = (...args: unknown[]) => void;
|
|
11
|
+
export type { RequestListener };
|
|
12
|
+
/**
|
|
13
|
+
* The webserver's request listener, once `[Service.init]` has installed it.
|
|
14
|
+
* @returns the listener, or undefined before the webserver row activates.
|
|
15
|
+
*/
|
|
16
|
+
export declare function requestListener(): RequestListener | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Await the request listener.
|
|
19
|
+
* @returns a promise resolved with the listener as soon as it is captured.
|
|
20
|
+
*/
|
|
21
|
+
export declare function whenRequestListener(): Promise<RequestListener>;
|
|
22
|
+
/** Fake Server: event registrations are stored and never emitted. */
|
|
23
|
+
declare class FakeServer {
|
|
24
|
+
private readonly listeners;
|
|
25
|
+
/**
|
|
26
|
+
* Register an event listener (`upgrade`, `error`); never emitted.
|
|
27
|
+
* @param event - event name.
|
|
28
|
+
* @param listener - the listener.
|
|
29
|
+
* @returns this server.
|
|
30
|
+
*/
|
|
31
|
+
on(event: string, listener: Listener): this;
|
|
32
|
+
/**
|
|
33
|
+
* One-shot registration counterpart of {@link on}.
|
|
34
|
+
* @param event - event name.
|
|
35
|
+
* @param listener - the listener.
|
|
36
|
+
* @returns this server.
|
|
37
|
+
*/
|
|
38
|
+
once(event: string, listener: Listener): this;
|
|
39
|
+
/**
|
|
40
|
+
* Remove a listener.
|
|
41
|
+
* @param event - event name.
|
|
42
|
+
* @param listener - the listener.
|
|
43
|
+
* @returns this server.
|
|
44
|
+
*/
|
|
45
|
+
off(event: string, listener: Listener): this;
|
|
46
|
+
/**
|
|
47
|
+
* Bind: succeeds immediately. The callback must run or the webserver fiber
|
|
48
|
+
* stays in LOADING forever.
|
|
49
|
+
* @param args - Node's listen arguments; only a trailing callback matters.
|
|
50
|
+
* @returns this server.
|
|
51
|
+
*/
|
|
52
|
+
listen(...args: unknown[]): this;
|
|
53
|
+
/**
|
|
54
|
+
* Bound address.
|
|
55
|
+
* @returns the loopback authority the tunnel synthesizes.
|
|
56
|
+
*/
|
|
57
|
+
address(): {
|
|
58
|
+
address: string;
|
|
59
|
+
family: string;
|
|
60
|
+
port: number;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Close: no socket to release.
|
|
64
|
+
* @param callback - completion callback, invoked immediately.
|
|
65
|
+
* @returns this server.
|
|
66
|
+
*/
|
|
67
|
+
close(callback?: Listener): this;
|
|
68
|
+
/** No connection was ever accepted. */
|
|
69
|
+
closeAllConnections(): void;
|
|
70
|
+
/** No idle connection exists either. */
|
|
71
|
+
closeIdleConnections(): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Constructor marker read by middleware during feature detection. Tunnel
|
|
75
|
+
* responses are synthesized objects and are never instances of this class.
|
|
76
|
+
*/
|
|
77
|
+
export declare class ServerResponse {
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create the fake server and retain its request listener for the tunnel.
|
|
81
|
+
* @param listener - the request listener the webserver installs.
|
|
82
|
+
* @returns the fake Server.
|
|
83
|
+
*/
|
|
84
|
+
export declare function createServer(listener?: RequestListener): FakeServer;
|
|
85
|
+
/**
|
|
86
|
+
* Outbound HTTP has one carrier in the worker: `fetch`.
|
|
87
|
+
* @returns Never — it throws naming the unavailable member.
|
|
88
|
+
*/
|
|
89
|
+
export declare function request(): never;
|
|
90
|
+
/**
|
|
91
|
+
* Same as {@link request}.
|
|
92
|
+
* @returns Never — it throws naming the unavailable member.
|
|
93
|
+
*/
|
|
94
|
+
export declare function get(): never;
|
|
95
|
+
/** Status text table Node exposes; a few handlers write status lines by hand. */
|
|
96
|
+
export declare const STATUS_CODES: typeof import('node:http').STATUS_CODES;
|
|
97
|
+
export { FakeServer as Server };
|
|
98
|
+
/** CommonJS interop marker: the worker loader hands `default` to default imports (see ./builtins.ts). */
|
|
99
|
+
export declare const __esModule = true;
|
|
100
|
+
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
101
|
+
declare const _default: {
|
|
102
|
+
createServer: typeof createServer;
|
|
103
|
+
request: typeof request;
|
|
104
|
+
get: typeof get;
|
|
105
|
+
STATUS_CODES: {
|
|
106
|
+
[errorCode: number]: string | undefined;
|
|
107
|
+
[errorCode: string]: string | undefined;
|
|
108
|
+
};
|
|
109
|
+
Server: typeof FakeServer;
|
|
110
|
+
ServerResponse: typeof ServerResponse;
|
|
111
|
+
};
|
|
112
|
+
export default _default;
|
|
113
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `node:module` for the worker: `createRequire` hands out the worker module
|
|
3
|
+
* loader's synchronous require. Typert can resolve package exports, and package
|
|
4
|
+
* inventory can discover manifests through `require.resolve.paths()` without
|
|
5
|
+
* either consumer changing for the Worker.
|
|
6
|
+
*/
|
|
7
|
+
import { type WorkerRequire } from '../../../module-system/module-loader.ts';
|
|
8
|
+
/** Node `require` face the harness consumes. */
|
|
9
|
+
export type NodeRequire = WorkerRequire;
|
|
10
|
+
/**
|
|
11
|
+
* Build a `require` bound to a base path or file URL.
|
|
12
|
+
* @param base - directory, file path, or file URL the resolution starts from.
|
|
13
|
+
* @returns the synchronous require face, including `resolve()` and `resolve.paths()`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createRequire(base: string | URL): NodeRequire;
|
|
16
|
+
/** Builtin specifiers the module proxy table answers (without the `node:` prefix). */
|
|
17
|
+
export declare const builtinModules: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether a specifier names a Node builtin.
|
|
20
|
+
* @param specifier - the module specifier.
|
|
21
|
+
* @returns true for builtin names, with or without the `node:` prefix.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isBuiltin(specifier: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* TypeScript stripping is a Node 22+ loader feature with no worker counterpart.
|
|
26
|
+
* @returns Never — it throws naming the unavailable member.
|
|
27
|
+
*/
|
|
28
|
+
export declare function stripTypeScriptTypes(): never;
|
|
29
|
+
/**
|
|
30
|
+
* Loader hooks have no meaning here: the worker loader owns resolution.
|
|
31
|
+
* @returns Never — it throws naming the unavailable member.
|
|
32
|
+
*/
|
|
33
|
+
export declare function register(): never;
|
|
34
|
+
/** ESM/CJS export syncing is a no-op: the worker loader materializes CommonJS only. */
|
|
35
|
+
export declare function syncBuiltinESMExports(): void;
|
|
36
|
+
/** Erased type peer for the vendored loader's type-only LoadHookContext import. */
|
|
37
|
+
export type LoadHookContext = never;
|
|
38
|
+
/** CommonJS interop marker: the worker loader hands `default` to default imports (see ./builtins.ts). */
|
|
39
|
+
export declare const __esModule = true;
|
|
40
|
+
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
41
|
+
declare const _default: {
|
|
42
|
+
createRequire: typeof createRequire;
|
|
43
|
+
builtinModules: string[];
|
|
44
|
+
isBuiltin: typeof isBuiltin;
|
|
45
|
+
register: typeof register;
|
|
46
|
+
syncBuiltinESMExports: typeof syncBuiltinESMExports;
|
|
47
|
+
stripTypeScriptTypes: typeof stripTypeScriptTypes;
|
|
48
|
+
};
|
|
49
|
+
export default _default;
|
|
50
|
+
//# sourceMappingURL=module.d.ts.map
|