@rhinostone/swig 2.4.3 → 2.5.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/HISTORY.md +6 -1
- package/README.md +1 -1
- package/ROADMAP.md +6 -1
- package/dist/swig.js +93 -9
- package/dist/swig.min.js +2 -2
- package/dist/swig.min.js.map +1 -1
- package/lib/dateformatter.js +1 -1
- package/lib/swig.js +1 -1
- package/lib/tags/extends.js +8 -8
- package/lib/tags/filter.js +1 -1
- package/lib/tags/if.js +5 -6
- package/lib/tags/import.js +6 -6
- package/lib/tags/parent.js +4 -4
- package/package.json +2 -2
package/lib/tags/import.js
CHANGED
|
@@ -28,7 +28,7 @@ var _dangerousProps = require('@rhinostone/swig-core/lib/security').dangerousPro
|
|
|
28
28
|
* @param {literal} varname Local-accessible object name to assign the macros to.
|
|
29
29
|
*/
|
|
30
30
|
exports.compile = function (compiler, args, content, parents, options) {
|
|
31
|
-
//
|
|
31
|
+
// Async-codegen branch. Parse stashed `[{path}, alias]`
|
|
32
32
|
// (no macro pre-render in async mode); emit IRImportDeferred so the
|
|
33
33
|
// backend's `_swig.getTemplate` + `.exports` bind happens at runtime.
|
|
34
34
|
if (options && options.codegenMode === 'async') {
|
|
@@ -154,11 +154,11 @@ exports.parse = function (str, line, parser, types, stack, opts, swig) {
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
macroName = token.args[0];
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
157
|
+
// macro.compile returns an IRMacro node rather than a JS source
|
|
158
|
+
// string. Render it through the shared backend so import.js still
|
|
159
|
+
// gets the JS source it performs regex-surgery on for
|
|
160
|
+
// namespace-prefixing. The +'\n' trailing newline matches the
|
|
161
|
+
// legacy compile output exactly.
|
|
162
162
|
out += backend.compile([token.compile(compiler, token.args, token.content, [], compileOpts)], [], compileOpts) + '\n';
|
|
163
163
|
self.out.push({compiled: out, name: macroName});
|
|
164
164
|
});
|
package/lib/tags/parent.js
CHANGED
|
@@ -35,10 +35,10 @@ exports.compile = function (compiler, args, content, parents, options, blockName
|
|
|
35
35
|
// Silly JSLint "Strange Loop" requires return to be in a conditional
|
|
36
36
|
if (breaker && parentFile !== parent.name) {
|
|
37
37
|
block = parent.blocks[blockName];
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
38
|
+
// The block tag returns `IRBlock { body: [...] }`. Splice the
|
|
39
|
+
// matched parent block's body into an IRParent node; the backend
|
|
40
|
+
// emits body verbatim plus a trailing newline for byte-identity
|
|
41
|
+
// with the legacy JS-string emission shape.
|
|
42
42
|
var blockNode = block.compile(compiler, [blockName], block.content, parents.slice(i + 1), options);
|
|
43
43
|
return ir.parent((blockNode && blockNode.body) ? blockNode.body.concat([ir.legacyJS('\n')]) : [ir.legacyJS('\n')]);
|
|
44
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinostone/swig",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A simple, powerful, and extendable templating engine for node.js and browsers, similar to Django, Jinja2, and Twig.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"template",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"Rhinostone <contact@gina.io>"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rhinostone/swig-core": "2.
|
|
24
|
+
"@rhinostone/swig-core": "2.5.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"blanket": "~1.1",
|