create-plasmic-app 0.0.99 → 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 (92) 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/package.json +2 -2
  82. package/run-cpa.ts +8 -6
  83. package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +0 -56
  84. package/cpa-out/nextjs-app-loader-js/app/api/hello/route.js +0 -3
  85. package/cpa-out/nextjs-app-loader-js/app/layout.js +0 -14
  86. package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +0 -6
  87. package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +0 -65
  88. package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +0 -59
  89. package/cpa-out/nextjs-app-loader-ts/app/api/hello/route.ts +0 -3
  90. package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +0 -18
  91. package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +0 -6
  92. package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +0 -65
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  import * as React from "react";
6
6
  import { createUseScreenVariants } from "@plasmicapp/react-web";
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  /** @jsxRuntime classic */
6
6
  /** @jsx createPlasmicElementProxy */
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  /** @jsxRuntime classic */
6
6
  /** @jsx createPlasmicElementProxy */
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  import React from "react";
6
6
  import { classNames } from "@plasmicapp/react-web";
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  import React from "react";
6
6
  import { classNames } from "@plasmicapp/react-web";
@@ -10,22 +10,22 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@plasmicapp/cli": "^0.1.335",
14
- "@plasmicapp/react-web": "^0.2.366",
13
+ "@plasmicapp/cli": "^0.1.337",
14
+ "@plasmicapp/react-web": "^0.2.381",
15
15
  "react": "^19.0.0",
16
16
  "react-dom": "^19.0.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@eslint/js": "^9.19.0",
20
- "@types/react": "^19.0.8",
21
- "@types/react-dom": "^19.0.3",
19
+ "@eslint/js": "^9.22.0",
20
+ "@types/react": "^19.0.10",
21
+ "@types/react-dom": "^19.0.4",
22
22
  "@vitejs/plugin-react": "^4.3.4",
23
- "eslint": "^9.19.0",
24
- "eslint-plugin-react-hooks": "^5.0.0",
25
- "eslint-plugin-react-refresh": "^0.4.18",
26
- "globals": "^15.14.0",
23
+ "eslint": "^9.22.0",
24
+ "eslint-plugin-react-hooks": "^5.2.0",
25
+ "eslint-plugin-react-refresh": "^0.4.19",
26
+ "globals": "^16.0.0",
27
27
  "typescript": "~5.7.2",
28
- "typescript-eslint": "^8.22.0",
29
- "vite": "^6.1.0"
28
+ "typescript-eslint": "^8.26.1",
29
+ "vite": "^6.3.1"
30
30
  }
31
31
  }
@@ -128,6 +128,6 @@
128
128
  ]
129
129
  },
130
130
  "wrapPagesWithGlobalContexts": true,
131
- "cliVersion": "0.1.335",
132
- "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.335/dist/plasmic.schema.json"
131
+ "cliVersion": "0.1.337",
132
+ "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.337/dist/plasmic.schema.json"
133
133
  }
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
 
6
6
  /** @jsxRuntime classic */
@@ -121,19 +121,21 @@ export const PlasmicButton__VariantProps = new Array<VariantPropType>(
121
121
  );
122
122
 
123
123
  export type PlasmicButton__ArgsType = {
124
- children?: React.ReactNode;
125
- startIcon?: React.ReactNode;
126
- endIcon?: React.ReactNode;
127
124
  link?: string;
128
125
  submitsForm?: boolean;
126
+ target?: boolean;
127
+ startIcon?: React.ReactNode;
128
+ children?: React.ReactNode;
129
+ endIcon?: React.ReactNode;
129
130
  };
130
131
  type ArgPropType = keyof PlasmicButton__ArgsType;
131
132
  export const PlasmicButton__ArgProps = new Array<ArgPropType>(
132
- "children",
133
- "startIcon",
134
- "endIcon",
135
133
  "link",
136
- "submitsForm"
134
+ "submitsForm",
135
+ "target",
136
+ "startIcon",
137
+ "children",
138
+ "endIcon"
137
139
  );
138
140
 
139
141
  export type PlasmicButton__OverridesType = {
@@ -145,6 +147,7 @@ export type PlasmicButton__OverridesType = {
145
147
 
146
148
  export interface DefaultButtonProps extends pp.BaseButtonProps {
147
149
  submitsForm?: boolean;
150
+ target?: boolean;
148
151
  shape?: SingleChoiceArg<"rounded" | "round" | "sharp">;
149
152
  size?: SingleChoiceArg<"compact" | "minimal">;
150
153
  color?: SingleChoiceArg<
@@ -683,15 +686,15 @@ type NodeComponentProps<T extends NodeNameType> =
683
686
  args?: PlasmicButton__ArgsType;
684
687
  overrides?: NodeOverridesType<T>;
685
688
  } & Omit<PlasmicButton__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
686
- /* Specify args directly as props*/ Omit<
687
- PlasmicButton__ArgsType,
688
- ReservedPropsType
689
- > &
690
- /* Specify overrides for each element directly as props*/ Omit<
689
+ // Specify args directly as props
690
+ Omit<PlasmicButton__ArgsType, ReservedPropsType> &
691
+ // Specify overrides for each element directly as props
692
+ Omit<
691
693
  NodeOverridesType<T>,
692
694
  ReservedPropsType | VariantPropType | ArgPropType
693
695
  > &
694
- /* Specify props for the root element*/ Omit<
696
+ // Specify props for the root element
697
+ Omit<
695
698
  Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
696
699
  ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
697
700
  >;
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
 
6
6
  /** @jsxRuntime classic */
@@ -207,15 +207,15 @@ type NodeComponentProps<T extends NodeNameType> =
207
207
  args?: PlasmicDynamicPage__ArgsType;
208
208
  overrides?: NodeOverridesType<T>;
209
209
  } & Omit<PlasmicDynamicPage__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
210
- /* Specify args directly as props*/ Omit<
211
- PlasmicDynamicPage__ArgsType,
212
- ReservedPropsType
213
- > &
214
- /* Specify overrides for each element directly as props*/ Omit<
210
+ // Specify args directly as props
211
+ Omit<PlasmicDynamicPage__ArgsType, ReservedPropsType> &
212
+ // Specify overrides for each element directly as props
213
+ Omit<
215
214
  NodeOverridesType<T>,
216
215
  ReservedPropsType | VariantPropType | ArgPropType
217
216
  > &
218
- /* Specify props for the root element*/ Omit<
217
+ // Specify props for the root element
218
+ Omit<
219
219
  Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
220
220
  ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
221
221
  >;
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
 
6
6
  import * as React from "react";
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
 
6
6
  /** @jsxRuntime classic */
@@ -247,15 +247,15 @@ type NodeComponentProps<T extends NodeNameType> =
247
247
  args?: PlasmicHomepage__ArgsType;
248
248
  overrides?: NodeOverridesType<T>;
249
249
  } & Omit<PlasmicHomepage__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
250
- /* Specify args directly as props*/ Omit<
251
- PlasmicHomepage__ArgsType,
252
- ReservedPropsType
253
- > &
254
- /* Specify overrides for each element directly as props*/ Omit<
250
+ // Specify args directly as props
251
+ Omit<PlasmicHomepage__ArgsType, ReservedPropsType> &
252
+ // Specify overrides for each element directly as props
253
+ Omit<
255
254
  NodeOverridesType<T>,
256
255
  ReservedPropsType | VariantPropType | ArgPropType
257
256
  > &
258
- /* Specify props for the root element*/ Omit<
257
+ // Specify props for the root element
258
+ Omit<
259
259
  Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
260
260
  ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
261
261
  >;
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
 
6
6
  /** @jsxRuntime classic */
@@ -194,15 +194,15 @@ type NodeComponentProps<T extends NodeNameType> =
194
194
  args?: PlasmicRandomDynamicPageButton__ArgsType;
195
195
  overrides?: NodeOverridesType<T>;
196
196
  } & Omit<PlasmicRandomDynamicPageButton__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
197
- /* Specify args directly as props*/ Omit<
198
- PlasmicRandomDynamicPageButton__ArgsType,
199
- ReservedPropsType
200
- > &
201
- /* Specify overrides for each element directly as props*/ Omit<
197
+ // Specify args directly as props
198
+ Omit<PlasmicRandomDynamicPageButton__ArgsType, ReservedPropsType> &
199
+ // Specify overrides for each element directly as props
200
+ Omit<
202
201
  NodeOverridesType<T>,
203
202
  ReservedPropsType | VariantPropType | ArgPropType
204
203
  > &
205
- /* Specify props for the root element*/ Omit<
204
+ // Specify props for the root element
205
+ Omit<
206
206
  Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
207
207
  ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
208
208
  >;
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  import React from "react";
6
6
  import { classNames } from "@plasmicapp/react-web";
@@ -1,6 +1,6 @@
1
- // @ts-nocheck
2
1
  /* eslint-disable */
3
2
  /* tslint:disable */
3
+ // @ts-nocheck
4
4
  /* prettier-ignore-start */
5
5
  import React from "react";
6
6
  import { classNames } from "@plasmicapp/react-web";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "description": "Create Plasmic-powered React apps",
5
5
  "main": "./dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
@@ -46,5 +46,5 @@
46
46
  "validate-npm-package-name": "^3.0.0",
47
47
  "yargs": "^16.2.0"
48
48
  },
49
- "gitHead": "951909f9952ffe42fefb6e15a1797cdc1aee1197"
49
+ "gitHead": "46ededb427fd9f6b017065e6623a082de0f10ec8"
50
50
  }
package/run-cpa.ts CHANGED
@@ -30,11 +30,13 @@ async function run() {
30
30
  scheme,
31
31
  typescript,
32
32
  });
33
- allArgSets.push({
34
- platform: "react",
35
- scheme,
36
- typescript,
37
- });
33
+ if (scheme === "codegen") {
34
+ allArgSets.push({
35
+ platform: "react",
36
+ scheme,
37
+ typescript,
38
+ });
39
+ }
38
40
  });
39
41
 
40
42
  allArgSets.push({
@@ -69,7 +71,7 @@ Valid arg sets:\n\tall\n\t${allArgSetNames.join("\n\t")}`,
69
71
  message: "Select arg sets:",
70
72
  choices: allArgSetNames,
71
73
  pageSize: allArgSetNames.length,
72
- validate: (input) => {
74
+ validate: (input: string[]) => {
73
75
  if (input.length === 0) {
74
76
  return "Please select at least 1 arg set.";
75
77
  }
@@ -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
- }