@run0/jiki 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/browser-bundle.d.ts +40 -0
  2. package/dist/builtins.d.ts +22 -0
  3. package/dist/code-transform.d.ts +7 -0
  4. package/dist/config/cdn.d.ts +13 -0
  5. package/dist/container.d.ts +101 -0
  6. package/dist/dev-server.d.ts +69 -0
  7. package/dist/errors.d.ts +19 -0
  8. package/dist/frameworks/code-transforms.d.ts +32 -0
  9. package/dist/frameworks/next-api-handler.d.ts +72 -0
  10. package/dist/frameworks/next-dev-server.d.ts +141 -0
  11. package/dist/frameworks/next-html-generator.d.ts +36 -0
  12. package/dist/frameworks/next-route-resolver.d.ts +19 -0
  13. package/dist/frameworks/next-shims.d.ts +78 -0
  14. package/dist/frameworks/remix-dev-server.d.ts +47 -0
  15. package/dist/frameworks/sveltekit-dev-server.d.ts +43 -0
  16. package/dist/frameworks/vite-dev-server.d.ts +50 -0
  17. package/dist/fs-errors.d.ts +36 -0
  18. package/dist/index.cjs +14916 -0
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.ts +61 -0
  21. package/dist/index.mjs +14898 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/kernel.d.ts +48 -0
  24. package/dist/memfs.d.ts +144 -0
  25. package/dist/metrics.d.ts +78 -0
  26. package/dist/module-resolver.d.ts +60 -0
  27. package/dist/network-interceptor.d.ts +71 -0
  28. package/dist/npm/cache.d.ts +76 -0
  29. package/dist/npm/index.d.ts +60 -0
  30. package/dist/npm/lockfile-reader.d.ts +32 -0
  31. package/dist/npm/pnpm.d.ts +18 -0
  32. package/dist/npm/registry.d.ts +45 -0
  33. package/dist/npm/resolver.d.ts +39 -0
  34. package/dist/npm/sync-installer.d.ts +18 -0
  35. package/dist/npm/tarball.d.ts +4 -0
  36. package/dist/npm/workspaces.d.ts +46 -0
  37. package/dist/persistence.d.ts +94 -0
  38. package/dist/plugin.d.ts +156 -0
  39. package/dist/polyfills/assert.d.ts +30 -0
  40. package/dist/polyfills/child_process.d.ts +116 -0
  41. package/dist/polyfills/chokidar.d.ts +18 -0
  42. package/dist/polyfills/crypto.d.ts +49 -0
  43. package/dist/polyfills/events.d.ts +28 -0
  44. package/dist/polyfills/fs.d.ts +82 -0
  45. package/dist/polyfills/http.d.ts +147 -0
  46. package/dist/polyfills/module.d.ts +29 -0
  47. package/dist/polyfills/net.d.ts +53 -0
  48. package/dist/polyfills/os.d.ts +91 -0
  49. package/dist/polyfills/path.d.ts +96 -0
  50. package/dist/polyfills/perf_hooks.d.ts +21 -0
  51. package/dist/polyfills/process.d.ts +99 -0
  52. package/dist/polyfills/querystring.d.ts +15 -0
  53. package/dist/polyfills/readdirp.d.ts +18 -0
  54. package/dist/polyfills/readline.d.ts +32 -0
  55. package/dist/polyfills/stream.d.ts +106 -0
  56. package/dist/polyfills/stubs.d.ts +737 -0
  57. package/dist/polyfills/tty.d.ts +25 -0
  58. package/dist/polyfills/url.d.ts +41 -0
  59. package/dist/polyfills/util.d.ts +61 -0
  60. package/dist/polyfills/v8.d.ts +43 -0
  61. package/dist/polyfills/vm.d.ts +76 -0
  62. package/dist/polyfills/worker-threads.d.ts +77 -0
  63. package/dist/polyfills/ws.d.ts +32 -0
  64. package/dist/polyfills/zlib.d.ts +87 -0
  65. package/dist/runtime-helpers.d.ts +4 -0
  66. package/dist/runtime-interface.d.ts +39 -0
  67. package/dist/sandbox.d.ts +69 -0
  68. package/dist/server-bridge.d.ts +55 -0
  69. package/dist/shell-commands.d.ts +2 -0
  70. package/dist/shell.d.ts +101 -0
  71. package/dist/transpiler.d.ts +47 -0
  72. package/dist/type-checker.d.ts +57 -0
  73. package/dist/types/package-json.d.ts +17 -0
  74. package/dist/utils/binary-encoding.d.ts +4 -0
  75. package/dist/utils/hash.d.ts +6 -0
  76. package/dist/utils/safe-path.d.ts +6 -0
  77. package/dist/worker-runtime.d.ts +34 -0
  78. package/package.json +59 -0
  79. package/src/browser-bundle.ts +498 -0
  80. package/src/builtins.ts +222 -0
  81. package/src/code-transform.ts +183 -0
  82. package/src/config/cdn.ts +17 -0
  83. package/src/container.ts +343 -0
  84. package/src/dev-server.ts +322 -0
  85. package/src/errors.ts +604 -0
  86. package/src/frameworks/code-transforms.ts +667 -0
  87. package/src/frameworks/next-api-handler.ts +366 -0
  88. package/src/frameworks/next-dev-server.ts +1252 -0
  89. package/src/frameworks/next-html-generator.ts +585 -0
  90. package/src/frameworks/next-route-resolver.ts +521 -0
  91. package/src/frameworks/next-shims.ts +1084 -0
  92. package/src/frameworks/remix-dev-server.ts +163 -0
  93. package/src/frameworks/sveltekit-dev-server.ts +197 -0
  94. package/src/frameworks/vite-dev-server.ts +370 -0
  95. package/src/fs-errors.ts +118 -0
  96. package/src/index.ts +188 -0
  97. package/src/kernel.ts +381 -0
  98. package/src/memfs.ts +1006 -0
  99. package/src/metrics.ts +140 -0
  100. package/src/module-resolver.ts +511 -0
  101. package/src/network-interceptor.ts +143 -0
  102. package/src/npm/cache.ts +172 -0
  103. package/src/npm/index.ts +377 -0
  104. package/src/npm/lockfile-reader.ts +105 -0
  105. package/src/npm/pnpm.ts +108 -0
  106. package/src/npm/registry.ts +120 -0
  107. package/src/npm/resolver.ts +339 -0
  108. package/src/npm/sync-installer.ts +217 -0
  109. package/src/npm/tarball.ts +136 -0
  110. package/src/npm/workspaces.ts +255 -0
  111. package/src/persistence.ts +235 -0
  112. package/src/plugin.ts +293 -0
  113. package/src/polyfills/assert.ts +164 -0
  114. package/src/polyfills/child_process.ts +535 -0
  115. package/src/polyfills/chokidar.ts +52 -0
  116. package/src/polyfills/crypto.ts +433 -0
  117. package/src/polyfills/events.ts +178 -0
  118. package/src/polyfills/fs.ts +297 -0
  119. package/src/polyfills/http.ts +478 -0
  120. package/src/polyfills/module.ts +97 -0
  121. package/src/polyfills/net.ts +123 -0
  122. package/src/polyfills/os.ts +108 -0
  123. package/src/polyfills/path.ts +169 -0
  124. package/src/polyfills/perf_hooks.ts +30 -0
  125. package/src/polyfills/process.ts +349 -0
  126. package/src/polyfills/querystring.ts +66 -0
  127. package/src/polyfills/readdirp.ts +72 -0
  128. package/src/polyfills/readline.ts +80 -0
  129. package/src/polyfills/stream.ts +610 -0
  130. package/src/polyfills/stubs.ts +600 -0
  131. package/src/polyfills/tty.ts +43 -0
  132. package/src/polyfills/url.ts +97 -0
  133. package/src/polyfills/util.ts +173 -0
  134. package/src/polyfills/v8.ts +62 -0
  135. package/src/polyfills/vm.ts +111 -0
  136. package/src/polyfills/worker-threads.ts +189 -0
  137. package/src/polyfills/ws.ts +73 -0
  138. package/src/polyfills/zlib.ts +244 -0
  139. package/src/runtime-helpers.ts +83 -0
  140. package/src/runtime-interface.ts +46 -0
  141. package/src/sandbox.ts +178 -0
  142. package/src/server-bridge.ts +473 -0
  143. package/src/service-worker.ts +153 -0
  144. package/src/shell-commands.ts +708 -0
  145. package/src/shell.ts +795 -0
  146. package/src/transpiler.ts +282 -0
  147. package/src/type-checker.ts +241 -0
  148. package/src/types/package-json.ts +17 -0
  149. package/src/utils/binary-encoding.ts +38 -0
  150. package/src/utils/hash.ts +24 -0
  151. package/src/utils/safe-path.ts +38 -0
  152. package/src/worker-runtime.ts +42 -0
@@ -0,0 +1,147 @@
1
+ import { EventEmitter } from "./events";
2
+ import { Readable, Writable, BufferImpl } from "./stream";
3
+ type ServerListenCallback = (port: number, server: Server) => void;
4
+ type ServerCloseCallback = (port: number) => void;
5
+ export declare function setServerListenCallback(cb: ServerListenCallback): void;
6
+ export declare function setServerCloseCallback(cb: ServerCloseCallback): void;
7
+ export declare function getServer(_port: number): Server | undefined;
8
+ export declare const METHODS: string[];
9
+ export declare const STATUS_CODES: Record<number, string>;
10
+ export declare class IncomingMessage extends Readable {
11
+ method: string;
12
+ url: string;
13
+ headers: Record<string, string | string[] | undefined>;
14
+ httpVersion: string;
15
+ statusCode?: number;
16
+ statusMessage?: string;
17
+ socket: {
18
+ remoteAddress: string;
19
+ remotePort: number;
20
+ destroy(): void;
21
+ };
22
+ complete: boolean;
23
+ aborted: boolean;
24
+ connection: {
25
+ remoteAddress: string;
26
+ };
27
+ rawHeaders: string[];
28
+ trailers: Record<string, string>;
29
+ rawTrailers: string[];
30
+ constructor(opts?: {
31
+ method?: string;
32
+ url?: string;
33
+ headers?: Record<string, string>;
34
+ });
35
+ setTimeout(_ms: number, _cb?: () => void): this;
36
+ }
37
+ export declare class ServerResponse extends Writable {
38
+ statusCode: number;
39
+ statusMessage: string;
40
+ headersSent: boolean;
41
+ finished: boolean;
42
+ private _headers;
43
+ private _body;
44
+ setHeader(name: string, value: string | string[]): this;
45
+ getHeader(name: string): string | string[] | undefined;
46
+ removeHeader(name: string): void;
47
+ getHeaders(): Record<string, string | string[]>;
48
+ hasHeader(name: string): boolean;
49
+ writeHead(statusCode: number, statusMessage?: string | Record<string, string | string[]>, headers?: Record<string, string | string[]>): this;
50
+ _write(chunk: unknown, _encoding: string, callback: () => void): void;
51
+ end(chunkOrCb?: unknown, encodingOrCb?: string | (() => void), cb?: () => void): this;
52
+ getBody(): Uint8Array;
53
+ getBodyString(): string;
54
+ addTrailers(headers: Record<string, string>): void;
55
+ flushHeaders(): void;
56
+ cork(): void;
57
+ uncork(): void;
58
+ }
59
+ type RequestHandler = (req: IncomingMessage, res: ServerResponse) => void;
60
+ export declare class Server extends EventEmitter {
61
+ private handler;
62
+ private _port;
63
+ listening: boolean;
64
+ keepAliveTimeout: number;
65
+ headersTimeout: number;
66
+ requestTimeout: number;
67
+ timeout: number;
68
+ constructor(handler?: RequestHandler);
69
+ setTimeout(ms?: number, _cb?: () => void): this;
70
+ listen(portOrOpts?: number | Record<string, unknown>, hostOrCb?: string | (() => void), cb?: () => void): this;
71
+ close(cb?: () => void): this;
72
+ address(): {
73
+ port: number;
74
+ family: string;
75
+ address: string;
76
+ } | null;
77
+ handleRequest(methodOrReq: string | IncomingMessage, urlOrRes?: string | ServerResponse, headers?: Record<string, string>, body?: BufferImpl | string): Promise<{
78
+ statusCode: number;
79
+ statusMessage: string;
80
+ headers: Record<string, string>;
81
+ body: BufferImpl;
82
+ }>;
83
+ }
84
+ export declare function createServer(handler?: RequestHandler): Server;
85
+ export declare class ClientRequest extends Writable {
86
+ method: string;
87
+ path: string;
88
+ private _headers;
89
+ private _body;
90
+ private _url;
91
+ constructor(options: string | {
92
+ hostname?: string;
93
+ host?: string;
94
+ port?: number;
95
+ path?: string;
96
+ method?: string;
97
+ headers?: Record<string, string>;
98
+ protocol?: string;
99
+ });
100
+ aborted: boolean;
101
+ setHeader(name: string, value: string): void;
102
+ getHeader(name: string): string | undefined;
103
+ removeHeader(name: string): void;
104
+ abort(): void;
105
+ setTimeout(_ms: number, _cb?: () => void): this;
106
+ destroy(error?: Error): this;
107
+ _write(chunk: unknown, _encoding: string, callback: () => void): void;
108
+ end(chunkOrCb?: unknown, encodingOrCb?: string | (() => void), cb?: () => void): this;
109
+ }
110
+ export declare function request(options: unknown, cb?: (res: IncomingMessage) => void): ClientRequest;
111
+ export declare function get(options: unknown, cb?: (res: IncomingMessage) => void): ClientRequest;
112
+ export declare const Agent: {
113
+ new (_opts?: unknown): {};
114
+ };
115
+ export declare const globalAgent: {};
116
+ declare const _default: {
117
+ METHODS: string[];
118
+ STATUS_CODES: Record<number, string>;
119
+ IncomingMessage: typeof IncomingMessage;
120
+ ServerResponse: typeof ServerResponse;
121
+ Server: typeof Server;
122
+ ClientRequest: typeof ClientRequest;
123
+ createServer: typeof createServer;
124
+ request: typeof request;
125
+ get: typeof get;
126
+ Agent: {
127
+ new (_opts?: unknown): {};
128
+ };
129
+ globalAgent: {};
130
+ setServerListenCallback: typeof setServerListenCallback;
131
+ setServerCloseCallback: typeof setServerCloseCallback;
132
+ getServer: typeof getServer;
133
+ };
134
+ export default _default;
135
+ export declare const httpsModule: {
136
+ createServer: typeof createServer;
137
+ request: typeof request;
138
+ get: typeof get;
139
+ Server: typeof Server;
140
+ Agent: {
141
+ new (_opts?: unknown): {};
142
+ };
143
+ globalAgent: {};
144
+ IncomingMessage: typeof IncomingMessage;
145
+ ServerResponse: typeof ServerResponse;
146
+ ClientRequest: typeof ClientRequest;
147
+ };
@@ -0,0 +1,29 @@
1
+ export declare const builtinModules: string[];
2
+ export declare function isBuiltin(moduleName: string): boolean;
3
+ export declare function initModule(requireFactory: (dir: string) => (id: string) => unknown): void;
4
+ export declare function createRequire(filename: string): (id: string) => unknown;
5
+ export declare class Module {
6
+ id: string;
7
+ filename: string;
8
+ exports: unknown;
9
+ loaded: boolean;
10
+ children: Module[];
11
+ paths: string[];
12
+ parent: Module | null;
13
+ constructor(id?: string);
14
+ static _resolveFilename(request: string, _parent?: unknown): string;
15
+ static _cache: Record<string, Module>;
16
+ static _extensions: Record<string, unknown>;
17
+ static builtinModules: string[];
18
+ static isBuiltin: typeof isBuiltin;
19
+ static createRequire: typeof createRequire;
20
+ static wrap(code: string): string;
21
+ static Module: typeof Module;
22
+ }
23
+ declare const _default: {
24
+ Module: typeof Module;
25
+ builtinModules: string[];
26
+ isBuiltin: typeof isBuiltin;
27
+ createRequire: typeof createRequire;
28
+ };
29
+ export default _default;
@@ -0,0 +1,53 @@
1
+ import { Duplex } from "./stream";
2
+ import { EventEmitter } from "./events";
3
+ export declare class Socket extends Duplex {
4
+ remoteAddress: string;
5
+ remotePort: number;
6
+ localAddress: string;
7
+ localPort: number;
8
+ connecting: boolean;
9
+ destroyed: boolean;
10
+ timeout: number;
11
+ allowHalfOpen: boolean;
12
+ connect(...args: unknown[]): this;
13
+ destroy(error?: Error): this;
14
+ setTimeout(timeout: number, cb?: () => void): this;
15
+ setNoDelay(): this;
16
+ setKeepAlive(): this;
17
+ ref(): this;
18
+ unref(): this;
19
+ address(): {
20
+ port: number;
21
+ family: string;
22
+ address: string;
23
+ };
24
+ }
25
+ export declare class Server extends EventEmitter {
26
+ listening: boolean;
27
+ listen(port?: number, hostOrCb?: string | (() => void), cb?: () => void): this;
28
+ close(cb?: () => void): this;
29
+ address(): {
30
+ port: number;
31
+ family: string;
32
+ address: string;
33
+ } | null;
34
+ ref(): this;
35
+ unref(): this;
36
+ }
37
+ export declare function createServer(_options?: unknown, _connectionListener?: unknown): Server;
38
+ export declare function createConnection(_options: unknown, cb?: () => void): Socket;
39
+ export declare function connect(_options: unknown, cb?: () => void): Socket;
40
+ export declare function isIP(input: string): number;
41
+ export declare function isIPv4(input: string): boolean;
42
+ export declare function isIPv6(input: string): boolean;
43
+ declare const _default: {
44
+ Socket: typeof Socket;
45
+ Server: typeof Server;
46
+ createServer: typeof createServer;
47
+ createConnection: typeof createConnection;
48
+ connect: typeof connect;
49
+ isIP: typeof isIP;
50
+ isIPv4: typeof isIPv4;
51
+ isIPv6: typeof isIPv6;
52
+ };
53
+ export default _default;
@@ -0,0 +1,91 @@
1
+ export declare function hostname(): string;
2
+ export declare function type(): string;
3
+ export declare function platform(): string;
4
+ export declare function arch(): string;
5
+ export declare function release(): string;
6
+ export declare function tmpdir(): string;
7
+ export declare function homedir(): string;
8
+ export declare function userInfo(): {
9
+ username: string;
10
+ uid: number;
11
+ gid: number;
12
+ shell: string;
13
+ homedir: string;
14
+ };
15
+ export declare function cpus(): {
16
+ model: string;
17
+ speed: number;
18
+ times: {
19
+ user: number;
20
+ nice: number;
21
+ sys: number;
22
+ idle: number;
23
+ irq: number;
24
+ };
25
+ }[];
26
+ export declare function totalmem(): number;
27
+ export declare function freemem(): number;
28
+ export declare function uptime(): number;
29
+ export declare function loadavg(): [number, number, number];
30
+ export declare function networkInterfaces(): Record<string, unknown[]>;
31
+ export declare function endianness(): "BE" | "LE";
32
+ export declare const EOL = "\n";
33
+ export declare const constants: {
34
+ signals: {
35
+ SIGHUP: number;
36
+ SIGINT: number;
37
+ SIGQUIT: number;
38
+ SIGTERM: number;
39
+ SIGKILL: number;
40
+ };
41
+ errno: {};
42
+ priority: {
43
+ PRIORITY_LOW: number;
44
+ PRIORITY_BELOW_NORMAL: number;
45
+ PRIORITY_NORMAL: number;
46
+ PRIORITY_ABOVE_NORMAL: number;
47
+ PRIORITY_HIGH: number;
48
+ PRIORITY_HIGHEST: number;
49
+ };
50
+ };
51
+ export declare function version(): string;
52
+ export declare function machine(): string;
53
+ declare const _default: {
54
+ hostname: typeof hostname;
55
+ type: typeof type;
56
+ platform: typeof platform;
57
+ arch: typeof arch;
58
+ release: typeof release;
59
+ tmpdir: typeof tmpdir;
60
+ homedir: typeof homedir;
61
+ userInfo: typeof userInfo;
62
+ cpus: typeof cpus;
63
+ totalmem: typeof totalmem;
64
+ freemem: typeof freemem;
65
+ uptime: typeof uptime;
66
+ loadavg: typeof loadavg;
67
+ networkInterfaces: typeof networkInterfaces;
68
+ endianness: typeof endianness;
69
+ EOL: string;
70
+ constants: {
71
+ signals: {
72
+ SIGHUP: number;
73
+ SIGINT: number;
74
+ SIGQUIT: number;
75
+ SIGTERM: number;
76
+ SIGKILL: number;
77
+ };
78
+ errno: {};
79
+ priority: {
80
+ PRIORITY_LOW: number;
81
+ PRIORITY_BELOW_NORMAL: number;
82
+ PRIORITY_NORMAL: number;
83
+ PRIORITY_ABOVE_NORMAL: number;
84
+ PRIORITY_HIGH: number;
85
+ PRIORITY_HIGHEST: number;
86
+ };
87
+ };
88
+ version: typeof version;
89
+ machine: typeof machine;
90
+ };
91
+ export default _default;
@@ -0,0 +1,96 @@
1
+ export declare const sep = "/";
2
+ export declare const delimiter = ":";
3
+ export declare function normalize(path: string): string;
4
+ export declare function join(...paths: string[]): string;
5
+ export declare function resolve(...paths: string[]): string;
6
+ export declare function isAbsolute(path: string): boolean;
7
+ export declare function dirname(path: string): string;
8
+ export declare function basename(path: string, ext?: string): string;
9
+ export declare function extname(path: string): string;
10
+ export declare function relative(from: string, to: string): string;
11
+ export declare function parse(path: string): {
12
+ root: string;
13
+ dir: string;
14
+ base: string;
15
+ ext: string;
16
+ name: string;
17
+ };
18
+ export declare function format(obj: {
19
+ root?: string;
20
+ dir?: string;
21
+ base?: string;
22
+ ext?: string;
23
+ name?: string;
24
+ }): string;
25
+ export declare const posix: {
26
+ sep: string;
27
+ delimiter: string;
28
+ normalize: typeof normalize;
29
+ join: typeof join;
30
+ resolve: typeof resolve;
31
+ isAbsolute: typeof isAbsolute;
32
+ dirname: typeof dirname;
33
+ basename: typeof basename;
34
+ extname: typeof extname;
35
+ relative: typeof relative;
36
+ parse: typeof parse;
37
+ format: typeof format;
38
+ };
39
+ /** @note win32 uses posix implementation — Windows paths not supported in browser */
40
+ export declare const win32: {
41
+ sep: string;
42
+ delimiter: string;
43
+ normalize: typeof normalize;
44
+ join: typeof join;
45
+ resolve: typeof resolve;
46
+ isAbsolute: typeof isAbsolute;
47
+ dirname: typeof dirname;
48
+ basename: typeof basename;
49
+ extname: typeof extname;
50
+ relative: typeof relative;
51
+ parse: typeof parse;
52
+ format: typeof format;
53
+ };
54
+ declare const _default: {
55
+ sep: string;
56
+ delimiter: string;
57
+ normalize: typeof normalize;
58
+ join: typeof join;
59
+ resolve: typeof resolve;
60
+ isAbsolute: typeof isAbsolute;
61
+ dirname: typeof dirname;
62
+ basename: typeof basename;
63
+ extname: typeof extname;
64
+ relative: typeof relative;
65
+ parse: typeof parse;
66
+ format: typeof format;
67
+ posix: {
68
+ sep: string;
69
+ delimiter: string;
70
+ normalize: typeof normalize;
71
+ join: typeof join;
72
+ resolve: typeof resolve;
73
+ isAbsolute: typeof isAbsolute;
74
+ dirname: typeof dirname;
75
+ basename: typeof basename;
76
+ extname: typeof extname;
77
+ relative: typeof relative;
78
+ parse: typeof parse;
79
+ format: typeof format;
80
+ };
81
+ win32: {
82
+ sep: string;
83
+ delimiter: string;
84
+ normalize: typeof normalize;
85
+ join: typeof join;
86
+ resolve: typeof resolve;
87
+ isAbsolute: typeof isAbsolute;
88
+ dirname: typeof dirname;
89
+ basename: typeof basename;
90
+ extname: typeof extname;
91
+ relative: typeof relative;
92
+ parse: typeof parse;
93
+ format: typeof format;
94
+ };
95
+ };
96
+ export default _default;
@@ -0,0 +1,21 @@
1
+ export declare const performance: Performance;
2
+ export declare class PerformanceObserver {
3
+ private callback;
4
+ constructor(callback: (list: unknown) => void);
5
+ observe(_options?: unknown): void;
6
+ disconnect(): void;
7
+ }
8
+ export declare function monitorEventLoopDelay(_options?: unknown): {
9
+ enable(): void;
10
+ disable(): void;
11
+ min: number;
12
+ max: number;
13
+ mean: number;
14
+ percentile(p: number): number;
15
+ };
16
+ declare const _default: {
17
+ performance: Performance;
18
+ PerformanceObserver: typeof PerformanceObserver;
19
+ monitorEventLoopDelay: typeof monitorEventLoopDelay;
20
+ };
21
+ export default _default;
@@ -0,0 +1,99 @@
1
+ import { EventListener } from "./events";
2
+ export interface ProcessEnv {
3
+ [key: string]: string | undefined;
4
+ }
5
+ interface ProcessStream {
6
+ isTTY: boolean;
7
+ on: (event: string, listener: EventListener) => ProcessStream;
8
+ once: (event: string, listener: EventListener) => ProcessStream;
9
+ off: (event: string, listener: EventListener) => ProcessStream;
10
+ emit: (event: string, ...args: unknown[]) => boolean;
11
+ addListener: (event: string, listener: EventListener) => ProcessStream;
12
+ removeListener: (event: string, listener: EventListener) => ProcessStream;
13
+ removeAllListeners: (event?: string) => ProcessStream;
14
+ setMaxListeners: (n: number) => ProcessStream;
15
+ getMaxListeners: () => number;
16
+ listenerCount: (event: string) => number;
17
+ listeners: (event: string) => EventListener[];
18
+ rawListeners: (event: string) => EventListener[];
19
+ prependListener: (event: string, listener: EventListener) => ProcessStream;
20
+ prependOnceListener: (event: string, listener: EventListener) => ProcessStream;
21
+ eventNames: () => string[];
22
+ pause?: () => ProcessStream;
23
+ resume?: () => ProcessStream;
24
+ setEncoding?: (encoding: string) => ProcessStream;
25
+ }
26
+ interface ProcessWritableStream extends ProcessStream {
27
+ write: (data: string | Buffer, encoding?: string, callback?: () => void) => boolean;
28
+ end?: (data?: string, callback?: () => void) => void;
29
+ }
30
+ interface ProcessReadableStream extends ProcessStream {
31
+ read?: (size?: number) => string | Buffer | null;
32
+ setRawMode?: (mode: boolean) => ProcessReadableStream;
33
+ }
34
+ export interface Process {
35
+ env: ProcessEnv;
36
+ cwd: () => string;
37
+ chdir: (directory: string) => void;
38
+ platform: string;
39
+ arch: string;
40
+ version: string;
41
+ versions: {
42
+ node: string;
43
+ v8: string;
44
+ uv: string;
45
+ };
46
+ argv: string[];
47
+ argv0: string;
48
+ execPath: string;
49
+ execArgv: string[];
50
+ pid: number;
51
+ ppid: number;
52
+ exit: (code?: number) => never;
53
+ nextTick: (callback: (...args: unknown[]) => void, ...args: unknown[]) => void;
54
+ stdout: ProcessWritableStream;
55
+ stderr: ProcessWritableStream;
56
+ stdin: ProcessReadableStream;
57
+ hrtime: {
58
+ (time?: [number, number]): [number, number];
59
+ bigint: () => bigint;
60
+ };
61
+ memoryUsage: () => {
62
+ rss: number;
63
+ heapTotal: number;
64
+ heapUsed: number;
65
+ external: number;
66
+ arrayBuffers: number;
67
+ };
68
+ uptime: () => number;
69
+ cpuUsage: () => {
70
+ user: number;
71
+ system: number;
72
+ };
73
+ on: (event: string, listener: EventListener) => Process;
74
+ once: (event: string, listener: EventListener) => Process;
75
+ off: (event: string, listener: EventListener) => Process;
76
+ emit: (event: string, ...args: unknown[]) => boolean;
77
+ addListener: (event: string, listener: EventListener) => Process;
78
+ removeListener: (event: string, listener: EventListener) => Process;
79
+ removeAllListeners: (event?: string) => Process;
80
+ listeners: (event: string) => EventListener[];
81
+ listenerCount: (event: string) => number;
82
+ prependListener: (event: string, listener: EventListener) => Process;
83
+ prependOnceListener: (event: string, listener: EventListener) => Process;
84
+ eventNames: () => string[];
85
+ setMaxListeners: (n: number) => Process;
86
+ getMaxListeners: () => number;
87
+ send?: (message: unknown, callback?: (error: Error | null) => void) => boolean;
88
+ connected?: boolean;
89
+ _cwdCallCount?: number;
90
+ }
91
+ export declare function createProcess(options?: {
92
+ cwd?: string;
93
+ env?: ProcessEnv;
94
+ onExit?: (code: number) => void;
95
+ onStdout?: (data: string) => void;
96
+ onStderr?: (data: string) => void;
97
+ }): Process;
98
+ export declare const process: Process;
99
+ export default process;
@@ -0,0 +1,15 @@
1
+ export declare function stringify(obj: Record<string, unknown>, sep?: string, eq?: string): string;
2
+ export declare function parse(str: string, sep?: string, eq?: string): Record<string, string | string[]>;
3
+ export declare function escape(str: string): string;
4
+ export declare function unescape(str: string): string;
5
+ export declare function encode(obj: Record<string, unknown>, sep?: string, eq?: string): string;
6
+ export declare function decode(str: string, sep?: string, eq?: string): Record<string, string | string[]>;
7
+ declare const _default: {
8
+ stringify: typeof stringify;
9
+ parse: typeof parse;
10
+ escape: typeof escape;
11
+ unescape: typeof unescape;
12
+ encode: typeof encode;
13
+ decode: typeof decode;
14
+ };
15
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import type { MemFS } from "../memfs";
2
+ export declare function initReaddirp(vfs: MemFS): void;
3
+ export interface ReaddirpEntry {
4
+ path: string;
5
+ fullPath: string;
6
+ basename: string;
7
+ dirent: {
8
+ isFile(): boolean;
9
+ isDirectory(): boolean;
10
+ };
11
+ }
12
+ export default function readdirp(root: string, options?: {
13
+ fileFilter?: string | string[];
14
+ directoryFilter?: string | string[];
15
+ depth?: number;
16
+ }): AsyncIterable<ReaddirpEntry> & {
17
+ [Symbol.asyncIterator](): AsyncIterableIterator<ReaddirpEntry>;
18
+ };
@@ -0,0 +1,32 @@
1
+ import { EventEmitter } from "./events";
2
+ export declare class Interface extends EventEmitter {
3
+ private _input;
4
+ private _output;
5
+ terminal: boolean;
6
+ constructor(options?: {
7
+ input?: unknown;
8
+ output?: unknown;
9
+ terminal?: boolean;
10
+ });
11
+ question(query: string, cb: (answer: string) => void): void;
12
+ close(): void;
13
+ pause(): this;
14
+ resume(): this;
15
+ prompt(_preserveCursor?: boolean): void;
16
+ setPrompt(_prompt: string): void;
17
+ write(_data: string): void;
18
+ }
19
+ export declare function createInterface(options?: unknown): Interface;
20
+ export declare function clearLine(_stream: unknown, _dir: number, _cb?: () => void): boolean;
21
+ export declare function clearScreenDown(_stream: unknown, _cb?: () => void): boolean;
22
+ export declare function cursorTo(_stream: unknown, _x: number, _y?: number, _cb?: () => void): boolean;
23
+ export declare function moveCursor(_stream: unknown, _dx: number, _dy: number, _cb?: () => void): boolean;
24
+ declare const _default: {
25
+ Interface: typeof Interface;
26
+ createInterface: typeof createInterface;
27
+ clearLine: typeof clearLine;
28
+ clearScreenDown: typeof clearScreenDown;
29
+ cursorTo: typeof cursorTo;
30
+ moveCursor: typeof moveCursor;
31
+ };
32
+ export default _default;