Skip to content

feat: support kit's explicit environment variables#1122

Merged
jycouet merged 26 commits into
mainfrom
env-and-more
Jun 9, 2026
Merged

feat: support kit's explicit environment variables#1122
jycouet merged 26 commits into
mainfrom
env-and-more

Conversation

@jycouet

@jycouet jycouet commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

  • drizzle and better-auth now emit kit's explicit environment variables (src/env.ts + $app/env/private) when the project uses them in kit 3 / next, or kit 2 with explicitEnvironmentVariables. And fall back to legacy $env/dynamic/private otherwise.
  • Adds a defineEnv helper to sv-utils.
  • diff is big because of a new snapshot testing... that covers envs

The new util will be reuse for a future sv migrate env !

Checklist

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

jycouet added 21 commits June 8, 2026 21:23
…rom cwd

Drop dependencyVersion/language from the context (read kit version and ts/js
from cwd) to match svelteConfig's { sv, cwd } shape. Rename declare -> define.
Mode stays internal; add-ons never thread it.
Mirrors the workspace's resolution so a monorepo project that declares kit only
in a parent package.json is still detected (closest wins).
…ng it

Add-ons pass dependencyVersion('@sveltejs/kit') (the engine's authoritative,
walk-up-aware resolution). Removes findKitRange's package.json walk-up from
sv-utils - dependency resolution belongs to the engine, not sv-utils. The
experimental flag is still read from the config here, where config-reading
already lives.
Call site is just { sv, cwd, dependencyVersion } - the workspace's authoritative
walk-up lookup, called internally for @sveltejs/kit. Cleaner than threading a
pre-resolved kitVersion value.
@changeset-bot

changeset-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b67ab07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sveltejs/sv-utils Minor
sv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@jycouet jycouet merged commit fbdb1a0 into main Jun 9, 2026
6 checks passed
@jycouet jycouet deleted the env-and-more branch June 9, 2026 11:38
@github-actions github-actions Bot mentioned this pull request Jun 9, 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.

2 participants