Repository navigation
feat(sourcemap): Add wasm sourcemap support for inject and upload #1629
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
Open
sentry-junior
wants to merge
6
commits into
port/cli-1572-wasm-upload
from
port/cli-1588-wasm-sourcemaps
+1,673
−76
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9603ea6
feat(sourcemap): Add wasm sourcemap support for inject and upload
sentry-junior[bot] cbf136c
fix(sourcemap): Leave --ignore'd files out of the zero-pairs counts
sentry-junior[bot] 08e9c3b
fix(sourcemap): Don't upload or misreport unusable wasm pairs
sentry-junior[bot] e958e67
Merge port/cli-1572-wasm-upload into port/cli-1588-wasm-sourcemaps
sentry-junior[bot] 28d3b4c
chore: Retrigger mergeability check after merging the base branch
sentry-junior[bot] 456329b
Merge port/cli-1572-wasm-upload into port/cli-1588-wasm-sourcemaps
sentry-junior[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /** | ||
| * Replace a file's contents without ever leaving it half-written. | ||
| * | ||
| * Used where the CLI rewrites a user's build output in place (wasm modules, | ||
| * sourcemaps). A plain `writeFile` truncates first, so a full disk or a kill | ||
| * mid-write leaves a corrupt artifact; writing a sibling and renaming it over | ||
| * the target is atomic on the same filesystem. The original's mode is kept so | ||
| * an executable or read-only-for-others file stays that way. | ||
| */ | ||
|
|
||
| import { randomBytes } from "node:crypto"; | ||
| import { rename, rm, stat, writeFile } from "node:fs/promises"; | ||
|
|
||
| /** | ||
| * Atomically replace `path` with `data`. | ||
| * | ||
| * @param path - Existing file to replace | ||
| * @param data - New contents | ||
| */ | ||
| export async function replaceFile( | ||
| path: string, | ||
| data: string | Uint8Array, | ||
| ): Promise<void> { | ||
| const { mode } = await stat(path); | ||
| const tmp = `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`; | ||
| try { | ||
| await writeFile(tmp, data, { mode }); | ||
| await rename(tmp, path); | ||
| } finally { | ||
| await rm(tmp, { force: true }); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.