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

Add sanitizeFileName option #4058

Merged
merged 26 commits into from Apr 29, 2021
Merged

Conversation

guybedford
Copy link
Contributor

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:

Description

As an alternative to #4050 this provides a sanitizeFileNames output option that can be set to a function or false to allow hooking or disabling the chunk name sanitization process.

//cc @lukastaegert

@github-actions
Copy link

github-actions bot commented Apr 26, 2021

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install guybedford/rollup#sanitize-file-names

or load it into the REPL:
https://rollupjs.org/repl/?pr=4058

@guybedford guybedford changed the title Add sanitizeFileNames option Add sanitizeFileName option Apr 26, 2021
@codecov
Copy link

codecov bot commented Apr 26, 2021

Codecov Report

Merging #4058 (466d3d1) into master (8c59abe) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4058      +/-   ##
==========================================
- Coverage   97.45%   97.43%   -0.02%     
==========================================
  Files         192      192              
  Lines        6795     6794       -1     
  Branches     1996     1995       -1     
==========================================
- Hits         6622     6620       -2     
  Misses         84       84              
- Partials       89       90       +1     
Impacted Files Coverage Δ
src/Bundle.ts 100.00% <ø> (ø)
src/utils/PluginContext.ts 100.00% <ø> (ø)
src/utils/options/mergeOptions.ts 100.00% <ø> (ø)
src/Chunk.ts 100.00% <100.00%> (ø)
src/utils/FileEmitter.ts 100.00% <100.00%> (ø)
src/utils/PluginDriver.ts 100.00% <100.00%> (ø)
src/utils/options/normalizeOutputOptions.ts 100.00% <100.00%> (ø)
src/utils/relativeId.ts 100.00% <100.00%> (ø)
src/utils/renderNamePattern.ts 100.00% <100.00%> (ø)
src/utils/sanitizeFileName.ts 66.66% <0.00%> (-33.34%) ⬇️

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 8c59abe...466d3d1. Read the comment docs.

src/Chunk.ts Outdated Show resolved Hide resolved
src/utils/renderNamePattern.ts Outdated Show resolved Hide resolved
src/utils/relativeId.ts Outdated Show resolved Hide resolved
@guybedford
Copy link
Contributor Author

Thanks for the review, I've pushed the changes, there's just the question of the default argument left to resolve as per discussion above.

@guybedford
Copy link
Contributor Author

I've added the validation changes here, PTAL.

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.

👍

@lukastaegert lukastaegert merged commit 81e0afc into rollup:master Apr 29, 2021
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