@barefootjs/xslate 0.9.0 → 0.9.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/xslate",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Text::Xslate (Kolon) adapter for BarefootJS — compiles IR to .tx templates and ships the Xslate rendering backend; runs under any PSGI/Plack app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,15 +55,14 @@
|
|
|
55
55
|
"directory": "packages/adapter-xslate"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@barefootjs/
|
|
59
|
-
"@barefootjs/shared": "0.9.0"
|
|
58
|
+
"@barefootjs/shared": "0.9.2"
|
|
60
59
|
},
|
|
61
60
|
"peerDependencies": {
|
|
62
61
|
"@barefootjs/jsx": ">=0.2.0"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
66
|
-
"@barefootjs/jsx": "0.9.
|
|
65
|
+
"@barefootjs/jsx": "0.9.2",
|
|
67
66
|
"typescript": "^5.0.0"
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -37,13 +37,27 @@ runAdapterConformanceTests({
|
|
|
37
37
|
// template reads a stash key that's never seeded. Implemented on Go; the
|
|
38
38
|
// Perl stash-seed path is a follow-up port, so Xslate stays skipped (#1297).
|
|
39
39
|
'context-provider',
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
40
|
+
// `toggle-shared`: the parent maps a `ToggleItemProps[]` prop into
|
|
41
|
+
// sibling `ToggleItem` children inside a keyed `.map`. Three gaps
|
|
42
|
+
// remain (same as mojo): the loop-child `on = props.defaultOn ??
|
|
43
|
+
// false` signal isn't seeded server-side (so every item renders OFF
|
|
44
|
+
// instead of honouring per-item `defaultOn`), the child scope id is
|
|
45
|
+
// the snake-case `toggle_item_<rand>` rather than the `ToggleItem_*`
|
|
46
|
+
// PascalCase the reference pins, and `key=` → `data-key` isn't
|
|
47
|
+
// emitted. Kolon resolves the unseeded vars to nil rather than
|
|
48
|
+
// aborting, so this surfaces as a render mismatch (not a hard error).
|
|
49
|
+
// Separate follow-up.
|
|
46
50
|
'toggle-shared',
|
|
51
|
+
// `props-reactivity-comparison` (the `PropsReactivityComparison`
|
|
52
|
+
// export of `ReactiveProps.tsx`): componentName selection is now
|
|
53
|
+
// honoured, but the child `PropsStyleChild`'s `displayValue =
|
|
54
|
+
// props.value * 10` memo has no static SSR default
|
|
55
|
+
// (`extractSsrDefaults` → `null` for a prop-derived expression) and
|
|
56
|
+
// the Perl SSR model seeds child memos from static defaults. Kolon
|
|
57
|
+
// renders the unseeded `$displayValue` as empty, so `child-computed-
|
|
58
|
+
// value` is blank where Hono / Go emit `10` (Go computes it in a
|
|
59
|
+
// generated child constructor — the Perl static path has no
|
|
60
|
+
// equivalent). (Same reason mojo skips.)
|
|
47
61
|
'props-reactivity-comparison',
|
|
48
62
|
// (`kbd` is not skipped here — it's a BF101 refusal pinned in
|
|
49
63
|
// `expectedDiagnostics` below, not a render-mismatch.)
|
package/src/test-render.ts
CHANGED
|
@@ -87,10 +87,17 @@ export interface RenderOptions {
|
|
|
87
87
|
props?: Record<string, unknown>
|
|
88
88
|
/** Additional component files (filename → source) */
|
|
89
89
|
components?: Record<string, string>
|
|
90
|
+
/**
|
|
91
|
+
* Explicit component to render when `source` declares multiple
|
|
92
|
+
* exports (e.g. `ReactiveProps.tsx` → `PropsReactivityComparison`).
|
|
93
|
+
* Mirrors the Hono reference's `componentName`; omitted for
|
|
94
|
+
* single-export fixtures, which fall back to the default/first export.
|
|
95
|
+
*/
|
|
96
|
+
componentName?: string
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
export async function renderXslateComponent(options: RenderOptions): Promise<string> {
|
|
93
|
-
const { source, adapter, props, components } = options
|
|
100
|
+
const { source, adapter, props, components, componentName: requestedName } = options
|
|
94
101
|
|
|
95
102
|
// Compile child components first.
|
|
96
103
|
//
|
|
@@ -142,7 +149,12 @@ export async function renderXslateComponent(options: RenderOptions): Promise<str
|
|
|
142
149
|
const irFiles = result.files.filter(f => f.type === 'ir')
|
|
143
150
|
if (irFiles.length === 0) throw new Error('No IR output (set outputIR: true)')
|
|
144
151
|
const irs = irFiles.map(f => JSON.parse(f.content) as ComponentIR)
|
|
152
|
+
// Explicit `componentName` wins (multi-export sources pin the render
|
|
153
|
+
// target); otherwise default-export, first inline-exported, first IR.
|
|
154
|
+
// Mirrors the Hono reference so multi-component fixtures render the
|
|
155
|
+
// same export across adapters.
|
|
145
156
|
const ir =
|
|
157
|
+
(requestedName ? irs.find(i => i.metadata.componentName === requestedName) : undefined) ??
|
|
146
158
|
irs.find(i => i.metadata.hasDefaultExport) ??
|
|
147
159
|
irs.find(i => i.metadata.isExported) ??
|
|
148
160
|
irs[0]
|