envapt 8.1.1 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # envapt
2
2
 
3
+ ## 8.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Raise the bun engine floor to 1.3.11. They finally fixed the decorator bug.
8
+
3
9
  ## 8.1.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -17,11 +17,10 @@
17
17
 
18
18
  <br clear="left"/>
19
19
 
20
- envapt returns config as the type you asked for instead of the `string | undefined` you get raw, with
21
- a fallback that removes `undefined` from the return type. It reads from whatever source you bind. On
22
- Node, Bun, and Deno that is `process.env` and your `.env` files, bound on import. On Cloudflare
23
- Workers, in the browser, or for a secrets object you fetched at boot, you bind the source with
24
- `Envapter.useSource(...)`.
20
+ envapt returns config as the type you asked for, with a fallback that removes `undefined` from the
21
+ return type. It reads from whatever source you bind. On Node, Bun, and Deno that is `process.env`
22
+ and your `.env` files, bound on import. On Cloudflare Workers, in the browser, or for a secrets
23
+ object you fetched at boot, you bind the source with `Envapter.useSource(...)`.
25
24
 
26
25
  ```ts
27
26
  import { Converters, Envapter } from 'envapt';
@@ -54,7 +53,7 @@ missing. Reads with a fallback (`Envapter.getNumber('WORKERS', 4)`) never throw.
54
53
  On Node, Bun, and Deno one binds on import.
55
54
  - **Zero runtime dependencies.** The reader, converters, and built-in `.env` parser are self-contained,
56
55
  so nothing is added to your dependency tree.
57
- - **Runs on Node, Bun, Deno, Cloudflare Workers, and the browser.** Node `>=20`, Bun `>=1.3`, Deno
56
+ - **Runs on Node, Bun, Deno, Cloudflare Workers, and the browser.** Node `>=20`, Bun `>=1.3.11`, Deno
58
57
  `>=2.5` (ESM and CJS). The portable build resolves through the package `exports`
59
58
  conditions.
60
59
  - **`.env` loading built in on Node.** The default Node source adds a per-environment file cascade,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "envapt",
3
3
  "type": "module",
4
- "version": "8.1.1",
4
+ "version": "8.2.0",
5
5
  "description": "Type-safe config for TypeScript. Read typed values from any source, process.env, .env files, Cloudflare Workers bindings, browser bundles, or any object you supply. Zero runtime dependencies, one API across Node, Bun, Deno, Workers, and the browser. TC39 accessor decorators (legacy decorators at envapt/legacy), converters, and Standard Schema (zod/valibot/arktype) validation.",
6
6
  "types": "./dist/types/index.d.mts",
7
7
  "exports": {
@@ -178,7 +178,7 @@
178
178
  "license": "Apache-2.0",
179
179
  "engines": {
180
180
  "node": ">=20.0.0",
181
- "bun": ">=1.3.0",
181
+ "bun": ">=1.3.11",
182
182
  "deno": ">=2.5.0"
183
183
  },
184
184
  "publishConfig": {
@@ -231,5 +231,5 @@
231
231
  "bump": "pnpm tsx ../../scripts/release/bump-jsr.ts",
232
232
  "release": "pnpm run cs:publish"
233
233
  },
234
- "readme": "<img src=\"https://raw.githubusercontent.com/materwelonDhruv/envapt/main/.github/assets/logo.png\" width=\"120\" align=\"left\" alt=\"envapt logo\" />\n\n<h3>envapt</h3>\n\n<p>\n <strong>The apt way to read typed config.</strong><br/>\n Read config from any source as real typed values, with zero runtime dependencies.\n</p>\n\n<p>\n <a href=\"https://www.npmjs.com/package/envapt\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/envapt?logo=npm&logoColor=cb3838&label=%20&labelColor=103544&color=cb3838\"></a>\n <a href=\"https://www.npmjs.com/package/envapt\"><img alt=\"downloads\" src=\"https://img.shields.io/npm/dm/envapt?style=flat&color=f7f6e8&labelColor=103544&label=downloads\"></a>\n <a href=\"https://jsr.io/@materwelon/envapt\"><img alt=\"jsr\" src=\"https://jsr.io/badges/@materwelon/envapt\"></a>\n <img alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/materwelonDhruv/envapt/checks.yml?branch=main&label=tests&style=flat&logo=github&color=3fb950&labelColor=103544\">\n <a href=\"LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/npm/l/envapt?style=flat&color=e97826&logo=apache&label=\"></a>\n</p>\n\n<br clear=\"left\"/>\n\nenvapt returns config as the type you asked for instead of the `string | undefined` you get raw, with\na fallback that removes `undefined` from the return type. It reads from whatever source you bind. On\nNode, Bun, and Deno that is `process.env` and your `.env` files, bound on import. On Cloudflare\nWorkers, in the browser, or for a secrets object you fetched at boot, you bind the source with\n`Envapter.useSource(...)`.\n\n```ts\nimport { Converters, Envapter } from 'envapt';\n\nconst { port, databaseUrl, cacheTtl, allowedOrigins } = Envapter.getRequiredAll(\n {\n PORT: Converters.Port, // number, checked against 0-65535\n DATABASE_URL: Converters.Url, // URL\n CACHE_TTL: Converters.Time, // \"15m\" parsed to 900000\n ALLOWED_ORIGINS: Converters.array() // string[]\n // ... and many more built-in converters\n },\n 'camelCase'\n);\n```\n\nCall that at startup and a missing value fails the boot, with one error naming every key that was\nmissing. Reads with a fallback (`Envapter.getNumber('WORKERS', 4)`) never throw.\n\n**[Read the docs →](https://envapt.materwelon.dev)**\n\n## What you get\n\n- **Typed values.** A fallback removes `undefined` from the return type. Built-in converters cover\n numbers, integers, floats, booleans, bigint, symbols, JSON, URLs, regular expressions, dates,\n durations, ports, emails, and arrays, or pass your own function or a Standard Schema validator\n (zod, valibot, arktype).\n- **Any source.** A source is any object with a `readVars()` method, so you can bind `process.env`, a\n Cloudflare Workers binding, a browser bundle, or a secrets payload you fetched from a store at boot.\n On Node, Bun, and Deno one binds on import.\n- **Zero runtime dependencies.** The reader, converters, and built-in `.env` parser are self-contained,\n so nothing is added to your dependency tree.\n- **Runs on Node, Bun, Deno, Cloudflare Workers, and the browser.** Node `>=20`, Bun `>=1.3`, Deno\n `>=2.5` (ESM and CJS). The portable build resolves through the package `exports`\n conditions.\n- **`.env` loading built in on Node.** The default Node source adds a per-environment file cascade,\n `${VAR}` templates, and strict / required checks. Off Node there is no filesystem, so you bind\n another source with `Envapter.useSource(...)` and read with the same typed API.\n\n## Install\n\n```sh\nnpm install envapt\npnpm add envapt\nyarn add envapt\nbun add envapt\ndeno add jsr:@materwelon/envapt\n```\n\n## Quick start\n\nRead values functionally with `Envapter`, or bind them to class fields with the `@Envapt` decorator.\nBoth share the same parsing, converters, and cache.\n\n### Functional\n\nRead a value from any call site, in JavaScript or TypeScript. No build step. On Node the source is\nbound for you. On Workers and in the browser, call `Envapter.useSource(...)` first.\n\n```ts\nimport { Converters, Envapter } from 'envapt';\n\nconst requestTimeout = Envapter.getUsing('REQUEST_TIMEOUT', Converters.Time, '30s'); // 30000\nconst maxRetries = Envapter.getNumber('MAX_RETRIES', 3);\nconst debug = Envapter.getBoolean('DEBUG', false);\n```\n\nOn Cloudflare Workers, `env` is importable at module scope, so bind it once in a config module, and in\nthe browser seed a `PortableSource` from the object your bundler injects.\n\n```ts\nimport { env } from 'cloudflare:workers';\nimport { Envapter, PortableSource } from 'envapt';\n\nEnvapter.useSource(new PortableSource(env));\n\nexport const apiToken = Envapter.get('API_TOKEN');\n```\n\n### Decorator\n\nBind a value to a class field with a TC39 accessor decorator. No `experimentalDecorators` flag, and it runs on Bun and Deno from `.ts` directly.\n\n```ts\nimport { Converters, Envapt, EnvTime } from 'envapt';\n\nclass Config {\n @Envapt('PORT', { converter: Converters.Port, fallback: 3000 })\n static accessor port: number;\n\n @EnvTime('CACHE_TTL', '15m')\n static accessor cacheTtl: number;\n}\n```\n\nThe legacy (experimentalDecorators) decorators are exported from `envapt/legacy`.\n\n## Agent skill\n\nInstall the envapt agent skill so AI coding tools use the correct API:\n\n```sh\nnpx skills add materwelonDhruv/envapt\n```\n\n---\n\n<p align=\"center\"><sub>Built by <a href=\"https://github.com/materwelondhruv\">@materwelonDhruv</a> · Apache 2.0</sub></p>\n"
234
+ "readme": "<img src=\"https://raw.githubusercontent.com/materwelonDhruv/envapt/main/.github/assets/logo.png\" width=\"120\" align=\"left\" alt=\"envapt logo\" />\n\n<h3>envapt</h3>\n\n<p>\n <strong>The apt way to read typed config.</strong><br/>\n Read config from any source as real typed values, with zero runtime dependencies.\n</p>\n\n<p>\n <a href=\"https://www.npmjs.com/package/envapt\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/envapt?logo=npm&logoColor=cb3838&label=%20&labelColor=103544&color=cb3838\"></a>\n <a href=\"https://www.npmjs.com/package/envapt\"><img alt=\"downloads\" src=\"https://img.shields.io/npm/dm/envapt?style=flat&color=f7f6e8&labelColor=103544&label=downloads\"></a>\n <a href=\"https://jsr.io/@materwelon/envapt\"><img alt=\"jsr\" src=\"https://jsr.io/badges/@materwelon/envapt\"></a>\n <img alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/materwelonDhruv/envapt/checks.yml?branch=main&label=tests&style=flat&logo=github&color=3fb950&labelColor=103544\">\n <a href=\"LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/npm/l/envapt?style=flat&color=e97826&logo=apache&label=\"></a>\n</p>\n\n<br clear=\"left\"/>\n\nenvapt returns config as the type you asked for, with a fallback that removes `undefined` from the\nreturn type. It reads from whatever source you bind. On Node, Bun, and Deno that is `process.env`\nand your `.env` files, bound on import. On Cloudflare Workers, in the browser, or for a secrets\nobject you fetched at boot, you bind the source with `Envapter.useSource(...)`.\n\n```ts\nimport { Converters, Envapter } from 'envapt';\n\nconst { port, databaseUrl, cacheTtl, allowedOrigins } = Envapter.getRequiredAll(\n {\n PORT: Converters.Port, // number, checked against 0-65535\n DATABASE_URL: Converters.Url, // URL\n CACHE_TTL: Converters.Time, // \"15m\" parsed to 900000\n ALLOWED_ORIGINS: Converters.array() // string[]\n // ... and many more built-in converters\n },\n 'camelCase'\n);\n```\n\nCall that at startup and a missing value fails the boot, with one error naming every key that was\nmissing. Reads with a fallback (`Envapter.getNumber('WORKERS', 4)`) never throw.\n\n**[Read the docs →](https://envapt.materwelon.dev)**\n\n## What you get\n\n- **Typed values.** A fallback removes `undefined` from the return type. Built-in converters cover\n numbers, integers, floats, booleans, bigint, symbols, JSON, URLs, regular expressions, dates,\n durations, ports, emails, and arrays, or pass your own function or a Standard Schema validator\n (zod, valibot, arktype).\n- **Any source.** A source is any object with a `readVars()` method, so you can bind `process.env`, a\n Cloudflare Workers binding, a browser bundle, or a secrets payload you fetched from a store at boot.\n On Node, Bun, and Deno one binds on import.\n- **Zero runtime dependencies.** The reader, converters, and built-in `.env` parser are self-contained,\n so nothing is added to your dependency tree.\n- **Runs on Node, Bun, Deno, Cloudflare Workers, and the browser.** Node `>=20`, Bun `>=1.3.11`, Deno\n `>=2.5` (ESM and CJS). The portable build resolves through the package `exports`\n conditions.\n- **`.env` loading built in on Node.** The default Node source adds a per-environment file cascade,\n `${VAR}` templates, and strict / required checks. Off Node there is no filesystem, so you bind\n another source with `Envapter.useSource(...)` and read with the same typed API.\n\n## Install\n\n```sh\nnpm install envapt\npnpm add envapt\nyarn add envapt\nbun add envapt\ndeno add jsr:@materwelon/envapt\n```\n\n## Quick start\n\nRead values functionally with `Envapter`, or bind them to class fields with the `@Envapt` decorator.\nBoth share the same parsing, converters, and cache.\n\n### Functional\n\nRead a value from any call site, in JavaScript or TypeScript. No build step. On Node the source is\nbound for you. On Workers and in the browser, call `Envapter.useSource(...)` first.\n\n```ts\nimport { Converters, Envapter } from 'envapt';\n\nconst requestTimeout = Envapter.getUsing('REQUEST_TIMEOUT', Converters.Time, '30s'); // 30000\nconst maxRetries = Envapter.getNumber('MAX_RETRIES', 3);\nconst debug = Envapter.getBoolean('DEBUG', false);\n```\n\nOn Cloudflare Workers, `env` is importable at module scope, so bind it once in a config module, and in\nthe browser seed a `PortableSource` from the object your bundler injects.\n\n```ts\nimport { env } from 'cloudflare:workers';\nimport { Envapter, PortableSource } from 'envapt';\n\nEnvapter.useSource(new PortableSource(env));\n\nexport const apiToken = Envapter.get('API_TOKEN');\n```\n\n### Decorator\n\nBind a value to a class field with a TC39 accessor decorator. No `experimentalDecorators` flag, and it runs on Bun and Deno from `.ts` directly.\n\n```ts\nimport { Converters, Envapt, EnvTime } from 'envapt';\n\nclass Config {\n @Envapt('PORT', { converter: Converters.Port, fallback: 3000 })\n static accessor port: number;\n\n @EnvTime('CACHE_TTL', '15m')\n static accessor cacheTtl: number;\n}\n```\n\nThe legacy (experimentalDecorators) decorators are exported from `envapt/legacy`.\n\n## Agent skill\n\nInstall the envapt agent skill so AI coding tools use the correct API:\n\n```sh\nnpx skills add materwelonDhruv/envapt\n```\n\n---\n\n<p align=\"center\"><sub>Built by <a href=\"https://github.com/materwelondhruv\">@materwelonDhruv</a> · Apache 2.0</sub></p>\n"
235
235
  }