create-plasmic-app 0.0.131 → 0.0.133

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 (78) hide show
  1. package/cpa-out/gatsby-codegen-js/package.json +4 -4
  2. package/cpa-out/gatsby-codegen-js/plasmic.json +7 -3
  3. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +11 -7
  4. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +32 -8
  5. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
  6. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +34 -13
  7. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +2 -0
  8. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.jsx +15 -0
  9. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
  10. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/plasmic.jsx +11 -0
  11. package/cpa-out/gatsby-codegen-ts/package.json +4 -4
  12. package/cpa-out/gatsby-codegen-ts/plasmic.json +7 -3
  13. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -8
  14. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +37 -9
  15. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
  16. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +38 -14
  17. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -1
  18. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +19 -0
  19. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
  20. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/plasmic.tsx +14 -0
  21. package/cpa-out/gatsby-loader-js/package.json +3 -3
  22. package/cpa-out/gatsby-loader-ts/package.json +3 -3
  23. package/cpa-out/nextjs-app-loader-js/package.json +3 -3
  24. package/cpa-out/nextjs-app-loader-ts/package.json +3 -3
  25. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +8 -6
  26. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +33 -7
  27. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
  28. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +33 -7
  29. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.jsx +2 -10
  30. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
  31. package/cpa-out/nextjs-pages-codegen-js/package.json +4 -4
  32. package/cpa-out/nextjs-pages-codegen-js/pages/dynamic/[slug].jsx +10 -7
  33. package/cpa-out/nextjs-pages-codegen-js/pages/index.jsx +10 -7
  34. package/cpa-out/nextjs-pages-codegen-js/plasmic.json +5 -3
  35. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +11 -7
  36. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +37 -8
  37. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
  38. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +37 -8
  39. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +3 -1
  40. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +2 -10
  41. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
  42. package/cpa-out/nextjs-pages-codegen-ts/package.json +4 -4
  43. package/cpa-out/nextjs-pages-codegen-ts/pages/dynamic/[slug].tsx +10 -7
  44. package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +10 -7
  45. package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +5 -3
  46. package/cpa-out/nextjs-pages-loader-js/package.json +3 -3
  47. package/cpa-out/nextjs-pages-loader-ts/package.json +3 -3
  48. package/cpa-out/react-codegen-js/eslint.config.js +1 -1
  49. package/cpa-out/react-codegen-js/package.json +13 -13
  50. package/cpa-out/react-codegen-js/plasmic.json +3 -2
  51. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +8 -6
  52. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +29 -7
  53. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +29 -7
  54. package/cpa-out/react-codegen-ts/eslint.config.js +1 -1
  55. package/cpa-out/react-codegen-ts/package.json +15 -15
  56. package/cpa-out/react-codegen-ts/plasmic.json +3 -2
  57. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +8 -6
  58. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +29 -7
  59. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +29 -7
  60. package/cpa-out/tanstack-codegen-ts/package.json +26 -22
  61. package/cpa-out/tanstack-codegen-ts/plasmic.json +6 -2
  62. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +22 -18
  63. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +42 -19
  64. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
  65. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +42 -23
  66. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +12 -11
  67. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +17 -0
  68. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__CheckSvg.tsx +1 -1
  69. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/plasmic.tsx +14 -0
  70. package/cpa-out/tanstack-codegen-ts/src/main.tsx +23 -0
  71. package/cpa-out/tanstack-codegen-ts/src/routeTree.gen.ts +3 -3
  72. package/cpa-out/tanstack-codegen-ts/src/router.tsx +8 -8
  73. package/cpa-out/tanstack-codegen-ts/tsconfig.json +5 -5
  74. package/cpa-out/tanstack-codegen-ts/vite.config.ts +8 -9
  75. package/dist/utils/file-utils.js +6 -1
  76. package/package.json +2 -2
  77. package/src/utils/file-utils.ts +8 -1
  78. package/cpa-out/tanstack-codegen-ts/src/components/Header.tsx +0 -21
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ // @ts-nocheck
4
+
5
+ // This code is auto-generated by Plasmic; please do not edit!
6
+ // Plasmic Project: 47tFXWjN2C4NyHFGGpaYQ3
7
+
8
+ import { createUseGlobalVariants } from "@plasmicapp/react-web";
9
+
10
+ import { useScreenVariants as useScreenVariantsscBjPxgdxdzbv } from "./PlasmicGlobalVariant__Screen"; // plasmic-import: SCBjPXGDXDZBV/globalVariant
11
+
12
+ export const _useGlobalVariants = createUseGlobalVariants({
13
+ screen: useScreenVariantsscBjPxgdxdzbv
14
+ });
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import { RouterProvider, createRouter } from '@tanstack/react-router'
4
+ import { routeTree } from './routeTree.gen'
5
+
6
+ const router = createRouter({
7
+ routeTree,
8
+ defaultPreload: 'intent',
9
+ scrollRestoration: true,
10
+ })
11
+
12
+ declare module '@tanstack/react-router' {
13
+ interface Register {
14
+ router: typeof router
15
+ }
16
+ }
17
+
18
+ const rootElement = document.getElementById('app')!
19
+
20
+ if (!rootElement.innerHTML) {
21
+ const root = ReactDOM.createRoot(rootElement)
22
+ root.render(<RouterProvider router={router} />)
23
+ }
@@ -32,7 +32,7 @@ const DynamicSlugIndexRoute = DynamicSlugIndexRouteImport.update({
32
32
  export interface FileRoutesByFullPath {
33
33
  '/': typeof IndexRoute
34
34
  '/plasmic-host': typeof PlasmicHostRoute
35
- '/dynamic/$slug': typeof DynamicSlugIndexRoute
35
+ '/dynamic/$slug/': typeof DynamicSlugIndexRoute
36
36
  }
37
37
  export interface FileRoutesByTo {
38
38
  '/': typeof IndexRoute
@@ -47,7 +47,7 @@ export interface FileRoutesById {
47
47
  }
48
48
  export interface FileRouteTypes {
49
49
  fileRoutesByFullPath: FileRoutesByFullPath
50
- fullPaths: '/' | '/plasmic-host' | '/dynamic/$slug'
50
+ fullPaths: '/' | '/plasmic-host' | '/dynamic/$slug/'
51
51
  fileRoutesByTo: FileRoutesByTo
52
52
  to: '/' | '/plasmic-host' | '/dynamic/$slug'
53
53
  id: '__root__' | '/' | '/plasmic-host' | '/dynamic/$slug/'
@@ -78,7 +78,7 @@ declare module '@tanstack/react-router' {
78
78
  '/dynamic/$slug/': {
79
79
  id: '/dynamic/$slug/'
80
80
  path: '/dynamic/$slug'
81
- fullPath: '/dynamic/$slug'
81
+ fullPath: '/dynamic/$slug/'
82
82
  preLoaderRoute: typeof DynamicSlugIndexRouteImport
83
83
  parentRoute: typeof rootRouteImport
84
84
  }
@@ -1,20 +1,20 @@
1
- import { createRouter as createTanstackRouter } from '@tanstack/react-router'
2
-
3
- // Import the generated route tree
1
+ import { createRouter as createTanStackRouter } from '@tanstack/react-router'
4
2
  import { routeTree } from './routeTree.gen'
5
3
 
6
- // Create a new router instance
7
- export const createRouter = () => {
8
- return createTanstackRouter({
4
+ export function getRouter() {
5
+ const router = createTanStackRouter({
9
6
  routeTree,
7
+
10
8
  scrollRestoration: true,
9
+ defaultPreload: 'intent',
11
10
  defaultPreloadStaleTime: 0,
12
11
  })
12
+
13
+ return router
13
14
  }
14
15
 
15
- // Register the router instance for type safety
16
16
  declare module '@tanstack/react-router' {
17
17
  interface Register {
18
- router: ReturnType<typeof createRouter>
18
+ router: ReturnType<typeof getRouter>
19
19
  }
20
20
  }
@@ -4,6 +4,10 @@
4
4
  "target": "ES2022",
5
5
  "jsx": "react-jsx",
6
6
  "module": "ESNext",
7
+ "baseUrl": ".",
8
+ "paths": {
9
+ "@/*": ["./src/*"]
10
+ },
7
11
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
8
12
  "types": ["vite/client"],
9
13
 
@@ -19,10 +23,6 @@
19
23
  "noUnusedLocals": true,
20
24
  "noUnusedParameters": true,
21
25
  "noFallthroughCasesInSwitch": true,
22
- "noUncheckedSideEffectImports": true,
23
- "baseUrl": ".",
24
- "paths": {
25
- "@/*": ["./src/*"],
26
- }
26
+ "noUncheckedSideEffectImports": true
27
27
  }
28
28
  }
@@ -1,7 +1,10 @@
1
1
  import { defineConfig } from 'vite'
2
- import { tanstackStart } from '@tanstack/react-start/plugin/vite'
2
+ import { devtools } from '@tanstack/devtools-vite'
3
+ import tsconfigPaths from 'vite-tsconfig-paths'
4
+
5
+ import { tanstackRouter } from '@tanstack/router-plugin/vite'
6
+
3
7
  import viteReact from '@vitejs/plugin-react'
4
- import viteTsConfigPaths from 'vite-tsconfig-paths'
5
8
  import tailwindcss from '@tailwindcss/vite'
6
9
 
7
10
  const config = defineConfig({
@@ -15,14 +18,10 @@ const config = defineConfig({
15
18
  ],
16
19
  },
17
20
  plugins: [
18
- // this is the plugin that enables path aliases
19
- viteTsConfigPaths({
20
- projects: ['./tsconfig.json'],
21
- }),
21
+ devtools(),
22
+ tsconfigPaths({ projects: ['./tsconfig.json'] }),
22
23
  tailwindcss(),
23
- tanstackStart({
24
- customViteReactPlugin: true,
25
- }),
24
+ tanstackRouter({ target: 'react', autoCodeSplitting: true }),
26
25
  viteReact(),
27
26
  ],
28
27
  })
@@ -146,12 +146,17 @@ function generateWelcomePage(config, platform) {
146
146
  getPageSection: () => {
147
147
  const pageLinks = components
148
148
  .map((pc) => {
149
+ var _a;
149
150
  // Get the relative path on the filesystem
150
151
  const relativePath = path.relative(dir, pc.importSpec.modulePath);
151
152
  // Format as an absolute path without the extension name
152
153
  const relativeLink = "/" + stripExtension(relativePath);
153
154
  if (platform === "nextjs") {
154
- return `<li><Link href="${relativeLink}">${pc.name} - ${relativeLink}</Link></li>`;
155
+ // Replace [param] with dummy values to avoid
156
+ // Next.js App Router error: "Dynamic href found in <Link>"
157
+ // https://nextjs.org/docs/messages/app-dir-dynamic-href
158
+ const href = ((_a = pc.path) !== null && _a !== void 0 ? _a : relativeLink).replace(/\[(\w+)\]/g, "placeholder");
159
+ return `<li><Link href="${href}">${pc.name} - ${pc.path}</Link></li>`;
155
160
  }
156
161
  else {
157
162
  return `<li><a style={{ color: "blue" }} href="${relativeLink}">${pc.name} - ${relativeLink}</a></li>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.131",
3
+ "version": "0.0.133",
4
4
  "description": "Create Plasmic-powered React apps",
5
5
  "main": "./dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
@@ -47,5 +47,5 @@
47
47
  "validate-npm-package-name": "^3.0.0",
48
48
  "yargs": "^16.2.0"
49
49
  },
50
- "gitHead": "0cff43ac752f86fd735d436e5852e538268d11bd"
50
+ "gitHead": "a18cd21936a28b372b3cbdd9f4a4c37b7d055eae"
51
51
  }
@@ -153,7 +153,14 @@ export function generateWelcomePage(
153
153
  // Format as an absolute path without the extension name
154
154
  const relativeLink = "/" + stripExtension(relativePath);
155
155
  if (platform === "nextjs") {
156
- return `<li><Link href="${relativeLink}">${pc.name} - ${relativeLink}</Link></li>`;
156
+ // Replace [param] with dummy values to avoid
157
+ // Next.js App Router error: "Dynamic href found in <Link>"
158
+ // https://nextjs.org/docs/messages/app-dir-dynamic-href
159
+ const href = (pc.path ?? relativeLink).replace(
160
+ /\[(\w+)\]/g,
161
+ "placeholder"
162
+ );
163
+ return `<li><Link href="${href}">${pc.name} - ${pc.path}</Link></li>`;
157
164
  } else {
158
165
  return `<li><a style={{ color: "blue" }} href="${relativeLink}">${pc.name} - ${relativeLink}</a></li>`;
159
166
  }
@@ -1,21 +0,0 @@
1
- import { Link } from '@tanstack/react-router'
2
-
3
- export default function Header() {
4
- return (
5
- <header className="p-2 flex gap-2 bg-white text-black justify-between">
6
- <nav className="flex flex-row">
7
- <div className="px-2 font-bold">
8
- <Link to="/">Home</Link>
9
- </div>
10
-
11
- <div className="px-2 font-bold">
12
- <Link to="/demo/start/server-funcs">Start - Server Functions</Link>
13
- </div>
14
-
15
- <div className="px-2 font-bold">
16
- <Link to="/demo/start/api-request">Start - API Request</Link>
17
- </div>
18
- </nav>
19
- </header>
20
- )
21
- }