@rhinostone/swig-core 2.5.1 → 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.
Files changed (2) hide show
  1. package/lib/engine.js +10 -8
  2. package/package.json +1 -1
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.1",
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",