Merged
Conversation
commit: |
Contributor
Author
📦 Bundle Size Report
✅ All size limits passed! |
Contributor
Author
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Related Documentation 3 document(s) may need updating based on files changed in this PR: ArkEnv Getting Started with ArkEnvView Suggested Changes@@ -30,7 +30,7 @@
npm install arkenv valibot
```
-Note: You can omit the `arktype` package entirely when using Standard mode.
+Note: When using the `arkenv/standard` import, you can omit the `arktype` package entirely.
## TypeScript Configuration
@@ -47,6 +47,14 @@
The `moduleResolution` setting can be omitted if `module` is set to `"Preserve"`, `"Node16"`, or `"NodeNext"`.
+## Import Paths
+
+ArkEnv provides three separate import paths for different use cases:
+
+- **`arkenv`** (main): ArkType-first approach. Exports `createEnv` (aliased as default export `arkenv`), `type` helper, and `ArkEnvError`. Use this when you want ArkType's TypeScript-like DSL syntax.
+- **`arkenv/standard`**: ArkType-free import. Exports only `createEnv` for Standard Schema validators (Zod, Valibot, etc.) without bundling ArkType.
+- **`arkenv/core`**: Mode-agnostic primitives. Exports `ArkEnvError` and `ValidationIssue` types.
+
## ArkType Mode (Default, Recommended)
[ArkType mode is the recommended approach](https://arkenv.js.org/docs/arkenv/validator-mode) for new projects, offering the best developer experience with TypeScript-like syntax and automatic coercion.
@@ -57,7 +65,7 @@
```typescript
import arkenv from 'arkenv';
-import { type } from 'arkenv/arktype';
+import { type } from 'arkenv';
export const env = arkenv({
// Optional variables with defaults
@@ -138,18 +146,38 @@
### 1. Define Your Schema with Standard Mode
```typescript
+import { createEnv } from 'arkenv/standard';
+import { z } from 'zod';
+
+export const env = createEnv({
+ PORT: z.coerce.number().int().min(0).max(65535),
+ DATABASE_URL: z.url(),
+ DEBUG: z.coerce.boolean().default(false),
+ LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
+});
+```
+
+> **Note:** The `arkenv/standard` import is the recommended way for Standard Schema users (Zod, Valibot, etc.) as it avoids bundling ArkType entirely.
+
+### Migrating from Previous Versions
+
+If you were using `{ validator: "standard" }` in v0.9.x, update to the new import:
+
+```typescript
+// ❌ Before (v0.9.x)
import arkenv from 'arkenv';
import { z } from 'zod';
-export const env = arkenv(
- {
- PORT: z.coerce.number().int().min(0).max(65535),
- DATABASE_URL: z.url(),
- DEBUG: z.coerce.boolean().default(false),
- LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
- },
- { validator: "standard" } // Enable standard mode
-);
+const env = arkenv(
+ { PORT: z.coerce.number() },
+ { validator: "standard" }
+);
+
+// ✅ After (v0.10.0+)
+import { createEnv } from 'arkenv/standard';
+import { z } from 'zod';
+
+const env = createEnv({ PORT: z.coerce.number() });
```
### 2. Create a `.env` File✅ Accepted README
|
613a39c to
dda28e8
Compare
dda28e8 to
a581916
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
arkenv@0.10.0
Minor Changes
arkenv/standardimport#806f9010d0@yamcodesarkenvnow ships three separate entry points:arkenv(main): ArkType-first. IncludescreateEnv(aliased toarkenvdefault import),type, andArkEnvError. Importing from this entry requires you to have ArkType installed.arkenv/standard: ArkType-free. A standalonecreateEnv(aliased toarkenvdefault import) for Standard Schema validators (Zod, Valibot, etc.), not requiring ArkType.arkenv/core: Mode-agnostic primitives -ArkEnvErrorandValidationIssue.Breaking changes
1.
validator: "standard"option removed;arkenvnow statically requires ArkType.The
validatorconfig option has been removed - ArkType is now always required when importing fromarkenv. For a zero-ArkType bundle, usearkenv/standard:2.
typemoved fromarkenv/arktypetoarkenv.The
typehelper is now exported from the main entry. Thearkenv/arktypesub-path is no longer public:@arkenv/bun-plugin@0.1.4
Patch Changes
Updated 1 dependency
f9010d0arkenv@0.10.0@arkenv/vite-plugin@0.0.31
Patch Changes
arkenv/standardimport#806f9010d0@yamcodesarkenvnow ships three separate entry points:arkenv(main): ArkType-first. IncludescreateEnv(aliased toarkenvdefault import),type, andArkEnvError. Importing from this entry requires you to have ArkType installed.arkenv/standard: ArkType-free. A standalonecreateEnv(aliased toarkenvdefault import) for Standard Schema validators (Zod, Valibot, etc.), not requiring ArkType.arkenv/core: Mode-agnostic primitives -ArkEnvErrorandValidationIssue.Breaking changes
1.
validator: "standard"option removed;arkenvnow statically requires ArkType.The
validatorconfig option has been removed - ArkType is now always required when importing fromarkenv. For a zero-ArkType bundle, usearkenv/standard:2.
typemoved fromarkenv/arktypetoarkenv.The
typehelper is now exported from the main entry. Thearkenv/arktypesub-path is no longer public:Updated 1 dependency
f9010d0arkenv@0.10.0