Bump arktype to v2.1.28#498
Conversation
… arkenv and add Zod dependency, along with a type assertion in the Vite plugin.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughUpdates arktype to 2.1.28, adds Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/vite-plugin/src/index.ts (1)
64-64: Acknowledge the temporary type-safety workaround.The
as anycast resolves the "type instantiation is excessively deep" error introduced by ArkType 2.1.28, as documented in PR objectives. While this is an acceptable interim solution, it sacrifices type safety.Consider opening a tracking issue to improve the
EnvSchematyping (e.g., using Standard Schema directly) as the preferred long-term solution mentioned in the PR objectives. Would you like me to help create this issue?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
apps/playgrounds/node/.env.example(1 hunks)apps/playgrounds/node/index.ts(1 hunks)apps/playgrounds/node/package.json(1 hunks)packages/vite-plugin/src/index.ts(1 hunks)pnpm-workspace.yaml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/package.json
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use workspace:* protocol for workspace dependencies between packages
Files:
apps/playgrounds/node/package.json
{packages,apps,tooling}/**/package.json
📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)
When referencing workspace packages in dependencies, use the
workspace:*protocol instead of version numbers
Files:
apps/playgrounds/node/package.json
**/*.{ts,tsx,json,md}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Biome for linting and formatting instead of ESLint and Prettier
Files:
apps/playgrounds/node/package.jsonpackages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
{package.json,pnpm-lock.yaml,pnpm-workspace.yaml}
📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)
Always use
pnpmfor all package management operations in this monorepo (never usenpmoryarncommands), except for standalone example projects in theexamples/folder
Files:
pnpm-workspace.yaml
pnpm-workspace.yaml
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use pnpm for package management with workspace support
Files:
pnpm-workspace.yaml
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
**/*.{ts,tsx}: Prefertypeoverinterfacefor type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverageconsttype parameters for better inference in TypeScript
Use JSDoc comments for public APIs
Use tabs for indentation (configured in Biome)
Use double quotes for strings (configured in Biome)
Organize imports automatically (Biome handles this)
Avoid explicit types when TypeScript can infer them (noInferrableTypeserror)
Useas constwhere appropriate for immutable values (useAsConstAssertionerror)
Don't reassign function parameters (noParameterAssignerror)
Place default parameters last in function signatures (useDefaultParameterLasterror)
Always initialize enum values (useEnumInitializerserror)
Declare one variable per statement (useSingleVarDeclaratorerror)
Avoid unnecessary template literals (noUnusedTemplateLiteralerror)
PreferNumber.parseIntover globalparseInt(useNumberNamespaceerror)
Use kebab-case for TypeScript filenames (e.g.,create-env.ts)
Use camelCase for function names (e.g.,createEnv)
Use PascalCase for type names (e.g.,ArkEnvError)
Use UPPER_SNAKE_CASE for environment variables and constants
Include examples in JSDoc comments when helpful for public APIs
Document complex type logic with JSDoc comments
UseArkEnvErrorfor environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type
**/*.{ts,tsx}: UsecreateEnv(schema)as the main function for validated environment objects, available as the default export
Use built-in validators (host, port, url, email) fromsrc/types.tswhen available instead of custom validation
UseArkEnvErrorfor environment variable errors, not generic errors
Environment schema definitions should use built-in validators, ArkType string literals, and support default values in the schema pattern
Use logical grouping for related environment variables in schemas
Use descriptive env...
Files:
packages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
**/index.ts
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
Use barrel exports (
index.ts) for package entry points
Files:
packages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable errors, not generic errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Applies to **/*.{ts,tsx} : Environment schema definitions should use built-in validators, ArkType string literals, and support default values in the schema pattern
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Applied to files:
apps/playgrounds/node/package.jsonpackages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Applied to files:
apps/playgrounds/node/package.jsonapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: packages/arkenv should not depend on other workspace packages; packages/vite-plugin depends on arkenv; apps/www may depend on workspace packages
Applied to files:
apps/playgrounds/node/package.jsonpnpm-workspace.yaml
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Applied to files:
apps/playgrounds/node/package.jsonpackages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Applied to files:
apps/playgrounds/node/package.jsonpnpm-workspace.yamlapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Applied to files:
apps/playgrounds/node/package.jsonpackages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Applied to files:
apps/playgrounds/node/package.jsonapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use the scoped `$` type system for custom types defined in `scope.ts`
Applied to files:
apps/playgrounds/node/package.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/scope.ts : Define custom types in `scope.ts` using ArkType's scoped type system for reusability across schemas
Applied to files:
apps/playgrounds/node/package.json
📚 Learning: 2025-11-29T22:11:39.920Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Applies to pnpm-workspace.yaml : Use pnpm for package management with workspace support
Applied to files:
pnpm-workspace.yaml
📚 Learning: 2025-11-29T08:00:08.031Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-29T08:00:08.031Z
Learning: Applies to package.json : The project uses `pnpm10.20.0` as specified in the `packageManager` field
Applied to files:
pnpm-workspace.yaml
📚 Learning: 2025-11-29T22:11:39.920Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Always run `pnpm changeset` for version bumps in published packages - never skip changesets
Applied to files:
pnpm-workspace.yaml
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Applies to packages/vite-plugin/src/**/*.test.ts : Test Vite plugin using the `with-vite-react-ts` example as a fixture and validate plugin works with real Vite projects
Applied to files:
pnpm-workspace.yamlpackages/vite-plugin/src/index.ts
📚 Learning: 2025-11-29T22:11:39.920Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Applies to **/*.{ts,tsx} : Use `createEnv(schema)` as the main function for validated environment objects, available as the default export
Applied to files:
packages/vite-plugin/src/index.tsapps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use camelCase for function names (e.g., `createEnv`)
Applied to files:
packages/vite-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures
Applied to files:
packages/vite-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript 5.1+ features when appropriate
Applied to files:
packages/vite-plugin/src/index.ts
📚 Learning: 2025-11-29T22:11:39.920Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Never modify `.env` files in examples or apps - these may contain sensitive configuration
Applied to files:
apps/playgrounds/node/.env.example
📚 Learning: 2025-11-29T22:11:39.920Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable errors, not generic errors
Applied to files:
apps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Applied to files:
apps/playgrounds/node/index.ts
📚 Learning: 2025-11-29T22:11:39.920Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.920Z
Learning: Applies to **/*.{ts,tsx} : Use logical grouping for related environment variables in schemas
Applied to files:
apps/playgrounds/node/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Applied to files:
apps/playgrounds/node/index.ts
🧬 Code graph analysis (1)
apps/playgrounds/node/index.ts (8)
examples/with-bun-react/src/env.ts (1)
env(9-9)packages/vite-plugin/src/index.ts (1)
arkenv(50-86)packages/arkenv/src/type.ts (1)
type(3-3)packages/arkenv/src/types.ts (2)
host(19-19)port(6-14)packages/arkenv/src/index.test.ts (2)
arkenv(50-53)vi(65-81)packages/arkenv/src/create-env.ts (1)
createEnv(34-52)packages/bun-plugin/src/index.ts (1)
arkenv(126-137)packages/arkenv/src/type.test.ts (2)
envType(86-108)envType(5-9)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
- GitHub Check: test-build (latest)
- GitHub Check: test-build (lts/*)
- GitHub Check: test-typesafety
🔇 Additional comments (4)
pnpm-workspace.yaml (1)
21-21: LGTM!The ArkType version bump to 2.1.28 is the trigger for the type instantiation issue, which is addressed by the workaround in the vite-plugin.
apps/playgrounds/node/.env.example (1)
5-5: LGTM!The new
ZED_ENVenvironment variable is properly documented in the example file.apps/playgrounds/node/index.ts (1)
4-11: Consider the rationale for mixing validation libraries.If Standard Schema support is planned, this would be a valid test case. However, without corresponding arkenv implementation changes, this appears to be an error. Please clarify the intention behind mixing Zod and ArkType validation.
apps/playgrounds/node/package.json (1)
14-14: Zod version 4.1.13 is a valid release (published November 24, 2025) and is appropriate for this dependency.
arktype to v2.1.28
…a TODO comment for type improvement.
ArkEnv has supported Standard Schema validators (Zod, Valibot, etc.)
since v2.1.28, but this capability was not documented. Users can now mix
validators from different libraries in a single schema.
## Changes
**READMEs**
- Added "Compatible with any Standard Schema validator" to features list
**Documentation (`/docs/standard-schema`)**
- What Standard Schema is and why it matters (interoperability, zero
runtime overhead)
- Usage examples with Zod and Valibot
- Practical use cases: complex transformations, incremental migration,
team preferences
- Error handling and TypeScript inference
**Example (`examples/with-standard-schema/`)**
- Working project demonstrating ArkType + Zod integration
- Shows mixing validators based on complexity needs
**Navigation**
- Added page to docs menu under API section
- Referenced from quickstart guide
## Example Usage
```ts
import arkenv from 'arkenv';
import { z } from 'zod';
const env = arkenv({
// ArkType for concise syntax
HOST: "string.host",
NODE_ENV: "'development' | 'production' | 'test'",
// Zod for complex transformations
DATABASE_URL: z.string().url(),
ALLOWED_ORIGINS: z.string()
.transform(str => str.split(','))
.pipe(z.array(z.string().url())),
});
```
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `fonts.googleapis.com`
> - Triggering command: `/usr/local/bin/node node
./node_modules/.bin/../next/dist/bin/next build` (dns block)
> - Triggering command: `/usr/local/bin/node node
./node_modules/.bin/../next/dist/bin/next build git conf�� get --local
node_modules/.pnpm/@esbuild+linux-x64@0.27.1/node_modules/@esbuild/linux-x64/bin/esbuild
user.email` (dns block)
> - Triggering command: `/usr/local/bin/node node
./node_modules/.bin/../next/dist/bin/next build bash --no�� --noprofile`
(dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/yamcodes/arkenv/settings/copilot/coding_agent)
(admins only)
>
> </details>
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Document support for any Standard Schema
validator</issue_title>
> <issue_description>Since #498 (`arkenv@>=2.1.28`)
supports the usage of _any_ Standard Schema validator, we should
properly document that as an ArkEnv feature in the advertised features
list, ideally along with examples/use cases/a dedicated section, and
anything else that comes to mind for proper documentation
here.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #500
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
Co-authored-by: Yam C Borodetsky <yam@yam.codes>
Fix "type instantiation is excessively deep" issue with ArkType 2.1.28 and close #497
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.