@barefootjs/erb 0.31.10 → 0.32.0

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/dist/index.js CHANGED
@@ -189273,7 +189273,11 @@ var conformancePins = {
189273
189273
  "rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }]
189274
189274
  };
189275
189275
  // src/render-divergences.ts
189276
- var renderDivergences = {};
189276
+ var renderDivergences = {
189277
+ "todo-app": "the `todos` signal seeds from `(props.initialTodos ?? []).map(t => ({ ...t, editing: false }))` — a different-prop-derived `.map()` chain `extractSsrDefaults` cannot statically resolve, and `computeSsrSeedPlan` classifies it opaque (no in-template recompute), so it seeds `nil`; the non-`/* @client */`-marked `{todos().length > 0 && ...}` toggle-all block SSRs as if there are zero todos regardless of `initialTodos` (https://github.com/piconic-ai/barefootjs/issues/2696)",
189278
+ "todo-app-ssr": "same root cause as `todo-app` (https://github.com/piconic-ai/barefootjs/issues/2696), but this fixture's todo-list loop carries no `/* @client */` marker — the compiled ERB loop iterates the nil-seeded `todos` directly and raises `NoMethodError: undefined method 'length' for nil` instead of rendering",
189279
+ "callback-param-shadows-prop": "the `first` signal seeds from `[{ a: 'p' }].map((title) => title.a).join(',')` — a constant expression `extractSsrDefaults` still cannot statically resolve (`.map()` is unsupported for any receiver) and, unlike the sibling `joined` memo's structurally similar chain, gets no in-template recompute (`computeSsrSeedPlan` classifies it opaque too); `<span>{first()}</span>` SSRs empty instead of `p` (https://github.com/piconic-ai/barefootjs/issues/2696)"
189280
+ };
189277
189281
  export {
189278
189282
  renderDivergences,
189279
189283
  erbAdapter,
@@ -1 +1 @@
1
- {"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,eAAO,MAAM,iBAAiB,EAAE,iBAC/B,CAAA"}
1
+ {"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,eAAO,MAAM,iBAAiB,EAAE,iBAO/B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/erb",
3
- "version": "0.31.10",
3
+ "version": "0.32.0",
4
4
  "description": "ERB (Embedded Ruby) adapter for BarefootJS — compiles IR to .erb templates and ships the Ruby rendering backend; runs under any Rack app (Sinatra, Rails)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "directory": "packages/adapter-erb"
55
55
  },
56
56
  "dependencies": {
57
- "@barefootjs/shared": "0.31.10"
57
+ "@barefootjs/shared": "0.32.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@barefootjs/jsx": ">=0.2.0",
@@ -71,9 +71,9 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@barefootjs/adapter-tests": "0.1.0",
74
- "@barefootjs/jsx": "0.31.10",
75
- "@barefootjs/vite": "0.31.10",
76
- "@barefootjs/client": "0.31.10",
74
+ "@barefootjs/jsx": "0.32.0",
75
+ "@barefootjs/vite": "0.32.0",
76
+ "@barefootjs/client": "0.32.0",
77
77
  "typescript": "^5.0.0",
78
78
  "vite": "^6.0.0"
79
79
  }
@@ -10,4 +10,10 @@
10
10
  import type { RenderDivergences } from '@barefootjs/jsx'
11
11
 
12
12
  export const renderDivergences: RenderDivergences = {
13
+ 'todo-app':
14
+ 'the `todos` signal seeds from `(props.initialTodos ?? []).map(t => ({ ...t, editing: false }))` — a different-prop-derived `.map()` chain `extractSsrDefaults` cannot statically resolve, and `computeSsrSeedPlan` classifies it opaque (no in-template recompute), so it seeds `nil`; the non-`/* @client */`-marked `{todos().length > 0 && ...}` toggle-all block SSRs as if there are zero todos regardless of `initialTodos` (https://github.com/piconic-ai/barefootjs/issues/2696)',
15
+ 'todo-app-ssr':
16
+ 'same root cause as `todo-app` (https://github.com/piconic-ai/barefootjs/issues/2696), but this fixture\'s todo-list loop carries no `/* @client */` marker — the compiled ERB loop iterates the nil-seeded `todos` directly and raises `NoMethodError: undefined method \'length\' for nil` instead of rendering',
17
+ 'callback-param-shadows-prop':
18
+ "the `first` signal seeds from `[{ a: 'p' }].map((title) => title.a).join(',')` — a constant expression `extractSsrDefaults` still cannot statically resolve (`.map()` is unsupported for any receiver) and, unlike the sibling `joined` memo's structurally similar chain, gets no in-template recompute (`computeSsrSeedPlan` classifies it opaque too); `<span>{first()}</span>` SSRs empty instead of `p` (https://github.com/piconic-ai/barefootjs/issues/2696)",
13
19
  }
@@ -36,7 +36,7 @@
36
36
  * regression test.
37
37
  */
38
38
 
39
- import { compileJSX, extractSsrDefaults, deriveStashFromDefaults, importsSearchParams, evaluateSignalInit } from '@barefootjs/jsx'
39
+ import { compileJSX, extractSsrDefaults, deriveStashFromDefaults, importsSearchParams } from '@barefootjs/jsx'
40
40
  import type { ComponentIR, SsrDefault } from '@barefootjs/jsx'
41
41
  import { mkdir, rm } from 'node:fs/promises'
42
42
  import { resolve } from 'node:path'
@@ -600,37 +600,22 @@ function buildRubyProps(
600
600
  }
601
601
  }
602
602
 
603
- // Signal values evaluated from props (after user props).
603
+ // No initializer re-evaluation against raw props production's
604
+ // before_render seeds only from `deriveStashFromDefaults` (#2696).
604
605
  for (const signal of ir.metadata.signals) {
605
606
  // Env signals (#2057 / #1922) are bound below via `search_params('')`,
606
607
  // not from a static initial value.
607
608
  if (signal.envReader) continue
608
- // #2669: a self-derivation collision (the signal's own initializer
609
- // derives from a same-named prop, e.g. `createSignal(props.label ??
610
- // 'Default')`) already got the correct RAW-prop seed above via
611
- // `derivedProps` / `obj[param.name]` — `extractSsrDefaults` marks that
612
- // with a `propName`-carrying entry (see its docstring's invariant).
613
- // Re-seeding here with this harness's OWN recompute
614
- // (`evaluateSignalInit`) would clobber the correctly-derived caller
615
- // value with the harness's evaluated-from-static-props number, papering
616
- // over the exact production bug this fixture exists to catch.
617
- if (rootSsrDefaults[signal.getter]?.propName !== undefined) continue
618
- const value = evaluateSignalInit(signal.initialValue.trim(), props)
619
- if (value !== null) {
620
- obj[signal.getter] = value
609
+ if (Object.prototype.hasOwnProperty.call(derivedProps, signal.getter)) {
610
+ obj[signal.getter] = derivedProps[signal.getter]
621
611
  }
622
612
  }
623
613
 
624
- // Memo values seeded from the statically-evaluated ssrDefaults, same
625
- // as the production plugin's before_render hook.
614
+ // No `?? 0` for entries the manifest lacks — production seeds nothing there (#2696).
626
615
  for (const memo of ir.metadata.memos) {
627
- // #2669: same self-derivation skip as the signal loop above — a
628
- // `propName`-carrying memo entry already stands as the correctly
629
- // prop-derived seed; don't clobber it with the memo's OWN evaluated
630
- // value (which for a non-idempotent derivation is already the WRONG,
631
- // double-applied number).
632
- if (rootSsrDefaults[memo.name]?.propName !== undefined) continue
633
- obj[memo.name] = rootSsrDefaults[memo.name]?.value ?? 0
616
+ if (Object.prototype.hasOwnProperty.call(derivedProps, memo.name)) {
617
+ obj[memo.name] = derivedProps[memo.name]
618
+ }
634
619
  }
635
620
 
636
621
  const needsSearchParams = importsSearchParams(ir.metadata)