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

Built files in _observablehq, _import, and _npm can change content without changing their name #1555

Closed
mbostock opened this issue Aug 7, 2024 · 0 comments · Fixed by #1557
Labels
bug Something isn’t working

Comments

@mbostock
Copy link
Member

mbostock commented Aug 7, 2024

Framework tries to maintain the contract (via content hashes and exact versions) that built files in _observablehq, _import, and _npm should change their name if their content changes, allowing immutable caching in the browser for better performance. However, in practice, this contract can be broken for several reasons.

  1. Files in _observablehq can change between Framework releases, and because they bake-in the resolved versions of npm dependencies (such as via the recommended libraries and FileAttachment APIs).
  2. Files in _import can change because they bake-in the resolved versions of npm dependencies, and these resolved versions are not considered as part of the content hash (which only considers the original path of the import, pre-resolution, such as npm:@observablehq/plot).
  3. Files in _npm can change because they bake-in the resolved versions of (transitive) npm dependencies. For example, @observablehq/plot depends on d3, and the version of d3 can change independently of @observablehq/plot.

To maintain this contract, Framework will need to apply hashes (or other unique identifiers) to both _observablehq and _npm, and also fix how the hash is computed in _import.

@mbostock mbostock added the bug Something isn’t working label Aug 7, 2024
@mbostock mbostock mentioned this issue Aug 7, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant