@rhinostone/swig-twig 2.4.3 → 2.5.1

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/lib/filters.js CHANGED
@@ -800,7 +800,7 @@ exports.merge = function (input, other) {
800
800
  *
801
801
  * Twig's native `|date` accepts DateTime / DateInterval objects, a
802
802
  * timezone string argument, and locale-aware month/day names. Those are
803
- * Phase 4 concerns — today this filter supports the same surface as
803
+ * deferred — today this filter supports the same surface as
804
804
  * native swig's `date` filter: Date object or epoch-ms number input, a
805
805
  * format string, an optional numeric `offset` in minutes from GMT, and
806
806
  * an optional `abbr` timezone abbreviation (output-only).
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @rhinostone/swig-twig — Twig frontend for the @rhinostone/swig family.
3
3
  *
4
- * Phase 3 Session 17: end-to-end render wiring (Path A). The package now
4
+ * End-to-end render wiring (Path A). The package now
5
5
  * exposes a Twig constructor + default instance via `engine.install(self,
6
6
  * frontend)` from @rhinostone/swig-core, so callers can `render(source,
7
7
  * locals)` / `renderFile(path, locals, cb)` directly against Twig syntax.
package/lib/lexer.js CHANGED
@@ -11,7 +11,7 @@ var TYPES = require('./tokentypes');
11
11
  */
12
12
 
13
13
  /*!
14
- * Phase 3 Session 2–4 — Twig lexer rule table.
14
+ * Twig lexer rule table.
15
15
  *
16
16
  * Covers the swig-shared token subset plus all Twig-only operators
17
17
  * including string interpolation (`~` concat, `..` range, `??`
@@ -168,7 +168,7 @@ var rules = [
168
168
  // cleanly decomposes into VAR `start` + RANGE `..` + VAR `end`. Native
169
169
  // swig-core's VAR rule still uses `\w*` because it has no RANGE token;
170
170
  // do not copy this tightening back without also auditing native's path
171
- // semantics. Phase 3 Session 6.
171
+ // semantics.
172
172
  type: TYPES.VAR,
173
173
  regex: [
174
174
  /^[a-zA-Z_$]\w*((\.\$?\w+)+)?/,
@@ -256,7 +256,7 @@ exports.types = TYPES;
256
256
  * Match the next token at the start of `str`.
257
257
  *
258
258
  * Throws via utils.throwError when no rule matches — including every
259
- * Twig-only operator until Session 3 adds its rules. The throw is
259
+ * Twig-only operator until its rules land. The throw is
260
260
  * opaque (no line / file info); the Twig frontend's onCompileError
261
261
  * callback attaches filename + line per the swig-core / frontend seam
262
262
  * rule.
package/lib/parser.js CHANGED
@@ -517,7 +517,7 @@ exports.parse = function (swig, source, opts, tags, filters) {
517
517
  );
518
518
  // Twig/Jinja2 whitespace-control. `{{- … -}}` / `{%- … -%}` strip
519
519
  // surrounding whitespace; the `-?` lives only adjacent to the open /
520
- // close marker (post-#T23 shape — drop the inner `-?` after `\s*` so
520
+ // close marker (drop the inner `-?` after `\s*` so
521
521
  // `{{ -5 }}` doesn't have its expression-`-` eaten as a strip marker).
522
522
  var tagStrip = new RegExp('^' + escapeRegExp(tagOpen) + '-?\\s*|\\s*-?' + escapeRegExp(tagClose) + '$', 'g');
523
523
  var varStrip = new RegExp('^' + escapeRegExp(varOpen) + '-?\\s*|\\s*-?' + escapeRegExp(varClose) + '$', 'g');
package/lib/tags/apply.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 11 — Twig `{% apply filter %}…{% endapply %}` tag.
2
+ * Twig `{% apply filter %}…{% endapply %}` tag.
3
3
  *
4
4
  * Twig apply syntax — pipe the captured body through one or more filters,
5
5
  * left-to-right:
package/lib/tags/block.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 9 — Twig `{% block %}` tag.
2
+ * Twig `{% block %}` tag.
3
3
  *
4
4
  * Named override point for template inheritance:
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 9 — Twig `{% extends %}` tag.
2
+ * Twig `{% extends %}` tag.
3
3
  *
4
4
  * Declares a parent template for inheritance:
5
5
  *
package/lib/tags/for.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 8 — Twig `{% for %}` tag.
2
+ * Twig `{% for %}` tag.
3
3
  *
4
4
  * Twig iteration:
5
5
  * {% for <val> in <iterable> %}…{% endfor %}
package/lib/tags/from.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 11 — Twig `{% from "file" import a, b as c %}` tag.
2
+ * Twig `{% from "file" import a, b as c %}` tag.
3
3
  *
4
4
  * Selective macro import syntax — binds a named subset of an imported
5
5
  * template's macros into the current context, optionally renaming each
@@ -142,7 +142,7 @@ exports.parse = function (str, line, parser, types, stack, opts, swig, token) {
142
142
  var path = pathTok.match.replace(/^['"]|['"]$/g, '');
143
143
 
144
144
  if (opts && opts.codegenMode === 'async') {
145
- // Phase 2 (#T22): async mode skips parse-time parseFile + macro
145
+ // Async mode skips parse-time parseFile + macro
146
146
  // pre-render. compile() emits IRFromImportDeferred; runtime resolves
147
147
  // the template via _swig.getTemplate and binds each entry on _ctx.
148
148
  token.args = [{ path: path, entries: entries }];
@@ -239,7 +239,7 @@ exports.parse = function (str, line, parser, types, stack, opts, swig, token) {
239
239
  * `IRLegacyJS`.
240
240
  */
241
241
  exports.compile = function (compiler, args, content, parents, options) {
242
- // Phase 2 (#T22): async-codegen branch. Parse stashed a single bundle
242
+ // Async-codegen branch. Parse stashed a single bundle
243
243
  // `[{path, entries: [{origName, aliasName}, ...]}]` in async mode (no
244
244
  // macro pre-render); emit IRFromImportDeferred so the backend's
245
245
  // `_swig.getTemplate` + per-entry `_ctx.<bind>` assignment happens at
package/lib/tags/if.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 7 — Twig `{% if %}` tag.
2
+ * Twig `{% if %}` tag.
3
3
  *
4
4
  * Twig conditional: `{% if <expr> %}…{% endif %}`. The test expression
5
5
  * is parsed via `parser.parseExpr` and attached to `token.irExpr`; the
@@ -7,8 +7,8 @@
7
7
  * mechanism (parser.js sets `ends: true` so subsequent tokens append to
8
8
  * `token.content` until the matching `{% endif %}` arrives).
9
9
  *
10
- * Session 7 ships a single-branch shape — `{% else %}` / `{% elseif %}`
11
- * are deferred to a later session. The compile path emits one
10
+ * Ships a single-branch shape — `{% else %}` / `{% elseif %}` are
11
+ * deferred. The compile path emits one
12
12
  * IRIfBranch carrying the test IRExpr and the recursively-compiled
13
13
  * body wrapped in IRLegacyJS.
14
14
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 10 — Twig `{% import %}` tag.
2
+ * Twig `{% import %}` tag.
3
3
  *
4
4
  * Twig import syntax:
5
5
  *
@@ -116,7 +116,7 @@ exports.parse = function (str, line, parser, types, stack, opts, swig, token) {
116
116
  var path = pathTok.match.replace(/^['"]|['"]$/g, '');
117
117
 
118
118
  if (opts && opts.codegenMode === 'async') {
119
- // Phase 2 (#T22): async mode skips the parse-time parseFile + macro
119
+ // Async mode skips the parse-time parseFile + macro
120
120
  // pre-render. compile() emits IRImportDeferred; runtime resolves the
121
121
  // template via _swig.getTemplate and binds .exports under the alias.
122
122
  token.args = [path, aliasTok.match];
@@ -194,7 +194,7 @@ exports.parse = function (str, line, parser, types, stack, opts, swig, token) {
194
194
  * imported macro into it.
195
195
  */
196
196
  exports.compile = function (compiler, args, content, parents, options) {
197
- // Phase 2 (#T22): async-codegen branch. Parse stashed `[path, alias]`
197
+ // Async-codegen branch. Parse stashed `[path, alias]`
198
198
  // in async mode (no macro pre-render); emit IRImportDeferred so the
199
199
  // backend's `_swig.getTemplate` + `.exports` bind happens at runtime.
200
200
  if (options && options.codegenMode === 'async') {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 10 — Twig `{% include %}` tag.
2
+ * Twig `{% include %}` tag.
3
3
  *
4
4
  * Twig include syntax:
5
5
  *
package/lib/tags/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 7 — Twig per-flavor tag registry.
2
+ * Twig per-flavor tag registry.
3
3
  *
4
4
  * Each tag exports `{ parse, compile, ends, block }` with a Twig-tailored
5
5
  * shape:
@@ -12,11 +12,8 @@
12
12
  * native-swig `parser.on(types.X, fn)` callback indirection — Twig tags own
13
13
  * their own arg-parsing path.
14
14
  *
15
- * Session 7 begins with an empty registry; subsequent commits within the
16
- * session add `set` (assignment) and `if` (flow control) to validate the
17
- * per-flavor shape. Future sessions add `for`, `block`, `extends`,
18
- * `include`, `import`, `macro`, `apply`, `verbatim`, `with`,
19
- * `from … import`.
15
+ * The registry covers `set`, `if`, `for`, `block`, `extends`, `include`,
16
+ * `import`, `macro`, `apply`, `verbatim`, `with`, and `from import`.
20
17
  */
21
18
 
22
19
  module.exports = {
package/lib/tags/macro.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 10 — Twig `{% macro %}` tag.
2
+ * Twig `{% macro %}` tag.
3
3
  *
4
4
  * Twig macro syntax:
5
5
  *
@@ -17,8 +17,8 @@
17
17
  * binding slots reject any `.` in the match before the
18
18
  * `_dangerousProps` check.
19
19
  *
20
- * Twig kwargs (`{% macro foo(a=1, b="x") %}`) are deferred Phase 4 with
21
- * the rest of the Twig-specific surface.
20
+ * Twig kwargs (`{% macro foo(a=1, b="x") %}`) are deferred with the
21
+ * rest of the Twig-specific surface.
22
22
  */
23
23
 
24
24
  var ir = require('@rhinostone/swig-core/lib/ir');
package/lib/tags/set.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 7 — Twig `{% set %}` tag.
3
- * Phase 3 Session 11 — extended with body-capture form.
2
+ * Twig `{% set %}` tag (assignment + body-capture forms).
4
3
  *
5
4
  * Twig `set` has two forms:
6
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 11 — Twig `{% verbatim %}…{% endverbatim %}` tag.
2
+ * Twig `{% verbatim %}…{% endverbatim %}` tag.
3
3
  *
4
4
  * Preserves arbitrary template-like content as literal output. Inside
5
5
  * a verbatim block, `{{ … }}`, `{% … %}` (other than `{% endverbatim %}`),
package/lib/tags/with.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Phase 3 Session 12 — Twig `{% with %}` tag.
2
+ * Twig `{% with %}` tag.
3
3
  *
4
4
  * Twig scoped-context region:
5
5
  *
package/lib/tokentypes.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * but the cognitive overhead of re-mapping IDs across flavors is not
12
12
  * worth the freedom.
13
13
  *
14
- * Twig-only IDs (30–37) are reserved here so Session 3 can add lexer
14
+ * Twig-only IDs (30–37) are reserved here so later commits can add lexer
15
15
  * rules without renumbering. Keeping the layout stable up front avoids
16
16
  * silent ID collisions across in-flight flavor work.
17
17
  *
@@ -70,7 +70,7 @@ module.exports = {
70
70
  /** Method call open — internal */
71
71
  METHODOPEN: 25,
72
72
 
73
- /* ---- Twig-only token IDs (reserved; rules land in Session 3+) ---- */
73
+ /* ---- Twig-only token IDs (reserved; rules land later) ---- */
74
74
 
75
75
  /** Twig string-concatenation operator — `~` */
76
76
  TILDE: 30,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinostone/swig-twig",
3
- "version": "2.4.3",
3
+ "version": "2.5.1",
4
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",
@@ -22,7 +22,7 @@
22
22
  "node": ">=12"
23
23
  },
24
24
  "peerDependencies": {
25
- "@rhinostone/swig-core": "2.4.3"
25
+ "@rhinostone/swig-core": "2.5.1"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"