@deneb-ui/cli 2.0.24 → 2.0.26
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 -3
- package/src/arc/transformer.cjs +26 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deneb-ui/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "Official DENEB CLI — scaffold, convert, validate, and package Fivora-ready storefront templates.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"deneb": "bin/index.js",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"test": "node --test src/arc/__tests__/arc.test.cjs"
|
|
28
|
+
"test": "node --test src/arc/__tests__/arc.test.cjs",
|
|
29
|
+
"build:tools": "npx --yes tsx tool-sources/build-tools.ts"
|
|
29
30
|
},
|
|
30
31
|
"keywords": [
|
|
31
32
|
"deneb",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"license": "MIT",
|
|
49
50
|
"dependencies": {
|
|
50
51
|
"@babel/parser": "^7.28.0",
|
|
51
|
-
"@deneb-ui/core": "^2.0.
|
|
52
|
+
"@deneb-ui/core": "^2.0.26",
|
|
52
53
|
"adm-zip": "^0.6.0",
|
|
53
54
|
"recast": "^0.23.11"
|
|
54
55
|
},
|
package/src/arc/transformer.cjs
CHANGED
|
@@ -580,11 +580,36 @@ function inferPageKey(relativeFile) {
|
|
|
580
580
|
return 'home';
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
function ensureHtmlBodyHydration(ast) {
|
|
584
|
+
recast.types.visit(ast, {
|
|
585
|
+
visitJSXOpeningElement(pathNode) {
|
|
586
|
+
const name = pathNode.node.name;
|
|
587
|
+
const tag = name && name.type === 'JSXIdentifier' ? name.name : '';
|
|
588
|
+
if (tag === 'html' || tag === 'body') {
|
|
589
|
+
const has = (pathNode.node.attributes || []).some(
|
|
590
|
+
(attr) => attr.type === 'JSXAttribute' && attr.name && attr.name.name === 'suppressHydrationWarning',
|
|
591
|
+
);
|
|
592
|
+
if (!has) {
|
|
593
|
+
pathNode.node.attributes.push(b.jsxAttribute(b.jsxIdentifier('suppressHydrationWarning')));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
this.traverse(pathNode);
|
|
597
|
+
},
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
|
|
583
601
|
function instrumentLayoutSource(code, siteDataImport) {
|
|
584
602
|
if (/SiteDataProvider|DenebDataProvider/.test(code)) {
|
|
585
|
-
|
|
603
|
+
if (/suppressHydrationWarning/.test(code)) {
|
|
604
|
+
return { code, updated: false };
|
|
605
|
+
}
|
|
606
|
+
const ast = parseSource(code, 'layout.tsx');
|
|
607
|
+
ensureHtmlBodyHydration(ast);
|
|
608
|
+
return { code: printSource(ast, code), updated: true };
|
|
586
609
|
}
|
|
610
|
+
|
|
587
611
|
const ast = parseSource(code, 'layout.tsx');
|
|
612
|
+
ensureHtmlBodyHydration(ast);
|
|
588
613
|
ensureImport(ast, '@deneb-ui/ui', ['SiteDataProvider']);
|
|
589
614
|
ensureDefaultImport(ast, siteDataImport, 'initialSiteData');
|
|
590
615
|
|