Repository navigation
fix: Remove reserved safe?: false from ArkEnvConfig - #1924
Conversation
Drop the phantom safe option from public config types so /safe subpaths are the only safe-mode entry points. Fixes #1912. Co-authored-by: Yam Borodetsky <[email protected]>
🦋 Changeset detectedLatest commit: f087fda The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
@arkenv/agent-plugin
arkenv
@arkenv/build
@arkenv/bun-plugin
@arkenv/core
@arkenv/fumadocs-ui
@arkenv/nextjs
@arkenv/nuxt
@arkenv/rsbuild-plugin
@arkenv/standard
@arkenv/tanstack-addon
@arkenv/vite-plugin
commit: |
There was a problem hiding this comment.
ℹ️ No critical issues — one doc redundancy worth a look.
Reviewed changes
- Public config types:
ArkEnvConfig(core) andParseStandardConfig(@repo/utils) lose the reservedsafe?: false;StandardEnvConfigbecomes a direct alias ofParseStandardConfig(wasOmit<…, "safe"> & { safe?: false }). - Internal aliases:
SafeArkenvConfig/SafeStandardEnvConfigcollapse to the plain config, and the Vite/Bun/Rsbuild factory configs drop theirOmit<ArkEnvConfig, "safe">; Nuxt'sresolve-core-arkenvdropssafe?: false. - Docs:
safeis removed from the options reference and the intro field lists, plugin reference tables lose the "exceptsafe" clause, and the framework-plugin callout moves fromoptions.mdxintoerror-reporting.mdx. - Tests:
@ts-expect-errortype-regression tests reject{ safe: false }and{ safe: true }on both config types. - Changeset:
majorfor@arkenv/coreand@arkenv/standardwith migration notes.
Verification I ran while reviewing: no runtime code reads config.safe; both config types lack an index signature, so the @ts-expect-error tests genuinely fail if safe returns (and tsc covers *.test-d.ts via include: ["src"]); @repo/utils is in alwaysBundle, so the direct StandardEnvConfig alias does not leak a private import into the published .d.ts; and the plugin packages expose no /safe subpath, so the moved callout's claim holds.
ℹ️ Nitpicks
- The changeset migration block re-imports
arkenvunder the same name from@arkenv/core/safewithin the same snippet and deletes a// (was never supported…)comment line; two clearly labelled before/after snippets would read cleaner.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Use expectTypeOf.not.toHaveProperty for safe regressions, restore /safe pointer on StandardEnvConfig JSDoc, and tighten the changeset. Co-authored-by: Yam Borodetsky <[email protected]>
|
Folded the useful bits from duplicate #1923 into this PR:
Kept this PR’s extras that #1923 lacked (error-reporting callout relocation; changeset at |
There was a problem hiding this comment.
ℹ️ No critical issues — the new regression guard is sound; one small consistency nitpick inline.
Reviewed changes
- Rewrote the changeset copy: distinct-name
arkenv/arkenvSafeexample, a separate before/after diff block, and a tightened BREAKING CHANGE note (replaces the same-name re-import the prior review flagged). - Swapped the
@ts-expect-errortype-regression tests forexpectTypeOf<…>().not.toHaveProperty("safe")in@arkenv/coreand@arkenv/standard. - Updated JSDoc in
packages/core/src/arkenv.tsandpackages/standard/src/index.tsto drop stale{ safe: true }migration wording.
I checked that the new guard can actually fail: .not.toHaveProperty resolves to MismatchArgs<Extends<"safe", keyof T>, false>, which demands a second argument (TS2554) as soon as safe is a key. Confirmed against a scratch type { safe?: false } (errored) vs { PORT?: string } (clean). Both *.test-d.ts files sit under src, so tsc --noEmit covers them, and turbo.json typecheck dependsOn ^build so ParseStandardConfig resolves in CI.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Consolidate the duplicate safe-mode callout/paragraph (include Rsbuild) and move the core type guard into its own Issue #1912 describe block. Co-authored-by: Yam Borodetsky <[email protected]>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Consolidated the
error-reporting.mdxframework-plugin note into a single<Callout>, adding Rsbuild to the list and dropping the paragraph that restated it — resolves the prior redundancy thread. - Moved the core
ArkEnvConfigsafeguard into its owndescribe("Type Regression (Issue #1912)")block, matching the@arkenv/standardcounterpart — resolves the prior consistency nitpick.
Both prior pullfrog threads are addressed and resolved. I re-verified that @arkenv/rsbuild-plugin exposes only . and ./standard (no /safe subpath), so the expanded callout's plugin list and claim hold. No source or type behavior changed in this delta.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [@arkenv/core](https://arkenv.js.org) ([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1` → `1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fcore/1.0.0-rc.1/1.0.0-rc.4) |  |  | | [@arkenv/nextjs](https://arkenv.js.org) ([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1` → `1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fnextjs/1.0.0-rc.1/1.0.0-rc.4) |  |  | | [@arkenv/standard](https://arkenv.js.org) ([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1` → `1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fstandard/1.0.0-rc.1/1.0.0-rc.4) |  |  | | [@arkenv/vite-plugin](https://arkenv.js.org) ([source](https://redirect.github.com/yamcodes/arkenv)) | [`1.0.0-rc.1` → `1.0.0-rc.4`](https://renovatebot.com/diffs/npm/@arkenv%2fvite-plugin/1.0.0-rc.1/1.0.0-rc.4) |  |  | --- ### Release Notes <details> <summary>yamcodes/arkenv (@​arkenv/core)</summary> ### [`v1.0.0-rc.4`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/core%401.0.0-rc.4) [Compare Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected]) No changes in this release. ### [`v1.0.0-rc.3`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/core%401.0.0-rc.3) [Compare Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected]) ##### Patch Changes - #### Restore keyword suggestions inside inline schemas *[`#1975`](https://redirect.github.com/yamcodes/arkenv/pull/1975) [`089ef43`](https://redirect.github.com/yamcodes/arkenv/commit/089ef436d3e007fa636e3948734d3911b1065758) [@​yamcodes](https://redirect.github.com/yamcodes)* A partial keyword in an inline schema string suggests ArkType keywords again. `arkenv({ PORT: "n" })` offers `never`, `null`, and `number`. The same suggestions are back on `arkenv` from `@arkenv/core/safe`. ```ts import arkenv from "@arkenv/core"; export const env = arkenv({ PORT: "number.port = 3000", }); ``` ### [`v1.0.0-rc.2`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/core%401.0.0-rc.2) [Compare Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected]) ##### Major Changes - #### Remove reserved `safe` from main-factory config *[`#1924`](https://redirect.github.com/yamcodes/arkenv/pull/1924) [`ed09bb0`](https://redirect.github.com/yamcodes/arkenv/commit/ed09bb05c27b5409a49430c0f2897b28fe26484d) [@​yamcodes](https://redirect.github.com/yamcodes)* `ArkEnvConfig` and `StandardEnvConfig` no longer declare the reserved `safe?: false` field. Safe-mode parsing stays on the `/safe` subpaths. ```ts import arkenv from "@arkenv/core"; import arkenvSafe from "@arkenv/core/safe"; export const env = arkenv({ PORT: "number.port = 3000", }); const result = arkenvSafe( { PORT: "number.port" }, { env: { PORT: "invalid" } }, ); ``` `@arkenv/standard` mirrors the same shape via `@arkenv/standard/safe`. **BREAKING CHANGE**: Passing `safe: false` on the main `arkenv()` config is no longer accepted. Delete the property; use `/safe` for result-object parsing. ```diff - export const env = arkenv(schema, { safe: false }); + export const env = arkenv(schema); ``` ##### Patch Changes - #### Avoid Node-only `process` APIs in color detection *[`#1939`](https://redirect.github.com/yamcodes/arkenv/pull/1939) [`7684644`](https://redirect.github.com/yamcodes/arkenv/commit/76846449b8a634e24b59a6126958b2826cf975ef) [@​yamcodes](https://redirect.github.com/yamcodes)* ANSI color helpers no longer read `process.versions` or `process.stdout` as static member expressions, so Next.js edge instrumentation no longer flags `@arkenv/core` when `env` is imported from edge files. - #### Point StackBlitz README link at the v1 example *[`#1905`](https://redirect.github.com/yamcodes/arkenv/pull/1905) [`f71bee1`](https://redirect.github.com/yamcodes/arkenv/commit/f71bee184ed2f2abfbc69a514a551310d14b3ca5) [@​yamcodes](https://redirect.github.com/yamcodes)* The core package README StackBlitz badge now opens `tree/v1/examples/stackblitz`, matching the v1 `@arkenv/core` playground instead of the stale `main` path. - #### Sync the package README with the repo README *[`#1949`](https://redirect.github.com/yamcodes/arkenv/pull/1949) [`2fd0f33`](https://redirect.github.com/yamcodes/arkenv/commit/2fd0f335835f3c0918da7b547b6a43fed3dfa3d7) [@​yamcodes](https://redirect.github.com/yamcodes)* The published `@arkenv/core` README now matches the root project README (v1 imports, validator examples, RC callout). The outdated demo GIF that showed a v0-shaped `import` is gone. </details> --- ### Configuration 📅 **Schedule**: (in timezone Asia/Almaty) - Branch creation - "on friday" - 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 these updates 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:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzNC4xIiwidGFyZ2V0QnJhbmNoIjoidjEiLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Fixes #1912
Removes the phantom
safe?: falsefield from publicArkEnvConfig/StandardEnvConfig(andParseStandardConfig). Safe mode stays available only via@arkenv/core/safeand@arkenv/standard/safe.Changes
safe?: falsefrom core, standard, and internal parse config typesOmit<…, "safe">aliases on/safeentries and Vite/Bun/Rsbuild plugin configssafedocs from the options reference; relocate the framework-plugin callout to error-reporting{ safe: false }/{ safe: true }on both config types@arkenv/coreand@arkenv/standardwith migration notesValidation
nub run typecheck --filter=./packages/*— pass@arkenv/core+@arkenv/standardunit tests — passvitest --typecheck.onlyfor the new type regressions — passnub run check— pass