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

Provide normalized options #3597

Merged
merged 27 commits into from May 27, 2020
Merged

Provide normalized options #3597

merged 27 commits into from May 27, 2020

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented May 26, 2020

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:
Resolves #3018

Description

This completely refactors how options are handled internally. Basically there are now two types "NormalizedInputOptions" and "NormalizedOutputOptions" that represent a normalized view of the options with all defaults merged in.
All option validation, option normalization and applicable deprecation warnings have been moved to a central place. Internally, only the normalized options are passed around instead of putting them on various classes such as Graph.

As a positive net effect for end users, the buildStart and renderStart hooks will now receive normalized options as well so there is no reason to hard-code any Rollup defaults in plugins.

@rollup-bot
Copy link
Collaborator

rollup-bot commented May 26, 2020

Thank you for your contribution! ❤️

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

npm install rollup/rollup#normalize-options

or load it into the REPL:
https://rollupjs.org/repl/?circleci=11418

@codecov
Copy link

codecov bot commented May 26, 2020

Codecov Report

Merging #3597 into master will increase coverage by 0.04%.
The diff coverage is 99.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3597      +/-   ##
==========================================
+ Coverage   96.30%   96.35%   +0.04%     
==========================================
  Files         177      180       +3     
  Lines        6070     6140      +70     
  Branches     1787     1799      +12     
==========================================
+ Hits         5846     5916      +70     
+ Misses        112      111       -1     
- Partials      112      113       +1     
Impacted Files Coverage Δ
cli/cli.ts 71.42% <ø> (ø)
cli/run/batchWarnings.ts 95.27% <ø> (-2.37%) ⬇️
cli/run/loadConfigFile.ts 95.55% <ø> (ø)
cli/run/loadConfigFromCommand.ts 100.00% <ø> (ø)
src/ast/nodes/ImportExpression.ts 100.00% <ø> (ø)
src/ast/nodes/MemberExpression.ts 98.27% <ø> (ø)
src/finalisers/es.ts 100.00% <ø> (ø)
src/finalisers/index.ts 100.00% <ø> (ø)
src/finalisers/shared/warnOnBuiltins.ts 100.00% <ø> (ø)
src/finalisers/system.ts 97.75% <ø> (ø)
... and 46 more

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 00e197f...0eb883c. Read the comment docs.

@lukastaegert lukastaegert merged commit 9bff788 into master May 27, 2020
@lukastaegert lukastaegert deleted the normalize-options branch May 27, 2020 18:09
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.

broken cli arguments (all watch options)
2 participants