-
-
Couldn't load subscription status.
- Fork 235
feat(js): Add ability for include in JS sourcemap upload options to be an object
#1001
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(js): Add ability for include in JS sourcemap upload options to be an object
#1001
Conversation
include in sourcemap upload options to be an object in JSinclude in JS sourcemap upload options to be an object
|
I wonder if we actually need a new option This would be mapped to Eventually, we could move to webpack-like |
I specifically chose not to do that because I don't think we want to allow nesting, as it's not clear what that'd mean. As for webpack WDYT? |
|
Got it, makes sense, we can go with it. Can we however extract the 3rd possible type and give it some meaningful name? |
Done. I also made two more changes:
|
This mirrors the change in getsentry/sentry-cli#1001, which allows for path-specific options to be passed as part of the `include` option value. Specifically, this: - Fixes normalization of the `include` option to account for the new possibility of it being an object, and of the `ignore` option within that object - Adds tests for the normalization - Updates the README to reflect the new possibility - Fixes a bug in the normalization function `toArray()` so that falsy (but defined) values aren't ignored. We don't actually ever use it in a way which would make this an issue, but it seemed silly to leave the bug in place when the fix was so simple.
In the
@sentry/clicode, theReleases. uploadSourceMaps()method iterates over theincludearray inoptionsand calls a separate upload command for each entry (see here).This means that it's possible (at least in theory) to have different options for each
includeentry. This PR brings that theory to fruition.The motivation here is to make it easier to include multiple sets of files in the upload.
Suppose you have the following file structure:
and you want to upload only the files in
animals/aardvarks/researchandanimals/zebras/gifs. Further suppose that you want to prefix all of your files with~/zoo.Under the current system, you might try the following options:
but you'd end up with files with names like
~/zoo/google.txtand~/zoo/dramatic_zebra.gifwhen what you need is~/zoo/animals/aardvarks/research/google.txtand~/zoo/animals/zebras/gifs/dramatic_zebra.gif. No oneurlPrefixworks for both, and you'd similarly run into trouble if you tried to use anignorevalue which applied to one and not the other, or differentextvalues for each.To solve the prefix problem, you could do
but that involves writing out all of the things you don't want (brittle and also a giant pain if there are a lot of them), and it still doesn't solve the "different
extvalues for each entry" problem (or any of its friends related to other options likestripPrefix,rewrite, and the like).This solves that by allowing the user to specify options per
includevalue, like this:Any
includeentry which doesn't have its own options specified continues to use the globally-specified ones, as is the case today.NB: Since this new option is primarily here in order to unblock
@sentry/nextjs's use ofSentryWebpackPlugin, I have chosen not to document it anywhere, since to my knowledge no one has actually asked for it. If I were to do so, the question would then become whether to do it in theREADMEhere, ingetsentry/sentry-webpack-plugin'sREADME, in some other place, or any combination of the three. Open to opinions on this score.