@scelar/nodepod 1.0.1 → 1.0.2
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/__tests__/smoke.test.d.ts +1 -0
- package/dist/constants/cdn-urls.d.ts +12 -0
- package/dist/constants/config.d.ts +121 -0
- package/dist/cross-origin.d.ts +5 -0
- package/dist/engine-factory.d.ts +24 -0
- package/dist/engine-types.d.ts +40 -0
- package/dist/helpers/byte-encoding.d.ts +4 -0
- package/dist/helpers/digest.d.ts +1 -0
- package/dist/helpers/event-loop.d.ts +12 -0
- package/dist/helpers/wasm-cache.d.ts +6 -0
- package/dist/iframe-sandbox.d.ts +25 -0
- package/dist/index.d.ts +86 -0
- package/dist/isolation-helpers.d.ts +13 -0
- package/dist/memory-volume.d.ts +147 -0
- package/dist/module-transformer.d.ts +6 -0
- package/dist/packages/archive-extractor.d.ts +28 -0
- package/dist/packages/browser-bundler.d.ts +14 -0
- package/dist/packages/installer.d.ts +41 -0
- package/dist/packages/registry-client.d.ts +46 -0
- package/dist/packages/version-resolver.d.ts +37 -0
- package/dist/polyfills/assert.d.ts +54 -0
- package/dist/polyfills/async_hooks.d.ts +46 -0
- package/dist/polyfills/buffer.d.ts +111 -0
- package/dist/polyfills/child_process.d.ts +141 -0
- package/dist/polyfills/chokidar.d.ts +63 -0
- package/dist/polyfills/cluster.d.ts +55 -0
- package/dist/polyfills/console.d.ts +72 -0
- package/dist/polyfills/constants.d.ts +207 -0
- package/dist/polyfills/crypto.d.ts +189 -0
- package/dist/polyfills/dgram.d.ts +37 -0
- package/dist/polyfills/diagnostics_channel.d.ts +27 -0
- package/dist/polyfills/dns.d.ts +76 -0
- package/dist/polyfills/domain.d.ts +27 -0
- package/dist/polyfills/esbuild.d.ts +106 -0
- package/dist/polyfills/events.d.ts +39 -0
- package/dist/polyfills/fs.d.ts +274 -0
- package/dist/polyfills/fsevents.d.ts +62 -0
- package/dist/polyfills/http.d.ts +215 -0
- package/dist/polyfills/http2.d.ts +119 -0
- package/dist/polyfills/https.d.ts +24 -0
- package/dist/polyfills/inspector.d.ts +29 -0
- package/dist/polyfills/lightningcss.d.ts +70 -0
- package/dist/polyfills/module.d.ts +35 -0
- package/dist/polyfills/net.d.ts +91 -0
- package/dist/polyfills/os.d.ts +240 -0
- package/dist/polyfills/path.d.ts +95 -0
- package/dist/polyfills/perf_hooks.d.ts +48 -0
- package/dist/polyfills/process.d.ts +190 -0
- package/dist/polyfills/punycode.d.ts +21 -0
- package/dist/polyfills/querystring.d.ts +18 -0
- package/dist/polyfills/quic.d.ts +42 -0
- package/dist/polyfills/readdirp.d.ts +48 -0
- package/dist/polyfills/readline.d.ts +87 -0
- package/dist/polyfills/repl.d.ts +45 -0
- package/dist/polyfills/rollup.d.ts +37 -0
- package/dist/polyfills/sea.d.ts +11 -0
- package/dist/polyfills/sqlite.d.ts +30 -0
- package/dist/polyfills/stream.d.ts +160 -0
- package/dist/polyfills/string_decoder.d.ts +16 -0
- package/dist/polyfills/tailwindcss-oxide.d.ts +42 -0
- package/dist/polyfills/test.d.ts +60 -0
- package/dist/polyfills/timers.d.ts +23 -0
- package/dist/polyfills/tls.d.ts +61 -0
- package/dist/polyfills/trace_events.d.ts +22 -0
- package/dist/polyfills/tty.d.ts +38 -0
- package/dist/polyfills/url.d.ts +55 -0
- package/dist/polyfills/util.d.ts +135 -0
- package/dist/polyfills/v8.d.ts +97 -0
- package/dist/polyfills/vm.d.ts +66 -0
- package/dist/polyfills/volume-registry.d.ts +3 -0
- package/dist/polyfills/wasi.d.ts +16 -0
- package/dist/polyfills/worker_threads.d.ts +111 -0
- package/dist/polyfills/ws.d.ts +92 -0
- package/dist/polyfills/zlib.d.ts +278 -0
- package/dist/request-proxy.d.ts +63 -0
- package/dist/script-engine.d.ts +79 -0
- package/dist/sdk/nodepod-fs.d.ts +27 -0
- package/dist/sdk/nodepod-process.d.ts +28 -0
- package/dist/sdk/nodepod-terminal.d.ts +48 -0
- package/dist/sdk/nodepod.d.ts +39 -0
- package/dist/sdk/types.d.ts +53 -0
- package/dist/shell/commands/bun.d.ts +4 -0
- package/dist/shell/commands/directory.d.ts +2 -0
- package/dist/shell/commands/file-ops.d.ts +2 -0
- package/dist/shell/commands/git.d.ts +2 -0
- package/dist/shell/commands/node.d.ts +4 -0
- package/dist/shell/commands/npm.d.ts +3 -0
- package/dist/shell/commands/pm-types.d.ts +25 -0
- package/dist/shell/commands/pnpm.d.ts +3 -0
- package/dist/shell/commands/search.d.ts +2 -0
- package/dist/shell/commands/shell-env.d.ts +3 -0
- package/dist/shell/commands/text-processing.d.ts +2 -0
- package/dist/shell/commands/yarn.d.ts +3 -0
- package/dist/shell/shell-builtins.d.ts +2 -0
- package/dist/shell/shell-helpers.d.ts +28 -0
- package/dist/shell/shell-interpreter.d.ts +48 -0
- package/dist/shell/shell-parser.d.ts +6 -0
- package/dist/shell/shell-types.d.ts +48 -0
- package/dist/syntax-transforms.d.ts +3 -0
- package/dist/threading/engine-worker.d.ts +1 -0
- package/dist/threading/inline-worker.d.ts +2 -0
- package/dist/threading/offload-types.d.ts +87 -0
- package/dist/threading/offload-worker.d.ts +1 -0
- package/dist/threading/offload.d.ts +16 -0
- package/dist/threading/process-context.d.ts +40 -0
- package/dist/threading/process-handle.d.ts +42 -0
- package/dist/threading/process-manager.d.ts +52 -0
- package/dist/threading/process-worker-entry.d.ts +24 -0
- package/dist/threading/shared-vfs.d.ts +36 -0
- package/dist/threading/sync-channel.d.ts +21 -0
- package/dist/threading/task-queue.d.ts +15 -0
- package/dist/threading/vfs-bridge.d.ts +25 -0
- package/dist/threading/worker-pool.d.ts +38 -0
- package/dist/threading/worker-protocol.d.ts +264 -0
- package/dist/threading/worker-vfs.d.ts +34 -0
- package/dist/types/fs-streams.d.ts +122 -0
- package/dist/types/manifest.d.ts +17 -0
- package/dist/worker-sandbox.d.ts +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export declare function getHeapStatistics(): {
|
|
2
|
+
total_heap_size: number;
|
|
3
|
+
total_heap_size_executable: number;
|
|
4
|
+
total_physical_size: number;
|
|
5
|
+
total_available_size: number;
|
|
6
|
+
used_heap_size: number;
|
|
7
|
+
heap_size_limit: number;
|
|
8
|
+
malloced_memory: number;
|
|
9
|
+
peak_malloced_memory: number;
|
|
10
|
+
does_zap_garbage: number;
|
|
11
|
+
number_of_native_contexts: number;
|
|
12
|
+
number_of_detached_contexts: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function getHeapSpaceStatistics(): unknown[];
|
|
15
|
+
export declare function getHeapCodeStatistics(): {
|
|
16
|
+
code_and_metadata_size: number;
|
|
17
|
+
bytecode_and_metadata_size: number;
|
|
18
|
+
external_script_source_size: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function getHeapSnapshot(): null;
|
|
21
|
+
export declare function writeHeapSnapshot(): string;
|
|
22
|
+
export declare function setFlagsFromString(_flags: string): void;
|
|
23
|
+
export declare function takeCoverage(): void;
|
|
24
|
+
export declare function stopCoverage(): void;
|
|
25
|
+
export declare function cachedDataVersionTag(): number;
|
|
26
|
+
export declare function serialize(value: unknown): Uint8Array;
|
|
27
|
+
export declare function deserialize(bytes: Uint8Array): unknown;
|
|
28
|
+
export interface Serializer {
|
|
29
|
+
writeHeader(): void;
|
|
30
|
+
writeValue(_v: unknown): void;
|
|
31
|
+
releaseBuffer(): Uint8Array;
|
|
32
|
+
}
|
|
33
|
+
export declare const Serializer: {
|
|
34
|
+
new (): Serializer;
|
|
35
|
+
prototype: any;
|
|
36
|
+
};
|
|
37
|
+
export interface Deserializer {
|
|
38
|
+
readHeader(): boolean;
|
|
39
|
+
readValue(): unknown;
|
|
40
|
+
}
|
|
41
|
+
export declare const Deserializer: {
|
|
42
|
+
new (_buf: Uint8Array): Deserializer;
|
|
43
|
+
prototype: any;
|
|
44
|
+
};
|
|
45
|
+
export interface DefaultSerializer extends Serializer {
|
|
46
|
+
}
|
|
47
|
+
export declare const DefaultSerializer: {
|
|
48
|
+
new (): DefaultSerializer;
|
|
49
|
+
prototype: any;
|
|
50
|
+
};
|
|
51
|
+
export interface DefaultDeserializer extends Deserializer {
|
|
52
|
+
}
|
|
53
|
+
export declare const DefaultDeserializer: {
|
|
54
|
+
new (_buf: Uint8Array): DefaultDeserializer;
|
|
55
|
+
prototype: any;
|
|
56
|
+
};
|
|
57
|
+
export declare function promiseHooks(): {
|
|
58
|
+
onInit: () => void;
|
|
59
|
+
onSettled: () => void;
|
|
60
|
+
onBefore: () => void;
|
|
61
|
+
onAfter: () => void;
|
|
62
|
+
createHook: () => {
|
|
63
|
+
enable: () => void;
|
|
64
|
+
disable: () => void;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare const _default: {
|
|
68
|
+
getHeapStatistics: typeof getHeapStatistics;
|
|
69
|
+
getHeapSpaceStatistics: typeof getHeapSpaceStatistics;
|
|
70
|
+
getHeapCodeStatistics: typeof getHeapCodeStatistics;
|
|
71
|
+
getHeapSnapshot: typeof getHeapSnapshot;
|
|
72
|
+
writeHeapSnapshot: typeof writeHeapSnapshot;
|
|
73
|
+
setFlagsFromString: typeof setFlagsFromString;
|
|
74
|
+
takeCoverage: typeof takeCoverage;
|
|
75
|
+
stopCoverage: typeof stopCoverage;
|
|
76
|
+
cachedDataVersionTag: typeof cachedDataVersionTag;
|
|
77
|
+
serialize: typeof serialize;
|
|
78
|
+
deserialize: typeof deserialize;
|
|
79
|
+
Serializer: {
|
|
80
|
+
new (): Serializer;
|
|
81
|
+
prototype: any;
|
|
82
|
+
};
|
|
83
|
+
Deserializer: {
|
|
84
|
+
new (_buf: Uint8Array): Deserializer;
|
|
85
|
+
prototype: any;
|
|
86
|
+
};
|
|
87
|
+
DefaultSerializer: {
|
|
88
|
+
new (): DefaultSerializer;
|
|
89
|
+
prototype: any;
|
|
90
|
+
};
|
|
91
|
+
DefaultDeserializer: {
|
|
92
|
+
new (_buf: Uint8Array): DefaultDeserializer;
|
|
93
|
+
prototype: any;
|
|
94
|
+
};
|
|
95
|
+
promiseHooks: typeof promiseHooks;
|
|
96
|
+
};
|
|
97
|
+
export default _default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface Script {
|
|
2
|
+
runInThisContext(_opts?: object): unknown;
|
|
3
|
+
runInNewContext(ctx?: object, _opts?: object): unknown;
|
|
4
|
+
runInContext(ctx: object, _opts?: object): unknown;
|
|
5
|
+
createCachedData(): Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export declare const Script: {
|
|
8
|
+
new (src: string, _opts?: object): Script;
|
|
9
|
+
prototype: any;
|
|
10
|
+
};
|
|
11
|
+
export declare function createContext(sandbox?: object, _opts?: object): object;
|
|
12
|
+
export declare function isContext(_box: object): boolean;
|
|
13
|
+
export declare function runInThisContext(code: string, _opts?: object): unknown;
|
|
14
|
+
export declare function runInNewContext(code: string, ctx?: object, _opts?: object): unknown;
|
|
15
|
+
export declare function runInContext(code: string, ctx: object, _opts?: object): unknown;
|
|
16
|
+
export declare function compileFunction(body: string, params?: string[], _opts?: object): Function;
|
|
17
|
+
export interface Module {
|
|
18
|
+
link(_linker: unknown): Promise<void>;
|
|
19
|
+
evaluate(_opts?: object): Promise<unknown>;
|
|
20
|
+
readonly status: string;
|
|
21
|
+
readonly identifier: string;
|
|
22
|
+
readonly context: object;
|
|
23
|
+
readonly namespace: object;
|
|
24
|
+
}
|
|
25
|
+
export declare const Module: {
|
|
26
|
+
new (_code: string, _opts?: object): Module;
|
|
27
|
+
prototype: any;
|
|
28
|
+
};
|
|
29
|
+
export interface SourceTextModule extends Module {
|
|
30
|
+
}
|
|
31
|
+
export declare const SourceTextModule: {
|
|
32
|
+
new (_code: string, _opts?: object): SourceTextModule;
|
|
33
|
+
prototype: any;
|
|
34
|
+
};
|
|
35
|
+
export interface SyntheticModule extends Module {
|
|
36
|
+
setExport(_name: string, _value: unknown): void;
|
|
37
|
+
}
|
|
38
|
+
export declare const SyntheticModule: {
|
|
39
|
+
new (_code: string, _opts?: object): SyntheticModule;
|
|
40
|
+
prototype: any;
|
|
41
|
+
};
|
|
42
|
+
declare const _default: {
|
|
43
|
+
Script: {
|
|
44
|
+
new (src: string, _opts?: object): Script;
|
|
45
|
+
prototype: any;
|
|
46
|
+
};
|
|
47
|
+
createContext: typeof createContext;
|
|
48
|
+
isContext: typeof isContext;
|
|
49
|
+
runInThisContext: typeof runInThisContext;
|
|
50
|
+
runInNewContext: typeof runInNewContext;
|
|
51
|
+
runInContext: typeof runInContext;
|
|
52
|
+
compileFunction: typeof compileFunction;
|
|
53
|
+
Module: {
|
|
54
|
+
new (_code: string, _opts?: object): Module;
|
|
55
|
+
prototype: any;
|
|
56
|
+
};
|
|
57
|
+
SourceTextModule: {
|
|
58
|
+
new (_code: string, _opts?: object): SourceTextModule;
|
|
59
|
+
prototype: any;
|
|
60
|
+
};
|
|
61
|
+
SyntheticModule: {
|
|
62
|
+
new (_code: string, _opts?: object): SyntheticModule;
|
|
63
|
+
prototype: any;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WASI {
|
|
2
|
+
readonly wasiImport: Record<string, Function>;
|
|
3
|
+
start(_instance: object): number;
|
|
4
|
+
initialize(_instance: object): void;
|
|
5
|
+
getImportObject(): Record<string, Record<string, Function>>;
|
|
6
|
+
}
|
|
7
|
+
interface WASIConstructor {
|
|
8
|
+
new (_options?: object): WASI;
|
|
9
|
+
(this: any, _options?: object): void;
|
|
10
|
+
prototype: any;
|
|
11
|
+
}
|
|
12
|
+
export declare const WASI: WASIConstructor;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
WASI: WASIConstructor;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { EventEmitter } from "./events";
|
|
2
|
+
export declare let isMainThread: boolean;
|
|
3
|
+
export declare let parentPort: MessagePort | null;
|
|
4
|
+
export declare let workerData: unknown;
|
|
5
|
+
export declare let threadId: number;
|
|
6
|
+
export type WorkerThreadForkFn = (modulePath: string, opts: {
|
|
7
|
+
workerData: unknown;
|
|
8
|
+
threadId: number;
|
|
9
|
+
isEval?: boolean;
|
|
10
|
+
cwd: string;
|
|
11
|
+
env: Record<string, string>;
|
|
12
|
+
onMessage: (data: unknown) => void;
|
|
13
|
+
onError: (err: Error) => void;
|
|
14
|
+
onExit: (code: number) => void;
|
|
15
|
+
onStdout?: (data: string) => void;
|
|
16
|
+
onStderr?: (data: string) => void;
|
|
17
|
+
}) => {
|
|
18
|
+
postMessage: (data: unknown) => void;
|
|
19
|
+
terminate: () => void;
|
|
20
|
+
requestId: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function setWorkerThreadForkCallback(fn: WorkerThreadForkFn): void;
|
|
23
|
+
export interface MessagePort extends EventEmitter {
|
|
24
|
+
postMessage(_val: unknown, _transfer?: unknown[]): void;
|
|
25
|
+
start(): void;
|
|
26
|
+
close(): void;
|
|
27
|
+
ref(): void;
|
|
28
|
+
unref(): void;
|
|
29
|
+
}
|
|
30
|
+
interface MessagePortConstructor {
|
|
31
|
+
new (): MessagePort;
|
|
32
|
+
(this: any): void;
|
|
33
|
+
prototype: any;
|
|
34
|
+
}
|
|
35
|
+
export declare const MessagePort: MessagePortConstructor;
|
|
36
|
+
export interface MessageChannel {
|
|
37
|
+
port1: MessagePort;
|
|
38
|
+
port2: MessagePort;
|
|
39
|
+
}
|
|
40
|
+
interface MessageChannelConstructor {
|
|
41
|
+
new (): MessageChannel;
|
|
42
|
+
(this: any): void;
|
|
43
|
+
prototype: any;
|
|
44
|
+
}
|
|
45
|
+
export declare const MessageChannel: MessageChannelConstructor;
|
|
46
|
+
export interface Worker extends EventEmitter {
|
|
47
|
+
threadId: number;
|
|
48
|
+
resourceLimits: object;
|
|
49
|
+
_handle: ReturnType<WorkerThreadForkFn> | null;
|
|
50
|
+
_terminated: boolean;
|
|
51
|
+
_isReffed: boolean;
|
|
52
|
+
postMessage(value: unknown, _transferListOrOptions?: unknown): void;
|
|
53
|
+
terminate(): Promise<number>;
|
|
54
|
+
ref(): this;
|
|
55
|
+
unref(): this;
|
|
56
|
+
getHeapSnapshot(): Promise<unknown>;
|
|
57
|
+
}
|
|
58
|
+
interface WorkerConstructor {
|
|
59
|
+
new (script: string | URL, opts?: {
|
|
60
|
+
workerData?: unknown;
|
|
61
|
+
eval?: boolean;
|
|
62
|
+
env?: Record<string, string> | symbol;
|
|
63
|
+
argv?: string[];
|
|
64
|
+
execArgv?: string[];
|
|
65
|
+
resourceLimits?: Record<string, number>;
|
|
66
|
+
name?: string;
|
|
67
|
+
transferList?: unknown[];
|
|
68
|
+
}): Worker;
|
|
69
|
+
(this: any, script: string | URL, opts?: any): void;
|
|
70
|
+
prototype: any;
|
|
71
|
+
}
|
|
72
|
+
export declare const Worker: WorkerConstructor;
|
|
73
|
+
export interface BroadcastChannel extends EventEmitter {
|
|
74
|
+
name: string;
|
|
75
|
+
postMessage(_msg: unknown): void;
|
|
76
|
+
close(): void;
|
|
77
|
+
ref(): void;
|
|
78
|
+
unref(): void;
|
|
79
|
+
}
|
|
80
|
+
interface BroadcastChannelConstructor {
|
|
81
|
+
new (label: string): BroadcastChannel;
|
|
82
|
+
(this: any, label: string): void;
|
|
83
|
+
prototype: any;
|
|
84
|
+
}
|
|
85
|
+
export declare const BroadcastChannel: BroadcastChannelConstructor;
|
|
86
|
+
export declare function moveMessagePortToContext(port: MessagePort, _ctx: unknown): MessagePort;
|
|
87
|
+
export declare function receiveMessageOnPort(_port: MessagePort): {
|
|
88
|
+
message: unknown;
|
|
89
|
+
} | undefined;
|
|
90
|
+
export declare const SHARE_ENV: unique symbol;
|
|
91
|
+
export declare function markAsUntransferable(_obj: unknown): void;
|
|
92
|
+
export declare function getEnvironmentData(_key: unknown): unknown;
|
|
93
|
+
export declare function setEnvironmentData(_key: unknown, _val: unknown): void;
|
|
94
|
+
declare const _default: {
|
|
95
|
+
isMainThread: boolean;
|
|
96
|
+
parentPort: null;
|
|
97
|
+
workerData: unknown;
|
|
98
|
+
threadId: number;
|
|
99
|
+
Worker: WorkerConstructor;
|
|
100
|
+
MessageChannel: MessageChannelConstructor;
|
|
101
|
+
MessagePort: MessagePortConstructor;
|
|
102
|
+
BroadcastChannel: BroadcastChannelConstructor;
|
|
103
|
+
moveMessagePortToContext: typeof moveMessagePortToContext;
|
|
104
|
+
receiveMessageOnPort: typeof receiveMessageOnPort;
|
|
105
|
+
SHARE_ENV: symbol;
|
|
106
|
+
markAsUntransferable: typeof markAsUntransferable;
|
|
107
|
+
getEnvironmentData: typeof getEnvironmentData;
|
|
108
|
+
setEnvironmentData: typeof setEnvironmentData;
|
|
109
|
+
setWorkerThreadForkCallback: typeof setWorkerThreadForkCallback;
|
|
110
|
+
};
|
|
111
|
+
export default _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { TcpSocket } from "./net";
|
|
2
|
+
type Handler = (...args: unknown[]) => void;
|
|
3
|
+
interface TinyEmitter {
|
|
4
|
+
_listeners: Map<string, Set<Handler>>;
|
|
5
|
+
on(evt: string, fn: Handler): this;
|
|
6
|
+
off(evt: string, fn: Handler): this;
|
|
7
|
+
emit(evt: string, ...args: unknown[]): void;
|
|
8
|
+
}
|
|
9
|
+
interface TinyEmitterConstructor {
|
|
10
|
+
new (): TinyEmitter;
|
|
11
|
+
(this: any): void;
|
|
12
|
+
prototype: any;
|
|
13
|
+
}
|
|
14
|
+
declare const TinyEmitter: TinyEmitterConstructor;
|
|
15
|
+
export declare const CONNECTING = 0;
|
|
16
|
+
export declare const OPEN = 1;
|
|
17
|
+
export declare const CLOSING = 2;
|
|
18
|
+
export declare const CLOSED = 3;
|
|
19
|
+
export interface WebSocket extends TinyEmitter {
|
|
20
|
+
readonly CONNECTING: number;
|
|
21
|
+
readonly OPEN: number;
|
|
22
|
+
readonly CLOSING: number;
|
|
23
|
+
readonly CLOSED: number;
|
|
24
|
+
readyState: number;
|
|
25
|
+
url: string;
|
|
26
|
+
protocol: string;
|
|
27
|
+
extensions: string;
|
|
28
|
+
bufferedAmount: number;
|
|
29
|
+
binaryType: 'blob' | 'arraybuffer';
|
|
30
|
+
_uid: string;
|
|
31
|
+
_boundServer: WebSocketServer | null;
|
|
32
|
+
_native: globalThis.WebSocket | null;
|
|
33
|
+
_tcpSocket: TcpSocket | null;
|
|
34
|
+
_tcpInboundBuf: Uint8Array;
|
|
35
|
+
onopen: ((ev: Event) => void) | null;
|
|
36
|
+
onclose: ((ev: CloseEvent) => void) | null;
|
|
37
|
+
onerror: ((ev: Event) => void) | null;
|
|
38
|
+
onmessage: ((ev: MessageEvent) => void) | null;
|
|
39
|
+
_open(): void;
|
|
40
|
+
_openNative(): void;
|
|
41
|
+
send(payload: string | ArrayBuffer | Uint8Array): void;
|
|
42
|
+
close(code?: number, reason?: string): void;
|
|
43
|
+
ping(): void;
|
|
44
|
+
pong(): void;
|
|
45
|
+
terminate(): void;
|
|
46
|
+
_bindServer(srv: WebSocketServer): void;
|
|
47
|
+
_deliverMessage(data: unknown): void;
|
|
48
|
+
}
|
|
49
|
+
interface WebSocketConstructor {
|
|
50
|
+
new (address: string, protocols?: string | string[]): WebSocket;
|
|
51
|
+
(this: any, address: string, protocols?: string | string[]): void;
|
|
52
|
+
prototype: any;
|
|
53
|
+
readonly CONNECTING: number;
|
|
54
|
+
readonly OPEN: number;
|
|
55
|
+
readonly CLOSING: number;
|
|
56
|
+
readonly CLOSED: number;
|
|
57
|
+
}
|
|
58
|
+
export declare const WebSocket: WebSocketConstructor;
|
|
59
|
+
export interface ServerConfig {
|
|
60
|
+
host?: string;
|
|
61
|
+
port?: number;
|
|
62
|
+
server?: unknown;
|
|
63
|
+
noServer?: boolean;
|
|
64
|
+
path?: string;
|
|
65
|
+
clientTracking?: boolean;
|
|
66
|
+
perMessageDeflate?: boolean | object;
|
|
67
|
+
maxPayload?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface WebSocketServer extends TinyEmitter {
|
|
70
|
+
clients: Set<WebSocket>;
|
|
71
|
+
options: ServerConfig;
|
|
72
|
+
_route: string;
|
|
73
|
+
_channelCb: ((ev: MessageEvent) => void) | null;
|
|
74
|
+
_listen(): void;
|
|
75
|
+
_injectClientPayload(source: WebSocket, data: unknown): void;
|
|
76
|
+
handleUpgrade(req: unknown, socket: unknown, head: unknown, done: (ws: WebSocket, req: unknown) => void): void;
|
|
77
|
+
close(done?: () => void): void;
|
|
78
|
+
address(): {
|
|
79
|
+
port: number;
|
|
80
|
+
family: string;
|
|
81
|
+
address: string;
|
|
82
|
+
} | null;
|
|
83
|
+
}
|
|
84
|
+
interface WebSocketServerConstructor {
|
|
85
|
+
new (opts?: ServerConfig): WebSocketServer;
|
|
86
|
+
(this: any, opts?: ServerConfig): void;
|
|
87
|
+
prototype: any;
|
|
88
|
+
}
|
|
89
|
+
export declare const WebSocketServer: WebSocketServerConstructor;
|
|
90
|
+
export declare const Server: WebSocketServerConstructor;
|
|
91
|
+
export declare const createWebSocketStream: () => never;
|
|
92
|
+
export default WebSocket;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { Transform } from "./stream";
|
|
2
|
+
import pako from "pako";
|
|
3
|
+
type CompressCallback = (err: Error | null, result: Buffer) => void;
|
|
4
|
+
export declare function gzip(input: Buffer | string, cb: CompressCallback): void;
|
|
5
|
+
export declare function gunzip(input: Buffer, cb: CompressCallback): void;
|
|
6
|
+
export declare function deflate(input: Buffer | string, cb: CompressCallback): void;
|
|
7
|
+
export declare function inflate(input: Buffer, cb: CompressCallback): void;
|
|
8
|
+
export declare function deflateRaw(input: Buffer | string, cb: CompressCallback): void;
|
|
9
|
+
export declare function inflateRaw(input: Buffer, cb: CompressCallback): void;
|
|
10
|
+
export declare function brotliCompress(input: Buffer | string, optsOrCb: unknown, cb?: CompressCallback): void;
|
|
11
|
+
export declare function brotliDecompress(input: Buffer, optsOrCb: unknown, cb?: CompressCallback): void;
|
|
12
|
+
export declare function gzipSync(input: Buffer | string): Buffer;
|
|
13
|
+
export declare function gunzipSync(input: Buffer): Buffer;
|
|
14
|
+
export declare function deflateSync(input: Buffer | string): Buffer;
|
|
15
|
+
export declare function inflateSync(input: Buffer): Buffer;
|
|
16
|
+
export declare function deflateRawSync(input: Buffer | string): Buffer;
|
|
17
|
+
export declare function inflateRawSync(input: Buffer): Buffer;
|
|
18
|
+
export declare function brotliCompressSync(input: Buffer | string, _opts?: unknown): Buffer;
|
|
19
|
+
export declare function brotliDecompressSync(input: Buffer, _opts?: unknown): Buffer;
|
|
20
|
+
export interface ZlibTransform extends Transform {
|
|
21
|
+
_opts: any;
|
|
22
|
+
bytesWritten: number;
|
|
23
|
+
_handle: {
|
|
24
|
+
close: () => void;
|
|
25
|
+
};
|
|
26
|
+
close(cb?: () => void): void;
|
|
27
|
+
flush(cb?: (err: Error | null) => void): void;
|
|
28
|
+
reset(): void;
|
|
29
|
+
params(_level: number, _strategy: number, cb?: (err: Error | null) => void): void;
|
|
30
|
+
_processChunk(chunk: Buffer | Uint8Array, flushFlag: number): Buffer | null;
|
|
31
|
+
}
|
|
32
|
+
export interface Gzip extends ZlibTransform {
|
|
33
|
+
_engine: pako.Deflate;
|
|
34
|
+
}
|
|
35
|
+
interface GzipConstructor {
|
|
36
|
+
new (opts?: any): Gzip;
|
|
37
|
+
(this: any, opts?: any): void;
|
|
38
|
+
prototype: any;
|
|
39
|
+
}
|
|
40
|
+
export declare const Gzip: GzipConstructor;
|
|
41
|
+
export interface Gunzip extends ZlibTransform {
|
|
42
|
+
_engine: pako.Inflate;
|
|
43
|
+
}
|
|
44
|
+
interface GunzipConstructor {
|
|
45
|
+
new (opts?: any): Gunzip;
|
|
46
|
+
(this: any, opts?: any): void;
|
|
47
|
+
prototype: any;
|
|
48
|
+
}
|
|
49
|
+
export declare const Gunzip: GunzipConstructor;
|
|
50
|
+
export interface Deflate extends ZlibTransform {
|
|
51
|
+
_engine: pako.Deflate;
|
|
52
|
+
}
|
|
53
|
+
interface DeflateConstructor {
|
|
54
|
+
new (opts?: any): Deflate;
|
|
55
|
+
(this: any, opts?: any): void;
|
|
56
|
+
prototype: any;
|
|
57
|
+
}
|
|
58
|
+
export declare const Deflate: DeflateConstructor;
|
|
59
|
+
export interface Inflate extends ZlibTransform {
|
|
60
|
+
_engine: pako.Inflate;
|
|
61
|
+
}
|
|
62
|
+
interface InflateConstructor {
|
|
63
|
+
new (opts?: any): Inflate;
|
|
64
|
+
(this: any, opts?: any): void;
|
|
65
|
+
prototype: any;
|
|
66
|
+
}
|
|
67
|
+
export declare const Inflate: InflateConstructor;
|
|
68
|
+
export interface DeflateRaw extends ZlibTransform {
|
|
69
|
+
_engine: pako.Deflate;
|
|
70
|
+
}
|
|
71
|
+
interface DeflateRawConstructor {
|
|
72
|
+
new (opts?: any): DeflateRaw;
|
|
73
|
+
(this: any, opts?: any): void;
|
|
74
|
+
prototype: any;
|
|
75
|
+
}
|
|
76
|
+
export declare const DeflateRaw: DeflateRawConstructor;
|
|
77
|
+
export interface InflateRaw extends ZlibTransform {
|
|
78
|
+
_engine: pako.Inflate;
|
|
79
|
+
}
|
|
80
|
+
interface InflateRawConstructor {
|
|
81
|
+
new (opts?: any): InflateRaw;
|
|
82
|
+
(this: any, opts?: any): void;
|
|
83
|
+
prototype: any;
|
|
84
|
+
}
|
|
85
|
+
export declare const InflateRaw: InflateRawConstructor;
|
|
86
|
+
export interface Unzip extends ZlibTransform {
|
|
87
|
+
_engine: pako.Inflate | null;
|
|
88
|
+
}
|
|
89
|
+
interface UnzipConstructor {
|
|
90
|
+
new (opts?: any): Unzip;
|
|
91
|
+
(this: any, opts?: any): void;
|
|
92
|
+
prototype: any;
|
|
93
|
+
}
|
|
94
|
+
export declare const Unzip: UnzipConstructor;
|
|
95
|
+
export interface BrotliCompressStream extends ZlibTransform {
|
|
96
|
+
}
|
|
97
|
+
interface BrotliCompressStreamConstructor {
|
|
98
|
+
new (opts?: any): BrotliCompressStream;
|
|
99
|
+
(this: any, opts?: any): void;
|
|
100
|
+
prototype: any;
|
|
101
|
+
}
|
|
102
|
+
export declare const BrotliCompressStream: BrotliCompressStreamConstructor;
|
|
103
|
+
export interface BrotliDecompressStream extends ZlibTransform {
|
|
104
|
+
}
|
|
105
|
+
interface BrotliDecompressStreamConstructor {
|
|
106
|
+
new (opts?: any): BrotliDecompressStream;
|
|
107
|
+
(this: any, opts?: any): void;
|
|
108
|
+
prototype: any;
|
|
109
|
+
}
|
|
110
|
+
export declare const BrotliDecompressStream: BrotliDecompressStreamConstructor;
|
|
111
|
+
export declare const BrotliCompress: BrotliCompressStreamConstructor;
|
|
112
|
+
export declare const BrotliDecompress: BrotliDecompressStreamConstructor;
|
|
113
|
+
export declare function createGzip(opts?: any): Gzip;
|
|
114
|
+
export declare function createGunzip(opts?: any): Gunzip;
|
|
115
|
+
export declare function createDeflate(opts?: any): Deflate;
|
|
116
|
+
export declare function createInflate(opts?: any): Inflate;
|
|
117
|
+
export declare function createDeflateRaw(opts?: any): DeflateRaw;
|
|
118
|
+
export declare function createInflateRaw(opts?: any): InflateRaw;
|
|
119
|
+
export declare function createUnzip(opts?: any): Unzip;
|
|
120
|
+
export declare function createBrotliCompress(opts?: any): BrotliCompressStream;
|
|
121
|
+
export declare function createBrotliDecompress(opts?: any): BrotliDecompressStream;
|
|
122
|
+
export declare const constants: {
|
|
123
|
+
Z_NO_FLUSH: number;
|
|
124
|
+
Z_PARTIAL_FLUSH: number;
|
|
125
|
+
Z_SYNC_FLUSH: number;
|
|
126
|
+
Z_FULL_FLUSH: number;
|
|
127
|
+
Z_FINISH: number;
|
|
128
|
+
Z_BLOCK: number;
|
|
129
|
+
Z_OK: number;
|
|
130
|
+
Z_STREAM_END: number;
|
|
131
|
+
Z_NEED_DICT: number;
|
|
132
|
+
Z_ERRNO: number;
|
|
133
|
+
Z_STREAM_ERROR: number;
|
|
134
|
+
Z_DATA_ERROR: number;
|
|
135
|
+
Z_MEM_ERROR: number;
|
|
136
|
+
Z_BUF_ERROR: number;
|
|
137
|
+
Z_VERSION_ERROR: number;
|
|
138
|
+
Z_NO_COMPRESSION: number;
|
|
139
|
+
Z_BEST_SPEED: number;
|
|
140
|
+
Z_BEST_COMPRESSION: number;
|
|
141
|
+
Z_DEFAULT_COMPRESSION: number;
|
|
142
|
+
Z_FILTERED: number;
|
|
143
|
+
Z_HUFFMAN_ONLY: number;
|
|
144
|
+
Z_RLE: number;
|
|
145
|
+
Z_FIXED: number;
|
|
146
|
+
Z_DEFAULT_STRATEGY: number;
|
|
147
|
+
ZLIB_VERNUM: number;
|
|
148
|
+
Z_MIN_WINDOWBITS: number;
|
|
149
|
+
Z_MAX_WINDOWBITS: number;
|
|
150
|
+
Z_DEFAULT_WINDOWBITS: number;
|
|
151
|
+
Z_MIN_CHUNK: number;
|
|
152
|
+
Z_MAX_CHUNK: number;
|
|
153
|
+
Z_DEFAULT_CHUNK: number;
|
|
154
|
+
Z_MIN_MEMLEVEL: number;
|
|
155
|
+
Z_MAX_MEMLEVEL: number;
|
|
156
|
+
Z_DEFAULT_MEMLEVEL: number;
|
|
157
|
+
Z_MIN_LEVEL: number;
|
|
158
|
+
Z_MAX_LEVEL: number;
|
|
159
|
+
Z_DEFAULT_LEVEL: number;
|
|
160
|
+
BROTLI_DECODE: number;
|
|
161
|
+
BROTLI_ENCODE: number;
|
|
162
|
+
BROTLI_OPERATION_PROCESS: number;
|
|
163
|
+
BROTLI_OPERATION_FLUSH: number;
|
|
164
|
+
BROTLI_OPERATION_FINISH: number;
|
|
165
|
+
BROTLI_OPERATION_EMIT_METADATA: number;
|
|
166
|
+
BROTLI_PARAM_MODE: number;
|
|
167
|
+
BROTLI_MODE_GENERIC: number;
|
|
168
|
+
BROTLI_MODE_TEXT: number;
|
|
169
|
+
BROTLI_MODE_FONT: number;
|
|
170
|
+
BROTLI_PARAM_QUALITY: number;
|
|
171
|
+
BROTLI_MIN_QUALITY: number;
|
|
172
|
+
BROTLI_MAX_QUALITY: number;
|
|
173
|
+
BROTLI_DEFAULT_QUALITY: number;
|
|
174
|
+
BROTLI_PARAM_LGWIN: number;
|
|
175
|
+
BROTLI_MIN_WINDOW_BITS: number;
|
|
176
|
+
BROTLI_MAX_WINDOW_BITS: number;
|
|
177
|
+
BROTLI_DEFAULT_WINDOW: number;
|
|
178
|
+
BROTLI_PARAM_LGBLOCK: number;
|
|
179
|
+
BROTLI_MIN_INPUT_BLOCK_BITS: number;
|
|
180
|
+
BROTLI_MAX_INPUT_BLOCK_BITS: number;
|
|
181
|
+
};
|
|
182
|
+
declare const _default: {
|
|
183
|
+
gzip: typeof gzip;
|
|
184
|
+
gunzip: typeof gunzip;
|
|
185
|
+
deflate: typeof deflate;
|
|
186
|
+
inflate: typeof inflate;
|
|
187
|
+
deflateRaw: typeof deflateRaw;
|
|
188
|
+
inflateRaw: typeof inflateRaw;
|
|
189
|
+
brotliCompress: typeof brotliCompress;
|
|
190
|
+
brotliDecompress: typeof brotliDecompress;
|
|
191
|
+
gzipSync: typeof gzipSync;
|
|
192
|
+
gunzipSync: typeof gunzipSync;
|
|
193
|
+
deflateSync: typeof deflateSync;
|
|
194
|
+
inflateSync: typeof inflateSync;
|
|
195
|
+
deflateRawSync: typeof deflateRawSync;
|
|
196
|
+
inflateRawSync: typeof inflateRawSync;
|
|
197
|
+
brotliCompressSync: typeof brotliCompressSync;
|
|
198
|
+
brotliDecompressSync: typeof brotliDecompressSync;
|
|
199
|
+
Gzip: GzipConstructor;
|
|
200
|
+
Gunzip: GunzipConstructor;
|
|
201
|
+
Deflate: DeflateConstructor;
|
|
202
|
+
Inflate: InflateConstructor;
|
|
203
|
+
DeflateRaw: DeflateRawConstructor;
|
|
204
|
+
InflateRaw: InflateRawConstructor;
|
|
205
|
+
Unzip: UnzipConstructor;
|
|
206
|
+
BrotliCompress: BrotliCompressStreamConstructor;
|
|
207
|
+
BrotliDecompress: BrotliDecompressStreamConstructor;
|
|
208
|
+
createGzip: typeof createGzip;
|
|
209
|
+
createGunzip: typeof createGunzip;
|
|
210
|
+
createDeflate: typeof createDeflate;
|
|
211
|
+
createInflate: typeof createInflate;
|
|
212
|
+
createDeflateRaw: typeof createDeflateRaw;
|
|
213
|
+
createInflateRaw: typeof createInflateRaw;
|
|
214
|
+
createUnzip: typeof createUnzip;
|
|
215
|
+
createBrotliCompress: typeof createBrotliCompress;
|
|
216
|
+
createBrotliDecompress: typeof createBrotliDecompress;
|
|
217
|
+
constants: {
|
|
218
|
+
Z_NO_FLUSH: number;
|
|
219
|
+
Z_PARTIAL_FLUSH: number;
|
|
220
|
+
Z_SYNC_FLUSH: number;
|
|
221
|
+
Z_FULL_FLUSH: number;
|
|
222
|
+
Z_FINISH: number;
|
|
223
|
+
Z_BLOCK: number;
|
|
224
|
+
Z_OK: number;
|
|
225
|
+
Z_STREAM_END: number;
|
|
226
|
+
Z_NEED_DICT: number;
|
|
227
|
+
Z_ERRNO: number;
|
|
228
|
+
Z_STREAM_ERROR: number;
|
|
229
|
+
Z_DATA_ERROR: number;
|
|
230
|
+
Z_MEM_ERROR: number;
|
|
231
|
+
Z_BUF_ERROR: number;
|
|
232
|
+
Z_VERSION_ERROR: number;
|
|
233
|
+
Z_NO_COMPRESSION: number;
|
|
234
|
+
Z_BEST_SPEED: number;
|
|
235
|
+
Z_BEST_COMPRESSION: number;
|
|
236
|
+
Z_DEFAULT_COMPRESSION: number;
|
|
237
|
+
Z_FILTERED: number;
|
|
238
|
+
Z_HUFFMAN_ONLY: number;
|
|
239
|
+
Z_RLE: number;
|
|
240
|
+
Z_FIXED: number;
|
|
241
|
+
Z_DEFAULT_STRATEGY: number;
|
|
242
|
+
ZLIB_VERNUM: number;
|
|
243
|
+
Z_MIN_WINDOWBITS: number;
|
|
244
|
+
Z_MAX_WINDOWBITS: number;
|
|
245
|
+
Z_DEFAULT_WINDOWBITS: number;
|
|
246
|
+
Z_MIN_CHUNK: number;
|
|
247
|
+
Z_MAX_CHUNK: number;
|
|
248
|
+
Z_DEFAULT_CHUNK: number;
|
|
249
|
+
Z_MIN_MEMLEVEL: number;
|
|
250
|
+
Z_MAX_MEMLEVEL: number;
|
|
251
|
+
Z_DEFAULT_MEMLEVEL: number;
|
|
252
|
+
Z_MIN_LEVEL: number;
|
|
253
|
+
Z_MAX_LEVEL: number;
|
|
254
|
+
Z_DEFAULT_LEVEL: number;
|
|
255
|
+
BROTLI_DECODE: number;
|
|
256
|
+
BROTLI_ENCODE: number;
|
|
257
|
+
BROTLI_OPERATION_PROCESS: number;
|
|
258
|
+
BROTLI_OPERATION_FLUSH: number;
|
|
259
|
+
BROTLI_OPERATION_FINISH: number;
|
|
260
|
+
BROTLI_OPERATION_EMIT_METADATA: number;
|
|
261
|
+
BROTLI_PARAM_MODE: number;
|
|
262
|
+
BROTLI_MODE_GENERIC: number;
|
|
263
|
+
BROTLI_MODE_TEXT: number;
|
|
264
|
+
BROTLI_MODE_FONT: number;
|
|
265
|
+
BROTLI_PARAM_QUALITY: number;
|
|
266
|
+
BROTLI_MIN_QUALITY: number;
|
|
267
|
+
BROTLI_MAX_QUALITY: number;
|
|
268
|
+
BROTLI_DEFAULT_QUALITY: number;
|
|
269
|
+
BROTLI_PARAM_LGWIN: number;
|
|
270
|
+
BROTLI_MIN_WINDOW_BITS: number;
|
|
271
|
+
BROTLI_MAX_WINDOW_BITS: number;
|
|
272
|
+
BROTLI_DEFAULT_WINDOW: number;
|
|
273
|
+
BROTLI_PARAM_LGBLOCK: number;
|
|
274
|
+
BROTLI_MIN_INPUT_BLOCK_BITS: number;
|
|
275
|
+
BROTLI_MAX_INPUT_BLOCK_BITS: number;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
export default _default;
|