Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/utils/transform/get-esbuild-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@
loader: 'default',
});

const isNodeDebuggerEnabled = process.execArgv.some((flag) => {

Check failure on line 13 in src/utils/transform/get-esbuild-options.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Block must not be padded by blank lines

Check failure on line 13 in src/utils/transform/get-esbuild-options.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`

// match Node.js debugger flags
// https://nodejs.org/api/cli.html#--inspecthostport
return /--inspect(-brk|-port|-publish-uid|-wait)?/.test(flag)

Check failure on line 17 in src/utils/transform/get-esbuild-options.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Capturing group number 1 is defined but never used

Check failure on line 17 in src/utils/transform/get-esbuild-options.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Missing semicolon
char8x marked this conversation as resolved.
Show resolved Hide resolved
})

Check failure on line 18 in src/utils/transform/get-esbuild-options.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Missing semicolon

export const cacheConfig = {
...baseConfig,

sourcemap: true,

/**
* Improve performance by only generating sourcesContent
* when V8 coverage is enabled
* when V8 coverage is enabled or Node.js debugger is enabled
*
* https://esbuild.github.io/api/#sources-content
*/
sourcesContent: Boolean(process.env.NODE_V8_COVERAGE),
sourcesContent: Boolean(process.env.NODE_V8_COVERAGE) || isNodeDebuggerEnabled,

/**
* Smaller output for cache and marginal performance improvement:
Expand Down
Loading