@dxos/app-framework 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
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/.storybook/main.mts +9 -0
- package/.storybook/preview.mts +8 -0
- package/dist/lib/browser/capability-5RRH3WIB.mjs +35 -0
- package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
- package/dist/lib/browser/capability-LUKGKUQH.mjs +38 -0
- package/dist/lib/browser/capability-LUKGKUQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-23D4SJUE.mjs +42 -0
- package/dist/lib/browser/chunk-23D4SJUE.mjs.map +7 -0
- package/dist/lib/browser/chunk-3JWJXGLK.mjs +79 -0
- package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
- package/dist/lib/browser/chunk-66IXTIVK.mjs +48 -0
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/chunk-7VZJR2OA.mjs +581 -0
- package/dist/lib/browser/chunk-7VZJR2OA.mjs.map +7 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs.map +7 -0
- package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
- package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs +469 -0
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs.map +7 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBHCSOBW.mjs +80 -0
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z55LVAGN.mjs +213 -0
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs +142 -0
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +76 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/common/activation-events.mjs +24 -0
- package/dist/lib/browser/common/capabilities.mjs +46 -0
- package/dist/lib/browser/core/activation-event.mjs +20 -0
- package/dist/lib/browser/core/capability.mjs +30 -0
- package/dist/lib/browser/core/capability.mjs.map +7 -0
- package/dist/lib/browser/core/plugin-manager.mjs +19 -0
- package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/browser/core/plugin.mjs +37 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/core/url-loader.mjs +24 -0
- package/dist/lib/browser/core/url-loader.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +108 -162
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs +44 -0
- package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +235 -48
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +48 -0
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/capability-FCGZVIEG.mjs +39 -0
- package/dist/lib/node-esm/capability-FCGZVIEG.mjs.map +7 -0
- package/dist/lib/node-esm/capability-JOIQ2MQE.mjs +36 -0
- package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +10 -0
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D347W3KO.mjs +143 -0
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs +470 -0
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs +214 -0
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SBS2YMPT.mjs +43 -0
- package/dist/lib/node-esm/chunk-SBS2YMPT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs +80 -0
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V24UWT36.mjs +582 -0
- package/dist/lib/node-esm/chunk-V24UWT36.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs +81 -0
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs +49 -0
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +77 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/common/activation-events.mjs +25 -0
- package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
- package/dist/lib/node-esm/common/capabilities.mjs +47 -0
- package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
- package/dist/lib/node-esm/core/activation-event.mjs +21 -0
- package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
- package/dist/lib/node-esm/core/capability.mjs +31 -0
- package/dist/lib/node-esm/core/capability.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs +20 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin.mjs +38 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/core/url-loader.mjs +25 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +108 -162
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs +45 -0
- package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +235 -48
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +49 -0
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +893 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/cli/cli.d.ts +39 -0
- package/dist/types/src/cli/cli.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/common/activation-events.d.ts +27 -0
- package/dist/types/src/common/activation-events.d.ts.map +1 -0
- package/dist/types/src/common/annotations.d.ts +1 -0
- package/dist/types/src/common/annotations.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +110 -190
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +4 -8
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +19 -0
- package/dist/types/src/common/operations.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +8 -8
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/context.d.ts +5 -0
- package/dist/types/src/context.d.ts.map +1 -0
- package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +11 -11
- package/dist/types/src/core/activation-event.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.d.ts +48 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.test.d.ts +2 -0
- package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/capability.d.ts +156 -0
- package/dist/types/src/core/capability.d.ts.map +1 -0
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +11 -4
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +239 -0
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.d.ts +101 -0
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +208 -37
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +101 -0
- package/dist/types/src/core/registry.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.d.ts +127 -0
- package/dist/types/src/core/url-loader.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.test.d.ts +2 -0
- package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts +32 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
- package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +101 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/index.d.ts +3 -0
- package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/meta.d.ts +3 -0
- package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/testing.d.ts +59 -0
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/index.d.ts +2 -0
- package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
- package/dist/types/src/testing/harness.d.ts +67 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- package/dist/types/src/testing/service.d.ts +8 -0
- package/dist/types/src/testing/service.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +8 -9
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.d.ts +9 -0
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts +19 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/index.d.ts +2 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/{playground/playground.stories.d.ts → ui/components/PluginManager/PluginManagerContext.stories.d.ts} +5 -4
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +24 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{components/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -2
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +11 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
- package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +36 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.d.ts +197 -0
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +5 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/index.d.ts +6 -0
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.d.ts +89 -0
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts +31 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/{components → ui/hooks}/useLoading.d.ts +1 -2
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts +10 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
- package/dist/types/src/ui/index.d.ts +3 -0
- package/dist/types/src/ui/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +5 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +13 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +26 -3
- package/package.json +114 -54
- package/src/cli/cli.ts +107 -0
- package/src/{playground/logger → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/{components/index.ts → common/annotations.ts} +0 -2
- package/src/common/capabilities.ts +169 -195
- package/src/common/index.ts +4 -8
- package/src/common/operations.ts +35 -0
- package/src/common/translations.ts +18 -10
- package/src/context.ts +9 -0
- package/src/core/{events.ts → activation-event.ts} +10 -7
- package/src/core/capability-manager.test.ts +151 -0
- package/src/core/capability-manager.ts +192 -0
- package/src/core/capability.ts +247 -0
- package/src/core/edge-registry-plugin-provider.ts +92 -0
- package/src/core/index.ts +11 -4
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +1671 -0
- package/src/core/plugin-manager.ts +1335 -0
- package/src/core/plugin-manifest.test.ts +75 -0
- package/src/core/plugin-manifest.ts +134 -0
- package/src/core/plugin.ts +369 -43
- package/src/core/registry.ts +157 -0
- package/src/core/url-loader.test.ts +221 -0
- package/src/core/url-loader.ts +388 -0
- package/src/index.ts +3 -4
- package/src/plugin-operation/OperationPlugin.ts +24 -0
- package/src/plugin-operation/history/capability.ts +36 -0
- package/src/plugin-operation/history/errors.ts +7 -0
- package/src/plugin-operation/history/history-tracker.test.ts +374 -0
- package/src/plugin-operation/history/history-tracker.ts +128 -0
- package/src/plugin-operation/history/index.ts +9 -0
- package/src/plugin-operation/history/types.ts +17 -0
- package/src/plugin-operation/history/undo-mapping.ts +135 -0
- package/src/plugin-operation/history/undo-registry.test.ts +72 -0
- package/src/plugin-operation/history/undo-registry.ts +54 -0
- package/src/plugin-operation/index.ts +6 -0
- package/src/plugin-operation/invoker-capability.ts +55 -0
- package/src/plugin-operation/meta.ts +12 -0
- package/src/plugin-operation/testing.ts +155 -0
- package/src/plugin-runtime/RuntimePlugin.ts +19 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/plugin-runtime/index.ts +5 -0
- package/src/plugin-runtime/meta.ts +12 -0
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +9 -10
- package/src/testing/withPluginManager.tsx +74 -50
- package/src/ui/components/App/App.stories.tsx +88 -0
- package/src/ui/components/App/App.tsx +81 -0
- package/src/{playground/layout → ui/components/App}/index.ts +1 -1
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/{playground/debug → ui/components/Placeholder}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +185 -0
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +3 -3
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +144 -0
- package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
- package/src/ui/components/Surface/SurfaceInfo.tsx +106 -0
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/context.ts +12 -0
- package/src/ui/components/Surface/index.ts +54 -0
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +269 -0
- package/src/ui/components/index.ts +8 -0
- package/src/ui/hooks/index.ts +9 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +424 -0
- package/src/ui/hooks/useCapabilities.ts +67 -0
- package/src/{components → ui/hooks}/useLoading.tsx +16 -10
- package/src/ui/hooks/useSettingsState.ts +26 -0
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
- package/src/vite-plugin/boot-loader/index.ts +5 -0
- package/src/vite-plugin/boot-loader/loader.ts +123 -0
- package/src/vite-plugin/composer/index.ts +306 -0
- package/src/vite-plugin/import-map/index.ts +527 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +46 -0
- package/src/vite-plugin/manifest.ts +57 -0
- package/src/vite-plugin/packages.ts +187 -0
- package/tsconfig.json +24 -15
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +8 -6
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs +0 -137
- package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs +0 -32
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZY7HV2A.mjs +0 -1643
- package/dist/lib/browser/chunk-OZY7HV2A.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6M7JB7M.mjs +0 -471
- package/dist/lib/browser/chunk-T6M7JB7M.mjs.map +0 -7
- package/dist/lib/browser/intent-dispatcher-QG7UPGQX.mjs +0 -11
- package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs +0 -39
- package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs.map +0 -7
- package/dist/lib/browser/store-6E33KLGK.mjs +0 -30
- package/dist/lib/browser/store-6E33KLGK.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -85
- package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs +0 -138
- package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F63ZRXMK.mjs +0 -1645
- package/dist/lib/node-esm/chunk-F63ZRXMK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HJFU7QOR.mjs +0 -472
- package/dist/lib/node-esm/chunk-HJFU7QOR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs +0 -34
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-dispatcher-NXBGPJOX.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs.map +0 -7
- package/dist/lib/node-esm/store-QQUTQHHT.mjs +0 -31
- package/dist/lib/node-esm/store-QQUTQHHT.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -86
- package/dist/types/src/common/collaboration.d.ts +0 -20
- package/dist/types/src/common/collaboration.d.ts.map +0 -1
- package/dist/types/src/common/events.d.ts +0 -52
- package/dist/types/src/common/events.d.ts.map +0 -1
- package/dist/types/src/common/file.d.ts +0 -14
- package/dist/types/src/common/file.d.ts.map +0 -1
- package/dist/types/src/common/graph.d.ts +0 -21
- package/dist/types/src/common/graph.d.ts.map +0 -1
- package/dist/types/src/common/layout.d.ts +0 -281
- package/dist/types/src/common/layout.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts +0 -65
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/components/App.d.ts +0 -10
- package/dist/types/src/components/App.d.ts.map +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/components/DefaultFallback.d.ts +0 -8
- package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/components/useApp.d.ts +0 -44
- package/dist/types/src/components/useApp.d.ts.map +0 -1
- package/dist/types/src/components/useLoading.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.d.ts +0 -117
- package/dist/types/src/core/capabilities.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.test.d.ts +0 -2
- package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
- package/dist/types/src/core/events.d.ts.map +0 -1
- package/dist/types/src/core/manager.d.ts +0 -126
- package/dist/types/src/core/manager.d.ts.map +0 -1
- package/dist/types/src/core/manager.test.d.ts +0 -2
- package/dist/types/src/core/manager.test.d.ts.map +0 -1
- package/dist/types/src/playground/debug/Debug.d.ts +0 -6
- package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
- package/dist/types/src/playground/debug/index.d.ts +0 -2
- package/dist/types/src/playground/debug/index.d.ts.map +0 -1
- package/dist/types/src/playground/debug/plugin.d.ts +0 -2
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -6
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -7
- package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
- package/dist/types/src/playground/generator/index.d.ts +0 -3
- package/dist/types/src/playground/generator/index.d.ts.map +0 -1
- package/dist/types/src/playground/generator/plugin.d.ts +0 -2
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -8
- package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
- package/dist/types/src/playground/layout/index.d.ts +0 -2
- package/dist/types/src/playground/layout/index.d.ts.map +0 -1
- package/dist/types/src/playground/layout/plugin.d.ts +0 -2
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/logger/index.d.ts +0 -2
- package/dist/types/src/playground/logger/index.d.ts.map +0 -1
- package/dist/types/src/playground/logger/plugin.d.ts +0 -2
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -13
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/actions.d.ts +0 -38
- package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/errors.d.ts +0 -16
- package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/index.d.ts +0 -6
- package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent.d.ts +0 -63
- package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -2
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -27
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -4
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/index.d.ts +0 -3
- package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/store.d.ts +0 -5
- package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/translations.d.ts +0 -10
- package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/react/IntentContext.d.ts +0 -8
- package/dist/types/src/react/IntentContext.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerProvider.d.ts +0 -10
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -12
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts +0 -18
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts +0 -13
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -7
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts +0 -13
- package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
- package/dist/types/src/react/useIntentResolver.d.ts +0 -3
- package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/common/collaboration.ts +0 -18
- package/src/common/events.ts +0 -79
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/layout.ts +0 -278
- package/src/common/surface.ts +0 -86
- package/src/components/App.stories.tsx +0 -35
- package/src/components/App.tsx +0 -59
- package/src/components/DefaultFallback.tsx +0 -26
- package/src/components/useApp.tsx +0 -166
- package/src/core/capabilities.test.ts +0 -136
- package/src/core/capabilities.ts +0 -259
- package/src/core/manager.test.ts +0 -516
- package/src/core/manager.ts +0 -597
- package/src/playground/debug/Debug.tsx +0 -39
- package/src/playground/debug/plugin.ts +0 -17
- package/src/playground/generator/Main.tsx +0 -71
- package/src/playground/generator/Toolbar.tsx +0 -47
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -23
- package/src/playground/layout/Layout.tsx +0 -33
- package/src/playground/layout/plugin.ts +0 -17
- package/src/playground/logger/Toolbar.tsx +0 -30
- package/src/playground/logger/plugin.ts +0 -37
- package/src/playground/logger/schema.ts +0 -12
- package/src/playground/playground.stories.tsx +0 -47
- package/src/plugin-intent/IntentPlugin.ts +0 -21
- package/src/plugin-intent/actions.ts +0 -33
- package/src/plugin-intent/errors.ts +0 -39
- package/src/plugin-intent/index.ts +0 -9
- package/src/plugin-intent/intent-dispatcher.test.ts +0 -279
- package/src/plugin-intent/intent-dispatcher.ts +0 -335
- package/src/plugin-intent/intent.ts +0 -154
- package/src/plugin-settings/SettingsPlugin.ts +0 -36
- package/src/plugin-settings/actions.ts +0 -29
- package/src/plugin-settings/app-graph-builder.ts +0 -158
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/intent-resolver.ts +0 -35
- package/src/plugin-settings/store.ts +0 -33
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/ErrorBoundary.tsx +0 -54
- package/src/react/IntentContext.tsx +0 -35
- package/src/react/Surface.stories.tsx +0 -104
- package/src/react/Surface.tsx +0 -78
- package/src/react/common.ts +0 -13
- package/src/react/index.ts +0 -10
- package/src/react/useCapabilities.ts +0 -31
- package/src/react/useIntentResolver.ts +0 -22
- package/src/worker.ts +0 -11
- /package/dist/lib/{node-esm/worker.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-NXBGPJOX.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → common/capabilities.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.mjs.map → core/activation-event.mjs.map} +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getModuleTag
|
|
4
|
+
} from "./chunk-SDJ4B2LU.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
8
|
+
|
|
9
|
+
// src/core/plugin.ts
|
|
10
|
+
var plugin_exports = {};
|
|
11
|
+
__export(plugin_exports, {
|
|
12
|
+
LazyPluginError: () => LazyPluginError,
|
|
13
|
+
PluginModuleTypeId: () => PluginModuleTypeId,
|
|
14
|
+
PluginTypeId: () => PluginTypeId,
|
|
15
|
+
Service: () => Service,
|
|
16
|
+
activate: () => activate,
|
|
17
|
+
addModule: () => addModule,
|
|
18
|
+
define: () => define,
|
|
19
|
+
isLazy: () => isLazy,
|
|
20
|
+
isPlugin: () => isPlugin,
|
|
21
|
+
isPluginModule: () => isPluginModule,
|
|
22
|
+
lazy: () => lazy,
|
|
23
|
+
make: () => make,
|
|
24
|
+
reset: () => reset,
|
|
25
|
+
resolveLazy: () => resolveLazy,
|
|
26
|
+
shutdown: () => shutdown
|
|
27
|
+
});
|
|
28
|
+
import * as Context from "effect/Context";
|
|
29
|
+
import * as Effect from "effect/Effect";
|
|
30
|
+
import * as Option from "effect/Option";
|
|
31
|
+
import * as Pipeable from "effect/Pipeable";
|
|
32
|
+
import { BaseError } from "@dxos/errors";
|
|
33
|
+
import { invariant } from "@dxos/invariant";
|
|
34
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin.ts";
|
|
35
|
+
var Service = class extends Context.Tag("@dxos/app-framework/PluginManager")() {
|
|
36
|
+
};
|
|
37
|
+
var activate = (event) => Effect.flatMap(Service, (manager) => manager.activate(event));
|
|
38
|
+
var reset = (event) => Effect.flatMap(Service, (manager) => manager.reset(event));
|
|
39
|
+
var shutdown = () => Effect.flatMap(Service, (manager) => manager.shutdown());
|
|
40
|
+
var computeModuleId = (pluginId, moduleName) => {
|
|
41
|
+
return `${pluginId}.module.${moduleName}`;
|
|
42
|
+
};
|
|
43
|
+
var PluginModuleTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/PluginModule");
|
|
44
|
+
var isPluginModule = (value) => {
|
|
45
|
+
return typeof value === "object" && value !== null && PluginModuleTypeId in value;
|
|
46
|
+
};
|
|
47
|
+
var PluginModuleImpl = class {
|
|
48
|
+
[PluginModuleTypeId] = PluginModuleTypeId;
|
|
49
|
+
id;
|
|
50
|
+
activatesOn;
|
|
51
|
+
firesBeforeActivation;
|
|
52
|
+
firesAfterActivation;
|
|
53
|
+
activate;
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.id = options.id;
|
|
56
|
+
this.activatesOn = options.activatesOn;
|
|
57
|
+
this.firesBeforeActivation = options.firesBeforeActivation;
|
|
58
|
+
this.firesAfterActivation = options.firesAfterActivation;
|
|
59
|
+
this.activate = options.activate;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var PluginTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Plugin");
|
|
63
|
+
var isPlugin = (value) => {
|
|
64
|
+
return typeof value === "object" && value !== null && PluginTypeId in value;
|
|
65
|
+
};
|
|
66
|
+
var PluginImpl = class {
|
|
67
|
+
_meta;
|
|
68
|
+
_modules;
|
|
69
|
+
[PluginTypeId] = PluginTypeId;
|
|
70
|
+
constructor(_meta, _modules) {
|
|
71
|
+
this._meta = _meta;
|
|
72
|
+
this._modules = _modules;
|
|
73
|
+
}
|
|
74
|
+
get meta() {
|
|
75
|
+
return this._meta;
|
|
76
|
+
}
|
|
77
|
+
get modules() {
|
|
78
|
+
return this._modules;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var PluginBuilderImpl = class {
|
|
82
|
+
meta;
|
|
83
|
+
_modules = [];
|
|
84
|
+
constructor(meta) {
|
|
85
|
+
this.meta = meta;
|
|
86
|
+
}
|
|
87
|
+
get modules() {
|
|
88
|
+
return this._modules;
|
|
89
|
+
}
|
|
90
|
+
addModule(moduleOptions) {
|
|
91
|
+
this._modules.push(moduleOptions);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
pipe() {
|
|
95
|
+
return Pipeable.pipeArguments(this, arguments);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var define = (meta) => new PluginBuilderImpl(meta);
|
|
99
|
+
function addModule(moduleOptionsOrBuilder, moduleOptions) {
|
|
100
|
+
if (moduleOptions !== void 0) {
|
|
101
|
+
return moduleOptionsOrBuilder.addModule(moduleOptions);
|
|
102
|
+
}
|
|
103
|
+
const moduleOpts = moduleOptionsOrBuilder;
|
|
104
|
+
return (builder) => builder.addModule(moduleOpts);
|
|
105
|
+
}
|
|
106
|
+
var resolveModule = (meta, module, options) => {
|
|
107
|
+
const moduleOptions = typeof module === "function" ? module(options) : module;
|
|
108
|
+
const id = Option.fromNullable(moduleOptions.id).pipe(Option.match({
|
|
109
|
+
onNone: () => {
|
|
110
|
+
const exportName = getModuleTag(moduleOptions.activate);
|
|
111
|
+
invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 131, S: void 0, A: ["exportName", "`Plugin module missing name. Plugin: ${meta.id}`"] });
|
|
112
|
+
return computeModuleId(meta.id, exportName);
|
|
113
|
+
},
|
|
114
|
+
onSome: (id2) => computeModuleId(meta.id, id2)
|
|
115
|
+
}));
|
|
116
|
+
return new PluginModuleImpl({
|
|
117
|
+
...moduleOptions,
|
|
118
|
+
id
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
function make(builder) {
|
|
122
|
+
const meta = builder.meta;
|
|
123
|
+
const factory = (options) => {
|
|
124
|
+
const modules = builder.modules.map((module) => resolveModule(meta, module, options));
|
|
125
|
+
return new PluginImpl(meta, modules);
|
|
126
|
+
};
|
|
127
|
+
return Object.assign(factory, {
|
|
128
|
+
meta
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
var LazyTag = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Plugin/Lazy");
|
|
132
|
+
var lazy = (meta, loader) => {
|
|
133
|
+
const factory = (options) => {
|
|
134
|
+
const stub = new PluginImpl(meta, []);
|
|
135
|
+
Object.defineProperty(stub, LazyTag, {
|
|
136
|
+
value: {
|
|
137
|
+
loader,
|
|
138
|
+
options
|
|
139
|
+
},
|
|
140
|
+
enumerable: false
|
|
141
|
+
});
|
|
142
|
+
return stub;
|
|
143
|
+
};
|
|
144
|
+
return Object.assign(factory, {
|
|
145
|
+
meta
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
var isLazy = (plugin) => LazyTag in plugin;
|
|
149
|
+
var LazyPluginError = class extends BaseError.extend("LazyPluginError", "Failed to resolve lazy plugin") {
|
|
150
|
+
};
|
|
151
|
+
var resolveLazy = (plugin) => Effect.gen(function* () {
|
|
152
|
+
if (!isLazy(plugin)) {
|
|
153
|
+
return plugin;
|
|
154
|
+
}
|
|
155
|
+
const id = plugin.meta.id;
|
|
156
|
+
const { loader, options } = plugin[LazyTag];
|
|
157
|
+
const mod = yield* Effect.tryPromise({
|
|
158
|
+
try: loader,
|
|
159
|
+
catch: (error) => new LazyPluginError({
|
|
160
|
+
context: {
|
|
161
|
+
id,
|
|
162
|
+
reason: "load-failed"
|
|
163
|
+
},
|
|
164
|
+
cause: error
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
if (!mod || typeof mod.default !== "function") {
|
|
168
|
+
return yield* Effect.fail(new LazyPluginError({
|
|
169
|
+
context: {
|
|
170
|
+
id,
|
|
171
|
+
reason: "missing-default"
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
const result = mod.default(options);
|
|
176
|
+
if (!isPlugin(result)) {
|
|
177
|
+
return yield* Effect.fail(new LazyPluginError({
|
|
178
|
+
context: {
|
|
179
|
+
id,
|
|
180
|
+
reason: "invalid-plugin"
|
|
181
|
+
}
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
if (result.meta.id !== id) {
|
|
185
|
+
return yield* Effect.fail(new LazyPluginError({
|
|
186
|
+
context: {
|
|
187
|
+
id,
|
|
188
|
+
reason: "meta-mismatch",
|
|
189
|
+
returnedId: result.meta.id
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
return result;
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export {
|
|
197
|
+
Service,
|
|
198
|
+
activate,
|
|
199
|
+
reset,
|
|
200
|
+
shutdown,
|
|
201
|
+
PluginModuleTypeId,
|
|
202
|
+
isPluginModule,
|
|
203
|
+
PluginTypeId,
|
|
204
|
+
isPlugin,
|
|
205
|
+
define,
|
|
206
|
+
addModule,
|
|
207
|
+
make,
|
|
208
|
+
lazy,
|
|
209
|
+
isLazy,
|
|
210
|
+
LazyPluginError,
|
|
211
|
+
resolveLazy,
|
|
212
|
+
plugin_exports
|
|
213
|
+
};
|
|
214
|
+
//# sourceMappingURL=chunk-HTBJU5FX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/core/plugin.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { BaseError } from '@dxos/errors';\nimport { invariant } from '@dxos/invariant';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Shuts down the plugin manager, deactivating all active modules and clearing lifecycle state.\n * Accesses the PluginManager via the Effect layer system.\n */\nexport const shutdown = (): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.shutdown());\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}.module.${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events that this module fires *before* its own activation runs.\n *\n * When this module is asked to activate (via {@link activatesOn}), the\n * plugin manager first activates every event listed here, ensuring any\n * other modules that contribute to those events have completed before\n * this module's {@link activate} body executes. These events are fired\n * by the framework on this module's behalf — the module does not need\n * to wait for some other code to fire them.\n *\n * The module is marked as needing reset if a module activated by one\n * of these events is later removed.\n *\n * Read as: \"this module fires these events before [its] activation\".\n */\n firesBeforeActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events that this module fires *after* its own activation completes.\n *\n * Once this module's {@link activate} body has finished executing, the\n * plugin manager activates every event listed here, causing any modules\n * listening on those events to run. These events are fired by the\n * framework on this module's behalf as part of this module's lifecycle.\n *\n * Read as: \"this module fires these events after [its] activation\".\n */\n firesAfterActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly firesBeforeActivation?: PluginModule['firesBeforeActivation'];\n readonly firesAfterActivation?: PluginModule['firesAfterActivation'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.firesBeforeActivation = options.firesBeforeActivation;\n this.firesAfterActivation = options.firesAfterActivation;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example org.dxos.plugin.example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Name of the author or organization that created the plugin.\n */\n author?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n};\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// TODO(burdon): Convert to ECHO schema.\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(meta.id, exportName);\n },\n onSome: (id) => computeModuleId(meta.id, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n\n//\n// Lazy plugin loading\n//\n\n/**\n * Symbol used to tag lazy plugin stubs with their loader closure.\n * Hidden from enumeration so plugin manager iteration / serialization paths\n * don't trip over it.\n */\nconst LazyTag: unique symbol = Symbol.for('@dxos/app-framework/Plugin/Lazy');\n\n/**\n * Async loader for a lazy plugin's real implementation.\n * The default export of the loaded module must be a `PluginFactory<T>` —\n * i.e. the same shape `Plugin.make` produces.\n */\nexport type LazyLoader<T = void> = () => Promise<{ default: PluginFactory<T> }>;\n\n/** Internal: payload carried on a lazy stub. */\ntype LazyPayload = { loader: LazyLoader<any>; options: unknown };\n\n/**\n * Defines a lazy plugin whose body is loaded on first enable.\n *\n * The returned factory produces a stub `Plugin` that exposes `meta`\n * synchronously (so callers can read `Plugin.meta.id` for free) but defers\n * loading the real plugin's modules until the manager calls\n * `Plugin.resolveLazy`. This lets the plugin's main entry point ship as a\n * tiny meta-only chunk — the heavy capabilities, schema, React surfaces,\n * etc. live behind the dynamic `import()` and become a separate Rollup\n * chunk that is only fetched when the plugin is enabled.\n *\n * @example\n * ```ts\n * // plugin-markdown/src/index.ts\n * import { Plugin } from '@dxos/app-framework';\n * import { meta } from './meta';\n *\n * export const MarkdownPlugin = Plugin.lazy(meta, () => import('./MarkdownPlugin'));\n *\n * // plugin-markdown/src/MarkdownPlugin.tsx\n * export const MarkdownPlugin = Plugin.define(meta).pipe(...heavy modules..., Plugin.make);\n * export default MarkdownPlugin;\n * ```\n */\nexport const lazy = <T = void>(meta: Meta, loader: LazyLoader<T>): PluginFactory<T> => {\n const factory = (options: T): Plugin => {\n const stub = new PluginImpl(meta, []);\n Object.defineProperty(stub, LazyTag, {\n value: { loader, options } satisfies LazyPayload,\n enumerable: false,\n });\n return stub;\n };\n return Object.assign(factory, { meta });\n};\n\n/**\n * Type guard for lazy plugin stubs produced by {@link lazy}.\n */\nexport const isLazy = (plugin: Plugin): boolean => LazyTag in plugin;\n\n/**\n * Tagged error for failures during lazy plugin resolution. `context.id` is\n * the lazy plugin's `meta.id`; `context.reason` discriminates the failure\n * mode (`'load-failed' | 'missing-default' | 'invalid-plugin' |\n * 'meta-mismatch'`) so callers can route on it.\n */\nexport class LazyPluginError extends BaseError.extend('LazyPluginError', 'Failed to resolve lazy plugin') {}\n\n/**\n * Resolves a lazy plugin stub to its real plugin.\n * Returns the plugin unchanged if it is not lazy. Failures surface as\n * {@link LazyPluginError} with `context.reason` indicating the failure mode\n * and (for loader failures) `cause` set to the original error.\n */\nexport const resolveLazy = (plugin: Plugin): Effect.Effect<Plugin, LazyPluginError> =>\n Effect.gen(function* () {\n if (!isLazy(plugin)) {\n return plugin;\n }\n const id = plugin.meta.id;\n const { loader, options } = (plugin as unknown as { [LazyTag]: LazyPayload })[LazyTag];\n const mod = yield* Effect.tryPromise({\n try: loader,\n catch: (error) => new LazyPluginError({ context: { id, reason: 'load-failed' }, cause: error }),\n });\n if (!mod || typeof mod.default !== 'function') {\n return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'missing-default' } }));\n }\n const result = mod.default(options);\n if (!isPlugin(result)) {\n return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'invalid-plugin' } }));\n }\n if (result.meta.id !== id) {\n return yield* Effect.fail(\n new LazyPluginError({ context: { id, reason: 'meta-mismatch', returnedId: result.meta.id } }),\n );\n }\n return result;\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAM1B,IAAE,eAAA;AAUA,IAAA,UAAA,cAAA,YAAA,mCAAA,EAAA,EAAA;AACF;;;;AAiCA,IAAA,kBAAA,CAAA,UAAA,eAAA;AAEA,SAAA,GAAA,QAAA,WAAA,UAAA;;;AAWE,IAAA,iBAAA,CAAA,UAAA;AA2DF,SAAMC,OAAAA,UAAAA,YAAAA,UAAAA,QAAAA,sBAAAA;;IAEKC,yBAAuB;EACvBC,CAAAA,kBAAyC,IAAA;EACzCC;EACAC;EACAC;EAET;;cAEOH,SAAW;AAChB,SAAKC,KAAAA,QAAAA;AACL,SAAKC,cAAAA,QAAoB;AACzB,SAAKC,wBAAmBA,QAAQ;AAClC,SAAA,uBAAA,QAAA;AACF,SAAA,WAAA,QAAA;EA0DA;;;AAWE,IAAA,WAAA,CAAA,UAAA;AAaF,SAAA,OAAA,UAAA,YAAA,UAAA,QAAA,gBAAA;;;EAKW;EAET;eACmBC,IAAAA;cACAC,OAAAA,UAAAA;AAChB,SAAA,QAAA;AAECC,SAAAA,WAAuB;;EAE3B,IAAA,OAAA;AAEIC,WAAAA,KAAuC;;EAE3C,IAAA,UAAA;AACF,WAAA,KAAA;EAWA;;AAKmBF,IAAAA,oBAAAA,MAAkF;EAEnG;aACOC,CAAAA;EACP,YAAA,MAAA;AAEIC,SAAAA,OAAsF;;EAE1F,IAAA,UAAA;AAEAC,WAAUC,KAAAA;;YAER,eAAW;AACb,SAAA,SAAA,KAAA,aAAA;AAEAC,WAAO;;SAEL;AAEJ,WAAA,uBAAA,MAAA,SAAA;EAEA;;AAqBE,IAAA,SAAA,CAAA,SAAA,IAAA,kBAAA,IAAA;AACA,SAAID,UAAkBE,wBAAW,eAAA;AAEjC,MAAA,kBAAA,QAAA;AACA,WAAA,uBAAA,UAAA,aAAA;EACA;AAEF,QAAA,aAAA;AAIA,SAAA,CAAA,YAAA,QAAA,UAAA,UAAA;;AASE,IAAMZ,gBAAYa,CAAAA,MAAAA,QAAaH,YAAgB;QAE3CI,gBAAQ,OAAA,WAAA,aAAA,OAAA,OAAA,IAAA;aACAC,oBAAaC,cAAWC,EAAAA,EAAAA,KAAaP,aAAcN;YACzDc,MAAAA;AACA,YAAA,aAA8B,aAAEH,cAAAA,QAAAA;AAClC,gBAAA,YAAA,uCAAA,KAAA,EAAA,IAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,KAAA,GAAA,QAAA,GAAA,CAAA,cAAA,kDAAA,EAAA,CAAA;AACAI,aAASnB,gBAAOoB,KAAgBb,IAAKP,UAAIA;IAC3C;IAEF,QAAWD,CAAAA,QAAAA,gBAAiB,KAAA,IAAAC,GAAA;;SAAoBA,IAAAA,iBAAAA;IAAG,GAAA;IACrD;EASA,CAAA;;AAGE,SAAMqB,KAAWC,SAAAA;QACf,OAAMd,QAAUe;QAChB,UAAWC,CAAAA,YAAWjB;AACxB,UAAA,UAAA,QAAA,QAAA,IAAA,CAAA,WAAA,cAAA,MAAA,QAAA,OAAA,CAAA;AAEA,WAAOkB,IAAOC,WAAOL,MAAS,OAAA;;AAAO,SAAA,OAAA,OAAA,SAAA;IACvC;EAEE,CAAA;AACF;;AA8CI,IAAMM,OAAO,CAAIH,MAAAA,WAAWjB;QAC5BkB,UAAOG,CAAAA,YAAeD;UACpBE,OAAO,IAAA,WAAA,MAAA,CAAA,CAAA;0BAAEC,MAAAA,SAAAA;aAAQR;QAAQ;QACzBS;MACF;MACA,YAAOJ;IACT,CAAA;AACA,WAAOF;;AAA8B,SAAA,OAAA,OAAA,SAAA;IACrC;EAEF,CAAA;;;AAaA,IAAA,kBAAA,cAAA,UAAA,OAAA,mBAAA,+BAAA,EAAA;;IASM,cAAOO,CAAAA,WAAAA,WAAAA,aAAAA;AACT,MAAA,CAAA,OAAA,MAAA,GAAA;AACA,WAAWA;EACX;AACA,QAAMC,KAAAA,OAAM,KAAOC;QACjBC,EAAAA,QAAKL,QAAAA,IAAAA,OAAAA,OAAAA;QACLM,MAAQC,OAAcC,kBAAAA;;sBAA6BtC,IAAAA,gBAAAA;eAAIuC;QAAsB;QAAGC,QAAOH;MAAM;MAC/F,OAAA;IACKJ,CAAAA;;cAC6CQ,OAAS,IAAA,YAAA,YAAA;kBAAEzC,YAAAA,IAAAA,gBAAAA;eAAIuC;QAA0B;QAAE,QAAA;MAC7F;IACA,CAAA,CAAMG;EACN;QACE,SAAO,IAAOR,QAAOS,OAASL;gBAAkBG,MAAS,GAAA;kBAAEzC,YAAAA,IAAAA,gBAAAA;eAAIuC;QAAyB;QAAE,QAAA;MAC5F;IACIG,CAAAA,CAAAA;;aAEsBD,KAAAA,OAAS,IAAA;kBAAEzC,YAAAA,IAAAA,gBAAAA;eAAIuC;QAAyBK;QAA2B,QAAA;QAAE,YAAA,OAAA,KAAA;MAE/F;IACA,CAAA,CAAA;EACC;;;",
|
|
6
|
+
"names": ["Context", "Effect", "Option", "Pipeable", "BaseError", "invariant", "PluginModuleImpl", "id", "activatesOn", "firesBeforeActivation", "firesAfterActivation", "activate", "_meta", "_modules", "meta", "modules", "addModule", "moduleOptions", "pipe", "undefined", "fromNullable", "onNone", "exportName", "Capability", "getModuleTag", "invariant", "onSome", "computeModuleId", "factory", "options", "builder", "PluginImpl", "Object", "assign", "stub", "defineProperty", "value", "loader", "enumerable", "plugin", "mod", "Effect", "try", "catch", "error", "LazyPluginError", "reason", "cause", "context", "result", "fail", "returnedId"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isPlugin
|
|
4
|
+
} from "./chunk-HTBJU5FX.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
8
|
+
|
|
9
|
+
// src/core/url-loader.ts
|
|
10
|
+
var url_loader_exports = {};
|
|
11
|
+
__export(url_loader_exports, {
|
|
12
|
+
RemotePluginLoadError: () => RemotePluginLoadError,
|
|
13
|
+
getInstalledVersion: () => getInstalledVersion,
|
|
14
|
+
getRemoteEntries: () => getRemoteEntries,
|
|
15
|
+
isLocalUrl: () => isLocalUrl,
|
|
16
|
+
make: () => make,
|
|
17
|
+
preload: () => preload,
|
|
18
|
+
setInstalledVersion: () => setInstalledVersion,
|
|
19
|
+
uninstall: () => uninstall
|
|
20
|
+
});
|
|
21
|
+
import * as Effect3 from "effect/Effect";
|
|
22
|
+
import * as Option from "effect/Option";
|
|
23
|
+
import { BaseError as BaseError3 } from "@dxos/errors";
|
|
24
|
+
import { log } from "@dxos/log";
|
|
25
|
+
|
|
26
|
+
// src/core/plugin-asset-cache.ts
|
|
27
|
+
var plugin_asset_cache_exports = {};
|
|
28
|
+
__export(plugin_asset_cache_exports, {
|
|
29
|
+
PluginAssetCacheError: () => PluginAssetCacheError,
|
|
30
|
+
noop: () => noop
|
|
31
|
+
});
|
|
32
|
+
import * as Effect from "effect/Effect";
|
|
33
|
+
import { BaseError } from "@dxos/errors";
|
|
34
|
+
var PluginAssetCacheError = class extends BaseError.extend("PluginAssetCacheError", "Plugin asset cache operation failed") {
|
|
35
|
+
};
|
|
36
|
+
var noop = () => ({
|
|
37
|
+
cache: () => Effect.void,
|
|
38
|
+
evict: () => Effect.void,
|
|
39
|
+
resolve: (_pluginId, url) => Effect.succeed(url),
|
|
40
|
+
list: () => Effect.succeed([])
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/core/plugin-manifest.ts
|
|
44
|
+
var plugin_manifest_exports = {};
|
|
45
|
+
__export(plugin_manifest_exports, {
|
|
46
|
+
Manifest: () => Manifest,
|
|
47
|
+
PLUGIN_DEV_SERVER_PORT: () => PLUGIN_DEV_SERVER_PORT,
|
|
48
|
+
PluginManifestError: () => PluginManifestError,
|
|
49
|
+
fetchManifest: () => fetchManifest,
|
|
50
|
+
parse: () => parse
|
|
51
|
+
});
|
|
52
|
+
import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
|
|
53
|
+
import * as HttpClient from "@effect/platform/HttpClient";
|
|
54
|
+
import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
|
|
55
|
+
import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
56
|
+
import * as Effect2 from "effect/Effect";
|
|
57
|
+
import * as Schema from "effect/Schema";
|
|
58
|
+
import { BaseError as BaseError2 } from "@dxos/errors";
|
|
59
|
+
import { PLUGIN_ENTRY_FILENAME } from "@dxos/protocols";
|
|
60
|
+
var PLUGIN_DEV_SERVER_PORT = 3967;
|
|
61
|
+
var PluginManifestError = class extends BaseError2.extend("PluginManifestError", "Plugin manifest is invalid") {
|
|
62
|
+
};
|
|
63
|
+
var Manifest = Schema.Struct({
|
|
64
|
+
id: Schema.String,
|
|
65
|
+
name: Schema.String,
|
|
66
|
+
version: Schema.String,
|
|
67
|
+
assets: Schema.Array(Schema.String),
|
|
68
|
+
devEntry: Schema.String.pipe(Schema.optional)
|
|
69
|
+
});
|
|
70
|
+
var resolve = (manifestUrl, manifest) => {
|
|
71
|
+
const dev = manifest.devEntry !== void 0;
|
|
72
|
+
return {
|
|
73
|
+
id: manifest.id,
|
|
74
|
+
name: manifest.name,
|
|
75
|
+
version: manifest.version,
|
|
76
|
+
entryUrl: new URL(dev ? manifest.devEntry : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),
|
|
77
|
+
assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),
|
|
78
|
+
dev
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
var parse = (manifestUrl, payload) => {
|
|
82
|
+
const manifest = Schema.decodeUnknownSync(Manifest)(payload);
|
|
83
|
+
if (manifest.devEntry === void 0 && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
|
|
84
|
+
throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);
|
|
85
|
+
}
|
|
86
|
+
return resolve(manifestUrl, manifest);
|
|
87
|
+
};
|
|
88
|
+
var fetchManifest = (manifestUrl) => Effect2.gen(function* () {
|
|
89
|
+
const response = yield* HttpClientRequest.get(manifestUrl).pipe(HttpClient.execute, Effect2.mapError((cause) => new PluginManifestError({
|
|
90
|
+
context: {
|
|
91
|
+
manifestUrl,
|
|
92
|
+
reason: "fetch-failed"
|
|
93
|
+
},
|
|
94
|
+
cause
|
|
95
|
+
})));
|
|
96
|
+
if (response.status >= 400) {
|
|
97
|
+
return yield* Effect2.fail(new PluginManifestError({
|
|
98
|
+
context: {
|
|
99
|
+
manifestUrl,
|
|
100
|
+
reason: "http-error",
|
|
101
|
+
status: response.status
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(Effect2.mapError((cause) => new PluginManifestError({
|
|
106
|
+
context: {
|
|
107
|
+
manifestUrl,
|
|
108
|
+
reason: "parse-failed"
|
|
109
|
+
},
|
|
110
|
+
cause
|
|
111
|
+
})));
|
|
112
|
+
if (manifest.devEntry === void 0 && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
|
|
113
|
+
return yield* Effect2.fail(new PluginManifestError({
|
|
114
|
+
context: {
|
|
115
|
+
manifestUrl,
|
|
116
|
+
reason: "invalid"
|
|
117
|
+
},
|
|
118
|
+
cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return resolve(manifestUrl, manifest);
|
|
122
|
+
}).pipe(Effect2.scoped, Effect2.provide(FetchHttpClient.layer));
|
|
123
|
+
|
|
124
|
+
// src/core/url-loader.ts
|
|
125
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/url-loader.ts";
|
|
126
|
+
var DEFAULT_KEY = "org.dxos.composer.remote-plugins";
|
|
127
|
+
var RemotePluginLoadError = class extends BaseError3.extend("RemotePluginLoadError", "Failed to load remote plugin") {
|
|
128
|
+
};
|
|
129
|
+
var defaultStorage = () => ({
|
|
130
|
+
get: (key) => localStorage.getItem(key),
|
|
131
|
+
set: (key, value) => localStorage.setItem(key, value)
|
|
132
|
+
});
|
|
133
|
+
var getPersistedRemotePlugins = (storage, key) => {
|
|
134
|
+
try {
|
|
135
|
+
const parsed = JSON.parse(storage.get(key) ?? "[]");
|
|
136
|
+
if (!Array.isArray(parsed)) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string");
|
|
140
|
+
} catch {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var persistRemotePlugin = (storage, key, entry) => {
|
|
145
|
+
try {
|
|
146
|
+
const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== entry.id);
|
|
147
|
+
entries.push(entry);
|
|
148
|
+
storage.set(key, JSON.stringify(entries));
|
|
149
|
+
} catch (error) {
|
|
150
|
+
log.warn("failed to persist remote plugin entry", {
|
|
151
|
+
entry,
|
|
152
|
+
error
|
|
153
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var removePersistedRemotePlugin = (storage, key, pluginId) => {
|
|
157
|
+
try {
|
|
158
|
+
const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== pluginId);
|
|
159
|
+
storage.set(key, JSON.stringify(entries));
|
|
160
|
+
} catch (error) {
|
|
161
|
+
log.warn("failed to remove remote plugin entry", {
|
|
162
|
+
pluginId,
|
|
163
|
+
error
|
|
164
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 51, S: void 0 });
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
var isUrl = (locator) => {
|
|
168
|
+
try {
|
|
169
|
+
const url = new URL(locator);
|
|
170
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
171
|
+
} catch {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var isLocalUrl = (locator) => {
|
|
176
|
+
try {
|
|
177
|
+
const hostname = new URL(locator).hostname.toLowerCase();
|
|
178
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
|
|
179
|
+
} catch {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var getRemoteEntries = (options = {}) => {
|
|
184
|
+
const storage = options.storage ?? defaultStorage();
|
|
185
|
+
const key = options.key ?? DEFAULT_KEY;
|
|
186
|
+
return getPersistedRemotePlugins(storage, key);
|
|
187
|
+
};
|
|
188
|
+
var setInstalledVersion = (id, version, options = {}) => {
|
|
189
|
+
const storage = options.storage ?? defaultStorage();
|
|
190
|
+
const key = options.key ?? DEFAULT_KEY;
|
|
191
|
+
const entries = getPersistedRemotePlugins(storage, key);
|
|
192
|
+
const index = entries.findIndex((entry) => entry.id === id);
|
|
193
|
+
if (index === -1) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
entries[index] = {
|
|
197
|
+
...entries[index],
|
|
198
|
+
version
|
|
199
|
+
};
|
|
200
|
+
try {
|
|
201
|
+
storage.set(key, JSON.stringify(entries));
|
|
202
|
+
} catch (error) {
|
|
203
|
+
log.warn("failed to update installed version for remote plugin", {
|
|
204
|
+
id,
|
|
205
|
+
version,
|
|
206
|
+
error
|
|
207
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 103, S: void 0 });
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
var getInstalledVersion = (id, options = {}) => {
|
|
211
|
+
const storage = options.storage ?? defaultStorage();
|
|
212
|
+
const key = options.key ?? DEFAULT_KEY;
|
|
213
|
+
return getPersistedRemotePlugins(storage, key).find((entry) => entry.id === id)?.version;
|
|
214
|
+
};
|
|
215
|
+
var normalizePluginExport = (mod) => {
|
|
216
|
+
const exported = mod.default;
|
|
217
|
+
if (isPlugin(exported)) {
|
|
218
|
+
return exported;
|
|
219
|
+
}
|
|
220
|
+
if (typeof exported === "function") {
|
|
221
|
+
const result = exported();
|
|
222
|
+
if (isPlugin(result)) {
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
throw new Error("Remote module default export is not a Plugin or a zero-arg plugin factory.");
|
|
227
|
+
};
|
|
228
|
+
var loadStylesheets = (manifest, cache) => Effect3.gen(function* () {
|
|
229
|
+
if (typeof document === "undefined") {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const cssUrls = manifest.assetUrls.filter((url) => url.endsWith(".css"));
|
|
233
|
+
for (const url of cssUrls) {
|
|
234
|
+
const resolved = yield* cache.resolve(manifest.id, url);
|
|
235
|
+
if (document.querySelector(`link[data-dxos-plugin-id="${manifest.id}"][href="${resolved}"]`)) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const link = document.createElement("link");
|
|
239
|
+
link.rel = "stylesheet";
|
|
240
|
+
link.href = resolved;
|
|
241
|
+
link.dataset.dxosPluginId = manifest.id;
|
|
242
|
+
document.head.appendChild(link);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
|
|
246
|
+
log.info("loading remote plugin", {
|
|
247
|
+
manifestUrl
|
|
248
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 152, S: this });
|
|
249
|
+
const manifest = yield* fetchManifest(manifestUrl).pipe(Effect3.mapError((cause) => new RemotePluginLoadError({
|
|
250
|
+
context: {
|
|
251
|
+
locator: manifestUrl,
|
|
252
|
+
reason: "manifest-error"
|
|
253
|
+
},
|
|
254
|
+
cause
|
|
255
|
+
})));
|
|
256
|
+
const wrapCacheError = Effect3.mapError((cause) => new RemotePluginLoadError({
|
|
257
|
+
context: {
|
|
258
|
+
locator: manifestUrl,
|
|
259
|
+
reason: "cache-error"
|
|
260
|
+
},
|
|
261
|
+
cause
|
|
262
|
+
}));
|
|
263
|
+
if (!manifest.dev) {
|
|
264
|
+
const cachedUrls = manifest.assetUrls.indexOf(manifestUrl) === -1 ? [
|
|
265
|
+
manifestUrl,
|
|
266
|
+
...manifest.assetUrls
|
|
267
|
+
] : manifest.assetUrls;
|
|
268
|
+
yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);
|
|
269
|
+
}
|
|
270
|
+
const entryUrl = manifest.dev ? manifest.entryUrl : yield* cache.resolve(manifest.id, manifest.entryUrl).pipe(wrapCacheError);
|
|
271
|
+
const mod = yield* Effect3.tryPromise({
|
|
272
|
+
try: () => import(
|
|
273
|
+
/* @vite-ignore */
|
|
274
|
+
entryUrl
|
|
275
|
+
),
|
|
276
|
+
catch: (cause) => new RemotePluginLoadError({
|
|
277
|
+
context: {
|
|
278
|
+
locator: manifestUrl,
|
|
279
|
+
reason: "import-failed"
|
|
280
|
+
},
|
|
281
|
+
cause
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
const plugin = normalizePluginExport(mod);
|
|
285
|
+
if (!plugin.meta.id || !plugin.meta.name) {
|
|
286
|
+
return yield* Effect3.fail(new RemotePluginLoadError({
|
|
287
|
+
context: {
|
|
288
|
+
locator: manifestUrl,
|
|
289
|
+
reason: "meta-missing"
|
|
290
|
+
}
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
if (plugin.meta.id !== manifest.id) {
|
|
294
|
+
return yield* Effect3.fail(new RemotePluginLoadError({
|
|
295
|
+
context: {
|
|
296
|
+
locator: manifestUrl,
|
|
297
|
+
reason: "meta-mismatch",
|
|
298
|
+
metaId: plugin.meta.id,
|
|
299
|
+
manifestId: manifest.id
|
|
300
|
+
}
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
if (!manifest.dev) {
|
|
304
|
+
yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
plugin,
|
|
308
|
+
manifest
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
var preload = (options = {}) => Effect3.gen(function* () {
|
|
312
|
+
const storage = options.storage ?? defaultStorage();
|
|
313
|
+
const key = options.key ?? DEFAULT_KEY;
|
|
314
|
+
const cache = options.cache ?? noop();
|
|
315
|
+
const onPluginLoaded = options.onPluginLoaded;
|
|
316
|
+
const entries = getPersistedRemotePlugins(storage, key);
|
|
317
|
+
if (entries.length === 0) {
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
320
|
+
log.info("preloading remote plugins", {
|
|
321
|
+
count: entries.length
|
|
322
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 240, S: this });
|
|
323
|
+
const total = entries.length;
|
|
324
|
+
let loaded = 0;
|
|
325
|
+
const results = yield* Effect3.all(entries.map((entry) => loadFromManifest(entry.url, cache).pipe(
|
|
326
|
+
Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to preload remote plugin", {
|
|
327
|
+
entry,
|
|
328
|
+
error
|
|
329
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 245, S: this }))),
|
|
330
|
+
Effect3.option,
|
|
331
|
+
// Tick the progress hook on both success and recoverable failure so
|
|
332
|
+
// the counter monotonically reaches `total`. The host-supplied
|
|
333
|
+
// callback is best-effort: any synchronous throw flows through
|
|
334
|
+
// `Effect.try` and gets logged + ignored so a buggy hook can't
|
|
335
|
+
// derail the preload.
|
|
336
|
+
Effect3.tap(() => Effect3.sync(() => {
|
|
337
|
+
loaded += 1;
|
|
338
|
+
}).pipe(Effect3.andThen(Effect3.try(() => onPluginLoaded?.(loaded, total))), Effect3.tapError((error) => Effect3.sync(() => log.warn("onPluginLoaded threw", {
|
|
339
|
+
loaded,
|
|
340
|
+
total,
|
|
341
|
+
error
|
|
342
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 255, S: this }))), Effect3.ignore))
|
|
343
|
+
)), {
|
|
344
|
+
concurrency: "unbounded"
|
|
345
|
+
});
|
|
346
|
+
return results.flatMap((result) => Option.match(result, {
|
|
347
|
+
onNone: () => [],
|
|
348
|
+
onSome: ({ plugin }) => [
|
|
349
|
+
plugin
|
|
350
|
+
]
|
|
351
|
+
}));
|
|
352
|
+
});
|
|
353
|
+
var make = (builtinPlugins, options = {}) => {
|
|
354
|
+
const storage = options.storage ?? defaultStorage();
|
|
355
|
+
const key = options.key ?? DEFAULT_KEY;
|
|
356
|
+
const cache = options.cache ?? noop();
|
|
357
|
+
return (locator) => Effect3.gen(function* () {
|
|
358
|
+
const builtin = builtinPlugins.find((plugin2) => plugin2.meta.id === locator);
|
|
359
|
+
if (builtin) {
|
|
360
|
+
return {
|
|
361
|
+
plugin: builtin
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (!isUrl(locator)) {
|
|
365
|
+
return yield* Effect3.fail(new RemotePluginLoadError({
|
|
366
|
+
context: {
|
|
367
|
+
locator,
|
|
368
|
+
reason: "invalid-locator"
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
const { plugin, manifest } = yield* loadFromManifest(locator, cache);
|
|
373
|
+
if (!manifest.dev) {
|
|
374
|
+
const duplicate = builtinPlugins.find((existing) => existing.meta.id === plugin.meta.id);
|
|
375
|
+
if (duplicate) {
|
|
376
|
+
return yield* Effect3.fail(new RemotePluginLoadError({
|
|
377
|
+
context: {
|
|
378
|
+
locator,
|
|
379
|
+
reason: "duplicate-id",
|
|
380
|
+
id: plugin.meta.id
|
|
381
|
+
}
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
persistRemotePlugin(storage, key, {
|
|
385
|
+
id: plugin.meta.id,
|
|
386
|
+
url: locator
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
plugin,
|
|
391
|
+
dev: manifest.dev
|
|
392
|
+
};
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
var uninstall = (pluginId, options = {}) => Effect3.gen(function* () {
|
|
396
|
+
const storage = options.storage ?? defaultStorage();
|
|
397
|
+
const key = options.key ?? DEFAULT_KEY;
|
|
398
|
+
const cache = options.cache ?? noop();
|
|
399
|
+
removePersistedRemotePlugin(storage, key, pluginId);
|
|
400
|
+
if (typeof document !== "undefined") {
|
|
401
|
+
document.querySelectorAll(`link[data-dxos-plugin-id="${pluginId}"]`).forEach((node) => node.remove());
|
|
402
|
+
}
|
|
403
|
+
yield* cache.evict(pluginId).pipe(Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to evict plugin assets", {
|
|
404
|
+
pluginId,
|
|
405
|
+
error
|
|
406
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 337, S: this }))), Effect3.ignore);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
export {
|
|
410
|
+
plugin_asset_cache_exports,
|
|
411
|
+
PLUGIN_DEV_SERVER_PORT,
|
|
412
|
+
plugin_manifest_exports,
|
|
413
|
+
RemotePluginLoadError,
|
|
414
|
+
isLocalUrl,
|
|
415
|
+
getRemoteEntries,
|
|
416
|
+
setInstalledVersion,
|
|
417
|
+
getInstalledVersion,
|
|
418
|
+
preload,
|
|
419
|
+
make,
|
|
420
|
+
uninstall,
|
|
421
|
+
url_loader_exports
|
|
422
|
+
};
|
|
423
|
+
//# sourceMappingURL=chunk-M3HKPRPO.mjs.map
|