@tsed/engines 1.1.4 → 6.113.0
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/.mocharc.js +5 -0
- package/.nycrc +26 -0
- package/lib/cjs/components/AtplEngine.js +13 -0
- package/lib/cjs/components/AtplEngine.js.map +1 -0
- package/lib/cjs/components/BracketEngine.js +18 -0
- package/lib/cjs/components/BracketEngine.js.map +1 -0
- package/lib/cjs/components/DotEngine.js +20 -0
- package/lib/cjs/components/DotEngine.js.map +1 -0
- package/lib/cjs/components/DustEngine.js +60 -0
- package/lib/cjs/components/DustEngine.js.map +1 -0
- package/lib/cjs/components/EctEngine.js +27 -0
- package/lib/cjs/components/EctEngine.js.map +1 -0
- package/lib/cjs/components/EjsEngine.js +13 -0
- package/lib/cjs/components/EjsEngine.js.map +1 -0
- package/lib/cjs/components/Engine.js +63 -0
- package/lib/cjs/components/Engine.js.map +1 -0
- package/lib/cjs/components/HamlCoffeeEngine.js +13 -0
- package/lib/cjs/components/HamlCoffeeEngine.js.map +1 -0
- package/lib/cjs/components/HamlEngine.js +19 -0
- package/lib/cjs/components/HamlEngine.js.map +1 -0
- package/lib/cjs/components/HamletEngine.js +19 -0
- package/lib/cjs/components/HamletEngine.js.map +1 -0
- package/lib/cjs/components/HandlebarsEngine.js +25 -0
- package/lib/cjs/components/HandlebarsEngine.js.map +1 -0
- package/lib/cjs/components/HoganEngine.js +21 -0
- package/lib/cjs/components/HoganEngine.js.map +1 -0
- package/lib/cjs/components/HtmlingEngine.js +17 -0
- package/lib/cjs/components/HtmlingEngine.js.map +1 -0
- package/lib/cjs/components/JazzEngine.js +17 -0
- package/lib/cjs/components/JazzEngine.js.map +1 -0
- package/lib/cjs/components/JqtplEngine.js +17 -0
- package/lib/cjs/components/JqtplEngine.js.map +1 -0
- package/lib/cjs/components/JustEngine.js +27 -0
- package/lib/cjs/components/JustEngine.js.map +1 -0
- package/lib/cjs/components/LiquorEngine.js +13 -0
- package/lib/cjs/components/LiquorEngine.js.map +1 -0
- package/lib/cjs/components/LodashEngine.js +20 -0
- package/lib/cjs/components/LodashEngine.js.map +1 -0
- package/lib/cjs/components/MarkoEngine.js +29 -0
- package/lib/cjs/components/MarkoEngine.js.map +1 -0
- package/lib/cjs/components/MoteEngine.js +13 -0
- package/lib/cjs/components/MoteEngine.js.map +1 -0
- package/lib/cjs/components/MustacheEngine.js +16 -0
- package/lib/cjs/components/MustacheEngine.js.map +1 -0
- package/lib/cjs/components/NunjucksEngine.js +56 -0
- package/lib/cjs/components/NunjucksEngine.js.map +1 -0
- package/lib/cjs/components/PlatesEngine.js +19 -0
- package/lib/cjs/components/PlatesEngine.js.map +1 -0
- package/lib/cjs/components/PugEngine.js +21 -0
- package/lib/cjs/components/PugEngine.js.map +1 -0
- package/lib/cjs/components/RactiveEngine.js +36 -0
- package/lib/cjs/components/RactiveEngine.js.map +1 -0
- package/lib/cjs/components/ReactEngine.js +136 -0
- package/lib/cjs/components/ReactEngine.js.map +1 -0
- package/lib/cjs/components/SlmEngine.js +13 -0
- package/lib/cjs/components/SlmEngine.js.map +1 -0
- package/lib/cjs/components/SquirrellyEngine.js +23 -0
- package/lib/cjs/components/SquirrellyEngine.js.map +1 -0
- package/lib/cjs/components/SwigEngine.js +21 -0
- package/lib/cjs/components/SwigEngine.js.map +1 -0
- package/lib/cjs/components/TemplayedEngine.js +16 -0
- package/lib/cjs/components/TemplayedEngine.js.map +1 -0
- package/lib/cjs/components/ToffeeEngine.js +22 -0
- package/lib/cjs/components/ToffeeEngine.js.map +1 -0
- package/lib/cjs/components/TwigEngine.js +28 -0
- package/lib/cjs/components/TwigEngine.js.map +1 -0
- package/lib/cjs/components/TwingEngine.js +29 -0
- package/lib/cjs/components/TwingEngine.js.map +1 -0
- package/lib/cjs/components/UnderscoreEngine.js +28 -0
- package/lib/cjs/components/UnderscoreEngine.js.map +1 -0
- package/lib/cjs/components/VashEngine.js +35 -0
- package/lib/cjs/components/VashEngine.js.map +1 -0
- package/lib/cjs/components/VelocityEngine.js +18 -0
- package/lib/cjs/components/VelocityEngine.js.map +1 -0
- package/lib/cjs/components/VueEngine.js +139 -0
- package/lib/cjs/components/VueEngine.js.map +1 -0
- package/lib/cjs/components/WalrusEngine.js +17 -0
- package/lib/cjs/components/WalrusEngine.js.map +1 -0
- package/lib/cjs/decorators/viewEngine.js +11 -0
- package/lib/cjs/decorators/viewEngine.js.map +1 -0
- package/lib/cjs/index.js +49 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/registries/EnginesContainer.js +31 -0
- package/lib/cjs/registries/EnginesContainer.js.map +1 -0
- package/lib/cjs/utils/cache.js +140 -0
- package/lib/cjs/utils/cache.js.map +1 -0
- package/lib/cjs/utils/getEngines.js +47 -0
- package/lib/cjs/utils/getEngines.js.map +1 -0
- package/lib/esm/components/AtplEngine.js +10 -0
- package/lib/esm/components/AtplEngine.js.map +1 -0
- package/lib/esm/components/BracketEngine.js +15 -0
- package/lib/esm/components/BracketEngine.js.map +1 -0
- package/lib/esm/components/DotEngine.js +17 -0
- package/lib/esm/components/DotEngine.js.map +1 -0
- package/lib/esm/components/DustEngine.js +57 -0
- package/lib/esm/components/DustEngine.js.map +1 -0
- package/lib/esm/components/EctEngine.js +24 -0
- package/lib/esm/components/EctEngine.js.map +1 -0
- package/lib/esm/components/EjsEngine.js +10 -0
- package/lib/esm/components/EjsEngine.js.map +1 -0
- package/lib/esm/components/Engine.js +59 -0
- package/lib/esm/components/Engine.js.map +1 -0
- package/lib/esm/components/HamlCoffeeEngine.js +10 -0
- package/lib/esm/components/HamlCoffeeEngine.js.map +1 -0
- package/lib/esm/components/HamlEngine.js +16 -0
- package/lib/esm/components/HamlEngine.js.map +1 -0
- package/lib/esm/components/HamletEngine.js +16 -0
- package/lib/esm/components/HamletEngine.js.map +1 -0
- package/lib/esm/components/HandlebarsEngine.js +22 -0
- package/lib/esm/components/HandlebarsEngine.js.map +1 -0
- package/lib/esm/components/HoganEngine.js +18 -0
- package/lib/esm/components/HoganEngine.js.map +1 -0
- package/lib/esm/components/HtmlingEngine.js +14 -0
- package/lib/esm/components/HtmlingEngine.js.map +1 -0
- package/lib/esm/components/JazzEngine.js +14 -0
- package/lib/esm/components/JazzEngine.js.map +1 -0
- package/lib/esm/components/JqtplEngine.js +14 -0
- package/lib/esm/components/JqtplEngine.js.map +1 -0
- package/lib/esm/components/JustEngine.js +24 -0
- package/lib/esm/components/JustEngine.js.map +1 -0
- package/lib/esm/components/LiquorEngine.js +10 -0
- package/lib/esm/components/LiquorEngine.js.map +1 -0
- package/lib/esm/components/LodashEngine.js +17 -0
- package/lib/esm/components/LodashEngine.js.map +1 -0
- package/lib/esm/components/MarkoEngine.js +26 -0
- package/lib/esm/components/MarkoEngine.js.map +1 -0
- package/lib/esm/components/MoteEngine.js +10 -0
- package/lib/esm/components/MoteEngine.js.map +1 -0
- package/lib/esm/components/MustacheEngine.js +13 -0
- package/lib/esm/components/MustacheEngine.js.map +1 -0
- package/lib/esm/components/NunjucksEngine.js +53 -0
- package/lib/esm/components/NunjucksEngine.js.map +1 -0
- package/lib/esm/components/PlatesEngine.js +16 -0
- package/lib/esm/components/PlatesEngine.js.map +1 -0
- package/lib/esm/components/PugEngine.js +18 -0
- package/lib/esm/components/PugEngine.js.map +1 -0
- package/lib/esm/components/RactiveEngine.js +33 -0
- package/lib/esm/components/RactiveEngine.js.map +1 -0
- package/lib/esm/components/ReactEngine.js +133 -0
- package/lib/esm/components/ReactEngine.js.map +1 -0
- package/lib/esm/components/SlmEngine.js +10 -0
- package/lib/esm/components/SlmEngine.js.map +1 -0
- package/lib/esm/components/SquirrellyEngine.js +20 -0
- package/lib/esm/components/SquirrellyEngine.js.map +1 -0
- package/lib/esm/components/SwigEngine.js +18 -0
- package/lib/esm/components/SwigEngine.js.map +1 -0
- package/lib/esm/components/TemplayedEngine.js +13 -0
- package/lib/esm/components/TemplayedEngine.js.map +1 -0
- package/lib/esm/components/ToffeeEngine.js +19 -0
- package/lib/esm/components/ToffeeEngine.js.map +1 -0
- package/lib/esm/components/TwigEngine.js +25 -0
- package/lib/esm/components/TwigEngine.js.map +1 -0
- package/lib/esm/components/TwingEngine.js +26 -0
- package/lib/esm/components/TwingEngine.js.map +1 -0
- package/lib/esm/components/UnderscoreEngine.js +25 -0
- package/lib/esm/components/UnderscoreEngine.js.map +1 -0
- package/lib/esm/components/VashEngine.js +32 -0
- package/lib/esm/components/VashEngine.js.map +1 -0
- package/lib/esm/components/VelocityEngine.js +15 -0
- package/lib/esm/components/VelocityEngine.js.map +1 -0
- package/lib/esm/components/VueEngine.js +136 -0
- package/lib/esm/components/VueEngine.js.map +1 -0
- package/lib/esm/components/WalrusEngine.js +14 -0
- package/lib/esm/components/WalrusEngine.js.map +1 -0
- package/lib/esm/decorators/viewEngine.js +7 -0
- package/lib/esm/decorators/viewEngine.js.map +1 -0
- package/lib/esm/index.js +46 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/registries/EnginesContainer.js +27 -0
- package/lib/esm/registries/EnginesContainer.js.map +1 -0
- package/lib/esm/utils/cache.js +127 -0
- package/lib/esm/utils/cache.js.map +1 -0
- package/lib/esm/utils/getEngines.js +42 -0
- package/lib/esm/utils/getEngines.js.map +1 -0
- package/lib/{components → types/components}/AtplEngine.d.ts +0 -0
- package/lib/{components → types/components}/BracketEngine.d.ts +0 -0
- package/lib/{components → types/components}/DotEngine.d.ts +0 -0
- package/lib/{components → types/components}/DustEngine.d.ts +0 -0
- package/lib/{components → types/components}/EctEngine.d.ts +0 -0
- package/lib/{components → types/components}/EjsEngine.d.ts +0 -0
- package/lib/{components → types/components}/Engine.d.ts +4 -1
- package/lib/{components → types/components}/HamlCoffeeEngine.d.ts +0 -0
- package/lib/{components → types/components}/HamlEngine.d.ts +0 -0
- package/lib/{components → types/components}/HamletEngine.d.ts +0 -0
- package/lib/{components → types/components}/HandlebarsEngine.d.ts +0 -0
- package/lib/{components → types/components}/HoganEngine.d.ts +0 -0
- package/lib/{components → types/components}/HtmlingEngine.d.ts +0 -0
- package/lib/{components → types/components}/JazzEngine.d.ts +0 -0
- package/lib/{components → types/components}/JqtplEngine.d.ts +0 -0
- package/lib/{components → types/components}/JustEngine.d.ts +0 -0
- package/lib/{components → types/components}/LiquorEngine.d.ts +0 -0
- package/lib/{components → types/components}/LodashEngine.d.ts +0 -0
- package/lib/{components → types/components}/MarkoEngine.d.ts +0 -0
- package/lib/{components → types/components}/MoteEngine.d.ts +0 -0
- package/lib/{components → types/components}/MustacheEngine.d.ts +0 -0
- package/lib/{components → types/components}/NunjucksEngine.d.ts +0 -0
- package/lib/{components → types/components}/PlatesEngine.d.ts +0 -0
- package/lib/{components → types/components}/PugEngine.d.ts +0 -0
- package/lib/{components → types/components}/RactiveEngine.d.ts +0 -0
- package/lib/{components → types/components}/ReactEngine.d.ts +3 -0
- package/lib/{components → types/components}/SlmEngine.d.ts +0 -0
- package/lib/{components → types/components}/SquirrellyEngine.d.ts +0 -0
- package/lib/{components → types/components}/SwigEngine.d.ts +0 -0
- package/lib/{components → types/components}/TemplayedEngine.d.ts +0 -0
- package/lib/{components → types/components}/ToffeeEngine.d.ts +0 -0
- package/lib/{components → types/components}/TwigEngine.d.ts +0 -0
- package/lib/{components → types/components}/TwingEngine.d.ts +0 -0
- package/lib/{components → types/components}/UnderscoreEngine.d.ts +0 -0
- package/lib/{components → types/components}/VashEngine.d.ts +0 -0
- package/lib/{components → types/components}/VelocityEngine.d.ts +0 -0
- package/lib/{components → types/components}/VueEngine.d.ts +2 -2
- package/lib/{components → types/components}/WalrusEngine.d.ts +0 -0
- package/lib/{decorators → types/decorators}/viewEngine.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +6 -3
- package/lib/{registries → types/registries}/EnginesContainer.d.ts +0 -0
- package/lib/{utils → types/utils}/cache.d.ts +3 -3
- package/lib/{utils → types/utils}/getEngines.d.ts +0 -0
- package/package.json +35 -27
- package/readme.md +91 -90
- package/tsconfig.compile.esm.json +25 -0
- package/lib/index.js +0 -1211
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -1198
- package/lib/index.modern.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { read } from "../utils/cache.js";
|
|
3
|
+
import { extname } from "path";
|
|
4
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
5
|
+
import { Engine } from "./Engine.js";
|
|
6
|
+
import { promisify } from "util";
|
|
7
|
+
let DustEngine = class DustEngine extends Engine {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.views = ".";
|
|
11
|
+
this.ext = "dust";
|
|
12
|
+
}
|
|
13
|
+
configure(options) {
|
|
14
|
+
if (options) {
|
|
15
|
+
if (options.ext) {
|
|
16
|
+
this.ext = options.ext;
|
|
17
|
+
}
|
|
18
|
+
if (options.views) {
|
|
19
|
+
this.views = options.views;
|
|
20
|
+
}
|
|
21
|
+
if (options.settings && options.settings.views) {
|
|
22
|
+
this.views = options.settings.views;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!options || (options && !options.cache))
|
|
26
|
+
this.engine.cache = {};
|
|
27
|
+
this.engine.onLoad = async (path, callback) => {
|
|
28
|
+
if (extname(path) === "") {
|
|
29
|
+
path += `.${this.ext}`;
|
|
30
|
+
}
|
|
31
|
+
if (path[0] !== "/") {
|
|
32
|
+
path = `${this.views}/${path}`;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
callback(null, await read(path, options));
|
|
36
|
+
}
|
|
37
|
+
catch (er) {
|
|
38
|
+
callback(er);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
$compile(template, options) {
|
|
43
|
+
this.configure(options);
|
|
44
|
+
let templateName;
|
|
45
|
+
if (options.filename) {
|
|
46
|
+
templateName = options.filename.replace(new RegExp("^" + this.views + "/"), "").replace(new RegExp("\\." + this.ext), "");
|
|
47
|
+
}
|
|
48
|
+
return promisify(this.engine.compileFn(template, templateName));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
DustEngine = __decorate([
|
|
52
|
+
ViewEngine("dust", {
|
|
53
|
+
requires: ["dustjs-helpers", "dustjs-linkedin"]
|
|
54
|
+
})
|
|
55
|
+
], DustEngine);
|
|
56
|
+
export { DustEngine };
|
|
57
|
+
//# sourceMappingURL=DustEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DustEngine.js","sourceRoot":"","sources":["../../../src/components/DustEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAK/B,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,MAAM;IAAtC;;QACU,UAAK,GAAG,GAAG,CAAC;QACZ,QAAG,GAAG,MAAM,CAAC;IA0CvB,CAAC;IAxCC,SAAS,CAAC,OAAY;QACpB,IAAI,OAAO,EAAE;YACX,IAAI,OAAO,CAAC,GAAG,EAAE;gBACf,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;aACxB;YACD,IAAI,OAAO,CAAC,KAAK,EAAE;gBACjB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;aAC5B;YACD,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE;gBAC9C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;aACrC;SACF;QACD,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;QAEpE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,EAAE,IAAY,EAAE,QAAa,EAAE,EAAE;YACzD,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE;gBACxB,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;aACxB;YACD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBACnB,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;aAChC;YACD,IAAI;gBACF,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;aAC3C;YAAC,OAAO,EAAE,EAAE;gBACX,QAAQ,CAAC,EAAE,CAAC,CAAC;aACd;QACH,CAAC,CAAC;IACJ,CAAC;IAES,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAExB,IAAI,YAAY,CAAC;QAEjB,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;SAC3H;QAED,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAQ,CAAC;IACzE,CAAC;CACF,CAAA;AA5CY,UAAU;IAHtB,UAAU,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;KAChD,CAAC;GACW,UAAU,CA4CtB;SA5CY,UAAU","sourcesContent":["import {read} from \"../utils/cache\";\nimport {extname} from \"path\";\nimport {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\nimport {promisify} from \"util\";\n\n@ViewEngine(\"dust\", {\n requires: [\"dustjs-helpers\", \"dustjs-linkedin\"]\n})\nexport class DustEngine extends Engine {\n private views = \".\";\n private ext = \"dust\";\n\n configure(options: any) {\n if (options) {\n if (options.ext) {\n this.ext = options.ext;\n }\n if (options.views) {\n this.views = options.views;\n }\n if (options.settings && options.settings.views) {\n this.views = options.settings.views;\n }\n }\n if (!options || (options && !options.cache)) this.engine.cache = {};\n\n this.engine.onLoad = async (path: string, callback: any) => {\n if (extname(path) === \"\") {\n path += `.${this.ext}`;\n }\n if (path[0] !== \"/\") {\n path = `${this.views}/${path}`;\n }\n try {\n callback(null, await read(path, options));\n } catch (er) {\n callback(er);\n }\n };\n }\n\n protected $compile(template: string, options: any) {\n this.configure(options);\n\n let templateName;\n\n if (options.filename) {\n templateName = options.filename.replace(new RegExp(\"^\" + this.views + \"/\"), \"\").replace(new RegExp(\"\\\\.\" + this.ext), \"\");\n }\n\n return promisify(this.engine.compileFn(template, templateName)) as any;\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
4
|
+
import { Engine } from "./Engine.js";
|
|
5
|
+
let EctEngine = class EctEngine extends Engine {
|
|
6
|
+
$compile(template, options) {
|
|
7
|
+
const ECT = this.engine;
|
|
8
|
+
const engine = new ECT({ root: { page: template } });
|
|
9
|
+
const compile = promisify(engine.render.bind(engine));
|
|
10
|
+
return (options) => compile("page", options);
|
|
11
|
+
}
|
|
12
|
+
async $compileFile(file, options) {
|
|
13
|
+
const ECT = this.engine;
|
|
14
|
+
const engine = new ECT(options);
|
|
15
|
+
engine.configure({ cache: options.cache });
|
|
16
|
+
const compile = promisify(engine.render.bind(engine));
|
|
17
|
+
return (options) => compile(file, options);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
EctEngine = __decorate([
|
|
21
|
+
ViewEngine("ect")
|
|
22
|
+
], EctEngine);
|
|
23
|
+
export { EctEngine };
|
|
24
|
+
//# sourceMappingURL=EctEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EctEngine.js","sourceRoot":"","sources":["../../../src/components/EctEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,MAAM;IACzB,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEtD,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAY;QACrD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,CAAC,SAAS,CAAC,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAC,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEtD,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAjBY,SAAS;IADrB,UAAU,CAAC,KAAK,CAAC;GACL,SAAS,CAiBrB;SAjBY,SAAS","sourcesContent":["import {promisify} from \"util\";\nimport {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"ect\")\nexport class EctEngine extends Engine {\n protected $compile(template: string, options: any) {\n const ECT = this.engine;\n const engine = new ECT({root: {page: template}});\n const compile = promisify(engine.render.bind(engine));\n\n return (options: any) => compile(\"page\", options);\n }\n\n protected async $compileFile(file: string, options: any) {\n const ECT = this.engine;\n const engine = new ECT(options);\n engine.configure({cache: options.cache});\n const compile = promisify(engine.render.bind(engine));\n\n return (options: any) => compile(file, options);\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let EjsEngine = class EjsEngine extends Engine {
|
|
5
|
+
};
|
|
6
|
+
EjsEngine = __decorate([
|
|
7
|
+
ViewEngine("ejs")
|
|
8
|
+
], EjsEngine);
|
|
9
|
+
export { EjsEngine };
|
|
10
|
+
//# sourceMappingURL=EjsEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EjsEngine.js","sourceRoot":"","sources":["../../../src/components/EjsEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,MAAM;CAAG,CAAA;AAA3B,SAAS;IADrB,UAAU,CAAC,KAAK,CAAC;GACL,SAAS,CAAkB;SAA3B,SAAS","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"ejs\")\nexport class EjsEngine extends Engine {}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cache, getCachedEngine, importEngine, read, readPartials } from "../utils/cache.js";
|
|
2
|
+
export class Engine {
|
|
3
|
+
constructor(name, options) {
|
|
4
|
+
this.name = name;
|
|
5
|
+
this.options = options;
|
|
6
|
+
}
|
|
7
|
+
get engine() {
|
|
8
|
+
return getCachedEngine(this.name);
|
|
9
|
+
}
|
|
10
|
+
async $onInit() {
|
|
11
|
+
await this.importEngine(this.name, this.options);
|
|
12
|
+
}
|
|
13
|
+
compile(template, options) {
|
|
14
|
+
options = this.$cacheOptions(template, options, false);
|
|
15
|
+
return cache(options) || cache(options, this.$compile.call(this, template, options));
|
|
16
|
+
}
|
|
17
|
+
compileFile(file, options) {
|
|
18
|
+
options = this.$cacheOptions(file, options, true);
|
|
19
|
+
return cache(options) || cache(options, this.$compileFile.call(this, file, options));
|
|
20
|
+
}
|
|
21
|
+
async render(template, options) {
|
|
22
|
+
const compile = await this.compile(template, options);
|
|
23
|
+
return compile(options);
|
|
24
|
+
}
|
|
25
|
+
async renderFile(file, options) {
|
|
26
|
+
const opts = await this.readPartials(file, options);
|
|
27
|
+
const compile = await this.compileFile(file, opts);
|
|
28
|
+
return compile(opts);
|
|
29
|
+
}
|
|
30
|
+
async readPartials(file, options) {
|
|
31
|
+
options.filename = file;
|
|
32
|
+
const partials = await readPartials(file, options);
|
|
33
|
+
const opts = Object.assign({}, options);
|
|
34
|
+
opts.partials = partials;
|
|
35
|
+
return opts;
|
|
36
|
+
}
|
|
37
|
+
$cacheOptions(template, options, fromFile) {
|
|
38
|
+
return options;
|
|
39
|
+
}
|
|
40
|
+
$compile(template, options) {
|
|
41
|
+
return this.engine.compile(template, options);
|
|
42
|
+
}
|
|
43
|
+
async $compileFile(file, options) {
|
|
44
|
+
const template = await read(file, options);
|
|
45
|
+
return this.$compile(template, options);
|
|
46
|
+
}
|
|
47
|
+
importEngine(name, options) {
|
|
48
|
+
const reqs = [].concat(options.requires || [name]);
|
|
49
|
+
const promises = reqs.map(async (req) => {
|
|
50
|
+
try {
|
|
51
|
+
await importEngine(req, name);
|
|
52
|
+
this.driverName = req;
|
|
53
|
+
}
|
|
54
|
+
catch (er) { }
|
|
55
|
+
});
|
|
56
|
+
return Promise.all(promises);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=Engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/components/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAYxF,MAAM,OAAO,MAAM;IAGjB,YAAqB,IAAY,EAAW,OAA0B;QAAjD,SAAI,GAAJ,IAAI,CAAQ;QAAW,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAE1E,IAAI,MAAM;QACR,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAAsB;QAC9C,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEvD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,OAAsB;QAC9C,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,OAAsB;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,OAAsB;QACnD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAsB;QAC/D,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;QACxB,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,aAAa,CAAC,QAAgB,EAAE,OAAsB,EAAE,QAAkB;QAClF,OAAO,OAAO,CAAC;IACjB,CAAC;IAES,QAAQ,CAAC,QAAgB,EAAE,OAAsB;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAsB;QAC/D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAES,YAAY,CAAC,IAAY,EAAE,OAA0B;QAC7D,MAAM,IAAI,GAAI,EAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;YAC9C,IAAI;gBACF,MAAM,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBAC9B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;aACvB;YAAC,OAAO,EAAE,EAAE,GAAE;QACjB,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import {cache, getCachedEngine, importEngine, read, readPartials} from \"../utils/cache\";\n\nexport interface ViewEngineOptions {\n requires?: string | string[];\n}\n\nexport interface EngineOptions {\n cache?: boolean;\n\n [otherOptions: string]: any;\n}\n\nexport class Engine {\n protected driverName: string;\n\n constructor(readonly name: string, readonly options: ViewEngineOptions) {}\n\n get engine(): any {\n return getCachedEngine(this.name);\n }\n\n async $onInit() {\n await this.importEngine(this.name, this.options);\n }\n\n compile(template: string, options: EngineOptions) {\n options = this.$cacheOptions(template, options, false);\n\n return cache(options) || cache(options, this.$compile.call(this, template, options));\n }\n\n compileFile(file: string, options: EngineOptions) {\n options = this.$cacheOptions(file, options, true);\n\n return cache(options) || cache(options, this.$compileFile.call(this, file, options));\n }\n\n async render(template: string, options: EngineOptions) {\n const compile = await this.compile(template, options);\n\n return compile(options);\n }\n\n async renderFile(file: string, options: EngineOptions) {\n const opts = await this.readPartials(file, options);\n const compile = await this.compileFile(file, opts);\n\n return compile(opts);\n }\n\n protected async readPartials(file: string, options: EngineOptions) {\n options.filename = file;\n const partials = await readPartials(file, options);\n\n const opts = Object.assign({}, options);\n opts.partials = partials;\n\n return opts;\n }\n\n protected $cacheOptions(template: string, options: EngineOptions, fromFile?: boolean) {\n return options;\n }\n\n protected $compile(template: string, options: EngineOptions): (options: EngineOptions) => Promise<string> {\n return this.engine.compile(template, options);\n }\n\n protected async $compileFile(file: string, options: EngineOptions) {\n const template = await read(file, options);\n return this.$compile(template, options);\n }\n\n protected importEngine(name: string, options: ViewEngineOptions) {\n const reqs = ([] as string[]).concat(options.requires || [name]);\n\n const promises = reqs.map(async (req: string) => {\n try {\n await importEngine(req, name);\n this.driverName = req;\n } catch (er) {}\n });\n\n return Promise.all(promises);\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let HamlCoffeeEngine = class HamlCoffeeEngine extends Engine {
|
|
5
|
+
};
|
|
6
|
+
HamlCoffeeEngine = __decorate([
|
|
7
|
+
ViewEngine("haml-coffee")
|
|
8
|
+
], HamlCoffeeEngine);
|
|
9
|
+
export { HamlCoffeeEngine };
|
|
10
|
+
//# sourceMappingURL=HamlCoffeeEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HamlCoffeeEngine.js","sourceRoot":"","sources":["../../../src/components/HamlCoffeeEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,MAAM;CAAG,CAAA;AAAlC,gBAAgB;IAD5B,UAAU,CAAC,aAAa,CAAC;GACb,gBAAgB,CAAkB;SAAlC,gBAAgB","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"haml-coffee\")\nexport class HamlCoffeeEngine extends Engine {}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let HamlEngine = class HamlEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
return (options) => {
|
|
7
|
+
options.locals = options;
|
|
8
|
+
return Promise.resolve(this.engine.render(template, options).trimLeft());
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
HamlEngine = __decorate([
|
|
13
|
+
ViewEngine("haml")
|
|
14
|
+
], HamlEngine);
|
|
15
|
+
export { HamlEngine };
|
|
16
|
+
//# sourceMappingURL=HamlEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HamlEngine.js","sourceRoot":"","sources":["../../../src/components/HamlEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,MAAM;IAC1B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,OAAO,CAAC,OAAY,EAAE,EAAE;YACtB,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC;YACzB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAPY,UAAU;IADtB,UAAU,CAAC,MAAM,CAAC;GACN,UAAU,CAOtB;SAPY,UAAU","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"haml\")\nexport class HamlEngine extends Engine {\n protected $compile(template: string, options: any) {\n return (options: any) => {\n options.locals = options;\n return Promise.resolve(this.engine.render(template, options).trimLeft());\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let HamletEngine = class HamletEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
return (options) => {
|
|
7
|
+
options.locals = options;
|
|
8
|
+
return Promise.resolve(this.engine.render(template, options).trimLeft());
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
HamletEngine = __decorate([
|
|
13
|
+
ViewEngine("hamlet")
|
|
14
|
+
], HamletEngine);
|
|
15
|
+
export { HamletEngine };
|
|
16
|
+
//# sourceMappingURL=HamletEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HamletEngine.js","sourceRoot":"","sources":["../../../src/components/HamletEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,MAAM;IAC5B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,OAAO,CAAC,OAAY,EAAE,EAAE;YACtB,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC;YACzB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAPY,YAAY;IADxB,UAAU,CAAC,QAAQ,CAAC;GACR,YAAY,CAOxB;SAPY,YAAY","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"hamlet\")\nexport class HamletEngine extends Engine {\n protected $compile(template: string, options: any) {\n return (options: any) => {\n options.locals = options;\n return Promise.resolve(this.engine.render(template, options).trimLeft());\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let HandlebarsEngine = class HandlebarsEngine extends Engine {
|
|
5
|
+
configure(options) {
|
|
6
|
+
for (const partial in options.partials) {
|
|
7
|
+
this.engine.registerPartial(partial, options.partials[partial]);
|
|
8
|
+
}
|
|
9
|
+
for (const helper in options.helpers) {
|
|
10
|
+
this.engine.registerHelper(helper, options.helpers[helper]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
$compile(template, options) {
|
|
14
|
+
this.configure(options);
|
|
15
|
+
return this.engine.compile(template, options);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
HandlebarsEngine = __decorate([
|
|
19
|
+
ViewEngine("handlebars")
|
|
20
|
+
], HandlebarsEngine);
|
|
21
|
+
export { HandlebarsEngine };
|
|
22
|
+
//# sourceMappingURL=HandlebarsEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandlebarsEngine.js","sourceRoot":"","sources":["../../../src/components/HandlebarsEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,MAAM;IAChC,SAAS,CAAC,OAAY;QAC9B,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE;YACtC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SACjE;QACD,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;YACpC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7D;IACH,CAAC;IAES,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AAdY,gBAAgB;IAD5B,UAAU,CAAC,YAAY,CAAC;GACZ,gBAAgB,CAc5B;SAdY,gBAAgB","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"handlebars\")\nexport class HandlebarsEngine extends Engine {\n protected configure(options: any) {\n for (const partial in options.partials) {\n this.engine.registerPartial(partial, options.partials[partial]);\n }\n for (const helper in options.helpers) {\n this.engine.registerHelper(helper, options.helpers[helper]);\n }\n }\n\n protected $compile(template: string, options: any) {\n this.configure(options);\n return this.engine.compile(template, options);\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let HoganEngine = class HoganEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
const compile = this.engine.compile(template, options);
|
|
7
|
+
return (options) => {
|
|
8
|
+
return compile.render(options, options.partials);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
HoganEngine = __decorate([
|
|
13
|
+
ViewEngine("hogan", {
|
|
14
|
+
requires: "hogan.js"
|
|
15
|
+
})
|
|
16
|
+
], HoganEngine);
|
|
17
|
+
export { HoganEngine };
|
|
18
|
+
//# sourceMappingURL=HoganEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoganEngine.js","sourceRoot":"","sources":["../../../src/components/HoganEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAgB,MAAM,UAAU,CAAC;AAK/C,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,MAAM;IAC3B,QAAQ,CAAC,QAAgB,EAAE,OAAsB;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,CAAC,OAAsB,EAAE,EAAE;YAChC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAPY,WAAW;IAHvB,UAAU,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,UAAU;KACrB,CAAC;GACW,WAAW,CAOvB;SAPY,WAAW","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine, EngineOptions} from \"./Engine\";\n\n@ViewEngine(\"hogan\", {\n requires: \"hogan.js\"\n})\nexport class HoganEngine extends Engine {\n protected $compile(template: string, options: EngineOptions) {\n const compile = this.engine.compile(template, options);\n return (options: EngineOptions) => {\n return compile.render(options, options.partials);\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let HtmlingEngine = class HtmlingEngine extends Engine {
|
|
5
|
+
$compile(template) {
|
|
6
|
+
const compile = this.engine.string(template);
|
|
7
|
+
return (options) => compile.render(options);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
HtmlingEngine = __decorate([
|
|
11
|
+
ViewEngine("htmling")
|
|
12
|
+
], HtmlingEngine);
|
|
13
|
+
export { HtmlingEngine };
|
|
14
|
+
//# sourceMappingURL=HtmlingEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlingEngine.js","sourceRoot":"","sources":["../../../src/components/HtmlingEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,MAAM;IAC7B,QAAQ,CAAC,QAAgB;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE7C,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AANY,aAAa;IADzB,UAAU,CAAC,SAAS,CAAC;GACT,aAAa,CAMzB;SANY,aAAa","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"htmling\")\nexport class HtmlingEngine extends Engine {\n protected $compile(template: string) {\n const compile = this.engine.string(template);\n\n return (options: any) => compile.render(options);\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let JazzEngine = class JazzEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
const compile = this.engine.compile(template, options);
|
|
7
|
+
return (options) => new Promise((resolve) => compile.eval(options, resolve));
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
JazzEngine = __decorate([
|
|
11
|
+
ViewEngine("jazz")
|
|
12
|
+
], JazzEngine);
|
|
13
|
+
export { JazzEngine };
|
|
14
|
+
//# sourceMappingURL=JazzEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JazzEngine.js","sourceRoot":"","sources":["../../../src/components/JazzEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,MAAM;IAC1B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF,CAAA;AALY,UAAU;IADtB,UAAU,CAAC,MAAM,CAAC;GACN,UAAU,CAKtB;SALY,UAAU","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"jazz\")\nexport class JazzEngine extends Engine {\n protected $compile(template: string, options: any) {\n const compile = this.engine.compile(template, options);\n return (options: any) => new Promise<string>((resolve) => compile.eval(options, resolve));\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let JqtplEngine = class JqtplEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
this.engine.template(template, template);
|
|
7
|
+
return (options) => this.engine.tmpl(template, options);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
JqtplEngine = __decorate([
|
|
11
|
+
ViewEngine("jqtpl")
|
|
12
|
+
], JqtplEngine);
|
|
13
|
+
export { JqtplEngine };
|
|
14
|
+
//# sourceMappingURL=JqtplEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JqtplEngine.js","sourceRoot":"","sources":["../../../src/components/JqtplEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,MAAM;IAC3B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACzC,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;CACF,CAAA;AALY,WAAW;IADvB,UAAU,CAAC,OAAO,CAAC;GACP,WAAW,CAKvB;SALY,WAAW","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"jqtpl\")\nexport class JqtplEngine extends Engine {\n protected $compile(template: string, options: any) {\n this.engine.template(template, template);\n return (options: any) => this.engine.tmpl(template, options);\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
4
|
+
import { Engine } from "./Engine.js";
|
|
5
|
+
let JustEngine = class JustEngine extends Engine {
|
|
6
|
+
$compile(template, options) {
|
|
7
|
+
const JUST = this.engine;
|
|
8
|
+
const engine = new JUST({ root: { page: template } });
|
|
9
|
+
const compile = promisify(engine.render.bind(engine));
|
|
10
|
+
return (options) => compile("page", options);
|
|
11
|
+
}
|
|
12
|
+
async $compileFile(file, options) {
|
|
13
|
+
const JUST = this.engine;
|
|
14
|
+
const engine = new JUST(options);
|
|
15
|
+
engine.configure({ useCache: options.cache });
|
|
16
|
+
const compile = promisify(engine.render.bind(engine));
|
|
17
|
+
return (options) => compile(file, options);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
JustEngine = __decorate([
|
|
21
|
+
ViewEngine("just")
|
|
22
|
+
], JustEngine);
|
|
23
|
+
export { JustEngine };
|
|
24
|
+
//# sourceMappingURL=JustEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JustEngine.js","sourceRoot":"","sources":["../../../src/components/JustEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,MAAM;IAC1B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEtD,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAY;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,EAAC,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEtD,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAjBY,UAAU;IADtB,UAAU,CAAC,MAAM,CAAC;GACN,UAAU,CAiBtB;SAjBY,UAAU","sourcesContent":["import {promisify} from \"util\";\nimport {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"just\")\nexport class JustEngine extends Engine {\n protected $compile(template: string, options: any) {\n const JUST = this.engine;\n const engine = new JUST({root: {page: template}});\n const compile = promisify(engine.render.bind(engine));\n\n return (options: any) => compile(\"page\", options);\n }\n\n protected async $compileFile(file: string, options: any) {\n const JUST = this.engine;\n const engine = new JUST(options);\n engine.configure({useCache: options.cache});\n const compile = promisify(engine.render.bind(engine));\n\n return (options: any) => compile(file, options);\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let LiquorEngine = class LiquorEngine extends Engine {
|
|
5
|
+
};
|
|
6
|
+
LiquorEngine = __decorate([
|
|
7
|
+
ViewEngine("liquor")
|
|
8
|
+
], LiquorEngine);
|
|
9
|
+
export { LiquorEngine };
|
|
10
|
+
//# sourceMappingURL=LiquorEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiquorEngine.js","sourceRoot":"","sources":["../../../src/components/LiquorEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,MAAM;CAAG,CAAA;AAA9B,YAAY;IADxB,UAAU,CAAC,QAAQ,CAAC;GACR,YAAY,CAAkB;SAA9B,YAAY","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"liquor\")\nexport class LiquorEngine extends Engine {}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let LodashEngine = class LodashEngine extends Engine {
|
|
5
|
+
render(template, options) {
|
|
6
|
+
const compile = this.compile(template, options);
|
|
7
|
+
return compile(options).replace(/\n$/, "");
|
|
8
|
+
}
|
|
9
|
+
$compile(template, options) {
|
|
10
|
+
return this.engine.template(template, options);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
LodashEngine = __decorate([
|
|
14
|
+
ViewEngine("lodash")
|
|
15
|
+
], LodashEngine);
|
|
16
|
+
export { LodashEngine };
|
|
17
|
+
//# sourceMappingURL=LodashEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LodashEngine.js","sourceRoot":"","sources":["../../../src/components/LodashEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,MAAM;IACtC,MAAM,CAAC,QAAgB,EAAE,OAAY;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAES,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AATY,YAAY;IADxB,UAAU,CAAC,QAAQ,CAAC;GACR,YAAY,CASxB;SATY,YAAY","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"lodash\")\nexport class LodashEngine extends Engine {\n render(template: string, options: any) {\n const compile = this.compile(template, options);\n return compile(options).replace(/\\n$/, \"\");\n }\n\n protected $compile(template: string, options: any) {\n return this.engine.template(template, options);\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
4
|
+
import { Engine } from "./Engine.js";
|
|
5
|
+
let MarkoEngine = class MarkoEngine extends Engine {
|
|
6
|
+
$cacheOptions(template, options, fromFile) {
|
|
7
|
+
options.writeToDisk = !!options.cache;
|
|
8
|
+
if (!fromFile) {
|
|
9
|
+
options.filename = options.filename || "string.marko";
|
|
10
|
+
}
|
|
11
|
+
return options;
|
|
12
|
+
}
|
|
13
|
+
async $compileFile(file, options) {
|
|
14
|
+
const $cmp = this.engine.load(file, options);
|
|
15
|
+
return promisify($cmp.renderToString.bind($cmp));
|
|
16
|
+
}
|
|
17
|
+
$compile(template, options) {
|
|
18
|
+
const $cmp = this.engine.load(options.filename, template, options);
|
|
19
|
+
return promisify($cmp.renderToString.bind($cmp));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
MarkoEngine = __decorate([
|
|
23
|
+
ViewEngine("marko")
|
|
24
|
+
], MarkoEngine);
|
|
25
|
+
export { MarkoEngine };
|
|
26
|
+
//# sourceMappingURL=MarkoEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkoEngine.js","sourceRoot":"","sources":["../../../src/components/MarkoEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAgB,MAAM,UAAU,CAAC;AAG/C,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,MAAM;IACrC,aAAa,CAAC,QAAgB,EAAE,OAAY,EAAE,QAAiB;QAC7D,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QAEtC,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,cAAc,CAAC;SACvD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAsB;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE7C,OAAO,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC;IAC1D,CAAC;IAES,QAAQ,CAAC,QAAgB,EAAE,OAAsB;QACzD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEnE,OAAO,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC;IAC1D,CAAC;CACF,CAAA;AAtBY,WAAW;IADvB,UAAU,CAAC,OAAO,CAAC;GACP,WAAW,CAsBvB;SAtBY,WAAW","sourcesContent":["import {promisify} from \"util\";\nimport {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine, EngineOptions} from \"./Engine\";\n\n@ViewEngine(\"marko\")\nexport class MarkoEngine extends Engine {\n $cacheOptions(template: string, options: any, fromFile: boolean): any {\n options.writeToDisk = !!options.cache;\n\n if (!fromFile) {\n options.filename = options.filename || \"string.marko\";\n }\n\n return options;\n }\n\n async $compileFile(file: string, options: EngineOptions) {\n const $cmp = this.engine.load(file, options);\n\n return promisify($cmp.renderToString.bind($cmp)) as any;\n }\n\n protected $compile(template: string, options: EngineOptions) {\n const $cmp = this.engine.load(options.filename, template, options);\n\n return promisify($cmp.renderToString.bind($cmp)) as any;\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let MoteEngine = class MoteEngine extends Engine {
|
|
5
|
+
};
|
|
6
|
+
MoteEngine = __decorate([
|
|
7
|
+
ViewEngine("mote")
|
|
8
|
+
], MoteEngine);
|
|
9
|
+
export { MoteEngine };
|
|
10
|
+
//# sourceMappingURL=MoteEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoteEngine.js","sourceRoot":"","sources":["../../../src/components/MoteEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,MAAM;CAAG,CAAA;AAA5B,UAAU;IADtB,UAAU,CAAC,MAAM,CAAC;GACN,UAAU,CAAkB;SAA5B,UAAU","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"mote\")\nexport class MoteEngine extends Engine {}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let MustacheEngine = class MustacheEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
return (options) => this.engine.render(template, options, options.partials);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
MustacheEngine = __decorate([
|
|
10
|
+
ViewEngine("mustache")
|
|
11
|
+
], MustacheEngine);
|
|
12
|
+
export { MustacheEngine };
|
|
13
|
+
//# sourceMappingURL=MustacheEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MustacheEngine.js","sourceRoot":"","sources":["../../../src/components/MustacheEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,MAAM;IAC9B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnF,CAAC;CACF,CAAA;AAJY,cAAc;IAD1B,UAAU,CAAC,UAAU,CAAC;GACV,cAAc,CAI1B;SAJY,cAAc","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"mustache\")\nexport class MustacheEngine extends Engine {\n protected $compile(template: string, options: any) {\n return (options: any) => this.engine.render(template, options, options.partials);\n }\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
4
|
+
import { Engine } from "./Engine.js";
|
|
5
|
+
let NunjucksEngine = class NunjucksEngine extends Engine {
|
|
6
|
+
configure(options) {
|
|
7
|
+
const engine = options.nunjucksEnv || this.engine;
|
|
8
|
+
let env = engine;
|
|
9
|
+
// deprecated fallback support for express
|
|
10
|
+
// <https://github.com/tj/consolidate.js/pull/152>
|
|
11
|
+
// <https://github.com/tj/consolidate.js/pull/224>
|
|
12
|
+
if (options.settings && options.settings.views) {
|
|
13
|
+
env = engine.configure(options.settings.views);
|
|
14
|
+
}
|
|
15
|
+
else if (options.nunjucks && options.nunjucks.configure) {
|
|
16
|
+
// eslint-disable-next-line prefer-spread
|
|
17
|
+
env = engine.configure.apply(engine, options.nunjucks.configure);
|
|
18
|
+
}
|
|
19
|
+
//
|
|
20
|
+
// because `renderString` does not initiate loaders
|
|
21
|
+
// we must manually create a loader for it based off
|
|
22
|
+
// either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
|
|
23
|
+
//
|
|
24
|
+
// <https://github.com/mozilla/nunjucks/issues/730>
|
|
25
|
+
// <https://github.com/crocodilejs/node-email-templates/issues/182>
|
|
26
|
+
//
|
|
27
|
+
// so instead we simply check if we passed a custom loader
|
|
28
|
+
// otherwise we create a simple file based loader
|
|
29
|
+
if (options.loader) {
|
|
30
|
+
return new engine.Environment(options.loader);
|
|
31
|
+
}
|
|
32
|
+
if (options.settings && options.settings.views) {
|
|
33
|
+
return new engine.Environment(new engine.FileSystemLoader(options.settings.views));
|
|
34
|
+
}
|
|
35
|
+
if (options.nunjucks && options.nunjucks.loader) {
|
|
36
|
+
if (typeof options.nunjucks.loader === "string") {
|
|
37
|
+
return new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
|
|
38
|
+
}
|
|
39
|
+
return new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader[0], options.nunjucks.loader[1]));
|
|
40
|
+
}
|
|
41
|
+
return env;
|
|
42
|
+
}
|
|
43
|
+
$compile(template, options) {
|
|
44
|
+
let engine = this.configure(options);
|
|
45
|
+
const render = promisify(engine.renderString.bind(engine));
|
|
46
|
+
return (options) => render(template, options);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
NunjucksEngine = __decorate([
|
|
50
|
+
ViewEngine("nunjucks")
|
|
51
|
+
], NunjucksEngine);
|
|
52
|
+
export { NunjucksEngine };
|
|
53
|
+
//# sourceMappingURL=NunjucksEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NunjucksEngine.js","sourceRoot":"","sources":["../../../src/components/NunjucksEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,MAAM;IAC9B,SAAS,CAAC,OAAY;QAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC;QAClD,IAAI,GAAG,GAAG,MAAM,CAAC;QAEjB,0CAA0C;QAC1C,kDAAkD;QAClD,kDAAkD;QAClD,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE;YAC9C,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChD;aAAM,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE;YACzD,yCAAyC;YACzC,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;SAClE;QAED,EAAE;QACF,mDAAmD;QACnD,oDAAoD;QACpD,mFAAmF;QACnF,EAAE;QACF,mDAAmD;QACnD,mEAAmE;QACnE,EAAE;QAEF,0DAA0D;QAC1D,iDAAiD;QACjD,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,OAAO,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAC/C;QAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE;YAC9C,OAAO,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;SACpF;QAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC/C,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;gBAC/C,OAAO,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;aACrF;YAED,OAAO,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACpH;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAES,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,IAAI,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAErC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAE3D,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF,CAAA;AApDY,cAAc;IAD1B,UAAU,CAAC,UAAU,CAAC;GACV,cAAc,CAoD1B;SApDY,cAAc","sourcesContent":["import {promisify} from \"util\";\nimport {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"nunjucks\")\nexport class NunjucksEngine extends Engine {\n protected configure(options: any) {\n const engine = options.nunjucksEnv || this.engine;\n let env = engine;\n\n // deprecated fallback support for express\n // <https://github.com/tj/consolidate.js/pull/152>\n // <https://github.com/tj/consolidate.js/pull/224>\n if (options.settings && options.settings.views) {\n env = engine.configure(options.settings.views);\n } else if (options.nunjucks && options.nunjucks.configure) {\n // eslint-disable-next-line prefer-spread\n env = engine.configure.apply(engine, options.nunjucks.configure);\n }\n\n //\n // because `renderString` does not initiate loaders\n // we must manually create a loader for it based off\n // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`\n //\n // <https://github.com/mozilla/nunjucks/issues/730>\n // <https://github.com/crocodilejs/node-email-templates/issues/182>\n //\n\n // so instead we simply check if we passed a custom loader\n // otherwise we create a simple file based loader\n if (options.loader) {\n return new engine.Environment(options.loader);\n }\n\n if (options.settings && options.settings.views) {\n return new engine.Environment(new engine.FileSystemLoader(options.settings.views));\n }\n\n if (options.nunjucks && options.nunjucks.loader) {\n if (typeof options.nunjucks.loader === \"string\") {\n return new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));\n }\n\n return new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader[0], options.nunjucks.loader[1]));\n }\n\n return env;\n }\n\n protected $compile(template: string, options: any) {\n let engine = this.configure(options);\n\n const render = promisify(engine.renderString.bind(engine));\n\n return (options: any) => render(template, options);\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let PlatesEngine = class PlatesEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
return (options) => {
|
|
7
|
+
const map = options.map || undefined;
|
|
8
|
+
return this.engine.bind(template, options, map);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
PlatesEngine = __decorate([
|
|
13
|
+
ViewEngine("plates")
|
|
14
|
+
], PlatesEngine);
|
|
15
|
+
export { PlatesEngine };
|
|
16
|
+
//# sourceMappingURL=PlatesEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatesEngine.js","sourceRoot":"","sources":["../../../src/components/PlatesEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,MAAM;IAC5B,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,OAAO,CAAC,OAAY,EAAE,EAAE;YACtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,SAAS,CAAC;YACrC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAPY,YAAY;IADxB,UAAU,CAAC,QAAQ,CAAC;GACR,YAAY,CAOxB;SAPY,YAAY","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"plates\")\nexport class PlatesEngine extends Engine {\n protected $compile(template: string, options: any) {\n return (options: any) => {\n const map = options.map || undefined;\n return this.engine.bind(template, options, map);\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let PugEngine = class PugEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
return this.engine.compile(template, options);
|
|
7
|
+
}
|
|
8
|
+
async $compileFile(file, options) {
|
|
9
|
+
return this.engine.compileFile(file, options);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
PugEngine = __decorate([
|
|
13
|
+
ViewEngine("pug", {
|
|
14
|
+
requires: ["pug", "then-pug"]
|
|
15
|
+
})
|
|
16
|
+
], PugEngine);
|
|
17
|
+
export { PugEngine };
|
|
18
|
+
//# sourceMappingURL=PugEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PugEngine.js","sourceRoot":"","sources":["../../../src/components/PugEngine.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAKhC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,MAAM;IACzB,QAAQ,CAAC,QAAgB,EAAE,OAAY;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAY;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AARY,SAAS;IAHrB,UAAU,CAAC,KAAK,EAAE;QACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC;KAC9B,CAAC;GACW,SAAS,CAQrB;SARY,SAAS","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"pug\", {\n requires: [\"pug\", \"then-pug\"]\n})\nexport class PugEngine extends Engine {\n protected $compile(template: string, options: any) {\n return this.engine.compile(template, options);\n }\n\n protected async $compileFile(file: string, options: any) {\n return this.engine.compileFile(file, options);\n }\n}\n"]}
|