ecto 4.8.4 → 4.8.6
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/ecto.mjs +15 -15
- package/package.json +15 -15
package/dist/ecto.mjs
CHANGED
|
@@ -306,7 +306,7 @@ var Ecto = class extends Hookified {
|
|
|
306
306
|
set defaultEngine(value) {
|
|
307
307
|
value = value.toLowerCase().trim();
|
|
308
308
|
if (this.isValidEngine(value)) this._defaultEngine = value;
|
|
309
|
-
else this.emit(
|
|
309
|
+
else this.emit("warn", `Invalid engine name: ${value}. Defaulting to ${this._defaultEngine}.`);
|
|
310
310
|
}
|
|
311
311
|
/**
|
|
312
312
|
* Get the cacheable instance
|
|
@@ -404,7 +404,7 @@ var Ecto = class extends Hookified {
|
|
|
404
404
|
if (this._cache) {
|
|
405
405
|
const cachedResult = await this._cache.get(cacheKey);
|
|
406
406
|
if (cachedResult) {
|
|
407
|
-
this.emit(
|
|
407
|
+
this.emit("cacheHit", `Cache hit for key: ${cacheKey}`);
|
|
408
408
|
const context = {
|
|
409
409
|
source,
|
|
410
410
|
data,
|
|
@@ -413,16 +413,16 @@ var Ecto = class extends Hookified {
|
|
|
413
413
|
filePathOutput,
|
|
414
414
|
cached: true
|
|
415
415
|
};
|
|
416
|
-
await this.hook(
|
|
416
|
+
await this.hook("beforeRender", context);
|
|
417
417
|
const renderResult = {
|
|
418
418
|
result: cachedResult,
|
|
419
419
|
context
|
|
420
420
|
};
|
|
421
|
-
await this.hook(
|
|
421
|
+
await this.hook("afterRender", renderResult);
|
|
422
422
|
await this.writeFile(filePathOutput, renderResult.result);
|
|
423
423
|
return renderResult.result;
|
|
424
424
|
}
|
|
425
|
-
this.emit(
|
|
425
|
+
this.emit("cacheMiss", `Cache miss for key: ${cacheKey}`);
|
|
426
426
|
}
|
|
427
427
|
const context = {
|
|
428
428
|
source,
|
|
@@ -432,7 +432,7 @@ var Ecto = class extends Hookified {
|
|
|
432
432
|
filePathOutput,
|
|
433
433
|
cached: false
|
|
434
434
|
};
|
|
435
|
-
await this.hook(
|
|
435
|
+
await this.hook("beforeRender", context);
|
|
436
436
|
const renderEngine = this.getRenderEngine(renderEngineName);
|
|
437
437
|
renderEngine.rootTemplatePath = context.rootTemplatePath;
|
|
438
438
|
let result = await renderEngine.render(context.source, context.data);
|
|
@@ -440,14 +440,14 @@ var Ecto = class extends Hookified {
|
|
|
440
440
|
result,
|
|
441
441
|
context
|
|
442
442
|
};
|
|
443
|
-
await this.hook(
|
|
443
|
+
await this.hook("afterRender", renderResult);
|
|
444
444
|
result = renderResult.result;
|
|
445
445
|
if (this._cache) await this._cache.set(cacheKey, result);
|
|
446
446
|
await this.writeFile(filePathOutput, result);
|
|
447
447
|
return result;
|
|
448
448
|
} catch (error) {
|
|
449
449
|
/* v8 ignore next -- @preserve */
|
|
450
|
-
this.emit(
|
|
450
|
+
this.emit("error", error);
|
|
451
451
|
/* v8 ignore next -- @preserve */
|
|
452
452
|
return "";
|
|
453
453
|
}
|
|
@@ -471,7 +471,7 @@ var Ecto = class extends Hookified {
|
|
|
471
471
|
if (this._cacheSync) {
|
|
472
472
|
const cachedResult = this._cacheSync.get(cacheKey);
|
|
473
473
|
if (cachedResult) {
|
|
474
|
-
this.emit(
|
|
474
|
+
this.emit("cacheHit", `Cache hit for key: ${cacheKey}`);
|
|
475
475
|
const context = {
|
|
476
476
|
source,
|
|
477
477
|
data,
|
|
@@ -480,16 +480,16 @@ var Ecto = class extends Hookified {
|
|
|
480
480
|
filePathOutput,
|
|
481
481
|
cached: true
|
|
482
482
|
};
|
|
483
|
-
this.hookSync(
|
|
483
|
+
this.hookSync("beforeRenderSync", context);
|
|
484
484
|
const renderResult = {
|
|
485
485
|
result: cachedResult,
|
|
486
486
|
context
|
|
487
487
|
};
|
|
488
|
-
this.hookSync(
|
|
488
|
+
this.hookSync("afterRenderSync", renderResult);
|
|
489
489
|
this.writeFileSync(filePathOutput, renderResult.result);
|
|
490
490
|
return renderResult.result;
|
|
491
491
|
}
|
|
492
|
-
this.emit(
|
|
492
|
+
this.emit("cacheMiss", `Cache miss for key: ${cacheKey}`);
|
|
493
493
|
}
|
|
494
494
|
const context = {
|
|
495
495
|
source,
|
|
@@ -499,7 +499,7 @@ var Ecto = class extends Hookified {
|
|
|
499
499
|
filePathOutput,
|
|
500
500
|
cached: false
|
|
501
501
|
};
|
|
502
|
-
this.hookSync(
|
|
502
|
+
this.hookSync("beforeRenderSync", context);
|
|
503
503
|
const renderEngine = this.getRenderEngine(renderEngineName);
|
|
504
504
|
renderEngine.rootTemplatePath = context.rootTemplatePath;
|
|
505
505
|
let result = renderEngine.renderSync(context.source, context.data);
|
|
@@ -507,13 +507,13 @@ var Ecto = class extends Hookified {
|
|
|
507
507
|
result,
|
|
508
508
|
context
|
|
509
509
|
};
|
|
510
|
-
this.hookSync(
|
|
510
|
+
this.hookSync("afterRenderSync", renderResult);
|
|
511
511
|
result = renderResult.result;
|
|
512
512
|
if (this._cacheSync) this._cacheSync.set(cacheKey, result);
|
|
513
513
|
this.writeFileSync(filePathOutput, result);
|
|
514
514
|
return result;
|
|
515
515
|
} catch (error) {
|
|
516
|
-
this.emit(
|
|
516
|
+
this.emit("error", error);
|
|
517
517
|
return "";
|
|
518
518
|
}
|
|
519
519
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ecto",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.6",
|
|
4
4
|
"description": "Modern Template Consolidation Engine for EJS, Markdown, Pug, Nunjucks, Liquid, and Handlebars",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/ecto.mjs",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"liquidjs"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jaredwray/fumanchu": "^4.
|
|
43
|
-
"cacheable": "^2.3.
|
|
44
|
-
"ejs": "^5.0.
|
|
42
|
+
"@jaredwray/fumanchu": "^4.7.0",
|
|
43
|
+
"cacheable": "^2.3.5",
|
|
44
|
+
"ejs": "^5.0.2",
|
|
45
45
|
"ent": "^2.2.2",
|
|
46
|
-
"hookified": "^2.
|
|
47
|
-
"liquidjs": "^10.
|
|
46
|
+
"hookified": "^2.2.0",
|
|
47
|
+
"liquidjs": "^10.27.0",
|
|
48
48
|
"nunjucks": "^3.2.4",
|
|
49
49
|
"pug": "^3.0.4",
|
|
50
|
-
"writr": "^6.1.
|
|
50
|
+
"writr": "^6.1.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@biomejs/biome": "^2.4.
|
|
53
|
+
"@biomejs/biome": "^2.4.14",
|
|
54
54
|
"@faker-js/faker": "^10.4.0",
|
|
55
55
|
"@types/ejs": "^3.1.5",
|
|
56
56
|
"@types/ent": "^2.2.8",
|
|
57
|
-
"@types/node": "^
|
|
57
|
+
"@types/node": "^24.0.15",
|
|
58
58
|
"@types/nunjucks": "^3.2.6",
|
|
59
59
|
"@types/pug": "^2.0.10",
|
|
60
|
-
"@vitest/coverage-v8": "^4.1.
|
|
61
|
-
"docula": "^1.
|
|
60
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
61
|
+
"docula": "^1.14.0",
|
|
62
62
|
"rimraf": "^6.1.3",
|
|
63
|
-
"tsdown": "^0.
|
|
64
|
-
"typescript": "^6.0.
|
|
65
|
-
"vite": "^8.0.
|
|
66
|
-
"vitest": "^4.1.
|
|
63
|
+
"tsdown": "^0.22.0",
|
|
64
|
+
"typescript": "^6.0.3",
|
|
65
|
+
"vite": "^8.0.11",
|
|
66
|
+
"vitest": "^4.1.5"
|
|
67
67
|
},
|
|
68
68
|
"files": [
|
|
69
69
|
"dist",
|