webstudio 0.143.0 → 0.143.1

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
@@ -514,12 +514,6 @@ var prebuild = async (options) => {
514
514
  backgroundImageAssetsByPage[page.id] = backgroundImageAssets;
515
515
  }
516
516
  const assetsToDownload = [];
517
- const imageAssets = [];
518
- for (const asset of siteData.assets) {
519
- if (asset.type === "image") {
520
- imageAssets.push(asset);
521
- }
522
- }
523
517
  const appDomain = options.preview ? "wstd.work" : "wstd.io";
524
518
  const assetBuildUrl = `https://${domain}.${appDomain}/cgi/asset/`;
525
519
  const imageLoader = createImageLoader({
@@ -549,6 +543,7 @@ var prebuild = async (options) => {
549
543
  }
550
544
  }
551
545
  }
546
+ const assets = new Map(siteData.assets.map((asset) => [asset.id, asset]));
552
547
  spinner.text = "Generating css file";
553
548
  const { cssText, classesMap } = generateCss(
554
549
  {
@@ -641,9 +636,10 @@ var prebuild = async (options) => {
641
636
  [rootInstanceId]
642
637
  )
643
638
  });
644
- const favIconAsset = imageAssets.find(
645
- (asset) => asset.id === siteData.build.pages.meta?.faviconAssetId
646
- );
639
+ const projectMeta = siteData.build.pages.meta;
640
+ const pageMeta = pageData.page.meta;
641
+ const favIconAsset = assets.get(projectMeta?.faviconAssetId ?? "");
642
+ const socialImageAsset = assets.get(pageMeta.socialImageAssetId ?? "");
647
643
  const pageExports = `/* eslint-disable */
648
644
  /* This is a auto generated file for building the project */
649
645
 
@@ -652,14 +648,19 @@ import { Fragment, useState } from "react";
652
648
  import type { FontAsset, ImageAsset } from "@webstudio-is/sdk";
653
649
  import { useResource } from "@webstudio-is/react-sdk";
654
650
  ${componentImports}
655
- export const favIconAsset: ImageAsset | undefined = ${favIconAsset ? JSON.stringify(favIconAsset) : "undefined"};
651
+
652
+ export const favIconAsset: ImageAsset | undefined =
653
+ ${JSON.stringify(favIconAsset)};
654
+
655
+ export const socialImageAsset: ImageAsset | undefined =
656
+ ${JSON.stringify(socialImageAsset)};
656
657
 
657
658
  // Font assets on current page (can be preloaded)
658
- export const pageFontAssets: FontAsset[] = ${JSON.stringify(pageFontAssets)}
659
+ export const pageFontAssets: FontAsset[] =
660
+ ${JSON.stringify(pageFontAssets)}
659
661
 
660
- export const pageBackgroundImageAssets: ImageAsset[] = ${JSON.stringify(
661
- pageBackgroundImageAssets
662
- )}
662
+ export const pageBackgroundImageAssets: ImageAsset[] =
663
+ ${JSON.stringify(pageBackgroundImageAssets)}
663
664
 
664
665
 
665
666
 
@@ -671,7 +672,7 @@ export { Page }
671
672
  /* This is a auto generated file for building the project */
672
673
 
673
674
 
674
- import type { ImageAsset, ProjectMeta, PageMeta } from "@webstudio-is/sdk";
675
+ import type { ProjectMeta, PageMeta } from "@webstudio-is/sdk";
675
676
  ${generateResourcesLoader({
676
677
  scope,
677
678
  page: pageData.page,
@@ -691,16 +692,11 @@ ${generateRemixParams(pageData.page.path)}
691
692
 
692
693
  export const projectId = "${siteData.build.projectId}";
693
694
 
694
- export const user: { email: string | null } | undefined = ${JSON.stringify(
695
- siteData.user
696
- )};
697
-
698
- export const projectMeta: ProjectMeta = ${JSON.stringify(
699
- siteData.build.pages.meta
700
- )};
701
-
702
- export const imageAssets: ImageAsset[] = ${JSON.stringify(imageAssets)}
695
+ export const user: { email: string | null } | undefined =
696
+ ${JSON.stringify(siteData.user)};
703
697
 
698
+ export const projectMeta: ProjectMeta =
699
+ ${JSON.stringify(projectMeta)};
704
700
  `;
705
701
  const pagePath = getPagePath(pageData.page.id, siteData.build.pages);
706
702
  const remixRoute = generateRemixRoute(pagePath);
@@ -925,7 +921,7 @@ import makeCLI from "yargs";
925
921
  // package.json
926
922
  var package_default = {
927
923
  name: "webstudio",
928
- version: "0.143.0",
924
+ version: "0.143.1",
929
925
  description: "Webstudio CLI",
930
926
  author: "Webstudio <github@webstudio.is>",
931
927
  homepage: "https://webstudio.is",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.143.0",
3
+ "version": "0.143.1",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -28,21 +28,21 @@
28
28
  "title-case": "^4.1.0",
29
29
  "yargs": "^17.7.2",
30
30
  "zod": "^3.22.4",
31
- "@webstudio-is/http-client": "0.143.0",
32
- "@webstudio-is/image": "0.143.0",
33
- "@webstudio-is/react-sdk": "0.143.0",
34
- "@webstudio-is/sdk": "0.143.0",
35
- "@webstudio-is/sdk-components-react-radix": "0.143.0",
36
- "@webstudio-is/sdk-components-react-remix": "0.143.0",
37
- "@webstudio-is/sdk-components-react": "0.143.0"
31
+ "@webstudio-is/image": "0.143.1",
32
+ "@webstudio-is/http-client": "0.143.1",
33
+ "@webstudio-is/react-sdk": "0.143.1",
34
+ "@webstudio-is/sdk": "0.143.1",
35
+ "@webstudio-is/sdk-components-react-radix": "0.143.1",
36
+ "@webstudio-is/sdk-components-react": "0.143.1",
37
+ "@webstudio-is/sdk-components-react-remix": "0.143.1"
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/tsconfig": "1.0.7",
45
- "@webstudio-is/form-handlers": "0.143.0"
44
+ "@webstudio-is/form-handlers": "0.143.1",
45
+ "@webstudio-is/tsconfig": "1.0.7"
46
46
  },
47
47
  "scripts": {
48
48
  "typecheck": "tsc",
@@ -15,6 +15,7 @@ import { n8nHandler, getFormId } from "@webstudio-is/form-handlers";
15
15
  import {
16
16
  Page,
17
17
  favIconAsset,
18
+ socialImageAsset,
18
19
  pageFontAssets,
19
20
  pageBackgroundImageAssets,
20
21
  } from "../../../__generated__/_index";
@@ -26,7 +27,6 @@ import {
26
27
  projectId,
27
28
  user,
28
29
  projectMeta,
29
- imageAssets,
30
30
  } from "../../../__generated__/_index.server";
31
31
 
32
32
  import css from "../__generated__/index.css";
@@ -150,21 +150,15 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
150
150
  });
151
151
  }
152
152
 
153
- if (pageMeta.socialImageAssetId) {
154
- const imageAsset = imageAssets.find(
155
- (asset) => asset.id === pageMeta.socialImageAssetId
156
- );
157
-
158
- if (imageAsset) {
159
- metas.push({
160
- property: "og:image",
161
- content: `https://${data.host}${imageLoader({
162
- src: imageAsset.name,
163
- // Do not transform social image (not enough information do we need to do this)
164
- format: "raw",
165
- })}`,
166
- });
167
- }
153
+ if (socialImageAsset) {
154
+ metas.push({
155
+ property: "og:image",
156
+ content: `https://${data.host}${imageLoader({
157
+ src: socialImageAsset.name,
158
+ // Do not transform social image (not enough information do we need to do this)
159
+ format: "raw",
160
+ })}`,
161
+ });
168
162
  } else if (pageMeta.socialImageUrl) {
169
163
  metas.push({
170
164
  property: "og:image",
@@ -10,13 +10,13 @@
10
10
  "@remix-run/react": "^1.19.2",
11
11
  "@remix-run/server-runtime": "^1.19.2",
12
12
  "@remix-run/node": "^1.19.2",
13
- "@webstudio-is/react-sdk": "0.143.0",
14
- "@webstudio-is/sdk-components-react-radix": "0.143.0",
15
- "@webstudio-is/sdk-components-react-remix": "0.143.0",
16
- "@webstudio-is/sdk-components-react": "0.143.0",
17
- "@webstudio-is/form-handlers": "0.143.0",
18
- "@webstudio-is/image": "0.143.0",
19
- "@webstudio-is/sdk": "0.143.0",
13
+ "@webstudio-is/react-sdk": "0.143.1",
14
+ "@webstudio-is/sdk-components-react-radix": "0.143.1",
15
+ "@webstudio-is/sdk-components-react-remix": "0.143.1",
16
+ "@webstudio-is/sdk-components-react": "0.143.1",
17
+ "@webstudio-is/form-handlers": "0.143.1",
18
+ "@webstudio-is/image": "0.143.1",
19
+ "@webstudio-is/sdk": "0.143.1",
20
20
  "isbot": "^3.6.8",
21
21
  "react": "^18.2.0",
22
22
  "react-dom": "^18.2.0"