fix(deps): move tinyspy from devDependencies to dependencies#320
Draft
arturosdg wants to merge 1 commit into
Draft
fix(deps): move tinyspy from devDependencies to dependencies#320arturosdg wants to merge 1 commit into
arturosdg wants to merge 1 commit into
Conversation
`tinyspy` is imported from `src/utils/tinyspyWrapper.ts` (uses `getInternalState`
and `internalSpyOn`) and the published bundle calls `require("tinyspy")` at
runtime. Until now it was declared as a devDependency, so consumers were
resolving it transitively via `vitest` (a phantom dependency):
consumer/node_modules/vitest depends on tinyspy → hoisted to top-level
→ wrapito/dist resolves it by node_modules traversal
This works on npm and Yarn classic thanks to flat hoisting, but is fragile:
- breaks under pnpm with default settings and Yarn PnP
- silently picks whatever tinyspy version the consumer's vitest brings,
which can drift away from the version wrapito was tested against
- breaks if vitest ever drops tinyspy
Declaring it as a real dependency fixes the latent bug. npm will dedupe
against the consumer's existing tinyspy when ranges overlap, so there is
no extra disk/install cost for the common case.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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.
Summary
Fix a latent phantom dependency:
tinyspyis imported fromsrc/utils/tinyspyWrapper.tsand the publisheddist/callsrequire("tinyspy")at runtime, but the package is declared as adevDependency. Today it only works in consumers becausevitest(which every wrapito consumer installs) brings tinyspy transitively and npm hoists it.Why this matters
node_modules, so wrapito fails to resolve tinyspy in those projects.vitesthappens to bring. If that version becomes incompatible with the internal APIs we use (getInternalState,internalSpyOn), wrapito breaks without any change on its side.Changes
package.json: movetinyspyfromdevDependenciestodependencies.No code changes.
dist/keeps the samerequire("tinyspy")it already had.Risk
Very low. npm and Yarn classic will dedupe the new declared dependency against the existing transitive one (same range), so consumers see no extra install and no version change.
Test plan
npm test— 82/82 passingnpm run build—dist/index.jsstill externalizes tinyspy viarequire("tinyspy")🤖 Generated with Claude Code