@barefootjs/jinja 0.18.7 → 0.19.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/adapter/index.js +1 -1
- package/dist/adapter/props/prop-classes.d.ts +3 -2
- package/dist/adapter/props/prop-classes.d.ts.map +1 -1
- package/dist/build.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/__tests__/jinja-adapter.test.ts +13 -0
- package/src/adapter/props/prop-classes.ts +4 -3
package/dist/adapter/index.js
CHANGED
|
@@ -188283,7 +188283,7 @@ function collectBooleanTypedProps(ir) {
|
|
|
188283
188283
|
return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
|
|
188284
188284
|
}
|
|
188285
188285
|
function collectNullableOptionalProps(ir) {
|
|
188286
|
-
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
|
|
188286
|
+
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
|
|
188287
188287
|
}
|
|
188288
188288
|
function collectStringValueNames(ir) {
|
|
188289
188289
|
const names = new Set;
|
|
@@ -14,8 +14,9 @@ import type { ComponentIR } from '@barefootjs/jsx';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function collectBooleanTypedProps(ir: ComponentIR): Set<string>;
|
|
16
16
|
/**
|
|
17
|
-
* Bare references to
|
|
18
|
-
* textarea's `rows`) are
|
|
17
|
+
* Bare references to presence-uncertain no-default props (non-primitive
|
|
18
|
+
* typed OR declared optional, #2259 — e.g. textarea's `rows`) are
|
|
19
|
+
* `None` when omitted → guarded with
|
|
19
20
|
* `is defined and is not none` in `emitExpression`. See the
|
|
20
21
|
* `nullableOptionalProps` field docstring in `jinja-adapter.ts`.
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED
|
|
1
|
+
{"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWpE"}
|
package/dist/build.js
CHANGED
|
@@ -188283,7 +188283,7 @@ function collectBooleanTypedProps(ir) {
|
|
|
188283
188283
|
return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
|
|
188284
188284
|
}
|
|
188285
188285
|
function collectNullableOptionalProps(ir) {
|
|
188286
|
-
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
|
|
188286
|
+
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
|
|
188287
188287
|
}
|
|
188288
188288
|
function collectStringValueNames(ir) {
|
|
188289
188289
|
const names = new Set;
|
package/dist/index.js
CHANGED
|
@@ -188283,7 +188283,7 @@ function collectBooleanTypedProps(ir) {
|
|
|
188283
188283
|
return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
|
|
188284
188284
|
}
|
|
188285
188285
|
function collectNullableOptionalProps(ir) {
|
|
188286
|
-
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
|
|
188286
|
+
return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
|
|
188287
188287
|
}
|
|
188288
188288
|
function collectStringValueNames(ir) {
|
|
188289
188289
|
const names = new Set;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/jinja",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.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,14 +53,14 @@
|
|
|
53
53
|
"directory": "packages/adapter-jinja"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@barefootjs/shared": "0.
|
|
56
|
+
"@barefootjs/shared": "0.19.0"
|
|
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.
|
|
63
|
+
"@barefootjs/jsx": "0.19.0",
|
|
64
64
|
"typescript": "^5.0.0"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -51,6 +51,19 @@ runAdapterConformanceTests({
|
|
|
51
51
|
// Same `/* @client */` keyed-map elision (data-table).
|
|
52
52
|
'data-table',
|
|
53
53
|
]),
|
|
54
|
+
skipDataPoints: new Set<string>([
|
|
55
|
+
// #2255 — Python len() counts codepoints; JS counts UTF-16 code
|
|
56
|
+
// units, so a surrogate-pair character is 2 in JS, 1 here.
|
|
57
|
+
'string-length-text:astral',
|
|
58
|
+
// #2260 — controlled boolean props: the SSR seed evaluates only the
|
|
59
|
+
// static fallback of `props.X ?? internal()` chains.
|
|
60
|
+
'toggle:gen:pressed:true',
|
|
61
|
+
'switch:gen:checked:true',
|
|
62
|
+
'checkbox:gen:checked:true',
|
|
63
|
+
// #2261 — invalid dynamic CSS value kept (escaped) where the oracle
|
|
64
|
+
// drops the property.
|
|
65
|
+
'style-object-dynamic:gen:color:markup',
|
|
66
|
+
]),
|
|
54
67
|
onRenderError: (err, id) => {
|
|
55
68
|
if (err instanceof PythonNotAvailableError) {
|
|
56
69
|
console.log(`Skipping [${id}]: ${err.message}`)
|
|
@@ -24,8 +24,9 @@ export function collectBooleanTypedProps(ir: ComponentIR): Set<string> {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Bare references to
|
|
28
|
-
* textarea's `rows`) are
|
|
27
|
+
* Bare references to presence-uncertain no-default props (non-primitive
|
|
28
|
+
* typed OR declared optional, #2259 — e.g. textarea's `rows`) are
|
|
29
|
+
* `None` when omitted → guarded with
|
|
29
30
|
* `is defined and is not none` in `emitExpression`. See the
|
|
30
31
|
* `nullableOptionalProps` field docstring in `jinja-adapter.ts`.
|
|
31
32
|
*/
|
|
@@ -36,7 +37,7 @@ export function collectNullableOptionalProps(ir: ComponentIR): Set<string> {
|
|
|
36
37
|
p =>
|
|
37
38
|
p.defaultValue === undefined &&
|
|
38
39
|
!p.isRest &&
|
|
39
|
-
p.type?.kind !== 'primitive',
|
|
40
|
+
(p.type?.kind !== 'primitive' || p.optional),
|
|
40
41
|
)
|
|
41
42
|
.map(p => p.name),
|
|
42
43
|
)
|