@scelar/nodepod 1.0.2 → 1.0.4
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 +642 -642
- package/dist/__tests__/bench/integration.bench.d.ts +1 -0
- package/dist/__tests__/bench/memory-volume.bench.d.ts +1 -0
- package/dist/__tests__/bench/polyfills.bench.d.ts +1 -0
- package/dist/__tests__/bench/script-engine.bench.d.ts +1 -0
- package/dist/__tests__/bench/shell.bench.d.ts +1 -0
- package/dist/__tests__/bench/syntax-transforms.bench.d.ts +1 -0
- package/dist/__tests__/bench/version-resolver.bench.d.ts +1 -0
- package/dist/__tests__/buffer.test.d.ts +1 -0
- package/dist/__tests__/byte-encoding.test.d.ts +1 -0
- package/dist/__tests__/digest.test.d.ts +1 -0
- package/dist/__tests__/events.test.d.ts +1 -0
- package/dist/__tests__/memory-volume.test.d.ts +1 -0
- package/dist/__tests__/path.test.d.ts +1 -0
- package/dist/__tests__/process.test.d.ts +1 -0
- package/dist/__tests__/script-engine.test.d.ts +1 -0
- package/dist/__tests__/shell-builtins.test.d.ts +1 -0
- package/dist/__tests__/shell-interpreter.test.d.ts +1 -0
- package/dist/__tests__/shell-parser.test.d.ts +1 -0
- package/dist/__tests__/stream.test.d.ts +1 -0
- package/dist/__tests__/syntax-transforms.test.d.ts +1 -0
- package/dist/__tests__/version-resolver.test.d.ts +1 -0
- package/dist/{child_process-Dopvyd-E.js → child_process-53fMkug_.js} +4 -4
- package/dist/child_process-53fMkug_.js.map +1 -0
- package/dist/{child_process-B38qoN6R.cjs → child_process-lxSKECHq.cjs} +5 -5
- package/dist/child_process-lxSKECHq.cjs.map +1 -0
- package/dist/{index--Qr8LVpQ.js → index-B8lyh_ti.js} +1316 -559
- package/dist/index-B8lyh_ti.js.map +1 -0
- package/dist/{index-cnitc68U.cjs → index-C-TQIrdG.cjs} +1422 -612
- package/dist/index-C-TQIrdG.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/memory-volume.d.ts +1 -1
- package/dist/polyfills/wasi.d.ts +45 -4
- package/dist/script-engine.d.ts +2 -0
- package/dist/sdk/nodepod.d.ts +4 -3
- package/dist/sdk/types.d.ts +6 -0
- package/dist/syntax-transforms.d.ts +1 -0
- package/dist/threading/process-manager.d.ts +1 -1
- package/dist/threading/worker-protocol.d.ts +1 -1
- package/package.json +5 -3
- package/src/__tests__/bench/integration.bench.ts +117 -0
- package/src/__tests__/bench/memory-volume.bench.ts +115 -0
- package/src/__tests__/bench/polyfills.bench.ts +147 -0
- package/src/__tests__/bench/script-engine.bench.ts +104 -0
- package/src/__tests__/bench/shell.bench.ts +101 -0
- package/src/__tests__/bench/syntax-transforms.bench.ts +82 -0
- package/src/__tests__/bench/version-resolver.bench.ts +95 -0
- package/src/__tests__/buffer.test.ts +273 -0
- package/src/__tests__/byte-encoding.test.ts +98 -0
- package/src/__tests__/digest.test.ts +44 -0
- package/src/__tests__/events.test.ts +245 -0
- package/src/__tests__/memory-volume.test.ts +443 -0
- package/src/__tests__/path.test.ts +181 -0
- package/src/__tests__/process.test.ts +129 -0
- package/src/__tests__/script-engine.test.ts +229 -0
- package/src/__tests__/shell-builtins.test.ts +357 -0
- package/src/__tests__/shell-interpreter.test.ts +157 -0
- package/src/__tests__/shell-parser.test.ts +204 -0
- package/src/__tests__/stream.test.ts +142 -0
- package/src/__tests__/syntax-transforms.test.ts +158 -0
- package/src/__tests__/version-resolver.test.ts +184 -0
- package/src/constants/cdn-urls.ts +18 -18
- package/src/helpers/byte-encoding.ts +51 -39
- package/src/index.ts +192 -192
- package/src/memory-volume.ts +968 -941
- package/src/module-transformer.ts +368 -368
- package/src/packages/installer.ts +396 -396
- package/src/packages/version-resolver.ts +12 -2
- package/src/polyfills/buffer.ts +633 -628
- package/src/polyfills/child_process.ts +2288 -2288
- package/src/polyfills/esbuild.ts +854 -854
- package/src/polyfills/events.ts +282 -276
- package/src/polyfills/fs.ts +2888 -2888
- package/src/polyfills/http.ts +1450 -1449
- package/src/polyfills/process.ts +721 -690
- package/src/polyfills/readline.ts +692 -692
- package/src/polyfills/stream.ts +1620 -1620
- package/src/polyfills/tty.ts +71 -71
- package/src/polyfills/wasi.ts +1284 -22
- package/src/request-proxy.ts +716 -716
- package/src/script-engine.ts +465 -146
- package/src/sdk/nodepod.ts +525 -509
- package/src/sdk/types.ts +7 -0
- package/src/syntax-transforms.ts +543 -561
- package/src/threading/offload-worker.ts +383 -383
- package/src/threading/offload.ts +271 -271
- package/src/threading/process-manager.ts +956 -956
- package/src/threading/process-worker-entry.ts +858 -854
- package/src/threading/worker-protocol.ts +1 -1
- package/dist/child_process-B38qoN6R.cjs.map +0 -1
- package/dist/child_process-Dopvyd-E.js.map +0 -1
- package/dist/index--Qr8LVpQ.js.map +0 -1
- package/dist/index-cnitc68U.cjs.map +0 -1
package/src/polyfills/tty.ts
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
// TTY polyfill - always reports non-TTY in browser
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// always false in browser
|
|
5
|
-
export function isatty(_fd: number): boolean {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ReadStream {
|
|
10
|
-
isTTY: boolean;
|
|
11
|
-
isRaw: boolean;
|
|
12
|
-
setRawMode(_mode: boolean): this;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const ReadStream = function ReadStream(this: any) {
|
|
16
|
-
if (!this) return;
|
|
17
|
-
this.isTTY = false;
|
|
18
|
-
this.isRaw = false;
|
|
19
|
-
} as unknown as { new(): ReadStream; prototype: any };
|
|
20
|
-
|
|
21
|
-
ReadStream.prototype.setRawMode = function setRawMode(_mode: boolean) {
|
|
22
|
-
this.isRaw = _mode;
|
|
23
|
-
return this;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export interface WriteStream {
|
|
27
|
-
isTTY: boolean;
|
|
28
|
-
columns: number;
|
|
29
|
-
rows: number;
|
|
30
|
-
getColorDepth(): number;
|
|
31
|
-
hasColors(count?: number): boolean;
|
|
32
|
-
getWindowSize(): [number, number];
|
|
33
|
-
clearLine(_dir: number, _cb?: () => void): boolean;
|
|
34
|
-
clearScreenDown(_cb?: () => void): boolean;
|
|
35
|
-
cursorTo(_x: number, _y?: number | (() => void), _cb?: () => void): boolean;
|
|
36
|
-
moveCursor(_dx: number, _dy: number, _cb?: () => void): boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const WriteStream = function WriteStream(this: any) {
|
|
40
|
-
if (!this) return;
|
|
41
|
-
this.isTTY = false;
|
|
42
|
-
this.columns = 120;
|
|
43
|
-
this.rows = 40;
|
|
44
|
-
} as unknown as { new(): WriteStream; prototype: any };
|
|
45
|
-
|
|
46
|
-
WriteStream.prototype.getColorDepth = function getColorDepth(): number { return 8; };
|
|
47
|
-
WriteStream.prototype.hasColors = function hasColors(count?: number): boolean {
|
|
48
|
-
return (count ?? 1) <= 256;
|
|
49
|
-
};
|
|
50
|
-
WriteStream.prototype.getWindowSize = function getWindowSize(): [number, number] {
|
|
51
|
-
return [this.columns, this.rows];
|
|
52
|
-
};
|
|
53
|
-
WriteStream.prototype.clearLine = function clearLine(_dir: number, _cb?: () => void): boolean {
|
|
54
|
-
_cb?.();
|
|
55
|
-
return true;
|
|
56
|
-
};
|
|
57
|
-
WriteStream.prototype.clearScreenDown = function clearScreenDown(_cb?: () => void): boolean {
|
|
58
|
-
_cb?.();
|
|
59
|
-
return true;
|
|
60
|
-
};
|
|
61
|
-
WriteStream.prototype.cursorTo = function cursorTo(_x: number, _y?: number | (() => void), _cb?: () => void): boolean {
|
|
62
|
-
if (typeof _y === "function") _y();
|
|
63
|
-
else _cb?.();
|
|
64
|
-
return true;
|
|
65
|
-
};
|
|
66
|
-
WriteStream.prototype.moveCursor = function moveCursor(_dx: number, _dy: number, _cb?: () => void): boolean {
|
|
67
|
-
_cb?.();
|
|
68
|
-
return true;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export default { isatty, ReadStream, WriteStream };
|
|
1
|
+
// TTY polyfill - always reports non-TTY in browser
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// always false in browser
|
|
5
|
+
export function isatty(_fd: number): boolean {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ReadStream {
|
|
10
|
+
isTTY: boolean;
|
|
11
|
+
isRaw: boolean;
|
|
12
|
+
setRawMode(_mode: boolean): this;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ReadStream = function ReadStream(this: any) {
|
|
16
|
+
if (!this) return;
|
|
17
|
+
this.isTTY = false;
|
|
18
|
+
this.isRaw = false;
|
|
19
|
+
} as unknown as { new(): ReadStream; prototype: any };
|
|
20
|
+
|
|
21
|
+
ReadStream.prototype.setRawMode = function setRawMode(_mode: boolean) {
|
|
22
|
+
this.isRaw = _mode;
|
|
23
|
+
return this;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export interface WriteStream {
|
|
27
|
+
isTTY: boolean;
|
|
28
|
+
columns: number;
|
|
29
|
+
rows: number;
|
|
30
|
+
getColorDepth(): number;
|
|
31
|
+
hasColors(count?: number): boolean;
|
|
32
|
+
getWindowSize(): [number, number];
|
|
33
|
+
clearLine(_dir: number, _cb?: () => void): boolean;
|
|
34
|
+
clearScreenDown(_cb?: () => void): boolean;
|
|
35
|
+
cursorTo(_x: number, _y?: number | (() => void), _cb?: () => void): boolean;
|
|
36
|
+
moveCursor(_dx: number, _dy: number, _cb?: () => void): boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const WriteStream = function WriteStream(this: any) {
|
|
40
|
+
if (!this) return;
|
|
41
|
+
this.isTTY = false;
|
|
42
|
+
this.columns = 120;
|
|
43
|
+
this.rows = 40;
|
|
44
|
+
} as unknown as { new(): WriteStream; prototype: any };
|
|
45
|
+
|
|
46
|
+
WriteStream.prototype.getColorDepth = function getColorDepth(): number { return 8; };
|
|
47
|
+
WriteStream.prototype.hasColors = function hasColors(count?: number): boolean {
|
|
48
|
+
return (count ?? 1) <= 256;
|
|
49
|
+
};
|
|
50
|
+
WriteStream.prototype.getWindowSize = function getWindowSize(): [number, number] {
|
|
51
|
+
return [this.columns, this.rows];
|
|
52
|
+
};
|
|
53
|
+
WriteStream.prototype.clearLine = function clearLine(_dir: number, _cb?: () => void): boolean {
|
|
54
|
+
_cb?.();
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
WriteStream.prototype.clearScreenDown = function clearScreenDown(_cb?: () => void): boolean {
|
|
58
|
+
_cb?.();
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
61
|
+
WriteStream.prototype.cursorTo = function cursorTo(_x: number, _y?: number | (() => void), _cb?: () => void): boolean {
|
|
62
|
+
if (typeof _y === "function") _y();
|
|
63
|
+
else _cb?.();
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
WriteStream.prototype.moveCursor = function moveCursor(_dx: number, _dy: number, _cb?: () => void): boolean {
|
|
67
|
+
_cb?.();
|
|
68
|
+
return true;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default { isatty, ReadStream, WriteStream };
|