ecto 4.2.3 → 4.2.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/dist/ecto.js +14 -14
- package/package.json +11 -11
package/dist/ecto.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/ecto.ts
|
|
2
|
-
import fs2 from "
|
|
2
|
+
import fs2 from "fs";
|
|
3
3
|
import { Writr as Writr2 } from "writr";
|
|
4
4
|
|
|
5
5
|
// src/engine-map.ts
|
|
@@ -101,7 +101,7 @@ var Markdown = class extends BaseEngine {
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
// src/engines/handlebars.ts
|
|
104
|
-
import fs from "
|
|
104
|
+
import fs from "fs";
|
|
105
105
|
import * as _ from "underscore";
|
|
106
106
|
import { helpers, handlebars } from "@jaredwray/fumanchu";
|
|
107
107
|
var Handlebars = class extends BaseEngine {
|
|
@@ -174,16 +174,16 @@ var EJS = class extends BaseEngine {
|
|
|
174
174
|
this.setExtensions(["ejs"]);
|
|
175
175
|
}
|
|
176
176
|
async render(source, data) {
|
|
177
|
-
this.engine
|
|
178
|
-
this.opts
|
|
177
|
+
this.engine ??= ejs;
|
|
178
|
+
this.opts ??= {};
|
|
179
179
|
if (this.rootTemplatePath) {
|
|
180
180
|
this.opts.root = this.rootTemplatePath;
|
|
181
181
|
}
|
|
182
182
|
return ejs.render(source, data, this.opts);
|
|
183
183
|
}
|
|
184
184
|
renderSync(source, data) {
|
|
185
|
-
this.engine
|
|
186
|
-
this.opts
|
|
185
|
+
this.engine ??= ejs;
|
|
186
|
+
this.opts ??= {};
|
|
187
187
|
if (this.rootTemplatePath) {
|
|
188
188
|
this.opts.root = this.rootTemplatePath;
|
|
189
189
|
}
|
|
@@ -205,7 +205,7 @@ var Pug = class extends BaseEngine {
|
|
|
205
205
|
}
|
|
206
206
|
async render(source, data) {
|
|
207
207
|
if (this.rootTemplatePath) {
|
|
208
|
-
this.opts
|
|
208
|
+
this.opts ??= {};
|
|
209
209
|
this.opts.basedir = this.rootTemplatePath;
|
|
210
210
|
}
|
|
211
211
|
const template = pug.compile(source, this.opts);
|
|
@@ -213,7 +213,7 @@ var Pug = class extends BaseEngine {
|
|
|
213
213
|
}
|
|
214
214
|
renderSync(source, data) {
|
|
215
215
|
if (this.rootTemplatePath) {
|
|
216
|
-
this.opts
|
|
216
|
+
this.opts ??= {};
|
|
217
217
|
this.opts.basedir = this.rootTemplatePath;
|
|
218
218
|
}
|
|
219
219
|
const template = pug.compile(source, this.opts);
|
|
@@ -240,7 +240,7 @@ var Nunjucks = class extends BaseEngine {
|
|
|
240
240
|
} else {
|
|
241
241
|
nunjucks.configure(this.opts);
|
|
242
242
|
}
|
|
243
|
-
data
|
|
243
|
+
data ??= {};
|
|
244
244
|
return nunjucks.renderString(source, data);
|
|
245
245
|
}
|
|
246
246
|
renderSync(source, data) {
|
|
@@ -249,7 +249,7 @@ var Nunjucks = class extends BaseEngine {
|
|
|
249
249
|
} else {
|
|
250
250
|
nunjucks.configure(this.opts);
|
|
251
251
|
}
|
|
252
|
-
data
|
|
252
|
+
data ??= {};
|
|
253
253
|
return nunjucks.renderString(source, data);
|
|
254
254
|
}
|
|
255
255
|
};
|
|
@@ -267,7 +267,7 @@ var Liquid = class extends BaseEngine {
|
|
|
267
267
|
}
|
|
268
268
|
async render(source, data) {
|
|
269
269
|
if (this.rootTemplatePath) {
|
|
270
|
-
this.opts
|
|
270
|
+
this.opts ??= {};
|
|
271
271
|
this.opts.root = this.rootTemplatePath;
|
|
272
272
|
}
|
|
273
273
|
if (!this.engine) {
|
|
@@ -277,7 +277,7 @@ var Liquid = class extends BaseEngine {
|
|
|
277
277
|
}
|
|
278
278
|
renderSync(source, data) {
|
|
279
279
|
if (this.rootTemplatePath) {
|
|
280
|
-
this.opts
|
|
280
|
+
this.opts ??= {};
|
|
281
281
|
this.opts.root = this.rootTemplatePath;
|
|
282
282
|
}
|
|
283
283
|
if (!this.engine) {
|
|
@@ -438,7 +438,7 @@ var Ecto = class {
|
|
|
438
438
|
// eslint-disable-next-line max-params
|
|
439
439
|
async renderFromFile(filePath, data, rootTemplatePath, filePathOutput, engineName) {
|
|
440
440
|
let result = "";
|
|
441
|
-
engineName
|
|
441
|
+
engineName ??= this.getEngineByFilePath(filePath);
|
|
442
442
|
const source = await fs2.promises.readFile(filePath, "utf8");
|
|
443
443
|
result = await this.render(source, data, engineName, rootTemplatePath, filePathOutput);
|
|
444
444
|
return result;
|
|
@@ -455,7 +455,7 @@ var Ecto = class {
|
|
|
455
455
|
// eslint-disable-next-line max-params
|
|
456
456
|
renderFromFileSync(filePath, data, rootTemplatePath, filePathOutput, engineName) {
|
|
457
457
|
let result = "";
|
|
458
|
-
engineName
|
|
458
|
+
engineName ??= this.getEngineByFilePath(filePath);
|
|
459
459
|
const source = fs2.readFileSync(filePath, "utf8");
|
|
460
460
|
result = this.renderSync(source, data, engineName, rootTemplatePath, filePathOutput);
|
|
461
461
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ecto",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Modern Template Consolidation Engine for EJS, Markdown, Pug, Nunjucks, Liquid, and Handlebars",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/ecto.js",
|
|
@@ -46,28 +46,28 @@
|
|
|
46
46
|
"liquidjs"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@jaredwray/fumanchu": "^3.
|
|
49
|
+
"@jaredwray/fumanchu": "^3.1.1",
|
|
50
50
|
"ejs": "^3.1.10",
|
|
51
|
-
"liquidjs": "^10.21.
|
|
51
|
+
"liquidjs": "^10.21.1",
|
|
52
52
|
"nunjucks": "^3.2.4",
|
|
53
53
|
"pug": "^3.0.3",
|
|
54
54
|
"underscore": "^1.13.7",
|
|
55
|
-
"writr": "^4.4.
|
|
55
|
+
"writr": "^4.4.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/ejs": "^3.1.5",
|
|
59
|
-
"@types/node": "^22.15.
|
|
59
|
+
"@types/node": "^22.15.24",
|
|
60
60
|
"@types/nunjucks": "^3.2.6",
|
|
61
61
|
"@types/pug": "^2.0.10",
|
|
62
62
|
"@types/underscore": "^1.13.0",
|
|
63
|
-
"@vitest/coverage-v8": "^3.1.
|
|
64
|
-
"docula": "^0.
|
|
63
|
+
"@vitest/coverage-v8": "^3.1.4",
|
|
64
|
+
"docula": "^0.12.1",
|
|
65
65
|
"rimraf": "^6.0.1",
|
|
66
|
-
"tsup": "^8.
|
|
66
|
+
"tsup": "^8.5.0",
|
|
67
67
|
"typescript": "^5.8.3",
|
|
68
|
-
"vitest": "^3.1.
|
|
69
|
-
"webpack": "^5.99.
|
|
70
|
-
"xo": "^0.
|
|
68
|
+
"vitest": "^3.1.4",
|
|
69
|
+
"webpack": "^5.99.9",
|
|
70
|
+
"xo": "^1.0.0"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dist",
|