Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .changeset/defu-merge-isolate-safe.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/docs-feedback-polish.md

This file was deleted.

13 changes: 0 additions & 13 deletions .changeset/envscript-rename.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/fs-entrypoint-rename.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/readenv-defensive-fallback.md

This file was deleted.

30 changes: 30 additions & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# @vlandoss/env

## 0.2.0

### Minor Changes

- [#6](https://github.com/variableland/env/pull/6) [`d150a70`](https://github.com/variableland/env/commit/d150a7006c10a240db0dd464ae4e6e8947924028) Thanks [@rqbazan](https://github.com/rqbazan)! - **BREAKING** Rename `<ClientEnv />` (in `@vlandoss/env/react`) to `<EnvScript />`. The new name stops suggesting client-side use and reflects what the component actually does: emit a `<script>` tag with the server-resolved env so the browser can read it during SSR or SSG hydration. The entrypoint path (`@vlandoss/env/react`) is unchanged. The wire format is also unchanged: the DOM `id="env"` and `window.__env` global stay identical, so HTML served by an older build continues to hydrate correctly.

Renames included:

- Component: `ClientEnv` → `EnvScript`
- Props: `ClientEnvProps` → `EnvScriptProps`
- Constants: `CLIENT_ENV_SCRIPT_ID` → `ENV_SCRIPT_ID`, `CLIENT_ENV_GLOBAL_ID` → `ENV_GLOBAL_ID`

Migration: replace `<ClientEnv …>` with `<EnvScript …>`. If you imported the constants from the core entrypoint, update those imports too.

- [#6](https://github.com/variableland/env/pull/6) [`d150a70`](https://github.com/variableland/env/commit/d150a7006c10a240db0dd464ae4e6e8947924028) Thanks [@rqbazan](https://github.com/rqbazan)! - **BREAKING** Rename `@vlandoss/env/node` to `@vlandoss/env/fs`. The entrypoint has always been about file-system access on a Node-compatible runtime — the new name reflects that it works on Node, Bun, and Deno (not just Node), and that it does not work on Workers/Edge. The dynamic-import path resolution now uses `pathToFileURL` so Deno can load absolute paths correctly.

Migration: replace `from "@vlandoss/env/node"` with `from "@vlandoss/env/fs"`.

### Patch Changes

- [#6](https://github.com/variableland/env/pull/6) [`d150a70`](https://github.com/variableland/env/commit/d150a7006c10a240db0dd464ae4e6e8947924028) Thanks [@rqbazan](https://github.com/rqbazan)! - Replace `lodash.merge` with [`defu`](https://github.com/unjs/defu) for the internal merge that combines `defaults + config + envOverride`. The precedence (env > config > defaults) is unchanged.

This fixes a silent shallow-merge regression on V8 isolate runtimes (Cloudflare Workers, Vercel Edge, Next.js Edge): `lodash.merge` relies on `isPlainObject`, which returns `false` when the object originates from a different realm than the merger. The fallback path then assigns by reference instead of deep-merging, which caused leaf values present in `config` (e.g. `db.LOGGING: true`) to be dropped whenever `envOverride` touched the same parent branch.

defu is realm-agnostic and reliably deep-merges in all the runtimes supported by the core.

- [#6](https://github.com/variableland/env/pull/6) [`d150a70`](https://github.com/variableland/env/commit/d150a7006c10a240db0dd464ae4e6e8947924028) Thanks [@rqbazan](https://github.com/rqbazan)! - Polish the package README to match the new docs site language — soften technical references to `process.env`, separate the optional `zod` install, and align the tagline with the rest of the documentation.

- [#6](https://github.com/variableland/env/pull/6) [`d150a70`](https://github.com/variableland/env/commit/d150a7006c10a240db0dd464ae4e6e8947924028) Thanks [@rqbazan](https://github.com/rqbazan)! - `readEnv()` no longer throws `ReferenceError` on runtimes where `process` is not defined (e.g. Cloudflare Workers without `nodejs_compat`). It now returns `{}` so callers can supply the environment explicitly via `defineEnv({ runtimeEnv })` — the idiomatic pattern in Worker `fetch(req, env, ctx)` handlers. Behavior on Node, Bun, Deno, browsers, and Edge runtimes that polyfill `process.env` is unchanged.

## 0.1.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vlandoss/env",
"version": "0.1.2",
"version": "0.2.0",
"description": "A simple helper to define environment-based configuration",
"homepage": "https://github.com/variableland/env/tree/main/package#readme",
"bugs": {
Expand Down