@jxsuite/import 0.38.2 → 0.39.0
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 +4 -4
- package/src/ai-componentize.ts +5 -2
- package/src/asset-rewrite.ts +1 -1
- package/src/componentize.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/import",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "Clone a live website into a Jx project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"import": "bun run src/cli.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@jxsuite/markup": "^0.4.
|
|
35
|
-
"@jxsuite/schema": "^1.
|
|
34
|
+
"@jxsuite/markup": "^0.4.3",
|
|
35
|
+
"@jxsuite/schema": "^1.6.0",
|
|
36
36
|
"pixelmatch": "^7.2.0",
|
|
37
37
|
"pngjs": "^7.0.0",
|
|
38
38
|
"puppeteer-core": "^24.9.0"
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"happy-dom": "^20.10.6"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@jxsuite/compiler": "^
|
|
45
|
+
"@jxsuite/compiler": "^2.0.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/ai-componentize.ts
CHANGED
|
@@ -279,8 +279,11 @@ function rewriteCallSites(
|
|
|
279
279
|
): JxElement {
|
|
280
280
|
const result: JxElement = { ...node };
|
|
281
281
|
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
/* Import builds every node from parsed HTML, so a tag here is always a literal — the narrow is
|
|
283
|
+
the type saying so rather than a cast pretending the other shape cannot arrive. */
|
|
284
|
+
const literalTag = typeof result.tagName === "string" ? result.tagName : null;
|
|
285
|
+
if (literalTag && tagRenames.has(literalTag)) {
|
|
286
|
+
const oldTag = literalTag;
|
|
284
287
|
result.tagName = tagRenames.get(oldTag)!;
|
|
285
288
|
|
|
286
289
|
const propRenames = propRenamesByTag.get(oldTag);
|
package/src/asset-rewrite.ts
CHANGED
|
@@ -98,7 +98,7 @@ export function rewriteAssetUrls(
|
|
|
98
98
|
|
|
99
99
|
// Href on non-anchor elements (could be link icon, etc.)
|
|
100
100
|
if (typeof attrs.href === "string") {
|
|
101
|
-
const tag = (node.tagName
|
|
101
|
+
const tag = (typeof node.tagName === "string" ? node.tagName : "").toLowerCase();
|
|
102
102
|
if (tag !== "a") {
|
|
103
103
|
const rewritten = rewriteUrl(attrs.href);
|
|
104
104
|
if (rewritten) {
|
package/src/componentize.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { JxElement } from "@jxsuite/schema/types";
|
|
2
|
+
import { displayTagName } from "@jxsuite/schema/guards";
|
|
2
3
|
|
|
3
4
|
export interface ComponentizeOptions {
|
|
4
5
|
minInstances?: number;
|
|
@@ -286,7 +287,7 @@ export function componentize(
|
|
|
286
287
|
}
|
|
287
288
|
|
|
288
289
|
const baseTag = unclaimed[0]!.node.tagName ?? "div";
|
|
289
|
-
const kebabName = toKebabCase(baseTag, compIndex);
|
|
290
|
+
const kebabName = toKebabCase(displayTagName(baseTag), compIndex);
|
|
290
291
|
const pascalName = toPascalCase(kebabName);
|
|
291
292
|
compIndex += 1;
|
|
292
293
|
|