@h3ravel/core 1.22.0-alpha.8 → 1.29.0-alpha.11

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.cjs CHANGED
@@ -1,4 +1,5 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
9
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
19
16
  }
20
17
  return to;
21
18
  };
@@ -23,32 +20,31 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
20
  value: mod,
24
21
  enumerable: true
25
22
  }) : target, mod));
26
-
27
23
  //#endregion
28
24
  require("reflect-metadata");
29
- let __h3ravel_shared = require("@h3ravel/shared");
25
+ let _h3ravel_shared = require("@h3ravel/shared");
30
26
  let h3 = require("h3");
31
- let __h3ravel_contracts = require("@h3ravel/contracts");
32
- let __h3ravel_support = require("@h3ravel/support");
33
- let __h3ravel_foundation = require("@h3ravel/foundation");
27
+ let _h3ravel_contracts = require("@h3ravel/contracts");
28
+ let _h3ravel_support = require("@h3ravel/support");
29
+ let _h3ravel_foundation = require("@h3ravel/foundation");
34
30
  let module$1 = require("module");
35
31
  let fast_glob = require("fast-glob");
36
- fast_glob = __toESM(fast_glob);
32
+ fast_glob = __toESM(fast_glob, 1);
37
33
  let node_path = require("node:path");
38
- node_path = __toESM(node_path);
34
+ node_path = __toESM(node_path, 1);
39
35
  let detect_port = require("detect-port");
40
36
  let dotenv = require("dotenv");
41
- dotenv = __toESM(dotenv);
37
+ dotenv = __toESM(dotenv, 1);
42
38
  let dotenv_expand = require("dotenv-expand");
43
- dotenv_expand = __toESM(dotenv_expand);
39
+ dotenv_expand = __toESM(dotenv_expand, 1);
44
40
  let node_fs_promises = require("node:fs/promises");
45
41
  let semver = require("semver");
46
- semver = __toESM(semver);
42
+ semver = __toESM(semver, 1);
47
43
  let node_module = require("node:module");
48
- let __h3ravel_support_facades = require("@h3ravel/support/facades");
49
-
44
+ let _h3ravel_support_facades = require("@h3ravel/support/facades");
50
45
  //#region src/Manager/ContainerResolver.ts
51
46
  var ContainerResolver = class ContainerResolver {
47
+ app;
52
48
  constructor(app) {
53
49
  this.app = app;
54
50
  }
@@ -82,10 +78,9 @@ var ContainerResolver = class ContainerResolver {
82
78
  return typeof C === "function" && !ContainerResolver.isClass(C);
83
79
  }
84
80
  };
85
-
86
81
  //#endregion
87
82
  //#region src/Container.ts
88
- var Container = class Container extends __h3ravel_contracts.IContainer {
83
+ var Container = class Container extends _h3ravel_contracts.IContainer {
89
84
  bindings = /* @__PURE__ */ new Map();
90
85
  singletons = /* @__PURE__ */ new Map();
91
86
  middlewareHandler;
@@ -136,7 +131,11 @@ var Container = class Container extends __h3ravel_contracts.IContainer {
136
131
  return false;
137
132
  }
138
133
  bind(key, factory) {
139
- this.bindings.set(key, factory);
134
+ const abstract = this.getAlias(key);
135
+ this.resolvedInstances.delete(abstract);
136
+ this.singletons.delete(abstract);
137
+ this.bindings.set(abstract, factory);
138
+ if (this.reboundCallbacks.has(abstract)) this.rebound(abstract);
140
139
  }
141
140
  /**
142
141
  * Bind unregistered middlewares to the service container so we can use them later
@@ -158,12 +157,18 @@ var Container = class Container extends __h3ravel_contracts.IContainer {
158
157
  */
159
158
  unbind(key) {
160
159
  if (Array.isArray(key)) for (let i = 0; i < key.length; i++) {
161
- this.bindings.delete(key[i]);
162
- this.singletons.delete(key[i]);
160
+ const abstract = this.getAlias(key[i]);
161
+ this.bindings.delete(abstract);
162
+ this.singletons.delete(abstract);
163
+ this.instances.delete(abstract);
164
+ this.resolvedInstances.delete(abstract);
163
165
  }
164
166
  else {
165
- this.bindings.delete(key);
166
- this.singletons.delete(key);
167
+ const abstract = this.getAlias(key);
168
+ this.bindings.delete(abstract);
169
+ this.singletons.delete(abstract);
170
+ this.instances.delete(abstract);
171
+ this.resolvedInstances.delete(abstract);
167
172
  }
168
173
  }
169
174
  singleton(key, factory) {
@@ -367,9 +372,11 @@ var Container = class Container extends __h3ravel_contracts.IContainer {
367
372
  }
368
373
  }
369
374
  instance(abstract, instance) {
375
+ abstract = this.getAlias(abstract);
370
376
  this.removeAbstractAlias(abstract);
371
377
  const isBound = this.bound(abstract);
372
378
  this.aliases.delete(abstract);
379
+ this.resolvedInstances.delete(abstract);
373
380
  this.instances.set(abstract, instance);
374
381
  if (isBound) this.rebound(abstract);
375
382
  return instance;
@@ -425,7 +432,6 @@ var Container = class Container extends __h3ravel_contracts.IContainer {
425
432
  return Container.instance = container;
426
433
  }
427
434
  };
428
-
429
435
  //#endregion
430
436
  //#region src/ProviderRegistry.ts
431
437
  var ProviderRegistry = class {
@@ -611,10 +617,10 @@ var ProviderRegistry = class {
611
617
  return (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href)(manifestPath);
612
618
  }
613
619
  };
614
-
615
620
  //#endregion
616
621
  //#region src/Registerer.ts
617
- var Registerer = class Registerer extends __h3ravel_contracts.IRegisterer {
622
+ var Registerer = class Registerer extends _h3ravel_contracts.IRegisterer {
623
+ app;
618
624
  constructor(app) {
619
625
  super();
620
626
  this.app = app;
@@ -623,31 +629,30 @@ var Registerer = class Registerer extends __h3ravel_contracts.IRegisterer {
623
629
  new Registerer(app).bootRegister();
624
630
  }
625
631
  bootRegister() {
626
- globalThis.dd = __h3ravel_support.dd;
627
- globalThis.dump = __h3ravel_support.dump;
628
- globalThis.app_path = (path$2) => this.appPath(path$2);
629
- globalThis.base_path = (path$2) => this.basePath(path$2);
630
- globalThis.public_path = (path$2) => this.publicPath(path$2);
631
- globalThis.storage_path = (path$2) => this.storagePath(path$2);
632
- globalThis.database_path = (path$2) => this.databasePath(path$2);
632
+ globalThis.dd = _h3ravel_support.dd;
633
+ globalThis.dump = _h3ravel_support.dump;
634
+ globalThis.app_path = (path) => this.appPath(path);
635
+ globalThis.base_path = (path) => this.basePath(path);
636
+ globalThis.public_path = (path) => this.publicPath(path);
637
+ globalThis.storage_path = (path) => this.storagePath(path);
638
+ globalThis.database_path = (path) => this.databasePath(path);
633
639
  }
634
- appPath(path$2) {
635
- return this.app.getPath("base", node_path.default.join(`/${process.env.DIST_DIR ?? "src"}/`.replace(/([^:]\/)\/+/g, "$1"), "app", path$2 ?? ""));
640
+ appPath(path) {
641
+ return this.app.getPath("base", node_path.default.join(`/${process.env.DIST_DIR ?? "src"}/`.replace(/([^:]\/)\/+/g, "$1"), "app", path ?? ""));
636
642
  }
637
- basePath(path$2) {
638
- return this.app.getPath("base", path$2);
643
+ basePath(path) {
644
+ return this.app.getPath("base", path);
639
645
  }
640
- publicPath(path$2) {
641
- return this.app.getPath("public", path$2);
646
+ publicPath(path) {
647
+ return this.app.getPath("public", path);
642
648
  }
643
- storagePath(path$2) {
644
- return this.app.getPath("base", node_path.default.join("storage", path$2 ?? ""));
649
+ storagePath(path) {
650
+ return this.app.getPath("base", node_path.default.join("storage", path ?? ""));
645
651
  }
646
- databasePath(path$2) {
647
- return this.app.getPath("database", path$2);
652
+ databasePath(path) {
653
+ return this.app.getPath("database", path);
648
654
  }
649
655
  };
650
-
651
656
  //#endregion
652
657
  //#region src/Providers/CoreServiceProvider.ts
653
658
  /**
@@ -659,23 +664,23 @@ var Registerer = class Registerer extends __h3ravel_contracts.IRegisterer {
659
664
  *
660
665
  * Auto-Registered
661
666
  */
662
- var CoreServiceProvider = class extends __h3ravel_support.ServiceProvider {
667
+ var CoreServiceProvider = class extends _h3ravel_support.ServiceProvider {
663
668
  static priority = 999;
664
669
  register() {
665
- Object.assign(globalThis, { str: __h3ravel_support.str });
666
- this.app.alias(__h3ravel_contracts.IApplication, Application);
670
+ Object.assign(globalThis, { str: _h3ravel_support.str });
671
+ this.app.alias(_h3ravel_contracts.IApplication, Application);
667
672
  }
668
673
  boot() {}
669
674
  };
670
-
671
675
  //#endregion
672
676
  //#region src/Application.ts
673
677
  var Application = class Application extends Container {
678
+ initializer;
674
679
  /**
675
680
  * Indicates if the application has "booted".
676
681
  */
677
682
  #booted = false;
678
- paths = new __h3ravel_shared.PathLoader();
683
+ paths = new _h3ravel_shared.PathLoader();
679
684
  context;
680
685
  h3Event;
681
686
  tries = 0;
@@ -747,7 +752,7 @@ var Application = class Application extends Container {
747
752
  }
748
753
  async loadOptions() {
749
754
  try {
750
- const corePath = __h3ravel_shared.FileSystem.findModulePkg("@h3ravel/core", process.cwd()) ?? "";
755
+ const corePath = _h3ravel_shared.FileSystem.findModulePkg("@h3ravel/core", process.cwd()) ?? "";
751
756
  const app = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "/package.json"), { encoding: "utf8" }));
752
757
  const core = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(corePath, "package.json"), { encoding: "utf8" }));
753
758
  if (core) {
@@ -759,7 +764,7 @@ var Application = class Application extends Container {
759
764
  Application.versions.ts = this.versions.ts;
760
765
  }
761
766
  if (app && app.dependencies) {
762
- const versions = Object.fromEntries(Object.entries(app.dependencies).filter(([e]) => e.includes("@h3ravel")).map(([name, ver]) => [__h3ravel_support.Str.afterLast(name, "/"), semver.default.minVersion(ver.includes("work") ? this.versions.app : ver)?.version]));
767
+ const versions = Object.fromEntries(Object.entries(app.dependencies).filter(([e]) => e.includes("@h3ravel")).map(([name, ver]) => [_h3ravel_support.Str.afterLast(name, "/"), semver.default.minVersion(ver.includes("work") ? this.versions.app : ver)?.version]));
763
768
  Object.assign(this.versions, versions);
764
769
  Object.assign(Application.versions, versions);
765
770
  }
@@ -946,8 +951,8 @@ var Application = class Application extends Container {
946
951
  * @throws {NotFoundHttpException}
947
952
  */
948
953
  abort(code, message = "", headers = {}) {
949
- if (code == 404) throw new __h3ravel_foundation.NotFoundHttpException(message, void 0, 0, headers);
950
- throw new __h3ravel_foundation.HttpException(code, message, void 0, headers);
954
+ if (code == 404) throw new _h3ravel_foundation.NotFoundHttpException(message, void 0, 0, headers);
955
+ throw new _h3ravel_foundation.HttpException(code, message, void 0, headers);
951
956
  }
952
957
  /**
953
958
  * Register a terminating callback with the application.
@@ -987,20 +992,33 @@ var Application = class Application extends Container {
987
992
  */
988
993
  async handleRequest(config) {
989
994
  this.h3App?.all("/**", async (event) => {
990
- this.context = (event$1) => this.buildContext(event$1, config);
995
+ this.context = (event) => this.buildContext(event, config);
991
996
  this.h3Event = event;
992
- const context = await this.context(event);
993
- const kernel = this.make(__h3ravel_contracts.IKernel);
997
+ const context = await this.buildContext(event, config, true);
998
+ const kernel = this.make(_h3ravel_contracts.IKernel);
994
999
  this.bind("http.context", () => context);
995
1000
  this.bind("http.request", () => context.request);
996
1001
  this.bind("http.response", () => context.response);
997
- const response = await kernel.handle(context.request);
998
- if (response) this.bind("http.response", () => response);
999
- kernel.terminate(context.request, response);
1000
- let finalResponse;
1001
- if (response && ["Response", "JsonResponse"].includes(response.constructor.name)) finalResponse = response.prepare(context.request).send();
1002
- else finalResponse = response;
1003
- return finalResponse;
1002
+ let response;
1003
+ try {
1004
+ response = await kernel.handle(context.request);
1005
+ const handledResponse = response ?? context.response;
1006
+ this.bind("http.response", () => handledResponse);
1007
+ kernel.terminate(context.request, handledResponse);
1008
+ let finalResponse;
1009
+ if (response && ["Response", "JsonResponse"].includes(response.constructor.name)) finalResponse = response.prepare(context.request).send();
1010
+ else finalResponse = response;
1011
+ return finalResponse;
1012
+ } finally {
1013
+ const { HttpContext } = await import("@h3ravel/http");
1014
+ HttpContext.forget(context.event);
1015
+ delete context.event._h3ravelContext;
1016
+ this.unbind([
1017
+ "http.context",
1018
+ "http.request",
1019
+ "http.response"
1020
+ ]);
1021
+ }
1004
1022
  });
1005
1023
  }
1006
1024
  /**
@@ -1027,7 +1045,7 @@ var Application = class Application extends Container {
1027
1045
  * Handle the incoming Artisan command.
1028
1046
  */
1029
1047
  async handleCommand() {
1030
- const kernel = this.make(__h3ravel_contracts.CKernel);
1048
+ const kernel = this.make(_h3ravel_contracts.CKernel);
1031
1049
  const status = await kernel.handle();
1032
1050
  kernel.terminate(status);
1033
1051
  return status;
@@ -1057,17 +1075,17 @@ var Application = class Application extends Container {
1057
1075
  * Provide safe overides for the app
1058
1076
  */
1059
1077
  configure() {
1060
- return new __h3ravel_foundation.AppBuilder(this).withKernels().withCommands();
1078
+ return new _h3ravel_foundation.AppBuilder(this).withKernels().withCommands();
1061
1079
  }
1062
1080
  /**
1063
1081
  * Check if the current application environment matches the one provided
1064
1082
  */
1065
- environment(env$1) {
1066
- return this.make("config").get("app.env") === env$1;
1083
+ environment(env) {
1084
+ return this.make("config").get("app.env") === env;
1067
1085
  }
1068
1086
  async fire(h3App, preferredPort) {
1069
1087
  if (h3App) this.h3App = h3App;
1070
- if (!this?.h3App) throw new __h3ravel_foundation.ConfigException("[Provide a H3 app instance in the config or install @h3ravel/http]");
1088
+ if (!this?.h3App) throw new _h3ravel_foundation.ConfigException("[Provide a H3 app instance in the config or install @h3ravel/http]");
1071
1089
  return await this.serve(this.h3App, preferredPort);
1072
1090
  }
1073
1091
  /**
@@ -1079,27 +1097,27 @@ var Application = class Application extends Container {
1079
1097
  * @param preferedPort If provided, this will overide the port set in the evironment
1080
1098
  */
1081
1099
  async serve(h3App, preferredPort) {
1082
- if (!h3App) throw new __h3ravel_support.InvalidArgumentException("No valid H3 app instance was provided.");
1100
+ if (!h3App) throw new _h3ravel_support.InvalidArgumentException("No valid H3 app instance was provided.");
1083
1101
  await this.boot();
1084
- const serve$1 = this.make("http.serve");
1102
+ const serve = this.make("http.serve");
1085
1103
  const port = preferredPort ?? env("PORT", 3e3);
1086
1104
  const tries = env("RETRIES", 1);
1087
1105
  const hostname = env("HOSTNAME", "localhost");
1088
1106
  try {
1089
1107
  const realPort = await (0, detect_port.detect)(port);
1090
1108
  if (port == realPort) {
1091
- const server = serve$1(h3App, {
1109
+ const server = serve(h3App, {
1092
1110
  port,
1093
1111
  hostname,
1094
1112
  silent: true
1095
1113
  });
1096
- __h3ravel_shared.Logger.parse([["🚀 H3ravel running at:", "green"], [`${server.options.protocol ?? "http"}://${server.options.hostname}:${server.options.port}`, "cyan"]]);
1114
+ _h3ravel_shared.Logger.parse([["🚀 H3ravel running at:", "green"], [`${server.options.protocol ?? "http"}://${server.options.hostname}:${server.options.port}`, "cyan"]]);
1097
1115
  } else if (this.tries <= tries) {
1098
1116
  await this.fire(h3App, realPort);
1099
1117
  this.tries++;
1100
- } else __h3ravel_shared.Logger.parse([["ERROR:", "bgRed"], ["No free port available", "red"]]);
1118
+ } else _h3ravel_shared.Logger.parse([["ERROR:", "bgRed"], ["No free port available", "red"]]);
1101
1119
  } catch (e) {
1102
- __h3ravel_shared.Logger.parse([
1120
+ _h3ravel_shared.Logger.parse([
1103
1121
  ["An error occured", "bgRed"],
1104
1122
  [e.message, "red"],
1105
1123
  [e.stack, "red"]
@@ -1127,7 +1145,7 @@ var Application = class Application extends Container {
1127
1145
  return this.bootstrapped;
1128
1146
  }
1129
1147
  /**
1130
- * Save the curretn H3 instance for possible future use.
1148
+ * Save the current H3 app instance for possible future use.
1131
1149
  *
1132
1150
  * @param h3App The current H3 app instance
1133
1151
  * @returns
@@ -1137,6 +1155,14 @@ var Application = class Application extends Container {
1137
1155
  return this;
1138
1156
  }
1139
1157
  /**
1158
+ * Get the current H3 app instance.
1159
+ *
1160
+ * @returns
1161
+ */
1162
+ getH3App() {
1163
+ return this.h3App;
1164
+ }
1165
+ /**
1140
1166
  * Set the HttpContext.
1141
1167
  *
1142
1168
  * @param ctx
@@ -1156,8 +1182,8 @@ var Application = class Application extends Container {
1156
1182
  getNamespace() {
1157
1183
  if (this.namespace != null) return this.namespace;
1158
1184
  const pkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)(node_path.default.join(process.cwd(), "package.json"));
1159
- for (const [namespace, pathChoice] of Object.entries((0, __h3ravel_support.data_get)(pkg, "autoload.namespaces"))) if (this.getPath("app", "/") === this.getPath("src", pathChoice)) return this.namespace = namespace;
1160
- throw new __h3ravel_support.RuntimeException("Unable to detect application namespace.");
1185
+ for (const [namespace, pathChoice] of Object.entries((0, _h3ravel_support.data_get)(pkg, "autoload.namespaces"))) if (this.getPath("app", "/") === this.getPath("src", pathChoice)) return this.namespace = namespace;
1186
+ throw new _h3ravel_support.RuntimeException("Unable to detect application namespace.");
1161
1187
  }
1162
1188
  /**
1163
1189
  * Get the path of the app dir
@@ -1192,8 +1218,8 @@ var Application = class Application extends Container {
1192
1218
  * @param path - The new path
1193
1219
  * @returns
1194
1220
  */
1195
- setPath(name, path$2) {
1196
- return this.paths.setPath(name, path$2, this.basePath);
1221
+ setPath(name, path) {
1222
+ return this.paths.setPath(name, path, this.basePath);
1197
1223
  }
1198
1224
  /**
1199
1225
  * Returns the installed version of the system core and typescript.
@@ -1212,20 +1238,18 @@ var Application = class Application extends Container {
1212
1238
  return this.versions[key]?.replaceAll(/\^|~/g, "");
1213
1239
  }
1214
1240
  };
1215
-
1216
1241
  //#endregion
1217
1242
  //#region src/Controller.ts
1218
1243
  /**
1219
1244
  * Base controller class
1220
1245
  */
1221
- var Controller = class extends __h3ravel_contracts.IController {
1246
+ var Controller = class extends _h3ravel_contracts.IController {
1222
1247
  app;
1223
1248
  constructor(app) {
1224
1249
  super();
1225
1250
  this.app = app;
1226
1251
  }
1227
1252
  };
1228
-
1229
1253
  //#endregion
1230
1254
  //#region src/H3ravel.ts
1231
1255
  /**
@@ -1242,14 +1266,14 @@ const h3ravel = async (providers = [], basePath = process.cwd(), config = {
1242
1266
  }) => {
1243
1267
  let h3App;
1244
1268
  const app = new Application(basePath, "h3ravel");
1245
- if (config.customPaths) for (const [name, path$2] of Object.entries(config.customPaths)) app.setPath(name, path$2);
1269
+ if (config.customPaths) for (const [name, path] of Object.entries(config.customPaths)) app.setPath(name, path);
1246
1270
  app.initialize(providers, config.filteredProviders, config.autoload);
1247
1271
  try {
1248
1272
  h3App = app.make("http.app");
1249
1273
  app.setH3App(h3App);
1250
- app.singleton(__h3ravel_contracts.IApplication, () => app);
1251
- if (!__h3ravel_support_facades.Facades.getApplication()) __h3ravel_support_facades.Facades.setApplication(app);
1252
- if (!__h3ravel_foundation.Helpers.isLoaded()) __h3ravel_foundation.Helpers.load(app);
1274
+ app.singleton(_h3ravel_contracts.IApplication, () => app);
1275
+ if (!_h3ravel_support_facades.Facades.getApplication()) _h3ravel_support_facades.Facades.setApplication(app);
1276
+ if (!_h3ravel_foundation.Helpers.isLoaded()) _h3ravel_foundation.Helpers.load(app);
1253
1277
  await app.handleRequest(config);
1254
1278
  } catch {
1255
1279
  if (!h3App && config.h3) h3App = config.h3;
@@ -1257,7 +1281,6 @@ const h3ravel = async (providers = [], basePath = process.cwd(), config = {
1257
1281
  if (config.initialize && h3App) return await app.fire(h3App);
1258
1282
  return app.setH3App(h3App);
1259
1283
  };
1260
-
1261
1284
  //#endregion
1262
1285
  //#region src/Http/Kernel.ts
1263
1286
  /**
@@ -1265,6 +1288,8 @@ const h3ravel = async (providers = [], basePath = process.cwd(), config = {
1265
1288
  * It acts as the core middleware pipeline for HTTP requests.
1266
1289
  */
1267
1290
  var Kernel = class {
1291
+ app;
1292
+ middleware;
1268
1293
  /**
1269
1294
  * The router instance.
1270
1295
  */
@@ -1303,7 +1328,7 @@ var Kernel = class {
1303
1328
  this.app.bind("http.context", () => this.applicationContext);
1304
1329
  this.app.bind("http.request", () => this.applicationContext.request);
1305
1330
  this.app.bind("http.response", () => this.applicationContext.response);
1306
- this.app.middlewareHandler = this.app.has(__h3ravel_foundation.MiddlewareHandler) ? this.app.make(__h3ravel_foundation.MiddlewareHandler) : new __h3ravel_foundation.MiddlewareHandler([], this.app);
1331
+ this.app.middlewareHandler = this.app.has(_h3ravel_foundation.MiddlewareHandler) ? this.app.make(_h3ravel_foundation.MiddlewareHandler) : new _h3ravel_foundation.MiddlewareHandler([], this.app);
1307
1332
  request.constructor.enableHttpMethodParameterOverride();
1308
1333
  /**
1309
1334
  * Run middleware stack and obtain result
@@ -1313,7 +1338,7 @@ var Kernel = class {
1313
1338
  * If a plain object is returned from a controller or middleware,
1314
1339
  * automatically set the JSON Content-Type header for the response.
1315
1340
  */
1316
- if (result !== void 0 && __h3ravel_support.Obj.isPlainObject(result, true) && !result?.headers) event.res.headers.set("Content-Type", "application/json; charset=UTF-8");
1341
+ if (result !== void 0 && _h3ravel_support.Obj.isPlainObject(result, true) && !result?.headers) event.res.headers.set("Content-Type", "application/json; charset=UTF-8");
1317
1342
  return result;
1318
1343
  }
1319
1344
  /**
@@ -1321,9 +1346,9 @@ var Kernel = class {
1321
1346
  */
1322
1347
  async resolve(event, middleware, handler) {
1323
1348
  const { Response } = await import("@h3ravel/http");
1324
- this.middleware = Array.from(new Set([...this.middleware, ...__h3ravel_support.Arr.wrap(middleware)]));
1349
+ this.middleware = Array.from(new Set([...this.middleware, ..._h3ravel_support.Arr.wrap(middleware)]));
1325
1350
  return this.handle(event, (ctx) => new Promise((resolve) => {
1326
- if (__h3ravel_shared.Resolver.isAsyncFunction(handler)) handler(ctx).then((response) => {
1351
+ if (_h3ravel_shared.Resolver.isAsyncFunction(handler)) handler(ctx).then((response) => {
1327
1352
  if (response instanceof Response) resolve(response.prepare(ctx.request).send());
1328
1353
  else resolve(response);
1329
1354
  });
@@ -1331,32 +1356,31 @@ var Kernel = class {
1331
1356
  }));
1332
1357
  }
1333
1358
  };
1334
-
1335
1359
  //#endregion
1336
1360
  exports.Application = Application;
1337
1361
  exports.Container = Container;
1338
1362
  exports.ContainerResolver = ContainerResolver;
1339
1363
  exports.Controller = Controller;
1340
1364
  exports.CoreServiceProvider = CoreServiceProvider;
1341
- Object.defineProperty(exports, 'Inject', {
1342
- enumerable: true,
1343
- get: function () {
1344
- return __h3ravel_foundation.Inject;
1345
- }
1365
+ Object.defineProperty(exports, "Inject", {
1366
+ enumerable: true,
1367
+ get: function() {
1368
+ return _h3ravel_foundation.Inject;
1369
+ }
1346
1370
  });
1347
- Object.defineProperty(exports, 'Injectable', {
1348
- enumerable: true,
1349
- get: function () {
1350
- return __h3ravel_foundation.Injectable;
1351
- }
1371
+ Object.defineProperty(exports, "Injectable", {
1372
+ enumerable: true,
1373
+ get: function() {
1374
+ return _h3ravel_foundation.Injectable;
1375
+ }
1352
1376
  });
1353
1377
  exports.Kernel = Kernel;
1354
1378
  exports.ProviderRegistry = ProviderRegistry;
1355
1379
  exports.Registerer = Registerer;
1356
- Object.defineProperty(exports, 'ServiceProvider', {
1357
- enumerable: true,
1358
- get: function () {
1359
- return __h3ravel_support.ServiceProvider;
1360
- }
1380
+ Object.defineProperty(exports, "ServiceProvider", {
1381
+ enumerable: true,
1382
+ get: function() {
1383
+ return _h3ravel_support.ServiceProvider;
1384
+ }
1361
1385
  });
1362
- exports.h3ravel = h3ravel;
1386
+ exports.h3ravel = h3ravel;