Skip to content

fix(producer): preserve nested entry asset base - #3645

Merged
miga-heygen merged 1 commit into
mainfrom
magi/fix-standalone-entry-asset-base
Sep 4, 2026
Merged

fix(producer): preserve nested entry asset base#3645
miga-heygen merged 1 commit into
mainfrom
magi/fix-standalone-entry-asset-base

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

Direct --composition compositions/scene.html entries now keep the same sibling-asset resolution as mounted sub-compositions. A sibling image.png is emitted as compositions/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.png and returned 404 even when compositions/image.png existed.

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 stylesheet url(...) values. Generated standalone wrappers outside the project are skipped, which prevents double rebasing of the existing mounted flow.

Test plan

  • Regression test covers a direct nested entry with both a sibling image and a project-root image.
  • Full producer HTML compiler suite passes (132/132).
  • Shared path-rewriter suite passes (11/11).
  • Producer typecheck, oxlint, and oxfmt checks pass.
  • Documentation updated (not applicable).

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@miga-heygen
miga-heygen enabled auto-merge (squash) September 4, 2026 23:15
@miga-heygen
miga-heygen merged commit 32f9ed9 into main Sep 4, 2026
54 checks passed
@miga-heygen
miga-heygen deleted the magi/fix-standalone-entry-asset-base branch September 4, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants