webstudio 0.179.0 → 0.182.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
@@ -130,7 +130,7 @@ import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises
130
130
  import { cancel, isCancel, log, text } from "@clack/prompts";
131
131
  import { parseBuilderUrl } from "@webstudio-is/http-client";
132
132
  var parseShareLink = (value) => {
133
- const url = new URL(value);
133
+ const url = new URL(value.replaceAll("'", ""));
134
134
  const token = url.searchParams.get("authToken");
135
135
  let { projectId, sourceOrigin } = parseBuilderUrl(url.href);
136
136
  if (projectId === void 0) {
@@ -272,7 +272,7 @@ var sync = async (options) => {
272
272
  });
273
273
  } catch (error) {
274
274
  syncing.stop(error.message, 2);
275
- return;
275
+ throw error;
276
276
  }
277
277
  }
278
278
  project;
@@ -820,16 +820,17 @@ Please check webstudio --help for more details`
820
820
  backgroundImageAssetsByPage[page.id] = backgroundImageAssets;
821
821
  }
822
822
  const assetsToDownload = [];
823
- const appDomain = options.preview ? "wstd.work" : "wstd.io";
824
- const domain = siteData.build.deployment?.destination === "static" ? siteData.build.deployment?.assetsDomain : siteData.build.deployment?.projectDomain;
825
- if (domain === void 0) {
826
- throw new Error(`Project domain is missing from the project data`);
827
- }
828
- const assetBuildUrl = `https://${domain}.${appDomain}/cgi/asset/`;
829
- const imageLoader = createImageLoader({
830
- imageBaseUrl: assetBuildUrl
831
- });
832
823
  if (options.assets === true) {
824
+ const appDomain = options.preview ? "wstd.work" : "wstd.io";
825
+ const domain = siteData.build.deployment?.assetsDomain ?? // fallback to project domain should not be used since 2025-01-01 (for now is used for backward compatibility)
826
+ (siteData.build.deployment?.destination !== "static" ? siteData.build.deployment?.projectDomain : void 0);
827
+ if (domain === void 0) {
828
+ throw new Error(`Project domain is missing from the project data`);
829
+ }
830
+ const assetBuildUrl = `https://${domain}.${appDomain}/cgi/asset/`;
831
+ const imageLoader = createImageLoader({
832
+ imageBaseUrl: assetBuildUrl
833
+ });
833
834
  for (const asset of siteData.assets) {
834
835
  if (asset.type === "image") {
835
836
  const imageSrc = imageLoader({
@@ -1112,6 +1113,24 @@ Please check webstudio --help for more details`
1112
1113
  log2.step("Build finished");
1113
1114
  };
1114
1115
 
1116
+ // src/build-utils.ts
1117
+ var mapToTemplatesFromOptions = (values) => {
1118
+ const templates = [];
1119
+ for (const value of values) {
1120
+ const template = PROJECT_TEMPLATES.find((item) => item.value === value) ?? INTERNAL_TEMPLATES.find((item) => item.value === value);
1121
+ if (template == null) {
1122
+ templates.push(value);
1123
+ continue;
1124
+ }
1125
+ if ("expand" in template && template.expand != null) {
1126
+ templates.push(...template.expand);
1127
+ continue;
1128
+ }
1129
+ templates.push(value);
1130
+ }
1131
+ return templates;
1132
+ };
1133
+
1115
1134
  // src/commands/build.ts
1116
1135
  var buildOptions = (yargs) => yargs.option("assets", {
1117
1136
  type: "boolean",
@@ -1125,22 +1144,7 @@ var buildOptions = (yargs) => yargs.option("assets", {
1125
1144
  type: "array",
1126
1145
  string: true,
1127
1146
  default: [],
1128
- coerce: (values) => {
1129
- const templates = [];
1130
- for (const value of values) {
1131
- const template = PROJECT_TEMPLATES.find((item) => item.value === value) ?? INTERNAL_TEMPLATES.find((item) => item.value === value);
1132
- if (template == null) {
1133
- templates.push(value);
1134
- continue;
1135
- }
1136
- if ("expand" in template && template.expand != null) {
1137
- templates.push(...template.expand);
1138
- continue;
1139
- }
1140
- templates.push(value);
1141
- }
1142
- return templates;
1143
- },
1147
+ coerce: mapToTemplatesFromOptions,
1144
1148
  describe: `Template to use for the build [choices: ${PROJECT_TEMPLATES.map(
1145
1149
  (item) => item.value
1146
1150
  ).join(", ")}]`
@@ -1238,7 +1242,9 @@ var initFlow = async (options) => {
1238
1242
  await sync({ buildId: void 0, origin: void 0, authToken: void 0 });
1239
1243
  await build({
1240
1244
  ...options,
1241
- ...projectTemplate && { template: [projectTemplate] }
1245
+ ...projectTemplate && {
1246
+ template: mapToTemplatesFromOptions([projectTemplate])
1247
+ }
1242
1248
  });
1243
1249
  if (shouldInstallDeps === true) {
1244
1250
  const install = spinner3();
@@ -1281,7 +1287,7 @@ import makeCLI from "yargs";
1281
1287
  // package.json
1282
1288
  var package_default = {
1283
1289
  name: "webstudio",
1284
- version: "0.179.0",
1290
+ version: "0.182.0",
1285
1291
  description: "Webstudio CLI",
1286
1292
  author: "Webstudio <github@webstudio.is>",
1287
1293
  homepage: "https://webstudio.is",
@@ -1341,7 +1347,7 @@ var package_default = {
1341
1347
  "@remix-run/node": "^2.11.0",
1342
1348
  "@remix-run/react": "^2.11.0",
1343
1349
  "@remix-run/server-runtime": "^2.11.0",
1344
- "@types/node": "^20.12.7",
1350
+ "@types/node": "^22.6.1",
1345
1351
  "@types/react": "^18.2.70",
1346
1352
  "@types/react-dom": "^18.2.25",
1347
1353
  "@types/yargs": "^17.0.32",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.179.0",
3
+ "version": "0.182.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -37,13 +37,13 @@
37
37
  "strip-indent": "^4.0.0",
38
38
  "yargs": "^17.7.2",
39
39
  "zod": "^3.22.4",
40
- "@webstudio-is/http-client": "0.179.0",
41
- "@webstudio-is/image": "0.179.0",
42
- "@webstudio-is/sdk": "0.179.0",
43
- "@webstudio-is/sdk-components-react": "0.179.0",
44
- "@webstudio-is/react-sdk": "0.179.0",
45
- "@webstudio-is/sdk-components-react-radix": "0.179.0",
46
- "@webstudio-is/sdk-components-react-remix": "0.179.0"
40
+ "@webstudio-is/http-client": "0.182.0",
41
+ "@webstudio-is/image": "0.182.0",
42
+ "@webstudio-is/react-sdk": "0.182.0",
43
+ "@webstudio-is/sdk": "0.182.0",
44
+ "@webstudio-is/sdk-components-react": "0.182.0",
45
+ "@webstudio-is/sdk-components-react-radix": "0.182.0",
46
+ "@webstudio-is/sdk-components-react-remix": "0.182.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@jest/globals": "^29.7.0",
@@ -55,7 +55,7 @@
55
55
  "@remix-run/node": "^2.11.0",
56
56
  "@remix-run/react": "^2.11.0",
57
57
  "@remix-run/server-runtime": "^2.11.0",
58
- "@types/node": "^20.12.7",
58
+ "@types/node": "^22.6.1",
59
59
  "@types/react": "^18.2.70",
60
60
  "@types/react-dom": "^18.2.25",
61
61
  "@types/yargs": "^17.0.32",
@@ -11,12 +11,12 @@
11
11
  "@remix-run/node": "2.11.0",
12
12
  "@remix-run/react": "2.11.0",
13
13
  "@remix-run/server-runtime": "2.11.0",
14
- "@webstudio-is/react-sdk": "0.179.0",
15
- "@webstudio-is/sdk-components-react-radix": "0.179.0",
16
- "@webstudio-is/sdk-components-react-remix": "0.179.0",
17
- "@webstudio-is/sdk-components-react": "0.179.0",
18
- "@webstudio-is/image": "0.179.0",
19
- "@webstudio-is/sdk": "0.179.0",
14
+ "@webstudio-is/react-sdk": "0.182.0",
15
+ "@webstudio-is/sdk-components-react-radix": "0.182.0",
16
+ "@webstudio-is/sdk-components-react-remix": "0.182.0",
17
+ "@webstudio-is/sdk-components-react": "0.182.0",
18
+ "@webstudio-is/image": "0.182.0",
19
+ "@webstudio-is/sdk": "0.182.0",
20
20
  "isbot": "^5.1.17",
21
21
  "react": "18.3.0-canary-14898b6a9-20240318",
22
22
  "react-dom": "18.3.0-canary-14898b6a9-20240318"
@@ -2,6 +2,8 @@
2
2
  * We use mjs extension as constants in this file is shared with the build script
3
3
  * and we use `node --eval` to extract the constants.
4
4
  */
5
+ import { UrlCanParse } from "@webstudio-is/image";
6
+
5
7
  export const assetBaseUrl = "/assets/";
6
8
  export const imageBaseUrl = "/assets/";
7
9
 
@@ -9,7 +11,7 @@ export const imageBaseUrl = "/assets/";
9
11
  * @type {import("@webstudio-is/image").ImageLoader}
10
12
  */
11
13
  export const imageLoader = ({ src }) => {
12
- if (URL.canParse(src)) {
14
+ if (UrlCanParse(src)) {
13
15
  return src;
14
16
  }
15
17
 
@@ -8,11 +8,11 @@
8
8
  "typecheck": "tsc"
9
9
  },
10
10
  "dependencies": {
11
- "@webstudio-is/react-sdk": "0.179.0",
12
- "@webstudio-is/sdk-components-react-radix": "0.179.0",
13
- "@webstudio-is/sdk-components-react": "0.179.0",
14
- "@webstudio-is/image": "0.179.0",
15
- "@webstudio-is/sdk": "0.179.0",
11
+ "@webstudio-is/react-sdk": "0.182.0",
12
+ "@webstudio-is/sdk-components-react-radix": "0.182.0",
13
+ "@webstudio-is/sdk-components-react": "0.182.0",
14
+ "@webstudio-is/image": "0.182.0",
15
+ "@webstudio-is/sdk": "0.182.0",
16
16
  "react": "18.3.0-canary-14898b6a9-20240318",
17
17
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
18
18
  "vike": "^0.4.182"
@@ -2,6 +2,8 @@
2
2
  * We use mjs extension as constants in this file is shared with the build script
3
3
  * and we use `node --eval` to extract the constants.
4
4
  */
5
+ import { UrlCanParse } from "@webstudio-is/image";
6
+
5
7
  export const assetBaseUrl = "/assets/";
6
8
  export const imageBaseUrl = "/assets/";
7
9
 
@@ -9,7 +11,7 @@ export const imageBaseUrl = "/assets/";
9
11
  * @type {import("@webstudio-is/image").ImageLoader}
10
12
  */
11
13
  export const imageLoader = (props) => {
12
- if (URL.canParse(props.src)) {
14
+ if (UrlCanParse(props.src)) {
13
15
  return props.src;
14
16
  }
15
17
 
@@ -2,6 +2,8 @@
2
2
  * We use mjs extension as constants in this file is shared with the build script
3
3
  * and we use `node --eval` to extract the constants.
4
4
  */
5
+ import { UrlCanParse } from "@webstudio-is/image";
6
+
5
7
  export const assetBaseUrl = "/assets/";
6
8
  export const imageBaseUrl = "/assets/";
7
9
 
@@ -9,7 +11,7 @@ export const imageBaseUrl = "/assets/";
9
11
  * @type {import("@webstudio-is/image").ImageLoader}
10
12
  */
11
13
  export const imageLoader = (props) => {
12
- if (URL.canParse(props.src)) {
14
+ if (UrlCanParse(props.src)) {
13
15
  return props.src;
14
16
  }
15
17