@barefootjs/mojolicious 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
@@ -1930,7 +1930,11 @@ var conformancePins = {
1930
1930
  "rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }]
1931
1931
  };
1932
1932
  // src/render-divergences.ts
1933
- var renderDivergences = {};
1933
+ var renderDivergences = {
1934
+ "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 `undef`; 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)",
1935
+ "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 Mojo::Template loop iterates the undef-seeded `todos` directly and Perl's strict vars abort the render instead of producing HTML",
1936
+ "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)"
1937
+ };
1934
1938
  export {
1935
1939
  renderDivergences,
1936
1940
  mojoAdapter,
@@ -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"}
@@ -1,5 +1,5 @@
1
1
  package BarefootJS::Backend::Mojo;
2
- our $VERSION = "0.31.9";
2
+ our $VERSION = "0.31.10";
3
3
  use Mojo::Base -base, -signatures;
4
4
 
5
5
  use Mojo::ByteStream qw(b);
@@ -1,5 +1,5 @@
1
1
  package Mojolicious::Plugin::BarefootJS::DevReload;
2
- our $VERSION = "0.31.9";
2
+ our $VERSION = "0.31.10";
3
3
  use Mojo::Base 'Mojolicious::Plugin', -signatures;
4
4
 
5
5
  =head1 NAME
@@ -1,5 +1,5 @@
1
1
  package Mojolicious::Plugin::BarefootJS;
2
- our $VERSION = "0.31.9";
2
+ our $VERSION = "0.31.10";
3
3
  use Mojo::Base 'Mojolicious::Plugin', -signatures;
4
4
 
5
5
  use Mojo::File qw(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/mojolicious",
3
- "version": "0.31.10",
3
+ "version": "0.32.0",
4
4
  "description": "Mojolicious EP template adapter for BarefootJS - generates .html.ep files from IR",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,7 +52,7 @@
52
52
  "directory": "packages/adapter-mojolicious"
53
53
  },
54
54
  "dependencies": {
55
- "@barefootjs/shared": "0.31.10"
55
+ "@barefootjs/shared": "0.32.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@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
  "vite": "^6.0.0"
77
77
  }
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 `undef`; 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 Mojo::Template loop iterates the undef-seeded `todos` directly and Perl's strict vars abort the render instead of producing HTML",
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
  }
@@ -5,7 +5,7 @@
5
5
  * Used by adapter-tests conformance runner.
6
6
  */
7
7
 
8
- import { compileJSX, extractSsrDefaults, deriveStashFromDefaults, augmentInheritedPropAccesses, importsSearchParams, evaluateSignalInit } from '@barefootjs/jsx'
8
+ import { compileJSX, extractSsrDefaults, deriveStashFromDefaults, augmentInheritedPropAccesses, importsSearchParams } from '@barefootjs/jsx'
9
9
  import type { ComponentIR, SsrDefault } from '@barefootjs/jsx'
10
10
  import { mkdir, rm } from 'node:fs/promises'
11
11
  import { resolve } from 'node:path'
@@ -520,10 +520,7 @@ function buildChildDefaultsPerl(ir: ComponentIR): string {
520
520
  // MUST stay a hashref so `_derive_stash_from_defaults` resolves it
521
521
  // against the REAL child props at runtime; the declared-prop loop above
522
522
  // already emitted it for a DECLARED prop, so only an undeclared one
523
- // needs adding here. Either way, do NOT fall through to this harness's
524
- // own `evaluateSignalInit(..., undefined)` recompute below — that call
525
- // sees no props at all and would silently re-flatten the collision back
526
- // to a bare, non-caller-overridable value.
523
+ // needs adding here.
527
524
  const d = ssrDefaults[signal.getter]
528
525
  if (d?.propName !== undefined) {
529
526
  if (!declared.has(signal.getter)) {
@@ -532,8 +529,9 @@ function buildChildDefaultsPerl(ir: ComponentIR): string {
532
529
  }
533
530
  continue
534
531
  }
535
- const value = evaluateSignalInit(signal.initialValue.trim(), undefined)
536
- entries.push(`${signal.getter} => ${value !== null ? toPerlLiteral(value) : 'undef'}`)
532
+ // Static manifest value only — no harness-side evaluation (#2696).
533
+ const value = d ? d.value : undefined
534
+ entries.push(`${signal.getter} => ${value !== undefined && value !== null ? toPerlLiteral(value) : 'undef'}`)
537
535
  }
538
536
  for (const memo of ir.metadata.memos) {
539
537
  const entry = ssrDefaults[memo.name]
@@ -744,30 +742,20 @@ function buildPerlProps(
744
742
  // ternary) rather than skipping it — an unseeded getter faults strict
745
743
  // vars with `Global symbol "$x" requires explicit package name`. Same
746
744
  // rule `buildChildDefaultsPerl` applies to child signals (#1897).
745
+ // No initializer re-evaluation against raw props — production's
746
+ // before_render seeds only from `deriveStashFromDefaults` (#2696).
747
747
  for (const signal of ir.metadata.signals) {
748
748
  if (signal.envReader) continue // env signal bound below via search_params('') (#2057)
749
- // #2669: a self-derivation collision already got the correct RAW-prop
750
- // seed above via `derivedProps` — `extractSsrDefaults` marks that with
751
- // a `propName`-carrying entry (see its docstring's invariant). Skip
752
- // re-seeding here or this harness's own `evaluateSignalInit` recompute
753
- // clobbers the correctly-derived caller value.
754
- if (rootSsrDefaults[signal.getter]?.propName !== undefined) continue
755
- const value = evaluateSignalInit(signal.initialValue.trim(), props)
756
- entries.push(`${signal.getter} => ${value !== null ? toPerlLiteral(value) : 'undef'}`)
749
+ if (Object.prototype.hasOwnProperty.call(derivedProps, signal.getter)) {
750
+ entries.push(`${signal.getter} => ${toPerlLiteral(derivedProps[signal.getter])}`)
751
+ }
757
752
  }
758
753
 
759
- // Add memo values. The production Mojo plugin seeds these from the
760
- // manifest's `ssrDefaults` (see Plugin/BarefootJS.pm `before_render`
761
- // hook), which carries the statically-evaluated result of each memo
762
- // computation. Mirror that here so the test harness doesn't diverge
763
- // from the plugin: hard-coding `0` masked memos with non-zero
764
- // initial values until #1423 added a fixture that exposed the gap.
754
+ // No `?? 0` for entries the manifest lacks — production seeds nothing there (#2696).
765
755
  for (const memo of ir.metadata.memos) {
766
- // #2669: same self-derivation skip as the signal loop above.
767
- if (rootSsrDefaults[memo.name]?.propName !== undefined) continue
768
- const entry = rootSsrDefaults[memo.name]
769
- const value = entry ? entry.value : 0
770
- entries.push(`${memo.name} => ${toPerlLiteral(value ?? 0)}`)
756
+ if (Object.prototype.hasOwnProperty.call(derivedProps, memo.name)) {
757
+ entries.push(`${memo.name} => ${toPerlLiteral(derivedProps[memo.name])}`)
758
+ }
771
759
  }
772
760
 
773
761
  // (#1922) Request-scoped `searchParams()`: bind `$searchParams` to an