@nuvler/cli 0.5.0 → 0.5.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/README.md +2 -2
- package/dist/commands/theme/create.js +2 -2
- package/dist/index.js +1 -1
- package/dist/migrate/analyzer.js +90 -0
- package/dist/migrate/analyzer.js.map +1 -1
- package/dist/migrate/generation/fidelity-pass.js +16 -6
- package/dist/migrate/generation/fidelity-pass.js.map +1 -1
- package/dist/migrate/generator.js +101 -27
- package/dist/migrate/generator.js.map +1 -1
- package/dist/migrate/transform/source-transformer.js +92 -13
- package/dist/migrate/transform/source-transformer.js.map +1 -1
- package/dist/migrate/transformer.js +57 -3
- package/dist/migrate/transformer.js.map +1 -1
- package/dist/nuvler.js +348 -163
- package/dist/nuvler.js.map +1 -1
- package/dist/preview/prepare.js +2 -78
- package/dist/preview/prepare.js.map +1 -1
- package/dist/templates/nuvler-atelier/nuvler.theme.json +24 -10
- package/dist/templates/nuvler-atelier/package.json +3 -3
- package/dist/templates/nuvler-default/nuvler.theme.json +24 -10
- package/dist/templates/nuvler-default/package.json +9 -4
- package/dist/templates/nuvler-default/src/home.tsx +4 -9
- package/dist/templates/starter/nuvler.theme.json +1 -1
- package/dist/templates/starter/package.json +2 -2
- package/package.json +2 -2
- package/preview-host/package.json +1 -1
- package/preview-host/vite.config.ts +10 -0
package/dist/preview/prepare.js
CHANGED
|
@@ -1,83 +1,8 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
1
|
import { ThemeContextSchema } from "@nuvler/theme-schema";
|
|
4
2
|
import { loadThemeContext } from "../api/theme-context.js";
|
|
5
3
|
import { loadDeveloperSession, requireAuthorizedTenant, } from "../config/developer-session.js";
|
|
6
4
|
import { readThemeProjectConfig } from "../config/project.js";
|
|
7
5
|
import { loadThemeProject } from "../theme/project.js";
|
|
8
|
-
function record(value) {
|
|
9
|
-
return value && typeof value === "object" && !Array.isArray(value)
|
|
10
|
-
? value
|
|
11
|
-
: null;
|
|
12
|
-
}
|
|
13
|
-
function meaningful(value) {
|
|
14
|
-
if (typeof value === "string")
|
|
15
|
-
return Boolean(value.trim());
|
|
16
|
-
if (Array.isArray(value))
|
|
17
|
-
return value.length > 0;
|
|
18
|
-
return value !== null && value !== undefined;
|
|
19
|
-
}
|
|
20
|
-
async function migrationSeedContext(directory, context) {
|
|
21
|
-
let parsed;
|
|
22
|
-
try {
|
|
23
|
-
parsed = JSON.parse(await readFile(path.join(directory, "migration-content-seed.json"), "utf8"));
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
if (error.code === "ENOENT")
|
|
27
|
-
return { context, sections: 0 };
|
|
28
|
-
throw new Error("migration-content-seed.json inválido; regenere o tema migrado.", { cause: error });
|
|
29
|
-
}
|
|
30
|
-
const seed = record(parsed);
|
|
31
|
-
const rawSections = Array.isArray(seed?.sections) ? seed.sections : [];
|
|
32
|
-
const supported = new Set([
|
|
33
|
-
"hero", "banner-carousel", "image-text", "rich-text", "cta",
|
|
34
|
-
"services-grid", "blog-grid", "cases-grid", "products-grid", "products-carousel",
|
|
35
|
-
]);
|
|
36
|
-
const seeds = rawSections.flatMap((candidate) => {
|
|
37
|
-
const section = record(candidate);
|
|
38
|
-
const data = record(section?.data);
|
|
39
|
-
if (!section || !data || typeof section.id !== "string" || typeof section.type !== "string" || !supported.has(section.type))
|
|
40
|
-
return [];
|
|
41
|
-
return [{
|
|
42
|
-
id: section.id,
|
|
43
|
-
type: section.type,
|
|
44
|
-
enabled: true,
|
|
45
|
-
order: typeof section.order === "number" ? section.order : 0,
|
|
46
|
-
data,
|
|
47
|
-
}];
|
|
48
|
-
});
|
|
49
|
-
if (!seeds.length)
|
|
50
|
-
return { context, sections: 0 };
|
|
51
|
-
const merged = context.home.content.sections.map((section) => ({ ...section, data: { ...section.data } }));
|
|
52
|
-
const claimed = new Set();
|
|
53
|
-
for (const seedSection of seeds) {
|
|
54
|
-
const exact = merged.findIndex(({ id }) => id === seedSection.id);
|
|
55
|
-
const compatible = exact >= 0
|
|
56
|
-
? exact
|
|
57
|
-
: merged.findIndex((section, index) => !claimed.has(index) && section.type === seedSection.type);
|
|
58
|
-
if (compatible < 0) {
|
|
59
|
-
merged.push(seedSection);
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
claimed.add(compatible);
|
|
63
|
-
const configured = merged[compatible];
|
|
64
|
-
const configuredValues = Object.fromEntries(Object.entries(configured.data).filter(([, value]) => meaningful(value)));
|
|
65
|
-
// The public Home currently does not expose section IDs. Attach the
|
|
66
|
-
// migrated ID to the matching type/occurrence so the preserved component
|
|
67
|
-
// can find it, while always giving panel data priority over the dev seed.
|
|
68
|
-
merged[compatible] = {
|
|
69
|
-
...configured,
|
|
70
|
-
id: seedSection.id,
|
|
71
|
-
data: { ...seedSection.data, ...configuredValues },
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
merged.sort((left, right) => left.order - right.order);
|
|
75
|
-
const seeded = ThemeContextSchema.parse({
|
|
76
|
-
...context,
|
|
77
|
-
home: { ...context.home, content: { ...context.home.content, sections: merged } },
|
|
78
|
-
});
|
|
79
|
-
return { context: seeded, sections: seeds.length };
|
|
80
|
-
}
|
|
81
6
|
export async function prepareThemePreview(options) {
|
|
82
7
|
const project = await loadThemeProject(options.themeDirectory);
|
|
83
8
|
const configured = await readThemeProjectConfig(project.directory);
|
|
@@ -90,13 +15,12 @@ export async function prepareThemePreview(options) {
|
|
|
90
15
|
if (context.store.slug !== tenant.slug) {
|
|
91
16
|
throw new Error(`A API retornou contexto do tenant "${context.store.slug}" para "${tenant.slug}".`);
|
|
92
17
|
}
|
|
93
|
-
const preview = await migrationSeedContext(project.directory, context);
|
|
94
18
|
return {
|
|
95
19
|
project,
|
|
96
|
-
context:
|
|
20
|
+
context: ThemeContextSchema.parse(context),
|
|
97
21
|
apiUrl: session.apiUrl,
|
|
98
22
|
tenant,
|
|
99
|
-
migrationSeedSections:
|
|
23
|
+
migrationSeedSections: 0,
|
|
100
24
|
};
|
|
101
25
|
}
|
|
102
26
|
//# sourceMappingURL=prepare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/preview/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/preview/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAc1E,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAIzC;IACC,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnE,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,uBAAuB,CACpC,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,UAAW,CAAC,MAAM,CAAC,EAAE,CAC/C,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACvF,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,sCAAsC,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,MAAM,CAAC,IAAI,IAAI,CACnF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO;QACP,OAAO,EAAE,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC;QAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM;QACN,qBAAqB,EAAE,CAAC;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -2,22 +2,36 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"id": "nuvler-atelier",
|
|
4
4
|
"name": "Nuvler Atelier",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.3",
|
|
6
6
|
"runtimeVersion": "1",
|
|
7
|
-
"sdkVersion": "^1.3.
|
|
7
|
+
"sdkVersion": "^1.3.1",
|
|
8
8
|
"entry": "src/theme.tsx",
|
|
9
|
-
"styles": [
|
|
9
|
+
"styles": [
|
|
10
|
+
"src/theme.css"
|
|
11
|
+
],
|
|
10
12
|
"presentation": {
|
|
11
13
|
"description": "Tema editorial com composição assimétrica, imagens protagonistas e navegação refinada.",
|
|
12
14
|
"templateId": "nuvler-atelier",
|
|
13
15
|
"colors": {
|
|
14
|
-
"primary": "#153f3a",
|
|
15
|
-
"secondary": "#ff6b3d",
|
|
16
|
-
"background": "#f3efe5",
|
|
17
|
-
"text": "#17201e",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
16
|
+
"primary": "#153f3a",
|
|
17
|
+
"secondary": "#ff6b3d",
|
|
18
|
+
"background": "#f3efe5",
|
|
19
|
+
"text": "#17201e",
|
|
20
|
+
"primaryText": "#ffffff",
|
|
21
|
+
"secondaryText": "#17201e",
|
|
22
|
+
"accent": "#ff6b3d",
|
|
23
|
+
"surface": "#fffaf0",
|
|
24
|
+
"surfaceAlt": "#e8e1d3",
|
|
25
|
+
"textMuted": "#6b716e",
|
|
26
|
+
"border": "#d5cdbd",
|
|
27
|
+
"headerBackground": "#f3efe5",
|
|
28
|
+
"headerText": "#17201e",
|
|
29
|
+
"footerBackground": "#101c1a",
|
|
30
|
+
"footerText": "#ffffff"
|
|
20
31
|
},
|
|
21
|
-
"layout": {
|
|
32
|
+
"layout": {
|
|
33
|
+
"containerWidth": 1380,
|
|
34
|
+
"borderRadius": 8
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuvler-theme-nuvler-atelier",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@nuvler/theme-sdk": "^1.3.
|
|
16
|
+
"@nuvler/theme-sdk": "^1.3.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^19.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@nuvler/cli": "^0.5.
|
|
22
|
+
"@nuvler/cli": "^0.5.1",
|
|
23
23
|
"@types/react": "^19.0.0",
|
|
24
24
|
"react": "^19.0.0",
|
|
25
25
|
"typescript": "^5.9.0"
|
|
@@ -2,22 +2,36 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"id": "nuvler-default",
|
|
4
4
|
"name": "Nuvler Default",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.5",
|
|
6
6
|
"runtimeVersion": "1",
|
|
7
|
-
"sdkVersion": "^1.3.
|
|
7
|
+
"sdkVersion": "^1.3.1",
|
|
8
8
|
"entry": "src/theme.tsx",
|
|
9
|
-
"styles": [
|
|
9
|
+
"styles": [
|
|
10
|
+
"src/theme.css"
|
|
11
|
+
],
|
|
10
12
|
"presentation": {
|
|
11
13
|
"description": "Tema oficial completo, indicado para produção e usado como base confiável.",
|
|
12
14
|
"templateId": "nuvler-default",
|
|
13
15
|
"colors": {
|
|
14
|
-
"primary": "#176b3a",
|
|
15
|
-
"secondary": "#d99b31",
|
|
16
|
-
"background": "#f7f7f2",
|
|
17
|
-
"text": "#18221b",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
16
|
+
"primary": "#176b3a",
|
|
17
|
+
"secondary": "#d99b31",
|
|
18
|
+
"background": "#f7f7f2",
|
|
19
|
+
"text": "#18221b",
|
|
20
|
+
"primaryText": "#ffffff",
|
|
21
|
+
"secondaryText": "#18221b",
|
|
22
|
+
"accent": "#b45309",
|
|
23
|
+
"surface": "#ffffff",
|
|
24
|
+
"surfaceAlt": "#eef2e9",
|
|
25
|
+
"textMuted": "#657068",
|
|
26
|
+
"border": "#dfe4dd",
|
|
27
|
+
"headerBackground": "#ffffff",
|
|
28
|
+
"headerText": "#18221b",
|
|
29
|
+
"footerBackground": "#14251a",
|
|
30
|
+
"footerText": "#f7f7f2"
|
|
20
31
|
},
|
|
21
|
-
"layout": {
|
|
32
|
+
"layout": {
|
|
33
|
+
"containerWidth": 1280,
|
|
34
|
+
"borderRadius": 18
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuvler/theme-default",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Tema padrão oficial da Nuvler",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"sideEffects": [
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
7
9
|
"main": "./dist/src/index.js",
|
|
8
10
|
"types": "./dist/src/index.d.ts",
|
|
9
11
|
"exports": {
|
|
@@ -45,7 +47,10 @@
|
|
|
45
47
|
"./styles.css": "./dist/theme.css",
|
|
46
48
|
"./manifest": "./dist/nuvler.theme.json"
|
|
47
49
|
},
|
|
48
|
-
"files": [
|
|
50
|
+
"files": [
|
|
51
|
+
"dist",
|
|
52
|
+
"README.md"
|
|
53
|
+
],
|
|
49
54
|
"scripts": {
|
|
50
55
|
"dev": "nuvler theme dev --theme .",
|
|
51
56
|
"validate": "nuvler theme validate --theme .",
|
|
@@ -59,7 +64,7 @@
|
|
|
59
64
|
"react": "^19.0.0"
|
|
60
65
|
},
|
|
61
66
|
"dependencies": {
|
|
62
|
-
"@nuvler/theme-sdk": "^1.3.
|
|
67
|
+
"@nuvler/theme-sdk": "^1.3.1"
|
|
63
68
|
},
|
|
64
69
|
"devDependencies": {
|
|
65
70
|
"@types/react": "^19.0.0",
|
|
@@ -97,12 +97,7 @@ function TextSection({ section, ImageComponent = ThemeImageView }: { section: Th
|
|
|
97
97
|
function ContactForm({ section, submitContact }: { section: ThemeHomeSection; submitContact?: (submission: ThemeContactSubmissionInput) => Promise<unknown> }) {
|
|
98
98
|
const props = record(section.data, "props");
|
|
99
99
|
const configured = records(props, "fields");
|
|
100
|
-
const fields = configured
|
|
101
|
-
{ key: "name", label: "Nome", type: "text", required: true },
|
|
102
|
-
{ key: "email", label: "E-mail", type: "email", required: true },
|
|
103
|
-
{ key: "phone", label: "Telefone", type: "tel" },
|
|
104
|
-
{ key: "message", label: "Mensagem", type: "textarea", required: true },
|
|
105
|
-
];
|
|
100
|
+
const fields = configured;
|
|
106
101
|
const [status, setStatus] = useState<"idle" | "sending" | "success" | "error">("idle");
|
|
107
102
|
const [error, setError] = useState("");
|
|
108
103
|
const submit = async (event: FormEvent<HTMLFormElement>) => {
|
|
@@ -136,7 +131,7 @@ function ContactForm({ section, submitContact }: { section: ThemeHomeSection; su
|
|
|
136
131
|
setError(cause instanceof Error ? cause.message : "Não foi possível enviar o contato.");
|
|
137
132
|
}
|
|
138
133
|
};
|
|
139
|
-
return <section className="store-section theme-component-section contact-form-section"><div className="store-container contact-form-layout"><div className="contact-form-copy">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}
|
|
134
|
+
return <section className="store-section theme-component-section contact-form-section"><div className="store-container contact-form-layout"><div className="contact-form-copy">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}{text(props, "description") && <p>{text(props, "description")}</p>}</div><form className="contact-form" onSubmit={(event) => void submit(event)}>{fields.map((field) => {
|
|
140
135
|
const key = text(field, "key");
|
|
141
136
|
const type = text(field, "type", "text");
|
|
142
137
|
const label = text(field, "label", key);
|
|
@@ -145,7 +140,7 @@ function ContactForm({ section, submitContact }: { section: ThemeHomeSection; su
|
|
|
145
140
|
if (type === "checkbox") return <label className="contact-form-wide contact-form-checkbox" key={key}><input name={key} required={required} type="checkbox" value="true" /><span>{label}{required && <small aria-hidden="true"> *</small>}</span></label>;
|
|
146
141
|
if (type === "select") return <label key={key}><span>{label}{required && <small aria-hidden="true"> *</small>}</span><select name={key} required={required}>{records(field, "options").map((option) => <option key={text(option, "value")} value={text(option, "value")}>{text(option, "label", text(option, "value"))}</option>)}</select></label>;
|
|
147
142
|
return <label className={type === "textarea" ? "contact-form-wide" : ""} key={key}><span>{label}{required && <small aria-hidden="true"> *</small>}</span>{type === "textarea" ? <textarea name={key} placeholder={text(field, "placeholder")} required={required} rows={5} /> : <input name={key} placeholder={text(field, "placeholder")} required={required} type={["email", "tel", "url", "number"].includes(type) ? type : "text"} />}</label>;
|
|
148
|
-
})}<div className="contact-form-wide"><button className="button button-primary" disabled={status === "sending"} type="submit">{status === "sending" ? "
|
|
143
|
+
})}<div className="contact-form-wide"><button className="button button-primary" disabled={status === "sending"} type="submit">{status === "sending" ? "" : text(props, "submitLabel")}</button>{status === "success" && text(props, "successMessage") && <p className="contact-form-feedback" role="status">{text(props, "successMessage")}</p>}{status === "error" && <p className="contact-form-feedback contact-form-error" role="alert">{error}</p>}</div></form></div></section>;
|
|
149
144
|
}
|
|
150
145
|
|
|
151
146
|
function ThemeComponent({ section, submitContact }: { section: ThemeHomeSection; submitContact?: HomeProps["submitContact"] }) {
|
|
@@ -154,7 +149,7 @@ function ThemeComponent({ section, submitContact }: { section: ThemeHomeSection;
|
|
|
154
149
|
if (componentKey === "contact-form" || componentKey.endsWith("-form")) return <ContactForm section={section} submitContact={submitContact} />;
|
|
155
150
|
if (componentKey === "video") return <section className="store-section theme-component-section" data-component-key="video"><div className="store-container">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}{text(props, "description") && <p>{text(props, "description")}</p>}{text(props, "videoUrl") && <video className="theme-component-video" controls playsInline poster={text(props, "posterImageUrl") || undefined} src={text(props, "videoUrl")} />}</div></section>;
|
|
156
151
|
const items = records(props, "items");
|
|
157
|
-
return <section className="store-section theme-component-section" data-component-key={componentKey || undefined}><div className="store-container">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}{text(props, "description") && <p>{text(props, "description")}</p>}{items.length > 0 && <div className="theme-component-items">{items.map((item, index) =>
|
|
152
|
+
return <section className="store-section theme-component-section" data-component-key={componentKey || undefined}><div className="store-container">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}{text(props, "description") && <p>{text(props, "description")}</p>}{items.length > 0 && <div className="theme-component-items">{items.map((item, index) => { const itemTitle = text(item, "value", text(item, "title", text(item, "question"))); return <article key={index}>{itemTitle && <strong>{itemTitle}</strong>}{text(item, "description", text(item, "answer")) && <p>{text(item, "description", text(item, "answer"))}</p>}</article>; })}</div>}</div></section>;
|
|
158
153
|
}
|
|
159
154
|
|
|
160
155
|
export function Home({ sections, products, posts, services, cases, site, template, submitContact, ImageComponent = ThemeImageView }: HomeProps & { ImageComponent?: ThemeImageComponent }) {
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@nuvler/theme-sdk": "^1.3.
|
|
16
|
+
"@nuvler/theme-sdk": "^1.3.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^19.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@nuvler/cli": "^0.5.
|
|
22
|
+
"@nuvler/cli": "^0.5.1",
|
|
23
23
|
"@types/react": "^19.0.0",
|
|
24
24
|
"react": "^19.0.0",
|
|
25
25
|
"typescript": "^5.9.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuvler/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "CLI oficial para criação, validação, preview e empacotamento de temas Nuvler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@nuvler/theme-schema": "^1.3.0",
|
|
24
|
-
"@nuvler/theme-sdk": "^1.3.
|
|
24
|
+
"@nuvler/theme-sdk": "^1.3.1",
|
|
25
25
|
"@vitejs/plugin-react": "^6.0.5",
|
|
26
26
|
"commander": "^15.0.0",
|
|
27
27
|
"react": "19.2.8",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
import react from "@vitejs/plugin-react";
|
|
@@ -82,6 +83,9 @@ function activeThemePlugin(
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
const previewHostDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
86
|
+
const moduleRequire = createRequire(import.meta.url);
|
|
87
|
+
const reactDirectory = path.dirname(moduleRequire.resolve("react/package.json"));
|
|
88
|
+
const reactDomDirectory = path.dirname(moduleRequire.resolve("react-dom/package.json"));
|
|
85
89
|
const toolingRoot = path.resolve(previewHostDirectory, "../..");
|
|
86
90
|
const isMonorepoPreview = existsSync(path.join(toolingRoot, "packages", "theme-runtime", "src", "index.ts"));
|
|
87
91
|
const runtimeEntry = isMonorepoPreview
|
|
@@ -117,6 +121,12 @@ export default defineConfig({
|
|
|
117
121
|
), react()],
|
|
118
122
|
resolve: {
|
|
119
123
|
alias: {
|
|
124
|
+
// Dependencies preserved from the migrated project (icons, UI kits,
|
|
125
|
+
// motion libraries) may resolve React from the theme's node_modules.
|
|
126
|
+
// Pin every React import to the preview host so hooks and the renderer
|
|
127
|
+
// always share the same module instance.
|
|
128
|
+
react: reactDirectory,
|
|
129
|
+
"react-dom": reactDomDirectory,
|
|
120
130
|
"@nuvler/theme-runtime": runtimeEntry,
|
|
121
131
|
...(isMonorepoPreview ? {
|
|
122
132
|
"@nuvler/theme-sdk": path.join(toolingRoot, "packages", "theme-sdk", "src", "index.ts"),
|