brsh 2.1.4 → 2.1.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.1.5](https://github.com/eliotstocker/Brsh-JS/compare/v2.1.4...v2.1.5) (2026-05-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * binary serialisation ([b2aa4d2](https://github.com/eliotstocker/Brsh-JS/commit/b2aa4d23d4b4d696b1fdc965fd55f2155c8eb44d))
7
+
1
8
  ## [2.1.4](https://github.com/eliotstocker/Brsh-JS/compare/v2.1.3...v2.1.4) (2026-05-22)
2
9
 
3
10
 
@@ -100,6 +100,8 @@ const textLoaderPlugin = {
100
100
  && !filename.endsWith('.jpg')
101
101
  && !filename.endsWith('.jpeg')
102
102
  && !filename.endsWith('.bmp')
103
+ && !filename.endsWith('.webp')
104
+ && !filename.endsWith('.ico')
103
105
  ) {
104
106
  const contents = await fs.promises.readFile(args.path, 'utf8');
105
107
  return { contents, loader: 'text' };
@@ -124,7 +126,9 @@ esbuild.build({
124
126
  '.png': 'binary',
125
127
  '.jpg': 'binary',
126
128
  '.jpeg': 'binary',
127
- '.bmp': 'binary'
129
+ '.bmp': 'binary',
130
+ '.webp': 'binary',
131
+ '.ico': 'binary'
128
132
  },
129
133
  plugins: [
130
134
  textLoaderPlugin,
@@ -5,6 +5,16 @@ const path = require('path');
5
5
 
6
6
  const IGNORE = ['.DS_Store'];
7
7
 
8
+ const BINARY_MIME = {
9
+ '.gif': 'image/gif',
10
+ '.png': 'image/png',
11
+ '.jpg': 'image/jpeg',
12
+ '.jpeg': 'image/jpeg',
13
+ '.bmp': 'image/bmp',
14
+ '.webp': 'image/webp',
15
+ '.ico': 'image/x-icon',
16
+ };
17
+
8
18
  /**
9
19
  * Recursively builds a filesystem structure object from a real directory.
10
20
  * Returns { filesystem, permissions } where:
@@ -39,9 +49,13 @@ function _buildTree(root, virtualPrefix, permissions) {
39
49
 
40
50
  const filePath = path.join(root, handle);
41
51
  const isJavaScript = handle.endsWith('.js');
52
+ const ext = path.extname(handle).toLowerCase();
53
+ const isBinary = ext in BINARY_MIME;
42
54
  const fileContents = isJavaScript
43
55
  ? null
44
- : fs.readFileSync(filePath, 'utf8');
56
+ : isBinary
57
+ ? `data:${BINARY_MIME[ext]};base64,${fs.readFileSync(filePath).toString('base64')}`
58
+ : fs.readFileSync(filePath, 'utf8');
45
59
 
46
60
  const key = isJavaScript
47
61
  ? handle.substring(0, handle.length - 3)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brsh",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "A unix like shell written in javascript",
5
5
  "main": "./dist/shell.min.js",
6
6
  "module": "./dist/shell.es.js",