brsh 3.10.5 → 3.10.7
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/POSIX-CHECKLIST.md +16 -15
- package/dist/shell.es.js +943 -652
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +15 -6
- package/dist/shell.min.js.map +1 -1
- package/index.js +118 -39
- package/lib/builtins/index.js +2 -0
- package/lib/builtins/readInput.js +37 -0
- package/lib/builtins/sed.js +361 -0
- package/lib/builtins/tail.js +76 -0
- package/lib/local/read.js +63 -16
- package/package.json +1 -1
- package/test/builtins.test.js +217 -0
- package/test/local-commands.test.js +86 -0
- package/test/scripts.test.js +97 -0
- package/test/shell.test.js +159 -0
- package/test/wbt.test.js +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.10.7](https://github.com/eliotstocker/Brsh-JS/compare/v3.10.6...v3.10.7) (2026-11-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* enhanced POSIX compatibility ([076650d](https://github.com/eliotstocker/Brsh-JS/commit/076650d1e7db7d43502f389517879b8faca6ada9))
|
|
7
|
+
|
|
8
|
+
## [3.10.6](https://github.com/eliotstocker/Brsh-JS/compare/v3.10.5...v3.10.6) (2026-11-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **read:** add -r, backslash handling, multiple names and IFS splitting ([87235c1](https://github.com/eliotstocker/Brsh-JS/commit/87235c1c065481defa0bf5ca0973994c34106af6))
|
|
14
|
+
|
|
1
15
|
## [3.10.5](https://github.com/eliotstocker/Brsh-JS/compare/v3.10.4...v3.10.5) (2026-11-27)
|
|
2
16
|
|
|
3
17
|
|
package/POSIX-CHECKLIST.md
CHANGED
|
@@ -41,15 +41,15 @@ Track progress toward a POSIX-compliant `sh` implementation in Brsh-JS.
|
|
|
41
41
|
- [x] `$?` — last exit code
|
|
42
42
|
- [x] `$#` — positional parameter count
|
|
43
43
|
- [x] `$1` … `$n` — positional parameters
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
44
|
+
- [x] `$@` — all positional params as separate words *(`"$@"` in scripts, functions and `for` lists; expands to nothing with no args)*
|
|
45
|
+
- [x] `$*` — all positional params joined into one word *(unquoted form tested; `"$*"` not separately verified)*
|
|
46
46
|
- [ ] `$0` — script / shell name
|
|
47
47
|
- [ ] `$$` — current PID *(can be faked)*
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
48
|
+
- [x] `${var:-default}` — use default if unset/empty *(defaults may contain quotes, `$VAR` and `$(...)`; the colon-less `${var-default}` forms behave identically since empty variables are stored as unset)*
|
|
49
|
+
- [x] `${var:=default}` — assign default if unset/empty
|
|
50
|
+
- [x] `${var:?error}` — error if unset/empty *(fails the command; does not yet exit a non-interactive shell)*
|
|
51
|
+
- [x] `${var:+alt}` — use alt if set
|
|
52
|
+
- [x] `${#var}` — string length
|
|
53
53
|
- [ ] `${var#pattern}` — strip shortest prefix
|
|
54
54
|
- [ ] `${var##pattern}` — strip longest prefix
|
|
55
55
|
- [ ] `${var%pattern}` — strip shortest suffix
|
|
@@ -58,7 +58,8 @@ Track progress toward a POSIX-compliant `sh` implementation in Brsh-JS.
|
|
|
58
58
|
- [ ] `${var//from/to}` — replace all *(non-POSIX but common)*
|
|
59
59
|
|
|
60
60
|
### Expansion
|
|
61
|
-
- [x] Command substitution `$(cmd)`
|
|
61
|
+
- [x] Command substitution `$(cmd)` (nested quotes, parens and `;` `&&` `||` `|` inside are respected; output is never re-expanded)
|
|
62
|
+
- [x] Single quotes and `\$` keep `$` literal
|
|
62
63
|
- [x] Arithmetic expansion `$((expr))` (both `$VAR` and bare `VAR` forms)
|
|
63
64
|
- [ ] Tilde expansion (`~`, `~user`)
|
|
64
65
|
- [ ] Filename glob expansion (`*`, `?`, `[a-z]`)
|
|
@@ -102,13 +103,13 @@ Track progress toward a POSIX-compliant `sh` implementation in Brsh-JS.
|
|
|
102
103
|
- [x] `grep`
|
|
103
104
|
- [ ] `wc`
|
|
104
105
|
- [ ] `head`
|
|
105
|
-
- [
|
|
106
|
+
- [x] `tail` *(`-n`, `-c`, `+N`, legacy `-N`, multiple files, stdin; `-f` ignored)*
|
|
106
107
|
- [ ] `sort`
|
|
107
108
|
- [ ] `uniq`
|
|
108
109
|
- [ ] `tr`
|
|
109
110
|
- [ ] `cut`
|
|
110
111
|
- [ ] `tee` *(requires pipe support)*
|
|
111
|
-
- [
|
|
112
|
+
- [x] `sed` *(s with g/p/i/N flags, d, p, q, y, `=`, line/`$`/regex addresses, ranges, `!`, `-n`, `-e`, `-E`/`-r`, BRE by default; no a/i/c, `{}` blocks, hold space, `-f` or `-i`)*
|
|
112
113
|
- [ ] `awk`
|
|
113
114
|
|
|
114
115
|
### Filesystem
|
|
@@ -139,7 +140,7 @@ Track progress toward a POSIX-compliant `sh` implementation in Brsh-JS.
|
|
|
139
140
|
- [x] `which`
|
|
140
141
|
- [x] `true`
|
|
141
142
|
- [x] `false`
|
|
142
|
-
- [x] `read`
|
|
143
|
+
- [x] `read` (`-r`, backslash escapes and line continuation, multiple names, `IFS` splitting, `-n`, `-p`, `-t`; escaped separators still split, empty `IFS` unreachable from the shell)
|
|
143
144
|
- [x] `alias`
|
|
144
145
|
- [x] `exit`
|
|
145
146
|
|
|
@@ -149,12 +150,12 @@ Track progress toward a POSIX-compliant `sh` implementation in Brsh-JS.
|
|
|
149
150
|
|
|
150
151
|
1. **Input redirect (`<`)** — needed for many real scripts
|
|
151
152
|
2. **`shift` / `unset` / `:`** — small special builtins, high frequency in scripts
|
|
152
|
-
3.
|
|
153
|
-
4. **`${var
|
|
154
|
-
5. **`wc`, `head`, `
|
|
153
|
+
3. **`$0`** — script / shell name (currently expands to empty in scripts)
|
|
154
|
+
4. **`${var#pat}` / `${var%pat}` pattern removal** — the remaining common parameter expansion forms
|
|
155
|
+
5. **`wc`, `head`, `sort`, `uniq`, `tr`, `cut`** — most-used text utilities
|
|
155
156
|
6. **`basename` / `dirname`** — common path helpers
|
|
156
157
|
7. **`local`** — function-scoped variables
|
|
157
158
|
8. **`date`, `sleep`** — misc utilities
|
|
158
159
|
9. **`set -u` enforcement** — nounset mode
|
|
159
160
|
10. **Glob expansion** — needed for `ls *.txt` style usage
|
|
160
|
-
11. **`sed`
|
|
161
|
+
11. **`awk`**, and the missing `sed` pieces (`a`/`i`/`c`, blocks, `-i`) — complex; consider wasm or partial implementation
|