create-plasmic-app 0.0.63 → 0.0.65
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.internal.md +6 -2
- package/cpa-out/.gitignore +15 -0
- package/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +11 -0
- package/cpa-out/gatsby-codegen-js/gatsby-config.js +9 -0
- package/cpa-out/gatsby-codegen-js/gatsby-node.js +0 -0
- package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +11 -0
- package/cpa-out/gatsby-codegen-js/package.json +26 -0
- package/cpa-out/gatsby-codegen-js/plasmic.json +79 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +206 -0
- package/cpa-out/gatsby-codegen-js/src/pages/404.js +4 -0
- package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +39 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +11 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-config.ts +14 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-node.ts +0 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +11 -0
- package/cpa-out/gatsby-codegen-ts/package.json +34 -0
- package/cpa-out/gatsby-codegen-ts/plasmic.json +79 -0
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +290 -0
- package/cpa-out/gatsby-codegen-ts/src/pages/404.js +4 -0
- package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +41 -0
- package/cpa-out/gatsby-codegen-ts/tsconfig.json +102 -0
- package/cpa-out/gatsby-loader-js/gatsby-config.js +25 -0
- package/cpa-out/gatsby-loader-js/gatsby-node.js +0 -0
- package/cpa-out/gatsby-loader-js/gatsby-ssr.jsx +44 -0
- package/cpa-out/gatsby-loader-js/package.json +24 -0
- package/cpa-out/gatsby-loader-js/src/pages/404.js +4 -0
- package/cpa-out/gatsby-loader-js/src/pages/plasmic-host.jsx +19 -0
- package/cpa-out/gatsby-loader-js/src/plasmic-init.js +18 -0
- package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +44 -0
- package/cpa-out/gatsby-loader-ts/gatsby-config.ts +31 -0
- package/cpa-out/gatsby-loader-ts/gatsby-node.ts +0 -0
- package/cpa-out/gatsby-loader-ts/gatsby-ssr.tsx +44 -0
- package/cpa-out/gatsby-loader-ts/package.json +32 -0
- package/cpa-out/gatsby-loader-ts/src/pages/404.ts +4 -0
- package/cpa-out/gatsby-loader-ts/src/pages/plasmic-host.tsx +24 -0
- package/cpa-out/gatsby-loader-ts/src/plasmic-init.ts +19 -0
- package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +52 -0
- package/cpa-out/gatsby-loader-ts/tsconfig.json +102 -0
- package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +56 -0
- package/cpa-out/nextjs-app-loader-js/app/api/hello/route.js +3 -0
- package/cpa-out/nextjs-app-loader-js/app/layout.js +14 -0
- package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +6 -0
- package/cpa-out/nextjs-app-loader-js/next.config.js +13 -0
- package/cpa-out/nextjs-app-loader-js/package.json +19 -0
- package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +65 -0
- package/cpa-out/nextjs-app-loader-js/plasmic-init.js +16 -0
- package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +59 -0
- package/cpa-out/nextjs-app-loader-ts/app/api/hello/route.ts +3 -0
- package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +18 -0
- package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +6 -0
- package/cpa-out/nextjs-app-loader-ts/next.config.js +13 -0
- package/cpa-out/nextjs-app-loader-ts/package.json +23 -0
- package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +65 -0
- package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +16 -0
- package/cpa-out/nextjs-app-loader-ts/tsconfig.json +28 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +216 -0
- package/cpa-out/nextjs-pages-codegen-js/next.config.js +10 -0
- package/cpa-out/nextjs-pages-codegen-js/package.json +21 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +11 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/api/hello.js +5 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/index.jsx +35 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/plasmic-host.jsx +15 -0
- package/cpa-out/nextjs-pages-codegen-js/plasmic.json +79 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +297 -0
- package/cpa-out/nextjs-pages-codegen-ts/next.config.js +10 -0
- package/cpa-out/nextjs-pages-codegen-ts/package.json +25 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +12 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/api/hello.ts +13 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +37 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/plasmic-host.tsx +15 -0
- package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +79 -0
- package/cpa-out/nextjs-pages-codegen-ts/tsconfig.json +23 -0
- package/cpa-out/nextjs-pages-loader-js/next.config.js +10 -0
- package/cpa-out/nextjs-pages-loader-js/package.json +19 -0
- package/cpa-out/nextjs-pages-loader-js/pages/[[...catchall]].jsx +66 -0
- package/cpa-out/nextjs-pages-loader-js/pages/api/hello.js +5 -0
- package/cpa-out/nextjs-pages-loader-js/pages/plasmic-host.jsx +7 -0
- package/cpa-out/nextjs-pages-loader-js/plasmic-init.js +25 -0
- package/cpa-out/nextjs-pages-loader-ts/next.config.js +10 -0
- package/cpa-out/nextjs-pages-loader-ts/package.json +23 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/[[...catchall]].tsx +70 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/api/hello.ts +13 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/plasmic-host.tsx +7 -0
- package/cpa-out/nextjs-pages-loader-ts/plasmic-init.ts +25 -0
- package/cpa-out/nextjs-pages-loader-ts/tsconfig.json +23 -0
- package/cpa-out/react-codegen-js/package.json +41 -0
- package/cpa-out/react-codegen-js/plasmic.json +76 -0
- package/cpa-out/react-codegen-js/src/App.jsx +9 -0
- package/cpa-out/react-codegen-js/src/components/Homepage.jsx +26 -0
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
- package/cpa-out/react-codegen-js/src/index.js +17 -0
- package/cpa-out/react-codegen-js/src/reportWebVitals.js +13 -0
- package/cpa-out/react-codegen-js/src/setupTests.js +5 -0
- package/cpa-out/react-codegen-ts/package.json +46 -0
- package/cpa-out/react-codegen-ts/plasmic.json +76 -0
- package/cpa-out/react-codegen-ts/src/App.tsx +9 -0
- package/cpa-out/react-codegen-ts/src/components/Homepage.tsx +45 -0
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
- package/cpa-out/react-codegen-ts/src/index.tsx +19 -0
- package/cpa-out/react-codegen-ts/src/react-app-env.d.ts +1 -0
- package/cpa-out/react-codegen-ts/src/reportWebVitals.ts +15 -0
- package/cpa-out/react-codegen-ts/src/setupTests.ts +5 -0
- package/cpa-out/react-codegen-ts/tsconfig.json +26 -0
- package/cpa-out/react-loader-js/package.json +41 -0
- package/cpa-out/react-loader-js/plasmic.json +76 -0
- package/cpa-out/react-loader-js/src/App.jsx +9 -0
- package/cpa-out/react-loader-js/src/components/Homepage.jsx +26 -0
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
- package/cpa-out/react-loader-js/src/index.js +17 -0
- package/cpa-out/react-loader-js/src/reportWebVitals.js +13 -0
- package/cpa-out/react-loader-js/src/setupTests.js +5 -0
- package/cpa-out/react-loader-ts/package.json +46 -0
- package/cpa-out/react-loader-ts/plasmic.json +76 -0
- package/cpa-out/react-loader-ts/src/App.tsx +9 -0
- package/cpa-out/react-loader-ts/src/components/Homepage.tsx +45 -0
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
- package/cpa-out/react-loader-ts/src/index.tsx +19 -0
- package/cpa-out/react-loader-ts/src/react-app-env.d.ts +1 -0
- package/cpa-out/react-loader-ts/src/reportWebVitals.ts +15 -0
- package/cpa-out/react-loader-ts/src/setupTests.ts +5 -0
- package/cpa-out/react-loader-ts/tsconfig.json +26 -0
- package/dist/gatsby/gatsby.d.ts +6 -0
- package/dist/{strategies → gatsby}/gatsby.js +26 -29
- package/dist/gatsby/template.d.ts +11 -0
- package/dist/{templates/gatsby.js → gatsby/template.js} +34 -42
- package/dist/index.d.ts +1 -1
- package/dist/index.js +57 -27
- package/dist/lib.d.ts +3 -4
- package/dist/lib.js +22 -12
- package/dist/nextjs/nextjs.d.ts +2 -0
- package/dist/nextjs/nextjs.js +155 -0
- package/dist/nextjs/templates/app-loader/catchall-page.d.ts +2 -0
- package/dist/nextjs/templates/app-loader/catchall-page.js +67 -0
- package/dist/nextjs/templates/app-loader/plasmic-host.d.ts +1 -0
- package/dist/nextjs/templates/app-loader/plasmic-host.js +13 -0
- package/dist/nextjs/templates/app-loader/plasmic-init-client.d.ts +2 -0
- package/dist/nextjs/templates/app-loader/plasmic-init-client.js +73 -0
- package/dist/nextjs/templates/app-loader/plasmic-init.d.ts +1 -0
- package/dist/nextjs/templates/app-loader/plasmic-init.js +23 -0
- package/dist/nextjs/templates/pages-codegen/app.d.ts +2 -0
- package/dist/nextjs/templates/pages-codegen/app.js +20 -0
- package/dist/nextjs/templates/pages-codegen/plasmic-host.d.ts +1 -0
- package/dist/nextjs/templates/pages-codegen/plasmic-host.js +22 -0
- package/dist/nextjs/templates/pages-loader/catchall-page.d.ts +2 -0
- package/dist/nextjs/templates/pages-loader/catchall-page.js +77 -0
- package/dist/nextjs/templates/pages-loader/plasmic-host.d.ts +1 -0
- package/dist/nextjs/templates/pages-loader/plasmic-host.js +14 -0
- package/dist/nextjs/templates/pages-loader/plasmic-init.d.ts +1 -0
- package/dist/nextjs/templates/pages-loader/plasmic-init.js +32 -0
- package/dist/react/react.d.ts +2 -0
- package/dist/{strategies → react}/react.js +10 -10
- package/dist/templates/readme.d.ts +2 -2
- package/dist/templates/readme.js +5 -4
- package/dist/templates/welcomePage.d.ts +2 -2
- package/dist/templates/welcomePage.js +5 -5
- package/dist/utils/file-utils.d.ts +2 -2
- package/dist/utils/file-utils.js +3 -3
- package/dist/{strategies/types.d.ts → utils/strategy.d.ts} +16 -14
- package/dist/utils/types.d.ts +9 -0
- package/dist/utils/types.js +7 -0
- package/package.json +4 -3
- package/run-cpa.ts +151 -0
- package/src/{strategies → gatsby}/gatsby.ts +28 -46
- package/src/{templates/gatsby.ts → gatsby/template.ts} +41 -51
- package/src/index.ts +86 -56
- package/src/lib.ts +30 -15
- package/src/nextjs/nextjs.ts +180 -0
- package/src/nextjs/templates/app-loader/catchall-page.ts +71 -0
- package/src/nextjs/templates/app-loader/plasmic-host.ts +9 -0
- package/src/nextjs/templates/app-loader/plasmic-init-client.ts +74 -0
- package/src/nextjs/templates/app-loader/plasmic-init.ts +22 -0
- package/src/nextjs/templates/pages-codegen/app.ts +24 -0
- package/src/nextjs/templates/pages-codegen/plasmic-host.ts +18 -0
- package/src/nextjs/templates/pages-loader/catchall-page.ts +81 -0
- package/src/nextjs/templates/pages-loader/plasmic-host.ts +10 -0
- package/src/nextjs/templates/pages-loader/plasmic-init.ts +31 -0
- package/src/{strategies → react}/react.ts +8 -10
- package/src/templates/readme.ts +5 -5
- package/src/templates/welcomePage.ts +6 -7
- package/src/utils/file-utils.ts +4 -4
- package/src/utils/strategy.ts +48 -0
- package/src/utils/types.ts +12 -0
- package/dist/strategies/gatsby.d.ts +0 -7
- package/dist/strategies/index.d.ts +0 -2
- package/dist/strategies/index.js +0 -22
- package/dist/strategies/nextjs.d.ts +0 -3
- package/dist/strategies/nextjs.js +0 -104
- package/dist/strategies/react.d.ts +0 -3
- package/dist/templates/gatsby.d.ts +0 -11
- package/dist/templates/nextjs.d.ts +0 -5
- package/dist/templates/nextjs.js +0 -162
- package/src/strategies/index.ts +0 -21
- package/src/strategies/nextjs.ts +0 -131
- package/src/strategies/types.ts +0 -42
- package/src/templates/nextjs.ts +0 -170
- /package/dist/{strategies/common.d.ts → utils/codegen.d.ts} +0 -0
- /package/dist/{strategies/common.js → utils/codegen.js} +0 -0
- /package/dist/{strategies/types.js → utils/strategy.js} +0 -0
- /package/src/{strategies/common.ts → utils/codegen.ts} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
|
|
3
|
+
*
|
|
4
|
+
* See: https://www.gatsbyjs.com/docs/ssr-apis/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const React = require("react")
|
|
8
|
+
|
|
9
|
+
const HeadComponents = [
|
|
10
|
+
<script
|
|
11
|
+
key="plasmic-hmr"
|
|
12
|
+
type="text/javascript"
|
|
13
|
+
dangerouslySetInnerHTML={{
|
|
14
|
+
__html: `
|
|
15
|
+
if (typeof window !== "undefined" && /\\/plasmic-host\\/?$/.test(window.location.pathname)) {
|
|
16
|
+
const RealEventSource = window.EventSource;
|
|
17
|
+
window.EventSource = function(url, config) {
|
|
18
|
+
if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {
|
|
19
|
+
console.warn("Plasmic: disabled EventSource request for", url);
|
|
20
|
+
return {
|
|
21
|
+
onerror() {}, onmessage() {}, onopen() {}, close() {}
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
return new RealEventSource(url, config);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const isProduction = process.env.NODE_ENV === "production"
|
|
34
|
+
|
|
35
|
+
exports.onRenderBody = ({ pathname, setHeadComponents }) => {
|
|
36
|
+
/**
|
|
37
|
+
* We add the preamble tag script to all pages during development mode
|
|
38
|
+
* because during development all pages are dynamically rendered based
|
|
39
|
+
* on `/` route, during production we add it only in `/plasmic-host/`
|
|
40
|
+
*/
|
|
41
|
+
if (!isProduction || pathname === "/plasmic-host/") {
|
|
42
|
+
setHeadComponents(HeadComponents)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gatsby-loader-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Plasmic app for 47tFXWjN2C4NyHFGGpaYQ3",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"gatsby"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"develop": "gatsby develop",
|
|
11
|
+
"start": "gatsby develop",
|
|
12
|
+
"build": "gatsby build",
|
|
13
|
+
"serve": "gatsby serve",
|
|
14
|
+
"clean": "gatsby clean",
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@plasmicapp/loader-gatsby": "^1.0.215",
|
|
19
|
+
"gatsby": "^5.5.0",
|
|
20
|
+
"gatsby-plugin-react-helmet": "^6.5.0",
|
|
21
|
+
"react": "^18.2.0",
|
|
22
|
+
"react-dom": "^18.2.0",
|
|
23
|
+
"react-helmet": "^6.1.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^18.11.18",
|
|
27
|
+
"@types/react": "^18.0.27",
|
|
28
|
+
"@types/react-dom": "^18.0.10",
|
|
29
|
+
"@types/react-helmet": "^6.1.6",
|
|
30
|
+
"typescript": "^4.9.4"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
PlasmicCanvasHost, InitOptions
|
|
4
|
+
} from "@plasmicapp/loader-gatsby"
|
|
5
|
+
import { graphql } from "gatsby"
|
|
6
|
+
import { initPlasmicLoaderWithRegistrations } from "../plasmic-init"
|
|
7
|
+
|
|
8
|
+
export const query = graphql`
|
|
9
|
+
query {
|
|
10
|
+
plasmicOptions
|
|
11
|
+
}
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
interface HostProps {
|
|
15
|
+
data: {
|
|
16
|
+
plasmicOptions: InitOptions;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function Host({ data }: HostProps) {
|
|
21
|
+
const { plasmicOptions } = data
|
|
22
|
+
initPlasmicLoaderWithRegistrations(plasmicOptions)
|
|
23
|
+
return <PlasmicCanvasHost />
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
initPlasmicLoader,
|
|
3
|
+
InitOptions,
|
|
4
|
+
} from "@plasmicapp/loader-gatsby";
|
|
5
|
+
|
|
6
|
+
export function initPlasmicLoaderWithRegistrations(plasmicOptions: InitOptions) {
|
|
7
|
+
const PLASMIC = initPlasmicLoader(plasmicOptions);
|
|
8
|
+
|
|
9
|
+
// You can register any code components that you want to use here; see
|
|
10
|
+
// https://docs.plasmic.app/learn/code-components-ref/
|
|
11
|
+
// And configure your Plasmic project to use the host url pointing at
|
|
12
|
+
// the /plasmic-host page of your nextjs app (for example,
|
|
13
|
+
// http://localhost:8000/plasmic-host). See
|
|
14
|
+
// https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
|
|
15
|
+
|
|
16
|
+
// PLASMIC.registerComponent(...);
|
|
17
|
+
|
|
18
|
+
return PLASMIC;
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Helmet from "react-helmet";
|
|
3
|
+
import {
|
|
4
|
+
PlasmicComponent,
|
|
5
|
+
PlasmicRootProvider,
|
|
6
|
+
InitOptions,
|
|
7
|
+
ComponentRenderData,
|
|
8
|
+
} from "@plasmicapp/loader-gatsby";
|
|
9
|
+
import { graphql, PageProps } from "gatsby";
|
|
10
|
+
import { initPlasmicLoaderWithRegistrations } from "../plasmic-init";
|
|
11
|
+
|
|
12
|
+
export const query = graphql`
|
|
13
|
+
query ($path: String) {
|
|
14
|
+
plasmicComponents(componentNames: [$path])
|
|
15
|
+
plasmicOptions
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
interface PlasmicGatsbyPageProps extends PageProps {
|
|
20
|
+
data: {
|
|
21
|
+
plasmicOptions: InitOptions
|
|
22
|
+
plasmicComponents: ComponentRenderData
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const PlasmicGatsbyPage = ({ data, location }: PlasmicGatsbyPageProps) => {
|
|
27
|
+
const {
|
|
28
|
+
plasmicComponents,
|
|
29
|
+
plasmicOptions,
|
|
30
|
+
} = data;
|
|
31
|
+
const pageMeta = plasmicComponents.entryCompMetas[0];
|
|
32
|
+
const pageMetadata = pageMeta.pageMetadata;
|
|
33
|
+
return (
|
|
34
|
+
<PlasmicRootProvider
|
|
35
|
+
loader={initPlasmicLoaderWithRegistrations(plasmicOptions)}
|
|
36
|
+
prefetchedData={plasmicComponents}
|
|
37
|
+
pageParams={pageMeta.params}
|
|
38
|
+
pageQuery={Object.fromEntries(new URLSearchParams(location.search))}
|
|
39
|
+
Head={Helmet}
|
|
40
|
+
>
|
|
41
|
+
<Helmet>
|
|
42
|
+
{pageMetadata?.title && <title>{pageMetadata.title}</title>}
|
|
43
|
+
{pageMetadata?.title && <meta property="og:title" content={pageMetadata.title} /> }
|
|
44
|
+
{pageMetadata?.description && <meta property="og:description" content={pageMetadata.description} />}
|
|
45
|
+
{pageMetadata?.openGraphImageUrl && <meta property="og:image" content={pageMetadata.openGraphImageUrl} />}
|
|
46
|
+
</Helmet>
|
|
47
|
+
<PlasmicComponent component={pageMeta.displayName} />
|
|
48
|
+
</PlasmicRootProvider>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default PlasmicGatsbyPage;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
"lib": ["dom", "esnext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
"jsx": "react", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "esnext", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
+
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
+
|
|
44
|
+
/* Emit */
|
|
45
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
51
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
+
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
+
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
+
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
},
|
|
101
|
+
"include": ["./src/**/*", "./gatsby-node.ts", "./gatsby-config.ts", "./plugins/**/*"]
|
|
102
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
|
|
2
|
+
import { notFound } from "next/navigation";
|
|
3
|
+
import { PLASMIC } from "@/plasmic-init";
|
|
4
|
+
import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
|
|
5
|
+
|
|
6
|
+
// Use revalidate if you want incremental static regeneration
|
|
7
|
+
export const revalidate = 60;
|
|
8
|
+
|
|
9
|
+
export default async function PlasmicLoaderPage({
|
|
10
|
+
params,
|
|
11
|
+
searchParams,
|
|
12
|
+
}) {
|
|
13
|
+
const plasmicComponentData = await fetchPlasmicComponentData(params?.catchall);
|
|
14
|
+
if (!plasmicComponentData) {
|
|
15
|
+
notFound();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { prefetchedData } = plasmicComponentData;
|
|
19
|
+
if (prefetchedData.entryCompMetas.length === 0) {
|
|
20
|
+
notFound();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const pageMeta = prefetchedData.entryCompMetas[0];
|
|
24
|
+
return (
|
|
25
|
+
<ClientPlasmicRootProvider
|
|
26
|
+
prefetchedData={prefetchedData}
|
|
27
|
+
pageParams={pageMeta.params}
|
|
28
|
+
pageQuery={searchParams}
|
|
29
|
+
>
|
|
30
|
+
<PlasmicComponent
|
|
31
|
+
component={pageMeta.displayName}
|
|
32
|
+
/>
|
|
33
|
+
</ClientPlasmicRootProvider>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function fetchPlasmicComponentData(catchall) {
|
|
38
|
+
const plasmicPath = "/" + (catchall ? catchall.join("/") : "");
|
|
39
|
+
const prefetchedData = await PLASMIC.maybeFetchComponentData(plasmicPath);
|
|
40
|
+
if (!prefetchedData) {
|
|
41
|
+
notFound();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return { prefetchedData };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function generateStaticParams() {
|
|
48
|
+
const pageModules = await PLASMIC.fetchPages();
|
|
49
|
+
return pageModules.map((mod) => {
|
|
50
|
+
const catchall =
|
|
51
|
+
mod.path === "/" ? undefined : mod.path.substring(1).split("/");
|
|
52
|
+
return {
|
|
53
|
+
catchall,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './globals.css'
|
|
2
|
+
|
|
3
|
+
export const metadata = {
|
|
4
|
+
title: 'Create Next App',
|
|
5
|
+
description: 'Generated by create next app',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function RootLayout({ children }) {
|
|
9
|
+
return (
|
|
10
|
+
<html lang="en">
|
|
11
|
+
<body>{children}</body>
|
|
12
|
+
</html>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
/** @type {import('next').NextConfig} */
|
|
3
|
+
const nextConfig = {
|
|
4
|
+
// Turn off React StrictMode for now, as react-aria (used by Plasmic)
|
|
5
|
+
// has some troubles with it. See
|
|
6
|
+
// https://github.com/adobe/react-spectrum/labels/strict%20mode
|
|
7
|
+
reactStrictMode: false,
|
|
8
|
+
experimental: {
|
|
9
|
+
appDir: true,
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports = nextConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nextjs-app-loader-js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"lint": "next lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@plasmicapp/loader-nextjs": "^1.0.233",
|
|
13
|
+
"eslint": "8.35.0",
|
|
14
|
+
"eslint-config-next": "13.2.3",
|
|
15
|
+
"next": "13.2.3",
|
|
16
|
+
"react": "18.2.0",
|
|
17
|
+
"react-dom": "18.2.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
|
|
4
|
+
import { PLASMIC } from "@/plasmic-init";
|
|
5
|
+
|
|
6
|
+
// You can register any code components that you want to use here; see
|
|
7
|
+
// https://docs.plasmic.app/learn/code-components-ref/
|
|
8
|
+
// And configure your Plasmic project to use the host url pointing at
|
|
9
|
+
// the /plasmic-host page of your nextjs app (for example,
|
|
10
|
+
// http://localhost:3000/plasmic-host). See
|
|
11
|
+
// https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
|
|
12
|
+
|
|
13
|
+
// PLASMIC.registerComponent(...);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* ClientPlasmicRootProvider is a Client Component that passes in the loader for you.
|
|
17
|
+
*
|
|
18
|
+
* Why? Props passed from Server to Client Components must be serializable.
|
|
19
|
+
* https://beta.nextjs.org/docs/rendering/server-and-client-components#passing-props-from-server-to-client-components-serialization
|
|
20
|
+
* However, PlasmicRootProvider requires a loader, but the loader is NOT serializable.
|
|
21
|
+
*
|
|
22
|
+
* In a Server Component like app/<your-path>/path.tsx, rendering the following would not work:
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* import { PLASMIC } from "@/plasmic-init";
|
|
26
|
+
* import { PlasmicRootProvider } from "plasmicapp/loader-nextjs";
|
|
27
|
+
* export default function MyPage() {
|
|
28
|
+
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
29
|
+
* return (
|
|
30
|
+
* <PlasmicRootProvider
|
|
31
|
+
* loader={PLASMIC} // ERROR: loader is not serializable
|
|
32
|
+
* prefetchedData={prefetchedData}
|
|
33
|
+
* >
|
|
34
|
+
* {yourContent()}
|
|
35
|
+
* </PlasmicRootProvider>;
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Therefore, we define ClientPlasmicRootProvider as a Client Component (this file is marked "use client").
|
|
41
|
+
* ClientPlasmicRootProvider wraps the PlasmicRootProvider and passes in the loader for you,
|
|
42
|
+
* while allowing your Server Component to pass in prefetched data and other serializable props:
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { PLASMIC } from "@/plasmic-init";
|
|
46
|
+
* import { ClientPlasmicRootProvider } from "@/plasmic-init-client"; // changed
|
|
47
|
+
* export default function MyPage() {
|
|
48
|
+
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
49
|
+
* return (
|
|
50
|
+
* <ClientPlasmicRootProvider // don't pass in loader
|
|
51
|
+
* prefetchedData={prefetchedData}
|
|
52
|
+
* >
|
|
53
|
+
* {yourContent()}
|
|
54
|
+
* </ClientPlasmicRootProvider>;
|
|
55
|
+
* );
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function ClientPlasmicRootProvider(
|
|
60
|
+
props
|
|
61
|
+
) {
|
|
62
|
+
return (
|
|
63
|
+
<PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { initPlasmicLoader } from "@plasmicapp/loader-nextjs/react-server-conditional";
|
|
2
|
+
|
|
3
|
+
export const PLASMIC = initPlasmicLoader({
|
|
4
|
+
projects: [
|
|
5
|
+
{
|
|
6
|
+
id: "47tFXWjN2C4NyHFGGpaYQ3",
|
|
7
|
+
token: "7BRFratDxPLMGZHnd2grV5QP6mlHcZ1AK3BJSIeh7xzUlHgWh25XpgXvUaKAqHXFMXQQuzpADqboibF6nqNWQ",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
|
|
11
|
+
// By default Plasmic will use the last published version of your project.
|
|
12
|
+
// For development, you can set preview to true, which will use the unpublished
|
|
13
|
+
// project, allowing you to see your designs without publishing. Please
|
|
14
|
+
// only use this for development, as this is significantly slower.
|
|
15
|
+
preview: false,
|
|
16
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
|
|
2
|
+
import { notFound } from "next/navigation";
|
|
3
|
+
import { PLASMIC } from "@/plasmic-init";
|
|
4
|
+
import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
|
|
5
|
+
|
|
6
|
+
// Use revalidate if you want incremental static regeneration
|
|
7
|
+
export const revalidate = 60;
|
|
8
|
+
|
|
9
|
+
export default async function PlasmicLoaderPage({
|
|
10
|
+
params,
|
|
11
|
+
searchParams,
|
|
12
|
+
}: {
|
|
13
|
+
params?: { catchall: string[] | undefined };
|
|
14
|
+
searchParams?: Record<string, string | string[]>;
|
|
15
|
+
}) {
|
|
16
|
+
const plasmicComponentData = await fetchPlasmicComponentData(params?.catchall);
|
|
17
|
+
if (!plasmicComponentData) {
|
|
18
|
+
notFound();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { prefetchedData } = plasmicComponentData;
|
|
22
|
+
if (prefetchedData.entryCompMetas.length === 0) {
|
|
23
|
+
notFound();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const pageMeta = prefetchedData.entryCompMetas[0];
|
|
27
|
+
return (
|
|
28
|
+
<ClientPlasmicRootProvider
|
|
29
|
+
prefetchedData={prefetchedData}
|
|
30
|
+
pageParams={pageMeta.params}
|
|
31
|
+
pageQuery={searchParams}
|
|
32
|
+
>
|
|
33
|
+
<PlasmicComponent
|
|
34
|
+
component={pageMeta.displayName}
|
|
35
|
+
/>
|
|
36
|
+
</ClientPlasmicRootProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function fetchPlasmicComponentData(catchall: string[] | undefined) {
|
|
41
|
+
const plasmicPath = "/" + (catchall ? catchall.join("/") : "");
|
|
42
|
+
const prefetchedData = await PLASMIC.maybeFetchComponentData(plasmicPath);
|
|
43
|
+
if (!prefetchedData) {
|
|
44
|
+
notFound();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return { prefetchedData };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function generateStaticParams() {
|
|
51
|
+
const pageModules = await PLASMIC.fetchPages();
|
|
52
|
+
return pageModules.map((mod) => {
|
|
53
|
+
const catchall =
|
|
54
|
+
mod.path === "/" ? undefined : mod.path.substring(1).split("/");
|
|
55
|
+
return {
|
|
56
|
+
catchall,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './globals.css'
|
|
2
|
+
|
|
3
|
+
export const metadata = {
|
|
4
|
+
title: 'Create Next App',
|
|
5
|
+
description: 'Generated by create next app',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function RootLayout({
|
|
9
|
+
children,
|
|
10
|
+
}: {
|
|
11
|
+
children: React.ReactNode
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<body>{children}</body>
|
|
16
|
+
</html>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
/** @type {import('next').NextConfig} */
|
|
3
|
+
const nextConfig = {
|
|
4
|
+
// Turn off React StrictMode for now, as react-aria (used by Plasmic)
|
|
5
|
+
// has some troubles with it. See
|
|
6
|
+
// https://github.com/adobe/react-spectrum/labels/strict%20mode
|
|
7
|
+
reactStrictMode: false,
|
|
8
|
+
experimental: {
|
|
9
|
+
appDir: true,
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports = nextConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nextjs-app-loader-ts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"lint": "next lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@plasmicapp/loader-nextjs": "^1.0.233",
|
|
13
|
+
"@types/node": "18.14.2",
|
|
14
|
+
"@types/react": "18.0.28",
|
|
15
|
+
"@types/react-dom": "18.0.11",
|
|
16
|
+
"eslint": "8.35.0",
|
|
17
|
+
"eslint-config-next": "13.2.3",
|
|
18
|
+
"next": "13.2.3",
|
|
19
|
+
"react": "18.2.0",
|
|
20
|
+
"react-dom": "18.2.0",
|
|
21
|
+
"typescript": "4.9.5"
|
|
22
|
+
}
|
|
23
|
+
}
|