@barefootjs/jinja 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.
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/render-divergences.d.ts +16 -0
- package/dist/render-divergences.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/jinja-adapter.test.ts +8 -0
- package/src/conformance-pins.ts +11 -0
- package/src/index.ts +1 -0
- package/src/render-divergences.ts +42 -0
|
@@ -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,
|
|
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,eAmG7B,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@
|
|
|
6
6
|
export { JinjaAdapter, jinjaAdapter } from './adapter/index.ts';
|
|
7
7
|
export type { JinjaAdapterOptions } 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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,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,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -189109,9 +189109,27 @@ var conformancePins = {
|
|
|
189109
189109
|
"filter-nested-find-predicate": [
|
|
189110
189110
|
{ code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2038" }
|
|
189111
189111
|
],
|
|
189112
|
-
"array-map-function-reference": [{ code: "BF101", severity: "error" }]
|
|
189112
|
+
"array-map-function-reference": [{ code: "BF101", severity: "error" }],
|
|
189113
|
+
"dangerous-inner-html": [{ code: "BF101", severity: "error" }],
|
|
189114
|
+
"string-replaceall": [{ code: "BF101", severity: "error" }]
|
|
189115
|
+
};
|
|
189116
|
+
// src/render-divergences.ts
|
|
189117
|
+
var renderDivergences = {
|
|
189118
|
+
"arithmetic-text": "`(count() + 2) * 3` renders 10 instead of 18 — the parenthesised sub-expression loses its grouping (silent wrong arithmetic)",
|
|
189119
|
+
"html-entity-text": "`©` in JSX literal text: Hono decodes to `©`, this adapter re-emits the raw entity — same DOM, different bytes",
|
|
189120
|
+
"math-methods": "Math.min/max/abs over a signal render empty (only Math.floor is in the template-primitive registry)",
|
|
189121
|
+
"boolean-attr-literals": 'camelCase boolean alias `readOnly`: Hono SSRs `readOnly="true"`, this adapter emits bare presence',
|
|
189122
|
+
"camelcase-attributes": "`htmlFor` is not lowered to `for` (Hono maps it)",
|
|
189123
|
+
"static-attr-escape": 'static attribute values are not HTML-escaped (`title="Fish & Chips"` emitted raw; Hono escapes)',
|
|
189124
|
+
"svg-icon": "SVG camelCase presentation attrs (`strokeWidth`, `strokeLinecap`) pass through unmapped; Hono lowers to kebab-case",
|
|
189125
|
+
"object-entries-map": "`Object.entries(prop).map(([k, v]) => …)` renders an EMPTY list — the object-shaped prop silently produces zero iterations",
|
|
189126
|
+
"nested-loop-outer-binding": "nested-loop inner items carry `data-key` where the reference emits the depth-suffixed `data-key-1`",
|
|
189127
|
+
"jsx-element-prop": "a JSX element passed as a NON-children prop renders an empty slot — the element value is silently dropped",
|
|
189128
|
+
"string-slice": "`.slice()` on a STRING renders empty (array-slice helper misfires on strings)",
|
|
189129
|
+
"string-trim-sided": "`.trimStart()` / `.trimEnd()` render empty (no lowering)"
|
|
189113
189130
|
};
|
|
189114
189131
|
export {
|
|
189132
|
+
renderDivergences,
|
|
189115
189133
|
jinjaAdapter,
|
|
189116
189134
|
conformancePins,
|
|
189117
189135
|
JinjaAdapter
|
|
@@ -0,0 +1,16 @@
|
|
|
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 Python jinja2.
|
|
6
|
+
*
|
|
7
|
+
* Consumed by this package's conformance test (its `skipJsx` set is
|
|
8
|
+
* derived from these keys, so the skip list and this declaration can't
|
|
9
|
+
* drift) and by `packages/compat`, which publishes the entries in the
|
|
10
|
+
* fixture-divergences section of `ui/compat.lock.json` — surfaced on
|
|
11
|
+
* the docs compatibility-matrix page. Graduating an entry means fixing
|
|
12
|
+
* the adapter (or the shared compiler layer) and deleting the line.
|
|
13
|
+
*/
|
|
14
|
+
import type { RenderDivergences } from '@barefootjs/jsx';
|
|
15
|
+
export declare const renderDivergences: RenderDivergences;
|
|
16
|
+
//# 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;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,eAAO,MAAM,iBAAiB,EAAE,iBAyB/B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/jinja",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
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,14 +53,14 @@
|
|
|
53
53
|
"directory": "packages/adapter-jinja"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@barefootjs/shared": "0.18.
|
|
56
|
+
"@barefootjs/shared": "0.18.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@barefootjs/jsx": ">=0.2.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
63
|
-
"@barefootjs/jsx": "0.18.
|
|
63
|
+
"@barefootjs/jsx": "0.18.3",
|
|
64
64
|
"typescript": "^5.0.0"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -16,11 +16,19 @@ import { runAdapterConformanceTests } from '@barefootjs/adapter-tests'
|
|
|
16
16
|
import { JinjaAdapter } from '../adapter'
|
|
17
17
|
import { renderJinjaComponent, PythonNotAvailableError } from '../test-render'
|
|
18
18
|
import { conformancePins } from '../conformance-pins'
|
|
19
|
+
import { renderDivergences } from '../render-divergences'
|
|
19
20
|
|
|
20
21
|
runAdapterConformanceTests({
|
|
21
22
|
name: 'jinja',
|
|
22
23
|
factory: () => new JinjaAdapter(),
|
|
23
24
|
render: renderJinjaComponent,
|
|
25
|
+
// Priority-12 edge-case sweep (炙り出し, #2168): render-level
|
|
26
|
+
// divergences are declared in `../render-divergences` (exported from the
|
|
27
|
+
// package index and published to `ui/compat.lock.json` / the docs
|
|
28
|
+
// compatibility-matrix page by `packages/compat`). Deriving the skip
|
|
29
|
+
// list from that object keeps the public declaration and these test
|
|
30
|
+
// skips from drifting; each entry's rationale lives there.
|
|
31
|
+
skipJsx: Object.keys(renderDivergences),
|
|
24
32
|
// Per-fixture build-time contracts for shapes the Jinja adapter
|
|
25
33
|
// intentionally refuses to lower. Lives in `../conformance-pins` —
|
|
26
34
|
// mirrors xslate's set (the lowering gates are shared code paths in
|
package/src/conformance-pins.ts
CHANGED
|
@@ -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
|
@@ -0,0 +1,42 @@
|
|
|
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 Python jinja2.
|
|
6
|
+
*
|
|
7
|
+
* Consumed by this package's conformance test (its `skipJsx` set is
|
|
8
|
+
* derived from these keys, so the skip list and this declaration can't
|
|
9
|
+
* drift) and by `packages/compat`, which publishes the entries in the
|
|
10
|
+
* fixture-divergences section of `ui/compat.lock.json` — surfaced on
|
|
11
|
+
* the docs compatibility-matrix page. Graduating an entry means fixing
|
|
12
|
+
* the adapter (or the shared compiler layer) and deleting the line.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { RenderDivergences } from '@barefootjs/jsx'
|
|
16
|
+
|
|
17
|
+
export const renderDivergences: RenderDivergences = {
|
|
18
|
+
'arithmetic-text':
|
|
19
|
+
'`(count() + 2) * 3` renders 10 instead of 18 — the parenthesised sub-expression loses its grouping (silent wrong arithmetic)',
|
|
20
|
+
'html-entity-text':
|
|
21
|
+
'`©` in JSX literal text: Hono decodes to `©`, this adapter re-emits the raw entity — same DOM, different bytes',
|
|
22
|
+
'math-methods':
|
|
23
|
+
'Math.min/max/abs over a signal render empty (only Math.floor is in the template-primitive registry)',
|
|
24
|
+
'boolean-attr-literals':
|
|
25
|
+
'camelCase boolean alias `readOnly`: Hono SSRs `readOnly="true"`, this adapter emits bare presence',
|
|
26
|
+
'camelcase-attributes':
|
|
27
|
+
'`htmlFor` is not lowered to `for` (Hono maps it)',
|
|
28
|
+
'static-attr-escape':
|
|
29
|
+
'static attribute values are not HTML-escaped (`title="Fish & Chips"` emitted raw; Hono escapes)',
|
|
30
|
+
'svg-icon':
|
|
31
|
+
'SVG camelCase presentation attrs (`strokeWidth`, `strokeLinecap`) pass through unmapped; Hono lowers to kebab-case',
|
|
32
|
+
'object-entries-map':
|
|
33
|
+
'`Object.entries(prop).map(([k, v]) => …)` renders an EMPTY list — the object-shaped prop silently produces zero iterations',
|
|
34
|
+
'nested-loop-outer-binding':
|
|
35
|
+
'nested-loop inner items carry `data-key` where the reference emits the depth-suffixed `data-key-1`',
|
|
36
|
+
'jsx-element-prop':
|
|
37
|
+
'a JSX element passed as a NON-children prop renders an empty slot — the element value is silently dropped',
|
|
38
|
+
'string-slice':
|
|
39
|
+
'`.slice()` on a STRING renders empty (array-slice helper misfires on strings)',
|
|
40
|
+
'string-trim-sided':
|
|
41
|
+
'`.trimStart()` / `.trimEnd()` render empty (no lowering)',
|
|
42
|
+
}
|