miqro 8.0.1 → 8.0.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/common/exit.js +22 -39
- package/build/lib.cjs +175 -82
- package/package.json +2 -2
package/build/esm/common/exit.js
CHANGED
|
@@ -10,22 +10,23 @@ function cleanJSX(app) {
|
|
|
10
10
|
unlinkSync(getESBuildBinaryPath());
|
|
11
11
|
}
|
|
12
12
|
if (CLEAR_JSX_CACHE) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
try {
|
|
14
|
+
const buildParendDir = resolve(JSX_TMP_DIR, String(process.pid));
|
|
15
|
+
app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
|
|
16
|
+
const buildDir = resolve(buildParendDir, "build");
|
|
17
|
+
const importDir = resolve(buildParendDir, "import");
|
|
18
|
+
if (existsSync(buildDir)) {
|
|
19
|
+
rmdirSync(buildDir);
|
|
20
|
+
}
|
|
21
|
+
if (existsSync(importDir)) {
|
|
22
|
+
rmdirSync(importDir);
|
|
23
|
+
}
|
|
24
|
+
if (existsSync(buildParendDir)) {
|
|
25
|
+
rmdirSync(buildParendDir);
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
catch (e) {
|
|
29
|
+
app.logger?.error(e);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -35,14 +36,8 @@ export function setupExitHandlers(app) {
|
|
|
35
36
|
app.logger?.error('Caught exception: ' + err);
|
|
36
37
|
app.logger?.error(err);
|
|
37
38
|
exceptionOccured = true;
|
|
38
|
-
/*if (app.server) {
|
|
39
|
-
notifiyServerConfigSync(app, "unload");
|
|
40
|
-
notifiyServerConfigSync(app, "stop");
|
|
41
|
-
app.webSocketManager.disconnectAll();
|
|
42
|
-
app.dbManager.closeAll();
|
|
43
|
-
}*/
|
|
44
39
|
cleanJSX(app);
|
|
45
|
-
if (app.
|
|
40
|
+
if (app.status === "started") {
|
|
46
41
|
await app.stop();
|
|
47
42
|
}
|
|
48
43
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
@@ -52,14 +47,8 @@ export function setupExitHandlers(app) {
|
|
|
52
47
|
app.logger?.error('Exception occured');
|
|
53
48
|
}
|
|
54
49
|
else {
|
|
55
|
-
/*if (app.server) {
|
|
56
|
-
notifiyServerConfigSync(app, "unload");
|
|
57
|
-
notifiyServerConfigSync(app, "stop");
|
|
58
|
-
app.webSocketManager.disconnectAll();
|
|
59
|
-
app.dbManager.closeAll();
|
|
60
|
-
}*/
|
|
61
50
|
cleanJSX(app);
|
|
62
|
-
if (app.
|
|
51
|
+
if (app.status === "started") {
|
|
63
52
|
app.stop();
|
|
64
53
|
}
|
|
65
54
|
}
|
|
@@ -68,21 +57,15 @@ export function setupExitHandlers(app) {
|
|
|
68
57
|
app.logger?.error('Unhandled rejection:');
|
|
69
58
|
app.logger?.error(reason);
|
|
70
59
|
exceptionOccured = true;
|
|
71
|
-
/*if (app.server) {
|
|
72
|
-
notifiyServerConfigSync(app, "unload");
|
|
73
|
-
notifiyServerConfigSync(app, "stop");
|
|
74
|
-
app.webSocketManager.disconnectAll();
|
|
75
|
-
app.dbManager.closeAll();
|
|
76
|
-
}*/
|
|
77
60
|
cleanJSX(app);
|
|
78
|
-
if (app.
|
|
61
|
+
if (app.status === "started") {
|
|
79
62
|
await app.stop();
|
|
80
63
|
}
|
|
81
64
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
82
65
|
});
|
|
83
66
|
process.on("SIGTERM", async function () {
|
|
84
67
|
app.logger?.info('SIGTERM received');
|
|
85
|
-
if (app.
|
|
68
|
+
if (app.status === "started") {
|
|
86
69
|
await Promise.race([
|
|
87
70
|
app.stop(),
|
|
88
71
|
new Promise(r => setTimeout(r, 5000))
|
|
@@ -92,7 +75,7 @@ export function setupExitHandlers(app) {
|
|
|
92
75
|
});
|
|
93
76
|
process.on('SIGHUP', async function () {
|
|
94
77
|
app.logger?.info('SIGHUP received');
|
|
95
|
-
if (app.
|
|
78
|
+
if (app.status === "started") {
|
|
96
79
|
await Promise.race([
|
|
97
80
|
app.stop(),
|
|
98
81
|
new Promise(r => setTimeout(r, 5000))
|
|
@@ -106,7 +89,7 @@ export function setupExitHandlers(app) {
|
|
|
106
89
|
});*/
|
|
107
90
|
process.on('SIGINT', async function () {
|
|
108
91
|
app.logger?.info('SIGINT received');
|
|
109
|
-
if (app.
|
|
92
|
+
if (app.status === "started") {
|
|
110
93
|
await Promise.race([
|
|
111
94
|
app.stop(),
|
|
112
95
|
new Promise(r => setTimeout(r, 5000))
|
package/build/lib.cjs
CHANGED
|
@@ -34,12 +34,19 @@ var require_dist = __commonJS({
|
|
|
34
34
|
"node_modules/cookie/dist/index.js"(exports2) {
|
|
35
35
|
"use strict";
|
|
36
36
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
37
|
-
exports2.
|
|
38
|
-
exports2.
|
|
37
|
+
exports2.parseCookie = parseCookie;
|
|
38
|
+
exports2.parse = parseCookie;
|
|
39
|
+
exports2.stringifyCookie = stringifyCookie;
|
|
40
|
+
exports2.stringifySetCookie = stringifySetCookie;
|
|
41
|
+
exports2.serialize = stringifySetCookie;
|
|
42
|
+
exports2.parseSetCookie = parseSetCookie;
|
|
43
|
+
exports2.stringifySetCookie = stringifySetCookie;
|
|
44
|
+
exports2.serialize = stringifySetCookie;
|
|
39
45
|
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
40
46
|
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
41
47
|
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;
|
|
42
48
|
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
49
|
+
var maxAgeRegExp = /^-?\d+$/;
|
|
43
50
|
var __toString = Object.prototype.toString;
|
|
44
51
|
var NullObject = /* @__PURE__ */ (() => {
|
|
45
52
|
const C = function() {
|
|
@@ -47,7 +54,7 @@ var require_dist = __commonJS({
|
|
|
47
54
|
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
48
55
|
return C;
|
|
49
56
|
})();
|
|
50
|
-
function
|
|
57
|
+
function parseCookie(str, options) {
|
|
51
58
|
const obj = new NullObject();
|
|
52
59
|
const len = str.length;
|
|
53
60
|
if (len < 2)
|
|
@@ -55,91 +62,87 @@ var require_dist = __commonJS({
|
|
|
55
62
|
const dec = options?.decode || decode2;
|
|
56
63
|
let index = 0;
|
|
57
64
|
do {
|
|
58
|
-
const eqIdx = str
|
|
65
|
+
const eqIdx = eqIndex(str, index, len);
|
|
59
66
|
if (eqIdx === -1)
|
|
60
67
|
break;
|
|
61
|
-
const
|
|
62
|
-
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
68
|
+
const endIdx = endIndex(str, index, len);
|
|
63
69
|
if (eqIdx > endIdx) {
|
|
64
70
|
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
65
71
|
continue;
|
|
66
72
|
}
|
|
67
|
-
const
|
|
68
|
-
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
69
|
-
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
73
|
+
const key = valueSlice(str, index, eqIdx);
|
|
70
74
|
if (obj[key] === void 0) {
|
|
71
|
-
|
|
72
|
-
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
73
|
-
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
74
|
-
obj[key] = value;
|
|
75
|
+
obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
|
|
75
76
|
}
|
|
76
77
|
index = endIdx + 1;
|
|
77
78
|
} while (index < len);
|
|
78
79
|
return obj;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
|
|
81
|
+
function stringifyCookie(cookie, options) {
|
|
82
|
+
const enc = options?.encode || encodeURIComponent;
|
|
83
|
+
const cookieStrings = [];
|
|
84
|
+
for (const name of Object.keys(cookie)) {
|
|
85
|
+
const val = cookie[name];
|
|
86
|
+
if (val === void 0)
|
|
87
|
+
continue;
|
|
88
|
+
if (!cookieNameRegExp.test(name)) {
|
|
89
|
+
throw new TypeError(`cookie name is invalid: ${name}`);
|
|
90
|
+
}
|
|
91
|
+
const value = enc(val);
|
|
92
|
+
if (!cookieValueRegExp.test(value)) {
|
|
93
|
+
throw new TypeError(`cookie val is invalid: ${val}`);
|
|
94
|
+
}
|
|
95
|
+
cookieStrings.push(`${name}=${value}`);
|
|
93
96
|
}
|
|
94
|
-
return
|
|
97
|
+
return cookieStrings.join("; ");
|
|
95
98
|
}
|
|
96
|
-
function
|
|
99
|
+
function stringifySetCookie(_name, _val, _opts) {
|
|
100
|
+
const cookie = typeof _name === "object" ? _name : { ..._opts, name: _name, value: String(_val) };
|
|
101
|
+
const options = typeof _val === "object" ? _val : _opts;
|
|
97
102
|
const enc = options?.encode || encodeURIComponent;
|
|
98
|
-
if (!cookieNameRegExp.test(name)) {
|
|
99
|
-
throw new TypeError(`argument name is invalid: ${name}`);
|
|
103
|
+
if (!cookieNameRegExp.test(cookie.name)) {
|
|
104
|
+
throw new TypeError(`argument name is invalid: ${cookie.name}`);
|
|
100
105
|
}
|
|
101
|
-
const value = enc(
|
|
106
|
+
const value = cookie.value ? enc(cookie.value) : "";
|
|
102
107
|
if (!cookieValueRegExp.test(value)) {
|
|
103
|
-
throw new TypeError(`argument val is invalid: ${
|
|
108
|
+
throw new TypeError(`argument val is invalid: ${cookie.value}`);
|
|
104
109
|
}
|
|
105
|
-
let str = name + "=" + value;
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!Number.isInteger(options.maxAge)) {
|
|
110
|
-
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
110
|
+
let str = cookie.name + "=" + value;
|
|
111
|
+
if (cookie.maxAge !== void 0) {
|
|
112
|
+
if (!Number.isInteger(cookie.maxAge)) {
|
|
113
|
+
throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
|
|
111
114
|
}
|
|
112
|
-
str += "; Max-Age=" +
|
|
115
|
+
str += "; Max-Age=" + cookie.maxAge;
|
|
113
116
|
}
|
|
114
|
-
if (
|
|
115
|
-
if (!domainValueRegExp.test(
|
|
116
|
-
throw new TypeError(`option domain is invalid: ${
|
|
117
|
+
if (cookie.domain) {
|
|
118
|
+
if (!domainValueRegExp.test(cookie.domain)) {
|
|
119
|
+
throw new TypeError(`option domain is invalid: ${cookie.domain}`);
|
|
117
120
|
}
|
|
118
|
-
str += "; Domain=" +
|
|
121
|
+
str += "; Domain=" + cookie.domain;
|
|
119
122
|
}
|
|
120
|
-
if (
|
|
121
|
-
if (!pathValueRegExp.test(
|
|
122
|
-
throw new TypeError(`option path is invalid: ${
|
|
123
|
+
if (cookie.path) {
|
|
124
|
+
if (!pathValueRegExp.test(cookie.path)) {
|
|
125
|
+
throw new TypeError(`option path is invalid: ${cookie.path}`);
|
|
123
126
|
}
|
|
124
|
-
str += "; Path=" +
|
|
127
|
+
str += "; Path=" + cookie.path;
|
|
125
128
|
}
|
|
126
|
-
if (
|
|
127
|
-
if (!isDate(
|
|
128
|
-
throw new TypeError(`option expires is invalid: ${
|
|
129
|
+
if (cookie.expires) {
|
|
130
|
+
if (!isDate(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
|
|
131
|
+
throw new TypeError(`option expires is invalid: ${cookie.expires}`);
|
|
129
132
|
}
|
|
130
|
-
str += "; Expires=" +
|
|
133
|
+
str += "; Expires=" + cookie.expires.toUTCString();
|
|
131
134
|
}
|
|
132
|
-
if (
|
|
135
|
+
if (cookie.httpOnly) {
|
|
133
136
|
str += "; HttpOnly";
|
|
134
137
|
}
|
|
135
|
-
if (
|
|
138
|
+
if (cookie.secure) {
|
|
136
139
|
str += "; Secure";
|
|
137
140
|
}
|
|
138
|
-
if (
|
|
141
|
+
if (cookie.partitioned) {
|
|
139
142
|
str += "; Partitioned";
|
|
140
143
|
}
|
|
141
|
-
if (
|
|
142
|
-
const priority = typeof
|
|
144
|
+
if (cookie.priority) {
|
|
145
|
+
const priority = typeof cookie.priority === "string" ? cookie.priority.toLowerCase() : void 0;
|
|
143
146
|
switch (priority) {
|
|
144
147
|
case "low":
|
|
145
148
|
str += "; Priority=Low";
|
|
@@ -151,11 +154,11 @@ var require_dist = __commonJS({
|
|
|
151
154
|
str += "; Priority=High";
|
|
152
155
|
break;
|
|
153
156
|
default:
|
|
154
|
-
throw new TypeError(`option priority is invalid: ${
|
|
157
|
+
throw new TypeError(`option priority is invalid: ${cookie.priority}`);
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
if (
|
|
158
|
-
const sameSite = typeof
|
|
160
|
+
if (cookie.sameSite) {
|
|
161
|
+
const sameSite = typeof cookie.sameSite === "string" ? cookie.sameSite.toLowerCase() : cookie.sameSite;
|
|
159
162
|
switch (sameSite) {
|
|
160
163
|
case true:
|
|
161
164
|
case "strict":
|
|
@@ -168,11 +171,98 @@ var require_dist = __commonJS({
|
|
|
168
171
|
str += "; SameSite=None";
|
|
169
172
|
break;
|
|
170
173
|
default:
|
|
171
|
-
throw new TypeError(`option sameSite is invalid: ${
|
|
174
|
+
throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
177
|
return str;
|
|
175
178
|
}
|
|
179
|
+
function parseSetCookie(str, options) {
|
|
180
|
+
const dec = options?.decode || decode2;
|
|
181
|
+
const len = str.length;
|
|
182
|
+
const endIdx = endIndex(str, 0, len);
|
|
183
|
+
const eqIdx = eqIndex(str, 0, endIdx);
|
|
184
|
+
const setCookie = eqIdx === -1 ? { name: "", value: dec(valueSlice(str, 0, endIdx)) } : {
|
|
185
|
+
name: valueSlice(str, 0, eqIdx),
|
|
186
|
+
value: dec(valueSlice(str, eqIdx + 1, endIdx))
|
|
187
|
+
};
|
|
188
|
+
let index = endIdx + 1;
|
|
189
|
+
while (index < len) {
|
|
190
|
+
const endIdx2 = endIndex(str, index, len);
|
|
191
|
+
const eqIdx2 = eqIndex(str, index, endIdx2);
|
|
192
|
+
const attr = eqIdx2 === -1 ? valueSlice(str, index, endIdx2) : valueSlice(str, index, eqIdx2);
|
|
193
|
+
const val = eqIdx2 === -1 ? void 0 : valueSlice(str, eqIdx2 + 1, endIdx2);
|
|
194
|
+
switch (attr.toLowerCase()) {
|
|
195
|
+
case "httponly":
|
|
196
|
+
setCookie.httpOnly = true;
|
|
197
|
+
break;
|
|
198
|
+
case "secure":
|
|
199
|
+
setCookie.secure = true;
|
|
200
|
+
break;
|
|
201
|
+
case "partitioned":
|
|
202
|
+
setCookie.partitioned = true;
|
|
203
|
+
break;
|
|
204
|
+
case "domain":
|
|
205
|
+
setCookie.domain = val;
|
|
206
|
+
break;
|
|
207
|
+
case "path":
|
|
208
|
+
setCookie.path = val;
|
|
209
|
+
break;
|
|
210
|
+
case "max-age":
|
|
211
|
+
if (val && maxAgeRegExp.test(val))
|
|
212
|
+
setCookie.maxAge = Number(val);
|
|
213
|
+
break;
|
|
214
|
+
case "expires":
|
|
215
|
+
if (!val)
|
|
216
|
+
break;
|
|
217
|
+
const date = new Date(val);
|
|
218
|
+
if (Number.isFinite(date.valueOf()))
|
|
219
|
+
setCookie.expires = date;
|
|
220
|
+
break;
|
|
221
|
+
case "priority":
|
|
222
|
+
if (!val)
|
|
223
|
+
break;
|
|
224
|
+
const priority = val.toLowerCase();
|
|
225
|
+
if (priority === "low" || priority === "medium" || priority === "high") {
|
|
226
|
+
setCookie.priority = priority;
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
case "samesite":
|
|
230
|
+
if (!val)
|
|
231
|
+
break;
|
|
232
|
+
const sameSite = val.toLowerCase();
|
|
233
|
+
if (sameSite === "lax" || sameSite === "strict" || sameSite === "none") {
|
|
234
|
+
setCookie.sameSite = sameSite;
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
index = endIdx2 + 1;
|
|
239
|
+
}
|
|
240
|
+
return setCookie;
|
|
241
|
+
}
|
|
242
|
+
function endIndex(str, min, len) {
|
|
243
|
+
const index = str.indexOf(";", min);
|
|
244
|
+
return index === -1 ? len : index;
|
|
245
|
+
}
|
|
246
|
+
function eqIndex(str, min, max) {
|
|
247
|
+
const index = str.indexOf("=", min);
|
|
248
|
+
return index < max ? index : -1;
|
|
249
|
+
}
|
|
250
|
+
function valueSlice(str, min, max) {
|
|
251
|
+
let start = min;
|
|
252
|
+
let end = max;
|
|
253
|
+
do {
|
|
254
|
+
const code = str.charCodeAt(start);
|
|
255
|
+
if (code !== 32 && code !== 9)
|
|
256
|
+
break;
|
|
257
|
+
} while (++start < end);
|
|
258
|
+
while (end > start) {
|
|
259
|
+
const code = str.charCodeAt(end - 1);
|
|
260
|
+
if (code !== 32 && code !== 9)
|
|
261
|
+
break;
|
|
262
|
+
end--;
|
|
263
|
+
}
|
|
264
|
+
return str.slice(start, end);
|
|
265
|
+
}
|
|
176
266
|
function decode2(str) {
|
|
177
267
|
if (str.indexOf("%") === -1)
|
|
178
268
|
return str;
|
|
@@ -2588,7 +2678,7 @@ var import_node_fs = require("node:fs");
|
|
|
2588
2678
|
var import_node_path = require("node:path");
|
|
2589
2679
|
|
|
2590
2680
|
// node_modules/@miqro/core/build/types.js
|
|
2591
|
-
var
|
|
2681
|
+
var import_cookie = __toESM(require_dist(), 1);
|
|
2592
2682
|
var import_node_crypto = require("node:crypto");
|
|
2593
2683
|
var import_node_http = require("node:http");
|
|
2594
2684
|
|
|
@@ -3050,7 +3140,6 @@ function parsePart(req, part, value, args, mode, parser4) {
|
|
|
3050
3140
|
}
|
|
3051
3141
|
|
|
3052
3142
|
// node_modules/@miqro/core/build/middleware/session.js
|
|
3053
|
-
var import_cookie = __toESM(require_dist(), 1);
|
|
3054
3143
|
var DEFAULT_TOKEN_LOCATION = "free";
|
|
3055
3144
|
var DEFAULT_TOKEN_HEADER = "Authorization";
|
|
3056
3145
|
var DEFAULT_TOKEN_QUERY = "token";
|
|
@@ -3438,7 +3527,7 @@ var Request = class extends import_node_http.IncomingMessage {
|
|
|
3438
3527
|
set: (v2) => {
|
|
3439
3528
|
vCookie = v2;
|
|
3440
3529
|
this.cookies = /* @__PURE__ */ Object.create(null);
|
|
3441
|
-
const cookies = (0,
|
|
3530
|
+
const cookies = (0, import_cookie.parse)(vCookie || "");
|
|
3442
3531
|
const cookieList = Object.keys(cookies);
|
|
3443
3532
|
for (const name of cookieList) {
|
|
3444
3533
|
const value = cookies[name];
|
|
@@ -3522,7 +3611,7 @@ var Response = class _Response extends import_node_http.ServerResponse {
|
|
|
3522
3611
|
});
|
|
3523
3612
|
}
|
|
3524
3613
|
setCookie(name, value, options) {
|
|
3525
|
-
return this.setHeader("Set-Cookie", (0,
|
|
3614
|
+
return this.setHeader("Set-Cookie", (0, import_cookie.serialize)(name, String(value), options));
|
|
3526
3615
|
}
|
|
3527
3616
|
addVaryHeader(value) {
|
|
3528
3617
|
const c = this.getHeader("Vary");
|
|
@@ -11293,18 +11382,22 @@ function cleanJSX(app) {
|
|
|
11293
11382
|
(0, import_node_fs17.unlinkSync)(getESBuildBinaryPath());
|
|
11294
11383
|
}
|
|
11295
11384
|
if (CLEAR_JSX_CACHE) {
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
(0, import_node_fs17.
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
(0, import_node_fs17.
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
(0, import_node_fs17.
|
|
11385
|
+
try {
|
|
11386
|
+
const buildParendDir = (0, import_node_path19.resolve)(JSX_TMP_DIR, String(process.pid));
|
|
11387
|
+
app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
|
|
11388
|
+
const buildDir = (0, import_node_path19.resolve)(buildParendDir, "build");
|
|
11389
|
+
const importDir = (0, import_node_path19.resolve)(buildParendDir, "import");
|
|
11390
|
+
if ((0, import_node_fs17.existsSync)(buildDir)) {
|
|
11391
|
+
(0, import_node_fs17.rmdirSync)(buildDir);
|
|
11392
|
+
}
|
|
11393
|
+
if ((0, import_node_fs17.existsSync)(importDir)) {
|
|
11394
|
+
(0, import_node_fs17.rmdirSync)(importDir);
|
|
11395
|
+
}
|
|
11396
|
+
if ((0, import_node_fs17.existsSync)(buildParendDir)) {
|
|
11397
|
+
(0, import_node_fs17.rmdirSync)(buildParendDir);
|
|
11398
|
+
}
|
|
11399
|
+
} catch (e) {
|
|
11400
|
+
app.logger?.error(e);
|
|
11308
11401
|
}
|
|
11309
11402
|
}
|
|
11310
11403
|
}
|
|
@@ -11315,7 +11408,7 @@ function setupExitHandlers(app) {
|
|
|
11315
11408
|
app.logger?.error(err);
|
|
11316
11409
|
exceptionOccured = true;
|
|
11317
11410
|
cleanJSX(app);
|
|
11318
|
-
if (app.
|
|
11411
|
+
if (app.status === "started") {
|
|
11319
11412
|
await app.stop();
|
|
11320
11413
|
}
|
|
11321
11414
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
@@ -11325,7 +11418,7 @@ function setupExitHandlers(app) {
|
|
|
11325
11418
|
app.logger?.error("Exception occured");
|
|
11326
11419
|
} else {
|
|
11327
11420
|
cleanJSX(app);
|
|
11328
|
-
if (app.
|
|
11421
|
+
if (app.status === "started") {
|
|
11329
11422
|
app.stop();
|
|
11330
11423
|
}
|
|
11331
11424
|
}
|
|
@@ -11335,14 +11428,14 @@ function setupExitHandlers(app) {
|
|
|
11335
11428
|
app.logger?.error(reason);
|
|
11336
11429
|
exceptionOccured = true;
|
|
11337
11430
|
cleanJSX(app);
|
|
11338
|
-
if (app.
|
|
11431
|
+
if (app.status === "started") {
|
|
11339
11432
|
await app.stop();
|
|
11340
11433
|
}
|
|
11341
11434
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
11342
11435
|
});
|
|
11343
11436
|
process.on("SIGTERM", async function() {
|
|
11344
11437
|
app.logger?.info("SIGTERM received");
|
|
11345
|
-
if (app.
|
|
11438
|
+
if (app.status === "started") {
|
|
11346
11439
|
await Promise.race([
|
|
11347
11440
|
app.stop(),
|
|
11348
11441
|
new Promise((r) => setTimeout(r, 5e3))
|
|
@@ -11352,7 +11445,7 @@ function setupExitHandlers(app) {
|
|
|
11352
11445
|
});
|
|
11353
11446
|
process.on("SIGHUP", async function() {
|
|
11354
11447
|
app.logger?.info("SIGHUP received");
|
|
11355
|
-
if (app.
|
|
11448
|
+
if (app.status === "started") {
|
|
11356
11449
|
await Promise.race([
|
|
11357
11450
|
app.stop(),
|
|
11358
11451
|
new Promise((r) => setTimeout(r, 5e3))
|
|
@@ -11362,7 +11455,7 @@ function setupExitHandlers(app) {
|
|
|
11362
11455
|
});
|
|
11363
11456
|
process.on("SIGINT", async function() {
|
|
11364
11457
|
app.logger?.info("SIGINT received");
|
|
11365
|
-
if (app.
|
|
11458
|
+
if (app.status === "started") {
|
|
11366
11459
|
await Promise.race([
|
|
11367
11460
|
app.stop(),
|
|
11368
11461
|
new Promise((r) => setTimeout(r, 5e3))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miqro",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/esm/lib.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typescript": "^5.9.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@miqro/core": "^5.1.
|
|
32
|
+
"@miqro/core": "^5.1.3",
|
|
33
33
|
"@miqro/jsx": "^1.0.2",
|
|
34
34
|
"@miqro/jsx-dom": "^1.0.6",
|
|
35
35
|
"@miqro/jsx-node": "^1.0.9",
|