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
This is the foundation ticket for the Nuxt integration parity epic. Before we can generate code, validate at build time, or harden the strict-layout boundary, the @arkenv/nuxt module and runtime must understand the flat layout the same way @arkenv/nextjs does.
Current behavior
ModuleOptions.layout only accepts "simple" | "strict". There is no "flat" option and no deprecation alias for "simple".
The module imports extractKeys from @arkenv/build, which only understands the legacy nested server/client/shared blocks.
is parsed incorrectly because the parser looks for nested blocks.
The @arkenv/nuxt runtime entry point (src/index.ts) only exposes the nested createEnv({ server, client, shared }) signature. It does not support createEnv(schema, options).
createEnvInternal in Nuxt does not categorize flat keys by NUXT_PUBLIC_ prefix or by exposeToClient, so a flat schema would misclassify public/shared variables on the client.
Desired behavior
Add "flat" to ModuleOptions.layout and make it the default when a single env.ts file is detected.
Treat "simple" as a deprecated alias for "flat" and emit a one-time warning in development.
Implement flat key extraction in the module, honoring:
NUXT_PUBLIC_* keys as client keys.
NODE_ENV as implicitly shared.
exposeToClient (and deprecated expose/shared arrays) as shared keys.
Everything else as server keys.
Update the @arkenv/nuxt runtime createEnv signature to accept createEnv(schema, options) in addition to the legacy nested signature.
Update createEnvInternal to split a flat schema into server/client/shared buckets using the same rules as the parser.
Acceptance criteria
ModuleOptions.layout supports "flat" and auto-detects it as the default for a single env.ts file.
"simple" is accepted but logs a one-time deprecation warning in development.
The module correctly extracts clientKeys, sharedKeys, and serverKeys from a flat env.ts that uses NUXT_PUBLIC_*, NODE_ENV, and exposeToClient.
@arkenv/nuxt exports a flat createEnv(schema, options) overload with correct type inference.
createEnvInternal categorizes flat schema keys into server/client/shared buckets using NUXT_PUBLIC_, NODE_ENV, and exposeToClient.
Existing Nuxt runtime tests still pass and new tests are added for flat key extraction and flat runtime categorization.
Out of scope
Build-time validation and env.gen.ts codegen (handled in the next ticket).
The Vite plugin boundary patch (handled in the final ticket).
Updating the with-nuxt example to use the flat layout (can be done here if convenient, but not required).
Summary
This is the foundation ticket for the Nuxt integration parity epic. Before we can generate code, validate at build time, or harden the strict-layout boundary, the
@arkenv/nuxtmodule and runtime must understand the flat layout the same way@arkenv/nextjsdoes.Current behavior
ModuleOptions.layoutonly accepts"simple"|"strict". There is no"flat"option and no deprecation alias for"simple".extractKeysfrom@arkenv/build, which only understands the legacy nestedserver/client/sharedblocks.env.tssuch as@arkenv/nuxtruntime entry point (src/index.ts) only exposes the nestedcreateEnv({ server, client, shared })signature. It does not supportcreateEnv(schema, options).createEnvInternalin Nuxt does not categorize flat keys byNUXT_PUBLIC_prefix or byexposeToClient, so a flat schema would misclassify public/shared variables on the client.Desired behavior
"flat"toModuleOptions.layoutand make it the default when a singleenv.tsfile is detected."simple"as a deprecated alias for"flat"and emit a one-time warning in development.NUXT_PUBLIC_*keys as client keys.NODE_ENVas implicitly shared.exposeToClient(and deprecatedexpose/sharedarrays) as shared keys.@arkenv/nuxtruntimecreateEnvsignature to acceptcreateEnv(schema, options)in addition to the legacy nested signature.createEnvInternalto split a flat schema into server/client/shared buckets using the same rules as the parser.Acceptance criteria
ModuleOptions.layoutsupports"flat"and auto-detects it as the default for a singleenv.tsfile."simple"is accepted but logs a one-time deprecation warning in development.clientKeys,sharedKeys, andserverKeysfrom a flatenv.tsthat usesNUXT_PUBLIC_*,NODE_ENV, andexposeToClient.@arkenv/nuxtexports a flatcreateEnv(schema, options)overload with correct type inference.createEnvInternalcategorizes flat schema keys into server/client/shared buckets usingNUXT_PUBLIC_,NODE_ENV, andexposeToClient.Out of scope
env.gen.tscodegen (handled in the next ticket).with-nuxtexample to use the flat layout (can be done here if convenient, but not required).References
@arkenv/nextjs/src/config.ts— reference implementation for flat key extraction@arkenv/nextjs/src/create-env.ts— reference implementation for flat schema categorization