Commit 56c8985
Fix Dynamic require of "tty" crash under ESM Node (#211)
The esbuild dynamic-require shim in the ESM Node bundles had no real
`require` to delegate to at chunk-init, so any runtime `require("tty")`
/ `require("os")` from the `file-type` → `debug` → `supports-color`
chain threw "Dynamic require of \"tty\" is not supported". This made
the `file` command crash for every consumer importing just-bash as ESM
and for the `just-bash` CLI binary.
Provide `createRequire(import.meta.url)` via the build banner for
`build:lib`, `build:cli`, and `build:shell`. CJS and browser bundles
are unchanged.
Add regression tests covering both the bundled CLI binary and the ESM
library bundle running the `file` command.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5fdc8f6 commit 56c8985
3 files changed
Lines changed: 47 additions & 3 deletions
File tree
- .changeset
- packages/just-bash
- src/cli
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
99 | 114 | | |
100 | 115 | | |
101 | 116 | | |
| |||
186 | 201 | | |
187 | 202 | | |
188 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
0 commit comments