|
| 1 | +--- |
| 2 | +"@arkenv/core": major |
| 3 | +"@arkenv/standard": major |
| 4 | +--- |
| 5 | + |
| 6 | +#### Move issue helpers and safe parsing off the default import |
| 7 | + |
| 8 | +The default `@arkenv/core` and `@arkenv/standard` imports are now the throw |
| 9 | +path only. `formatIssues`, `getSchemaKeys`, and the `EnvIssue` types moved |
| 10 | +to `@arkenv/core/issues` (core). `{ safe: true }` is no longer accepted on |
| 11 | +either package's main `arkenv()`; import `arkenv` from `/safe` instead. |
| 12 | + |
| 13 | +```ts |
| 14 | +import arkenv from "@arkenv/core"; |
| 15 | +import { formatIssues } from "@arkenv/core/issues"; |
| 16 | +import arkenvSafe from "@arkenv/core/safe"; |
| 17 | + |
| 18 | +export const env = arkenv({ |
| 19 | + PORT: "number.port = 3000", |
| 20 | +}); |
| 21 | + |
| 22 | +const result = arkenvSafe( |
| 23 | + { PORT: "number.port" }, |
| 24 | + { env: { PORT: "invalid" } }, |
| 25 | +); |
| 26 | + |
| 27 | +if (!result.success) { |
| 28 | + console.error(formatIssues(result.issues)); |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +`@arkenv/standard` mirrors the same shape: |
| 33 | + |
| 34 | +```ts |
| 35 | +import arkenv from "@arkenv/standard"; |
| 36 | +import arkenvSafe from "@arkenv/standard/safe"; |
| 37 | +``` |
| 38 | + |
| 39 | +`@arkenv/core` now sets `"sideEffects": false` so bundlers can tree-shake |
| 40 | +unused subpaths. Framework packages (Next.js, Nuxt, Vite, Bun) do **not** |
| 41 | +ship a `/safe` subpath. |
| 42 | + |
| 43 | +**BREAKING CHANGE**: Issue helpers moved to `@arkenv/core/issues`. |
| 44 | +`{ safe: true }` on `arkenv()` is replaced by `arkenv` from |
| 45 | +`@arkenv/core/safe` / `@arkenv/standard/safe`. |
| 46 | + |
| 47 | +```diff |
| 48 | +- import arkenv, { formatIssues } from "@arkenv/core"; |
| 49 | +- const result = arkenv(schema, { safe: true }); |
| 50 | ++ import arkenv from "@arkenv/core"; |
| 51 | ++ import { formatIssues } from "@arkenv/core/issues"; |
| 52 | ++ import arkenvSafe from "@arkenv/core/safe"; |
| 53 | ++ const result = arkenvSafe(schema); |
| 54 | +``` |
| 55 | + |
| 56 | +```diff |
| 57 | +- import arkenv from "@arkenv/standard"; |
| 58 | +- const result = arkenv(schema, { safe: true }); |
| 59 | ++ import arkenv from "@arkenv/standard/safe"; |
| 60 | ++ const result = arkenv(schema); |
| 61 | +``` |
0 commit comments