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
-**Vite**: Integrated via `@arkenv/vite-plugin`. Validates environment variables at build-time and inlines `import.meta.env` variables for **client-side** (browser) usage.
201
201
-**Next.js**: Integrated via `@arkenv/nextjs`. Provides two layout patterns:
202
202
-**3-File Layout (Strict)**: Uses separate environment files for client, server, and shared scopes (`env/client.ts`, `env/server.ts`, and `env/internal/shared.ts`) for compile-time locking of secrets from browser bundles using package conditional exports (`react-server` vs. `default`) and `server-only`.
203
-
-**Unified 1-File Layout**: Uses a single `env.ts` schema file. In Next.js, client-side environment variables must be statically destructured in a `runtimeEnv` block to allow static inlining by the Next.js compiler. To automate this, `@arkenv/nextjs/config` exposes a `withArkEnv` wrapper for `next.config.js` that performs static analysis on `env.ts` to locate `client` and `shared` keys, then automatically generates a tailored `createEnv` factory in `generated/env.gen.ts` that pre-fills `runtimeEnv`. It enforces strict client-side prefixing (`NEXT_PUBLIC_`) and prevents server secrets from leaking to client components.
203
+
-**Unified 1-File Layout**: Uses a single `env.ts` schema file. In Next.js, client-side environment variables must be statically destructured in a `runtimeEnv` block to allow static inlining by the Next.js compiler. To automate this, `@arkenv/nextjs/config` exposes a `withArkEnv` wrapper for `next.config.js` that performs static analysis on `env.ts` to locate `client` and `shared` keys, then automatically generates a tailored `arkenv` factory in `generated/env.gen.ts` that pre-fills `runtimeEnv`. It enforces strict client-side prefixing (`NEXT_PUBLIC_`) and prevents server secrets from leaking to client components.
204
204
-**Bun fullstack dev server**:
205
205
-**Bun.serve**: An HTTP server runtime that integrates with Bun's built-in bundler to scan HTML files, trigger on-demand bundling, and serve resulting assets. It does not perform bundling itself; rather, it coordinates with Bun's bundler (configured via `@arkenv/bun-plugin` in `bunfig.toml`) to inline environment variables (e.g., using a `PUBLIC_` prefix) via static replacement. Primarily used for **client-side** bundling integration.
206
206
-**Bun.build**: Bun's programmatic bundling API. Integrated via `@arkenv/bun-plugin` in the `Bun.build` plugins array. Used for custom build scripts targeting the browser in a fullstack context.
@@ -218,7 +218,7 @@ pnpm run test:e2e # E2E tests
218
218
219
219
- Uses `const` type parameters for better type inference
220
220
- Leverages ArkType's `type.infer` and `type.validate` utilities
221
-
- Typesafe environment object returned from `createEnv`
221
+
- Typesafe environment object returned from `arkenv`
Copy file name to clipboardExpand all lines: .agents/platforms/copilot-instructions.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,14 +56,14 @@ The project uses modern tooling:
56
56
57
57
The core package provides:
58
58
59
-
1.**`createEnv(schema)`** - Main function to create validated environment objects. Also available as the default export, typically imported as `arkenv`.
59
+
1.**`arkenv(schema)`** - Main function to create validated environment objects. Exposed as default export, and also as named export`arkenv`.
60
60
2.**Built-in validators** - Common validators like `host`, `port`, `url`, etc.
61
61
3.**ArkType integration** - Uses ArkType for schema definition and validation
62
62
4.**Type inference** - Full TypeScript type inference from schemas
**BREAKING CHANGE**: Rename the primary environment variable validation function from `createEnv` to `arkenv` across all packages in the ecosystem, and expose it as both the default export and a named export.
Copy file name to clipboardExpand all lines: apps/www/content/docs/arkenv/coercion.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ Coercion works recursively: even variables inside a JSON object are coerced to t
100
100
101
101
## How it works
102
102
103
-
ArkEnv uses a unified pre-coercion model shared across both `arkenv` and `arkenv/standard`. When you call `createEnv()` (or `arkenv()`):
103
+
ArkEnv uses a unified pre-coercion model shared across both `arkenv` and `arkenv/standard`. When you call `arkenv()`:
104
104
105
105
1.**Introspection**: ArkEnv extracts the JSON Schema of your defined schema. For `arkenv` (ArkType), it introspects the schema (with a fallback to handle unjsonifiable parts of the schema like custom morphs or predicates). For `arkenv/standard` (e.g., Zod, Valibot), it extracts JSON Schema using the validator's standard metadata.
106
106
2.**Paths Identification**: It computes the exact paths requiring coercion (using `findCoercionPaths`) to identify target non-string types like numbers, booleans, arrays, or objects.
0 commit comments