miqro 8.0.2 → 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.
@@ -10,22 +10,23 @@ function cleanJSX(app) {
10
10
  unlinkSync(getESBuildBinaryPath());
11
11
  }
12
12
  if (CLEAR_JSX_CACHE) {
13
- /*app.logger?.trace("trying to clean up jsx.js installation at [%s]", getJSXJSPath());
14
- if (existsSync(getJSXJSPath())) {
15
- unlinkSync(getJSXJSPath());
16
- }*/
17
- const buildParendDir = resolve(JSX_TMP_DIR, String(process.pid));
18
- app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
19
- const buildDir = resolve(buildParendDir, "build");
20
- const importDir = resolve(buildParendDir, "import");
21
- if (existsSync(buildDir)) {
22
- rmdirSync(buildDir);
23
- }
24
- if (existsSync(importDir)) {
25
- rmdirSync(importDir);
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
- if (existsSync(buildParendDir)) {
28
- rmdirSync(buildParendDir);
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.server) {
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.server) {
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.server) {
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.server) {
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.server) {
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.server) {
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
@@ -11382,18 +11382,22 @@ function cleanJSX(app) {
11382
11382
  (0, import_node_fs17.unlinkSync)(getESBuildBinaryPath());
11383
11383
  }
11384
11384
  if (CLEAR_JSX_CACHE) {
11385
- const buildParendDir = (0, import_node_path19.resolve)(JSX_TMP_DIR, String(process.pid));
11386
- app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
11387
- const buildDir = (0, import_node_path19.resolve)(buildParendDir, "build");
11388
- const importDir = (0, import_node_path19.resolve)(buildParendDir, "import");
11389
- if ((0, import_node_fs17.existsSync)(buildDir)) {
11390
- (0, import_node_fs17.rmdirSync)(buildDir);
11391
- }
11392
- if ((0, import_node_fs17.existsSync)(importDir)) {
11393
- (0, import_node_fs17.rmdirSync)(importDir);
11394
- }
11395
- if ((0, import_node_fs17.existsSync)(buildParendDir)) {
11396
- (0, import_node_fs17.rmdirSync)(buildParendDir);
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);
11397
11401
  }
11398
11402
  }
11399
11403
  }
@@ -11404,7 +11408,7 @@ function setupExitHandlers(app) {
11404
11408
  app.logger?.error(err);
11405
11409
  exceptionOccured = true;
11406
11410
  cleanJSX(app);
11407
- if (app.server) {
11411
+ if (app.status === "started") {
11408
11412
  await app.stop();
11409
11413
  }
11410
11414
  process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
@@ -11414,7 +11418,7 @@ function setupExitHandlers(app) {
11414
11418
  app.logger?.error("Exception occured");
11415
11419
  } else {
11416
11420
  cleanJSX(app);
11417
- if (app.server) {
11421
+ if (app.status === "started") {
11418
11422
  app.stop();
11419
11423
  }
11420
11424
  }
@@ -11424,14 +11428,14 @@ function setupExitHandlers(app) {
11424
11428
  app.logger?.error(reason);
11425
11429
  exceptionOccured = true;
11426
11430
  cleanJSX(app);
11427
- if (app.server) {
11431
+ if (app.status === "started") {
11428
11432
  await app.stop();
11429
11433
  }
11430
11434
  process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
11431
11435
  });
11432
11436
  process.on("SIGTERM", async function() {
11433
11437
  app.logger?.info("SIGTERM received");
11434
- if (app.server) {
11438
+ if (app.status === "started") {
11435
11439
  await Promise.race([
11436
11440
  app.stop(),
11437
11441
  new Promise((r) => setTimeout(r, 5e3))
@@ -11441,7 +11445,7 @@ function setupExitHandlers(app) {
11441
11445
  });
11442
11446
  process.on("SIGHUP", async function() {
11443
11447
  app.logger?.info("SIGHUP received");
11444
- if (app.server) {
11448
+ if (app.status === "started") {
11445
11449
  await Promise.race([
11446
11450
  app.stop(),
11447
11451
  new Promise((r) => setTimeout(r, 5e3))
@@ -11451,7 +11455,7 @@ function setupExitHandlers(app) {
11451
11455
  });
11452
11456
  process.on("SIGINT", async function() {
11453
11457
  app.logger?.info("SIGINT received");
11454
- if (app.server) {
11458
+ if (app.status === "started") {
11455
11459
  await Promise.race([
11456
11460
  app.stop(),
11457
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.2",
3
+ "version": "8.0.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/esm/lib.js",