@rhinostone/swig-core 2.5.0 → 2.5.2

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 CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  [![NPM version](http://img.shields.io/npm/v/@rhinostone/swig-core.svg?style=flat)](https://www.npmjs.com/package/@rhinostone/swig-core) [![Socket Badge](https://socket.dev/api/badge/npm/package/@rhinostone/swig-core)](https://socket.dev/npm/package/@rhinostone/swig-core)
5
5
 
6
- > **Shared runtime** for the `@rhinostone/swig` family of template engines. Not intended for direct consumption unless you are building a custom frontend. Install [@rhinostone/swig](https://www.npmjs.com/package/@rhinostone/swig) for the default Swig (Jinja2/Django-inspired) flavor, or [@rhinostone/swig-twig](https://www.npmjs.com/package/@rhinostone/swig-twig) for the Twig flavor — both pull this package in pinned to the matching version.
6
+ > **Shared runtime** for the `@rhinostone/swig` family of template engines. Not intended for direct consumption unless you are building a custom frontend. Install [@rhinostone/swig](https://www.npmjs.com/package/@rhinostone/swig) for the default Swig (Jinja2/Django-inspired) flavor, [@rhinostone/swig-twig](https://www.npmjs.com/package/@rhinostone/swig-twig) for the Twig flavor, or [@rhinostone/swig-jinja2](https://www.npmjs.com/package/@rhinostone/swig-jinja2) for the Python Jinja2 flavor they all pull this package in pinned to the matching version.
7
7
 
8
8
  Extracted from `@rhinostone/swig@1.6.0` during the `2.0.0-alpha.1` multi-flavor carve. See [ROADMAP.md](https://github.com/gina-io/swig/blob/develop/ROADMAP.md) for the release narrative.
9
9
 
@@ -21,6 +21,7 @@ Consumers
21
21
 
22
22
  * [@rhinostone/swig](https://www.npmjs.com/package/@rhinostone/swig) — default Swig flavor.
23
23
  * [@rhinostone/swig-twig](https://www.npmjs.com/package/@rhinostone/swig-twig) — Twig parity frontend.
24
+ * [@rhinostone/swig-jinja2](https://www.npmjs.com/package/@rhinostone/swig-jinja2) — Python Jinja2 frontend.
24
25
 
25
26
  Versioning
26
27
  ----------
package/lib/engine.js CHANGED
@@ -106,13 +106,15 @@ exports.importNonBlocks = function (blocks, tokens) {
106
106
  * which works for `{% extends "layout.html" %}` but for a bare
107
107
  * identifier (`{% extends parent_var %}`) yields a pre-lowered JS
108
108
  * source fragment such as `((typeof _ctx.parent_var !== "undefined")
109
- * ? _ctx.parent_var : …)`. Embedded here as a string literal it
110
- * becomes a garbage template lookup at runtime
111
- * (`Template not found: /((typeof _ctx.parent_var …`). Closing the
112
- * dynamic-extends gap requires the parser to stash an IRExpr on
113
- * `tokens.parent` and this helper to lower it through
114
- * `ir.extendsDeferred`'s `parentExpr` slot already designed as
115
- * `<IRExpr>` per the deferred IR contract.
109
+ * ? _ctx.parent_var : …)`. As a string literal that would become a
110
+ * garbage template lookup at runtime
111
+ * (`Template not found: /((typeof _ctx.parent_var …`). Closed: a
112
+ * dynamic path is lowered to an IRExpr by the extends tag's `lowerExpr`
113
+ * (lib/tags/extends.js) and stashed on the sibling `tokens.parentExpr`
114
+ * slot — NOT `tokens.parent`, which the sync `getParents` chain still
115
+ * reads as a string then passed through `ir.extendsDeferred`'s
116
+ * `path` slot below. A lone string-literal path keeps the
117
+ * `ir.literal('string', tokens.parent)` path unchanged.
116
118
  *
117
119
  * @param {object} tokens Parsed child template (must have `.parent`).
118
120
  * @param {object} options Per-call Swig options; `options.filename` is
@@ -149,7 +151,7 @@ function buildExtendsDeferred(tokens, options) {
149
151
  }
150
152
  });
151
153
  return ir.extendsDeferred(
152
- ir.literal('string', tokens.parent),
154
+ tokens.parentExpr || ir.literal('string', tokens.parent),
153
155
  childBlocks,
154
156
  childIRs,
155
157
  options.filename || ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinostone/swig-core",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Shared IR, backend, and runtime for the @rhinostone/swig family of template engines.",
5
5
  "keywords": [
6
6
  "template",