similarbuild 0.2.0 → 0.2.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.2.
|
|
3
|
+
"version": "0.2.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": {
|
|
@@ -978,7 +978,7 @@ function extractInPage({ selector, maxDepth, maxChildren, maxText }) {
|
|
|
978
978
|
function classifySection(el) {
|
|
979
979
|
const cls = (typeof el.className === 'string' ? el.className : '').toLowerCase()
|
|
980
980
|
const tag = el.tagName.toLowerCase()
|
|
981
|
-
const id = (el.id
|
|
981
|
+
const id = (typeof el.id === 'string' ? el.id : '').toLowerCase()
|
|
982
982
|
const blob = `${tag} ${cls} ${id}`
|
|
983
983
|
if (/\bhero\b/.test(blob)) return 'hero'
|
|
984
984
|
if (/\bbanner\b/.test(blob)) return 'banner'
|
|
@@ -1107,7 +1107,7 @@ function extractInPage({ selector, maxDepth, maxChildren, maxText }) {
|
|
|
1107
1107
|
const node = {
|
|
1108
1108
|
tag: el.tagName.toLowerCase(),
|
|
1109
1109
|
classes: typeof el.className === 'string' ? el.className.split(/\s+/).filter(Boolean) : [],
|
|
1110
|
-
id: el.id
|
|
1110
|
+
id: typeof el.id === 'string' && el.id ? el.id : null,
|
|
1111
1111
|
attrs: {},
|
|
1112
1112
|
text: directText(el),
|
|
1113
1113
|
bbox: bbox(el),
|
|
@@ -1239,7 +1239,7 @@ function extractInPage({ selector, maxDepth, maxChildren, maxText }) {
|
|
|
1239
1239
|
// pseudo-elements, so this filters automatically.
|
|
1240
1240
|
const pseudoElements = []
|
|
1241
1241
|
function pseudoSelectorFor(el) {
|
|
1242
|
-
if (el.id) return `#${el.id}`
|
|
1242
|
+
if (typeof el.id === 'string' && el.id) return `#${el.id}`
|
|
1243
1243
|
const cls = typeof el.className === 'string' ? el.className.trim().split(/\s+/).filter(Boolean) : []
|
|
1244
1244
|
if (cls.length) return `${el.tagName.toLowerCase()}.${cls.slice(0, 3).join('.')}`
|
|
1245
1245
|
return el.tagName.toLowerCase()
|