webstudio 0.298.0 → 0.300.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.298.0",
3
+ "version": "0.300.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -53,9 +53,9 @@
53
53
  "which": "^5.0.0",
54
54
  "yargs": "^17.7.2",
55
55
  "zod": "^4.4.3",
56
- "@webstudio-is/http-client": "0.298.0",
57
- "@webstudio-is/project-migrations": "0.298.0",
58
- "@webstudio-is/protocol": "0.298.0",
56
+ "@webstudio-is/http-client": "0.300.0",
57
+ "@webstudio-is/protocol": "0.300.0",
58
+ "@webstudio-is/project-migrations": "0.300.0",
59
59
  "@webstudio-is/sync-client": "0.0.0"
60
60
  },
61
61
  "devDependencies": {
@@ -99,24 +99,24 @@
99
99
  "vite": "^6.3.4",
100
100
  "vitest": "^3.1.2",
101
101
  "wrangler": "4.130.0",
102
- "@webstudio-is/css-engine": "0.298.0",
103
- "@webstudio-is/content-engine": "0.298.0",
104
- "@webstudio-is/fonts": "0.298.0",
105
- "@webstudio-is/expression": "0.298.0",
106
- "@webstudio-is/image": "0.298.0",
102
+ "@webstudio-is/expression": "0.300.0",
103
+ "@webstudio-is/fonts": "0.300.0",
104
+ "@webstudio-is/image": "0.300.0",
107
105
  "@webstudio-is/project-build": "0.0.0",
108
- "@webstudio-is/query-builder": "0.298.0",
109
- "@webstudio-is/react-sdk": "0.298.0",
110
- "@webstudio-is/sdk": "0.298.0",
111
- "@webstudio-is/sdk-components-animation": "0.298.0",
112
- "@webstudio-is/sdk-components-react-remix": "0.298.0",
113
- "@webstudio-is/sdk-components-react-radix": "0.298.0",
114
- "@webstudio-is/sdk-components-react-router": "0.298.0",
115
- "@webstudio-is/sdk-components-react": "0.298.0",
116
- "@webstudio-is/sdk-components-registry": "0.298.0",
106
+ "@webstudio-is/query-builder": "0.300.0",
107
+ "@webstudio-is/css-engine": "0.300.0",
108
+ "@webstudio-is/sdk-components-animation": "0.300.0",
109
+ "@webstudio-is/react-sdk": "0.300.0",
110
+ "@webstudio-is/sdk": "0.300.0",
111
+ "@webstudio-is/sdk-components-react": "0.300.0",
112
+ "@webstudio-is/content-engine": "0.300.0",
113
+ "@webstudio-is/sdk-components-react-radix": "0.300.0",
114
+ "@webstudio-is/sdk-components-react-router": "0.300.0",
117
115
  "@webstudio-is/tsconfig": "1.0.7",
118
- "@webstudio-is/vision": "0.0.0",
119
- "@webstudio-is/wsauth": "0.298.0"
116
+ "@webstudio-is/sdk-components-registry": "0.300.0",
117
+ "@webstudio-is/wsauth": "0.300.0",
118
+ "@webstudio-is/sdk-components-react-remix": "0.300.0",
119
+ "@webstudio-is/vision": "0.0.0"
120
120
  },
121
121
  "scripts": {
122
122
  "typecheck": "tsc --noEmit",
@@ -12,7 +12,7 @@
12
12
  "build-cf-types": "wrangler types"
13
13
  },
14
14
  "dependencies": {
15
- "@webstudio-is/wsauth": "0.298.0",
15
+ "@webstudio-is/wsauth": "0.300.0",
16
16
  "@remix-run/cloudflare": "2.16.5",
17
17
  "@remix-run/cloudflare-pages": "2.16.5"
18
18
  },
@@ -46,6 +46,7 @@ import css from "__CSS__?url";
46
46
  import { sitemap } from "__SITEMAP__";
47
47
  import { authRoutes } from "__AUTH__";
48
48
  import { createGeneratedAssetResourceFetch } from "__ASSET_QUERY_RUNTIME__";
49
+ import { assetUrlsByPath } from "__ASSETS__";
49
50
 
50
51
  const authenticateProductionRequest = (request: Request) => {
51
52
  const host =
@@ -275,9 +276,10 @@ export const action = async ({
275
276
  };
276
277
 
277
278
  const resourceName = formData.get(formIdFieldName);
278
- let resource =
279
+ const generatedResources = getResources({ system });
280
+ const actionResource =
279
281
  typeof resourceName === "string"
280
- ? getResources({ system }).action.get(resourceName)
282
+ ? generatedResources.action.get(resourceName)
281
283
  : undefined;
282
284
 
283
285
  const formBotValue = formData.get(formBotFieldName);
@@ -306,25 +308,49 @@ export const action = async ({
306
308
  formData.delete(formIdFieldName);
307
309
  formData.delete(formBotFieldName);
308
310
 
309
- if (resource) {
310
- resource.body = Object.fromEntries(formData);
311
- } else {
311
+ let result: Awaited<ReturnType<typeof loadResource>>;
312
+ if (actionResource === undefined) {
312
313
  if (contactEmail === undefined) {
313
314
  throw new Error("Contact email not found");
314
315
  }
315
-
316
- resource = context.getDefaultActionResource?.({
316
+ const resource = context.getDefaultActionResource?.({
317
317
  url,
318
318
  projectId,
319
319
  contactEmail,
320
320
  formData,
321
321
  });
322
+ if (resource === undefined) {
323
+ throw Error("Resource not found");
324
+ }
325
+ result = await loadResource(fetch, resource);
326
+ } else {
327
+ const actionFetch = await createGeneratedAssetResourceFetch({
328
+ request,
329
+ context,
330
+ fallback: customFetch,
331
+ });
332
+ const results = await loadResources(
333
+ actionFetch,
334
+ {
335
+ ...generatedResources.data,
336
+ rootIds: [actionResource.id],
337
+ },
338
+ url,
339
+ {
340
+ requestOverrides: new Map([
341
+ // Mutations must reach the backend on every submission, even when
342
+ // the resource has caching enabled. Dependencies can stay cached.
343
+ [actionResource.id, { body: Object.fromEntries(formData), fetch }],
344
+ ]),
345
+ }
346
+ );
347
+ const actionResult = results[actionResource.outputName];
348
+ if (actionResult === undefined) {
349
+ throw Error("Resource not found");
350
+ }
351
+ result = actionResult as Awaited<ReturnType<typeof loadResource>>;
322
352
  }
323
-
324
- if (resource === undefined) {
325
- throw Error("Resource not found");
326
- }
327
- const { ok, statusText } = await loadResource(fetch, resource);
353
+ const { ok, statusText } = result;
328
354
  if (ok) {
329
355
  return { success: true };
330
356
  }
@@ -356,6 +382,7 @@ const Outlet = () => {
356
382
  const sdkContext = useMemo(
357
383
  () => ({
358
384
  ...constants,
385
+ assetUrlsByPath,
359
386
  resources,
360
387
  breakpoints,
361
388
  onError: console.error,
@@ -13,14 +13,14 @@
13
13
  "@remix-run/node": "2.16.5",
14
14
  "@remix-run/react": "2.16.5",
15
15
  "@remix-run/server-runtime": "2.16.5",
16
- "@webstudio-is/image": "0.298.0",
17
- "@webstudio-is/react-sdk": "0.298.0",
18
- "@webstudio-is/sdk": "0.298.0",
19
- "@webstudio-is/sdk-components-react": "0.298.0",
20
- "@webstudio-is/sdk-components-animation": "0.298.0",
21
- "@webstudio-is/sdk-components-react-radix": "0.298.0",
22
- "@webstudio-is/sdk-components-react-remix": "0.298.0",
23
- "@webstudio-is/wsauth": "0.298.0",
16
+ "@webstudio-is/image": "0.300.0",
17
+ "@webstudio-is/react-sdk": "0.300.0",
18
+ "@webstudio-is/sdk": "0.300.0",
19
+ "@webstudio-is/sdk-components-react": "0.300.0",
20
+ "@webstudio-is/sdk-components-animation": "0.300.0",
21
+ "@webstudio-is/sdk-components-react-radix": "0.300.0",
22
+ "@webstudio-is/sdk-components-react-remix": "0.300.0",
23
+ "@webstudio-is/wsauth": "0.300.0",
24
24
  "isbot": "^5.1.25",
25
25
  "react": "18.3.0-canary-14898b6a9-20240318",
26
26
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
@@ -3,6 +3,7 @@ import type { ResourceRequest } from "@webstudio-is/sdk";
3
3
  declare module "react-router" {
4
4
  interface AppLoadContext {
5
5
  EXCLUDE_FROM_SEARCH: boolean;
6
+ WEBSTUDIO_AUTOMATION_TOKEN?: string;
6
7
  getDefaultActionResource?: (options: {
7
8
  url: URL;
8
9
  projectId: string;
@@ -45,6 +45,7 @@ import css from "__CSS__?url";
45
45
  import { sitemap } from "__SITEMAP__";
46
46
  import { authRoutes } from "__AUTH__";
47
47
  import { createGeneratedAssetResourceFetch } from "__ASSET_QUERY_RUNTIME__";
48
+ import { assetUrlsByPath } from "__ASSETS__";
48
49
 
49
50
  const authenticateProductionRequest = (request: Request) => {
50
51
  const host =
@@ -274,9 +275,10 @@ export const action = async ({
274
275
  };
275
276
 
276
277
  const resourceName = formData.get(formIdFieldName);
277
- let resource =
278
+ const generatedResources = getResources({ system });
279
+ const actionResource =
278
280
  typeof resourceName === "string"
279
- ? getResources({ system }).action.get(resourceName)
281
+ ? generatedResources.action.get(resourceName)
280
282
  : undefined;
281
283
 
282
284
  const formBotValue = formData.get(formBotFieldName);
@@ -305,25 +307,49 @@ export const action = async ({
305
307
  formData.delete(formIdFieldName);
306
308
  formData.delete(formBotFieldName);
307
309
 
308
- if (resource) {
309
- resource.body = Object.fromEntries(formData);
310
- } else {
310
+ let result: Awaited<ReturnType<typeof loadResource>>;
311
+ if (actionResource === undefined) {
311
312
  if (contactEmail === undefined) {
312
313
  throw new Error("Contact email not found");
313
314
  }
314
-
315
- resource = context.getDefaultActionResource?.({
315
+ const resource = context.getDefaultActionResource?.({
316
316
  url,
317
317
  projectId,
318
318
  contactEmail,
319
319
  formData,
320
320
  });
321
+ if (resource === undefined) {
322
+ throw Error("Resource not found");
323
+ }
324
+ result = await loadResource(fetch, resource);
325
+ } else {
326
+ const actionFetch = await createGeneratedAssetResourceFetch({
327
+ request,
328
+ context,
329
+ fallback: customFetch,
330
+ });
331
+ const results = await loadResources(
332
+ actionFetch,
333
+ {
334
+ ...generatedResources.data,
335
+ rootIds: [actionResource.id],
336
+ },
337
+ url,
338
+ {
339
+ requestOverrides: new Map([
340
+ // Mutations must reach the backend on every submission, even when
341
+ // the resource has caching enabled. Dependencies can stay cached.
342
+ [actionResource.id, { body: Object.fromEntries(formData), fetch }],
343
+ ]),
344
+ }
345
+ );
346
+ const actionResult = results[actionResource.outputName];
347
+ if (actionResult === undefined) {
348
+ throw Error("Resource not found");
349
+ }
350
+ result = actionResult as Awaited<ReturnType<typeof loadResource>>;
321
351
  }
322
-
323
- if (resource === undefined) {
324
- throw Error("Resource not found");
325
- }
326
- const { ok, statusText } = await loadResource(fetch, resource);
352
+ const { ok, statusText } = result;
327
353
  if (ok) {
328
354
  return { success: true };
329
355
  }
@@ -355,6 +381,7 @@ const Outlet = () => {
355
381
  const sdkContext = useMemo(
356
382
  () => ({
357
383
  ...constants,
384
+ assetUrlsByPath,
358
385
  resources,
359
386
  breakpoints,
360
387
  onError: console.error,
@@ -15,14 +15,14 @@
15
15
  "@react-router/fs-routes": "^7.5.3",
16
16
  "@react-router/node": "^7.5.3",
17
17
  "@react-router/serve": "^7.5.3",
18
- "@webstudio-is/image": "0.298.0",
19
- "@webstudio-is/react-sdk": "0.298.0",
20
- "@webstudio-is/sdk": "0.298.0",
21
- "@webstudio-is/sdk-components-animation": "0.298.0",
22
- "@webstudio-is/sdk-components-react-radix": "0.298.0",
23
- "@webstudio-is/sdk-components-react-router": "0.298.0",
24
- "@webstudio-is/sdk-components-react": "0.298.0",
25
- "@webstudio-is/wsauth": "0.298.0",
18
+ "@webstudio-is/image": "0.300.0",
19
+ "@webstudio-is/react-sdk": "0.300.0",
20
+ "@webstudio-is/sdk": "0.300.0",
21
+ "@webstudio-is/sdk-components-animation": "0.300.0",
22
+ "@webstudio-is/sdk-components-react-radix": "0.300.0",
23
+ "@webstudio-is/sdk-components-react-router": "0.300.0",
24
+ "@webstudio-is/sdk-components-react": "0.300.0",
25
+ "@webstudio-is/wsauth": "0.300.0",
26
26
  "isbot": "^5.1.25",
27
27
  "react": "18.3.0-canary-14898b6a9-20240318",
28
28
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@cloudflare/vite-plugin": "^1.1.0",
10
- "@webstudio-is/wsauth": "0.298.0",
10
+ "@webstudio-is/wsauth": "0.300.0",
11
11
  "wrangler": "^4.14.1"
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "node_modules/wrangler/config-schema.json",
3
- // SaaS publishes Workers. This takes precedence over the Cloudflare Pages
3
+ // Hosted deployments publish Workers. This takes precedence over the Cloudflare Pages
4
4
  // template's wrangler.toml; publish workflows provide the name and date.
5
5
  "name": "webstudio-remix-app",
6
6
  "compatibility_date": "2024-04-05"
@@ -18,5 +18,9 @@ export const createSsgAssetResourceFetch = ({
18
18
  baseUrl: "https://webstudio.local",
19
19
  deploymentId,
20
20
  artifact,
21
+ automationToken:
22
+ typeof process === "undefined"
23
+ ? undefined
24
+ : process.env.WEBSTUDIO_AUTOMATION_TOKEN,
21
25
  runtimeAssets,
22
26
  });
@@ -7,6 +7,7 @@ import {
7
7
  } from "@webstudio-is/react-sdk/runtime";
8
8
  import { LinkCurrentUrlContext } from "@webstudio-is/sdk-components-react";
9
9
  import { assetBaseUrl, imageLoader } from "__CONSTANTS__";
10
+ import { assetUrlsByPath } from "__ASSETS__";
10
11
  import { Page, breakpoints, siteName } from "__CLIENT__";
11
12
 
12
13
  const getPageKey = (url: string) => {
@@ -32,6 +33,7 @@ const PageComponent = ({ data }: { data: PageContext["data"] }) => {
32
33
  () => ({
33
34
  imageLoader,
34
35
  assetBaseUrl,
36
+ assetUrlsByPath,
35
37
  resources,
36
38
  breakpoints,
37
39
  onError: console.error,
@@ -11,12 +11,12 @@
11
11
  "dependencies": {
12
12
  "@shikijs/langs": "4.4.1",
13
13
  "@shikijs/themes": "4.4.1",
14
- "@webstudio-is/image": "0.298.0",
15
- "@webstudio-is/react-sdk": "0.298.0",
16
- "@webstudio-is/sdk": "0.298.0",
17
- "@webstudio-is/sdk-components-react": "0.298.0",
18
- "@webstudio-is/sdk-components-animation": "0.298.0",
19
- "@webstudio-is/sdk-components-react-radix": "0.298.0",
14
+ "@webstudio-is/image": "0.300.0",
15
+ "@webstudio-is/react-sdk": "0.300.0",
16
+ "@webstudio-is/sdk": "0.300.0",
17
+ "@webstudio-is/sdk-components-react": "0.300.0",
18
+ "@webstudio-is/sdk-components-animation": "0.300.0",
19
+ "@webstudio-is/sdk-components-react-radix": "0.300.0",
20
20
  "react": "18.3.0-canary-14898b6a9-20240318",
21
21
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
22
22
  "shiki": "4.4.1",