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,30 @@
1
+ import { PLASMIC } from "@/plasmic-init";
2
+ import type { MetadataRoute } from "next";
3
+ import { headers } from "next/headers";
4
+
5
+ export const revalidate = 60;
6
+
7
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin and keep this route static;
8
+ // otherwise it is derived per-request, which opts the route out of prerendering.
9
+ async function getSiteUrl() {
10
+ if (process.env.NEXT_PUBLIC_SITE_URL) {
11
+ return process.env.NEXT_PUBLIC_SITE_URL;
12
+ }
13
+ if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
14
+ return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
15
+ }
16
+ const h = await headers();
17
+ const proto = h.get("x-forwarded-proto") ?? "http";
18
+ return `${proto}://${h.get("x-forwarded-host") ?? h.get("host")}`;
19
+ }
20
+
21
+ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
22
+ const siteUrl = await getSiteUrl();
23
+
24
+ // fetchPages() drops pages whose path takes a param, e.g. "/blog/[slug]".
25
+ const pages = await PLASMIC.fetchPages();
26
+
27
+ return pages.map((page) => ({
28
+ url: new URL(page.path, siteUrl).toString(),
29
+ }));
30
+ }
@@ -9,17 +9,17 @@
9
9
  "lint": "eslint"
10
10
  },
11
11
  "dependencies": {
12
- "@plasmicapp/loader-nextjs": "^2.0.6",
13
- "next": "16.2.7",
14
- "react": "19.2.4",
15
- "react-dom": "19.2.4"
12
+ "@plasmicapp/loader-nextjs": "^2.0.23",
13
+ "next": "16.3.1",
14
+ "react": "19.2.8",
15
+ "react-dom": "19.2.8"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^20",
19
19
  "@types/react": "^19",
20
20
  "@types/react-dom": "^19",
21
21
  "eslint": "^9",
22
- "eslint-config-next": "16.2.7",
22
+ "eslint-config-next": "16.3.1",
23
23
  "typescript": "^5"
24
24
  }
25
25
  }
@@ -17,7 +17,7 @@ import {
17
17
  deriveRenderOpts
18
18
  } from "@plasmicapp/react-web";
19
19
  import { useDataEnv } from "@plasmicapp/react-web/lib/host";
20
- import { unstable_usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
20
+ import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
21
21
  import RandomDynamicPageButton from "../../RandomDynamicPageButton"; // plasmic-import: Q23H1_1M_P/component
22
22
  import { _useStyleTokens } from "./PlasmicStyleTokensProvider"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/styleTokensProvider
23
23
  import "@plasmicapp/react-web/lib/plasmic.css";
@@ -114,7 +114,7 @@ function PlasmicDynamicPage__RenderFunc(props) {
114
114
  const $ctx = useDataEnv?.() || {};
115
115
  const refsRef = React.useRef({});
116
116
  const $refs = refsRef.current;
117
- const $q = unstable_usePlasmicQueries(serverQueryTree, $ctx, $props, null);
117
+ const $q = usePlasmicQueries(serverQueryTree, { $ctx, $props, $state: null });
118
118
  const pageMetadata = generateDynamicMetadata(
119
119
  wrapQueriesWithLoadingProxy($q),
120
120
  $ctx
@@ -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;
@@ -9,14 +9,15 @@
9
9
  "lint": "eslint"
10
10
  },
11
11
  "dependencies": {
12
- "@plasmicapp/cli": "^0.1.364",
13
- "@plasmicapp/react-web": "^1.0.12",
14
- "next": "16.2.9",
15
- "react": "19.2.4",
16
- "react-dom": "19.2.4"
12
+ "@plasmicapp/cli": "^0.1.372",
13
+ "@plasmicapp/host": "^2.0.17",
14
+ "@plasmicapp/react-web": "^1.0.32",
15
+ "next": "16.3.1",
16
+ "react": "19.2.8",
17
+ "react-dom": "19.2.8"
17
18
  },
18
19
  "devDependencies": {
19
20
  "eslint": "^9",
20
- "eslint-config-next": "16.2.9"
21
+ "eslint-config-next": "16.3.1"
21
22
  }
22
23
  }
@@ -0,0 +1,25 @@
1
+ export const getServerSideProps = async ({ req, res }) => {
2
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
3
+ // otherwise it is derived per-request from the request headers.
4
+ const siteUrl =
5
+ process.env.NEXT_PUBLIC_SITE_URL ??
6
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
7
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
8
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
9
+ req.headers["x-forwarded-host"] ?? req.headers.host
10
+ }`);
11
+
12
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
13
+ res.write(
14
+ `User-agent: *\nAllow: /\n\nSitemap: ${new URL(
15
+ "/sitemap.xml",
16
+ siteUrl
17
+ ).toString()}\n`
18
+ );
19
+ res.end();
20
+ return { props: {} };
21
+ };
22
+
23
+ export default function Robots() {
24
+ return null;
25
+ }
@@ -0,0 +1,53 @@
1
+ import plasmicJson from "../plasmic.json";
2
+
3
+ function escapeXml(str) {
4
+ return str
5
+ .replace(/&/g, "&amp;")
6
+ .replace(/</g, "&lt;")
7
+ .replace(/>/g, "&gt;")
8
+ .replace(/"/g, "&quot;")
9
+ .replace(/'/g, "&apos;");
10
+ }
11
+
12
+ function makeSitemapXml(urls) {
13
+ const entries = urls.map(
14
+ (url) => ` <url><loc>${escapeXml(url)}</loc></url>`
15
+ );
16
+ return `<?xml version="1.0" encoding="UTF-8"?>
17
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
18
+ ${entries.join("\n")}
19
+ </urlset>
20
+ `;
21
+ }
22
+
23
+ export const getServerSideProps = async ({ req, res }) => {
24
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
25
+ // otherwise it is derived per-request from the request headers.
26
+ const siteUrl =
27
+ process.env.NEXT_PUBLIC_SITE_URL ??
28
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
29
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
30
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
31
+ req.headers["x-forwarded-host"] ?? req.headers.host
32
+ }`);
33
+
34
+ const urls = plasmicJson.projects
35
+ .flatMap((project) => project.components)
36
+ .flatMap((component) =>
37
+ component.componentType === "page" &&
38
+ component.path &&
39
+ !component.path.includes("[")
40
+ ? // next.config sets trailingSlash.
41
+ [new URL(component.path.replace(/\/?$/, "/"), siteUrl).toString()]
42
+ : []
43
+ );
44
+
45
+ res.setHeader("Content-Type", "application/xml; charset=utf-8");
46
+ res.write(makeSitemapXml(urls));
47
+ res.end();
48
+ return { props: {} };
49
+ };
50
+
51
+ export default function Sitemap() {
52
+ return null;
53
+ }
@@ -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": "components",
22
18
  "defaultPlasmicDir": "./plasmic",
23
19
  "projects": [
@@ -135,6 +131,7 @@
135
131
  "nextjsConfig": {
136
132
  "pagesDir": "../pages"
137
133
  },
138
- "cliVersion": "0.1.364",
139
- "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.364/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
  }
@@ -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
+ }
@@ -61,7 +61,7 @@ import {
61
61
 
62
62
  import { useMutablePlasmicQueryData } from "@plasmicapp/query";
63
63
 
64
- import { unstable_usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
64
+ import { usePlasmicQueries } from "@plasmicapp/react-web/lib/data-sources";
65
65
  import type {
66
66
  PlasmicQuery,
67
67
  PlasmicQueryResult
@@ -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 pageMetadata = generateDynamicMetadata(
205
205
  wrapQueriesWithLoadingProxy($q),
@@ -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;
@@ -9,18 +9,19 @@
9
9
  "lint": "eslint"
10
10
  },
11
11
  "dependencies": {
12
- "@plasmicapp/cli": "^0.1.364",
13
- "@plasmicapp/react-web": "^1.0.12",
14
- "next": "16.2.9",
15
- "react": "19.2.4",
16
- "react-dom": "19.2.4"
12
+ "@plasmicapp/cli": "^0.1.372",
13
+ "@plasmicapp/host": "^2.0.17",
14
+ "@plasmicapp/react-web": "^1.0.32",
15
+ "next": "16.3.1",
16
+ "react": "19.2.8",
17
+ "react-dom": "19.2.8"
17
18
  },
18
19
  "devDependencies": {
19
20
  "@types/node": "^20",
20
21
  "@types/react": "^19",
21
22
  "@types/react-dom": "^19",
22
23
  "eslint": "^9",
23
- "eslint-config-next": "16.2.9",
24
+ "eslint-config-next": "16.3.1",
24
25
  "typescript": "^5"
25
26
  }
26
27
  }
@@ -0,0 +1,27 @@
1
+ import type { GetServerSideProps } from "next";
2
+
3
+ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
4
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
5
+ // otherwise it is derived per-request from the request headers.
6
+ const siteUrl =
7
+ process.env.NEXT_PUBLIC_SITE_URL ??
8
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
9
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
10
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
11
+ req.headers["x-forwarded-host"] ?? req.headers.host
12
+ }`);
13
+
14
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
15
+ res.write(
16
+ `User-agent: *\nAllow: /\n\nSitemap: ${new URL(
17
+ "/sitemap.xml",
18
+ siteUrl
19
+ ).toString()}\n`
20
+ );
21
+ res.end();
22
+ return { props: {} };
23
+ };
24
+
25
+ export default function Robots() {
26
+ return null;
27
+ }
@@ -0,0 +1,56 @@
1
+ import type { GetServerSideProps } from "next";
2
+ import plasmicJson from "../plasmic.json";
3
+
4
+ function escapeXml(str: string) {
5
+ return str
6
+ .replace(/&/g, "&amp;")
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
+ const urls = (plasmicJson.projects as {
36
+ components: { componentType: string; path?: string }[];
37
+ }[])
38
+ .flatMap((project) => project.components)
39
+ .flatMap((component) =>
40
+ component.componentType === "page" &&
41
+ component.path &&
42
+ !component.path.includes("[")
43
+ ? // next.config sets trailingSlash.
44
+ [new URL(component.path.replace(/\/?$/, "/"), siteUrl).toString()]
45
+ : []
46
+ );
47
+
48
+ res.setHeader("Content-Type", "application/xml; charset=utf-8");
49
+ res.write(makeSitemapXml(urls));
50
+ res.end();
51
+ return { props: {} };
52
+ };
53
+
54
+ export default function Sitemap() {
55
+ return null;
56
+ }
@@ -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": "components",
22
18
  "defaultPlasmicDir": "./plasmic",
23
19
  "projects": [
@@ -135,6 +131,7 @@
135
131
  "nextjsConfig": {
136
132
  "pagesDir": "../pages"
137
133
  },
138
- "cliVersion": "0.1.364",
139
- "$schema": "https://unpkg.com/@plasmicapp/cli@0.1.364/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
  }
@@ -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
+ }
@@ -9,13 +9,13 @@
9
9
  "lint": "eslint"
10
10
  },
11
11
  "dependencies": {
12
- "@plasmicapp/loader-nextjs": "^2.0.6",
13
- "next": "16.2.7",
14
- "react": "19.2.4",
15
- "react-dom": "19.2.4"
12
+ "@plasmicapp/loader-nextjs": "^2.0.23",
13
+ "next": "16.3.1",
14
+ "react": "19.2.8",
15
+ "react-dom": "19.2.8"
16
16
  },
17
17
  "devDependencies": {
18
18
  "eslint": "^9",
19
- "eslint-config-next": "16.2.7"
19
+ "eslint-config-next": "16.3.1"
20
20
  }
21
21
  }
@@ -0,0 +1,25 @@
1
+ export const getServerSideProps = async ({ req, res }) => {
2
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
3
+ // otherwise it is derived per-request from the request headers.
4
+ const siteUrl =
5
+ process.env.NEXT_PUBLIC_SITE_URL ??
6
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
7
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
8
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
9
+ req.headers["x-forwarded-host"] ?? req.headers.host
10
+ }`);
11
+
12
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
13
+ res.write(
14
+ `User-agent: *\nAllow: /\n\nSitemap: ${new URL(
15
+ "/sitemap.xml",
16
+ siteUrl
17
+ ).toString()}\n`
18
+ );
19
+ res.end();
20
+ return { props: {} };
21
+ };
22
+
23
+ export default function Robots() {
24
+ return null;
25
+ }
@@ -0,0 +1,46 @@
1
+ import { PLASMIC } from "@/plasmic-init";
2
+
3
+ function escapeXml(str) {
4
+ return str
5
+ .replace(/&/g, "&amp;")
6
+ .replace(/</g, "&lt;")
7
+ .replace(/>/g, "&gt;")
8
+ .replace(/"/g, "&quot;")
9
+ .replace(/'/g, "&apos;");
10
+ }
11
+
12
+ function makeSitemapXml(urls) {
13
+ const entries = urls.map(
14
+ (url) => ` <url><loc>${escapeXml(url)}</loc></url>`
15
+ );
16
+ return `<?xml version="1.0" encoding="UTF-8"?>
17
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
18
+ ${entries.join("\n")}
19
+ </urlset>
20
+ `;
21
+ }
22
+
23
+ export const getServerSideProps = async ({ req, res }) => {
24
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
25
+ // otherwise it is derived per-request from the request headers.
26
+ const siteUrl =
27
+ process.env.NEXT_PUBLIC_SITE_URL ??
28
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
29
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
30
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
31
+ req.headers["x-forwarded-host"] ?? req.headers.host
32
+ }`);
33
+
34
+ // fetchPages() drops pages whose path takes a param, e.g. "/blog/[slug]".
35
+ const pages = await PLASMIC.fetchPages();
36
+ const urls = pages.map((page) => new URL(page.path, siteUrl).toString());
37
+
38
+ res.setHeader("Content-Type", "application/xml; charset=utf-8");
39
+ res.write(makeSitemapXml(urls));
40
+ res.end();
41
+ return { props: {} };
42
+ };
43
+
44
+ export default function Sitemap() {
45
+ return null;
46
+ }
@@ -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
+ }
@@ -9,17 +9,17 @@
9
9
  "lint": "eslint"
10
10
  },
11
11
  "dependencies": {
12
- "@plasmicapp/loader-nextjs": "^2.0.6",
13
- "next": "16.2.7",
14
- "react": "19.2.4",
15
- "react-dom": "19.2.4"
12
+ "@plasmicapp/loader-nextjs": "^2.0.23",
13
+ "next": "16.3.1",
14
+ "react": "19.2.8",
15
+ "react-dom": "19.2.8"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^20",
19
19
  "@types/react": "^19",
20
20
  "@types/react-dom": "^19",
21
21
  "eslint": "^9",
22
- "eslint-config-next": "16.2.7",
22
+ "eslint-config-next": "16.3.1",
23
23
  "typescript": "^5"
24
24
  }
25
25
  }
@@ -0,0 +1,27 @@
1
+ import type { GetServerSideProps } from "next";
2
+
3
+ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
4
+ // Set NEXT_PUBLIC_SITE_URL to pin the origin;
5
+ // otherwise it is derived per-request from the request headers.
6
+ const siteUrl =
7
+ process.env.NEXT_PUBLIC_SITE_URL ??
8
+ (process.env.VERCEL_PROJECT_PRODUCTION_URL
9
+ ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
10
+ : `${req.headers["x-forwarded-proto"] ?? "http"}://${
11
+ req.headers["x-forwarded-host"] ?? req.headers.host
12
+ }`);
13
+
14
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
15
+ res.write(
16
+ `User-agent: *\nAllow: /\n\nSitemap: ${new URL(
17
+ "/sitemap.xml",
18
+ siteUrl
19
+ ).toString()}\n`
20
+ );
21
+ res.end();
22
+ return { props: {} };
23
+ };
24
+
25
+ export default function Robots() {
26
+ return null;
27
+ }