buninu-linux 0.14.57 → 0.15.58

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 (94) hide show
  1. package/LICENSES/linux-firmware/LICENCE.nvidia +131 -0
  2. package/LICENSES/linux-firmware/LICENSE.amdgpu +51 -0
  3. package/LICENSES/linux-firmware/LICENSE.amdisp +31 -0
  4. package/LICENSES/linux-firmware/LICENSE.i915 +39 -0
  5. package/LICENSES/linux-firmware/LICENSE.radeon +51 -0
  6. package/LICENSES/linux-firmware/LICENSE.xe +39 -0
  7. package/LICENSES/linux-firmware/WHENCE +10280 -0
  8. package/NOTICE.md +64 -46
  9. package/README.md +371 -87
  10. package/README.zh.md +2034 -0
  11. package/build-image.sh +10 -1
  12. package/build-uki.sh +3 -1
  13. package/fetch-alpine.sh +14 -0
  14. package/graphics.md +31 -0
  15. package/index.js +28 -11
  16. package/initramfs/bin/buninu-browser +4 -1
  17. package/initramfs/bin/buninu-land +1 -1
  18. package/initramfs/bin/bunterm +3 -3
  19. package/initramfs/bin/chroot +13 -0
  20. package/initramfs/bin/chvt +11 -0
  21. package/initramfs/bin/mount +4 -0
  22. package/initramfs/bin/umount +6 -0
  23. package/initramfs/bin/xdg-open +33 -0
  24. package/initramfs/buninu/CHANGELOG.md +19 -0
  25. package/initramfs/buninu/apps/bunmsh/CHANGELOG.md +4 -0
  26. package/initramfs/buninu/apps/bunmsh/package.json +1 -1
  27. package/initramfs/buninu/apps/bunmsh/src/main.js +1 -1
  28. package/initramfs/buninu/apps/jsgotty/README.en.md +40 -0
  29. package/initramfs/buninu/apps/jsgotty/README.md +40 -0
  30. package/initramfs/buninu/apps/jsgotty/package-lock.json +2 -2
  31. package/initramfs/buninu/apps/jsgotty/package.json +1 -1
  32. package/initramfs/buninu/apps/jsgotty/static/index.html +1 -0
  33. package/initramfs/buninu/apps/jsgotty/static/js/gotty.js +82 -17
  34. package/initramfs/buninu/apps/jsgotty/static/js/kitty-keyboard.js +193 -0
  35. package/initramfs/buninu/apps/jsgotty/tests/android-alt.test.js +115 -0
  36. package/initramfs/buninu/apps/jsgotty/tests/arrow-modifiers.test.js +80 -0
  37. package/initramfs/buninu/apps/jsgotty/tests/kitty-keyboard-browser.test.js +53 -0
  38. package/initramfs/buninu/apps/jsgotty/tests/kitty-keyboard.test.js +102 -0
  39. package/initramfs/buninu/apps/jsgotty/tests/manual/README.md +20 -0
  40. package/initramfs/buninu/apps/jsgotty/tests/manual/keyboard-collector.cjs +55 -0
  41. package/initramfs/buninu/apps/jsgotty/tests/manual/keyboard-debug.js +74 -0
  42. package/initramfs/buninu/apps/jsgotty/tests/manual/kitty-keyboard.js +80 -0
  43. package/initramfs/buninu/package.json +1 -1
  44. package/initramfs/init.js +19 -3
  45. package/initramfs/lib/bunterm/clipboard.js +14 -0
  46. package/initramfs/lib/bunterm/commands.js +37 -0
  47. package/initramfs/lib/bunterm/fps.js +38 -0
  48. package/initramfs/lib/bunterm/images.js +9 -5
  49. package/initramfs/lib/bunterm/input.js +58 -15
  50. package/initramfs/lib/bunterm/keyboard.js +62 -0
  51. package/initramfs/lib/bunterm/keycodes.js +104 -0
  52. package/initramfs/lib/bunterm/kitty-keyboard.cjs +195 -0
  53. package/initramfs/lib/bunterm/raw-protocol.js +33 -0
  54. package/initramfs/lib/bunterm/renderer.js +89 -20
  55. package/initramfs/lib/bunterm/selection.js +60 -0
  56. package/initramfs/lib/bunterm/terminal.js +146 -11
  57. package/initramfs/lib/bunterm/vt-menu.js +181 -0
  58. package/initramfs/lib/bunterm/vt.js +27 -1
  59. package/initramfs/lib/canvas.js +99 -0
  60. package/initramfs/lib/chvt.js +31 -0
  61. package/initramfs/lib/fbdev.js +21 -3
  62. package/initramfs/lib/gpu.js +77 -0
  63. package/initramfs/lib/raw-image.js +47 -0
  64. package/initramfs/lib/xdg-open.js +42 -0
  65. package/initramfs/usr/share/doc/buninu-linux/bunterm.md +85 -11
  66. package/initramfs/usr/share/doc/buninu-linux/chvt.md +34 -0
  67. package/initramfs/usr/share/doc/buninu-linux/xdg-open.md +43 -0
  68. package/package.json +1 -1
  69. package/scripts/arch.js +7 -5
  70. package/scripts/arch.sh +5 -5
  71. package/scripts/build.js +16 -3
  72. package/scripts/fetch-gpu.js +105 -0
  73. package/scripts/fetch.js +11 -1
  74. package/scripts/gpu-firmware.json +22 -0
  75. package/scripts/modules.js +4 -1
  76. package/scripts/npm-packages.md +17 -17
  77. package/test/bunterm-fps.test.js +17 -0
  78. package/test/bunterm-keyboard.test.js +116 -0
  79. package/test/bunterm-next-vt.test.js +9 -0
  80. package/test/bunterm-raw-protocol.test.js +19 -0
  81. package/test/bunterm-renderer.test.js +158 -0
  82. package/test/bunterm-selection.test.js +38 -0
  83. package/test/bunterm-vt-menu.test.js +178 -0
  84. package/test/chroot-bind.test.js +40 -2
  85. package/test/chvt.test.js +46 -0
  86. package/test/fbdev-sync.test.js +33 -0
  87. package/test/gpu.test.js +155 -0
  88. package/test/image-size.test.js +17 -0
  89. package/test/manual-bunterm-image-paths.js +31 -0
  90. package/test/mount-libc-lifetime.test.js +50 -0
  91. package/test/no-gpu.test.js +43 -0
  92. package/test/readme-cli.test.js +29 -0
  93. package/test/stage-npm.test.js +11 -4
  94. package/test/xdg-open.test.js +55 -0
@@ -101,9 +101,16 @@ test("distribution launcher ensures resources then forwards to local casty witho
101
101
  `);
102
102
  writeFileSync(join(root, "usr/lib/node_modules/@drxiaozhi/casty/index.js"),
103
103
  "console.log(JSON.stringify({args:process.argv.slice(2),engine:process.env.CASTY_BROWSER}));");
104
- const result = spawnSync(process.execPath, [join(root, "bin/buninu-browser"), "--casty", "https://example.test", "--", "--chromium"], { encoding: "utf8" });
105
- expect(result.status).toBe(0);
106
- expect(JSON.parse(result.stdout)).toEqual({ args: ["https://example.test", "--", "--chromium"], engine: join(browser, "buninu-browser.js") });
104
+ for (const args of [
105
+ ["https://example.test", "--", "--chromium"],
106
+ ["--", "--help"],
107
+ ["--", "--version"],
108
+ ["--", "--window-size=160,90"],
109
+ ]) {
110
+ const result = spawnSync(process.execPath, [join(root, "bin/buninu-browser"), "--casty", ...args], { encoding: "utf8" });
111
+ expect(result.status).toBe(0);
112
+ expect(JSON.parse(result.stdout)).toEqual({ args, engine: join(browser, "buninu-browser.js") });
113
+ }
107
114
  });
108
115
 
109
116
  test("land launcher selects bundled casty and preserves package frontend dispatch", async () => {
@@ -130,7 +137,7 @@ test("land launcher selects bundled casty and preserves package frontend dispatc
130
137
  });
131
138
  expect(result.status).toBe(0);
132
139
  expect(JSON.parse(result.stdout)).toEqual({
133
- args: args[0] === '--casty' ? args.slice(1) : args,
140
+ args: ['--no-shortcuts', ...(args[0] === '--casty' ? args.slice(1) : args)],
134
141
  engine: join(land, "compositor.js"),
135
142
  });
136
143
  }
@@ -0,0 +1,55 @@
1
+ import {afterAll, expect, test} from 'bun:test';
2
+ import {mkdtempSync,writeFileSync,symlinkSync,rmSync,chmodSync} from 'node:fs';
3
+ import {tmpdir} from 'node:os';
4
+ import {join} from 'node:path';
5
+ import {pathToFileURL} from 'node:url';
6
+ import {browserTarget,parseOpenArgs} from '../initramfs/lib/xdg-open.js';
7
+ const dir=mkdtempSync(join(tmpdir(),'buninu-xdg-open-'));
8
+ afterAll(()=>rmSync(dir,{recursive:true,force:true}));
9
+ const file=join(dir,'中文 # %.html');writeFileSync(file,'<p>test</p>');
10
+ symlinkSync(file,join(dir,'alias.html'));
11
+ test('HTTP and HTTPS remain browser URLs',()=>{
12
+ expect(browserTarget('https://buninu.org/path?q=one#two')).toBe('https://buninu.org/path?q=one#two');
13
+ expect(browserTarget('http://localhost:8080')).toBe('http://localhost:8080/');
14
+ expect(()=>browserTarget('http://')).toThrow();
15
+ });
16
+ test('local files resolve symlinks and escape URL-special characters',()=>{
17
+ expect(browserTarget('alias.html',dir)).toBe(pathToFileURL(file).href);
18
+ expect(browserTarget(pathToFileURL(file).href)).toBe(pathToFileURL(file).href);
19
+ expect(()=>browserTarget('missing',dir)).toThrow();
20
+ expect(()=>browserTarget(dir)).toThrow('regular file');
21
+ expect(()=>browserTarget('javascript:alert(1)')).toThrow('Unsupported');
22
+ expect(()=>browserTarget('mailto:test@example.com')).toThrow('Unsupported');
23
+ });
24
+ test('argument validation',()=>{
25
+ expect(parseOpenArgs(['--help'])).toEqual({help:true});
26
+ expect(()=>parseOpenArgs([])).toThrow('Usage');
27
+ expect(()=>parseOpenArgs(['a','b'])).toThrow('Usage');
28
+ });
29
+ test('launcher passes a single URL argument to a new bunterm and maps launch failure to status 4',async()=>{
30
+ const stub=join(dir,'bunterm');writeFileSync(stub,`#!${process.execPath}\nconsole.log(JSON.stringify(process.argv.slice(2)));process.exit(7);`);chmodSync(stub,0o755);
31
+ const browser=join(dir,'buninu-browser');writeFileSync(browser,'#!/bin/sh\nexit 0');chmodSync(browser,0o755);
32
+ const url='https://example.test/?q=$(touch%20bad)&x=1';
33
+ const p=Bun.spawn([process.execPath,new URL('../initramfs/bin/xdg-open',import.meta.url).pathname,url],{env:{...process.env,PATH:dir+':'+process.env.PATH},stdout:'pipe',stderr:'pipe'});
34
+ expect(await p.exited).toBe(4);
35
+ expect(JSON.parse(await new Response(p.stdout).text())).toEqual(['-e','buninu-browser',url]);
36
+ expect(await new Response(p.stderr).text()).toBe('');
37
+ });
38
+
39
+ test('about URLs pass through; Markdown remains a browser file URL',()=>{
40
+ for(const url of ['about:blank','about:audio','about:custom?x=1#part'])
41
+ expect(browserTarget(url)).toBe(url);
42
+ const markdown=join(dir,'note.md');writeFileSync(markdown,'# Note');
43
+ expect(browserTarget(markdown)).toBe(pathToFileURL(markdown).href);
44
+ });
45
+
46
+ test('manual aliases, version and standard failure codes work through the command',async()=>{
47
+ const run=async args=>{const p=Bun.spawn([process.execPath,new URL('../initramfs/bin/xdg-open',import.meta.url).pathname,...args],{env:{...process.env,PATH:'/nonexistent'},stdout:'pipe',stderr:'pipe'});return {code:await p.exited,out:await new Response(p.stdout).text()}};
48
+ for(const flag of ['-h','--help','--manual']){const r=await run([flag]);expect(r.code).toBe(0);expect(r.out).toContain('Exit codes');}
49
+ const v=await run(['--version']);expect(v.code).toBe(0);expect(v.out).toContain('xdg-open (Buninu Linux)');
50
+ expect((await run([])).code).toBe(1);
51
+ expect((await run(['http://'])).code).toBe(1);
52
+ expect((await run([join(dir,'absent')])).code).toBe(2);
53
+ expect((await run(['https://buninu.org'])).code).toBe(3);
54
+ expect((await run(['mailto:a@example.com'])).code).toBe(4);
55
+ });