Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: generate sourcesContent when Node.js debugger is enabled #670

Merged
merged 2 commits into from
Oct 26, 2024

Conversation

char8x
Copy link
Contributor

@char8x char8x commented Oct 24, 2024

This PR attempts to fix the issue described here: #661

If make changes to tsx/src/run.ts, the --inspect flag will be confused with the flag of the custom program.

// run command
./dist/cli.mjs --inspect temp/test.ts --inspect-xxx

// tsx/src/run.ts
// `console.log(argv)`
[ '--inspect', 'temp/test.ts', '--inspect-xxx' ]

But in src/utils/transform/get-esbuild-options.ts, process.execArgv doesn't have this problem

// run command
./dist/cli.mjs --inspect temp/test.ts --inspect-xxx

// src/utils/transform/get-esbuild-options.ts
// `console.log(process.execArgv)`
[
  '--require',
  '/home/debian/tsx/dist/preflight.cjs',
  '--import',
  'file:///home/debian/tsx/dist/loader.mjs',
  '--inspect'
]

@privatenumber
Copy link
Owner

Since we can't really add tests for this, can you confirm this fixes your problem?

I published a prerelease here:

npm i 'privatenumber/tsx#npm/fix-node-debugger'

or

npx 'privatenumber/tsx#npm/fix-node-debugger' file.ts # same as `npx tsx file.ts`

@char8x
Copy link
Contributor Author

char8x commented Oct 26, 2024

I checked it out and it works.

@privatenumber privatenumber merged commit 7c47074 into privatenumber:master Oct 26, 2024
3 checks passed
@privatenumber
Copy link
Owner

Thanks for the PR @char8x !

@privatenumber
Copy link
Owner

This issue is now resolved in v4.19.2.

If you're able to, your sponsorship would be very much appreciated.

renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Oct 27, 2024
##### [v4.19.2](https://github.com/privatenumber/tsx/releases/tag/v4.19.2)

##### Bug Fixes

-   generate sourcesContent when Node.js debugger is enabled ([#670](privatenumber/tsx#670)) ([7c47074](privatenumber/tsx@7c47074))

***

This release is also available on:

-   [npm package (@latest dist-tag)](https://www.npmjs.com/package/tsx/v/4.19.2)
@char8x char8x deleted the fix-node-debugger branch October 27, 2024 01:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants