@volter/tabnode 0.4.1 → 0.5.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/dist/__sw__.js +259 -5
- package/dist/assets/{runtime-worker-LWfW6VWE.js → runtime-worker-DBZ2flHK.js} +4000 -2944
- package/dist/fetch-transport.d.ts +20 -0
- package/dist/guest-timers.d.ts +15 -0
- package/dist/http-client-transport.d.ts +19 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +5196 -3062
- package/dist/native-stream-binding.d.ts +57 -0
- package/dist/native-stream-owner.d.ts +121 -0
- package/dist/node-lib/binding/duplex_stream.d.ts +26 -0
- package/dist/node-lib/binding/fds.d.ts +8 -0
- package/dist/node-lib/binding/fs.d.ts +311 -78
- package/dist/node-lib/binding/misc.d.ts +1 -0
- package/dist/node-lib/binding/pipe_wrap.d.ts +4 -4
- package/dist/node-lib/binding/process_wrap.d.ts +12 -1
- package/dist/node-lib/binding/stream_wrap.d.ts +27 -18
- package/dist/node-lib/binding/tcp_wrap.d.ts +0 -1
- package/dist/node-lib/binding/tty_wrap.d.ts +43 -2
- package/dist/node-lib/binding/util.d.ts +83 -0
- package/dist/node-lib/binding/uv.d.ts +4 -0
- package/dist/node-lib/fs-module.d.ts +1 -0
- package/dist/node-lib/internals/buffer-and-streams.d.ts +30 -17
- package/dist/node-lib/internals/index.d.ts +1 -1
- package/dist/node-lib/load.d.ts +17 -3
- package/dist/node-lib/module-hooks.d.ts +1 -0
- package/dist/node-lib/public-modules.d.ts +1 -1
- package/dist/node-lib/timers.d.ts +38 -0
- package/dist/node-process-host.d.ts +41 -0
- package/dist/process-registry.d.ts +39 -0
- package/dist/process-tokens.d.ts +11 -0
- package/dist/promise-ownership.d.ts +3 -0
- package/dist/runtime.d.ts +10 -9
- package/dist/shims/child_process.d.ts +2 -0
- package/dist/shims/crypto.d.ts +660 -119
- package/dist/shims/dns.d.ts +76 -2
- package/dist/shims/process.d.ts +1 -0
- package/dist/shims/string_decoder.d.ts +19 -3
- package/dist/shims/tls.d.ts +853 -31
- package/dist/source-edits.d.ts +7 -0
- package/package.json +1 -1
- package/src/code-transforms.ts +2 -3
- package/src/fetch-transport.ts +98 -0
- package/src/guest-timers.ts +89 -0
- package/src/http-client-transport.ts +169 -0
- package/src/index.ts +18 -0
- package/src/native-stream-binding.ts +393 -0
- package/src/native-stream-owner.ts +317 -0
- package/src/node-lib/binding/duplex_stream.ts +95 -0
- package/src/node-lib/binding/fds.ts +18 -1
- package/src/node-lib/binding/fs.ts +45 -17
- package/src/node-lib/binding/misc.ts +2 -0
- package/src/node-lib/binding/pipe_wrap.ts +35 -12
- package/src/node-lib/binding/process_wrap.ts +50 -9
- package/src/node-lib/binding/stream_wrap.ts +196 -72
- package/src/node-lib/binding/tcp_wrap.ts +43 -8
- package/src/node-lib/binding/tty_wrap.ts +135 -8
- package/src/node-lib/binding/util.ts +24 -15
- package/src/node-lib/binding/uv.ts +4 -0
- package/src/node-lib/fs-module.ts +2 -18
- package/src/node-lib/internal/navigator.js +149 -0
- package/src/node-lib/internals/buffer-and-streams.ts +50 -11
- package/src/node-lib/internals/events-util.ts +5 -0
- package/src/node-lib/internals/index.ts +12 -2
- package/src/node-lib/load.ts +170 -62
- package/src/node-lib/module-hooks.ts +5 -2
- package/src/node-lib/public-modules.ts +12 -48
- package/src/node-lib/sources.ts +4 -0
- package/src/node-lib/timers.ts +93 -0
- package/src/node-process-host.ts +124 -0
- package/src/process-registry.ts +144 -0
- package/src/process-tokens.ts +55 -6
- package/src/promise-ownership.ts +28 -0
- package/src/runtime.ts +90 -214
- package/src/shims/child_process.ts +310 -80
- package/src/shims/crypto.ts +115 -100
- package/src/shims/dns.ts +17 -1
- package/src/shims/process.ts +33 -11
- package/src/shims/string_decoder.ts +10 -6
- package/src/shims/tls.ts +49 -19
- package/src/source-edits.ts +20 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Worker-side libuv delegation. The capability channel never becomes a handle property. */
|
|
2
|
+
import type { NativeStreamDescriptor, NativeStreamEvent, NativeStreamOperation, NativeStreamReply, NativeStreamTransport } from './native-stream-owner';
|
|
3
|
+
import type { TCP } from './node-lib/binding/tcp_wrap';
|
|
4
|
+
import type { Pipe } from './node-lib/binding/pipe_wrap';
|
|
5
|
+
import { LibuvStreamWrap, type WriteWrap } from './node-lib/binding/stream_wrap';
|
|
6
|
+
type Stream = TCP | Pipe;
|
|
7
|
+
export declare function registerNativeStreamConstructor(kind: 'tcp' | 'pipe', constructor: new (type: number) => Stream): void;
|
|
8
|
+
/** Host bootstrap only, before any TCP/Pipe exists in this process realm. */
|
|
9
|
+
export declare function installNativeStreamTransport(next: NativeStreamTransport): void;
|
|
10
|
+
export declare function nativeStreamFor(handle: LibuvStreamWrap): NativeStreamDriver | undefined;
|
|
11
|
+
/** Inherited descriptors live with the owner, not in this realm's JS fd table. */
|
|
12
|
+
export declare function nativeInheritedFdType(fd: number): 'TCP' | 'PIPE' | undefined;
|
|
13
|
+
/** Trusted process admission uses this ID for explicit descriptor inheritance. */
|
|
14
|
+
export declare function nativeStreamDescriptor(handle: LibuvStreamWrap): NativeStreamDescriptor | undefined;
|
|
15
|
+
export declare function attachNativeStream(handle: Stream, kind: 'tcp' | 'pipe', type: number, closeLocal: (callback?: () => void) => void, flushLocal: () => void): void;
|
|
16
|
+
export declare class NativeStreamDriver {
|
|
17
|
+
private readonly handle;
|
|
18
|
+
readonly descriptor: NativeStreamDescriptor;
|
|
19
|
+
private readonly channel;
|
|
20
|
+
private readonly closeLocal;
|
|
21
|
+
private readonly flushLocal;
|
|
22
|
+
private readingCredit;
|
|
23
|
+
private buffered;
|
|
24
|
+
private readEnded;
|
|
25
|
+
private closing;
|
|
26
|
+
private readonly completions;
|
|
27
|
+
private readonly writes;
|
|
28
|
+
private readonly closeCallbacks;
|
|
29
|
+
private endpoint;
|
|
30
|
+
private pumping;
|
|
31
|
+
private releaseClose;
|
|
32
|
+
private writeEnded;
|
|
33
|
+
private pendingShutdown;
|
|
34
|
+
constructor(handle: Stream, descriptor: NativeStreamDescriptor, channel: NativeStreamTransport, closeLocal: (callback?: () => void) => void, flushLocal: () => void);
|
|
35
|
+
get peer(): LibuvStreamWrap | null;
|
|
36
|
+
pair(other: NativeStreamDriver): void;
|
|
37
|
+
call(operation: NativeStreamOperation): NativeStreamReply;
|
|
38
|
+
operation(operation: 'readStop' | 'ref' | 'unref'): number;
|
|
39
|
+
beginRead(): number;
|
|
40
|
+
readFlushed(empty: boolean, ended: boolean): void;
|
|
41
|
+
complete(operation: NativeStreamOperation, callback: (status: number) => void): number;
|
|
42
|
+
connect(address: string, port: number | undefined, ipv6: boolean, callback: (status: number) => void): number;
|
|
43
|
+
shutdown(callback: (status: number) => void): number;
|
|
44
|
+
duplicate(): Stream;
|
|
45
|
+
write(request: WriteWrap, parts: Uint8Array[], sent?: unknown): number;
|
|
46
|
+
private pumpWrites;
|
|
47
|
+
private flushShutdown;
|
|
48
|
+
private writeNext;
|
|
49
|
+
private finishWrite;
|
|
50
|
+
close(callback?: () => void, reset?: boolean): number;
|
|
51
|
+
private finishClose;
|
|
52
|
+
receive(event: Exclude<NativeStreamEvent, {
|
|
53
|
+
type: 'closed';
|
|
54
|
+
}>): void;
|
|
55
|
+
ownerStopped(): void;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/** Host-owned native handles. Node's JS socket and IPC libraries stay in the guest. */
|
|
2
|
+
import { type SockName } from './node-lib/binding/tcp_wrap';
|
|
3
|
+
export interface NativeStreamDescriptor {
|
|
4
|
+
id: number;
|
|
5
|
+
kind: 'tcp' | 'pipe';
|
|
6
|
+
type: number;
|
|
7
|
+
}
|
|
8
|
+
export interface NativeStreamLimits {
|
|
9
|
+
maxHandles: number;
|
|
10
|
+
maxReadChunkBytes: number;
|
|
11
|
+
maxQueuedBytes: number;
|
|
12
|
+
/** Per connection, like maxQueuedBytes; includes unread IPC descriptor copies. */
|
|
13
|
+
maxQueuedHandles: number;
|
|
14
|
+
maxPendingWriteBytes: number;
|
|
15
|
+
}
|
|
16
|
+
export type NativeStreamEvent = {
|
|
17
|
+
type: 'closed';
|
|
18
|
+
} | {
|
|
19
|
+
type: 'read';
|
|
20
|
+
id: number;
|
|
21
|
+
status: number;
|
|
22
|
+
bytes?: Uint8Array;
|
|
23
|
+
handle?: NativeStreamDescriptor;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'connection';
|
|
26
|
+
id: number;
|
|
27
|
+
status: number;
|
|
28
|
+
handle?: NativeStreamDescriptor;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'connect' | 'shutdown' | 'close';
|
|
31
|
+
id: number;
|
|
32
|
+
request: number;
|
|
33
|
+
status: number;
|
|
34
|
+
};
|
|
35
|
+
export type NativeStreamOperation = {
|
|
36
|
+
operation: 'create';
|
|
37
|
+
kind: 'tcp' | 'pipe';
|
|
38
|
+
type: number;
|
|
39
|
+
} | {
|
|
40
|
+
operation: 'fdType';
|
|
41
|
+
fd: number;
|
|
42
|
+
} | {
|
|
43
|
+
operation: 'pair';
|
|
44
|
+
id: number;
|
|
45
|
+
peer: number;
|
|
46
|
+
} | {
|
|
47
|
+
operation: 'duplicate';
|
|
48
|
+
id: number;
|
|
49
|
+
} | {
|
|
50
|
+
operation: 'bind';
|
|
51
|
+
id: number;
|
|
52
|
+
address: string;
|
|
53
|
+
port?: number;
|
|
54
|
+
ipv6?: boolean;
|
|
55
|
+
flags?: number;
|
|
56
|
+
} | {
|
|
57
|
+
operation: 'listen';
|
|
58
|
+
id: number;
|
|
59
|
+
backlog: number;
|
|
60
|
+
} | {
|
|
61
|
+
operation: 'connect';
|
|
62
|
+
id: number;
|
|
63
|
+
request: number;
|
|
64
|
+
address: string;
|
|
65
|
+
port?: number;
|
|
66
|
+
ipv6?: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
operation: 'open';
|
|
69
|
+
id: number;
|
|
70
|
+
fd: number;
|
|
71
|
+
} | {
|
|
72
|
+
operation: 'readStart' | 'readStop' | 'ref' | 'unref' | 'getsockname' | 'getpeername';
|
|
73
|
+
id: number;
|
|
74
|
+
} | {
|
|
75
|
+
operation: 'shutdown' | 'close' | 'reset';
|
|
76
|
+
id: number;
|
|
77
|
+
request: number;
|
|
78
|
+
};
|
|
79
|
+
export interface NativeStreamReply {
|
|
80
|
+
status: number;
|
|
81
|
+
handle?: NativeStreamDescriptor;
|
|
82
|
+
handleType?: 'TCP' | 'PIPE';
|
|
83
|
+
address?: Partial<SockName>;
|
|
84
|
+
}
|
|
85
|
+
export interface NativeStreamTransport {
|
|
86
|
+
readonly limits: Readonly<NativeStreamLimits>;
|
|
87
|
+
call(operation: NativeStreamOperation): NativeStreamReply;
|
|
88
|
+
write(id: number, bytes: Uint8Array, handle?: number): Promise<number>;
|
|
89
|
+
onEvent(listener: (event: NativeStreamEvent) => void): () => void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* One capability namespace per worker. Only the trusted host can inherit a
|
|
93
|
+
* descriptor from another scope; wire operations can name this scope's IDs only.
|
|
94
|
+
*/
|
|
95
|
+
export declare class NativeStreamScope {
|
|
96
|
+
private readonly emit;
|
|
97
|
+
private readonly entries;
|
|
98
|
+
private readonly descriptors;
|
|
99
|
+
private readonly writes;
|
|
100
|
+
private readonly connects;
|
|
101
|
+
private nextId;
|
|
102
|
+
private pendingWriteBytes;
|
|
103
|
+
private disposed;
|
|
104
|
+
private readonly limits;
|
|
105
|
+
constructor(limits: NativeStreamLimits, emit: (event: NativeStreamEvent) => void);
|
|
106
|
+
private entry;
|
|
107
|
+
private publish;
|
|
108
|
+
private claim;
|
|
109
|
+
/** Synchronous operations return libuv status; completions use the event door. */
|
|
110
|
+
call(operation: NativeStreamOperation): NativeStreamReply;
|
|
111
|
+
/**
|
|
112
|
+
* Transport chunks are bounded and serialized per handle. Waiting for native
|
|
113
|
+
* receive capacity retains at most one chunk per writer, within the scope's
|
|
114
|
+
* explicit aggregate ceiling. No polling or copying a whole guest write.
|
|
115
|
+
*/
|
|
116
|
+
write(id: number, bytes: Uint8Array, sentId?: number): Promise<number>;
|
|
117
|
+
/** Trusted parent-to-child inheritance; this is deliberately absent from call(). */
|
|
118
|
+
inherit(fd: number, source: NativeStreamScope, id: number): NativeStreamReply;
|
|
119
|
+
private close;
|
|
120
|
+
dispose(): void;
|
|
121
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** A Node Duplex as a libuv stream handle. Node still owns both socket APIs. */
|
|
2
|
+
import { LibuvStreamWrap, type WriteWrap, type ShutdownWrap } from './stream_wrap';
|
|
3
|
+
interface DuplexTransport {
|
|
4
|
+
write(chunk: Uint8Array, callback: (error?: Error | null) => void): boolean;
|
|
5
|
+
end(callback: () => void): void;
|
|
6
|
+
pause(): void;
|
|
7
|
+
resume(): void;
|
|
8
|
+
destroy(): void;
|
|
9
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
10
|
+
}
|
|
11
|
+
/** No listener or network address is allocated for this internal connection. */
|
|
12
|
+
export declare class DuplexStreamHandle extends LibuvStreamWrap {
|
|
13
|
+
private readonly transport;
|
|
14
|
+
private pendingWrite?;
|
|
15
|
+
constructor(transport: DuplexTransport);
|
|
16
|
+
readStop(): number;
|
|
17
|
+
protected flushInbound(): void;
|
|
18
|
+
protected dispatchWrite(req: WriteWrap, buffer: Uint8Array): number;
|
|
19
|
+
shutdown(req: ShutdownWrap): number;
|
|
20
|
+
protected onCloseHandle(): void;
|
|
21
|
+
getsockname(): number;
|
|
22
|
+
getpeername(): number;
|
|
23
|
+
setNoDelay(): number;
|
|
24
|
+
setKeepAlive(): number;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -15,10 +15,18 @@
|
|
|
15
15
|
import type { ProcessToken } from '../../process-tokens';
|
|
16
16
|
/** What libuv answers for a descriptor. */
|
|
17
17
|
export type HandleType = 'TCP' | 'TTY' | 'UDP' | 'FILE' | 'PIPE' | 'UNKNOWN';
|
|
18
|
+
/** Files and streams occupy one descriptor namespace, as on the OS. */
|
|
19
|
+
export declare function allocateFd(): number;
|
|
18
20
|
/** Record a descriptor a run is started with, under that run's name. */
|
|
19
21
|
export declare function registerRunFd(token: ProcessToken, fd: number, type: HandleType, handle: unknown): void;
|
|
20
22
|
/** A run that has ended was started with nothing. */
|
|
21
23
|
export declare function releaseRunFds(token: ProcessToken): void;
|
|
24
|
+
/** Trusted process admission reads copies of this run's descriptor entries. */
|
|
25
|
+
export declare function inheritedRunFds(token: ProcessToken): Array<{
|
|
26
|
+
fd: number;
|
|
27
|
+
type: HandleType;
|
|
28
|
+
handle: unknown;
|
|
29
|
+
}>;
|
|
22
30
|
/** Record a handle under a descriptor of the engine's own, and answer the number. */
|
|
23
31
|
export declare function registerFd(type: HandleType, handle: unknown): number;
|
|
24
32
|
/** The handle a descriptor names, for `Pipe.open(fd)` and `TCP.open(fd)`. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { VirtualFS } from '../../virtual-fs';
|
|
2
|
+
import { Buffer as NodeBuffer } from '../buffer-module';
|
|
2
3
|
/** The key the engine hangs a run's filesystem off its guest process. */
|
|
3
4
|
export declare const kRunFilesystem: unique symbol;
|
|
4
5
|
export declare function withFilesystem<T>(tree: VirtualFS, work: () => T): T;
|
|
@@ -7,89 +8,236 @@ interface FSReq {
|
|
|
7
8
|
oncomplete?: (error: Error | null, ...rest: unknown[]) => void;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* the
|
|
13
|
-
*
|
|
11
|
+
* A name the binding answers, in the encoding Node handed. `fs.rm` recursive
|
|
12
|
+
* (rimraf) readdir's with encoding `buffer` and `Buffer.concat`s each child
|
|
13
|
+
* onto the path; a string child threw `list[1]`/`list[2]` must be a Buffer,
|
|
14
|
+
* received `'exthost1'`.
|
|
14
15
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
16
|
+
export declare function createFsBindings(Bytes?: () => typeof NodeBuffer): {
|
|
17
|
+
fsBinding: {
|
|
18
|
+
FSReqCallback: {
|
|
19
|
+
new (bigint?: boolean): {
|
|
20
|
+
oncomplete: ((error: Error | null, ...rest: unknown[]) => void) | undefined;
|
|
21
|
+
context: unknown;
|
|
22
|
+
bigint: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
kUsePromises: symbol;
|
|
26
|
+
StatWatcher: {
|
|
27
|
+
new (bigint?: boolean): {
|
|
28
|
+
onchange: ((current: Float64Array | BigInt64Array, previous: Float64Array | BigInt64Array) => void) | null;
|
|
29
|
+
"__#private@#timer": ReturnType<typeof setInterval> | null;
|
|
30
|
+
"__#private@#previous": Float64Array | BigInt64Array | null;
|
|
31
|
+
bigint: boolean;
|
|
32
|
+
start(path: unknown, interval?: number): number;
|
|
33
|
+
stop(): void;
|
|
34
|
+
close(): void;
|
|
35
|
+
ref(): void;
|
|
36
|
+
unref(): void;
|
|
37
|
+
getAsyncId(): number;
|
|
38
|
+
hasRef(): boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** `fs.promises.open`: the same open, answered as a promise with a handle. */
|
|
42
|
+
openFileHandle(path: unknown, flags: number, mode: number, usePromises?: unknown): Promise<{
|
|
43
|
+
fd: number;
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
release(): void;
|
|
46
|
+
getAsyncId(): number;
|
|
47
|
+
}> | {
|
|
48
|
+
fd: number;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
release(): void;
|
|
51
|
+
getAsyncId(): number;
|
|
52
|
+
};
|
|
53
|
+
open(path: unknown, flags: number, _mode: number, req?: FSReq): number | undefined;
|
|
54
|
+
close(fd: number, req?: FSReq): undefined;
|
|
55
|
+
read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number, req?: FSReq): number | undefined;
|
|
56
|
+
readBuffers(fd: number, buffers: Uint8Array[], position: number, req?: FSReq): number | undefined;
|
|
57
|
+
/** Node's fast path for `readFile` with an encoding it can decode itself. */
|
|
58
|
+
readFileUtf8(path: unknown, flags: number): string;
|
|
59
|
+
writeBuffer(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null, req?: FSReq): number | undefined;
|
|
60
|
+
writeBuffers(fd: number, buffers: Uint8Array[], position: number | null, req?: FSReq): number | undefined;
|
|
61
|
+
writeString(fd: number, value: string, position: number | null, encoding: string | undefined, req?: FSReq): number | undefined;
|
|
62
|
+
writeFileUtf8(path: unknown, data: string, flags: number, mode: number): undefined;
|
|
63
|
+
stat(path: unknown, bigint: boolean, req?: FSReq, throwIfNoEntry?: boolean): Float64Array | BigInt64Array | undefined;
|
|
64
|
+
lstat(path: unknown, bigint: boolean, req?: FSReq, throwIfNoEntry?: boolean): Float64Array | BigInt64Array | undefined;
|
|
65
|
+
fstat(fd: number, bigint: boolean, req?: FSReq): Float64Array | BigInt64Array | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* `statfs`: a tab's filesystem is the page's memory, and it has no device
|
|
68
|
+
* of its own. The numbers are a filesystem's shape rather than a lie about
|
|
69
|
+
* a disk: a block size, and a count no program can exhaust.
|
|
70
|
+
*/
|
|
71
|
+
statfs(_path: unknown, bigint: boolean, req?: FSReq): Float64Array | BigInt64Array | undefined;
|
|
72
|
+
access(path: unknown, mode: number, req?: FSReq): undefined;
|
|
73
|
+
existsSync(path: unknown): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Node's `cpSync` asks this before it copies: a directory is not a file,
|
|
76
|
+
* and without `recursive` the copy of one is `ERR_FS_EISDIR`.
|
|
77
|
+
*/
|
|
78
|
+
cpSyncCheckPaths(src: unknown, dest: unknown, dereference: boolean, recursive: boolean): undefined;
|
|
79
|
+
/** Node's C++ `cp` of a file onto an existing dest. */
|
|
80
|
+
cpSyncOverrideFile(src: unknown, dest: unknown, _mode: number, _preserveTimestamps: boolean): undefined;
|
|
81
|
+
/** Node's C++ recursive directory copy, without a JS filter. */
|
|
82
|
+
cpSyncCopyDir(src: unknown, dest: unknown, force: boolean, dereference: boolean, errorOnExist: boolean, _verbatimSymlinks: boolean, _preserveTimestamps: boolean): undefined;
|
|
83
|
+
/**
|
|
84
|
+
* What the module loader asks of a path before it reads it: 0 for a file,
|
|
85
|
+
* 1 for a directory, and a negative errno for neither.
|
|
86
|
+
*
|
|
87
|
+
* Node has called this with a receiver in front of the path and without
|
|
88
|
+
* one across versions; the three vendored call sites here -- `fs.js`'s
|
|
89
|
+
* `glob` twice and `internal/fs/promises.js`'s once -- pass the path alone,
|
|
90
|
+
* so the path is whichever argument is one.
|
|
91
|
+
*/
|
|
92
|
+
internalModuleStat(receiver: unknown, path?: unknown): number;
|
|
93
|
+
readdir(path: unknown, encoding: string, withFileTypes: boolean, req?: FSReq): unknown;
|
|
94
|
+
mkdir(path: unknown, mode: number, recursive: boolean, req?: FSReq): string | undefined;
|
|
95
|
+
rmdir(path: unknown, req?: FSReq): undefined;
|
|
96
|
+
unlink(path: unknown, req?: FSReq): undefined;
|
|
97
|
+
rename(from: unknown, to: unknown, req?: FSReq): undefined;
|
|
98
|
+
copyFile(from: unknown, to: unknown, mode: number, req?: FSReq): undefined;
|
|
99
|
+
link(from: unknown, to: unknown, req?: FSReq): undefined;
|
|
100
|
+
symlink(target: unknown, path: unknown, _type: unknown, req?: FSReq): undefined;
|
|
101
|
+
readlink(path: unknown, encoding: string, req?: FSReq): string | Uint8Array | undefined;
|
|
102
|
+
realpath(path: unknown, encoding: string, req?: FSReq): string | Uint8Array | undefined;
|
|
103
|
+
mkdtemp(prefix: unknown, encoding: string, req?: FSReq): string | Uint8Array | undefined;
|
|
104
|
+
chmod(path: unknown, mode: number, req?: FSReq): undefined;
|
|
105
|
+
fchmod(fd: number, mode: number, req?: FSReq): undefined;
|
|
106
|
+
chown(_path: unknown, _uid: number, _gid: number, req?: FSReq): undefined;
|
|
107
|
+
fchown(_fd: number, _uid: number, _gid: number, req?: FSReq): undefined;
|
|
108
|
+
lchown(_path: unknown, _uid: number, _gid: number, req?: FSReq): undefined;
|
|
109
|
+
utimes(path: unknown, atime: number, mtime: number, req?: FSReq): undefined;
|
|
110
|
+
futimes(fd: number, atime: number, mtime: number, req?: FSReq): undefined;
|
|
111
|
+
lutimes(path: unknown, atime: number, mtime: number, req?: FSReq): undefined;
|
|
112
|
+
fsync(_fd: number, req?: FSReq): undefined;
|
|
113
|
+
fdatasync(_fd: number, req?: FSReq): undefined;
|
|
114
|
+
ftruncate(fd: number, length: number, req?: FSReq): undefined;
|
|
115
|
+
};
|
|
116
|
+
fsDirBinding: {
|
|
117
|
+
opendirSync(path: unknown, encoding?: unknown): {
|
|
118
|
+
"__#private@#entries": Array<[string, number]>;
|
|
119
|
+
"__#private@#at": number;
|
|
120
|
+
"__#private@#encoding": unknown;
|
|
121
|
+
read(encoding?: string, bufferSize?: number, req?: FSReq): unknown;
|
|
122
|
+
close(req?: FSReq): undefined;
|
|
123
|
+
};
|
|
124
|
+
opendir(path: unknown, encoding: string, req?: FSReq): {
|
|
125
|
+
"__#private@#entries": Array<[string, number]>;
|
|
126
|
+
"__#private@#at": number;
|
|
127
|
+
"__#private@#encoding": unknown;
|
|
128
|
+
read(encoding?: string, bufferSize?: number, req?: FSReq): unknown;
|
|
129
|
+
close(req?: FSReq): undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
};
|
|
132
|
+
fsEventWrapBinding: {
|
|
133
|
+
FSEvent: {
|
|
134
|
+
new (): {
|
|
135
|
+
onchange: ((status: number, event: string, filename: string | Uint8Array) => void) | null;
|
|
136
|
+
"__#private@#watcher": {
|
|
137
|
+
close(): void;
|
|
138
|
+
} | null;
|
|
139
|
+
initialized: boolean;
|
|
140
|
+
start(path: unknown, persistent?: boolean, recursive?: boolean, encoding?: string): number;
|
|
141
|
+
close(): void;
|
|
142
|
+
ref(): void;
|
|
143
|
+
unref(): void;
|
|
144
|
+
getAsyncId(): number;
|
|
145
|
+
hasRef(): boolean;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
FSReqCallback: {
|
|
150
|
+
new (bigint?: boolean): {
|
|
151
|
+
oncomplete: ((error: Error | null, ...rest: unknown[]) => void) | undefined;
|
|
152
|
+
context: unknown;
|
|
153
|
+
bigint: boolean;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
DirHandle: {
|
|
157
|
+
new (path: string, encoding?: unknown): {
|
|
158
|
+
"__#private@#entries": Array<[string, number]>;
|
|
159
|
+
"__#private@#at": number;
|
|
160
|
+
"__#private@#encoding": unknown;
|
|
161
|
+
read(encoding?: string, bufferSize?: number, req?: FSReq): unknown;
|
|
162
|
+
close(req?: FSReq): undefined;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
FSEvent: {
|
|
166
|
+
new (): {
|
|
167
|
+
onchange: ((status: number, event: string, filename: string | Uint8Array) => void) | null;
|
|
168
|
+
"__#private@#watcher": {
|
|
169
|
+
close(): void;
|
|
170
|
+
} | null;
|
|
171
|
+
initialized: boolean;
|
|
172
|
+
start(path: unknown, persistent?: boolean, recursive?: boolean, encoding?: string): number;
|
|
173
|
+
close(): void;
|
|
174
|
+
ref(): void;
|
|
175
|
+
unref(): void;
|
|
176
|
+
getAsyncId(): number;
|
|
177
|
+
hasRef(): boolean;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
StatWatcher: {
|
|
181
|
+
new (bigint?: boolean): {
|
|
182
|
+
onchange: ((current: Float64Array | BigInt64Array, previous: Float64Array | BigInt64Array) => void) | null;
|
|
183
|
+
"__#private@#timer": ReturnType<typeof setInterval> | null;
|
|
184
|
+
"__#private@#previous": Float64Array | BigInt64Array | null;
|
|
185
|
+
bigint: boolean;
|
|
186
|
+
start(path: unknown, interval?: number): number;
|
|
187
|
+
stop(): void;
|
|
188
|
+
close(): void;
|
|
189
|
+
ref(): void;
|
|
190
|
+
unref(): void;
|
|
191
|
+
getAsyncId(): number;
|
|
192
|
+
hasRef(): boolean;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
FileHandle: {
|
|
196
|
+
new (fd: number): {
|
|
197
|
+
fd: number;
|
|
198
|
+
close(): Promise<void>;
|
|
199
|
+
release(): void;
|
|
200
|
+
getAsyncId(): number;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
74
203
|
};
|
|
75
|
-
|
|
76
|
-
* What `fs.promises.open` is handed: a descriptor with a close of its own.
|
|
77
|
-
* Node's is a C++ handle whose destructor closes the file; here it is the
|
|
78
|
-
* same number this file's table keeps, with the same close.
|
|
79
|
-
*/
|
|
80
|
-
export declare class FileHandle {
|
|
81
|
-
fd: number;
|
|
82
|
-
constructor(fd: number);
|
|
83
|
-
close(): Promise<void>;
|
|
84
|
-
release(): void;
|
|
85
|
-
getAsyncId(): number;
|
|
86
|
-
}
|
|
204
|
+
export declare const kUsePromises: unique symbol;
|
|
87
205
|
export declare const fsBinding: {
|
|
88
|
-
FSReqCallback:
|
|
206
|
+
FSReqCallback: {
|
|
207
|
+
new (bigint?: boolean): {
|
|
208
|
+
oncomplete: ((error: Error | null, ...rest: unknown[]) => void) | undefined;
|
|
209
|
+
context: unknown;
|
|
210
|
+
bigint: boolean;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
89
213
|
kUsePromises: symbol;
|
|
90
|
-
StatWatcher:
|
|
214
|
+
StatWatcher: {
|
|
215
|
+
new (bigint?: boolean): {
|
|
216
|
+
onchange: ((current: Float64Array | BigInt64Array, previous: Float64Array | BigInt64Array) => void) | null;
|
|
217
|
+
"__#private@#timer": ReturnType<typeof setInterval> | null;
|
|
218
|
+
"__#private@#previous": Float64Array | BigInt64Array | null;
|
|
219
|
+
bigint: boolean;
|
|
220
|
+
start(path: unknown, interval?: number): number;
|
|
221
|
+
stop(): void;
|
|
222
|
+
close(): void;
|
|
223
|
+
ref(): void;
|
|
224
|
+
unref(): void;
|
|
225
|
+
getAsyncId(): number;
|
|
226
|
+
hasRef(): boolean;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
91
229
|
/** `fs.promises.open`: the same open, answered as a promise with a handle. */
|
|
92
|
-
openFileHandle(path: unknown, flags: number, mode: number, usePromises?: unknown): Promise<
|
|
230
|
+
openFileHandle(path: unknown, flags: number, mode: number, usePromises?: unknown): Promise<{
|
|
231
|
+
fd: number;
|
|
232
|
+
close(): Promise<void>;
|
|
233
|
+
release(): void;
|
|
234
|
+
getAsyncId(): number;
|
|
235
|
+
}> | {
|
|
236
|
+
fd: number;
|
|
237
|
+
close(): Promise<void>;
|
|
238
|
+
release(): void;
|
|
239
|
+
getAsyncId(): number;
|
|
240
|
+
};
|
|
93
241
|
open(path: unknown, flags: number, _mode: number, req?: FSReq): number | undefined;
|
|
94
242
|
close(fd: number, req?: FSReq): undefined;
|
|
95
243
|
read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number, req?: FSReq): number | undefined;
|
|
@@ -152,5 +300,90 @@ export declare const fsBinding: {
|
|
|
152
300
|
fsync(_fd: number, req?: FSReq): undefined;
|
|
153
301
|
fdatasync(_fd: number, req?: FSReq): undefined;
|
|
154
302
|
ftruncate(fd: number, length: number, req?: FSReq): undefined;
|
|
303
|
+
}, fsDirBinding: {
|
|
304
|
+
opendirSync(path: unknown, encoding?: unknown): {
|
|
305
|
+
"__#private@#entries": Array<[string, number]>;
|
|
306
|
+
"__#private@#at": number;
|
|
307
|
+
"__#private@#encoding": unknown;
|
|
308
|
+
read(encoding?: string, bufferSize?: number, req?: FSReq): unknown;
|
|
309
|
+
close(req?: FSReq): undefined;
|
|
310
|
+
};
|
|
311
|
+
opendir(path: unknown, encoding: string, req?: FSReq): {
|
|
312
|
+
"__#private@#entries": Array<[string, number]>;
|
|
313
|
+
"__#private@#at": number;
|
|
314
|
+
"__#private@#encoding": unknown;
|
|
315
|
+
read(encoding?: string, bufferSize?: number, req?: FSReq): unknown;
|
|
316
|
+
close(req?: FSReq): undefined;
|
|
317
|
+
} | undefined;
|
|
318
|
+
}, fsEventWrapBinding: {
|
|
319
|
+
FSEvent: {
|
|
320
|
+
new (): {
|
|
321
|
+
onchange: ((status: number, event: string, filename: string | Uint8Array) => void) | null;
|
|
322
|
+
"__#private@#watcher": {
|
|
323
|
+
close(): void;
|
|
324
|
+
} | null;
|
|
325
|
+
initialized: boolean;
|
|
326
|
+
start(path: unknown, persistent?: boolean, recursive?: boolean, encoding?: string): number;
|
|
327
|
+
close(): void;
|
|
328
|
+
ref(): void;
|
|
329
|
+
unref(): void;
|
|
330
|
+
getAsyncId(): number;
|
|
331
|
+
hasRef(): boolean;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
}, FSReqCallback: {
|
|
335
|
+
new (bigint?: boolean): {
|
|
336
|
+
oncomplete: ((error: Error | null, ...rest: unknown[]) => void) | undefined;
|
|
337
|
+
context: unknown;
|
|
338
|
+
bigint: boolean;
|
|
339
|
+
};
|
|
340
|
+
}, DirHandle: {
|
|
341
|
+
new (path: string, encoding?: unknown): {
|
|
342
|
+
"__#private@#entries": Array<[string, number]>;
|
|
343
|
+
"__#private@#at": number;
|
|
344
|
+
"__#private@#encoding": unknown;
|
|
345
|
+
read(encoding?: string, bufferSize?: number, req?: FSReq): unknown;
|
|
346
|
+
close(req?: FSReq): undefined;
|
|
347
|
+
};
|
|
348
|
+
}, FSEvent: {
|
|
349
|
+
new (): {
|
|
350
|
+
onchange: ((status: number, event: string, filename: string | Uint8Array) => void) | null;
|
|
351
|
+
"__#private@#watcher": {
|
|
352
|
+
close(): void;
|
|
353
|
+
} | null;
|
|
354
|
+
initialized: boolean;
|
|
355
|
+
start(path: unknown, persistent?: boolean, recursive?: boolean, encoding?: string): number;
|
|
356
|
+
close(): void;
|
|
357
|
+
ref(): void;
|
|
358
|
+
unref(): void;
|
|
359
|
+
getAsyncId(): number;
|
|
360
|
+
hasRef(): boolean;
|
|
361
|
+
};
|
|
362
|
+
}, StatWatcher: {
|
|
363
|
+
new (bigint?: boolean): {
|
|
364
|
+
onchange: ((current: Float64Array | BigInt64Array, previous: Float64Array | BigInt64Array) => void) | null;
|
|
365
|
+
"__#private@#timer": ReturnType<typeof setInterval> | null;
|
|
366
|
+
"__#private@#previous": Float64Array | BigInt64Array | null;
|
|
367
|
+
bigint: boolean;
|
|
368
|
+
start(path: unknown, interval?: number): number;
|
|
369
|
+
stop(): void;
|
|
370
|
+
close(): void;
|
|
371
|
+
ref(): void;
|
|
372
|
+
unref(): void;
|
|
373
|
+
getAsyncId(): number;
|
|
374
|
+
hasRef(): boolean;
|
|
375
|
+
};
|
|
376
|
+
}, FileHandle: {
|
|
377
|
+
new (fd: number): {
|
|
378
|
+
fd: number;
|
|
379
|
+
close(): Promise<void>;
|
|
380
|
+
release(): void;
|
|
381
|
+
getAsyncId(): number;
|
|
382
|
+
};
|
|
155
383
|
};
|
|
384
|
+
export type FSReqCallback = InstanceType<typeof FSReqCallback>;
|
|
385
|
+
export type DirHandle = InstanceType<typeof DirHandle>;
|
|
386
|
+
export type FSEvent = InstanceType<typeof FSEvent>;
|
|
387
|
+
export type StatWatcher = InstanceType<typeof StatWatcher>;
|
|
388
|
+
export type FileHandle = InstanceType<typeof FileHandle>;
|
|
156
389
|
export default fsBinding;
|
|
@@ -58,6 +58,7 @@ export declare const encodingBinding: {
|
|
|
58
58
|
* Node without ICU does, and is the one thing `buffer.js` loses here.
|
|
59
59
|
*/
|
|
60
60
|
export declare const configBinding: {
|
|
61
|
+
getDefaultLocale: () => string;
|
|
61
62
|
hasIntl: boolean;
|
|
62
63
|
hasSmallICU: boolean;
|
|
63
64
|
hasNodeOptions: boolean;
|
|
@@ -60,13 +60,13 @@ export declare class Pipe extends LibuvStreamWrap {
|
|
|
60
60
|
*
|
|
61
61
|
* The handle becomes the receiving run's. Node's `send(message, socket)`
|
|
62
62
|
* duplicates the sender's descriptor into the other process, and from then
|
|
63
|
-
* on the socket is an active handle of that process's loop
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* on the socket is an active handle of that process's loop. The binding
|
|
64
|
+
* duplicates the wrapper and assigns that reference to the receiver.
|
|
65
|
+
* Without that ownership, openvscode-server's extension
|
|
66
66
|
* host -- a program whose only handle is the socket its parent sent it --
|
|
67
67
|
* read as idle and was settled with exit 0.
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
protected dispatchWrite(req: WriteWrap, bytes: Uint8Array, handle?: unknown): number;
|
|
70
70
|
protected onCloseHandle(): void;
|
|
71
71
|
}
|
|
72
72
|
declare const _default: {
|