@tsed/engines 1.1.4 → 7.0.0-beta.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/.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,14 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ViewEngine } from "../decorators/viewEngine.js";
|
|
3
|
+
import { Engine } from "./Engine.js";
|
|
4
|
+
let WalrusEngine = class WalrusEngine extends Engine {
|
|
5
|
+
$compile(template, options) {
|
|
6
|
+
const compile = this.engine.parse(template);
|
|
7
|
+
return (options) => compile.compile(options);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
WalrusEngine = __decorate([
|
|
11
|
+
ViewEngine("walrus")
|
|
12
|
+
], WalrusEngine);
|
|
13
|
+
export { WalrusEngine };
|
|
14
|
+
//# sourceMappingURL=WalrusEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalrusEngine.js","sourceRoot":"","sources":["../../../src/components/WalrusEngine.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,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE5C,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF,CAAA;AANY,YAAY;IADxB,UAAU,CAAC,QAAQ,CAAC;GACR,YAAY,CAMxB;SANY,YAAY","sourcesContent":["import {ViewEngine} from \"../decorators/viewEngine\";\nimport {Engine} from \"./Engine\";\n\n@ViewEngine(\"walrus\")\nexport class WalrusEngine extends Engine {\n protected $compile(template: string, options: any) {\n const compile = this.engine.parse(template);\n\n return (options: any) => compile.compile(options);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewEngine.js","sourceRoot":"","sources":["../../../src/decorators/viewEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,gCAAgC,CAAC;AAEvD,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,UAA6B,EAAE;IACtE,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAC,CAAC,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {ViewEngineOptions} from \"../components/Engine\";\nimport {engines} from \"../registries/EnginesContainer\";\n\nexport function ViewEngine(name: string, options: ViewEngineOptions = {}): ClassDecorator {\n return (target: any) => {\n engines.set(target, {name, useClass: target, options});\n };\n}\n"]}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./components/AtplEngine.js";
|
|
5
|
+
export * from "./components/BracketEngine.js";
|
|
6
|
+
export * from "./components/DotEngine.js";
|
|
7
|
+
export * from "./components/DustEngine.js";
|
|
8
|
+
export * from "./components/EctEngine.js";
|
|
9
|
+
export * from "./components/EjsEngine.js";
|
|
10
|
+
export * from "./components/Engine.js";
|
|
11
|
+
export * from "./components/HamlCoffeeEngine.js";
|
|
12
|
+
export * from "./components/HamlEngine.js";
|
|
13
|
+
export * from "./components/HamletEngine.js";
|
|
14
|
+
export * from "./components/HandlebarsEngine.js";
|
|
15
|
+
export * from "./components/HoganEngine.js";
|
|
16
|
+
export * from "./components/HtmlingEngine.js";
|
|
17
|
+
export * from "./components/JazzEngine.js";
|
|
18
|
+
export * from "./components/JqtplEngine.js";
|
|
19
|
+
export * from "./components/JustEngine.js";
|
|
20
|
+
export * from "./components/LiquorEngine.js";
|
|
21
|
+
export * from "./components/LodashEngine.js";
|
|
22
|
+
export * from "./components/MarkoEngine.js";
|
|
23
|
+
export * from "./components/MoteEngine.js";
|
|
24
|
+
export * from "./components/MustacheEngine.js";
|
|
25
|
+
export * from "./components/NunjucksEngine.js";
|
|
26
|
+
export * from "./components/PlatesEngine.js";
|
|
27
|
+
export * from "./components/PugEngine.js";
|
|
28
|
+
export * from "./components/RactiveEngine.js";
|
|
29
|
+
export * from "./components/ReactEngine.js";
|
|
30
|
+
export * from "./components/SlmEngine.js";
|
|
31
|
+
export * from "./components/SquirrellyEngine.js";
|
|
32
|
+
export * from "./components/SwigEngine.js";
|
|
33
|
+
export * from "./components/TemplayedEngine.js";
|
|
34
|
+
export * from "./components/ToffeeEngine.js";
|
|
35
|
+
export * from "./components/TwigEngine.js";
|
|
36
|
+
export * from "./components/TwingEngine.js";
|
|
37
|
+
export * from "./components/UnderscoreEngine.js";
|
|
38
|
+
export * from "./components/VashEngine.js";
|
|
39
|
+
export * from "./components/VelocityEngine.js";
|
|
40
|
+
export * from "./components/VueEngine.js";
|
|
41
|
+
export * from "./components/WalrusEngine.js";
|
|
42
|
+
export * from "./decorators/viewEngine.js";
|
|
43
|
+
export * from "./registries/EnginesContainer.js";
|
|
44
|
+
export * from "./utils/cache.js";
|
|
45
|
+
export * from "./utils/getEngines.js";
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/AtplEngine\";\nexport * from \"./components/BracketEngine\";\nexport * from \"./components/DotEngine\";\nexport * from \"./components/DustEngine\";\nexport * from \"./components/EctEngine\";\nexport * from \"./components/EjsEngine\";\nexport * from \"./components/Engine\";\nexport * from \"./components/HamlCoffeeEngine\";\nexport * from \"./components/HamlEngine\";\nexport * from \"./components/HamletEngine\";\nexport * from \"./components/HandlebarsEngine\";\nexport * from \"./components/HoganEngine\";\nexport * from \"./components/HtmlingEngine\";\nexport * from \"./components/JazzEngine\";\nexport * from \"./components/JqtplEngine\";\nexport * from \"./components/JustEngine\";\nexport * from \"./components/LiquorEngine\";\nexport * from \"./components/LodashEngine\";\nexport * from \"./components/MarkoEngine\";\nexport * from \"./components/MoteEngine\";\nexport * from \"./components/MustacheEngine\";\nexport * from \"./components/NunjucksEngine\";\nexport * from \"./components/PlatesEngine\";\nexport * from \"./components/PugEngine\";\nexport * from \"./components/RactiveEngine\";\nexport * from \"./components/ReactEngine\";\nexport * from \"./components/SlmEngine\";\nexport * from \"./components/SquirrellyEngine\";\nexport * from \"./components/SwigEngine\";\nexport * from \"./components/TemplayedEngine\";\nexport * from \"./components/ToffeeEngine\";\nexport * from \"./components/TwigEngine\";\nexport * from \"./components/TwingEngine\";\nexport * from \"./components/UnderscoreEngine\";\nexport * from \"./components/VashEngine\";\nexport * from \"./components/VelocityEngine\";\nexport * from \"./components/VueEngine\";\nexport * from \"./components/WalrusEngine\";\nexport * from \"./decorators/viewEngine\";\nexport * from \"./registries/EnginesContainer\";\nexport * from \"./utils/cache\";\nexport * from \"./utils/getEngines\";\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _EnginesContainer_providers;
|
|
2
|
+
import { __classPrivateFieldGet } from "tslib";
|
|
3
|
+
export class EnginesContainer {
|
|
4
|
+
constructor() {
|
|
5
|
+
_EnginesContainer_providers.set(this, new Map());
|
|
6
|
+
}
|
|
7
|
+
has(key) {
|
|
8
|
+
return __classPrivateFieldGet(this, _EnginesContainer_providers, "f").has(key);
|
|
9
|
+
}
|
|
10
|
+
get(key) {
|
|
11
|
+
const provider = __classPrivateFieldGet(this, _EnginesContainer_providers, "f").get(key);
|
|
12
|
+
if (provider && !provider.instance) {
|
|
13
|
+
provider.instance = new provider.useClass(provider.name, provider.options);
|
|
14
|
+
}
|
|
15
|
+
return provider === null || provider === void 0 ? void 0 : provider.instance;
|
|
16
|
+
}
|
|
17
|
+
set(key, provider) {
|
|
18
|
+
__classPrivateFieldGet(this, _EnginesContainer_providers, "f").set(key, provider);
|
|
19
|
+
__classPrivateFieldGet(this, _EnginesContainer_providers, "f").set(provider.name, provider);
|
|
20
|
+
}
|
|
21
|
+
getSupportedEngines() {
|
|
22
|
+
return [...__classPrivateFieldGet(this, _EnginesContainer_providers, "f").keys()].filter((key) => typeof key === "string");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
_EnginesContainer_providers = new WeakMap();
|
|
26
|
+
export const engines = new EnginesContainer();
|
|
27
|
+
//# sourceMappingURL=EnginesContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnginesContainer.js","sourceRoot":"","sources":["../../../src/registries/EnginesContainer.ts"],"names":[],"mappings":";;AASA,MAAM,OAAO,gBAAgB;IAA7B;QACE,sCAA0D,IAAI,GAAG,EAAE,EAAC;IAwBtE,CAAC;IAtBC,GAAG,CAAC,GAA2B;QAC7B,OAAO,uBAAA,IAAI,mCAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,GAAG,CAAC,GAA2B;QAC7B,MAAM,QAAQ,GAAG,uBAAA,IAAI,mCAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE1C,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClC,QAAQ,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC5E;QAED,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAC;IAC5B,CAAC;IAED,GAAG,CAAC,GAAkB,EAAE,QAAwB;QAC9C,uBAAA,IAAI,mCAAW,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnC,uBAAA,IAAI,mCAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,mBAAmB;QACjB,OAAO,CAAC,GAAG,uBAAA,IAAI,mCAAW,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAa,CAAC;IAC1F,CAAC;CACF;;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC","sourcesContent":["import {Engine, ViewEngineOptions} from \"../components/Engine\";\n\nexport interface EngineProvider {\n name: string;\n useClass: typeof Engine;\n instance?: Engine;\n options: ViewEngineOptions;\n}\n\nexport class EnginesContainer {\n #providers: Map<string | typeof Engine, EngineProvider> = new Map();\n\n has(key: string | typeof Engine) {\n return this.#providers.has(key);\n }\n\n get(key: string | typeof Engine) {\n const provider = this.#providers.get(key);\n\n if (provider && !provider.instance) {\n provider.instance = new provider.useClass(provider.name, provider.options);\n }\n\n return provider?.instance;\n }\n\n set(key: typeof Engine, provider: EngineProvider) {\n this.#providers.set(key, provider);\n this.#providers.set(provider.name, provider);\n }\n\n getSupportedEngines(): string[] {\n return [...this.#providers.keys()].filter((key) => typeof key === \"string\") as string[];\n }\n}\n\nexport const engines = new EnginesContainer();\n"]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import { dirname, extname, isAbsolute, join } from "path";
|
|
3
|
+
const readCache = new Map();
|
|
4
|
+
const cacheStore = new Map();
|
|
5
|
+
export const requires = new Map();
|
|
6
|
+
export function getCachedEngine(name, toName = name) {
|
|
7
|
+
const mdl = requires.get(toName) || {};
|
|
8
|
+
return mdl.default || mdl;
|
|
9
|
+
}
|
|
10
|
+
export async function importEngine(name, toName = name) {
|
|
11
|
+
if (!requires.has(toName)) {
|
|
12
|
+
await setEngine(name, toName);
|
|
13
|
+
}
|
|
14
|
+
return getCachedEngine(toName);
|
|
15
|
+
}
|
|
16
|
+
export async function setEngine(name, toName = name) {
|
|
17
|
+
const mdl = await import(name);
|
|
18
|
+
requires.set(toName, mdl);
|
|
19
|
+
}
|
|
20
|
+
export function setToCache(key, value) {
|
|
21
|
+
readCache.set(key, value);
|
|
22
|
+
}
|
|
23
|
+
export function getFromCache(key) {
|
|
24
|
+
return readCache.get(key);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Clear the cache.
|
|
28
|
+
*
|
|
29
|
+
* @api public
|
|
30
|
+
*/
|
|
31
|
+
export const clearCache = () => {
|
|
32
|
+
readCache.clear();
|
|
33
|
+
cacheStore.clear();
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Conditionally cache `compiled` template based
|
|
37
|
+
* on the `options` filename and `.cache` boolean.
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} options
|
|
40
|
+
* @param {Function} compiled
|
|
41
|
+
* @return {Function}
|
|
42
|
+
*/
|
|
43
|
+
export function cache(options, compiled) {
|
|
44
|
+
// cachable
|
|
45
|
+
if (compiled && options.filename && options.cache) {
|
|
46
|
+
readCache.delete(options.filename);
|
|
47
|
+
cacheStore.set(options.filename, compiled);
|
|
48
|
+
return compiled;
|
|
49
|
+
}
|
|
50
|
+
// check cache
|
|
51
|
+
if (options.filename && options.cache) {
|
|
52
|
+
return cacheStore.get(options.filename);
|
|
53
|
+
}
|
|
54
|
+
return compiled;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Read `path` with `options` with
|
|
58
|
+
* callback `(err, str)`. When `options.cache`
|
|
59
|
+
* is true the template string will be cached.
|
|
60
|
+
*
|
|
61
|
+
* @param path
|
|
62
|
+
* @param {String} options
|
|
63
|
+
*/
|
|
64
|
+
export async function read(path, options) {
|
|
65
|
+
let str = readCache.get(path);
|
|
66
|
+
// cached (only if cached is a string and not a compiled template function)
|
|
67
|
+
if (options.cache && str && typeof str === "string") {
|
|
68
|
+
return str;
|
|
69
|
+
}
|
|
70
|
+
// read
|
|
71
|
+
str = await fs.readFile(path, "utf8");
|
|
72
|
+
// remove extraneous utf8 BOM marker
|
|
73
|
+
str = str.replace(/^\uFEFF/, "");
|
|
74
|
+
if (options.cache) {
|
|
75
|
+
readCache.set(path, str);
|
|
76
|
+
}
|
|
77
|
+
return str;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read `path` with `options` with
|
|
81
|
+
* callback `(err, str)`. When `options.cache`
|
|
82
|
+
* is true the partial string will be cached.
|
|
83
|
+
*
|
|
84
|
+
* @param path
|
|
85
|
+
* @param {String} options
|
|
86
|
+
* @api private
|
|
87
|
+
*/
|
|
88
|
+
export async function readPartials(path, options) {
|
|
89
|
+
if (!options.partials) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const keys = Object.keys(options.partials);
|
|
93
|
+
const partials = {};
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
async function next(index) {
|
|
96
|
+
if (index === keys.length) {
|
|
97
|
+
return resolve(partials);
|
|
98
|
+
}
|
|
99
|
+
const key = keys[index];
|
|
100
|
+
const partialPath = options.partials[key];
|
|
101
|
+
if (partialPath === undefined || partialPath === null || partialPath === false) {
|
|
102
|
+
return next(++index);
|
|
103
|
+
}
|
|
104
|
+
let file;
|
|
105
|
+
if (isAbsolute(partialPath)) {
|
|
106
|
+
if (extname(partialPath) !== "") {
|
|
107
|
+
file = partialPath;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
file = join(partialPath + extname(path));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
file = join(dirname(path), partialPath + extname(path));
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
partials[key] = await read(file, options);
|
|
118
|
+
next(++index);
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
reject(err);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
next(0);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -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AAC,EAAE,KAAK,CAAC,CAAC;aACf;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;QACH,CAAC;QAED,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import fs from \"fs-extra\";\nimport {dirname, extname, isAbsolute, join} from \"path\";\n\nconst readCache: Map<string, string> = new Map();\nconst cacheStore: Map<string, any> = new Map();\n\nexport const requires: Map<string, any> = new Map();\n\nexport function getCachedEngine(name: string, toName: string = name) {\n const mdl = requires.get(toName) || {};\n\n return mdl.default || mdl;\n}\n\nexport async function importEngine(name: string, toName: string = name) {\n if (!requires.has(toName)) {\n await setEngine(name, toName);\n }\n\n return getCachedEngine(toName);\n}\n\nexport async function setEngine(name: string, toName: string = name) {\n const mdl = await import(name);\n requires.set(toName, mdl);\n}\n\nexport function setToCache(key: string, value: any) {\n readCache.set(key, value);\n}\n\nexport function getFromCache(key: string) {\n return readCache.get(key);\n}\n\n/**\n * Clear the cache.\n *\n * @api public\n */\n\nexport const clearCache = () => {\n readCache.clear();\n cacheStore.clear();\n};\n\n/**\n * Conditionally cache `compiled` template based\n * on the `options` filename and `.cache` boolean.\n *\n * @param {Object} options\n * @param {Function} compiled\n * @return {Function}\n */\nexport function cache(options: any, compiled?: any) {\n // cachable\n if (compiled && options.filename && options.cache) {\n readCache.delete(options.filename);\n cacheStore.set(options.filename, compiled);\n return compiled;\n }\n\n // check cache\n if (options.filename && options.cache) {\n return cacheStore.get(options.filename);\n }\n\n return compiled;\n}\n\n/**\n * Read `path` with `options` with\n * callback `(err, str)`. When `options.cache`\n * is true the template string will be cached.\n *\n * @param path\n * @param {String} options\n */\nexport async function read(path: string, options: any): Promise<string> {\n let str = readCache.get(path);\n\n // cached (only if cached is a string and not a compiled template function)\n if (options.cache && str && typeof str === \"string\") {\n return str;\n }\n\n // read\n str = await fs.readFile(path, \"utf8\");\n\n // remove extraneous utf8 BOM marker\n str = str.replace(/^\\uFEFF/, \"\");\n\n if (options.cache) {\n readCache.set(path, str);\n }\n\n return str;\n}\n\n/**\n * Read `path` with `options` with\n * callback `(err, str)`. When `options.cache`\n * is true the partial string will be cached.\n *\n * @param path\n * @param {String} options\n * @api private\n */\nexport async function readPartials(path: string, options: any): Promise<Record<string, string> | void> {\n if (!options.partials) {\n return;\n }\n\n const keys = Object.keys(options.partials);\n const partials: Record<string, string> = {};\n\n return new Promise((resolve, reject) => {\n async function next(index: number): Promise<any> {\n if (index === keys.length) {\n return resolve(partials);\n }\n\n const key = keys[index];\n const partialPath = options.partials[key];\n\n if (partialPath === undefined || partialPath === null || partialPath === false) {\n return next(++index);\n }\n\n let file;\n if (isAbsolute(partialPath)) {\n if (extname(partialPath) !== \"\") {\n file = partialPath;\n } else {\n file = join(partialPath + extname(path));\n }\n } else {\n file = join(dirname(path), partialPath + extname(path));\n }\n\n try {\n partials[key] = await read(file, options);\n next(++index);\n } catch (err) {\n reject(err);\n }\n }\n\n next(0);\n });\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { engines } from "../registries/EnginesContainer.js";
|
|
2
|
+
const callbackify = async (fn, cb) => {
|
|
3
|
+
try {
|
|
4
|
+
const html = await fn();
|
|
5
|
+
cb && cb(null, html);
|
|
6
|
+
return html;
|
|
7
|
+
}
|
|
8
|
+
catch (er) {
|
|
9
|
+
if (cb) {
|
|
10
|
+
cb(er);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
throw er;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export function getEngine(name) {
|
|
18
|
+
const cb = async (path, options, cb) => {
|
|
19
|
+
const engine = engines.get(name);
|
|
20
|
+
await engine.$onInit();
|
|
21
|
+
return callbackify(() => engine.renderFile(path, options), cb);
|
|
22
|
+
};
|
|
23
|
+
cb.render = async (template, options, cb) => {
|
|
24
|
+
const engine = engines.get(name);
|
|
25
|
+
await engine.$onInit();
|
|
26
|
+
return callbackify(() => engine.render(template, options), cb);
|
|
27
|
+
};
|
|
28
|
+
return cb;
|
|
29
|
+
}
|
|
30
|
+
let localEngines;
|
|
31
|
+
export function getEngines() {
|
|
32
|
+
localEngines =
|
|
33
|
+
localEngines ||
|
|
34
|
+
engines.getSupportedEngines().reduce((acc, key) => {
|
|
35
|
+
return {
|
|
36
|
+
...acc,
|
|
37
|
+
[key]: getEngine(key)
|
|
38
|
+
};
|
|
39
|
+
}, {});
|
|
40
|
+
return localEngines;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=getEngines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEngines.js","sourceRoot":"","sources":["../../../src/utils/getEngines.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,gCAAgC,CAAC;AAWvD,MAAM,WAAW,GAAG,KAAK,EAAE,EAAO,EAAE,EAAmB,EAAE,EAAE;IACzD,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC;QACxB,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE;YACN,EAAE,CAAC,EAAE,CAAC,CAAC;SACR;aAAM;YACL,MAAM,EAAE,CAAC;SACV;KACF;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,EAAE,GAAG,KAAK,EAAE,IAAY,EAAE,OAAY,EAAE,EAAmB,EAAE,EAAE;QACnE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;QAClC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QAEvB,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,EAAE,CAAC,MAAM,GAAG,KAAK,EAAE,QAAgB,EAAE,OAAsB,EAAE,EAAkB,EAAE,EAAE;QACjF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;QAClC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QAEvB,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,OAAO,EAAS,CAAC;AACnB,CAAC;AAED,IAAI,YAAiB,CAAC;AAEtB,MAAM,UAAU,UAAU;IACxB,YAAY;QACV,YAAY;YACZ,OAAO,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBAChD,OAAO;oBACL,GAAG,GAAG;oBACN,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC;iBACtB,CAAC;YACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAET,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import {EngineOptions} from \"../components/Engine\";\nimport {engines} from \"../registries/EnginesContainer\";\n\nexport type RenderCallback = (err: Error | null, str?: string | any) => any;\nexport interface EngineFunction {\n (path: string, options: any, cb: RenderCallback): void;\n (path: string, options: any): Promise<string>;\n\n render(template: string, options: any, cb: RenderCallback): void;\n render(template: string, options: any): Promise<string>;\n}\n\nconst callbackify = async (fn: any, cb?: RenderCallback) => {\n try {\n const html = await fn();\n cb && cb(null, html);\n return html;\n } catch (er) {\n if (cb) {\n cb(er);\n } else {\n throw er;\n }\n }\n};\n\nexport function getEngine(name: string): EngineFunction {\n const cb = async (path: string, options: any, cb?: RenderCallback) => {\n const engine = engines.get(name)!;\n await engine.$onInit();\n\n return callbackify(() => engine.renderFile(path, options), cb);\n };\n\n cb.render = async (template: string, options: EngineOptions, cb: RenderCallback) => {\n const engine = engines.get(name)!;\n await engine.$onInit();\n\n return callbackify(() => engine.render(template, options), cb);\n };\n\n return cb as any;\n}\n\nlet localEngines: any;\n\nexport function getEngines(): Record<string, EngineFunction> {\n localEngines =\n localEngines ||\n engines.getSupportedEngines().reduce((acc, key) => {\n return {\n ...acc,\n [key]: getEngine(key)\n };\n }, {});\n\n return localEngines;\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -7,15 +7,18 @@ export interface EngineOptions {
|
|
|
7
7
|
}
|
|
8
8
|
export declare class Engine {
|
|
9
9
|
readonly name: string;
|
|
10
|
+
readonly options: ViewEngineOptions;
|
|
10
11
|
protected driverName: string;
|
|
11
12
|
constructor(name: string, options: ViewEngineOptions);
|
|
12
13
|
get engine(): any;
|
|
14
|
+
$onInit(): Promise<void>;
|
|
13
15
|
compile(template: string, options: EngineOptions): any;
|
|
14
16
|
compileFile(file: string, options: EngineOptions): any;
|
|
15
17
|
render(template: string, options: EngineOptions): Promise<any>;
|
|
16
18
|
renderFile(file: string, options: EngineOptions): Promise<any>;
|
|
17
|
-
protected readPartials(file: string, options: EngineOptions): Promise<
|
|
19
|
+
protected readPartials(file: string, options: EngineOptions): Promise<EngineOptions>;
|
|
18
20
|
protected $cacheOptions(template: string, options: EngineOptions, fromFile?: boolean): EngineOptions;
|
|
19
21
|
protected $compile(template: string, options: EngineOptions): (options: EngineOptions) => Promise<string>;
|
|
20
22
|
protected $compileFile(file: string, options: EngineOptions): Promise<(options: EngineOptions) => Promise<string>>;
|
|
23
|
+
protected importEngine(name: string, options: ViewEngineOptions): Promise<void[]>;
|
|
21
24
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Engine, EngineOptions, ViewEngineOptions } from "./Engine";
|
|
2
2
|
export declare class ReactEngine extends Engine {
|
|
3
3
|
constructor(name: string, options: ViewEngineOptions);
|
|
4
|
+
$onInit(): Promise<void>;
|
|
5
|
+
get babel(): any;
|
|
6
|
+
get reactDOM(): any;
|
|
4
7
|
protected patchRequire(): void;
|
|
5
8
|
protected configure(options: EngineOptions): {
|
|
6
9
|
base: any;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Engine, EngineOptions
|
|
1
|
+
import { Engine, EngineOptions } from "./Engine";
|
|
2
2
|
export declare class VueEngine extends Engine {
|
|
3
3
|
#private;
|
|
4
|
-
|
|
4
|
+
$onInit(): Promise<void>;
|
|
5
5
|
get pronto(): any;
|
|
6
6
|
get vueify(): any;
|
|
7
7
|
get vueServerRenderer(): any;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
1
4
|
export * from "./components/AtplEngine";
|
|
2
5
|
export * from "./components/BracketEngine";
|
|
3
6
|
export * from "./components/DotEngine";
|
|
4
7
|
export * from "./components/DustEngine";
|
|
5
8
|
export * from "./components/EctEngine";
|
|
6
9
|
export * from "./components/EjsEngine";
|
|
7
|
-
export * from "./components/
|
|
10
|
+
export * from "./components/Engine";
|
|
8
11
|
export * from "./components/HamlCoffeeEngine";
|
|
12
|
+
export * from "./components/HamlEngine";
|
|
9
13
|
export * from "./components/HamletEngine";
|
|
10
14
|
export * from "./components/HandlebarsEngine";
|
|
11
15
|
export * from "./components/HoganEngine";
|
|
@@ -28,14 +32,13 @@ export * from "./components/SquirrellyEngine";
|
|
|
28
32
|
export * from "./components/SwigEngine";
|
|
29
33
|
export * from "./components/TemplayedEngine";
|
|
30
34
|
export * from "./components/ToffeeEngine";
|
|
31
|
-
export * from "./components/TwingEngine";
|
|
32
35
|
export * from "./components/TwigEngine";
|
|
36
|
+
export * from "./components/TwingEngine";
|
|
33
37
|
export * from "./components/UnderscoreEngine";
|
|
34
38
|
export * from "./components/VashEngine";
|
|
35
39
|
export * from "./components/VelocityEngine";
|
|
36
40
|
export * from "./components/VueEngine";
|
|
37
41
|
export * from "./components/WalrusEngine";
|
|
38
|
-
export * from "./components/Engine";
|
|
39
42
|
export * from "./decorators/viewEngine";
|
|
40
43
|
export * from "./registries/EnginesContainer";
|
|
41
44
|
export * from "./utils/cache";
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const requires: Map<string, any>;
|
|
2
|
-
export declare
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
2
|
+
export declare function getCachedEngine(name: string, toName?: string): any;
|
|
3
|
+
export declare function importEngine(name: string, toName?: string): Promise<any>;
|
|
4
|
+
export declare function setEngine(name: string, toName?: string): Promise<void>;
|
|
5
5
|
export declare function setToCache(key: string, value: any): void;
|
|
6
6
|
export declare function getFromCache(key: string): string | undefined;
|
|
7
7
|
/**
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/engines",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.0.0-beta.5",
|
|
4
|
+
"description": "Template engines library. Provide an API to adding custom engines from decorators.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"
|
|
6
|
+
"main": "./lib/cjs/index.js",
|
|
7
|
+
"module": "./lib/esm/index.js",
|
|
8
|
+
"typings": "./lib/types/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"import": "./lib/esm/index.js",
|
|
12
|
+
"require": "./lib/cjs/index.js",
|
|
13
|
+
"default": "./lib/esm/index.js"
|
|
11
14
|
},
|
|
12
15
|
"scripts": {
|
|
13
|
-
"build": "
|
|
16
|
+
"build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
17
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
18
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
19
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
20
|
+
"test": "cross-env NODE_ENV=test nyc mocha"
|
|
14
21
|
},
|
|
15
22
|
"private": false,
|
|
16
23
|
"dependencies": {
|
|
17
|
-
"fs-extra": "
|
|
18
|
-
"tslib": "2.
|
|
24
|
+
"fs-extra": "10.0.1",
|
|
25
|
+
"tslib": "^2.3.1"
|
|
19
26
|
},
|
|
20
27
|
"devDependencies": {
|
|
21
|
-
"@types/fs-extra": "^9.0.
|
|
22
|
-
"@types/semver": "7.3.
|
|
28
|
+
"@types/fs-extra": "^9.0.13",
|
|
29
|
+
"@types/semver": "^7.3.9",
|
|
23
30
|
"arc-templates": "^0.5.3",
|
|
24
|
-
"atpl": "
|
|
31
|
+
"atpl": "^0.9.3",
|
|
25
32
|
"babel-core": "^6.26.3",
|
|
26
33
|
"babel-plugin-transform-runtime": "^6.23.0",
|
|
27
34
|
"babel-preset-es2015": "^6.24.1",
|
|
@@ -31,30 +38,30 @@
|
|
|
31
38
|
"dot": "^1.1.3",
|
|
32
39
|
"dust": "^0.3.0",
|
|
33
40
|
"dustjs-helpers": "^1.7.4",
|
|
34
|
-
"dustjs-linkedin": "^
|
|
41
|
+
"dustjs-linkedin": "^3.0.1",
|
|
35
42
|
"eco": "^1.1.0-rc-3",
|
|
36
43
|
"ect": "^0.5.9",
|
|
37
|
-
"ejs": "^3.1.
|
|
38
|
-
"haml": "0.4.3",
|
|
44
|
+
"ejs": "^3.1.6",
|
|
45
|
+
"haml": "^0.4.3",
|
|
39
46
|
"haml-coffee": "^1.14.1",
|
|
40
47
|
"hamlet": "^0.3.3",
|
|
41
48
|
"hamljs": "^0.6.2",
|
|
42
|
-
"handlebars": "^4.7.
|
|
49
|
+
"handlebars": "^4.7.7",
|
|
43
50
|
"hogan.js": "^3.0.2",
|
|
44
51
|
"htmling": "^0.0.8",
|
|
45
52
|
"jazz": "^0.0.18",
|
|
46
|
-
"jqtpl": "
|
|
53
|
+
"jqtpl": "^1.1.0",
|
|
47
54
|
"just": "^0.1.8",
|
|
48
55
|
"liquid-node": "^3.0.1",
|
|
49
56
|
"liquor": "^0.0.5",
|
|
50
|
-
"lodash": "^4.17.
|
|
51
|
-
"marko": "^
|
|
57
|
+
"lodash": "^4.17.21",
|
|
58
|
+
"marko": "^5.20.3",
|
|
52
59
|
"mote": "^0.2.0",
|
|
53
|
-
"mustache": "^4.0
|
|
54
|
-
"nunjucks": "^3.2.
|
|
55
|
-
"plates": "
|
|
60
|
+
"mustache": "^4.2.0",
|
|
61
|
+
"nunjucks": "^3.2.3",
|
|
62
|
+
"plates": "^0.4.11",
|
|
56
63
|
"pug": "^3.0.0",
|
|
57
|
-
"ractive": "^1.
|
|
64
|
+
"ractive": "^1.4.0",
|
|
58
65
|
"razor-tmpl": "^1.3.1",
|
|
59
66
|
"react": "^16.13.1",
|
|
60
67
|
"react-dom": "^16.13.1",
|
|
@@ -83,10 +90,11 @@
|
|
|
83
90
|
"view"
|
|
84
91
|
],
|
|
85
92
|
"peerDependencies": {},
|
|
86
|
-
"repository": "https://github.com/tsedio/tsed
|
|
93
|
+
"repository": "https://github.com/tsedio/tsed",
|
|
87
94
|
"bugs": {
|
|
88
|
-
"url": "https://github.com/tsedio/tsed
|
|
95
|
+
"url": "https://github.com/tsedio/tsed/issues"
|
|
89
96
|
},
|
|
90
|
-
"homepage": "https://github.com/tsedio/tsed
|
|
91
|
-
"author": "Romain Lenzotti"
|
|
97
|
+
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/engines",
|
|
98
|
+
"author": "Romain Lenzotti",
|
|
99
|
+
"license": "MIT"
|
|
92
100
|
}
|