similarbuild 0.3.0 → 0.3.1
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": "similarbuild",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Visual migration framework for Claude Code — clone a live page, get a paste-ready WordPress/Elementor or Shopify section file, validated and auto-corrected.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,9 @@ A single `.html` file written to `outputPath`. The file is a fragment — no `<h
|
|
|
37
37
|
|
|
38
38
|
## On Activation
|
|
39
39
|
|
|
40
|
-
1. **Read the inputs.** Parse `inspection.json` (capture `sectionType`, `tokens`, `dom`, `pseudoElements`, `imgUrls`, **`hydratedHeader`**, **`hydratedFooter`**) and `assets-map.json` (the URL → localPath / inline-SVG dictionary). If `fixHints` is given, also read `previousHtmlPath`.
|
|
40
|
+
1. **Read the inputs.** Parse `inspection.json` (capture `sectionType`, `tokens`, `dom`, **`domLive`**, `pseudoElements`, `imgUrls`, **`hydratedHeader`**, **`hydratedFooter`**) and `assets-map.json` (the URL → localPath / inline-SVG dictionary). If `fixHints` is given, also read `previousHtmlPath`.
|
|
41
|
+
|
|
42
|
+
**§V03-1 — Use `domLive` as the canonical body tree when present.** When `inspection.domLive` is non-null, it holds the live-walker snapshot taken BEFORE Cap A substituted `dom[]` with the shadow-flattened tree. The flattened `dom[]` carries `bbox={0,0,0,0}` and empty `computedStyle` because parseHTMLUnsafe returns a detached doc — it's structurally rich (gallery imgs, custom-element children) but useless for layout. The composer needs real bboxes, real `computedStyle.background`, real heights. Always prefer `inspection.domLive` for body section composition (bbox, computedStyle, hero detection, section ordering). Use `inspection.dom` only when `domLive === null` (page had no shadow roots — flatten didn't fire) or when you specifically need shadow-flattened content like a PDP gallery (consult `dom` for image-rich PDP nodes, but use `domLive` for the surrounding layout).
|
|
41
43
|
|
|
42
44
|
**§V03-0a — `hydratedHeader` / `hydratedFooter` payload.** When `inspect-live` captures the page chrome WHILE THE BOTTOM IS IN VIEW, it snapshots the hydrated HTML before Shopify themes tear menus down on intersection-out. The payload is the canonical source of truth for header/footer composition — prefer it over `dom[]` subtrees, which may be empty `<ul>` shells if the live walker ran after tear-down. Each one has:
|
|
43
45
|
- `html`: outerHTML of the chrome subtree (string).
|
|
@@ -276,11 +276,26 @@ async function verifyInspectionComplete(inspectionPath) {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// §V03-1 — Prefer domLive when present. v0.3.0 introduced
|
|
280
|
+
// inspection.domLive as the live-walker snapshot taken BEFORE Cap A's
|
|
281
|
+
// shadow-flatten substitution. The flattened dom[] (parsedDoc detached)
|
|
282
|
+
// has bbox={0,0,0,0} and empty computedStyle on every node, which
|
|
283
|
+
// would falsely trigger 'sections-no-computed-style' on any page with
|
|
284
|
+
// open shadow roots (every Shopify Dawn/OS 2.0 page has ≥1). The
|
|
285
|
+
// composer needs real layout, so we read sections from domLive when
|
|
286
|
+
// available and fall back to dom[] otherwise.
|
|
287
|
+
const domForPreflight = Array.isArray(inspection.domLive)
|
|
288
|
+
? inspection.domLive
|
|
289
|
+
: inspection.domLive && typeof inspection.domLive === 'object'
|
|
290
|
+
? [inspection.domLive]
|
|
291
|
+
: inspection.dom
|
|
292
|
+
|
|
279
293
|
// (a) dom non-empty
|
|
280
|
-
if (!Array.isArray(
|
|
294
|
+
if (!Array.isArray(domForPreflight) || domForPreflight.length === 0) {
|
|
281
295
|
missing.push('dom-empty')
|
|
282
296
|
}
|
|
283
|
-
info.domRoots = Array.isArray(
|
|
297
|
+
info.domRoots = Array.isArray(domForPreflight) ? domForPreflight.length : 0
|
|
298
|
+
info.domSource = inspection.domLive ? 'domLive' : 'dom'
|
|
284
299
|
|
|
285
300
|
// (b) screenshot path exists on disk
|
|
286
301
|
let screenshotPath = inspection.screenshot
|
|
@@ -300,11 +315,11 @@ async function verifyInspectionComplete(inspectionPath) {
|
|
|
300
315
|
}
|
|
301
316
|
}
|
|
302
317
|
|
|
303
|
-
// (c) ≥1 classified section
|
|
318
|
+
// (c) ≥1 classified section (counted from domForPreflight per above)
|
|
304
319
|
let sectionsCount = 0
|
|
305
320
|
let sectionsWithBg = 0
|
|
306
321
|
let sectionsWithBbox = 0
|
|
307
|
-
walkAllNodes(
|
|
322
|
+
walkAllNodes(domForPreflight, (n) => {
|
|
308
323
|
if (n.sectionType) {
|
|
309
324
|
sectionsCount++
|
|
310
325
|
if (n.bbox && typeof n.bbox.h === 'number' && n.bbox.h > 0) sectionsWithBbox++
|