@barefootjs/go-template 0.18.1 → 0.18.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eA0H7B,CAAA"}
1
+ {"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAqI7B,CAAA"}
package/dist/index.d.ts CHANGED
@@ -6,4 +6,5 @@
6
6
  export { GoTemplateAdapter, goTemplateAdapter } from './adapter/index.ts';
7
7
  export type { GoTemplateAdapterOptions } from './adapter/index.ts';
8
8
  export { conformancePins } from './conformance-pins.ts';
9
+ export { renderDivergences } from './render-divergences.ts';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACzE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACzE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
package/dist/index.js CHANGED
@@ -5436,9 +5436,33 @@ var conformancePins = {
5436
5436
  "filter-nested-find-predicate": [
5437
5437
  { code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2038" }
5438
5438
  ],
5439
- "array-map-function-reference": [{ code: "BF101", severity: "error" }]
5439
+ "array-map-function-reference": [{ code: "BF101", severity: "error" }],
5440
+ "dangerous-inner-html": [{ code: "BF101", severity: "error" }],
5441
+ "string-replaceall": [{ code: "BF101", severity: "error" }]
5442
+ };
5443
+ // src/render-divergences.ts
5444
+ var renderDivergences = {
5445
+ "html-entity-text": "`©` in JSX literal text: Hono decodes to `©`, this adapter re-emits the raw entity — same DOM, different bytes",
5446
+ "string-concat-plus": "`'Hello, ' + name` renders \"0\" — JS string-concat `+` lowered through numeric addition",
5447
+ "optional-chaining-prop": "`user?.name ?? …` on an object prop: generated Go fails to run (exit 1) — optional chaining into a struct/map prop has no lowering",
5448
+ "number-tofixed": "`.toFixed(2)` on a number PROP: generated Go fails to run (exit 1)",
5449
+ "math-methods": "Math.min/max/abs over a signal: generated Go fails to run (exit 1) — only Math.floor is registered",
5450
+ "boolean-attr-literals": 'camelCase boolean alias `readOnly`: Hono SSRs `readOnly="true"`, this adapter emits bare presence',
5451
+ "camelcase-attributes": "`htmlFor` is not lowered to `for` (Hono maps it)",
5452
+ "static-attr-escape": 'static attribute values are not HTML-escaped (`title="Fish & Chips"` emitted raw; Hono escapes)',
5453
+ "svg-icon": "SVG camelCase presentation attrs (`strokeWidth`, `strokeLinecap`) pass through unmapped; Hono lowers to kebab-case",
5454
+ "object-entries-map": "`Object.entries(prop).map(([k, v]) => …)`: generated Go fails to run (exit 1) — no object-iteration loop lowering",
5455
+ "nested-loop-outer-binding": "nested-loop inner items carry `data-key` where the reference emits the depth-suffixed `data-key-1`",
5456
+ "jsx-element-prop": "a JSX element passed as a NON-children prop renders an empty slot — the element value is silently dropped",
5457
+ "grandchild-composition": "three-level composition: the grandchild's threaded prop renders EMPTY — prop forwarding through two template-render layers loses the value",
5458
+ "child-primitive-props": "numeric/boolean LITERAL props on a child (`count={5}` `active={true}`) render as Go zero values (0 / false)",
5459
+ "memo-chain": "a memo derived from another memo renders EMPTY for the second layer — the constructor folds only one derivation level",
5460
+ "signal-object-field": "object-valued signal (`user().name`): generated Go fails to run (exit 1) — no struct synthesis outside loops",
5461
+ "string-slice": '`.slice()` on a STRING routes through the array `bf_slice` helper and renders "[]" instead of the substring',
5462
+ "string-trim-sided": "`.trimStart()` / `.trimEnd()`: generated Go fails to run (exit 1) — only both-sides `bf_trim` exists"
5440
5463
  };
5441
5464
  export {
5465
+ renderDivergences,
5442
5466
  goTemplateAdapter,
5443
5467
  conformancePins,
5444
5468
  GoTemplateAdapter
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Render-level divergences against the shared conformance corpus
3
+ * (Priority-12 edge-case sweep, #2168): fixtures that COMPILE clean on
4
+ * this adapter but whose rendered output diverges from the Hono
5
+ * reference on real Go — or whose generated Go fails `go run` outright
6
+ * (marked "exit 1" below; those should eventually become loud BF101
7
+ * refusals instead of broken codegen).
8
+ *
9
+ * Consumed by this package's conformance test (its `skipJsx` set is
10
+ * derived from these keys, so the skip list and this declaration can't
11
+ * drift) and by `packages/compat`, which publishes the entries in the
12
+ * fixture-divergences section of `ui/compat.lock.json` — surfaced on
13
+ * the docs compatibility-matrix page. Graduating an entry means fixing
14
+ * the adapter (or the shared compiler layer) and deleting the line.
15
+ */
16
+ import type { RenderDivergences } from '@barefootjs/jsx';
17
+ export declare const renderDivergences: RenderDivergences;
18
+ //# sourceMappingURL=render-divergences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,eAAO,MAAM,iBAAiB,EAAE,iBAqC/B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/go-template",
3
- "version": "0.18.1",
3
+ "version": "0.18.3",
4
4
  "description": "Go html/template adapter for BarefootJS - generates Go template files from IR",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "directory": "packages/adapter-go-template"
50
50
  },
51
51
  "dependencies": {
52
- "@barefootjs/shared": "0.18.1"
52
+ "@barefootjs/shared": "0.18.3"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@barefootjs/jsx": ">=0.2.0",
@@ -57,6 +57,6 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@barefootjs/adapter-tests": "0.1.0",
60
- "@barefootjs/jsx": "0.18.1"
60
+ "@barefootjs/jsx": "0.18.3"
61
61
  }
62
62
  }
@@ -17,11 +17,19 @@ import {
17
17
  type IRExpression,
18
18
  } from '@barefootjs/jsx'
19
19
  import { conformancePins } from '../conformance-pins'
20
+ import { renderDivergences } from '../render-divergences'
20
21
 
21
22
  runAdapterConformanceTests({
22
23
  name: 'go-template',
23
24
  factory: () => new GoTemplateAdapter(),
24
25
  render: renderGoTemplateComponent,
26
+ // Priority-12 edge-case sweep (炙り出し, #2168): render-level
27
+ // divergences are declared in `../render-divergences` (exported from the
28
+ // package index and published to `ui/compat.lock.json` / the docs
29
+ // compatibility-matrix page by `packages/compat`). Deriving the skip
30
+ // list from that object keeps the public declaration and these test
31
+ // skips from drifting; each entry's rationale lives there.
32
+ skipJsx: Object.keys(renderDivergences),
25
33
  // `branch-self-closing` no longer needs a skip — the conditional-
26
34
  // marker divergence (Hono `bf-c="sN"` attribute vs Go
27
35
  // `<!--bf-cond-start:sN-->` / `<!--bf-cond-end:sN-->` comment pairs)
@@ -132,4 +132,15 @@ export const conformancePins: ConformancePins = {
132
132
  // UNSUPPORTED_METHODS gate refuses it with BF101 rather than emitting
133
133
  // a broken template.
134
134
  'array-map-function-reference': [{ code: 'BF101', severity: 'error' }],
135
+ // Edge-case sweep (Priority 12): `dangerouslySetInnerHTML` requires a
136
+ // deliberate raw-HTML (unescaped) output affordance in the target
137
+ // template language. No lowering exists yet, so the compiler refuses
138
+ // the shape loudly instead of emitting entity-escaped markup that
139
+ // silently renders tags as text.
140
+ 'dangerous-inner-html': [{ code: 'BF101', severity: 'error' }],
141
+ // Edge-case sweep (Priority 12): `.replaceAll` has no lowering yet —
142
+ // only first-occurrence `.replace` is wired to the runtime helpers.
143
+ // Refused with BF101 rather than reusing the first-only lowering,
144
+ // which would silently change semantics.
145
+ 'string-replaceall': [{ code: 'BF101', severity: 'error' }],
135
146
  }
package/src/index.ts CHANGED
@@ -7,3 +7,4 @@
7
7
  export { GoTemplateAdapter, goTemplateAdapter } from './adapter/index.ts'
8
8
  export type { GoTemplateAdapterOptions } from './adapter/index.ts'
9
9
  export { conformancePins } from './conformance-pins.ts'
10
+ export { renderDivergences } from './render-divergences.ts'
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Render-level divergences against the shared conformance corpus
3
+ * (Priority-12 edge-case sweep, #2168): fixtures that COMPILE clean on
4
+ * this adapter but whose rendered output diverges from the Hono
5
+ * reference on real Go — or whose generated Go fails `go run` outright
6
+ * (marked "exit 1" below; those should eventually become loud BF101
7
+ * refusals instead of broken codegen).
8
+ *
9
+ * Consumed by this package's conformance test (its `skipJsx` set is
10
+ * derived from these keys, so the skip list and this declaration can't
11
+ * drift) and by `packages/compat`, which publishes the entries in the
12
+ * fixture-divergences section of `ui/compat.lock.json` — surfaced on
13
+ * the docs compatibility-matrix page. Graduating an entry means fixing
14
+ * the adapter (or the shared compiler layer) and deleting the line.
15
+ */
16
+
17
+ import type { RenderDivergences } from '@barefootjs/jsx'
18
+
19
+ export const renderDivergences: RenderDivergences = {
20
+ 'html-entity-text':
21
+ '`&copy;` in JSX literal text: Hono decodes to `©`, this adapter re-emits the raw entity — same DOM, different bytes',
22
+ 'string-concat-plus':
23
+ "`'Hello, ' + name` renders \"0\" — JS string-concat `+` lowered through numeric addition",
24
+ 'optional-chaining-prop':
25
+ '`user?.name ?? …` on an object prop: generated Go fails to run (exit 1) — optional chaining into a struct/map prop has no lowering',
26
+ 'number-tofixed':
27
+ '`.toFixed(2)` on a number PROP: generated Go fails to run (exit 1)',
28
+ 'math-methods':
29
+ 'Math.min/max/abs over a signal: generated Go fails to run (exit 1) — only Math.floor is registered',
30
+ 'boolean-attr-literals':
31
+ 'camelCase boolean alias `readOnly`: Hono SSRs `readOnly="true"`, this adapter emits bare presence',
32
+ 'camelcase-attributes':
33
+ '`htmlFor` is not lowered to `for` (Hono maps it)',
34
+ 'static-attr-escape':
35
+ 'static attribute values are not HTML-escaped (`title="Fish & Chips"` emitted raw; Hono escapes)',
36
+ 'svg-icon':
37
+ 'SVG camelCase presentation attrs (`strokeWidth`, `strokeLinecap`) pass through unmapped; Hono lowers to kebab-case',
38
+ 'object-entries-map':
39
+ '`Object.entries(prop).map(([k, v]) => …)`: generated Go fails to run (exit 1) — no object-iteration loop lowering',
40
+ 'nested-loop-outer-binding':
41
+ 'nested-loop inner items carry `data-key` where the reference emits the depth-suffixed `data-key-1`',
42
+ 'jsx-element-prop':
43
+ 'a JSX element passed as a NON-children prop renders an empty slot — the element value is silently dropped',
44
+ 'grandchild-composition':
45
+ "three-level composition: the grandchild's threaded prop renders EMPTY — prop forwarding through two template-render layers loses the value",
46
+ 'child-primitive-props':
47
+ 'numeric/boolean LITERAL props on a child (`count={5}` `active={true}`) render as Go zero values (0 / false)',
48
+ 'memo-chain':
49
+ 'a memo derived from another memo renders EMPTY for the second layer — the constructor folds only one derivation level',
50
+ 'signal-object-field':
51
+ 'object-valued signal (`user().name`): generated Go fails to run (exit 1) — no struct synthesis outside loops',
52
+ 'string-slice':
53
+ '`.slice()` on a STRING routes through the array `bf_slice` helper and renders "[]" instead of the substring',
54
+ 'string-trim-sided':
55
+ '`.trimStart()` / `.trimEnd()`: generated Go fails to run (exit 1) — only both-sides `bf_trim` exists',
56
+ }