-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
feat: Add sourcemaps inject command #1469
Conversation
src/commands/sourcemaps/inject.rs
Outdated
pub fn make_command(command: Command) -> Command { | ||
command | ||
.about("Fixes up JavaScript source files and sourcemaps with debug ids.") | ||
// TODO: What are these {n}{n}s? They show up verbatim in the help output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They suppose to be terminal line-break specific to clap, but for some reason you say they stopped working? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The placeholders have apparently been in the send_envelope-help
test case since the beginning.
I'll review this next week, as I'm not even sure what we exactly want to achieve here tbh. |
I would vote to change |
This now uses sourcemap-related functions that were added in |
@loewenheim I think |
But if the snippet was already added, the file should have a |
@lforst has convinced me that backing up the files before modifying them is the wrong thing to do, for two reasons:
|
This implements #1467.
It adds a new subcommand
inject PATH
to thesourcemaps
command that works as follows:For each
.js
filefile.js
inPATH
,file.js
contains a//# sentryDebugId
//# debugId
comment, skip it (it has already been processed).file.js
does not contain a//# sourceMappingURL=<sourcemap_path>
comment, skip it (without a sourcemap there's nothing to do).sourcemap_path
exists. If not, emit a warning and skipfile.js
.sourcemap_path
contains a debug id under thedebugID
x_sentry_debug_id
debug_id
key. If so, return it, otherwise insert a fresh debug id under that key and return that.//# sentryDebugId=__SENTRY_DEBUG_ID__
comment tofile.js
, where__SENTRY_DEBUG_ID__
is replaced with the debug id returned in step 4.This procedure differs slightly from the description in #1467: it checks first whether the sourcemap already contains a debug id instead of unconditionally generating a new one.