typescript-virtual-container 1.5.8 → 1.5.10
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/README.md +39 -29
- package/dist/.tsbuildinfo +1 -1
- package/dist/SSHMimic/executor.js +9 -0
- package/dist/SSHMimic/prompt.js +2 -2
- package/dist/VirtualShell/shell.js +48 -1
- package/dist/VirtualShell/shellParser.js +35 -3
- package/dist/VirtualUserManager/index.d.ts +26 -0
- package/dist/VirtualUserManager/index.js +26 -0
- package/dist/commands/coreutils.d.ts +55 -0
- package/dist/commands/coreutils.js +271 -0
- package/dist/commands/htop.d.ts +2 -2
- package/dist/commands/htop.js +143 -8
- package/dist/commands/manuals-bundle.js +227 -0
- package/dist/commands/pacman.d.ts +8 -0
- package/dist/commands/pacman.js +15 -0
- package/dist/commands/ps.js +22 -8
- package/dist/commands/registry.js +13 -0
- package/dist/commands/runtime.js +42 -2
- package/dist/commands/sh.js +10 -3
- package/dist/index.d.ts +1 -1
- package/dist/modules/linuxRootfs.js +4 -4
- package/dist/modules/nanoEditor.d.ts +1 -1
- package/dist/modules/nanoEditor.js +22 -4
- package/dist/modules/pacmanGame.d.ts +59 -0
- package/dist/modules/pacmanGame.js +655 -0
- package/dist/modules/webTermRenderer.d.ts +8 -0
- package/dist/modules/webTermRenderer.js +163 -29
- package/dist/types/commands.d.ts +2 -0
- package/dist/types/pipeline.d.ts +2 -0
- package/package.json +2 -2
|
@@ -60,9 +60,9 @@ function bootstrapEtc(vfs, hostname, props) {
|
|
|
60
60
|
ensureFile(vfs, "/etc/profile", `${[
|
|
61
61
|
"export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
62
62
|
"if [ \"$(id -u)\" -eq 0 ]; then",
|
|
63
|
-
" export PS1='\\[\\e[37;1m\\][\\[\\e[31;1m\\]\\u\\[\\e[37;1m\\]@\\[\\e[34;1m\\]\\h\\[\\e[0m\\] \\w
|
|
63
|
+
" export PS1='\\[\\e[37;1m\\][\\[\\e[31;1m\\]\\u\\[\\e[37;1m\\]@\\[\\e[34;1m\\]\\h\\[\\e[0m\\] \\w]\\[\\e[31;1m\\]\\$\\[\\e[0m\\] '",
|
|
64
64
|
"else",
|
|
65
|
-
" export PS1='\\[\\e[37;1m\\][\\[\\e[35;1m\\]\\u\\[\\e[37;1m\\]@\\[\\e[34;1m\\]\\h\\[\\e[0m\\] \\w
|
|
65
|
+
" export PS1='\\[\\e[37;1m\\][\\[\\e[35;1m\\]\\u\\[\\e[37;1m\\]@\\[\\e[34;1m\\]\\h\\[\\e[0m\\] \\w]\\[\\e[0m\\]\\$ '",
|
|
66
66
|
"fi",
|
|
67
67
|
].join("\n")}\n`);
|
|
68
68
|
ensureFile(vfs, "/etc/issue", "Fortune GNU/Linux 24.04 LTS \\n \\l\n");
|
|
@@ -1285,7 +1285,7 @@ Installed-Size: 6800
|
|
|
1285
1285
|
Maintainer: Fortune Package Team <dpkg@fortune.local>
|
|
1286
1286
|
Architecture: amd64
|
|
1287
1287
|
Version: 1.22.6nyx1
|
|
1288
|
-
Depends: libc6 (>= 2.17), libzstd1 (>= 1.5.
|
|
1288
|
+
Depends: libc6 (>= 2.17), libzstd1 (>= 1.5.9)
|
|
1289
1289
|
Description: Fortune package management system
|
|
1290
1290
|
This package provides the low-level infrastructure for handling the
|
|
1291
1291
|
installation and removal of Fortune software packages.
|
|
@@ -1453,7 +1453,7 @@ function bootstrapRoot(vfs) {
|
|
|
1453
1453
|
ensureDir(vfs, "/root/.local/share", 0o755);
|
|
1454
1454
|
ensureFile(vfs, "/root/.bashrc", `${[
|
|
1455
1455
|
"# root .bashrc",
|
|
1456
|
-
"export PS1='\\[\\e[37;1m\\][\\[\\e[31;1m\\]\\u\\[\\e[37;1m\\]@\\[\\e[34;1m\\]\\h\\[\\e[0m\\] \\w
|
|
1456
|
+
"export PS1='\\[\\e[37;1m\\][\\[\\e[31;1m\\]\\u\\[\\e[37;1m\\]@\\[\\e[34;1m\\]\\h\\[\\e[0m\\] \\w]\\[\\e[31;1m\\]\\$\\[\\e[0m\\] '",
|
|
1457
1457
|
"export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
1458
1458
|
"export LANG=en_US.UTF-8",
|
|
1459
1459
|
"alias ll='ls -la'",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TerminalSize } from "./shellRuntime";
|
|
2
1
|
import type { ShellStream } from "../types/streams";
|
|
2
|
+
import type { TerminalSize } from "./shellRuntime";
|
|
3
3
|
export type NanoExitReason = "saved" | "aborted";
|
|
4
4
|
export interface NanoEditorOptions {
|
|
5
5
|
stream: ShellStream;
|
|
@@ -444,8 +444,14 @@ export class NanoEditor {
|
|
|
444
444
|
moveCursor(dRow, _dCol) {
|
|
445
445
|
this.cursorRow = Math.max(0, Math.min(this.lines.length - 1, this.cursorRow + dRow));
|
|
446
446
|
this.cursorCol = Math.min(this.cursorCol, this.currentLine().length);
|
|
447
|
+
const prevScrollTop = this.scrollTop;
|
|
447
448
|
this.clampScroll();
|
|
448
|
-
this.
|
|
449
|
+
if (this.scrollTop !== prevScrollTop) {
|
|
450
|
+
this.renderEditArea();
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
this.renderCursor();
|
|
454
|
+
}
|
|
449
455
|
}
|
|
450
456
|
moveCursorLeft() {
|
|
451
457
|
if (this.cursorCol > 0) {
|
|
@@ -455,8 +461,14 @@ export class NanoEditor {
|
|
|
455
461
|
this.cursorRow--;
|
|
456
462
|
this.cursorCol = this.currentLine().length;
|
|
457
463
|
}
|
|
464
|
+
const prevScrollTop = this.scrollTop;
|
|
458
465
|
this.clampScroll();
|
|
459
|
-
this.
|
|
466
|
+
if (this.scrollTop !== prevScrollTop) {
|
|
467
|
+
this.renderEditArea();
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
this.renderCursor();
|
|
471
|
+
}
|
|
460
472
|
}
|
|
461
473
|
moveCursorRight() {
|
|
462
474
|
const line = this.currentLine();
|
|
@@ -467,8 +479,14 @@ export class NanoEditor {
|
|
|
467
479
|
this.cursorRow++;
|
|
468
480
|
this.cursorCol = 0;
|
|
469
481
|
}
|
|
482
|
+
const prevScrollTop = this.scrollTop;
|
|
470
483
|
this.clampScroll();
|
|
471
|
-
this.
|
|
484
|
+
if (this.scrollTop !== prevScrollTop) {
|
|
485
|
+
this.renderEditArea();
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
this.renderCursor();
|
|
489
|
+
}
|
|
472
490
|
}
|
|
473
491
|
moveCursorHome() {
|
|
474
492
|
this.cursorCol = 0;
|
|
@@ -483,7 +501,7 @@ export class NanoEditor {
|
|
|
483
501
|
this.cursorRow = Math.max(0, Math.min(this.lines.length - 1, this.cursorRow + dir * editRows));
|
|
484
502
|
this.cursorCol = Math.min(this.cursorCol, this.currentLine().length);
|
|
485
503
|
this.clampScroll();
|
|
486
|
-
this.
|
|
504
|
+
this.renderEditArea();
|
|
487
505
|
}
|
|
488
506
|
moveWordRight() {
|
|
489
507
|
const line = this.currentLine();
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ShellStream } from "../types/streams";
|
|
2
|
+
import type { TerminalSize } from "./shellRuntime";
|
|
3
|
+
export interface PacmanGameOptions {
|
|
4
|
+
stream: ShellStream;
|
|
5
|
+
terminalSize: TerminalSize;
|
|
6
|
+
onExit: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare class PacmanGame {
|
|
9
|
+
private stream;
|
|
10
|
+
private onExit;
|
|
11
|
+
private grid;
|
|
12
|
+
private visualGrid;
|
|
13
|
+
private pacR;
|
|
14
|
+
private pacC;
|
|
15
|
+
private pacDir;
|
|
16
|
+
private pacNextDir;
|
|
17
|
+
private pacMouthOpen;
|
|
18
|
+
private pacAlive;
|
|
19
|
+
private ghosts;
|
|
20
|
+
private score;
|
|
21
|
+
private lives;
|
|
22
|
+
private level;
|
|
23
|
+
private dotsTotal;
|
|
24
|
+
private dotsEaten;
|
|
25
|
+
private frightDuration;
|
|
26
|
+
private gameOver;
|
|
27
|
+
private won;
|
|
28
|
+
private msgTicks;
|
|
29
|
+
private msg;
|
|
30
|
+
private globalMode;
|
|
31
|
+
private globalModeTick;
|
|
32
|
+
private readonly modeSchedule;
|
|
33
|
+
private modeIdx;
|
|
34
|
+
private tick;
|
|
35
|
+
private intervalId;
|
|
36
|
+
private inputKey;
|
|
37
|
+
private escBuf;
|
|
38
|
+
private deathTick;
|
|
39
|
+
private deathAnimating;
|
|
40
|
+
private prevLines;
|
|
41
|
+
constructor(opts: PacmanGameOptions);
|
|
42
|
+
private countDots;
|
|
43
|
+
private initGhosts;
|
|
44
|
+
start(): void;
|
|
45
|
+
stop(): void;
|
|
46
|
+
handleInput(chunk: Buffer): void;
|
|
47
|
+
private gameTick;
|
|
48
|
+
private isWalkable;
|
|
49
|
+
private movePacman;
|
|
50
|
+
private activateFright;
|
|
51
|
+
private ghostTarget;
|
|
52
|
+
private moveGhost;
|
|
53
|
+
private checkCollisions;
|
|
54
|
+
private tickFrightCountdowns;
|
|
55
|
+
private respawn;
|
|
56
|
+
private buildLines;
|
|
57
|
+
private renderFull;
|
|
58
|
+
private renderDiff;
|
|
59
|
+
}
|