Repository navigation
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
✅ Staging deployment successful! Preview: https://viteplus-staging.void.app/ |
|
Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.
Updated: |
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.52 MiB | 2.79 MiB | +274.89 KiB (+10.64%) |
packages/core/dist |
Directory total | 4.29 MiB | 4.29 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.81 MiB | 7.08 MiB | +274.89 KiB (+3.94%) |
vp (Linux x64) |
Binary | 9.31 MiB | 9.31 MiB | 0 B (0.00%) |
vp (Linux x64) |
gzip -9 | 4.26 MiB | 4.26 MiB | -201 B (-0.00%) |
| NAPI (Linux x64) | Binary | 37.99 MiB | 38.05 MiB | +60.00 KiB (+0.15%) |
| NAPI (Linux x64) | gzip -9 | 15.33 MiB | 15.34 MiB | +13.94 KiB (+0.09%) |
vp (macOS ARM64) |
Binary | 6.12 MiB | 6.12 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
gzip -9 | 3.65 MiB | 3.65 MiB | +266 B (+0.01%) |
| NAPI (macOS ARM64) | Binary | 44.39 MiB | 44.44 MiB | +48.42 KiB (+0.11%) |
| NAPI (macOS ARM64) | gzip -9 | 19.42 MiB | 19.44 MiB | +19.77 KiB (+0.10%) |
vp (Windows x64) |
Binary | 7.27 MiB | 7.27 MiB | +512 B (+0.01%) |
vp (Windows x64) |
gzip -9 | 3.33 MiB | 3.33 MiB | +436 B (+0.01%) |
| NAPI (Windows x64) | Binary | 33.88 MiB | 33.93 MiB | +51.50 KiB (+0.15%) |
| NAPI (Windows x64) | gzip -9 | 14.04 MiB | 14.05 MiB | +10.63 KiB (+0.07%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.09 KiB | 7.09 KiB | 0 B (0.00%) |
| Installer (Windows x64) | Binary | 4.70 MiB | 4.70 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 2.25 MiB | 2.25 MiB | 0 B (0.00%) |
|
|
||
| 1. `.env.schema`: the committed schema and default values | ||
| 2. `.env`: loaded, but prefer the files below | ||
| 3. `.env.local`: your machine-only values, git-ignored |
There was a problem hiding this comment.
If a vp tool reads .env.local and gets cached, the content of .env.local will be fingerprinted even though it's git-gignored. Do we need to do anything about this?
There was a problem hiding this comment.
It needs to be excluded, just make the cache judgment based only on the whitelist of environment variables configured by the user.
ae214b9 to
8293bde
Compare
|
How
Modes. A schema without # @currentEnv=$APP_ENV
# ---
# @public @type=enum(development, staging, production, test)
APP_ENV=developmentAPP_ENV=production vp build
APP_ENV=test vp test
In CI, The follow-up passes the Vite mode to varlock as the default environment, as varlock's Next.js integration does.
import 'varlock/auto-load';
import { ENV } from 'varlock/env';
import { defineConfig } from 'vite-plus';
export default defineConfig({
server: { port: ENV.API_PORT },
});
Guide sections: Vite modes, Using |
Preview binary sizes (
|
| Binary | Latest release | Preview | Change |
|---|---|---|---|
vp (macOS ARM64) |
6.11 MiB | 6.12 MiB | +16.27 KiB (+0.26%) |
| NAPI (macOS ARM64) | 44.35 MiB | 44.39 MiB | +48.45 KiB (+0.11%) |
vp (macOS x64) |
7.71 MiB | 7.73 MiB | +20.20 KiB (+0.26%) |
| NAPI (macOS x64) | 49.94 MiB | 50.02 MiB | +80.10 KiB (+0.16%) |
vp (Linux ARM64 GNU) |
7.72 MiB | 7.74 MiB | +23.98 KiB (+0.30%) |
| NAPI (Linux ARM64 GNU) | 33.66 MiB | 33.71 MiB | +56.00 KiB (+0.16%) |
vp (Linux ARM64 musl) |
7.80 MiB | 7.83 MiB | +25.51 KiB (+0.32%) |
| NAPI (Linux ARM64 musl) | 32.87 MiB | 32.93 MiB | +58.50 KiB (+0.17%) |
vp (Linux x64 GNU) |
9.28 MiB | 9.31 MiB | +27.98 KiB (+0.29%) |
| NAPI (Linux x64 GNU) | 37.89 MiB | 37.97 MiB | +80.00 KiB (+0.21%) |
vp (Linux x64 musl) |
9.35 MiB | 9.38 MiB | +30.51 KiB (+0.32%) |
| NAPI (Linux x64 musl) | 37.08 MiB | 37.16 MiB | +76.63 KiB (+0.20%) |
vp (Windows x64) |
7.25 MiB | 7.27 MiB | +22.00 KiB (+0.30%) |
| NAPI (Windows x64) | 33.49 MiB | 33.57 MiB | +76.00 KiB (+0.22%) |
| Trampoline (Windows x64) | 13.00 KiB | 13.00 KiB | 0 B (0.00%) |
| Installer (Windows x64) | 4.70 MiB | 4.71 MiB | +9.00 KiB (+0.19%) |
vp (Windows ARM64) |
6.45 MiB | 6.47 MiB | +22.50 KiB (+0.34%) |
| NAPI (Windows ARM64) | 29.50 MiB | 29.55 MiB | +55.00 KiB (+0.18%) |
| Trampoline (Windows ARM64) | 13.00 KiB | 13.00 KiB | 0 B (0.00%) |
| Installer (Windows ARM64) | 3.87 MiB | 3.88 MiB | +8.00 KiB (+0.20%) |
gzip -9 sizes
| Binary | Latest release | Preview | Change |
|---|---|---|---|
vp (macOS ARM64) |
3.63 MiB | 3.65 MiB | +13.75 KiB (+0.37%) |
| NAPI (macOS ARM64) | 19.40 MiB | 19.43 MiB | +31.87 KiB (+0.16%) |
vp (macOS x64) |
3.82 MiB | 3.84 MiB | +13.96 KiB (+0.36%) |
| NAPI (macOS x64) | 20.75 MiB | 20.78 MiB | +28.83 KiB (+0.14%) |
vp (Linux ARM64 GNU) |
4.18 MiB | 4.19 MiB | +12.17 KiB (+0.28%) |
| NAPI (Linux ARM64 GNU) | 14.52 MiB | 14.54 MiB | +23.00 KiB (+0.15%) |
vp (Linux ARM64 musl) |
4.21 MiB | 4.22 MiB | +16.17 KiB (+0.38%) |
| NAPI (Linux ARM64 musl) | 14.22 MiB | 14.25 MiB | +26.59 KiB (+0.18%) |
vp (Linux x64 GNU) |
4.24 MiB | 4.26 MiB | +15.25 KiB (+0.35%) |
| NAPI (Linux x64 GNU) | 15.27 MiB | 15.30 MiB | +22.68 KiB (+0.15%) |
vp (Linux x64 musl) |
4.27 MiB | 4.29 MiB | +16.21 KiB (+0.37%) |
| NAPI (Linux x64 musl) | 14.95 MiB | 14.98 MiB | +26.22 KiB (+0.17%) |
vp (Windows x64) |
3.32 MiB | 3.33 MiB | +11.61 KiB (+0.34%) |
| NAPI (Windows x64) | 13.88 MiB | 13.91 MiB | +24.07 KiB (+0.17%) |
| Trampoline (Windows x64) | 7.14 KiB | 7.14 KiB | -1 B (-0.01%) |
| Installer (Windows x64) | 2.25 MiB | 2.25 MiB | +4.73 KiB (+0.21%) |
vp (Windows ARM64) |
3.18 MiB | 3.19 MiB | +14.10 KiB (+0.43%) |
| NAPI (Windows ARM64) | 13.15 MiB | 13.18 MiB | +25.46 KiB (+0.19%) |
| Trampoline (Windows ARM64) | 6.93 KiB | 6.92 KiB | -1 B (-0.01%) |
| Installer (Windows ARM64) | 2.15 MiB | 2.15 MiB | +4.62 KiB (+0.21%) |
Raw sizes are uncompressed file sizes. gzip sizes recompress each binary at level 9; they are not package or download archive sizes.
The baseline uses published release files, including NAPI packages from npm at the same version. Build versions and toolchains can affect the difference.
Registry bridge build (
|
| Package | Version |
|---|---|
vite-plus |
0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb |
@voidzero-dev/vite-plus-core |
0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb |
create-vite-plus |
0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb |
Install the Vite+ CLI built from this commit, then migrate a project:
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/voidzero-dev/vite-plus/1e65e4269a7cea61f0058d0674d64f3b6f5de0fb/packages/cli/install.sh | VP_PR_VERSION=3670 VP_LEGACY_INSTALLER_URL=https://raw.githubusercontent.com/voidzero-dev/vite-plus/1e65e4269a7cea61f0058d0674d64f3b6f5de0fb/packages/cli/install-legacy.sh bash# Windows (PowerShell)
$env:VP_PR_VERSION="3670"; $env:VP_LEGACY_INSTALLER_URL="https://raw.githubusercontent.com/voidzero-dev/vite-plus/1e65e4269a7cea61f0058d0674d64f3b6f5de0fb/packages/cli/install-legacy.ps1"; irm https://raw.githubusercontent.com/voidzero-dev/vite-plus/1e65e4269a7cea61f0058d0674d64f3b6f5de0fb/packages/cli/install.ps1 | iexOr install with Homebrew (macOS / glibc Linux):
These commands use the formula and binary from this published commit. Replace brew install with brew reinstall if the tap package is already installed.
If Homebrew Core’s vite-plus is installed, run brew uninstall vite-plus first. This keeps your user data; do not run vp implode to switch installations.
(
set -eu
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_VP_PR_VERSION=1e65e4269a7cea61f0058d0674d64f3b6f5de0fb
brew tap voidzero-dev/vite-plus https://github.com/voidzero-dev/vite-plus
preview_tap="$(brew --repository voidzero-dev/vite-plus)"
git -C "$preview_tap" fetch --depth=1 https://github.com/voidzero-dev/vite-plus.git "$HOMEBREW_VP_PR_VERSION"
git -C "$preview_tap" switch --detach "$HOMEBREW_VP_PR_VERSION"
brew install voidzero-dev/vite-plus/vp
brew test voidzero-dev/vite-plus/vp
"$(brew --prefix)/bin/vp"
)The tap stays at the tested commit. Return it to main after testing:
git -C "$(brew --repository voidzero-dev/vite-plus)" switch mainOr download the standalone Windows installer built from this commit:
| Architecture | Installer |
|---|---|
| x64 | vp-setup-x86_64-pc-windows-msvc.exe |
| Arm64 | vp-setup-aarch64-pc-windows-msvc.exe |
GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:
.\vp-setup.exe --version "0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb" --registry "https://registry-bridge.viteplus.dev/"After installing, upgrade the current project's vite-plus to this test build with:
vp migrateOr create a new project from this commit without installing the CLI:
export npm_config_registry=https://registry-bridge.viteplus.dev/ pnpm_config_registry=https://registry-bridge.viteplus.dev/
pnpm create vite-plus@0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb # or: npm create vite-plus@0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb$env:npm_config_registry="https://registry-bridge.viteplus.dev/"; $env:pnpm_config_registry="https://registry-bridge.viteplus.dev/"
pnpm create vite-plus@0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb # or: npm create vite-plus@0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fbpnpm 11+ reads pnpm_config_registry, npm and older pnpm read npm_config_registry. The new project pins this build, so keep the registry set for later installs, or configure it as below.
Or point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:
| Package manager | Registry config |
|---|---|
| npm / pnpm / Bun | .npmrc: registry=https://registry-bridge.viteplus.dev/ |
| Yarn (v2+) | .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/" |
Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):
{
"devDependencies": {
"vite-plus": "0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb",
"vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.1e65e4269a7cea61f0058d0674d64f3b6f5de0fb"
}
}
🐳 Docker preview imageBuilt from this PR's registry bridge build:
# remove any stale local copy from a previous run, then pull fresh
docker rmi ghcr.io/voidzero-dev/vite-plus:pr-3670 2>/dev/null; docker pull ghcr.io/voidzero-dev/vite-plus:pr-3670Quick check: docker run --rm ghcr.io/voidzero-dev/vite-plus:pr-3670 vp --versionSee docs/guide/docker.md for usage. |
6b4945c to
cc78061
Compare
4ae3656 to
eafdf1f
Compare
|
Design update: the Vite mode no longer selects the varlock environment in this PR. This moves to a follow-up. This PR is switching to a direct
The plugin also caused a production problem:
What this PR does instead:
Follow-up, not in this PR: varlock's Next.js integration already passes the framework environment (
We will take this upstream after this PR lands. Until then, the Vite mode does not select the varlock environment. |
…ntal
varlock encrypts secrets with a key stored on the device (Secure Enclave,
TPM, or a key file) as `varlock("local:...")`, and every command that
loads the schema already decrypts them. Projects without a direct
`varlock` dependency had no command to create those values, though.
`vp dotenv encrypt` runs `varlock encrypt` with the terminal attached: it
reads a value from stdin or a prompt, or encrypts the sensitive plaintext
values of a file with `--file`. `vp dotenv lock` runs `varlock lock`,
which ends the biometric session. Neither needs a schema, except
`encrypt --file`.
The guide gets a local encryption section: which commands decrypt, where
varlock keeps the key, that only the encrypting device can decrypt, and
that `varlock(prompt)` asks only through `vp dotenv exec`. The guide, the
`dotenv` config reference, the varlock migration rules, and the README
command lists now say that `vp dotenv` and the `.env.schema` support are
experimental.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`keychain()` already reads secrets from the macOS Keychain in every command that loads the schema, but projects without a direct `varlock` dependency had no command to store or manage those items. `vp dotenv keychain` passes every argument, `--help` included, to `varlock keychain` (`set`, `import`, `fix-access`, or `list`) with the terminal attached. Vite+ does not declare the subcommands and options again, so it does not have to follow their changes. varlock reports the platform error outside macOS, and `keychain import` checks for its schema itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On cnpmcore, a server with about 80 optional variables and none set,
`vp dotenv check` printed `Found no errors in 0 config items`, because it
counted only the values in `load --format json`. It now reads the full
graph (`json-full --agent`, so sensitive values stay redacted) and prints
both numbers: `Found no errors in 80 config items (0 have a value)`.
`vp dotenv init` also assumed a Vite app. `inferFromPrefix('VITE_')`
made every variable of a server sensitive, and the `viteMode()` item had
no Vite command to follow. init now reads the package.json scripts and
`index.html`: only a project that serves or builds a client app with Vite
gets the prefix rule, and only one whose scripts run Vite or Vitest gets
the `APP_ENV` item. A server keeps `@defaultSensitive=false`.
The guide also notes that output redaction in `vp dotenv exec` masks every
occurrence of a sensitive value, so a short value such as `postgres`
masks the same word in unrelated output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
varlock reads the header as the comment blocks before the first item. A blank line, a divider, or the end of the file ends a block. `varlock init` writes no divider when `.env.example` starts with a comment block, so `vp dotenv init` and `vp migrate` left such a schema unchanged. A section divider below the items also counted as the end of the header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`vp dotenv keychain` added the `keychainArgs` field, which the parser returns for every subcommand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nal peer A project with .env.schema now depends on varlock itself. vite-plus declares varlock as an optional peer (^1.25.0, the peer range of @varlock/vite-integration) and inlines the integration, whose varlock imports resolve to the project's copy. This removes what a vite-plus-only varlock needed: - the PATH change for the integration's CLI lookup, the dotenv-resolve plugin, and noExternal for SSR imports - the vite-plus/dotenv export and its config-time loader - the vite-plus varlock plugin (@plugin(vite-plus), @generateVitePlusTypes, viteMode()) and VP_VITE_MODE - varlock in vp --version, vp toolchain, and vite-plus/versions vp dotenv init adds varlock with `vp add` before varlock init runs, then adds importMetaEnv=none to a new schema and, in a client app, makes only VITE_* public by default. A missing varlock fails with the command that adds it, and a version outside the peer range prints a warning. The Vite mode no longer selects the varlock environment; vp dev, build, and test warn when the mode has env files that varlock does not load. Following the mode is a follow-up. vp dotenv drops --mode, keeps --env for check, print, and explain, and fails when @currentEnv would ignore it. dotenv.ssrInjectMode passes the integration's option. vp migrate removes varlockVitePlugin() and the integration dependency, keeps varlock and .env.schema, and adds varlock when the project had it only as the integration's peer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
varlock init checks only `dependencies.varlock` in package.json, and otherwise runs its own `<package manager> add varlock` without a range. vp dotenv init added varlock only when it could not resolve it, so a varlock in devDependencies, or one that only the workspace root has, let varlock init add it again at the latest version. vp dotenv init now adds varlock with `vp add` when package.json does not list it, and moves it from devDependencies or optionalDependencies to dependencies with its range, then runs `vp install`. bun and Yarn keep an existing dev dependency in place on `add`, so the move edits package.json. Built server code imports varlock at run time, so dependencies is also the right field for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…m issues The varlock migration and the .gitignore fix ship in Phase 1. The RFC listed them under Phase 2, next to the schema scaffolding that is still planned. The pre-commit step now runs `vp dotenv scan --staged`, as the guide shows, and `vp exec varlock` replaces `vpx varlock` for varlock commands that `vp dotenv` does not wrap. varlock#1329 and varlock#1330 are closed. The migrator README no longer describes the schema type generator that the migration dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…les in check
`vp dotenv init` now finishes the setup that users had to do by hand:
- It removes the unchanged `EXAMPLE_ITEM` placeholder that `varlock init`
always writes.
- It lists the items that `inferFromPrefix('VITE_')` makes sensitive, so that
a value such as `HOST=localhost` does not become a secret unnoticed.
- It adds the generated types file to the `include` of `tsconfig.app.json`
or `tsconfig.json` when that list does not cover it.
- It adds the file to `fmt.ignorePatterns` in the Vite config, because
varlock rewrites it in its own style on every load and `vp check` would
report its format. When `fmt` is not an object literal, it warns instead.
The `pass:` line of `vp dotenv check` now names the files that varlock
loaded, so it shows which environment was checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
A `varlockVitePlugin({ ssrInjectMode: '...' })` call stayed in the config
with a warning, because both integrations would run. When `ssrInjectMode`
is its only option and the config does not set `dotenv` yet, migration now
moves the options to `dotenv` and removes the call, with the integration
dependency when nothing else uses it. Other calls with options keep the
warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
The plugin injection had only unit tests with mocks. The new fixture installs the real varlock, as a project does, and checks that: - `vp build` inlines a public value and removes a sensitive `VITE_*` value from `import.meta.env`, with a warning. - A sensitive value in the client output fails the build. - `vp test` does not run the tests while the env config is invalid, and the tests read the resolved values once it is valid. The dotenv warnings now carry a timestamp only in a server, like Vite's own logs, so build output has none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
- The `vp check` step runs only checks that read no values: type generation, schema errors, and `varlock audit`. Value validation needs secrets, which lint-only CI jobs and cached tasks do not have. - The git-hook scan becomes opt-in, because it resolves the schema on every commit. - A Follow-ups section lists the known gaps after Phase 1, and the upstream asks gain a minimum value length for redaction and scanning and a package without source maps. - The init, check, migration, and fixture descriptions match the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
The macOS temp dir is a symlink under /private, and module resolution returns the real path, so the test failed in the macOS CLI E2E job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
- An `env.d.ts` that varlock did not generate stays. The schema writes the types to `env.varlock.d.ts` instead, and init says so. - In a workspace package, the formatter setting belongs to the root config, so init prints the root-relative pattern instead of adding a `fmt` block to the package config. - The tsconfig and Vite config edits keep the quotes, indentation, semicolons, and single-line arrays of each file, so `vp fmt --check` still passes. The config edits share one AST helper. - init generates the types with `varlock codegen`, which needs no values. - init reports when a tsconfig may not include the types file, when every item is public by default, and which `.env.<mode>` files need `@currentEnv`. - On an existing schema, init still sets up the types file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
- `vp preview` with an invalid env config warns and serves the existing build output. Only `vp test` stops, and its error has no stack trace. - A config that still adds `varlockVitePlugin()` gets a warning, because the integration would run twice. - A failed build output scan suggests `@public` for a value that is not a secret. - `ssrInjectMode` comes from the merged config, so a value set by a composed config or a plugin applies. The fixture reads `ENV` from `varlock/env`, inlines a `@public` port, and checks the build output when the env config is invalid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…range - `vp dotenv check --env <name>` warns when varlock loaded no `.env.<name>` or `.env.<name>.local` file. varlock accepts any name, so a typo passed silently. - `vp migrate` warns when a `package.json` declares a `varlock` range that allows versions this Vite+ does not support, with the command that fixes it. - The migrator adds `dotenv` to the config with the shared AST helper instead of the native JSON merge, which dropped semicolons and could not edit an arrow function config. The config keeps its layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…commands - The guide and the RFC describe what `vp dotenv init` keeps and edits, the workspace package case, `varlock codegen`, and the notices. - `vp preview` warns about an invalid env config instead of failing. - The migration rules mention the `varlock` range warning, and `vp dotenv init` for a project that already has a schema. - The guide lists the costs of `varlock/auto-load`, the `@public` hint for a scan match, the `check --env` warning, and `vp exec varlock` for the commands that `vp dotenv` does not wrap. - The RFC follow-ups record the workspace formatter setup, a missing varlock in a workspace package, and a user-registered integration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
The `vp dotenv init` snapshots record the text of `varlock init --agent`, which spells "self-explanitory". The typos check failed the Lint job on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…v init - On an existing schema whose types path is a file of the user, such as the `env.d.ts` of create-vue, init no longer runs `varlock codegen` over it. It leaves the file and the project setup, and asks for another path. In a client app it also points out a schema with `@defaultSensitive=false`. The deprecated `@generateTypes(lang=ts, ...)` counts as a types decorator. - init warns when `varlock codegen` fails, and ends with a line that names `vp dotenv check` for an existing schema too. - Formatter ignore patterns count as `.gitignore` lines: the last match decides, a `!` pattern includes the file again, and `./env.d.ts` does not cover `env.d.ts`, as in oxfmt. - Config edits keep comments with the property or pattern they describe, and take the quotes of the first string in the file, else double quotes, the formatter default. - The workspace root comes from `findMonorepoRoot`, as for `vp check`. When it cannot be found, init asks the user instead of editing the package config. - The `vp migrate` summary names `vp dotenv init`, which sets up the types file of a migrated schema. - The `.env.<mode>` notices say that the `APP_ENV` item goes in the schema, not in the header, and `.env.template` and `.env.dist` are not environments. The init fixture gets a case for an existing schema, and the workspace case starts from a schema, checks the root `vp fmt --check`, and runs init again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…ow-ups - The guide and the RFC say what `vp dotenv init` does with an existing schema and a types file of the user, and that an added entry can need `vp fmt` when it makes a line too long. - The `@generateTsTypes` row says to use a path that no file of the user has, since varlock replaces the file. - `printenv` replaces `install-plugin` among the `vp exec varlock` examples: `install-plugin` works only with the standalone binary. - The RFC follow-ups record the remaining review items: a `vp fmt` backstop for init edits, the types setup in `vp migrate`, init and range warning edges, and the place of the shared config edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
`varlock init` skips a `.env.schema` that it cannot parse and writes a new one in its place. `vp dotenv init` now puts the original back and exits with code 1, and `vp dotenv check` shows the parse error. - When the types file is a file of the user, the warning says that the next `vp dev`, `vp build`, `vp test`, or `vp dotenv check` replaces it, names the decorator that the schema uses, and init no longer suggests `vp dotenv check` as the next step. - Set up the tsconfig and the formatter only for a types file that `varlock codegen` wrote. - Read formatter ignore patterns with the `.gitignore` anchors and directory patterns, so `/env.d.ts` and `apps/web/` count. - Keep the comment of an empty `ignorePatterns` array. - Suggest `env.d.ts` for a schema without types when the file is free, and say that only items without `@sensitive` are public. - Docs and RFC: describe the restored schema, fix the `@currentEnv` wording, and record the remaining review items as follow-ups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
An interactive `varlock init` on a schema that it cannot parse writes a new schema from `.env.example` and the other env files, then offers to delete the example file and the values that went into the new schema. `vp dotenv init` puts the original schema back, so accepting those prompts lost values. With a schema, `vp dotenv init` now always runs `varlock init --agent`, which asks nothing and deletes nothing, and the restore error says that varlock's notes are about the discarded schema. - Restore the schema byte for byte. - Add no formatter pattern for a types file outside the workspace root: the formatter rejects `..` in `ignorePatterns`, so `vp check` failed. - Read ignore patterns without extglobs, as the formatter does. - The user-file warning names example commands that replace the file. - Fix the remaining "every item is public" wording, and record the remaining review items in the RFC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
`vp dotenv init` chose `--agent` from one check for `.env.schema` and armed the restore from a second read, with `vp add` in between. It now reads the schema once, after the dependency step, and both follow from that read. `buildVarlockInvocation` takes `hasSchema` without a default. - The `dotenv_init_existing_schema` case runs `vp dotenv init` without `--no-interactive` on a schema that varlock cannot parse, next to an `.env.example`. Without `--agent`, varlock waits at a prompt and the step times out, so the case guards the fix. - `isOutsideRoot` takes the path module, so the Windows drive case has a test on every platform. - Reword the restore error, use "prompts" in the guide, say that a types file outside the root needs no formatter pattern, fix the RFC command table and agent note, and record the remaining review items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…g as varlock and TypeScript do - The `--env` guard reads the header of the schema that varlock loads, `.env.schema` or the entries of `varlock.loadPath`, and names the file. - `vp dotenv init` fails when `varlock.loadPath` names another path, because `varlock init` writes `.env.schema` in the working directory. - The Vite mode warning reads the schema and env files of a single `loadPath` directory. - The `vp dotenv check` pass line names the loaded files relative to the working directory, from the `basePath` of the graph. - `init` treats only a missing schema as absent, and fails on any other read error instead of letting varlock prompt over it. - As in TypeScript, `*` and `**` in a tsconfig `include` skip hidden files and directories, and a tsconfig without `include` gets a request to check a types file in a hidden directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
…endencies `vp dotenv init` cannot tell whether a project loads varlock at run time, so it keeps `dependencies`. A project that uses varlock only through the CLI can move it back, and a later init moves it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
- The client env filter removes only sensitive keys with an env prefix, so `MODE`, `DEV`, `PROD`, `SSR`, and `BASE_URL` stay in `import.meta.env` when the schema declares them. - `vp dotenv init` marks the items for values that Vite and Node.js set (`NODE_ENV`, `MODE`, `DEV`, `PROD`, `SSR`, `BASE_URL`) `@public` in a client app. - `vp dotenv check` fails when varlock loads no file. - `vp dotenv init` uses varlock's defaults without a terminal or in CI, and removes a schema that varlock wrote before it failed. - The `--env` guard fails when any `varlock.loadPath` entry sets `@currentEnv`, because varlock then ignores the flag for every entry. - The init `loadPath` guard accepts `./.env.schema`, an empty list loads the working directory, and its error no longer suggests running init in the schema directory. - Docs, RFC, and BUNDLING.md: a package schema from the workspace root, the empty schema follow-up, and the inlined integration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUJ79dF65F7Fo5MhZtHU7a
97350d0 to
1e65e42
Compare
Adds
.envfiles with a committed schema through varlock. A project commits.env.schema, which declares each variable, its type, and whether it is sensitive. Real values stay in git-ignored files such as.env.local.The project depends on
varlockitself.vite-pluslists it as an optional peer dependency (^1.25.0) and inlines@varlock/vite-integration1.5.6, whosevarlockimports resolve to the project's copy, so the CLI, the integration, andENVfromvarlock/envshare one varlock.vp dotenv initadds the dependency. Without it, every command that loads the schema fails and suggestsvp add varlock@^1.25.0, and a version outside the range prints a warning.The feature is experimental. Design:
rfcs/varlock-integration.md. Guide:docs/guide/dotenv.md. Config:docs/config/dotenv.md.vp dotenv init [--no-interactive]varlockindependencies, runsvarlock init, and adapts a new schema to Vite: removes theEXAMPLE_ITEMplaceholder, setsimportMetaEnv=nonefor the types and, in a client app,@defaultSensitive=inferFromPrefix('VITE_'), and lists the items that become sensitive. It writes the types withvarlock codegen, toenv.varlock.d.tswhen a new schema would replace the project's ownenv.d.ts, and once the file exists, adds it to the tsconfigincludeand tofmt.ignorePatterns, keeping the style of each file. In a workspace package it prints the root-relative pattern for the root config instead. An existing schema stays unchanged: init runsvarlock initwithout its prompts, sets up the types file, leaves a types file of the user and says what to change, and fails with the schema restored when varlock cannot parse it, becausevarlock initwould write a new one over it. With avarlock.loadPathto another path, init fails, becausevarlock initwrites.env.schemain the working directoryvp dotenv check [--env <name>]--envloaded no file of that environmentvp dotenv print [--env <name>] [--format env|json|shell] [--reveal]--revealvp dotenv explain [KEY] [--env <name>]vp dotenv scan [--staged] [--include-ignored] [paths...]vp dotenv exec -- <command>vp dotenv encrypt [--file <file>],lock,keychain [args...]When the config root has
.env.schema,defineConfigadds the varlock integration and three plugins:vp buildandvp testexit with code 1 on an invalid env,vp previewwarns and serves the existing build output, andvp devshows varlock's error page. A config that also addsvarlockVitePlugin()gets a warning, because the integration would run twice.VITE_*keys fromimport.meta.envand names them in a warning.dotenv.scanBuildOutput).dotenv.schematurns loading off or requires a schema, anddotenv.ssrInjectModepasses the integration's option for built server code. A project without a schema gets no new plugins.The Vite mode does not select the varlock environment in this PR:
vp buildloads.env.productiononly when the variable that@currentEnvreads isproduction, as inAPP_ENV=production vp buildwith@currentEnv=$APP_ENV.vp dev,vp build,vp preview, andvp testwarn when the mode has env files that varlock does not load, and name the variable to set. Passing the mode to varlock as the--envfallback, as its Next.js integration does, is a follow-up (details).vp migrate(vp migrate --fullon a Vite+ project) removesvarlockVitePlugin()and the@varlock/vite-integrationdependency. A call whose only option is a stringssrInjectModemoves todotenv.ssrInjectMode. A call with other options stays, with a warning, and so does the dependency.varlockand.env.schemastay, with a warning when thevarlockrange allows versions that this Vite+ does not support.vp createadds!.env.schemato.gitignore.Limits:
vpprocess loads one schema. A second schema in onevp testrun fails.vp dev ./app) is not checked for a schema.vp runtask gets the values only throughvp dotenv exec --.vp packdoes not load the schema.vp dotenv execredacts every occurrence of a sensitive value in the output, so a common value such as the passwordpostgresalso masks that word elsewhere.