@dxos/app-framework 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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 +1 -3
- package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-4NSF2SOO.mjs} +16 -11
- package/dist/lib/browser/capability-4NSF2SOO.mjs.map +7 -0
- package/dist/lib/browser/capability-EB3UKSKA.mjs +35 -0
- package/dist/lib/browser/capability-EB3UKSKA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-27FZETIA.mjs} +324 -181
- package/dist/lib/browser/chunk-27FZETIA.mjs.map +7 -0
- package/dist/lib/browser/chunk-CV7I2AAB.mjs +80 -0
- package/dist/lib/browser/chunk-CV7I2AAB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-FL2XTEJH.mjs} +3 -4
- package/dist/lib/browser/chunk-FL2XTEJH.mjs.map +7 -0
- package/dist/lib/browser/chunk-H7OMDDGW.mjs +42 -0
- package/dist/lib/browser/chunk-H7OMDDGW.mjs.map +7 -0
- package/dist/lib/browser/chunk-HDQXX5DC.mjs +157 -0
- package/dist/lib/browser/chunk-HDQXX5DC.mjs.map +7 -0
- package/dist/lib/browser/chunk-I34GF4NG.mjs +34 -0
- package/dist/lib/browser/chunk-I34GF4NG.mjs.map +7 -0
- package/dist/lib/browser/chunk-KNBRTZVK.mjs +892 -0
- package/dist/lib/browser/chunk-KNBRTZVK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-NO7R7QHA.mjs} +4 -7
- package/dist/lib/browser/chunk-NO7R7QHA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-P2E7VMRF.mjs} +10 -7
- package/dist/lib/browser/chunk-P2E7VMRF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-QSXYHXCE.mjs} +3 -2
- package/dist/lib/browser/chunk-QSXYHXCE.mjs.map +7 -0
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +1 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
- package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
- package/dist/lib/browser/cli/index.mjs +90 -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 +1 -1
- package/dist/lib/browser/core/capability.mjs +1 -1
- package/dist/lib/browser/core/plugin-manager.mjs +4 -4
- package/dist/lib/browser/core/plugin.mjs +6 -4
- package/dist/lib/browser/core/url-loader.mjs +12 -0
- package/dist/lib/browser/index.mjs +40 -131
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-P7KPBTP3.mjs +43 -0
- package/dist/lib/browser/invoker-capability-P7KPBTP3.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +56 -34
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/{react → ui}/index.mjs +19 -21
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-CB3MNEI3.mjs} +16 -11
- package/dist/lib/node-esm/capability-CB3MNEI3.mjs.map +7 -0
- package/dist/lib/node-esm/capability-CMROGK7R.mjs +36 -0
- package/dist/lib/node-esm/capability-CMROGK7R.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-37NG7SIN.mjs} +3 -4
- package/dist/lib/node-esm/chunk-37NG7SIN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7JPKC7OM.mjs +893 -0
- package/dist/lib/node-esm/chunk-7JPKC7OM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7PPVTBYR.mjs +81 -0
- package/dist/lib/node-esm/chunk-7PPVTBYR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BQ56U4QX.mjs +43 -0
- package/dist/lib/node-esm/chunk-BQ56U4QX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-CG6UBBZZ.mjs} +10 -7
- package/dist/lib/node-esm/chunk-CG6UBBZZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +2 -0
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-663A54LQ.mjs → chunk-EXYTXQ47.mjs} +4 -7
- package/dist/lib/node-esm/chunk-EXYTXQ47.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-OXXXRCQX.mjs +158 -0
- package/dist/lib/node-esm/chunk-OXXXRCQX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs +35 -0
- package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XYQTBFPA.mjs → chunk-YH44RHP6.mjs} +324 -181
- package/dist/lib/node-esm/chunk-YH44RHP6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-ZZ7CKK6W.mjs} +3 -2
- package/dist/lib/node-esm/chunk-ZZ7CKK6W.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +91 -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 +1 -1
- package/dist/lib/node-esm/core/capability.mjs +1 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
- package/dist/lib/node-esm/core/plugin.mjs +6 -4
- package/dist/lib/node-esm/core/url-loader.mjs +13 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +40 -131
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-3C5H46ZY.mjs +44 -0
- package/dist/lib/node-esm/invoker-capability-3C5H46ZY.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +56 -34
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{react → ui}/index.mjs +19 -21
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +384 -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.d.ts → cli/cli.d.ts} +2 -2
- 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/capabilities.d.ts +110 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +4 -9
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +8 -369
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +0 -9
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +1 -1
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +7 -7
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/index.d.ts +1 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +9 -2
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +6 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +25 -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/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +30 -3
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/testing.d.ts +26 -77
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/{react → ui/components/App}/App.d.ts +3 -2
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
- 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/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerProvider.d.ts +1 -1
- 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 +12 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{react/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -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 +26 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +4 -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/{react → ui/hooks}/useApp.d.ts +26 -9
- 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/{react → ui/hooks}/useCapabilities.d.ts +6 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
- 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/composer-plugin.d.ts +18 -0
- package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts +16 -0
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +3 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +7 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +20 -6
- package/package.json +91 -64
- package/src/{cli.ts → cli/cli.ts} +10 -10
- package/src/{playground/debug → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +172 -0
- package/src/common/index.ts +4 -9
- package/src/common/operations.ts +6 -382
- package/src/common/translations.ts +0 -12
- package/src/context.ts +1 -1
- package/src/core/activation-event.ts +5 -2
- package/src/core/capability-manager.ts +1 -1
- package/src/core/capability.ts +11 -10
- package/src/core/index.ts +1 -0
- package/src/core/plugin-manager.test.ts +313 -44
- package/src/core/plugin-manager.ts +344 -157
- package/src/core/plugin.ts +10 -2
- package/src/core/url-loader.test.ts +79 -0
- package/src/core/url-loader.ts +148 -0
- package/src/index.ts +1 -3
- package/src/plugin-operation/OperationPlugin.ts +5 -5
- package/src/plugin-operation/history/capability.ts +5 -5
- package/src/plugin-operation/history/errors.ts +2 -6
- package/src/plugin-operation/history/history-tracker.test.ts +36 -42
- package/src/plugin-operation/history/undo-mapping.ts +6 -3
- package/src/plugin-operation/history/undo-registry.test.ts +3 -3
- package/src/plugin-operation/invoker-capability.ts +21 -7
- package/src/plugin-operation/meta.ts +1 -1
- package/src/plugin-operation/testing.ts +25 -45
- package/src/plugin-runtime/RuntimePlugin.ts +4 -4
- package/src/plugin-runtime/capability.ts +5 -5
- package/src/plugin-runtime/meta.ts +1 -1
- package/src/testing/service.ts +6 -6
- package/src/testing/withPluginManager.stories.tsx +6 -6
- package/src/testing/withPluginManager.tsx +46 -19
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/{react → ui/components/App}/App.tsx +9 -11
- package/src/{playground/layout → ui/components/App}/index.ts +1 -1
- package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +28 -24
- package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +48 -58
- package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
- 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 +35 -0
- package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
- package/src/ui/components/index.ts +7 -0
- package/src/ui/hooks/index.ts +9 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/{react → ui/hooks}/useApp.tsx +110 -30
- package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
- package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/src/vite-plugin/composer-plugin.ts +128 -0
- package/src/vite-plugin/import-map-plugin.ts +315 -0
- package/src/vite-plugin/index.ts +6 -0
- package/src/vite-plugin/packages.ts +29 -0
- package/tsconfig.json +4 -28
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
- package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
- package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
- package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
- package/dist/lib/browser/chunk-6Y7PZV72.mjs.map +0 -7
- package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
- package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
- package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
- package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
- package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
- package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
- package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
- package/dist/lib/browser/chunk-XYNO72GQ.mjs +0 -746
- package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
- package/dist/lib/browser/common/index.mjs +0 -38
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs +0 -32
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs +0 -747
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-STMXUEPO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
- package/dist/lib/node-esm/common/index.mjs +0 -39
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs +0 -33
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
- package/dist/types/src/cli.d.ts.map +0 -1
- package/dist/types/src/common/activation-event.d.ts +0 -66
- package/dist/types/src/common/activation-event.d.ts.map +0 -1
- package/dist/types/src/common/capability.d.ts +0 -265
- package/dist/types/src/common/capability.d.ts.map +0 -1
- package/dist/types/src/common/collaboration.d.ts +0 -26
- package/dist/types/src/common/collaboration.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/plugin.d.ts +0 -201
- package/dist/types/src/common/plugin.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/playground/debug/Debug.d.ts +0 -8
- 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 -3
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -8
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -19
- 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 -3
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -10
- 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 -3
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
- 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 -3
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -27
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.d.ts +0 -11
- package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -61
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
- 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/meta.d.ts +0 -3
- package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
- package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/translations.d.ts +0 -11
- package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
- package/dist/types/src/react/App.d.ts.map +0 -1
- package/dist/types/src/react/App.stories.d.ts.map +0 -1
- package/dist/types/src/react/DefaultFallback.d.ts +0 -8
- package/dist/types/src/react/DefaultFallback.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/PluginManagerContext.stories.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -14
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -9
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/types.d.ts +0 -12
- package/dist/types/src/react/types.d.ts.map +0 -1
- package/dist/types/src/react/useApp.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
- package/dist/types/src/react/useLoading.d.ts.map +0 -1
- package/dist/types/src/react/useOperationResolver.d.ts +0 -19
- package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
- package/src/common/activation-event.ts +0 -99
- package/src/common/capability.ts +0 -343
- package/src/common/collaboration.ts +0 -31
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/plugin.ts +0 -364
- package/src/playground/debug/Debug.tsx +0 -49
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -80
- package/src/playground/generator/Toolbar.tsx +0 -57
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -21
- package/src/playground/layout/Layout.tsx +0 -37
- package/src/playground/layout/plugin.ts +0 -18
- package/src/playground/logger/Toolbar.tsx +0 -33
- package/src/playground/logger/index.ts +0 -5
- package/src/playground/logger/plugin.ts +0 -42
- package/src/playground/logger/schema.ts +0 -22
- package/src/playground/playground.stories.tsx +0 -54
- package/src/plugin-settings/SettingsPlugin.ts +0 -19
- package/src/plugin-settings/actions.ts +0 -64
- package/src/plugin-settings/app-graph-builder.ts +0 -140
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/meta.ts +0 -10
- package/src/plugin-settings/operation-resolver.ts +0 -55
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/App.stories.tsx +0 -63
- package/src/react/DefaultFallback.tsx +0 -26
- package/src/react/ErrorBoundary.tsx +0 -56
- package/src/react/index.ts +0 -14
- package/src/react/types.ts +0 -27
- package/src/react/useOperationResolver.ts +0 -40
- /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-RFSO3JRG.mjs.map} +0 -0
- /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
- /package/dist/lib/browser/{common/index.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
- /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
- /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
- /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
eventKey,
|
|
3
3
|
getEvents,
|
|
4
4
|
isAllOf
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QSXYHXCE.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Service as Service2
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P2E7VMRF.mjs";
|
|
9
9
|
import {
|
|
10
10
|
Service
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FL2XTEJH.mjs";
|
|
12
12
|
import {
|
|
13
13
|
__export
|
|
14
14
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -32,6 +32,7 @@ import * as HashSet from "effect/HashSet";
|
|
|
32
32
|
import * as PubSub from "effect/PubSub";
|
|
33
33
|
import * as Ref from "effect/Ref";
|
|
34
34
|
import { runAndForwardErrors } from "@dxos/effect";
|
|
35
|
+
import { Performance } from "@dxos/effect";
|
|
35
36
|
import { log as log2 } from "@dxos/log";
|
|
36
37
|
|
|
37
38
|
// src/core/capability-manager.ts
|
|
@@ -51,14 +52,14 @@ var CapabilityManagerImpl = class {
|
|
|
51
52
|
return Atom.make([]).pipe(Atom.keepAlive);
|
|
52
53
|
});
|
|
53
54
|
_capabilities = Atom.family((id) => {
|
|
54
|
-
return Atom.make((
|
|
55
|
-
const current =
|
|
55
|
+
return Atom.make((get2) => {
|
|
56
|
+
const current = get2(this._capabilityEntries(id));
|
|
56
57
|
return current.map((c) => c.implementation);
|
|
57
|
-
});
|
|
58
|
+
}).pipe(Atom.keepAlive);
|
|
58
59
|
});
|
|
59
60
|
_capability = Atom.family((id) => {
|
|
60
|
-
return Atom.make((
|
|
61
|
-
const current =
|
|
61
|
+
return Atom.make((get2) => {
|
|
62
|
+
const current = get2(this._capabilities(id));
|
|
62
63
|
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
63
64
|
F: __dxlog_file,
|
|
64
65
|
L: 84,
|
|
@@ -177,7 +178,7 @@ var make2 = (options) => new CapabilityManagerImpl(options);
|
|
|
177
178
|
|
|
178
179
|
// src/core/plugin-manager.ts
|
|
179
180
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin-manager.ts";
|
|
180
|
-
var ManagerTypeId = Symbol.for("@dxos/app-framework/Manager");
|
|
181
|
+
var ManagerTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Manager");
|
|
181
182
|
var isManager = (value) => {
|
|
182
183
|
return typeof value === "object" && value !== null && ManagerTypeId in value;
|
|
183
184
|
};
|
|
@@ -199,6 +200,9 @@ var ManagerImpl = class {
|
|
|
199
200
|
_moduleSemaphores = /* @__PURE__ */ new Map();
|
|
200
201
|
_activatingEvents = Effect2.runSync(Ref.make([]));
|
|
201
202
|
_activatingModules = Effect2.runSync(Ref.make([]));
|
|
203
|
+
_inFlightFibers = Effect2.runSync(Ref.make([]));
|
|
204
|
+
_shutdownSemaphore = Effect2.runSync(Effect2.makeSemaphore(1));
|
|
205
|
+
_shuttingDown = Effect2.runSync(Ref.make(false));
|
|
202
206
|
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
|
|
203
207
|
this.registry = registry ?? Registry.make();
|
|
204
208
|
this.capabilities = make2({
|
|
@@ -285,13 +289,13 @@ var ManagerImpl = class {
|
|
|
285
289
|
id
|
|
286
290
|
}, {
|
|
287
291
|
F: __dxlog_file2,
|
|
288
|
-
L:
|
|
292
|
+
L: 227,
|
|
289
293
|
S: this,
|
|
290
294
|
C: (f, a) => f(...a)
|
|
291
295
|
});
|
|
292
296
|
const plugin = yield* this._pluginLoader(id);
|
|
293
297
|
this._addPlugin(plugin);
|
|
294
|
-
return yield* this.enable(id);
|
|
298
|
+
return yield* this.enable(plugin.meta.id);
|
|
295
299
|
});
|
|
296
300
|
}
|
|
297
301
|
/**
|
|
@@ -304,7 +308,7 @@ var ManagerImpl = class {
|
|
|
304
308
|
id
|
|
305
309
|
}, {
|
|
306
310
|
F: __dxlog_file2,
|
|
307
|
-
L:
|
|
311
|
+
L: 240,
|
|
308
312
|
S: this,
|
|
309
313
|
C: (f, a) => f(...a)
|
|
310
314
|
});
|
|
@@ -326,7 +330,7 @@ var ManagerImpl = class {
|
|
|
326
330
|
]
|
|
327
331
|
}, {
|
|
328
332
|
F: __dxlog_file2,
|
|
329
|
-
L:
|
|
333
|
+
L: 253,
|
|
330
334
|
S: this,
|
|
331
335
|
C: (f, a) => f(...a)
|
|
332
336
|
});
|
|
@@ -345,7 +349,7 @@ var ManagerImpl = class {
|
|
|
345
349
|
id
|
|
346
350
|
}, {
|
|
347
351
|
F: __dxlog_file2,
|
|
348
|
-
L:
|
|
352
|
+
L: 268,
|
|
349
353
|
S: this,
|
|
350
354
|
C: (f, a) => f(...a)
|
|
351
355
|
});
|
|
@@ -366,7 +370,7 @@ var ManagerImpl = class {
|
|
|
366
370
|
id
|
|
367
371
|
}, {
|
|
368
372
|
F: __dxlog_file2,
|
|
369
|
-
L:
|
|
373
|
+
L: 284,
|
|
370
374
|
S: this,
|
|
371
375
|
C: (f, a) => f(...a)
|
|
372
376
|
});
|
|
@@ -396,136 +400,35 @@ var ManagerImpl = class {
|
|
|
396
400
|
activate(event, params) {
|
|
397
401
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
398
402
|
return Effect2.gen(this, function* () {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
F: __dxlog_file2,
|
|
404
|
-
L: 302,
|
|
405
|
-
S: this,
|
|
406
|
-
C: (f, a) => f(...a)
|
|
407
|
-
});
|
|
408
|
-
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
409
|
-
const pendingIndex = this._get(this._pendingResetAtom).findIndex((event2) => event2 === key);
|
|
410
|
-
if (pendingIndex !== -1) {
|
|
411
|
-
this._update(this._pendingResetAtom, (pending) => pending.filter((event2) => event2 !== key));
|
|
412
|
-
}
|
|
413
|
-
const activatingEvents = yield* this._activatingEvents;
|
|
414
|
-
const activatingModules = yield* this._activatingModules;
|
|
415
|
-
const modules = this._getInactiveModulesByEvent(key).filter((module) => {
|
|
416
|
-
const allOf = isAllOf(module.activatesOn);
|
|
417
|
-
if (!allOf) {
|
|
418
|
-
return true;
|
|
419
|
-
}
|
|
420
|
-
const events = getEvents(module.activatesOn).filter((event2) => eventKey(event2) !== key);
|
|
421
|
-
return events.every((event2) => this._get(this._eventsFiredAtom).includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
|
|
422
|
-
});
|
|
423
|
-
yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
|
|
424
|
-
if (modules.length === 0) {
|
|
425
|
-
log2("no modules to activate", {
|
|
426
|
-
key
|
|
403
|
+
if (yield* this._isShuttingDown()) {
|
|
404
|
+
log2("skipping activation during shutdown", {
|
|
405
|
+
key,
|
|
406
|
+
...params
|
|
427
407
|
}, {
|
|
428
408
|
F: __dxlog_file2,
|
|
429
|
-
L:
|
|
409
|
+
L: 320,
|
|
430
410
|
S: this,
|
|
431
411
|
C: (f, a) => f(...a)
|
|
432
412
|
});
|
|
433
|
-
if (!this._get(this._eventsFiredAtom).includes(key)) {
|
|
434
|
-
this._update(this._eventsFiredAtom, (events) => [
|
|
435
|
-
...events,
|
|
436
|
-
key
|
|
437
|
-
]);
|
|
438
|
-
}
|
|
439
413
|
return false;
|
|
440
414
|
}
|
|
441
|
-
log2("
|
|
442
|
-
key
|
|
443
|
-
modules: modules.map((module) => module.id)
|
|
444
|
-
}, {
|
|
445
|
-
F: __dxlog_file2,
|
|
446
|
-
L: 344,
|
|
447
|
-
S: this,
|
|
448
|
-
C: (f, a) => f(...a)
|
|
449
|
-
});
|
|
450
|
-
yield* PubSub.publish(this.activation, {
|
|
451
|
-
event: key,
|
|
452
|
-
state: "activating"
|
|
453
|
-
});
|
|
454
|
-
const beforeEvents = Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))));
|
|
455
|
-
yield* Function.pipe(beforeEvents, Array.map((event2) => this.activate(event2, {
|
|
456
|
-
before: key
|
|
457
|
-
})), Effect2.allWith({
|
|
458
|
-
concurrency: "unbounded"
|
|
459
|
-
}), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("activatesBefore is taking a long time", {
|
|
460
|
-
event: key,
|
|
461
|
-
beforeEvents: beforeEvents.map(eventKey)
|
|
462
|
-
}, {
|
|
463
|
-
F: __dxlog_file2,
|
|
464
|
-
L: 363,
|
|
465
|
-
S: this,
|
|
466
|
-
C: (f, a) => f(...a)
|
|
467
|
-
}))))));
|
|
468
|
-
const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
469
|
-
concurrency: "unbounded"
|
|
470
|
-
}), Effect2.catchAll((error) => {
|
|
471
|
-
return Effect2.gen(this, function* () {
|
|
472
|
-
yield* PubSub.publish(this.activation, {
|
|
473
|
-
event: key,
|
|
474
|
-
state: "error",
|
|
475
|
-
error
|
|
476
|
-
});
|
|
477
|
-
return yield* Effect2.fail(error);
|
|
478
|
-
});
|
|
479
|
-
}));
|
|
480
|
-
yield* Function.pipe(
|
|
481
|
-
modules,
|
|
482
|
-
Array.zip(getCapabilities),
|
|
483
|
-
Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
|
|
484
|
-
Effect2.all
|
|
485
|
-
);
|
|
486
|
-
const afterEvents = Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))));
|
|
487
|
-
yield* Function.pipe(afterEvents, Array.map((event2) => this.activate(event2, {
|
|
488
|
-
after: key
|
|
489
|
-
})), Effect2.allWith({
|
|
490
|
-
concurrency: "unbounded"
|
|
491
|
-
}), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("activatesAfter is taking a long time", {
|
|
492
|
-
event: key,
|
|
493
|
-
afterEvents: afterEvents.map(eventKey)
|
|
494
|
-
}, {
|
|
495
|
-
F: __dxlog_file2,
|
|
496
|
-
L: 412,
|
|
497
|
-
S: this,
|
|
498
|
-
C: (f, a) => f(...a)
|
|
499
|
-
}))))));
|
|
500
|
-
yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
|
|
501
|
-
yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
|
|
502
|
-
if (!this._get(this._eventsFiredAtom).includes(key)) {
|
|
503
|
-
this._update(this._eventsFiredAtom, (events) => [
|
|
504
|
-
...events,
|
|
505
|
-
key
|
|
506
|
-
]);
|
|
507
|
-
}
|
|
508
|
-
yield* PubSub.publish(this.activation, {
|
|
509
|
-
event: key,
|
|
510
|
-
state: "activated"
|
|
511
|
-
});
|
|
512
|
-
log2("activated", {
|
|
513
|
-
key
|
|
415
|
+
return yield* Effect2.withFiberRuntime((fiber) => this._activateEvent(key, params, fiber).pipe(together(Effect2.sleep(Duration.seconds(15)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("event activation is taking a long time", {
|
|
416
|
+
event: key
|
|
514
417
|
}, {
|
|
515
418
|
F: __dxlog_file2,
|
|
516
|
-
L:
|
|
419
|
+
L: 328,
|
|
517
420
|
S: this,
|
|
518
421
|
C: (f, a) => f(...a)
|
|
519
|
-
})
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
})
|
|
422
|
+
}))))), Performance.addTrackEntry({
|
|
423
|
+
name: typeof event === "string" ? event : eventKey(event),
|
|
424
|
+
devtools: {
|
|
425
|
+
dataType: "track-entry",
|
|
426
|
+
track: "Event Activation",
|
|
427
|
+
trackGroup: "Composer",
|
|
428
|
+
color: "primary"
|
|
429
|
+
}
|
|
430
|
+
})));
|
|
431
|
+
});
|
|
529
432
|
}
|
|
530
433
|
/**
|
|
531
434
|
* Deactivates all of the modules for a plugin.
|
|
@@ -557,7 +460,7 @@ var ManagerImpl = class {
|
|
|
557
460
|
key
|
|
558
461
|
}, {
|
|
559
462
|
F: __dxlog_file2,
|
|
560
|
-
L:
|
|
463
|
+
L: 374,
|
|
561
464
|
S: this,
|
|
562
465
|
C: (f, a) => f(...a)
|
|
563
466
|
});
|
|
@@ -572,6 +475,41 @@ var ManagerImpl = class {
|
|
|
572
475
|
}
|
|
573
476
|
});
|
|
574
477
|
}
|
|
478
|
+
shutdown() {
|
|
479
|
+
return this._shutdownSemaphore.withPermits(1)(Effect2.gen(this, function* () {
|
|
480
|
+
yield* Ref.set(this._shuttingDown, true);
|
|
481
|
+
log2("shutdown", void 0, {
|
|
482
|
+
F: __dxlog_file2,
|
|
483
|
+
L: 393,
|
|
484
|
+
S: this,
|
|
485
|
+
C: (f, a) => f(...a)
|
|
486
|
+
});
|
|
487
|
+
yield* this._interruptInFlightActivations();
|
|
488
|
+
const activeIds = [
|
|
489
|
+
...this._get(this._activeAtom)
|
|
490
|
+
].reverse();
|
|
491
|
+
const allModules = this._get(this._modulesAtom);
|
|
492
|
+
const modulesToDeactivate = activeIds.map((id) => allModules.find((module) => module.id === id)).filter((module) => module != null);
|
|
493
|
+
for (const module of modulesToDeactivate) {
|
|
494
|
+
yield* this._deactivateModule(module);
|
|
495
|
+
}
|
|
496
|
+
this._set(this._eventsFiredAtom, []);
|
|
497
|
+
this._set(this._pendingResetAtom, []);
|
|
498
|
+
this._moduleMemoMap.clear();
|
|
499
|
+
yield* Ref.set(this._activatingEvents, []);
|
|
500
|
+
yield* Ref.set(this._activatingModules, []);
|
|
501
|
+
log2("shutdown complete", void 0, {
|
|
502
|
+
F: __dxlog_file2,
|
|
503
|
+
L: 413,
|
|
504
|
+
S: this,
|
|
505
|
+
C: (f, a) => f(...a)
|
|
506
|
+
});
|
|
507
|
+
return true;
|
|
508
|
+
}).pipe(Effect2.ensuring(Ref.set(this._shuttingDown, false))));
|
|
509
|
+
}
|
|
510
|
+
//
|
|
511
|
+
// State helpers
|
|
512
|
+
//
|
|
575
513
|
_get(atom) {
|
|
576
514
|
return this.registry.get(atom);
|
|
577
515
|
}
|
|
@@ -581,12 +519,82 @@ var ManagerImpl = class {
|
|
|
581
519
|
_update(atom, updater) {
|
|
582
520
|
this._set(atom, updater(this._get(atom)));
|
|
583
521
|
}
|
|
522
|
+
_isShuttingDown() {
|
|
523
|
+
return Ref.get(this._shuttingDown);
|
|
524
|
+
}
|
|
525
|
+
_getPlugin(id) {
|
|
526
|
+
return this._get(this._pluginsAtom).find((plugin) => plugin.meta.id === id);
|
|
527
|
+
}
|
|
528
|
+
_getActiveModules() {
|
|
529
|
+
const active = this._get(this._activeAtom);
|
|
530
|
+
return this._get(this._modulesAtom).filter((module) => active.includes(module.id));
|
|
531
|
+
}
|
|
532
|
+
_getInactiveModules() {
|
|
533
|
+
const active = this._get(this._activeAtom);
|
|
534
|
+
return this._get(this._modulesAtom).filter((module) => !active.includes(module.id));
|
|
535
|
+
}
|
|
536
|
+
_getActiveModulesByEvent(key) {
|
|
537
|
+
return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
538
|
+
}
|
|
539
|
+
_getInactiveModulesByEvent(key) {
|
|
540
|
+
return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
541
|
+
}
|
|
542
|
+
_setPendingResetByModule(module) {
|
|
543
|
+
const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._get(this._eventsFiredAtom).includes(key));
|
|
544
|
+
const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => {
|
|
545
|
+
const pending = this._get(this._pendingResetAtom);
|
|
546
|
+
return !pending.includes(event);
|
|
547
|
+
});
|
|
548
|
+
if (pendingReset.length > 0) {
|
|
549
|
+
log2("pending reset", {
|
|
550
|
+
events: pendingReset
|
|
551
|
+
}, {
|
|
552
|
+
F: __dxlog_file2,
|
|
553
|
+
L: 475,
|
|
554
|
+
S: this,
|
|
555
|
+
C: (f, a) => f(...a)
|
|
556
|
+
});
|
|
557
|
+
this._update(this._pendingResetAtom, (current) => [
|
|
558
|
+
...current,
|
|
559
|
+
...pendingReset
|
|
560
|
+
]);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
_clearPendingReset(key) {
|
|
564
|
+
const pendingIndex = this._get(this._pendingResetAtom).findIndex((event) => event === key);
|
|
565
|
+
if (pendingIndex !== -1) {
|
|
566
|
+
this._update(this._pendingResetAtom, (pending) => pending.filter((event) => event !== key));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
//
|
|
570
|
+
// Fiber helpers
|
|
571
|
+
//
|
|
572
|
+
_interruptInFlightActivations() {
|
|
573
|
+
return Effect2.gen(this, function* () {
|
|
574
|
+
const inFlightFibers = yield* Ref.get(this._inFlightFibers);
|
|
575
|
+
yield* Effect2.forEach(inFlightFibers, (fiber) => Fiber.interrupt(fiber), {
|
|
576
|
+
concurrency: "unbounded"
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
_trackFiber(ref, fiber) {
|
|
581
|
+
return Ref.update(ref, (fibers) => [
|
|
582
|
+
...fibers,
|
|
583
|
+
fiber
|
|
584
|
+
]);
|
|
585
|
+
}
|
|
586
|
+
_untrackFiber(ref, fiber) {
|
|
587
|
+
return Ref.update(ref, (fibers) => fibers.filter((trackedFiber) => trackedFiber !== fiber));
|
|
588
|
+
}
|
|
589
|
+
//
|
|
590
|
+
// Registration helpers
|
|
591
|
+
//
|
|
584
592
|
_addPlugin(plugin) {
|
|
585
593
|
log2("add plugin", {
|
|
586
594
|
id: plugin.meta.id
|
|
587
595
|
}, {
|
|
588
596
|
F: __dxlog_file2,
|
|
589
|
-
L:
|
|
597
|
+
L: 519,
|
|
590
598
|
S: this,
|
|
591
599
|
C: (f, a) => f(...a)
|
|
592
600
|
});
|
|
@@ -600,7 +608,7 @@ var ManagerImpl = class {
|
|
|
600
608
|
id
|
|
601
609
|
}, {
|
|
602
610
|
F: __dxlog_file2,
|
|
603
|
-
L:
|
|
611
|
+
L: 525,
|
|
604
612
|
S: this,
|
|
605
613
|
C: (f, a) => f(...a)
|
|
606
614
|
});
|
|
@@ -611,7 +619,7 @@ var ManagerImpl = class {
|
|
|
611
619
|
id: module.id
|
|
612
620
|
}, {
|
|
613
621
|
F: __dxlog_file2,
|
|
614
|
-
L:
|
|
622
|
+
L: 530,
|
|
615
623
|
S: this,
|
|
616
624
|
C: (f, a) => f(...a)
|
|
617
625
|
});
|
|
@@ -625,49 +633,160 @@ var ManagerImpl = class {
|
|
|
625
633
|
id
|
|
626
634
|
}, {
|
|
627
635
|
F: __dxlog_file2,
|
|
628
|
-
L:
|
|
636
|
+
L: 536,
|
|
629
637
|
S: this,
|
|
630
638
|
C: (f, a) => f(...a)
|
|
631
639
|
});
|
|
632
640
|
this._update(this._modulesAtom, (modules) => modules.filter((module) => module.id !== id));
|
|
633
641
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
return this._get(this._modulesAtom).filter((module) => !active.includes(module.id));
|
|
644
|
-
}
|
|
645
|
-
_getActiveModulesByEvent(key) {
|
|
646
|
-
return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
647
|
-
}
|
|
648
|
-
_getInactiveModulesByEvent(key) {
|
|
649
|
-
return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
650
|
-
}
|
|
651
|
-
_setPendingResetByModule(module) {
|
|
652
|
-
const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._get(this._eventsFiredAtom).includes(key));
|
|
653
|
-
const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => {
|
|
654
|
-
const pending = this._get(this._pendingResetAtom);
|
|
655
|
-
return !pending.includes(event);
|
|
656
|
-
});
|
|
657
|
-
if (pendingReset.length > 0) {
|
|
658
|
-
log2("pending reset", {
|
|
659
|
-
events: pendingReset
|
|
642
|
+
//
|
|
643
|
+
// Activation helpers
|
|
644
|
+
//
|
|
645
|
+
_activateEvent(key, params, fiber) {
|
|
646
|
+
return Effect2.gen(this, function* () {
|
|
647
|
+
yield* this._trackFiber(this._inFlightFibers, fiber);
|
|
648
|
+
log2("activating", {
|
|
649
|
+
key,
|
|
650
|
+
...params
|
|
660
651
|
}, {
|
|
661
652
|
F: __dxlog_file2,
|
|
662
|
-
L:
|
|
653
|
+
L: 551,
|
|
663
654
|
S: this,
|
|
664
655
|
C: (f, a) => f(...a)
|
|
665
656
|
});
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
657
|
+
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
658
|
+
this._clearPendingReset(key);
|
|
659
|
+
const activatingEvents = yield* this._activatingEvents;
|
|
660
|
+
const activatingModules = yield* this._activatingModules;
|
|
661
|
+
const modules = this._getModulesForActivation(key, activatingEvents, activatingModules);
|
|
662
|
+
if (modules.length === 0) {
|
|
663
|
+
log2("no modules to activate", {
|
|
664
|
+
key
|
|
665
|
+
}, {
|
|
666
|
+
F: __dxlog_file2,
|
|
667
|
+
L: 559,
|
|
668
|
+
S: this,
|
|
669
|
+
C: (f, a) => f(...a)
|
|
670
|
+
});
|
|
671
|
+
if (!this._get(this._eventsFiredAtom).includes(key)) {
|
|
672
|
+
this._update(this._eventsFiredAtom, (events) => [
|
|
673
|
+
...events,
|
|
674
|
+
key
|
|
675
|
+
]);
|
|
676
|
+
}
|
|
677
|
+
return false;
|
|
678
|
+
}
|
|
679
|
+
return yield* this._activateModulesForEvent(key, modules, activatingEvents);
|
|
680
|
+
}).pipe(Effect2.ensuring(Effect2.all([
|
|
681
|
+
this._untrackFiber(this._inFlightFibers, fiber),
|
|
682
|
+
Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event) => event !== key))
|
|
683
|
+
])));
|
|
684
|
+
}
|
|
685
|
+
_activateModulesForEvent(key, modules, activatingEvents) {
|
|
686
|
+
const activatingModuleIds = modules.map((module) => module.id);
|
|
687
|
+
return Effect2.gen(this, function* () {
|
|
688
|
+
yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, activatingModuleIds));
|
|
689
|
+
log2("activating modules", {
|
|
690
|
+
key,
|
|
691
|
+
modules: activatingModuleIds
|
|
692
|
+
}, {
|
|
693
|
+
F: __dxlog_file2,
|
|
694
|
+
L: 586,
|
|
695
|
+
S: this,
|
|
696
|
+
C: (f, a) => f(...a)
|
|
697
|
+
});
|
|
698
|
+
performance.mark(`event:${key}:start`);
|
|
699
|
+
yield* PubSub.publish(this.activation, {
|
|
700
|
+
event: key,
|
|
701
|
+
state: "activating"
|
|
702
|
+
});
|
|
703
|
+
yield* this._activateRelatedEvents(key, this._getBeforeEvents(modules, activatingEvents), "before");
|
|
704
|
+
const capabilities = yield* this._loadCapabilitiesForModules(key, modules);
|
|
705
|
+
yield* this._contributeCapabilitiesForModules(modules, capabilities);
|
|
706
|
+
yield* this._activateRelatedEvents(key, this._getAfterEvents(modules, activatingEvents), "after");
|
|
707
|
+
if (!this._get(this._eventsFiredAtom).includes(key)) {
|
|
708
|
+
this._update(this._eventsFiredAtom, (events) => [
|
|
709
|
+
...events,
|
|
710
|
+
key
|
|
711
|
+
]);
|
|
712
|
+
}
|
|
713
|
+
performance.mark(`event:${key}:end`);
|
|
714
|
+
performance.measure(`event:${key}`, `event:${key}:start`, `event:${key}:end`);
|
|
715
|
+
yield* PubSub.publish(this.activation, {
|
|
716
|
+
event: key,
|
|
717
|
+
state: "activated"
|
|
718
|
+
});
|
|
719
|
+
log2("activated", {
|
|
720
|
+
key
|
|
721
|
+
}, {
|
|
722
|
+
F: __dxlog_file2,
|
|
723
|
+
L: 604,
|
|
724
|
+
S: this,
|
|
725
|
+
C: (f, a) => f(...a)
|
|
726
|
+
});
|
|
727
|
+
return true;
|
|
728
|
+
}).pipe(Effect2.ensuring(Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !activatingModuleIds.includes(module)))));
|
|
729
|
+
}
|
|
730
|
+
_getModulesForActivation(key, activatingEvents, activatingModules) {
|
|
731
|
+
return this._getInactiveModulesByEvent(key).filter((module) => {
|
|
732
|
+
const allOf = isAllOf(module.activatesOn);
|
|
733
|
+
if (!allOf) {
|
|
734
|
+
return true;
|
|
735
|
+
}
|
|
736
|
+
const events = getEvents(module.activatesOn).filter((event) => eventKey(event) !== key);
|
|
737
|
+
return events.every((event) => this._get(this._eventsFiredAtom).includes(eventKey(event)) || activatingEvents.includes(eventKey(event))) && !activatingModules.includes(module.id);
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
_getBeforeEvents(modules, activatingEvents) {
|
|
741
|
+
return Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
|
|
742
|
+
}
|
|
743
|
+
_getAfterEvents(modules, activatingEvents) {
|
|
744
|
+
return Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
|
|
745
|
+
}
|
|
746
|
+
_activateRelatedEvents(key, events, phase) {
|
|
747
|
+
const logLabel = phase === "before" ? "activatesBefore" : "activatesAfter";
|
|
748
|
+
const eventKey2 = phase === "before" ? "beforeEvents" : "afterEvents";
|
|
749
|
+
return Function.pipe(events, Array.map((event) => this.activate(event, phase === "before" ? {
|
|
750
|
+
before: key
|
|
751
|
+
} : {
|
|
752
|
+
after: key
|
|
753
|
+
})), Effect2.allWith({
|
|
754
|
+
concurrency: "unbounded"
|
|
755
|
+
}), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`${logLabel} is taking a long time`, {
|
|
756
|
+
event: key,
|
|
757
|
+
[eventKey2]: events.map(eventKey)
|
|
758
|
+
}, {
|
|
759
|
+
F: __dxlog_file2,
|
|
760
|
+
L: 683,
|
|
761
|
+
S: this,
|
|
762
|
+
C: (f, a) => f(...a)
|
|
763
|
+
}))))), Effect2.asVoid);
|
|
764
|
+
}
|
|
765
|
+
//
|
|
766
|
+
// Module lifecycle helpers
|
|
767
|
+
//
|
|
768
|
+
_loadCapabilitiesForModules(key, modules) {
|
|
769
|
+
return Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
770
|
+
concurrency: "unbounded"
|
|
771
|
+
}), Effect2.catchAll((error) => {
|
|
772
|
+
return Effect2.gen(this, function* () {
|
|
773
|
+
yield* PubSub.publish(this.activation, {
|
|
774
|
+
event: key,
|
|
775
|
+
state: "error",
|
|
776
|
+
error
|
|
777
|
+
});
|
|
778
|
+
return yield* Effect2.fail(error);
|
|
779
|
+
});
|
|
780
|
+
}));
|
|
781
|
+
}
|
|
782
|
+
_contributeCapabilitiesForModules(modules, capabilities) {
|
|
783
|
+
return Function.pipe(
|
|
784
|
+
modules,
|
|
785
|
+
Array.zip(capabilities),
|
|
786
|
+
Array.map(([module, capabilitySet]) => this._contributeCapabilities(module, capabilitySet)),
|
|
787
|
+
Effect2.all,
|
|
788
|
+
Effect2.asVoid
|
|
789
|
+
);
|
|
671
790
|
}
|
|
672
791
|
_getModuleSemaphore(moduleId) {
|
|
673
792
|
let semaphore = this._moduleSemaphores.get(moduleId);
|
|
@@ -691,21 +810,35 @@ var ManagerImpl = class {
|
|
|
691
810
|
module: module.id
|
|
692
811
|
}, {
|
|
693
812
|
F: __dxlog_file2,
|
|
694
|
-
L:
|
|
813
|
+
L: 756,
|
|
695
814
|
S: this,
|
|
696
815
|
C: (f, a) => f(...a)
|
|
697
816
|
});
|
|
817
|
+
performance.mark(`module:${module.id}:start`);
|
|
818
|
+
yield* PubSub.publish(this.activation, {
|
|
819
|
+
event: "",
|
|
820
|
+
state: "activating",
|
|
821
|
+
module: module.id
|
|
822
|
+
});
|
|
698
823
|
const [duration, capabilities] = yield* module.activate().pipe(Effect2.provideService(Service, this.capabilities), Effect2.provideService(Service2, this), Effect2.timed);
|
|
699
824
|
const normalized = capabilities == null ? [] : Array.isArray(capabilities) ? capabilities : [
|
|
700
825
|
capabilities
|
|
701
826
|
];
|
|
827
|
+
const elapsed = Duration.toMillis(duration);
|
|
828
|
+
performance.mark(`module:${module.id}:end`);
|
|
829
|
+
performance.measure(`module:${module.id}`, `module:${module.id}:start`, `module:${module.id}:end`);
|
|
830
|
+
yield* PubSub.publish(this.activation, {
|
|
831
|
+
event: "",
|
|
832
|
+
state: "activated",
|
|
833
|
+
module: module.id
|
|
834
|
+
});
|
|
702
835
|
log2("loaded module", {
|
|
703
836
|
module: module.id,
|
|
704
|
-
elapsed
|
|
837
|
+
elapsed,
|
|
705
838
|
failed: false
|
|
706
839
|
}, {
|
|
707
840
|
F: __dxlog_file2,
|
|
708
|
-
L:
|
|
841
|
+
L: 771,
|
|
709
842
|
S: this,
|
|
710
843
|
C: (f, a) => f(...a)
|
|
711
844
|
});
|
|
@@ -714,11 +847,19 @@ var ManagerImpl = class {
|
|
|
714
847
|
module: module.id
|
|
715
848
|
}, {
|
|
716
849
|
F: __dxlog_file2,
|
|
717
|
-
L:
|
|
850
|
+
L: 782,
|
|
718
851
|
S: this,
|
|
719
852
|
C: (f, a) => f(...a)
|
|
720
|
-
})))))
|
|
721
|
-
|
|
853
|
+
}))))), Performance.addTrackEntry({
|
|
854
|
+
name: module.id,
|
|
855
|
+
devtools: {
|
|
856
|
+
dataType: "track-entry",
|
|
857
|
+
track: "Module Activation",
|
|
858
|
+
trackGroup: "Composer",
|
|
859
|
+
color: "primary"
|
|
860
|
+
}
|
|
861
|
+
}));
|
|
862
|
+
const fiber = yield* Effect2.forkDaemon(loadEffect.pipe(Effect2.tap((result) => Deferred2.succeed(deferred, result)), Effect2.catchAllCause((cause) => {
|
|
722
863
|
const error = Cause.squash(cause);
|
|
723
864
|
log2.error("module failed to activate", {
|
|
724
865
|
module: module.id,
|
|
@@ -727,12 +868,14 @@ var ManagerImpl = class {
|
|
|
727
868
|
isDefect: !Cause.isFailure(cause)
|
|
728
869
|
}, {
|
|
729
870
|
F: __dxlog_file2,
|
|
730
|
-
L:
|
|
871
|
+
L: 803,
|
|
731
872
|
S: this,
|
|
732
873
|
C: (f, a) => f(...a)
|
|
733
874
|
});
|
|
734
875
|
return Deferred2.fail(deferred, error instanceof Error ? error : new Error(String(error)));
|
|
735
876
|
})));
|
|
877
|
+
yield* this._trackFiber(this._inFlightFibers, fiber);
|
|
878
|
+
yield* Effect2.forkDaemon(Fiber.await(fiber).pipe(Effect2.andThen(() => this._untrackFiber(this._inFlightFibers, fiber))));
|
|
736
879
|
return deferred;
|
|
737
880
|
}).pipe(semaphore.withPermits(1));
|
|
738
881
|
return yield* Deferred2.await(deferredToAwait);
|
|
@@ -759,7 +902,7 @@ var ManagerImpl = class {
|
|
|
759
902
|
id
|
|
760
903
|
}, {
|
|
761
904
|
F: __dxlog_file2,
|
|
762
|
-
L:
|
|
905
|
+
L: 841,
|
|
763
906
|
S: this,
|
|
764
907
|
C: (f, a) => f(...a)
|
|
765
908
|
});
|
|
@@ -781,7 +924,7 @@ var ManagerImpl = class {
|
|
|
781
924
|
id
|
|
782
925
|
}, {
|
|
783
926
|
F: __dxlog_file2,
|
|
784
|
-
L:
|
|
927
|
+
L: 859,
|
|
785
928
|
S: this,
|
|
786
929
|
C: (f, a) => f(...a)
|
|
787
930
|
});
|
|
@@ -804,4 +947,4 @@ export {
|
|
|
804
947
|
make5 as make,
|
|
805
948
|
plugin_manager_exports
|
|
806
949
|
};
|
|
807
|
-
//# sourceMappingURL=chunk-
|
|
950
|
+
//# sourceMappingURL=chunk-27FZETIA.mjs.map
|