@hot-updater/console 0.1.0 → 0.1.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.
package/dist/index.cjs CHANGED
@@ -43,7 +43,6 @@ __export(src_server_exports, {
43
43
  });
44
44
  module.exports = __toCommonJS(src_server_exports);
45
45
  var import_path = __toESM(require("path"), 1);
46
- var import_url7 = require("url");
47
46
 
48
47
  // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/filepath.js
49
48
  var getFilePath = (options) => {
@@ -2419,8 +2418,6 @@ var rpc = new Hono2().get("/loadConfig", async (c) => {
2419
2418
  );
2420
2419
 
2421
2420
  // src-server/index.ts
2422
- var import_meta = {};
2423
- var __dirname = (0, import_url7.fileURLToPath)(new URL(".", import_meta.url));
2424
2421
  var relativePathToScript = import_path.default.relative(process.cwd(), __dirname);
2425
2422
  var app = new Hono2().get("/ping", (c) => c.text("pong")).route("/rpc", rpc).use(
2426
2423
  "/static/*",
package/dist/index.js CHANGED
@@ -9,9 +9,15 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
 
12
- // src-server/index.ts
13
- import path from "path";
12
+ // ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.13__jiti@1.21.6_postcss@8.4.47_typescript@5.6.2_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js
14
13
  import { fileURLToPath } from "url";
14
+ import path from "path";
15
+ var getFilename = () => fileURLToPath(import.meta.url);
16
+ var getDirname = () => path.dirname(getFilename());
17
+ var __dirname = /* @__PURE__ */ getDirname();
18
+
19
+ // src-server/index.ts
20
+ import path2 from "path";
15
21
 
16
22
  // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/filepath.js
17
23
  var getFilePath = (options) => {
@@ -22,11 +28,11 @@ var getFilePath = (options) => {
22
28
  } else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) {
23
29
  filename = filename.concat("/" + defaultDocument);
24
30
  }
25
- const path2 = getFilePathWithoutDefaultDocument({
31
+ const path3 = getFilePathWithoutDefaultDocument({
26
32
  root: options.root,
27
33
  filename
28
34
  });
29
- return path2;
35
+ return path3;
30
36
  };
31
37
  var getFilePathWithoutDefaultDocument = (options) => {
32
38
  let root = options.root || "";
@@ -37,12 +43,12 @@ var getFilePathWithoutDefaultDocument = (options) => {
37
43
  filename = filename.replace(/^\.?[\/\\]/, "");
38
44
  filename = filename.replace(/\\/, "/");
39
45
  root = root.replace(/\/$/, "");
40
- let path2 = root ? root + "/" + filename : filename;
41
- path2 = path2.replace(/^\.?\//, "");
42
- if (root[0] !== "/" && path2[0] === "/") {
46
+ let path3 = root ? root + "/" + filename : filename;
47
+ path3 = path3.replace(/^\.?\//, "");
48
+ if (root[0] !== "/" && path3[0] === "/") {
43
49
  return;
44
50
  }
45
- return path2;
51
+ return path3;
46
52
  };
47
53
 
48
54
  // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/mime.js
@@ -141,13 +147,13 @@ var createStreamBody = (stream) => {
141
147
  });
142
148
  return body;
143
149
  };
144
- var addCurrentDirPrefix = (path2) => {
145
- return `./${path2}`;
150
+ var addCurrentDirPrefix = (path3) => {
151
+ return `./${path3}`;
146
152
  };
147
- var getStats = (path2) => {
153
+ var getStats = (path3) => {
148
154
  let stats;
149
155
  try {
150
- stats = lstatSync(path2);
156
+ stats = lstatSync(path3);
151
157
  } catch {
152
158
  }
153
159
  return stats;
@@ -164,35 +170,35 @@ var serveStatic = (options = { root: "" }) => {
164
170
  await options.onNotFound?.(c.req.path, c);
165
171
  return next();
166
172
  }
167
- let path2 = getFilePathWithoutDefaultDocument({
173
+ let path3 = getFilePathWithoutDefaultDocument({
168
174
  filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
169
175
  root: options.root
170
176
  });
171
- if (path2) {
172
- path2 = addCurrentDirPrefix(path2);
177
+ if (path3) {
178
+ path3 = addCurrentDirPrefix(path3);
173
179
  } else {
174
180
  return next();
175
181
  }
176
- let stats = getStats(path2);
182
+ let stats = getStats(path3);
177
183
  if (stats && stats.isDirectory()) {
178
- path2 = getFilePath({
184
+ path3 = getFilePath({
179
185
  filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
180
186
  root: options.root,
181
187
  defaultDocument: options.index ?? "index.html"
182
188
  });
183
- if (path2) {
184
- path2 = addCurrentDirPrefix(path2);
189
+ if (path3) {
190
+ path3 = addCurrentDirPrefix(path3);
185
191
  } else {
186
192
  return next();
187
193
  }
188
- stats = getStats(path2);
194
+ stats = getStats(path3);
189
195
  }
190
196
  if (!stats) {
191
- await options.onNotFound?.(path2, c);
197
+ await options.onNotFound?.(path3, c);
192
198
  return next();
193
199
  }
194
- await options.onFound?.(path2, c);
195
- const mimeType = getMimeType(path2);
200
+ await options.onFound?.(path3, c);
201
+ const mimeType = getMimeType(path3);
196
202
  c.header("Content-Type", mimeType || "application/octet-stream");
197
203
  if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
198
204
  const acceptEncodingSet = new Set(
@@ -202,12 +208,12 @@ var serveStatic = (options = { root: "" }) => {
202
208
  if (!acceptEncodingSet.has(encoding)) {
203
209
  continue;
204
210
  }
205
- const precompressedStats = getStats(path2 + ENCODINGS[encoding]);
211
+ const precompressedStats = getStats(path3 + ENCODINGS[encoding]);
206
212
  if (precompressedStats) {
207
213
  c.header("Content-Encoding", encoding);
208
214
  c.header("Vary", "Accept-Encoding", { append: true });
209
215
  stats = precompressedStats;
210
- path2 = path2 + ENCODINGS[encoding];
216
+ path3 = path3 + ENCODINGS[encoding];
211
217
  break;
212
218
  }
213
219
  }
@@ -221,7 +227,7 @@ var serveStatic = (options = { root: "" }) => {
221
227
  const range = c.req.header("range") || "";
222
228
  if (!range) {
223
229
  c.header("Content-Length", size.toString());
224
- return c.body(createStreamBody(createReadStream(path2)), 200);
230
+ return c.body(createStreamBody(createReadStream(path3)), 200);
225
231
  }
226
232
  c.header("Accept-Ranges", "bytes");
227
233
  c.header("Date", stats.birthtime.toUTCString());
@@ -232,7 +238,7 @@ var serveStatic = (options = { root: "" }) => {
232
238
  end = size - 1;
233
239
  }
234
240
  const chunksize = end - start + 1;
235
- const stream = createReadStream(path2, { start, end });
241
+ const stream = createReadStream(path3, { start, end });
236
242
  c.header("Content-Length", chunksize.toString());
237
243
  c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
238
244
  return c.body(createStreamBody(stream), 206);
@@ -305,26 +311,26 @@ var handleParsingNestedValues = (form, key, value) => {
305
311
  };
306
312
 
307
313
  // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/url.js
308
- var splitPath = (path2) => {
309
- const paths = path2.split("/");
314
+ var splitPath = (path3) => {
315
+ const paths = path3.split("/");
310
316
  if (paths[0] === "") {
311
317
  paths.shift();
312
318
  }
313
319
  return paths;
314
320
  };
315
321
  var splitRoutingPath = (routePath) => {
316
- const { groups, path: path2 } = extractGroupsFromPath(routePath);
317
- const paths = splitPath(path2);
322
+ const { groups, path: path3 } = extractGroupsFromPath(routePath);
323
+ const paths = splitPath(path3);
318
324
  return replaceGroupMarks(paths, groups);
319
325
  };
320
- var extractGroupsFromPath = (path2) => {
326
+ var extractGroupsFromPath = (path3) => {
321
327
  const groups = [];
322
- path2 = path2.replace(/\{[^}]+\}/g, (match, index) => {
328
+ path3 = path3.replace(/\{[^}]+\}/g, (match, index) => {
323
329
  const mark = `@${index}`;
324
330
  groups.push([mark, match]);
325
331
  return mark;
326
332
  });
327
- return { groups, path: path2 };
333
+ return { groups, path: path3 };
328
334
  };
329
335
  var replaceGroupMarks = (paths, groups) => {
330
336
  for (let i = groups.length - 1; i >= 0; i--) {
@@ -377,8 +383,8 @@ var getPath = (request) => {
377
383
  const charCode = url.charCodeAt(i);
378
384
  if (charCode === 37) {
379
385
  const queryIndex = url.indexOf("?", i);
380
- const path2 = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
381
- return tryDecodeURI(path2.includes("%25") ? path2.replace(/%25/g, "%2525") : path2);
386
+ const path3 = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
387
+ return tryDecodeURI(path3.includes("%25") ? path3.replace(/%25/g, "%2525") : path3);
382
388
  } else if (charCode === 63) {
383
389
  break;
384
390
  }
@@ -392,30 +398,30 @@ var getPathNoStrict = (request) => {
392
398
  var mergePath = (...paths) => {
393
399
  let p = "";
394
400
  let endsWithSlash = false;
395
- for (let path2 of paths) {
401
+ for (let path3 of paths) {
396
402
  if (p[p.length - 1] === "/") {
397
403
  p = p.slice(0, -1);
398
404
  endsWithSlash = true;
399
405
  }
400
- if (path2[0] !== "/") {
401
- path2 = `/${path2}`;
406
+ if (path3[0] !== "/") {
407
+ path3 = `/${path3}`;
402
408
  }
403
- if (path2 === "/" && endsWithSlash) {
409
+ if (path3 === "/" && endsWithSlash) {
404
410
  p = `${p}/`;
405
- } else if (path2 !== "/") {
406
- p = `${p}${path2}`;
411
+ } else if (path3 !== "/") {
412
+ p = `${p}${path3}`;
407
413
  }
408
- if (path2 === "/" && p === "") {
414
+ if (path3 === "/" && p === "") {
409
415
  p = "/";
410
416
  }
411
417
  }
412
418
  return p;
413
419
  };
414
- var checkOptionalParameter = (path2) => {
415
- if (!path2.match(/\:.+\?$/)) {
420
+ var checkOptionalParameter = (path3) => {
421
+ if (!path3.match(/\:.+\?$/)) {
416
422
  return null;
417
423
  }
418
- const segments = path2.split("/");
424
+ const segments = path3.split("/");
419
425
  const results = [];
420
426
  let basePath = "";
421
427
  segments.forEach((segment) => {
@@ -520,7 +526,7 @@ var decodeURIComponent_ = decodeURIComponent;
520
526
  // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/request.js
521
527
  var _validatedData, _matchResult, _a;
522
528
  var HonoRequest = (_a = class {
523
- constructor(request, path2 = "/", matchResult = [[]]) {
529
+ constructor(request, path3 = "/", matchResult = [[]]) {
524
530
  __publicField(this, "raw");
525
531
  __privateAdd(this, _validatedData);
526
532
  __privateAdd(this, _matchResult);
@@ -545,7 +551,7 @@ var HonoRequest = (_a = class {
545
551
  return bodyCache[key] = raw2[key]();
546
552
  });
547
553
  this.raw = request;
548
- this.path = path2;
554
+ this.path = path3;
549
555
  __privateSet(this, _matchResult, matchResult);
550
556
  __privateSet(this, _validatedData, {});
551
557
  }
@@ -1018,8 +1024,8 @@ var Hono = (_a3 = class {
1018
1024
  return this.fetch(input, Env, executionCtx);
1019
1025
  }
1020
1026
  input = input.toString();
1021
- const path2 = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`;
1022
- const req = new Request(path2, requestInit);
1027
+ const path3 = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`;
1028
+ const req = new Request(path3, requestInit);
1023
1029
  return this.fetch(req, Env, executionCtx);
1024
1030
  });
1025
1031
  __publicField(this, "fire", () => {
@@ -1043,8 +1049,8 @@ var Hono = (_a3 = class {
1043
1049
  return this;
1044
1050
  };
1045
1051
  });
1046
- this.on = (method, path2, ...handlers) => {
1047
- for (const p of [path2].flat()) {
1052
+ this.on = (method, path3, ...handlers) => {
1053
+ for (const p of [path3].flat()) {
1048
1054
  __privateSet(this, _path2, p);
1049
1055
  for (const m of [method].flat()) {
1050
1056
  handlers.map((handler) => {
@@ -1079,8 +1085,8 @@ var Hono = (_a3 = class {
1079
1085
  clone.routes = this.routes;
1080
1086
  return clone;
1081
1087
  }
1082
- route(path2, app2) {
1083
- const subApp = this.basePath(path2);
1088
+ route(path3, app2) {
1089
+ const subApp = this.basePath(path3);
1084
1090
  app2.routes.map((r) => {
1085
1091
  let handler;
1086
1092
  if (app2.errorHandler === errorHandler) {
@@ -1093,12 +1099,12 @@ var Hono = (_a3 = class {
1093
1099
  });
1094
1100
  return this;
1095
1101
  }
1096
- basePath(path2) {
1102
+ basePath(path3) {
1097
1103
  const subApp = this.clone();
1098
- subApp._basePath = mergePath(this._basePath, path2);
1104
+ subApp._basePath = mergePath(this._basePath, path3);
1099
1105
  return subApp;
1100
1106
  }
1101
- mount(path2, applicationHandler, options) {
1107
+ mount(path3, applicationHandler, options) {
1102
1108
  let replaceRequest;
1103
1109
  let optionHandler;
1104
1110
  if (options) {
@@ -1121,7 +1127,7 @@ var Hono = (_a3 = class {
1121
1127
  return [c.env, executionContext];
1122
1128
  };
1123
1129
  replaceRequest || (replaceRequest = (() => {
1124
- const mergedPath = mergePath(this._basePath, path2);
1130
+ const mergedPath = mergePath(this._basePath, path3);
1125
1131
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
1126
1132
  return (request) => {
1127
1133
  const url = new URL(request.url);
@@ -1136,18 +1142,18 @@ var Hono = (_a3 = class {
1136
1142
  }
1137
1143
  await next();
1138
1144
  };
1139
- this.addRoute(METHOD_NAME_ALL, mergePath(path2, "*"), handler);
1145
+ this.addRoute(METHOD_NAME_ALL, mergePath(path3, "*"), handler);
1140
1146
  return this;
1141
1147
  }
1142
- addRoute(method, path2, handler) {
1148
+ addRoute(method, path3, handler) {
1143
1149
  method = method.toUpperCase();
1144
- path2 = mergePath(this._basePath, path2);
1145
- const r = { path: path2, method, handler };
1146
- this.router.add(method, path2, [handler, r]);
1150
+ path3 = mergePath(this._basePath, path3);
1151
+ const r = { path: path3, method, handler };
1152
+ this.router.add(method, path3, [handler, r]);
1147
1153
  this.routes.push(r);
1148
1154
  }
1149
- matchRoute(method, path2) {
1150
- return this.router.match(method, path2);
1155
+ matchRoute(method, path3) {
1156
+ return this.router.match(method, path3);
1151
1157
  }
1152
1158
  handleError(err, c) {
1153
1159
  if (err instanceof Error) {
@@ -1159,10 +1165,10 @@ var Hono = (_a3 = class {
1159
1165
  if (method === "HEAD") {
1160
1166
  return (async () => new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
1161
1167
  }
1162
- const path2 = this.getPath(request, { env });
1163
- const matchResult = this.matchRoute(method, path2);
1168
+ const path3 = this.getPath(request, { env });
1169
+ const matchResult = this.matchRoute(method, path3);
1164
1170
  const c = new Context(request, {
1165
- path: path2,
1171
+ path: path3,
1166
1172
  matchResult,
1167
1173
  env,
1168
1174
  executionCtx,
@@ -1311,12 +1317,12 @@ var Trie = class {
1311
1317
  __publicField(this, "context", { varIndex: 0 });
1312
1318
  __publicField(this, "root", new Node());
1313
1319
  }
1314
- insert(path2, index, pathErrorCheckOnly) {
1320
+ insert(path3, index, pathErrorCheckOnly) {
1315
1321
  const paramAssoc = [];
1316
1322
  const groups = [];
1317
1323
  for (let i = 0; ; ) {
1318
1324
  let replaced = false;
1319
- path2 = path2.replace(/\{[^}]+\}/g, (m) => {
1325
+ path3 = path3.replace(/\{[^}]+\}/g, (m) => {
1320
1326
  const mark = `@\\${i}`;
1321
1327
  groups[i] = [mark, m];
1322
1328
  i++;
@@ -1327,7 +1333,7 @@ var Trie = class {
1327
1333
  break;
1328
1334
  }
1329
1335
  }
1330
- const tokens = path2.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
1336
+ const tokens = path3.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
1331
1337
  for (let i = groups.length - 1; i >= 0; i--) {
1332
1338
  const [mark] = groups[i];
1333
1339
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -1367,9 +1373,9 @@ var Trie = class {
1367
1373
  var emptyParam = [];
1368
1374
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
1369
1375
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
1370
- function buildWildcardRegExp(path2) {
1371
- return wildcardRegExpCache[path2] ?? (wildcardRegExpCache[path2] = new RegExp(
1372
- path2 === "*" ? "" : `^${path2.replace(
1376
+ function buildWildcardRegExp(path3) {
1377
+ return wildcardRegExpCache[path3] ?? (wildcardRegExpCache[path3] = new RegExp(
1378
+ path3 === "*" ? "" : `^${path3.replace(
1373
1379
  /\/\*$|([.\\+*[^\]$()])/g,
1374
1380
  (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
1375
1381
  )}$`
@@ -1391,17 +1397,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
1391
1397
  );
1392
1398
  const staticMap = /* @__PURE__ */ Object.create(null);
1393
1399
  for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
1394
- const [pathErrorCheckOnly, path2, handlers] = routesWithStaticPathFlag[i];
1400
+ const [pathErrorCheckOnly, path3, handlers] = routesWithStaticPathFlag[i];
1395
1401
  if (pathErrorCheckOnly) {
1396
- staticMap[path2] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
1402
+ staticMap[path3] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
1397
1403
  } else {
1398
1404
  j++;
1399
1405
  }
1400
1406
  let paramAssoc;
1401
1407
  try {
1402
- paramAssoc = trie.insert(path2, j, pathErrorCheckOnly);
1408
+ paramAssoc = trie.insert(path3, j, pathErrorCheckOnly);
1403
1409
  } catch (e) {
1404
- throw e === PATH_ERROR ? new UnsupportedPathError(path2) : e;
1410
+ throw e === PATH_ERROR ? new UnsupportedPathError(path3) : e;
1405
1411
  }
1406
1412
  if (pathErrorCheckOnly) {
1407
1413
  continue;
@@ -1435,12 +1441,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
1435
1441
  }
1436
1442
  return [regexp, handlerMap, staticMap];
1437
1443
  }
1438
- function findMiddleware(middleware, path2) {
1444
+ function findMiddleware(middleware, path3) {
1439
1445
  if (!middleware) {
1440
1446
  return void 0;
1441
1447
  }
1442
1448
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
1443
- if (buildWildcardRegExp(k).test(path2)) {
1449
+ if (buildWildcardRegExp(k).test(path3)) {
1444
1450
  return [...middleware[k]];
1445
1451
  }
1446
1452
  }
@@ -1454,7 +1460,7 @@ var RegExpRouter = class {
1454
1460
  this.middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
1455
1461
  this.routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
1456
1462
  }
1457
- add(method, path2, handler) {
1463
+ add(method, path3, handler) {
1458
1464
  var _a4;
1459
1465
  const { middleware, routes } = this;
1460
1466
  if (!middleware || !routes) {
@@ -1469,19 +1475,19 @@ var RegExpRouter = class {
1469
1475
  });
1470
1476
  });
1471
1477
  }
1472
- if (path2 === "/*") {
1473
- path2 = "*";
1478
+ if (path3 === "/*") {
1479
+ path3 = "*";
1474
1480
  }
1475
- const paramCount = (path2.match(/\/:/g) || []).length;
1476
- if (/\*$/.test(path2)) {
1477
- const re = buildWildcardRegExp(path2);
1481
+ const paramCount = (path3.match(/\/:/g) || []).length;
1482
+ if (/\*$/.test(path3)) {
1483
+ const re = buildWildcardRegExp(path3);
1478
1484
  if (method === METHOD_NAME_ALL) {
1479
1485
  Object.keys(middleware).forEach((m) => {
1480
1486
  var _a5;
1481
- (_a5 = middleware[m])[path2] || (_a5[path2] = findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []);
1487
+ (_a5 = middleware[m])[path3] || (_a5[path3] = findMiddleware(middleware[m], path3) || findMiddleware(middleware[METHOD_NAME_ALL], path3) || []);
1482
1488
  });
1483
1489
  } else {
1484
- (_a4 = middleware[method])[path2] || (_a4[path2] = findMiddleware(middleware[method], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []);
1490
+ (_a4 = middleware[method])[path3] || (_a4[path3] = findMiddleware(middleware[method], path3) || findMiddleware(middleware[METHOD_NAME_ALL], path3) || []);
1485
1491
  }
1486
1492
  Object.keys(middleware).forEach((m) => {
1487
1493
  if (method === METHOD_NAME_ALL || method === m) {
@@ -1499,7 +1505,7 @@ var RegExpRouter = class {
1499
1505
  });
1500
1506
  return;
1501
1507
  }
1502
- const paths = checkOptionalParameter(path2) || [path2];
1508
+ const paths = checkOptionalParameter(path3) || [path3];
1503
1509
  for (let i = 0, len = paths.length; i < len; i++) {
1504
1510
  const path22 = paths[i];
1505
1511
  Object.keys(routes).forEach((m) => {
@@ -1513,7 +1519,7 @@ var RegExpRouter = class {
1513
1519
  });
1514
1520
  }
1515
1521
  }
1516
- match(method, path2) {
1522
+ match(method, path3) {
1517
1523
  clearWildcardRegExpCache();
1518
1524
  const matchers = this.buildAllMatchers();
1519
1525
  this.match = (method2, path22) => {
@@ -1529,7 +1535,7 @@ var RegExpRouter = class {
1529
1535
  const index = match.indexOf("", 1);
1530
1536
  return [matcher[1][index], match];
1531
1537
  };
1532
- return this.match(method, path2);
1538
+ return this.match(method, path3);
1533
1539
  }
1534
1540
  buildAllMatchers() {
1535
1541
  const matchers = /* @__PURE__ */ Object.create(null);
@@ -1543,13 +1549,13 @@ var RegExpRouter = class {
1543
1549
  const routes = [];
1544
1550
  let hasOwnRoute = method === METHOD_NAME_ALL;
1545
1551
  [this.middleware, this.routes].forEach((r) => {
1546
- const ownRoute = r[method] ? Object.keys(r[method]).map((path2) => [path2, r[method][path2]]) : [];
1552
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path3) => [path3, r[method][path3]]) : [];
1547
1553
  if (ownRoute.length !== 0) {
1548
1554
  hasOwnRoute || (hasOwnRoute = true);
1549
1555
  routes.push(...ownRoute);
1550
1556
  } else if (method !== METHOD_NAME_ALL) {
1551
1557
  routes.push(
1552
- ...Object.keys(r[METHOD_NAME_ALL]).map((path2) => [path2, r[METHOD_NAME_ALL][path2]])
1558
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path3) => [path3, r[METHOD_NAME_ALL][path3]])
1553
1559
  );
1554
1560
  }
1555
1561
  });
@@ -1569,13 +1575,13 @@ var SmartRouter = class {
1569
1575
  __publicField(this, "routes", []);
1570
1576
  Object.assign(this, init);
1571
1577
  }
1572
- add(method, path2, handler) {
1578
+ add(method, path3, handler) {
1573
1579
  if (!this.routes) {
1574
1580
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
1575
1581
  }
1576
- this.routes.push([method, path2, handler]);
1582
+ this.routes.push([method, path3, handler]);
1577
1583
  }
1578
- match(method, path2) {
1584
+ match(method, path3) {
1579
1585
  if (!this.routes) {
1580
1586
  throw new Error("Fatal error");
1581
1587
  }
@@ -1589,7 +1595,7 @@ var SmartRouter = class {
1589
1595
  routes.forEach((args) => {
1590
1596
  router.add(...args);
1591
1597
  });
1592
- res = router.match(method, path2);
1598
+ res = router.match(method, path3);
1593
1599
  } catch (e) {
1594
1600
  if (e instanceof UnsupportedPathError) {
1595
1601
  continue;
@@ -1634,11 +1640,11 @@ var Node2 = class {
1634
1640
  }
1635
1641
  this.patterns = [];
1636
1642
  }
1637
- insert(method, path2, handler) {
1638
- this.name = `${method} ${path2}`;
1643
+ insert(method, path3, handler) {
1644
+ this.name = `${method} ${path3}`;
1639
1645
  this.order = ++this.order;
1640
1646
  let curNode = this;
1641
- const parts = splitRoutingPath(path2);
1647
+ const parts = splitRoutingPath(path3);
1642
1648
  const possibleKeys = [];
1643
1649
  for (let i = 0, len = parts.length; i < len; i++) {
1644
1650
  const p = parts[i];
@@ -1690,12 +1696,12 @@ var Node2 = class {
1690
1696
  }
1691
1697
  return handlerSets;
1692
1698
  }
1693
- search(method, path2) {
1699
+ search(method, path3) {
1694
1700
  const handlerSets = [];
1695
1701
  this.params = /* @__PURE__ */ Object.create(null);
1696
1702
  const curNode = this;
1697
1703
  let curNodes = [curNode];
1698
- const parts = splitPath(path2);
1704
+ const parts = splitPath(path3);
1699
1705
  for (let i = 0, len = parts.length; i < len; i++) {
1700
1706
  const part = parts[i];
1701
1707
  const isLast = i === len - 1;
@@ -1770,18 +1776,18 @@ var TrieRouter = class {
1770
1776
  __publicField(this, "node");
1771
1777
  this.node = new Node2();
1772
1778
  }
1773
- add(method, path2, handler) {
1774
- const results = checkOptionalParameter(path2);
1779
+ add(method, path3, handler) {
1780
+ const results = checkOptionalParameter(path3);
1775
1781
  if (results) {
1776
1782
  for (const p of results) {
1777
1783
  this.node.insert(method, p, handler);
1778
1784
  }
1779
1785
  return;
1780
1786
  }
1781
- this.node.insert(method, path2, handler);
1787
+ this.node.insert(method, path3, handler);
1782
1788
  }
1783
- match(method, path2) {
1784
- return this.node.search(method, path2);
1789
+ match(method, path3) {
1790
+ return this.node.search(method, path3);
1785
1791
  }
1786
1792
  };
1787
1793
 
@@ -2390,8 +2396,7 @@ var rpc = new Hono2().get("/loadConfig", async (c) => {
2390
2396
  );
2391
2397
 
2392
2398
  // src-server/index.ts
2393
- var __dirname = fileURLToPath(new URL(".", import.meta.url));
2394
- var relativePathToScript = path.relative(process.cwd(), __dirname);
2399
+ var relativePathToScript = path2.relative(process.cwd(), __dirname);
2395
2400
  var app = new Hono2().get("/ping", (c) => c.text("pong")).route("/rpc", rpc).use(
2396
2401
  "/static/*",
2397
2402
  serveStatic({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/console",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "files": [
6
6
  "dist",
7
7
  "package.json"
@@ -46,11 +46,11 @@
46
46
  "@types/node": "^22.8.6"
47
47
  },
48
48
  "dependencies": {
49
- "@hot-updater/plugin-core": "0.1.0",
50
- "@hot-updater/utils": "0.1.0"
49
+ "@hot-updater/plugin-core": "0.1.2",
50
+ "@hot-updater/utils": "0.1.2"
51
51
  },
52
52
  "scripts": {
53
- "build": "rsbuild build && tsup src-server/index.ts --format esm,cjs --dts",
53
+ "build": "rsbuild build && tsup src-server/index.ts --format esm,cjs --dts --shims",
54
54
  "check": "biome check --write",
55
55
  "dev": "rsbuild dev --open",
56
56
  "format": "biome format --write",