webstudio 0.228.0 → 0.230.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
@@ -1931,11 +1931,6 @@ var Method = z.union([
1931
1931
  z.literal("put"),
1932
1932
  z.literal("delete")
1933
1933
  ]);
1934
- var Header = z.object({
1935
- name: z.string(),
1936
- // expression
1937
- value: z.string()
1938
- });
1939
1934
  var Resource = z.object({
1940
1935
  id: ResourceId,
1941
1936
  name: z.string(),
@@ -1943,16 +1938,41 @@ var Resource = z.object({
1943
1938
  method: Method,
1944
1939
  // expression
1945
1940
  url: z.string(),
1946
- headers: z.array(Header),
1941
+ searchParams: z.array(
1942
+ z.object({
1943
+ name: z.string(),
1944
+ // expression
1945
+ value: z.string()
1946
+ })
1947
+ ).optional(),
1948
+ headers: z.array(
1949
+ z.object({
1950
+ name: z.string(),
1951
+ // expression
1952
+ value: z.string()
1953
+ })
1954
+ ),
1947
1955
  // expression
1948
1956
  body: z.optional(z.string())
1949
1957
  });
1950
1958
  z.object({
1951
- id: ResourceId,
1952
1959
  name: z.string(),
1953
1960
  method: Method,
1954
1961
  url: z.string(),
1955
- headers: z.array(Header),
1962
+ searchParams: z.array(
1963
+ z.object({
1964
+ name: z.string(),
1965
+ // can be string or object which should be serialized
1966
+ value: z.unknown()
1967
+ })
1968
+ ),
1969
+ headers: z.array(
1970
+ z.object({
1971
+ name: z.string(),
1972
+ // can be string or object which should be serialized
1973
+ value: z.unknown()
1974
+ })
1975
+ ),
1956
1976
  body: z.optional(z.unknown())
1957
1977
  });
1958
1978
  z.map(ResourceId, Resource);
@@ -3671,8 +3691,6 @@ var generateResources = ({
3671
3691
  let generatedRequest = "";
3672
3692
  const resourceName = scope.getName(resource.id, resource.name);
3673
3693
  generatedRequest += ` const ${resourceName}: ResourceRequest = {
3674
- `;
3675
- generatedRequest += ` id: "${resource.id}",
3676
3694
  `;
3677
3695
  generatedRequest += ` name: ${JSON.stringify(resource.name)},
3678
3696
  `;
@@ -3683,6 +3701,20 @@ var generateResources = ({
3683
3701
  scope
3684
3702
  });
3685
3703
  generatedRequest += ` url: ${url},
3704
+ `;
3705
+ generatedRequest += ` searchParams: [
3706
+ `;
3707
+ for (const searchParam of resource.searchParams ?? []) {
3708
+ const value = generateExpression({
3709
+ expression: searchParam.value,
3710
+ dataSources,
3711
+ usedDataSources,
3712
+ scope
3713
+ });
3714
+ generatedRequest += ` { name: "${searchParam.name}", value: ${value} },
3715
+ `;
3716
+ }
3717
+ generatedRequest += ` ],
3686
3718
  `;
3687
3719
  generatedRequest += ` method: "${resource.method}",
3688
3720
  `;
@@ -9055,7 +9087,7 @@ const getDeploymentInstructions = (deployTarget) => {
9055
9087
  }
9056
9088
  };
9057
9089
  const name = "webstudio";
9058
- const version = "0.228.0";
9090
+ const version = "0.230.0";
9059
9091
  const description = "Webstudio CLI";
9060
9092
  const author = "Webstudio <github@webstudio.is>";
9061
9093
  const homepage = "https://webstudio.is";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.228.0",
3
+ "version": "0.230.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -70,17 +70,17 @@
70
70
  "vite": "^6.3.4",
71
71
  "vitest": "^3.1.2",
72
72
  "wrangler": "^3.63.2",
73
- "@webstudio-is/css-engine": "0.228.0",
74
- "@webstudio-is/image": "0.228.0",
75
- "@webstudio-is/react-sdk": "0.228.0",
76
- "@webstudio-is/sdk": "0.228.0",
77
- "@webstudio-is/http-client": "0.228.0",
78
- "@webstudio-is/sdk-components-react": "0.228.0",
79
- "@webstudio-is/sdk-components-react-radix": "0.228.0",
80
- "@webstudio-is/tsconfig": "1.0.7",
81
- "@webstudio-is/sdk-components-react-remix": "0.228.0",
82
- "@webstudio-is/sdk-components-animation": "0.228.0",
83
- "@webstudio-is/sdk-components-react-router": "0.228.0"
73
+ "@webstudio-is/css-engine": "0.230.0",
74
+ "@webstudio-is/image": "0.230.0",
75
+ "@webstudio-is/http-client": "0.230.0",
76
+ "@webstudio-is/react-sdk": "0.230.0",
77
+ "@webstudio-is/sdk": "0.230.0",
78
+ "@webstudio-is/sdk-components-animation": "0.230.0",
79
+ "@webstudio-is/sdk-components-react": "0.230.0",
80
+ "@webstudio-is/sdk-components-react-radix": "0.230.0",
81
+ "@webstudio-is/sdk-components-react-remix": "0.230.0",
82
+ "@webstudio-is/sdk-components-react-router": "0.230.0",
83
+ "@webstudio-is/tsconfig": "1.0.7"
84
84
  },
85
85
  "scripts": {
86
86
  "typecheck": "tsc",
@@ -13,6 +13,7 @@ import {
13
13
  isLocalResource,
14
14
  loadResource,
15
15
  loadResources,
16
+ cachedFetch,
16
17
  formIdFieldName,
17
18
  formBotFieldName,
18
19
  } from "@webstudio-is/sdk/runtime";
@@ -43,7 +44,7 @@ import { sitemap } from "__SITEMAP__";
43
44
 
44
45
  const customFetch: typeof fetch = (input, init) => {
45
46
  if (typeof input !== "string") {
46
- return fetch(input, init);
47
+ return cachedFetch(projectId, input, init);
47
48
  }
48
49
 
49
50
  if (isLocalResource(input, "sitemap.xml")) {
@@ -53,7 +54,7 @@ const customFetch: typeof fetch = (input, init) => {
53
54
  return Promise.resolve(response);
54
55
  }
55
56
 
56
- return fetch(input, init);
57
+ return cachedFetch(projectId, input, init);
57
58
  };
58
59
 
59
60
  export const loader = async (arg: LoaderFunctionArgs) => {
@@ -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.228.0",
15
- "@webstudio-is/react-sdk": "0.228.0",
16
- "@webstudio-is/sdk": "0.228.0",
17
- "@webstudio-is/sdk-components-react": "0.228.0",
18
- "@webstudio-is/sdk-components-animation": "0.228.0",
19
- "@webstudio-is/sdk-components-react-radix": "0.228.0",
20
- "@webstudio-is/sdk-components-react-remix": "0.228.0",
14
+ "@webstudio-is/image": "0.230.0",
15
+ "@webstudio-is/react-sdk": "0.230.0",
16
+ "@webstudio-is/sdk": "0.230.0",
17
+ "@webstudio-is/sdk-components-react": "0.230.0",
18
+ "@webstudio-is/sdk-components-animation": "0.230.0",
19
+ "@webstudio-is/sdk-components-react-radix": "0.230.0",
20
+ "@webstudio-is/sdk-components-react-remix": "0.230.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"
@@ -15,6 +15,7 @@ import {
15
15
  loadResources,
16
16
  formIdFieldName,
17
17
  formBotFieldName,
18
+ cachedFetch,
18
19
  } from "@webstudio-is/sdk/runtime";
19
20
  import {
20
21
  ReactSdkContext,
@@ -42,7 +43,7 @@ import { sitemap } from "__SITEMAP__";
42
43
 
43
44
  const customFetch: typeof fetch = (input, init) => {
44
45
  if (typeof input !== "string") {
45
- return fetch(input, init);
46
+ return cachedFetch(projectId, input, init);
46
47
  }
47
48
 
48
49
  if (isLocalResource(input, "sitemap.xml")) {
@@ -52,7 +53,7 @@ const customFetch: typeof fetch = (input, init) => {
52
53
  return Promise.resolve(response);
53
54
  }
54
55
 
55
- return fetch(input, init);
56
+ return cachedFetch(projectId, input, init);
56
57
  };
57
58
 
58
59
  export const loader = async (arg: LoaderFunctionArgs) => {
@@ -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.228.0",
14
- "@webstudio-is/react-sdk": "0.228.0",
15
- "@webstudio-is/sdk": "0.228.0",
16
- "@webstudio-is/sdk-components-animation": "0.228.0",
17
- "@webstudio-is/sdk-components-react-radix": "0.228.0",
18
- "@webstudio-is/sdk-components-react-router": "0.228.0",
19
- "@webstudio-is/sdk-components-react": "0.228.0",
13
+ "@webstudio-is/image": "0.230.0",
14
+ "@webstudio-is/react-sdk": "0.230.0",
15
+ "@webstudio-is/sdk": "0.230.0",
16
+ "@webstudio-is/sdk-components-animation": "0.230.0",
17
+ "@webstudio-is/sdk-components-react-radix": "0.230.0",
18
+ "@webstudio-is/sdk-components-react-router": "0.230.0",
19
+ "@webstudio-is/sdk-components-react": "0.230.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",
@@ -8,12 +8,12 @@
8
8
  "typecheck": "tsc"
9
9
  },
10
10
  "dependencies": {
11
- "@webstudio-is/image": "0.228.0",
12
- "@webstudio-is/react-sdk": "0.228.0",
13
- "@webstudio-is/sdk": "0.228.0",
14
- "@webstudio-is/sdk-components-react": "0.228.0",
15
- "@webstudio-is/sdk-components-animation": "0.228.0",
16
- "@webstudio-is/sdk-components-react-radix": "0.228.0",
11
+ "@webstudio-is/image": "0.230.0",
12
+ "@webstudio-is/react-sdk": "0.230.0",
13
+ "@webstudio-is/sdk": "0.230.0",
14
+ "@webstudio-is/sdk-components-react": "0.230.0",
15
+ "@webstudio-is/sdk-components-animation": "0.230.0",
16
+ "@webstudio-is/sdk-components-react-radix": "0.230.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"