@barefootjs/jinja 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
@@ -189254,7 +189254,11 @@ var conformancePins = {
189254
189254
  "rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }]
189255
189255
  };
189256
189256
  // src/render-divergences.ts
189257
- var renderDivergences = {};
189257
+ var renderDivergences = {
189258
+ "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 `None`; 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)",
189259
+ "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 `{% for todo in todos %}` iterates the null-seeded `todos` directly and Jinja2 raises `TypeError: 'NoneType' object is not iterable` instead of rendering",
189260
+ "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)"
189261
+ };
189258
189262
  export {
189259
189263
  renderDivergences,
189260
189264
  jinjaAdapter,
@@ -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/jinja",
3
- "version": "0.31.10",
3
+ "version": "0.32.0",
4
4
  "description": "Jinja2 adapter for BarefootJS — compiles IR to .jinja templates and ships the Python BarefootJS rendering runtime; runs under any Python web framework (Flask, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,7 +53,7 @@
53
53
  "directory": "packages/adapter-jinja"
54
54
  },
55
55
  "dependencies": {
56
- "@barefootjs/shared": "0.31.10"
56
+ "@barefootjs/shared": "0.32.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@barefootjs/jsx": ">=0.2.0",
@@ -70,9 +70,9 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@barefootjs/adapter-tests": "0.1.0",
73
- "@barefootjs/jsx": "0.31.10",
74
- "@barefootjs/vite": "0.31.10",
75
- "@barefootjs/client": "0.31.10",
73
+ "@barefootjs/jsx": "0.32.0",
74
+ "@barefootjs/vite": "0.32.0",
75
+ "@barefootjs/client": "0.32.0",
76
76
  "typescript": "^5.0.0",
77
77
  "vite": "^6.0.0"
78
78
  }
@@ -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 `None`; 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 `{% for todo in todos %}` iterates the null-seeded `todos` directly and Jinja2 raises `TypeError: \'NoneType\' object is not iterable` 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
  }
@@ -16,7 +16,7 @@
16
16
  * generated render script (Python, not Perl) and its literal syntax differ.
17
17
  */
18
18
 
19
- import { compileJSX, extractSsrDefaults, deriveStashFromDefaults, importsSearchParams, evaluateSignalInit } from '@barefootjs/jsx'
19
+ import { compileJSX, extractSsrDefaults, deriveStashFromDefaults, importsSearchParams } from '@barefootjs/jsx'
20
20
  import type { ComponentIR, SsrDefault } from '@barefootjs/jsx'
21
21
  import { mkdir, rm } from 'node:fs/promises'
22
22
  import { resolve } from 'node:path'
@@ -595,31 +595,22 @@ function buildPythonProps(
595
595
  const explicitScope = typeof props?.__instanceId === 'string' ? props.__instanceId : 'test'
596
596
  const fullEntries = [...entries, `${pyStr('scope_id')}: ${pyStr(explicitScope)}`]
597
597
 
598
- // Signal values evaluated from props (after user props).
598
+ // No initializer re-evaluation against raw props production's
599
+ // before_render seeds only from `deriveStashFromDefaults` (#2696).
599
600
  for (const signal of ir.metadata.signals) {
600
601
  // Env signals (#2057) are bound below via `SearchParams('')`, not from a
601
602
  // static initial value.
602
603
  if (signal.envReader) continue
603
- // #2669: a self-derivation collision already got the correct RAW-prop
604
- // seed above via `derivedProps` — `extractSsrDefaults` marks that with
605
- // a `propName`-carrying entry (see its docstring's invariant). Skip
606
- // re-seeding here or this harness's own `evaluateSignalInit` recompute
607
- // clobbers the correctly-derived caller value.
608
- if (rootSsrDefaults[signal.getter]?.propName !== undefined) continue
609
- const value = evaluateSignalInit(signal.initialValue.trim(), props)
610
- if (value !== null) {
611
- fullEntries.push(`${pyStr(signal.getter)}: ${toPyLiteral(value)}`)
604
+ if (Object.prototype.hasOwnProperty.call(derivedProps, signal.getter)) {
605
+ fullEntries.push(`${pyStr(signal.getter)}: ${toPyLiteral(derivedProps[signal.getter])}`)
612
606
  }
613
607
  }
614
608
 
615
- // Memo values seeded from the statically-evaluated ssrDefaults, same
616
- // as the production plugin's before_render hook.
609
+ // No `?? 0` for entries the manifest lacks — production seeds nothing there (#2696).
617
610
  for (const memo of ir.metadata.memos) {
618
- // #2669: same self-derivation skip as the signal loop above.
619
- if (rootSsrDefaults[memo.name]?.propName !== undefined) continue
620
- const entry = rootSsrDefaults[memo.name]
621
- const value = entry ? entry.value : 0
622
- fullEntries.push(`${pyStr(memo.name)}: ${toPyLiteral(value ?? 0)}`)
611
+ if (Object.prototype.hasOwnProperty.call(derivedProps, memo.name)) {
612
+ fullEntries.push(`${pyStr(memo.name)}: ${toPyLiteral(derivedProps[memo.name])}`)
613
+ }
623
614
  }
624
615
 
625
616
  // (#1922) Request-scoped `searchParams()`: bind `searchParams` to an