@wix/cli-app 1.1.8 → 1.1.9

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 (71) hide show
  1. package/build/{CreateVersionCommand-XY77M77G.js → CreateVersionCommand-HRPRVABQ.js} +2 -2
  2. package/build/{DevCommand-KYMGVTJK.js → DevCommand-VXSOOPGI.js} +2 -2
  3. package/build/{GenerateCommand-YY3VLI6F.js → GenerateCommand-LES5RWP7.js} +2 -2
  4. package/build/PreviewCommand-7WGLANH2.js +4 -0
  5. package/build/{ServeCommand-T7ONJGTT.js → ServeCommand-2XBFLJAW.js} +2 -2
  6. package/build/{build-L5SDRJ7I.js → build-TCFCF3FL.js} +2 -2
  7. package/build/{chunk-HEUTIIWU.js → chunk-4PMM4VH2.js} +2 -2
  8. package/build/{chunk-NEFKMKKG.js → chunk-AQMCJTIA.js} +2 -2
  9. package/build/{chunk-MMDHW54Y.js → chunk-AUZPEJRN.js} +2 -2
  10. package/build/{chunk-MMDHW54Y.js.map → chunk-AUZPEJRN.js.map} +1 -1
  11. package/build/{chunk-L2O2VHQ5.js → chunk-DGISEOUY.js} +2 -2
  12. package/build/chunk-HI6L2JY4.js +4 -0
  13. package/build/chunk-HI6L2JY4.js.map +1 -0
  14. package/build/{chunk-YISUVMX6.js → chunk-JBYJ7JWH.js} +27 -27
  15. package/build/chunk-JBYJ7JWH.js.map +1 -0
  16. package/build/{chunk-PFA6M6ZX.js → chunk-KN6FMDRW.js} +2 -2
  17. package/build/{chunk-E672MUDP.js → chunk-KQHAMVTM.js} +8 -8
  18. package/build/chunk-KQHAMVTM.js.map +1 -0
  19. package/build/chunk-LULXOULI.js +4 -0
  20. package/build/chunk-LULXOULI.js.map +1 -0
  21. package/build/{chunk-VIS32XQB.js → chunk-MZF5I7OU.js} +2 -2
  22. package/build/{chunk-ZBKHOEDJ.js → chunk-NR3APHWL.js} +2 -2
  23. package/build/{chunk-KHVNOWQT.js → chunk-OU5SEGSI.js} +2 -2
  24. package/build/chunk-OU5SEGSI.js.map +1 -0
  25. package/build/chunk-P5QI4AKT.js +25 -0
  26. package/build/chunk-P5QI4AKT.js.map +1 -0
  27. package/build/chunk-RDG3FN7Q.js +4 -0
  28. package/build/chunk-RDG3FN7Q.js.map +1 -0
  29. package/build/{chunk-UMDJRPVA.js → chunk-S4GPIPJ3.js} +2 -2
  30. package/build/{chunk-33ZJLOBS.js → chunk-UBUOOVV3.js} +2 -2
  31. package/build/chunk-UBUOOVV3.js.map +1 -0
  32. package/build/{chunk-HFRTZDJK.js → chunk-X2ODJQS5.js} +2 -2
  33. package/build/chunk-YSG4RLTD.js +75 -0
  34. package/build/chunk-YSG4RLTD.js.map +1 -0
  35. package/build/index.js +1 -1
  36. package/build/{preview-RVEH4SWT.js → preview-M6ZJKLI4.js} +2 -2
  37. package/build/render-command-TZ27VUBD.js +4 -0
  38. package/build/render-command-TZ27VUBD.js.map +1 -0
  39. package/package.json +7 -7
  40. package/build/PreviewCommand-JQCZICOM.js +0 -4
  41. package/build/chunk-33ZJLOBS.js.map +0 -1
  42. package/build/chunk-3B3FUXMB.js +0 -24
  43. package/build/chunk-3B3FUXMB.js.map +0 -1
  44. package/build/chunk-74DPMRN2.js +0 -4
  45. package/build/chunk-74DPMRN2.js.map +0 -1
  46. package/build/chunk-E672MUDP.js.map +0 -1
  47. package/build/chunk-G6WJ564G.js +0 -4
  48. package/build/chunk-G6WJ564G.js.map +0 -1
  49. package/build/chunk-JRFCSA2V.js +0 -75
  50. package/build/chunk-JRFCSA2V.js.map +0 -1
  51. package/build/chunk-KHVNOWQT.js.map +0 -1
  52. package/build/chunk-UD5LSB7X.js +0 -4
  53. package/build/chunk-UD5LSB7X.js.map +0 -1
  54. package/build/chunk-YISUVMX6.js.map +0 -1
  55. package/build/render-command-ZO2JM5KO.js +0 -4
  56. package/build/render-command-ZO2JM5KO.js.map +0 -1
  57. /package/build/{CreateVersionCommand-XY77M77G.js.map → CreateVersionCommand-HRPRVABQ.js.map} +0 -0
  58. /package/build/{DevCommand-KYMGVTJK.js.map → DevCommand-VXSOOPGI.js.map} +0 -0
  59. /package/build/{GenerateCommand-YY3VLI6F.js.map → GenerateCommand-LES5RWP7.js.map} +0 -0
  60. /package/build/{PreviewCommand-JQCZICOM.js.map → PreviewCommand-7WGLANH2.js.map} +0 -0
  61. /package/build/{ServeCommand-T7ONJGTT.js.map → ServeCommand-2XBFLJAW.js.map} +0 -0
  62. /package/build/{build-L5SDRJ7I.js.map → build-TCFCF3FL.js.map} +0 -0
  63. /package/build/{chunk-HEUTIIWU.js.map → chunk-4PMM4VH2.js.map} +0 -0
  64. /package/build/{chunk-NEFKMKKG.js.map → chunk-AQMCJTIA.js.map} +0 -0
  65. /package/build/{chunk-L2O2VHQ5.js.map → chunk-DGISEOUY.js.map} +0 -0
  66. /package/build/{chunk-PFA6M6ZX.js.map → chunk-KN6FMDRW.js.map} +0 -0
  67. /package/build/{chunk-VIS32XQB.js.map → chunk-MZF5I7OU.js.map} +0 -0
  68. /package/build/{chunk-ZBKHOEDJ.js.map → chunk-NR3APHWL.js.map} +0 -0
  69. /package/build/{chunk-UMDJRPVA.js.map → chunk-S4GPIPJ3.js.map} +0 -0
  70. /package/build/{chunk-HFRTZDJK.js.map → chunk-X2ODJQS5.js.map} +0 -0
  71. /package/build/{preview-RVEH4SWT.js.map → preview-M6ZJKLI4.js.map} +0 -0
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{$ as A,B as c,C as M,S as l,U as v,W as B,a as g,ba as N,c as m,d as u,s as S,u as p,v as P,y as b,z as I}from"./chunk-YSG4RLTD.js";import{e as C,h as d}from"./chunk-HFDLXX7R.js";d();var x=C(g(),1);import{randomUUID as U}from"node:crypto";var T=t=>{let r=new Map;[...t].sort((e,a)=>e.id.localeCompare(a.id)).forEach(e=>{let a=r.get(e.id)??[];a.push(e),r.set(e.id,a)});let i=new Map;if(r.forEach((e,a)=>{e.length>1&&i.set(a,e)}),i.size)throw new m({code:u.DuplicateComponentIdsError({issues:Array.from(i.entries()).map(([e,a])=>({id:e,components:a.map(f=>(0,x.match)(f,{DashboardPage:({title:s,relativePath:n})=>({name:s,type:"page",path:l(n,"json")}),DashboardPagePlugin:({title:s,relativePath:n})=>({name:s,type:"page-plugin",path:l(n,"json")}),DashboardMenuPlugin:({title:s,relativePath:n})=>({name:s,type:"menu-plugin",path:n}),DashboardModal:({title:s,relativePath:n})=>({name:s,type:"modal",path:l(n,"json")}),DashboardSidebarCategory:({label:s})=>({name:s,type:"sidebar-category",path:S}),EmbeddedScript:({relativePath:s})=>({name:s,type:"embedded-script",path:l(s,"json")}),CustomElement:({title:s,relativePath:n})=>({name:s,type:"custom-element",path:l(n,"json")})})).sort((f,s)=>f.name.localeCompare(s.name)),suggestedId:U()}))})})};d();var w=C(g(),1);var k=(t,r)=>{if(t.experiments)return{appId:r,componentId:t.id,spec:t.experiments.enabledBy,variantValue:"true"}};async function $({appId:t,components:r,sentryDSN:o,componentSourceBuilder:i}){return T(r),{appId:t,components:await Promise.all(r.map((0,w.match)({DashboardPage:async e=>{let a=e.sentryDSN??o;return{compId:e.id,compType:p.BACK_OFFICE_PAGE,compData:{backOfficePage:{hostingPlatform:c.BUSINESS_MANAGER,fullPage:e.sidebar?.whenActive?.hideSidebar,hideInSidebar:e.sidebar?.disabled,priority:e.sidebar?.priority,routePath:e.route.slice(1),title:e.title,pageCategoryId:e.sidebar?.categoryId,activeSidebarPageId:e.sidebar?.whenActive?.selectedPageId,requiredPermission:e.requiredPermission,previousRoutePaths:e.additionalRoutes,...a?{errorReporting:{url:a}}:void 0,...await i(e)}},compName:e.title,experiment:k(e,t)}},DashboardPagePlugin:async e=>({compId:e.id,compType:p.BACK_OFFICE_EXTENSION_WIDGET,compData:{backOfficeExtensionWidget:{hostingPlatform:c.BUSINESS_MANAGER,extends:e.extends,title:e.title,requiredPermission:e.requiredPermission,width:e.width,height:e.height,...await i(e),...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardMenuPlugin:async e=>({compId:e.id,compType:p.BACK_OFFICE_EXTENSION_MENU_ITEM,compData:{backOfficeExtensionMenuItem:{hostingPlatform:c.BUSINESS_MANAGER,id:e.id,title:e.title,subtitle:e.subtitle,iconKey:e.iconKey,extends:e.extends,action:e.action,requiredPermission:e.requiredPermission,...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardModal:async e=>({compId:e.id,compType:p.BACK_OFFICE_MODAL,compData:{backOfficeModal:{hostingPlatform:c.BUSINESS_MANAGER,title:e.title,requiredPermission:e.requiredPermission,width:e.width,height:e.height,...await i(e),...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardSidebarCategory:async e=>({compId:e.id,compType:p.BACK_OFFICE_SIDEBAR_CATEGORY,compData:{backOfficeSidebarCategory:{hostingPlatform:c.BUSINESS_MANAGER,title:e.label,priority:e.priority}},compName:e.label}),EmbeddedScript:async e=>({compId:e.id,compType:p.EMBEDDED_SCRIPT,compName:e.name,compData:{embeddedScriptComponentData:{name:e.name,pages:P.NONE_PAGES,placement:e.placement,connectArticleUrl:"",embedCategory:e.scriptType,loadOnce:!0,allowedForFreeSite:!0,...await i(e)}}}),CustomElement:async e=>({compId:e.id,compType:p.WEB,compName:e.title,compData:{webComponentData:{scriptType:I.MODULE,tagName:e.tagName,type:b.WIDGET,size:{width:e.width,height:e.height},installation:{base:{autoAdd:e.installation?.autoAddToSite,essential:e.installation?.essential,maxInstances:e.installation?.maxInstances}},...await i(e)}}})})))}}d();var F=C(g(),1);d();function O(t){if(!("output"in t||Array.isArray(t)))throw new m({code:u.InvalidViteBuildOutput()});return Array.isArray(t)?t.flatMap(i=>i.output):t.output}function E(t,r){let i=O(t).find(e=>e.type==="chunk"&&e.facadeModuleId===r);if(!i)throw new m({code:u.ViteModuleBundleNotFound()});return i.fileName}function _(t,r){let i=O(t).find(e=>e.fileName===r);if(!i||!("source"in i))throw new m({code:u.ViteFileNotFoundInOutput({fileName:r})});return i.source.toString()}async function R(t,r){let o=new URL(t.relativePath,r).href;return await fetch(o).then(e=>e.text())}var D=(t,r,o)=>{if(!r.config.trusted)return{iframeUrl:v(t.id)};let i=B(t.id),e=o?E(o,i):`/@id/${i}?import`;return{scriptAsset:{exportedName:t.id,containerId:r.config.appId,url:e,scriptType:M.MODULE}}},V=async(t,r,o)=>({template:r?_(r,t.relativePath):await R(t,o)}),j=(t,r)=>{let o=N(t.id);return{scriptTag:r?E(r,o):`/@id/${o}?import`,settingsUrl:A(t.id)}};function oe({model:t,buildOutput:r,devServerUrl:o}){return async i=>(0,F.match)(i,{EmbeddedScript:a=>V(a,r,o),DashboardSidebarCategory:()=>{},CustomElement:a=>j(a,r),DashboardPage:a=>D(a,t,r),DashboardPagePlugin:a=>D(a,t,r),DashboardModal:a=>D(a,t,r),DashboardMenuPlugin:()=>{}})}export{T as a,$ as b,oe as c};
4
+ //# sourceMappingURL=chunk-HI6L2JY4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/app-manifest/validate.ts","../src/app-manifest/create.ts","../src/app-manifest/component-source.ts","../src/app-manifest/build-output-data-extractor.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { match } from 'variant';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { CONFIG_FILENAME } from '@wix/cli-core-definitions';\nimport { replaceExtension } from '../dev-center/components/path.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap: Map<string, DevCenterComponent[]> =\n new Map();\n const sortedComponentsById = [...components].sort((a, b) =>\n a.id.localeCompare(b.id)\n );\n sortedComponentsById.forEach((component) => {\n const componentList = devCenterComponentsToIdMap.get(component.id) ?? [];\n componentList.push(component);\n devCenterComponentsToIdMap.set(component.id, componentList);\n });\n\n const devCenterComponentsWithSameIDMap: Map<string, DevCenterComponent[]> =\n new Map();\n\n devCenterComponentsToIdMap.forEach((devCenterComponents, key) => {\n if (devCenterComponents.length > 1) {\n devCenterComponentsWithSameIDMap.set(key, devCenterComponents);\n }\n });\n\n if (devCenterComponentsWithSameIDMap.size) {\n throw new CliError({\n code: CliErrorCode.DuplicateComponentIdsError({\n issues: Array.from(devCenterComponentsWithSameIDMap.entries()).map(\n ([id, devCenterComponents]) => {\n return {\n id,\n components: devCenterComponents\n .map((component) =>\n match(component, {\n DashboardPage: ({ title, relativePath }) => ({\n name: title,\n type: 'page' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardPagePlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'page-plugin' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardMenuPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'menu-plugin' as const,\n // We can use the relative path since the path already points to the menu config json\n path: relativePath,\n }),\n DashboardModal: ({ title, relativePath }) => ({\n name: title,\n type: 'modal' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardSidebarCategory: ({ label }) => ({\n name: label,\n type: 'sidebar-category' as const,\n path: CONFIG_FILENAME,\n }),\n EmbeddedScript: ({ relativePath }) => ({\n name: relativePath,\n type: 'embedded-script' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n CustomElement: ({ title, relativePath }) => ({\n name: title,\n type: 'custom-element' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n })\n )\n .sort((a, b) => a.name.localeCompare(b.name)),\n suggestedId: randomUUID(),\n };\n }\n ),\n }),\n });\n }\n};\n","import {\n ComponentType,\n BackOfficeHostingPlatforms,\n EmbeddedScriptPages,\n ScriptType,\n ElementType,\n} from '@wix/ambassador-devcenter-components-v1-component/types';\nimport { match } from 'variant';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtensionWidget,\n BackofficeExtensionMenuItem,\n BackofficeSideCategory,\n BackofficeModal,\n EmbeddedScript,\n CustomElement,\n} from '@wix/cli-app-manifest';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ntype CreateAppManifestParams = {\n appId: string;\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n};\n\nconst getExperiment = (\n component: DevCenterComponent<'DashboardPage'>,\n appId: string\n): ComponentExperiment => {\n if (component.experiments) {\n return {\n appId,\n componentId: component.id,\n spec: component.experiments.enabledBy,\n variantValue: 'true',\n };\n }\n return undefined;\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n return {\n appId,\n components: await Promise.all(\n components.map(\n match({\n DashboardPage: async (component): Promise<BackofficePage> => {\n const componentSentryDSN = component.sentryDSN ?? sentryDSN;\n return {\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_PAGE as const,\n compData: {\n backOfficePage: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n fullPage: component.sidebar?.whenActive?.hideSidebar,\n hideInSidebar: component.sidebar?.disabled,\n priority: component.sidebar?.priority,\n routePath: component.route.slice(1),\n title: component.title,\n pageCategoryId: component.sidebar?.categoryId,\n activeSidebarPageId:\n component.sidebar?.whenActive?.selectedPageId,\n requiredPermission: component.requiredPermission,\n previousRoutePaths: component.additionalRoutes,\n ...(componentSentryDSN\n ? { errorReporting: { url: componentSentryDSN } }\n : undefined),\n ...(await componentSourceBuilder(component)),\n },\n },\n compName: component.title,\n experiment: getExperiment(component, appId),\n };\n },\n DashboardPagePlugin: async (\n component\n ): Promise<BackofficeExtensionWidget> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_WIDGET as const,\n compData: {\n backOfficeExtensionWidget: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n extends: component.extends,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardMenuPlugin: async (\n component\n ): Promise<BackofficeExtensionMenuItem> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_MENU_ITEM as const,\n compData: {\n backOfficeExtensionMenuItem: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n id: component.id,\n title: component.title,\n subtitle: component.subtitle,\n iconKey: component.iconKey,\n extends: component.extends,\n action: component.action,\n requiredPermission: component.requiredPermission,\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardModal: async (component): Promise<BackofficeModal> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_MODAL as const,\n compData: {\n backOfficeModal: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardSidebarCategory: async (\n component\n ): Promise<BackofficeSideCategory> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_SIDEBAR_CATEGORY as const,\n compData: {\n backOfficeSidebarCategory: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.label,\n priority: component.priority,\n },\n },\n compName: component.label,\n }),\n EmbeddedScript: async (component): Promise<EmbeddedScript> => ({\n compId: component.id,\n compType: ComponentType.EMBEDDED_SCRIPT as const,\n compName: component.name,\n compData: {\n embeddedScriptComponentData: {\n name: component.name,\n pages: EmbeddedScriptPages.NONE_PAGES,\n placement: component.placement,\n connectArticleUrl: '',\n embedCategory: component.scriptType,\n loadOnce: true,\n allowedForFreeSite: true,\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n CustomElement: async (component): Promise<CustomElement> => ({\n compId: component.id,\n compType: ComponentType.WEB as const,\n compName: component.title,\n compData: {\n webComponentData: {\n scriptType: ScriptType.MODULE,\n tagName: component.tagName,\n type: ElementType.WIDGET,\n size: {\n width: component.width,\n height: component.height,\n },\n installation: {\n base: {\n autoAdd: component.installation?.autoAddToSite,\n essential: component.installation?.essential,\n maxInstances: component.installation?.maxInstances,\n },\n },\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n })\n )\n ),\n };\n}\n","import { BackOfficeScriptAssetType } from '@wix/ambassador-devcenter-components-v1-component/types';\nimport type { ComponentSource } from '@wix/cli-app-manifest';\nimport { match } from 'variant';\nimport {\n virtualModuleIdForScriptAsset,\n virtualPathForHTMLAsset,\n} from '../dev-center/components/dashboard/config.js';\nimport {\n virtualModuleIdForCustomElementScriptAsset,\n virtualPathForCustomElementPanelHTMLAsset,\n} from '../dev-center/components/site/config.js';\nimport type { ProjectModel } from '../model.js';\nimport type { ViteBuildOutput } from './build-output-data-extractor.js';\nimport {\n extractModuleBundleContent,\n extractModuleBundleName,\n} from './build-output-data-extractor.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\ntype EmbeddedScriptSource = {\n template: string;\n};\ntype CustomElementSource = { scriptTag: string; settingsUrl: string };\n\nexport type ComponentSourceBuilder = <T extends DevCenterComponent>(\n component: T\n) => Promise<\n T extends DevCenterComponent<'EmbeddedScript'>\n ? EmbeddedScriptSource\n : T extends DevCenterComponent<'CustomElement'>\n ? CustomElementSource\n : T extends DevCenterComponent<'DashboardPage'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardPagePlugin'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardModal'>\n ? DashboardSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n devServerUrl?: string\n) {\n const url = new URL(component.relativePath, devServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardPagePlugin'>\n | DevCenterComponent<'DashboardModal'>,\n model: ProjectModel,\n buildOutput?: ViteBuildOutput\n): DashboardSource => {\n if (!model.config.trusted) {\n return {\n iframeUrl: virtualPathForHTMLAsset(component.id),\n };\n }\n const moduleId = virtualModuleIdForScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptAsset: {\n exportedName: component.id,\n containerId: model.config.appId,\n url: componentUrl,\n scriptType: BackOfficeScriptAssetType.MODULE,\n },\n };\n};\n\nconst embeddedScriptBuilder = async (\n component: DevCenterComponent<'EmbeddedScript'>,\n buildOutput?: ViteBuildOutput,\n devServerUrl?: string\n): Promise<EmbeddedScriptSource> => {\n return {\n template: buildOutput\n ? extractModuleBundleContent(buildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, devServerUrl),\n };\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n buildOutput?: ViteBuildOutput\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptTag: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder({\n model,\n buildOutput,\n devServerUrl,\n}: {\n model: ProjectModel;\n buildOutput?: ViteBuildOutput;\n devServerUrl?: string;\n}) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(\n embeddedScriptComponent,\n buildOutput,\n devServerUrl\n ),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, buildOutput),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, buildOutput),\n DashboardPagePlugin: (dashboardPagePluginComponent) =>\n dashboardSourceBuilder(\n dashboardPagePluginComponent,\n model,\n buildOutput\n ),\n DashboardModal: (dashboardModalComponent) =>\n dashboardSourceBuilder(dashboardModalComponent, model, buildOutput),\n DashboardMenuPlugin: () => {},\n });\n\n return source;\n }) as ComponentSourceBuilder;\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { build } from 'vite';\n\nexport type ViteBuildOutput = Awaited<ReturnType<typeof build>>;\n\nfunction extractBuildOutputs(buildOutput: ViteBuildOutput) {\n const isValidRollupOutput =\n 'output' in buildOutput || Array.isArray(buildOutput);\n\n if (!isValidRollupOutput) {\n throw new CliError({ code: CliErrorCode.InvalidViteBuildOutput() });\n }\n\n const outputs = Array.isArray(buildOutput)\n ? buildOutput.flatMap((output) => output.output)\n : buildOutput.output;\n\n return outputs;\n}\n\nexport function extractModuleBundleName(\n buildOutput: ViteBuildOutput,\n moduleId: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find(\n (output) => output.type === 'chunk' && output.facadeModuleId === moduleId\n );\n\n if (!output) {\n throw new CliError({ code: CliErrorCode.ViteModuleBundleNotFound() });\n }\n\n return output.fileName;\n}\n\nexport function extractModuleBundleContent(\n buildOutput: ViteBuildOutput,\n fileName: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find((output) => output.fileName === fileName);\n\n if (!output || !('source' in output)) {\n throw new CliError({\n code: CliErrorCode.ViteFileNotFoundInOutput({ fileName }),\n });\n }\n\n return output.source.toString();\n}\n"],"mappings":";;0LAAAA,IACA,IAAAC,EAAsB,SADtB,OAAS,cAAAC,MAAkB,cAOpB,IAAM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CACxC,MAAAb,EACA,YAAAC,EACA,aAAAL,CACF,EAIG,CACD,MAAQ,OAAOD,MACE,SAAMA,EAAW,CAC9B,eAAiBmB,GACfN,EACEM,EACAb,EACAL,CACF,EACF,yBAA0B,IAAM,CAAC,EACjC,cAAgBmB,GACdL,EAAqBK,EAAwBd,CAAW,EAC1D,cAAgBe,GACdjB,EAAuBiB,EAAwBhB,EAAOC,CAAW,EACnE,oBAAsBgB,GACpBlB,EACEkB,EACAjB,EACAC,CACF,EACF,eAAiBiB,GACfnB,EAAuBmB,EAAyBlB,EAAOC,CAAW,EACpE,oBAAqB,IAAM,CAAC,CAC9B,CAAC,CAIL","names":["init_esm_shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","a","b","component","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","randomUUID","init_esm_shims","import_variant","getExperiment","component","appId","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","componentSentryDSN","ComponentType","BackOfficeHostingPlatforms","EmbeddedScriptPages","ScriptType","ElementType","init_esm_shims","import_variant","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","devServerUrl","url","res","dashboardSourceBuilder","model","buildOutput","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","extractModuleBundleContent","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardPagePluginComponent","dashboardModalComponent"]}