Commit c044b25
authored
fix(memos-local-plugin): Node.js v23 built-in TypeScript breaks bridge.cts (#1484)
## Summary
- Node.js v23.6+ enables `--experimental-strip-types` by default,
causing its native `.cts` handler (`Object.loadCTS`) to take precedence
over `tsx`. The native handler only strips type annotations without
transforming ESM `import` to `require()`, resulting in `SyntaxError:
Cannot use import statement outside a module` when loading `bridge.cts`.
- Set `NODE_OPTIONS='--no-experimental-strip-types'` when Node >= 23 is
detected in both `daemon_manager.py` (hermes + openharness adapters) and
`install.sh`, so `tsx` fully handles the compilation.
## Error reproduced
```
(node:70572) Warning: Failed to load the ES module: bridge.cts
SyntaxError: Cannot use import statement outside a module
at Object.loadCTS [as .cts] (node:internal/modules/cjs/loader:1797:10)
```
## Files changed
| File | Change |
|------|--------|
| `adapters/hermes/daemon_manager.py` | Detect Node >= 23, set
`--no-experimental-strip-types` in env before launching daemon |
| `adapters/openharness/scripts/daemon_manager.py` | Same fix for
openharness adapter |
| `install.sh` | Export `NODE_OPTIONS` in environment check when Node >=
23 detected |
## Test plan
- [ ] Install plugin on Node.js v23.x — daemon should start without
`SyntaxError`
- [ ] Install plugin on Node.js v22.x (LTS) — no regression,
`NODE_OPTIONS` not set
- [ ] Verify memory viewer accessible at `http://127.0.0.1:18901` after
install on Node 233 files changed
Lines changed: 32 additions & 0 deletions
File tree
- apps/memos-local-plugin
- adapters
- hermes
- openharness/scripts
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
129 | 143 | | |
130 | 144 | | |
131 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
| |||
0 commit comments