webstudio 0.112.0 → 0.113.0

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.
package/lib/cli.js CHANGED
@@ -627,6 +627,21 @@ ${utilsExport}
627
627
  }
628
628
  );
629
629
  await ensureFileInPath(join4(generatedDir, "index.css"), cssText);
630
+ await writeFile4(
631
+ join4(generatedDir, "[sitemap.xml].ts"),
632
+ `
633
+ export const sitemap = ${JSON.stringify(
634
+ {
635
+ pages: siteData.pages.map((page) => ({
636
+ path: page.path,
637
+ lastModified: siteData.build.updatedAt
638
+ }))
639
+ },
640
+ null,
641
+ 2
642
+ )};
643
+ `
644
+ );
630
645
  spinner.text = "Downloading fonts and images";
631
646
  await Promise.all(assetsToDownload);
632
647
  spinner.succeed("Build finished");
@@ -791,7 +806,7 @@ import makeCLI from "yargs";
791
806
  // package.json
792
807
  var package_default = {
793
808
  name: "webstudio",
794
- version: "0.112.0",
809
+ version: "0.113.0",
795
810
  description: "Webstudio CLI",
796
811
  author: "Webstudio <github@webstudio.is>",
797
812
  homepage: "https://webstudio.is",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.112.0",
3
+ "version": "0.113.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -28,20 +28,20 @@
28
28
  "title-case": "^4.1.0",
29
29
  "yargs": "^17.7.2",
30
30
  "zod": "^3.21.4",
31
- "@webstudio-is/http-client": "0.112.0",
32
- "@webstudio-is/image": "0.112.0",
33
- "@webstudio-is/sdk": "0.112.0",
34
- "@webstudio-is/react-sdk": "0.112.0",
35
- "@webstudio-is/sdk-components-react-radix": "0.112.0",
36
- "@webstudio-is/sdk-components-react": "0.112.0",
37
- "@webstudio-is/sdk-components-react-remix": "0.112.0"
31
+ "@webstudio-is/http-client": "0.113.0",
32
+ "@webstudio-is/image": "0.113.0",
33
+ "@webstudio-is/react-sdk": "0.113.0",
34
+ "@webstudio-is/sdk": "0.113.0",
35
+ "@webstudio-is/sdk-components-react": "0.113.0",
36
+ "@webstudio-is/sdk-components-react-radix": "0.113.0",
37
+ "@webstudio-is/sdk-components-react-remix": "0.113.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^18.17.1",
41
41
  "@types/prompts": "^2.4.5",
42
42
  "tsx": "^3.12.8",
43
43
  "typescript": "5.2.2",
44
- "@webstudio-is/form-handlers": "0.112.0",
44
+ "@webstudio-is/form-handlers": "0.113.0",
45
45
  "@webstudio-is/tsconfig": "1.0.7"
46
46
  },
47
47
  "scripts": {
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The only intent of this file is to support typings inside ../routes/[sitemap.xml].tsx for easier development.
3
+ **/
4
+ export const sitemap = {
5
+ pages: [
6
+ {
7
+ path: "",
8
+ lastModified: "2021-10-13T12:00:00.000Z",
9
+ },
10
+ ],
11
+ };
@@ -11,8 +11,7 @@ export const loader = (arg: LoaderArgs) => {
11
11
  User-agent: *
12
12
  Disallow: /api/
13
13
 
14
- # Uncomment
15
- # Sitemap: https://${host}/sitemap.xml
14
+ Sitemap: https://${host}/sitemap.xml
16
15
 
17
16
  `,
18
17
  {
@@ -0,0 +1,34 @@
1
+ import type { LoaderArgs } from "@remix-run/server-runtime";
2
+ import { sitemap } from "../__generated__/[sitemap.xml]";
3
+
4
+ export const loader = (arg: LoaderArgs) => {
5
+ const host =
6
+ arg.request.headers.get("x-forwarded-host") ||
7
+ arg.request.headers.get("host") ||
8
+ "";
9
+
10
+ const urls = sitemap.pages.map((page) => {
11
+ const url = new URL(`https://${host}${page.path}`);
12
+
13
+ return `
14
+ <url>
15
+ <loc>${url.href}</loc>
16
+ <lastmod>${page.lastModified.split("T")[0]}</lastmod>
17
+ </url>
18
+ `;
19
+ });
20
+
21
+ return new Response(
22
+ `<?xml version="1.0" encoding="UTF-8"?>
23
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
24
+ ${urls.join("")}
25
+ </urlset>
26
+ `,
27
+ {
28
+ headers: {
29
+ "Content-Type": "application/xml",
30
+ },
31
+ status: 200,
32
+ }
33
+ );
34
+ };
@@ -1,3 +1,2 @@
1
1
  /// <reference types="@remix-run/dev" />
2
2
  /// <reference types="@remix-run/node" />
3
-