create-plasmic-app 0.0.98 → 0.0.100

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.
Files changed (98) hide show
  1. package/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +2 -1
  2. package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +2 -1
  3. package/cpa-out/gatsby-codegen-js/package.json +4 -4
  4. package/cpa-out/gatsby-codegen-js/plasmic.json +14 -8
  5. package/cpa-out/gatsby-codegen-js/src/components/Button.jsx +1 -3
  6. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +53 -100
  7. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +36 -30
  8. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +3 -15
  9. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +25 -25
  10. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +45 -59
  11. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +3 -3
  12. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
  13. package/cpa-out/gatsby-codegen-js/src/pages/dynamic/[slug].jsx +5 -4
  14. package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +5 -4
  15. package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +2 -1
  16. package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +2 -1
  17. package/cpa-out/gatsby-codegen-ts/package.json +9 -9
  18. package/cpa-out/gatsby-codegen-ts/plasmic.json +14 -8
  19. package/cpa-out/gatsby-codegen-ts/src/components/Button.tsx +4 -5
  20. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +99 -75
  21. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +80 -49
  22. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +3 -15
  23. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +69 -43
  24. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +90 -77
  25. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +4 -4
  26. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
  27. package/cpa-out/gatsby-codegen-ts/src/pages/dynamic/[slug].tsx +6 -5
  28. package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +6 -5
  29. package/cpa-out/gatsby-loader-js/package.json +3 -3
  30. package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +1 -0
  31. package/cpa-out/gatsby-loader-ts/package.json +8 -8
  32. package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +1 -0
  33. package/cpa-out/nextjs-app-loader-js/package.json +8 -6
  34. package/cpa-out/nextjs-app-loader-js/plasmic-init.js +10 -1
  35. package/cpa-out/nextjs-app-loader-ts/package.json +12 -10
  36. package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +10 -1
  37. package/cpa-out/nextjs-app-loader-ts/tsconfig.json +2 -9
  38. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +6 -5
  39. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -1
  40. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
  41. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +1 -1
  42. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -1
  43. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
  44. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
  45. package/cpa-out/nextjs-pages-codegen-js/package.json +4 -4
  46. package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +2 -1
  47. package/cpa-out/nextjs-pages-codegen-js/plasmic.json +2 -2
  48. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -14
  49. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +7 -7
  50. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
  51. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -7
  52. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -7
  53. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
  54. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
  55. package/cpa-out/nextjs-pages-codegen-ts/package.json +4 -4
  56. package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +2 -1
  57. package/cpa-out/nextjs-pages-codegen-ts/pages/dynamic/[slug].tsx +1 -0
  58. package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +1 -0
  59. package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +2 -2
  60. package/cpa-out/nextjs-pages-loader-js/package.json +3 -3
  61. package/cpa-out/nextjs-pages-loader-ts/package.json +3 -3
  62. package/cpa-out/react-codegen-js/eslint.config.js +1 -6
  63. package/cpa-out/react-codegen-js/package.json +10 -11
  64. package/cpa-out/react-codegen-js/plasmic.json +2 -2
  65. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +6 -5
  66. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -1
  67. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
  68. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +1 -1
  69. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -1
  70. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
  71. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
  72. package/cpa-out/react-codegen-ts/package.json +11 -11
  73. package/cpa-out/react-codegen-ts/plasmic.json +2 -2
  74. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -14
  75. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +7 -7
  76. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
  77. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -7
  78. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -7
  79. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
  80. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
  81. package/dist/index.js +7 -8
  82. package/dist/utils/file-utils.d.ts +2 -2
  83. package/dist/utils/file-utils.js +29 -28
  84. package/package.json +5 -13
  85. package/run-cpa.ts +8 -6
  86. package/src/index.ts +7 -9
  87. package/src/utils/file-utils.ts +44 -30
  88. package/.eslintrc.js +0 -15
  89. package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +0 -56
  90. package/cpa-out/nextjs-app-loader-js/app/api/hello/route.js +0 -3
  91. package/cpa-out/nextjs-app-loader-js/app/layout.js +0 -14
  92. package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +0 -6
  93. package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +0 -65
  94. package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +0 -59
  95. package/cpa-out/nextjs-app-loader-ts/app/api/hello/route.ts +0 -3
  96. package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +0 -18
  97. package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +0 -6
  98. package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +0 -65
@@ -1,56 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- export async function GET(request) {
2
- return new Response('Hello, Next.js!')
3
- }
@@ -1,14 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- import { PlasmicCanvasHost } from "@plasmicapp/loader-nextjs";
2
- import "@/plasmic-init-client";
3
-
4
- export default function PlasmicHost() {
5
- return <PlasmicCanvasHost />;
6
- }
@@ -1,65 +0,0 @@
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
- }
@@ -1,59 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- export async function GET(request: Request) {
2
- return new Response('Hello, Next.js!')
3
- }
@@ -1,18 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- import { PlasmicCanvasHost } from "@plasmicapp/loader-nextjs";
2
- import "@/plasmic-init-client";
3
-
4
- export default function PlasmicHost() {
5
- return <PlasmicCanvasHost />;
6
- }
@@ -1,65 +0,0 @@
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: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">
61
- ) {
62
- return (
63
- <PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>
64
- );
65
- }