@barefootjs/rust 0.18.0 → 0.18.2

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;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAuF7B,CAAA"}
1
+ {"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAkG7B,CAAA"}
package/dist/index.d.ts CHANGED
@@ -9,4 +9,5 @@
9
9
  export { MinijinjaAdapter, minijinjaAdapter } from './adapter/index.ts';
10
10
  export type { MinijinjaAdapterOptions } from './adapter/index.ts';
11
11
  export { conformancePins } from './conformance-pins.ts';
12
+ export { renderDivergences } from './render-divergences.ts';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACvE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACvE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
package/dist/index.js CHANGED
@@ -189103,9 +189103,28 @@ var conformancePins = {
189103
189103
  "filter-nested-find-predicate": [
189104
189104
  { code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2038" }
189105
189105
  ],
189106
- "array-map-function-reference": [{ code: "BF101", severity: "error" }]
189106
+ "array-map-function-reference": [{ code: "BF101", severity: "error" }],
189107
+ "dangerous-inner-html": [{ code: "BF101", severity: "error" }],
189108
+ "string-replaceall": [{ code: "BF101", severity: "error" }]
189109
+ };
189110
+ // src/render-divergences.ts
189111
+ var renderDivergences = {
189112
+ "arithmetic-text": "`(count() + 2) * 3` renders 10 instead of 18 — the parenthesised sub-expression loses its grouping (silent wrong arithmetic)",
189113
+ "falsy-text-values": '`{false}` renders "false" (Hono drops it); `{null}`/`{undefined}` render empty (Hono renders "null") — neither side matches JSX semantics',
189114
+ "html-entity-text": "`©` in JSX literal text: Hono decodes to `©`, this adapter re-emits the raw entity — same DOM, different bytes",
189115
+ "math-methods": "Math.min/max/abs over a signal render empty (only Math.floor is in the template-primitive registry)",
189116
+ "boolean-attr-literals": 'camelCase boolean alias `readOnly`: Hono SSRs `readOnly="true"`, this adapter emits bare presence',
189117
+ "camelcase-attributes": "`htmlFor` is not lowered to `for` (Hono maps it)",
189118
+ "static-attr-escape": 'static attribute values are not HTML-escaped (`title="Fish & Chips"` emitted raw; Hono escapes)',
189119
+ "svg-icon": "SVG camelCase presentation attrs (`strokeWidth`, `strokeLinecap`) pass through unmapped; Hono lowers to kebab-case",
189120
+ "object-entries-map": "`Object.entries(prop).map(([k, v]) => …)` renders an EMPTY list — the object-shaped prop silently produces zero iterations",
189121
+ "nested-loop-outer-binding": "nested-loop inner items carry `data-key` where the reference emits the depth-suffixed `data-key-1`",
189122
+ "jsx-element-prop": "a JSX element passed as a NON-children prop renders an empty slot — the element value is silently dropped",
189123
+ "string-slice": "`.slice()` on a STRING renders empty (array-slice helper misfires on strings)",
189124
+ "string-trim-sided": "`.trimStart()` / `.trimEnd()` render empty (no lowering)"
189107
189125
  };
189108
189126
  export {
189127
+ renderDivergences,
189109
189128
  minijinjaAdapter,
189110
189129
  conformancePins,
189111
189130
  MinijinjaAdapter
@@ -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 through the real `bf-render` minijinja binary.
6
+ * (`string-concat-plus` is NOT here — minijinja's `+` concatenates
7
+ * strings, unlike Perl/PHP/Twig.)
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,iBA2B/B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/rust",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "minijinja (Rust) adapter for BarefootJS — compiles IR to .j2 templates and ships a Rust rendering runtime (packages/adapter-rust/runtime/); runs under any Rust web framework (axum, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,14 +54,14 @@
54
54
  "directory": "packages/adapter-rust"
55
55
  },
56
56
  "dependencies": {
57
- "@barefootjs/shared": "0.18.0"
57
+ "@barefootjs/shared": "0.18.2"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@barefootjs/jsx": ">=0.2.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@barefootjs/adapter-tests": "0.1.0",
64
- "@barefootjs/jsx": "0.18.0",
64
+ "@barefootjs/jsx": "0.18.2",
65
65
  "typescript": "^5.0.0"
66
66
  }
67
67
  }
@@ -1,9 +1,14 @@
1
1
  [package]
2
2
  name = "barefootjs"
3
+ # Placeholder — the crates-release job stamps the @barefootjs/rust version
4
+ # resolved by changesets over this value before `cargo publish`.
3
5
  version = "0.1.0"
4
6
  edition = "2021"
5
7
  description = "Rust runtime for BarefootJS marked templates (minijinja adapter)."
6
8
  license = "MIT"
9
+ readme = "README.md"
10
+ homepage = "https://barefootjs.dev"
11
+ repository = "https://github.com/piconic-ai/barefootjs"
7
12
 
8
13
  [lib]
9
14
  name = "barefootjs"
@@ -0,0 +1,34 @@
1
+ # barefootjs
2
+
3
+ Rust runtime for [BarefootJS](https://barefootjs.dev/) marked templates, targeting [minijinja](https://crates.io/crates/minijinja).
4
+
5
+ [BarefootJS](https://github.com/piconic-ai/barefootjs) is a fine-grained reactive TSX compiler: you write components in TSX, and the compiler emits templates for your backend's template engine plus the client-side JS that hydrates them. This crate is the server half for Rust — it renders the templates produced by the `@barefootjs/rust` adapter.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ cargo add barefootjs
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Build a minijinja environment over the compiled template directory with `backend_minijinja::build_environment`, create a root `BfInstance` for the render (`BfInstance::root`), then render a named component template with `backend_minijinja::render_named`. `load_manifest` / `register_components_from_manifest` wire up the component manifest emitted by the compiler, and a `bf-render` binary is included for rendering from the command line.
16
+
17
+ Key modules:
18
+
19
+ | Module | Role |
20
+ |--------|------|
21
+ | `runtime` | the engine-agnostic `bf` object (`BfInstance`, `RenderSession`) |
22
+ | `backend_minijinja` | the minijinja engine backend |
23
+ | `evaluator` | ParsedExpr evaluator for the `*_eval` helpers |
24
+ | `manifest` | component manifest loading and registration |
25
+ | `search_params` | `searchParams()` SSR reader |
26
+
27
+ ## Documentation
28
+
29
+ - [barefootjs.dev](https://barefootjs.dev/) — core documentation
30
+ - [GitHub: piconic-ai/barefootjs](https://github.com/piconic-ai/barefootjs) — monorepo (this crate lives at `packages/adapter-rust/runtime`)
31
+
32
+ ## License
33
+
34
+ MIT
@@ -20,11 +20,19 @@ import { runAdapterConformanceTests } from '@barefootjs/adapter-tests'
20
20
  import { MinijinjaAdapter } from '../adapter'
21
21
  import { renderMinijinjaComponent, RustNotAvailableError } from '../test-render'
22
22
  import { conformancePins } from '../conformance-pins'
23
+ import { renderDivergences } from '../render-divergences'
23
24
 
24
25
  runAdapterConformanceTests({
25
26
  name: 'minijinja',
26
27
  factory: () => new MinijinjaAdapter(),
27
28
  render: renderMinijinjaComponent,
29
+ // Priority-12 edge-case sweep (炙り出し, #2168): render-level
30
+ // divergences are declared in `../render-divergences` (exported from the
31
+ // package index and published to `ui/compat.lock.json` / the docs
32
+ // compatibility-matrix page by `packages/compat`). Deriving the skip
33
+ // list from that object keeps the public declaration and these test
34
+ // skips from drifting; each entry's rationale lives there.
35
+ skipJsx: Object.keys(renderDivergences),
28
36
  // Per-fixture build-time contracts for shapes the adapter intentionally
29
37
  // refuses to lower. Lives in `../conformance-pins` — mirrors
30
38
  // adapter-jinja's set (itself mirroring xslate's); the lowering gates
@@ -98,4 +98,15 @@ export const conformancePins: ConformancePins = {
98
98
  // "Expression not supported" BF101 rather than emitting a broken
99
99
  // template.
100
100
  'array-map-function-reference': [{ code: 'BF101', severity: 'error' }],
101
+ // Edge-case sweep (Priority 12): `dangerouslySetInnerHTML` requires a
102
+ // deliberate raw-HTML (unescaped) output affordance in the target
103
+ // template language. No lowering exists yet, so the compiler refuses
104
+ // the shape loudly instead of emitting entity-escaped markup that
105
+ // silently renders tags as text.
106
+ 'dangerous-inner-html': [{ code: 'BF101', severity: 'error' }],
107
+ // Edge-case sweep (Priority 12): `.replaceAll` has no lowering yet —
108
+ // only first-occurrence `.replace` is wired to the runtime helpers.
109
+ // Refused with BF101 rather than reusing the first-only lowering,
110
+ // which would silently change semantics.
111
+ 'string-replaceall': [{ code: 'BF101', severity: 'error' }],
101
112
  }
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@
10
10
  export { MinijinjaAdapter, minijinjaAdapter } from './adapter/index.ts'
11
11
  export type { MinijinjaAdapterOptions } from './adapter/index.ts'
12
12
  export { conformancePins } from './conformance-pins.ts'
13
+ export { renderDivergences } from './render-divergences.ts'
@@ -0,0 +1,46 @@
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 through the real `bf-render` minijinja binary.
6
+ * (`string-concat-plus` is NOT here — minijinja's `+` concatenates
7
+ * strings, unlike Perl/PHP/Twig.)
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
+ 'arithmetic-text':
21
+ '`(count() + 2) * 3` renders 10 instead of 18 — the parenthesised sub-expression loses its grouping (silent wrong arithmetic)',
22
+ 'falsy-text-values':
23
+ '`{false}` renders "false" (Hono drops it); `{null}`/`{undefined}` render empty (Hono renders "null") — neither side matches JSX semantics',
24
+ 'html-entity-text':
25
+ '`©` in JSX literal text: Hono decodes to `©`, this adapter re-emits the raw entity — same DOM, different bytes',
26
+ 'math-methods':
27
+ 'Math.min/max/abs over a signal render empty (only Math.floor is in the template-primitive registry)',
28
+ 'boolean-attr-literals':
29
+ 'camelCase boolean alias `readOnly`: Hono SSRs `readOnly="true"`, this adapter emits bare presence',
30
+ 'camelcase-attributes':
31
+ '`htmlFor` is not lowered to `for` (Hono maps it)',
32
+ 'static-attr-escape':
33
+ 'static attribute values are not HTML-escaped (`title="Fish & Chips"` emitted raw; Hono escapes)',
34
+ 'svg-icon':
35
+ 'SVG camelCase presentation attrs (`strokeWidth`, `strokeLinecap`) pass through unmapped; Hono lowers to kebab-case',
36
+ 'object-entries-map':
37
+ '`Object.entries(prop).map(([k, v]) => …)` renders an EMPTY list — the object-shaped prop silently produces zero iterations',
38
+ 'nested-loop-outer-binding':
39
+ 'nested-loop inner items carry `data-key` where the reference emits the depth-suffixed `data-key-1`',
40
+ 'jsx-element-prop':
41
+ 'a JSX element passed as a NON-children prop renders an empty slot — the element value is silently dropped',
42
+ 'string-slice':
43
+ '`.slice()` on a STRING renders empty (array-slice helper misfires on strings)',
44
+ 'string-trim-sided':
45
+ '`.trimStart()` / `.trimEnd()` render empty (no lowering)',
46
+ }