Repository navigation
Commit 3c1d051
committed
fix: detect the Node inspector enabled via NODE_OPTIONS
## Problem
The transform cache enables `sourcesContent` when Node's inspector is
running so debuggers can show original TypeScript. Detection scanned
only `process.execArgv` with a hand-maintained regex, so it missed the
inspector when enabled through `NODE_OPTIONS` (for example,
`NODE_OPTIONS='--inspect' tsx app.ts`) and did not cover
`--inspect-brk-node`. It also matched `--inspect-port` and
`--inspect-publish-uid`, which configure but do not enable the
inspector.
## Changes
Replace the regex scan with `getOptionValue(inspectFlag)` from
`get-option-value@^1.0.0`. This reads both `NODE_OPTIONS` and `execArgv`
and applies Node's implications, so `--inspect`, `--inspect-brk`,
`--inspect-wait`, and `--inspect-brk-node` all register as the inspector
being enabled. Source content is now emitted whenever the inspector is
on, however it was enabled.
get-option-value is a bundled devDependency, so pkgroll inlines the
relevant flag and scanner while tsx keeps esbuild as its only runtime
dependency.1 parent 40380a4 commit 3c1d051
3 files changed
Lines changed: 17 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
0 commit comments