You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eliminate top-level await from the generated virtual:env/server module — boot validation used to conditionally await each Standard Schema validate() result, putting a TLA in the server env chunk whenever the schema had server keys, and any downstream bundler below esnext (Nitro's node-server preset in real deploys) rejects a TLA chunk, forcing the documented build-target-esnext workaround. Validation is now fully synchronous with identical boot semantics (same process.env read at module init, same per-key report, fail-loud before any importer's body runs, frozen env export) — synchronous init is the only shape that keeps "validated before first use", since user server modules read env.KEY at their own top level. Tradeoff made explicit: async validators are rejected for server keys at config/build time with the fix in the message (boot backstops with the same report when async-ness only surfaces on real values); client keys keep async support (baked at build time, where the plugin awaits). start-env suite: async-server-validator guard fixture + every server chunk must transform under esbuild target es2020 (rejects TLA at parse time — the exact downstream-bundler check). Patch changeset on the 3.0.0-next line.
record('guards','prefix','VITE_-prefixed server key is a config-time error',/cannotkeepitsecret/.test(out)&&/VITE_API_SECRET/.test(out),out.slice(0,400));
377
+
378
+
// Async validators are rejected for `server` keys at config time: boot
379
+
// validation is synchronous (the generated server env module carries no
380
+
// top-level await so server bundles work on non-esnext targets), so a
381
+
// Promise-returning server validator could only ever fail at deploy
382
+
// boot — fail fast at build instead, with the fix in the message.
` if (__result && typeof __result.then === 'function') {`,
600
+
` __issues.push(' \\u2717 ' + __key + ': validator returned a Promise \\u2014 async validators are not supported for server keys (boot validation is synchronous so the server bundle carries no top-level await); make this validator synchronous');`,
601
+
` } else if (__result.issues && __result.issues.length) {`,
560
602
` for (const __issue of __result.issues) __issues.push(' \\u2717 ' + __key + ': ' + __issue.message);`,
0 commit comments