kuwan-expresspack-core 0.1.12 → 0.1.13

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/dist/env.d.ts CHANGED
@@ -1,14 +1,10 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare function parseEnv<T extends z.ZodType>(schema: T, env: Record<string, string | undefined>): z.infer<T> | undefined;
3
+ declare function parseEnv<T>(schema: z.ZodObject, env: Record<string, string | undefined>): Record<string, any> | undefined;
4
4
  /**
5
5
  * Load env with types and validation from a Zod schema
6
- *
7
- * @param appRoot
8
- * @param zodSchema
9
- * @param env
10
6
  */
11
- declare function create<T extends z.ZodType>(appRoot: string | URL, zodSchema: T, env?: Record<string, string | undefined>): z.infer<T>;
7
+ declare function create<T extends z.ZodTypeAny>(schema: T, data: unknown): z.infer<T> | undefined;
12
8
  /**
13
9
  * Helper type to infer the environment variable types from a Zod schema
14
10
  *
@@ -17,10 +13,9 @@ declare function create<T extends z.ZodType>(appRoot: string | URL, zodSchema: T
17
13
  * export type Env = InferEnv<typeof envSchema>;
18
14
  * ```
19
15
  */
20
- type InferEnv<T extends z.ZodType> = z.infer<T>;
21
16
  declare const _default: {
22
17
  create: typeof create;
23
18
  parseEnv: typeof parseEnv;
24
19
  };
25
20
 
26
- export { type InferEnv, create, _default as default, parseEnv };
21
+ export { create, _default as default };
package/dist/env.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
2
 
3
- function t(n,r){let e=n.safeParse(r);return e.success||(console.error("\u274C Invalid environment variables:"),console.error(z.prettifyError(e.error))),e?.data}function s(n,r,e){return t(r,e||process.env)||{}}var a={create:s,parseEnv:t};
3
+ function t(r,n){let e=r.safeParse(n);if(e.success)return e.data;console.error("\u274C Invalid environment variables:"),console.error(z.prettifyError(e.error));}function s(r,n){let e=r.safeParse(n);if(!e.success){console.error("\u274C Invalid environment variables:"),console.error(z.prettifyError(e.error));return}return e.data}var u={create:s,parseEnv:t};
4
4
 
5
- export { s as create, a as default, t as parseEnv };
5
+ export { s as create, u as default };
@@ -1,6 +1,13 @@
1
- import { ConsolaInstance } from 'consola';
1
+ import { ConsolaInstance, ConsolaOptions } from 'consola';
2
2
 
3
3
  declare const println: ConsolaInstance;
4
+ /**
5
+ * Create a console logger with a specific name. Uses the log-level specified in `APP_LOG_LEVEL` env variable.
6
+ */
4
7
  declare function useConsoleLogger(name: string): ConsolaInstance;
8
+ /**
9
+ * Create a console logger allowing to specify log level in options.
10
+ */
11
+ declare function createConsoleLogger(name: string, options: Partial<Pick<ConsolaOptions, "level">>): ConsolaInstance;
5
12
 
6
- export { println, useConsoleLogger };
13
+ export { createConsoleLogger, println, useConsoleLogger };
@@ -1,6 +1,6 @@
1
1
  import n from 'consola';
2
2
  import { env } from 'process';
3
3
 
4
- var e=env.APP_LOG_LEVEL,t=n.create({level:Number.isNaN(Number(e))?3:Number(e)});function i(o){return t.withTag(o)}
4
+ var e=env.APP_LOG_LEVEL,l=n.create({level:Number.isNaN(Number(e))?3:Number(e)});function u(o){return l.withTag(o)}function m(o,r){return n.create({level:r.level??(Number.isNaN(Number(e))?3:Number(e))}).withTag(o)}
5
5
 
6
- export { t as println, i as useConsoleLogger };
6
+ export { m as createConsoleLogger, l as println, u as useConsoleLogger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kuwan-expresspack-core",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -91,7 +91,7 @@
91
91
  "express": "^5.1.0",
92
92
  "kysely": "^0.28.8",
93
93
  "tinyglobby": "^0.2.15",
94
- "zod": "^4.0.14"
94
+ "zod": "4.1.12"
95
95
  },
96
96
  "keywords": [],
97
97
  "author": {
@@ -122,7 +122,8 @@
122
122
  "eslint": "^9.37.0",
123
123
  "express": "^5.1.0",
124
124
  "kysely": "^0.28.8",
125
- "typescript": "^5.9.3"
125
+ "typescript": "^5.9.3",
126
+ "zod": "4.1.12"
126
127
  },
127
128
  "sideEffects": false,
128
129
  "scripts": {