create-plasmic-app 0.0.167 → 0.0.169

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 (122) hide show
  1. package/README.internal.md +6 -4
  2. package/cpa-out/gatsby-codegen-js/package.json +3 -2
  3. package/cpa-out/gatsby-codegen-js/plasmic.json +5 -8
  4. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +12 -12
  5. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +18 -18
  6. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +12 -16
  7. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -0
  8. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.jsx +2 -2
  9. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/{plasmic.module.css → plasmic.css} +89 -73
  10. package/cpa-out/gatsby-codegen-js/src/components/plasmic/{plasmic__default_style.module.css → plasmic__default_style.css} +16 -0
  11. package/cpa-out/gatsby-codegen-ts/package.json +3 -2
  12. package/cpa-out/gatsby-codegen-ts/plasmic.json +5 -8
  13. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +12 -12
  14. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +18 -18
  15. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +12 -16
  16. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +1 -1
  17. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +2 -2
  18. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/{plasmic.module.css → plasmic.css} +89 -73
  19. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/{plasmic__default_style.module.css → plasmic__default_style.css} +16 -0
  20. package/cpa-out/gatsby-loader-js/package.json +1 -1
  21. package/cpa-out/gatsby-loader-ts/package.json +1 -1
  22. package/cpa-out/nextjs-app-codegen-js/app/dynamic/[slug]/page.jsx +5 -5
  23. package/cpa-out/nextjs-app-codegen-js/app/robots.js +24 -0
  24. package/cpa-out/nextjs-app-codegen-js/app/sitemap.js +38 -0
  25. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
  26. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.jsx +2 -2
  27. package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/plasmic.css +16 -0
  28. package/cpa-out/nextjs-app-codegen-js/components/plasmic/plasmic__default_style.css +16 -0
  29. package/cpa-out/nextjs-app-codegen-js/package.json +7 -6
  30. package/cpa-out/nextjs-app-codegen-js/plasmic.json +3 -6
  31. package/cpa-out/nextjs-app-codegen-ts/app/dynamic/[slug]/page.tsx +8 -11
  32. package/cpa-out/nextjs-app-codegen-ts/app/page.tsx +4 -4
  33. package/cpa-out/nextjs-app-codegen-ts/app/robots.ts +25 -0
  34. package/cpa-out/nextjs-app-codegen-ts/app/sitemap.ts +41 -0
  35. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
  36. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.tsx +7 -13
  37. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepageServer.tsx +5 -11
  38. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/plasmic.css +16 -0
  39. package/cpa-out/nextjs-app-codegen-ts/components/plasmic/plasmic__default_style.css +16 -0
  40. package/cpa-out/nextjs-app-codegen-ts/package.json +7 -6
  41. package/cpa-out/nextjs-app-codegen-ts/plasmic.json +3 -6
  42. package/cpa-out/nextjs-app-loader-js/app/robots.js +24 -0
  43. package/cpa-out/nextjs-app-loader-js/app/sitemap.js +29 -0
  44. package/cpa-out/nextjs-app-loader-js/package.json +5 -5
  45. package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +1 -5
  46. package/cpa-out/nextjs-app-loader-ts/app/robots.ts +25 -0
  47. package/cpa-out/nextjs-app-loader-ts/app/sitemap.ts +30 -0
  48. package/cpa-out/nextjs-app-loader-ts/package.json +5 -5
  49. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
  50. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/plasmic.css +16 -0
  51. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/plasmic__default_style.css +16 -0
  52. package/cpa-out/nextjs-pages-codegen-js/package.json +7 -6
  53. package/cpa-out/nextjs-pages-codegen-js/pages/robots.txt.js +25 -0
  54. package/cpa-out/nextjs-pages-codegen-js/pages/sitemap.xml.js +53 -0
  55. package/cpa-out/nextjs-pages-codegen-js/plasmic.json +3 -6
  56. package/cpa-out/nextjs-pages-codegen-js/styles/Home.module.css +8 -0
  57. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
  58. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/plasmic.css +16 -0
  59. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/plasmic__default_style.css +16 -0
  60. package/cpa-out/nextjs-pages-codegen-ts/package.json +7 -6
  61. package/cpa-out/nextjs-pages-codegen-ts/pages/robots.txt.ts +27 -0
  62. package/cpa-out/nextjs-pages-codegen-ts/pages/sitemap.xml.ts +56 -0
  63. package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +3 -6
  64. package/cpa-out/nextjs-pages-codegen-ts/styles/Home.module.css +8 -0
  65. package/cpa-out/nextjs-pages-loader-js/package.json +5 -5
  66. package/cpa-out/nextjs-pages-loader-js/pages/robots.txt.js +25 -0
  67. package/cpa-out/nextjs-pages-loader-js/pages/sitemap.xml.js +46 -0
  68. package/cpa-out/nextjs-pages-loader-js/styles/Home.module.css +8 -0
  69. package/cpa-out/nextjs-pages-loader-ts/package.json +5 -5
  70. package/cpa-out/nextjs-pages-loader-ts/pages/robots.txt.ts +27 -0
  71. package/cpa-out/nextjs-pages-loader-ts/pages/sitemap.xml.ts +47 -0
  72. package/cpa-out/nextjs-pages-loader-ts/styles/Home.module.css +8 -0
  73. package/cpa-out/react-codegen-js/package.json +3 -2
  74. package/cpa-out/react-codegen-js/plasmic.json +3 -6
  75. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
  76. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/plasmic.css +16 -0
  77. package/cpa-out/react-codegen-js/src/components/plasmic/plasmic__default_style.css +16 -0
  78. package/cpa-out/react-codegen-ts/package.json +3 -2
  79. package/cpa-out/react-codegen-ts/plasmic.json +3 -6
  80. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
  81. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/plasmic.css +16 -0
  82. package/cpa-out/react-codegen-ts/src/components/plasmic/plasmic__default_style.css +16 -0
  83. package/cpa-out/tanstack-codegen-ts/package.json +8 -13
  84. package/cpa-out/tanstack-codegen-ts/plasmic.json +3 -6
  85. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +3 -3
  86. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/plasmic__default_style.css +16 -0
  87. package/cpa-out/tanstack-codegen-ts/src/routeTree.gen.ts +13 -13
  88. package/cpa-out/tanstack-codegen-ts/src/routes/dynamic/$slug/index.tsx +2 -2
  89. package/dist/gatsby/gatsby.js +23 -17
  90. package/dist/index.js +6 -0
  91. package/dist/lib.d.ts +2 -1
  92. package/dist/lib.js +9 -4
  93. package/dist/nextjs/nextjs.js +30 -6
  94. package/dist/nextjs/templates/app-seo.d.ts +4 -0
  95. package/dist/nextjs/templates/app-seo.js +92 -0
  96. package/dist/nextjs/templates/pages-seo.d.ts +4 -0
  97. package/dist/nextjs/templates/pages-seo.js +121 -0
  98. package/dist/react/react.js +9 -4
  99. package/dist/tanstack/tanstack.js +12 -5
  100. package/dist/utils/codegen.d.ts +3 -0
  101. package/dist/utils/codegen.js +17 -4
  102. package/dist/utils/file-utils.d.ts +2 -2
  103. package/dist/utils/file-utils.js +2 -1
  104. package/dist/utils/npm-utils.d.ts +24 -9
  105. package/dist/utils/npm-utils.js +66 -21
  106. package/dist/utils/strategy.d.ts +5 -1
  107. package/dist/utils/types.d.ts +1 -0
  108. package/package.json +2 -4
  109. package/run-cpa.ts +17 -6
  110. package/src/gatsby/gatsby.ts +40 -22
  111. package/src/index.ts +9 -0
  112. package/src/lib.ts +18 -6
  113. package/src/nextjs/nextjs.ts +85 -7
  114. package/src/nextjs/templates/app-seo.ts +104 -0
  115. package/src/nextjs/templates/pages-seo.ts +131 -0
  116. package/src/react/react.ts +11 -4
  117. package/src/tanstack/tanstack.ts +19 -6
  118. package/src/utils/codegen.ts +28 -6
  119. package/src/utils/file-utils.ts +6 -2
  120. package/src/utils/npm-utils.ts +76 -23
  121. package/src/utils/strategy.ts +10 -1
  122. package/src/utils/types.ts +1 -0
@@ -0,0 +1,47 @@
1
+ import { PLASMIC } from "@/plasmic-init";
2
+ import type { GetServerSideProps } from "next";
3
+
4
+ function escapeXml(str: string) {
5
+ return str
6
+ .replace(/&/g, "&")
7
+ .replace(/</g, "&lt;")
8
+ .replace(/>/g, "&gt;")
9
+ .replace(/"/g, "&quot;")
10
+ .replace(/'/g, "&apos;");
11
+ }
12
+
13
+ function makeSitemapXml(urls: string[]) {
14
+ const entries = urls.map(
15
+ (url) => ` <url><loc>${escapeXml(url)}</loc></url>`
16
+ );
17
+ return `<?xml version="1.0" encoding="UTF-8"?>
18
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
19
+ ${entries.join("\n")}
20
+ </urlset>
21
+ `;
22
+ }
23
+
24
+ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
25
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
26
+ // otherwise it is derived per-request from the request headers.
27
+ const siteUrl =
28
+ process.env.NEXT_PUBLIC_SITE_URL ??
29
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
30
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
31
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
32
+ req.headers["x-forwarded-host"] ?? req.headers.host
33
+ }`);
34
+
35
+ // fetchPages() drops pages whose path takes a param, e.g. "/blog/[slug]".
36
+ const pages = await PLASMIC.fetchPages();
37
+ const urls = pages.map((page) => new URL(page.path, siteUrl).toString());
38
+
39
+ res.setHeader("Content-Type", "application/xml; charset=utf-8");
40
+ res.write(makeSitemapXml(urls));
41
+ res.end();
42
+ return { props: {} };
43
+ };
44
+
45
+ export default function Sitemap() {
46
+ return null;
47
+ }
@@ -139,3 +139,11 @@ a.secondary {
139
139
  --button-secondary-border: #1a1a1a;
140
140
  }
141
141
  }
142
+
143
+ .code {
144
+ font-family: var(--font-geist-mono);
145
+ font-size: 0.9em;
146
+ background: color-mix(in srgb, currentColor 8%, transparent);
147
+ padding: 0.1em 0.4em;
148
+ border-radius: 6px;
149
+ }
@@ -10,8 +10,9 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@plasmicapp/cli": "^0.1.364",
14
- "@plasmicapp/react-web": "^1.0.12",
13
+ "@plasmicapp/cli": "^0.1.372",
14
+ "@plasmicapp/host": "^2.0.17",
15
+ "@plasmicapp/react-web": "^1.0.32",
15
16
  "react": "^18.3.1",
16
17
  "react-dom": "^18.3.1"
17
18
  },
@@ -14,10 +14,6 @@
14
14
  "publicDir": "../public",
15
15
  "publicUrlPrefix": "/static/"
16
16
  },
17
- "tokens": {
18
- "scheme": "theo",
19
- "tokensFilePath": "plasmic-tokens.theo.json"
20
- },
21
17
  "srcDir": "src/components",
22
18
  "defaultPlasmicDir": "./plasmic",
23
19
  "projects": [
@@ -132,6 +128,7 @@
132
128
  },
133
129
  "wrapPagesWithGlobalContexts": true,
134
130
  "preserveJsImportExtensions": false,
135
- "cliVersion": "0.1.364",
136
- "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.364/dist/plasmic.schema.json"
131
+ "cliVersion": "0.1.372",
132
+ "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.372/dist/plasmic.schema.json",
133
+ "packageManager": "npm"
137
134
  }
@@ -15,7 +15,7 @@ import {
15
15
  deriveRenderOpts
16
16
  } from "@plasmicapp/react-web";
17
17
  import { useDataEnv } from "@plasmicapp/react-web/lib/host";
18
- import { unstable_usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
18
+ import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
19
19
  import RandomDynamicPageButton from "../../RandomDynamicPageButton"; // plasmic-import: Q23H1_1M_P/component
20
20
  import { _useStyleTokens } from "./PlasmicStyleTokensProvider"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/styleTokensProvider
21
21
  import "@plasmicapp/react-web/lib/plasmic.css";
@@ -105,7 +105,7 @@ function PlasmicDynamicPage__RenderFunc(props) {
105
105
  const $ctx = useDataEnv?.() || {};
106
106
  const refsRef = React.useRef({});
107
107
  const $refs = refsRef.current;
108
- const $q = unstable_usePlasmicQueries(serverQueryTree, $ctx, $props, null);
108
+ const $q = usePlasmicQueries(serverQueryTree, { $ctx, $props, $state: null });
109
109
  const styleTokensClassNames = _useStyleTokens();
110
110
  return (
111
111
  <React.Fragment>
@@ -323,6 +323,22 @@
323
323
  text-transform: inherit;
324
324
  }
325
325
 
326
+ :where(.b) {
327
+ font-family: inherit;
328
+ line-height: inherit;
329
+ font-size: inherit;
330
+ color: inherit;
331
+ text-transform: inherit;
332
+ }
333
+ :where(.__wab_expr_html_text b) {
334
+ white-space: inherit;
335
+ font-family: inherit;
336
+ line-height: inherit;
337
+ font-size: inherit;
338
+ color: inherit;
339
+ text-transform: inherit;
340
+ }
341
+
326
342
  :where(.i) {
327
343
  font-family: inherit;
328
344
  line-height: inherit;
@@ -186,6 +186,22 @@
186
186
  text-transform: inherit;
187
187
  }
188
188
 
189
+ :where(.b) {
190
+ font-family: inherit;
191
+ line-height: inherit;
192
+ font-size: inherit;
193
+ color: inherit;
194
+ text-transform: inherit;
195
+ }
196
+ :where(.__wab_expr_html_text b) {
197
+ white-space: inherit;
198
+ font-family: inherit;
199
+ line-height: inherit;
200
+ font-size: inherit;
201
+ color: inherit;
202
+ text-transform: inherit;
203
+ }
204
+
189
205
  :where(.i) {
190
206
  font-family: inherit;
191
207
  line-height: inherit;
@@ -10,8 +10,9 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@plasmicapp/cli": "^0.1.364",
14
- "@plasmicapp/react-web": "^1.0.12",
13
+ "@plasmicapp/cli": "^0.1.372",
14
+ "@plasmicapp/host": "^2.0.17",
15
+ "@plasmicapp/react-web": "^1.0.32",
15
16
  "react": "^18.3.1",
16
17
  "react-dom": "^18.3.1"
17
18
  },
@@ -14,10 +14,6 @@
14
14
  "publicDir": "../public",
15
15
  "publicUrlPrefix": "/static/"
16
16
  },
17
- "tokens": {
18
- "scheme": "theo",
19
- "tokensFilePath": "plasmic-tokens.theo.json"
20
- },
21
17
  "srcDir": "src/components",
22
18
  "defaultPlasmicDir": "./plasmic",
23
19
  "projects": [
@@ -132,6 +128,7 @@
132
128
  },
133
129
  "wrapPagesWithGlobalContexts": true,
134
130
  "preserveJsImportExtensions": false,
135
- "cliVersion": "0.1.364",
136
- "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.364/dist/plasmic.schema.json"
131
+ "cliVersion": "0.1.372",
132
+ "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.372/dist/plasmic.schema.json",
133
+ "packageManager": "npm"
137
134
  }
@@ -57,7 +57,7 @@ import {
57
57
 
58
58
  import { useMutablePlasmicQueryData } from "@plasmicapp/query";
59
59
 
60
- import { unstable_usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
60
+ import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
61
61
  import type {
62
62
  PlasmicQuery,
63
63
  PlasmicQueryResult
@@ -189,7 +189,7 @@ function PlasmicDynamicPage__RenderFunc(props: {
189
189
  const refsRef = React.useRef({});
190
190
  const $refs = refsRef.current;
191
191
 
192
- const $q = unstable_usePlasmicQueries(serverQueryTree, $ctx, $props, null);
192
+ const $q = usePlasmicQueries(serverQueryTree, { $ctx, $props, $state: null });
193
193
 
194
194
  const styleTokensClassNames = _useStyleTokens();
195
195
 
@@ -323,6 +323,22 @@
323
323
  text-transform: inherit;
324
324
  }
325
325
 
326
+ :where(.b) {
327
+ font-family: inherit;
328
+ line-height: inherit;
329
+ font-size: inherit;
330
+ color: inherit;
331
+ text-transform: inherit;
332
+ }
333
+ :where(.__wab_expr_html_text b) {
334
+ white-space: inherit;
335
+ font-family: inherit;
336
+ line-height: inherit;
337
+ font-size: inherit;
338
+ color: inherit;
339
+ text-transform: inherit;
340
+ }
341
+
326
342
  :where(.i) {
327
343
  font-family: inherit;
328
344
  line-height: inherit;
@@ -186,6 +186,22 @@
186
186
  text-transform: inherit;
187
187
  }
188
188
 
189
+ :where(.b) {
190
+ font-family: inherit;
191
+ line-height: inherit;
192
+ font-size: inherit;
193
+ color: inherit;
194
+ text-transform: inherit;
195
+ }
196
+ :where(.__wab_expr_html_text b) {
197
+ white-space: inherit;
198
+ font-family: inherit;
199
+ line-height: inherit;
200
+ font-size: inherit;
201
+ color: inherit;
202
+ text-transform: inherit;
203
+ }
204
+
189
205
  :where(.i) {
190
206
  font-family: inherit;
191
207
  line-height: inherit;
@@ -7,38 +7,33 @@
7
7
  },
8
8
  "scripts": {
9
9
  "dev": "vite dev --port 3000",
10
+ "generate-routes": "tsr generate",
10
11
  "build": "vite build",
11
- "preview": "vite preview",
12
- "test": "vitest run"
12
+ "preview": "vite preview"
13
13
  },
14
14
  "dependencies": {
15
- "@plasmicapp/cli": "^0.1.363",
16
- "@plasmicapp/react-web": "^1.0.10",
15
+ "@plasmicapp/cli": "^0.1.372",
16
+ "@plasmicapp/host": "^2.0.17",
17
+ "@plasmicapp/react-web": "^1.0.32",
17
18
  "@tailwindcss/vite": "^4.1.18",
18
19
  "@tanstack/react-devtools": "latest",
19
- "@tanstack/react-query": "^5.101.0",
20
+ "@tanstack/react-query": "^5.101.4",
20
21
  "@tanstack/react-router": "latest",
21
22
  "@tanstack/react-router-devtools": "latest",
22
- "@tanstack/router-plugin": "^1.132.0",
23
- "lucide-react": "^0.545.0",
24
23
  "react": "^19.2.0",
25
24
  "react-dom": "^19.2.0",
26
25
  "tailwindcss": "^4.1.18"
27
26
  },
28
27
  "devDependencies": {
29
- "@tailwindcss/typography": "^0.5.16",
30
28
  "@tanstack/devtools-vite": "latest",
29
+ "@tanstack/router-cli": "^1.132.0",
31
30
  "@tanstack/router-plugin": "latest",
32
- "@testing-library/dom": "^10.4.1",
33
- "@testing-library/react": "^16.3.0",
34
31
  "@types/node": "^22.10.2",
35
32
  "@types/react": "^19.2.0",
36
33
  "@types/react-dom": "^19.2.0",
37
34
  "@vitejs/plugin-react": "^6.0.1",
38
- "jsdom": "^28.1.0",
39
35
  "typescript": "^6.0.2",
40
- "vite": "^8.0.0",
41
- "vitest": "^4.1.5"
36
+ "vite": "^8.0.0"
42
37
  },
43
38
  "pnpm": {
44
39
  "onlyBuiltDependencies": [
@@ -14,10 +14,6 @@
14
14
  "publicDir": "../../public",
15
15
  "publicUrlPrefix": "/"
16
16
  },
17
- "tokens": {
18
- "scheme": "theo",
19
- "tokensFilePath": "plasmic-tokens.theo.json"
20
- },
21
17
  "srcDir": "src/components",
22
18
  "defaultPlasmicDir": "./plasmic",
23
19
  "projects": [
@@ -135,6 +131,7 @@
135
131
  "tanstackConfig": {
136
132
  "pagesDir": "../routes"
137
133
  },
138
- "cliVersion": "0.1.363",
139
- "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.363/dist/plasmic.schema.json"
134
+ "cliVersion": "0.1.372",
135
+ "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.372/dist/plasmic.schema.json",
136
+ "packageManager": "npm"
140
137
  }
@@ -60,7 +60,7 @@ import {
60
60
 
61
61
  import { useMutablePlasmicQueryData } from "@plasmicapp/query";
62
62
 
63
- import { unstable_usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
63
+ import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
64
64
  import type {
65
65
  PlasmicQuery,
66
66
  PlasmicQueryResult
@@ -135,7 +135,7 @@ export const serverQueryTree: QueryComponentNode = {
135
135
  type: "component",
136
136
  queries: {
137
137
  sha256: {
138
- id: "custom:krgWtF9Kkesx",
138
+ id: "custom-code:krgWtF9Kkesx",
139
139
  fn: async ({ $q, $props, $ctx, $state }) => {
140
140
  console.log("Running SHA-256");
141
141
  const data = new TextEncoder().encode($ctx.params.slug);
@@ -199,7 +199,7 @@ function PlasmicDynamicPage__RenderFunc(props: {
199
199
  const refsRef = React.useRef({});
200
200
  const $refs = refsRef.current;
201
201
 
202
- const $q = unstable_usePlasmicQueries(serverQueryTree, $ctx, $props, null);
202
+ const $q = usePlasmicQueries(serverQueryTree, { $ctx, $props, $state: null });
203
203
 
204
204
  const styleTokensClassNames = _useStyleTokens();
205
205
 
@@ -186,6 +186,22 @@
186
186
  text-transform: inherit;
187
187
  }
188
188
 
189
+ :where(.plasmic_default__b) {
190
+ font-family: inherit;
191
+ line-height: inherit;
192
+ font-size: inherit;
193
+ color: inherit;
194
+ text-transform: inherit;
195
+ }
196
+ :where(.__wab_expr_html_text b) {
197
+ white-space: inherit;
198
+ font-family: inherit;
199
+ line-height: inherit;
200
+ font-size: inherit;
201
+ color: inherit;
202
+ text-transform: inherit;
203
+ }
204
+
189
205
  :where(.plasmic_default__i) {
190
206
  font-family: inherit;
191
207
  line-height: inherit;
@@ -9,20 +9,20 @@
9
9
  // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
10
 
11
11
  import { Route as rootRouteImport } from './routes/__root'
12
- import { Route as PlasmicHostRouteImport } from './routes/plasmic-host'
13
12
  import { Route as IndexRouteImport } from './routes/index'
13
+ import { Route as PlasmicHostRouteImport } from './routes/plasmic-host'
14
14
  import { Route as DynamicSlugIndexRouteImport } from './routes/dynamic/$slug/index'
15
15
 
16
- const PlasmicHostRoute = PlasmicHostRouteImport.update({
17
- id: '/plasmic-host',
18
- path: '/plasmic-host',
19
- getParentRoute: () => rootRouteImport,
20
- } as any)
21
16
  const IndexRoute = IndexRouteImport.update({
22
17
  id: '/',
23
18
  path: '/',
24
19
  getParentRoute: () => rootRouteImport,
25
20
  } as any)
21
+ const PlasmicHostRoute = PlasmicHostRouteImport.update({
22
+ id: '/plasmic-host',
23
+ path: '/plasmic-host',
24
+ getParentRoute: () => rootRouteImport,
25
+ } as any)
26
26
  const DynamicSlugIndexRoute = DynamicSlugIndexRouteImport.update({
27
27
  id: '/dynamic/$slug/',
28
28
  path: '/dynamic/$slug/',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
61
61
 
62
62
  declare module '@tanstack/react-router' {
63
63
  interface FileRoutesByPath {
64
- '/plasmic-host': {
65
- id: '/plasmic-host'
66
- path: '/plasmic-host'
67
- fullPath: '/plasmic-host'
68
- preLoaderRoute: typeof PlasmicHostRouteImport
69
- parentRoute: typeof rootRouteImport
70
- }
71
64
  '/': {
72
65
  id: '/'
73
66
  path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/react-router' {
75
68
  preLoaderRoute: typeof IndexRouteImport
76
69
  parentRoute: typeof rootRouteImport
77
70
  }
71
+ '/plasmic-host': {
72
+ id: '/plasmic-host'
73
+ path: '/plasmic-host'
74
+ fullPath: '/plasmic-host'
75
+ preLoaderRoute: typeof PlasmicHostRouteImport
76
+ parentRoute: typeof rootRouteImport
77
+ }
78
78
  '/dynamic/$slug/': {
79
79
  id: '/dynamic/$slug/'
80
80
  path: '/dynamic/$slug'
@@ -9,7 +9,7 @@ import {
9
9
  serverQueryTree
10
10
  } from "../../../components/plasmic/create_plasmic_app/PlasmicDynamicPage";
11
11
  import { createFileRoute } from "@tanstack/react-router";
12
- import { unstable_executePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
12
+ import { executePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
13
13
  import { PlasmicQueryDataProvider } from "@plasmicapp/react-web/lib/query";
14
14
 
15
15
  export const Route = createFileRoute("/dynamic/$slug/")({
@@ -28,7 +28,7 @@ export const Route = createFileRoute("/dynamic/$slug/")({
28
28
  string | string[] | undefined
29
29
  >
30
30
  };
31
- const { cache: prefetchedCache } = await unstable_executePlasmicQueries(
31
+ const { cache: prefetchedCache } = await executePlasmicQueries(
32
32
  serverQueryTree,
33
33
  { $props: {}, $ctx }
34
34
  );
@@ -28,28 +28,42 @@ exports.GATSBY_TEMPLATES = {
28
28
  };
29
29
  exports.gatsbyStrategy = {
30
30
  create: (args) => __awaiter(void 0, void 0, void 0, function* () {
31
- const { projectPath, template, jsOrTs } = args;
31
+ const { projectPath, projectId, template, jsOrTs, packageManager } = args;
32
32
  if (template) {
33
33
  console.log(`Warning: Ignoring template '${template}' (argument is not supported by Gatsby).`);
34
34
  }
35
35
  const gatsbyTemplate = exports.GATSBY_TEMPLATES[jsOrTs];
36
36
  const createCommand = `git clone ${gatsbyTemplate} ${projectPath} --recursive --depth 1 --quiet`;
37
37
  yield (0, cmd_utils_1.spawnOrFail)(`${createCommand}`);
38
- // Remove .git and LICENSE so that we don't generate linked outputs
39
- yield (0, cmd_utils_1.spawnOrFail)(`rm -rf ${projectPath}/.git`);
40
- yield (0, cmd_utils_1.spawnOrFail)(`rm -rf ${projectPath}/LICENSE`);
38
+ // Remove package-lock.json since the user might be using a different package manager
39
+ yield (0, cmd_utils_1.spawnOrFail)(`rm -rf ${projectPath}/.git ${projectPath}/LICENSE ${projectPath}/package-lock.json`);
40
+ // Rename before installing; Yarn Berry rejects `yarn run` once the lockfile's
41
+ // workspace name no longer matches package.json
42
+ const packageJsonPath = path_1.default.join(projectPath, "package.json");
43
+ const packageJsonObject = JSON.parse(yield fs_1.promises.readFile(packageJsonPath, "utf8"));
44
+ packageJsonObject.name = path_1.default.basename(projectPath);
45
+ packageJsonObject.description = `Plasmic app for ${projectId}`;
46
+ delete packageJsonObject.license;
47
+ delete packageJsonObject.author;
48
+ yield fs_1.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonObject, null, 2));
49
+ if (packageManager === "yarn2") {
50
+ yield (0, npm_utils_1.initYarnBerryProject)(projectPath);
51
+ }
41
52
  }),
42
- installDeps: ({ projectPath, scheme, jsOrTs }) => __awaiter(void 0, void 0, void 0, function* () {
53
+ installDeps: ({ projectPath, scheme, jsOrTs, packageManager }) => __awaiter(void 0, void 0, void 0, function* () {
43
54
  const installedHelmet = yield (0, npm_utils_1.installUpgrade)("react-helmet", {
44
55
  workingDir: projectPath,
56
+ packageManager,
45
57
  });
46
58
  const installedHelmetTypes = jsOrTs === "js" ||
47
59
  (yield (0, npm_utils_1.installUpgrade)("@types/react-helmet", {
48
60
  workingDir: projectPath,
49
61
  dev: true,
62
+ packageManager,
50
63
  }));
51
64
  const installedHelmetPlugin = yield (0, npm_utils_1.installUpgrade)("gatsby-plugin-react-helmet", {
52
65
  workingDir: projectPath,
66
+ packageManager,
53
67
  });
54
68
  if (!installedHelmet || !installedHelmetPlugin || !installedHelmetTypes) {
55
69
  return false;
@@ -57,24 +71,15 @@ exports.gatsbyStrategy = {
57
71
  if (scheme === "loader") {
58
72
  return yield (0, npm_utils_1.installUpgrade)("@plasmicapp/loader-gatsby", {
59
73
  workingDir: projectPath,
74
+ packageManager,
60
75
  });
61
76
  }
62
77
  else {
63
- return yield (0, codegen_1.installCodegenDeps)({ projectPath });
78
+ return yield (0, codegen_1.installCodegenDeps)({ projectPath, packageManager });
64
79
  }
65
80
  }),
66
81
  overwriteConfig: (args) => __awaiter(void 0, void 0, void 0, function* () {
67
82
  const { projectId, projectPath, projectApiToken, jsOrTs, scheme } = args;
68
- const packageName = path_1.default.basename(projectPath);
69
- // Update package.json: adding name and description, removing license and author
70
- const packageJsonPath = path_1.default.join(projectPath, "package.json");
71
- const packageJson = yield fs_1.promises.readFile(packageJsonPath, "utf8");
72
- const packageJsonObject = JSON.parse(packageJson);
73
- packageJsonObject.name = packageName;
74
- packageJsonObject.description = `Plasmic app for ${projectId}`;
75
- delete packageJsonObject.license;
76
- delete packageJsonObject.author;
77
- yield fs_1.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonObject, null, 2));
78
83
  if (scheme === "loader") {
79
84
  const gatsbyConfigFile = path_1.default.join(projectPath, `gatsby-config.${jsOrTs}`);
80
85
  yield fs_1.promises.writeFile(gatsbyConfigFile, (0, template_1.makeGatsbyConfig)(projectId, (0, lang_utils_1.ensure)(projectApiToken, "Missing projectApiToken"), jsOrTs));
@@ -83,7 +88,7 @@ exports.gatsbyStrategy = {
83
88
  generateFiles: (args) => __awaiter(void 0, void 0, void 0, function* () {
84
89
  // in gatsby we can delete all existing pages/components, since all pages are going
85
90
  // to be handled by templates/defaultPlasmicPage
86
- const { projectId, projectApiToken, projectPath, jsOrTs, scheme } = args;
91
+ const { projectId, projectApiToken, projectPath, jsOrTs, scheme, packageManager, } = args;
87
92
  (0, file_utils_1.deleteGlob)(path_1.default.join(projectPath, "src/@(pages|components|templates)/*.*"));
88
93
  // Create a very basic 404 page - `gatsby build` fails without it.
89
94
  yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/pages/404.${jsOrTs}`), template_1.GATSBY_404);
@@ -111,6 +116,7 @@ exports.gatsbyStrategy = {
111
116
  projectId,
112
117
  projectApiToken,
113
118
  projectPath,
119
+ packageManager,
114
120
  });
115
121
  // Special case: remove all Gatsby components (due to conflicting file names)
116
122
  const config = yield (0, file_utils_1.getPlasmicConfig)(projectPath, "gatsby", scheme);
package/dist/index.js CHANGED
@@ -87,6 +87,10 @@ const argv = yargs_1.default
87
87
  .option("appDir", {
88
88
  describe: "(Next.js) Use app directory?",
89
89
  boolean: true,
90
+ })
91
+ .option("packageManager", {
92
+ describe: "Package manager to scaffold and install with",
93
+ choices: ["", "npm", "yarn", "pnpm"],
90
94
  })
91
95
  .strict()
92
96
  .help("h")
@@ -261,6 +265,7 @@ What is the URL of your project?`,
261
265
  console.log();
262
266
  const template = argv["template"];
263
267
  const projectApiToken = argv["projectApiToken"];
268
+ const packageManager = (argv["packageManager"] || undefined);
264
269
  // Set the metadata environment variable to tag the future Segment codegen event
265
270
  (0, cli_1.setMetadataEnv)({
266
271
  source: "create-plasmic-app",
@@ -274,6 +279,7 @@ What is the URL of your project?`,
274
279
  jsOrTs,
275
280
  projectApiToken,
276
281
  template,
282
+ packageManager,
277
283
  });
278
284
  });
279
285
  }
package/dist/lib.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setMetadataEnv } from "@plasmicapp/cli";
2
- import { JsOrTs, PlatformOptions, PlatformType, SchemeType } from "./utils/types";
2
+ import { JsOrTs, PackageManagerType, PlatformOptions, PlatformType, SchemeType } from "./utils/types";
3
3
  export interface CreatePlasmicAppArgs {
4
4
  resolvedProjectPath: string;
5
5
  projectId: string;
@@ -9,6 +9,7 @@ export interface CreatePlasmicAppArgs {
9
9
  jsOrTs: JsOrTs;
10
10
  projectApiToken?: string;
11
11
  template?: string;
12
+ packageManager?: PackageManagerType;
12
13
  }
13
14
  export declare function create(args: CreatePlasmicAppArgs): Promise<void>;
14
15
  export declare function checkValidName(name?: string): boolean;
package/dist/lib.js CHANGED
@@ -60,6 +60,7 @@ function create(args) {
60
60
  return __awaiter(this, void 0, void 0, function* () {
61
61
  const { resolvedProjectPath, projectId, platform, platformOptions, scheme, jsOrTs, template, } = args;
62
62
  let { projectApiToken } = args;
63
+ const packageManager = (0, npm_utils_1.resolvePackageManager)(args.packageManager);
63
64
  console.log("Let's get started! Here's what we'll do: ");
64
65
  console.log("1. Authenticate with Plasmic");
65
66
  console.log("2. Create a React/Next/Gatsby repo");
@@ -94,15 +95,17 @@ function create(args) {
94
95
  // Create project using strategy for platform
95
96
  yield cpaStrategy.create({
96
97
  projectPath: resolvedProjectPath,
98
+ projectId,
97
99
  jsOrTs,
98
100
  template,
99
101
  platformOptions,
102
+ packageManager,
100
103
  });
101
104
  // Ensure that we have a empty tsconfig and @types packages.
102
105
  // Gatsby and Next.js by default support typescript handling internally
103
106
  // tsconfig so we don't have to ensure it.
104
107
  if (jsOrTs === "ts" && platform === "react") {
105
- yield (0, file_utils_1.ensureTsconfig)(resolvedProjectPath);
108
+ yield (0, file_utils_1.ensureTsconfig)(resolvedProjectPath, packageManager);
106
109
  }
107
110
  // Make sure we have an api token for loader
108
111
  if (scheme === "loader" && !projectApiToken) {
@@ -117,6 +120,7 @@ function create(args) {
117
120
  scheme,
118
121
  projectPath: resolvedProjectPath,
119
122
  jsOrTs,
123
+ packageManager,
120
124
  });
121
125
  if (!installResult) {
122
126
  throw new Error("Failed to install the Plasmic dependency");
@@ -138,12 +142,13 @@ function create(args) {
138
142
  projectId,
139
143
  projectApiToken,
140
144
  platformOptions,
145
+ packageManager,
141
146
  });
142
147
  /**
143
148
  * INSTRUCT USER ON NEXT STEPS
144
149
  */
145
- const pkgMgr = (0, npm_utils_1.detectPackageManager)(resolvedProjectPath);
146
- const npmRunCmd = pkgMgr === "yarn" ? "yarn" : pkgMgr === "pnpm" ? "pnpm run" : "npm run";
150
+ const pmCmd = (0, npm_utils_1.packageManagerCommand)(packageManager);
151
+ const npmRunCmd = pmCmd === "yarn" ? "yarn" : `${pmCmd} run`;
147
152
  const command = platform === "nextjs"
148
153
  ? `${npmRunCmd} dev`
149
154
  : platform === "gatsby"
@@ -169,7 +174,7 @@ function create(args) {
169
174
  }
170
175
  if (scheme === "codegen") {
171
176
  console.log("To watch for changes in Plasmic components, in a separate terminal run:");
172
- console.log(chalk_1.default.bold(`npx plasmic watch`));
177
+ console.log(chalk_1.default.bold(`${(0, npm_utils_1.packageManagerExec)(packageManager)} plasmic watch`));
173
178
  }
174
179
  });
175
180
  }