fix(producer): preserve nested entry asset base - #3645
Conversation
miga-heygen
left a comment
There was a problem hiding this comment.
Reviewed the diff plus the underlying rewriteAssetPath/rewriteAssetPaths/rewriteCssAssetUrls helpers in packages/parsers/src/rewriteSubCompPaths.ts. Traced the added regression test by hand: for a direct nested entry at compositions/scene.html, a sibling compositions/sibling.png gets rewritten to compositions/sibling.png (sibling-exists probe hits), while a project-root root.png is left unchanged (sibling probe path compositions/root.png doesn't exist on disk, so it falls through to the original value) — matches the PR's stated sibling-first/project-root-fallback rule and the existing mounted-subcomposition behavior. The isPathInside(htmlPath, projectDir) guard correctly skips generated standalone wrappers living outside the project, avoiding double-rewriting of the already-handled mounted flow. Logic is consistent with the reused helpers rather than a parallel reimplementation. Approving.
What
Direct
--composition compositions/scene.htmlentries now keep the same sibling-asset resolution as mounted sub-compositions. A siblingimage.pngis emitted ascompositions/image.png, while an existing project-root asset remains root-relative.Why
The compiler relocates every entry document to
compiled/index.html. Direct nested entries previously kept plain relative URLs unchanged, so the render server requested/image.pngand returned 404 even whencompositions/image.pngexisted.How
Nested entry documents inside the project are rebased before compilation with the established mounted-subcomposition path resolver. The pass covers
src/href, inline styles, and stylesheeturl(...)values. Generated standalone wrappers outside the project are skipped, which prevents double rebasing of the existing mounted flow.Test plan