fix(site-import): honour alt text, script order, folders, and re-imports - #480
Merged
Conversation
Real theme imports lost authored image attributes, loaded a shared script before its dependency because one global counter numbered it on first sight, stacked every ambient rule again on re-import, turned a folder API blip into a lost upload, and reported 22 of 30 uploads as 22/22. Each fix lands at its source: the planner, the walker, the store transaction, the upload adapter, and the progress model.
The mapping table and the key-details list still said the img rule keeps src only and drops alt, which PR 480 changed: the perf hints map onto the Image props and alt travels to the media record through imageAlts.
A class rule the Conflicts step renamed keeps the origin of the rule it came from, so origin alone is not unique in the registry and an index keyed on it kept whichever same-origin rule came last. The selector is now part of the key. Also: the rule-conflict row shows the source stylesheet, the site-import doc no longer claims class rules are a no-op on re-import, and two comments the earlier commits left wrong are corrected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #403
Fixes #404
Fixes #409
Fixes #411
Fixes #412
Summary
Five static-import defects from real theme imports. Image
alt,loading,decodingandfetchprioritywere dropped, so a 30-image import left 30 blank alts. A script shared by two pages took its priority from whichever page sorted first, soapp.jsloaded beforevendor.js. Importing a site twice appended every ambient rule again. A folder API failure after a successful upload rejected the upload, leaving pages on their bundle paths. A run that lost 8 of 30 uploads finished as 22/22.Script priorities now come from a topological merge of every page's document order (
scriptOrder.ts), with ascript-order-conflictwarning when pages disagree. Rules carryorigin(stylesheet + ordinal) andputStyleRulereplaces a same-origin, same-selector rule in place. Alt rides with the asset into the upload as analtTextform part; the perf hints map onto the Image props. Folder placement is best-effort and reportsasset-folder-failed. The done state keeps the planned total (22 / 30), opens the log, and toasts a warning.Class rules still go through the Conflicts step on re-import; only ambient rules reconcile by origin. Re-import identity is origin plus selector, since a renamed class rule keeps the origin it came from.
Verification
bun run build(clean)bun test(6803 pass, 0 fail)bun run lint(clean)Checklist