create-plasmic-app 0.0.167 → 0.0.168
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/cpa-out/nextjs-app-codegen-js/app/dynamic/[slug]/page.jsx +5 -5
- package/cpa-out/nextjs-app-codegen-js/app/robots.js +24 -0
- package/cpa-out/nextjs-app-codegen-js/app/sitemap.js +38 -0
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.jsx +2 -2
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/nextjs-app-codegen-js/package.json +6 -6
- package/cpa-out/nextjs-app-codegen-js/plasmic.json +2 -6
- package/cpa-out/nextjs-app-codegen-ts/app/dynamic/[slug]/page.tsx +8 -11
- package/cpa-out/nextjs-app-codegen-ts/app/page.tsx +4 -4
- package/cpa-out/nextjs-app-codegen-ts/app/robots.ts +25 -0
- package/cpa-out/nextjs-app-codegen-ts/app/sitemap.ts +41 -0
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.tsx +7 -13
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepageServer.tsx +5 -11
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/nextjs-app-codegen-ts/package.json +6 -6
- package/cpa-out/nextjs-app-codegen-ts/plasmic.json +2 -6
- package/cpa-out/nextjs-app-loader-js/app/robots.js +24 -0
- package/cpa-out/nextjs-app-loader-js/app/sitemap.js +29 -0
- package/cpa-out/nextjs-app-loader-js/package.json +5 -5
- package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +1 -5
- package/cpa-out/nextjs-app-loader-ts/app/robots.ts +25 -0
- package/cpa-out/nextjs-app-loader-ts/app/sitemap.ts +30 -0
- package/cpa-out/nextjs-app-loader-ts/package.json +5 -5
- package/cpa-out/nextjs-pages-codegen-js/pages/robots.txt.js +25 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/sitemap.xml.js +53 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/robots.txt.ts +27 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/sitemap.xml.ts +56 -0
- package/cpa-out/nextjs-pages-loader-js/pages/robots.txt.js +25 -0
- package/cpa-out/nextjs-pages-loader-js/pages/sitemap.xml.js +46 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/robots.txt.ts +27 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/sitemap.xml.ts +47 -0
- package/dist/nextjs/nextjs.js +14 -0
- package/dist/nextjs/templates/app-seo.d.ts +4 -0
- package/dist/nextjs/templates/app-seo.js +92 -0
- package/dist/nextjs/templates/pages-seo.d.ts +4 -0
- package/dist/nextjs/templates/pages-seo.js +121 -0
- package/package.json +2 -2
- package/src/nextjs/nextjs.ts +46 -0
- package/src/nextjs/templates/app-seo.ts +104 -0
- package/src/nextjs/templates/pages-seo.ts +131 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
generateDynamicMetadata,
|
|
9
9
|
serverQueryTree
|
|
10
10
|
} from "../../../components/plasmic/create_plasmic_app/PlasmicDynamicPageServer";
|
|
11
|
-
import {
|
|
11
|
+
import { executePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
|
|
12
12
|
// Uncomment and populate to statically pre-render this route at build time.
|
|
13
13
|
// Each entry should be an object whose keys match the dynamic segments in the route path.
|
|
14
14
|
// See https://nextjs.org/docs/app/api-reference/functions/generate-static-params
|
|
@@ -23,10 +23,10 @@ const metadataQueryTree = { ...serverQueryTree, children: [] };
|
|
|
23
23
|
|
|
24
24
|
export async function generateMetadata({ params, searchParams }, parent) {
|
|
25
25
|
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
26
|
-
const { queries: $q } = await
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
26
|
+
const { queries: $q } = await executePlasmicQueries(metadataQueryTree, {
|
|
27
|
+
$props: {},
|
|
28
|
+
$ctx: ctx
|
|
29
|
+
});
|
|
30
30
|
const metadata = generateDynamicMetadata($q, ctx);
|
|
31
31
|
return { ...(await parent), ...metadata };
|
|
32
32
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { headers } from "next/headers";
|
|
2
|
+
|
|
3
|
+
// Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
|
|
4
|
+
// otherwise it is derived per-request, which opts the route out of prerendering.
|
|
5
|
+
async function getSiteUrl() {
|
|
6
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
7
|
+
return process.env.NEXT_PUBLIC_SITE_URL;
|
|
8
|
+
}
|
|
9
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
|
10
|
+
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
|
|
11
|
+
}
|
|
12
|
+
const h = await headers();
|
|
13
|
+
const proto = h.get("x-forwarded-proto") ?? "http";
|
|
14
|
+
return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default async function robots() {
|
|
18
|
+
const siteUrl = await getSiteUrl();
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
rules: { userAgent: "*", allow: "/" },
|
|
22
|
+
sitemap: new URL("/sitemap.xml", siteUrl).toString(),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { headers } from "next/headers";
|
|
2
|
+
import plasmicJson from "../plasmic.json";
|
|
3
|
+
|
|
4
|
+
// Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
|
|
5
|
+
// otherwise it is derived per-request, which opts the route out of prerendering.
|
|
6
|
+
async function getSiteUrl() {
|
|
7
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
8
|
+
return process.env.NEXT_PUBLIC_SITE_URL;
|
|
9
|
+
}
|
|
10
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
|
11
|
+
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
|
|
12
|
+
}
|
|
13
|
+
const h = await headers();
|
|
14
|
+
const proto = h.get("x-forwarded-proto") ?? "http";
|
|
15
|
+
return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default async function sitemap() {
|
|
19
|
+
const siteUrl = await getSiteUrl();
|
|
20
|
+
|
|
21
|
+
return plasmicJson.projects
|
|
22
|
+
.flatMap((project) => project.components)
|
|
23
|
+
.flatMap((component) =>
|
|
24
|
+
component.componentType === "page" &&
|
|
25
|
+
component.path &&
|
|
26
|
+
!component.path.includes("[")
|
|
27
|
+
? [
|
|
28
|
+
{
|
|
29
|
+
// next.config sets trailingSlash.
|
|
30
|
+
url: new URL(
|
|
31
|
+
component.path.replace(/\/?$/, "/"),
|
|
32
|
+
siteUrl
|
|
33
|
+
).toString(),
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
: []
|
|
37
|
+
);
|
|
38
|
+
}
|
package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
deriveRenderOpts
|
|
19
19
|
} from "@plasmicapp/react-web";
|
|
20
20
|
import { useDataEnv } from "@plasmicapp/host";
|
|
21
|
-
import {
|
|
21
|
+
import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
|
|
22
22
|
import { generateDynamicMetadata } from "./PlasmicDynamicPageServer"; // plasmic-import: AO44A-w7hh/rscServer
|
|
23
23
|
import RandomDynamicPageButton from "../../RandomDynamicPageButton"; // plasmic-import: Q23H1_1M_P/component
|
|
24
24
|
import { _useStyleTokens } from "./PlasmicStyleTokensProvider"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/styleTokensProvider
|
|
@@ -107,7 +107,7 @@ function PlasmicDynamicPage__RenderFunc(props) {
|
|
|
107
107
|
const $ctx = useDataEnv?.() || {};
|
|
108
108
|
const refsRef = React.useRef({});
|
|
109
109
|
const $refs = refsRef.current;
|
|
110
|
-
const $q =
|
|
110
|
+
const $q = usePlasmicQueries(pageQueryTree, { $ctx, $props, $state: null });
|
|
111
111
|
const pageMetadata = generateDynamicMetadata(
|
|
112
112
|
wrapQueriesWithLoadingProxy($q),
|
|
113
113
|
$ctx
|
|
@@ -9,7 +9,7 @@ import * as React from "react";
|
|
|
9
9
|
import { ClientDynamicPage } from "../../../app/dynamic/[slug]/page-client"; // plasmic-import: AO44A-w7hh/rscClient
|
|
10
10
|
|
|
11
11
|
const $$ = {};
|
|
12
|
-
import {
|
|
12
|
+
import { executePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
|
|
13
13
|
import { PlasmicQueryDataProvider } from "@plasmicapp/react-web/lib/query";
|
|
14
14
|
|
|
15
15
|
export function generateDynamicMetadata($q, $ctx) {
|
|
@@ -145,7 +145,7 @@ export async function makeAppRouterPageCtx({ params, searchParams }) {
|
|
|
145
145
|
export async function PlasmicDynamicPageServer(props) {
|
|
146
146
|
const { params, searchParams, ...rest } = props;
|
|
147
147
|
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
148
|
-
const { cache: prefetchedCache } = await
|
|
148
|
+
const { cache: prefetchedCache } = await executePlasmicQueries(
|
|
149
149
|
serverQueryTree,
|
|
150
150
|
{ $props: rest, $ctx: ctx }
|
|
151
151
|
);
|
|
@@ -323,6 +323,22 @@
|
|
|
323
323
|
text-transform: inherit;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
:where(.b) {
|
|
327
|
+
font-family: inherit;
|
|
328
|
+
line-height: inherit;
|
|
329
|
+
font-size: inherit;
|
|
330
|
+
color: inherit;
|
|
331
|
+
text-transform: inherit;
|
|
332
|
+
}
|
|
333
|
+
:where(.__wab_expr_html_text b) {
|
|
334
|
+
white-space: inherit;
|
|
335
|
+
font-family: inherit;
|
|
336
|
+
line-height: inherit;
|
|
337
|
+
font-size: inherit;
|
|
338
|
+
color: inherit;
|
|
339
|
+
text-transform: inherit;
|
|
340
|
+
}
|
|
341
|
+
|
|
326
342
|
:where(.i) {
|
|
327
343
|
font-family: inherit;
|
|
328
344
|
line-height: inherit;
|
|
@@ -186,6 +186,22 @@
|
|
|
186
186
|
text-transform: inherit;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
:where(.b) {
|
|
190
|
+
font-family: inherit;
|
|
191
|
+
line-height: inherit;
|
|
192
|
+
font-size: inherit;
|
|
193
|
+
color: inherit;
|
|
194
|
+
text-transform: inherit;
|
|
195
|
+
}
|
|
196
|
+
:where(.__wab_expr_html_text b) {
|
|
197
|
+
white-space: inherit;
|
|
198
|
+
font-family: inherit;
|
|
199
|
+
line-height: inherit;
|
|
200
|
+
font-size: inherit;
|
|
201
|
+
color: inherit;
|
|
202
|
+
text-transform: inherit;
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
:where(.i) {
|
|
190
206
|
font-family: inherit;
|
|
191
207
|
line-height: inherit;
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"lint": "eslint"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@plasmicapp/cli": "^0.1.
|
|
13
|
-
"@plasmicapp/react-web": "^1.0.
|
|
14
|
-
"next": "16.
|
|
15
|
-
"react": "19.2.
|
|
16
|
-
"react-dom": "19.2.
|
|
12
|
+
"@plasmicapp/cli": "^0.1.372",
|
|
13
|
+
"@plasmicapp/react-web": "^1.0.32",
|
|
14
|
+
"next": "16.3.1",
|
|
15
|
+
"react": "19.2.8",
|
|
16
|
+
"react-dom": "19.2.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"eslint": "^9",
|
|
20
|
-
"eslint-config-next": "16.
|
|
20
|
+
"eslint-config-next": "16.3.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -14,10 +14,6 @@
|
|
|
14
14
|
"publicDir": "../public",
|
|
15
15
|
"publicUrlPrefix": "/"
|
|
16
16
|
},
|
|
17
|
-
"tokens": {
|
|
18
|
-
"scheme": "theo",
|
|
19
|
-
"tokensFilePath": "plasmic-tokens.theo.json"
|
|
20
|
-
},
|
|
21
17
|
"srcDir": "components",
|
|
22
18
|
"defaultPlasmicDir": "./plasmic",
|
|
23
19
|
"projects": [
|
|
@@ -143,6 +139,6 @@
|
|
|
143
139
|
"nextjsConfig": {
|
|
144
140
|
"pagesDir": "../app"
|
|
145
141
|
},
|
|
146
|
-
"cliVersion": "0.1.
|
|
147
|
-
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.
|
|
142
|
+
"cliVersion": "0.1.372",
|
|
143
|
+
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.372/dist/plasmic.schema.json"
|
|
148
144
|
}
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
PlasmicDynamicPageServer,
|
|
8
8
|
makeAppRouterPageCtx,
|
|
9
9
|
generateDynamicMetadata,
|
|
10
|
-
DynamicPageServerSkeletonProps,
|
|
11
10
|
serverQueryTree
|
|
12
11
|
} from "../../../components/plasmic/create_plasmic_app/PlasmicDynamicPageServer";
|
|
13
12
|
import type { Metadata, ResolvingMetadata } from "next";
|
|
14
|
-
import {
|
|
13
|
+
import type { PlasmicPageProps } from "@plasmicapp/react-web";
|
|
14
|
+
import { executePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
|
|
15
15
|
|
|
16
16
|
// Uncomment and populate to statically pre-render this route at build time.
|
|
17
17
|
// Each entry should be an object whose keys match the dynamic segments in the route path.
|
|
@@ -26,23 +26,20 @@ const $$ = {};
|
|
|
26
26
|
const metadataQueryTree = { ...serverQueryTree, children: [] };
|
|
27
27
|
|
|
28
28
|
export async function generateMetadata(
|
|
29
|
-
{ params, searchParams }:
|
|
29
|
+
{ params, searchParams }: PlasmicPageProps,
|
|
30
30
|
parent: ResolvingMetadata
|
|
31
31
|
): Promise<Metadata> {
|
|
32
32
|
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
33
|
-
const { queries: $q } = await
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
33
|
+
const { queries: $q } = await executePlasmicQueries(metadataQueryTree, {
|
|
34
|
+
$props: {},
|
|
35
|
+
$ctx: ctx
|
|
36
|
+
});
|
|
37
37
|
const metadata = generateDynamicMetadata($q, ctx);
|
|
38
38
|
|
|
39
39
|
return { ...(await parent), ...metadata } as unknown as Metadata;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
async function DynamicPage({
|
|
43
|
-
params,
|
|
44
|
-
searchParams
|
|
45
|
-
}: DynamicPageServerSkeletonProps) {
|
|
42
|
+
async function DynamicPage({ params, searchParams }: PlasmicPageProps) {
|
|
46
43
|
// Use PlasmicDynamicPage to render this component as it was
|
|
47
44
|
// designed in Plasmic, by activating the appropriate variants,
|
|
48
45
|
// attaching the appropriate event handlers, etc. You
|
|
@@ -6,13 +6,13 @@ import { PageParamsProvider as PageParamsProvider__ } from "@plasmicapp/host";
|
|
|
6
6
|
import {
|
|
7
7
|
PlasmicHomepageServer,
|
|
8
8
|
makeAppRouterPageCtx,
|
|
9
|
-
generateDynamicMetadata
|
|
10
|
-
HomepageServerSkeletonProps
|
|
9
|
+
generateDynamicMetadata
|
|
11
10
|
} from "../components/plasmic/create_plasmic_app/PlasmicHomepageServer";
|
|
12
11
|
import type { Metadata, ResolvingMetadata } from "next";
|
|
12
|
+
import type { PlasmicPageProps } from "@plasmicapp/react-web";
|
|
13
13
|
|
|
14
14
|
export async function generateMetadata(
|
|
15
|
-
{ params, searchParams }:
|
|
15
|
+
{ params, searchParams }: PlasmicPageProps,
|
|
16
16
|
parent: ResolvingMetadata
|
|
17
17
|
): Promise<Metadata> {
|
|
18
18
|
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
@@ -21,7 +21,7 @@ export async function generateMetadata(
|
|
|
21
21
|
return { ...(await parent), ...metadata } as unknown as Metadata;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async function Homepage({ params, searchParams }:
|
|
24
|
+
async function Homepage({ params, searchParams }: PlasmicPageProps) {
|
|
25
25
|
// Use PlasmicHomepage to render this component as it was
|
|
26
26
|
// designed in Plasmic, by activating the appropriate variants,
|
|
27
27
|
// attaching the appropriate event handlers, etc. You
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MetadataRoute } from "next";
|
|
2
|
+
import { headers } from "next/headers";
|
|
3
|
+
|
|
4
|
+
// Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
|
|
5
|
+
// otherwise it is derived per-request, which opts the route out of prerendering.
|
|
6
|
+
async function getSiteUrl() {
|
|
7
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
8
|
+
return process.env.NEXT_PUBLIC_SITE_URL;
|
|
9
|
+
}
|
|
10
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
|
11
|
+
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
|
|
12
|
+
}
|
|
13
|
+
const h = await headers();
|
|
14
|
+
const proto = h.get("x-forwarded-proto") ?? "http";
|
|
15
|
+
return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default async function robots(): Promise<MetadataRoute.Robots> {
|
|
19
|
+
const siteUrl = await getSiteUrl();
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
rules: { userAgent: "*", allow: "/" },
|
|
23
|
+
sitemap: new URL("/sitemap.xml", siteUrl).toString(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MetadataRoute } from "next";
|
|
2
|
+
import { headers } from "next/headers";
|
|
3
|
+
import plasmicJson from "../plasmic.json";
|
|
4
|
+
|
|
5
|
+
// Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
|
|
6
|
+
// otherwise it is derived per-request, which opts the route out of prerendering.
|
|
7
|
+
async function getSiteUrl() {
|
|
8
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
9
|
+
return process.env.NEXT_PUBLIC_SITE_URL;
|
|
10
|
+
}
|
|
11
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
|
12
|
+
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
|
|
13
|
+
}
|
|
14
|
+
const h = await headers();
|
|
15
|
+
const proto = h.get("x-forwarded-proto") ?? "http";
|
|
16
|
+
return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
20
|
+
const siteUrl = await getSiteUrl();
|
|
21
|
+
|
|
22
|
+
return (plasmicJson.projects as {
|
|
23
|
+
components: { componentType: string; path?: string }[];
|
|
24
|
+
}[])
|
|
25
|
+
.flatMap((project) => project.components)
|
|
26
|
+
.flatMap((component) =>
|
|
27
|
+
component.componentType === "page" &&
|
|
28
|
+
component.path &&
|
|
29
|
+
!component.path.includes("[")
|
|
30
|
+
? [
|
|
31
|
+
{
|
|
32
|
+
// next.config sets trailingSlash.
|
|
33
|
+
url: new URL(
|
|
34
|
+
component.path.replace(/\/?$/, "/"),
|
|
35
|
+
siteUrl
|
|
36
|
+
).toString(),
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
: []
|
|
40
|
+
);
|
|
41
|
+
}
|
package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx
CHANGED
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
useGlobalActions
|
|
62
62
|
} from "@plasmicapp/host";
|
|
63
63
|
|
|
64
|
-
import {
|
|
64
|
+
import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
|
|
65
65
|
|
|
66
66
|
import type { QueryComponentNode } from "@plasmicapp/react-web/lib/data-sources";
|
|
67
67
|
import { generateDynamicMetadata, PageCtx } from "./PlasmicDynamicPageServer"; // plasmic-import: AO44A-w7hh/rscServer
|
|
@@ -181,7 +181,7 @@ function PlasmicDynamicPage__RenderFunc(props: {
|
|
|
181
181
|
const refsRef = React.useRef({});
|
|
182
182
|
const $refs = refsRef.current;
|
|
183
183
|
|
|
184
|
-
const $q =
|
|
184
|
+
const $q = usePlasmicQueries(pageQueryTree, { $ctx, $props, $state: null });
|
|
185
185
|
|
|
186
186
|
const pageMetadata = generateDynamicMetadata(
|
|
187
187
|
wrapQueriesWithLoadingProxy($q),
|
|
@@ -14,7 +14,7 @@ import { ClientDynamicPage } from "../../../app/dynamic/[slug]/page-client"; //
|
|
|
14
14
|
|
|
15
15
|
const $$ = {};
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { executePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
|
|
18
18
|
import type {
|
|
19
19
|
PlasmicQuery,
|
|
20
20
|
PlasmicQueryResult
|
|
@@ -125,10 +125,9 @@ export const serverQueryTree: QueryComponentNode = {
|
|
|
125
125
|
]
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
) {
|
|
128
|
+
import type { ParamsRecord, PlasmicPageProps } from "@plasmicapp/react-web";
|
|
129
|
+
|
|
130
|
+
function mkPathFromRouteAndParams(route: string, params: ParamsRecord) {
|
|
132
131
|
if (!params) {
|
|
133
132
|
return route;
|
|
134
133
|
}
|
|
@@ -147,15 +146,10 @@ function mkPathFromRouteAndParams(
|
|
|
147
146
|
return path;
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
export interface DynamicPageServerSkeletonProps {
|
|
151
|
-
params?: Promise<Record<string, string | string[] | undefined>>;
|
|
152
|
-
searchParams?: Promise<Record<string, string | string[] | undefined>>;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
149
|
export async function makeAppRouterPageCtx({
|
|
156
150
|
params,
|
|
157
151
|
searchParams
|
|
158
|
-
}:
|
|
152
|
+
}: PlasmicPageProps) {
|
|
159
153
|
const pageRoute = "/dynamic/[slug]";
|
|
160
154
|
const pageParams = (await params) ?? {};
|
|
161
155
|
const pagePath = mkPathFromRouteAndParams(pageRoute, pageParams);
|
|
@@ -170,14 +164,14 @@ export async function makeAppRouterPageCtx({
|
|
|
170
164
|
}
|
|
171
165
|
|
|
172
166
|
export type PlasmicDynamicPageServerProps = DefaultDynamicPageProps &
|
|
173
|
-
|
|
167
|
+
PlasmicPageProps;
|
|
174
168
|
|
|
175
169
|
export async function PlasmicDynamicPageServer(
|
|
176
170
|
props: PlasmicDynamicPageServerProps
|
|
177
171
|
) {
|
|
178
172
|
const { params, searchParams, ...rest } = props;
|
|
179
173
|
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
180
|
-
const { cache: prefetchedCache } = await
|
|
174
|
+
const { cache: prefetchedCache } = await executePlasmicQueries(
|
|
181
175
|
serverQueryTree,
|
|
182
176
|
{ $props: rest, $ctx: ctx }
|
|
183
177
|
);
|
|
@@ -30,10 +30,9 @@ export function generateDynamicMetadata($q: any, $ctx: PageCtx) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
) {
|
|
33
|
+
import type { ParamsRecord, PlasmicPageProps } from "@plasmicapp/react-web";
|
|
34
|
+
|
|
35
|
+
function mkPathFromRouteAndParams(route: string, params: ParamsRecord) {
|
|
37
36
|
if (!params) {
|
|
38
37
|
return route;
|
|
39
38
|
}
|
|
@@ -52,15 +51,10 @@ function mkPathFromRouteAndParams(
|
|
|
52
51
|
return path;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export interface HomepageServerSkeletonProps {
|
|
56
|
-
params?: Promise<Record<string, string | string[] | undefined>>;
|
|
57
|
-
searchParams?: Promise<Record<string, string | string[] | undefined>>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
54
|
export async function makeAppRouterPageCtx({
|
|
61
55
|
params,
|
|
62
56
|
searchParams
|
|
63
|
-
}:
|
|
57
|
+
}: PlasmicPageProps) {
|
|
64
58
|
const pageRoute = "/";
|
|
65
59
|
const pageParams = (await params) ?? {};
|
|
66
60
|
const pagePath = mkPathFromRouteAndParams(pageRoute, pageParams);
|
|
@@ -75,7 +69,7 @@ export async function makeAppRouterPageCtx({
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
export type PlasmicHomepageServerProps = DefaultHomepageProps &
|
|
78
|
-
|
|
72
|
+
PlasmicPageProps;
|
|
79
73
|
|
|
80
74
|
export function PlasmicHomepageServer(props: PlasmicHomepageServerProps) {
|
|
81
75
|
return <ClientHomepage {...props} />;
|
|
@@ -323,6 +323,22 @@
|
|
|
323
323
|
text-transform: inherit;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
:where(.b) {
|
|
327
|
+
font-family: inherit;
|
|
328
|
+
line-height: inherit;
|
|
329
|
+
font-size: inherit;
|
|
330
|
+
color: inherit;
|
|
331
|
+
text-transform: inherit;
|
|
332
|
+
}
|
|
333
|
+
:where(.__wab_expr_html_text b) {
|
|
334
|
+
white-space: inherit;
|
|
335
|
+
font-family: inherit;
|
|
336
|
+
line-height: inherit;
|
|
337
|
+
font-size: inherit;
|
|
338
|
+
color: inherit;
|
|
339
|
+
text-transform: inherit;
|
|
340
|
+
}
|
|
341
|
+
|
|
326
342
|
:where(.i) {
|
|
327
343
|
font-family: inherit;
|
|
328
344
|
line-height: inherit;
|
|
@@ -186,6 +186,22 @@
|
|
|
186
186
|
text-transform: inherit;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
:where(.b) {
|
|
190
|
+
font-family: inherit;
|
|
191
|
+
line-height: inherit;
|
|
192
|
+
font-size: inherit;
|
|
193
|
+
color: inherit;
|
|
194
|
+
text-transform: inherit;
|
|
195
|
+
}
|
|
196
|
+
:where(.__wab_expr_html_text b) {
|
|
197
|
+
white-space: inherit;
|
|
198
|
+
font-family: inherit;
|
|
199
|
+
line-height: inherit;
|
|
200
|
+
font-size: inherit;
|
|
201
|
+
color: inherit;
|
|
202
|
+
text-transform: inherit;
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
:where(.i) {
|
|
190
206
|
font-family: inherit;
|
|
191
207
|
line-height: inherit;
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
"lint": "eslint"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@plasmicapp/cli": "^0.1.
|
|
13
|
-
"@plasmicapp/react-web": "^1.0.
|
|
14
|
-
"next": "16.
|
|
15
|
-
"react": "19.2.
|
|
16
|
-
"react-dom": "19.2.
|
|
12
|
+
"@plasmicapp/cli": "^0.1.372",
|
|
13
|
+
"@plasmicapp/react-web": "^1.0.32",
|
|
14
|
+
"next": "16.3.1",
|
|
15
|
+
"react": "19.2.8",
|
|
16
|
+
"react-dom": "19.2.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/node": "^20",
|
|
20
20
|
"@types/react": "^19",
|
|
21
21
|
"@types/react-dom": "^19",
|
|
22
22
|
"eslint": "^9",
|
|
23
|
-
"eslint-config-next": "16.
|
|
23
|
+
"eslint-config-next": "16.3.1",
|
|
24
24
|
"typescript": "^5"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -14,10 +14,6 @@
|
|
|
14
14
|
"publicDir": "../public",
|
|
15
15
|
"publicUrlPrefix": "/"
|
|
16
16
|
},
|
|
17
|
-
"tokens": {
|
|
18
|
-
"scheme": "theo",
|
|
19
|
-
"tokensFilePath": "plasmic-tokens.theo.json"
|
|
20
|
-
},
|
|
21
17
|
"srcDir": "components",
|
|
22
18
|
"defaultPlasmicDir": "./plasmic",
|
|
23
19
|
"projects": [
|
|
@@ -143,6 +139,6 @@
|
|
|
143
139
|
"nextjsConfig": {
|
|
144
140
|
"pagesDir": "../app"
|
|
145
141
|
},
|
|
146
|
-
"cliVersion": "0.1.
|
|
147
|
-
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.
|
|
142
|
+
"cliVersion": "0.1.372",
|
|
143
|
+
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.372/dist/plasmic.schema.json"
|
|
148
144
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { headers } from "next/headers";
|
|
2
|
+
|
|
3
|
+
// Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
|
|
4
|
+
// otherwise it is derived per-request, which opts the route out of prerendering.
|
|
5
|
+
async function getSiteUrl() {
|
|
6
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
7
|
+
return process.env.NEXT_PUBLIC_SITE_URL;
|
|
8
|
+
}
|
|
9
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
|
10
|
+
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
|
|
11
|
+
}
|
|
12
|
+
const h = await headers();
|
|
13
|
+
const proto = h.get("x-forwarded-proto") ?? "http";
|
|
14
|
+
return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default async function robots() {
|
|
18
|
+
const siteUrl = await getSiteUrl();
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
rules: { userAgent: "*", allow: "/" },
|
|
22
|
+
sitemap: new URL("/sitemap.xml", siteUrl).toString(),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PLASMIC } from "@/plasmic-init";
|
|
2
|
+
import { headers } from "next/headers";
|
|
3
|
+
|
|
4
|
+
export const revalidate = 60;
|
|
5
|
+
|
|
6
|
+
// Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
|
|
7
|
+
// otherwise it is derived per-request, which opts the route out of prerendering.
|
|
8
|
+
async function getSiteUrl() {
|
|
9
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
10
|
+
return process.env.NEXT_PUBLIC_SITE_URL;
|
|
11
|
+
}
|
|
12
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
|
13
|
+
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
|
|
14
|
+
}
|
|
15
|
+
const h = await headers();
|
|
16
|
+
const proto = h.get("x-forwarded-proto") ?? "http";
|
|
17
|
+
return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default async function sitemap() {
|
|
21
|
+
const siteUrl = await getSiteUrl();
|
|
22
|
+
|
|
23
|
+
// fetchPages() drops pages whose path takes a param, e.g. "/blog/[slug]".
|
|
24
|
+
const pages = await PLASMIC.fetchPages();
|
|
25
|
+
|
|
26
|
+
return pages.map((page) => ({
|
|
27
|
+
url: new URL(page.path, siteUrl).toString(),
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"lint": "eslint"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@plasmicapp/loader-nextjs": "^2.0.
|
|
13
|
-
"next": "16.
|
|
14
|
-
"react": "19.2.
|
|
15
|
-
"react-dom": "19.2.
|
|
12
|
+
"@plasmicapp/loader-nextjs": "^2.0.23",
|
|
13
|
+
"next": "16.3.1",
|
|
14
|
+
"react": "19.2.8",
|
|
15
|
+
"react-dom": "19.2.8"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"eslint": "^9",
|
|
19
|
-
"eslint-config-next": "16.
|
|
19
|
+
"eslint-config-next": "16.3.1"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -17,11 +17,7 @@ export const metadata: Metadata = {
|
|
|
17
17
|
description: "Generated by create next app",
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export default function RootLayout({
|
|
21
|
-
children,
|
|
22
|
-
}: Readonly<{
|
|
23
|
-
children: React.ReactNode;
|
|
24
|
-
}>) {
|
|
20
|
+
export default function RootLayout({ children }: LayoutProps<"/">) {
|
|
25
21
|
return (
|
|
26
22
|
<html lang="en" className={`${geistSans.variable} ${geistMono.variable}`}>
|
|
27
23
|
<body>{children}</body>
|