@forinda/kickjs-http 0.3.0 → 0.3.2

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.
Files changed (37) hide show
  1. package/README.md +51 -0
  2. package/dist/application.js +4 -4
  3. package/dist/bootstrap.js +5 -5
  4. package/dist/{chunk-ZI52TGQ4.js → chunk-35NUARK7.js} +2 -2
  5. package/dist/{chunk-BNWCVQQH.js → chunk-3NEDJA3J.js} +2 -2
  6. package/dist/{chunk-KAWXFLFS.js → chunk-7I33DN2G.js} +14 -4
  7. package/dist/chunk-7I33DN2G.js.map +1 -0
  8. package/dist/{chunk-P3YCN5LK.js → chunk-AK5TGZRS.js} +4 -4
  9. package/dist/{chunk-U2JYL2NW.js → chunk-BPXWHHCY.js} +4 -4
  10. package/dist/{chunk-RZUH6NBM.js → chunk-DU3FQYET.js} +3 -3
  11. package/dist/{chunk-I6UNTOQD.js → chunk-I32MVBEG.js} +2 -2
  12. package/dist/{chunk-75Z5FSZN.js → chunk-RFOXGJ3G.js} +2 -2
  13. package/dist/{chunk-JD2RKDKH.js → chunk-RPN7UFUO.js} +2 -2
  14. package/dist/{chunk-JM7X7SAD.js → chunk-VXX2Y3TA.js} +2 -2
  15. package/dist/chunk-WCQVDF3K.js +14 -0
  16. package/dist/context.js +3 -3
  17. package/dist/index.js +11 -11
  18. package/dist/middleware/csrf.js +2 -2
  19. package/dist/middleware/error-handler.js +2 -2
  20. package/dist/middleware/request-id.js +2 -2
  21. package/dist/middleware/upload.js +2 -2
  22. package/dist/middleware/validate.js +2 -2
  23. package/dist/query/index.js +2 -2
  24. package/dist/router-builder.js +5 -5
  25. package/package.json +2 -2
  26. package/dist/chunk-7QVYU63E.js +0 -7
  27. package/dist/chunk-KAWXFLFS.js.map +0 -1
  28. /package/dist/{chunk-ZI52TGQ4.js.map → chunk-35NUARK7.js.map} +0 -0
  29. /package/dist/{chunk-BNWCVQQH.js.map → chunk-3NEDJA3J.js.map} +0 -0
  30. /package/dist/{chunk-P3YCN5LK.js.map → chunk-AK5TGZRS.js.map} +0 -0
  31. /package/dist/{chunk-U2JYL2NW.js.map → chunk-BPXWHHCY.js.map} +0 -0
  32. /package/dist/{chunk-RZUH6NBM.js.map → chunk-DU3FQYET.js.map} +0 -0
  33. /package/dist/{chunk-I6UNTOQD.js.map → chunk-I32MVBEG.js.map} +0 -0
  34. /package/dist/{chunk-75Z5FSZN.js.map → chunk-RFOXGJ3G.js.map} +0 -0
  35. /package/dist/{chunk-JD2RKDKH.js.map → chunk-RPN7UFUO.js.map} +0 -0
  36. /package/dist/{chunk-JM7X7SAD.js.map → chunk-VXX2Y3TA.js.map} +0 -0
  37. /package/dist/{chunk-7QVYU63E.js.map → chunk-WCQVDF3K.js.map} +0 -0
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @forinda/kickjs-http
2
+
3
+ Express 5 application, router builder, RequestContext, middleware, and query parsing for KickJS.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @forinda/kickjs-http @forinda/kickjs-core express reflect-metadata
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - `Application` class with full lifecycle (setup, start, shutdown, HMR rebuild)
14
+ - `bootstrap()` for zero-boilerplate entry with Vite HMR
15
+ - `RequestContext` with typed body/params/query and response helpers
16
+ - `buildRoutes()` — builds Express routers from decorated controllers
17
+ - Built-in middleware: `requestId`, `validate`, `errorHandler`, `csrf`, `upload`
18
+ - ORM-agnostic query parsing: `parseQuery()`, `ctx.qs()`, `QueryBuilderAdapter`
19
+ - Graceful shutdown with `Promise.allSettled`
20
+
21
+ ## Quick Example
22
+
23
+ ```typescript
24
+ import 'reflect-metadata'
25
+ import { bootstrap } from '@forinda/kickjs-http'
26
+ import { UserModule } from './modules/users'
27
+
28
+ bootstrap({
29
+ modules: [UserModule],
30
+ apiPrefix: '/api',
31
+ defaultVersion: 1,
32
+ })
33
+ ```
34
+
35
+ ## Sub-path Imports
36
+
37
+ ```typescript
38
+ import { Application } from '@forinda/kickjs-http/application'
39
+ import { RequestContext } from '@forinda/kickjs-http/context'
40
+ import { csrf } from '@forinda/kickjs-http/middleware/csrf'
41
+ import { upload } from '@forinda/kickjs-http/middleware/upload'
42
+ import { parseQuery } from '@forinda/kickjs-http/query'
43
+ ```
44
+
45
+ ## Documentation
46
+
47
+ [Full documentation](https://github.com/forinda/kick-js)
48
+
49
+ ## License
50
+
51
+ MIT
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Application
3
- } from "./chunk-P3YCN5LK.js";
4
- import "./chunk-BNWCVQQH.js";
5
- import "./chunk-ZI52TGQ4.js";
6
- import "./chunk-7QVYU63E.js";
3
+ } from "./chunk-AK5TGZRS.js";
4
+ import "./chunk-3NEDJA3J.js";
5
+ import "./chunk-35NUARK7.js";
6
+ import "./chunk-WCQVDF3K.js";
7
7
  export {
8
8
  Application
9
9
  };
package/dist/bootstrap.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  bootstrap
3
- } from "./chunk-KAWXFLFS.js";
4
- import "./chunk-P3YCN5LK.js";
5
- import "./chunk-BNWCVQQH.js";
6
- import "./chunk-ZI52TGQ4.js";
7
- import "./chunk-7QVYU63E.js";
3
+ } from "./chunk-7I33DN2G.js";
4
+ import "./chunk-AK5TGZRS.js";
5
+ import "./chunk-3NEDJA3J.js";
6
+ import "./chunk-35NUARK7.js";
7
+ import "./chunk-WCQVDF3K.js";
8
8
  export {
9
9
  bootstrap
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-7QVYU63E.js";
3
+ } from "./chunk-WCQVDF3K.js";
4
4
 
5
5
  // src/middleware/request-id.ts
6
6
  import { randomUUID } from "crypto";
@@ -19,4 +19,4 @@ export {
19
19
  REQUEST_ID_HEADER,
20
20
  requestId
21
21
  };
22
- //# sourceMappingURL=chunk-ZI52TGQ4.js.map
22
+ //# sourceMappingURL=chunk-35NUARK7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-7QVYU63E.js";
3
+ } from "./chunk-WCQVDF3K.js";
4
4
 
5
5
  // src/middleware/error-handler.ts
6
6
  import { HttpException, createLogger } from "@forinda/kickjs-core";
@@ -51,4 +51,4 @@ export {
51
51
  notFoundHandler,
52
52
  errorHandler
53
53
  };
54
- //# sourceMappingURL=chunk-BNWCVQQH.js.map
54
+ //# sourceMappingURL=chunk-3NEDJA3J.js.map
@@ -1,12 +1,21 @@
1
1
  import {
2
2
  Application
3
- } from "./chunk-P3YCN5LK.js";
3
+ } from "./chunk-AK5TGZRS.js";
4
4
  import {
5
- __name
6
- } from "./chunk-7QVYU63E.js";
5
+ __name,
6
+ __require
7
+ } from "./chunk-WCQVDF3K.js";
7
8
 
8
9
  // src/bootstrap.ts
9
10
  import { createLogger } from "@forinda/kickjs-core";
11
+ function tryReloadEnv() {
12
+ try {
13
+ const config = __require("@forinda/kickjs-config");
14
+ config.reloadEnv?.();
15
+ } catch {
16
+ }
17
+ }
18
+ __name(tryReloadEnv, "tryReloadEnv");
10
19
  var log = createLogger("Process");
11
20
  function bootstrap(options) {
12
21
  const g = globalThis;
@@ -31,6 +40,7 @@ function bootstrap(options) {
31
40
  }
32
41
  if (g.__app) {
33
42
  log.info("HMR: Rebuilding application...");
43
+ tryReloadEnv();
34
44
  g.__app.rebuild();
35
45
  return;
36
46
  }
@@ -47,4 +57,4 @@ __name(bootstrap, "bootstrap");
47
57
  export {
48
58
  bootstrap
49
59
  };
50
- //# sourceMappingURL=chunk-KAWXFLFS.js.map
60
+ //# sourceMappingURL=chunk-7I33DN2G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bootstrap.ts"],"sourcesContent":["import { createLogger } from '@forinda/kickjs-core'\nimport { Application, type ApplicationOptions } from './application'\n\n/** Try to reload env from .env file if config package is available */\nfunction tryReloadEnv(): void {\n try {\n const config = require('@forinda/kickjs-config')\n config.reloadEnv?.()\n } catch {\n // Config package not installed — skip\n }\n}\n\nconst log = createLogger('Process')\n\n/**\n * Bootstrap a KickJS application with zero boilerplate.\n *\n * Handles:\n * - Vite HMR (hot-swaps Express handler without restarting the server)\n * - Graceful shutdown on SIGINT / SIGTERM\n * - Global uncaughtException / unhandledRejection handlers\n * - globalThis app storage for HMR rebuild\n *\n * @example\n * ```ts\n * // src/index.ts — that's it, the whole file\n * import 'reflect-metadata'\n * import { bootstrap } from '@forinda/kickjs-http'\n * import { modules } from './modules'\n *\n * bootstrap({ modules })\n * ```\n */\nexport function bootstrap(options: ApplicationOptions): void {\n const g = globalThis as any\n\n // ── Global error handlers ────────────────────────────────────────────\n if (!g.__kickBootstrapped) {\n process.on('uncaughtException', (err) => {\n log.error(err, 'Uncaught exception')\n })\n\n process.on('unhandledRejection', (reason) => {\n log.error(reason as any, 'Unhandled rejection')\n })\n\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.on(signal, async () => {\n log.info(`Received ${signal}, shutting down...`)\n if (g.__app) await g.__app.shutdown()\n process.exit(0)\n })\n }\n\n g.__kickBootstrapped = true\n }\n\n // ── HMR rebuild ──────────────────────────────────────────────────────\n if (g.__app) {\n log.info('HMR: Rebuilding application...')\n tryReloadEnv()\n g.__app.rebuild()\n return\n }\n\n // ── First boot ───────────────────────────────────────────────────────\n const app = new Application(options)\n g.__app = app\n app.start()\n\n // ── Vite HMR acceptance ──────────────────────────────────────────────\n const meta = import.meta as any\n if (meta.hot) {\n meta.hot.accept()\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAASA,oBAAoB;AAI7B,SAASC,eAAAA;AACP,MAAI;AACF,UAAMC,SAASC,UAAQ,wBAAA;AACvBD,WAAOE,YAAS;EAClB,QAAQ;EAER;AACF;AAPSH;AAST,IAAMI,MAAMC,aAAa,SAAA;AAqBlB,SAASC,UAAUC,SAA2B;AACnD,QAAMC,IAAIC;AAGV,MAAI,CAACD,EAAEE,oBAAoB;AACzBC,YAAQC,GAAG,qBAAqB,CAACC,QAAAA;AAC/BT,UAAIU,MAAMD,KAAK,oBAAA;IACjB,CAAA;AAEAF,YAAQC,GAAG,sBAAsB,CAACG,WAAAA;AAChCX,UAAIU,MAAMC,QAAe,qBAAA;IAC3B,CAAA;AAEA,eAAWC,UAAU;MAAC;MAAU;OAAqB;AACnDL,cAAQC,GAAGI,QAAQ,YAAA;AACjBZ,YAAIa,KAAK,YAAYD,MAAAA,oBAA0B;AAC/C,YAAIR,EAAEU,MAAO,OAAMV,EAAEU,MAAMC,SAAQ;AACnCR,gBAAQS,KAAK,CAAA;MACf,CAAA;IACF;AAEAZ,MAAEE,qBAAqB;EACzB;AAGA,MAAIF,EAAEU,OAAO;AACXd,QAAIa,KAAK,gCAAA;AACTjB,iBAAAA;AACAQ,MAAEU,MAAMG,QAAO;AACf;EACF;AAGA,QAAMC,MAAM,IAAIC,YAAYhB,OAAAA;AAC5BC,IAAEU,QAAQI;AACVA,MAAIE,MAAK;AAGT,QAAMC,OAAO;AACb,MAAIA,KAAKC,KAAK;AACZD,SAAKC,IAAIC,OAAM;EACjB;AACF;AA1CgBrB;","names":["createLogger","tryReloadEnv","config","require","reloadEnv","log","createLogger","bootstrap","options","g","globalThis","__kickBootstrapped","process","on","err","error","reason","signal","info","__app","shutdown","exit","rebuild","app","Application","start","meta","hot","accept"]}
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  errorHandler,
3
3
  notFoundHandler
4
- } from "./chunk-BNWCVQQH.js";
4
+ } from "./chunk-3NEDJA3J.js";
5
5
  import {
6
6
  requestId
7
- } from "./chunk-ZI52TGQ4.js";
7
+ } from "./chunk-35NUARK7.js";
8
8
  import {
9
9
  __name
10
- } from "./chunk-7QVYU63E.js";
10
+ } from "./chunk-WCQVDF3K.js";
11
11
 
12
12
  // src/application.ts
13
13
  import http from "http";
@@ -193,4 +193,4 @@ var Application = class {
193
193
  export {
194
194
  Application
195
195
  };
196
- //# sourceMappingURL=chunk-P3YCN5LK.js.map
196
+ //# sourceMappingURL=chunk-AK5TGZRS.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  validate
3
- } from "./chunk-JD2RKDKH.js";
3
+ } from "./chunk-RPN7UFUO.js";
4
4
  import {
5
5
  RequestContext
6
- } from "./chunk-RZUH6NBM.js";
6
+ } from "./chunk-DU3FQYET.js";
7
7
  import {
8
8
  __name
9
- } from "./chunk-7QVYU63E.js";
9
+ } from "./chunk-WCQVDF3K.js";
10
10
 
11
11
  // src/router-builder.ts
12
12
  import "reflect-metadata";
@@ -59,4 +59,4 @@ export {
59
59
  getControllerPath,
60
60
  buildRoutes
61
61
  };
62
- //# sourceMappingURL=chunk-U2JYL2NW.js.map
62
+ //# sourceMappingURL=chunk-BPXWHHCY.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseQuery
3
- } from "./chunk-JM7X7SAD.js";
3
+ } from "./chunk-VXX2Y3TA.js";
4
4
  import {
5
5
  __name
6
- } from "./chunk-7QVYU63E.js";
6
+ } from "./chunk-WCQVDF3K.js";
7
7
 
8
8
  // src/context.ts
9
9
  var RequestContext = class {
@@ -107,4 +107,4 @@ var RequestContext = class {
107
107
  export {
108
108
  RequestContext
109
109
  };
110
- //# sourceMappingURL=chunk-RZUH6NBM.js.map
110
+ //# sourceMappingURL=chunk-DU3FQYET.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-7QVYU63E.js";
3
+ } from "./chunk-WCQVDF3K.js";
4
4
 
5
5
  // src/middleware/csrf.ts
6
6
  import { randomBytes } from "crypto";
@@ -49,4 +49,4 @@ __name(csrf, "csrf");
49
49
  export {
50
50
  csrf
51
51
  };
52
- //# sourceMappingURL=chunk-I6UNTOQD.js.map
52
+ //# sourceMappingURL=chunk-I32MVBEG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-7QVYU63E.js";
3
+ } from "./chunk-WCQVDF3K.js";
4
4
 
5
5
  // src/middleware/upload.ts
6
6
  import { unlink } from "fs/promises";
@@ -85,4 +85,4 @@ export {
85
85
  cleanupFiles,
86
86
  upload
87
87
  };
88
- //# sourceMappingURL=chunk-75Z5FSZN.js.map
88
+ //# sourceMappingURL=chunk-RFOXGJ3G.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-7QVYU63E.js";
3
+ } from "./chunk-WCQVDF3K.js";
4
4
 
5
5
  // src/middleware/validate.ts
6
6
  function validate(schema) {
@@ -58,4 +58,4 @@ __name(validate, "validate");
58
58
  export {
59
59
  validate
60
60
  };
61
- //# sourceMappingURL=chunk-JD2RKDKH.js.map
61
+ //# sourceMappingURL=chunk-RPN7UFUO.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-7QVYU63E.js";
3
+ } from "./chunk-WCQVDF3K.js";
4
4
 
5
5
  // src/query/types.ts
6
6
  var FILTER_OPERATORS = /* @__PURE__ */ new Set([
@@ -130,4 +130,4 @@ export {
130
130
  parseQuery,
131
131
  buildQueryParams
132
132
  };
133
- //# sourceMappingURL=chunk-JM7X7SAD.js.map
133
+ //# sourceMappingURL=chunk-VXX2Y3TA.js.map
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
10
+ export {
11
+ __name,
12
+ __require
13
+ };
14
+ //# sourceMappingURL=chunk-WCQVDF3K.js.map
package/dist/context.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RequestContext
3
- } from "./chunk-RZUH6NBM.js";
4
- import "./chunk-JM7X7SAD.js";
5
- import "./chunk-7QVYU63E.js";
3
+ } from "./chunk-DU3FQYET.js";
4
+ import "./chunk-VXX2Y3TA.js";
5
+ import "./chunk-WCQVDF3K.js";
6
6
  export {
7
7
  RequestContext
8
8
  };
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  cleanupFiles,
3
3
  upload
4
- } from "./chunk-75Z5FSZN.js";
4
+ } from "./chunk-RFOXGJ3G.js";
5
5
  import {
6
6
  bootstrap
7
- } from "./chunk-KAWXFLFS.js";
7
+ } from "./chunk-7I33DN2G.js";
8
8
  import {
9
9
  Application
10
- } from "./chunk-P3YCN5LK.js";
10
+ } from "./chunk-AK5TGZRS.js";
11
11
  import {
12
12
  buildRoutes,
13
13
  getControllerPath
14
- } from "./chunk-U2JYL2NW.js";
14
+ } from "./chunk-BPXWHHCY.js";
15
15
  import {
16
16
  validate
17
- } from "./chunk-JD2RKDKH.js";
17
+ } from "./chunk-RPN7UFUO.js";
18
18
  import {
19
19
  RequestContext
20
- } from "./chunk-RZUH6NBM.js";
20
+ } from "./chunk-DU3FQYET.js";
21
21
  import {
22
22
  FILTER_OPERATORS,
23
23
  buildQueryParams,
@@ -26,19 +26,19 @@ import {
26
26
  parseQuery,
27
27
  parseSearchQuery,
28
28
  parseSort
29
- } from "./chunk-JM7X7SAD.js";
29
+ } from "./chunk-VXX2Y3TA.js";
30
30
  import {
31
31
  csrf
32
- } from "./chunk-I6UNTOQD.js";
32
+ } from "./chunk-I32MVBEG.js";
33
33
  import {
34
34
  errorHandler,
35
35
  notFoundHandler
36
- } from "./chunk-BNWCVQQH.js";
36
+ } from "./chunk-3NEDJA3J.js";
37
37
  import {
38
38
  REQUEST_ID_HEADER,
39
39
  requestId
40
- } from "./chunk-ZI52TGQ4.js";
41
- import "./chunk-7QVYU63E.js";
40
+ } from "./chunk-35NUARK7.js";
41
+ import "./chunk-WCQVDF3K.js";
42
42
  export {
43
43
  Application,
44
44
  FILTER_OPERATORS,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  csrf
3
- } from "../chunk-I6UNTOQD.js";
4
- import "../chunk-7QVYU63E.js";
3
+ } from "../chunk-I32MVBEG.js";
4
+ import "../chunk-WCQVDF3K.js";
5
5
  export {
6
6
  csrf
7
7
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  errorHandler,
3
3
  notFoundHandler
4
- } from "../chunk-BNWCVQQH.js";
5
- import "../chunk-7QVYU63E.js";
4
+ } from "../chunk-3NEDJA3J.js";
5
+ import "../chunk-WCQVDF3K.js";
6
6
  export {
7
7
  errorHandler,
8
8
  notFoundHandler
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  REQUEST_ID_HEADER,
3
3
  requestId
4
- } from "../chunk-ZI52TGQ4.js";
5
- import "../chunk-7QVYU63E.js";
4
+ } from "../chunk-35NUARK7.js";
5
+ import "../chunk-WCQVDF3K.js";
6
6
  export {
7
7
  REQUEST_ID_HEADER,
8
8
  requestId
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  cleanupFiles,
3
3
  upload
4
- } from "../chunk-75Z5FSZN.js";
5
- import "../chunk-7QVYU63E.js";
4
+ } from "../chunk-RFOXGJ3G.js";
5
+ import "../chunk-WCQVDF3K.js";
6
6
  export {
7
7
  cleanupFiles,
8
8
  upload
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  validate
3
- } from "../chunk-JD2RKDKH.js";
4
- import "../chunk-7QVYU63E.js";
3
+ } from "../chunk-RPN7UFUO.js";
4
+ import "../chunk-WCQVDF3K.js";
5
5
  export {
6
6
  validate
7
7
  };
@@ -6,8 +6,8 @@ import {
6
6
  parseQuery,
7
7
  parseSearchQuery,
8
8
  parseSort
9
- } from "../chunk-JM7X7SAD.js";
10
- import "../chunk-7QVYU63E.js";
9
+ } from "../chunk-VXX2Y3TA.js";
10
+ import "../chunk-WCQVDF3K.js";
11
11
  export {
12
12
  FILTER_OPERATORS,
13
13
  buildQueryParams,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  buildRoutes,
3
3
  getControllerPath
4
- } from "./chunk-U2JYL2NW.js";
5
- import "./chunk-JD2RKDKH.js";
6
- import "./chunk-RZUH6NBM.js";
7
- import "./chunk-JM7X7SAD.js";
8
- import "./chunk-7QVYU63E.js";
4
+ } from "./chunk-BPXWHHCY.js";
5
+ import "./chunk-RPN7UFUO.js";
6
+ import "./chunk-DU3FQYET.js";
7
+ import "./chunk-VXX2Y3TA.js";
8
+ import "./chunk-WCQVDF3K.js";
9
9
  export {
10
10
  buildRoutes,
11
11
  getControllerPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forinda/kickjs-http",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Express 5 integration, router builder, RequestContext, and middleware for KickJS",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -58,7 +58,7 @@
58
58
  "cookie-parser": "^1.4.7",
59
59
  "multer": "^2.1.1",
60
60
  "reflect-metadata": "^0.2.2",
61
- "@forinda/kickjs-core": "0.3.0"
61
+ "@forinda/kickjs-core": "0.3.2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "express": "^5.1.0"
@@ -1,7 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- export {
5
- __name
6
- };
7
- //# sourceMappingURL=chunk-7QVYU63E.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/bootstrap.ts"],"sourcesContent":["import { createLogger } from '@forinda/kickjs-core'\nimport { Application, type ApplicationOptions } from './application'\n\nconst log = createLogger('Process')\n\n/**\n * Bootstrap a KickJS application with zero boilerplate.\n *\n * Handles:\n * - Vite HMR (hot-swaps Express handler without restarting the server)\n * - Graceful shutdown on SIGINT / SIGTERM\n * - Global uncaughtException / unhandledRejection handlers\n * - globalThis app storage for HMR rebuild\n *\n * @example\n * ```ts\n * // src/index.ts — that's it, the whole file\n * import 'reflect-metadata'\n * import { bootstrap } from '@forinda/kickjs-http'\n * import { modules } from './modules'\n *\n * bootstrap({ modules })\n * ```\n */\nexport function bootstrap(options: ApplicationOptions): void {\n const g = globalThis as any\n\n // ── Global error handlers ────────────────────────────────────────────\n if (!g.__kickBootstrapped) {\n process.on('uncaughtException', (err) => {\n log.error(err, 'Uncaught exception')\n })\n\n process.on('unhandledRejection', (reason) => {\n log.error(reason as any, 'Unhandled rejection')\n })\n\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.on(signal, async () => {\n log.info(`Received ${signal}, shutting down...`)\n if (g.__app) await g.__app.shutdown()\n process.exit(0)\n })\n }\n\n g.__kickBootstrapped = true\n }\n\n // ── HMR rebuild ──────────────────────────────────────────────────────\n if (g.__app) {\n log.info('HMR: Rebuilding application...')\n g.__app.rebuild()\n return\n }\n\n // ── First boot ───────────────────────────────────────────────────────\n const app = new Application(options)\n g.__app = app\n app.start()\n\n // ── Vite HMR acceptance ──────────────────────────────────────────────\n const meta = import.meta as any\n if (meta.hot) {\n meta.hot.accept()\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAASA,oBAAoB;AAG7B,IAAMC,MAAMC,aAAa,SAAA;AAqBlB,SAASC,UAAUC,SAA2B;AACnD,QAAMC,IAAIC;AAGV,MAAI,CAACD,EAAEE,oBAAoB;AACzBC,YAAQC,GAAG,qBAAqB,CAACC,QAAAA;AAC/BT,UAAIU,MAAMD,KAAK,oBAAA;IACjB,CAAA;AAEAF,YAAQC,GAAG,sBAAsB,CAACG,WAAAA;AAChCX,UAAIU,MAAMC,QAAe,qBAAA;IAC3B,CAAA;AAEA,eAAWC,UAAU;MAAC;MAAU;OAAqB;AACnDL,cAAQC,GAAGI,QAAQ,YAAA;AACjBZ,YAAIa,KAAK,YAAYD,MAAAA,oBAA0B;AAC/C,YAAIR,EAAEU,MAAO,OAAMV,EAAEU,MAAMC,SAAQ;AACnCR,gBAAQS,KAAK,CAAA;MACf,CAAA;IACF;AAEAZ,MAAEE,qBAAqB;EACzB;AAGA,MAAIF,EAAEU,OAAO;AACXd,QAAIa,KAAK,gCAAA;AACTT,MAAEU,MAAMG,QAAO;AACf;EACF;AAGA,QAAMC,MAAM,IAAIC,YAAYhB,OAAAA;AAC5BC,IAAEU,QAAQI;AACVA,MAAIE,MAAK;AAGT,QAAMC,OAAO;AACb,MAAIA,KAAKC,KAAK;AACZD,SAAKC,IAAIC,OAAM;EACjB;AACF;AAzCgBrB;","names":["createLogger","log","createLogger","bootstrap","options","g","globalThis","__kickBootstrapped","process","on","err","error","reason","signal","info","__app","shutdown","exit","rebuild","app","Application","start","meta","hot","accept"]}