@rhinostone/swig-twig 2.0.0-alpha.7 → 2.0.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/README.md +6 -8
- package/lib/index.js +0 -29
- package/package.json +3 -3
- package/rhinostone-swig-twig-2.0.0-alpha.7.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
@rhinostone/swig-twig
|
|
2
2
|
=====================
|
|
3
3
|
|
|
4
|
-
[](https://www.npmjs.
|
|
4
|
+
[](https://www.npmjs.com/package/@rhinostone/swig-twig) [](https://socket.dev/npm/package/@rhinostone/swig-twig)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Twig frontend for the [@rhinostone/swig-core](https://www.npmjs.com/package/@rhinostone/swig-core) template engine. See #T16 in [ROADMAP.md](https://github.com/gina-io/swig/blob/develop/ROADMAP.md) for the multi-flavor roadmap.
|
|
6
|
+
Twig-syntax frontend for the [@rhinostone/swig-core](https://www.npmjs.com/package/@rhinostone/swig-core) template engine. Part of the multi-flavor architecture introduced in `2.0.0` — see [ROADMAP.md](https://github.com/gina-io/swig/blob/develop/ROADMAP.md) for the release narrative.
|
|
9
7
|
|
|
10
8
|
Installation
|
|
11
9
|
------------
|
|
12
10
|
|
|
13
|
-
npm install @rhinostone/swig-twig
|
|
11
|
+
npm install @rhinostone/swig-twig
|
|
14
12
|
|
|
15
|
-
This pulls in `@rhinostone/swig-core` as a peer dependency, pinned to the matching
|
|
13
|
+
This pulls in `@rhinostone/swig-core` as a peer dependency, pinned to the matching version. Frontends and the core release in lockstep — do not mix versions.
|
|
16
14
|
|
|
17
15
|
Basic example
|
|
18
16
|
-------------
|
|
@@ -26,8 +24,8 @@ var out = swig.render('Hello, {{ name|upper }}!', {
|
|
|
26
24
|
// => Hello, WORLD!
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
Supported surface (as of 2.0.0
|
|
30
|
-
|
|
27
|
+
Supported surface (as of 2.0.0)
|
|
28
|
+
-------------------------------
|
|
31
29
|
|
|
32
30
|
* **Tags** — `apply`, `block`, `extends`, `for`, `from`, `if`, `import`, `include`, `macro`, `set`, `verbatim`, `with`.
|
|
33
31
|
* **Operators** — `..` range, `??` null-coalescing, `~` string concat, `is <test>` / `is not <test>`.
|
package/lib/index.js
CHANGED
|
@@ -189,32 +189,3 @@ exports.invalidateCache = defaultInstance.invalidateCache;
|
|
|
189
189
|
* app.set('view engine', 'twig');
|
|
190
190
|
*/
|
|
191
191
|
exports.__express = defaultInstance.renderFile;
|
|
192
|
-
|
|
193
|
-
var _parseDeprecationWarned = false;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Parse a Twig source string into the parse-tree shape consumed by
|
|
197
|
-
* swig-core's `engine.compile`: `{ name, parent, tokens, blocks }`.
|
|
198
|
-
*
|
|
199
|
-
* @deprecated since 2.0.0-alpha.4 — use `new exports.Twig(opts)` and the
|
|
200
|
-
* per-instance `precompile` / `compile` / `render` surface installed by
|
|
201
|
-
* `engine.install`. Slated for removal in `2.0.0` stable. The full-instance
|
|
202
|
-
* path uses closure-captured tag/filter maps and honors `setFilter` /
|
|
203
|
-
* `setTag` overrides; this Path B wrapper does not.
|
|
204
|
-
*
|
|
205
|
-
* @param {string} source Twig template source.
|
|
206
|
-
* @param {object} [options] Per-call options.
|
|
207
|
-
* @return {object} `{ name, parent, tokens, blocks }`.
|
|
208
|
-
*/
|
|
209
|
-
exports.parse = function (source, options) {
|
|
210
|
-
if (!_parseDeprecationWarned) {
|
|
211
|
-
_parseDeprecationWarned = true;
|
|
212
|
-
if (typeof console !== 'undefined' && console.warn) {
|
|
213
|
-
console.warn('[@rhinostone/swig-twig] exports.parse is deprecated and will be removed in 2.0.0. Use `new twig.Twig(opts)` and the per-instance precompile/compile/render API instead.');
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
options = options || {};
|
|
217
|
-
var tags = options.tags || exports.tags;
|
|
218
|
-
var filters = options.filters || exports.filters;
|
|
219
|
-
return exports.parser.parse(undefined, source, options, tags, filters);
|
|
220
|
-
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinostone/swig-twig",
|
|
3
|
-
"version": "2.0.0
|
|
4
|
-
"description": "Twig frontend for the @rhinostone/swig-core template engine.
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Twig-syntax frontend for the @rhinostone/swig-core template engine. Part of the @rhinostone/swig multi-flavor family.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"template",
|
|
7
7
|
"templating",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=12"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@rhinostone/swig-core": "2.0.0
|
|
25
|
+
"@rhinostone/swig-core": "2.0.0"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
Binary file
|