kuwan-expresspack-core 0.1.11 → 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 +6 -5
- package/package.json +13 -4
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",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@antfu/eslint-config": "^6.0.0",
|
|
83
|
+
"axios": "^1.12.2",
|
|
83
84
|
"citty": "^0.1.6",
|
|
84
85
|
"consola": "^3.4.2",
|
|
85
86
|
"dayjs": "^1.11.18",
|
|
@@ -88,6 +89,8 @@
|
|
|
88
89
|
"emittery": "^1.2.0",
|
|
89
90
|
"execa": "^9.6.0",
|
|
90
91
|
"express": "^5.1.0",
|
|
92
|
+
"kysely": "^0.28.8",
|
|
93
|
+
"tinyglobby": "^0.2.15",
|
|
91
94
|
"zod": "^4.0.14"
|
|
92
95
|
},
|
|
93
96
|
"keywords": [],
|
|
@@ -95,6 +98,14 @@
|
|
|
95
98
|
"name": "Mark Terence Tiglao",
|
|
96
99
|
"email": "github@markterence.me"
|
|
97
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
|
+
},
|
|
98
109
|
"license": "MIT",
|
|
99
110
|
"devDependencies": {
|
|
100
111
|
"@types/bun": "^1.2.19",
|
|
@@ -107,13 +118,11 @@
|
|
|
107
118
|
"vitest": "^3.2.4"
|
|
108
119
|
},
|
|
109
120
|
"peerDependencies": {
|
|
110
|
-
"@antfu/eslint-config": "^6.0.0",
|
|
111
121
|
"@types/express": "^5.0.3",
|
|
112
122
|
"eslint": "^9.37.0",
|
|
113
123
|
"express": "^5.1.0",
|
|
114
|
-
"typescript": "^5.9.3",
|
|
115
124
|
"kysely": "^0.28.8",
|
|
116
|
-
"
|
|
125
|
+
"typescript": "^5.9.3"
|
|
117
126
|
},
|
|
118
127
|
"sideEffects": false,
|
|
119
128
|
"scripts": {
|