@next-core/runtime 1.5.0 → 1.5.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/dist/cjs/Dialog.js +2 -3
- package/dist/cjs/Dialog.js.map +1 -1
- package/dist/cjs/Notification.js +2 -3
- package/dist/cjs/Notification.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/Router.js +2 -2
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/Runtime.js +72 -32
- package/dist/cjs/internal/Runtime.js.map +1 -1
- package/dist/cjs/internal/bootstrapData.js.map +1 -1
- package/dist/cjs/internal/fulfilStoryboard.js +27 -0
- package/dist/cjs/internal/fulfilStoryboard.js.map +1 -0
- package/dist/cjs/internal/secret_internals.js +0 -12
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/Dialog.js +2 -3
- package/dist/esm/Dialog.js.map +1 -1
- package/dist/esm/Notification.js +2 -3
- package/dist/esm/Notification.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/Router.js +1 -1
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/Runtime.js +70 -29
- package/dist/esm/internal/Runtime.js.map +1 -1
- package/dist/esm/internal/bootstrapData.js.map +1 -1
- package/dist/esm/internal/fulfilStoryboard.js +34 -0
- package/dist/esm/internal/fulfilStoryboard.js.map +1 -0
- package/dist/esm/internal/secret_internals.js +1 -10
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/Dialog.d.ts +1 -1
- package/dist/types/Notification.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal/Runtime.d.ts +11 -2
- package/dist/types/internal/bootstrapData.d.ts +1 -1
- package/dist/types/internal/fulfilStoryboard.d.ts +2 -0
- package/dist/types/internal/secret_internals.d.ts +1 -4
- package/package.json +6 -6
- package/dist/cjs/internal/loadBootstrapData.js +0 -227
- package/dist/cjs/internal/loadBootstrapData.js.map +0 -1
- package/dist/cjs/internal/loadCheckLogin.js +0 -17
- package/dist/cjs/internal/loadCheckLogin.js.map +0 -1
- package/dist/esm/internal/loadBootstrapData.js +0 -244
- package/dist/esm/internal/loadBootstrapData.js.map +0 -1
- package/dist/esm/internal/loadCheckLogin.js +0 -18
- package/dist/esm/internal/loadCheckLogin.js.map +0 -1
- package/dist/types/internal/loadBootstrapData.d.ts +0 -10
- package/dist/types/internal/loadCheckLogin.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.js","names":["i18n","initializeI18n","loadBricksImperatively","moment","createHistory","matchStoryboard","Router","loadCheckLogin","loadBootstrapData","NS","locales","loadNotificationService","loadDialogService","injectedBootstrapData","runtime","bootstrapData","router","createRuntime","Error","locale","language","on","Runtime","getRuntime","bootstrap","_asyncToGenerator","_bootstrapData","Promise","all","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","getFeatureFlags","_bootstrapData2","_bootstrapData2$setti","_router3","_router3$getRecentApp","_router3$getRecentApp2","_router3$getRecentApp3","_objectSpread","settings","featureFlags","config","getMiscSettings","_bootstrapData3","_bootstrapData3$setti","_router4","_router4$getRecentApp","_router4$getRecentApp2","_router4$getRecentApp3","misc","getBrandSettings","_bootstrapData4","_bootstrapData4$setti","base_title","brand","getLaunchpadSettings","_bootstrapData5","_bootstrapData5$setti","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData6","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData7","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","concat","getNavConfig","_router5","_internalApiSetBootstrapData","data","getBrickPackages","_bootstrapData$brickP","_bootstrapData8","brickPackages","_internalApiLoadBricks","bricks","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData9","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","appId","_bootstrapData10","_bootstrapData10$stor","find","storyboard","app","id","_internalApiGetAppInBootstrapData","_internalApiGetStoryb"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { loadCheckLogin } from \"./loadCheckLogin.js\";\nimport { loadBootstrapData } from \"./loadBootstrapData.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBootstrapData } from \"./bootstrapData.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData = injectedBootstrapData;\nlet router: Router | undefined;\n\nexport function createRuntime() {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n async bootstrap() {\n const [, _bootstrapData] = await Promise.all([\n loadCheckLogin(),\n loadBootstrapData(),\n ]);\n bootstrapData = _bootstrapData;\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n router = new Router(_bootstrapData.storyboards);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n // ...(kernel.getOriginFaviconHref()\n // ? { favicon: kernel.getOriginFaviconHref() }\n // : {})\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n}\n\nexport function _internalApiSetBootstrapData(data: Partial<BootstrapData>) {\n bootstrapData = data;\n}\n\nexport function getBrickPackages() {\n return bootstrapData?.brickPackages ?? [];\n}\n\nexport function _internalApiLoadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n"],"mappings":";;AAMA,SAASA,IAAI,EAAEC,cAAc,QAAQ,iBAAiB;AACtD,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAO,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,EAAE,EAAEC,OAAO,QAAQ,WAAW;AACvC,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,IAAIC,OAAgB;;AAEpB;AACA,IAAIC,aAAa,GAAGF,qBAAqB;AACzC,IAAIG,MAA0B;AAE9B,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC9B,IAAIH,OAAO,EAAE;IACX,MAAM,IAAII,KAAK,CAAC,iCAAiC,CAAC;EACpD;EACAjB,cAAc,CAACQ,EAAE,EAAEC,OAAO,CAAC;EAC3BP,MAAM,CAACgB,MAAM,CAACnB,IAAI,CAACoB,QAAQ,CAAC;EAC5BpB,IAAI,CAACqB,EAAE,CAAC,iBAAiB,EAAE,MAAM;IAC/BlB,MAAM,CAACgB,MAAM,CAACnB,IAAI,CAACoB,QAAQ,CAAC;EAC9B,CAAC,CAAC;EACFhB,aAAa,EAAE;EACfU,OAAO,GAAG,IAAIQ,OAAO,EAAE;EACvB,OAAOR,OAAO;AAChB;AAEA,OAAO,SAASS,UAAUA,CAAA,EAAG;EAC3B,OAAOT,OAAO;AAChB;AAEA,OAAO,MAAMQ,OAAO,CAAC;EACbE,SAASA,CAAA,EAAG;IAAA,OAAAC,iBAAA;MAChB,IAAM,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AC5D,QAAAA,QAAA,GAAOhF,MAAM,cAAAgF,QAAA,uBAANA,QAAA,CAAQC,WAAW,EAAE;AAC9B;AAEA,OAAO,SAASC,2BAA2BA,CACzCC,QAAgB,EACe;EAAA,IAAAC,qBAAA,EAAAC,eAAA;EAC/B,OAAOhG,eAAe,EAAA+F,qBAAA,IAAAC,eAAA,GAACtF,aAAa,cAAAsF,eAAA,uBAAbA,eAAA,CAAexE,WAAW,cAAAuE,qBAAA,cAAAA,qBAAA,GAAI,EAAE,EAAED,QAAQ,CAAC;AACpE;AAEA,OAAO,SAASG,6BAA6BA,CAAA,EAAG;EAAA,IAAAC,QAAA;EAC9C,QAAAA,QAAA,GAAOvF,MAAM,cAAAuF,QAAA,uBAANA,QAAA,CAAQC,iBAAiB,EAAE;AACpC;AAEA,OAAO,SAASC,wCAAwCA,CAACC,KAAa,EAAE;EAAA,IAAAC,gBAAA,EAAAC,qBAAA;EACtE,QAAAD,gBAAA,GAAO5F,aAAa,cAAA4F,gBAAA,wBAAAC,qBAAA,GAAbD,gBAAA,CAAe9E,WAAW,cAAA+E,qBAAA,uBAA1BA,qBAAA,CAA4BC,IAAI,CACpCC,UAAU,IAAKA,UAAU,CAACC,GAAG,CAACC,EAAE,KAAKN,KAAK,CAC5C;AACH;AAEA,OAAO,SAASO,iCAAiCA,CAACP,KAAa,EAAE;EAAA,IAAAQ,qBAAA;EAC/D,QAAAA,qBAAA,GAAOT,wCAAwC,CAACC,KAAK,CAAC,cAAAQ,qBAAA,uBAA/CA,qBAAA,CAAiDH,GAAG;AAC7D"}
|
|
1
|
+
{"version":3,"file":"Runtime.js","names":["i18n","initializeI18n","loadBricksImperatively","deepFreeze","isObject","moment","createHistory","matchStoryboard","Router","NS","locales","loadNotificationService","loadDialogService","injectedBootstrapData","runtime","bootstrapData","router","hooks","createRuntime","options","Error","locale","language","on","Runtime","getRuntime","initialize","data","normalizeBootstrapData","loadBricks","bootstrap","_asyncToGenerator","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","getFeatureFlags","_bootstrapData","_bootstrapData$settin","_router3","_router3$getRecentApp","_router3$getRecentApp2","_router3$getRecentApp3","_objectSpread","settings","featureFlags","config","getMiscSettings","_bootstrapData2","_bootstrapData2$setti","_router4","_router4$getRecentApp","_router4$getRecentApp2","_router4$getRecentApp3","misc","getBrandSettings","_bootstrapData3","_bootstrapData3$setti","base_title","brand","getLaunchpadSettings","_bootstrapData4","_bootstrapData4$setti","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData5","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData6","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","concat","getNavConfig","_router5","bricks","getBrickPackages","Array","isArray","_loop","app","ns","id","Object","entries","forEach","_ref","lang","resources","addResourceBundle","localeName","getFixedT","name","keys","removeResourceBundle","brickPackages","_bootstrapData$brickP","_bootstrapData7","_internalApiLoadBricks","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData8","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","appId","_bootstrapData9","_bootstrapData9$story","find","storyboard","_internalApiGetAppInBootstrapData","_internalApiGetStoryb","_test_only_setBootstrapData","process","env","NODE_ENV"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { deepFreeze, isObject } from \"@next-core/utils/general\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBootstrapData } from \"./bootstrapData.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData = injectedBootstrapData;\nlet router: Router | undefined;\n\nexport interface RuntimeOptions {\n hooks?: RuntimeHooks;\n}\n\nexport interface RuntimeHooks {\n fulfilStoryboard?: (storyboard: RuntimeStoryboard) => Promise<void>;\n}\n\nexport let hooks: RuntimeHooks | undefined;\n\nexport function createRuntime(options?: RuntimeOptions) {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n hooks = options?.hooks;\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n initialize(data: BootstrapData) {\n normalizeBootstrapData(data);\n bootstrapData = data;\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\", this.loadBricks);\n loadDialogService(\"shoelace.show-dialog\", this.loadBricks);\n }\n\n async bootstrap() {\n router = new Router(bootstrapData!.storyboards!);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n // ...(kernel.getOriginFaviconHref()\n // ? { favicon: kernel.getOriginFaviconHref() }\n // : {})\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n\n loadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n }\n}\n\nfunction normalizeBootstrapData(data: BootstrapData) {\n if (Array.isArray(data.storyboards)) {\n for (const { app } of data.storyboards) {\n if (app.locales) {\n // Prefix to avoid conflict between brick package's i18n namespace.\n const ns = `tmp/${app.id}`;\n // Support any languages in `app.locales`.\n Object.entries(app.locales).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n // Use `app.name` as the fallback `app.localeName`.\n app.localeName = i18n.getFixedT(null, ns)(\"name\", app.name) as string;\n // Remove the temporary i18n resource bundles.\n Object.keys(app.locales).forEach((lang) => {\n i18n.removeResourceBundle(lang, ns);\n });\n } else {\n app.localeName = app.name;\n }\n }\n }\n\n if (isObject(data.settings)) {\n deepFreeze(data.settings);\n }\n data.brickPackages = deepFreeze(data.brickPackages);\n}\n\nexport function getBrickPackages() {\n return bootstrapData?.brickPackages ?? [];\n}\n\nexport function _internalApiLoadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n\nexport let _test_only_setBootstrapData: (data: Partial<BootstrapData>) => void;\n\nif (process.env.NODE_ENV === \"test\") {\n _test_only_setBootstrapData = (data) => {\n bootstrapData = data as BootstrapData;\n };\n}\n"],"mappings":";;AAMA,SAASA,IAAI,EAAEC,cAAc,QAAQ,iBAAiB;AACtD,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,UAAU,EAAEC,QAAQ,QAAQ,0BAA0B;AAC/D,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAO,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,EAAE,EAAEC,OAAO,QAAQ,WAAW;AACvC,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,IAAIC,OAAgB;;AAEpB;AACA,IAAIC,aAAa,GAAGF,qBAAqB;AACzC,IAAIG,MAA0B;AAU9B,OAAO,IAAIC,KAA+B;AAE1C,OAAO,SAASC,aAAaA,CAACC,OAAwB,EAAE;EACtD,IAAIL,OAAO,EAAE;IACX,MAAM,IAAIM,KAAK,CAAC,iCAAiC,CAAC;EACpD;EACAH,KAAK,GAAGE,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEF,KAAK;EACtBhB,cAAc,CAACQ,EAAE,EAAEC,OAAO,CAAC;EAC3BL,MAAM,CAACgB,MAAM,CAACrB,IAAI,CAACsB,QAAQ,CAAC;EAC5BtB,IAAI,CAACuB,EAAE,CAAC,i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AACC,KAAK,CAAC,cAAAM,qBAAA,uBAA/CA,qBAAA,CAAiDpC,GAAG;AAC7D;AAEA,OAAO,IAAIqC,2BAAmE;AAE9E,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;EACnCH,2BAA2B,GAAIzG,IAAI,IAAK;IACtCZ,aAAa,GAAGY,IAAqB;EACvC,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapData.js","names":["injectedBootstrapData","BOOTSTRAP_DATA","undefined"],"sources":["../../../src/internal/bootstrapData.ts"],"sourcesContent":["import type { BootstrapData } from \"@next-core/types\";\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nexport const injectedBootstrapData:
|
|
1
|
+
{"version":3,"file":"bootstrapData.js","names":["injectedBootstrapData","BOOTSTRAP_DATA","undefined"],"sources":["../../../src/internal/bootstrapData.ts"],"sourcesContent":["import type { BootstrapData } from \"@next-core/types\";\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nexport const injectedBootstrapData: BootstrapData | undefined =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof BOOTSTRAP_DATA !== \"undefined\" ? BOOTSTRAP_DATA : undefined;\n"],"mappings":"AAEA;AACA,OAAO,IAAMA,qBAAgD;AAC3D;AACA;AACA,OAAOC,cAAc,KAAK,WAAW,GAAGA,cAAc,GAAGC,SAAS"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import { hooks } from "./Runtime.js";
|
|
3
|
+
import { registerAppI18n } from "./registerAppI18n.js";
|
|
4
|
+
export function fulfilStoryboard(_x) {
|
|
5
|
+
return _fulfilStoryboard.apply(this, arguments);
|
|
6
|
+
}
|
|
7
|
+
function _fulfilStoryboard() {
|
|
8
|
+
_fulfilStoryboard = _asyncToGenerator(function* (storyboard) {
|
|
9
|
+
if (storyboard.$$fulfilled) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!storyboard.$$fulfilling) {
|
|
13
|
+
storyboard.$$fulfilling = doFulfilStoryboard(storyboard);
|
|
14
|
+
}
|
|
15
|
+
return storyboard.$$fulfilling;
|
|
16
|
+
});
|
|
17
|
+
return _fulfilStoryboard.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
function doFulfilStoryboard(_x2) {
|
|
20
|
+
return _doFulfilStoryboard.apply(this, arguments);
|
|
21
|
+
}
|
|
22
|
+
function _doFulfilStoryboard() {
|
|
23
|
+
_doFulfilStoryboard = _asyncToGenerator(function* (storyboard) {
|
|
24
|
+
var _hooks$fulfilStoryboa;
|
|
25
|
+
yield hooks === null || hooks === void 0 ? void 0 : (_hooks$fulfilStoryboa = hooks.fulfilStoryboard) === null || _hooks$fulfilStoryboa === void 0 ? void 0 : _hooks$fulfilStoryboa.call(hooks, storyboard);
|
|
26
|
+
registerAppI18n(storyboard);
|
|
27
|
+
Object.assign(storyboard, {
|
|
28
|
+
$$fulfilled: true,
|
|
29
|
+
$$fulfilling: null
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return _doFulfilStoryboard.apply(this, arguments);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fulfilStoryboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fulfilStoryboard.js","names":["hooks","registerAppI18n","fulfilStoryboard","_x","_fulfilStoryboard","apply","arguments","_asyncToGenerator","storyboard","$$fulfilled","$$fulfilling","doFulfilStoryboard","_x2","_doFulfilStoryboard","_hooks$fulfilStoryboa","call","Object","assign"],"sources":["../../../src/internal/fulfilStoryboard.ts"],"sourcesContent":["import type { RuntimeStoryboard } from \"@next-core/types\";\nimport { hooks } from \"./Runtime.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\n\nexport async function fulfilStoryboard(storyboard: RuntimeStoryboard) {\n if (storyboard.$$fulfilled) {\n return;\n }\n if (!storyboard.$$fulfilling) {\n storyboard.$$fulfilling = doFulfilStoryboard(storyboard);\n }\n return storyboard.$$fulfilling;\n}\n\nasync function doFulfilStoryboard(storyboard: RuntimeStoryboard) {\n await hooks?.fulfilStoryboard?.(storyboard);\n registerAppI18n(storyboard);\n Object.assign(storyboard, {\n $$fulfilled: true,\n $$fulfilling: null,\n });\n}\n"],"mappings":";AACA,SAASA,KAAK,QAAQ,cAAc;AACpC,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,gBAAsBC,gBAAgBA,CAAAC,EAAA;EAAA,OAAAC,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAQrC,SAAAF,kBAAA;EAAAA,iBAAA,GAAAG,iBAAA,CARM,WAAgCC,UAA6B,EAAE;IACpE,IAAIA,UAAU,CAACC,WAAW,EAAE;MAC1B;IACF;IACA,IAAI,CAACD,UAAU,CAACE,YAAY,EAAE;MAC5BF,UAAU,CAACE,YAAY,GAAGC,kBAAkB,CAACH,UAAU,CAAC;IAC1D;IACA,OAAOA,UAAU,CAACE,YAAY;EAChC,CAAC;EAAA,OAAAN,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAEcK,kBAAkBA,CAAAC,GAAA;EAAA,OAAAC,mBAAA,CAAAR,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAO,oBAAA;EAAAA,mBAAA,GAAAN,iBAAA,CAAjC,WAAkCC,UAA6B,EAAE;IAAA,IAAAM,qBAAA;IAC/D,MAAMd,KAAK,aAALA,KAAK,wBAAAc,qBAAA,GAALd,KAAK,CAAEE,gBAAgB,cAAAY,qBAAA,uBAAvBA,qBAAA,CAAAC,IAAA,CAAAf,KAAK,EAAqBQ,UAAU,CAAC;IAC3CP,eAAe,CAACO,UAAU,CAAC;IAC3BQ,MAAM,CAACC,MAAM,CAACT,UAAU,EAAE;MACxBC,WAAW,EAAE,IAAI;MACjBC,YAAY,EAAE;IAChB,CAAC,CAAC;EACJ,CAAC;EAAA,OAAAG,mBAAA,CAAAR,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import { flushStableLoadBricks } from "@next-core/loader";
|
|
4
4
|
import { pick } from "lodash";
|
|
5
|
-
import { _internalApiGetRuntimeContext, _internalApiGetStoryboardInBootstrapData
|
|
5
|
+
import { _internalApiGetRuntimeContext, _internalApiGetStoryboardInBootstrapData } from "./Runtime.js";
|
|
6
6
|
import { renderBrick } from "./Renderer.js";
|
|
7
7
|
import { RendererContext } from "./RendererContext.js";
|
|
8
8
|
import { mountTree, unmountTree } from "./mount.js";
|
|
@@ -11,8 +11,6 @@ import { computeRealValue } from "./compute/computeRealValue.js";
|
|
|
11
11
|
import { isStrictMode, warnAboutStrictMode } from "../isStrictMode.js";
|
|
12
12
|
import { customTemplates } from "../CustomTemplates.js";
|
|
13
13
|
import { registerAppI18n } from "./registerAppI18n.js";
|
|
14
|
-
import { loadNotificationService } from "../Notification.js";
|
|
15
|
-
import { loadDialogService } from "../Dialog.js";
|
|
16
14
|
export function renderUseBrick(_x, _x2) {
|
|
17
15
|
return _renderUseBrick.apply(this, arguments);
|
|
18
16
|
}
|
|
@@ -94,12 +92,6 @@ export function unmountUseBrick(_ref2, mountResult) {
|
|
|
94
92
|
rendererContext.dispatchOnUnmount();
|
|
95
93
|
rendererContext.dispose();
|
|
96
94
|
}
|
|
97
|
-
export function initializePlayground(data) {
|
|
98
|
-
_internalApiSetBootstrapData(data);
|
|
99
|
-
// Todo: allow configuration of notification bricks.
|
|
100
|
-
loadNotificationService("shoelace.show-notification");
|
|
101
|
-
loadDialogService("shoelace.show-dialog");
|
|
102
|
-
}
|
|
103
95
|
export function legacyDoTransform(data, to, options) {
|
|
104
96
|
if (options) {
|
|
105
97
|
throw new Error("Legacy doTransform does not support options in v3");
|
|
@@ -110,7 +102,6 @@ export function legacyDoTransform(data, to, options) {
|
|
|
110
102
|
noInject: true
|
|
111
103
|
});
|
|
112
104
|
}
|
|
113
|
-
export var loadBricks = _internalApiLoadBricks;
|
|
114
105
|
export function updateStoryboard(appId, storyboardPatch) {
|
|
115
106
|
var storyboard = _internalApiGetStoryboardInBootstrapData(appId);
|
|
116
107
|
Object.assign(storyboard, _objectSpread(_objectSpread({}, storyboardPatch), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["flushStableLoadBricks","pick","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","_internalApiLoadBricks","_internalApiSetBootstrapData","renderBrick","RendererContext","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","loadNotificationService","loadDialogService","renderUseBrick","_x","_x2","_renderUseBrick","apply","arguments","_asyncToGenerator","useBrick","data","_runtimeContext$tplSt","_runtimeContext$formS","_output$node","tplStateStoreScope","formStateStoreScope","runtimeContext","_objectSpread","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","initializePlayground","legacyDoTransform","to","options","noInject","loadBricks","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","concat","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BootstrapData,\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiLoadBricks,\n _internalApiSetBootstrapData,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n formStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n runtimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...[...tplStateStoreScope, ...formStateStoreScope].map((store) =>\n store.waitForAll()\n ),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\nexport function initializePlayground(data: Partial<BootstrapData>) {\n _internalApiSetBootstrapData(data);\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport const loadBricks = _internalApiLoadBricks;\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n"],"mappings":";;AAQA,SAASA,qBAAqB,QAAQ,mBAAmB;AACzD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SACEC,6BAA6B,EAC7BC,wCAAwC,EACxCC,sBAAsB,EACtBC,4BAA4B,QACvB,cAAc;AACrB,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,eAAe,QAAQ,sBAAsB;AAGtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,iBAAiB,QAAQ,cAAc;AAQhD,gBAAsBC,cAAcA,CAAAC,EAAA,EAAAC,GAAA;EAAA,OAAAC,eAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAwEnC,SAAAF,gBAAA;EAAAA,eAAA,GAAAG,iBAAA,CAxEM,WACLC,QAA4B,EAC5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eAAe,CAAC;EACtD;AACF"}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["flushStableLoadBricks","pick","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","renderBrick","RendererContext","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","renderUseBrick","_x","_x2","_renderUseBrick","apply","arguments","_asyncToGenerator","useBrick","data","_runtimeContext$tplSt","_runtimeContext$formS","_output$node","tplStateStoreScope","formStateStoreScope","runtimeContext","_objectSpread","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","concat","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n formStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n runtimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...[...tplStateStoreScope, ...formStateStoreScope].map((store) =>\n store.waitForAll()\n ),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n"],"mappings":";;AAOA,SAASA,qBAAqB,QAAQ,mBAAmB;AACzD,SAASC,I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,KAAK,IAAKA,KAAK,CAACE,IAAI,KAAKA,IAAI,CAAC;EAC1E,IAAM4B,eAA0B,GAAG;IACjC5B,IAAI;IACJa,MAAM;IACNgB,IAAI,EAAE,KAAK;IACX5B,KAAK,EAAE;EACT,CAAC;EACD,IAAIyB,iBAAiB,KAAK,CAAC,CAAC,EAAE;IAC5BvB,MAAM,CAACG,OAAO,CAACsB,eAAe,CAAC;EACjC,CAAC,MAAM;IACLzB,MAAM,CAAC2B,MAAM,CAACJ,iBAAiB,EAAE,CAAC,EAAEE,eAAe,CAAC;EACtD;AACF"}
|
package/dist/types/Dialog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare function show(options: DialogOptions): Promise<void>;
|
|
2
|
-
export declare function loadDialogService(tagName: string): void;
|
|
2
|
+
export declare function loadDialogService(tagName: string, loader: (bricks: string[]) => Promise<void>): void;
|
|
3
3
|
export interface DialogOptions {
|
|
4
4
|
type?: "success" | "error" | "warn" | "info" | "confirm";
|
|
5
5
|
title?: string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare function show(options: NotificationOptions): void;
|
|
2
|
-
export declare function loadNotificationService(tagName: string): void;
|
|
2
|
+
export declare function loadNotificationService(tagName: string, loader: (bricks: string[]) => Promise<void>): void;
|
|
3
3
|
export interface NotificationOptions {
|
|
4
4
|
type?: "success" | "error" | "warn" | "info";
|
|
5
5
|
message: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from "./getPageInfo.js";
|
|
|
7
7
|
export * from "./handleHttpError.js";
|
|
8
8
|
export * from "./history.js";
|
|
9
9
|
export * from "./createRoot.js";
|
|
10
|
-
export { createRuntime, getRuntime } from "./internal/Runtime.js";
|
|
10
|
+
export { createRuntime, getRuntime, type RuntimeOptions, type RuntimeHooks, } from "./internal/Runtime.js";
|
|
11
11
|
import * as __secret_internals from "./internal/secret_internals.js";
|
|
12
12
|
export { __secret_internals };
|
|
13
13
|
export { getCssPropertyValue, getCurrentTheme, getCurrentMode, batchSetAppsLocalTheme, applyTheme, } from "./themeAndMode.js";
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { RuntimeStoryboard, FeatureFlags, BootstrapData } from "@next-core/types";
|
|
2
2
|
import "moment/locale/zh-cn.js";
|
|
3
|
-
export
|
|
3
|
+
export interface RuntimeOptions {
|
|
4
|
+
hooks?: RuntimeHooks;
|
|
5
|
+
}
|
|
6
|
+
export interface RuntimeHooks {
|
|
7
|
+
fulfilStoryboard?: (storyboard: RuntimeStoryboard) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare let hooks: RuntimeHooks | undefined;
|
|
10
|
+
export declare function createRuntime(options?: RuntimeOptions): Runtime;
|
|
4
11
|
export declare function getRuntime(): Runtime;
|
|
5
12
|
export declare class Runtime {
|
|
13
|
+
initialize(data: BootstrapData): void;
|
|
6
14
|
bootstrap(): Promise<void>;
|
|
7
15
|
getRecentApps(): {};
|
|
8
16
|
getCurrentApp(): import("@next-core/types").MicroApp | undefined;
|
|
@@ -22,8 +30,8 @@ export declare class Runtime {
|
|
|
22
30
|
getNavConfig(): {
|
|
23
31
|
breadcrumb?: import("@next-core/types").BreadcrumbItemConf[] | undefined;
|
|
24
32
|
} | undefined;
|
|
33
|
+
loadBricks(bricks: string[] | Set<string>): Promise<void>;
|
|
25
34
|
}
|
|
26
|
-
export declare function _internalApiSetBootstrapData(data: Partial<BootstrapData>): void;
|
|
27
35
|
export declare function getBrickPackages(): import("@next-core/types").BrickPackage[];
|
|
28
36
|
export declare function _internalApiLoadBricks(bricks: string[] | Set<string>): Promise<void>;
|
|
29
37
|
export declare function _internalApiGetRenderId(): string | undefined;
|
|
@@ -31,3 +39,4 @@ export declare function _internalApiMatchStoryboard(pathname: string): RuntimeSt
|
|
|
31
39
|
export declare function _internalApiGetRuntimeContext(): import("./interfaces.js").RuntimeContext | undefined;
|
|
32
40
|
export declare function _internalApiGetStoryboardInBootstrapData(appId: string): import("@next-core/types").Storyboard | undefined;
|
|
33
41
|
export declare function _internalApiGetAppInBootstrapData(appId: string): import("@next-core/types").MicroApp | undefined;
|
|
42
|
+
export declare let _test_only_setBootstrapData: (data: Partial<BootstrapData>) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { BootstrapData } from "@next-core/types";
|
|
2
|
-
export declare const injectedBootstrapData:
|
|
2
|
+
export declare const injectedBootstrapData: BootstrapData | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { _internalApiLoadBricks } from "./Runtime.js";
|
|
1
|
+
import type { BrickConf, CustomTemplate, RouteConf, Storyboard, UseSingleBrickConf } from "@next-core/types";
|
|
3
2
|
import { RendererContext } from "./RendererContext.js";
|
|
4
3
|
import type { RenderRoot } from "./interfaces.js";
|
|
5
4
|
export interface RenderUseBrickResult {
|
|
@@ -13,9 +12,7 @@ export interface MountUseBrickResult {
|
|
|
13
12
|
}
|
|
14
13
|
export declare function mountUseBrick({ renderRoot, rendererContext }: RenderUseBrickResult, element: HTMLElement): MountUseBrickResult;
|
|
15
14
|
export declare function unmountUseBrick({ rendererContext }: RenderUseBrickResult, mountResult: MountUseBrickResult): void;
|
|
16
|
-
export declare function initializePlayground(data: Partial<BootstrapData>): void;
|
|
17
15
|
export declare function legacyDoTransform(data: unknown, to: unknown, options?: unknown): unknown;
|
|
18
|
-
export declare const loadBricks: typeof _internalApiLoadBricks;
|
|
19
16
|
export declare function updateStoryboard(appId: string, storyboardPatch: Partial<Storyboard>): void;
|
|
20
17
|
export declare function updateStoryboardByRoute(appId: string, newRoute: RouteConf): void;
|
|
21
18
|
export declare function updateStoryboardByTemplate(appId: string, newTemplate: CustomTemplate, settings: unknown): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/runtime",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/runtime",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@next-api-sdk/micro-app-standalone-sdk": "^1.1.0",
|
|
50
50
|
"@next-core/cook": "^2.0.4",
|
|
51
51
|
"@next-core/http": "^1.0.4",
|
|
52
|
-
"@next-core/i18n": "^1.0.
|
|
53
|
-
"@next-core/inject": "^1.0.
|
|
52
|
+
"@next-core/i18n": "^1.0.9",
|
|
53
|
+
"@next-core/inject": "^1.0.7",
|
|
54
54
|
"@next-core/loader": "^1.3.0",
|
|
55
55
|
"@next-core/supply": "^2.0.4",
|
|
56
|
-
"@next-core/types": "^1.1.
|
|
57
|
-
"@next-core/utils": "^1.2.
|
|
56
|
+
"@next-core/types": "^1.1.1",
|
|
57
|
+
"@next-core/utils": "^1.2.4",
|
|
58
58
|
"@ungap/event-target": "^0.2.3",
|
|
59
59
|
"compare-versions": "^5.0.3",
|
|
60
60
|
"history": "^4.10.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@next-core/build-next-libs": "^1.0.3",
|
|
68
68
|
"@next-core/test-next": "^1.0.4"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "ca6d1adfe5ab93cedb5deaeb1d4f7f870127b91c"
|
|
71
71
|
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fulfilStoryboard = fulfilStoryboard;
|
|
7
|
-
exports.loadBootstrapData = loadBootstrapData;
|
|
8
|
-
exports.safeGetRuntimeMicroAppStandalone = safeGetRuntimeMicroAppStandalone;
|
|
9
|
-
var _apiGatewaySdk = require("@next-api-sdk/api-gateway-sdk");
|
|
10
|
-
var _http = require("@next-core/http");
|
|
11
|
-
var _i18n = require("@next-core/i18n");
|
|
12
|
-
var _general = require("@next-core/utils/general");
|
|
13
|
-
var _lodash = require("lodash");
|
|
14
|
-
var _jsYaml = require("js-yaml");
|
|
15
|
-
var _microAppStandaloneSdk = require("@next-api-sdk/micro-app-standalone-sdk");
|
|
16
|
-
var _registerAppI18n = require("./registerAppI18n.js");
|
|
17
|
-
async function loadBootstrapData() {
|
|
18
|
-
const data = await (window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : (0, _apiGatewaySdk.BootstrapV2Api_bootstrapV2)({
|
|
19
|
-
appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",
|
|
20
|
-
ignoreTemplateFields: "templates",
|
|
21
|
-
ignoreBrickFields: "bricks,processors,providers,editors"
|
|
22
|
-
}));
|
|
23
|
-
for (const {
|
|
24
|
-
app
|
|
25
|
-
} of data.storyboards) {
|
|
26
|
-
if (app.locales) {
|
|
27
|
-
// Prefix to avoid conflict between brick package's i18n namespace.
|
|
28
|
-
const ns = `tmp/${app.id}`;
|
|
29
|
-
// Support any languages in `app.locales`.
|
|
30
|
-
Object.entries(app.locales).forEach(([lang, resources]) => {
|
|
31
|
-
_i18n.i18n.addResourceBundle(lang, ns, resources);
|
|
32
|
-
});
|
|
33
|
-
// Use `app.name` as the fallback `app.localeName`.
|
|
34
|
-
app.localeName = _i18n.i18n.getFixedT(null, ns)("name", app.name);
|
|
35
|
-
// Remove the temporary i18n resource bundles.
|
|
36
|
-
Object.keys(app.locales).forEach(lang => {
|
|
37
|
-
_i18n.i18n.removeResourceBundle(lang, ns);
|
|
38
|
-
});
|
|
39
|
-
} else {
|
|
40
|
-
app.localeName = app.name;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if ((0, _general.isObject)(data.settings)) {
|
|
44
|
-
(0, _general.deepFreeze)(data.settings);
|
|
45
|
-
}
|
|
46
|
-
data.brickPackages = (0, _general.deepFreeze)(data.brickPackages);
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
async function standaloneBootstrap() {
|
|
50
|
-
const requests = [
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
52
|
-
_http.http.get(window.BOOTSTRAP_FILE), _http.http.get(`${window.APP_ROOT}conf.yaml`, {
|
|
53
|
-
responseType: "text"
|
|
54
|
-
}), (0, _apiGatewaySdk.BootstrapStandaloneApi_runtimeStandalone)().catch(error => {
|
|
55
|
-
// make it not crash when the backend service is not updated.
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
|
-
console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
|
|
58
|
-
})];
|
|
59
|
-
if (!window.NO_AUTH_GUARD) {
|
|
60
|
-
let matches;
|
|
61
|
-
const appId = window.APP_ID || (window.APP_ROOT && (matches = window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\//)) ? matches[1] : null);
|
|
62
|
-
if (appId) {
|
|
63
|
-
// No need to wait.
|
|
64
|
-
safeGetRuntimeMicroAppStandalone(appId);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const [bootstrapResult, confString, runtimeData] = await Promise.all(requests);
|
|
68
|
-
mergeConf(bootstrapResult, confString);
|
|
69
|
-
mergeRuntimeSettings(bootstrapResult, runtimeData === null || runtimeData === void 0 ? void 0 : runtimeData.settings);
|
|
70
|
-
return bootstrapResult;
|
|
71
|
-
}
|
|
72
|
-
function mergeConf(bootstrapResult, confString) {
|
|
73
|
-
let conf;
|
|
74
|
-
try {
|
|
75
|
-
conf = confString ? (0, _jsYaml.safeLoad)(confString, {
|
|
76
|
-
schema: _jsYaml.JSON_SCHEMA,
|
|
77
|
-
json: true
|
|
78
|
-
}) : undefined;
|
|
79
|
-
} catch (error) {
|
|
80
|
-
// eslint-disable-next-line no-console
|
|
81
|
-
console.error("Parse conf.yaml failed", error);
|
|
82
|
-
throw new Error("Invalid conf.yaml");
|
|
83
|
-
}
|
|
84
|
-
if (conf) {
|
|
85
|
-
const {
|
|
86
|
-
sys_settings,
|
|
87
|
-
user_config,
|
|
88
|
-
user_config_by_apps
|
|
89
|
-
} = conf;
|
|
90
|
-
if (sys_settings) {
|
|
91
|
-
const {
|
|
92
|
-
feature_flags: featureFlags,
|
|
93
|
-
...rest
|
|
94
|
-
} = sys_settings;
|
|
95
|
-
bootstrapResult.settings = {
|
|
96
|
-
featureFlags,
|
|
97
|
-
...rest
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
if (user_config && bootstrapResult.storyboards.length === 1) {
|
|
101
|
-
bootstrapResult.storyboards[0].app.userConfig = user_config;
|
|
102
|
-
} else if (user_config_by_apps) {
|
|
103
|
-
for (const {
|
|
104
|
-
app
|
|
105
|
-
} of bootstrapResult.storyboards) {
|
|
106
|
-
if ((0, _general.hasOwnProperty)(user_config_by_apps, app.id)) {
|
|
107
|
-
app.userConfig = user_config_by_apps[app.id];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function mergeRuntimeSettings(bootstrapResult, runtimeSettings) {
|
|
114
|
-
var _bootstrapResult$sett;
|
|
115
|
-
if (!runtimeSettings) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
// Merge Feature Flags & Misc
|
|
119
|
-
const {
|
|
120
|
-
featureFlags,
|
|
121
|
-
misc,
|
|
122
|
-
...rest
|
|
123
|
-
} = runtimeSettings;
|
|
124
|
-
const settings = (_bootstrapResult$sett = bootstrapResult.settings) !== null && _bootstrapResult$sett !== void 0 ? _bootstrapResult$sett : bootstrapResult.settings = {};
|
|
125
|
-
settings.featureFlags = {
|
|
126
|
-
...settings.featureFlags,
|
|
127
|
-
...featureFlags
|
|
128
|
-
};
|
|
129
|
-
settings.misc = {
|
|
130
|
-
...settings.misc,
|
|
131
|
-
...misc
|
|
132
|
-
};
|
|
133
|
-
Object.assign(settings, rest);
|
|
134
|
-
}
|
|
135
|
-
const appRuntimeDataMap = new Map();
|
|
136
|
-
async function safeGetRuntimeMicroAppStandalone(appId) {
|
|
137
|
-
if (appRuntimeDataMap.has(appId)) {
|
|
138
|
-
return appRuntimeDataMap.get(appId);
|
|
139
|
-
}
|
|
140
|
-
const promise = (0, _microAppStandaloneSdk.RuntimeApi_runtimeMicroAppStandalone)(appId).catch(error => {
|
|
141
|
-
// make it not crash when the backend service is not updated.
|
|
142
|
-
// eslint-disable-next-line no-console
|
|
143
|
-
console.warn("request standalone runtime api from micro-app-standalone failed: ", error, ", something might went wrong running standalone micro app");
|
|
144
|
-
});
|
|
145
|
-
appRuntimeDataMap.set(appId, promise);
|
|
146
|
-
return promise;
|
|
147
|
-
}
|
|
148
|
-
async function fulfilStoryboard(storyboard) {
|
|
149
|
-
if (storyboard.$$fulfilled) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (!storyboard.$$fulfilling) {
|
|
153
|
-
storyboard.$$fulfilling = doFulfilStoryboard(storyboard);
|
|
154
|
-
}
|
|
155
|
-
return storyboard.$$fulfilling;
|
|
156
|
-
}
|
|
157
|
-
async function doFulfilStoryboard(storyboard) {
|
|
158
|
-
if (window.STANDALONE_MICRO_APPS) {
|
|
159
|
-
Object.assign(storyboard, {
|
|
160
|
-
$$fulfilled: true,
|
|
161
|
-
$$fulfilling: null
|
|
162
|
-
});
|
|
163
|
-
if (!window.NO_AUTH_GUARD) {
|
|
164
|
-
let appRuntimeData;
|
|
165
|
-
try {
|
|
166
|
-
// Note: the request maybe have fired already during bootstrap.
|
|
167
|
-
appRuntimeData = await safeGetRuntimeMicroAppStandalone(storyboard.app.id);
|
|
168
|
-
} catch (error) {
|
|
169
|
-
// make it not crash when the backend service is not updated.
|
|
170
|
-
// eslint-disable-next-line no-console
|
|
171
|
-
console.warn("request standalone runtime api from micro-app-standalone failed: ", error, ", something might went wrong running standalone micro app");
|
|
172
|
-
}
|
|
173
|
-
if (appRuntimeData) {
|
|
174
|
-
const {
|
|
175
|
-
userConfig,
|
|
176
|
-
injectMenus
|
|
177
|
-
} = appRuntimeData;
|
|
178
|
-
// Merge `app.defaultConfig` and `app.userConfig` to `app.config`.
|
|
179
|
-
storyboard.app.userConfig = {
|
|
180
|
-
...storyboard.app.userConfig,
|
|
181
|
-
...userConfig
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// Initialize `overrideApp.config` in `injectMenus`
|
|
185
|
-
initializeInjectMenus(injectMenus);
|
|
186
|
-
|
|
187
|
-
// get inject menus (Actually, appRuntimeData contains both main and inject menus)
|
|
188
|
-
storyboard.meta = {
|
|
189
|
-
...storyboard.meta,
|
|
190
|
-
injectMenus
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
const {
|
|
196
|
-
routes,
|
|
197
|
-
meta,
|
|
198
|
-
app
|
|
199
|
-
} = await (0, _apiGatewaySdk.BootstrapV2Api_getAppStoryboardV2)(storyboard.app.id, {});
|
|
200
|
-
Object.assign(storyboard, {
|
|
201
|
-
routes,
|
|
202
|
-
meta,
|
|
203
|
-
app: {
|
|
204
|
-
...storyboard.app,
|
|
205
|
-
...app
|
|
206
|
-
},
|
|
207
|
-
$$fulfilled: true,
|
|
208
|
-
$$fulfilling: null
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
(0, _registerAppI18n.registerAppI18n)(storyboard);
|
|
212
|
-
initializeAppConfig(storyboard.app);
|
|
213
|
-
}
|
|
214
|
-
function initializeAppConfig(app) {
|
|
215
|
-
app.config = (0, _general.deepFreeze)((0, _lodash.merge)({}, app.defaultConfig, app.userConfig));
|
|
216
|
-
}
|
|
217
|
-
function initializeInjectMenus(menus) {
|
|
218
|
-
if (!Array.isArray(menus)) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
for (const menu of menus) {
|
|
222
|
-
if (menu.overrideApp) {
|
|
223
|
-
initializeAppConfig(menu.overrideApp);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
//# sourceMappingURL=loadBootstrapData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadBootstrapData.js","names":["_apiGatewaySdk","require","_http","_i18n","_general","_lodash","_jsYaml","_microAppStandaloneSdk","_registerAppI18n","loadBootstrapData","data","window","STANDALONE_MICRO_APPS","standaloneBootstrap","BootstrapV2Api_bootstrapV2","appFields","ignoreTemplateFields","ignoreBrickFields","app","storyboards","locales","ns","id","Object","entries","forEach","lang","resources","i18n","addResourceBundle","localeName","getFixedT","name","keys","removeResourceBundle","isObject","settings","deepFreeze","brickPackages","requests","http","get","BOOTSTRAP_FILE","APP_ROOT","responseType","BootstrapStandaloneApi_runtimeStandalone","catch","error","console","warn","NO_AUTH_GUARD","matches","appId","APP_ID","match","safeGetRuntimeMicroAppStandalone","bootstrapResult","confString","runtimeData","Promise","all","mergeConf","mergeRuntimeSettings","conf","safeLoad","schema","JSON_SCHEMA","json","undefined","Error","sys_settings","user_config","user_config_by_apps","feature_flags","featureFlags","rest","length","userConfig","hasOwnProperty","runtimeSettings","_bootstrapResult$sett","misc","assign","appRuntimeDataMap","Map","has","promise","RuntimeApi_runtimeMicroAppStandalone","set","fulfilStoryboard","storyboard","$$fulfilled","$$fulfilling","doFulfilStoryboard","appRuntimeData","injectMenus","initializeInjectMenus","meta","routes","BootstrapV2Api_getAppStoryboardV2","registerAppI18n","initializeAppConfig","config","merge","defaultConfig","menus","Array","isArray","menu","overrideApp"],"sources":["../../../src/internal/loadBootstrapData.ts"],"sourcesContent":["import {\n BootstrapStandaloneApi_runtimeStandalone,\n BootstrapV2Api_bootstrapV2,\n BootstrapV2Api_getAppStoryboardV2,\n} from \"@next-api-sdk/api-gateway-sdk\";\nimport { http } from \"@next-core/http\";\nimport type {\n BootstrapData,\n BootstrapSettings,\n MicroApp,\n RuntimeStoryboard,\n} from \"@next-core/types\";\nimport { i18n } from \"@next-core/i18n\";\nimport { deepFreeze, hasOwnProperty, isObject } from \"@next-core/utils/general\";\nimport { merge } from \"lodash\";\nimport { JSON_SCHEMA, safeLoad } from \"js-yaml\";\nimport { RuntimeApi_runtimeMicroAppStandalone } from \"@next-api-sdk/micro-app-standalone-sdk\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { MenuRawData } from \"./menu/interfaces.js\";\n\ninterface StandaloneConf {\n /** The same as `auth.bootstrap.sys_settings` in api gateway conf. */\n sys_settings: StandaloneSettings;\n\n /** For fully standalone micro-apps. */\n user_config?: Record<string, unknown>;\n\n /** For mixed standalone micro-apps. */\n user_config_by_apps?: UserConfigByApps;\n}\n\ntype UserConfigByApps = Record<string, Record<string, unknown>>;\n\ninterface StandaloneSettings extends Omit<BootstrapSettings, \"featureFlags\"> {\n feature_flags: Record<string, boolean>;\n}\n\nexport async function loadBootstrapData(): Promise<BootstrapData> {\n const data = await (window.STANDALONE_MICRO_APPS\n ? standaloneBootstrap()\n : (BootstrapV2Api_bootstrapV2({\n appFields:\n \"defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode\",\n ignoreTemplateFields: \"templates\",\n ignoreBrickFields: \"bricks,processors,providers,editors\",\n }) as Promise<BootstrapData>));\n\n for (const { app } of data.storyboards) {\n if (app.locales) {\n // Prefix to avoid conflict between brick package's i18n namespace.\n const ns = `tmp/${app.id}`;\n // Support any languages in `app.locales`.\n Object.entries(app.locales).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n // Use `app.name` as the fallback `app.localeName`.\n app.localeName = i18n.getFixedT(null, ns)(\"name\", app.name) as string;\n // Remove the temporary i18n resource bundles.\n Object.keys(app.locales).forEach((lang) => {\n i18n.removeResourceBundle(lang, ns);\n });\n } else {\n app.localeName = app.name;\n }\n }\n\n if (isObject(data.settings)) {\n deepFreeze(data.settings);\n }\n data.brickPackages = deepFreeze(data.brickPackages);\n\n return data;\n}\n\nasync function standaloneBootstrap(): Promise<BootstrapData> {\n const requests = [\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n http.get<BootstrapData>(window.BOOTSTRAP_FILE!),\n http.get<string>(`${window.APP_ROOT}conf.yaml`, {\n responseType: \"text\",\n }),\n BootstrapStandaloneApi_runtimeStandalone().catch((error) => {\n // make it not crash when the backend service is not updated.\n // eslint-disable-next-line no-console\n console.warn(\n \"request runtime api from api-gateway failed: \",\n error,\n \", something might went wrong running standalone micro app\"\n );\n }),\n ] as const;\n\n if (!window.NO_AUTH_GUARD) {\n let matches: string[] | null;\n const appId =\n window.APP_ID ||\n (window.APP_ROOT &&\n (matches = window.APP_ROOT.match(\n /^(?:(?:\\/next)?\\/)?sa-static\\/([^/]+)\\/versions\\//\n ))\n ? matches[1]\n : null);\n if (appId) {\n // No need to wait.\n safeGetRuntimeMicroAppStandalone(appId);\n }\n }\n\n const [bootstrapResult, confString, runtimeData] = await Promise.all(\n requests\n );\n\n mergeConf(bootstrapResult, confString);\n\n mergeRuntimeSettings(bootstrapResult, runtimeData?.settings);\n\n return bootstrapResult;\n}\n\nfunction mergeConf(bootstrapResult: BootstrapData, confString: string) {\n let conf: StandaloneConf | undefined;\n try {\n conf = confString\n ? (safeLoad(confString, {\n schema: JSON_SCHEMA,\n json: true,\n }) as StandaloneConf)\n : undefined;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Parse conf.yaml failed\", error);\n throw new Error(\"Invalid conf.yaml\");\n }\n\n if (conf) {\n const { sys_settings, user_config, user_config_by_apps } = conf;\n if (sys_settings) {\n const { feature_flags: featureFlags, ...rest } = sys_settings;\n bootstrapResult.settings = {\n featureFlags,\n ...rest,\n } as BootstrapSettings;\n }\n if (user_config && bootstrapResult.storyboards.length === 1) {\n bootstrapResult.storyboards[0].app.userConfig = user_config;\n } else if (user_config_by_apps) {\n for (const { app } of bootstrapResult.storyboards) {\n if (hasOwnProperty(user_config_by_apps, app.id)) {\n app.userConfig = user_config_by_apps[app.id];\n }\n }\n }\n }\n}\n\nfunction mergeRuntimeSettings(\n bootstrapResult: BootstrapData,\n runtimeSettings: BootstrapSettings | undefined\n) {\n if (!runtimeSettings) {\n return;\n }\n // Merge Feature Flags & Misc\n const { featureFlags, misc, ...rest } = runtimeSettings;\n const settings = (bootstrapResult.settings ??= {});\n settings.featureFlags = {\n ...settings.featureFlags,\n ...featureFlags,\n };\n settings.misc = {\n ...settings.misc,\n ...misc,\n };\n Object.assign(settings, rest);\n}\n\nconst appRuntimeDataMap = new Map<\n string,\n Promise<RuntimeMicroAppStandaloneData | undefined>\n>();\n\ninterface RuntimeMicroAppStandaloneData {\n userConfig?: Record<string, unknown>;\n injectMenus?: MenuRawData[];\n}\n\nexport async function safeGetRuntimeMicroAppStandalone(appId: string) {\n if (appRuntimeDataMap.has(appId)) {\n return appRuntimeDataMap.get(appId);\n }\n const promise = RuntimeApi_runtimeMicroAppStandalone(appId).catch((error) => {\n // make it not crash when the backend service is not updated.\n // eslint-disable-next-line no-console\n console.warn(\n \"request standalone runtime api from micro-app-standalone failed: \",\n error,\n \", something might went wrong running standalone micro app\"\n );\n }) as Promise<RuntimeMicroAppStandaloneData | undefined>;\n appRuntimeDataMap.set(appId, promise);\n return promise;\n}\n\nexport async function fulfilStoryboard(storyboard: RuntimeStoryboard) {\n if (storyboard.$$fulfilled) {\n return;\n }\n if (!storyboard.$$fulfilling) {\n storyboard.$$fulfilling = doFulfilStoryboard(storyboard);\n }\n return storyboard.$$fulfilling;\n}\n\nasync function doFulfilStoryboard(storyboard: RuntimeStoryboard) {\n if (window.STANDALONE_MICRO_APPS) {\n Object.assign(storyboard, {\n $$fulfilled: true,\n $$fulfilling: null,\n });\n if (!window.NO_AUTH_GUARD) {\n let appRuntimeData: RuntimeMicroAppStandaloneData | void;\n try {\n // Note: the request maybe have fired already during bootstrap.\n appRuntimeData = await safeGetRuntimeMicroAppStandalone(\n storyboard.app.id\n );\n } catch (error) {\n // make it not crash when the backend service is not updated.\n // eslint-disable-next-line no-console\n console.warn(\n \"request standalone runtime api from micro-app-standalone failed: \",\n error,\n \", something might went wrong running standalone micro app\"\n );\n }\n if (appRuntimeData) {\n const { userConfig, injectMenus } = appRuntimeData;\n // Merge `app.defaultConfig` and `app.userConfig` to `app.config`.\n storyboard.app.userConfig = {\n ...storyboard.app.userConfig,\n ...userConfig,\n };\n\n // Initialize `overrideApp.config` in `injectMenus`\n initializeInjectMenus(injectMenus);\n\n // get inject menus (Actually, appRuntimeData contains both main and inject menus)\n storyboard.meta = {\n ...storyboard.meta,\n injectMenus,\n };\n }\n }\n } else {\n const { routes, meta, app } = await BootstrapV2Api_getAppStoryboardV2(\n storyboard.app.id,\n {}\n );\n Object.assign(storyboard, {\n routes,\n meta,\n app: { ...storyboard.app, ...app },\n $$fulfilled: true,\n $$fulfilling: null,\n });\n }\n\n registerAppI18n(storyboard);\n\n initializeAppConfig(storyboard.app);\n}\n\nfunction initializeAppConfig(app: MicroApp) {\n app.config = deepFreeze(merge({}, app.defaultConfig, app.userConfig));\n}\n\nfunction initializeInjectMenus(menus: MenuRawData[] | undefined) {\n if (!Array.isArray(menus)) {\n return;\n }\n for (const menu of menus) {\n if (menu.overrideApp) {\n initializeAppConfig(menu.overrideApp);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAoBO,eAAeQ,iBAAiBA,CAAA,EAA2B;EAChE,MAAMC,IAAI,GAAG,OAAOC,MAAM,CAACC,qBAAqB,GAC5CC,mBAAmB,EAAE,GACpB,IAAAC,yCAA0B,EAAC;IAC1BC,SAAS,EACP,qHAAqH;IACvHC,oBAAoB,EAAE,WAAW;IACjCC,iBAAiB,EAAE;EACrB,CAAC,CAA4B,CAAC;EAElC,KAAK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