Skip to content

Commit 8e539b4

Browse files
serpentbladeclaude
andcommitted
fix(vr): render Angular SortableList cell after Phase-20 source move
Moving SortableList.rozie out of examples/ into @rozie-ui/sortable-list left the VR Angular cell empty (0 items): the analogjs AOT prebuild + NgtscProgram were scoped to examples/ only, so the moved component never got AOT-compiled — the demo's imports:[SortableList] collapsed to any[], no ɵcmp emitted, JIT fallback → empty mount (DEBUG.md 'vr Angular JIT compiler unavailable'). Two coordinated changes make it render without contaminating other targets: - vite.config.ts + tsconfig.app.json: add packages/ui/sortable-list/src to the Angular prebuildExtraRoots + resolveCrossTreeBareImports + NgtscProgram include so the moved SortableList AOT-compiles (ɵcmp emitted). - build-cells.mjs: extend cleanupCrossTreeAngularArtifacts() to sweep the Angular .rozie.ts disk-cache + SortableList.ts shim from the package src after the Angular sub-build — mirroring the existing examples/ + demos/ sweep — so the later solid/lit sub-builds don't pick up the @angular/core-importing leftover (which otherwise fails with 'Rollup failed to resolve import lit'). Verified in the pinned CI Playwright container (vr.sh -g '[Ss]ortable'): 32 passed, 0 failed (was 27 passed / 5 angular failed). All 5 Angular sortable cells render (matrix + drag + cross + multi + keyboard); no Lit contamination. VR-harness only — zero emitter/compiler/IR change; dist-parity unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent de1a459 commit 8e539b4

3 files changed

Lines changed: 54 additions & 3 deletions

File tree

tests/visual-regression/scripts/build-cells.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ const ROOT = resolve(HERE, '..');
2121
// → tests → repo.
2222
const REPO_ROOT = resolve(HERE, '..', '..', '..');
2323
const EXAMPLES_DIR = resolve(REPO_ROOT, 'examples');
24+
// Phase 20: SortableList.rozie moved out of examples/ into the
25+
// @rozie-ui/sortable-list package. The Angular sub-build now walks this dir via
26+
// `prebuildExtraRoots` (vite.config.ts) and emits the same cross-tree disk-cache
27+
// artefacts here (`SortableList.rozie.ts` + the `SortableList.ts` composition
28+
// shim) that it drops in examples/. They must be swept after the Angular build
29+
// for the same reason — the @angular/core-importing files poison the later
30+
// solid/lit sub-builds (and unrelated workspace typechecks). See
31+
// cleanupCrossTreeAngularArtifacts().
32+
const SORTABLE_LIST_SRC = resolve(
33+
REPO_ROOT,
34+
'packages',
35+
'ui',
36+
'sortable-list',
37+
'src',
38+
);
2439
const REFERENCE_BASENAMES = [
2540
'Counter',
2641
'SearchInput',
@@ -120,6 +135,24 @@ function cleanupCrossTreeAngularArtifacts() {
120135
} catch {
121136
// demos dir may not exist in some checkouts — ignore
122137
}
138+
// Phase 20: the Angular sub-build also walks `packages/ui/sortable-list/src/`
139+
// (the moved SortableList canonical source) via `prebuildExtraRoots`. It emits
140+
// `SortableList.rozie.ts` (D-70 disk-cache, imports @angular/core) and the
141+
// `SortableList.ts` cross-rozie composition shim there. Without sweeping them
142+
// between sub-builds, the later solid/lit `vite build` resolves the leftover
143+
// `.rozie.ts` (it shadows the `.rozie` virtual module) and fails with
144+
// "Rollup failed to resolve import 'lit'/'solid-js'" — the same cross-tree
145+
// contamination the examples/ + demos/ sweeps above prevent.
146+
try {
147+
for (const entry of readdirSync(SORTABLE_LIST_SRC)) {
148+
if (entry.endsWith('.rozie.ts')) {
149+
rmSync(resolve(SORTABLE_LIST_SRC, entry), { force: true });
150+
}
151+
}
152+
} catch {
153+
// sortable-list src always exists post-Phase-20 — defensive only
154+
}
155+
rmSync(resolve(SORTABLE_LIST_SRC, 'SortableList.ts'), { force: true });
123156
}
124157

125158
const TARGETS = ['vue', 'react', 'svelte', 'angular', 'solid', 'lit'];

tests/visual-regression/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
"tslib": ["node_modules/tslib"]
1919
}
2020
},
21-
"include": ["host/**/*.ts", "../../examples/**/*.rozie.ts"]
21+
"include": ["host/**/*.ts", "../../examples/**/*.rozie.ts", "../../packages/ui/sortable-list/src/**/*.rozie.ts"]
2222
}

tests/visual-regression/vite.config.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,24 @@ async function frameworkPlugins(target: Target) {
108108

109109
export default defineConfig(async () => {
110110
const examplesRoot = resolve(__dirname, '..', '..', 'examples');
111+
// Phase 20: SortableList.rozie moved out of `examples/` into the
112+
// `@rozie-ui/sortable-list` package. The Angular AOT prebuild + NgtscProgram
113+
// must also walk the package src so the moved component's `.rozie.ts`
114+
// disk-cache artifact is generated and type-resolved — otherwise the demo's
115+
// `imports: [SortableList]` collapses to `any[]`, `ɵcmp` is skipped, and the
116+
// cell falls back to JIT → empty mount. The matching disk-cache sweep lives
117+
// in scripts/build-cells.mjs `cleanupCrossTreeAngularArtifacts()` so the
118+
// emitted `.rozie.ts` here doesn't poison the later solid/lit sub-builds.
119+
// See DEBUG.md "vr Angular JIT compiler unavailable".
120+
const sortableListSrc = resolve(
121+
__dirname,
122+
'..',
123+
'..',
124+
'packages',
125+
'ui',
126+
'sortable-list',
127+
'src',
128+
);
111129
return {
112130
// Sub-builds are served from dist/<target>/; the host router lives at dist root.
113131
base: `/${TARGET}/`,
@@ -147,10 +165,10 @@ export default defineConfig(async () => {
147165
// The other targets' `.rozie.ts/.tsx` virtual modules go through Vite's
148166
// own resolver, which honors `browser` via vite-plugin-solid's
149167
// `configEnvironment` hook (and the equivalent for other plugins).
150-
...(TARGET === 'angular' ? [resolveCrossTreeBareImports([examplesRoot])] : []),
168+
...(TARGET === 'angular' ? [resolveCrossTreeBareImports([examplesRoot, sortableListSrc])] : []),
151169
Rozie({
152170
target: TARGET,
153-
...(TARGET === 'angular' ? { prebuildExtraRoots: [examplesRoot] } : {}),
171+
...(TARGET === 'angular' ? { prebuildExtraRoots: [examplesRoot, sortableListSrc] } : {}),
154172
}),
155173
...(await frameworkPlugins(TARGET)),
156174
],

0 commit comments

Comments
 (0)