kuwan-expresspack-core 0.1.14 → 0.1.16
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-CZGPAGDK.mjs +12 -0
- package/dist/chunk-JKH5TYED.mjs +3 -0
- package/dist/chunk-OXUMMLIO.mjs +6 -0
- package/dist/env-config.d.ts +1 -0
- package/dist/env-config.mjs +3 -0
- package/dist/env.d.ts +6 -2
- package/dist/env.mjs +1 -1
- package/dist/index.d.ts +21 -5
- package/dist/index.mjs +9 -8
- package/dist/middlewares/body-parser/index.d.ts +3 -3
- package/dist/services/event/index.d.ts +19 -3
- package/dist/services/event/index.mjs +1 -1
- package/dist/services/logger/index.mjs +3 -3
- package/dist/utils/import-default.d.ts +8 -0
- package/dist/utils/import-default.mjs +1 -0
- package/package.json +6 -2
- package/dist/chunk-CRIPGIHI.mjs +0 -6
- package/dist/chunk-VOOKMRDS.mjs +0 -11
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z as z$1 } from 'zod';
|
|
2
|
+
import { config } from '@dotenvx/dotenvx';
|
|
3
|
+
import { colorize } from 'consola/utils';
|
|
4
|
+
import L from 'consola';
|
|
5
|
+
|
|
6
|
+
var m=colorize;function N(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 P=L.create({level:Number.isNaN(Number(process.env.EXPRESSPACK_LOG_LEVEL))?3:Number(process.env.EXPRESSPACK_LOG_LEVEL)});function b(){let r=Number(process.env.EXPRESSPACK_LOG_LEVEL);P.level=Number.isNaN(r)?3:r;}var s=P;var c,l=null,v=null,y={},E=[];function z(r,n){let o=r.safeParse(n);if(o.success)return o.data;console.error("\u274C Invalid environment variables:"),console.error(z$1.prettifyError(o.error));}function I(r,n,o={fatal:false,immediate_log_error:true,log_error_after_graceful_start:true}){if(b(),y=o,o.fatal)try{let t=r.parse(n);return {...c,...t}}catch(t){throw t instanceof z$1.ZodError?(l=z$1.prettifyError(t),v=t,s.error("\u274C Invalid environment variables:"),s.error("\u274C",l),new Error("Invalid environment variables. The environment variable did not pass the schema validation. Check if you have set all required environment variables correctly.")):t}let i=r.safeParse(n);if(!i.success){let t=r.partial().safeParse(n);if(!t.success)return l=z$1.prettifyError(i.error),v=i.error,o.immediate_log_error&&(s.error("\u274C Invalid environment variables:"),s.error("\u274C",l)),c||{};l=z$1.prettifyError(i.error),v=i.error,o.immediate_log_error&&(s.error("\u274C Invalid environment variables:"),s.error("\u274C",l));let d=r.keyof();E=d.options;for(let p of d.options)p in t.data||(t.data[p]=void 0);return {...c,...t.data}}let g=r.keyof();E=g.options;for(let t of g.options)t in i.data||(i.data[t]=void 0);return {...c,...i.data}}function R(){return v}function S(){return l}function T(r){if(!r||Object.keys(r).length===0){s.warn("No environment variables to print. Make sure the env is complete and valid.");return}let n=e=>e.startsWith("* ")?m("dim",e):e,o=e=>E.includes(e)?e:`* ${e}`,i=e=>e.startsWith("! ")?m("dim",m("yellow",`${e}`)):e,g=e=>E.includes(e)&&r[e]===void 0?`! ${e}`:e,t=Object.entries(r).sort(([e],[u])=>e.localeCompare(u)).map(([e,u])=>[o(e),u]).map(([e,u])=>[g(e),u]),d=Math.max(...t.map(([e])=>e.length))+2,p=t.map(([e,u])=>`${e.padEnd(d," ").replace(e,n(e)).replace(e,i(e))} ${N(u)}`),_=`KEY${" ".repeat(d-3)} VALUE`,h=" ".repeat(_.length);return [h,_,h,...p].join(`
|
|
7
|
+
`)}function C(){if(y){let{log_error_after_graceful_start:r}=y;if(r){let n=S();n&&s.error("Invalid Environment Variable Value",`
|
|
8
|
+
-----
|
|
9
|
+
${n}
|
|
10
|
+
-----`);}}}function K(r){c={};let n=config(r);return b(),c=n.parsed?n.parsed:void 0,n}function $(r){return new Proxy(r,{get(n,o){return o in n?n[o]:process.env[o]}})}function j(r,n,o){let i=I(r,n,o);return $(i)}var Y={create:j,parseEnv:z,prettifyEnv:T,getEnvErrorRaw:R,getEnvErrorString:S,logEnvErrors:C,config:K};
|
|
11
|
+
|
|
12
|
+
export { s as a, I as b, R as c, S as d, T as e, C as f, K as g, Y as h };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import a from 'emittery';
|
|
2
|
+
import { env } from 'process';
|
|
3
|
+
|
|
4
|
+
function c(){return env.EXPRESSPACK_EVENT_EMITTER_DEBUG==="true"||env.EXPRESSPACK_EVENT_EMITTER_DEBUG==="1"||(typeof env.EXPRESSPACK_EVENT_EMITTER_DEBUG=="boolean"?env.EXPRESSPACK_EVENT_EMITTER_DEBUG===true:false)}var r=new a({debug:{name:"expresspack-emitter",enabled:c()}});function y(){return new a({debug:{name:"c-emitter",enabled:c()}})}function x(o){o({on:async(i,t)=>{typeof t=="function"&&t.length===0?r.on(i,async s=>{try{let e=await t();if(typeof e=="object"&&e!==null&&"default"in e){let f=e.default;if(typeof f=="function")return f(s)}if(typeof e=="function")return e(s)}catch(e){throw e instanceof Error?e:new Error(`Unknown error occurred in event handler for event "${t}"`)}}):(console.log(typeof t),r.on(i,t));},emitter:r});}function T(o,E){return E}var K=r;
|
|
5
|
+
|
|
6
|
+
export { r as a, y as b, x as c, T as d, K as e };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@antfu/eslint-config';
|
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,13 +55,16 @@ 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;
|
|
59
|
+
declare function createProxy<T extends z.ZodObject<any>>(schema: T, data: unknown, options?: Partial<EnvOptions>): z.output<T>;
|
|
57
60
|
declare const _default: {
|
|
58
|
-
create: typeof
|
|
61
|
+
create: typeof createProxy;
|
|
59
62
|
parseEnv: typeof parseEnv;
|
|
60
63
|
prettifyEnv: typeof prettifyEnv;
|
|
61
64
|
getEnvErrorRaw: typeof getEnvErrorRaw;
|
|
62
65
|
getEnvErrorString: typeof getEnvErrorString;
|
|
63
66
|
logEnvErrors: typeof logEnvErrors;
|
|
67
|
+
config: typeof config;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
|
-
export { type EnvOptions, create, _default as default, getEnvErrorRaw, getEnvErrorString, logEnvErrors, prettifyEnv };
|
|
70
|
+
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-CZGPAGDK.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -8,14 +8,27 @@ declare function gracefulShutdown(server: Server, onShutdown: () => Promise<void
|
|
|
8
8
|
type AppContext = {
|
|
9
9
|
app: Express;
|
|
10
10
|
};
|
|
11
|
-
type KernelExports = ((context: AppContext) => void) | Promise<void
|
|
11
|
+
type KernelExports = ((context: AppContext) => void) | Promise<void> | void;
|
|
12
12
|
/**
|
|
13
13
|
* This is mostly a plain Express middleware definition.
|
|
14
14
|
*
|
|
15
15
|
* We just called it "**kernel**" to avoid mixing routers
|
|
16
16
|
* and main app middlewares.
|
|
17
|
+
* @deprecated
|
|
18
|
+
* This will be removed in future versions.
|
|
19
|
+
* Use `defineMiddlewareKernel` instead.
|
|
17
20
|
*/
|
|
18
21
|
declare function defineKernel(def: KernelExports): KernelExports;
|
|
22
|
+
/**
|
|
23
|
+
* Defines a middleware kernel for the framework.
|
|
24
|
+
* Accepts a setup function that receives the app context.
|
|
25
|
+
* Use for registering global middleware (e.g., app.use).
|
|
26
|
+
*/
|
|
27
|
+
declare function defineMiddlewareKernel(setup: (context: {
|
|
28
|
+
app: Express;
|
|
29
|
+
}) => void | Promise<void>): (context: {
|
|
30
|
+
app: Express;
|
|
31
|
+
}) => void | Promise<void>;
|
|
19
32
|
|
|
20
33
|
interface AppBootstrapContext extends Record<string, any> {
|
|
21
34
|
app: Express;
|
|
@@ -25,7 +38,10 @@ interface LoadKernelOptions {
|
|
|
25
38
|
* Loads the main kernel (Express middlewares) of your application.
|
|
26
39
|
*
|
|
27
40
|
*/
|
|
28
|
-
kernel
|
|
41
|
+
kernel?: () => Promise<any>;
|
|
42
|
+
kernel2?: () => Promise<{
|
|
43
|
+
default: (context: AppBootstrapContext) => void | Promise<void>;
|
|
44
|
+
} | ((context: AppBootstrapContext) => void | Promise<void>)>;
|
|
29
45
|
/**
|
|
30
46
|
* Loads the event listeners for the application.
|
|
31
47
|
*
|
|
@@ -47,7 +63,7 @@ interface LoadKernelOptions {
|
|
|
47
63
|
}
|
|
48
64
|
declare function loadKernel({ app }: {
|
|
49
65
|
app: any;
|
|
50
|
-
},
|
|
66
|
+
}, options: LoadKernelOptions): Promise<void>;
|
|
51
67
|
|
|
52
68
|
declare function createRouter(options?: RouterOptions): Router;
|
|
53
69
|
|
|
@@ -56,7 +72,7 @@ declare function createRouter(options?: RouterOptions): Router;
|
|
|
56
72
|
* @param fn Callback to register routes on the router
|
|
57
73
|
* @returns Express Router instance
|
|
58
74
|
*/
|
|
59
|
-
declare function defineRouterMiddleware(fn: (
|
|
75
|
+
declare function defineRouterMiddleware(fn: (r: Router) => void, options?: RouterOptions): Router;
|
|
60
76
|
|
|
61
77
|
/**
|
|
62
78
|
* Load all configurations from the config directory
|
|
@@ -66,4 +82,4 @@ declare function defineRouterMiddleware(fn: (router: Router) => void, options?:
|
|
|
66
82
|
*/
|
|
67
83
|
declare function configLoader(root: string): Promise<void>;
|
|
68
84
|
|
|
69
|
-
export { type AppBootstrapContext, type AppContext, type KernelExports, type LoadKernelOptions, configLoader, createRouter, defineKernel, defineRouterMiddleware, gracefulHTTPStart, gracefulShutdown, loadKernel };
|
|
85
|
+
export { type AppBootstrapContext, type AppContext, type KernelExports, type LoadKernelOptions, configLoader, createRouter, defineKernel, defineMiddlewareKernel, defineRouterMiddleware, gracefulHTTPStart, gracefulShutdown, loadKernel };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a
|
|
1
|
+
import { a as a$1 } from './chunk-JKH5TYED.mjs';
|
|
2
|
+
import { e } from './chunk-OXUMMLIO.mjs';
|
|
3
|
+
import { a as a$2 } from './chunk-VSPZT4K6.mjs';
|
|
4
|
+
import { a, f } from './chunk-CZGPAGDK.mjs';
|
|
4
5
|
import { Router } from 'express';
|
|
5
|
-
import
|
|
6
|
+
import M, { relative, join } from 'path';
|
|
6
7
|
import { existsSync } from 'fs';
|
|
7
8
|
import { glob } from 'tinyglobby';
|
|
8
9
|
import { pathToFileURL } from 'url';
|
|
9
10
|
|
|
10
|
-
function
|
|
11
|
-
${
|
|
12
|
-
`)}`);for(let
|
|
11
|
+
function A(r,t,e$1){return r.listen(t,async()=>{e$1&&(a.debug("Executing onStart hook..."),await e$1().catch(i=>{a.error("Error during onStart hook:",i);})),a.box({message:`Server is running at http://localhost:${t}`,style:{borderColor:"cyan"},level:"info"});try{await e.emit("app:mounted",{app:r});}catch(i){a.error("Error during app:mounted event:",i);}finally{f();}})}function F(r,t){process.on("SIGINT",async()=>{a.info("Received SIGINT. Shutting down gracefully..."),await new Promise(e=>{r.close(async s=>s instanceof Error?(a.error("Error shutting down server:",s),e()):(t&&await t().catch(i=>{a.error("Error during shutdown hook:",i);}),a.info("Server has been shut down."),e()));}),process.exit(0);});}function T(r){return r}function $(r){return r}async function L({app:r},t){a.debug("Loading kernel...");let{kernel:e,kernel2:s,listener:i,appBootstrap:d}=t,p=s;if(e&&typeof e=="function"&&(p=e),p&&typeof p=="function")try{let n=await p(),l=typeof n=="object"&&n!==null&&"default"in n?n.default:n;typeof l=="function"?(await l({app:r}),a.debug("Middleware kernel loaded.")):a.warn("Middleware kernel setup function not found.");}catch(n){throw a.error("Error loading middleware kernel:",n),n}if(i&&typeof i=="function")try{await a$1(i);}catch(n){throw a.error("Error loading listener:",n),n}if(d&&typeof d=="function")try{await d({app:r});}catch(n){throw a.error("Error during boot process:",n),n}a.debug("Kernel loaded.");}function g(r){return Router(r)}function B(r,t){let e=g(t);return r(e),e}function b(r){let t=join(r,"expresspack.config"),e=join(r,"app"),s=join(r,"config"),i=join(s,"app"),d=join(s,"body-parser"),p=join(e,"controllers"),n=join(e,"services"),l=join(e,"errors"),u=join(e,"middlewares"),m=join(e,"routes");return {rc:t,root:r,app:e,middlewareFilePath:u,routesFilePath:m,config:{base:s,bodyParserFile:d,appConfigFile:i},controllers:{base:p},services:{base:n},errors:{base:l}}}var R=r=>{let t=["ts","mts","js","mjs","cjs","cts"];for(let e of t){let s=`${r}.${e}`;if(existsSync(s))return s}return null},k=r=>existsSync(r)?r:null;function C(r){if(!r)return "";let t=M.sep;return r.endsWith(t)?r:r+t}var D="*.{js,ts,mjs,cjs,mts,cts}",I=["!*.d.{ts,mts,mjs,cts}","!*.map"];async function S(r){let t=await glob([D,...I],{cwd:r}),e=new Set;return t.forEach(s=>{let i=s.replace(/\.(js|ts|mjs|cjs|mts|cts)$/,"");e.add(i);}),Array.from(e)}async function U(r){let{config:t}=b(r),e=t.base;if(a.debug("Loading all configurations from: `"+C(relative(r,t.base)+"`")),!k(e)){a.debug("No config directory found. Looked for:",e);return}let i=await S(e);a.debug(`Found ${i.length} config files: %s`,`
|
|
12
|
+
${i.join(`
|
|
13
|
+
`)}`);for(let p of i){let n=R(join(e,p));if(!n){a.warn(`No config file found for topic: ${p}`);continue}try{let u=await import(pathToFileURL(n).href),m=u.default||u;typeof m=="function"&&(m=await m());let x=p.replace(/[-_](\w)/g,(H,y)=>y?y.toUpperCase():"");a$2[x]=m;let j=relative(r,n);a.debug(`Loaded config: \`${x}\` from \`${j}\``);}catch(l){a.error(`Failed to load config ${p}:`,l);}}}
|
|
13
14
|
|
|
14
|
-
export { U as configLoader, g as createRouter,
|
|
15
|
+
export { U as configLoader, g as createRouter, T as defineKernel, $ as defineMiddlewareKernel, B as defineRouterMiddleware, A as gracefulHTTPStart, F as gracefulShutdown, L as loadKernel };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import express__default, { Handler } from 'express';
|
|
2
2
|
|
|
3
|
-
type JSONOptions = Parameters<typeof
|
|
4
|
-
type URLEncodedOptions = Parameters<typeof
|
|
3
|
+
type JSONOptions = Parameters<typeof express__default.json>[0];
|
|
4
|
+
type URLEncodedOptions = Parameters<typeof express__default.urlencoded>[0];
|
|
5
5
|
type BodyParserConfig = {
|
|
6
6
|
json?: JSONOptions;
|
|
7
7
|
urlencoded?: URLEncodedOptions;
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import * as Emittery from 'emittery';
|
|
2
2
|
import Emittery__default from 'emittery';
|
|
3
3
|
export { default as Emittery } from 'emittery';
|
|
4
|
+
import * as express from 'express';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Base event map that users can extend in their applications
|
|
7
8
|
*/
|
|
8
9
|
interface EmitterEvents {
|
|
9
|
-
|
|
10
|
+
"app:mounted": {
|
|
11
|
+
app: express.Express;
|
|
12
|
+
};
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* Default emitter instance for convenient access
|
|
13
16
|
*/
|
|
14
|
-
declare const emitter: Emittery__default<EmitterEvents, EmitterEvents & Emittery.OmnipresentEventData,
|
|
17
|
+
declare const emitter: Emittery__default<EmitterEvents, EmitterEvents & Emittery.OmnipresentEventData, never>;
|
|
15
18
|
/**
|
|
16
19
|
* Create a new emitter instance (for testing or isolated use)
|
|
17
20
|
*/
|
|
18
21
|
declare function createEmitter<T extends EmitterEvents = EmitterEvents>(): Emittery__default<T>;
|
|
22
|
+
type EventHandler<K extends keyof EmitterEvents> = (payload?: EmitterEvents[K]) => void | Promise<void>;
|
|
23
|
+
type RegisterEventCallback = <K extends keyof EmitterEvents>(event: K, handler: EventHandler<K> | (() => Promise<EventHandler<K>> | Promise<{
|
|
24
|
+
default: any;
|
|
25
|
+
}>)) => void;
|
|
26
|
+
interface DefineEventContext {
|
|
27
|
+
/**
|
|
28
|
+
* Syntactic sugar for registering event listeners
|
|
29
|
+
*/
|
|
30
|
+
on: RegisterEventCallback;
|
|
31
|
+
emitter: typeof emitter;
|
|
32
|
+
}
|
|
33
|
+
declare function defineEvents(setup: (context: DefineEventContext) => void): void;
|
|
34
|
+
declare function defineEventHandler<K extends keyof EmitterEvents>(event: K, handler: EventHandler<K> | (() => Promise<EventHandler<K>>)): EventHandler<K> | (() => Promise<EventHandler<K>>);
|
|
19
35
|
|
|
20
|
-
export { type EmitterEvents, createEmitter, emitter as default, emitter };
|
|
36
|
+
export { type DefineEventContext, type EmitterEvents, type EventHandler, type RegisterEventCallback, createEmitter, emitter as default, defineEventHandler, defineEvents, emitter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as createEmitter,
|
|
1
|
+
export { b as createEmitter, e as default, d as defineEventHandler, c as defineEvents, a as emitter } from '../../chunk-OXUMMLIO.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from 'consola';
|
|
2
2
|
import { env } from 'process';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var s=r.create({level:Number.isNaN(Number(env.APP_LOG_LEVEL))?3:Number(env.APP_LOG_LEVEL)});function l(e){return s.withTag(e)}function p(e,t){let o=process.env.APP_LOG_LEVEL;return r.create({level:t.level??(Number.isNaN(Number(o))?3:Number(o))}).withTag(e)}var u=l;
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { u as Logger, p as createConsoleLogger, s as println, l as useConsoleLogger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as importDefault } from '../chunk-JKH5TYED.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuwan-expresspack-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/env.d.ts",
|
|
34
34
|
"import": "./dist/env.mjs"
|
|
35
35
|
},
|
|
36
|
+
"./env-config": {
|
|
37
|
+
"types": "./dist/env-config.d.ts",
|
|
38
|
+
"import": "./dist/env-config.mjs"
|
|
39
|
+
},
|
|
36
40
|
"./config": {
|
|
37
41
|
"types": "./dist/config.d.ts",
|
|
38
42
|
"import": "./dist/config.mjs"
|
|
@@ -80,6 +84,7 @@
|
|
|
80
84
|
},
|
|
81
85
|
"dependencies": {
|
|
82
86
|
"@antfu/eslint-config": "^6.0.0",
|
|
87
|
+
"@dotenvx/dotenvx": "^1.51.0",
|
|
83
88
|
"axios": "^1.12.2",
|
|
84
89
|
"citty": "^0.1.6",
|
|
85
90
|
"consola": "^3.4.2",
|
|
@@ -121,7 +126,6 @@
|
|
|
121
126
|
"@types/express": "^5.0.3",
|
|
122
127
|
"eslint": "^9.37.0",
|
|
123
128
|
"express": "^5.1.0",
|
|
124
|
-
"kysely": "^0.28.8",
|
|
125
129
|
"typescript": "^5.9.3",
|
|
126
130
|
"zod": "4.1.12"
|
|
127
131
|
},
|
package/dist/chunk-CRIPGIHI.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import t from 'emittery';
|
|
2
|
-
import { env } from 'process';
|
|
3
|
-
|
|
4
|
-
function E(){return env.EXPRESSPACK_EVENT_EMITTER_DEBUG==="true"||env.EXPRESSPACK_EVENT_EMITTER_DEBUG==="1"||(typeof env.EXPRESSPACK_EVENT_EMITTER_DEBUG=="boolean"?env.EXPRESSPACK_EVENT_EMITTER_DEBUG===true:false)}var r=new t({debug:{name:"expresspack-emitter",enabled:E()}});function T(){return new t({debug:{name:"c-emitter",enabled:E()}})}var a=r;
|
|
5
|
-
|
|
6
|
-
export { r as a, T as b, a as c };
|
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 };
|