@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
package/readme.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
|
|
7
|
-
<h1>Ts.ED
|
|
7
|
+
<h1>Ts.ED Engines</h1>
|
|
8
8
|
|
|
9
|
-
[](https://github.com/tsedio/tsed/actions/workflows/build.yml)
|
|
10
10
|
[](https://github.com/semantic-release/semantic-release)
|
|
11
11
|
[](https://github.com/prettier/prettier)
|
|
12
12
|
[](https://opencollective.com/tsed)
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<div align="center">
|
|
17
17
|
<a href="https://tsed.io/">Website</a>
|
|
18
18
|
<span> • </span>
|
|
19
|
-
<a href="https://tsed.io/docs/
|
|
19
|
+
<a href="https://tsed.io/docs/templating.html">Templating with Ts.ED</a>
|
|
20
20
|
<span> • </span>
|
|
21
21
|
<a href="https://api.tsed.io/rest/slack/tsedio/tsed">Slack</a>
|
|
22
22
|
<span> • </span>
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
|
|
26
26
|
<hr />
|
|
27
27
|
|
|
28
|
-
> Template engine consolidation library (inspired
|
|
28
|
+
> Template engine consolidation library (inspired from consolidate) written in TypeScript.
|
|
29
29
|
|
|
30
30
|
## Feature
|
|
31
31
|
|
|
32
32
|
- Support multiple engine library,
|
|
33
33
|
- Extendable - You can register your own engine,
|
|
34
34
|
- Configurable,
|
|
35
|
-
- Agnostic from Express/Koa (but compatible with Express)
|
|
35
|
+
- Agnostic from Express/Koa (but compatible with Express).
|
|
36
36
|
|
|
37
37
|
## Installation
|
|
38
38
|
|
|
@@ -42,81 +42,82 @@ npm install @tsed/engines
|
|
|
42
42
|
|
|
43
43
|
## Supported template engines
|
|
44
44
|
|
|
45
|
-
Some package has the same key name, @tsed/engines will load them according to the order number.
|
|
46
|
-
For example with dust, @tsed/engines will try to use in this order: `dustjs-helpers` and `dustjs-linkedin`.
|
|
45
|
+
Some package has the same key name, @tsed/engines will load them according to the order number.
|
|
46
|
+
For example with dust, @tsed/engines will try to use in this order: `dustjs-helpers` and `dustjs-linkedin`.
|
|
47
47
|
If `dustjs-helpers` is installed, `dustjs-linkedin` will not be used by consolidate.
|
|
48
48
|
|
|
49
|
-
| Name
|
|
50
|
-
|
|
51
|
-
| [atpl](https://github.com/soywiz/atpl.js)
|
|
52
|
-
| [bracket](https://github.com/danlevan/bracket-template)
|
|
53
|
-
| [dot](https://github.com/olado/doT)
|
|
54
|
-
| [dust](https://github.com/linkedin/dustjs)
|
|
55
|
-
| [ect](https://github.com/baryshev/ect)
|
|
56
|
-
| [ejs](https://github.com/mde/ejs)
|
|
57
|
-
| [hamlet](https://github.com/gregwebs/hamlet.js)
|
|
58
|
-
| [hamljs](https://github.com/visionmedia/haml.js)
|
|
59
|
-
| [haml-coffee](https://github.com/netzpirat/haml-coffee)
|
|
60
|
-
| [handlebars](https://github.com/wycats/handlebars.js/)
|
|
61
|
-
| [hogan](https://github.com/twitter/hogan.js)
|
|
62
|
-
| [htmling](https://github.com/codemix/htmling)
|
|
63
|
-
| [jazz](https://github.com/shinetech/jazz)
|
|
64
|
-
| [just](https://github.com/baryshev/just)
|
|
65
|
-
| [liquor](https://github.com/chjj/liquor)
|
|
66
|
-
| [lodash](https://github.com/bestiejs/lodash)
|
|
67
|
-
| [marko](https://github.com/marko-js/marko)
|
|
68
|
-
| [mote](https://github.com/satchmorun/mote)
|
|
69
|
-
| [mustache](https://github.com/janl/mustache.js)
|
|
70
|
-
| [nunjucks](https://github.com/mozilla/nunjucks)
|
|
71
|
-
| [plates](https://github.com/flatiron/plates)
|
|
72
|
-
| [pug](https://github.com/pugjs/pug)
|
|
73
|
-
| [ractive](https://github.com/ractivejs/ractive)
|
|
74
|
-
| [react](https://github.com/facebook/react)
|
|
75
|
-
| [slm](https://github.com/slm-lang/slm)
|
|
76
|
-
| [squirrelly](https://github.com/squirrellyjs/squirrelly)
|
|
77
|
-
| [swig](https://github.com/node-swig/swig-templates)
|
|
78
|
-
| [teacup](https://github.com/goodeggs/teacup)
|
|
79
|
-
| [templayed](https://github.com/archan937/templayed.js/)
|
|
80
|
-
| [toffee](https://github.com/malgorithms/toffee)
|
|
81
|
-
| [twig](https://github.com/justjohn/twig.js)
|
|
82
|
-
| [twing](https://github.com/NightlyCommit/twing)
|
|
83
|
-
| [underscore](https://github.com/documentcloud/underscore) | [`npm install underscore`](https://www.npmjs.com/package/underscore)
|
|
84
|
-
| [vash](https://github.com/kirbysayshi/vash)
|
|
85
|
-
| [velocityjs](https://github.com/julianshapiro/velocity)
|
|
86
|
-
| [walrus](https://github.com/jeremyruppel/walrus)
|
|
87
|
-
| [whiskers](https://github.com/gsf/whiskers.js)
|
|
88
|
-
| [vue](https://github.com/vuejs/vue)
|
|
89
|
-
|
|
49
|
+
| Name | Package Name / Order | Website / State |
|
|
50
|
+
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
51
|
+
| [atpl](https://github.com/soywiz/atpl.js) | [`npm install atpl`](https://www.npmjs.com/package/atpl) | - |
|
|
52
|
+
| [bracket](https://github.com/danlevan/bracket-template) | [`npm install bracket-template`](https://www.npmjs.com/package/bracket-template) | - |
|
|
53
|
+
| [dot](https://github.com/olado/doT) | [`npm install dot`](https://www.npmjs.com/package/dot) | [(website)](http://olado.github.io/doT/) |
|
|
54
|
+
| [dust](https://github.com/linkedin/dustjs) | [`npm install dustjs-helpers`](https://www.npmjs.com/package/dustjs-helpers) (2) or<br>[`npm install dustjs-linkedin`](https://www.npmjs.com/package/dustjs-linkedin) (3) | [(website)](http://linkedin.github.io/dustjs/) |
|
|
55
|
+
| [ect](https://github.com/baryshev/ect) | [`npm install ect`](https://www.npmjs.com/package/ect) | [(website)](http://ectjs.com/) |
|
|
56
|
+
| [ejs](https://github.com/mde/ejs) | [`npm install ejs`](https://www.npmjs.com/package/ejs) | [(website)](http://ejs.co/) |
|
|
57
|
+
| [hamlet](https://github.com/gregwebs/hamlet.js) | [`npm install hamlet`](https://www.npmjs.com/package/hamlet) | - |
|
|
58
|
+
| [hamljs](https://github.com/visionmedia/haml.js) | [`npm install hamljs`](https://www.npmjs.com/package/hamljs) | - |
|
|
59
|
+
| [haml-coffee](https://github.com/netzpirat/haml-coffee) | [`npm install haml-coffee`](https://www.npmjs.com/package/haml-coffee) | - |
|
|
60
|
+
| [handlebars](https://github.com/wycats/handlebars.js/) | [`npm install handlebars`](https://www.npmjs.com/package/handlebars) | [(website)](http://handlebarsjs.com/) |
|
|
61
|
+
| [hogan](https://github.com/twitter/hogan.js) | [`npm install hogan.js`](https://www.npmjs.com/package/hogan.js) | [(website)](http://twitter.github.com/hogan.js/) |
|
|
62
|
+
| [htmling](https://github.com/codemix/htmling) | [`npm install htmling`](https://www.npmjs.com/package/htmling) | - |
|
|
63
|
+
| [jazz](https://github.com/shinetech/jazz) | [`npm install jazz`](https://www.npmjs.com/package/jazz) | - |
|
|
64
|
+
| [just](https://github.com/baryshev/just) | [`npm install just`](https://www.npmjs.com/package/just) | - |
|
|
65
|
+
| [liquor](https://github.com/chjj/liquor) | [`npm install liquor`](https://www.npmjs.com/package/liquor) | - |
|
|
66
|
+
| [lodash](https://github.com/bestiejs/lodash) | [`npm install lodash`](https://www.npmjs.com/package/lodash) | [(website)](http://lodash.com/) |
|
|
67
|
+
| [marko](https://github.com/marko-js/marko) | [`npm install marko`](https://www.npmjs.com/package/marko) | [(website)](http://markojs.com) |
|
|
68
|
+
| [mote](https://github.com/satchmorun/mote) | [`npm install mote`](https://www.npmjs.com/package/mote) | [(website)](http://satchmorun.github.io/mote/) |
|
|
69
|
+
| [mustache](https://github.com/janl/mustache.js) | [`npm install mustache`](https://www.npmjs.com/package/mustache) | - |
|
|
70
|
+
| [nunjucks](https://github.com/mozilla/nunjucks) | [`npm install nunjucks`](https://www.npmjs.com/package/nunjucks) | [(website)](https://mozilla.github.io/nunjucks) |
|
|
71
|
+
| [plates](https://github.com/flatiron/plates) | [`npm install plates`](https://www.npmjs.com/package/plates) | - |
|
|
72
|
+
| [pug](https://github.com/pugjs/pug) | [`npm install pug`](https://www.npmjs.com/package/pug) | [(website)](http://jade-lang.com/) / **(formerly jade)** |
|
|
73
|
+
| [ractive](https://github.com/ractivejs/ractive) | [`npm install ractive`](https://www.npmjs.com/package/ractive) | - |
|
|
74
|
+
| [react](https://github.com/facebook/react) | [`npm install react`](https://www.npmjs.com/package/react) | - |
|
|
75
|
+
| [slm](https://github.com/slm-lang/slm) | [`npm install slm`](https://www.npmjs.com/package/slm) | - |
|
|
76
|
+
| [squirrelly](https://github.com/squirrellyjs/squirrelly) | [`npm install squirrelly`](https://www.npmjs.com/package/squirrelly) | [(website)](https://squirrelly.js.org) |
|
|
77
|
+
| [swig](https://github.com/node-swig/swig-templates) | [`npm install swig-templates`](https://www.npmjs.com/package/swig-templates) (2) | - |
|
|
78
|
+
| [teacup](https://github.com/goodeggs/teacup) | [`npm install teacup`](https://www.npmjs.com/package/teacup) | - |
|
|
79
|
+
| [templayed](https://github.com/archan937/templayed.js/) | [`npm install templayed`](https://www.npmjs.com/package/templayed) | [(website)](http://archan937.github.com/templayed.js/) |
|
|
80
|
+
| [toffee](https://github.com/malgorithms/toffee) | [`npm install toffee`](https://www.npmjs.com/package/toffee) | - |
|
|
81
|
+
| [twig](https://github.com/justjohn/twig.js) | [`npm install twig`](https://www.npmjs.com/package/twig) | [(wiki)](https://github.com/twigjs/twig.js/wiki/Implementation-Notes) |
|
|
82
|
+
| [twing](https://github.com/NightlyCommit/twing) | [`npm install twing`](https://www.npmjs.com/package/twing) | [(website)](https://nightlycommit.github.io/twing/) |
|
|
83
|
+
| [underscore](https://github.com/documentcloud/underscore) | [`npm install underscore`](https://www.npmjs.com/package/underscore) | [(website)](http://underscorejs.org/#template) |
|
|
84
|
+
| [vash](https://github.com/kirbysayshi/vash) | [`npm install vash`](https://www.npmjs.com/package/vash) | - |
|
|
85
|
+
| [velocityjs](https://github.com/julianshapiro/velocity) | [BETA](https://www.npmjs.com/package/velocity-animate) | [(website)](http://velocityjs.org/) |
|
|
86
|
+
| [walrus](https://github.com/jeremyruppel/walrus) | [`npm install walrus`](https://www.npmjs.com/package/walrus) | [(website)](http://documentup.com/jeremyruppel/walrus/) |
|
|
87
|
+
| [whiskers](https://github.com/gsf/whiskers.js) | [`npm install whiskers`](https://www.npmjs.com/package/whiskers) | - |
|
|
88
|
+
| [vue](https://github.com/vuejs/vue) | `npm install vue vue-pronto` | [(website)](https://vuejs.org/) |
|
|
89
|
+
|
|
90
|
+
> **NOTE**: you must still install the engines you wish to use, add them to your package.json dependencies.
|
|
90
91
|
|
|
91
92
|
## API
|
|
92
93
|
|
|
93
94
|
You can get an engine by using `engines`:
|
|
94
95
|
|
|
95
96
|
```typescript
|
|
96
|
-
import {getEngine} from
|
|
97
|
+
import {getEngine} from "@tsed/engines";
|
|
97
98
|
|
|
98
|
-
getEngine(
|
|
99
|
-
.renderFile({
|
|
99
|
+
getEngine("swig")
|
|
100
|
+
.renderFile({user: "tobi"})
|
|
100
101
|
.then((html) => {
|
|
101
102
|
console.log(html);
|
|
102
|
-
})
|
|
103
|
+
});
|
|
103
104
|
```
|
|
104
105
|
|
|
105
106
|
Or render directly a template:
|
|
106
107
|
|
|
107
108
|
```typescript
|
|
108
|
-
import {getEngine} from
|
|
109
|
+
import {getEngine} from "@tsed/engines";
|
|
109
110
|
|
|
110
|
-
getEngine(
|
|
111
|
-
.render(
|
|
111
|
+
getEngine("ejs")
|
|
112
|
+
.render("<p><%= user.name %></p>")
|
|
112
113
|
.then((html) => {
|
|
113
114
|
console.log(html);
|
|
114
|
-
})
|
|
115
|
+
});
|
|
115
116
|
```
|
|
116
117
|
|
|
117
118
|
## Caching
|
|
118
119
|
|
|
119
|
-
To enable caching simply pass `{ cache: true }`. EnginesContainer _may_ use this option to cache things reading the file contents, compiled `Function`s etc.
|
|
120
|
+
To enable caching simply pass `{ cache: true }`. EnginesContainer _may_ use this option to cache things reading the file contents, compiled `Function`s etc.
|
|
120
121
|
EnginesContainer which do _not_ support this may simply ignore it. All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments.
|
|
121
122
|
When using @tsed/engines directly: `getEngine('swig').renderFile('views/page.html', { user: 'tobi', cache: true });`
|
|
122
123
|
|
|
@@ -127,36 +128,36 @@ Using supported Express versions: `app.locals.cache = true` or set NODE_ENV to '
|
|
|
127
128
|
`@tsed/engines` can be used with Express as following:
|
|
128
129
|
|
|
129
130
|
```typescript
|
|
130
|
-
import express from
|
|
131
|
-
import {getEngine} from
|
|
131
|
+
import express from "express";
|
|
132
|
+
import {getEngine} from "@tsed/engines";
|
|
132
133
|
|
|
133
134
|
// assign the swig engine to .html files
|
|
134
|
-
app.engine(
|
|
135
|
+
app.engine("html", getEngine("swig"));
|
|
135
136
|
|
|
136
137
|
// set .html as the default extension
|
|
137
|
-
app.set(
|
|
138
|
-
app.set(
|
|
138
|
+
app.set("view engine", "html");
|
|
139
|
+
app.set("views", __dirname + "/views");
|
|
139
140
|
|
|
140
141
|
var users = [];
|
|
141
|
-
users.push({
|
|
142
|
-
users.push({
|
|
143
|
-
users.push({
|
|
142
|
+
users.push({name: "tobi"});
|
|
143
|
+
users.push({name: "loki"});
|
|
144
|
+
users.push({name: "jane"});
|
|
144
145
|
|
|
145
|
-
app.get(
|
|
146
|
-
res.render(
|
|
147
|
-
title:
|
|
146
|
+
app.get("/", function (req, res) {
|
|
147
|
+
res.render("index", {
|
|
148
|
+
title: "Ts.ED EnginesContainer"
|
|
148
149
|
});
|
|
149
150
|
});
|
|
150
151
|
|
|
151
|
-
app.get(
|
|
152
|
-
res.render(
|
|
153
|
-
title:
|
|
152
|
+
app.get("/users", function (req, res) {
|
|
153
|
+
res.render("users", {
|
|
154
|
+
title: "Users",
|
|
154
155
|
users: users
|
|
155
156
|
});
|
|
156
157
|
});
|
|
157
158
|
|
|
158
159
|
app.listen(3000);
|
|
159
|
-
console.log(
|
|
160
|
+
console.log("Express server listening on port 3000");
|
|
160
161
|
```
|
|
161
162
|
|
|
162
163
|
## Koa
|
|
@@ -166,17 +167,17 @@ console.log('Express server listening on port 3000');
|
|
|
166
167
|
```typescript
|
|
167
168
|
import {getEngines} from "./getEngines";
|
|
168
169
|
|
|
169
|
-
var views = require(
|
|
170
|
+
var views = require("koa-views");
|
|
170
171
|
|
|
171
|
-
const render = views(__dirname +
|
|
172
|
+
const render = views(__dirname + "/views", {
|
|
172
173
|
engineSource: getEngines(),
|
|
173
174
|
map: {
|
|
174
|
-
html:
|
|
175
|
+
html: "underscore"
|
|
175
176
|
}
|
|
176
|
-
})
|
|
177
|
+
});
|
|
177
178
|
|
|
178
179
|
// Must be used before any router is used
|
|
179
|
-
app.use(render)
|
|
180
|
+
app.use(render);
|
|
180
181
|
// OR Expand by app.context
|
|
181
182
|
// No order restrictions
|
|
182
183
|
// app.context.render = render()
|
|
@@ -184,30 +185,30 @@ app.use(render)
|
|
|
184
185
|
app.use(async function (ctx) {
|
|
185
186
|
ctx.state = {
|
|
186
187
|
session: this.session,
|
|
187
|
-
title:
|
|
188
|
+
title: "app"
|
|
188
189
|
};
|
|
189
190
|
|
|
190
|
-
await ctx.render(
|
|
191
|
-
user:
|
|
191
|
+
await ctx.render("user", {
|
|
192
|
+
user: "John"
|
|
192
193
|
});
|
|
193
194
|
});
|
|
194
195
|
```
|
|
195
196
|
|
|
196
197
|
## Template Engine Instances
|
|
197
198
|
|
|
198
|
-
Template engines are exposed via the `requires` object, but they are not instantiated until you've called the `getEngine(engine).render()` method.
|
|
199
|
+
Template engines are exposed via the `requires` object, but they are not instantiated until you've called the `getEngine(engine).render()` method.
|
|
199
200
|
You can instantiate them manually beforehand if you want to add filters, globals, mixins, or other engine features.
|
|
200
201
|
|
|
201
202
|
```typescript
|
|
202
|
-
import {requires} from
|
|
203
|
-
import nunjucks from
|
|
203
|
+
import {requires} from "consolidate";
|
|
204
|
+
import nunjucks from "nunjucks";
|
|
204
205
|
|
|
205
206
|
// add nunjucks to requires so filters can be
|
|
206
207
|
// added and the same instance will be used inside the render method
|
|
207
|
-
requires.set(
|
|
208
|
+
requires.set("nunjucks", nunjucks.configure());
|
|
208
209
|
|
|
209
|
-
requires.get(
|
|
210
|
-
return
|
|
210
|
+
requires.get("nunjucks").addFilter("foo", () => {
|
|
211
|
+
return "bar";
|
|
211
212
|
});
|
|
212
213
|
```
|
|
213
214
|
|
|
@@ -256,11 +257,11 @@ export class CustomePugEngine extends PugEngine {
|
|
|
256
257
|
|
|
257
258
|
## Notes
|
|
258
259
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
- If you're using Nunjucks, please take a look at the `exports.nunjucks.render` function in `packages/engines/src/components/NunjuncksEngine.ts`. You can pass your own engine/environment via `options.nunjucksEnv`, or if you want to support Express you can pass `options.settings.views`, or if you have another use case, pass `options.nunjucks` (see the code for more insight).
|
|
261
|
+
- You can pass **partials** with `options.partials`
|
|
262
|
+
- For using **template inheritance** with nunjucks, you can pass a loader
|
|
262
263
|
with `options.loader`.
|
|
263
|
-
|
|
264
|
+
- `React` To render content into a html base template (eg. `index.html` of your React app), pass the path of the template with `options.base`.
|
|
264
265
|
|
|
265
266
|
## Contributors
|
|
266
267
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"include": ["src"],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"node_modules",
|
|
14
|
+
"test",
|
|
15
|
+
"lib",
|
|
16
|
+
"benchmark",
|
|
17
|
+
"coverage",
|
|
18
|
+
"spec",
|
|
19
|
+
"**/*.benchmark.ts",
|
|
20
|
+
"**/*.spec.ts",
|
|
21
|
+
"keys",
|
|
22
|
+
"jest.config.js",
|
|
23
|
+
"**/__mock__/**"
|
|
24
|
+
]
|
|
25
|
+
}
|