@wix/cli-app 1.1.101 → 1.1.103

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.
Files changed (81) hide show
  1. package/build/{AddPermissionCommand-AQD2ALKK.js → AddPermissionCommand-47NX5FID.js} +2 -2
  2. package/build/{DevCommand-QWQNRPMT.js → DevCommand-R3ZGOMUJ.js} +10 -10
  3. package/build/{DevCommand-QWQNRPMT.js.map → DevCommand-R3ZGOMUJ.js.map} +1 -1
  4. package/build/{GenerateCommand-OQAZ7AQP.js → GenerateCommand-BNSFSYGT.js} +7 -7
  5. package/build/{LogsCommand-RQIJ3U7F.js → LogsCommand-B4XRPZLR.js} +3 -3
  6. package/build/PreviewCommand-WY3GWOX4.js +19 -0
  7. package/build/ReleaseCommand-KDD44AO7.js +23 -0
  8. package/build/{ServeCommand-WOUZHV2Y.js → ServeCommand-CNYCJPJS.js} +3 -3
  9. package/build/{build-C6DB6Y6E.js → build-A7OAZ226.js} +6 -6
  10. package/build/{chunk-4JT7QYEF.js → chunk-2FFNGH2K.js} +2 -2
  11. package/build/{chunk-KJN5NVSU.js → chunk-2PWMAOFK.js} +6 -6
  12. package/build/{chunk-JYS6G4NW.js → chunk-4BN6QXJE.js} +149 -37
  13. package/build/{chunk-JYS6G4NW.js.map → chunk-4BN6QXJE.js.map} +1 -1
  14. package/build/{chunk-FG7W5UDB.js → chunk-5HJEX4ZX.js} +633 -173
  15. package/build/{chunk-FG7W5UDB.js.map → chunk-5HJEX4ZX.js.map} +1 -1
  16. package/build/{chunk-HSSABJL6.js → chunk-ASICDRRU.js} +2 -2
  17. package/build/{chunk-P5CHCVB6.js → chunk-CLGKOJIA.js} +7 -7
  18. package/build/chunk-CLGKOJIA.js.map +1 -0
  19. package/build/{chunk-YK5OGTF3.js → chunk-D4HN4JQJ.js} +2 -2
  20. package/build/{chunk-VXAXSIUQ.js → chunk-EK3FDNFJ.js} +6 -6
  21. package/build/{chunk-NPPPO5AD.js → chunk-FQVLZZ37.js} +2 -2
  22. package/build/{chunk-OMC2SHRJ.js → chunk-HQWWEMUE.js} +7 -7
  23. package/build/{chunk-DAOCDBEQ.js → chunk-IJSYFKIP.js} +180 -2
  24. package/build/{chunk-DAOCDBEQ.js.map → chunk-IJSYFKIP.js.map} +1 -1
  25. package/build/{chunk-6XUQYB5M.js → chunk-LFE6DV2A.js} +3 -3
  26. package/build/{chunk-5PFWNTTF.js → chunk-N5BZMQKX.js} +2 -2
  27. package/build/{chunk-ZQWKIC6F.js → chunk-RBX7FQKV.js} +2 -2
  28. package/build/{chunk-CRTLCQQ3.js → chunk-UC4DVE5N.js} +4 -4
  29. package/build/{chunk-R66WIGA4.js → chunk-VDEKITDE.js} +2 -2
  30. package/build/{chunk-MRQDCRFF.js → chunk-WHR6NSJW.js} +2 -2
  31. package/build/cloudflare-runtime/entry.js +5 -2
  32. package/build/cloudflare-runtime/getRegisteredExtensions.js +5 -2
  33. package/build/index.js +23 -23
  34. package/build/platform-sdk/chunk-BBFFXVJD.js +2 -0
  35. package/build/platform-sdk/chunk-BBFFXVJD.js.map +1 -0
  36. package/build/platform-sdk/{chunk-ZBGVDXLX.js → chunk-MAZR75DI.js} +2 -2
  37. package/build/platform-sdk/chunk-MAZR75DI.js.map +1 -0
  38. package/build/platform-sdk/chunk-NHYZDMR5.js +2 -0
  39. package/build/platform-sdk/chunk-NHYZDMR5.js.map +1 -0
  40. package/build/platform-sdk/dashboard.js +1 -1
  41. package/build/platform-sdk/editor.js +2 -2
  42. package/build/platform-sdk/editor.js.map +1 -1
  43. package/build/platform-sdk/sdk-context.js +1 -1
  44. package/build/platform-sdk/sdk-context.js.map +1 -1
  45. package/build/platform-sdk/site.js +1 -1
  46. package/build/platform-sdk/site.js.map +1 -1
  47. package/build/{preview-I3VBWU7J.js → preview-O4LXNEA2.js} +12 -12
  48. package/build/{release-IXG7HZBL.js → release-3FUXB4BT.js} +14 -14
  49. package/build/{render-command-6MZYM2OA.js → render-command-WE3BHL5N.js} +5 -5
  50. package/package.json +4 -4
  51. package/build/PreviewCommand-SSA3LRRR.js +0 -19
  52. package/build/ReleaseCommand-BBWVLP2S.js +0 -23
  53. package/build/chunk-P5CHCVB6.js.map +0 -1
  54. package/build/platform-sdk/chunk-J3SVE4GM.js +0 -2
  55. package/build/platform-sdk/chunk-J3SVE4GM.js.map +0 -1
  56. package/build/platform-sdk/chunk-J7RIIVO6.js +0 -2
  57. package/build/platform-sdk/chunk-J7RIIVO6.js.map +0 -1
  58. package/build/platform-sdk/chunk-ZBGVDXLX.js.map +0 -1
  59. /package/build/{AddPermissionCommand-AQD2ALKK.js.map → AddPermissionCommand-47NX5FID.js.map} +0 -0
  60. /package/build/{GenerateCommand-OQAZ7AQP.js.map → GenerateCommand-BNSFSYGT.js.map} +0 -0
  61. /package/build/{LogsCommand-RQIJ3U7F.js.map → LogsCommand-B4XRPZLR.js.map} +0 -0
  62. /package/build/{PreviewCommand-SSA3LRRR.js.map → PreviewCommand-WY3GWOX4.js.map} +0 -0
  63. /package/build/{ReleaseCommand-BBWVLP2S.js.map → ReleaseCommand-KDD44AO7.js.map} +0 -0
  64. /package/build/{ServeCommand-WOUZHV2Y.js.map → ServeCommand-CNYCJPJS.js.map} +0 -0
  65. /package/build/{build-C6DB6Y6E.js.map → build-A7OAZ226.js.map} +0 -0
  66. /package/build/{chunk-4JT7QYEF.js.map → chunk-2FFNGH2K.js.map} +0 -0
  67. /package/build/{chunk-KJN5NVSU.js.map → chunk-2PWMAOFK.js.map} +0 -0
  68. /package/build/{chunk-HSSABJL6.js.map → chunk-ASICDRRU.js.map} +0 -0
  69. /package/build/{chunk-YK5OGTF3.js.map → chunk-D4HN4JQJ.js.map} +0 -0
  70. /package/build/{chunk-VXAXSIUQ.js.map → chunk-EK3FDNFJ.js.map} +0 -0
  71. /package/build/{chunk-NPPPO5AD.js.map → chunk-FQVLZZ37.js.map} +0 -0
  72. /package/build/{chunk-OMC2SHRJ.js.map → chunk-HQWWEMUE.js.map} +0 -0
  73. /package/build/{chunk-6XUQYB5M.js.map → chunk-LFE6DV2A.js.map} +0 -0
  74. /package/build/{chunk-5PFWNTTF.js.map → chunk-N5BZMQKX.js.map} +0 -0
  75. /package/build/{chunk-ZQWKIC6F.js.map → chunk-RBX7FQKV.js.map} +0 -0
  76. /package/build/{chunk-CRTLCQQ3.js.map → chunk-UC4DVE5N.js.map} +0 -0
  77. /package/build/{chunk-R66WIGA4.js.map → chunk-VDEKITDE.js.map} +0 -0
  78. /package/build/{chunk-MRQDCRFF.js.map → chunk-WHR6NSJW.js.map} +0 -0
  79. /package/build/{preview-I3VBWU7J.js.map → preview-O4LXNEA2.js.map} +0 -0
  80. /package/build/{release-IXG7HZBL.js.map → release-3FUXB4BT.js.map} +0 -0
  81. /package/build/{render-command-6MZYM2OA.js.map → render-command-WE3BHL5N.js.map} +0 -0
@@ -2,7 +2,7 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  useTunnel
5
- } from "./chunk-HSSABJL6.js";
5
+ } from "./chunk-ASICDRRU.js";
6
6
  import "./chunk-GWE3BRHX.js";
7
7
  import {
8
8
  Box_default,
@@ -23,7 +23,7 @@ import {
23
23
  useProjectModel,
24
24
  useTranslation,
25
25
  z
26
- } from "./chunk-FG7W5UDB.js";
26
+ } from "./chunk-5HJEX4ZX.js";
27
27
  import {
28
28
  __toESM,
29
29
  init_esm_shims
@@ -279,4 +279,4 @@ var LogsCommand = ({ version }) => {
279
279
  export {
280
280
  LogsCommand
281
281
  };
282
- //# sourceMappingURL=LogsCommand-RQIJ3U7F.js.map
282
+ //# sourceMappingURL=LogsCommand-B4XRPZLR.js.map
@@ -0,0 +1,19 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import {
4
+ PreviewCommand
5
+ } from "./chunk-2PWMAOFK.js";
6
+ import "./chunk-LFE6DV2A.js";
7
+ import "./chunk-HQWWEMUE.js";
8
+ import "./chunk-FQVLZZ37.js";
9
+ import "./chunk-ASICDRRU.js";
10
+ import "./chunk-GWE3BRHX.js";
11
+ import "./chunk-2FFNGH2K.js";
12
+ import "./chunk-4BN6QXJE.js";
13
+ import "./chunk-IJSYFKIP.js";
14
+ import "./chunk-5HJEX4ZX.js";
15
+ import "./chunk-4EFJZ3GQ.js";
16
+ export {
17
+ PreviewCommand
18
+ };
19
+ //# sourceMappingURL=PreviewCommand-WY3GWOX4.js.map
@@ -0,0 +1,23 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import {
4
+ ReleaseCommand,
5
+ ReleaseVersionType
6
+ } from "./chunk-EK3FDNFJ.js";
7
+ import "./chunk-2PWMAOFK.js";
8
+ import "./chunk-LFE6DV2A.js";
9
+ import "./chunk-HQWWEMUE.js";
10
+ import "./chunk-WHR6NSJW.js";
11
+ import "./chunk-FQVLZZ37.js";
12
+ import "./chunk-ASICDRRU.js";
13
+ import "./chunk-GWE3BRHX.js";
14
+ import "./chunk-2FFNGH2K.js";
15
+ import "./chunk-4BN6QXJE.js";
16
+ import "./chunk-IJSYFKIP.js";
17
+ import "./chunk-5HJEX4ZX.js";
18
+ import "./chunk-4EFJZ3GQ.js";
19
+ export {
20
+ ReleaseCommand,
21
+ ReleaseVersionType
22
+ };
23
+ //# sourceMappingURL=ReleaseCommand-KDD44AO7.js.map
@@ -3,14 +3,14 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  createPackageManager,
5
5
  getRepoType
6
- } from "./chunk-YK5OGTF3.js";
6
+ } from "./chunk-D4HN4JQJ.js";
7
7
  import "./chunk-GWE3BRHX.js";
8
8
  import {
9
9
  CliError,
10
10
  CliErrorCode,
11
11
  useAsync,
12
12
  useProjectModel
13
- } from "./chunk-FG7W5UDB.js";
13
+ } from "./chunk-5HJEX4ZX.js";
14
14
  import {
15
15
  init_esm_shims
16
16
  } from "./chunk-4EFJZ3GQ.js";
@@ -40,4 +40,4 @@ var ServeCommandDeprecated = () => {
40
40
  export {
41
41
  ServeCommandDeprecated
42
42
  };
43
- //# sourceMappingURL=ServeCommand-WOUZHV2Y.js.map
43
+ //# sourceMappingURL=ServeCommand-CNYCJPJS.js.map
@@ -2,10 +2,10 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  writeAppManifestFile
5
- } from "./chunk-6XUQYB5M.js";
5
+ } from "./chunk-LFE6DV2A.js";
6
6
  import {
7
7
  createLogger
8
- } from "./chunk-R66WIGA4.js";
8
+ } from "./chunk-VDEKITDE.js";
9
9
  import {
10
10
  createAppManifest,
11
11
  getComponentBuildSourceBuilder,
@@ -14,15 +14,15 @@ import {
14
14
  getViteConfig4 as getViteConfig3,
15
15
  getViteConfig5 as getViteConfig4,
16
16
  validateComponents
17
- } from "./chunk-JYS6G4NW.js";
18
- import "./chunk-DAOCDBEQ.js";
17
+ } from "./chunk-4BN6QXJE.js";
18
+ import "./chunk-IJSYFKIP.js";
19
19
  import {
20
20
  CliError,
21
21
  CliErrorCode,
22
22
  DevCenterComponent,
23
23
  getDistFolder,
24
24
  require_lib
25
- } from "./chunk-FG7W5UDB.js";
25
+ } from "./chunk-5HJEX4ZX.js";
26
26
  import {
27
27
  __toESM,
28
28
  init_esm_shims
@@ -133,4 +133,4 @@ async function build(projectModel) {
133
133
  export {
134
134
  build
135
135
  };
136
- //# sourceMappingURL=build-C6DB6Y6E.js.map
136
+ //# sourceMappingURL=build-A7OAZ226.js.map
@@ -4,7 +4,7 @@ import {
4
4
  require_index_node,
5
5
  require_react,
6
6
  require_verror
7
- } from "./chunk-FG7W5UDB.js";
7
+ } from "./chunk-5HJEX4ZX.js";
8
8
  import {
9
9
  __toESM,
10
10
  init_esm_shims
@@ -99,4 +99,4 @@ export {
99
99
  DebugLogProvider,
100
100
  useDebugLog
101
101
  };
102
- //# sourceMappingURL=chunk-4JT7QYEF.js.map
102
+ //# sourceMappingURL=chunk-2FFNGH2K.js.map
@@ -2,7 +2,7 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  readAppManifestFile
5
- } from "./chunk-6XUQYB5M.js";
5
+ } from "./chunk-LFE6DV2A.js";
6
6
  import {
7
7
  ArmTagProvider,
8
8
  ExtensionDataProvider,
@@ -16,16 +16,16 @@ import {
16
16
  useResolvePlatformUrl,
17
17
  useSite,
18
18
  useSiteOverrideClient
19
- } from "./chunk-OMC2SHRJ.js";
19
+ } from "./chunk-HQWWEMUE.js";
20
20
  import {
21
21
  useBackendComponents
22
- } from "./chunk-NPPPO5AD.js";
22
+ } from "./chunk-FQVLZZ37.js";
23
23
  import {
24
24
  getMonitoringProvider,
25
25
  updateAppManifestComponents,
26
26
  updateMonitoring,
27
27
  updateTopology
28
- } from "./chunk-JYS6G4NW.js";
28
+ } from "./chunk-4BN6QXJE.js";
29
29
  import {
30
30
  Alert,
31
31
  BROWSER_STATICS_FOLDER,
@@ -57,7 +57,7 @@ import {
57
57
  useHttpClient,
58
58
  useProjectModel,
59
59
  useTranslation
60
- } from "./chunk-FG7W5UDB.js";
60
+ } from "./chunk-5HJEX4ZX.js";
61
61
  import {
62
62
  __toESM,
63
63
  init_esm_shims
@@ -294,4 +294,4 @@ export {
294
294
  assertBuildOutputExists,
295
295
  PreviewCommand
296
296
  };
297
- //# sourceMappingURL=chunk-KJN5NVSU.js.map
297
+ //# sourceMappingURL=chunk-2PWMAOFK.js.map
@@ -3,7 +3,7 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  getBackendEventSlug,
5
5
  require_baseUniq
6
- } from "./chunk-DAOCDBEQ.js";
6
+ } from "./chunk-IJSYFKIP.js";
7
7
  import {
8
8
  API_BASEURL_PLACEHOLDER,
9
9
  BACKEND_OPTIMIZED_DIR,
@@ -27,12 +27,14 @@ import {
27
27
  ExtendingComponentType,
28
28
  HeightMode,
29
29
  MonitoringType,
30
+ PRESETS_DIR,
30
31
  PanelContentType,
31
32
  RELATIVE_ASSET_PATH_REGEX,
32
33
  RegionType,
33
34
  SERVICE_PLUGINS_PATTERN,
34
35
  SITE_COMPONENTS_PANEL_PATTERN,
35
36
  SITE_COMPONENTS_PATTERN,
37
+ SITE_COMPONENTS_PRESETS_PATTERN,
36
38
  SITE_COMPONENTS_SDK_PATTERN,
37
39
  SITE_PLUGINS_PANEL_PATTERN,
38
40
  SITE_PLUGINS_PLUGIN_PATTERN,
@@ -73,11 +75,13 @@ import {
73
75
  virtualModuleIdForSiteComponentSdkScriptAsset,
74
76
  virtualPathForCustomElementPanelHTMLAsset,
75
77
  virtualPathForHTMLAsset,
78
+ virtualPresetIdForSiteComponent,
76
79
  virtualSiteComponentPanelScriptAssets,
80
+ virtualSiteComponentPresetAssets,
77
81
  virtualSiteComponentScriptAssets,
78
82
  virtualSiteComponentSdkScriptAssets,
79
83
  z
80
- } from "./chunk-FG7W5UDB.js";
84
+ } from "./chunk-5HJEX4ZX.js";
81
85
  import {
82
86
  __commonJS,
83
87
  __esm,
@@ -38568,9 +38572,11 @@ var getCustomElementPanelBuildTemplate = (customElementPanelComponent) => {
38568
38572
  init_esm_shims();
38569
38573
  var getSiteComponentBaseTemplate = (applicationId, path9) => {
38570
38574
  return defaultOutdent`
38571
- import { enableComponentClient } from '@wix/cli-app/internal/platform-sdk/site';
38575
+ import { enableClient } from '@wix/cli-app/internal/platform-sdk/site';
38572
38576
 
38573
- enableComponentClient('${applicationId}');
38577
+ const { injectGetAccessToken: injectAccessTokenGetter } = enableClient('${applicationId}');
38578
+
38579
+ export { injectAccessTokenGetter };
38574
38580
 
38575
38581
  export { default } from '${path9}';
38576
38582
  `;
@@ -39089,7 +39095,7 @@ function fbjsHotfixPlugin() {
39089
39095
 
39090
39096
  // src/vite/plugins/config-extensions-file-emitter.ts
39091
39097
  init_esm_shims();
39092
- import path5 from "node:path";
39098
+ import path5, { dirname as dirname2 } from "node:path";
39093
39099
  function configExtensionsFileEmitter(model) {
39094
39100
  return {
39095
39101
  name: "config-extensions-file-emitter",
@@ -39127,6 +39133,16 @@ function configExtensionsFileEmitter(model) {
39127
39133
  }
39128
39134
  }
39129
39135
  }
39136
+ if (component.type === "SiteComponent" && component.editorElement?.presets) {
39137
+ for (const preset of Object.values(component.editorElement.presets)) {
39138
+ if (preset.thumbnailUrl && RELATIVE_ASSET_PATH_REGEX.test(preset.thumbnailUrl)) {
39139
+ preset.thumbnailUrl = await emitAssetFile(
39140
+ preset.thumbnailUrl,
39141
+ dirname2(component.relativePath)
39142
+ );
39143
+ }
39144
+ }
39145
+ }
39130
39146
  }
39131
39147
  }
39132
39148
  };
@@ -39266,6 +39282,9 @@ function getViteConfig2(model, options) {
39266
39282
  const virtualSiteComponentPanelScriptEntries = [
39267
39283
  ...virtualSiteComponentPanelScriptAssets(model)
39268
39284
  ].map(([assetId, component]) => [`script-asset-${component.id}`, assetId]);
39285
+ const virtualSiteComponentPresetEntries = [
39286
+ ...virtualSiteComponentPresetAssets(model)
39287
+ ].map(([assetId, assetPath]) => [assetId, assetPath]);
39269
39288
  return {
39270
39289
  configFile: false,
39271
39290
  root: model.projectFolder,
@@ -39287,7 +39306,8 @@ function getViteConfig2(model, options) {
39287
39306
  ...virtualCustomElementHTMLEntries,
39288
39307
  ...virtualCustomElementScriptEntries,
39289
39308
  ...virtualSiteComponentScriptEntries,
39290
- ...virtualSiteComponentPanelScriptEntries
39309
+ ...virtualSiteComponentPanelScriptEntries,
39310
+ ...virtualSiteComponentPresetEntries
39291
39311
  ]),
39292
39312
  ...virtualSiteComponentScriptEntries.length ? { [EXPORTS_CUSTODIAN_ENTRY]: EXPORTS_CUSTODIAN_ENTRY } : {}
39293
39313
  },
@@ -39626,7 +39646,7 @@ function autoOrigin() {
39626
39646
  }),
39627
39647
  configureServer: (server) => {
39628
39648
  server.middlewares.use((_req, _res, next) => {
39629
- origin ??= getViteServerUrl2(server);
39649
+ origin ??= getViteServerUrl2(server).replace(/\/$/, "");
39630
39650
  next();
39631
39651
  });
39632
39652
  },
@@ -39647,7 +39667,7 @@ function autoOrigin() {
39647
39667
 
39648
39668
  // src/vite/plugins/absolute-html-url.ts
39649
39669
  init_esm_shims();
39650
- import { dirname as dirname2, isAbsolute as isAbsolute2, join as join5 } from "node:path";
39670
+ import { dirname as dirname3, isAbsolute as isAbsolute2, join as join5 } from "node:path";
39651
39671
  import { URL as URL2 } from "node:url";
39652
39672
  function getAbsoluteAssetUrl(originalUrl, assetUrl, viteAddress) {
39653
39673
  let url = new URL2(assetUrl, viteAddress).href;
@@ -39655,7 +39675,7 @@ function getAbsoluteAssetUrl(originalUrl, assetUrl, viteAddress) {
39655
39675
  return url;
39656
39676
  }
39657
39677
  if (!isAbsolute2(assetUrl)) {
39658
- const assetPath = join5(dirname2(originalUrl), assetUrl);
39678
+ const assetPath = join5(dirname3(originalUrl), assetUrl);
39659
39679
  url = new URL2(assetPath, viteAddress).href;
39660
39680
  }
39661
39681
  return url;
@@ -39715,7 +39735,8 @@ function getViteConfig5(model, options) {
39715
39735
  BLOCKS_WIDGETS_PANELS_PATTERN,
39716
39736
  SITE_COMPONENTS_PATTERN,
39717
39737
  SITE_COMPONENTS_PANEL_PATTERN,
39718
- SITE_COMPONENTS_SDK_PATTERN
39738
+ SITE_COMPONENTS_SDK_PATTERN,
39739
+ SITE_COMPONENTS_PRESETS_PATTERN
39719
39740
  ]
39720
39741
  },
39721
39742
  server: { cors: { origin: true } },
@@ -39754,7 +39775,6 @@ function getViteConfig5(model, options) {
39754
39775
  initialModel: model,
39755
39776
  ...options
39756
39777
  }),
39757
- configExtensionsFileEmitter(model),
39758
39778
  monitoring({ initialModel: model }),
39759
39779
  src_default({
39760
39780
  ignoreConfigErrors: true,
@@ -39874,13 +39894,13 @@ init_esm_shims();
39874
39894
  var import_variant4 = __toESM(require_lib(), 1);
39875
39895
  var import_uniqWith = __toESM(require_uniqWith(), 1);
39876
39896
  import { randomUUID as randomUUID2 } from "node:crypto";
39877
- import { dirname as dirname3, join as join6 } from "node:path";
39897
+ import { dirname as dirname4, join as join6 } from "node:path";
39878
39898
  function isTruthy(x) {
39879
39899
  return x != null && x !== false;
39880
39900
  }
39881
39901
  function parseImageField(asset, relativePath) {
39882
39902
  if (RELATIVE_ASSET_PATH_REGEX.test(asset)) {
39883
- return join6(dirname3(`/${relativePath}`), asset);
39903
+ return join6(dirname4(`/${relativePath}`), asset);
39884
39904
  }
39885
39905
  return asset;
39886
39906
  }
@@ -40290,6 +40310,7 @@ async function createAppManifest({
40290
40310
  };
40291
40311
  },
40292
40312
  SiteComponent: async (component) => {
40313
+ const siteComponentSource = await componentSourceBuilder(component);
40293
40314
  return {
40294
40315
  compId: component.id,
40295
40316
  compType: ComponentType.EDITOR_REACT_COMPONENT,
@@ -40297,9 +40318,12 @@ async function createAppManifest({
40297
40318
  editorReactComponent: {
40298
40319
  type: `platform.builder.${appId}_${component.id}`,
40299
40320
  description: component.description,
40300
- editorElement: component.editorElement,
40321
+ editorElement: component.editorElement && {
40322
+ ...component.editorElement,
40323
+ presets: siteComponentSource.presets
40324
+ },
40301
40325
  installation: component.installation,
40302
- resources: { ...await componentSourceBuilder(component) }
40326
+ resources: { ...siteComponentSource.resources }
40303
40327
  }
40304
40328
  }
40305
40329
  };
@@ -40339,7 +40363,7 @@ async function createAppManifest({
40339
40363
  // src/app-manifest/component-source.ts
40340
40364
  init_esm_shims();
40341
40365
  var import_variant5 = __toESM(require_lib(), 1);
40342
- import path8, { join as join7 } from "node:path";
40366
+ import path8, { dirname as dirname5, join as join7 } from "node:path";
40343
40367
  import { pathToFileURL as pathToFileURL2 } from "node:url";
40344
40368
 
40345
40369
  // src/app-manifest/build-output-data-extractor.ts
@@ -40356,6 +40380,21 @@ function extractBuildOutputs(buildOutput) {
40356
40380
  const outputs = Array.isArray(buildOutput) ? buildOutput.flatMap((output) => output.output) : buildOutput.output;
40357
40381
  return outputs;
40358
40382
  }
40383
+ function extractPresetAssetOutput(buildOutput, presetAssetFileName) {
40384
+ const outputs = extractBuildOutputs(buildOutput);
40385
+ const presetFile = outputs.find((output) => {
40386
+ return output.type === "asset" && output.names.includes(presetAssetFileName);
40387
+ });
40388
+ if (!presetFile) {
40389
+ throw new CliError({
40390
+ code: CliErrorCode.ViteFileNotFoundInOutput({
40391
+ fileName: presetAssetFileName
40392
+ }),
40393
+ cause: null
40394
+ });
40395
+ }
40396
+ return presetFile;
40397
+ }
40359
40398
  function extractAssetOutput(buildOutput, fileName) {
40360
40399
  const outputs = extractBuildOutputs(buildOutput);
40361
40400
  return outputs.find((output) => {
@@ -40394,6 +40433,10 @@ function extractModuleBundleCss(buildOutput, moduleId) {
40394
40433
  const importedCss = output.viteMetadata?.importedCss;
40395
40434
  return importedCss?.values().next().value;
40396
40435
  }
40436
+ function extractPresetCss(buildOutput, presetAssetFileName) {
40437
+ const output = extractPresetAssetOutput(buildOutput, presetAssetFileName);
40438
+ return output.fileName;
40439
+ }
40397
40440
  function extractModuleBundleContent(buildOutput, fileName) {
40398
40441
  const output = extractAssetOutput(buildOutput, fileName);
40399
40442
  if (!output || !("source" in output)) {
@@ -40567,11 +40610,31 @@ var blocksPanelBuilder = (component, source) => {
40567
40610
  var siteComponentDevBuilder = (component) => {
40568
40611
  const moduleId = virtualModuleIdForSiteComponentScriptAsset(component.id);
40569
40612
  const sdkModuleId = component.relativeSdkPath ? virtualModuleIdForSiteComponentSdkScriptAsset(component.id) : null;
40613
+ const presets = component.editorElement?.presets ? Object.entries(
40614
+ component.editorElement.presets
40615
+ ).reduce((acc, [presetName, presetConfig]) => {
40616
+ acc[presetName] = {
40617
+ displayName: presetConfig.displayName,
40618
+ thumbnailUrl: presetConfig.thumbnailUrl && parseImageField(
40619
+ presetConfig.thumbnailUrl,
40620
+ dirname5(component.relativePath)
40621
+ ),
40622
+ cssUrl: join7(
40623
+ dirname5(component.relativePath),
40624
+ PRESETS_DIR,
40625
+ `${presetName}.css`
40626
+ )
40627
+ };
40628
+ return acc;
40629
+ }, {}) : {};
40570
40630
  return {
40571
- client: {
40572
- componentUrl: `/@id/${moduleId}?import`
40573
- },
40574
- ...sdkModuleId ? { sdk: { url: `/@id/${sdkModuleId}?import` } } : {}
40631
+ presets,
40632
+ resources: {
40633
+ client: {
40634
+ componentUrl: `/@id/${moduleId}?import`
40635
+ },
40636
+ ...sdkModuleId ? { sdk: { url: `/@id/${sdkModuleId}?import` } } : {}
40637
+ }
40575
40638
  };
40576
40639
  };
40577
40640
  var siteComponentBuildBuilder = (component, { browserBuildOutput }, { ssrBuildOutput }) => {
@@ -40580,19 +40643,37 @@ var siteComponentBuildBuilder = (component, { browserBuildOutput }, { ssrBuildOu
40580
40643
  if (!ssrBuildOutput) {
40581
40644
  throw new Error("Missing build output for site component");
40582
40645
  }
40646
+ const presets = {};
40647
+ if (component.editorElement?.presets) {
40648
+ for (const [presetName, presetConfig] of Object.entries(
40649
+ component.editorElement.presets
40650
+ )) {
40651
+ const modulePresetId = virtualPresetIdForSiteComponent(
40652
+ component.id,
40653
+ presetName
40654
+ );
40655
+ presets[presetName] = {
40656
+ ...presetConfig,
40657
+ cssUrl: extractPresetCss(browserBuildOutput, modulePresetId)
40658
+ };
40659
+ }
40660
+ }
40583
40661
  return {
40584
- client: {
40585
- componentUrl: extractModuleBundleName(browserBuildOutput, moduleId),
40586
- cssUrl: extractModuleBundleCss(browserBuildOutput, moduleId)
40587
- },
40588
- server: {
40589
- url: extractModuleBundleName(ssrBuildOutput, moduleId)
40590
- },
40591
- ...sdkModuleId ? {
40592
- sdk: {
40593
- url: extractModuleBundleName(ssrBuildOutput, sdkModuleId)
40594
- }
40595
- } : {}
40662
+ presets,
40663
+ resources: {
40664
+ client: {
40665
+ componentUrl: extractModuleBundleName(browserBuildOutput, moduleId),
40666
+ cssUrl: extractModuleBundleCss(browserBuildOutput, moduleId)
40667
+ },
40668
+ server: {
40669
+ url: extractModuleBundleName(ssrBuildOutput, moduleId)
40670
+ },
40671
+ ...sdkModuleId ? {
40672
+ sdk: {
40673
+ url: extractModuleBundleName(ssrBuildOutput, sdkModuleId)
40674
+ }
40675
+ } : {}
40676
+ }
40596
40677
  };
40597
40678
  };
40598
40679
  var siteComponentPanelBuilder = (component, source) => {
@@ -41174,7 +41255,7 @@ var monitoringSchema = z.object({
41174
41255
  monitoring: z.unknown()
41175
41256
  })
41176
41257
  });
41177
- var siteComponentSourceSchema = z.object({
41258
+ var siteComponentResourcesSchema = z.object({
41178
41259
  client: z.object({
41179
41260
  componentUrl: z.string(),
41180
41261
  cssUrl: z.string().optional()
@@ -41186,6 +41267,14 @@ var siteComponentSourceSchema = z.object({
41186
41267
  url: z.string()
41187
41268
  }).optional()
41188
41269
  });
41270
+ var siteComponentPresetsSchema = z.record(
41271
+ z.string(),
41272
+ z.object({
41273
+ cssUrl: z.string(),
41274
+ displayName: z.string(),
41275
+ thumbnailUrl: z.string().optional()
41276
+ })
41277
+ );
41189
41278
  var siteComponentSchema = z.object({
41190
41279
  compType: z.literal(ComponentType.EDITOR_REACT_COMPONENT),
41191
41280
  compId: z.string(),
@@ -41194,9 +41283,13 @@ var siteComponentSchema = z.object({
41194
41283
  editorReactComponent: z.object({
41195
41284
  type: z.string().min(5),
41196
41285
  description: z.string().min(5),
41197
- resources: siteComponentSourceSchema,
41198
- editorElement: z.unknown(),
41199
- installation: z.unknown()
41286
+ resources: siteComponentResourcesSchema,
41287
+ installation: z.unknown(),
41288
+ editorElement: z.object({
41289
+ displayName: z.string(),
41290
+ selector: z.string(),
41291
+ presets: siteComponentPresetsSchema
41292
+ }).passthrough().optional()
41200
41293
  })
41201
41294
  })
41202
41295
  });
@@ -41435,6 +41528,19 @@ var overrideCustomElementPresetsWithNormalizedAssets = (presets, normalizedBaseU
41435
41528
  }
41436
41529
  return {};
41437
41530
  };
41531
+ var overrideSiteComponentPresetsWithNormalizedAssets = (presets, normalizedBaseUrl) => {
41532
+ return Object.entries(presets).reduce(
41533
+ (siteComponentPresets, [presetName, presetConfig]) => {
41534
+ siteComponentPresets[presetName] = {
41535
+ ...presetConfig,
41536
+ thumbnailUrl: presetConfig.thumbnailUrl && normalizeUrl(presetConfig.thumbnailUrl, normalizedBaseUrl),
41537
+ cssUrl: normalizeUrl(presetConfig.cssUrl, normalizedBaseUrl)
41538
+ };
41539
+ return siteComponentPresets;
41540
+ },
41541
+ {}
41542
+ );
41543
+ };
41438
41544
  var overrideSitePluginMarketDataWithNormalizedLogoUrl = (marketData, normalizedBaseUrl) => {
41439
41545
  const logoUrl = marketData.logoUrl;
41440
41546
  if (logoUrl) {
@@ -41535,6 +41641,12 @@ var updateBrowserComponentsWithBaseUrl = (appManifest, baseUrl) => {
41535
41641
  compData.editorReactComponent.resources.client.componentUrl,
41536
41642
  normalizedBaseUrl
41537
41643
  );
41644
+ if (compData.editorReactComponent.editorElement?.presets) {
41645
+ compData.editorReactComponent.editorElement.presets = overrideSiteComponentPresetsWithNormalizedAssets(
41646
+ compData.editorReactComponent.editorElement.presets,
41647
+ normalizedBaseUrl
41648
+ );
41649
+ }
41538
41650
  if (compData.editorReactComponent.resources.client.cssUrl) {
41539
41651
  compData.editorReactComponent.resources.client.cssUrl = normalizeUrl(
41540
41652
  compData.editorReactComponent.resources.client.cssUrl,
@@ -41824,4 +41936,4 @@ export {
41824
41936
  he/he.js:
41825
41937
  (*! https://mths.be/he v1.2.0 by @mathias | MIT license *)
41826
41938
  */
41827
- //# sourceMappingURL=chunk-JYS6G4NW.js.map
41939
+ //# sourceMappingURL=chunk-4BN6QXJE.js.map