@rhinostone/swig 2.0.0-alpha.1 → 2.0.0-alpha.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/.changes/v2.0.0-alpha.2.md +4 -0
- package/HISTORY.md +5 -0
- package/ROADMAP.md +6 -2
- package/dist/swig.js +4083 -5134
- package/dist/swig.min.js +80 -7
- package/dist/swig.min.js.map +1 -1
- package/lib/filters.js +3 -4
- package/lib/lexer.js +1 -1
- package/lib/loaders/filesystem.js +3 -5
- package/lib/loaders/index.js +3 -5
- package/lib/loaders/memory.js +4 -6
- package/lib/parser.js +16 -15
- package/lib/swig.js +3 -3
- package/lib/tags/autoescape.js +24 -1
- package/lib/tags/block.js +4 -1
- package/lib/tags/elseif.js +12 -1
- package/lib/tags/extends.js +8 -0
- package/lib/tags/filter.js +68 -9
- package/lib/tags/for.js +26 -28
- package/lib/tags/if.js +43 -4
- package/lib/tags/import.js +23 -3
- package/lib/tags/include.js +69 -9
- package/lib/tags/macro.js +23 -15
- package/lib/tags/parent.js +9 -2
- package/lib/tags/raw.js +12 -1
- package/lib/tags/set.js +58 -3
- package/lib/utils.js +6 -8
- package/package.json +3 -2
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
[2.0.0-alpha.2](https://github.com/gina-io/swig/tree/v2.0.0-alpha.2) / 2026-04-15
|
|
2
|
+
---------------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
* **Changed** Phase 2 of the multi-flavor architecture: native frontend now compiles source → IR → backend. All built-in tags (`autoescape`, `filter`, `if`/`elseif`/`else`, `for`, `set`, `block`/`extends`/`parent`, `include`, `import`, `macro`) emit structured IR nodes; `IRLegacyJS` preserves the JS-string `compile` path for userland `setTag` consumers. TokenParser expression-level codegen migrated to IRExpr — every `{{ … }}` output site lowers through `parseOutput` + `parseExpr` (Pratt parser), with a structured fallback to `IRLegacyJS` for shapes the flat IR cannot represent. Filter chains, deep-filter compositions (`{{ a|f(b|g) }}`), and per-operand filter precedence (`{{ a|upper + b|lower }}`) all route through IR via the new `IRFilterCallExpr`. Internal-only carve; no user-visible API changes vs `2.0.0-alpha.1` — same entry points, same compiled-output semantics, all 7 CVE-2023-25345 + 1 CVE-2021-44906 regressions remain green. 526 → 673 Node tests (added IR + parseExpr + parseOutput acceptance suites).
|
package/HISTORY.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
[2.0.0-alpha.2](https://github.com/gina-io/swig/tree/v2.0.0-alpha.2) / 2026-04-15
|
|
2
|
+
---------------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
* **Changed** Phase 2 of the multi-flavor architecture: native frontend now compiles source → IR → backend. All built-in tags (`autoescape`, `filter`, `if`/`elseif`/`else`, `for`, `set`, `block`/`extends`/`parent`, `include`, `import`, `macro`) emit structured IR nodes; `IRLegacyJS` preserves the JS-string `compile` path for userland `setTag` consumers. TokenParser expression-level codegen migrated to IRExpr — every `{{ … }}` output site lowers through `parseOutput` + `parseExpr` (Pratt parser), with a structured fallback to `IRLegacyJS` for shapes the flat IR cannot represent. Filter chains, deep-filter compositions (`{{ a|f(b|g) }}`), and per-operand filter precedence (`{{ a|upper + b|lower }}`) all route through IR via the new `IRFilterCallExpr`. Internal-only carve; no user-visible API changes vs `2.0.0-alpha.1` — same entry points, same compiled-output semantics, all 7 CVE-2023-25345 + 1 CVE-2021-44906 regressions remain green. 526 → 673 Node tests (added IR + parseExpr + parseOutput acceptance suites).
|
|
5
|
+
|
|
1
6
|
[2.0.0-alpha.1](https://github.com/gina-io/swig/tree/v2.0.0-alpha.1) / 2026-04-14
|
|
2
7
|
---------------------------------------------------------------------------------
|
|
3
8
|
|
package/ROADMAP.md
CHANGED
|
@@ -10,7 +10,7 @@ For bug reports and feature requests, file an issue at [gina-io/swig](https://gi
|
|
|
10
10
|
|
|
11
11
|
| Status | Item |
|
|
12
12
|
| --- | --- |
|
|
13
|
-
| Planned |
|
|
13
|
+
| Planned | Port the native Swig frontend to emit IR instead of JS directly. Test gate: byte-identical compiled output for existing suites. Target: `2.0.0-alpha.2`. |
|
|
14
14
|
|
|
15
15
|
## Future (post-2.0)
|
|
16
16
|
|
|
@@ -18,7 +18,6 @@ Multi-flavor architecture — a single backend with swappable frontends so Twig
|
|
|
18
18
|
|
|
19
19
|
| Status | Item |
|
|
20
20
|
| --- | --- |
|
|
21
|
-
| Planned | Port the native Swig frontend to emit IR instead of JS directly. Test gate: byte-identical compiled output for existing suites. Target: `2.0.0-alpha.2`. |
|
|
22
21
|
| Planned | Ship `@rhinostone/swig-twig` frontend — expression sugar (`~`, `??`, `?:`, `..`, `is X`, `not in`, `#{}`), Twig tag rewrites (`apply`, `verbatim`, `set/endset`, `with/endwith`, `from import`), ~20 filter parity. |
|
|
23
22
|
| Planned | Ship Jinja2 and Django frontends. On demand — when there's concrete user demand. |
|
|
24
23
|
| Planned | Engine bump + test framework migration. Move to Node ≥ 18, `node:test` + `node:assert/strict`, swap mocha-phantomjs for a modern browser-test harness, swap blanket for `c8`. Bundled with `2.0.0`. |
|
|
@@ -27,6 +26,11 @@ Multi-flavor architecture — a single backend with swappable frontends so Twig
|
|
|
27
26
|
|
|
28
27
|
## Completed
|
|
29
28
|
|
|
29
|
+
### v2.0.0-alpha.1 (April 2026)
|
|
30
|
+
|
|
31
|
+
- Carve `@rhinostone/swig-core` — extract IR stubs, backend (JS codegen), runtime (cache, loader, filter infra, `_dangerousProps` guards), lexer token-type enum, and TokenParser into a standalone workspace package. `@rhinostone/swig` becomes the native-syntax frontend plus a core re-export. Phase 1 of the multi-flavor architecture.
|
|
32
|
+
- Replace `browserify@~2` with `esbuild@^0.28` in the browser build. Resolves the long-standing inability of browserify@2 (2013) to resolve scoped packages through `node_modules`, and unblocks the Phase 2 port of the native frontend to IR emission. `lib/**/*.js` shims now require `@rhinostone/swig-core` by scoped name.
|
|
33
|
+
|
|
30
34
|
### v1.6.0 (April 2026)
|
|
31
35
|
|
|
32
36
|
- AOT compile target: `swig compile --recursive <dir>` walks a directory and emits a single CommonJS module mapping relative template paths to compiled functions. New `--ext` filter flag. Conflicts with `--method-name` / `--wrap-start` / `--wrap-end` / positional file arguments.
|