miqro 7.3.1 → 7.3.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.
- package/build/esm/src/services/app.js +2 -2
- package/build/lib.cjs +164 -171
- package/package.json +2 -2
|
@@ -366,10 +366,10 @@ export class Miqro {
|
|
|
366
366
|
this.connect();
|
|
367
367
|
await this.dbManager.connectAll();
|
|
368
368
|
this.server = new App({
|
|
369
|
-
onUpgrade: (req, socket, head) => {
|
|
369
|
+
onUpgrade: async (req, socket, head) => {
|
|
370
370
|
try {
|
|
371
371
|
req.server = this.serverInterface;
|
|
372
|
-
return this.webSocketManager.onUpgrade(req, socket, head);
|
|
372
|
+
return await this.webSocketManager.onUpgrade(req, socket, head);
|
|
373
373
|
}
|
|
374
374
|
catch (e) {
|
|
375
375
|
this.logger?.error(e);
|
package/build/lib.cjs
CHANGED
|
@@ -32,165 +32,6 @@ 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/dist/index.js
|
|
36
|
-
var require_dist = __commonJS({
|
|
37
|
-
"node_modules/cookie/dist/index.js"(exports2) {
|
|
38
|
-
"use strict";
|
|
39
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
40
|
-
exports2.parse = parse2;
|
|
41
|
-
exports2.serialize = serialize2;
|
|
42
|
-
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
43
|
-
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
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
|
-
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
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 || decode2;
|
|
59
|
-
let index = 0;
|
|
60
|
-
do {
|
|
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) {
|
|
67
|
-
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
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;
|
|
78
|
-
}
|
|
79
|
-
index = endIdx + 1;
|
|
80
|
-
} while (index < len);
|
|
81
|
-
return obj;
|
|
82
|
-
}
|
|
83
|
-
function startIndex(str, index, max) {
|
|
84
|
-
do {
|
|
85
|
-
const code = str.charCodeAt(index);
|
|
86
|
-
if (code !== 32 && code !== 9)
|
|
87
|
-
return index;
|
|
88
|
-
} while (++index < max);
|
|
89
|
-
return max;
|
|
90
|
-
}
|
|
91
|
-
function endIndex(str, index, min) {
|
|
92
|
-
while (index > min) {
|
|
93
|
-
const code = str.charCodeAt(--index);
|
|
94
|
-
if (code !== 32 && code !== 9)
|
|
95
|
-
return index + 1;
|
|
96
|
-
}
|
|
97
|
-
return min;
|
|
98
|
-
}
|
|
99
|
-
function serialize2(name, val, options) {
|
|
100
|
-
const enc = options?.encode || encodeURIComponent;
|
|
101
|
-
if (!cookieNameRegExp.test(name)) {
|
|
102
|
-
throw new TypeError(`argument name is invalid: ${name}`);
|
|
103
|
-
}
|
|
104
|
-
const value = enc(val);
|
|
105
|
-
if (!cookieValueRegExp.test(value)) {
|
|
106
|
-
throw new TypeError(`argument val is invalid: ${val}`);
|
|
107
|
-
}
|
|
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}`);
|
|
114
|
-
}
|
|
115
|
-
str += "; Max-Age=" + options.maxAge;
|
|
116
|
-
}
|
|
117
|
-
if (options.domain) {
|
|
118
|
-
if (!domainValueRegExp.test(options.domain)) {
|
|
119
|
-
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
120
|
-
}
|
|
121
|
-
str += "; Domain=" + options.domain;
|
|
122
|
-
}
|
|
123
|
-
if (options.path) {
|
|
124
|
-
if (!pathValueRegExp.test(options.path)) {
|
|
125
|
-
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
126
|
-
}
|
|
127
|
-
str += "; Path=" + options.path;
|
|
128
|
-
}
|
|
129
|
-
if (options.expires) {
|
|
130
|
-
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
131
|
-
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
132
|
-
}
|
|
133
|
-
str += "; Expires=" + options.expires.toUTCString();
|
|
134
|
-
}
|
|
135
|
-
if (options.httpOnly) {
|
|
136
|
-
str += "; HttpOnly";
|
|
137
|
-
}
|
|
138
|
-
if (options.secure) {
|
|
139
|
-
str += "; Secure";
|
|
140
|
-
}
|
|
141
|
-
if (options.partitioned) {
|
|
142
|
-
str += "; Partitioned";
|
|
143
|
-
}
|
|
144
|
-
if (options.priority) {
|
|
145
|
-
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
146
|
-
switch (priority) {
|
|
147
|
-
case "low":
|
|
148
|
-
str += "; Priority=Low";
|
|
149
|
-
break;
|
|
150
|
-
case "medium":
|
|
151
|
-
str += "; Priority=Medium";
|
|
152
|
-
break;
|
|
153
|
-
case "high":
|
|
154
|
-
str += "; Priority=High";
|
|
155
|
-
break;
|
|
156
|
-
default:
|
|
157
|
-
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (options.sameSite) {
|
|
161
|
-
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
162
|
-
switch (sameSite) {
|
|
163
|
-
case true:
|
|
164
|
-
case "strict":
|
|
165
|
-
str += "; SameSite=Strict";
|
|
166
|
-
break;
|
|
167
|
-
case "lax":
|
|
168
|
-
str += "; SameSite=Lax";
|
|
169
|
-
break;
|
|
170
|
-
case "none":
|
|
171
|
-
str += "; SameSite=None";
|
|
172
|
-
break;
|
|
173
|
-
default:
|
|
174
|
-
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return str;
|
|
178
|
-
}
|
|
179
|
-
function decode2(str) {
|
|
180
|
-
if (str.indexOf("%") === -1)
|
|
181
|
-
return str;
|
|
182
|
-
try {
|
|
183
|
-
return decodeURIComponent(str);
|
|
184
|
-
} catch (e) {
|
|
185
|
-
return str;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function isDate(val) {
|
|
189
|
-
return __toString.call(val) === "[object Date]";
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
35
|
// node_modules/@miqro/parser/build/built-in-parsers.js
|
|
195
36
|
function newParseOptionsError(baseOption, option, name) {
|
|
196
37
|
return new ParseOptionsError(option.usage ? String(option.usage) : `${name ? `${name} ` : ""}not ${baseOption.type}${option.type === "number" && option.numberMin !== void 0 ? `${option.numberMin}:` : ""}${option.type === "number" && option.numberMax !== void 0 ? `:${option.numberMax}` : ""}${option.numberMinDecimals !== void 0 ? ` min decimals[${option.numberMinDecimals}]` : ""}${option.numberMaxDecimals !== void 0 ? ` max decimals[${option.numberMaxDecimals}]` : ""}${option.type === "string" && option.stringMinLength !== void 0 ? `${option.stringMinLength}:` : ""}${option.type === "string" && option.stringMaxLength !== void 0 ? `:${option.stringMaxLength}` : ""}${option.type === "array" && option.arrayMinLength !== void 0 ? `${option.arrayMinLength}:` : ""}${option.type === "array" && option.arrayMaxLength !== void 0 ? `:${option.arrayMaxLength}` : ""}${option.type === "array" && option.arrayType ? option.arrayType !== "enum" ? ` of ${option.arrayType}` : ` of ${option.arrayType} as defined. valid values [${option.enumValues}]` : ""}${option.type === "enum" ? ` as defined. valid values [${option.enumValues}]` : ""}`, name);
|
|
@@ -688,6 +529,165 @@ var init_lib = __esm({
|
|
|
688
529
|
}
|
|
689
530
|
});
|
|
690
531
|
|
|
532
|
+
// node_modules/cookie/dist/index.js
|
|
533
|
+
var require_dist = __commonJS({
|
|
534
|
+
"node_modules/cookie/dist/index.js"(exports2) {
|
|
535
|
+
"use strict";
|
|
536
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
537
|
+
exports2.parse = parse2;
|
|
538
|
+
exports2.serialize = serialize2;
|
|
539
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
540
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
541
|
+
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;
|
|
542
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
543
|
+
var __toString = Object.prototype.toString;
|
|
544
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
545
|
+
const C = function() {
|
|
546
|
+
};
|
|
547
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
548
|
+
return C;
|
|
549
|
+
})();
|
|
550
|
+
function parse2(str, options) {
|
|
551
|
+
const obj = new NullObject();
|
|
552
|
+
const len = str.length;
|
|
553
|
+
if (len < 2)
|
|
554
|
+
return obj;
|
|
555
|
+
const dec = options?.decode || decode2;
|
|
556
|
+
let index = 0;
|
|
557
|
+
do {
|
|
558
|
+
const eqIdx = str.indexOf("=", index);
|
|
559
|
+
if (eqIdx === -1)
|
|
560
|
+
break;
|
|
561
|
+
const colonIdx = str.indexOf(";", index);
|
|
562
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
563
|
+
if (eqIdx > endIdx) {
|
|
564
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
568
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
569
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
570
|
+
if (obj[key] === void 0) {
|
|
571
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
572
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
573
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
574
|
+
obj[key] = value;
|
|
575
|
+
}
|
|
576
|
+
index = endIdx + 1;
|
|
577
|
+
} while (index < len);
|
|
578
|
+
return obj;
|
|
579
|
+
}
|
|
580
|
+
function startIndex(str, index, max) {
|
|
581
|
+
do {
|
|
582
|
+
const code = str.charCodeAt(index);
|
|
583
|
+
if (code !== 32 && code !== 9)
|
|
584
|
+
return index;
|
|
585
|
+
} while (++index < max);
|
|
586
|
+
return max;
|
|
587
|
+
}
|
|
588
|
+
function endIndex(str, index, min) {
|
|
589
|
+
while (index > min) {
|
|
590
|
+
const code = str.charCodeAt(--index);
|
|
591
|
+
if (code !== 32 && code !== 9)
|
|
592
|
+
return index + 1;
|
|
593
|
+
}
|
|
594
|
+
return min;
|
|
595
|
+
}
|
|
596
|
+
function serialize2(name, val, options) {
|
|
597
|
+
const enc = options?.encode || encodeURIComponent;
|
|
598
|
+
if (!cookieNameRegExp.test(name)) {
|
|
599
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
600
|
+
}
|
|
601
|
+
const value = enc(val);
|
|
602
|
+
if (!cookieValueRegExp.test(value)) {
|
|
603
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
604
|
+
}
|
|
605
|
+
let str = name + "=" + value;
|
|
606
|
+
if (!options)
|
|
607
|
+
return str;
|
|
608
|
+
if (options.maxAge !== void 0) {
|
|
609
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
610
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
611
|
+
}
|
|
612
|
+
str += "; Max-Age=" + options.maxAge;
|
|
613
|
+
}
|
|
614
|
+
if (options.domain) {
|
|
615
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
616
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
617
|
+
}
|
|
618
|
+
str += "; Domain=" + options.domain;
|
|
619
|
+
}
|
|
620
|
+
if (options.path) {
|
|
621
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
622
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
623
|
+
}
|
|
624
|
+
str += "; Path=" + options.path;
|
|
625
|
+
}
|
|
626
|
+
if (options.expires) {
|
|
627
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
628
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
629
|
+
}
|
|
630
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
631
|
+
}
|
|
632
|
+
if (options.httpOnly) {
|
|
633
|
+
str += "; HttpOnly";
|
|
634
|
+
}
|
|
635
|
+
if (options.secure) {
|
|
636
|
+
str += "; Secure";
|
|
637
|
+
}
|
|
638
|
+
if (options.partitioned) {
|
|
639
|
+
str += "; Partitioned";
|
|
640
|
+
}
|
|
641
|
+
if (options.priority) {
|
|
642
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
643
|
+
switch (priority) {
|
|
644
|
+
case "low":
|
|
645
|
+
str += "; Priority=Low";
|
|
646
|
+
break;
|
|
647
|
+
case "medium":
|
|
648
|
+
str += "; Priority=Medium";
|
|
649
|
+
break;
|
|
650
|
+
case "high":
|
|
651
|
+
str += "; Priority=High";
|
|
652
|
+
break;
|
|
653
|
+
default:
|
|
654
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (options.sameSite) {
|
|
658
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
659
|
+
switch (sameSite) {
|
|
660
|
+
case true:
|
|
661
|
+
case "strict":
|
|
662
|
+
str += "; SameSite=Strict";
|
|
663
|
+
break;
|
|
664
|
+
case "lax":
|
|
665
|
+
str += "; SameSite=Lax";
|
|
666
|
+
break;
|
|
667
|
+
case "none":
|
|
668
|
+
str += "; SameSite=None";
|
|
669
|
+
break;
|
|
670
|
+
default:
|
|
671
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return str;
|
|
675
|
+
}
|
|
676
|
+
function decode2(str) {
|
|
677
|
+
if (str.indexOf("%") === -1)
|
|
678
|
+
return str;
|
|
679
|
+
try {
|
|
680
|
+
return decodeURIComponent(str);
|
|
681
|
+
} catch (e) {
|
|
682
|
+
return str;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function isDate(val) {
|
|
686
|
+
return __toString.call(val) === "[object Date]";
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
|
|
691
691
|
// node_modules/@miqro/core/build/middleware/body-parser.js
|
|
692
692
|
function ReadBuffer(options) {
|
|
693
693
|
let limit = DEFAULT_READ_BUFFER_LIMIT;
|
|
@@ -8785,7 +8785,7 @@ var SSRAttributeMap = class extends Map {
|
|
|
8785
8785
|
kIterator = keys.next();
|
|
8786
8786
|
}
|
|
8787
8787
|
if (this.node.value) {
|
|
8788
|
-
ret = `${ret} ${AttributeEncode("value")}="${this.node.value}"`;
|
|
8788
|
+
ret = `${ret} ${AttributeEncode("value")}="${AttributeEncode(String(this.node.value))}"`;
|
|
8789
8789
|
}
|
|
8790
8790
|
return ret;
|
|
8791
8791
|
}
|
|
@@ -8934,7 +8934,7 @@ function HTMLEncode(str) {
|
|
|
8934
8934
|
return aRet.join("");
|
|
8935
8935
|
}
|
|
8936
8936
|
function AttributeEncode(str) {
|
|
8937
|
-
return str.replaceAll('"', """);
|
|
8937
|
+
return str.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
8938
8938
|
}
|
|
8939
8939
|
var containerMap = /* @__PURE__ */ new WeakMap();
|
|
8940
8940
|
var originalChildNodesMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -9025,7 +9025,7 @@ function createNodeRuntime(options) {
|
|
|
9025
9025
|
basePath: options?.basePath
|
|
9026
9026
|
};
|
|
9027
9027
|
const customElementMap = {};
|
|
9028
|
-
const elementByIdMap =
|
|
9028
|
+
const elementByIdMap = /* @__PURE__ */ Object.create(null);
|
|
9029
9029
|
const runtime = {
|
|
9030
9030
|
name: "node",
|
|
9031
9031
|
customElementMap,
|
|
@@ -9086,13 +9086,6 @@ function createNodeRuntime(options) {
|
|
|
9086
9086
|
return runtime;
|
|
9087
9087
|
}
|
|
9088
9088
|
|
|
9089
|
-
// node_modules/@miqro/jsx-node/build/esm/handler.js
|
|
9090
|
-
init_lib3();
|
|
9091
|
-
|
|
9092
|
-
// node_modules/@miqro/jsx-node/build/esm/constants.js
|
|
9093
|
-
var import_os = require("os");
|
|
9094
|
-
var DEFAULT_BUILD_DIR = (0, import_os.tmpdir)();
|
|
9095
|
-
|
|
9096
9089
|
// src/common/jsx.ts
|
|
9097
9090
|
var import_node_path6 = require("node:path");
|
|
9098
9091
|
var import_node_crypto4 = require("node:crypto");
|
|
@@ -17697,10 +17690,10 @@ var Miqro = class _Miqro {
|
|
|
17697
17690
|
this.connect();
|
|
17698
17691
|
await this.dbManager.connectAll();
|
|
17699
17692
|
this.server = new App({
|
|
17700
|
-
onUpgrade: (req, socket, head) => {
|
|
17693
|
+
onUpgrade: async (req, socket, head) => {
|
|
17701
17694
|
try {
|
|
17702
17695
|
req.server = this.serverInterface;
|
|
17703
|
-
return this.webSocketManager.onUpgrade(req, socket, head);
|
|
17696
|
+
return await this.webSocketManager.onUpgrade(req, socket, head);
|
|
17704
17697
|
} catch (e) {
|
|
17705
17698
|
this.logger?.error(e);
|
|
17706
17699
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miqro",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/esm/src/lib.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@miqro/core": "^5.1.1",
|
|
45
45
|
"@miqro/jsx": "^1.0.2",
|
|
46
46
|
"@miqro/jsx-dom": "^1.0.6",
|
|
47
|
-
"@miqro/jsx-node": "^1.0.
|
|
47
|
+
"@miqro/jsx-node": "^1.0.9",
|
|
48
48
|
"@miqro/parser": "^2.0.6",
|
|
49
49
|
"@miqro/query": "^0.0.8",
|
|
50
50
|
"@miqro/runner": "^2.0.3",
|