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

Take dynamic dependencies into account when calculating hashes #2596

Merged
merged 1 commit into from Dec 16, 2018

Conversation

lukastaegert
Copy link
Member

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 #2435

Description

Previously, hashes were only based on the file content and the content of all static dependencies.
This will also take dynamic dependencies into account.

@lukastaegert lukastaegert force-pushed the invalidate-hash-dynamic-dependencies branch from d6021ac to 50eb217 Compare December 16, 2018 09:44
@lukastaegert lukastaegert added this to In progress in Release 1.0.0 via automation Dec 16, 2018
@lukastaegert lukastaegert moved this from In progress to In Review in Release 1.0.0 Dec 16, 2018
@lukastaegert lukastaegert merged commit e12dcc7 into master Dec 16, 2018
Release 1.0.0 automation moved this from In Review to Done Dec 16, 2018
@lukastaegert lukastaegert deleted the invalidate-hash-dynamic-dependencies branch December 16, 2018 10:12
private computeContentHashWithDependencies(addons: Addons, options: OutputOptions): string {
const hash = sha256();

// own rendered source, except for finalizer wrapping
hash.update(this.getRenderedHash());
Copy link
Contributor

Choose a reason for hiding this comment

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

We do need the rendered hash of the source itself here. How else would changing the source without changing any other dependency information change the hash?

Copy link
Member Author

Choose a reason for hiding this comment

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

The rendered hash is added in visitDependencies. I made a note to add a new test category at some point to prove this is actually the case.

Copy link
Member Author

Choose a reason for hiding this comment

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

It might be somewhat confusing, though, that visitDependencies always visits the base chunk first. Maybe the name should be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Release 1.0.0
  
Done
Development

Successfully merging this pull request may close these issues.

Hashes aren't correctly invalidated when running Rollup in watch mode
2 participants