Commit 7bb0672
committed
fix: avoid top-level await in bun-runner so hooks load on Node < 14.8
bun-runner.js is an ES module that uses a top-level `await collectStdin()`.
Top-level await is unsupported by the ESM loader of Node < 14.8, so on hosts
where Claude Code invokes hooks with an older Node (e.g. the Node 12 shipped
by Ubuntu 22.04 / many WSL setups) the module fails to load with
"SyntaxError: Unexpected reserved word", breaking every claude-mem hook.
Wrap the post-collectStdin body in an async IIFE so `await` is no longer at
module scope. Same oldest-Node compatibility concern already handled in this
file for optional chaining (see the `?.` note above isPluginDisabledInClaudeSettings).
Repro: `node --check plugin/scripts/bun-runner.js` under Node 12 fails before
this change and passes after.1 parent 3fe0725 commit 7bb0672
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
236 | 242 | | |
237 | 243 | | |
238 | 244 | | |
| 245 | + | |
0 commit comments