miqro 6.0.11 → 6.0.13

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 (43) hide show
  1. package/README.md +2 -1
  2. package/build/esm/editor/common/constants.d.ts +1 -1
  3. package/build/esm/editor/common/constants.js +1 -1
  4. package/build/esm/editor/common/constants.js.map +1 -1
  5. package/build/esm/editor/server.js +1 -1
  6. package/build/esm/editor/server.js.map +1 -1
  7. package/build/esm/src/bin/generate-doc.js +20 -18
  8. package/build/esm/src/bin/generate-doc.js.map +1 -1
  9. package/build/esm/src/cluster.js +12 -4
  10. package/build/esm/src/cluster.js.map +1 -1
  11. package/build/esm/src/common/arguments.d.ts +1 -0
  12. package/build/esm/src/common/arguments.js +11 -1
  13. package/build/esm/src/common/arguments.js.map +1 -1
  14. package/build/esm/src/common/help.d.ts +1 -1
  15. package/build/esm/src/common/help.js +2 -1
  16. package/build/esm/src/common/help.js.map +1 -1
  17. package/build/esm/src/inflate/inflate-sea.js +4 -3
  18. package/build/esm/src/inflate/inflate-sea.js.map +1 -1
  19. package/build/esm/src/main.js +0 -0
  20. package/build/esm/src/services/editor.js +21 -14
  21. package/build/esm/src/services/editor.js.map +1 -1
  22. package/build/esm/src/services/utils/log.js +2 -2
  23. package/build/esm/src/services/utils/log.js.map +1 -1
  24. package/build/esm/src/services/utils/server-interface.d.ts +2 -0
  25. package/build/esm/src/services/utils/server-interface.js +7 -1
  26. package/build/esm/src/services/utils/server-interface.js.map +1 -1
  27. package/build/esm/src/types.d.ts +2 -0
  28. package/build/lib.cjs +140 -127
  29. package/editor/common/constants.ts +1 -1
  30. package/editor/http/admin/editor/style.css +1 -1
  31. package/editor/server.ts +1 -1
  32. package/package.json +4 -5
  33. package/sea/types.json +1 -1
  34. package/src/bin/generate-doc.ts +21 -18
  35. package/src/cluster.ts +12 -4
  36. package/src/common/arguments.ts +13 -1
  37. package/src/common/help.ts +2 -1
  38. package/src/inflate/inflate-sea.ts +4 -3
  39. package/src/services/editor.tsx +24 -16
  40. package/src/services/utils/log.ts +2 -2
  41. package/src/services/utils/server-interface.ts +7 -1
  42. package/src/types/miqro.d.ts +2 -0
  43. package/src/types.ts +2 -0
package/build/lib.cjs CHANGED
@@ -32,50 +32,49 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  ));
33
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
 
35
- // node_modules/cookie/index.js
36
- var require_cookie = __commonJS({
37
- "node_modules/cookie/index.js"(exports2) {
35
+ // node_modules/cookie/dist/index.js
36
+ var require_dist = __commonJS({
37
+ "node_modules/cookie/dist/index.js"(exports2) {
38
38
  "use strict";
39
+ Object.defineProperty(exports2, "__esModule", { value: true });
39
40
  exports2.parse = parse2;
40
41
  exports2.serialize = serialize2;
41
- var __toString = Object.prototype.toString;
42
- var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
43
- var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
42
+ var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
43
+ var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
44
44
  var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
45
45
  var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
46
- function parse2(str, opt) {
47
- if (typeof str !== "string") {
48
- throw new TypeError("argument str must be a string");
49
- }
50
- var obj = {};
51
- var len = str.length;
52
- if (len < 2) return obj;
53
- var dec = opt && opt.decode || decode;
54
- var index = 0;
55
- var eqIdx = 0;
56
- var endIdx = 0;
46
+ var __toString = Object.prototype.toString;
47
+ var NullObject = /* @__PURE__ */ (() => {
48
+ const C = function() {
49
+ };
50
+ C.prototype = /* @__PURE__ */ Object.create(null);
51
+ return C;
52
+ })();
53
+ function parse2(str, options) {
54
+ const obj = new NullObject();
55
+ const len = str.length;
56
+ if (len < 2)
57
+ return obj;
58
+ const dec = options?.decode || decode;
59
+ let index = 0;
57
60
  do {
58
- eqIdx = str.indexOf("=", index);
59
- if (eqIdx === -1) break;
60
- endIdx = str.indexOf(";", index);
61
- if (endIdx === -1) {
62
- endIdx = len;
63
- } else if (eqIdx > endIdx) {
61
+ const eqIdx = str.indexOf("=", index);
62
+ if (eqIdx === -1)
63
+ break;
64
+ const colonIdx = str.indexOf(";", index);
65
+ const endIdx = colonIdx === -1 ? len : colonIdx;
66
+ if (eqIdx > endIdx) {
64
67
  index = str.lastIndexOf(";", eqIdx - 1) + 1;
65
68
  continue;
66
69
  }
67
- var keyStartIdx = startIndex(str, index, eqIdx);
68
- var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
69
- var key = str.slice(keyStartIdx, keyEndIdx);
70
- if (!obj.hasOwnProperty(key)) {
71
- var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
72
- var valEndIdx = endIndex(str, endIdx, valStartIdx);
73
- if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
74
- valStartIdx++;
75
- valEndIdx--;
76
- }
77
- var val = str.slice(valStartIdx, valEndIdx);
78
- obj[key] = tryDecode(val, dec);
70
+ const keyStartIdx = startIndex(str, index, eqIdx);
71
+ const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
72
+ const key = str.slice(keyStartIdx, keyEndIdx);
73
+ if (obj[key] === void 0) {
74
+ let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
75
+ let valEndIdx = endIndex(str, endIdx, valStartIdx);
76
+ const value = dec(str.slice(valStartIdx, valEndIdx));
77
+ obj[key] = value;
79
78
  }
80
79
  index = endIdx + 1;
81
80
  } while (index < len);
@@ -83,69 +82,67 @@ var require_cookie = __commonJS({
83
82
  }
84
83
  function startIndex(str, index, max) {
85
84
  do {
86
- var code = str.charCodeAt(index);
87
- if (code !== 32 && code !== 9) return index;
85
+ const code = str.charCodeAt(index);
86
+ if (code !== 32 && code !== 9)
87
+ return index;
88
88
  } while (++index < max);
89
89
  return max;
90
90
  }
91
91
  function endIndex(str, index, min) {
92
92
  while (index > min) {
93
- var code = str.charCodeAt(--index);
94
- if (code !== 32 && code !== 9) return index + 1;
93
+ const code = str.charCodeAt(--index);
94
+ if (code !== 32 && code !== 9)
95
+ return index + 1;
95
96
  }
96
97
  return min;
97
98
  }
98
- function serialize2(name, val, opt) {
99
- var enc = opt && opt.encode || encodeURIComponent;
100
- if (typeof enc !== "function") {
101
- throw new TypeError("option encode is invalid");
102
- }
99
+ function serialize2(name, val, options) {
100
+ const enc = options?.encode || encodeURIComponent;
103
101
  if (!cookieNameRegExp.test(name)) {
104
- throw new TypeError("argument name is invalid");
102
+ throw new TypeError(`argument name is invalid: ${name}`);
105
103
  }
106
- var value = enc(val);
104
+ const value = enc(val);
107
105
  if (!cookieValueRegExp.test(value)) {
108
- throw new TypeError("argument val is invalid");
106
+ throw new TypeError(`argument val is invalid: ${val}`);
109
107
  }
110
- var str = name + "=" + value;
111
- if (!opt) return str;
112
- if (null != opt.maxAge) {
113
- var maxAge = Math.floor(opt.maxAge);
114
- if (!isFinite(maxAge)) {
115
- throw new TypeError("option maxAge is invalid");
108
+ let str = name + "=" + value;
109
+ if (!options)
110
+ return str;
111
+ if (options.maxAge !== void 0) {
112
+ if (!Number.isInteger(options.maxAge)) {
113
+ throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
116
114
  }
117
- str += "; Max-Age=" + maxAge;
115
+ str += "; Max-Age=" + options.maxAge;
118
116
  }
119
- if (opt.domain) {
120
- if (!domainValueRegExp.test(opt.domain)) {
121
- throw new TypeError("option domain is invalid");
117
+ if (options.domain) {
118
+ if (!domainValueRegExp.test(options.domain)) {
119
+ throw new TypeError(`option domain is invalid: ${options.domain}`);
122
120
  }
123
- str += "; Domain=" + opt.domain;
121
+ str += "; Domain=" + options.domain;
124
122
  }
125
- if (opt.path) {
126
- if (!pathValueRegExp.test(opt.path)) {
127
- throw new TypeError("option path is invalid");
123
+ if (options.path) {
124
+ if (!pathValueRegExp.test(options.path)) {
125
+ throw new TypeError(`option path is invalid: ${options.path}`);
128
126
  }
129
- str += "; Path=" + opt.path;
127
+ str += "; Path=" + options.path;
130
128
  }
131
- if (opt.expires) {
132
- var expires = opt.expires;
133
- if (!isDate(expires) || isNaN(expires.valueOf())) {
134
- throw new TypeError("option expires is invalid");
129
+ if (options.expires) {
130
+ if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
131
+ throw new TypeError(`option expires is invalid: ${options.expires}`);
135
132
  }
136
- str += "; Expires=" + expires.toUTCString();
133
+ str += "; Expires=" + options.expires.toUTCString();
137
134
  }
138
- if (opt.httpOnly) {
135
+ if (options.httpOnly) {
139
136
  str += "; HttpOnly";
140
137
  }
141
- if (opt.secure) {
138
+ if (options.secure) {
142
139
  str += "; Secure";
143
140
  }
144
- if (opt.partitioned) {
141
+ if (options.partitioned) {
145
142
  str += "; Partitioned";
146
143
  }
147
- if (opt.priority) {
148
- var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
144
+ if (options.priority) {
145
+ const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
149
146
  switch (priority) {
150
147
  case "low":
151
148
  str += "; Priority=Low";
@@ -157,43 +154,40 @@ var require_cookie = __commonJS({
157
154
  str += "; Priority=High";
158
155
  break;
159
156
  default:
160
- throw new TypeError("option priority is invalid");
157
+ throw new TypeError(`option priority is invalid: ${options.priority}`);
161
158
  }
162
159
  }
163
- if (opt.sameSite) {
164
- var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
160
+ if (options.sameSite) {
161
+ const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
165
162
  switch (sameSite) {
166
163
  case true:
164
+ case "strict":
167
165
  str += "; SameSite=Strict";
168
166
  break;
169
167
  case "lax":
170
168
  str += "; SameSite=Lax";
171
169
  break;
172
- case "strict":
173
- str += "; SameSite=Strict";
174
- break;
175
170
  case "none":
176
171
  str += "; SameSite=None";
177
172
  break;
178
173
  default:
179
- throw new TypeError("option sameSite is invalid");
174
+ throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
180
175
  }
181
176
  }
182
177
  return str;
183
178
  }
184
179
  function decode(str) {
185
- return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
186
- }
187
- function isDate(val) {
188
- return __toString.call(val) === "[object Date]";
189
- }
190
- function tryDecode(str, decode2) {
180
+ if (str.indexOf("%") === -1)
181
+ return str;
191
182
  try {
192
- return decode2(str);
183
+ return decodeURIComponent(str);
193
184
  } catch (e) {
194
185
  return str;
195
186
  }
196
187
  }
188
+ function isDate(val) {
189
+ return __toString.call(val) === "[object Date]";
190
+ }
197
191
  }
198
192
  });
199
193
 
@@ -202,7 +196,7 @@ var BASEEDITOR_PATH, LOG_SOCKET_PATH, LOG_WRITE_EVENT, SUPPORTED_LANGUAGES;
202
196
  var init_constants = __esm({
203
197
  "editor/common/constants.ts"() {
204
198
  BASEEDITOR_PATH = "/admin/editor";
205
- LOG_SOCKET_PATH = "/admin/socket/";
199
+ LOG_SOCKET_PATH = "/admin/socket";
206
200
  LOG_WRITE_EVENT = "LogWrite";
207
201
  SUPPORTED_LANGUAGES = [
208
202
  "text",
@@ -4419,7 +4413,7 @@ var import_node_fs = require("node:fs");
4419
4413
  var import_node_path = require("node:path");
4420
4414
 
4421
4415
  // node_modules/@miqro/core/build/types.js
4422
- var import_cookie2 = __toESM(require_cookie(), 1);
4416
+ var import_cookie2 = __toESM(require_dist(), 1);
4423
4417
  var import_crypto = require("crypto");
4424
4418
  var import_http = require("http");
4425
4419
 
@@ -5368,7 +5362,7 @@ function parsePart(req, part, value, args, mode, parser3) {
5368
5362
  }
5369
5363
 
5370
5364
  // node_modules/@miqro/core/build/middleware/session.js
5371
- var import_cookie = __toESM(require_cookie(), 1);
5365
+ var import_cookie = __toESM(require_dist(), 1);
5372
5366
  var DEFAULT_TOKEN_LOCATION = "free";
5373
5367
  var DEFAULT_TOKEN_HEADER = "Authorization";
5374
5368
  var DEFAULT_TOKEN_QUERY = "token";
@@ -6007,11 +6001,7 @@ function normalizePath(path) {
6007
6001
  if (path.charAt(0) !== "/") {
6008
6002
  throw new Error("path doesnt start with /");
6009
6003
  }
6010
- if (path[path.length - 1] !== "/") {
6011
- return `${path}/`;
6012
- } else {
6013
- return path;
6014
- }
6004
+ return path;
6015
6005
  } else if (path !== "/") {
6016
6006
  throw new Error("path of length 1 not /");
6017
6007
  } else {
@@ -6304,9 +6294,9 @@ function routerDefaultLoggerFactory(uuid, req) {
6304
6294
  } catch (e) {
6305
6295
  urlParsingError = e;
6306
6296
  }
6307
- const pathToEnv = path.replace(/\//ig, "_").toUpperCase();
6297
+ const pathToEnv = path.replace(/\//ig, "_").replace(/\./ig, "_").replace(/-/ig, "_").toUpperCase();
6308
6298
  const WORKER_IDENTIFIER = process.env["CLUSTER_NODE_NUMBER"] ? `WORKER_${process.env["CLUSTER_NODE_NUMBER"]}_` : "";
6309
- const identifier = `${pathToEnv === "_" ? "" : `${pathToEnv.substring(1)}`}${method.toUpperCase()}`;
6299
+ const identifier = `${pathToEnv === "_" ? "" : `${pathToEnv.substring(1)}`}${pathToEnv.charAt(pathToEnv.length - 1) !== "_" ? "_" : ""}${method.toUpperCase()}`;
6310
6300
  const upgrade = req.headers.connection?.indexOf("Upgrade") !== -1;
6311
6301
  const logger = getLogger(`${WORKER_IDENTIFIER}${identifier}`, {
6312
6302
  formatter: (args) => {
@@ -9268,9 +9258,9 @@ var LogProvider = class {
9268
9258
  } catch (e) {
9269
9259
  urlParsingError = e;
9270
9260
  }
9271
- const pathToEnv = path.replace(/\//ig, "_").toUpperCase();
9261
+ const pathToEnv = path.replace(/\//ig, "_").replace(/\./ig, "_").replace(/-/ig, "_").toUpperCase();
9272
9262
  const WORKER_IDENTIFIER = process.env["CLUSTER_NODE_NUMBER"] ? `WORKER_${process.env["CLUSTER_NODE_NUMBER"]}_` : "";
9273
- const identifier = `${pathToEnv === "_" ? "" : `${pathToEnv.substring(1)}`}${method.toUpperCase()}`;
9263
+ const identifier = `${pathToEnv === "_" ? "" : `${pathToEnv.substring(1)}`}${pathToEnv.charAt(pathToEnv.length - 1) !== "_" ? "_" : ""}${method.toUpperCase()}`;
9274
9264
  const upgrade = req.headers.connection?.indexOf("Upgrade") !== -1;
9275
9265
  const logger = this.getLogger(
9276
9266
  `${WORKER_IDENTIFIER}${identifier}`,
@@ -12782,6 +12772,7 @@ async function main() {
12782
12772
  localCache,
12783
12773
  logProvider,
12784
12774
  wsManager: webSocketManager,
12775
+ logger: logProvider.getLogger("server"),
12785
12776
  dbManager,
12786
12777
  port: PORT
12787
12778
  });
@@ -12794,7 +12785,7 @@ async function main() {
12794
12785
  onUpgrade: webSocketManager.onUpgrade
12795
12786
  });
12796
12787
  ${SERVERCONFIGLIST ? `
12797
- await Promise.all([${SERVERCONFIGLIST}].map(config=>config.preload(serverInterface)));
12788
+ await Promise.all([${SERVERCONFIGLIST}].filter(config=>config.preload).map(config=>config.preload(serverInterface)));
12798
12789
  ` : ""}
12799
12790
  app.use(ServerRequestHandler(serverInterface));
12800
12791
  app.use(LoggerHandler());
@@ -12810,13 +12801,13 @@ async function main() {
12810
12801
  app.use(await (await import("./${(0, import_node_path12.join)(service, "api-router.js")}")).setupRouter());
12811
12802
  app.use(await (await import("./${(0, import_node_path12.join)(service, "static-router.js")}")).setupRouter())`).join("\n")}
12812
12803
  ${SERVERCONFIGLIST ? `
12813
- await Promise.all([${SERVERCONFIGLIST}].map(config=>config.load(serverInterface)));
12804
+ await Promise.all([${SERVERCONFIGLIST}].filter(config=>config.load).map(config=>config.load(serverInterface)));
12814
12805
  ` : ""}
12815
12806
 
12816
12807
 
12817
12808
  await app.listen(PORT);
12818
12809
  ${SERVERCONFIGLIST ? `
12819
- await Promise.all([${SERVERCONFIGLIST}].map(config=>config.start(serverInterface)));` : ""}
12810
+ await Promise.all([${SERVERCONFIGLIST}].filter(config=>config.start).map(config=>config.start(serverInterface)));` : ""}
12820
12811
  }
12821
12812
  main().catch(e=>console.error(e));
12822
12813
  `
@@ -13062,7 +13053,7 @@ var auth_default = {
13062
13053
  // editor/server.ts
13063
13054
  var ADMIN_EDITOR_BROWSER_OPEN_KEY = "ADMIN_EDITOR_BROWSER_OPEN_KEY$$";
13064
13055
  var server_default = {
13065
- preload: async (serverInterface, adminInterface) => {
13056
+ preload: (serverInterface, adminInterface) => {
13066
13057
  if (serverInterface?.isPrimaryWorker()) {
13067
13058
  const cache = adminInterface ? adminInterface.getCache() : serverInterface.cache;
13068
13059
  if (!cache.has(ADMIN_EDITOR_AUTH_KEY)) {
@@ -13100,7 +13091,8 @@ var server_default = {
13100
13091
  init_constants();
13101
13092
  async function createEditorRouter(adminInterface) {
13102
13093
  const router = new Router();
13103
- router.use(async (req, res) => {
13094
+ const innerRouter = new Router();
13095
+ innerRouter.use(async (req, res) => {
13104
13096
  res.setHeader("x-uuid", req.uuid);
13105
13097
  req.editor = adminInterface;
13106
13098
  });
@@ -13116,14 +13108,36 @@ async function createEditorRouter(adminInterface) {
13116
13108
  const reloadAPI = (await Promise.resolve().then(() => (init_reload_api(), reload_api_exports))).default;
13117
13109
  const authHandler = SessionHandler(auth_default);
13118
13110
  const { EditorIndex: EditorIndex2 } = await Promise.resolve().then(() => (init_editor_index(), editor_index_exports));
13119
- router.post(`${BASEEDITOR_PATH}/api/fs/write`, getHandler(authHandler, writeAPI));
13120
- router.post(`${BASEEDITOR_PATH}/api/fs/rename`, getHandler(authHandler, renameAPI));
13121
- router.post(`${BASEEDITOR_PATH}/api/fs/read`, getHandler(authHandler, readAPI));
13122
- router.post(`${BASEEDITOR_PATH}/api/fs/delete`, getHandler(authHandler, deleteAPI));
13123
- router.get(`${BASEEDITOR_PATH}/api/fs/scan`, getHandler(authHandler, scanAPI));
13124
- router.post(`${BASEEDITOR_PATH}/api/server/restart`, getHandler(authHandler, restartAPI));
13125
- router.post(`${BASEEDITOR_PATH}/api/server/reload`, getHandler(authHandler, reloadAPI));
13126
- router.get(`${BASEEDITOR_PATH}/font.ttf`, async (_req, res) => {
13111
+ innerRouter.use(authHandler);
13112
+ innerRouter.post(`/api/fs/write`, getHandler(
13113
+ /*authHandler, */
13114
+ writeAPI
13115
+ ));
13116
+ innerRouter.post(`/api/fs/rename`, getHandler(
13117
+ /*authHandler, */
13118
+ renameAPI
13119
+ ));
13120
+ innerRouter.post(`/api/fs/read`, getHandler(
13121
+ /*authHandler, */
13122
+ readAPI
13123
+ ));
13124
+ innerRouter.post(`/api/fs/delete`, getHandler(
13125
+ /*authHandler, */
13126
+ deleteAPI
13127
+ ));
13128
+ innerRouter.get(`/api/fs/scan`, getHandler(
13129
+ /*authHandler, */
13130
+ scanAPI
13131
+ ));
13132
+ innerRouter.post(`/api/server/restart`, getHandler(
13133
+ /*authHandler, */
13134
+ restartAPI
13135
+ ));
13136
+ innerRouter.post(`/api/server/reload`, getHandler(
13137
+ /*authHandler, */
13138
+ reloadAPI
13139
+ ));
13140
+ innerRouter.get(`/font.ttf`, async (_req, res) => {
13127
13141
  return await res.asyncEnd({
13128
13142
  status: 200,
13129
13143
  headers: {
@@ -13132,10 +13146,11 @@ async function createEditorRouter(adminInterface) {
13132
13146
  body: editorFont
13133
13147
  });
13134
13148
  });
13135
- router.get(BASEEDITOR_PATH, [authHandler, EditorIndex2(editorCSS, editorJS, false)]);
13136
- router.use(async (req, res) => {
13149
+ innerRouter.get("/", EditorIndex2(editorCSS, editorJS, false));
13150
+ innerRouter.use(async (req, res) => {
13137
13151
  delete req.editor;
13138
13152
  });
13153
+ router.use(innerRouter, BASEEDITOR_PATH);
13139
13154
  return router;
13140
13155
  }
13141
13156
  function getHandlerOptions(router) {
@@ -13147,11 +13162,11 @@ function getHandlerOptions(router) {
13147
13162
  response: router.response
13148
13163
  };
13149
13164
  }
13150
- function getHandler(auth, router) {
13151
- const ret = new Router();
13152
- ret.use(auth);
13153
- ret.use(router.handler, void 0, void 0, getHandlerOptions(router));
13154
- return ret;
13165
+ function getHandler(router) {
13166
+ return {
13167
+ ...getHandlerOptions(router),
13168
+ handler: router.handler
13169
+ };
13155
13170
  }
13156
13171
 
13157
13172
  // src/common/watch.ts
@@ -13385,7 +13400,7 @@ var ServerInterfaceImpl = class {
13385
13400
  constructor(options) {
13386
13401
  this.cache = options.cache;
13387
13402
  this.localCache = options.localCache;
13388
- this.logger = options.logger;
13403
+ this.logger = options.logger ? options.logger : options.loggerProvider ? options.loggerProvider.getLogger("server") : void 0;
13389
13404
  this.port = options.port;
13390
13405
  const dbManager = options.dbManager;
13391
13406
  const wsManager = options.wsManager;
@@ -13424,6 +13439,12 @@ var ServerInterfaceImpl = class {
13424
13439
  }
13425
13440
  });
13426
13441
  }
13442
+ getWorkerNumber() {
13443
+ return import_node_cluster2.default.isPrimary || process.env["CLUSTER_NODE_NUMBER"] === void 0 ? 0 : parseInt(process.env["CLUSTER_NODE_NUMBER"], 10);
13444
+ }
13445
+ getWorkerCount() {
13446
+ return import_node_cluster2.default.isPrimary || process.env["CLUSTER_NODE_NUMBER"] === void 0 || process.env["CLUSTER_COUNT"] === void 0 ? 1 : parseInt(process.env["CLUSTER_COUNT"], 10);
13447
+ }
13427
13448
  isPrimaryWorker() {
13428
13449
  return import_node_cluster2.default.isPrimary || process.env["CLUSTER_NODE_NUMBER"] === "0";
13429
13450
  }
@@ -14070,14 +14091,6 @@ async function appendAPIModule(router, dir, filePath, module2) {
14070
14091
  });
14071
14092
  /*! Bundled license information:
14072
14093
 
14073
- cookie/index.js:
14074
- (*!
14075
- * cookie
14076
- * Copyright(c) 2012-2014 Roman Shtylman
14077
- * Copyright(c) 2015 Douglas Christopher Wilson
14078
- * MIT Licensed
14079
- *)
14080
-
14081
14094
  showdown/dist/showdown.js:
14082
14095
  (*! showdown v 2.1.0 - 21-04-2022 *)
14083
14096
  */
@@ -1,5 +1,5 @@
1
1
  export const BASEEDITOR_PATH = "/admin/editor";
2
- export const LOG_SOCKET_PATH = "/admin/socket/";
2
+ export const LOG_SOCKET_PATH = "/admin/socket";
3
3
  export const LOG_WRITE_EVENT = "LogWrite";
4
4
 
5
5
  export const SUPPORTED_LANGUAGES = [
@@ -1,6 +1,6 @@
1
1
  @font-face {
2
2
  font-family: 'EditorFont';
3
- src: url('font.ttf');
3
+ src: url('/admin/editor/font.ttf');
4
4
  }
5
5
 
6
6
  * {
package/editor/server.ts CHANGED
@@ -10,7 +10,7 @@ import { EditorAdminInterface } from "./common/admin-interface.js";
10
10
  const ADMIN_EDITOR_BROWSER_OPEN_KEY = "ADMIN_EDITOR_BROWSER_OPEN_KEY$$";
11
11
 
12
12
  export default {
13
- preload: async (serverInterface: ServerInterface, adminInterface: EditorAdminInterface) => {
13
+ preload: (serverInterface: ServerInterface, adminInterface: EditorAdminInterface) => {
14
14
  //console.dir(server);
15
15
  if (serverInterface?.isPrimaryWorker()) {
16
16
  const cache = (adminInterface ? adminInterface.getCache() : serverInterface.cache);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miqro",
3
- "version": "6.0.11",
3
+ "version": "6.0.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/esm/src/lib.js",
@@ -34,23 +34,22 @@
34
34
  "miqro-cluster": "build/esm/src/cluster.js"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/cookie": "^0.6.0",
38
37
  "@types/node": "^22.10.2",
38
+ "@types/showdown": "2.0.6",
39
39
  "postject": "1.0.0-alpha.6",
40
40
  "typescript": "^5.7.2",
41
41
  "highlight.js": "11.11.1"
42
42
  },
43
43
  "dependencies": {
44
- "@miqro/core": "^5.0.13",
44
+ "@miqro/core": "^5.0.14",
45
45
  "@miqro/jsx": "^1.0.0",
46
46
  "@miqro/jsx-dom": "^1.0.3",
47
- "@miqro/jsx-node": "^1.0.4",
47
+ "@miqro/jsx-node": "^1.0.5",
48
48
  "@miqro/parser": "^2.0.4",
49
49
  "@miqro/query": "^0.0.4",
50
50
  "@miqro/runner": "^2.0.1",
51
51
  "@miqro/test": "^0.2.9",
52
52
  "@miqro/test-http": "^0.1.2",
53
- "@types/showdown": "2.0.6",
54
53
  "esbuild": "0.25.4",
55
54
  "showdown": "2.1.0"
56
55
  }