Skip to content

fix(compat): replace deprecated Kit 3 lib alias - #597

Merged
LudoLoops merged 2 commits into
mainfrom
584-remove-kit3-lib-alias
Oct 13, 2026
Merged

LudoLoops merged 2 commits into
mainfrom
584-remove-kit3-lib-alias

Conversation

@LudoLoops

Copy link
Copy Markdown
Contributor

Summary

  • Replace generated $lib imports with explicit-extension #lib package subpaths across SVForge templates and add-ons; preserve existing package imports entries and recognize legacy imports for add-on patch idempotency.
  • Stop injecting the deprecated sveltekit({ alias }) option. Update Vitest resolution while keeping $lib available as a Kit 2 test fallback.
  • Document tested compatibility behavior and version evidence.

Validation

  • bun run test — 121 files, 1,188 tests passed.
  • bun run lint, bun run typecheck, bun run build:all — passed.
  • Real Base and Base UI add-on scaffold profiles passed; packed sv add and packed svforge create journeys passed.
  • Real Dashboard scaffold with a fresh PostgreSQL test database passed build, check, 45 Vitest tests, and a /login dev smoke. The Vite dev log had no config_option_deprecated_alias warning.
  • Generated Base/Dashboard config and ESM #lib resolution regression passed.
  • Kit 2.57.0 project created by sv@0.15.4: build and 5 Vitest tests passed. svelte-check still reports existing Kit 2 hook-type incompatibilities; this is documented as evidence, not full Kit 2 certification.
  • bun run graphify:update completed.

Closes #584

Copy link
Copy Markdown
Contributor Author

Review of PR #597 — two merge blockers (head affed5fb3c1d60a836cbaaecf6516ca187cd2432).

GitHub Actions CI #587 passed its required quality job (full root tests, lint, typecheck, manifest freshness, build-all). The documented Kit 2 svelte-check incompatibility is not independently a blocker because the repository's support policy does not certify Kit 2 as a new-scaffold or migration target.

BLOCKER 1 — Preserve unrelated package imports without silently breaking conflicting #lib/* maps.

In packages/svforge/src/modes/base.ts (applyBaseMode, package.json transform), an existing "#lib/*": "./custom/lib/*" is preserved. But the PR now generates #lib/… imports for components actually written into src/lib. In that existing project, those imports resolve to custom/lib and fail. A Node package-import resolution check reproduces this behavior; the new test incorrectly treats preservation of a conflicting mapping as sufficient.

Correction: preserve unrelated consumer import entries, detect any conflicting #lib/* mapping and either reject the installation with a clear actionable diagnostic before generating a broken project, or implement and test a non-destructive alternative mapping. Add a conflict-case test that checks successful resolution or safe rejection.

BLOCKER 2 — Do not assume any node:url import supplies fileURLToPath.

patchVitestConfig() checks only whether there is a from 'node:url' import. For an existing valid config with import { pathToFileURL } from 'node:url' and no fileURLToPath, the patch adds aliases calling fileURLToPath(new URL(...)) but does not import that function. The generated Vitest config fails.

Correction: inspect whether fileURLToPath is actually in scope and add its import if absent. Add a regression test with an unrelated existing node:url import; verify the patched config loads, and patching twice is idempotent.

After fixes, rerun the config/consumer tests, relevant generated Base/Dashboard smoke, and required CI on the new commit. No need to expand into the documented, pre-existing Kit 2 hook types issue or to publish packages.

MERGE DECISION: DO NOT MERGE.

@LudoLoops

Copy link
Copy Markdown
Contributor Author

Both blockers are fixed in c1d25eb and pushed to this PR.

  • Conflicting package.json imports["#lib/*"] mappings now cancel the add-on before any SVForge files or manifest changes are applied; compatible ./src/lib/* and unrelated import entries remain supported. Regression coverage exercises an actual generated project and verifies it stays unchanged.
  • Vitest patching now checks for a runtime fileURLToPath binding (rather than any node:url import), adds the missing binding safely, and stays idempotent. A regression test imports pathToFileURL, applies the patch, and dynamically loads the resulting config.

Validation passed: bun run test (1,190 tests), bun run lint, bun run typecheck, bun run build:all, Base scaffold smoke, packed manual and svforge create Base journeys, and generated Base/Dashboard config tests. GitHub CI is currently running on the pushed commit; I am leaving the PR open and unmerged pending CI.

@LudoLoops

Copy link
Copy Markdown
Contributor Author

CI has completed on c1d25eb: the required quality check passed; main-smoke was skipped by workflow conditions. The PR remains open and unmerged for maintainer review.

Copy link
Copy Markdown
Contributor Author

Follow-up review of PR #597 at c1d25eb0d0b12a672c6ec12c882289d4885b84e2 — previous blockers resolved.

  • Former blocker 1 (#lib/* conflicts): FIXED. The add-on now checks the existing package import map in run() before registering file changes, rejects conflicting maps with an actionable diagnostic, and does not overwrite the consumer mapping. The real sv create + sv add regression checks the rejection, unchanged package/Vite config, and absence of SVForge files.
  • Former blocker 2 (fileURLToPath in Vitest): FIXED. The patch now checks for the required runtime import, adds it if absent (even when node:url is already imported for a different function), and retains an existing import alias. The regression checks that a patched config dynamically loads, produces both aliases, and is idempotent.
  • All changed #lib import paths, generated template mirrors, addon patch idempotency, compatibility documentation, and published-package Changeset have been reviewed. The documented Kit 2 hook-type svelte-check failure remains outside the repository's certified Kit 3 scaffold target; do not claim Kit 2 certification.
  • GitHub CI feat(i18n): English default and visible Paraglide EN/FR locale switcher #588: SUCCESS on this exact head. Its required quality job passed lint, typecheck, audits, manifest freshness, build-all, and the full root test step. main-smoke was correctly skipped for a PR; reported Base/Dashboard/packaged-consumer checks passed. No unresolved review threads; GitHub reports a clean merge.

MERGE DECISION: READY TO MERGE.

@LudoLoops
LudoLoops merged commit 6304081 into main Oct 13, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 13, 2026
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.

refactor(compat): remove SvelteKit 3 deprecated $lib alias from generated projects

1 participant