[PR #4042] [MERGED] feat(cli): support sveltekit $ imports in CLI generate cmd #30754

Closed
opened 2026-04-17 21:46:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4042
Author: @Kinfe123
Created: 8/16/2025
Status: Merged
Merged: 8/17/2025
Merged by: @Bekacru

Base: canaryHead: fix/sveltekit-dollar-imports-cli


📝 Commits (5)

📊 Changes

2 files changed (+164 additions, -1 deletions)

View changed files

📝 packages/cli/src/utils/add-svelte-kit-env-modules.ts (+118 -1)
📝 packages/cli/test/get-config.test.ts (+46 -0)

📄 Description

Summary by cubic

Adds support for SvelteKit $ imports in the CLI generate command. Resolves $env modules, $lib paths, and custom aliases so generation works in SvelteKit projects without errors.

  • New Features
    • Adds $env/dynamic and $env/static (private/public) via in-memory modules.
    • Detects SvelteKit by @sveltejs/kit dependency or svelte.config.*.
    • Resolves $lib and common subpaths (server, utils, components, stores) from src/lib or lib.
    • Parses custom aliases from svelte.config.js/ts (alias: { "$foo": "..." }), supporting both alias and alias/*.
    • Stubs $app/server to prevent CLI crashes.
    • Uses the CLI’s current working directory to resolve all paths.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4042 **Author:** [@Kinfe123](https://github.com/Kinfe123) **Created:** 8/16/2025 **Status:** ✅ Merged **Merged:** 8/17/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/sveltekit-dollar-imports-cli` --- ### 📝 Commits (5) - [`81be8d2`](https://github.com/better-auth/better-auth/commit/81be8d282bbef14761016cb6118cf90ef7eb67c7) sync - [`ebde277`](https://github.com/better-auth/better-auth/commit/ebde27794e35792d798ae9d789016547c6b4b68f) lint - [`65aeca2`](https://github.com/better-auth/better-auth/commit/65aeca27a96b777c87d05c97e065a01f6c9c6da6) sync - [`ca24941`](https://github.com/better-auth/better-auth/commit/ca24941d6606d0b1110bcb3af813d7db52171e72) sync - [`6ebf3ca`](https://github.com/better-auth/better-auth/commit/6ebf3ca40d0e874f0850f20b2c7e8fdd4a3a4275) lint ### 📊 Changes **2 files changed** (+164 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/utils/add-svelte-kit-env-modules.ts` (+118 -1) 📝 `packages/cli/test/get-config.test.ts` (+46 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds support for SvelteKit $ imports in the CLI generate command. Resolves $env modules, $lib paths, and custom aliases so generation works in SvelteKit projects without errors. - **New Features** - Adds $env/dynamic and $env/static (private/public) via in-memory modules. - Detects SvelteKit by @sveltejs/kit dependency or svelte.config.*. - Resolves $lib and common subpaths (server, utils, components, stores) from src/lib or lib. - Parses custom aliases from svelte.config.js/ts (alias: { "$foo": "..." }), supporting both alias and alias/*. - Stubs $app/server to prevent CLI crashes. - Uses the CLI’s current working directory to resolve all paths. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:46:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#30754