elseware-nodejs 1.7.3 → 1.7.5
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 +37 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +37 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -337,17 +337,31 @@ async function connectMongoDB(config) {
|
|
|
337
337
|
process.exit(1);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
dotenv__default.default.config(
|
|
341
|
-
function loadEnv(
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
dotenv__default.default.config();
|
|
341
|
+
function loadEnv(options) {
|
|
342
|
+
const result = options.schema.safeParse(process.env);
|
|
343
|
+
if (!result.success) {
|
|
344
|
+
handleError(result.error);
|
|
345
|
+
}
|
|
346
|
+
logger.success("\u2705 Env Configurations validated");
|
|
347
|
+
return options.transform ? options.transform(result.data) : result.data;
|
|
348
|
+
}
|
|
349
|
+
function handleError(error) {
|
|
350
|
+
console.error("\u274C ENV VALIDATION FAILED");
|
|
351
|
+
const grouped = {};
|
|
352
|
+
error.issues.forEach((err) => {
|
|
353
|
+
const key = err.path.join(".") || "unknown";
|
|
354
|
+
if (!grouped[key]) grouped[key] = [];
|
|
355
|
+
grouped[key].push(err.message);
|
|
345
356
|
});
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
357
|
+
Object.entries(grouped).forEach(([key, messages]) => {
|
|
358
|
+
console.error(`\u{1F539} ${key}`);
|
|
359
|
+
messages.forEach((msg) => {
|
|
360
|
+
console.error(` - ${msg}`);
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
console.error("\u{1F6AB} Application startup aborted.\n");
|
|
364
|
+
process.exit(1);
|
|
351
365
|
}
|
|
352
366
|
|
|
353
367
|
// src/configs/cors/allowedOrigins.ts
|
|
@@ -5334,16 +5348,20 @@ var TemplateEngine = class {
|
|
|
5334
5348
|
static partialsLoaded = {};
|
|
5335
5349
|
static cssCache = {};
|
|
5336
5350
|
static registerPartials(templateDir) {
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5351
|
+
if (this.partialsLoaded[templateDir]) return;
|
|
5352
|
+
const registerFromDir = (dirPath) => {
|
|
5353
|
+
if (!fs3__default.default.existsSync(dirPath)) return;
|
|
5354
|
+
const files = fs3__default.default.readdirSync(dirPath);
|
|
5355
|
+
for (const file of files) {
|
|
5356
|
+
if (file.endsWith(".hbs")) {
|
|
5357
|
+
const name = path__default.default.basename(file, ".hbs");
|
|
5358
|
+
const content = fs3__default.default.readFileSync(path__default.default.join(dirPath, file), "utf-8");
|
|
5359
|
+
Handlebars__default.default.registerPartial(name, content);
|
|
5360
|
+
}
|
|
5345
5361
|
}
|
|
5346
|
-
}
|
|
5362
|
+
};
|
|
5363
|
+
registerFromDir(path__default.default.join(templateDir, "partials"));
|
|
5364
|
+
registerFromDir(path__default.default.join(templateDir, "layouts"));
|
|
5347
5365
|
this.partialsLoaded[templateDir] = true;
|
|
5348
5366
|
}
|
|
5349
5367
|
static loadAllCSS(stylesDir) {
|