kuwan-expresspack-core 0.1.10 → 0.1.12
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/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { c } from './chunk-CRIPGIHI.mjs';
|
|
2
2
|
import { a } from './chunk-VSPZT4K6.mjs';
|
|
3
|
-
import
|
|
3
|
+
import N from 'consola';
|
|
4
4
|
import { Router } from 'express';
|
|
5
|
-
import
|
|
5
|
+
import _, { relative, join } from 'path';
|
|
6
6
|
import { existsSync } from 'fs';
|
|
7
7
|
import { glob } from 'tinyglobby';
|
|
8
|
+
import { pathToFileURL } from 'url';
|
|
8
9
|
|
|
9
|
-
var
|
|
10
|
+
var v=process.env.EXPRESSPACK_LOG_LEVEL,j=N.create({level:Number.isNaN(Number(v))?3:Number(v)}),t=j;function T(r,n,e){return r.listen(n,async()=>{e&&(t.debug("Executing onStart hook..."),await e().catch(o=>{t.error("Error during onStart hook:",o);})),t.box({message:`Server is running at http://localhost:${n}`,style:{borderColor:"cyan"},level:"info"}),c.emit("app:mounted");})}function k(r,n){process.on("SIGINT",async()=>{t.info("Received SIGINT. Shutting down gracefully..."),await new Promise(e=>{r.close(async i=>i instanceof Error?(t.error("Error shutting down server:",i),e()):(n&&await n().catch(o=>{t.error("Error during shutdown hook:",o);}),t.info("Server has been shut down."),e()));}),process.exit(0);});}function A(r){return r}async function K({app:r},{kernel:n,listener:e,appBootstrap:i}){t.debug("Loading kernel...");try{let o=await n();await(o?.default||o)({app:r});}catch(o){throw t.error("Error loading kernel:",o),o}if(e&&typeof e=="function")try{let o=await e(),a=o?.default||o;a===void 0||typeof a!="function"?t.warn("No listener setup function found"):await a();}catch(o){throw t.error("Error loading listener:",o),o}if(i&&typeof i=="function")try{await i({app:r});}catch(o){throw t.error("Error during boot process:",o),o}t.debug("Kernel loaded.");}function g(r){return Router(r)}function O(r,n){let e=g(n);return r(e),e}function b(r){let n=join(r,"expresspack.config"),e=join(r,"app"),i=join(r,"config"),o=join(i,"app"),a=join(i,"body-parser"),f=join(e,"controllers"),u=join(e,"services"),d=join(e,"errors"),m=join(e,"middlewares"),l=join(e,"routes");return {rc:n,root:r,app:e,middlewareFilePath:m,routesFilePath:l,config:{base:i,bodyParserFile:a,appConfigFile:o},controllers:{base:f},services:{base:u},errors:{base:d}}}var P=r=>{let n=["ts","mts","js","mjs","cjs","cts"];for(let e of n){let i=`${r}.${e}`;if(existsSync(i))return i}return null},R=r=>existsSync(r)?r:null;function S(r){if(!r)return "";let n=_.sep;return r.endsWith(n)?r:r+n}var I="*.{js,ts,mjs,cjs,mts,cts}",D=["!*.d.{ts,mts,mjs,cts}","!*.map"];async function C(r){let n=await glob([I,...D],{cwd:r}),e=new Set;return n.forEach(i=>{let o=i.replace(/\.(js|ts|mjs|cjs|mts|cts)$/,"");e.add(o);}),Array.from(e)}async function M(r){let{config:n}=b(r),e=n.base;if(t.debug("Loading all configurations from: `"+S(relative(r,n.base)+"`")),!R(e)){t.debug("No config directory found. Looked for:",e);return}let o=await C(e);t.debug(`Found ${o.length} config files: %s`,`
|
|
10
11
|
${o.join(`
|
|
11
|
-
`)}`);for(let f of o){let
|
|
12
|
+
`)}`);for(let f of o){let u=P(join(e,f));if(!u){t.warn(`No config file found for topic: ${f}`);continue}try{let m=await import(pathToFileURL(u).href),l=m.default||m;typeof l=="function"&&(l=await l());let x=f.replace(/[-_](\w)/g,(H,h)=>h?h.toUpperCase():"");a[x]=l;let F=relative(r,u);t.debug(`Loaded config: \`${x}\` from \`${F}\``);}catch(d){t.error(`Failed to load config ${f}:`,d);}}}
|
|
12
13
|
|
|
13
|
-
export {
|
|
14
|
+
export { M as configLoader, g as createRouter, A as defineKernel, O as defineRouterMiddleware, T as gracefulHTTPStart, k as gracefulShutdown, K as loadKernel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuwan-expresspack-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -72,10 +72,15 @@
|
|
|
72
72
|
"./thrid-party/kysely-logger": {
|
|
73
73
|
"types": "./dist/third-party/kysely-logger.d.ts",
|
|
74
74
|
"import": "./dist/third-party/kysely-logger.mjs"
|
|
75
|
+
},
|
|
76
|
+
"./third-party/axios-agent": {
|
|
77
|
+
"types": "./dist/third-party/axios-agent.d.ts",
|
|
78
|
+
"import": "./dist/third-party/axios-agent.mjs"
|
|
75
79
|
}
|
|
76
80
|
},
|
|
77
81
|
"dependencies": {
|
|
78
82
|
"@antfu/eslint-config": "^6.0.0",
|
|
83
|
+
"axios": "^1.12.2",
|
|
79
84
|
"citty": "^0.1.6",
|
|
80
85
|
"consola": "^3.4.2",
|
|
81
86
|
"dayjs": "^1.11.18",
|
|
@@ -84,6 +89,8 @@
|
|
|
84
89
|
"emittery": "^1.2.0",
|
|
85
90
|
"execa": "^9.6.0",
|
|
86
91
|
"express": "^5.1.0",
|
|
92
|
+
"kysely": "^0.28.8",
|
|
93
|
+
"tinyglobby": "^0.2.15",
|
|
87
94
|
"zod": "^4.0.14"
|
|
88
95
|
},
|
|
89
96
|
"keywords": [],
|
|
@@ -91,6 +98,14 @@
|
|
|
91
98
|
"name": "Mark Terence Tiglao",
|
|
92
99
|
"email": "github@markterence.me"
|
|
93
100
|
},
|
|
101
|
+
"repository": {
|
|
102
|
+
"type": "git",
|
|
103
|
+
"url": "git+https://github.com/markterence/kuwan-expresspack.git"
|
|
104
|
+
},
|
|
105
|
+
"homepage": "https://github.com/markterence/kuwan-expresspack",
|
|
106
|
+
"engines": {
|
|
107
|
+
"node": ">= 22 || >= 24"
|
|
108
|
+
},
|
|
94
109
|
"license": "MIT",
|
|
95
110
|
"devDependencies": {
|
|
96
111
|
"@types/bun": "^1.2.19",
|
|
@@ -103,12 +118,11 @@
|
|
|
103
118
|
"vitest": "^3.2.4"
|
|
104
119
|
},
|
|
105
120
|
"peerDependencies": {
|
|
106
|
-
"@antfu/eslint-config": "^6.0.0",
|
|
107
121
|
"@types/express": "^5.0.3",
|
|
108
122
|
"eslint": "^9.37.0",
|
|
109
123
|
"express": "^5.1.0",
|
|
110
|
-
"
|
|
111
|
-
"
|
|
124
|
+
"kysely": "^0.28.8",
|
|
125
|
+
"typescript": "^5.9.3"
|
|
112
126
|
},
|
|
113
127
|
"sideEffects": false,
|
|
114
128
|
"scripts": {
|