@hot-updater/console 0.16.3 → 0.16.4
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 +45 -54
- package/dist/index.js +40 -51
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -63,7 +63,7 @@ var __webpack_exports__ = {};
|
|
|
63
63
|
(()=>{
|
|
64
64
|
__webpack_require__.r(__webpack_exports__);
|
|
65
65
|
__webpack_require__.d(__webpack_exports__, {
|
|
66
|
-
default: ()=>
|
|
66
|
+
default: ()=>src_server
|
|
67
67
|
});
|
|
68
68
|
const external_path_namespaceObject = require("path");
|
|
69
69
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
@@ -297,13 +297,12 @@ var __webpack_exports__ = {};
|
|
|
297
297
|
return form;
|
|
298
298
|
}
|
|
299
299
|
var handleParsingAllValues = (form, key, value)=>{
|
|
300
|
-
if (void 0 !== form[key])
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
} else form[key] = value;
|
|
300
|
+
if (void 0 !== form[key]) if (Array.isArray(form[key])) form[key].push(value);
|
|
301
|
+
else form[key] = [
|
|
302
|
+
form[key],
|
|
303
|
+
value
|
|
304
|
+
];
|
|
305
|
+
else form[key] = value;
|
|
307
306
|
};
|
|
308
307
|
var handleParsingNestedValues = (form, key, value)=>{
|
|
309
308
|
let nestedForm = form;
|
|
@@ -356,18 +355,16 @@ var __webpack_exports__ = {};
|
|
|
356
355
|
if ("*" === label) return "*";
|
|
357
356
|
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
358
357
|
if (match) {
|
|
359
|
-
if (!patternCache[label])
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
];
|
|
370
|
-
}
|
|
358
|
+
if (!patternCache[label]) if (match[2]) patternCache[label] = [
|
|
359
|
+
label,
|
|
360
|
+
match[1],
|
|
361
|
+
new RegExp("^" + match[2] + "$")
|
|
362
|
+
];
|
|
363
|
+
else patternCache[label] = [
|
|
364
|
+
label,
|
|
365
|
+
match[1],
|
|
366
|
+
true
|
|
367
|
+
];
|
|
371
368
|
return patternCache[label];
|
|
372
369
|
}
|
|
373
370
|
return null;
|
|
@@ -426,15 +423,13 @@ var __webpack_exports__ = {};
|
|
|
426
423
|
let basePath = "";
|
|
427
424
|
segments.forEach((segment)=>{
|
|
428
425
|
if ("" === segment || /\:/.test(segment)) {
|
|
429
|
-
if (/\:/.test(segment)) {
|
|
430
|
-
if (
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
} else basePath += "/" + segment;
|
|
437
|
-
}
|
|
426
|
+
if (/\:/.test(segment)) if (/\?/.test(segment)) {
|
|
427
|
+
if (0 === results.length && "" === basePath) results.push("/");
|
|
428
|
+
else results.push(basePath);
|
|
429
|
+
const optionalSegment = segment.replace("?", "");
|
|
430
|
+
basePath += "/" + optionalSegment;
|
|
431
|
+
results.push(basePath);
|
|
432
|
+
} else basePath += "/" + segment;
|
|
438
433
|
} else basePath += "/" + segment;
|
|
439
434
|
});
|
|
440
435
|
return results.filter((v, i, a)=>a.indexOf(v) === i);
|
|
@@ -670,13 +665,11 @@ var __webpack_exports__ = {};
|
|
|
670
665
|
set res(_res) {
|
|
671
666
|
this.#isFresh = false;
|
|
672
667
|
if (this.#res && _res) try {
|
|
673
|
-
for (const [k, v] of this.#res.headers.entries())if ("content-type" !== k) {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
} else _res.headers.set(k, v);
|
|
679
|
-
}
|
|
668
|
+
for (const [k, v] of this.#res.headers.entries())if ("content-type" !== k) if ("set-cookie" === k) {
|
|
669
|
+
const cookies = this.#res.headers.getSetCookie();
|
|
670
|
+
_res.headers.delete("set-cookie");
|
|
671
|
+
for (const cookie of cookies)_res.headers.append("set-cookie", cookie);
|
|
672
|
+
} else _res.headers.set(k, v);
|
|
680
673
|
} catch (e) {
|
|
681
674
|
if (e instanceof TypeError && e.message.includes("immutable")) {
|
|
682
675
|
this.res = new Response(_res.body, {
|
|
@@ -718,10 +711,8 @@ var __webpack_exports__ = {};
|
|
|
718
711
|
this.#preparedHeaders ??= {};
|
|
719
712
|
this.#preparedHeaders[name.toLowerCase()] = value;
|
|
720
713
|
}
|
|
721
|
-
if (this.finalized)
|
|
722
|
-
|
|
723
|
-
else this.res.headers.set(name, value);
|
|
724
|
-
}
|
|
714
|
+
if (this.finalized) if (options?.append) this.res.headers.append(name, value);
|
|
715
|
+
else this.res.headers.set(name, value);
|
|
725
716
|
};
|
|
726
717
|
status = (status)=>{
|
|
727
718
|
this.#isFresh = false;
|
|
@@ -950,12 +941,10 @@ var __webpack_exports__ = {};
|
|
|
950
941
|
mount(path, applicationHandler, options) {
|
|
951
942
|
let replaceRequest;
|
|
952
943
|
let optionHandler;
|
|
953
|
-
if (options)
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
replaceRequest = options.replaceRequest;
|
|
958
|
-
}
|
|
944
|
+
if (options) if ("function" == typeof options) optionHandler = options;
|
|
945
|
+
else {
|
|
946
|
+
optionHandler = options.optionHandler;
|
|
947
|
+
replaceRequest = options.replaceRequest;
|
|
959
948
|
}
|
|
960
949
|
const getOptions = optionHandler ? (c)=>{
|
|
961
950
|
const options2 = optionHandler(c);
|
|
@@ -1953,7 +1942,7 @@ var __webpack_exports__ = {};
|
|
|
1953
1942
|
try {
|
|
1954
1943
|
const config = await (0, plugin_core_namespaceObject.loadConfig)(null);
|
|
1955
1944
|
const databasePlugin = await config?.database({
|
|
1956
|
-
cwd: plugin_core_namespaceObject.getCwd()
|
|
1945
|
+
cwd: (0, plugin_core_namespaceObject.getCwd)()
|
|
1957
1946
|
}) ?? null;
|
|
1958
1947
|
if (!databasePlugin) throw new Error("Database plugin initialization failed");
|
|
1959
1948
|
return {
|
|
@@ -2046,18 +2035,20 @@ var __webpack_exports__ = {};
|
|
|
2046
2035
|
}, 500);
|
|
2047
2036
|
}
|
|
2048
2037
|
});
|
|
2049
|
-
const
|
|
2050
|
-
const relativePathToScript = external_path_default().relative(process.cwd(),
|
|
2051
|
-
const
|
|
2038
|
+
const src_server_dirname = external_path_default().dirname((0, external_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__));
|
|
2039
|
+
const relativePathToScript = external_path_default().relative(process.cwd(), src_server_dirname);
|
|
2040
|
+
const src_server_app = new hono_Hono().get("/ping", (c)=>c.text("pong")).route("/rpc", rpc).use("/assets/*", serveStatic({
|
|
2052
2041
|
root: relativePathToScript
|
|
2053
2042
|
})).get("*", serveStatic({
|
|
2054
2043
|
root: relativePathToScript,
|
|
2055
2044
|
path: "index.html"
|
|
2056
2045
|
}));
|
|
2057
|
-
const
|
|
2046
|
+
const src_server = src_server_app;
|
|
2058
2047
|
})();
|
|
2059
|
-
|
|
2060
|
-
for(var __webpack_i__ in __webpack_exports__)
|
|
2061
|
-
|
|
2048
|
+
exports["default"] = __webpack_exports__["default"];
|
|
2049
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
2050
|
+
"default"
|
|
2051
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
2052
|
+
Object.defineProperty(exports, '__esModule', {
|
|
2062
2053
|
value: true
|
|
2063
2054
|
});
|
package/dist/index.js
CHANGED
|
@@ -259,13 +259,12 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
259
259
|
return form;
|
|
260
260
|
}
|
|
261
261
|
var handleParsingAllValues = (form, key, value)=>{
|
|
262
|
-
if (void 0 !== form[key])
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
} else form[key] = value;
|
|
262
|
+
if (void 0 !== form[key]) if (Array.isArray(form[key])) form[key].push(value);
|
|
263
|
+
else form[key] = [
|
|
264
|
+
form[key],
|
|
265
|
+
value
|
|
266
|
+
];
|
|
267
|
+
else form[key] = value;
|
|
269
268
|
};
|
|
270
269
|
var handleParsingNestedValues = (form, key, value)=>{
|
|
271
270
|
let nestedForm = form;
|
|
@@ -318,18 +317,16 @@ var getPattern = (label)=>{
|
|
|
318
317
|
if ("*" === label) return "*";
|
|
319
318
|
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
320
319
|
if (match) {
|
|
321
|
-
if (!patternCache[label])
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
];
|
|
332
|
-
}
|
|
320
|
+
if (!patternCache[label]) if (match[2]) patternCache[label] = [
|
|
321
|
+
label,
|
|
322
|
+
match[1],
|
|
323
|
+
new RegExp("^" + match[2] + "$")
|
|
324
|
+
];
|
|
325
|
+
else patternCache[label] = [
|
|
326
|
+
label,
|
|
327
|
+
match[1],
|
|
328
|
+
true
|
|
329
|
+
];
|
|
333
330
|
return patternCache[label];
|
|
334
331
|
}
|
|
335
332
|
return null;
|
|
@@ -388,15 +385,13 @@ var checkOptionalParameter = (path)=>{
|
|
|
388
385
|
let basePath = "";
|
|
389
386
|
segments.forEach((segment)=>{
|
|
390
387
|
if ("" === segment || /\:/.test(segment)) {
|
|
391
|
-
if (/\:/.test(segment)) {
|
|
392
|
-
if (
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
} else basePath += "/" + segment;
|
|
399
|
-
}
|
|
388
|
+
if (/\:/.test(segment)) if (/\?/.test(segment)) {
|
|
389
|
+
if (0 === results.length && "" === basePath) results.push("/");
|
|
390
|
+
else results.push(basePath);
|
|
391
|
+
const optionalSegment = segment.replace("?", "");
|
|
392
|
+
basePath += "/" + optionalSegment;
|
|
393
|
+
results.push(basePath);
|
|
394
|
+
} else basePath += "/" + segment;
|
|
400
395
|
} else basePath += "/" + segment;
|
|
401
396
|
});
|
|
402
397
|
return results.filter((v, i, a)=>a.indexOf(v) === i);
|
|
@@ -632,13 +627,11 @@ var Context = class {
|
|
|
632
627
|
set res(_res) {
|
|
633
628
|
this.#isFresh = false;
|
|
634
629
|
if (this.#res && _res) try {
|
|
635
|
-
for (const [k, v] of this.#res.headers.entries())if ("content-type" !== k) {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
} else _res.headers.set(k, v);
|
|
641
|
-
}
|
|
630
|
+
for (const [k, v] of this.#res.headers.entries())if ("content-type" !== k) if ("set-cookie" === k) {
|
|
631
|
+
const cookies = this.#res.headers.getSetCookie();
|
|
632
|
+
_res.headers.delete("set-cookie");
|
|
633
|
+
for (const cookie of cookies)_res.headers.append("set-cookie", cookie);
|
|
634
|
+
} else _res.headers.set(k, v);
|
|
642
635
|
} catch (e) {
|
|
643
636
|
if (e instanceof TypeError && e.message.includes("immutable")) {
|
|
644
637
|
this.res = new Response(_res.body, {
|
|
@@ -680,10 +673,8 @@ var Context = class {
|
|
|
680
673
|
this.#preparedHeaders ??= {};
|
|
681
674
|
this.#preparedHeaders[name.toLowerCase()] = value;
|
|
682
675
|
}
|
|
683
|
-
if (this.finalized)
|
|
684
|
-
|
|
685
|
-
else this.res.headers.set(name, value);
|
|
686
|
-
}
|
|
676
|
+
if (this.finalized) if (options?.append) this.res.headers.append(name, value);
|
|
677
|
+
else this.res.headers.set(name, value);
|
|
687
678
|
};
|
|
688
679
|
status = (status)=>{
|
|
689
680
|
this.#isFresh = false;
|
|
@@ -912,12 +903,10 @@ var Hono = class {
|
|
|
912
903
|
mount(path, applicationHandler, options) {
|
|
913
904
|
let replaceRequest;
|
|
914
905
|
let optionHandler;
|
|
915
|
-
if (options)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
replaceRequest = options.replaceRequest;
|
|
920
|
-
}
|
|
906
|
+
if (options) if ("function" == typeof options) optionHandler = options;
|
|
907
|
+
else {
|
|
908
|
+
optionHandler = options.optionHandler;
|
|
909
|
+
replaceRequest = options.replaceRequest;
|
|
921
910
|
}
|
|
922
911
|
const getOptions = optionHandler ? (c)=>{
|
|
923
912
|
const options2 = optionHandler(c);
|
|
@@ -1914,7 +1903,7 @@ const prepareConfig = async ()=>{
|
|
|
1914
1903
|
try {
|
|
1915
1904
|
const config = await (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.loadConfig)(null);
|
|
1916
1905
|
const databasePlugin = await config?.database({
|
|
1917
|
-
cwd: __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd()
|
|
1906
|
+
cwd: (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd)()
|
|
1918
1907
|
}) ?? null;
|
|
1919
1908
|
if (!databasePlugin) throw new Error("Database plugin initialization failed");
|
|
1920
1909
|
return {
|
|
@@ -2007,13 +1996,13 @@ const rpc = new hono_Hono().get("/config", async (c)=>{
|
|
|
2007
1996
|
}, 500);
|
|
2008
1997
|
}
|
|
2009
1998
|
});
|
|
2010
|
-
const
|
|
2011
|
-
const relativePathToScript = __WEBPACK_EXTERNAL_MODULE_path__["default"].relative(process.cwd(),
|
|
2012
|
-
const
|
|
1999
|
+
const src_server_dirname = __WEBPACK_EXTERNAL_MODULE_path__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url));
|
|
2000
|
+
const relativePathToScript = __WEBPACK_EXTERNAL_MODULE_path__["default"].relative(process.cwd(), src_server_dirname);
|
|
2001
|
+
const src_server_app = new hono_Hono().get("/ping", (c)=>c.text("pong")).route("/rpc", rpc).use("/assets/*", serveStatic({
|
|
2013
2002
|
root: relativePathToScript
|
|
2014
2003
|
})).get("*", serveStatic({
|
|
2015
2004
|
root: relativePathToScript,
|
|
2016
2005
|
path: "index.html"
|
|
2017
2006
|
}));
|
|
2018
|
-
const
|
|
2019
|
-
export {
|
|
2007
|
+
const src_server = src_server_app;
|
|
2008
|
+
export { src_server as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/console",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.4",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"package.json"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@hono/node-server": "^1.13.4",
|
|
22
22
|
"@hono/typia-validator": "^0.1.2",
|
|
23
23
|
"@hono/vite-dev-server": "^0.18.1",
|
|
24
|
-
"@hot-updater/mock": "0.16.
|
|
24
|
+
"@hot-updater/mock": "0.16.4",
|
|
25
25
|
"@kobalte/core": "^0.13.7",
|
|
26
26
|
"@ryoppippi/unplugin-typia": "^2.0.3",
|
|
27
27
|
"@solidjs/meta": "^0.29.4",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"vite-tsconfig-paths": "^5.1.4"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@hot-updater/core": "0.16.
|
|
55
|
-
"@hot-updater/plugin-core": "0.16.
|
|
54
|
+
"@hot-updater/core": "0.16.4",
|
|
55
|
+
"@hot-updater/plugin-core": "0.16.4"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "vite build --mode client && rslib build",
|