chore(package): declare svelte peer dependency and sideEffects: false#152
Merged
Conversation
The published manifest had no peerDependencies at all, so package managers could not warn on incompatible Svelte versions. The floor is 5.29: index.js re-exports from intersect.svelte.js, which imports fromAction from svelte/attachments at module top level, so every entry point needs it. Also mark the package side-effect-free — all modules are pure and the svelte/elements augmentation is types-only — so bundlers can tree-shake unused primitives.
render
Bot
temporarily deployed
to
metonym/add-svelte-peer-dependency - svelte-intersection-observer PR #152
July 5, 2026 20:16
Destroyed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The published package.json is generated by scripts/npm-package.ts and never declared a peerDependencies entry for svelte, so package managers couldn't warn on incompatible installs. The actual floor is svelte 5.29: index.js re-exports from intersect.svelte.js, which imports fromAction from svelte/attachments at module top level, so every entry point requires it even for consumers who only use the component.
This adds peerDependencies.svelte set to ^5.29.0 and sideEffects set to false to the generated manifest in scripts/npm-package.ts. All modules in the package are pure (no top-level DOM or global mutation, and the svelte/elements module augmentation is types-only), so marking the package side-effect-free lets bundlers tree-shake unused primitives like MultipleIntersectionObserver when an app only uses the intersect action.
Also updated the README compatibility table to say the 2.x row requires svelte >=5.29 instead of just 5, matching the new peer range.
Risk is low. This only changes metadata in the generated package.json (peerDependencies and sideEffects) and a doc table, no runtime code changed. Consumers on svelte 5.28 or earlier who were previously installing without warning will now see a peer dependency warning, which is the intended behavior since those versions don't actually work.