@dxos/app-framework 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{capability-BBBBAPDI.mjs → capability-Q5XRXRD2.mjs} +10 -10
- package/dist/lib/browser/{capability-OP63CD5N.mjs → capability-V7LR4LQN.mjs} +11 -11
- package/dist/lib/browser/capability-V7LR4LQN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T3Y4AEKX.mjs → chunk-23D4SJUE.mjs} +3 -3
- package/dist/lib/browser/{chunk-T3Y4AEKX.mjs.map → chunk-23D4SJUE.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-2CKCJ6PN.mjs → chunk-3JWJXGLK.mjs} +1 -1
- package/dist/lib/browser/{chunk-2CKCJ6PN.mjs.map → chunk-3JWJXGLK.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-GX4TUNM6.mjs → chunk-3ZS2A3DN.mjs} +170 -226
- package/dist/lib/browser/chunk-3ZS2A3DN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
- package/dist/lib/browser/chunk-5LAIGWLU.mjs +467 -0
- package/dist/lib/browser/chunk-5LAIGWLU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
- package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
- package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
- package/dist/lib/browser/chunk-G7SDBRKH.mjs +1 -0
- package/dist/lib/browser/chunk-JXCBZSBJ.mjs +372 -0
- package/dist/lib/browser/chunk-JXCBZSBJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
- package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FU4GAFUQ.mjs → chunk-Z55LVAGN.mjs} +80 -15
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +11 -27
- package/dist/lib/browser/cli/index.mjs.map +2 -2
- package/dist/lib/browser/common/activation-events.mjs +7 -7
- package/dist/lib/browser/common/capabilities.mjs +7 -7
- 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 +6 -4
- package/dist/lib/browser/core/plugin.mjs +10 -2
- package/dist/lib/browser/core/url-loader.mjs +13 -5
- package/dist/lib/browser/index.mjs +22 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{invoker-capability-H5PPENOC.mjs → invoker-capability-LNX4CGIV.mjs} +12 -11
- package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +144 -27
- 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 +18 -14
- package/dist/lib/node-esm/{capability-AWBEMRYR.mjs → capability-EW5GJCI6.mjs} +10 -10
- package/dist/lib/node-esm/{capability-WFEG6CIZ.mjs → capability-YKBMMD53.mjs} +11 -11
- package/dist/lib/node-esm/capability-YKBMMD53.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs → chunk-6XW6LET6.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-URWHJQT2.mjs → chunk-D347W3KO.mjs} +7 -32
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs +373 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ULUEXB7Q.mjs → chunk-HTBJU5FX.mjs} +80 -15
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs +468 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs → chunk-OZ7DZA5Z.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-BCEOLX47.mjs → chunk-Q7XBFII4.mjs} +170 -226
- package/dist/lib/node-esm/chunk-Q7XBFII4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
- package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
- package/dist/lib/node-esm/cli/index.mjs +11 -27
- package/dist/lib/node-esm/cli/index.mjs.map +2 -2
- package/dist/lib/node-esm/common/activation-events.mjs +7 -7
- package/dist/lib/node-esm/common/capabilities.mjs +7 -7
- 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 +6 -4
- package/dist/lib/node-esm/core/plugin.mjs +10 -2
- package/dist/lib/node-esm/core/url-loader.mjs +13 -5
- package/dist/lib/node-esm/index.mjs +22 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{invoker-capability-S3ZA527J.mjs → invoker-capability-O4T5PHLA.mjs} +12 -11
- package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +144 -27
- 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 +18 -14
- package/dist/plugin/node-esm/index.mjs +480 -32
- package/dist/plugin/node-esm/index.mjs.map +4 -4
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/types/src/common/capabilities.d.ts +2 -1
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +1 -1
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +4 -4
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +2 -2
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/index.d.ts +2 -0
- 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 +51 -2
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +76 -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 +107 -6
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +90 -3
- package/dist/types/src/core/url-loader.d.ts.map +1 -1
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.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 +2 -1
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- 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 +1 -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.map +1 -1
- 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.map +1 -1
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
- 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/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +16 -6
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- 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 +1 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +29 -3
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- 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 +52 -0
- package/dist/types/src/vite-plugin/boot-loader/index.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 +4 -2
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/manifest.d.ts +37 -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 +10 -4
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +1 -0
- package/package.json +33 -59
- package/src/common/capabilities.ts +2 -1
- package/src/common/operations.ts +1 -1
- package/src/core/capability.ts +1 -1
- package/src/core/index.ts +2 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +246 -5
- package/src/core/plugin-manager.ts +167 -25
- package/src/core/plugin-manifest.test.ts +48 -0
- package/src/core/plugin-manifest.ts +102 -0
- package/src/core/plugin.ts +135 -10
- package/src/core/url-loader.test.ts +104 -5
- package/src/core/url-loader.ts +226 -37
- package/src/plugin-operation/OperationPlugin.ts +2 -2
- package/src/plugin-operation/history/capability.ts +1 -1
- package/src/plugin-operation/history/history-tracker.test.ts +2 -1
- package/src/plugin-operation/history/history-tracker.ts +1 -1
- package/src/plugin-operation/history/types.ts +1 -1
- package/src/plugin-operation/history/undo-mapping.ts +1 -1
- package/src/plugin-operation/history/undo-registry.ts +1 -1
- package/src/plugin-operation/invoker-capability.ts +2 -1
- package/src/plugin-operation/testing.ts +2 -1
- package/src/plugin-runtime/RuntimePlugin.ts +2 -2
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/withPluginManager.stories.tsx +1 -1
- package/src/ui/components/App/App.stories.tsx +1 -1
- package/src/ui/components/App/App.tsx +25 -2
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/ui/components/Placeholder/index.ts +5 -0
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
- package/src/ui/components/Surface/SurfaceComponent.tsx +83 -46
- package/src/ui/components/Surface/index.ts +20 -1
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +164 -12
- package/src/ui/components/index.ts +1 -0
- package/src/ui/hooks/useApp.tsx +165 -41
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
- package/src/vite-plugin/boot-loader/index.ts +112 -0
- package/src/vite-plugin/composer/index.ts +277 -0
- package/src/vite-plugin/import-map/index.ts +524 -0
- package/src/vite-plugin/index.ts +6 -2
- package/src/vite-plugin/manifest.test.ts +24 -0
- package/src/vite-plugin/manifest.ts +50 -0
- package/src/vite-plugin/packages.ts +169 -10
- package/tsconfig.json +9 -0
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-OP63CD5N.mjs.map +0 -7
- package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
- package/dist/lib/browser/chunk-FU4GAFUQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-GX4TUNM6.mjs.map +0 -7
- package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
- package/dist/lib/browser/chunk-LVJW5EFU.mjs +0 -157
- package/dist/lib/browser/chunk-LVJW5EFU.mjs.map +0 -7
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
- package/dist/lib/browser/chunk-WPE6AL7I.mjs +0 -905
- package/dist/lib/browser/chunk-WPE6AL7I.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-H5PPENOC.mjs.map +0 -7
- package/dist/lib/node-esm/capability-WFEG6CIZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs +0 -158
- package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BCEOLX47.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LQKOTNJW.mjs +0 -906
- package/dist/lib/node-esm/chunk-LQKOTNJW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ULUEXB7Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
- package/dist/lib/node-esm/invoker-capability-S3ZA527J.mjs.map +0 -7
- package/dist/types/src/vite-plugin/composer-plugin.d.ts +0 -18
- package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +0 -1
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts +0 -16
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +0 -1
- package/src/vite-plugin/composer-plugin.ts +0 -128
- package/src/vite-plugin/import-map-plugin.ts +0 -314
- /package/dist/lib/browser/{capability-BBBBAPDI.mjs.map → capability-Q5XRXRD2.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-RFSO3JRG.mjs.map → chunk-G7SDBRKH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{capability-AWBEMRYR.mjs.map → capability-EW5GJCI6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs.map → chunk-6XW6LET6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs.map → chunk-OZ7DZA5Z.mjs.map} +0 -0
|
@@ -2,13 +2,15 @@ import {
|
|
|
2
2
|
eventKey,
|
|
3
3
|
getEvents,
|
|
4
4
|
isAllOf
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-66IXTIVK.mjs";
|
|
6
6
|
import {
|
|
7
|
-
Service as Service2
|
|
8
|
-
|
|
7
|
+
Service as Service2,
|
|
8
|
+
isLazy,
|
|
9
|
+
resolveLazy
|
|
10
|
+
} from "./chunk-Z55LVAGN.mjs";
|
|
9
11
|
import {
|
|
10
12
|
Service
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3JWJXGLK.mjs";
|
|
12
14
|
import {
|
|
13
15
|
__export
|
|
14
16
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -17,6 +19,7 @@ import {
|
|
|
17
19
|
var plugin_manager_exports = {};
|
|
18
20
|
__export(plugin_manager_exports, {
|
|
19
21
|
ManagerTypeId: () => ManagerTypeId,
|
|
22
|
+
PluginInitializationError: () => PluginInitializationError,
|
|
20
23
|
isManager: () => isManager,
|
|
21
24
|
make: () => make5
|
|
22
25
|
});
|
|
@@ -33,6 +36,7 @@ import * as PubSub from "effect/PubSub";
|
|
|
33
36
|
import * as Ref from "effect/Ref";
|
|
34
37
|
import { runAndForwardErrors } from "@dxos/effect";
|
|
35
38
|
import { Performance } from "@dxos/effect";
|
|
39
|
+
import { BaseError } from "@dxos/errors";
|
|
36
40
|
import { log as log2 } from "@dxos/log";
|
|
37
41
|
|
|
38
42
|
// src/core/capability-manager.ts
|
|
@@ -70,15 +74,7 @@ var CapabilityManagerImpl = class {
|
|
|
70
74
|
_capability = Atom.family((id) => {
|
|
71
75
|
return Atom.make((get2) => {
|
|
72
76
|
const current = get2(this._capabilities(id));
|
|
73
|
-
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
74
|
-
F: __dxlog_file,
|
|
75
|
-
L: 101,
|
|
76
|
-
S: this,
|
|
77
|
-
A: [
|
|
78
|
-
"current.length > 0",
|
|
79
|
-
"`No capability found for ${id}`"
|
|
80
|
-
]
|
|
81
|
-
});
|
|
77
|
+
invariant(current.length > 0, `No capability found for ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 35, S: this, A: ["current.length > 0", "`No capability found for ${id}`"] });
|
|
82
78
|
return current[0];
|
|
83
79
|
});
|
|
84
80
|
});
|
|
@@ -92,12 +88,7 @@ var CapabilityManagerImpl = class {
|
|
|
92
88
|
log("capability already contributed, skipping", {
|
|
93
89
|
id: interfaceDef.identifier,
|
|
94
90
|
moduleId
|
|
95
|
-
}, {
|
|
96
|
-
F: __dxlog_file,
|
|
97
|
-
L: 122,
|
|
98
|
-
S: this,
|
|
99
|
-
C: (f, a) => f(...a)
|
|
100
|
-
});
|
|
91
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 46, S: this });
|
|
101
92
|
return;
|
|
102
93
|
}
|
|
103
94
|
const entry = {
|
|
@@ -112,12 +103,7 @@ var CapabilityManagerImpl = class {
|
|
|
112
103
|
id: interfaceDef.identifier,
|
|
113
104
|
moduleId,
|
|
114
105
|
count: current.length
|
|
115
|
-
}, {
|
|
116
|
-
F: __dxlog_file,
|
|
117
|
-
L: 128,
|
|
118
|
-
S: this,
|
|
119
|
-
C: (f, a) => f(...a)
|
|
120
|
-
});
|
|
106
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 60, S: this });
|
|
121
107
|
}
|
|
122
108
|
remove(interfaceDef, implementation) {
|
|
123
109
|
const current = this._registry.get(this._capabilityEntries(interfaceDef.identifier));
|
|
@@ -130,21 +116,11 @@ var CapabilityManagerImpl = class {
|
|
|
130
116
|
log("capability removed", {
|
|
131
117
|
id: interfaceDef.identifier,
|
|
132
118
|
count: current.length
|
|
133
|
-
}, {
|
|
134
|
-
F: __dxlog_file,
|
|
135
|
-
L: 144,
|
|
136
|
-
S: this,
|
|
137
|
-
C: (f, a) => f(...a)
|
|
138
|
-
});
|
|
119
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 74, S: this });
|
|
139
120
|
} else {
|
|
140
121
|
log.warn("capability not removed", {
|
|
141
122
|
id: interfaceDef.identifier
|
|
142
|
-
}, {
|
|
143
|
-
F: __dxlog_file,
|
|
144
|
-
L: 146,
|
|
145
|
-
S: this,
|
|
146
|
-
C: (f, a) => f(...a)
|
|
147
|
-
});
|
|
123
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 79, S: this });
|
|
148
124
|
}
|
|
149
125
|
}
|
|
150
126
|
atom(interfaceDef) {
|
|
@@ -155,15 +131,7 @@ var CapabilityManagerImpl = class {
|
|
|
155
131
|
}
|
|
156
132
|
get(interfaceDef) {
|
|
157
133
|
const capabilities = this.getAll(interfaceDef);
|
|
158
|
-
invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
|
|
159
|
-
F: __dxlog_file,
|
|
160
|
-
L: 161,
|
|
161
|
-
S: this,
|
|
162
|
-
A: [
|
|
163
|
-
"capabilities.length > 0",
|
|
164
|
-
"`No capability found for ${interfaceDef.identifier}`"
|
|
165
|
-
]
|
|
166
|
-
});
|
|
134
|
+
invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 93, S: this, A: ["capabilities.length > 0", "`No capability found for ${interfaceDef.identifier}`"] });
|
|
167
135
|
return capabilities[0];
|
|
168
136
|
}
|
|
169
137
|
waitFor(interfaceDef) {
|
|
@@ -191,6 +159,8 @@ var make2 = (options) => new CapabilityManagerImpl(options);
|
|
|
191
159
|
|
|
192
160
|
// src/core/plugin-manager.ts
|
|
193
161
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin-manager.ts";
|
|
162
|
+
var PluginInitializationError = class extends BaseError.extend("PluginInitializationError", "Plugin manager initialization failed") {
|
|
163
|
+
};
|
|
194
164
|
var ManagerTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Manager");
|
|
195
165
|
var isManager = (value) => {
|
|
196
166
|
return typeof value === "object" && value !== null && ManagerTypeId in value;
|
|
@@ -208,20 +178,36 @@ var ManagerImpl = class {
|
|
|
208
178
|
_eventsFiredAtom;
|
|
209
179
|
_pendingResetAtom;
|
|
210
180
|
_pluginLoader;
|
|
181
|
+
_onRemove;
|
|
211
182
|
_capabilities = /* @__PURE__ */ new Map();
|
|
212
183
|
_moduleMemoMap = /* @__PURE__ */ new Map();
|
|
213
184
|
_moduleSemaphores = /* @__PURE__ */ new Map();
|
|
185
|
+
// Coalesces concurrent `_resolveLazyPlugin` calls per plugin id. Without
|
|
186
|
+
// this, two callers entering `enable(id)` before the swap completes would
|
|
187
|
+
// each invoke `mod.default(options)` and produce distinct module objects,
|
|
188
|
+
// defeating `_addModule`'s reference-equality dedupe and racing the
|
|
189
|
+
// `_pluginsAtom` swap.
|
|
190
|
+
_resolvingPlugins = /* @__PURE__ */ new Map();
|
|
214
191
|
_activatingEvents = Effect2.runSync(Ref.make([]));
|
|
215
192
|
_activatingModules = Effect2.runSync(Ref.make([]));
|
|
216
193
|
_inFlightFibers = Effect2.runSync(Ref.make([]));
|
|
217
194
|
_shutdownSemaphore = Effect2.runSync(Effect2.makeSemaphore(1));
|
|
218
195
|
_shuttingDown = Effect2.runSync(Ref.make(false));
|
|
219
|
-
|
|
196
|
+
// Tracks the constructor-launched core/enabled `enable()` calls so that
|
|
197
|
+
// `activate` can wait for module registration before dispatching events.
|
|
198
|
+
// Lazy plugins make `enable` asynchronous (a dynamic `import()` happens
|
|
199
|
+
// inside it), so without this synchronization an `activate` triggered
|
|
200
|
+
// immediately after `make` could fire on an empty module set. Failures
|
|
201
|
+
// are wrapped in `PluginInitializationError` so awaiters get a tagged
|
|
202
|
+
// error rather than the wide `Error` produced by the underlying chain.
|
|
203
|
+
_initialization = Effect2.runSync(Deferred2.make());
|
|
204
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry, onRemove }) {
|
|
220
205
|
this.registry = registry ?? Registry.make();
|
|
221
206
|
this.capabilities = make2({
|
|
222
207
|
registry: this.registry
|
|
223
208
|
});
|
|
224
209
|
this._pluginLoader = pluginLoader;
|
|
210
|
+
this._onRemove = onRemove;
|
|
225
211
|
this._pluginsAtom = Atom2.make(plugins).pipe(Atom2.keepAlive);
|
|
226
212
|
this._coreAtom = Atom2.make(core).pipe(Atom2.keepAlive);
|
|
227
213
|
this._enabledAtom = Atom2.make(enabled).pipe(Atom2.keepAlive);
|
|
@@ -230,10 +216,15 @@ var ManagerImpl = class {
|
|
|
230
216
|
this._eventsFiredAtom = Atom2.make([]).pipe(Atom2.keepAlive);
|
|
231
217
|
this._pendingResetAtom = Atom2.make([]).pipe(Atom2.keepAlive);
|
|
232
218
|
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
219
|
+
const initialIds = [
|
|
220
|
+
.../* @__PURE__ */ new Set([
|
|
221
|
+
...core,
|
|
222
|
+
...enabled
|
|
223
|
+
])
|
|
224
|
+
];
|
|
225
|
+
void Effect2.all(initialIds.map((id) => this.enable(id))).pipe(Effect2.mapError((cause) => new PluginInitializationError({
|
|
226
|
+
cause
|
|
227
|
+
})), Effect2.tap(() => Deferred2.succeed(this._initialization, void 0)), Effect2.tapErrorCause((cause) => Deferred2.failCause(this._initialization, cause))).pipe(runAndForwardErrors);
|
|
237
228
|
}
|
|
238
229
|
get plugins() {
|
|
239
230
|
return this._pluginsAtom;
|
|
@@ -294,21 +285,17 @@ var ManagerImpl = class {
|
|
|
294
285
|
}
|
|
295
286
|
/**
|
|
296
287
|
* Adds a plugin to the manager via the plugin loader.
|
|
288
|
+
* The plugin is registered but not enabled; call `enable` separately to activate it.
|
|
297
289
|
* @param id The id of the plugin.
|
|
298
290
|
*/
|
|
299
291
|
add(id) {
|
|
300
292
|
return Effect2.gen(this, function* () {
|
|
301
293
|
log2("add plugin", {
|
|
302
294
|
id
|
|
303
|
-
}, {
|
|
304
|
-
F: __dxlog_file2,
|
|
305
|
-
L: 227,
|
|
306
|
-
S: this,
|
|
307
|
-
C: (f, a) => f(...a)
|
|
308
|
-
});
|
|
295
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 165, S: this });
|
|
309
296
|
const plugin = yield* this._pluginLoader(id);
|
|
310
297
|
this._addPlugin(plugin);
|
|
311
|
-
return
|
|
298
|
+
return plugin;
|
|
312
299
|
});
|
|
313
300
|
}
|
|
314
301
|
/**
|
|
@@ -319,16 +306,12 @@ var ManagerImpl = class {
|
|
|
319
306
|
return Effect2.gen(this, function* () {
|
|
320
307
|
log2("enable plugin", {
|
|
321
308
|
id
|
|
322
|
-
}, {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
S: this,
|
|
326
|
-
C: (f, a) => f(...a)
|
|
327
|
-
});
|
|
328
|
-
const plugin = this._getPlugin(id);
|
|
329
|
-
if (!plugin) {
|
|
309
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 178, S: this });
|
|
310
|
+
const stub = this._getPlugin(id);
|
|
311
|
+
if (!stub) {
|
|
330
312
|
return false;
|
|
331
313
|
}
|
|
314
|
+
const plugin = yield* this._resolveLazyPlugin(stub);
|
|
332
315
|
this._update(this._enabledAtom, (enabled) => enabled.includes(id) ? enabled : [
|
|
333
316
|
...enabled,
|
|
334
317
|
id
|
|
@@ -341,12 +324,7 @@ var ManagerImpl = class {
|
|
|
341
324
|
events: [
|
|
342
325
|
...this.getPendingReset()
|
|
343
326
|
]
|
|
344
|
-
}, {
|
|
345
|
-
F: __dxlog_file2,
|
|
346
|
-
L: 253,
|
|
347
|
-
S: this,
|
|
348
|
-
C: (f, a) => f(...a)
|
|
349
|
-
});
|
|
327
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 194, S: this });
|
|
350
328
|
yield* Effect2.all(this.getPendingReset().map((event) => this.activate(event)), {
|
|
351
329
|
concurrency: "unbounded"
|
|
352
330
|
});
|
|
@@ -354,24 +332,78 @@ var ManagerImpl = class {
|
|
|
354
332
|
});
|
|
355
333
|
}
|
|
356
334
|
/**
|
|
335
|
+
* Resolves a lazy plugin stub (returned by {@link Plugin.lazy}) to its
|
|
336
|
+
* loaded form and swaps it into `_pluginsAtom`. Returns the input unchanged
|
|
337
|
+
* when the plugin is already resolved, so callers can `yield*` this
|
|
338
|
+
* unconditionally. The lazy stub carries `meta` synchronously but its
|
|
339
|
+
* `modules` list is empty until the loader resolves; the swap ensures
|
|
340
|
+
* subsequent enable/disable operations see the resolved plugin.
|
|
341
|
+
*
|
|
342
|
+
* Concurrent calls for the same id are coalesced via `_resolvingPlugins`:
|
|
343
|
+
* the first caller starts the resolution, every subsequent caller awaits
|
|
344
|
+
* the same `Deferred`. On failure we publish a `lazy:<id>` error message
|
|
345
|
+
* and skip the atom swap so the failure is observable to the activation
|
|
346
|
+
* subscriber and a retry can be attempted.
|
|
347
|
+
*/
|
|
348
|
+
_resolveLazyPlugin(plugin) {
|
|
349
|
+
return Effect2.gen(this, function* () {
|
|
350
|
+
if (!isLazy(plugin)) {
|
|
351
|
+
return plugin;
|
|
352
|
+
}
|
|
353
|
+
const id = plugin.meta.id;
|
|
354
|
+
const existing = this._resolvingPlugins.get(id);
|
|
355
|
+
if (existing) {
|
|
356
|
+
return yield* Deferred2.await(existing);
|
|
357
|
+
}
|
|
358
|
+
const deferred = yield* Deferred2.make();
|
|
359
|
+
this._resolvingPlugins.set(id, deferred);
|
|
360
|
+
return yield* Effect2.gen(this, function* () {
|
|
361
|
+
log2("resolving lazy plugin", {
|
|
362
|
+
id
|
|
363
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 231, S: this });
|
|
364
|
+
yield* PubSub.publish(this.activation, {
|
|
365
|
+
event: "",
|
|
366
|
+
state: "activating",
|
|
367
|
+
module: `lazy:${id}`
|
|
368
|
+
});
|
|
369
|
+
const resolvedPlugin = yield* resolveLazy(plugin);
|
|
370
|
+
this._update(this._pluginsAtom, (plugins) => plugins.map((p) => p.meta.id === id ? resolvedPlugin : p));
|
|
371
|
+
yield* PubSub.publish(this.activation, {
|
|
372
|
+
event: "",
|
|
373
|
+
state: "activated",
|
|
374
|
+
module: `lazy:${id}`
|
|
375
|
+
});
|
|
376
|
+
return resolvedPlugin;
|
|
377
|
+
}).pipe(Effect2.tapError((error) => PubSub.publish(this.activation, {
|
|
378
|
+
event: "",
|
|
379
|
+
state: "error",
|
|
380
|
+
module: `lazy:${id}`,
|
|
381
|
+
error
|
|
382
|
+
})), Effect2.tap((value) => Deferred2.succeed(deferred, value)), Effect2.tapErrorCause((cause) => Deferred2.failCause(deferred, cause)), Effect2.ensuring(Effect2.sync(() => this._resolvingPlugins.delete(id))));
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
357
386
|
* Removes a plugin from the manager.
|
|
358
387
|
* @param id The id of the plugin.
|
|
359
388
|
*/
|
|
360
389
|
remove(id) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
F: __dxlog_file2,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
390
|
+
return Effect2.gen(this, function* () {
|
|
391
|
+
log2("remove plugin", {
|
|
392
|
+
id
|
|
393
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 260, S: this });
|
|
394
|
+
const disabled = yield* this.disable(id);
|
|
395
|
+
if (!disabled) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
this._removePlugin(id);
|
|
399
|
+
if (this._onRemove) {
|
|
400
|
+
this._runForkedFiber(this._onRemove(id).pipe(Effect2.tapError((error) => Effect2.sync(() => log2.warn("plugin remove hook failed", {
|
|
401
|
+
id,
|
|
402
|
+
error
|
|
403
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 269, S: this }))), Effect2.ignore));
|
|
404
|
+
}
|
|
405
|
+
return true;
|
|
368
406
|
});
|
|
369
|
-
const result = this.disable(id);
|
|
370
|
-
if (!result) {
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
this._removePlugin(id);
|
|
374
|
-
return true;
|
|
375
407
|
}
|
|
376
408
|
/**
|
|
377
409
|
* Disables a plugin.
|
|
@@ -381,12 +413,7 @@ var ManagerImpl = class {
|
|
|
381
413
|
return Effect2.gen(this, function* () {
|
|
382
414
|
log2("disable plugin", {
|
|
383
415
|
id
|
|
384
|
-
}, {
|
|
385
|
-
F: __dxlog_file2,
|
|
386
|
-
L: 284,
|
|
387
|
-
S: this,
|
|
388
|
-
C: (f, a) => f(...a)
|
|
389
|
-
});
|
|
416
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 282, S: this });
|
|
390
417
|
if (this._get(this._coreAtom).includes(id)) {
|
|
391
418
|
return false;
|
|
392
419
|
}
|
|
@@ -417,22 +444,13 @@ var ManagerImpl = class {
|
|
|
417
444
|
log2("skipping activation during shutdown", {
|
|
418
445
|
key,
|
|
419
446
|
...params
|
|
420
|
-
}, {
|
|
421
|
-
F: __dxlog_file2,
|
|
422
|
-
L: 320,
|
|
423
|
-
S: this,
|
|
424
|
-
C: (f, a) => f(...a)
|
|
425
|
-
});
|
|
447
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 311, S: this });
|
|
426
448
|
return false;
|
|
427
449
|
}
|
|
450
|
+
yield* Deferred2.await(this._initialization);
|
|
428
451
|
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", {
|
|
429
452
|
event: key
|
|
430
|
-
}, {
|
|
431
|
-
F: __dxlog_file2,
|
|
432
|
-
L: 328,
|
|
433
|
-
S: this,
|
|
434
|
-
C: (f, a) => f(...a)
|
|
435
|
-
}))))), Performance.addTrackEntry({
|
|
453
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 322, S: this }))))), Performance.addTrackEntry({
|
|
436
454
|
name: typeof event === "string" ? event : eventKey(event),
|
|
437
455
|
devtools: {
|
|
438
456
|
dataType: "track-entry",
|
|
@@ -471,12 +489,7 @@ var ManagerImpl = class {
|
|
|
471
489
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
472
490
|
log2("reset", {
|
|
473
491
|
key
|
|
474
|
-
}, {
|
|
475
|
-
F: __dxlog_file2,
|
|
476
|
-
L: 374,
|
|
477
|
-
S: this,
|
|
478
|
-
C: (f, a) => f(...a)
|
|
479
|
-
});
|
|
492
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 359, S: this });
|
|
480
493
|
const modules = this._getActiveModulesByEvent(key);
|
|
481
494
|
const results = yield* Effect2.all(modules.map((module) => this._deactivateModule(module)), {
|
|
482
495
|
concurrency: "unbounded"
|
|
@@ -491,12 +504,7 @@ var ManagerImpl = class {
|
|
|
491
504
|
shutdown() {
|
|
492
505
|
return this._shutdownSemaphore.withPermits(1)(Effect2.gen(this, function* () {
|
|
493
506
|
yield* Ref.set(this._shuttingDown, true);
|
|
494
|
-
log2("shutdown", void 0, {
|
|
495
|
-
F: __dxlog_file2,
|
|
496
|
-
L: 393,
|
|
497
|
-
S: this,
|
|
498
|
-
C: (f, a) => f(...a)
|
|
499
|
-
});
|
|
507
|
+
log2("shutdown", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 376, S: this });
|
|
500
508
|
yield* this._interruptInFlightActivations();
|
|
501
509
|
const activeIds = [
|
|
502
510
|
...this._get(this._activeAtom)
|
|
@@ -511,12 +519,7 @@ var ManagerImpl = class {
|
|
|
511
519
|
this._moduleMemoMap.clear();
|
|
512
520
|
yield* Ref.set(this._activatingEvents, []);
|
|
513
521
|
yield* Ref.set(this._activatingModules, []);
|
|
514
|
-
log2("shutdown complete", void 0, {
|
|
515
|
-
F: __dxlog_file2,
|
|
516
|
-
L: 413,
|
|
517
|
-
S: this,
|
|
518
|
-
C: (f, a) => f(...a)
|
|
519
|
-
});
|
|
522
|
+
log2("shutdown complete", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 391, S: this });
|
|
520
523
|
return true;
|
|
521
524
|
}).pipe(Effect2.ensuring(Ref.set(this._shuttingDown, false))));
|
|
522
525
|
}
|
|
@@ -561,12 +564,7 @@ var ManagerImpl = class {
|
|
|
561
564
|
if (pendingReset.length > 0) {
|
|
562
565
|
log2("pending reset", {
|
|
563
566
|
events: pendingReset
|
|
564
|
-
}, {
|
|
565
|
-
F: __dxlog_file2,
|
|
566
|
-
L: 475,
|
|
567
|
-
S: this,
|
|
568
|
-
C: (f, a) => f(...a)
|
|
569
|
-
});
|
|
567
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 434, S: this });
|
|
570
568
|
this._update(this._pendingResetAtom, (current) => [
|
|
571
569
|
...current,
|
|
572
570
|
...pendingReset
|
|
@@ -599,18 +597,24 @@ var ManagerImpl = class {
|
|
|
599
597
|
_untrackFiber(ref, fiber) {
|
|
600
598
|
return Ref.update(ref, (fibers) => fibers.filter((trackedFiber) => trackedFiber !== fiber));
|
|
601
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* Spawns an effect on the default runtime and registers the resulting fiber in
|
|
602
|
+
* `_inFlightFibers` so {@link shutdown} can interrupt it. Used from sync entry
|
|
603
|
+
* points like {@link remove} where there is no enclosing Effect to fork from;
|
|
604
|
+
* inside an Effect chain prefer the existing track/await/untrack pattern.
|
|
605
|
+
*/
|
|
606
|
+
_runForkedFiber(effect) {
|
|
607
|
+
const fiber = Effect2.runFork(effect);
|
|
608
|
+
Effect2.runSync(this._trackFiber(this._inFlightFibers, fiber));
|
|
609
|
+
Effect2.runFork(Fiber.await(fiber).pipe(Effect2.andThen(() => this._untrackFiber(this._inFlightFibers, fiber))));
|
|
610
|
+
}
|
|
602
611
|
//
|
|
603
612
|
// Registration helpers
|
|
604
613
|
//
|
|
605
614
|
_addPlugin(plugin) {
|
|
606
615
|
log2("add plugin", {
|
|
607
616
|
id: plugin.meta.id
|
|
608
|
-
}, {
|
|
609
|
-
F: __dxlog_file2,
|
|
610
|
-
L: 519,
|
|
611
|
-
S: this,
|
|
612
|
-
C: (f, a) => f(...a)
|
|
613
|
-
});
|
|
617
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 483, S: this });
|
|
614
618
|
this._update(this._pluginsAtom, (plugins) => plugins.includes(plugin) ? plugins : [
|
|
615
619
|
...plugins,
|
|
616
620
|
plugin
|
|
@@ -619,23 +623,13 @@ var ManagerImpl = class {
|
|
|
619
623
|
_removePlugin(id) {
|
|
620
624
|
log2("remove plugin", {
|
|
621
625
|
id
|
|
622
|
-
}, {
|
|
623
|
-
F: __dxlog_file2,
|
|
624
|
-
L: 525,
|
|
625
|
-
S: this,
|
|
626
|
-
C: (f, a) => f(...a)
|
|
627
|
-
});
|
|
626
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 493, S: this });
|
|
628
627
|
this._update(this._pluginsAtom, (plugins) => plugins.filter((plugin) => plugin.meta.id !== id));
|
|
629
628
|
}
|
|
630
629
|
_addModule(module) {
|
|
631
630
|
log2("add module", {
|
|
632
631
|
id: module.id
|
|
633
|
-
}, {
|
|
634
|
-
F: __dxlog_file2,
|
|
635
|
-
L: 530,
|
|
636
|
-
S: this,
|
|
637
|
-
C: (f, a) => f(...a)
|
|
638
|
-
});
|
|
632
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 499, S: this });
|
|
639
633
|
this._update(this._modulesAtom, (modules) => modules.includes(module) ? modules : [
|
|
640
634
|
...modules,
|
|
641
635
|
module
|
|
@@ -644,12 +638,7 @@ var ManagerImpl = class {
|
|
|
644
638
|
_removeModule(id) {
|
|
645
639
|
log2("remove module", {
|
|
646
640
|
id
|
|
647
|
-
}, {
|
|
648
|
-
F: __dxlog_file2,
|
|
649
|
-
L: 536,
|
|
650
|
-
S: this,
|
|
651
|
-
C: (f, a) => f(...a)
|
|
652
|
-
});
|
|
641
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 509, S: this });
|
|
653
642
|
this._update(this._modulesAtom, (modules) => modules.filter((module) => module.id !== id));
|
|
654
643
|
}
|
|
655
644
|
//
|
|
@@ -661,12 +650,7 @@ var ManagerImpl = class {
|
|
|
661
650
|
log2("activating", {
|
|
662
651
|
key,
|
|
663
652
|
...params
|
|
664
|
-
}, {
|
|
665
|
-
F: __dxlog_file2,
|
|
666
|
-
L: 551,
|
|
667
|
-
S: this,
|
|
668
|
-
C: (f, a) => f(...a)
|
|
669
|
-
});
|
|
653
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 520, S: this });
|
|
670
654
|
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
671
655
|
this._clearPendingReset(key);
|
|
672
656
|
const activatingEvents = yield* this._activatingEvents;
|
|
@@ -675,12 +659,7 @@ var ManagerImpl = class {
|
|
|
675
659
|
if (modules.length === 0) {
|
|
676
660
|
log2("no modules to activate", {
|
|
677
661
|
key
|
|
678
|
-
}, {
|
|
679
|
-
F: __dxlog_file2,
|
|
680
|
-
L: 559,
|
|
681
|
-
S: this,
|
|
682
|
-
C: (f, a) => f(...a)
|
|
683
|
-
});
|
|
662
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 530, S: this });
|
|
684
663
|
if (!this._get(this._eventsFiredAtom).includes(key)) {
|
|
685
664
|
this._update(this._eventsFiredAtom, (events) => [
|
|
686
665
|
...events,
|
|
@@ -702,12 +681,7 @@ var ManagerImpl = class {
|
|
|
702
681
|
log2("activating modules", {
|
|
703
682
|
key,
|
|
704
683
|
modules: activatingModuleIds
|
|
705
|
-
}, {
|
|
706
|
-
F: __dxlog_file2,
|
|
707
|
-
L: 586,
|
|
708
|
-
S: this,
|
|
709
|
-
C: (f, a) => f(...a)
|
|
710
|
-
});
|
|
684
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 551, S: this });
|
|
711
685
|
performance.mark(`event:${key}:start`);
|
|
712
686
|
yield* PubSub.publish(this.activation, {
|
|
713
687
|
event: key,
|
|
@@ -731,12 +705,7 @@ var ManagerImpl = class {
|
|
|
731
705
|
});
|
|
732
706
|
log2("activated", {
|
|
733
707
|
key
|
|
734
|
-
}, {
|
|
735
|
-
F: __dxlog_file2,
|
|
736
|
-
L: 604,
|
|
737
|
-
S: this,
|
|
738
|
-
C: (f, a) => f(...a)
|
|
739
|
-
});
|
|
708
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 576, S: this });
|
|
740
709
|
return true;
|
|
741
710
|
}).pipe(Effect2.ensuring(Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !activatingModuleIds.includes(module)))));
|
|
742
711
|
}
|
|
@@ -751,13 +720,13 @@ var ManagerImpl = class {
|
|
|
751
720
|
});
|
|
752
721
|
}
|
|
753
722
|
_getBeforeEvents(modules, activatingEvents) {
|
|
754
|
-
return Function.pipe(modules, Array.flatMap((module) => module.
|
|
723
|
+
return Function.pipe(modules, Array.flatMap((module) => module.firesBeforeActivation ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
|
|
755
724
|
}
|
|
756
725
|
_getAfterEvents(modules, activatingEvents) {
|
|
757
|
-
return Function.pipe(modules, Array.flatMap((module) => module.
|
|
726
|
+
return Function.pipe(modules, Array.flatMap((module) => module.firesAfterActivation ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
|
|
758
727
|
}
|
|
759
728
|
_activateRelatedEvents(key, events, phase) {
|
|
760
|
-
const logLabel = phase === "before" ? "
|
|
729
|
+
const logLabel = phase === "before" ? "firesBeforeActivation" : "firesAfterActivation";
|
|
761
730
|
const eventKey2 = phase === "before" ? "beforeEvents" : "afterEvents";
|
|
762
731
|
return Function.pipe(events, Array.map((event) => this.activate(event, phase === "before" ? {
|
|
763
732
|
before: key
|
|
@@ -768,18 +737,13 @@ var ManagerImpl = class {
|
|
|
768
737
|
}), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`${logLabel} is taking a long time`, {
|
|
769
738
|
event: key,
|
|
770
739
|
[eventKey2]: events.map(eventKey)
|
|
771
|
-
}, {
|
|
772
|
-
F: __dxlog_file2,
|
|
773
|
-
L: 683,
|
|
774
|
-
S: this,
|
|
775
|
-
C: (f, a) => f(...a)
|
|
776
|
-
}))))), Effect2.asVoid);
|
|
740
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 609, S: this }))))), Effect2.asVoid);
|
|
777
741
|
}
|
|
778
742
|
//
|
|
779
743
|
// Module lifecycle helpers
|
|
780
744
|
//
|
|
781
745
|
_loadCapabilitiesForModules(key, modules) {
|
|
782
|
-
return Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
746
|
+
return Function.pipe(modules, Array.map((mod) => this._loadModule(mod, key)), Effect2.allWith({
|
|
783
747
|
concurrency: "unbounded"
|
|
784
748
|
}), Effect2.catchAll((error) => {
|
|
785
749
|
return Effect2.gen(this, function* () {
|
|
@@ -809,7 +773,14 @@ var ManagerImpl = class {
|
|
|
809
773
|
}
|
|
810
774
|
return semaphore;
|
|
811
775
|
}
|
|
812
|
-
|
|
776
|
+
// `parentEvent` is the activation event that first triggered this module
|
|
777
|
+
// load — included in `activating`/`activated` PubSub messages so subscribers
|
|
778
|
+
// (e.g. the boot loader's status listener) can associate a module with its
|
|
779
|
+
// triggering event in the trace. The same module may be referenced by
|
|
780
|
+
// multiple events, but module loads are memoized via `_moduleMemoMap`, so
|
|
781
|
+
// only the first event to need it will appear here; later events await the
|
|
782
|
+
// cached deferred without re-publishing.
|
|
783
|
+
_loadModule = (module, parentEvent) => Effect2.gen(this, function* () {
|
|
813
784
|
const semaphore = this._getModuleSemaphore(module.id);
|
|
814
785
|
const deferredToAwait = yield* Effect2.gen(this, function* () {
|
|
815
786
|
const existing = this._moduleMemoMap.get(module.id);
|
|
@@ -820,16 +791,12 @@ var ManagerImpl = class {
|
|
|
820
791
|
this._moduleMemoMap.set(module.id, deferred);
|
|
821
792
|
const loadEffect = Effect2.gen(this, function* () {
|
|
822
793
|
log2("loading module", {
|
|
823
|
-
module: module.id
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
L: 756,
|
|
827
|
-
S: this,
|
|
828
|
-
C: (f, a) => f(...a)
|
|
829
|
-
});
|
|
794
|
+
module: module.id,
|
|
795
|
+
parentEvent
|
|
796
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 667, S: this });
|
|
830
797
|
performance.mark(`module:${module.id}:start`);
|
|
831
798
|
yield* PubSub.publish(this.activation, {
|
|
832
|
-
event:
|
|
799
|
+
event: parentEvent,
|
|
833
800
|
state: "activating",
|
|
834
801
|
module: module.id
|
|
835
802
|
});
|
|
@@ -841,29 +808,20 @@ var ManagerImpl = class {
|
|
|
841
808
|
performance.mark(`module:${module.id}:end`);
|
|
842
809
|
performance.measure(`module:${module.id}`, `module:${module.id}:start`, `module:${module.id}:end`);
|
|
843
810
|
yield* PubSub.publish(this.activation, {
|
|
844
|
-
event:
|
|
811
|
+
event: parentEvent,
|
|
845
812
|
state: "activated",
|
|
846
813
|
module: module.id
|
|
847
814
|
});
|
|
848
815
|
log2("loaded module", {
|
|
849
816
|
module: module.id,
|
|
817
|
+
parentEvent,
|
|
850
818
|
elapsed,
|
|
851
819
|
failed: false
|
|
852
|
-
}, {
|
|
853
|
-
F: __dxlog_file2,
|
|
854
|
-
L: 771,
|
|
855
|
-
S: this,
|
|
856
|
-
C: (f, a) => f(...a)
|
|
857
|
-
});
|
|
820
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 689, S: this });
|
|
858
821
|
return normalized;
|
|
859
822
|
}).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
|
|
860
823
|
module: module.id
|
|
861
|
-
}, {
|
|
862
|
-
F: __dxlog_file2,
|
|
863
|
-
L: 782,
|
|
864
|
-
S: this,
|
|
865
|
-
C: (f, a) => f(...a)
|
|
866
|
-
}))))), Performance.addTrackEntry({
|
|
824
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 696, S: this }))))), Performance.addTrackEntry({
|
|
867
825
|
name: module.id,
|
|
868
826
|
devtools: {
|
|
869
827
|
dataType: "track-entry",
|
|
@@ -879,12 +837,7 @@ var ManagerImpl = class {
|
|
|
879
837
|
error: error instanceof Error ? error.message : String(error),
|
|
880
838
|
stack: error instanceof Error ? error.stack : void 0,
|
|
881
839
|
isDefect: !Cause.isFailure(cause)
|
|
882
|
-
}, {
|
|
883
|
-
F: __dxlog_file2,
|
|
884
|
-
L: 803,
|
|
885
|
-
S: this,
|
|
886
|
-
C: (f, a) => f(...a)
|
|
887
|
-
});
|
|
840
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 710, S: this });
|
|
888
841
|
return Deferred2.fail(deferred, error instanceof Error ? error : new Error(String(error)));
|
|
889
842
|
})));
|
|
890
843
|
yield* this._trackFiber(this._inFlightFibers, fiber);
|
|
@@ -913,12 +866,7 @@ var ManagerImpl = class {
|
|
|
913
866
|
const id = module.id;
|
|
914
867
|
log2("deactivating", {
|
|
915
868
|
id
|
|
916
|
-
}, {
|
|
917
|
-
F: __dxlog_file2,
|
|
918
|
-
L: 841,
|
|
919
|
-
S: this,
|
|
920
|
-
C: (f, a) => f(...a)
|
|
921
|
-
});
|
|
869
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 743, S: this });
|
|
922
870
|
this._moduleMemoMap.delete(id);
|
|
923
871
|
const capabilities = this._capabilities.get(id);
|
|
924
872
|
if (capabilities) {
|
|
@@ -935,12 +883,7 @@ var ManagerImpl = class {
|
|
|
935
883
|
}
|
|
936
884
|
log2("deactivated", {
|
|
937
885
|
id
|
|
938
|
-
}, {
|
|
939
|
-
F: __dxlog_file2,
|
|
940
|
-
L: 859,
|
|
941
|
-
S: this,
|
|
942
|
-
C: (f, a) => f(...a)
|
|
943
|
-
});
|
|
886
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 760, S: this });
|
|
944
887
|
return true;
|
|
945
888
|
});
|
|
946
889
|
}
|
|
@@ -955,9 +898,10 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
|
955
898
|
|
|
956
899
|
export {
|
|
957
900
|
capability_manager_exports,
|
|
901
|
+
PluginInitializationError,
|
|
958
902
|
ManagerTypeId,
|
|
959
903
|
isManager,
|
|
960
904
|
make5 as make,
|
|
961
905
|
plugin_manager_exports
|
|
962
906
|
};
|
|
963
|
-
//# sourceMappingURL=chunk-
|
|
907
|
+
//# sourceMappingURL=chunk-3ZS2A3DN.mjs.map
|