kuwan-expresspack-core 0.1.14 → 0.1.15
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/chunk-AFN6MPA7.mjs +12 -0
- package/dist/env.d.ts +4 -1
- package/dist/env.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-VOOKMRDS.mjs +0 -11
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { config } from '@dotenvx/dotenvx';
|
|
3
|
+
import O from 'consola';
|
|
4
|
+
import { colorize } from 'consola/utils';
|
|
5
|
+
|
|
6
|
+
var v=process.env.EXPRESSPACK_LOG_LEVEL,h=O.create({level:Number.isNaN(Number(v))?3:Number(v)});function E(r){switch(typeof r){case "number":case "bigint":return colorize("cyan",r.toString());case "boolean":return colorize(r?"green":"red",String(r));case "symbol":return colorize("magenta",r.toString());case "string":return isNaN(Number(r))?colorize("whiteBright",`${r}`):colorize("yellow",`'${r}'`);case "undefined":return colorize("gray","undefined")}return r===null?colorize("dim","null"):String(r)}var o=h;var f,s=null,c=null,m={};function w(r,e){let t=r.safeParse(e);if(t.success)return t.data;console.error("\u274C Invalid environment variables:"),console.error(z.prettifyError(t.error));}function C(r,e,t={fatal:false,immediate_log_error:true,log_error_after_graceful_start:true}){if(m=t,t.fatal)try{let n=r.parse(e);return {...f,...n}}catch(n){throw n instanceof z.ZodError?(s=z.prettifyError(n),c=n,o.error("\u274C Invalid environment variables:"),o.error("\u274C",s),new Error("Invalid environment variables. The environment variable did not pass the schema validation. Check if you have set all required environment variables correctly.")):n}let i=r.safeParse(e);if(!i.success){let n=r.partial().safeParse(e);if(!n.success)return s=z.prettifyError(i.error),c=i.error,t.immediate_log_error&&(o.error("\u274C Invalid environment variables:"),o.error("\u274C",s)),f||{};s=z.prettifyError(i.error),c=i.error,t.immediate_log_error&&(o.error("\u274C Invalid environment variables:"),o.error("\u274C",s));let d=r.keyof();for(let g of d.options)g in n.data||(n.data[g]=void 0);return {...f,...n.data}}return {...f,...i.data}}function N(){return c}function b(){return s}function P(r){if(!r||Object.keys(r).length===0){o.warn("No environment variables to print. Make sure the env is complete and valid.");return}let e=Object.entries(r).sort(([l],[p])=>l.localeCompare(p)),t=Math.max(...e.map(([l])=>l.length))+2,i=e.map(([l,p])=>`${l.padEnd(t," ")} ${E(p)}`),n=`KEY${" ".repeat(t-3)} VALUE`,d=" ".repeat(n.length);return [d,n,d,...i].join(`
|
|
7
|
+
`)}function S(){if(m){let{log_error_after_graceful_start:r}=m;if(r){let e=b();e&&o.error("Invalid Environment Variable Value",`
|
|
8
|
+
-----
|
|
9
|
+
${e}
|
|
10
|
+
-----`);}}}function k(r){let e=config(r);return f=e.parsed?e.parsed:void 0,e}var Z={create:C,parseEnv:w,prettifyEnv:P,getEnvErrorRaw:N,getEnvErrorString:b,logEnvErrors:S,config:k};
|
|
11
|
+
|
|
12
|
+
export { o as a, C as b, N as c, b as d, P as e, S as f, k as g, Z as h };
|
package/dist/env.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { DotenvConfigOptions, DotenvConfigOutput } from '@dotenvx/dotenvx';
|
|
2
3
|
|
|
3
4
|
interface EnvOptions {
|
|
4
5
|
/**
|
|
@@ -54,6 +55,7 @@ declare function prettifyEnv(env: Record<string, any>): string | undefined;
|
|
|
54
55
|
* Errors are already logged after by graceful start.
|
|
55
56
|
*/
|
|
56
57
|
declare function logEnvErrors(): void;
|
|
58
|
+
declare function config(options?: DotenvConfigOptions | undefined): DotenvConfigOutput;
|
|
57
59
|
declare const _default: {
|
|
58
60
|
create: typeof create;
|
|
59
61
|
parseEnv: typeof parseEnv;
|
|
@@ -61,6 +63,7 @@ declare const _default: {
|
|
|
61
63
|
getEnvErrorRaw: typeof getEnvErrorRaw;
|
|
62
64
|
getEnvErrorString: typeof getEnvErrorString;
|
|
63
65
|
logEnvErrors: typeof logEnvErrors;
|
|
66
|
+
config: typeof config;
|
|
64
67
|
};
|
|
65
68
|
|
|
66
|
-
export { type EnvOptions, create, _default as default, getEnvErrorRaw, getEnvErrorString, logEnvErrors, prettifyEnv };
|
|
69
|
+
export { type EnvOptions, config, create, _default as default, getEnvErrorRaw, getEnvErrorString, logEnvErrors, prettifyEnv };
|
package/dist/env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as create,
|
|
1
|
+
export { g as config, b as create, h as default, c as getEnvErrorRaw, d as getEnvErrorString, f as logEnvErrors, e as prettifyEnv } from './chunk-AFN6MPA7.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from './chunk-CRIPGIHI.mjs';
|
|
2
2
|
import { a as a$1 } from './chunk-VSPZT4K6.mjs';
|
|
3
|
-
import { a, f } from './chunk-
|
|
3
|
+
import { a, f } from './chunk-AFN6MPA7.mjs';
|
|
4
4
|
import { Router } from 'express';
|
|
5
5
|
import N, { relative, join } from 'path';
|
|
6
6
|
import { existsSync } from 'fs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuwan-expresspack-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@antfu/eslint-config": "^6.0.0",
|
|
83
|
+
"@dotenvx/dotenvx": "^1.51.0",
|
|
83
84
|
"axios": "^1.12.2",
|
|
84
85
|
"citty": "^0.1.6",
|
|
85
86
|
"consola": "^3.4.2",
|
|
@@ -121,7 +122,6 @@
|
|
|
121
122
|
"@types/express": "^5.0.3",
|
|
122
123
|
"eslint": "^9.37.0",
|
|
123
124
|
"express": "^5.1.0",
|
|
124
|
-
"kysely": "^0.28.8",
|
|
125
125
|
"typescript": "^5.9.3",
|
|
126
126
|
"zod": "4.1.12"
|
|
127
127
|
},
|
package/dist/chunk-VOOKMRDS.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import _ from 'consola';
|
|
3
|
-
import { colorize } from 'consola/utils';
|
|
4
|
-
|
|
5
|
-
var p=process.env.EXPRESSPACK_LOG_LEVEL,h=_.create({level:Number.isNaN(Number(p))?3:Number(p)});function v(r){switch(typeof r){case "number":case "bigint":return colorize("cyan",r.toString());case "boolean":return colorize(r?"green":"red",String(r));case "symbol":return colorize("magenta",r.toString());case "string":return isNaN(Number(r))?colorize("whiteBright",`${r}`):colorize("yellow",`'${r}'`);case "undefined":return colorize("gray","undefined")}return r===null?colorize("dim","null"):String(r)}var o=h;var s=null,f=null,m={};function x(r,n){let t=r.safeParse(n);if(t.success)return t.data;console.error("\u274C Invalid environment variables:"),console.error(z.prettifyError(t.error));}function w(r,n,t={fatal:false,immediate_log_error:true,log_error_after_graceful_start:true}){if(m=t,t.fatal)try{return r.parse(n)}catch(e){throw e instanceof z.ZodError?(s=z.prettifyError(e),f=e,o.error("\u274C Invalid environment variables:"),o.error("\u274C",s),new Error("Invalid environment variables. The environment variable did not pass the schema validation. Check if you have set all required environment variables correctly.")):e}let i=r.safeParse(n);if(!i.success){let e=r.partial().safeParse(n);if(!e.success)return s=z.prettifyError(i.error),f=i.error,t.immediate_log_error&&(o.error("\u274C Invalid environment variables:"),o.error("\u274C",s)),{};s=z.prettifyError(i.error),f=i.error,t.immediate_log_error&&(o.error("\u274C Invalid environment variables:"),o.error("\u274C",s));let c=r.keyof();for(let d of c.options)d in e.data||(e.data[d]=void 0);return e.data}return i.data}function N(){return f}function E(){return s}function O(r){if(!r||Object.keys(r).length===0){o.warn("No environment variables to print. Make sure the env is complete and valid.");return}let n=Object.entries(r).sort(([l],[g])=>l.localeCompare(g)),t=Math.max(...n.map(([l])=>l.length))+2,i=n.map(([l,g])=>`${l.padEnd(t," ")} ${v(g)}`),e=`KEY${" ".repeat(t-3)} VALUE`,c=" ".repeat(e.length);return [c,e,c,...i].join(`
|
|
6
|
-
`)}function S(){if(m){let{log_error_after_graceful_start:r}=m;if(r){let n=E();n&&o.error("Invalid Environment Variable Value",`
|
|
7
|
-
-----
|
|
8
|
-
${n}
|
|
9
|
-
-----`);}}}var j={create:w,parseEnv:x,prettifyEnv:O,getEnvErrorRaw:N,getEnvErrorString:E,logEnvErrors:S};
|
|
10
|
-
|
|
11
|
-
export { o as a, w as b, N as c, E as d, O as e, S as f, j as g };
|