create-plasmic-app 0.0.143 → 0.0.145
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/gatsby-codegen-js/package.json +2 -2
- package/cpa-out/gatsby-codegen-js/plasmic.json +2 -2
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +1 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +7 -2
- package/cpa-out/gatsby-codegen-ts/package.json +2 -2
- package/cpa-out/gatsby-codegen-ts/plasmic.json +2 -2
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +1 -0
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +1 -0
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -2
- package/cpa-out/gatsby-loader-js/gatsby-config.js +25 -21
- package/cpa-out/gatsby-loader-js/gatsby-node.js +58 -0
- package/cpa-out/gatsby-loader-js/package.json +1 -1
- package/cpa-out/gatsby-loader-js/src/plasmic-init.js +4 -4
- package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +2 -1
- package/cpa-out/gatsby-loader-ts/gatsby-config.ts +20 -22
- package/cpa-out/gatsby-loader-ts/gatsby-node.ts +61 -0
- package/cpa-out/gatsby-loader-ts/package.json +1 -1
- package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +6 -2
- package/cpa-out/nextjs-app-codegen-js/app/dynamic/[slug]/page.jsx +11 -3
- package/cpa-out/nextjs-app-codegen-js/app/layout.jsx +3 -4
- package/cpa-out/nextjs-app-codegen-js/app/page.jsx +4 -3
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +1 -0
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -0
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.jsx +1 -1
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +7 -2
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepageServer.jsx +1 -1
- package/cpa-out/nextjs-app-codegen-js/package.json +2 -2
- package/cpa-out/nextjs-app-codegen-js/plasmic-init-client.jsx +0 -1
- package/cpa-out/nextjs-app-codegen-js/plasmic.json +2 -2
- package/cpa-out/nextjs-app-codegen-ts/app/dynamic/[slug]/page.tsx +12 -4
- package/cpa-out/nextjs-app-codegen-ts/app/layout.tsx +3 -4
- package/cpa-out/nextjs-app-codegen-ts/app/page.tsx +4 -4
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +1 -0
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +1 -0
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.tsx +1 -1
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -2
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepageServer.tsx +1 -1
- package/cpa-out/nextjs-app-codegen-ts/package.json +2 -2
- package/cpa-out/nextjs-app-codegen-ts/plasmic-init-client.tsx +1 -1
- package/cpa-out/nextjs-app-codegen-ts/plasmic.json +2 -2
- package/cpa-out/nextjs-app-loader-js/package.json +1 -1
- package/cpa-out/nextjs-app-loader-js/plasmic-init.js +5 -0
- package/cpa-out/nextjs-app-loader-ts/package.json +1 -1
- package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +5 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +1 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +7 -2
- package/cpa-out/nextjs-pages-codegen-js/package.json +2 -2
- package/cpa-out/nextjs-pages-codegen-js/plasmic.json +2 -2
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +1 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +1 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -2
- package/cpa-out/nextjs-pages-codegen-ts/package.json +2 -2
- package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +2 -2
- package/cpa-out/nextjs-pages-loader-js/package.json +1 -1
- package/cpa-out/nextjs-pages-loader-ts/package.json +1 -1
- package/cpa-out/react-codegen-js/package.json +2 -2
- package/cpa-out/react-codegen-js/plasmic.json +2 -2
- package/cpa-out/react-codegen-ts/package.json +2 -2
- package/cpa-out/react-codegen-ts/plasmic.json +2 -2
- package/cpa-out/tanstack-codegen-ts/package.json +7 -8
- package/cpa-out/tanstack-codegen-ts/plasmic.json +2 -2
- package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +1 -5
- package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +1 -2
- package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -5
- package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +2 -0
- package/cpa-out/tanstack-codegen-ts/src/router.tsx +0 -1
- package/cpa-out/tanstack-codegen-ts/tsconfig.json +0 -1
- package/cpa-out/tanstack-codegen-ts/vite.config.ts +1 -2
- package/dist/gatsby/gatsby.js +4 -67
- package/dist/gatsby/template.d.ts +2 -1
- package/dist/gatsby/template.js +122 -25
- package/dist/nextjs/nextjs.js +2 -0
- package/dist/nextjs/templates/app-codegen/plasmic-init-client.js +1 -2
- package/dist/tanstack/tanstack.js +11 -1
- package/package.json +2 -2
- package/src/gatsby/gatsby.ts +16 -28
- package/src/gatsby/template.ts +139 -29
- package/src/nextjs/nextjs.ts +3 -0
- package/src/nextjs/templates/app-codegen/plasmic-init-client.ts +4 -2
- package/src/tanstack/tanstack.ts +11 -1
- package/cpa-out/nextjs-app-codegen-js/app/layout.js +0 -28
- package/cpa-out/tanstack-codegen-ts/src/components/Footer.tsx +0 -44
- package/cpa-out/tanstack-codegen-ts/src/components/Header.tsx +0 -78
- package/cpa-out/tanstack-codegen-ts/src/components/ThemeToggle.tsx +0 -81
- /package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/{PlasmicIcon__Checksvg.jsx → PlasmicIcon__CheckSvg.jsx} +0 -0
- /package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/{PlasmicIcon__Checksvg.tsx → PlasmicIcon__CheckSvg.tsx} +0 -0
- /package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/{PlasmicIcon__Checksvg.jsx → PlasmicIcon__CheckSvg.jsx} +0 -0
- /package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/{PlasmicIcon__Checksvg.tsx → PlasmicIcon__CheckSvg.tsx} +0 -0
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"clean": "gatsby clean"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@plasmicapp/cli": "^0.1.
|
|
18
|
-
"@plasmicapp/react-web": "^0.
|
|
17
|
+
"@plasmicapp/cli": "^0.1.361",
|
|
18
|
+
"@plasmicapp/react-web": "^1.0.6",
|
|
19
19
|
"gatsby": "^5.14.6",
|
|
20
20
|
"gatsby-plugin-react-helmet": "^6.16.0",
|
|
21
21
|
"react": "^18.2.0",
|
|
@@ -135,6 +135,6 @@
|
|
|
135
135
|
"gatsbyConfig": {
|
|
136
136
|
"pagesDir": "../pages"
|
|
137
137
|
},
|
|
138
|
-
"cliVersion": "0.1.
|
|
139
|
-
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.
|
|
138
|
+
"cliVersion": "0.1.361",
|
|
139
|
+
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.361/dist/plasmic.schema.json"
|
|
140
140
|
}
|
package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx
CHANGED
|
@@ -114,6 +114,7 @@ function PlasmicHomepage__RenderFunc(props) {
|
|
|
114
114
|
className={classNames(
|
|
115
115
|
projectcss.all,
|
|
116
116
|
projectcss.h1,
|
|
117
|
+
projectcss.h1__47tFX,
|
|
117
118
|
projectcss.__wab_text,
|
|
118
119
|
sty.h1
|
|
119
120
|
)}
|
|
@@ -137,7 +138,9 @@ function PlasmicHomepage__RenderFunc(props) {
|
|
|
137
138
|
}
|
|
138
139
|
</React.Fragment>
|
|
139
140
|
<span
|
|
140
|
-
className={
|
|
141
|
+
className={
|
|
142
|
+
"plasmic_default__all plasmic_default__span plasmic_default__span__47tFX"
|
|
143
|
+
}
|
|
141
144
|
style={{ fontWeight: 700 }}
|
|
142
145
|
>
|
|
143
146
|
{"Therefore, please avoid changing this project."}
|
|
@@ -151,7 +154,9 @@ function PlasmicHomepage__RenderFunc(props) {
|
|
|
151
154
|
}
|
|
152
155
|
</React.Fragment>
|
|
153
156
|
<span
|
|
154
|
-
className={
|
|
157
|
+
className={
|
|
158
|
+
"plasmic_default__all plasmic_default__span plasmic_default__span__47tFX"
|
|
159
|
+
}
|
|
155
160
|
style={{ fontWeight: 700 }}
|
|
156
161
|
>
|
|
157
162
|
{"Code"}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@plasmicapp/cli": "^0.1.
|
|
19
|
-
"@plasmicapp/react-web": "^0.
|
|
18
|
+
"@plasmicapp/cli": "^0.1.361",
|
|
19
|
+
"@plasmicapp/react-web": "^1.0.6",
|
|
20
20
|
"gatsby": "^5.14.6",
|
|
21
21
|
"gatsby-plugin-react-helmet": "^6.16.0",
|
|
22
22
|
"react": "^18.2.0",
|
|
@@ -135,6 +135,6 @@
|
|
|
135
135
|
"gatsbyConfig": {
|
|
136
136
|
"pagesDir": "../pages"
|
|
137
137
|
},
|
|
138
|
-
"cliVersion": "0.1.
|
|
139
|
-
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.
|
|
138
|
+
"cliVersion": "0.1.361",
|
|
139
|
+
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.361/dist/plasmic.schema.json"
|
|
140
140
|
}
|
package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx
CHANGED
|
@@ -197,6 +197,7 @@ function PlasmicHomepage__RenderFunc(props: {
|
|
|
197
197
|
className={classNames(
|
|
198
198
|
projectcss.all,
|
|
199
199
|
projectcss.h1,
|
|
200
|
+
projectcss.h1__47tFX,
|
|
200
201
|
projectcss.__wab_text,
|
|
201
202
|
sty.h1
|
|
202
203
|
)}
|
|
@@ -220,7 +221,9 @@ function PlasmicHomepage__RenderFunc(props: {
|
|
|
220
221
|
}
|
|
221
222
|
</React.Fragment>
|
|
222
223
|
<span
|
|
223
|
-
className={
|
|
224
|
+
className={
|
|
225
|
+
"plasmic_default__all plasmic_default__span plasmic_default__span__47tFX"
|
|
226
|
+
}
|
|
224
227
|
style={{ fontWeight: 700 }}
|
|
225
228
|
>
|
|
226
229
|
{"Therefore, please avoid changing this project."}
|
|
@@ -234,7 +237,9 @@ function PlasmicHomepage__RenderFunc(props: {
|
|
|
234
237
|
}
|
|
235
238
|
</React.Fragment>
|
|
236
239
|
<span
|
|
237
|
-
className={
|
|
240
|
+
className={
|
|
241
|
+
"plasmic_default__all plasmic_default__span plasmic_default__span__47tFX"
|
|
242
|
+
}
|
|
238
243
|
style={{ fontWeight: 700 }}
|
|
239
244
|
>
|
|
240
245
|
{"Code"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
/** @type {import("gatsby").GatsbyConfig} */
|
|
4
|
+
const config = {
|
|
5
5
|
siteMetadata: {
|
|
6
6
|
siteUrl: `https://www.yourdomain.tld`,
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
graphqlTypegen: true,
|
|
9
|
+
plugins: [
|
|
10
|
+
{
|
|
11
|
+
resolve: "@plasmicapp/loader-gatsby",
|
|
12
|
+
options: {
|
|
13
|
+
projects: [
|
|
14
|
+
{
|
|
15
|
+
id: "47tFXWjN2C4NyHFGGpaYQ3",
|
|
16
|
+
token: "7BRFratDxPLMGZHnd2grV5QP6mlHcZ1AK3BJSIeh7xzUlHgWh25XpgXvUaKAqHXFMXQQuzpADqboibF6nqNWQ",
|
|
17
|
+
},
|
|
18
|
+
], // An array of project ids.
|
|
19
|
+
preview: false,
|
|
20
|
+
defaultPlasmicPage: path.resolve("./src/templates/defaultPlasmicPage.jsx"),
|
|
15
21
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]
|
|
25
|
-
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
resolve: "gatsby-plugin-react-helmet",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports = config;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implement Gatsby's Node APIs in this file.
|
|
3
|
+
*
|
|
4
|
+
* See: https://www.gatsbyjs.com/docs/node-apis/
|
|
5
|
+
*
|
|
6
|
+
* `onCreatePage` runs `extractPlasmicQueryData` at build time so that the
|
|
7
|
+
* SSG'd HTML for each Plasmic page contains its actual rendered content,
|
|
8
|
+
* rather than the `<Suspense fallback>` ("Loading...") of unresolved data
|
|
9
|
+
* queries.
|
|
10
|
+
*/
|
|
11
|
+
const React = require("react");
|
|
12
|
+
const {
|
|
13
|
+
extractPlasmicQueryData,
|
|
14
|
+
PlasmicComponent,
|
|
15
|
+
PlasmicRootProvider,
|
|
16
|
+
} = require("@plasmicapp/loader-gatsby");
|
|
17
|
+
const gatsbyConfig = require("./gatsby-config");
|
|
18
|
+
const { initPlasmicLoaderWithRegistrations } = require("./src/plasmic-init");
|
|
19
|
+
|
|
20
|
+
const plasmicLoaderOptions = gatsbyConfig.plugins.find(
|
|
21
|
+
(p) => p && p.resolve === "@plasmicapp/loader-gatsby"
|
|
22
|
+
).options;
|
|
23
|
+
const PLASMIC = initPlasmicLoaderWithRegistrations(plasmicLoaderOptions);
|
|
24
|
+
|
|
25
|
+
exports.onCreatePage = async ({ page, actions }) => {
|
|
26
|
+
if (page.component !== plasmicLoaderOptions.defaultPlasmicPage) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (page.context?.queryCache) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const componentData = await PLASMIC.maybeFetchComponentData(page.path);
|
|
34
|
+
if (!componentData) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const meta = componentData.entryCompMetas[0];
|
|
38
|
+
|
|
39
|
+
const queryCache = await extractPlasmicQueryData(
|
|
40
|
+
React.createElement(
|
|
41
|
+
PlasmicRootProvider,
|
|
42
|
+
{
|
|
43
|
+
loader: PLASMIC,
|
|
44
|
+
prefetchedData: componentData,
|
|
45
|
+
pageRoute: meta.path,
|
|
46
|
+
pageParams: meta.params,
|
|
47
|
+
pageQuery: {},
|
|
48
|
+
},
|
|
49
|
+
React.createElement(PlasmicComponent, { component: meta.displayName })
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
actions.deletePage(page);
|
|
54
|
+
actions.createPage({
|
|
55
|
+
...page,
|
|
56
|
+
context: { ...page.context, queryCache },
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
initPlasmicLoader,
|
|
3
|
-
} from "@plasmicapp/loader-gatsby";
|
|
1
|
+
const { initPlasmicLoader } = require("@plasmicapp/loader-gatsby");
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
function initPlasmicLoaderWithRegistrations(plasmicOptions) {
|
|
6
4
|
const PLASMIC = initPlasmicLoader(plasmicOptions);
|
|
7
5
|
|
|
8
6
|
// You can register any code components that you want to use here; see
|
|
@@ -16,3 +14,5 @@ export function initPlasmicLoaderWithRegistrations(plasmicOptions) {
|
|
|
16
14
|
|
|
17
15
|
return PLASMIC;
|
|
18
16
|
}
|
|
17
|
+
|
|
18
|
+
module.exports = { initPlasmicLoaderWithRegistrations };
|
|
@@ -15,7 +15,7 @@ export const query = graphql`
|
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
const PlasmicGatsbyPage = ({ data, location }) => {
|
|
18
|
+
const PlasmicGatsbyPage = ({ data, location, pageContext }) => {
|
|
19
19
|
const {
|
|
20
20
|
plasmicComponents,
|
|
21
21
|
plasmicOptions,
|
|
@@ -26,6 +26,7 @@ const PlasmicGatsbyPage = ({ data, location }) => {
|
|
|
26
26
|
<PlasmicRootProvider
|
|
27
27
|
loader={initPlasmicLoaderWithRegistrations(plasmicOptions)}
|
|
28
28
|
prefetchedData={plasmicComponents}
|
|
29
|
+
prefetchedQueryData={pageContext.queryCache}
|
|
29
30
|
pageRoute={pageMeta.path}
|
|
30
31
|
pageParams={pageMeta.params}
|
|
31
32
|
pageQuery={Object.fromEntries(new URLSearchParams(location.search))}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import type { GatsbyConfig } from "gatsby"
|
|
2
|
+
import type { GatsbyConfig } from "gatsby";
|
|
3
3
|
|
|
4
4
|
const config: GatsbyConfig = {
|
|
5
5
|
siteMetadata: {
|
|
6
6
|
siteUrl: `https://www.yourdomain.tld`,
|
|
7
7
|
},
|
|
8
|
-
// More easily incorporate content into your pages through automatic TypeScript type generation and better GraphQL IntelliSense.
|
|
9
|
-
// If you use VSCode you can also use the GraphQL plugin
|
|
10
|
-
// Learn more at: https://gatsby.dev/graphql-typegen
|
|
11
8
|
graphqlTypegen: true,
|
|
12
|
-
plugins: [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
plugins: [
|
|
10
|
+
{
|
|
11
|
+
resolve: "@plasmicapp/loader-gatsby",
|
|
12
|
+
options: {
|
|
13
|
+
projects: [
|
|
14
|
+
{
|
|
15
|
+
id: "47tFXWjN2C4NyHFGGpaYQ3",
|
|
16
|
+
token: "7BRFratDxPLMGZHnd2grV5QP6mlHcZ1AK3BJSIeh7xzUlHgWh25XpgXvUaKAqHXFMXQQuzpADqboibF6nqNWQ",
|
|
17
|
+
},
|
|
18
|
+
], // An array of project ids.
|
|
19
|
+
preview: false,
|
|
20
|
+
defaultPlasmicPage: path.resolve("./src/templates/defaultPlasmicPage.tsx"),
|
|
19
21
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
resolve: "gatsby-plugin-react-helmet",
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
resolve: "gatsby-plugin-react-helmet",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
30
28
|
|
|
31
|
-
export default config
|
|
29
|
+
export default config;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implement Gatsby's Node APIs in this file.
|
|
3
|
+
*
|
|
4
|
+
* See: https://www.gatsbyjs.com/docs/node-apis/
|
|
5
|
+
*
|
|
6
|
+
* `onCreatePage` runs `extractPlasmicQueryData` at build time so that the
|
|
7
|
+
* SSG'd HTML for each Plasmic page contains its actual rendered content,
|
|
8
|
+
* rather than the `<Suspense fallback>` ("Loading...") of unresolved data
|
|
9
|
+
* queries.
|
|
10
|
+
*/
|
|
11
|
+
import type { CreatePageArgs } from "gatsby";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import {
|
|
14
|
+
extractPlasmicQueryData,
|
|
15
|
+
PlasmicComponent,
|
|
16
|
+
PlasmicRootProvider,
|
|
17
|
+
} from "@plasmicapp/loader-gatsby";
|
|
18
|
+
import type { GatsbyPluginOptions } from "@plasmicapp/loader-gatsby";
|
|
19
|
+
import gatsbyConfig from "./gatsby-config";
|
|
20
|
+
import { initPlasmicLoaderWithRegistrations } from "./src/plasmic-init";
|
|
21
|
+
import type { PlasmicGatsbyPageProps } from "./src/templates/defaultPlasmicPage";
|
|
22
|
+
|
|
23
|
+
const plasmicLoaderOptions = gatsbyConfig.plugins.find(
|
|
24
|
+
(p) => p && p.resolve === "@plasmicapp/loader-gatsby"
|
|
25
|
+
)!.options as GatsbyPluginOptions;
|
|
26
|
+
const PLASMIC = initPlasmicLoaderWithRegistrations(plasmicLoaderOptions);
|
|
27
|
+
|
|
28
|
+
export const onCreatePage = async ({ page, actions }: CreatePageArgs<PlasmicGatsbyPageProps["pageContext"]>) => {
|
|
29
|
+
if (page.component !== plasmicLoaderOptions.defaultPlasmicPage) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (page.context?.queryCache) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const componentData = await PLASMIC.maybeFetchComponentData(page.path);
|
|
37
|
+
if (!componentData) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const meta = componentData.entryCompMetas[0];
|
|
41
|
+
|
|
42
|
+
const queryCache = await extractPlasmicQueryData(
|
|
43
|
+
React.createElement(
|
|
44
|
+
PlasmicRootProvider,
|
|
45
|
+
{
|
|
46
|
+
loader: PLASMIC,
|
|
47
|
+
prefetchedData: componentData,
|
|
48
|
+
pageRoute: meta.path,
|
|
49
|
+
pageParams: meta.params,
|
|
50
|
+
pageQuery: {},
|
|
51
|
+
},
|
|
52
|
+
React.createElement(PlasmicComponent, { component: meta.displayName })
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
actions.deletePage(page);
|
|
57
|
+
actions.createPage({
|
|
58
|
+
...page,
|
|
59
|
+
context: { ...page.context, queryCache },
|
|
60
|
+
});
|
|
61
|
+
};
|
|
@@ -16,14 +16,17 @@ export const query = graphql`
|
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
-
interface PlasmicGatsbyPageProps extends PageProps {
|
|
19
|
+
export interface PlasmicGatsbyPageProps extends PageProps {
|
|
20
20
|
data: {
|
|
21
21
|
plasmicOptions: InitOptions
|
|
22
22
|
plasmicComponents: ComponentRenderData
|
|
23
23
|
}
|
|
24
|
+
pageContext: {
|
|
25
|
+
queryCache?: Record<string, any>
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
const PlasmicGatsbyPage = ({ data, location }: PlasmicGatsbyPageProps) => {
|
|
29
|
+
const PlasmicGatsbyPage = ({ data, location, pageContext }: PlasmicGatsbyPageProps) => {
|
|
27
30
|
const {
|
|
28
31
|
plasmicComponents,
|
|
29
32
|
plasmicOptions,
|
|
@@ -34,6 +37,7 @@ const PlasmicGatsbyPage = ({ data, location }: PlasmicGatsbyPageProps) => {
|
|
|
34
37
|
<PlasmicRootProvider
|
|
35
38
|
loader={initPlasmicLoaderWithRegistrations(plasmicOptions)}
|
|
36
39
|
prefetchedData={plasmicComponents}
|
|
40
|
+
prefetchedQueryData={pageContext.queryCache}
|
|
37
41
|
pageRoute={pageMeta.path}
|
|
38
42
|
pageParams={pageMeta.params}
|
|
39
43
|
pageQuery={Object.fromEntries(new URLSearchParams(location.search))}
|
|
@@ -7,6 +7,13 @@ import {
|
|
|
7
7
|
makeAppRouterPageCtx,
|
|
8
8
|
generateDynamicMetadata
|
|
9
9
|
} from "../../../components/plasmic/create_plasmic_app/PlasmicDynamicPageServer";
|
|
10
|
+
// Uncomment and populate to statically pre-render this route at build time.
|
|
11
|
+
// Each entry should be an object whose keys match the dynamic segments in the route path.
|
|
12
|
+
// See https://nextjs.org/docs/app/api-reference/functions/generate-static-params
|
|
13
|
+
//
|
|
14
|
+
// export async function generateStaticParams() {
|
|
15
|
+
// return [];
|
|
16
|
+
// }
|
|
10
17
|
|
|
11
18
|
export async function generateMetadata({ params, searchParams }, parent) {
|
|
12
19
|
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
@@ -31,11 +38,12 @@ async function DynamicPage({ params, searchParams }) {
|
|
|
31
38
|
// variant context providers. These wrappers may be moved to
|
|
32
39
|
// Next.js Custom App component
|
|
33
40
|
// (https://nextjs.org/docs/advanced-features/custom-app).
|
|
41
|
+
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
34
42
|
return (
|
|
35
43
|
<PageParamsProvider__
|
|
36
|
-
route=
|
|
37
|
-
params={
|
|
38
|
-
query={
|
|
44
|
+
route={ctx.pageRoute}
|
|
45
|
+
params={ctx.params}
|
|
46
|
+
query={ctx.query}
|
|
39
47
|
>
|
|
40
48
|
<PlasmicDynamicPageServer />
|
|
41
49
|
</PageParamsProvider__>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import '@/app/globals.css'
|
|
2
|
-
import {
|
|
3
|
-
import Link from "next/link";
|
|
2
|
+
import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
|
|
4
3
|
|
|
5
4
|
export default function RootLayout({
|
|
6
5
|
children,
|
|
@@ -8,9 +7,9 @@ export default function RootLayout({
|
|
|
8
7
|
return (
|
|
9
8
|
<html lang="en">
|
|
10
9
|
<body>
|
|
11
|
-
<
|
|
10
|
+
<ClientPlasmicRootProvider>
|
|
12
11
|
{children}
|
|
13
|
-
</
|
|
12
|
+
</ClientPlasmicRootProvider>
|
|
14
13
|
</body>
|
|
15
14
|
</html>
|
|
16
15
|
);
|
|
@@ -31,11 +31,12 @@ async function Homepage({ params, searchParams }) {
|
|
|
31
31
|
// variant context providers. These wrappers may be moved to
|
|
32
32
|
// Next.js Custom App component
|
|
33
33
|
// (https://nextjs.org/docs/advanced-features/custom-app).
|
|
34
|
+
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
34
35
|
return (
|
|
35
36
|
<PageParamsProvider__
|
|
36
|
-
route=
|
|
37
|
-
params={
|
|
38
|
-
query={
|
|
37
|
+
route={ctx.pageRoute}
|
|
38
|
+
params={ctx.params}
|
|
39
|
+
query={ctx.query}
|
|
39
40
|
>
|
|
40
41
|
<PlasmicHomepageServer />
|
|
41
42
|
</PageParamsProvider__>
|
package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx
CHANGED
|
@@ -119,6 +119,7 @@ function PlasmicHomepage__RenderFunc(props) {
|
|
|
119
119
|
className={classNames(
|
|
120
120
|
projectcss.all,
|
|
121
121
|
projectcss.h1,
|
|
122
|
+
projectcss.h1__47tFX,
|
|
122
123
|
projectcss.__wab_text,
|
|
123
124
|
sty.h1
|
|
124
125
|
)}
|
|
@@ -142,7 +143,9 @@ function PlasmicHomepage__RenderFunc(props) {
|
|
|
142
143
|
}
|
|
143
144
|
</React.Fragment>
|
|
144
145
|
<span
|
|
145
|
-
className={
|
|
146
|
+
className={
|
|
147
|
+
"plasmic_default__all plasmic_default__span plasmic_default__span__47tFX"
|
|
148
|
+
}
|
|
146
149
|
style={{ fontWeight: 700 }}
|
|
147
150
|
>
|
|
148
151
|
{"Therefore, please avoid changing this project."}
|
|
@@ -156,7 +159,9 @@ function PlasmicHomepage__RenderFunc(props) {
|
|
|
156
159
|
}
|
|
157
160
|
</React.Fragment>
|
|
158
161
|
<span
|
|
159
|
-
className={
|
|
162
|
+
className={
|
|
163
|
+
"plasmic_default__all plasmic_default__span plasmic_default__span__47tFX"
|
|
164
|
+
}
|
|
160
165
|
style={{ fontWeight: 700 }}
|
|
161
166
|
>
|
|
162
167
|
{"Code"}
|
|
@@ -143,6 +143,6 @@
|
|
|
143
143
|
"nextjsConfig": {
|
|
144
144
|
"pagesDir": "../app"
|
|
145
145
|
},
|
|
146
|
-
"cliVersion": "0.1.
|
|
147
|
-
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.
|
|
146
|
+
"cliVersion": "0.1.361",
|
|
147
|
+
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.361/dist/plasmic.schema.json"
|
|
148
148
|
}
|
|
@@ -9,9 +9,16 @@ import {
|
|
|
9
9
|
generateDynamicMetadata,
|
|
10
10
|
DynamicPageServerSkeletonProps
|
|
11
11
|
} from "../../../components/plasmic/create_plasmic_app/PlasmicDynamicPageServer";
|
|
12
|
-
|
|
13
12
|
import type { Metadata, ResolvingMetadata } from "next";
|
|
14
13
|
|
|
14
|
+
// Uncomment and populate to statically pre-render this route at build time.
|
|
15
|
+
// Each entry should be an object whose keys match the dynamic segments in the route path.
|
|
16
|
+
// See https://nextjs.org/docs/app/api-reference/functions/generate-static-params
|
|
17
|
+
//
|
|
18
|
+
// export async function generateStaticParams() {
|
|
19
|
+
// return [];
|
|
20
|
+
// }
|
|
21
|
+
|
|
15
22
|
export async function generateMetadata(
|
|
16
23
|
{ params, searchParams }: DynamicPageServerSkeletonProps,
|
|
17
24
|
parent: ResolvingMetadata
|
|
@@ -43,11 +50,12 @@ async function DynamicPage({
|
|
|
43
50
|
// Next.js Custom App component
|
|
44
51
|
// (https://nextjs.org/docs/advanced-features/custom-app).
|
|
45
52
|
|
|
53
|
+
const ctx = await makeAppRouterPageCtx({ params, searchParams });
|
|
46
54
|
return (
|
|
47
55
|
<PageParamsProvider__
|
|
48
|
-
route=
|
|
49
|
-
params={
|
|
50
|
-
query={
|
|
56
|
+
route={ctx.pageRoute}
|
|
57
|
+
params={ctx.params}
|
|
58
|
+
query={ctx.query}
|
|
51
59
|
>
|
|
52
60
|
<PlasmicDynamicPageServer />
|
|
53
61
|
</PageParamsProvider__>
|