shokupan 0.16.1 → 0.16.3

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.
@@ -2152,7 +2152,7 @@ function serveStatic(config, prefix) {
2152
2152
  }
2153
2153
  }
2154
2154
  walk(rootPath).then(_resolveReady).catch((err) => {
2155
- if (process.env.NODE_ENV !== "test") this.logger.error("[serveStatic] Cache population error:", err);
2155
+ if (process.env.NODE_ENV !== "test") console.error("[serveStatic] Cache population error:", err);
2156
2156
  _resolveReady();
2157
2157
  });
2158
2158
  } else {
@@ -4763,7 +4763,7 @@ class ApiExplorerPlugin extends ShokupanRouter {
4763
4763
  }
4764
4764
  }
4765
4765
  static getBasePath() {
4766
- const dir = path$1.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-DGW-KI1t.cjs", document.baseURI).href));
4766
+ const dir = path$1.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-8Ylk5R0q.cjs", document.baseURI).href));
4767
4767
  if (dir.endsWith("dist")) {
4768
4768
  return dir + "/plugins/application/api-explorer";
4769
4769
  }
@@ -5567,7 +5567,7 @@ class AsyncApiPlugin extends ShokupanRouter {
5567
5567
  this.init();
5568
5568
  }
5569
5569
  static getBasePath() {
5570
- const dir = path$1.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-DGW-KI1t.cjs", document.baseURI).href));
5570
+ const dir = path$1.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-8Ylk5R0q.cjs", document.baseURI).href));
5571
5571
  if (dir.endsWith("dist")) {
5572
5572
  return dir + "/plugins/application/asyncapi";
5573
5573
  }
@@ -6091,7 +6091,7 @@ function createHTTPLogger() {
6091
6091
  return result;
6092
6092
  };
6093
6093
  }
6094
- const require$1 = node_module.createRequire(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-DGW-KI1t.cjs", document.baseURI).href);
6094
+ const require$1 = node_module.createRequire(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-8Ylk5R0q.cjs", document.baseURI).href);
6095
6095
  const http = require$1("node:http");
6096
6096
  const https = require$1("node:https");
6097
6097
  class FetchInterceptor {
@@ -6698,7 +6698,7 @@ class Dashboard {
6698
6698
  }
6699
6699
  // Get base path for dashboard files - works in both dev (src/) and production (dist/)
6700
6700
  static getBasePath() {
6701
- const dir = path$1.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-DGW-KI1t.cjs", document.baseURI).href));
6701
+ const dir = path$1.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-8Ylk5R0q.cjs", document.baseURI).href));
6702
6702
  if (dir.endsWith("dist")) {
6703
6703
  return dir + "/plugins/application/dashboard";
6704
6704
  }
@@ -9745,7 +9745,7 @@ class Shokupan extends ShokupanRouter {
9745
9745
  const { SecurityHeaders: SecurityHeaders2 } = require("./plugins/middleware/security-headers");
9746
9746
  this.use(SecurityHeaders2(this.applicationConfig.defaultSecurityHeaders === true ? {} : this.applicationConfig.defaultSecurityHeaders));
9747
9747
  }
9748
- if (this.applicationConfig.adapter !== "wintercg") {
9748
+ if (this.applicationConfig.adapter !== "wintercg" && this.applicationConfig.datastore) {
9749
9749
  this.dbPromise = this.initDatastore().catch((err) => {
9750
9750
  this.logger?.debug("Shokupan", "Failed to initialize default datastore", { error: err });
9751
9751
  });
@@ -9801,24 +9801,24 @@ class Shokupan extends ShokupanRouter {
9801
9801
  try {
9802
9802
  switch (adapterName) {
9803
9803
  case "sqlite": {
9804
- const { SqliteAdapter } = await Promise.resolve().then(() => require("./sqlite-Z7Jt65XL.cjs"));
9804
+ const { SqliteAdapter } = await Promise.resolve().then(() => require("./sqlite-4_h2xf9-.cjs"));
9805
9805
  this.datastore = new SqliteAdapter(options);
9806
9806
  break;
9807
9807
  }
9808
9808
  case "level": {
9809
- const { LevelAdapter } = await Promise.resolve().then(() => require("./level-14ZzYhXc.cjs"));
9809
+ const { LevelAdapter } = await Promise.resolve().then(() => require("./level-3Mg_5PYx.cjs"));
9810
9810
  this.datastore = new LevelAdapter(options);
9811
9811
  break;
9812
9812
  }
9813
9813
  case "surrealdb": {
9814
- const { SurrealAdapter } = await Promise.resolve().then(() => require("./surreal-BglaabNG.cjs"));
9814
+ const { SurrealAdapter } = await Promise.resolve().then(() => require("./surreal-wFuSfb5c.cjs"));
9815
9815
  const legacyConfig = this.applicationConfig.surreal || {};
9816
9816
  const effectiveOptions = { ...legacyConfig, ...options };
9817
9817
  this.datastore = new SurrealAdapter(effectiveOptions);
9818
9818
  break;
9819
9819
  }
9820
9820
  default: {
9821
- const { SurrealAdapter } = await Promise.resolve().then(() => require("./surreal-BglaabNG.cjs"));
9821
+ const { SurrealAdapter } = await Promise.resolve().then(() => require("./surreal-wFuSfb5c.cjs"));
9822
9822
  const legacy = this.applicationConfig.surreal;
9823
9823
  this.datastore = new SurrealAdapter(options || legacy || {});
9824
9824
  }
@@ -10022,13 +10022,14 @@ class Shokupan extends ShokupanRouter {
10022
10022
  * @param port - The port to listen on. If not specified, the port from the configuration is used. If that is not specified, port 3000 is used.
10023
10023
  * @returns The server instance.
10024
10024
  */
10025
- async listen(port) {
10025
+ async listen(port, callback) {
10026
10026
  this.httpServer = new ShokupanServer(this);
10027
10027
  this.server = await this.httpServer.listen(port);
10028
10028
  const protocol = this.applicationConfig.tls || this.applicationConfig.development ? "https" : "http";
10029
10029
  const url = `${protocol}://${this.applicationConfig.hostname}:${this.applicationConfig.port}`;
10030
10030
  const hyperlinkedUrl = `\x1B]8;;${url}\x07${url}\x1B]8;;\x07`;
10031
10031
  this.logger.info("Shokupan", `Server running on ${hyperlinkedUrl}`);
10032
+ callback?.();
10032
10033
  return this.server;
10033
10034
  }
10034
10035
  /**
@@ -12925,4 +12926,4 @@ exports.traceMiddleware = traceMiddleware;
12925
12926
  exports.useExpress = useExpress;
12926
12927
  exports.valibot = valibot;
12927
12928
  exports.validate = validate;
12928
- //# sourceMappingURL=index-DGW-KI1t.cjs.map
12929
+ //# sourceMappingURL=index-8Ylk5R0q.cjs.map