@akanjs/devkit 2.2.13-rc.0 → 2.3.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.
|
@@ -29,8 +29,14 @@ describe("resolveSsrPageEntries", () => {
|
|
|
29
29
|
const groupedLayoutPath = path.join(pageRoot, "(home)", "_layout.tsx");
|
|
30
30
|
|
|
31
31
|
await write(path.join(appRoot, "env", "env.client.ts"), "export const env = {};\n");
|
|
32
|
-
await write(
|
|
33
|
-
|
|
32
|
+
await write(
|
|
33
|
+
rootLayoutPath,
|
|
34
|
+
'export const theme = "dark";\nexport const fonts = [{ name: "pretendard" }];\nexport const metadata = { title: "Root" };\n',
|
|
35
|
+
);
|
|
36
|
+
await write(
|
|
37
|
+
groupedLayoutPath,
|
|
38
|
+
'export function generateMetadata() { return { title: "Home" }; }\nexport default function Layout({ children }) { return children; }\n',
|
|
39
|
+
);
|
|
34
40
|
|
|
35
41
|
const entries = await resolveSsrPageEntries({
|
|
36
42
|
appCwdPath: appRoot,
|
|
@@ -46,6 +52,15 @@ describe("resolveSsrPageEntries", () => {
|
|
|
46
52
|
const generatedSource = await Bun.file(groupedRoot?.moduleAbsPath ?? "").text();
|
|
47
53
|
expect(generatedSource).toContain('import * as inheritedLayout from "../../../page/_layout.tsx";');
|
|
48
54
|
expect(generatedSource).not.toContain("<System.Provider");
|
|
55
|
+
expect(generatedSource).toContain("export async function generateMetadata(props: PageProps)");
|
|
56
|
+
expect(generatedSource).toContain("if (userLayout.generateMetadata) return userLayout.generateMetadata(props);");
|
|
57
|
+
expect(generatedSource).toContain("if (userLayout.metadata !== undefined) return userLayout.metadata;");
|
|
58
|
+
expect(generatedSource).toContain(
|
|
59
|
+
"if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);",
|
|
60
|
+
);
|
|
61
|
+
expect(generatedSource).toContain("return inheritedLayout.metadata;");
|
|
62
|
+
expect(generatedSource).not.toContain("Object.keys(userLayout.metadata)");
|
|
63
|
+
expect(generatedSource).not.toContain("Object.keys(inheritedLayout.metadata)");
|
|
49
64
|
expect(generatedSource).toContain("export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;");
|
|
50
65
|
expect(generatedSource).toContain("export const Error = userLayout.Error ?? inheritedLayout.Error;");
|
|
51
66
|
expect(generatedSource).toContain(
|
|
@@ -179,6 +179,13 @@ export async function generateHead(props: PageProps) {
|
|
|
179
179
|
return inheritedLayout.head;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
export async function generateMetadata(props: PageProps) {
|
|
183
|
+
if (userLayout.generateMetadata) return userLayout.generateMetadata(props);
|
|
184
|
+
if (userLayout.metadata !== undefined) return userLayout.metadata;
|
|
185
|
+
if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);
|
|
186
|
+
return inheritedLayout.metadata;
|
|
187
|
+
}
|
|
188
|
+
|
|
182
189
|
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
183
190
|
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
184
191
|
|
|
@@ -213,6 +220,13 @@ export async function generateHead(props: PageProps) {
|
|
|
213
220
|
return inheritedLayout.head;
|
|
214
221
|
}
|
|
215
222
|
|
|
223
|
+
export async function generateMetadata(props: PageProps) {
|
|
224
|
+
if (userLayout.generateMetadata) return userLayout.generateMetadata(props);
|
|
225
|
+
if (userLayout.metadata !== undefined) return userLayout.metadata;
|
|
226
|
+
if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);
|
|
227
|
+
return inheritedLayout.metadata;
|
|
228
|
+
}
|
|
229
|
+
|
|
216
230
|
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
217
231
|
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
218
232
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@langchain/openai": "^1.4.6",
|
|
33
33
|
"@tailwindcss/node": "^4.3.0",
|
|
34
34
|
"@trapezedev/project": "^7.1.4",
|
|
35
|
-
"akanjs": "2.
|
|
35
|
+
"akanjs": "2.3.0",
|
|
36
36
|
"chalk": "^5.6.2",
|
|
37
37
|
"commander": "^14.0.3",
|
|
38
38
|
"daisyui": "^5.5.20",
|