webstudio 0.232.0 → 0.233.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
@@ -9117,7 +9117,7 @@ const getDeploymentInstructions = (deployTarget) => {
9117
9117
  }
9118
9118
  };
9119
9119
  const name = "webstudio";
9120
- const version = "0.232.0";
9120
+ const version = "0.233.0";
9121
9121
  const description = "Webstudio CLI";
9122
9122
  const author = "Webstudio <github@webstudio.is>";
9123
9123
  const homepage = "https://webstudio.is";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.232.0",
3
+ "version": "0.233.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -70,16 +70,16 @@
70
70
  "vite": "^6.3.4",
71
71
  "vitest": "^3.1.2",
72
72
  "wrangler": "^3.63.2",
73
- "@webstudio-is/css-engine": "0.232.0",
74
- "@webstudio-is/http-client": "0.232.0",
75
- "@webstudio-is/image": "0.232.0",
76
- "@webstudio-is/sdk": "0.232.0",
77
- "@webstudio-is/sdk-components-animation": "0.232.0",
78
- "@webstudio-is/sdk-components-react": "0.232.0",
79
- "@webstudio-is/sdk-components-react-radix": "0.232.0",
80
- "@webstudio-is/sdk-components-react-remix": "0.232.0",
81
- "@webstudio-is/sdk-components-react-router": "0.232.0",
82
- "@webstudio-is/react-sdk": "0.232.0",
73
+ "@webstudio-is/css-engine": "0.233.0",
74
+ "@webstudio-is/http-client": "0.233.0",
75
+ "@webstudio-is/image": "0.233.0",
76
+ "@webstudio-is/react-sdk": "0.233.0",
77
+ "@webstudio-is/sdk": "0.233.0",
78
+ "@webstudio-is/sdk-components-animation": "0.233.0",
79
+ "@webstudio-is/sdk-components-react": "0.233.0",
80
+ "@webstudio-is/sdk-components-react-remix": "0.233.0",
81
+ "@webstudio-is/sdk-components-react-radix": "0.233.0",
82
+ "@webstudio-is/sdk-components-react-router": "0.233.0",
83
83
  "@webstudio-is/tsconfig": "1.0.7"
84
84
  },
85
85
  "scripts": {
@@ -54,6 +54,24 @@ const customFetch: typeof fetch = (input, init) => {
54
54
  return Promise.resolve(response);
55
55
  }
56
56
 
57
+ if (isLocalResource(input, "current-date")) {
58
+ const now = new Date();
59
+ // Normalize to midnight UTC to prevent hydration mismatches
60
+ const startOfDay = new Date(
61
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())
62
+ );
63
+ const data = {
64
+ iso: startOfDay.toISOString(),
65
+ year: startOfDay.getUTCFullYear(),
66
+ month: startOfDay.getUTCMonth() + 1, // 1-12 instead of 0-11
67
+ day: startOfDay.getUTCDate(),
68
+ timestamp: startOfDay.getTime(),
69
+ };
70
+ const response = new Response(JSON.stringify(data));
71
+ response.headers.set("content-type", "application/json; charset=utf-8");
72
+ return Promise.resolve(response);
73
+ }
74
+
57
75
  return cachedFetch(projectId, input, init);
58
76
  };
59
77
 
@@ -22,6 +22,24 @@ const customFetch: typeof fetch = (input, init) => {
22
22
  return Promise.resolve(response);
23
23
  }
24
24
 
25
+ if (isLocalResource(input, "current-date")) {
26
+ const now = new Date();
27
+ // Normalize to midnight UTC to prevent hydration mismatches
28
+ const startOfDay = new Date(
29
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())
30
+ );
31
+ const data = {
32
+ iso: startOfDay.toISOString(),
33
+ year: startOfDay.getUTCFullYear(),
34
+ month: startOfDay.getUTCMonth() + 1, // 1-12 instead of 0-11
35
+ day: startOfDay.getUTCDate(),
36
+ timestamp: startOfDay.getTime(),
37
+ };
38
+ const response = new Response(JSON.stringify(data));
39
+ response.headers.set("content-type", "application/json; charset=utf-8");
40
+ return Promise.resolve(response);
41
+ }
42
+
25
43
  return fetch(input, init);
26
44
  };
27
45
 
@@ -11,13 +11,13 @@
11
11
  "@remix-run/node": "2.16.5",
12
12
  "@remix-run/react": "2.16.5",
13
13
  "@remix-run/server-runtime": "2.16.5",
14
- "@webstudio-is/image": "0.232.0",
15
- "@webstudio-is/react-sdk": "0.232.0",
16
- "@webstudio-is/sdk": "0.232.0",
17
- "@webstudio-is/sdk-components-react": "0.232.0",
18
- "@webstudio-is/sdk-components-animation": "0.232.0",
19
- "@webstudio-is/sdk-components-react-radix": "0.232.0",
20
- "@webstudio-is/sdk-components-react-remix": "0.232.0",
14
+ "@webstudio-is/image": "0.233.0",
15
+ "@webstudio-is/react-sdk": "0.233.0",
16
+ "@webstudio-is/sdk": "0.233.0",
17
+ "@webstudio-is/sdk-components-react": "0.233.0",
18
+ "@webstudio-is/sdk-components-animation": "0.233.0",
19
+ "@webstudio-is/sdk-components-react-radix": "0.233.0",
20
+ "@webstudio-is/sdk-components-react-remix": "0.233.0",
21
21
  "isbot": "^5.1.25",
22
22
  "react": "18.3.0-canary-14898b6a9-20240318",
23
23
  "react-dom": "18.3.0-canary-14898b6a9-20240318"
@@ -53,6 +53,24 @@ const customFetch: typeof fetch = (input, init) => {
53
53
  return Promise.resolve(response);
54
54
  }
55
55
 
56
+ if (isLocalResource(input, "current-date")) {
57
+ const now = new Date();
58
+ // Normalize to midnight UTC to prevent hydration mismatches
59
+ const startOfDay = new Date(
60
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())
61
+ );
62
+ const data = {
63
+ iso: startOfDay.toISOString(),
64
+ year: startOfDay.getUTCFullYear(),
65
+ month: startOfDay.getUTCMonth() + 1, // 1-12 instead of 0-11
66
+ day: startOfDay.getUTCDate(),
67
+ timestamp: startOfDay.getTime(),
68
+ };
69
+ const response = new Response(JSON.stringify(data));
70
+ response.headers.set("content-type", "application/json; charset=utf-8");
71
+ return Promise.resolve(response);
72
+ }
73
+
56
74
  return cachedFetch(projectId, input, init);
57
75
  };
58
76
 
@@ -22,6 +22,24 @@ const customFetch: typeof fetch = (input, init) => {
22
22
  return Promise.resolve(response);
23
23
  }
24
24
 
25
+ if (isLocalResource(input, "current-date")) {
26
+ const now = new Date();
27
+ // Normalize to midnight UTC to prevent hydration mismatches
28
+ const startOfDay = new Date(
29
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())
30
+ );
31
+ const data = {
32
+ iso: startOfDay.toISOString(),
33
+ year: startOfDay.getUTCFullYear(),
34
+ month: startOfDay.getUTCMonth() + 1, // 1-12 instead of 0-11
35
+ day: startOfDay.getUTCDate(),
36
+ timestamp: startOfDay.getTime(),
37
+ };
38
+ const response = new Response(JSON.stringify(data));
39
+ response.headers.set("content-type", "application/json; charset=utf-8");
40
+ return Promise.resolve(response);
41
+ }
42
+
25
43
  return fetch(input, init);
26
44
  };
27
45
 
@@ -10,13 +10,13 @@
10
10
  "dependencies": {
11
11
  "@react-router/dev": "^7.5.3",
12
12
  "@react-router/fs-routes": "^7.5.3",
13
- "@webstudio-is/image": "0.232.0",
14
- "@webstudio-is/react-sdk": "0.232.0",
15
- "@webstudio-is/sdk": "0.232.0",
16
- "@webstudio-is/sdk-components-animation": "0.232.0",
17
- "@webstudio-is/sdk-components-react-radix": "0.232.0",
18
- "@webstudio-is/sdk-components-react-router": "0.232.0",
19
- "@webstudio-is/sdk-components-react": "0.232.0",
13
+ "@webstudio-is/image": "0.233.0",
14
+ "@webstudio-is/react-sdk": "0.233.0",
15
+ "@webstudio-is/sdk": "0.233.0",
16
+ "@webstudio-is/sdk-components-animation": "0.233.0",
17
+ "@webstudio-is/sdk-components-react-radix": "0.233.0",
18
+ "@webstudio-is/sdk-components-react-router": "0.233.0",
19
+ "@webstudio-is/sdk-components-react": "0.233.0",
20
20
  "isbot": "^5.1.25",
21
21
  "react": "18.3.0-canary-14898b6a9-20240318",
22
22
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
@@ -1,8 +1,34 @@
1
1
  import type { PageContextServer } from "vike/types";
2
2
  import { redirect } from "vike/abort";
3
- import { loadResources } from "@webstudio-is/sdk/runtime";
3
+ import { isLocalResource, loadResources } from "@webstudio-is/sdk/runtime";
4
4
  import { getPageMeta, getResources } from "__SERVER__";
5
5
 
6
+ const customFetch: typeof fetch = (input, init) => {
7
+ if (typeof input !== "string") {
8
+ return fetch(input, init);
9
+ }
10
+
11
+ if (isLocalResource(input, "current-date")) {
12
+ const now = new Date();
13
+ // Normalize to midnight UTC to prevent hydration mismatches
14
+ const startOfDay = new Date(
15
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())
16
+ );
17
+ const data = {
18
+ iso: startOfDay.toISOString(),
19
+ year: startOfDay.getUTCFullYear(),
20
+ month: startOfDay.getUTCMonth() + 1, // 1-12 instead of 0-11
21
+ day: startOfDay.getUTCDate(),
22
+ timestamp: startOfDay.getTime(),
23
+ };
24
+ const response = new Response(JSON.stringify(data));
25
+ response.headers.set("content-type", "application/json; charset=utf-8");
26
+ return Promise.resolve(response);
27
+ }
28
+
29
+ return fetch(input, init);
30
+ };
31
+
6
32
  export const data = async (pageContext: PageContextServer) => {
7
33
  const url = new URL(pageContext.urlOriginal, "http://url");
8
34
  const headers = new Headers(pageContext.headers ?? {});
@@ -18,7 +44,10 @@ export const data = async (pageContext: PageContextServer) => {
18
44
  pathname: url.pathname,
19
45
  };
20
46
 
21
- const resources = await loadResources(fetch, getResources({ system }).data);
47
+ const resources = await loadResources(
48
+ customFetch,
49
+ getResources({ system }).data
50
+ );
22
51
  const pageMeta = getPageMeta({ system, resources });
23
52
 
24
53
  if (pageMeta.redirect) {
@@ -8,12 +8,12 @@
8
8
  "typecheck": "tsc"
9
9
  },
10
10
  "dependencies": {
11
- "@webstudio-is/image": "0.232.0",
12
- "@webstudio-is/react-sdk": "0.232.0",
13
- "@webstudio-is/sdk": "0.232.0",
14
- "@webstudio-is/sdk-components-react": "0.232.0",
15
- "@webstudio-is/sdk-components-animation": "0.232.0",
16
- "@webstudio-is/sdk-components-react-radix": "0.232.0",
11
+ "@webstudio-is/image": "0.233.0",
12
+ "@webstudio-is/react-sdk": "0.233.0",
13
+ "@webstudio-is/sdk": "0.233.0",
14
+ "@webstudio-is/sdk-components-react": "0.233.0",
15
+ "@webstudio-is/sdk-components-animation": "0.233.0",
16
+ "@webstudio-is/sdk-components-react-radix": "0.233.0",
17
17
  "react": "18.3.0-canary-14898b6a9-20240318",
18
18
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
19
19
  "vike": "^0.4.229"