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

Update sourcemapPathTransform to also take the path to the sourcemap … #3617

Merged
merged 6 commits into from Jun 8, 2020
Merged

Update sourcemapPathTransform to also take the path to the sourcemap … #3617

merged 6 commits into from Jun 8, 2020

Conversation

dgoldstein0
Copy link
Contributor

@dgoldstein0 dgoldstein0 commented Jun 5, 2020

…file as a second argument

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers: #3615

Description

This aims to solve the problem in #3615. I need some help figuring out the best way to write the test for this. I manually tested by making the same change to rollup in my project and verified I could generate sourcemaps correctly by utilizing this change.

Comment on lines 14 to 17
generateError: {
code: 'VALIDATION_ERROR',
message: 'sourcemapPathTransform function must return a string.'
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this section is wrong but I didn't find a way to assert about the sourcemap output or even just the js output... pointers here would be helpful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you just extend this one to use the new parameter: https://github.com/rollup/rollup/tree/master/test/sourcemaps/samples/transform-source-paths ? Alternatively, you can put a modified one next to it.

@@ -670,7 +670,7 @@ The location of the generated bundle. If this is an absolute path, all the `sour
`sourcemapFile` is not required if `output` is specified, in which case an output filename will be inferred by adding ".map" to the output filename for the bundle.

#### output.sourcemapPathTransform
Type: `(sourcePath: string) => string`
Type: `(sourcePath: string, sourcemapPath: string) => string`

A transformation to apply to each path in a sourcemap. For instance the following will change all paths to be relative to the `src` directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a short explanation of what sourcePath is as opposed to sourcemapPath here would help avoid a lot of confusion.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me, see my two comments regarding fixing the test and slightly extending documentation.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I will be on vacation shortly I performed my suggested changes myself and fixed the types, I hope you do not mind.

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #3617 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3617   +/-   ##
=======================================
  Coverage   96.48%   96.48%           
=======================================
  Files         182      182           
  Lines        6236     6236           
  Branches     1830     1830           
=======================================
  Hits         6017     6017           
  Misses        108      108           
  Partials      111      111           
Impacted Files Coverage Δ
src/utils/options/normalizeOutputOptions.ts 100.00% <ø> (ø)
src/Chunk.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef978c1...075cc40. Read the comment docs.

@lukastaegert lukastaegert merged commit 37b876c into rollup:master Jun 8, 2020
@dgoldstein0
Copy link
Contributor Author

dgoldstein0 commented Jun 8, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants