@thexjs/env 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -26,8 +26,8 @@ export const env = createEnv({
26
26
  });
27
27
 
28
28
  env.DATABASE_URL; // string, validated as a URL
29
- env.PORT; // number
30
- env.NODE_ENV; // "development" | "production" | "test"
29
+ env.PORT; // number
30
+ env.NODE_ENV; // "development" | "production" | "test"
31
31
  ```
32
32
 
33
33
  If any variable is missing or fails validation, `createEnv` throws a single `Error` listing every failure at once:
@@ -40,16 +40,15 @@ Environment validation failed:
40
40
 
41
41
  ## Validators
42
42
 
43
- | Validator | Accepts | Notes |
44
- |---|---|---|
45
- | `str()` | any non-`undefined` string | |
46
- | `num()` | numeric strings | rejects `NaN` |
47
- | `bool()` | `"true"` / `"1"` → `true`, `"false"` / `"0"` → `false` | anything else throws |
48
- | `oneOf([...values])` | one of the given string literals | return type is narrowed to the literal union |
49
- | `url()` | any string parseable by `new URL(...)` | |
43
+ | Validator | Accepts | Notes |
44
+ | -------------------- | ------------------------------------------------------ | -------------------------------------------- |
45
+ | `str()` | any non-`undefined` string | |
46
+ | `num()` | numeric strings | rejects `NaN` |
47
+ | `bool()` | `"true"` / `"1"` → `true`, `"false"` / `"0"` → `false` | anything else throws |
48
+ | `oneOf([...values])` | one of the given string literals | return type is narrowed to the literal union |
49
+ | `url()` | any string parseable by `new URL(...)` | |
50
50
 
51
51
  Built-in validators also expose two chaining combinators:
52
-
53
52
  - `.optional()` — a missing variable becomes `undefined` instead of failing;
54
53
  a present-but-invalid value still throws. `num().optional()` is typed
55
54
  `number | undefined`.
@@ -96,4 +95,4 @@ When used with `@thexjs/core`, keep the default `THEXJS_PUBLIC_` prefix: the fra
96
95
 
97
96
  ## License
98
97
 
99
- MIT
98
+ MIT
@@ -28,4 +28,5 @@ declare function bool(): ScalarValidator<boolean>;
28
28
  declare function oneOf<T extends string>(values: readonly T[]): ScalarValidator<T>;
29
29
  declare function url(): ScalarValidator<string>;
30
30
 
31
- export { type ChainableValidator, type EnvValidator, bool, num, oneOf, str, url };
31
+ export { bool, num, oneOf, str, url };
32
+ export type { ChainableValidator, EnvValidator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thexjs/env",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Type-safe environment variable loading and validation for the x framework.",
5
5
  "keywords": [
6
6
  "environment-variables",
@@ -43,6 +43,6 @@
43
43
  "typescript": "^5.7.0"
44
44
  },
45
45
  "devDependencies": {
46
- "tsup": "^8.3.0"
46
+ "tsup": "^9.0.0"
47
47
  }
48
48
  }