{"_id":"@atom-forge/env-reader","_rev":"6-d358e966db8995a1fd483921235d93ef","name":"@atom-forge/env-reader","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@atom-forge/env-reader","version":"0.1.0","keywords":["env","environment","config","typescript"],"author":{"name":"Gergely Laborci"},"license":"SEE LICENSE IN LICENSE","_id":"@atom-forge/env-reader@0.1.0","maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"homepage":"https://github.com/atom-forge/env-reader#readme","bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"dist":{"shasum":"bcbc91032faed497e16bd22099cd171cb02646c9","tarball":"https://registry.npmjs.org/@atom-forge/env-reader/-/env-reader-0.1.0.tgz","fileCount":4,"integrity":"sha512-TwCzCrOrT3ZJBkkRP1JkkQd3aV9pjO6UpSp+H1XQMYH5v1irMaJpgVOpa0msqAk8YK+evs9xye07zQoL7D9pxA==","signatures":[{"sig":"MEYCIQDD31dpjIo4MmuHhTJclG+Pxm5/CD69znTZqMDsumNiQgIhANITTv/Z5Aqms+T072lxBkaNpJn6+KkxQ+tkD+jVmMwL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17479},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","release":"npm publish --access public","prepublishOnly":"bun run build"},"_npmUser":{"name":"laborci","email":"gergely@laborci.hu"},"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"_npmVersion":"11.4.2","description":"Type-safe environment variable reader for TypeScript","directories":{},"_nodeVersion":"24.4.1","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.3.1"},"_npmOperationalInternal":{"tmp":"tmp/env-reader_0.1.0_1775476667354_0.15984178195831134","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@atom-forge/env-reader","version":"0.1.1","keywords":["env","environment","config","typescript"],"author":{"url":"https://github.com/laborci","name":"Gergely Laborci"},"license":"MIT","_id":"@atom-forge/env-reader@0.1.1","maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"homepage":"https://github.com/atom-forge/env-reader#readme","bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"dist":{"shasum":"74c0ff6675bb90010008afed4fe8b05e893fcd02","tarball":"https://registry.npmjs.org/@atom-forge/env-reader/-/env-reader-0.1.1.tgz","fileCount":4,"integrity":"sha512-qTypgHYfhzEqZ8SWQwzHJevZa1GwovH4cfuw/s74+htrHQOW+vuZ/lPxw414IGRV0VVvT/b5avCtILVqyLeKbA==","signatures":[{"sig":"MEYCIQDRmakmSOxms2hL875NOfTAsBiFHoVNCe7DH8A2VUeY1wIhAOEamzmad+HpNjxd8b7x4ZGjheedGTBrcX+zKzIbq6P1","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atom-forge%2fenv-reader@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":17514},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"2fb18ea84b889ca2afdad27c3c6145bfc8cd6a64","scripts":{"build":"tsc","release":"npm publish --access public","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b882e32b-96dc-4da3-b50a-dae482570fe5"}},"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"_npmVersion":"11.13.0","description":"Type-safe environment variable reader for TypeScript","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.3.1"},"_npmOperationalInternal":{"tmp":"tmp/env-reader_0.1.1_1780312617954_0.9572526788081581","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@atom-forge/env-reader","version":"0.1.2","keywords":["env","environment","config","typescript"],"author":{"url":"https://github.com/laborci","name":"Gergely Laborci"},"license":"MIT","_id":"@atom-forge/env-reader@0.1.2","maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"homepage":"https://github.com/atom-forge/env-reader#readme","bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"dist":{"shasum":"73592748bf1c2e358439bdb6195ba127a30e6b89","tarball":"https://registry.npmjs.org/@atom-forge/env-reader/-/env-reader-0.1.2.tgz","fileCount":5,"integrity":"sha512-IioJRx1+FXifHd8fQcaa/7BkL43L4m1N8ZuxRiUC4+XhlN/piYZmKhgberHOuAgr0ki6hb/2Wlw4cbjnE0HDPw==","signatures":[{"sig":"MEUCIQD4cDN25HvK4XmUn3d5iTOBfQRpclv/7A2fgAqgoRmBZwIgBj9Rn7DNM2awre+bCsWThHv5fSmu/8DXz2m5MAqqw3g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atom-forge%2fenv-reader@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":17975},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"65975318cd9c1f039abaf86c5ae3c67fedc0cfa9","scripts":{"pub":"bun run scripts/pub.ts","build":"tsc","release":"npm publish --access public","pub-check":"bun run scripts/pub-check.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b882e32b-96dc-4da3-b50a-dae482570fe5"}},"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"_npmVersion":"11.17.0","description":"Type-safe environment variable reader for TypeScript","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.3.1"},"_npmOperationalInternal":{"tmp":"tmp/env-reader_0.1.2_1787833471814_0.3214875061397997","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@atom-forge/env-reader","version":"0.1.3","keywords":["env","environment","config","typescript"],"author":{"url":"https://github.com/laborci","name":"Gergely Laborci"},"license":"MIT","_id":"@atom-forge/env-reader@0.1.3","maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"homepage":"https://github.com/atom-forge/env-reader#readme","bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"dist":{"shasum":"23463046196f258829286be4cbcbaee55c038452","tarball":"https://registry.npmjs.org/@atom-forge/env-reader/-/env-reader-0.1.3.tgz","fileCount":5,"integrity":"sha512-IaBv7IHF7AwI84Jrle7NL2I2myrGKfG8NYjiifcZLQKXRHjkWoqcg8clCcueU9eD2g5B9yO1f8acKACSjo5PYg==","signatures":[{"sig":"MEUCIDv06aCA9lin9s12nv3MMBnJIUWXddnD89JAWu3dRzcEAiEArCv68WjwGD73obl0QUyKRUNTIceRuEBHLDF9cMr4TRo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atom-forge%2fenv-reader@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":21923},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"5ac2a0594a0ab43c867605b3addda4c93649f1b9","scripts":{"pub":"bun run scripts/pub.ts","build":"tsc","release":"npm publish --access public","pub-check":"bun run scripts/pub-check.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b882e32b-96dc-4da3-b50a-dae482570fe5"}},"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"_npmVersion":"11.17.0","description":"Type-safe environment variable reader for TypeScript","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.3.1"},"_npmOperationalInternal":{"tmp":"tmp/env-reader_0.1.3_1787919922927_0.18614691328035704","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@atom-forge/env-reader","version":"0.1.4","keywords":["env","environment","config","typescript"],"author":{"url":"https://github.com/laborci","name":"Gergely Laborci"},"license":"MIT","_id":"@atom-forge/env-reader@0.1.4","maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"homepage":"https://github.com/atom-forge/env-reader#readme","bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"dist":{"shasum":"b6e5c992d8227b8f5559ce32afe65c0caf55887b","tarball":"https://registry.npmjs.org/@atom-forge/env-reader/-/env-reader-0.1.4.tgz","fileCount":5,"integrity":"sha512-2ToqOgoQ3Yrcf8a9e0y9xnDyElKw6XnSfukDWC1nkC6Mrh92OmcDRrxqJ2TnhOGCiSM8Q/WwSNjmYALZt6oyGg==","signatures":[{"sig":"MEUCIQCRo0l1jv6+dsFFttUgRRPSxakEO9SXqMWbTRFKnFTYlQIgQig5BQcqIUveRjyK/V7skt6T6DAFXywgxBd3aDdSudU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atom-forge%2fenv-reader@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":22825},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"de3bbdaa30d9e50cd5bb3885441e87f7973de90e","scripts":{"pub":"bun run scripts/pub.ts","build":"tsc","release":"npm publish --access public","pub-check":"bun run scripts/pub-check.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b882e32b-96dc-4da3-b50a-dae482570fe5"}},"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"_npmVersion":"11.17.0","description":"Type-safe environment variable reader for TypeScript","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.3.1"},"_npmOperationalInternal":{"tmp":"tmp/env-reader_0.1.4_1787923625049_0.14903613229088997","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@atom-forge/env-reader","version":"0.1.5","description":"Type-safe environment variable reader for TypeScript","keywords":["env","environment","config","typescript"],"author":{"name":"Gergely Laborci","url":"https://github.com/laborci"},"license":"MIT","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"scripts":{"build":"tsc","prepublishOnly":"bun run build","release":"npm publish --access public","pub-check":"bun run scripts/pub-check.ts","pub":"bun run scripts/pub.ts"},"devDependencies":{"@types/node":"^25.3.1","typescript":"^5.0.0"},"gitHead":"c83d33b4fc1798c2dfd85b0f14425b4798a3b726","_id":"@atom-forge/env-reader@0.1.5","bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"homepage":"https://github.com/atom-forge/env-reader#readme","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-WrqWgkRw5LQ7CHppFrc4ilkZqHw8KTwRW70L/scPR2QxhAapnAXYQsbLvIuCMYh2pWgzVzvX4lKkutWHEJ+eYA==","shasum":"d79a55950fd07cc2670727fc20e35338a56ef041","tarball":"https://registry.npmjs.org/@atom-forge/env-reader/-/env-reader-0.1.5.tgz","fileCount":5,"unpackedSize":23047,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atom-forge%2fenv-reader@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB8y4oEiRfJ6OfwslscSVju9O+emwabHW1oQ/0JEtPj4AiAQniRMnlpkOo3P93YJMCCH8Ls/Wbix4C5xnpKr4Wqcmg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b882e32b-96dc-4da3-b50a-dae482570fe5"}},"directories":{},"maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/env-reader_0.1.5_1787924541156_0.07449314291504949"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-06T11:57:47.289Z","modified":"2026-08-28T13:42:21.658Z","0.1.0":"2026-04-06T11:57:47.476Z","0.1.1":"2026-06-01T11:16:58.090Z","0.1.2":"2026-08-27T12:24:31.970Z","0.1.3":"2026-08-28T12:25:23.068Z","0.1.4":"2026-08-28T13:27:05.173Z","0.1.5":"2026-08-28T13:42:21.316Z"},"bugs":{"url":"https://github.com/atom-forge/env-reader/issues"},"author":{"name":"Gergely Laborci","url":"https://github.com/laborci"},"license":"MIT","homepage":"https://github.com/atom-forge/env-reader#readme","keywords":["env","environment","config","typescript"],"repository":{"url":"git://github.com/atom-forge/env-reader.git"},"description":"Type-safe environment variable reader for TypeScript","maintainers":[{"name":"laborci","email":"gergely@laborci.hu"}],"readme":"# @atom-forge/env-reader\n\nType-safe environment variable reader for TypeScript. Reads, parses, and validates environment variables at startup — so your app fails fast if the environment is misconfigured, not at runtime.\n\n## Installation\n\n```bash\nnpm install @atom-forge/env-reader\n```\n\n## Usage\n\n```typescript\nimport { EnvReader, asReadonly } from \"@atom-forge/env-reader\";\nimport path from \"path\";\n\nconst env = new EnvReader(path.resolve(__dirname, \"../\"));\n\nconst config = asReadonly({\n    app: {\n        env: env.oneOf(\"APP_ENV\", [\"dev\", \"prod\", \"test\"], \"prod\"),\n    },\n    database: {\n        connectionString: env.string(\"DATABASE_URL\"),\n        maxPool: env.int(\"DB_POOL_MAX\", 20),\n    },\n    auth: {\n        secret: env.string(\"JWT_SECRET\"),\n        expiresIn: env.int(\"JWT_EXPIRATION\", 60 * 60 * 8),\n    },\n});\n```\n\n## API\n\n### `new EnvReader(projectRoot: string)`\n\nInstantiate with an absolute path to the project root. Used for resolving `file()` and `dir()` paths.\n\n### Methods\n\n| Method | Returns | Description |\n|---|---|---|\n| `string(key, default?, trim?)` | `string` | Reads a string. Trims whitespace by default. |\n| `int(key, default?, radix?)` | `number` | Parses an integer. Radix defaults to `10`. |\n| `float(key, default?)` | `number` | Parses a floating-point number. |\n| `boolean(key, default?)` | `boolean` | Parses `true/false`, `yes/no`, `1/0` (case-insensitive). |\n| `url(key, default?)` | `URL` | Validates and returns a `URL` object. |\n| `url(key, { defaultValue?, map })` | mapped object | Validates a URL and maps selected components to an object. |\n| `regex(key, default?)` | `RegExp` | Validates and returns a `RegExp` object. |\n| `oneOf(key, values, default?)` | `T` | Validates the value is one of the allowed strings. |\n| `list(key, parser, default?, separator?)` | `T[]` | Splits by separator (default `,`) and parses each item. |\n| `file(key, default?, onMissing?, stayInProject?)` | `string` | Resolves an absolute file path. |\n| `dir(key, default?, onMissing?, stayInProject?)` | `string` | Resolves an absolute directory path. |\n\nIf a variable is missing and has no default, the method throws immediately.\n\n### `url` map example\n\n```typescript\n// S3_URL=s3://accessKey:secretKey@fsn1.your-objectstorage.com/assets/files/\nconst s3 = env.url(\"S3_URL\", {\n    map: {\n        accessKey: \"username\",\n        secretKey: \"password\",\n        host: \"hostname\",\n        bucket: \"path(0)\",\n        prefix: [\"path(1,end)\", \"\"],\n    },\n});\n// → { accessKey, secretKey, host, bucket: \"assets\", prefix: \"files/\" }\n```\n\nAvailable selectors are `protocol`, `username`, `password`, `hostname`, `host`, `port`, `origin`, `path`, `hash`, `path(index)`, `path(start,end)`, and `query(\"name\")`. `origin` combines the protocol and host, including a port when present. Path indexes are zero-based; negative indexes count from the end. Ranges are inclusive and may use `end` as their final index. A selector by itself is required; use `[selector, defaultValue]` to make it optional. The default applies only when the selector has no value, never to an invalid selector.\n\n### `asReadonly<T>(value: T): DeepReadonly<T>`\n\nWraps a config object in a `DeepReadonly` type. Zero runtime cost — pure TypeScript type cast.\n\n```typescript\nconst config = asReadonly({ db: { host: \"localhost\" } });\nconfig.db.host = \"other\"; // TS error\n```\n\n### `list` example\n\n```typescript\n// ALLOWED_PORTS=80,443,3000\nconst ports = env.list(\"ALLOWED_PORTS\", v => parseInt(v, 10));\n// → [80, 443, 3000]\n```\n\n### `file` / `dir` parameters\n\n- `onMissing`: `true` (default) throws on missing path, `false` returns the path silently, or a `(path) => void` callback.\n- `stayInProject`: `true` (default) prevents path traversal outside the project root.\n","readmeFilename":"README.md"}