Skip to content

fix: declare optional solid-js peer dependency - #796

Open
bjesuiter wants to merge 2 commits into
codingcommons:mainfrom
bjesuiter:fix/declare-solid-js-peer
Open

bjesuiter wants to merge 2 commits into
codingcommons:mainfrom
bjesuiter:fix/declare-solid-js-peer

Conversation

@bjesuiter

Copy link
Copy Markdown

Problem

The root package exports typesafe-i18n/solid, and that adapter imports solid-js at runtime. The published 5.27.1 manifest only declares TypeScript as a peer, so strict or isolated package layouts cannot resolve the adapter's runtime import.

In a Bun project with linker = "isolated", the unpatched package fails in three paths:

  • bun -e "await import('typesafe-i18n/solid')" reports that it cannot find solid-js from the isolated typesafe-i18n package path.
  • node --input-type=module -e "await import('typesafe-i18n/solid')" fails with ERR_MODULE_NOT_FOUND for solid-js.
  • Vite 8.0.11's production build fails after 841 transformed modules because Rolldown cannot resolve solid-js from typesafe-i18n/solid/index.mjs.

Vite's development dependency optimization can hide the invalid package graph. The direct imports and production build expose it. bjesuiter/bgf-wlan-translation-v5#211 has the consuming-project context and full comparison.

Fix

Declare solid-js >=1.0.0 as an optional peer dependency in the published root manifest. Solid adapter users must provide Solid, while users of the runtime or other adapters should not have to install it. The existing typescript >=3.5.1 peer remains unchanged.

This is a manifest-only change. The repository has no package-manifest test seam, so I checked the packed artifact and installed that exact tarball in a fresh consumer instead of adding a new test framework.

Validation

  • pnpm install --frozen-lockfile
  • pnpm lint
  • pnpm test
  • pnpm build
  • npm pack --dry-run --json
  • Packed-manifest assertion for the ./solid export, both peer dependencies, and peerDependenciesMeta.solid-js.optional
  • Fresh Bun 1.4.2 install with linker = "isolated" from the exact tarball
  • Direct Bun import from the installed tarball
  • Direct Node 26.8.1 ESM import from the installed tarball
  • Vite 8.3.0 production build from the installed tarball

pnpm test:size also ran. It exceeded nearly every existing limit by 1 to 5 bytes, including unrelated runtime and framework entries. This patch changes package metadata only and cannot change those bundles, so I did not alter the limits.

This branch has not been deployed

No deployments
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