@nuvler/cli 0.3.0 → 0.4.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/README.md +258 -38
- package/dist/api/client.js.map +1 -1
- package/dist/api/theme-registry.js.map +1 -1
- package/dist/commands/theme/create.js +73 -17
- package/dist/commands/theme/create.js.map +1 -1
- package/dist/commands/theme/migrate.js +117 -0
- package/dist/commands/theme/migrate.js.map +1 -0
- package/dist/config/developer-session.js.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/migrate/analyzer.js +479 -0
- package/dist/migrate/analyzer.js.map +1 -0
- package/dist/migrate/asset-copier.js +40 -0
- package/dist/migrate/asset-copier.js.map +1 -0
- package/dist/migrate/classifier.js +107 -0
- package/dist/migrate/classifier.js.map +1 -0
- package/dist/migrate/generator.js +459 -0
- package/dist/migrate/generator.js.map +1 -0
- package/dist/migrate/transformer.js +134 -0
- package/dist/migrate/transformer.js.map +1 -0
- package/dist/migrate/types.js +2 -0
- package/dist/migrate/types.js.map +1 -0
- package/dist/migrate/validator.js +40 -0
- package/dist/migrate/validator.js.map +1 -0
- package/dist/nuvler.js +1559 -26
- package/dist/nuvler.js.map +1 -1
- package/dist/preview/launcher.js +8 -8
- package/dist/preview/launcher.js.map +1 -1
- package/dist/templates/nuvler-atelier/README.md +17 -1
- package/dist/templates/nuvler-atelier/package.json +1 -1
- package/dist/templates/nuvler-default/README.md +18 -4
- package/dist/templates/starter/README.md +18 -1
- package/dist/templates/starter/package.json +1 -1
- package/package.json +2 -1
- package/preview-host/vite.config.ts +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const RULES = [
|
|
2
|
+
{ role: "HEADER", keywords: ["header", "navbar", "navigation", "menu", "cabecalho"], tags: ["header", "nav"], minimum: 5 },
|
|
3
|
+
{ role: "FOOTER", keywords: ["footer", "rodape"], tags: ["footer"], minimum: 5 },
|
|
4
|
+
{ role: "HERO", keywords: ["hero", "banner", "jumbotron", "masthead", "destaque"], tags: ["section"], minimum: 5 },
|
|
5
|
+
{ role: "PRODUCT_CARD", keywords: ["productcard", "product-card", "produto-card", "cardproduto", "productitem"], tags: ["article"], minimum: 6 },
|
|
6
|
+
{ role: "PRODUCT_GRID", keywords: ["productgrid", "product-grid", "products-grid", "produtos-grid", "productlist", "catalog"], minimum: 6 },
|
|
7
|
+
{ role: "PRODUCT_DETAIL", keywords: ["productdetail", "product-detail", "produto-detalhe", "productpage", "produto/", "product/"], minimum: 6 },
|
|
8
|
+
{ role: "HOME", keywords: ["homepage", "home-page", "landing", "inicio", "app.tsx", "page.tsx"], tags: ["main"], minimum: 6 },
|
|
9
|
+
{ role: "SECTION", keywords: ["section", "features", "benefits", "services", "about", "cta"], tags: ["section"], minimum: 6 },
|
|
10
|
+
{ role: "PAGE", keywords: ["page", "screen", "view"], tags: ["main"], minimum: 6 },
|
|
11
|
+
];
|
|
12
|
+
function normalized(value) {
|
|
13
|
+
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
function componentCorpus(component) {
|
|
16
|
+
return normalized([
|
|
17
|
+
component.name,
|
|
18
|
+
component.file,
|
|
19
|
+
...component.rootClasses,
|
|
20
|
+
...component.jsx.flatMap(({ classes, text }) => [...classes, ...text]),
|
|
21
|
+
].join(" "));
|
|
22
|
+
}
|
|
23
|
+
function roleScore(component, rule) {
|
|
24
|
+
const corpus = componentCorpus(component);
|
|
25
|
+
const name = normalized(component.name);
|
|
26
|
+
const file = normalized(component.file);
|
|
27
|
+
const reasons = [];
|
|
28
|
+
let score = 0;
|
|
29
|
+
for (const keyword of rule.keywords) {
|
|
30
|
+
const term = normalized(keyword);
|
|
31
|
+
if (name.includes(term)) {
|
|
32
|
+
score += 7;
|
|
33
|
+
reasons.push(`nome contém "${keyword}"`);
|
|
34
|
+
}
|
|
35
|
+
else if (file.includes(term)) {
|
|
36
|
+
score += 5;
|
|
37
|
+
reasons.push(`caminho contém "${keyword}"`);
|
|
38
|
+
}
|
|
39
|
+
else if (corpus.includes(term)) {
|
|
40
|
+
score += 3;
|
|
41
|
+
reasons.push(`JSX/classes contêm "${keyword}"`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const tag of rule.tags ?? []) {
|
|
45
|
+
if (component.jsx.some((node) => normalized(node.tag) === tag)) {
|
|
46
|
+
score += 6;
|
|
47
|
+
reasons.push(`usa <${tag}>`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (component.page && rule.role === "HOME" && /(^|\/)(?:app\/)?page\.tsx$/.test(component.file)) {
|
|
51
|
+
score += 7;
|
|
52
|
+
reasons.push("página inicial do framework");
|
|
53
|
+
}
|
|
54
|
+
if (component.page && rule.role === "PAGE") {
|
|
55
|
+
score += 4;
|
|
56
|
+
reasons.push("arquivo de página");
|
|
57
|
+
}
|
|
58
|
+
if (rule.role === "PRODUCT_CARD") {
|
|
59
|
+
const hasProduct = corpus.includes("product") || corpus.includes("produto");
|
|
60
|
+
const hasCard = corpus.includes("card") || component.jsx.some(({ tag }) => tag === "article");
|
|
61
|
+
if (hasProduct && hasCard) {
|
|
62
|
+
score += 7;
|
|
63
|
+
reasons.push("combina produto e card/article");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (rule.role === "PRODUCT_GRID") {
|
|
67
|
+
if (component.jsx.some(({ classes }) => classes.some((item) => /grid|list/.test(normalized(item))))) {
|
|
68
|
+
score += 5;
|
|
69
|
+
reasons.push("possui estrutura de grid/lista");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (rule.role === "PRODUCT_DETAIL") {
|
|
73
|
+
if (corpus.includes("price") || corpus.includes("preco") || corpus.includes("sku")) {
|
|
74
|
+
score += 4;
|
|
75
|
+
reasons.push("exibe campos de detalhe de produto");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (rule.role === "HERO" && component.text.some((text) => text.length > 20)) {
|
|
79
|
+
score += 2;
|
|
80
|
+
reasons.push("possui chamada textual de destaque");
|
|
81
|
+
}
|
|
82
|
+
if (component.defaultExport)
|
|
83
|
+
score += 1;
|
|
84
|
+
return { role: rule.role, score, reasons };
|
|
85
|
+
}
|
|
86
|
+
export function classifyProject(input) {
|
|
87
|
+
const components = input.components.map((component) => ({
|
|
88
|
+
...component,
|
|
89
|
+
roles: RULES
|
|
90
|
+
.map((rule) => roleScore(component, rule))
|
|
91
|
+
.filter((candidate) => candidate.score >= (RULES.find(({ role }) => role === candidate.role)?.minimum ?? 6))
|
|
92
|
+
.sort((left, right) => right.score - left.score),
|
|
93
|
+
}));
|
|
94
|
+
const ignoredFiles = [...input.ignoredFiles];
|
|
95
|
+
for (const component of components) {
|
|
96
|
+
if (!component.businessSignals.length || component.roles.length)
|
|
97
|
+
continue;
|
|
98
|
+
if (ignoredFiles.some(({ file }) => file === component.file))
|
|
99
|
+
continue;
|
|
100
|
+
ignoredFiles.push({
|
|
101
|
+
file: component.file,
|
|
102
|
+
reason: component.businessSignals.join(", "),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return { ...input, components, ignoredFiles };
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../src/migrate/classifier.ts"],"names":[],"mappings":"AAaA,MAAM,KAAK,GAAe;IACxB,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;IAC1H,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAA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AAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { themeCreate } from "../commands/theme/create.js";
|
|
4
|
+
import { copyMigrationAssets } from "./asset-copier.js";
|
|
5
|
+
function portable(file) {
|
|
6
|
+
return file.split(path.sep).join("/");
|
|
7
|
+
}
|
|
8
|
+
function classes(base, source = "") {
|
|
9
|
+
return JSON.stringify([base, source].filter(Boolean).join(" "));
|
|
10
|
+
}
|
|
11
|
+
function profile(plan, role) {
|
|
12
|
+
return plan.selected[role]?.classes ?? {
|
|
13
|
+
root: "", brand: "", navigation: "", title: "", text: "", action: "",
|
|
14
|
+
media: "", grid: "", card: "", content: "",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function sourceText(plan, role, fallback) {
|
|
18
|
+
const text = plan.selected[role]?.component.text
|
|
19
|
+
.find((candidate) => candidate.length >= 3 && candidate.length <= 140);
|
|
20
|
+
return text || fallback;
|
|
21
|
+
}
|
|
22
|
+
function headerSource(plan) {
|
|
23
|
+
const style = profile(plan, "HEADER");
|
|
24
|
+
return `import type { HeaderProps } from "@nuvler/theme-sdk";
|
|
25
|
+
|
|
26
|
+
export function Header({ site, categories, pages }: HeaderProps) {
|
|
27
|
+
const name = site.settings?.siteName || site.tenant.name;
|
|
28
|
+
return <header className=${classes("nuvler-migrated-header", style.root)}>
|
|
29
|
+
<div className=${classes("nuvler-migrated-header-inner", style.content)}>
|
|
30
|
+
<a className=${classes("nuvler-migrated-brand", style.brand)} href="/">
|
|
31
|
+
{site.settings?.logo?.url ? <img src={site.settings.logo.url} alt={site.settings.logo.alt || name} /> : <span>{name}</span>}
|
|
32
|
+
</a>
|
|
33
|
+
<nav className=${classes("nuvler-migrated-nav", style.navigation)} aria-label="Navegação principal">
|
|
34
|
+
<a href="/">Início</a>
|
|
35
|
+
{site.modules.includes("PRODUCTS") && <a href="/produtos">Produtos</a>}
|
|
36
|
+
{categories.slice(0, 6).map((category) => <a href={\`/categoria/\${category.slug}\`} key={category.slug}>{category.name}</a>)}
|
|
37
|
+
{pages.slice(0, 4).map((page) => <a href={\`/\${page.slug}\`} key={page.slug}>{page.title}</a>)}
|
|
38
|
+
</nav>
|
|
39
|
+
{site.modules.includes("PRODUCTS") && <form className="nuvler-migrated-search" action="/produtos">
|
|
40
|
+
<input name="busca" type="search" placeholder="Buscar produtos" />
|
|
41
|
+
<button className=${classes("nuvler-migrated-action", style.action)} type="submit">Buscar</button>
|
|
42
|
+
</form>}
|
|
43
|
+
</div>
|
|
44
|
+
</header>;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
function footerSource(plan) {
|
|
49
|
+
const style = profile(plan, "FOOTER");
|
|
50
|
+
return `import type { FooterProps } from "@nuvler/theme-sdk";
|
|
51
|
+
|
|
52
|
+
export function Footer({ site, pages, template }: FooterProps) {
|
|
53
|
+
const name = site.settings?.siteName || site.tenant.name;
|
|
54
|
+
return <footer className=${classes("nuvler-migrated-footer", style.root)}>
|
|
55
|
+
<div className=${classes("nuvler-migrated-footer-inner", style.content)}>
|
|
56
|
+
<div><strong className=${classes("nuvler-migrated-footer-brand", style.brand)}>{name}</strong><p className=${classes("nuvler-migrated-copy", style.text)}>{site.settings?.description || template.footerTagline}</p></div>
|
|
57
|
+
<nav className=${classes("nuvler-migrated-footer-nav", style.navigation)} aria-label={template.footerNavigationLabel}>
|
|
58
|
+
<a href="/">Início</a>
|
|
59
|
+
{site.modules.includes("PRODUCTS") && <a href="/produtos">Produtos</a>}
|
|
60
|
+
{pages.map((page) => <a href={\`/\${page.slug}\`} key={page.slug}>{page.title}</a>)}
|
|
61
|
+
</nav>
|
|
62
|
+
<div className="nuvler-migrated-contact">
|
|
63
|
+
{site.settings?.contact.phone && <a href={\`tel:\${site.settings.contact.phone}\`}>{site.settings.contact.phone}</a>}
|
|
64
|
+
{site.settings?.contact.email && <a href={\`mailto:\${site.settings.contact.email}\`}>{site.settings.contact.email}</a>}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<small>{template.footerNote}</small>
|
|
68
|
+
</footer>;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
function productCardSource(plan) {
|
|
73
|
+
const style = profile(plan, "PRODUCT_CARD");
|
|
74
|
+
return `import type { ThemeProduct } from "@nuvler/theme-sdk";
|
|
75
|
+
|
|
76
|
+
function money(value: number | null): string {
|
|
77
|
+
return value === null ? "Consulte" : new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(value);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function ProductCard({ product, showCategory = true, showDescription = true }: { product: ThemeProduct; showCategory?: boolean; showDescription?: boolean }) {
|
|
81
|
+
const price = product.promotionalPrice ?? product.price;
|
|
82
|
+
return <article className=${classes("nuvler-migrated-product-card", style.root || style.card)}>
|
|
83
|
+
<a className=${classes("nuvler-migrated-product-media", style.media)} href={\`/produto/\${product.slug}\`}>
|
|
84
|
+
{product.image?.url ? <img src={product.image.url} alt={product.image.alt || product.title} /> : <span aria-hidden="true" />}
|
|
85
|
+
</a>
|
|
86
|
+
<div className=${classes("nuvler-migrated-product-content", style.content)}>
|
|
87
|
+
{showCategory && <small>{product.categories[0]?.name || product.brand || "Produto"}</small>}
|
|
88
|
+
<h3 className=${classes("nuvler-migrated-product-title", style.title)}><a href={\`/produto/\${product.slug}\`}>{product.title}</a></h3>
|
|
89
|
+
{showDescription && product.description && <p className=${classes("nuvler-migrated-copy", style.text)}>{product.description}</p>}
|
|
90
|
+
<strong>{money(price)}</strong>
|
|
91
|
+
<a className=${classes("nuvler-migrated-action", style.action)} href={\`/produto/\${product.slug}\`}>Ver produto</a>
|
|
92
|
+
</div>
|
|
93
|
+
</article>;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
function productGridSource(plan) {
|
|
98
|
+
const style = profile(plan, "PRODUCT_GRID");
|
|
99
|
+
return `import type { ProductGridProps } from "@nuvler/theme-sdk";
|
|
100
|
+
import { ProductCard } from "./ProductCard.js";
|
|
101
|
+
|
|
102
|
+
export function ProductGrid({ products, columns = 3, showCategory, showDescription }: ProductGridProps) {
|
|
103
|
+
return <div className=${classes("nuvler-migrated-product-grid", style.root || style.grid)} data-columns={columns}>
|
|
104
|
+
{products.map((product) => <ProductCard product={product} showCategory={showCategory} showDescription={showDescription} key={product.slug} />)}
|
|
105
|
+
</div>;
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
function productDetailSource(plan) {
|
|
110
|
+
const style = profile(plan, "PRODUCT_DETAIL");
|
|
111
|
+
return `import type { ProductDetailProps } from "@nuvler/theme-sdk";
|
|
112
|
+
|
|
113
|
+
function money(value: number | null): string {
|
|
114
|
+
return value === null ? "Consulte" : new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(value);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function ProductDetail({ product, descriptionContent, onAddToCart }: ProductDetailProps) {
|
|
118
|
+
const image = product.images[0] ?? product.image;
|
|
119
|
+
return <article className=${classes("nuvler-migrated-product-detail", style.root)}>
|
|
120
|
+
<div className=${classes("nuvler-migrated-detail-media", style.media)}>{image?.url ? <img src={image.url} alt={image.alt || product.title} /> : <span aria-hidden="true" />}</div>
|
|
121
|
+
<div className=${classes("nuvler-migrated-detail-content", style.content)}>
|
|
122
|
+
<small>{product.categories[0]?.name || product.brand || "Produto"}</small>
|
|
123
|
+
<h1 className=${classes("nuvler-migrated-detail-title", style.title)}>{product.title}</h1>
|
|
124
|
+
<strong className="nuvler-migrated-price">{money(product.promotionalPrice ?? product.price)}</strong>
|
|
125
|
+
<div className=${classes("nuvler-migrated-copy", style.text)}>{descriptionContent}</div>
|
|
126
|
+
<button className=${classes("nuvler-migrated-action", style.action)} type="button" onClick={() => onAddToCart?.({ productSlug: product.slug, title: product.title, sku: product.sku, image: product.image, unitPrice: product.promotionalPrice ?? product.price })}>Adicionar ao orçamento</button>
|
|
127
|
+
</div>
|
|
128
|
+
</article>;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
function homeSource(plan, assets) {
|
|
133
|
+
const home = profile(plan, "HOME");
|
|
134
|
+
const hero = profile(plan, "HERO");
|
|
135
|
+
const section = profile(plan, "SECTION");
|
|
136
|
+
const heroText = sourceText(plan, "HERO", "Uma experiência criada para sua marca");
|
|
137
|
+
const visual = assets.find(({ kind }) => ["image", "svg"].includes(kind));
|
|
138
|
+
const visualDeclaration = visual
|
|
139
|
+
? `const migratedHeroAsset = new URL(${JSON.stringify(visual.importPath)}, import.meta.url).href;`
|
|
140
|
+
: "const migratedHeroAsset: string | null = null;";
|
|
141
|
+
return `import type { HomeProps, ThemeHomeSection } from "@nuvler/theme-sdk";
|
|
142
|
+
import { ProductGrid } from "../components/ProductGrid.js";
|
|
143
|
+
|
|
144
|
+
${visualDeclaration}
|
|
145
|
+
|
|
146
|
+
function value(section: ThemeHomeSection | undefined, key: string): string {
|
|
147
|
+
const candidate = section?.data[key];
|
|
148
|
+
return typeof candidate === "string" ? candidate : "";
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function Home({ sections, products, site, template }: HomeProps) {
|
|
152
|
+
const enabled = sections.filter((item) => item.enabled).sort((left, right) => left.order - right.order);
|
|
153
|
+
const heroSection = enabled.find((item) => item.type === "hero" || item.type === "banner-carousel");
|
|
154
|
+
const productSection = enabled.find((item) => item.type === "products-grid" || item.type === "products-carousel");
|
|
155
|
+
const name = site.settings?.siteName || site.tenant.name;
|
|
156
|
+
const action = template.primaryAction(site.modules);
|
|
157
|
+
return <main className=${classes("nuvler-migrated-home", home.root)}>
|
|
158
|
+
<section className=${classes("nuvler-migrated-hero", hero.root || home.content)}>
|
|
159
|
+
<div className=${classes("nuvler-migrated-hero-content", hero.content)}>
|
|
160
|
+
<span>{${JSON.stringify(heroText)}}</span>
|
|
161
|
+
<h1 className=${classes("nuvler-migrated-hero-title", hero.title)}>{value(heroSection, "title") || name}</h1>
|
|
162
|
+
<p className=${classes("nuvler-migrated-copy", hero.text)}>{value(heroSection, "description") || site.settings?.description || "Conheça nossos produtos e soluções."}</p>
|
|
163
|
+
<a className=${classes("nuvler-migrated-action", hero.action)} href={value(heroSection, "buttonUrl") || action.href}>{value(heroSection, "buttonLabel") || action.label}</a>
|
|
164
|
+
</div>
|
|
165
|
+
{migratedHeroAsset && <div className=${classes("nuvler-migrated-hero-media", hero.media)}><img src={migratedHeroAsset} alt="" /></div>}
|
|
166
|
+
</section>
|
|
167
|
+
{site.modules.includes("PRODUCTS") && <section className=${classes("nuvler-migrated-section", section.root)}>
|
|
168
|
+
<header><span>Destaques</span><h2 className=${classes("nuvler-migrated-section-title", section.title)}>{value(productSection, "title") || "Produtos em destaque"}</h2></header>
|
|
169
|
+
<ProductGrid products={products} columns={site.settings?.catalog?.desktopColumns || 3} showCategory={site.settings?.catalog?.showCategory} showDescription={site.settings?.catalog?.showDescription} />
|
|
170
|
+
</section>}
|
|
171
|
+
{enabled.filter((item) => ["image-text", "rich-text", "cta"].includes(item.type)).map((item) => <section className=${classes("nuvler-migrated-section nuvler-migrated-generic", section.content)} key={item.id || \`\${item.type}-\${item.order}\`}><h2>{value(item, "title")}</h2><p>{value(item, "description") || value(item, "content")}</p>{value(item, "buttonUrl") && <a className="nuvler-migrated-action" href={value(item, "buttonUrl")}>{value(item, "buttonLabel") || "Saiba mais"}</a>}</section>)}
|
|
172
|
+
</main>;
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
function definitionSource(plan) {
|
|
177
|
+
const tokens = plan.tokens;
|
|
178
|
+
return `import manifestData from "../nuvler.theme.json" with { type: "json" };
|
|
179
|
+
import { defineTheme, type ThemeHomeSection, type ThemeManifest } from "@nuvler/theme-sdk";
|
|
180
|
+
import { Footer } from "./components/Footer.js";
|
|
181
|
+
import { Header } from "./components/Header.js";
|
|
182
|
+
import { ProductDetail } from "./components/ProductDetail.js";
|
|
183
|
+
import { ProductGrid } from "./components/ProductGrid.js";
|
|
184
|
+
import { Home } from "./sections/Home.js";
|
|
185
|
+
|
|
186
|
+
function section(id: string, type: ThemeHomeSection["type"], order: number): ThemeHomeSection {
|
|
187
|
+
return { id, type, enabled: true, order, data: {} };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export const manifest = manifestData as ThemeManifest;
|
|
191
|
+
export const themeDefinition = defineTheme({
|
|
192
|
+
manifest,
|
|
193
|
+
tokens: {
|
|
194
|
+
colors: ${JSON.stringify({ primary: tokens.primary, secondary: tokens.secondary, background: tokens.background, text: tokens.text })},
|
|
195
|
+
layout: ${JSON.stringify({ containerWidth: tokens.containerWidth, borderRadius: tokens.borderRadius })},
|
|
196
|
+
},
|
|
197
|
+
template: {
|
|
198
|
+
announcement: ${JSON.stringify(plan.themeName)},
|
|
199
|
+
footerTagline: "Experiência visual migrada para a plataforma Nuvler.",
|
|
200
|
+
footerNavigationLabel: "Navegação",
|
|
201
|
+
footerNote: ${JSON.stringify(plan.themeName)},
|
|
202
|
+
socialLabel: "Redes sociais",
|
|
203
|
+
benefits: [],
|
|
204
|
+
fallbackSections: () => [section("migrated-hero", "hero", 0), section("migrated-products", "products-grid", 1)],
|
|
205
|
+
primaryAction: (modules) => modules.includes("PRODUCTS") ? { label: "Ver produtos", href: "/produtos" } : { label: "Saiba mais", href: "/" },
|
|
206
|
+
},
|
|
207
|
+
components: { Header, Footer, Home, ProductGrid, ProductDetail },
|
|
208
|
+
});
|
|
209
|
+
`;
|
|
210
|
+
}
|
|
211
|
+
function catalogPageSource() {
|
|
212
|
+
return `import type { ThemeRoute, ThemeSite } from "@nuvler/theme-sdk";
|
|
213
|
+
import { ProductGrid } from "../components/ProductGrid.js";
|
|
214
|
+
|
|
215
|
+
type CatalogRoute = Extract<ThemeRoute, { type: "catalog" }>;
|
|
216
|
+
|
|
217
|
+
export function CatalogPage({ route, site }: { route: CatalogRoute; site: ThemeSite }) {
|
|
218
|
+
return <main className="nuvler-migrated-section nuvler-migrated-catalog">
|
|
219
|
+
<header><span>Catálogo</span><h1>{route.search ? \`Busca: \${route.search}\` : "Produtos"}</h1><p>{route.pagination.total} produto(s)</p></header>
|
|
220
|
+
<ProductGrid products={route.products} columns={site.settings?.catalog?.desktopColumns || 3} showCategory={site.settings?.catalog?.showCategory} showDescription={site.settings?.catalog?.showDescription} />
|
|
221
|
+
</main>;
|
|
222
|
+
}
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
function productPageSource() {
|
|
226
|
+
return `import type { ThemeRoute, ThemeRuntimeSdk, ThemeSite } from "@nuvler/theme-sdk";
|
|
227
|
+
import { ProductDetail } from "../components/ProductDetail.js";
|
|
228
|
+
|
|
229
|
+
type ProductRoute = Extract<ThemeRoute, { type: "product" }>;
|
|
230
|
+
|
|
231
|
+
export function ProductPage({ route, site, cart }: { route: ProductRoute; site: ThemeSite; cart?: ThemeRuntimeSdk["cart"] }) {
|
|
232
|
+
return <main className="nuvler-migrated-section"><ProductDetail product={route.product} contact={site.settings?.contact} productUrl={null} descriptionContent={<p>{route.product.description}</p>} onAddToCart={cart?.add} /></main>;
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
}
|
|
236
|
+
function editorialPageSource() {
|
|
237
|
+
return `import type { ThemeRoute } from "@nuvler/theme-sdk";
|
|
238
|
+
|
|
239
|
+
type EditorialRoute = Extract<ThemeRoute, { type: "editorial-list" | "editorial-detail" }>;
|
|
240
|
+
|
|
241
|
+
export function EditorialPage({ route }: { route: EditorialRoute }) {
|
|
242
|
+
if (route.type === "editorial-detail") return <main className="nuvler-migrated-section"><article><span>Conteúdo</span><h1>{route.item.title}</h1><p>{route.item.description}</p></article></main>;
|
|
243
|
+
return <main className="nuvler-migrated-section"><h1>{route.title}</h1><div className="nuvler-migrated-editorial-grid">{route.items.map((item) => <article key={item.slug}><h2><a href={\`\${route.basePath}/\${item.slug}\`}>{item.title}</a></h2><p>{item.description}</p></article>)}</div></main>;
|
|
244
|
+
}
|
|
245
|
+
`;
|
|
246
|
+
}
|
|
247
|
+
function statePageSource() {
|
|
248
|
+
return `export function StatePage({ title, pathname }: { title: string; pathname?: string }) {
|
|
249
|
+
return <main className="nuvler-migrated-section nuvler-migrated-state"><span>{pathname || "Nuvler"}</span><h1>{title}</h1></main>;
|
|
250
|
+
}
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
function themeSource() {
|
|
254
|
+
return `import type { CSSProperties } from "react";
|
|
255
|
+
import type { NuvlerThemeProps, ThemeSite } from "@nuvler/theme-sdk";
|
|
256
|
+
import { themeDefinition } from "./definition.js";
|
|
257
|
+
import { CatalogPage } from "./pages/CatalogPage.js";
|
|
258
|
+
import { EditorialPage } from "./pages/EditorialPage.js";
|
|
259
|
+
import { ProductPage } from "./pages/ProductPage.js";
|
|
260
|
+
import { StatePage } from "./pages/StatePage.js";
|
|
261
|
+
import "./styles/theme.css";
|
|
262
|
+
|
|
263
|
+
export { manifest, themeDefinition } from "./definition.js";
|
|
264
|
+
|
|
265
|
+
export default function Theme({ context, route = { type: "home" }, sdk }: NuvlerThemeProps) {
|
|
266
|
+
const { Header, Footer, Home } = themeDefinition.components;
|
|
267
|
+
const site: ThemeSite = { tenant: context.store, ...context.site };
|
|
268
|
+
const configured = site.settings?.theme;
|
|
269
|
+
const tokens = {
|
|
270
|
+
colors: { ...themeDefinition.tokens.colors, ...configured?.colors },
|
|
271
|
+
layout: { ...themeDefinition.tokens.layout, ...configured?.layout },
|
|
272
|
+
};
|
|
273
|
+
const style = {
|
|
274
|
+
"--theme-primary": tokens.colors.primary,
|
|
275
|
+
"--theme-secondary": tokens.colors.secondary,
|
|
276
|
+
"--theme-background": tokens.colors.background,
|
|
277
|
+
"--theme-text": tokens.colors.text,
|
|
278
|
+
"--theme-radius": \`\${tokens.layout.borderRadius}px\`,
|
|
279
|
+
"--theme-container": \`\${tokens.layout.containerWidth}px\`,
|
|
280
|
+
} as CSSProperties;
|
|
281
|
+
let content;
|
|
282
|
+
if (route.type === "home") content = <Home sections={context.home.content.sections} products={context.catalog.products} posts={context.editorial.posts} services={context.editorial.services} cases={context.editorial.cases} site={site} template={themeDefinition.template} />;
|
|
283
|
+
else if (route.type === "catalog") content = <CatalogPage route={route} site={site} />;
|
|
284
|
+
else if (route.type === "product") content = <ProductPage route={route} site={site} cart={sdk?.cart} />;
|
|
285
|
+
else if (route.type === "editorial-list" || route.type === "editorial-detail") content = <EditorialPage route={route} />;
|
|
286
|
+
else content = <StatePage title={route.type === "loading" ? "Carregando…" : route.type === "page" ? route.title : "Conteúdo não encontrado"} pathname={"pathname" in route ? route.pathname : undefined} />;
|
|
287
|
+
return <div className="nuvler-migrated-theme" style={style}><Header site={site} categories={context.navigation.categories} pages={context.navigation.pages} template={themeDefinition.template} /><div className="nuvler-migrated-page">{content}</div><Footer site={site} pages={context.navigation.pages} template={themeDefinition.template} /></div>;
|
|
288
|
+
}
|
|
289
|
+
`;
|
|
290
|
+
}
|
|
291
|
+
function baseCss(plan) {
|
|
292
|
+
return `/* Fallback estrutural do adaptador Nuvler. Os estilos extraídos vêm depois deste bloco. */
|
|
293
|
+
* { box-sizing: border-box; }
|
|
294
|
+
body { margin: 0; }
|
|
295
|
+
.nuvler-migrated-theme { min-height: 100vh; background: var(--theme-background); color: var(--theme-text); font-family: Inter, system-ui, sans-serif; }
|
|
296
|
+
.nuvler-migrated-header-inner, .nuvler-migrated-footer-inner, .nuvler-migrated-section, .nuvler-migrated-hero { width: min(calc(100% - 32px), var(--theme-container)); margin-inline: auto; }
|
|
297
|
+
.nuvler-migrated-header-inner { min-height: 72px; display: flex; align-items: center; gap: 24px; justify-content: space-between; }
|
|
298
|
+
.nuvler-migrated-brand img { display: block; width: auto; max-width: 200px; max-height: 56px; }
|
|
299
|
+
.nuvler-migrated-nav { display: flex; flex-wrap: wrap; gap: 18px; }
|
|
300
|
+
.nuvler-migrated-nav a, .nuvler-migrated-brand, .nuvler-migrated-footer a { color: inherit; text-decoration: none; }
|
|
301
|
+
.nuvler-migrated-search { display: flex; gap: 8px; }
|
|
302
|
+
.nuvler-migrated-search input { min-width: 220px; border: 1px solid color-mix(in srgb, var(--theme-text), transparent 78%); border-radius: var(--theme-radius); padding: 10px 13px; }
|
|
303
|
+
.nuvler-migrated-action { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--theme-radius); background: var(--theme-primary); color: #fff; padding: 12px 18px; text-decoration: none; cursor: pointer; }
|
|
304
|
+
.nuvler-migrated-hero { display: grid; min-height: 520px; grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); align-items: center; gap: 40px; padding-block: 64px; }
|
|
305
|
+
.nuvler-migrated-hero-title { margin: 12px 0; font-size: clamp(42px, 7vw, 82px); line-height: .98; }
|
|
306
|
+
.nuvler-migrated-hero-media, .nuvler-migrated-product-media, .nuvler-migrated-detail-media { overflow: hidden; border-radius: var(--theme-radius); }
|
|
307
|
+
.nuvler-migrated-hero-media img, .nuvler-migrated-product-media img, .nuvler-migrated-detail-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
|
|
308
|
+
.nuvler-migrated-section { padding-block: 56px; }
|
|
309
|
+
.nuvler-migrated-product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
|
|
310
|
+
.nuvler-migrated-product-grid[data-columns="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
311
|
+
.nuvler-migrated-product-card { overflow: hidden; border: 1px solid color-mix(in srgb, var(--theme-text), transparent 85%); border-radius: var(--theme-radius); background: #fff; }
|
|
312
|
+
.nuvler-migrated-product-media { display: block; aspect-ratio: 1; }
|
|
313
|
+
.nuvler-migrated-product-content { display: grid; gap: 12px; padding: 20px; }
|
|
314
|
+
.nuvler-migrated-product-content p { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
|
315
|
+
.nuvler-migrated-product-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 48px; }
|
|
316
|
+
.nuvler-migrated-price { display: block; margin-block: 18px; font-size: 28px; }
|
|
317
|
+
.nuvler-migrated-footer { margin-top: 64px; background: var(--theme-text); color: var(--theme-background); padding: 56px max(16px, calc((100% - var(--theme-container)) / 2)); }
|
|
318
|
+
.nuvler-migrated-footer-inner { width: 100%; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
|
|
319
|
+
.nuvler-migrated-footer-nav, .nuvler-migrated-contact { display: grid; gap: 8px; }
|
|
320
|
+
@media (max-width: 850px) { .nuvler-migrated-header-inner, .nuvler-migrated-hero { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; } .nuvler-migrated-nav { overflow-x: auto; flex-wrap: nowrap; } .nuvler-migrated-search input { width: 100%; min-width: 0; } .nuvler-migrated-product-grid, .nuvler-migrated-product-grid[data-columns="4"], .nuvler-migrated-product-detail, .nuvler-migrated-footer-inner { grid-template-columns: 1fr; } }
|
|
321
|
+
|
|
322
|
+
:root {
|
|
323
|
+
--theme-primary: ${plan.tokens.primary};
|
|
324
|
+
--theme-secondary: ${plan.tokens.secondary};
|
|
325
|
+
--theme-background: ${plan.tokens.background};
|
|
326
|
+
--theme-text: ${plan.tokens.text};
|
|
327
|
+
--theme-radius: ${plan.tokens.borderRadius}px;
|
|
328
|
+
--theme-container: ${plan.tokens.containerWidth}px;
|
|
329
|
+
}
|
|
330
|
+
`;
|
|
331
|
+
}
|
|
332
|
+
function copiedAssetFor(style, reference, plan, copied) {
|
|
333
|
+
const absolute = reference.startsWith("/")
|
|
334
|
+
? path.join(plan.analysis.sourceDirectory, "public", reference.replace(/^\/+/, ""))
|
|
335
|
+
: path.resolve(path.dirname(style.absolutePath), reference);
|
|
336
|
+
return copied.find((asset) => path.resolve(asset.sourceFile) === path.resolve(absolute));
|
|
337
|
+
}
|
|
338
|
+
function preservedCss(plan, copied) {
|
|
339
|
+
return plan.styles.map((style) => {
|
|
340
|
+
let content = style.content;
|
|
341
|
+
content = content.replace(/@import\s+(["'])(?!https?:)(?!tailwindcss)([^"']+)\1\s*;?/gi, "");
|
|
342
|
+
content = content.replace(/@tailwind\s+(?:base|components|utilities)\s*;?/gi, "");
|
|
343
|
+
content = content.replace(/@import\s+["']tailwindcss["']\s*;?/gi, "");
|
|
344
|
+
content = content.replace(/:global\(([^)]+)\)/g, "$1");
|
|
345
|
+
content = content.replace(/url\(\s*(["']?)([^)'"\s]+)\1\s*\)/gi, (full, _quote, reference) => {
|
|
346
|
+
if (/^(?:data:|https?:|#)/i.test(reference))
|
|
347
|
+
return full;
|
|
348
|
+
const asset = copiedAssetFor(style, reference, plan, copied);
|
|
349
|
+
if (!asset)
|
|
350
|
+
return full;
|
|
351
|
+
const output = portable(asset.outputFile);
|
|
352
|
+
const marker = "/src/assets/";
|
|
353
|
+
const markerIndex = output.lastIndexOf(marker);
|
|
354
|
+
if (markerIndex < 0)
|
|
355
|
+
return full;
|
|
356
|
+
return `url(${JSON.stringify(`../assets/${output.slice(markerIndex + marker.length)}`)})`;
|
|
357
|
+
});
|
|
358
|
+
return `/* Origem: ${style.file}${style.module ? " (CSS Module convertido para CSS comum)" : ""} */\n${content}`;
|
|
359
|
+
}).join("\n\n");
|
|
360
|
+
}
|
|
361
|
+
async function configureTailwind(plan, directory) {
|
|
362
|
+
if (!plan.analysis.tailwind.detected)
|
|
363
|
+
return "";
|
|
364
|
+
const packageFile = path.join(directory, "package.json");
|
|
365
|
+
const metadata = JSON.parse(await readFile(packageFile, "utf8"));
|
|
366
|
+
metadata.devDependencies ??= {};
|
|
367
|
+
const major = plan.analysis.tailwind.major ?? 3;
|
|
368
|
+
metadata.devDependencies.tailwindcss = plan.analysis.tailwind.version || (major >= 4 ? "^4.0.0" : "^3.4.0");
|
|
369
|
+
metadata.devDependencies.postcss = plan.analysis.dependencies.postcss || "^8.4.0";
|
|
370
|
+
if (major >= 4) {
|
|
371
|
+
metadata.devDependencies["@tailwindcss/postcss"] = plan.analysis.dependencies["@tailwindcss/postcss"] || "^4.0.0";
|
|
372
|
+
await writeFile(path.join(directory, "postcss.config.mjs"), "export default { plugins: { \"@tailwindcss/postcss\": {} } };\n", "utf8");
|
|
373
|
+
await writeFile(packageFile, `${JSON.stringify(metadata, null, 2)}\n`, "utf8");
|
|
374
|
+
return '@import "tailwindcss";\n';
|
|
375
|
+
}
|
|
376
|
+
metadata.devDependencies.autoprefixer = plan.analysis.dependencies.autoprefixer || "^10.4.0";
|
|
377
|
+
await writeFile(path.join(directory, "tailwind.config.cjs"), "module.exports = { content: [\"./src/**/*.{ts,tsx}\"], theme: { extend: {} }, plugins: [] };\n", "utf8");
|
|
378
|
+
await writeFile(path.join(directory, "postcss.config.cjs"), "module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } };\n", "utf8");
|
|
379
|
+
await writeFile(packageFile, `${JSON.stringify(metadata, null, 2)}\n`, "utf8");
|
|
380
|
+
return "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n";
|
|
381
|
+
}
|
|
382
|
+
export async function generateMigratedTheme(plan, directory) {
|
|
383
|
+
await themeCreate({
|
|
384
|
+
directory,
|
|
385
|
+
id: plan.themeId,
|
|
386
|
+
name: plan.themeName,
|
|
387
|
+
template: "starter",
|
|
388
|
+
silent: true,
|
|
389
|
+
});
|
|
390
|
+
await rm(path.join(directory, "src"), { recursive: true, force: true });
|
|
391
|
+
await Promise.all([
|
|
392
|
+
mkdir(path.join(directory, "src", "components"), { recursive: true }),
|
|
393
|
+
mkdir(path.join(directory, "src", "sections"), { recursive: true }),
|
|
394
|
+
mkdir(path.join(directory, "src", "styles"), { recursive: true }),
|
|
395
|
+
mkdir(path.join(directory, "src", "pages"), { recursive: true }),
|
|
396
|
+
]);
|
|
397
|
+
const copiedAssets = await copyMigrationAssets(plan, directory);
|
|
398
|
+
const tailwindHeader = await configureTailwind(plan, directory);
|
|
399
|
+
await Promise.all([
|
|
400
|
+
writeFile(path.join(directory, "src/components/Header.tsx"), headerSource(plan), "utf8"),
|
|
401
|
+
writeFile(path.join(directory, "src/components/Footer.tsx"), footerSource(plan), "utf8"),
|
|
402
|
+
writeFile(path.join(directory, "src/components/ProductCard.tsx"), productCardSource(plan), "utf8"),
|
|
403
|
+
writeFile(path.join(directory, "src/components/ProductGrid.tsx"), productGridSource(plan), "utf8"),
|
|
404
|
+
writeFile(path.join(directory, "src/components/ProductDetail.tsx"), productDetailSource(plan), "utf8"),
|
|
405
|
+
writeFile(path.join(directory, "src/sections/Home.tsx"), homeSource(plan, copiedAssets), "utf8"),
|
|
406
|
+
writeFile(path.join(directory, "src/pages/CatalogPage.tsx"), catalogPageSource(), "utf8"),
|
|
407
|
+
writeFile(path.join(directory, "src/pages/ProductPage.tsx"), productPageSource(), "utf8"),
|
|
408
|
+
writeFile(path.join(directory, "src/pages/EditorialPage.tsx"), editorialPageSource(), "utf8"),
|
|
409
|
+
writeFile(path.join(directory, "src/pages/StatePage.tsx"), statePageSource(), "utf8"),
|
|
410
|
+
writeFile(path.join(directory, "src/definition.tsx"), definitionSource(plan), "utf8"),
|
|
411
|
+
writeFile(path.join(directory, "src/theme.tsx"), themeSource(), "utf8"),
|
|
412
|
+
writeFile(path.join(directory, "src/styles/theme.css"), `${tailwindHeader}${baseCss(plan)}\n${preservedCss(plan, copiedAssets)}\n`, "utf8"),
|
|
413
|
+
writeFile(path.join(directory, "src/styles.d.ts"), 'declare module "*.css";\ndeclare module "*.svg";\n', "utf8"),
|
|
414
|
+
]);
|
|
415
|
+
const manifestFile = path.join(directory, "nuvler.theme.json");
|
|
416
|
+
const manifest = JSON.parse(await readFile(manifestFile, "utf8"));
|
|
417
|
+
manifest.entry = "src/theme.tsx";
|
|
418
|
+
manifest.styles = ["src/styles/theme.css"];
|
|
419
|
+
manifest.presentation = {
|
|
420
|
+
description: `Tema ${plan.themeName} migrado de um projeto React + ${plan.analysis.framework === "next" ? "Next.js" : "Vite"}.`,
|
|
421
|
+
templateId: "starter",
|
|
422
|
+
colors: {
|
|
423
|
+
primary: plan.tokens.primary,
|
|
424
|
+
secondary: plan.tokens.secondary,
|
|
425
|
+
background: plan.tokens.background,
|
|
426
|
+
text: plan.tokens.text,
|
|
427
|
+
},
|
|
428
|
+
layout: {
|
|
429
|
+
containerWidth: plan.tokens.containerWidth,
|
|
430
|
+
borderRadius: plan.tokens.borderRadius,
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
await writeFile(manifestFile, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
|
|
434
|
+
const selectedComponents = {};
|
|
435
|
+
for (const [role, selected] of Object.entries(plan.selected)) {
|
|
436
|
+
if (selected)
|
|
437
|
+
selectedComponents[role] = {
|
|
438
|
+
name: selected.component.name,
|
|
439
|
+
file: selected.component.file,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
const report = {
|
|
443
|
+
framework: plan.analysis.framework,
|
|
444
|
+
sourceRoots: plan.analysis.sourceRoots,
|
|
445
|
+
componentsAnalyzed: plan.analysis.components.length,
|
|
446
|
+
selectedComponents,
|
|
447
|
+
assetsCopied: copiedAssets.length,
|
|
448
|
+
styleFilesPreserved: plan.styles.length,
|
|
449
|
+
tailwind: plan.analysis.tailwind,
|
|
450
|
+
ignoredFiles: plan.analysis.ignoredFiles,
|
|
451
|
+
warnings: [...new Set(plan.warnings)],
|
|
452
|
+
validation: { manifest: false, typecheck: false, build: false },
|
|
453
|
+
};
|
|
454
|
+
return { copiedAssets, report };
|
|
455
|
+
}
|
|
456
|
+
export async function writeMigrationReport(directory, report) {
|
|
457
|
+
await writeFile(path.join(directory, "migration-report.json"), `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
|
458
|
+
}
|
|
459
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/migrate/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,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