Skip to content

chore(package): declare svelte peer dependency and sideEffects: false#152

Merged
metonym merged 1 commit into
masterfrom
metonym/add-svelte-peer-dependency
Jul 5, 2026
Merged

chore(package): declare svelte peer dependency and sideEffects: false#152
metonym merged 1 commit into
masterfrom
metonym/add-svelte-peer-dependency

Conversation

@metonym

@metonym metonym commented Jul 5, 2026

Copy link
Copy Markdown
Owner

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.

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
render Bot temporarily deployed to metonym/add-svelte-peer-dependency - svelte-intersection-observer PR #152 July 5, 2026 20:16 Destroyed
@metonym
metonym merged commit 28a7d3c into master Jul 5, 2026
3 checks passed
@metonym
metonym deleted the metonym/add-svelte-peer-dependency branch July 5, 2026 20:19
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.

1 participant