Skip to content

Strip undeclared keys from output by default#662

Merged
yamcodes merged 4 commits intomainfrom
600-printing-env-prints-more-environment-variables-than-specified
Dec 27, 2025
Merged

Strip undeclared keys from output by default#662
yamcodes merged 4 commits intomainfrom
600-printing-env-prints-more-environment-variables-than-specified

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Dec 27, 2025

Closes #600

Summary by CodeRabbit

  • New Features

    • Introduced onUndeclaredKey configuration option with three modes: "ignore" (preserve undeclared variables), "delete" (remove them, default), and "reject" (throw error when present).
  • Documentation

    • Added documentation explaining the new default behavior of stripping undeclared environment variables from output.

✏️ Tip: You can customize this high-level summary in your review settings.

…amples, update dependencies, and refine theme toggle logic.
…eclared variables and introduce new playground examples for other env libraries.
…s and add comparative playgrounds for other env validation libraries.
@yamcodes yamcodes linked an issue Dec 27, 2025 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Dec 27, 2025

🦋 Changeset detected

Latest commit: 2b37eec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
arkenv Patch
@arkenv/bun-plugin Patch
@arkenv/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
arkenv Ready Ready Preview, Comment Dec 27, 2025 10:03pm

@github-actions github-actions bot added docs Improvements or additions to documentation arkenv Changes to the `arkenv` npm package. www Improvements or additions to arkenv.js.org tests This issue or PR is about adding, removing or changing tests labels Dec 27, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2025

Walkthrough

The PR introduces a new onUndeclaredKey configuration option to the arkenv library that controls how undeclared environment variables are handled during processing. It defaults to "delete", stripping undeclared keys from output. Implementation includes comprehensive tests, documentation, and a minor UI component simplification.

Changes

Cohort / File(s) Summary
Documentation
\.changeset/hip-breads-sit\.md
Adds changelog entry documenting the new onUndeclaredKey option with examples showing default behavior (stripping undeclared vars) and behavior with different option values.
Core Feature Implementation
packages/arkenv/src/create-env\.ts
Introduces onUndeclaredKey?: "ignore" | "delete" | "reject" option to ArkEnvConfig (defaults to "delete"). Implementation calls schema.onUndeclaredKey() before coercion and validation to handle undeclared keys according to the selected behavior.
Feature Tests
packages/arkenv/src/create-env\.test\.ts
Adds four new test cases covering default behavior (strips undeclared keys), "ignore" mode (preserves them), "reject" mode (throws on presence of extra keys), and "delete" mode (explicitly removes them).
UI Refinement
apps/www/components/ui/theme-toggle\.tsx
Simplifies isActive calculation from conditional ternary (theme === "system" ? "system" : theme) === option.value to direct comparison theme === option.value, reducing logic without changing behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

arkenv, tests, docs

Poem

🐰 ✨ Undeclared variables, now tidied away,
With onUndeclaredKey showing the way!
Delete, ignore, reject—pick your defense,
Environment configs at last make sense! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Changes to theme-toggle.tsx appear unrelated to the core objective of handling undeclared environment keys, representing an out-of-scope refactoring. Remove the theme-toggle.tsx changes or justify their inclusion in this PR; they should be in a separate PR focused on UI component cleanup.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly matches the main change: introducing default behavior to strip undeclared keys from environment output.
Linked Issues check ✅ Passed The PR successfully addresses issue #600 by implementing the onUndeclaredKey option with 'delete' as default, preventing undeclared environment variables from appearing in printed output.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 600-printing-env-prints-more-environment-variables-than-specified

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 27, 2025

Open in StackBlitz

npm i https://pkg.pr.new/arkenv@662
npm i https://pkg.pr.new/@arkenv/bun-plugin@662
npm i https://pkg.pr.new/@arkenv/vite-plugin@662

commit: 2b37eec

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Dec 27, 2025

📦 Bundle Size Report

Package Size Limit Diff Status
arkenv 1.43 kB 2 kB +1.4%

All size limits passed!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/www/components/ui/theme-toggle.tsx (1)

42-42: Good simplification!

The redundant ternary has been correctly removed. Since theme values directly match option.value ("light", "system", "dark"), the direct comparison theme === option.value is equivalent and more readable.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a1ddd0 and 2b37eec.

📒 Files selected for processing (4)
  • .changeset/hip-breads-sit.md
  • apps/www/components/ui/theme-toggle.tsx
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/arkenv/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/arktype.mdc)

packages/arkenv/**/*.ts: Use ArkType's type() function to define schemas in environment variable definitions
Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Use the scoped $ type system for custom types defined in scope.ts
Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Use union types for enums in ArkType schemas (e.g., "'dev' | 'prod'") instead of separate enum definitions
Leverage ArkType's built-in types (e.g., string.host, number.port) where possible in environment schemas
Convert ArkType validation errors to ArkEnvError for user-friendly error messages that include variable name and expected type

Files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Prefer type over interface for type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverage const type 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 (noInferrableTypes error)
Use as const where appropriate for immutable values (useAsConstAssertion error)
Don't reassign function parameters (noParameterAssign error)
Place default parameters last in function signatures (useDefaultParameterLast error)
Always initialize enum values (useEnumInitializers error)
Declare one variable per statement (useSingleVarDeclarator error)
Avoid unnecessary template literals (noUnusedTemplateLiteral error)
Prefer Number.parseInt over global parseInt (useNumberNamespace error)
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
Use ArkEnvError for environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type

**/*.{ts,tsx}: Use createEnv(schema) function (or default import as arkenv) to create validated environment objects in TypeScript
Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Use ArkEnvError for environment variable errors instead of generic Error types
For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'deve...

Files:

  • packages/arkenv/src/create-env.test.ts
  • apps/www/components/ui/theme-toggle.tsx
  • packages/arkenv/src/create-env.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Co-locate tests with components: Component.tsx next to Component.test.tsx

**/*.test.{ts,tsx}: Use Vitest for unit and integration tests
Test individual functions, components, and hooks in isolation with mocked dependencies in unit tests
Unit tests should focus on individual function logic and edge cases, component rendering and props, error handling and validation, and type checking
Unit tests should execute in less than 100ms per test
Mock external dependencies (clipboard, network, etc.) in unit tests
Co-locate unit test files with source files using naming convention: source file → test file (e.g., create-env.ts → create-env.test.ts)
Test component behavior, not aesthetics, and focus on what users can do and what the component guarantees through its API
Test component public API (props, events, and component contract), user behavior (clicks, typing, focus, keyboard, ARIA), state transitions, accessibility, and side effects in component tests
Do not test pure styling or CSS classes, library internals (Radix/shadcn), implementation details (hooks, setState, private variables), or visual variants in component tests
Use Testing Library with user-event for real user simulation in component tests
Query by role, name, label, and text (accessibility first) in component tests
Use beforeEach/afterEach for cleanup, not beforeAll/afterAll when possible
Keep tests fast, deterministic, and parallelizable
Mock at component boundaries (network, time, context)

Create unit tests with .test.ts or .test.tsx suffix located alongside source files, testing individual functions and components in isolation with mocked dependencies

Files:

  • packages/arkenv/src/create-env.test.ts
**/*.{test,integration.test}.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,integration.test}.{ts,tsx}: Use Vitest's describe/it structure for all test files
Test both success and failure cases in unit and integration tests
Mock process.env in unit tests to test different environment variable scenarios

Files:

  • packages/arkenv/src/create-env.test.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use self-closing JSX elements (useSelfClosingElements error)

Files:

  • apps/www/components/ui/theme-toggle.tsx
apps/www/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/www/.cursor/rules/posthog-integration.mdc)

apps/www/**/*.{ts,tsx,js,jsx}: If using TypeScript, use an enum to store feature flag names. If using JavaScript, store feature flag names as strings to an object declared as a constant to simulate an enum. Use UPPERCASE_WITH_UNDERSCORE naming convention for enum/const object members.
If a custom property for a person or event is referenced in two or more files or two or more callsites in the same file, use an enum or const object with UPPERCASE_WITH_UNDERSCORE naming convention, similar to feature flags.

Files:

  • apps/www/components/ui/theme-toggle.tsx
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
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-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
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
📚 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:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')

Applied to files:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript

Applied to files:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.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:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.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 built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas

Applied to files:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.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:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types

Applied to files:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.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:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.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:

  • .changeset/hip-breads-sit.md
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Mock `process.env` in unit tests to test different environment variable scenarios

Applied to files:

  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-26T19:27:11.710Z
Learnt from: danciudev
Repo: yamcodes/arkenv PR: 614
File: packages/vite-plugin/src/index.test.ts:641-654
Timestamp: 2025-12-26T19:27:11.710Z
Learning: In packages/vite-plugin/src/**/*.test.ts: The test suite uses `env.test` files (without leading dot) as test fixtures that are manually read by the `readTestConfig` helper function and stubbed into process.env with `vi.stubEnv`, not as files to be read by Vite's loadEnv during tests.

Applied to files:

  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Test component public API (props, events, and component contract), user behavior (clicks, typing, focus, keyboard, ARIA), state transitions, accessibility, and side effects in component tests

Applied to files:

  • apps/www/components/ui/theme-toggle.tsx
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Test component behavior, not aesthetics, and focus on what users can do and what the component guarantees through its API

Applied to files:

  • apps/www/components/ui/theme-toggle.tsx
📚 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:

  • packages/arkenv/src/create-env.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:

  • packages/arkenv/src/create-env.ts
🧬 Code graph analysis (2)
.changeset/hip-breads-sit.md (1)
packages/arkenv/src/index.test.ts (1)
  • arkenv (50-53)
packages/arkenv/src/create-env.test.ts (1)
packages/arkenv/src/create-env.ts (1)
  • createEnv (65-94)
🪛 markdownlint-cli2 (0.18.1)
.changeset/hip-breads-sit.md

22-22: Hard tabs
Column: 1

(MD010, no-hard-tabs)


32-32: Hard tabs
Column: 1

(MD010, no-hard-tabs)


40-40: Hard tabs
Column: 1

(MD010, no-hard-tabs)


41-41: Hard tabs
Column: 1

(MD010, no-hard-tabs)

⏰ 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). (3)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-build (latest)
🔇 Additional comments (4)
.changeset/hip-breads-sit.md (1)

1-43: LGTM! Clear documentation of the new feature.

The changeset documentation clearly explains the new onUndeclaredKey behavior with helpful before/after examples. The static analysis warnings about hard tabs (MD010) are false positives—the tabs occur inside code blocks and are intentional for proper TypeScript formatting.

packages/arkenv/src/create-env.test.ts (1)

366-422: Comprehensive test coverage for the new feature!

The tests thoroughly cover all three onUndeclaredKey modes plus the default behavior. The use of as any is appropriate for testing runtime handling of undeclared keys that TypeScript would otherwise reject.

Minor observation: The default test (lines 366-378) and explicit "delete" test (lines 409-422) verify identical behavior, which may be intentional for documentation purposes.

packages/arkenv/src/create-env.ts (2)

23-37: Excellent documentation!

The JSDoc clearly explains the three modes, provides rationale for choosing "delete" as the ArkEnv default (differing from ArkType's "ignore"), and includes a helpful link to the ArkType documentation.


67-79: Correct implementation!

The implementation properly applies onUndeclaredKey before coercion and validation, ensuring undeclared keys are filtered at the right stage of the pipeline. The default value of "delete" aligns with the documented behavior and resolves issue #600.

@yamcodes yamcodes merged commit d83d746 into main Dec 27, 2025
19 checks passed
@yamcodes yamcodes deleted the 600-printing-env-prints-more-environment-variables-than-specified branch December 27, 2025 22:08
@arkenv-bot arkenv-bot bot mentioned this pull request Dec 27, 2025
yamcodes pushed a commit that referenced this pull request Dec 27, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) 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.8.1

### Patch Changes

- #### Strip undeclared keys from output by default
_[`#662`](#662)
[`d83d746`](d83d746)
[@yamcodes](https://github.com/yamcodes)_

Environment variables not defined in your schema are now stripped from
the output object by default.

You can customize this behavior using the new `onUndeclaredKey` option.

    For example, assuming this is your `.env` file:

    ```env
    MY_VAR=hello
    UNDECLARED_VAR=world
    ```

    And this is your schema:

    ```ts
    const env = arkenv({
      MY_VAR: type.string(),
    });

    console.log(env);
    ```

    Current output:

    ```ts
    {
      MY_VAR: "hello";
    }
    ```

    Previous output:

    ```ts
    {
    	MY_VAR: "hello",
    	UNDECLARED_VAR: "world"
    }
    ```

## @arkenv/bun-plugin@0.0.6

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`d83d746`](d83d746)

</small>

-   `arkenv@0.8.1`

</details>

## @arkenv/vite-plugin@0.0.23

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`d83d746`](d83d746)

</small>

-   `arkenv@0.8.1`

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Dec 28, 2025
renovate bot added a commit that referenced this pull request Jan 2, 2026
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [arkenv](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`0.8.0` →
`0.8.1`](https://renovatebot.com/diffs/npm/arkenv/0.8.0/0.8.1) |
![age](https://developer.mend.io/api/mc/badges/age/npm/arkenv/0.8.1?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/arkenv/0.8.0/0.8.1?slim=true)
|

---

### Release Notes

<details>
<summary>yamcodes/arkenv (arkenv)</summary>

###
[`v0.8.1`](https://redirect.github.com/yamcodes/arkenv/releases/tag/arkenv%400.8.1)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/arkenv@0.8.0...arkenv@0.8.1)

##### Patch Changes

- #### Strip undeclared keys from output by default
*[`#662`](https://redirect.github.com/yamcodes/arkenv/pull/662)
[`d83d746`](https://redirect.github.com/yamcodes/arkenv/commit/d83d746e5f3672b97dea1d3eff0515a04af1d0e2)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

Environment variables not defined in your schema are now stripped from
the output object by default.

You can customize this behavior using the new `onUndeclaredKey` option.

  For example, assuming this is your `.env` file:

  ```env
  MY_VAR=hello
  UNDECLARED_VAR=world
  ```

  And this is your schema:

  ```ts
  const env = arkenv({
    MY_VAR: type.string(),
  });

  console.log(env);
  ```

  Current output:

  ```ts
  {
    MY_VAR: "hello";
  }
  ```

  Previous output:

  ```ts
  {
  	MY_VAR: "hello",
  	UNDECLARED_VAR: "world"
  }
  ```

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on friday" in timezone Asia/Almaty,
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/yamcodes/arkenv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi42OS4xIiwidXBkYXRlZEluVmVyIjoiNDIuNjkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arkenv Changes to the `arkenv` npm package. docs Improvements or additions to documentation tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Printing env prints more environment variables than specified

1 participant