brsh 2.8.1 → 3.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.
- package/.github/workflows/release.yml +3 -1
- package/CHANGELOG.md +32 -0
- package/POSIX-CHECKLIST.md +3 -3
- package/Readme.md +138 -223
- package/bin/Readme.md +70 -24
- package/bin/brsh-shell.js +16 -131
- package/bin/exportFileSystem.js +4 -0
- package/bin/zsh-server.js +261 -0
- package/dist/brsh.css +1 -1
- package/dist/shell.es.js +1020 -648
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +34 -19
- package/dist/shell.min.js.map +1 -1
- package/dist/terminal.cjs.js +77 -100
- package/dist/terminal.cjs.js.map +1 -1
- package/dist/terminal.es.js +1382 -603
- package/dist/terminal.es.js.map +1 -1
- package/dist/terminal.min.js +77 -100
- package/dist/terminal.min.js.map +1 -1
- package/dist/wbt.es.js +410 -238
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +10 -8
- package/dist/wbt.min.js.map +1 -1
- package/index.js +472 -0
- package/lib/Command.js +30 -0
- package/lib/InteractiveCommand.js +28 -0
- package/lib/Readme.md +111 -12
- package/lib/ReplCommand.js +15 -0
- package/lib/Terminal.js +769 -510
- package/lib/TtyStream.js +181 -0
- package/lib/WasmCommand.js +26 -5
- package/lib/builtins/cat.js +2 -2
- package/lib/builtins/grep.js +2 -2
- package/lib/local/clear.js +3 -0
- package/lib/terminal/DomRenderer.js +325 -0
- package/lib/terminal/PtyBridge.js +169 -0
- package/lib/terminal/ScreenBuffer.js +594 -0
- package/lib/terminal/VtParser.js +728 -0
- package/lib/wbt/index.js +3 -2
- package/lib/wbt/registry.js +15 -1
- package/package.json +4 -2
- package/styles/terminal.css +33 -4
- package/test/terminal.test.js +762 -40
- package/test/wbt.test.js +92 -0
package/lib/wbt/index.js
CHANGED
|
@@ -122,7 +122,7 @@ class Wbt extends LocalCommand {
|
|
|
122
122
|
_buildCommandsForPackage(pkgMeta) {
|
|
123
123
|
const cfg = this.constructor._config || {};
|
|
124
124
|
|
|
125
|
-
if (pkgMeta.type === 'custom-wasm' && pkgMeta.wasmPath) {
|
|
125
|
+
if ((pkgMeta.type === 'custom-wasm' || pkgMeta.type === 'wasm') && pkgMeta.wasmPath) {
|
|
126
126
|
const binName = (pkgMeta.bin || pkgMeta.name).toLowerCase();
|
|
127
127
|
return [{ bin: binName, Cmd: createCustomWasmBinCommand(binName, pkgMeta.wasmPath, pkgMeta) }];
|
|
128
128
|
}
|
|
@@ -1000,7 +1000,8 @@ class Wbt extends LocalCommand {
|
|
|
1000
1000
|
' wabt WebAssembly Binary Toolkit (wat2wasm, wasm2wat)',
|
|
1001
1001
|
' quickjs Sandboxed QuickJS JavaScript engine (qjs)',
|
|
1002
1002
|
' lua Lua 5.4 WebAssembly interpreter (lua)',
|
|
1003
|
-
' wllama WASM & WebGPU LLM inference engine (wllama, llama, llama-cli)'
|
|
1003
|
+
' wllama WASM & WebGPU LLM inference engine (wllama, llama, llama-cli)',
|
|
1004
|
+
' nano GNU nano 8.0 text editor with ncurses (nano, nano-wasm)'
|
|
1004
1005
|
].forEach(l => { this.stdOut = l; });
|
|
1005
1006
|
}
|
|
1006
1007
|
}
|
package/lib/wbt/registry.js
CHANGED
|
@@ -166,6 +166,19 @@ const DEFAULT_REGISTRY = {
|
|
|
166
166
|
type: 'builtin-adapter',
|
|
167
167
|
adapter: 'wllama',
|
|
168
168
|
size: '8.8 MB'
|
|
169
|
+
},
|
|
170
|
+
nano: {
|
|
171
|
+
name: 'nano',
|
|
172
|
+
bin: 'nano',
|
|
173
|
+
aliases: ['nano-wasm'],
|
|
174
|
+
version: '8.0.0',
|
|
175
|
+
description: 'GNU nano 8.0 text editor compiled to WebAssembly (wasm32-wasip1) with ncurses',
|
|
176
|
+
details: 'GNU nano is a small, user-friendly command-line text editor compiled to WebAssembly with wide-character ncurses 6.5, built-in terminfo fallbacks (xterm-256color, vt100, etc.), dynamic terminal dimensions (TIOCGWINSZ / LINES & COLUMNS), and zero custom imports (standard wasi_snapshot_preview1).',
|
|
177
|
+
homepage: 'https://github.com/eliotstocker/nano-wasm',
|
|
178
|
+
cdnUrl: 'https://cdn.jsdelivr.net/gh/eliotstocker/nano-wasm@main/dist/nano.wasm',
|
|
179
|
+
wasmUrl: 'https://cdn.jsdelivr.net/gh/eliotstocker/nano-wasm@main/dist/nano.wasm',
|
|
180
|
+
type: 'custom-wasm',
|
|
181
|
+
size: '574 KB'
|
|
169
182
|
}
|
|
170
183
|
};
|
|
171
184
|
|
|
@@ -186,7 +199,8 @@ const PACKAGE_ALIASES = {
|
|
|
186
199
|
llama: 'wllama',
|
|
187
200
|
'llama-cli': 'wllama',
|
|
188
201
|
'llama.cpp': 'wllama',
|
|
189
|
-
'@wllama/wllama': 'wllama'
|
|
202
|
+
'@wllama/wllama': 'wllama',
|
|
203
|
+
'nano-wasm': 'nano'
|
|
190
204
|
};
|
|
191
205
|
|
|
192
206
|
function resolvePackageName(name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brsh",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A unix like shell written in javascript",
|
|
5
5
|
"main": "./dist/shell.min.js",
|
|
6
6
|
"module": "./dist/shell.es.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"build:wbt": "vite build --config vite.config.wbt.js",
|
|
36
36
|
"shell": "node bin/brsh-shell.js",
|
|
37
37
|
"demo:shell": "node bin/brsh-shell.js --demo",
|
|
38
|
+
"demo:zsh": "npm run build:terminal && node bin/zsh-server.js",
|
|
38
39
|
"pretest": "npm run build",
|
|
39
40
|
"test": "vitest run",
|
|
40
41
|
"test:watch": "vitest",
|
|
@@ -57,11 +58,12 @@
|
|
|
57
58
|
"vitest": "^4.1.5"
|
|
58
59
|
},
|
|
59
60
|
"dependencies": {
|
|
60
|
-
"ansi_up": "git+https://github.com/eliotstocker/ansi_up.git",
|
|
61
61
|
"ansi-colors": "^4.1.3",
|
|
62
62
|
"command-line-args": "^6.0.1",
|
|
63
|
+
"esbuild": "^0.28.2",
|
|
63
64
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
64
65
|
"string.prototype.matchall": "^4.0.12",
|
|
66
|
+
"supports-color": "^7.2.0",
|
|
65
67
|
"through2": "^4.0.2",
|
|
66
68
|
"tmp": "^0.2.5"
|
|
67
69
|
}
|
package/styles/terminal.css
CHANGED
|
@@ -22,15 +22,33 @@
|
|
|
22
22
|
line-height: 1.15em;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
.terminal__cursor.block,
|
|
25
26
|
.terminal__cursor.blink {
|
|
26
|
-
|
|
27
|
+
background-color: currentColor;
|
|
28
|
+
-webkit-text-fill-color: rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b));
|
|
29
|
+
color: rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b));
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
.terminal__cursor.
|
|
32
|
+
.terminal__cursor.blink {
|
|
33
|
+
animation: 1s blink step-end infinite;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.terminal__inverse {
|
|
30
37
|
background-color: currentColor;
|
|
38
|
+
-webkit-text-fill-color: rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b));
|
|
31
39
|
color: rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b));
|
|
32
40
|
}
|
|
33
41
|
|
|
42
|
+
.terminal__blink {
|
|
43
|
+
animation: 1s blink-text step-end infinite;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.terminal__link {
|
|
47
|
+
color: inherit;
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
.terminal__line {
|
|
35
53
|
white-space: pre;
|
|
36
54
|
overflow: hidden;
|
|
@@ -45,13 +63,24 @@
|
|
|
45
63
|
}
|
|
46
64
|
|
|
47
65
|
@keyframes blink {
|
|
48
|
-
from,
|
|
66
|
+
from, 49.9% {
|
|
49
67
|
background-color: currentColor;
|
|
50
68
|
-webkit-text-fill-color: rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b));
|
|
69
|
+
color: rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b));
|
|
51
70
|
}
|
|
52
|
-
50
|
|
71
|
+
50%, to {
|
|
53
72
|
background-color: transparent;
|
|
54
73
|
-webkit-text-fill-color: unset;
|
|
74
|
+
color: inherit;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes blink-text {
|
|
79
|
+
from, 49.9% {
|
|
80
|
+
opacity: 1;
|
|
81
|
+
}
|
|
82
|
+
50%, to {
|
|
83
|
+
opacity: 0;
|
|
55
84
|
}
|
|
56
85
|
}
|
|
57
86
|
|