opticore-webapp 1.0.68 → 1.0.70
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 +161 -892
- package/dist/index.d.cts +20 -185
- package/dist/index.d.ts +20 -185
- package/dist/index.js +164 -899
- package/dist/utils/translations/message.translation.en.json +24 -3
- package/dist/utils/translations/message.translation.fr.json +3 -3
- package/package.json +8 -9
package/dist/index.cjs
CHANGED
|
@@ -40,105 +40,24 @@ var path2 = __toESM(require("path"), 1);
|
|
|
40
40
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
41
41
|
var import_cors = __toESM(require("cors"), 1);
|
|
42
42
|
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
43
|
-
var
|
|
43
|
+
var import_opticore_express2 = require("opticore-express");
|
|
44
44
|
var import_opticore_env_access2 = require("opticore-env-access");
|
|
45
|
-
var import_opticore_request_call_event = require("opticore-request-call-event");
|
|
46
|
-
var import_opticore_dependency_inject2 = require("opticore-dependency-inject");
|
|
47
45
|
var import_opticore_http_response3 = require("opticore-http-response");
|
|
48
46
|
var import_opticore_translator2 = require("opticore-translator");
|
|
47
|
+
var import_opticore_request_call_event = require("opticore-request-call-event");
|
|
49
48
|
|
|
50
49
|
// src/core/handlers/eventProcess.handler.ts
|
|
51
50
|
var import_node_process = __toESM(require("process"), 1);
|
|
52
51
|
var import_node_events = __toESM(require("events"), 1);
|
|
52
|
+
var import_opticore_express = require("opticore-express");
|
|
53
53
|
var import_opticore_catch_exception_error = require("opticore-catch-exception-error");
|
|
54
|
-
|
|
55
|
-
// src/utils/isTransformError.utils.ts
|
|
56
|
-
var isTransformErrorUtils = (error) => {
|
|
57
|
-
return error?.name === "TransformError" || error?.message?.includes("Transform failed") || error?.message?.includes("esbuild");
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// src/core/handlers/eventProcess.handler.ts
|
|
61
|
-
function eventProcessHandler(localeLanguage, expressApp) {
|
|
54
|
+
function eventProcessHandler(localeLanguage) {
|
|
62
55
|
const errorEmitter = new import_node_events.default();
|
|
56
|
+
const app = (0, import_opticore_express.express)();
|
|
63
57
|
const serverListenEvent = new import_opticore_catch_exception_error.ServerListenEventError(localeLanguage);
|
|
64
|
-
console.log("[Server] Setting up error event handlers...");
|
|
65
58
|
errorEmitter.on(import_opticore_catch_exception_error.CEventNameError.error, (error) => {
|
|
66
|
-
console.error("[Server] EventEmitter error caught:", error.message);
|
|
67
|
-
if (isTransformErrorUtils(error)) {
|
|
68
|
-
handleTransformError(error);
|
|
69
|
-
}
|
|
70
59
|
serverListenEvent.listenerError(error);
|
|
71
60
|
});
|
|
72
|
-
function handleTransformError(error) {
|
|
73
|
-
console.error("[Server] ============================================");
|
|
74
|
-
console.error("[Server] TRANSFORM ERROR DETECTED");
|
|
75
|
-
console.error("[Server] ============================================");
|
|
76
|
-
console.error("[Server] Message:", error.message);
|
|
77
|
-
console.error("[Server] Stack:", error.stack);
|
|
78
|
-
if (error.errors && Array.isArray(error.errors)) {
|
|
79
|
-
error.errors.forEach((err, index) => {
|
|
80
|
-
console.error(`[Server] Error ${index + 1}:`, err.text);
|
|
81
|
-
if (err.location) {
|
|
82
|
-
console.error(`[Server] File: ${err.location.file}`);
|
|
83
|
-
console.error(`[Server] Line: ${err.location.line}, Column: ${err.location.column}`);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const fileMatch = error.message.match(/([^:]+\.ts):(\d+):(\d+):/);
|
|
88
|
-
if (fileMatch) {
|
|
89
|
-
console.error("[Server] Problem file:", fileMatch[1]);
|
|
90
|
-
console.error("[Server] Line:", fileMatch[2], "Column:", fileMatch[3]);
|
|
91
|
-
}
|
|
92
|
-
const errorDetailMatch = error.message.match(/ERROR: (.+)$/m);
|
|
93
|
-
if (errorDetailMatch) {
|
|
94
|
-
console.error("[Server] Error detail:", errorDetailMatch[1]);
|
|
95
|
-
}
|
|
96
|
-
console.error("[Server] ============================================");
|
|
97
|
-
if (import_node_process.default.send) {
|
|
98
|
-
import_node_process.default.send({
|
|
99
|
-
type: "TRANSFORM_ERROR",
|
|
100
|
-
error: error.message,
|
|
101
|
-
stack: error.stack,
|
|
102
|
-
errorName: error.name,
|
|
103
|
-
details: error.errors,
|
|
104
|
-
timestamp: Date.now()
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtException, (error) => {
|
|
109
|
-
console.error("[Server] UNCAUGHT EXCEPTION:", error.message);
|
|
110
|
-
console.error("[Server] Stack:", error.stack);
|
|
111
|
-
if (isTransformErrorUtils(error)) {
|
|
112
|
-
errorEmitter.emit("transformError", error);
|
|
113
|
-
}
|
|
114
|
-
serverListenEvent.uncaughtException(error);
|
|
115
|
-
if (import_node_process.default.send) {
|
|
116
|
-
const messageType = isTransformErrorUtils(error) ? "TRANSFORM_ERROR" : "HOT_RELOAD_ERROR";
|
|
117
|
-
import_node_process.default.send({
|
|
118
|
-
type: messageType,
|
|
119
|
-
error: error.message,
|
|
120
|
-
stack: error.stack,
|
|
121
|
-
errorName: error.name,
|
|
122
|
-
timestamp: Date.now()
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.unhandledRejection, (reason, promise) => {
|
|
127
|
-
console.error("[Server] UNHANDLED REJECTION:", reason);
|
|
128
|
-
if (isTransformErrorUtils(reason)) {
|
|
129
|
-
errorEmitter.emit("transformError", reason);
|
|
130
|
-
}
|
|
131
|
-
serverListenEvent.unhandledRejection(reason, promise);
|
|
132
|
-
if (import_node_process.default.send) {
|
|
133
|
-
const messageType = isTransformErrorUtils(reason) ? "TRANSFORM_ERROR" : "HOT_RELOAD_ERROR";
|
|
134
|
-
import_node_process.default.send({
|
|
135
|
-
type: messageType,
|
|
136
|
-
error: reason?.message || String(reason),
|
|
137
|
-
errorName: reason?.name,
|
|
138
|
-
timestamp: Date.now()
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
61
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.beforeExit, (code) => {
|
|
143
62
|
setTimeout(() => {
|
|
144
63
|
serverListenEvent.processBeforeExit(code);
|
|
@@ -153,20 +72,20 @@ function eventProcessHandler(localeLanguage, expressApp) {
|
|
|
153
72
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.rejectionHandled, (promise) => {
|
|
154
73
|
serverListenEvent.promiseRejectionHandled(promise);
|
|
155
74
|
});
|
|
75
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtException, (error) => {
|
|
76
|
+
serverListenEvent.uncaughtException(error);
|
|
77
|
+
});
|
|
156
78
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtExceptionMonitor, (error) => {
|
|
157
|
-
console.error("[Server] UNCAUGHT EXCEPTION MONITOR:", error.message);
|
|
158
|
-
if (isTransformErrorUtils(error)) {
|
|
159
|
-
errorEmitter.emit("transformError", error);
|
|
160
|
-
}
|
|
161
79
|
serverListenEvent.uncaughtExceptionMonitor(error);
|
|
162
80
|
});
|
|
81
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.unhandledRejection, (reason, promise) => {
|
|
82
|
+
serverListenEvent.unhandledRejection(reason, promise);
|
|
83
|
+
});
|
|
163
84
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.warning, (warning) => {
|
|
164
85
|
serverListenEvent.warning(warning);
|
|
165
86
|
});
|
|
166
87
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.message, (message) => {
|
|
167
|
-
|
|
168
|
-
serverListenEvent.message(message);
|
|
169
|
-
}
|
|
88
|
+
serverListenEvent.message(message);
|
|
170
89
|
});
|
|
171
90
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.multipleResolves, (type, promise, reason) => {
|
|
172
91
|
serverListenEvent.multipleResolves(type, promise, reason);
|
|
@@ -177,15 +96,9 @@ function eventProcessHandler(localeLanguage, expressApp) {
|
|
|
177
96
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.sigterm, (signal) => {
|
|
178
97
|
serverListenEvent.sigtermSignalReceived(signal);
|
|
179
98
|
});
|
|
180
|
-
|
|
181
|
-
console.error("[Server] Express error middleware triggered:", err.message);
|
|
182
|
-
console.error("[Server] Request URL:", req.url);
|
|
183
|
-
console.error("[Server] Request method:", req.method);
|
|
184
|
-
errorEmitter.emit(import_opticore_catch_exception_error.CEventNameError.error, err);
|
|
99
|
+
app.use((err, req, res, next) => {
|
|
185
100
|
serverListenEvent.expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
186
101
|
});
|
|
187
|
-
console.log("[Server] Error event handlers configured successfully");
|
|
188
|
-
return errorEmitter;
|
|
189
102
|
}
|
|
190
103
|
|
|
191
104
|
// src/application/service/core.service.ts
|
|
@@ -236,21 +149,6 @@ var dependenciesContainerProvider = (localLang) => {
|
|
|
236
149
|
return new import_opticore_dependency_inject.SContainer(localLang, dependencies);
|
|
237
150
|
};
|
|
238
151
|
|
|
239
|
-
// src/application/service/core.service.ts
|
|
240
|
-
var import_opticore_logger2 = require("opticore-logger");
|
|
241
|
-
|
|
242
|
-
// src/application/service/logger.service.ts
|
|
243
|
-
var SLogger = (localLang) => {
|
|
244
|
-
return {
|
|
245
|
-
get serverLog() {
|
|
246
|
-
return dependenciesContainerProvider(localLang).resolve("OpticoreLogger");
|
|
247
|
-
},
|
|
248
|
-
get logger() {
|
|
249
|
-
return dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
|
|
254
152
|
// src/application/service/core.service.ts
|
|
255
153
|
var CoreService = class {
|
|
256
154
|
localLanguage;
|
|
@@ -258,9 +156,9 @@ var CoreService = class {
|
|
|
258
156
|
serverLog;
|
|
259
157
|
logger;
|
|
260
158
|
constructor(localLang, environmentPath) {
|
|
159
|
+
this.loadTranslationFiles();
|
|
261
160
|
this.environmentPath = environmentPath;
|
|
262
161
|
this.localLanguage = localLang;
|
|
263
|
-
loaderTranslationFile(this.localLanguage);
|
|
264
162
|
this.serverLog = dependenciesContainerProvider(localLang).resolve("OpticoreLogger");
|
|
265
163
|
this.logger = dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
266
164
|
}
|
|
@@ -274,6 +172,41 @@ var CoreService = class {
|
|
|
274
172
|
formatMemoryUsage(data) {
|
|
275
173
|
return `${Math.round(data / 1024 / 1024 * 100) / 100} MB`;
|
|
276
174
|
}
|
|
175
|
+
loadTranslationFiles() {
|
|
176
|
+
loaderTranslationFile(this.localLanguage);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
*
|
|
180
|
+
* @param filePath
|
|
181
|
+
* @private
|
|
182
|
+
*
|
|
183
|
+
* Return void
|
|
184
|
+
*/
|
|
185
|
+
getEnvFileLoading(filePath) {
|
|
186
|
+
this.loadTranslationFiles();
|
|
187
|
+
try {
|
|
188
|
+
const fullPath = path.resolve(import_node_process2.default.cwd(), filePath);
|
|
189
|
+
if (fs.existsSync(fullPath)) {
|
|
190
|
+
const env = fs.readFileSync(fullPath, "utf-8");
|
|
191
|
+
const lines = env.split("\n");
|
|
192
|
+
lines.forEach((line) => {
|
|
193
|
+
const match = line.match(/^([^#=]+)=([^#]+)$/);
|
|
194
|
+
if (match) {
|
|
195
|
+
const key = match[1].trim();
|
|
196
|
+
import_node_process2.default.env[key] = match[2].trim();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
this.logger.error({
|
|
202
|
+
message: err.message,
|
|
203
|
+
title: import_opticore_translator.TranslationLoader.t("EnvFileLoading", this.localLanguage),
|
|
204
|
+
errorType: err.code,
|
|
205
|
+
stackTrace: err.stack,
|
|
206
|
+
httpCodeValue: import_opticore_http_response.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
277
210
|
/**
|
|
278
211
|
* Returns an Object containing a node version, openssl, and v0
|
|
279
212
|
*/
|
|
@@ -298,7 +231,7 @@ var CoreService = class {
|
|
|
298
231
|
* and Memory usage system
|
|
299
232
|
*/
|
|
300
233
|
getUsageMemory() {
|
|
301
|
-
|
|
234
|
+
this.loadTranslationFiles();
|
|
302
235
|
const memoryData = import_node_process2.default.memoryUsage();
|
|
303
236
|
const data = {
|
|
304
237
|
[import_opticore_translator.TranslationLoader.t("totalMemoryAllocated", this.localLanguage)]: this.formatMemoryUsage(memoryData.rss),
|
|
@@ -330,37 +263,6 @@ var CoreService = class {
|
|
|
330
263
|
"startingTime": `${executionTime.toFixed(5)} ms`
|
|
331
264
|
};
|
|
332
265
|
}
|
|
333
|
-
/**
|
|
334
|
-
*
|
|
335
|
-
* @param filePath
|
|
336
|
-
* @private
|
|
337
|
-
*
|
|
338
|
-
* Return void
|
|
339
|
-
*/
|
|
340
|
-
getEnvFileLoading(filePath) {
|
|
341
|
-
try {
|
|
342
|
-
const fullPath = path.resolve(import_node_process2.default.cwd(), filePath);
|
|
343
|
-
if (fs.existsSync(fullPath)) {
|
|
344
|
-
const env = fs.readFileSync(fullPath, "utf-8");
|
|
345
|
-
const lines = env.split("\n");
|
|
346
|
-
lines.forEach((line) => {
|
|
347
|
-
const match = line.match(/^([^#=]+)=([^#]+)$/);
|
|
348
|
-
if (match) {
|
|
349
|
-
const key = match[1].trim();
|
|
350
|
-
import_node_process2.default.env[key] = match[2].trim();
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
} catch (err) {
|
|
355
|
-
this.logger.error({
|
|
356
|
-
message: err.message,
|
|
357
|
-
title: import_opticore_translator.TranslationLoader.t("EnvFileLoading", this.localLanguage),
|
|
358
|
-
errorType: err.code,
|
|
359
|
-
stackTrace: err.stack,
|
|
360
|
-
httpCodeValue: import_opticore_http_response.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
266
|
/**
|
|
365
267
|
*
|
|
366
268
|
* @param development
|
|
@@ -369,14 +271,15 @@ var CoreService = class {
|
|
|
369
271
|
* Return string
|
|
370
272
|
*/
|
|
371
273
|
getServerRunningMode(development, production) {
|
|
274
|
+
this.loadTranslationFiles();
|
|
372
275
|
try {
|
|
373
|
-
loaderTranslationFile(this.localLanguage);
|
|
374
276
|
this.getEnvFileLoading(".env");
|
|
375
|
-
const env = (0, import_opticore_env_access.
|
|
376
|
-
const isDevelopment = env.devEnv === development
|
|
277
|
+
const env = (0, import_opticore_env_access.getEnvironmentValue)(path.join(envPath));
|
|
278
|
+
const isDevelopment = env.devEnv === development;
|
|
279
|
+
const isProd = env.prodEnv === production;
|
|
377
280
|
if (isDevelopment) {
|
|
378
281
|
return `${import_opticore_translator.TranslationLoader.t("serverRunning", this.localLanguage)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${development}`)}`)} mode`;
|
|
379
|
-
} else if (
|
|
282
|
+
} else if (isProd) {
|
|
380
283
|
return `${import_opticore_translator.TranslationLoader.t("serverRunning", this.localLanguage)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${production}`)}`)} mode`;
|
|
381
284
|
} else {
|
|
382
285
|
return `${import_opticore_translator.TranslationLoader.t("serverRunning", this.localLanguage)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${development}`)}`)} mode`;
|
|
@@ -392,9 +295,9 @@ var CoreService = class {
|
|
|
392
295
|
}
|
|
393
296
|
}
|
|
394
297
|
infoServer(host, port) {
|
|
298
|
+
this.loadTranslationFiles();
|
|
395
299
|
try {
|
|
396
|
-
|
|
397
|
-
const getEnvironment = (0, import_opticore_env_access.getEnvironnementValue)(this.environmentPath);
|
|
300
|
+
const getEnvironment = (0, import_opticore_env_access.getEnvironmentValue)(this.environmentPath);
|
|
398
301
|
const msg5 = getEnvironment.protocolTransfert === "" ? import_ansi_colors.default.underline(`http://${host}:${port}`) : import_ansi_colors.default.underline(`${getEnvironment.protocolTransfert}://${host}:${port}`);
|
|
399
302
|
const messages = [
|
|
400
303
|
import_opticore_translator.TranslationLoader.t("webServerListening", this.localLanguage),
|
|
@@ -415,12 +318,11 @@ var CoreService = class {
|
|
|
415
318
|
});
|
|
416
319
|
console.log(border);
|
|
417
320
|
console.log("\n");
|
|
418
|
-
|
|
419
|
-
logCore.success({
|
|
321
|
+
this.logger.success({
|
|
420
322
|
title: import_opticore_translator.TranslationLoader.t("serverRunningTitle", this.localLanguage),
|
|
421
323
|
message: import_opticore_translator.TranslationLoader.t("serverRunningAt", this.localLanguage, { server: msg5 })
|
|
422
324
|
});
|
|
423
|
-
|
|
325
|
+
this.serverLog.serverLog({
|
|
424
326
|
timestamp: (/* @__PURE__ */ new Date()).toString(),
|
|
425
327
|
level: "SERVER",
|
|
426
328
|
title: import_opticore_translator.TranslationLoader.t("serverRunningTitle", this.localLanguage),
|
|
@@ -428,7 +330,7 @@ var CoreService = class {
|
|
|
428
330
|
message: import_opticore_translator.TranslationLoader.t("serverRunningAt", this.localLanguage, { server: msg5 })
|
|
429
331
|
});
|
|
430
332
|
} catch (err) {
|
|
431
|
-
|
|
333
|
+
this.logger.error({
|
|
432
334
|
message: err.message,
|
|
433
335
|
title: import_opticore_translator.TranslationLoader.t("server", this.localLanguage),
|
|
434
336
|
errorType: err.code,
|
|
@@ -444,6 +346,20 @@ var dateTimeFormattedUtils = `${(/* @__PURE__ */ new Date()).getMonth()}-${(/* @
|
|
|
444
346
|
|
|
445
347
|
// src/application/service/serverStartError.service.ts
|
|
446
348
|
var import_opticore_catch_exception_error2 = require("opticore-catch-exception-error");
|
|
349
|
+
|
|
350
|
+
// src/application/service/logger.service.ts
|
|
351
|
+
var SLogger = (localLang) => {
|
|
352
|
+
return {
|
|
353
|
+
get serverLog() {
|
|
354
|
+
return dependenciesContainerProvider(localLang).resolve("OpticoreLogger");
|
|
355
|
+
},
|
|
356
|
+
get logger() {
|
|
357
|
+
return dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// src/application/service/serverStartError.service.ts
|
|
447
363
|
var import_opticore_http_response2 = require("opticore-http-response");
|
|
448
364
|
var SServerStartError = (err, environmentPath) => {
|
|
449
365
|
if (err.name) {
|
|
@@ -476,152 +392,108 @@ var SServerStartError = (err, environmentPath) => {
|
|
|
476
392
|
};
|
|
477
393
|
|
|
478
394
|
// src/core/webServer.core.ts
|
|
479
|
-
var
|
|
395
|
+
var import_opticore_dependency_inject2 = require("opticore-dependency-inject");
|
|
480
396
|
var WebServerCore = class {
|
|
481
397
|
serverUtility;
|
|
482
|
-
expressApp = (0,
|
|
483
|
-
fileWatcher;
|
|
398
|
+
expressApp = (0, import_opticore_express2.express)();
|
|
484
399
|
localLanguage;
|
|
485
400
|
loggerConfig;
|
|
486
401
|
routerExpressApp;
|
|
487
|
-
|
|
402
|
+
getEnvironmentValue;
|
|
488
403
|
environmentPath;
|
|
489
404
|
serverListenEvent;
|
|
490
|
-
|
|
491
|
-
currentDependencies = [];
|
|
492
|
-
server = void 0;
|
|
493
|
-
errorEmitter;
|
|
494
|
-
isWatcherEnabled = true;
|
|
495
|
-
serverStatus = "STARTING";
|
|
496
|
-
serverStartTime = /* @__PURE__ */ new Date();
|
|
405
|
+
dependenciesRegistered = false;
|
|
497
406
|
constructor(paramsConstructor) {
|
|
498
|
-
this.
|
|
407
|
+
this.loadTranslationFiles();
|
|
408
|
+
this.stackTraceErrorHandling();
|
|
409
|
+
this.getEnvironmentValue = (0, import_opticore_env_access2.getEnvironmentValue)(paramsConstructor.environmentPath);
|
|
499
410
|
this.routerExpressApp = paramsConstructor.app;
|
|
500
411
|
this.loggerConfig = paramsConstructor.loggerConfig;
|
|
501
412
|
this.localLanguage = paramsConstructor.localLanguage;
|
|
502
413
|
this.environmentPath = paramsConstructor.environmentPath;
|
|
503
|
-
this.expressApp.use(
|
|
504
|
-
this.expressApp.use(
|
|
505
|
-
this.expressApp.use(
|
|
506
|
-
this.expressApp.use(
|
|
414
|
+
this.expressApp.use(import_opticore_express2.express.json());
|
|
415
|
+
this.expressApp.use(import_opticore_express2.express.raw());
|
|
416
|
+
this.expressApp.use(import_opticore_express2.express.text());
|
|
417
|
+
this.expressApp.use(import_opticore_express2.express.urlencoded({ extended: true }));
|
|
507
418
|
this.expressApp.use((0, import_cors.default)(paramsConstructor.corsOriginOptions));
|
|
508
419
|
this.serverListenEvent = new import_opticore_catch_exception_error3.ServerListenEventError(paramsConstructor.localLanguage);
|
|
509
420
|
this.serverUtility = new CoreService(paramsConstructor.localLanguage, paramsConstructor.environmentPath);
|
|
510
421
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
422
|
+
registerDependencies(dependencies2) {
|
|
423
|
+
try {
|
|
424
|
+
if (dependencies2 && dependencies2.length > 0) {
|
|
425
|
+
dependencies2.forEach((dependency) => {
|
|
426
|
+
return new import_opticore_dependency_inject2.SContainer(this.localLanguage).register(dependency.key, dependency.factory, dependency.scope);
|
|
427
|
+
});
|
|
428
|
+
} else {
|
|
429
|
+
SLogger(this.environmentPath).logger.info({
|
|
430
|
+
message: import_opticore_translator2.TranslationLoader.t("NO_REGISTER_DEPENDENCIES", this.localLanguage),
|
|
431
|
+
title: import_opticore_translator2.TranslationLoader.t("REGISTER_DEPENDENCIES", this.localLanguage)
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
} catch (err) {
|
|
435
|
+
SLogger(this.environmentPath).logger.error({
|
|
436
|
+
message: err.message,
|
|
437
|
+
title: "Register Dependencies",
|
|
438
|
+
errorType: err.code,
|
|
439
|
+
stackTrace: err.stack,
|
|
440
|
+
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
441
|
+
});
|
|
522
442
|
}
|
|
523
|
-
|
|
443
|
+
}
|
|
444
|
+
onStartServer(routers, databaseCallback, dependenciesProvider) {
|
|
445
|
+
this.loadTranslationFiles();
|
|
446
|
+
if (this.getEnvironmentValue.appPort === "" && Number(this.getEnvironmentValue.appPort) === 0) {
|
|
447
|
+
this.serverListenEvent.hostPortUndefined(Number(this.getEnvironmentValue.appPort));
|
|
448
|
+
} else if (this.getEnvironmentValue.appHost === "") {
|
|
449
|
+
this.serverListenEvent.hostUndefined(this.getEnvironmentValue.appHost);
|
|
450
|
+
} else if (Number(this.getEnvironmentValue.appPort) === 0) {
|
|
524
451
|
this.serverListenEvent.portUndefined();
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (this.localLanguage === "") {
|
|
528
|
-
SLogger(this.localLanguage).logger.error({
|
|
452
|
+
} else if (this.localLanguage === "") {
|
|
453
|
+
SLogger(this.environmentPath).logger.error({
|
|
529
454
|
message: import_opticore_translator2.TranslationLoader.t("noDefaultLocalLang", this.localLanguage),
|
|
530
455
|
title: import_opticore_translator2.TranslationLoader.t("noLocalLang", this.localLanguage),
|
|
531
456
|
errorType: import_opticore_translator2.TranslationLoader.t("localLangMissing", this.localLanguage),
|
|
532
457
|
stackTrace: void 0,
|
|
533
458
|
httpCodeValue: import_opticore_http_response3.HttpStatusCode.NOT_FOUND
|
|
534
459
|
});
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
this.registerRoutes(this.currentRoutes);
|
|
548
|
-
this.setupErrorHandling();
|
|
549
|
-
this.setupServerEvents();
|
|
550
|
-
if (this.isWatcherEnabled) {
|
|
551
|
-
this.initializeFileWatcher();
|
|
460
|
+
} else {
|
|
461
|
+
return this.expressApp.listen(
|
|
462
|
+
Number(this.getEnvironmentValue.appPort),
|
|
463
|
+
() => {
|
|
464
|
+
this.loadTranslationFiles();
|
|
465
|
+
try {
|
|
466
|
+
databaseCallback(this.getEnvironmentValue);
|
|
467
|
+
new import_opticore_dependency_inject2.SContainer(this.localLanguage, dependenciesProvider);
|
|
468
|
+
this.expressApp.use(import_opticore_express2.express.static(path2.join(import_node_process3.default.cwd(), "public/template")));
|
|
469
|
+
this.registerRoutes(routers);
|
|
470
|
+
} catch (err) {
|
|
471
|
+
SServerStartError(err, this.environmentPath);
|
|
552
472
|
}
|
|
553
|
-
this.infoWebApp();
|
|
554
|
-
} catch (err) {
|
|
555
|
-
SLogger(this.localLanguage).logger.error({
|
|
556
|
-
title: import_opticore_translator2.TranslationLoader.t("STARTUP_ERROR", this.localLanguage),
|
|
557
|
-
message: err.message,
|
|
558
|
-
errorType: err.code,
|
|
559
|
-
stackTrace: err.stackTrace,
|
|
560
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
561
|
-
});
|
|
562
|
-
SServerStartError(err, this.environmentPath);
|
|
563
473
|
}
|
|
564
|
-
|
|
565
|
-
);
|
|
566
|
-
return this.server;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Error handling configuration
|
|
570
|
-
*/
|
|
571
|
-
setupErrorHandling() {
|
|
572
|
-
SLogger(this.localLanguage).logger.info({
|
|
573
|
-
title: import_opticore_translator2.TranslationLoader.t("SETTING_UP", this.localLanguage),
|
|
574
|
-
message: import_opticore_translator2.TranslationLoader.t("SETTING_UP_ERROR", this.localLanguage)
|
|
575
|
-
});
|
|
576
|
-
this.errorEmitter = eventProcessHandler(this.localLanguage, this.expressApp);
|
|
577
|
-
if (this.errorEmitter) {
|
|
578
|
-
this.errorEmitter.on("transformError", (error) => {
|
|
579
|
-
SLogger(this.localLanguage).logger.error({
|
|
580
|
-
title: import_opticore_translator2.TranslationLoader.t("TRANSFORM_ERROR", this.localLanguage),
|
|
581
|
-
message: error.message,
|
|
582
|
-
errorType: error.name,
|
|
583
|
-
stackTrace: error.stackTrace,
|
|
584
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
585
|
-
});
|
|
586
|
-
});
|
|
587
|
-
this.errorEmitter.on("error", (error) => {
|
|
588
|
-
SLogger(this.localLanguage).logger.info({
|
|
589
|
-
title: import_opticore_translator2.TranslationLoader.t("ERROR_EMITTED", this.localLanguage),
|
|
590
|
-
message: error.message
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
this.errorEmitter.on("hotReload", (data) => {
|
|
594
|
-
SLogger(this.localLanguage).logger.info({
|
|
595
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_EVENT", this.localLanguage),
|
|
596
|
-
message: `Hot reload triggered for ${data.file}`
|
|
597
|
-
});
|
|
598
|
-
});
|
|
474
|
+
);
|
|
599
475
|
}
|
|
600
|
-
SLogger(this.localLanguage).logger.info({
|
|
601
|
-
title: import_opticore_translator2.TranslationLoader.t("ERROR_HANDLING", this.localLanguage),
|
|
602
|
-
message: import_opticore_translator2.TranslationLoader.t("ERROR_HANDLING_CONFIGURED", this.localLanguage)
|
|
603
|
-
});
|
|
604
476
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
setupServerEvents() {
|
|
609
|
-
if (!this.server) return;
|
|
610
|
-
this.server.on(import_opticore_catch_exception_error3.CEventNameError.error, (err) => {
|
|
477
|
+
onListeningOnServerEvent(serverWeb) {
|
|
478
|
+
this.loadTranslationFiles();
|
|
479
|
+
serverWeb.on(import_opticore_catch_exception_error3.CEventNameError.error, (err) => {
|
|
611
480
|
this.serverListenEvent.onEventError(err);
|
|
612
|
-
})
|
|
613
|
-
this.server.on(import_opticore_catch_exception_error3.CEventNameError.close, () => {
|
|
481
|
+
}).on(import_opticore_catch_exception_error3.CEventNameError.close, () => {
|
|
614
482
|
this.serverListenEvent.serverClosing();
|
|
615
|
-
})
|
|
616
|
-
this.server.on(import_opticore_catch_exception_error3.CEventNameError.drop, () => {
|
|
483
|
+
}).on(import_opticore_catch_exception_error3.CEventNameError.drop, () => {
|
|
617
484
|
this.serverListenEvent.dropNewConnection();
|
|
485
|
+
}).on(import_opticore_catch_exception_error3.CEventNameError.listening, () => {
|
|
486
|
+
this.infoWebApp();
|
|
618
487
|
});
|
|
619
|
-
|
|
488
|
+
}
|
|
489
|
+
onRequestOnServerEvent(serverWeb) {
|
|
490
|
+
this.loadTranslationFiles();
|
|
491
|
+
serverWeb.on(import_opticore_catch_exception_error3.CEventNameError.request, (req, res) => {
|
|
620
492
|
(0, import_opticore_request_call_event.requestCallsEvent)(
|
|
621
493
|
req,
|
|
622
494
|
res,
|
|
623
|
-
this.
|
|
624
|
-
Number(this.
|
|
495
|
+
this.getEnvironmentValue.appHost,
|
|
496
|
+
Number(this.getEnvironmentValue.appPort),
|
|
625
497
|
dateTimeFormattedUtils,
|
|
626
498
|
this.environmentPath,
|
|
627
499
|
this.localLanguage
|
|
@@ -629,645 +501,42 @@ var WebServerCore = class {
|
|
|
629
501
|
});
|
|
630
502
|
}
|
|
631
503
|
/**
|
|
632
|
-
*
|
|
633
|
-
|
|
634
|
-
initializeFileWatcher() {
|
|
635
|
-
try {
|
|
636
|
-
this.fileWatcher = new import_opticore_watcher.WebServerWatcherService(this.localLanguage);
|
|
637
|
-
this.setupWatcherEvents();
|
|
638
|
-
this.fileWatcher.startWatching();
|
|
639
|
-
this.fileWatcher.setHotReload(true);
|
|
640
|
-
SLogger(this.localLanguage).logger.info({
|
|
641
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_INITIALIZED", this.localLanguage),
|
|
642
|
-
message: "File watcher has been initialized successfully"
|
|
643
|
-
});
|
|
644
|
-
} catch (error) {
|
|
645
|
-
SLogger(this.localLanguage).logger.error({
|
|
646
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_INIT_ERROR", this.localLanguage),
|
|
647
|
-
message: `Failed to initialize file watcher: ${error.message}`,
|
|
648
|
-
errorType: "WatcherInitializationError",
|
|
649
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Setup watcher events
|
|
655
|
-
*/
|
|
656
|
-
setupWatcherEvents() {
|
|
657
|
-
if (!this.fileWatcher) return;
|
|
658
|
-
try {
|
|
659
|
-
this.fileWatcher.on("fileChangeDetected", (data) => {
|
|
660
|
-
this.handleFileChange(data);
|
|
661
|
-
});
|
|
662
|
-
this.fileWatcher.on("hotReloadRequired", (data) => {
|
|
663
|
-
this.handleHotReload(data);
|
|
664
|
-
});
|
|
665
|
-
this.fileWatcher.on("watcherError", (error) => {
|
|
666
|
-
this.handleWatcherError(error);
|
|
667
|
-
});
|
|
668
|
-
this.fileWatcher.on("started", () => {
|
|
669
|
-
SLogger(this.localLanguage).logger.info({
|
|
670
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_STARTED", this.localLanguage),
|
|
671
|
-
message: import_opticore_translator2.TranslationLoader.t("FILE_WATCHER_ACTIVE", this.localLanguage)
|
|
672
|
-
});
|
|
673
|
-
});
|
|
674
|
-
this.fileWatcher.on("stopped", () => {
|
|
675
|
-
SLogger(this.localLanguage).logger.info({
|
|
676
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_STOPPED", this.localLanguage),
|
|
677
|
-
message: import_opticore_translator2.TranslationLoader.t("FILE_WATCHER_INACTIVE", this.localLanguage)
|
|
678
|
-
});
|
|
679
|
-
});
|
|
680
|
-
} catch (error) {
|
|
681
|
-
SLogger(this.localLanguage).logger.error({
|
|
682
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_EVENTS_ERROR", this.localLanguage),
|
|
683
|
-
message: `Failed to setup watcher events: ${error.message}`,
|
|
684
|
-
errorType: "WatcherEventsError",
|
|
685
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Handle file changes detected by watcher
|
|
691
|
-
*/
|
|
692
|
-
handleFileChange(data) {
|
|
693
|
-
const { event: event2, action, requiresReload } = data;
|
|
694
|
-
SLogger(this.localLanguage).logger.info({
|
|
695
|
-
title: import_opticore_translator2.TranslationLoader.t("FILE_CHANGE_HANDLED", this.localLanguage),
|
|
696
|
-
message: import_opticore_translator2.TranslationLoader.t(
|
|
697
|
-
"PROCESSING_FILE_CHANGE",
|
|
698
|
-
this.localLanguage
|
|
699
|
-
).replace(
|
|
700
|
-
"{file}",
|
|
701
|
-
path2.basename(event2.filePath)
|
|
702
|
-
).replace(
|
|
703
|
-
"{action}",
|
|
704
|
-
action
|
|
705
|
-
)
|
|
706
|
-
});
|
|
707
|
-
if (this.errorEmitter) {
|
|
708
|
-
this.errorEmitter.emit("fileChanged", {
|
|
709
|
-
file: event2.filePath,
|
|
710
|
-
type: event2.extension,
|
|
711
|
-
action,
|
|
712
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
switch (action) {
|
|
716
|
-
case "reloadEnvironment":
|
|
717
|
-
this.reloadEnvironmentConfig();
|
|
718
|
-
break;
|
|
719
|
-
case "reloadConfig":
|
|
720
|
-
this.reloadConfigurationFiles();
|
|
721
|
-
break;
|
|
722
|
-
case "reloadRoutes":
|
|
723
|
-
this.reloadApplicationRoutes(event2.filePath);
|
|
724
|
-
break;
|
|
725
|
-
case "reloadDependencies":
|
|
726
|
-
this.reloadDependencies();
|
|
727
|
-
break;
|
|
728
|
-
case "notifyOnly":
|
|
729
|
-
this.notifyFileChange(event2);
|
|
730
|
-
break;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Handle hot reload requested by watcher
|
|
735
|
-
*/
|
|
736
|
-
handleHotReload(data) {
|
|
737
|
-
const { file, type, action } = data;
|
|
738
|
-
SLogger(this.localLanguage).logger.info({
|
|
739
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_STARTING", this.localLanguage),
|
|
740
|
-
message: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_FOR_FILE", this.localLanguage).replace("{file}", path2.basename(file)).replace("{type}", type)
|
|
741
|
-
});
|
|
742
|
-
if (this.errorEmitter) {
|
|
743
|
-
this.errorEmitter.emit("hotReload", {
|
|
744
|
-
file,
|
|
745
|
-
type,
|
|
746
|
-
action,
|
|
747
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
switch (action) {
|
|
751
|
-
case "reloadEnvironment":
|
|
752
|
-
this.executeHotReloadEnvironment(file);
|
|
753
|
-
break;
|
|
754
|
-
case "reloadConfig":
|
|
755
|
-
this.executeHotReloadConfig(file);
|
|
756
|
-
break;
|
|
757
|
-
case "reloadRoutes":
|
|
758
|
-
this.executeHotReloadRoutes(file);
|
|
759
|
-
break;
|
|
760
|
-
case "reloadDependencies":
|
|
761
|
-
this.executeHotReloadDependencies(file);
|
|
762
|
-
break;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Handle watcher errors
|
|
767
|
-
*/
|
|
768
|
-
handleWatcherError(error) {
|
|
769
|
-
SLogger(this.localLanguage).logger.error({
|
|
770
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_SYSTEM_ERROR", this.localLanguage),
|
|
771
|
-
message: error.message || "Unknown watcher system error",
|
|
772
|
-
errorType: "WatcherSystemError",
|
|
773
|
-
stackTrace: error.stack,
|
|
774
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Notify file change without action
|
|
779
|
-
*/
|
|
780
|
-
notifyFileChange(event2) {
|
|
781
|
-
SLogger(this.localLanguage).logger.info({
|
|
782
|
-
title: import_opticore_translator2.TranslationLoader.t("FILE_CHANGE_NOTIFIED", this.localLanguage),
|
|
783
|
-
message: import_opticore_translator2.TranslationLoader.t("FILE_CHANGE_NO_ACTION", this.localLanguage).replace("{file}", path2.basename(event2.filePath))
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
/**
|
|
787
|
-
* Reload environment configuration
|
|
788
|
-
*/
|
|
789
|
-
reloadEnvironmentConfig() {
|
|
790
|
-
try {
|
|
791
|
-
this.reloadConfigurations();
|
|
792
|
-
SLogger(this.localLanguage).logger.info({
|
|
793
|
-
title: import_opticore_translator2.TranslationLoader.t("ENV_RELOADED", this.localLanguage),
|
|
794
|
-
message: import_opticore_translator2.TranslationLoader.t("ENVIRONMENT_RELOADED_SUCCESS", this.localLanguage)
|
|
795
|
-
});
|
|
796
|
-
this.notifyEnvironmentReload();
|
|
797
|
-
} catch (error) {
|
|
798
|
-
SLogger(this.localLanguage).logger.error({
|
|
799
|
-
title: import_opticore_translator2.TranslationLoader.t("ENV_RELOAD_FAILED", this.localLanguage),
|
|
800
|
-
message: error.message,
|
|
801
|
-
errorType: "EnvironmentReloadError",
|
|
802
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Execute hot reload for environment files
|
|
808
|
-
*/
|
|
809
|
-
executeHotReloadEnvironment(filePath) {
|
|
810
|
-
try {
|
|
811
|
-
const newEnv = (0, import_opticore_env_access2.getEnvironnementValue)(this.environmentPath);
|
|
812
|
-
Object.keys(newEnv).forEach((key) => {
|
|
813
|
-
this.getEnvironment[key] = newEnv[key];
|
|
814
|
-
});
|
|
815
|
-
loaderTranslationFile(this.localLanguage);
|
|
816
|
-
SLogger(this.localLanguage).logger.info({
|
|
817
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_ENV_SUCCESS", this.localLanguage),
|
|
818
|
-
message: import_opticore_translator2.TranslationLoader.t("ENV_HOT_RELOAD_COMPLETE", this.localLanguage).replace("{file}", path2.basename(filePath))
|
|
819
|
-
});
|
|
820
|
-
} catch (error) {
|
|
821
|
-
SLogger(this.localLanguage).logger.error({
|
|
822
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_ENV_FAILED", this.localLanguage),
|
|
823
|
-
message: error.message,
|
|
824
|
-
errorType: "HotReloadEnvironmentError",
|
|
825
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Reload configuration files
|
|
831
|
-
*/
|
|
832
|
-
reloadConfigurationFiles() {
|
|
833
|
-
try {
|
|
834
|
-
loaderTranslationFile(this.localLanguage);
|
|
835
|
-
SLogger(this.localLanguage).logger.info({
|
|
836
|
-
title: import_opticore_translator2.TranslationLoader.t("CONFIG_RELOADED", this.localLanguage),
|
|
837
|
-
message: import_opticore_translator2.TranslationLoader.t("CONFIGURATION_RELOADED_SUCCESS", this.localLanguage)
|
|
838
|
-
});
|
|
839
|
-
} catch (error) {
|
|
840
|
-
SLogger(this.localLanguage).logger.error({
|
|
841
|
-
title: import_opticore_translator2.TranslationLoader.t("CONFIG_RELOAD_FAILED", this.localLanguage),
|
|
842
|
-
message: error.message,
|
|
843
|
-
errorType: "ConfigurationReloadError",
|
|
844
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* Execute hot reload for config files
|
|
850
|
-
*/
|
|
851
|
-
executeHotReloadConfig(filePath) {
|
|
852
|
-
try {
|
|
853
|
-
if (filePath.includes("locales") || filePath.includes("translations")) {
|
|
854
|
-
loaderTranslationFile(this.localLanguage);
|
|
855
|
-
SLogger(this.localLanguage).logger.info({
|
|
856
|
-
title: import_opticore_translator2.TranslationLoader.t("TRANSLATIONS_RELOADED", this.localLanguage),
|
|
857
|
-
message: import_opticore_translator2.TranslationLoader.t("TRANSLATIONS_HOT_RELOAD_COMPLETE", this.localLanguage).replace("{file}", path2.basename(filePath))
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
} catch (error) {
|
|
861
|
-
SLogger(this.localLanguage).logger.error({
|
|
862
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_CONFIG_FAILED", this.localLanguage),
|
|
863
|
-
message: error.message,
|
|
864
|
-
errorType: "HotReloadConfigError",
|
|
865
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* Reload application routes
|
|
871
|
-
*/
|
|
872
|
-
reloadApplicationRoutes(filePath) {
|
|
873
|
-
try {
|
|
874
|
-
SLogger(this.localLanguage).logger.info({
|
|
875
|
-
title: import_opticore_translator2.TranslationLoader.t("ROUTES_RELOADING", this.localLanguage),
|
|
876
|
-
message: import_opticore_translator2.TranslationLoader.t("APPLICATION_ROUTES_RELOADING", this.localLanguage).replace("{file}", path2.basename(filePath))
|
|
877
|
-
});
|
|
878
|
-
if (filePath.includes("routes") || filePath.includes("controller")) {
|
|
879
|
-
this.reloadSpecificRoute(filePath);
|
|
880
|
-
}
|
|
881
|
-
if (this.errorEmitter) {
|
|
882
|
-
this.errorEmitter.emit("routesReloaded", {
|
|
883
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
884
|
-
file: filePath,
|
|
885
|
-
routesCount: this.currentRoutes.length
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
} catch (error) {
|
|
889
|
-
SLogger(this.localLanguage).logger.error({
|
|
890
|
-
title: import_opticore_translator2.TranslationLoader.t("ROUTES_RELOAD_FAILED", this.localLanguage),
|
|
891
|
-
message: error.message,
|
|
892
|
-
errorType: "RoutesReloadError",
|
|
893
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
* Execute hot reload for routes
|
|
899
|
-
*/
|
|
900
|
-
executeHotReloadRoutes(filePath) {
|
|
901
|
-
try {
|
|
902
|
-
SLogger(this.localLanguage).logger.info({
|
|
903
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_ROUTES_START", this.localLanguage),
|
|
904
|
-
message: import_opticore_translator2.TranslationLoader.t("ROUTES_HOT_RELOADING", this.localLanguage).replace("{file}", path2.basename(filePath))
|
|
905
|
-
});
|
|
906
|
-
this.reloadRouterForFile(filePath);
|
|
907
|
-
SLogger(this.localLanguage).logger.info({
|
|
908
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_ROUTES_SUCCESS", this.localLanguage),
|
|
909
|
-
message: import_opticore_translator2.TranslationLoader.t("ROUTES_HOT_RELOAD_COMPLETE", this.localLanguage)
|
|
910
|
-
});
|
|
911
|
-
} catch (error) {
|
|
912
|
-
SLogger(this.localLanguage).logger.error({
|
|
913
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_ROUTES_FAILED", this.localLanguage),
|
|
914
|
-
message: error.message,
|
|
915
|
-
errorType: "HotReloadRoutesError",
|
|
916
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
/**
|
|
921
|
-
* Execute hot reload for dependencies
|
|
922
|
-
*/
|
|
923
|
-
executeHotReloadDependencies(filePath) {
|
|
924
|
-
try {
|
|
925
|
-
SLogger(this.localLanguage).logger.info({
|
|
926
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_DEPS_START", this.localLanguage),
|
|
927
|
-
message: import_opticore_translator2.TranslationLoader.t(
|
|
928
|
-
"DEPENDENCIES_HOT_RELOADING",
|
|
929
|
-
this.localLanguage
|
|
930
|
-
).replace("{file}", path2.basename(filePath))
|
|
931
|
-
});
|
|
932
|
-
this.reloadDependencies();
|
|
933
|
-
SLogger(this.localLanguage).logger.info({
|
|
934
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_DEPS_SUCCESS", this.localLanguage),
|
|
935
|
-
message: import_opticore_translator2.TranslationLoader.t("DEPENDENCIES_HOT_RELOAD_COMPLETE", this.localLanguage)
|
|
936
|
-
});
|
|
937
|
-
} catch (error) {
|
|
938
|
-
SLogger(this.localLanguage).logger.error({
|
|
939
|
-
title: import_opticore_translator2.TranslationLoader.t("HOT_RELOAD_DEPS_FAILED", this.localLanguage),
|
|
940
|
-
message: error.message,
|
|
941
|
-
errorType: "HotReloadDependenciesError",
|
|
942
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* Notify environment reload
|
|
948
|
-
*/
|
|
949
|
-
notifyEnvironmentReload() {
|
|
950
|
-
if (this.errorEmitter) {
|
|
951
|
-
this.errorEmitter.emit("environmentReloaded", {
|
|
952
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
953
|
-
environment: this.getEnvironment
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
* Reload specific route
|
|
959
|
-
*/
|
|
960
|
-
reloadSpecificRoute(filePath) {
|
|
961
|
-
SLogger(this.localLanguage).logger.info({
|
|
962
|
-
title: "Route Reload",
|
|
963
|
-
message: `Reloading route from: ${filePath}`
|
|
964
|
-
});
|
|
965
|
-
}
|
|
966
|
-
/**
|
|
967
|
-
* Reload router for specific file
|
|
968
|
-
*/
|
|
969
|
-
reloadRouterForFile(filePath) {
|
|
970
|
-
SLogger(this.localLanguage).logger.info({
|
|
971
|
-
title: "Router Reload",
|
|
972
|
-
message: `Reloading router for file: ${filePath}`
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
/**
|
|
976
|
-
* Reload configurations
|
|
977
|
-
*/
|
|
978
|
-
reloadConfigurations() {
|
|
979
|
-
try {
|
|
980
|
-
const newEnv = (0, import_opticore_env_access2.getEnvironnementValue)(this.environmentPath);
|
|
981
|
-
Object.keys(newEnv).forEach((key) => {
|
|
982
|
-
this.getEnvironment[key] = newEnv[key];
|
|
983
|
-
});
|
|
984
|
-
loaderTranslationFile(this.localLanguage);
|
|
985
|
-
} catch (error) {
|
|
986
|
-
throw new Error(`Configuration reload failed: ${error.message}`);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
/**
|
|
990
|
-
* Reload dependencies
|
|
504
|
+
*
|
|
505
|
+
* @private
|
|
991
506
|
*/
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
new import_opticore_dependency_inject2.SContainer(this.localLanguage, this.currentDependencies);
|
|
995
|
-
const container = dependenciesContainerProvider(this.localLanguage);
|
|
996
|
-
if (!container) {
|
|
997
|
-
throw new Error("Dependency container is not available");
|
|
998
|
-
}
|
|
999
|
-
} catch (error) {
|
|
1000
|
-
throw new Error(`Dependency reload failed: ${error.message}`);
|
|
1001
|
-
}
|
|
507
|
+
loadTranslationFiles() {
|
|
508
|
+
loaderTranslationFile(this.localLanguage);
|
|
1002
509
|
}
|
|
1003
510
|
/**
|
|
1004
|
-
*
|
|
511
|
+
*
|
|
512
|
+
* @param allFeatureRoutes
|
|
513
|
+
* @private
|
|
1005
514
|
*/
|
|
1006
515
|
registerRoutes(allFeatureRoutes) {
|
|
1007
|
-
allFeatureRoutes.
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
516
|
+
allFeatureRoutes.map((router) => {
|
|
517
|
+
router.routes.map((route) => {
|
|
518
|
+
this.expressApp.use(route.path, route.handler);
|
|
519
|
+
});
|
|
1013
520
|
});
|
|
1014
521
|
}
|
|
1015
522
|
/**
|
|
1016
|
-
*
|
|
523
|
+
*
|
|
524
|
+
* @private
|
|
1017
525
|
*/
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
let tool = "Unknown";
|
|
1021
|
-
if (errorMessage.includes("esbuild")) tool = "esbuild";
|
|
1022
|
-
if (errorMessage.includes("webpack")) tool = "webpack";
|
|
1023
|
-
const fileMatch = errorMessage.match(/([^:\s]+\.(?:ts|js|tsx|jsx)):(\d+):(\d+):/);
|
|
1024
|
-
const file = fileMatch ? fileMatch[1] : null;
|
|
1025
|
-
const line = fileMatch ? parseInt(fileMatch[2], 10) : null;
|
|
1026
|
-
const column = fileMatch ? parseInt(fileMatch[3], 10) : null;
|
|
1027
|
-
const errorDetailMatch = errorMessage.match(/ERROR:\s*(.+?)(?:\n|$)/);
|
|
1028
|
-
const errorDetail = errorDetailMatch ? errorDetailMatch[1].trim() : null;
|
|
1029
|
-
return {
|
|
1030
|
-
message: errorMessage,
|
|
1031
|
-
file,
|
|
1032
|
-
line,
|
|
1033
|
-
column,
|
|
1034
|
-
errorDetail,
|
|
1035
|
-
tool
|
|
1036
|
-
};
|
|
526
|
+
stackTraceErrorHandling() {
|
|
527
|
+
return eventProcessHandler(this.localLanguage);
|
|
1037
528
|
}
|
|
1038
529
|
/**
|
|
1039
|
-
*
|
|
530
|
+
*
|
|
531
|
+
* @private
|
|
1040
532
|
*/
|
|
1041
533
|
infoWebApp() {
|
|
534
|
+
this.loadTranslationFiles();
|
|
1042
535
|
this.serverUtility.infoServer(
|
|
1043
|
-
this.
|
|
1044
|
-
Number(this.
|
|
536
|
+
this.getEnvironmentValue.appHost,
|
|
537
|
+
Number(this.getEnvironmentValue.appPort)
|
|
1045
538
|
);
|
|
1046
539
|
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Stop file watcher
|
|
1049
|
-
*/
|
|
1050
|
-
stopFileWatcher() {
|
|
1051
|
-
if (this.fileWatcher) {
|
|
1052
|
-
try {
|
|
1053
|
-
this.fileWatcher.stopWatching();
|
|
1054
|
-
SLogger(this.localLanguage).logger.info({
|
|
1055
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_STOPPED", this.localLanguage),
|
|
1056
|
-
message: import_opticore_translator2.TranslationLoader.t("FILE_WATCHER_STOPPED_GRACEFULLY", this.localLanguage)
|
|
1057
|
-
});
|
|
1058
|
-
} catch (error) {
|
|
1059
|
-
SLogger(this.localLanguage).logger.error({
|
|
1060
|
-
title: import_opticore_translator2.TranslationLoader.t("WATCHER_STOP_ERROR", this.localLanguage),
|
|
1061
|
-
message: `Error stopping watcher: ${error.message}`,
|
|
1062
|
-
errorType: "WatcherStopError",
|
|
1063
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
1064
|
-
});
|
|
1065
|
-
} finally {
|
|
1066
|
-
this.fileWatcher = void 0;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Shutdown server
|
|
1072
|
-
*/
|
|
1073
|
-
shutdown() {
|
|
1074
|
-
this.stopFileWatcher();
|
|
1075
|
-
if (this.server) {
|
|
1076
|
-
this.server.close(() => {
|
|
1077
|
-
SLogger(this.localLanguage).logger.info({
|
|
1078
|
-
title: import_opticore_translator2.TranslationLoader.t("CLOSED", this.localLanguage),
|
|
1079
|
-
message: import_opticore_translator2.TranslationLoader.t("SERVER_CLOSED", this.localLanguage)
|
|
1080
|
-
});
|
|
1081
|
-
import_node_process3.default.exit(0);
|
|
1082
|
-
});
|
|
1083
|
-
setTimeout(() => {
|
|
1084
|
-
SLogger(this.localLanguage).logger.error({
|
|
1085
|
-
title: import_opticore_translator2.TranslationLoader.t("FORCE_SHUTDOWN", this.localLanguage),
|
|
1086
|
-
message: import_opticore_translator2.TranslationLoader.t("SERVER_FORCE_SHUTDOWN", this.localLanguage)
|
|
1087
|
-
});
|
|
1088
|
-
import_node_process3.default.exit(1);
|
|
1089
|
-
}, 5e3);
|
|
1090
|
-
} else {
|
|
1091
|
-
import_node_process3.default.exit(0);
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
/**
|
|
1095
|
-
* Enable/disable watcher
|
|
1096
|
-
*/
|
|
1097
|
-
setWatcherEnabled(enabled) {
|
|
1098
|
-
this.isWatcherEnabled = enabled;
|
|
1099
|
-
if (enabled && !this.fileWatcher) {
|
|
1100
|
-
this.initializeFileWatcher();
|
|
1101
|
-
} else if (!enabled && this.fileWatcher) {
|
|
1102
|
-
this.stopFileWatcher();
|
|
1103
|
-
}
|
|
1104
|
-
SLogger(this.localLanguage).logger.info({
|
|
1105
|
-
title: "Watcher Status",
|
|
1106
|
-
message: `File watcher ${enabled ? "enabled" : "disabled"}`
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Get watcher status
|
|
1111
|
-
*/
|
|
1112
|
-
getWatcherStatus() {
|
|
1113
|
-
return {
|
|
1114
|
-
enabled: this.isWatcherEnabled,
|
|
1115
|
-
active: this.fileWatcher !== void 0
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Get server state information
|
|
1120
|
-
*/
|
|
1121
|
-
getServerState() {
|
|
1122
|
-
const now = /* @__PURE__ */ new Date();
|
|
1123
|
-
const uptime = this.serverStartTime ? now.getTime() - this.serverStartTime.getTime() : 0;
|
|
1124
|
-
const formatUptime = (ms) => {
|
|
1125
|
-
const seconds = Math.floor(ms / 1e3);
|
|
1126
|
-
const minutes = Math.floor(seconds / 60);
|
|
1127
|
-
const hours = Math.floor(minutes / 60);
|
|
1128
|
-
const days = Math.floor(hours / 24);
|
|
1129
|
-
if (days > 0) return `${days}j ${hours % 24}h ${minutes % 60}m`;
|
|
1130
|
-
if (hours > 0) return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
1131
|
-
if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
|
|
1132
|
-
return `${seconds}s`;
|
|
1133
|
-
};
|
|
1134
|
-
const memory = import_node_process3.default.memoryUsage();
|
|
1135
|
-
return {
|
|
1136
|
-
status: this.serverStatus,
|
|
1137
|
-
isRunning: this.server !== void 0,
|
|
1138
|
-
host: this.getEnvironment.appHost,
|
|
1139
|
-
port: Number(this.getEnvironment.appPort),
|
|
1140
|
-
language: this.localLanguage,
|
|
1141
|
-
watcherEnabled: this.isWatcherEnabled,
|
|
1142
|
-
watcherActive: this.fileWatcher !== void 0,
|
|
1143
|
-
routesCount: this.currentRoutes.length,
|
|
1144
|
-
dependenciesCount: this.currentDependencies.length,
|
|
1145
|
-
startTime: this.serverStartTime,
|
|
1146
|
-
currentTime: now,
|
|
1147
|
-
uptime,
|
|
1148
|
-
uptimeFormatted: formatUptime(uptime),
|
|
1149
|
-
memoryUsage: {
|
|
1150
|
-
rss: memory.rss,
|
|
1151
|
-
heapTotal: memory.heapTotal,
|
|
1152
|
-
heapUsed: memory.heapUsed,
|
|
1153
|
-
external: memory.external,
|
|
1154
|
-
arrayBuffers: memory.arrayBuffers
|
|
1155
|
-
},
|
|
1156
|
-
pid: import_node_process3.default.pid,
|
|
1157
|
-
platform: import_node_process3.default.platform,
|
|
1158
|
-
nodeVersion: import_node_process3.default.version,
|
|
1159
|
-
cwd: import_node_process3.default.cwd()
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
/**
|
|
1163
|
-
* Simple method to get just the status
|
|
1164
|
-
*/
|
|
1165
|
-
getServerStatus() {
|
|
1166
|
-
return this.serverStatus;
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* Get server statistics for monitoring
|
|
1170
|
-
*/
|
|
1171
|
-
getServerStats() {
|
|
1172
|
-
const uptime = this.serverStartTime ? Date.now() - this.serverStartTime.getTime() : 0;
|
|
1173
|
-
const memory = import_node_process3.default.memoryUsage();
|
|
1174
|
-
return {
|
|
1175
|
-
status: this.serverStatus,
|
|
1176
|
-
uptime: this.formatUptime(uptime),
|
|
1177
|
-
memory: {
|
|
1178
|
-
rss: this.formatBytes(memory.rss),
|
|
1179
|
-
heapTotal: this.formatBytes(memory.heapTotal),
|
|
1180
|
-
heapUsed: this.formatBytes(memory.heapUsed),
|
|
1181
|
-
external: this.formatBytes(memory.external)
|
|
1182
|
-
},
|
|
1183
|
-
performance: {
|
|
1184
|
-
cpuUsage: import_node_process3.default.cpuUsage(),
|
|
1185
|
-
resourceUsage: import_node_process3.default.resourceUsage?.()
|
|
1186
|
-
}
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Format bytes to human readable string
|
|
1191
|
-
*/
|
|
1192
|
-
formatBytes(bytes) {
|
|
1193
|
-
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
1194
|
-
let value = bytes;
|
|
1195
|
-
let unitIndex = 0;
|
|
1196
|
-
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
1197
|
-
value /= 1024;
|
|
1198
|
-
unitIndex++;
|
|
1199
|
-
}
|
|
1200
|
-
return `${value.toFixed(2)} ${units[unitIndex]}`;
|
|
1201
|
-
}
|
|
1202
|
-
/**
|
|
1203
|
-
* Format uptime to human readable string
|
|
1204
|
-
*/
|
|
1205
|
-
formatUptime(ms) {
|
|
1206
|
-
const seconds = Math.floor(ms / 1e3);
|
|
1207
|
-
const minutes = Math.floor(seconds / 60);
|
|
1208
|
-
const hours = Math.floor(minutes / 60);
|
|
1209
|
-
const days = Math.floor(hours / 24);
|
|
1210
|
-
if (days > 0) {
|
|
1211
|
-
return `${days}j ${hours % 24}h ${minutes % 60}m`;
|
|
1212
|
-
} else if (hours > 0) {
|
|
1213
|
-
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
1214
|
-
} else if (minutes > 0) {
|
|
1215
|
-
return `${minutes}m ${seconds % 60}s`;
|
|
1216
|
-
} else {
|
|
1217
|
-
return `${seconds}s`;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Add watch directories
|
|
1222
|
-
*/
|
|
1223
|
-
addWatchDirectories(directories) {
|
|
1224
|
-
if (this.fileWatcher) {
|
|
1225
|
-
this.fileWatcher.addWatchDirectories(directories);
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
/**
|
|
1229
|
-
* Clear file cache
|
|
1230
|
-
*/
|
|
1231
|
-
clearFileCache() {
|
|
1232
|
-
if (this.fileWatcher) {
|
|
1233
|
-
this.fileWatcher.clearFileCache();
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Force reload configurations
|
|
1238
|
-
*/
|
|
1239
|
-
forceReloadConfig() {
|
|
1240
|
-
try {
|
|
1241
|
-
this.reloadConfigurations();
|
|
1242
|
-
this.reloadDependencies();
|
|
1243
|
-
SLogger(this.localLanguage).logger.info({
|
|
1244
|
-
title: "Force Reload",
|
|
1245
|
-
message: "All configurations and dependencies have been reloaded"
|
|
1246
|
-
});
|
|
1247
|
-
} catch (error) {
|
|
1248
|
-
SLogger(this.localLanguage).logger.error({
|
|
1249
|
-
title: "Force Reload Failed",
|
|
1250
|
-
message: error.message,
|
|
1251
|
-
errorType: "ForceReloadError",
|
|
1252
|
-
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
1253
|
-
});
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Restart watcher
|
|
1258
|
-
*/
|
|
1259
|
-
restartWatcher() {
|
|
1260
|
-
this.stopFileWatcher();
|
|
1261
|
-
if (this.isWatcherEnabled) {
|
|
1262
|
-
setTimeout(() => {
|
|
1263
|
-
this.initializeFileWatcher();
|
|
1264
|
-
SLogger(this.localLanguage).logger.info({
|
|
1265
|
-
title: "Watcher Restarted",
|
|
1266
|
-
message: "File watcher has been restarted successfully"
|
|
1267
|
-
});
|
|
1268
|
-
}, 1e3);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
540
|
};
|
|
1272
541
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1273
542
|
0 && (module.exports = {
|