miqro 8.0.2 → 8.0.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/build/esm/common/exit.js +22 -39
- package/build/esm/inflate/setup-db.js +1 -1
- package/build/esm/inflate/setup-http.js +4 -0
- package/build/lib.cjs +27 -19
- package/package.json +1 -1
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))
|
|
@@ -57,7 +57,7 @@ export async function inflateDBMigrations(logger, service, dbName, inflateDir, o
|
|
|
57
57
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
58
58
|
if (migrationsFolderPath) {
|
|
59
59
|
logger?.trace("loading migrations from service [%s]", service);
|
|
60
|
-
const serviceMigrations = migration.getSortedMigrations(migrationsFolderPath);
|
|
60
|
+
const serviceMigrations = migration.getSortedMigrations(migrationsFolderPath).filter(n => n).filter(n => n.indexOf("d.ts") === -1 || n.indexOf("d.ts") !== n.length - "d.ts".length);
|
|
61
61
|
const migrationModules = [];
|
|
62
62
|
for (const migrationName of serviceMigrations) {
|
|
63
63
|
const migrationPath = resolve(migrationsFolderPath, migrationName);
|
|
@@ -153,12 +153,16 @@ async function createRouterFromDirectory(importOptions, inflateJSXOptions, serve
|
|
|
153
153
|
tR.push(new Promise(async (resolve) => {
|
|
154
154
|
try {
|
|
155
155
|
switch (file.ext) {
|
|
156
|
+
case ".map": {
|
|
157
|
+
return resolve();
|
|
158
|
+
}
|
|
156
159
|
case ".jsx":
|
|
157
160
|
case ".cjs":
|
|
158
161
|
case ".js":
|
|
159
162
|
case ".ts":
|
|
160
163
|
case ".tsx": {
|
|
161
164
|
switch (file.subExt) {
|
|
165
|
+
case ".d":
|
|
162
166
|
case ".test":
|
|
163
167
|
return resolve();
|
|
164
168
|
case ".ignore":
|
package/build/lib.cjs
CHANGED
|
@@ -10138,12 +10138,16 @@ async function createRouterFromDirectory(importOptions, inflateJSXOptions, serve
|
|
|
10138
10138
|
tR.push(new Promise(async (resolve20) => {
|
|
10139
10139
|
try {
|
|
10140
10140
|
switch (file.ext) {
|
|
10141
|
+
case ".map": {
|
|
10142
|
+
return resolve20();
|
|
10143
|
+
}
|
|
10141
10144
|
case ".jsx":
|
|
10142
10145
|
case ".cjs":
|
|
10143
10146
|
case ".js":
|
|
10144
10147
|
case ".ts":
|
|
10145
10148
|
case ".tsx": {
|
|
10146
10149
|
switch (file.subExt) {
|
|
10150
|
+
case ".d":
|
|
10147
10151
|
case ".test":
|
|
10148
10152
|
return resolve20();
|
|
10149
10153
|
case ".ignore":
|
|
@@ -11382,18 +11386,22 @@ function cleanJSX(app) {
|
|
|
11382
11386
|
(0, import_node_fs17.unlinkSync)(getESBuildBinaryPath());
|
|
11383
11387
|
}
|
|
11384
11388
|
if (CLEAR_JSX_CACHE) {
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
(0, import_node_fs17.
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
(0, import_node_fs17.
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
(0, import_node_fs17.
|
|
11389
|
+
try {
|
|
11390
|
+
const buildParendDir = (0, import_node_path19.resolve)(JSX_TMP_DIR, String(process.pid));
|
|
11391
|
+
app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
|
|
11392
|
+
const buildDir = (0, import_node_path19.resolve)(buildParendDir, "build");
|
|
11393
|
+
const importDir = (0, import_node_path19.resolve)(buildParendDir, "import");
|
|
11394
|
+
if ((0, import_node_fs17.existsSync)(buildDir)) {
|
|
11395
|
+
(0, import_node_fs17.rmdirSync)(buildDir);
|
|
11396
|
+
}
|
|
11397
|
+
if ((0, import_node_fs17.existsSync)(importDir)) {
|
|
11398
|
+
(0, import_node_fs17.rmdirSync)(importDir);
|
|
11399
|
+
}
|
|
11400
|
+
if ((0, import_node_fs17.existsSync)(buildParendDir)) {
|
|
11401
|
+
(0, import_node_fs17.rmdirSync)(buildParendDir);
|
|
11402
|
+
}
|
|
11403
|
+
} catch (e) {
|
|
11404
|
+
app.logger?.error(e);
|
|
11397
11405
|
}
|
|
11398
11406
|
}
|
|
11399
11407
|
}
|
|
@@ -11404,7 +11412,7 @@ function setupExitHandlers(app) {
|
|
|
11404
11412
|
app.logger?.error(err);
|
|
11405
11413
|
exceptionOccured = true;
|
|
11406
11414
|
cleanJSX(app);
|
|
11407
|
-
if (app.
|
|
11415
|
+
if (app.status === "started") {
|
|
11408
11416
|
await app.stop();
|
|
11409
11417
|
}
|
|
11410
11418
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
@@ -11414,7 +11422,7 @@ function setupExitHandlers(app) {
|
|
|
11414
11422
|
app.logger?.error("Exception occured");
|
|
11415
11423
|
} else {
|
|
11416
11424
|
cleanJSX(app);
|
|
11417
|
-
if (app.
|
|
11425
|
+
if (app.status === "started") {
|
|
11418
11426
|
app.stop();
|
|
11419
11427
|
}
|
|
11420
11428
|
}
|
|
@@ -11424,14 +11432,14 @@ function setupExitHandlers(app) {
|
|
|
11424
11432
|
app.logger?.error(reason);
|
|
11425
11433
|
exceptionOccured = true;
|
|
11426
11434
|
cleanJSX(app);
|
|
11427
|
-
if (app.
|
|
11435
|
+
if (app.status === "started") {
|
|
11428
11436
|
await app.stop();
|
|
11429
11437
|
}
|
|
11430
11438
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
11431
11439
|
});
|
|
11432
11440
|
process.on("SIGTERM", async function() {
|
|
11433
11441
|
app.logger?.info("SIGTERM received");
|
|
11434
|
-
if (app.
|
|
11442
|
+
if (app.status === "started") {
|
|
11435
11443
|
await Promise.race([
|
|
11436
11444
|
app.stop(),
|
|
11437
11445
|
new Promise((r) => setTimeout(r, 5e3))
|
|
@@ -11441,7 +11449,7 @@ function setupExitHandlers(app) {
|
|
|
11441
11449
|
});
|
|
11442
11450
|
process.on("SIGHUP", async function() {
|
|
11443
11451
|
app.logger?.info("SIGHUP received");
|
|
11444
|
-
if (app.
|
|
11452
|
+
if (app.status === "started") {
|
|
11445
11453
|
await Promise.race([
|
|
11446
11454
|
app.stop(),
|
|
11447
11455
|
new Promise((r) => setTimeout(r, 5e3))
|
|
@@ -11451,7 +11459,7 @@ function setupExitHandlers(app) {
|
|
|
11451
11459
|
});
|
|
11452
11460
|
process.on("SIGINT", async function() {
|
|
11453
11461
|
app.logger?.info("SIGINT received");
|
|
11454
|
-
if (app.
|
|
11462
|
+
if (app.status === "started") {
|
|
11455
11463
|
await Promise.race([
|
|
11456
11464
|
app.stop(),
|
|
11457
11465
|
new Promise((r) => setTimeout(r, 5e3))
|
|
@@ -11512,7 +11520,7 @@ async function inflateDBMigrations(logger, service, dbName, inflateDir, options,
|
|
|
11512
11520
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
11513
11521
|
if (migrationsFolderPath) {
|
|
11514
11522
|
logger?.trace("loading migrations from service [%s]", service);
|
|
11515
|
-
const serviceMigrations = lib_exports2.getSortedMigrations(migrationsFolderPath);
|
|
11523
|
+
const serviceMigrations = lib_exports2.getSortedMigrations(migrationsFolderPath).filter((n) => n).filter((n) => n.indexOf("d.ts") === -1 || n.indexOf("d.ts") !== n.length - "d.ts".length);
|
|
11516
11524
|
const migrationModules = [];
|
|
11517
11525
|
for (const migrationName of serviceMigrations) {
|
|
11518
11526
|
const migrationPath = (0, import_node_path20.resolve)(migrationsFolderPath, migrationName);
|