webstudio 0.124.0 → 0.126.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
@@ -272,6 +272,7 @@ import {
272
272
  import {
273
273
  createScope,
274
274
  findTreeInstanceIds,
275
+ getPagePath,
275
276
  parseComponentName
276
277
  } from "@webstudio-is/sdk";
277
278
  import { createImageLoader } from "@webstudio-is/image";
@@ -424,7 +425,7 @@ var prebuild = async (options) => {
424
425
  props: siteData.build.props.map(([_id, prop]) => prop),
425
426
  assetBaseUrl,
426
427
  assets: new Map(siteData.assets.map((asset) => [asset.id, asset])),
427
- pages: new Map(siteData.pages.map((page2) => [page2.id, page2]))
428
+ pages: siteData.build.pages
428
429
  });
429
430
  const props = [];
430
431
  for (const prop of normalizedProps) {
@@ -447,7 +448,7 @@ var prebuild = async (options) => {
447
448
  resources.push([resourceId, resource]);
448
449
  }
449
450
  }
450
- siteDataByPage[page.path] = {
451
+ siteDataByPage[page.id] = {
451
452
  build: {
452
453
  props,
453
454
  instances,
@@ -458,12 +459,12 @@ var prebuild = async (options) => {
458
459
  page,
459
460
  assets: siteData.assets
460
461
  };
461
- componentsByPage[page.path] = /* @__PURE__ */ new Set();
462
+ componentsByPage[page.id] = /* @__PURE__ */ new Set();
462
463
  for (const [_instanceId, instance] of instances) {
463
464
  if (instance.component === collectionComponent) {
464
465
  continue;
465
466
  }
466
- componentsByPage[page.path].add(instance.component);
467
+ componentsByPage[page.id].add(instance.component);
467
468
  const meta = metas.get(instance.component);
468
469
  if (meta) {
469
470
  projectMetas.set(instance.component, meta);
@@ -536,11 +537,12 @@ var prebuild = async (options) => {
536
537
  ),
537
538
  "utf8"
538
539
  );
539
- for (const [pathname, pageComponents] of Object.entries(componentsByPage)) {
540
+ for (const [pageId, pageComponents] of Object.entries(componentsByPage)) {
540
541
  const scope = createScope([
541
542
  // manually maintained list of occupied identifiers
542
543
  "useState",
543
544
  "Fragment",
545
+ "useResource",
544
546
  "PageData",
545
547
  "Asset",
546
548
  "fontAssets",
@@ -581,7 +583,7 @@ var prebuild = async (options) => {
581
583
  componentImports += `import { ${specifiers} } from "${namespace}";
582
584
  `;
583
585
  }
584
- const pageData = siteDataByPage[pathname];
586
+ const pageData = siteDataByPage[pageId];
585
587
  const renderedPageData = {
586
588
  project: siteData.build.pages.meta,
587
589
  page: pageData.page
@@ -612,9 +614,10 @@ var prebuild = async (options) => {
612
614
  /* This is a auto generated file for building the project */
613
615
 
614
616
  import { Fragment, useState } from "react";
615
- import type { PageData } from "~/routes/_index";
616
617
  import type { Asset, ImageAsset, ProjectMeta } from "@webstudio-is/sdk";
618
+ import { useResource } from "@webstudio-is/react-sdk";
617
619
  ${componentImports}
620
+ import type { PageData } from "~/routes/_index";
618
621
  export const fontAssets: Asset[] = ${JSON.stringify(fontAssets)}
619
622
  export const imageAssets: ImageAsset[] = ${JSON.stringify(imageAssets)}
620
623
  export const pageData: PageData = ${JSON.stringify(renderedPageData)};
@@ -627,11 +630,12 @@ ${pageComponent}
627
630
 
628
631
  export { Page }
629
632
 
630
- ${generateRemixParams(pathname)}
633
+ ${generateRemixParams(pageData.page.path)}
631
634
 
632
635
  ${utilsExport}
633
636
  `;
634
- const remixRoute = generateRemixRoute(pathname);
637
+ const path = getPagePath(pageData.page.id, siteData.build.pages);
638
+ const remixRoute = generateRemixRoute(path);
635
639
  const fileName = `${remixRoute}.tsx`;
636
640
  const routeFileContent = routeFileTemplate.replace('../__generated__/index"', `../__generated__/${remixRoute}"`).replace(
637
641
  '../__generated__/index.server"',
@@ -837,7 +841,7 @@ import makeCLI from "yargs";
837
841
  // package.json
838
842
  var package_default = {
839
843
  name: "webstudio",
840
- version: "0.124.0",
844
+ version: "0.126.0",
841
845
  description: "Webstudio CLI",
842
846
  author: "Webstudio <github@webstudio.is>",
843
847
  homepage: "https://webstudio.is",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.124.0",
3
+ "version": "0.126.0",
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.21.4",
31
- "@webstudio-is/http-client": "0.124.0",
32
- "@webstudio-is/image": "0.124.0",
33
- "@webstudio-is/react-sdk": "0.124.0",
34
- "@webstudio-is/sdk": "0.124.0",
35
- "@webstudio-is/sdk-components-react-radix": "0.124.0",
36
- "@webstudio-is/sdk-components-react-remix": "0.124.0",
37
- "@webstudio-is/sdk-components-react": "0.124.0"
31
+ "@webstudio-is/http-client": "0.126.0",
32
+ "@webstudio-is/image": "0.126.0",
33
+ "@webstudio-is/sdk": "0.126.0",
34
+ "@webstudio-is/react-sdk": "0.126.0",
35
+ "@webstudio-is/sdk-components-react": "0.126.0",
36
+ "@webstudio-is/sdk-components-react-radix": "0.126.0",
37
+ "@webstudio-is/sdk-components-react-remix": "0.126.0"
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.124.0"
44
+ "@webstudio-is/form-handlers": "0.126.0",
45
+ "@webstudio-is/tsconfig": "1.0.7"
46
46
  },
47
47
  "scripts": {
48
48
  "typecheck": "tsc",
@@ -298,9 +298,10 @@ const Outlet = () => {
298
298
  assetBaseUrl,
299
299
  imageBaseUrl,
300
300
  pagesPaths,
301
+ resources,
301
302
  }}
302
303
  >
303
- <Page params={params} resources={resources} />
304
+ <Page params={params} />
304
305
  </ReactSdkContext.Provider>
305
306
  );
306
307
  };