brsh 3.10.3 → 3.10.5
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/CHANGELOG.md +14 -0
- package/dist/wbt.es.js +65 -33
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +19 -5
- package/dist/wbt.min.js.map +1 -1
- package/lib/wbt/index.js +21 -9
- package/lib/wbt/packages/wllama.js +13 -14
- package/lib/wbt/registry.js +18 -1
- package/package.json +1 -1
- package/test/wbt.test.js +99 -4
package/lib/wbt/index.js
CHANGED
|
@@ -6,6 +6,9 @@ const WasmCommand = require('../WasmCommand');
|
|
|
6
6
|
const ReplCommand = require('../ReplCommand');
|
|
7
7
|
const { DEFAULT_REGISTRY, resolvePackageName } = require('./registry');
|
|
8
8
|
const wllamaAdapter = require('./packages/wllama');
|
|
9
|
+
if (typeof globalThis !== 'undefined') {
|
|
10
|
+
globalThis.__brshWllamaAdapter = wllamaAdapter;
|
|
11
|
+
}
|
|
9
12
|
const { writeBytesToFs, createGenericWasmCommand } = WasmCommand;
|
|
10
13
|
const { createReplWasmCommand } = ReplCommand;
|
|
11
14
|
|
|
@@ -23,7 +26,7 @@ function createCustomWasmBinCommand(binName, wasmPath, pkgMeta = {}) {
|
|
|
23
26
|
const isHelpOrVersion = (this.arguments || []).some(a => a === '--help' || a === '-h' || a === '--version' || a === '-V' || a === '-v');
|
|
24
27
|
if (isHelpOrVersion) return false;
|
|
25
28
|
if (this._isInteractive !== undefined) return Boolean(this._isInteractive);
|
|
26
|
-
return Boolean(pkgMeta.interactive || binName === 'nano');
|
|
29
|
+
return Boolean(pkgMeta.interactive || binName === 'nano' || binName === 'pico' || binName === 'vim' || binName === 'vi');
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
get captureInput() {
|
|
@@ -258,18 +261,27 @@ class Wbt extends Command {
|
|
|
258
261
|
|
|
259
262
|
_generateJsCommandSource(pkgMeta, binName) {
|
|
260
263
|
if (pkgMeta.adapter === 'wllama' || pkgMeta.name === 'wllama') {
|
|
261
|
-
const wllamaPath =
|
|
264
|
+
const wllamaPath = typeof __dirname !== 'undefined'
|
|
265
|
+
? path.resolve(__dirname, 'packages/wllama.js')
|
|
266
|
+
: null;
|
|
262
267
|
return `'use strict';\n` +
|
|
263
268
|
`let wllamaModule;\n` +
|
|
264
|
-
`
|
|
265
|
-
` wllamaModule = require(${JSON.stringify(wllamaPath)});\n` +
|
|
266
|
-
`
|
|
267
|
-
`
|
|
268
|
-
`
|
|
269
|
-
`
|
|
270
|
-
`
|
|
269
|
+
`if (typeof require === 'function') {\n` +
|
|
270
|
+
(wllamaPath ? ` try {\n wllamaModule = require(${JSON.stringify(wllamaPath)});\n } catch (_) {}\n` : '') +
|
|
271
|
+
` if (!wllamaModule) {\n` +
|
|
272
|
+
` try {\n` +
|
|
273
|
+
` wllamaModule = require('brsh/wbt/packages/wllama');\n` +
|
|
274
|
+
` } catch (_) {\n` +
|
|
275
|
+
` try { wllamaModule = require('./wllama'); } catch (e) {}\n` +
|
|
276
|
+
` }\n` +
|
|
271
277
|
` }\n` +
|
|
272
278
|
`}\n` +
|
|
279
|
+
`if (!wllamaModule && typeof globalThis !== 'undefined') {\n` +
|
|
280
|
+
` wllamaModule = globalThis.__brshWllamaAdapter;\n` +
|
|
281
|
+
`}\n` +
|
|
282
|
+
`if (!wllamaModule) {\n` +
|
|
283
|
+
` throw new Error('Unable to load wllama adapter module');\n` +
|
|
284
|
+
`}\n` +
|
|
273
285
|
`module.exports = wllamaModule.createWllamaCommand(${JSON.stringify(pkgMeta)}, {}, ${JSON.stringify(binName)});\n`;
|
|
274
286
|
}
|
|
275
287
|
|
|
@@ -185,9 +185,10 @@ class ProgressTracker {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
clear() {
|
|
188
|
+
const wasActive = this.active;
|
|
188
189
|
this.stopTimer();
|
|
189
190
|
this.active = false;
|
|
190
|
-
if (this.enabled && typeof this.onRender === 'function') {
|
|
191
|
+
if (wasActive && this.enabled && typeof this.onRender === 'function') {
|
|
191
192
|
this.onRender('');
|
|
192
193
|
}
|
|
193
194
|
}
|
|
@@ -1176,6 +1177,7 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1176
1177
|
|
|
1177
1178
|
const tracker = this._createTracker();
|
|
1178
1179
|
tracker.start('Running inference', { hint: 'evaluating prompt & preparing KV cache' });
|
|
1180
|
+
let firstToken = false;
|
|
1179
1181
|
|
|
1180
1182
|
try {
|
|
1181
1183
|
if (typeof this._wllama.createChatCompletion === 'function') {
|
|
@@ -1183,7 +1185,6 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1183
1185
|
|
|
1184
1186
|
if (res && typeof res[Symbol.asyncIterator] === 'function') {
|
|
1185
1187
|
let fullText = '';
|
|
1186
|
-
let firstToken = false;
|
|
1187
1188
|
for await (const chunk of res) {
|
|
1188
1189
|
const delta = chunk?.choices?.[0]?.delta?.content ?? chunk?.choices?.[0]?.text ?? '';
|
|
1189
1190
|
if (delta) {
|
|
@@ -1193,8 +1194,6 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1193
1194
|
if (this.interactive) {
|
|
1194
1195
|
this._replStatus = 'Streaming tokens...';
|
|
1195
1196
|
this._renderRepl();
|
|
1196
|
-
} else {
|
|
1197
|
-
this._clearStatus();
|
|
1198
1197
|
}
|
|
1199
1198
|
}
|
|
1200
1199
|
fullText += delta;
|
|
@@ -1204,7 +1203,7 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1204
1203
|
}
|
|
1205
1204
|
}
|
|
1206
1205
|
tracker.clear();
|
|
1207
|
-
if (!this.interactive) {
|
|
1206
|
+
if (!this.interactive && !firstToken) {
|
|
1208
1207
|
this._clearStatus();
|
|
1209
1208
|
}
|
|
1210
1209
|
return fullText;
|
|
@@ -1236,7 +1235,6 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1236
1235
|
const res = await this._wllama.createCompletion(compOpts);
|
|
1237
1236
|
if (res && typeof res[Symbol.asyncIterator] === 'function') {
|
|
1238
1237
|
let fullText = '';
|
|
1239
|
-
let firstToken = false;
|
|
1240
1238
|
for await (const chunk of res) {
|
|
1241
1239
|
const delta = chunk?.choices?.[0]?.text ?? chunk?.choices?.[0]?.delta?.content ?? '';
|
|
1242
1240
|
if (delta) {
|
|
@@ -1246,8 +1244,6 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1246
1244
|
if (this.interactive) {
|
|
1247
1245
|
this._replStatus = 'Streaming tokens...';
|
|
1248
1246
|
this._renderRepl();
|
|
1249
|
-
} else {
|
|
1250
|
-
this._clearStatus();
|
|
1251
1247
|
}
|
|
1252
1248
|
}
|
|
1253
1249
|
fullText += delta;
|
|
@@ -1257,7 +1253,7 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1257
1253
|
}
|
|
1258
1254
|
}
|
|
1259
1255
|
tracker.clear();
|
|
1260
|
-
if (!this.interactive) {
|
|
1256
|
+
if (!this.interactive && !firstToken) {
|
|
1261
1257
|
this._clearStatus();
|
|
1262
1258
|
}
|
|
1263
1259
|
return fullText;
|
|
@@ -1275,7 +1271,7 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1275
1271
|
return text;
|
|
1276
1272
|
} finally {
|
|
1277
1273
|
tracker.clear();
|
|
1278
|
-
if (!this.interactive) {
|
|
1274
|
+
if (!this.interactive && !firstToken) {
|
|
1279
1275
|
this._clearStatus();
|
|
1280
1276
|
}
|
|
1281
1277
|
}
|
|
@@ -1497,11 +1493,11 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1497
1493
|
|
|
1498
1494
|
const tracker = this._createTracker();
|
|
1499
1495
|
tracker.start('Running inference', { hint: 'evaluating prompt & preparing KV cache' });
|
|
1496
|
+
let streamedAny = false;
|
|
1500
1497
|
try {
|
|
1501
1498
|
const res = await this._wllama.createCompletion(compOpts);
|
|
1502
1499
|
let outText = '';
|
|
1503
1500
|
if (res && typeof res[Symbol.asyncIterator] === 'function') {
|
|
1504
|
-
let streamedAny = false;
|
|
1505
1501
|
for await (const chunk of res) {
|
|
1506
1502
|
const delta = chunk?.choices?.[0]?.text ?? chunk?.choices?.[0]?.delta?.content ?? '';
|
|
1507
1503
|
if (delta) {
|
|
@@ -1509,7 +1505,6 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1509
1505
|
streamedAny = true;
|
|
1510
1506
|
this._streamedStdout = true;
|
|
1511
1507
|
tracker.clear();
|
|
1512
|
-
this._clearStatus();
|
|
1513
1508
|
}
|
|
1514
1509
|
outText += delta;
|
|
1515
1510
|
if (this.stdout && typeof this.stdout.write === 'function') {
|
|
@@ -1519,7 +1514,9 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1519
1514
|
}
|
|
1520
1515
|
}
|
|
1521
1516
|
tracker.clear();
|
|
1522
|
-
|
|
1517
|
+
if (!streamedAny) {
|
|
1518
|
+
this._clearStatus();
|
|
1519
|
+
}
|
|
1523
1520
|
if (streamedAny && outText.length > 0 && !outText.endsWith('\n') && this.stdout && typeof this.stdout.write === 'function') {
|
|
1524
1521
|
this.stdout.write('\r\n');
|
|
1525
1522
|
}
|
|
@@ -1532,7 +1529,9 @@ function createWllamaCommand(pkgMeta = {}, wbtConfig = {}, binName = 'wllama') {
|
|
|
1532
1529
|
return;
|
|
1533
1530
|
} finally {
|
|
1534
1531
|
tracker.clear();
|
|
1535
|
-
|
|
1532
|
+
if (!streamedAny) {
|
|
1533
|
+
this._clearStatus();
|
|
1534
|
+
}
|
|
1536
1535
|
}
|
|
1537
1536
|
}
|
|
1538
1537
|
|
package/lib/wbt/registry.js
CHANGED
|
@@ -170,7 +170,7 @@ const DEFAULT_REGISTRY = {
|
|
|
170
170
|
nano: {
|
|
171
171
|
name: 'nano',
|
|
172
172
|
bin: 'nano',
|
|
173
|
-
aliases: ['nano-wasm'],
|
|
173
|
+
aliases: ['nano-wasm', 'pico'],
|
|
174
174
|
version: '8.0.1',
|
|
175
175
|
description: 'GNU nano 8.0 text editor compiled to WebAssembly (wasm32-wasip1) with ncurses',
|
|
176
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).',
|
|
@@ -181,6 +181,20 @@ const DEFAULT_REGISTRY = {
|
|
|
181
181
|
interactive: true,
|
|
182
182
|
size: '680 KB'
|
|
183
183
|
},
|
|
184
|
+
vim: {
|
|
185
|
+
name: 'vim',
|
|
186
|
+
bin: 'vim',
|
|
187
|
+
aliases: ['vi', 'vim-wasm'],
|
|
188
|
+
version: '9.1.0700',
|
|
189
|
+
description: 'Vim 9.1 text editor compiled to WebAssembly (wasm32-wasip1) with ncurses',
|
|
190
|
+
details: 'Vim 9.1 (9.1.0700) compiled to WebAssembly (wasm32-wasip1) with static ncursesw 6.5, built-in terminfo fallbacks (xterm-256color, vt100, etc.), Asyncify interactive I/O, built-in defaults.vim fallback, and zero custom imports (standard wasi_snapshot_preview1).',
|
|
191
|
+
homepage: 'https://github.com/eliotstocker/vim-wasm',
|
|
192
|
+
cdnUrl: 'https://cdn.jsdelivr.net/gh/eliotstocker/vim-wasm@main/dist/vim.wasm',
|
|
193
|
+
wasmUrl: 'https://cdn.jsdelivr.net/gh/eliotstocker/vim-wasm@main/dist/vim.wasm',
|
|
194
|
+
type: 'custom-wasm',
|
|
195
|
+
interactive: true,
|
|
196
|
+
size: '4.5 MB'
|
|
197
|
+
},
|
|
184
198
|
doom: {
|
|
185
199
|
name: 'doom',
|
|
186
200
|
bin: 'doom',
|
|
@@ -219,6 +233,9 @@ const PACKAGE_ALIASES = {
|
|
|
219
233
|
'llama.cpp': 'wllama',
|
|
220
234
|
'@wllama/wllama': 'wllama',
|
|
221
235
|
'nano-wasm': 'nano',
|
|
236
|
+
pico: 'nano',
|
|
237
|
+
vi: 'vim',
|
|
238
|
+
'vim-wasm': 'vim',
|
|
222
239
|
'doom-wasm': 'doom',
|
|
223
240
|
'doom-ascii': 'doom',
|
|
224
241
|
freedoom: 'doom'
|
package/package.json
CHANGED
package/test/wbt.test.js
CHANGED
|
@@ -1150,6 +1150,43 @@ describe('WBT Wllama v3 WASM & WebGPU package (`wllama`, `llama`, `llama-cli`)',
|
|
|
1150
1150
|
expect(runHelpRes.output.join('\n')).toContain('Usage: wllama');
|
|
1151
1151
|
});
|
|
1152
1152
|
|
|
1153
|
+
it('installs wllama from the built ESM browser bundle without __dirname', async () => {
|
|
1154
|
+
const { default: BundledWbt } = await import('../dist/wbt.es.js');
|
|
1155
|
+
const ConfiguredBundledWbt = BundledWbt.configure({
|
|
1156
|
+
fetch: async (url) => {
|
|
1157
|
+
if (url.endsWith('.wasm')) {
|
|
1158
|
+
return {
|
|
1159
|
+
ok: true,
|
|
1160
|
+
status: 200,
|
|
1161
|
+
arrayBuffer: async () => new Uint8Array([0x00, 0x61, 0x73, 0x6d]).buffer
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
throw new Error(`Unexpected fetch: ${url}`);
|
|
1165
|
+
}
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
const browserShell = await createShell({ filesystem: { home: {} } });
|
|
1169
|
+
browserShell.context.setCommand(ConfiguredBundledWbt);
|
|
1170
|
+
|
|
1171
|
+
const installRes = await run(browserShell, 'wbt install wllama');
|
|
1172
|
+
expect(installRes.exitCode).toBe(0);
|
|
1173
|
+
expect(browserShell.context.fs.exists('/bin/wllama')).toBe(true);
|
|
1174
|
+
expect(browserShell.context.fs.exists('/bin/llama')).toBe(true);
|
|
1175
|
+
expect(browserShell.context.fs.exists('/bin/llama-cli')).toBe(true);
|
|
1176
|
+
|
|
1177
|
+
const helpRes = await run(browserShell, 'wllama --help');
|
|
1178
|
+
expect(helpRes.exitCode).toBe(0);
|
|
1179
|
+
expect(helpRes.output.join('\n')).toContain('Usage: wllama');
|
|
1180
|
+
|
|
1181
|
+
// Also verify generated __source can be evaluated without Node require() via globalThis.__brshWllamaAdapter
|
|
1182
|
+
const WllamaCmd = browserShell.context.fs.getFileByPath('/usr/lib/wllama/wllama.js');
|
|
1183
|
+
expect(typeof WllamaCmd).toBe('function');
|
|
1184
|
+
expect(typeof WllamaCmd.__source).toBe('string');
|
|
1185
|
+
const mod = { exports: {} };
|
|
1186
|
+
new Function('module', 'exports', 'require', WllamaCmd.__source)(mod, mod.exports, undefined);
|
|
1187
|
+
expect(typeof mod.exports).toBe('function');
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1153
1190
|
it('runs one-shot chat completions from a local filesystem .gguf model, piped stdin, or -f file with WebGPU or --no-gpu', async () => {
|
|
1154
1191
|
const res1 = await run(
|
|
1155
1192
|
shell,
|
|
@@ -1239,6 +1276,23 @@ describe('WBT Wllama v3 WASM & WebGPU package (`wllama`, `llama`, `llama-cli`)',
|
|
|
1239
1276
|
expect(combinedStatus).toContain('Loading model (tinyllama.gguf) weights');
|
|
1240
1277
|
expect(combinedStatus).toContain('Running inference');
|
|
1241
1278
|
expect(combinedStatus).toMatch(/\[.*\]/);
|
|
1279
|
+
|
|
1280
|
+
// Ensure status clearing (\r\x1b[K) never fires after tokens start streaming to stdout
|
|
1281
|
+
for (const cmd of ['wllama -m /home/tinyllama.gguf -p "No clobber"', 'wllama -m /home/tinyllama.gguf --raw -p "Raw no clobber"']) {
|
|
1282
|
+
const timeline = [];
|
|
1283
|
+
const onTok = (t) => timeline.push({ stream: 'token', data: String(t) });
|
|
1284
|
+
const onErr = (c) => timeline.push({ stream: 'err', data: String(c) });
|
|
1285
|
+
shell.on('token', onTok);
|
|
1286
|
+
shell.stderr.on('data', onErr);
|
|
1287
|
+
await run(shell, cmd);
|
|
1288
|
+
shell.removeListener('token', onTok);
|
|
1289
|
+
shell.stderr.removeListener('data', onErr);
|
|
1290
|
+
|
|
1291
|
+
const firstTokenIdx = timeline.findIndex(e => e.stream === 'token');
|
|
1292
|
+
expect(firstTokenIdx).toBeGreaterThanOrEqual(0);
|
|
1293
|
+
const errAfterFirstToken = timeline.slice(firstTokenIdx + 1).filter(e => e.stream === 'err' && e.data.includes('\x1b[K'));
|
|
1294
|
+
expect(errAfterFirstToken).toEqual([]);
|
|
1295
|
+
}
|
|
1242
1296
|
});
|
|
1243
1297
|
|
|
1244
1298
|
it('supports Hugging Face model loading (--hf / hf:), embeddings (wllama embed), info, and bench', async () => {
|
|
@@ -1399,19 +1453,24 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
|
|
|
1399
1453
|
expect(showRes.exitCode).toBe(0);
|
|
1400
1454
|
expect(showRes.output.join('\n')).toContain('Package: nano');
|
|
1401
1455
|
expect(showRes.output.join('\n')).toContain('Version: 8.0.1');
|
|
1402
|
-
expect(showRes.output.join('\n')).toContain('Aliases: nano-wasm');
|
|
1456
|
+
expect(showRes.output.join('\n')).toContain('Aliases: nano-wasm, pico');
|
|
1403
1457
|
|
|
1404
1458
|
const showAliasRes = await run(shell, 'wbt show nano-wasm');
|
|
1405
1459
|
expect(showAliasRes.exitCode).toBe(0);
|
|
1406
1460
|
expect(showAliasRes.output.join('\n')).toContain('Package: nano');
|
|
1461
|
+
|
|
1462
|
+
const showPicoRes = await run(shell, 'wbt show pico');
|
|
1463
|
+
expect(showPicoRes.exitCode).toBe(0);
|
|
1464
|
+
expect(showPicoRes.output.join('\n')).toContain('Package: nano');
|
|
1407
1465
|
});
|
|
1408
1466
|
|
|
1409
|
-
it('installs nano
|
|
1467
|
+
it('installs nano, nano-wasm, and pico into /bin and runs --version and --help', async () => {
|
|
1410
1468
|
const installRes = await run(shell, 'wbt install nano');
|
|
1411
1469
|
expect(installRes.exitCode).toBe(0);
|
|
1412
1470
|
expect(shell.context.fs.exists('/usr/lib/nano/nano.wasm')).toBe(true);
|
|
1413
1471
|
expect(shell.context.fs.exists('/bin/nano')).toBe(true);
|
|
1414
1472
|
expect(shell.context.fs.exists('/bin/nano-wasm')).toBe(true);
|
|
1473
|
+
expect(shell.context.fs.exists('/bin/pico')).toBe(true);
|
|
1415
1474
|
|
|
1416
1475
|
const verRes = await run(shell, 'nano --version');
|
|
1417
1476
|
expect(verRes.exitCode).toBe(0);
|
|
@@ -1424,6 +1483,10 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
|
|
|
1424
1483
|
const aliasVerRes = await run(shell, 'nano-wasm --version');
|
|
1425
1484
|
expect(aliasVerRes.exitCode).toBe(0);
|
|
1426
1485
|
expect(aliasVerRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.[0-9]+.*wasm/i);
|
|
1486
|
+
|
|
1487
|
+
const picoVerRes = await run(shell, 'pico --version');
|
|
1488
|
+
expect(picoVerRes.exitCode).toBe(0);
|
|
1489
|
+
expect(picoVerRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.[0-9]+.*wasm/i);
|
|
1427
1490
|
});
|
|
1428
1491
|
|
|
1429
1492
|
it('supports wbt run nano --version without permanently installing', async () => {
|
|
@@ -1433,16 +1496,18 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
|
|
|
1433
1496
|
expect(shell.context.fs.exists('/bin/nano')).toBe(false);
|
|
1434
1497
|
});
|
|
1435
1498
|
|
|
1436
|
-
it('removes nano and unregisters
|
|
1437
|
-
await run(shell, 'wbt install
|
|
1499
|
+
it('removes nano and unregisters nano, nano-wasm, and pico from /bin', async () => {
|
|
1500
|
+
await run(shell, 'wbt install pico');
|
|
1438
1501
|
expect(shell.context.fs.exists('/bin/nano')).toBe(true);
|
|
1439
1502
|
expect(shell.context.fs.exists('/bin/nano-wasm')).toBe(true);
|
|
1503
|
+
expect(shell.context.fs.exists('/bin/pico')).toBe(true);
|
|
1440
1504
|
expect(shell.context.fs.exists('/usr/lib/nano/nano.wasm')).toBe(true);
|
|
1441
1505
|
|
|
1442
1506
|
const rmRes = await run(shell, 'wbt remove nano');
|
|
1443
1507
|
expect(rmRes.exitCode).toBe(0);
|
|
1444
1508
|
expect(shell.context.fs.exists('/bin/nano')).toBe(false);
|
|
1445
1509
|
expect(shell.context.fs.exists('/bin/nano-wasm')).toBe(false);
|
|
1510
|
+
expect(shell.context.fs.exists('/bin/pico')).toBe(false);
|
|
1446
1511
|
expect(shell.context.fs.exists('/usr/lib/nano/nano.wasm')).toBe(false);
|
|
1447
1512
|
});
|
|
1448
1513
|
|
|
@@ -1677,6 +1742,36 @@ describe('WBT filesystem installer architecture (installer, not runtime)', () =>
|
|
|
1677
1742
|
expect(execRes.exitCode).toBe(0);
|
|
1678
1743
|
});
|
|
1679
1744
|
|
|
1745
|
+
it('registers vim package from eliotstocker/vim-wasm with vi and vim-wasm aliases', async () => {
|
|
1746
|
+
const searchRes = await run(shell, 'wbt search vim');
|
|
1747
|
+
expect(searchRes.exitCode).toBe(0);
|
|
1748
|
+
expect(searchRes.output.join('\n')).toContain('vim');
|
|
1749
|
+
|
|
1750
|
+
const showRes = await run(shell, 'wbt show vim');
|
|
1751
|
+
expect(showRes.exitCode).toBe(0);
|
|
1752
|
+
expect(showRes.output.join('\n')).toContain('Package: vim');
|
|
1753
|
+
expect(showRes.output.join('\n')).toContain('Version: 9.1.0700');
|
|
1754
|
+
expect(showRes.output.join('\n')).toContain('Aliases: vi, vim-wasm');
|
|
1755
|
+
|
|
1756
|
+
const showViRes = await run(shell, 'wbt show vi');
|
|
1757
|
+
expect(showViRes.exitCode).toBe(0);
|
|
1758
|
+
expect(showViRes.output.join('\n')).toContain('Package: vim');
|
|
1759
|
+
|
|
1760
|
+
const installRes = await run(shell, 'wbt install vi');
|
|
1761
|
+
expect(installRes.exitCode).toBe(0);
|
|
1762
|
+
expect(shell.context.fs.exists('/usr/lib/vim/vim.wasm')).toBe(true);
|
|
1763
|
+
expect(shell.context.fs.isSymlink('/bin/vim')).toBe(true);
|
|
1764
|
+
expect(shell.context.fs.isSymlink('/bin/vi')).toBe(true);
|
|
1765
|
+
expect(shell.context.fs.isSymlink('/bin/vim-wasm')).toBe(true);
|
|
1766
|
+
|
|
1767
|
+
const rmRes = await run(shell, 'wbt remove vim');
|
|
1768
|
+
expect(rmRes.exitCode).toBe(0);
|
|
1769
|
+
expect(shell.context.fs.exists('/bin/vim')).toBe(false);
|
|
1770
|
+
expect(shell.context.fs.exists('/bin/vi')).toBe(false);
|
|
1771
|
+
expect(shell.context.fs.exists('/bin/vim-wasm')).toBe(false);
|
|
1772
|
+
expect(shell.context.fs.exists('/usr/lib/vim/vim.wasm')).toBe(false);
|
|
1773
|
+
});
|
|
1774
|
+
|
|
1680
1775
|
it('registers doom package with aliases doom-wasm, doom-ascii, and freedoom launcher script', async () => {
|
|
1681
1776
|
const BaseWbt = createTestWbt();
|
|
1682
1777
|
const registry = BaseWbt.DEFAULT_REGISTRY;
|