tutuca 0.9.111 → 0.9.112

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tutuca",
3
- "version": "0.9.111",
3
+ "version": "0.9.112",
4
4
  "type": "module",
5
5
  "description": "SPA framework with immutable state and virtual DOM; dependency-free browser bundle",
6
6
  "main": "./dist/tutuca.js",
@@ -34,7 +34,7 @@
34
34
  "sync-docs-storybook": "bun scripts/sync-docs-storybook.js",
35
35
  "build-skill": "bun scripts/build-skill.js",
36
36
  "clean-skill": "rm -rf skill",
37
- "test": "bun test test/*.test.js",
37
+ "test": "bun run dist && bun run dist-ext && bun test test/*.test.js",
38
38
  "test-watch": "bun test --watch test/*.test.js",
39
39
  "format": "bunx @biomejs/biome format --write",
40
40
  "lint": "bunx @biomejs/biome lint",
@@ -157,8 +157,10 @@ you want to test them as a pipeline: filter + loop-data + enrichment
157
157
  together produce a list of bindings the view sees. Use
158
158
  `collectIterBindings` for that — a functional implementation only ships
159
159
  in the dev build (`tutuca/dev`); the core `tutuca` build exports a no-op
160
- stub. `tutuca test` redirects the bare `tutuca` import to the dev build
161
- automatically, so test modules can import it as below:
160
+ stub that returns `[]`. Both commands that run `getTests()` in the
161
+ terminal `tutuca test` and `tutuca storybook` (including `--dry-run`)
162
+ redirect the bare `tutuca` import to the dev build automatically, as does
163
+ the browser storybook's import map. So test modules can import it as below:
162
164
 
163
165
  ```js
164
166
  import { collectIterBindings } from "tutuca";
@@ -180,6 +182,10 @@ const r = collectIterBindings(MyComp, c, c.items, {
180
182
  - The `compInstance` is `this` for every handler. Pass
181
183
  `MyComp.make({ field: ... })` so handlers that read `this.field` see
182
184
  the value you want.
185
+ - The redirect uses Node's `module.register`, which is how the `tutuca`
186
+ bin runs. Under a Bun-driven CLI it degrades to the no-op stub — if you
187
+ see `collectIterBindings` return `[]`, import it from `tutuca/dev`
188
+ explicitly.
183
189
 
184
190
  Example:
185
191
 
@@ -540,7 +540,6 @@ var PREDICATES = {
540
540
 
541
541
  class ValParser {
542
542
  constructor() {
543
- this.bindValIt = new BindVal("it");
544
543
  this.nullConstVal = new ConstVal(null);
545
544
  }
546
545
  const(v) {
@@ -2086,7 +2085,7 @@ function parseXOp(attrs, childs, opIdx, px) {
2086
2085
  node = px.addNodeIf(RenderNode, parseXOpVal(name, value, px, vp.parseComponent), as);
2087
2086
  break;
2088
2087
  case "render-it":
2089
- node = px.addNodeIf(RenderItNode, vp.bindValIt, as);
2088
+ node = px.addNode(RenderItNode, as);
2090
2089
  break;
2091
2090
  case "render-each":
2092
2091
  node = parseRenderEach(px, value, as, attrs);
@@ -2269,7 +2268,7 @@ function parseRenderEach(px, value, as, attrs) {
2269
2268
  const seqVal = parseXOpVal("render-each", value, px, vp.parseSequence);
2270
2269
  if (seqVal === null)
2271
2270
  return null;
2272
- const renderIt = px.addNodeIf(RenderItNode, vp.bindValIt, as);
2271
+ const renderIt = px.addNode(RenderItNode, as);
2273
2272
  const attrParser = getAttrParser(px);
2274
2273
  const eachAttr = attrParser.eachAttr = attrParser.pushWrapper("each", value, seqVal);
2275
2274
  const when = attrs.getNamedItem("@when") ?? attrs.getNamedItem("when");
@@ -2469,6 +2468,12 @@ class ParseContext {
2469
2468
  }
2470
2469
  return null;
2471
2470
  }
2471
+ addNode(Class, extra) {
2472
+ const nodeId = this.nodes.length;
2473
+ const node = new Class(nodeId, null, extra);
2474
+ this.nodes.push(node);
2475
+ return node;
2476
+ }
2472
2477
  registerEvents() {
2473
2478
  const id = this.events.length;
2474
2479
  const events = new NodeEvents(id);
@@ -2900,7 +2905,7 @@ class Stack {
2900
2905
  return new Stack(comps, it, binds, newDynBinds, views, viewsId, ctx);
2901
2906
  }
2902
2907
  static root(comps, it, ctx) {
2903
- const binds = [new BindFrame(it, { it }, true), null];
2908
+ const binds = [new BindFrame(it, {}, true), null];
2904
2909
  const dynBinds = [new ObjectFrame({}), null];
2905
2910
  const views = ["main", null];
2906
2911
  return new Stack(comps, it, binds, dynBinds, views, "", ctx)._pushProvides();