brsh 2.6.0 → 2.8.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/Readme.md +145 -1
  3. package/bin/Readme.md +6 -3
  4. package/bin/brsh-shell.js +68 -9
  5. package/bin/exportFileSystem.js +192 -80
  6. package/dist/shell.es.js +2497 -1300
  7. package/dist/shell.es.js.map +1 -1
  8. package/dist/shell.min.js +21 -14
  9. package/dist/shell.min.js.map +1 -1
  10. package/dist/terminal.cjs.js +101 -0
  11. package/dist/terminal.cjs.js.map +1 -0
  12. package/dist/terminal.es.js +290 -6965
  13. package/dist/terminal.es.js.map +1 -1
  14. package/dist/terminal.min.js +4 -25
  15. package/dist/terminal.min.js.map +1 -1
  16. package/dist/wbt.es.js +3974 -0
  17. package/dist/wbt.es.js.map +1 -0
  18. package/dist/wbt.min.js +10 -0
  19. package/dist/wbt.min.js.map +1 -0
  20. package/index.js +160 -20
  21. package/lib/BinaryContainer.js +528 -0
  22. package/lib/Command.js +2 -1
  23. package/lib/FileSystem.js +31 -0
  24. package/lib/NodeFileSystem.js +19 -9
  25. package/lib/ReplCommand.js +520 -0
  26. package/lib/ScriptCommand.js +1 -1
  27. package/lib/Terminal.js +45 -10
  28. package/lib/WasmCommand.js +1123 -35
  29. package/lib/buildFilesystemStructure.js +15 -4
  30. package/lib/local/curl.js +60 -2
  31. package/lib/wbt/index.js +756 -0
  32. package/lib/wbt/packages/wllama.js +1051 -0
  33. package/lib/wbt/registry.js +193 -0
  34. package/lib/wbt/utils.js +118 -0
  35. package/package.json +11 -3
  36. package/test/binary-filesystem.test.js +248 -0
  37. package/test/curl.test.js +166 -0
  38. package/test/exportFileSystem.test.js +78 -0
  39. package/test/terminal.test.js +113 -0
  40. package/test/wasm-cli.test.js +127 -0
  41. package/test/wbt.test.js +1175 -0
  42. package/vite.config.demo.js +4 -0
  43. package/vite.config.js +4 -0
  44. package/vite.config.terminal.js +16 -12
  45. package/vite.config.wbt.js +21 -0
  46. package/vitest.config.js +6 -0
@@ -17,6 +17,10 @@ export default defineConfig({
17
17
  find: /^brsh\/terminal$/,
18
18
  replacement: path.resolve(projectRoot, 'lib/Terminal.js')
19
19
  },
20
+ {
21
+ find: /^brsh\/wbt$/,
22
+ replacement: path.resolve(projectRoot, 'lib/wbt/index.js')
23
+ },
20
24
  {
21
25
  find: /^brsh$/,
22
26
  replacement: path.resolve(projectRoot, 'index.js')
package/vite.config.js CHANGED
@@ -16,6 +16,10 @@ export default defineConfig({
16
16
  find: /^brsh\/terminal$/,
17
17
  replacement: path.resolve(projectRoot, 'lib/Terminal.js')
18
18
  },
19
+ {
20
+ find: /^brsh\/wbt$/,
21
+ replacement: path.resolve(projectRoot, 'lib/wbt/index.js')
22
+ },
19
23
  {
20
24
  find: /^brsh$/,
21
25
  replacement: path.resolve(projectRoot, 'index.js')
@@ -1,23 +1,27 @@
1
1
  import { defineConfig } from 'vite';
2
- import { nodePolyfills } from 'vite-plugin-node-polyfills';
3
2
  import path from 'path';
4
3
 
5
4
  export default defineConfig({
6
- plugins: [
7
- nodePolyfills()
8
- ],
9
- resolve: {
10
- // Terminal.js does require('Shell') — point that at the real entry
11
- alias: {
12
- Shell: path.resolve(import.meta.dirname, 'index.js')
13
- }
14
- },
15
5
  build: {
16
6
  lib: {
17
7
  entry: path.resolve(import.meta.dirname, 'lib/Terminal.js'),
18
8
  name: 'Terminal',
19
- formats: ['es', 'iife'],
20
- fileName: (format) => format === 'iife' ? 'terminal.min.js' : 'terminal.es.js'
9
+ formats: ['es', 'cjs', 'iife'],
10
+ fileName: (format) => {
11
+ if (format === 'iife') return 'terminal.min.js';
12
+ if (format === 'cjs') return 'terminal.cjs.js';
13
+ return 'terminal.es.js';
14
+ }
15
+ },
16
+ rollupOptions: {
17
+ external: ['brsh', 'Shell'],
18
+ output: {
19
+ exports: 'auto',
20
+ globals: {
21
+ brsh: 'globalThis.Shell',
22
+ Shell: 'globalThis.Shell'
23
+ }
24
+ }
21
25
  },
22
26
  minify: true,
23
27
  sourcemap: true,
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'vite';
2
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
3
+ import path from 'path';
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ nodePolyfills()
8
+ ],
9
+ build: {
10
+ lib: {
11
+ entry: path.resolve(import.meta.dirname, 'lib/wbt/index.js'),
12
+ name: 'Wbt',
13
+ formats: ['es', 'iife'],
14
+ fileName: (format) => format === 'iife' ? 'wbt.min.js' : 'wbt.es.js'
15
+ },
16
+ minify: true,
17
+ sourcemap: true,
18
+ outDir: 'dist',
19
+ emptyOutDir: false
20
+ }
21
+ });
package/vitest.config.js CHANGED
@@ -1,6 +1,12 @@
1
1
  import { defineConfig } from 'vitest/config';
2
+ import path from 'path';
2
3
 
3
4
  export default defineConfig({
5
+ resolve: {
6
+ alias: {
7
+ 'brsh': path.resolve(import.meta.dirname, 'index.js')
8
+ }
9
+ },
4
10
  test: {
5
11
  environment: 'node',
6
12
  globals: false,