@dxos/app-framework 0.8.4-main.a4bbb77 → 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/.storybook/main.mts +2 -4
- package/.storybook/preview.mts +2 -2
- package/dist/lib/browser/capability-Q5XRXRD2.mjs +38 -0
- package/dist/lib/browser/capability-Q5XRXRD2.mjs.map +7 -0
- package/dist/lib/browser/capability-V7LR4LQN.mjs +35 -0
- package/dist/lib/browser/capability-V7LR4LQN.mjs.map +7 -0
- package/dist/lib/browser/chunk-23D4SJUE.mjs +42 -0
- package/dist/lib/browser/chunk-23D4SJUE.mjs.map +7 -0
- package/dist/lib/browser/chunk-3JWJXGLK.mjs +79 -0
- package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
- package/dist/lib/browser/chunk-3ZS2A3DN.mjs +907 -0
- package/dist/lib/browser/chunk-3ZS2A3DN.mjs.map +7 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
- package/dist/lib/browser/chunk-5LAIGWLU.mjs +467 -0
- package/dist/lib/browser/chunk-5LAIGWLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-66IXTIVK.mjs +48 -0
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs.map +7 -0
- package/dist/lib/browser/chunk-G7SDBRKH.mjs +1 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -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-WBHCSOBW.mjs +80 -0
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z55LVAGN.mjs +213 -0
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs +142 -0
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +74 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/common/activation-events.mjs +24 -0
- package/dist/lib/browser/common/capabilities.mjs +46 -0
- package/dist/lib/browser/core/activation-event.mjs +20 -0
- package/dist/lib/browser/core/activation-event.mjs.map +7 -0
- package/dist/lib/browser/core/capability.mjs +30 -0
- package/dist/lib/browser/core/capability.mjs.map +7 -0
- package/dist/lib/browser/core/plugin-manager.mjs +17 -0
- package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/browser/core/plugin.mjs +37 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/core/url-loader.mjs +20 -0
- package/dist/lib/browser/core/url-loader.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +95 -148
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs +44 -0
- 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 +227 -41
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +48 -0
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/capability-EW5GJCI6.mjs +39 -0
- package/dist/lib/node-esm/capability-EW5GJCI6.mjs.map +7 -0
- package/dist/lib/node-esm/capability-YKBMMD53.mjs +36 -0
- package/dist/lib/node-esm/capability-YKBMMD53.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +10 -0
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D347W3KO.mjs +143 -0
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs +373 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs +214 -0
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs +468 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OZ7DZA5Z.mjs +2 -0
- package/dist/lib/node-esm/chunk-OZ7DZA5Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Q7XBFII4.mjs +908 -0
- package/dist/lib/node-esm/chunk-Q7XBFII4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SBS2YMPT.mjs +43 -0
- package/dist/lib/node-esm/chunk-SBS2YMPT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs +80 -0
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs +81 -0
- 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-XOCUANHO.mjs +49 -0
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +75 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/common/activation-events.mjs +25 -0
- package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
- package/dist/lib/node-esm/common/capabilities.mjs +47 -0
- package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
- package/dist/lib/node-esm/core/activation-event.mjs +21 -0
- package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
- package/dist/lib/node-esm/core/capability.mjs +31 -0
- package/dist/lib/node-esm/core/capability.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs +18 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin.mjs +38 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/core/url-loader.mjs +21 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +95 -148
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs +45 -0
- 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 +227 -41
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +49 -0
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +832 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/cli/cli.d.ts +39 -0
- package/dist/types/src/cli/cli.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/common/activation-events.d.ts +27 -0
- package/dist/types/src/common/activation-events.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +110 -197
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +4 -8
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +19 -0
- package/dist/types/src/common/operations.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +8 -8
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/context.d.ts +5 -0
- package/dist/types/src/context.d.ts.map +1 -0
- package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +11 -11
- package/dist/types/src/core/activation-event.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.d.ts +48 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.test.d.ts +2 -0
- package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/capability.d.ts +156 -0
- package/dist/types/src/core/capability.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +8 -4
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +122 -0
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.d.ts +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 +207 -39
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +112 -0
- package/dist/types/src/core/url-loader.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.test.d.ts +2 -0
- package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts +32 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
- package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +101 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/index.d.ts +3 -0
- package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/meta.d.ts +3 -0
- package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/testing.d.ts +59 -0
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/index.d.ts +2 -0
- package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
- package/dist/types/src/testing/harness.d.ts +67 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- package/dist/types/src/testing/service.d.ts +8 -0
- package/dist/types/src/testing/service.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +7 -6
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.d.ts +9 -0
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts +19 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/index.d.ts +2 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/{playground/playground.stories.d.ts → ui/components/PluginManager/PluginManagerContext.stories.d.ts} +5 -3
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +24 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{components/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -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 +11 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
- package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +36 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.d.ts +197 -0
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +5 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/index.d.ts +6 -0
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.d.ts +88 -0
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts +31 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/{components → ui/hooks}/useLoading.d.ts +1 -2
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts +10 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
- package/dist/types/src/ui/index.d.ts +3 -0
- package/dist/types/src/ui/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +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 +5 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- 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 +13 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +25 -6
- package/package.json +112 -55
- package/src/cli/cli.ts +107 -0
- package/src/{components → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +169 -210
- package/src/common/index.ts +4 -8
- package/src/common/operations.ts +35 -0
- package/src/common/translations.ts +18 -10
- package/src/context.ts +9 -0
- package/src/core/{events.ts → activation-event.ts} +10 -7
- package/src/core/capability-manager.test.ts +151 -0
- package/src/core/capability-manager.ts +192 -0
- package/src/core/capability.ts +247 -0
- package/src/core/index.ts +8 -4
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +1354 -0
- package/src/core/plugin-manager.ts +1025 -0
- package/src/core/plugin-manifest.test.ts +48 -0
- package/src/core/plugin-manifest.ts +102 -0
- package/src/core/plugin.ts +365 -45
- package/src/core/url-loader.test.ts +178 -0
- package/src/core/url-loader.ts +337 -0
- package/src/index.ts +3 -4
- package/src/plugin-operation/OperationPlugin.ts +24 -0
- package/src/plugin-operation/history/capability.ts +36 -0
- package/src/plugin-operation/history/errors.ts +7 -0
- package/src/plugin-operation/history/history-tracker.test.ts +374 -0
- package/src/plugin-operation/history/history-tracker.ts +128 -0
- package/src/plugin-operation/history/index.ts +9 -0
- package/src/plugin-operation/history/types.ts +17 -0
- package/src/plugin-operation/history/undo-mapping.ts +135 -0
- package/src/plugin-operation/history/undo-registry.test.ts +72 -0
- package/src/plugin-operation/history/undo-registry.ts +54 -0
- package/src/plugin-operation/index.ts +6 -0
- package/src/plugin-operation/invoker-capability.ts +55 -0
- package/src/plugin-operation/meta.ts +11 -0
- package/src/plugin-operation/testing.ts +155 -0
- package/src/plugin-runtime/RuntimePlugin.ts +19 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/{playground/layout → plugin-runtime}/index.ts +1 -1
- package/src/plugin-runtime/meta.ts +11 -0
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +8 -9
- package/src/testing/withPluginManager.tsx +68 -40
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/ui/components/App/App.tsx +81 -0
- package/src/{playground/debug → ui/components/App}/index.ts +1 -1
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/{playground/logger → ui/components/Placeholder}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +185 -0
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +3 -3
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +144 -0
- package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
- package/src/ui/components/Surface/SurfaceInfo.tsx +107 -0
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/context.ts +12 -0
- package/src/ui/components/Surface/index.ts +54 -0
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +269 -0
- package/src/ui/components/index.ts +8 -0
- package/src/ui/hooks/index.ts +9 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +413 -0
- package/src/ui/hooks/useCapabilities.ts +67 -0
- package/src/{components → ui/hooks}/useLoading.tsx +16 -10
- package/src/ui/hooks/useSettingsState.ts +26 -0
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +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 +10 -0
- package/src/vite-plugin/manifest.test.ts +24 -0
- package/src/vite-plugin/manifest.ts +50 -0
- package/src/vite-plugin/packages.ts +188 -0
- package/tsconfig.json +18 -15
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs +0 -137
- package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +0 -7
- package/dist/lib/browser/chunk-6V54SRFL.mjs +0 -1638
- package/dist/lib/browser/chunk-6V54SRFL.mjs.map +0 -7
- package/dist/lib/browser/chunk-RGKMLI6U.mjs +0 -35
- package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZZVFNUHZ.mjs +0 -467
- package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +0 -7
- package/dist/lib/browser/intent-dispatcher-VFMJVO2M.mjs +0 -11
- package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs +0 -39
- package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +0 -7
- package/dist/lib/browser/store-7ZGMHOGB.mjs +0 -30
- package/dist/lib/browser/store-7ZGMHOGB.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -77
- package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs +0 -138
- package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AXSZKZFD.mjs +0 -468
- package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LKPMRTRR.mjs +0 -37
- package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SOVTUUAY.mjs +0 -1640
- package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-dispatcher-SAPOKSLZ.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +0 -7
- package/dist/lib/node-esm/store-H4F4RMYD.mjs +0 -31
- package/dist/lib/node-esm/store-H4F4RMYD.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -78
- package/dist/types/src/common/collaboration.d.ts +0 -20
- package/dist/types/src/common/collaboration.d.ts.map +0 -1
- package/dist/types/src/common/events.d.ts +0 -52
- package/dist/types/src/common/events.d.ts.map +0 -1
- package/dist/types/src/common/file.d.ts +0 -14
- package/dist/types/src/common/file.d.ts.map +0 -1
- package/dist/types/src/common/graph.d.ts +0 -21
- package/dist/types/src/common/graph.d.ts.map +0 -1
- package/dist/types/src/common/layout.d.ts +0 -279
- package/dist/types/src/common/layout.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts +0 -59
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/components/App.d.ts +0 -10
- package/dist/types/src/components/App.d.ts.map +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/components/DefaultFallback.d.ts +0 -8
- package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/components/useApp.d.ts +0 -44
- package/dist/types/src/components/useApp.d.ts.map +0 -1
- package/dist/types/src/components/useLoading.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.d.ts +0 -117
- package/dist/types/src/core/capabilities.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.test.d.ts +0 -2
- package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
- package/dist/types/src/core/events.d.ts.map +0 -1
- package/dist/types/src/core/manager.d.ts +0 -126
- package/dist/types/src/core/manager.d.ts.map +0 -1
- package/dist/types/src/core/manager.test.d.ts +0 -2
- package/dist/types/src/core/manager.test.d.ts.map +0 -1
- package/dist/types/src/playground/debug/Debug.d.ts +0 -6
- package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
- package/dist/types/src/playground/debug/index.d.ts +0 -2
- package/dist/types/src/playground/debug/index.d.ts.map +0 -1
- package/dist/types/src/playground/debug/plugin.d.ts +0 -2
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -6
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -7
- package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
- package/dist/types/src/playground/generator/index.d.ts +0 -3
- package/dist/types/src/playground/generator/index.d.ts.map +0 -1
- package/dist/types/src/playground/generator/plugin.d.ts +0 -2
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -8
- package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
- package/dist/types/src/playground/layout/index.d.ts +0 -2
- package/dist/types/src/playground/layout/index.d.ts.map +0 -1
- package/dist/types/src/playground/layout/plugin.d.ts +0 -2
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/logger/index.d.ts +0 -2
- package/dist/types/src/playground/logger/index.d.ts.map +0 -1
- package/dist/types/src/playground/logger/plugin.d.ts +0 -2
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -13
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/actions.d.ts +0 -36
- package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/errors.d.ts +0 -16
- package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/index.d.ts +0 -6
- package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent.d.ts +0 -63
- package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/meta.d.ts +0 -3
- package/dist/types/src/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -2
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -25
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -4
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/index.d.ts +0 -3
- package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/meta.d.ts +0 -3
- package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/store.d.ts +0 -5
- package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/translations.d.ts +0 -11
- package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/react/IntentContext.d.ts +0 -8
- package/dist/types/src/react/IntentContext.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerProvider.d.ts +0 -10
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -12
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts +0 -17
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts +0 -13
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -7
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts +0 -13
- package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
- package/dist/types/src/react/useIntentResolver.d.ts +0 -3
- package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/common/collaboration.ts +0 -18
- package/src/common/events.ts +0 -79
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/layout.ts +0 -277
- package/src/common/surface.ts +0 -83
- package/src/components/App.stories.tsx +0 -33
- package/src/components/App.tsx +0 -59
- package/src/components/DefaultFallback.tsx +0 -26
- package/src/components/useApp.tsx +0 -164
- package/src/core/capabilities.test.ts +0 -136
- package/src/core/capabilities.ts +0 -259
- package/src/core/manager.test.ts +0 -516
- package/src/core/manager.ts +0 -597
- package/src/playground/debug/Debug.tsx +0 -39
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -71
- package/src/playground/generator/Toolbar.tsx +0 -47
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -22
- package/src/playground/layout/Layout.tsx +0 -33
- package/src/playground/layout/plugin.ts +0 -18
- package/src/playground/logger/Toolbar.tsx +0 -30
- package/src/playground/logger/plugin.ts +0 -41
- package/src/playground/logger/schema.ts +0 -12
- package/src/playground/playground.stories.tsx +0 -46
- package/src/plugin-intent/IntentPlugin.ts +0 -20
- package/src/plugin-intent/actions.ts +0 -31
- package/src/plugin-intent/errors.ts +0 -40
- package/src/plugin-intent/index.ts +0 -9
- package/src/plugin-intent/intent-dispatcher.test.ts +0 -279
- package/src/plugin-intent/intent-dispatcher.ts +0 -334
- package/src/plugin-intent/intent.ts +0 -154
- package/src/plugin-intent/meta.ts +0 -10
- package/src/plugin-settings/SettingsPlugin.ts +0 -34
- package/src/plugin-settings/actions.ts +0 -25
- package/src/plugin-settings/app-graph-builder.ts +0 -159
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/intent-resolver.ts +0 -35
- package/src/plugin-settings/meta.ts +0 -10
- package/src/plugin-settings/store.ts +0 -33
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/ErrorBoundary.tsx +0 -54
- package/src/react/IntentContext.tsx +0 -35
- package/src/react/Surface.stories.tsx +0 -101
- package/src/react/Surface.tsx +0 -86
- package/src/react/common.ts +0 -13
- package/src/react/index.ts +0 -10
- package/src/react/useCapabilities.ts +0 -31
- package/src/react/useIntentResolver.ts +0 -22
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-VFMJVO2M.mjs.map → chunk-G7SDBRKH.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-SAPOKSLZ.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/{node-esm/worker.mjs.map → browser/common/capabilities.mjs.map} +0 -0
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// raw-loader:/__w/dxos/dxos/packages/sdk/app-framework/src/vite-plugin/boot-loader/boot-loader.css?raw
|
|
4
|
+
var boot_loader_default = "/*\n * Boot loader stylesheet \u2014 injected into the host's `<head>` by `bootLoaderPlugin`.\n * The keyframe animation runs on the browser's compositor thread, so the bar\n * keeps moving even while the JS main thread is busy parsing modules.\n */\n\n/*\n * Defaults match `@dxos/ui-theme`'s `--color-base-surface`, which resolves to\n * Tailwind's `neutral-50` / `neutral-950` in light / dark mode respectively\n * (see `packages/ui/ui-theme/src/css/theme/semantic.css`). Hosts can override\n * with the `--boot-loader-bg-*` / `--boot-loader-fg-*` custom properties on\n * `:root` if they need a different palette. Keeping the boot loader's\n * background identical to the app's `body` eliminates the flash on handoff\n * to React's `<Placeholder>`.\n */\n#boot-loader {\n /*\n * Tunable sizes \u2014 change these in one place and every derived calc()\n * (mark size, dot orbit radius, status offset, \u2026) follows.\n */\n /*\n * Caps the disc / mark at the design pixel sizes on roomy viewports while\n * shrinking proportionally on narrow ones (`vmin` follows the smaller of\n * width / height) so neither the ring nor the mark crops on phones.\n */\n --boot-loader-disc-size: min(384px, 80vmin);\n /*\n * Match the React `Placeholder`'s logo box (`h-[300px] w-[300px]` at the\n * `stage >= 1` keyframe) so the brand mark doesn't visibly jump size when\n * the loader hands off \u2014 the responsive cap keeps the same 300/384 ratio\n * (\u224878%) at any viewport width.\n */\n --boot-loader-mark-size: min(300px, 62.5vmin);\n --boot-loader-dot-size: 6px;\n --boot-loader-line-thickness: 1px;\n --boot-loader-line-feather: 2px;\n --boot-loader-status-gap: 24px;\n\n position: fixed;\n inset: 0;\n z-index: 10;\n background: var(--boot-loader-bg-light, #fafafa);\n color: var(--boot-loader-fg-light, #0a0a0a);\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;\n font-size: 13px;\n}\n\n@media (prefers-color-scheme: dark) {\n #boot-loader {\n background: var(--boot-loader-bg-dark, #0a0a0a);\n color: var(--boot-loader-fg-dark, #fafafa);\n }\n}\n\n/*\n * Register the progress var as a typed custom property so the browser can\n * interpolate it. Both the conic-gradient arc and the orbiting dot derive\n * their angle from `--boot-loader-bar-progress`, so animating the var (rather\n * than the resulting `background` / `transform`) keeps them in lockstep \u2014\n * `transition: background` on a conic-gradient doesn't interpolate smoothly\n * in all engines, which previously caused the head of the arc to flicker\n * against the dot during each progress step.\n */\n@property --boot-loader-bar-progress {\n syntax: '<number>';\n inherits: true;\n initial-value: 0;\n}\n\n/*\n * Stack the ring and the brand mark in the same square so the mark sits\n * centered inside the circle. Grid stacking keeps the mark outside the ring's\n * mask (the mask would otherwise clip the SVG to the 1px-thick arc shape).\n */\n#boot-loader-disc {\n position: absolute;\n top: 50%;\n left: 50%;\n display: grid;\n place-items: center;\n width: var(--boot-loader-disc-size);\n height: var(--boot-loader-disc-size);\n transform: translate(-50%, -50%);\n transition: --boot-loader-bar-progress 240ms ease-out;\n}\n\n#boot-loader-disc > * {\n grid-column: 1;\n grid-row: 1;\n}\n\n/*\n * Default to grayscale so the mark reads as a quiet monochrome silhouette\n * before any host-driven progress lands; the brand palette swaps in once\n * the driver flips `data-host-driven` on the disc (state-2 entry \u2014 the\n * first `__bootLoader.progress()` call). Hover keeps a parallel reveal\n * affordance for inspection in the storybook. The 600ms ease lets the\n * grayscale \u2192 color transition play through the activation phase rather\n * than snapping.\n */\n#boot-loader-mark {\n width: var(--boot-loader-mark-size);\n height: var(--boot-loader-mark-size);\n display: flex;\n align-items: center;\n justify-content: center;\n filter: grayscale(100%);\n transition: filter 1000ms ease-out;\n}\n\n/*\n * `grayscale(0%)` (identity) rather than `none` \u2014 `filter: none` changes\n * the filter function list and most engines treat that as a discrete\n * transition (snap, not ease). Keeping `grayscale(...)` on both sides of\n * the rule lets the browser interpolate the percentage smoothly.\n */\n#boot-loader-disc[data-host-driven] #boot-loader-mark,\n#boot-loader-mark:hover {\n filter: grayscale(0%);\n}\n\n#boot-loader-mark svg {\n width: 100%;\n height: 100%;\n /*\n * The host SVG carries its own brand-palette fills, so we don't apply a\n * `color` cascade here. SVGs that intentionally use `fill=\"currentColor\"`\n * still pick up the loader's text colour via `#boot-loader`'s `color`.\n */\n}\n\n/*\n * Circular determinate progress \u2014 a 1px-thick ring carved out of a filled\n * disc by a radial-gradient mask. The mask applies to the element and its\n * descendants so the `::before` progress arc is clipped to the ring shape\n * too. There is no indeterminate state: the ring sits empty (0%) until the\n * host calls `__bootLoader.progress(fraction)`, then the arc grows in place.\n * The fill repaints on the compositor thread so progress remains visually\n * smooth even while the JS main thread is busy parsing modules.\n */\n#boot-loader-bar {\n position: relative;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background: rgba(127, 127, 127, 0.18);\n opacity: 0.2;\n /*\n * Feather the inner edge so the thin line gets soft anti-aliased edges\n * instead of a hard pixel cutoff (which can look stair-stepped on\n * non-retina screens). The outer edge is clipped by `border-radius: 50%`,\n * so only the inner side of the ring needs the gradient feather. The\n * solid line lives in the outermost `--boot-loader-line-thickness` of the\n * disc; the feather extends `--boot-loader-line-feather` further inward.\n */\n mask: radial-gradient(\n circle closest-side,\n transparent calc(100% - var(--boot-loader-line-thickness) - var(--boot-loader-line-feather)),\n #000 calc(100% - var(--boot-loader-line-thickness))\n );\n -webkit-mask: radial-gradient(\n circle closest-side,\n transparent calc(100% - var(--boot-loader-line-thickness) - var(--boot-loader-line-feather)),\n #000 calc(100% - var(--boot-loader-line-thickness))\n );\n}\n\n/*\n * The host writes 0\u2013100 into `--boot-loader-bar-progress` via\n * `__bootLoader.progress(fraction)`. The `transition: background` smooths\n * the transitions between counter ticks so the arc grows continuously\n * rather than snapping. `conic-gradient` is clockwise-only, so the arc is\n * mirrored horizontally with `scaleX(-1)` to grow anticlockwise from\n * 12 o'clock.\n */\n#boot-loader-bar::before {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: 50%;\n background: conic-gradient(currentcolor calc(var(--boot-loader-bar-progress, 0) * 1%), transparent 0);\n transform: scaleX(-1);\n opacity: 0.9;\n}\n\n/*\n * A small dot at the leading edge of the arc. Lives as a sibling of the\n * masked ring (inside `#boot-loader-disc`) so the radial-gradient mask\n * doesn't clip it. The `rotate(...) translateY(-50%)` recipe orbits the\n * dot around the disc centre: at progress 0 it sits at 12 o'clock; the\n * negative rotation grows it anticlockwise to match the arc.\n */\n#boot-loader-dot {\n position: absolute;\n top: 50%;\n left: 50%;\n width: var(--boot-loader-dot-size);\n height: var(--boot-loader-dot-size);\n margin: calc(var(--boot-loader-dot-size) / -2) 0 0 calc(var(--boot-loader-dot-size) / -2);\n border-radius: 50%;\n background: currentcolor;\n opacity: 0;\n /*\n * Orbit radius = `disc/2 - line/2` so the dot's centre lands on the solid\n * line's centre rather than on the disc's outer edge (the line lives in\n * the outermost `--boot-loader-line-thickness` of the disc).\n */\n transform: rotate(calc(var(--boot-loader-bar-progress, 0) * -3.6deg))\n translateY(calc(var(--boot-loader-disc-size) / -2 + var(--boot-loader-line-thickness) / 2));\n transition: opacity 200ms ease-out;\n}\n\n/*\n * The driver sets `data-progress-active` on `#boot-loader-disc` while\n * progress is strictly between 0 and 1, hiding the dot at the empty (0%)\n * and full (100%) ring states where it would either sit on a bare ring or\n * coincide with the start of the arc.\n */\n#boot-loader-disc[data-progress-active] #boot-loader-dot {\n opacity: 0.9;\n}\n\n#boot-loader-status {\n position: absolute;\n top: 50%;\n left: 50%;\n /* Sit just below the centered disc \u2014 half the disc plus the configured gap. */\n transform: translate(-50%, calc(var(--boot-loader-disc-size) / 2 + var(--boot-loader-status-gap)));\n /*\n * Slightly de-emphasised vs body text so the brand mark + ring stay the\n * dominant focus, but high enough to remain legible on both light and dark\n * backgrounds without a custom palette.\n */\n opacity: 0.5;\n /*\n * Single-line viewport over a vertically-stacked track of every status\n * the driver has emitted. The track translates upward by one line-height\n * per `status()` call (see `--boot-loader-line` below), animated via\n * CSS `transition` on `transform` so the new line slides in from below\n * while the previous line slides out \u2014 independent of any\n * `scroll-behavior` smooth-scroll support, which Playwright/headless\n * Chrome strips even from spec-compliant `scrollTo({ behavior: 'smooth' })`\n * calls.\n */\n height: 1.5em;\n line-height: 1.5;\n letter-spacing: 0.01em;\n /* \n * Fixed-width digits so the `(i/n)` counter on range-bearing status\n * updates (\"Loading plugins (12/80)\") doesn't jitter as the index\n * ticks through different glyph widths. \n */\n font-variant-numeric: tabular-nums;\n text-align: center;\n overflow: hidden;\n}\n\n/*\n * Track of every appended `.boot-loader-status-line`. The driver writes\n * `--boot-loader-line` (0 = first line visible, 1 = second, \u2026) on this\n * element and the `transform` interpolates because `--boot-loader-line` is\n * registered as a typed `<number>` custom property below.\n */\n#boot-loader-status-track {\n display: flex;\n flex-direction: column;\n /*\n * The driver writes `transform: translateY(<index>em)` directly per\n * `status()` call (see `boot-loader.js`). The transition animates the\n * change so the new line slides in from below while the previous one\n * slides out at the top.\n */\n transform: translateY(0);\n transition: transform 500ms ease-out;\n}\n\n/* Honour reduced-motion preferences explicitly \u2014 `transition` doesn't auto-respect it. */\n@media (prefers-reduced-motion: reduce) {\n #boot-loader-status-track {\n transition: none;\n }\n}\n\n.boot-loader-status-line {\n flex: 0 0 auto;\n height: 1.5em;\n white-space: nowrap;\n}\n";
|
|
5
|
+
|
|
6
|
+
// raw-loader:/__w/dxos/dxos/packages/sdk/app-framework/src/vite-plugin/boot-loader/boot-loader.js?raw
|
|
7
|
+
var boot_loader_default2 = "//\n// Copyright 2026 DXOS.org\n//\n\n// Inline driver script \u2014 injected into the host's `<body>` by `bootLoaderPlugin`.\n// Runs before the module bundle is fetched, so the host can observe `boot:html-parsed`\n// and update the visible status from `main.tsx` between phases.\n//\n// The loader has two host-driven states (plus an unobserved idle state on\n// script entry that's promoted automatically \u2014 there's no API to opt out of\n// motion on cold load, by design):\n// - State 1 (slow tick): auto-entered the moment the inline script runs;\n// asymptotic creep toward `STATE_1_ASYMPTOTE`%.\n// - State 2 (progress): host-driven, value supplied to `progress(fraction)`.\n// The creep stays alive in state 2 too, with a\n// ceiling that climbs `STATE_2_BUMP` percent ahead\n// of the most recent `progress()` call (capped at\n// `ABSOLUTE_CEILING`). Between sparse host updates\n// the ring keeps inching forward toward that\n// ceiling, so a long activation gap doesn't read\n// as a frozen disc.\n//\n// `window.__bootLoader.status(text)` updates the visible status line.\n// `window.__bootLoader.progress(fraction)` enter state 2 with `fraction` \u2208 [0, 1].\n// `window.__bootLoader.dismiss()` remove the loader DOM (terminal).\n//\n// Kept ES5-flavoured so the bundler never has to touch it.\n\n(function () {\n performance.mark('boot:html-parsed');\n\n // Asymptotic creep \u2014 `next = raw + (ceiling - raw) * creepRate` per tick,\n // so the var eases toward `ceiling` and never quite reaches it.\n var CREEP_TICK_MS = 100;\n // State 1 creep is a \"we're alive\" hint before any real progress lands,\n // so it eases gently toward a low asymptote.\n var STATE_1_RATE = 0.04;\n var STATE_1_ASYMPTOTE = 20;\n // State 2 creep bridges the gap between sparse `progress()` calls.\n // Tuning is a trade-off:\n // - Larger `STATE_2_RATE` \u2192 fills faster, but reaches the ceiling\n // sooner and then sits idle (looks \"paused\").\n // - Larger `STATE_2_BUMP` \u2192 ring leads further ahead of the host's\n // last reported value, so subsequent host updates feel \"behind\"\n // until they cross the lead.\n // Current values aim for continuous-but-modest motion through a ~5 s\n // activation silence: 50 % \u2192 ~64 % over 5 s, ceiling at host + 15 % so\n // real progress can catch up via `Math.max` without big jumps.\n var STATE_2_RATE = 0.05;\n var STATE_2_BUMP = 15;\n // Ring never auto-creeps past this \u2014 keeps the user from interpreting the\n // ring as \"almost done\" while the host hasn't actually said so.\n var ABSOLUTE_CEILING = 90;\n\n // 0 = idle (transient \u2014 auto-promoted to 1 immediately below),\n // 1 = slow tick, 2 = host-driven progress.\n var state = 0;\n var creepHandle = null;\n var creepCeiling = STATE_1_ASYMPTOTE;\n var creepRate = STATE_1_RATE;\n var trace = /(?:^|[?&])trace=1(?:&|$)/.test(window.location.search);\n var start = Date.now();\n var last = Date.now();\n var timings = [];\n\n function ensureCreep() {\n if (creepHandle != null) {\n return;\n }\n creepHandle = setInterval(function () {\n var element = document.getElementById('boot-loader-disc');\n if (!element) {\n return;\n }\n var raw = parseFloat(element.style.getPropertyValue('--boot-loader-bar-progress')) || 0;\n // Already at (or above) the ceiling \u2014 nothing to do this tick.\n if (raw >= creepCeiling - 0.1) {\n return;\n }\n var next = raw + (creepCeiling - raw) * creepRate;\n element.style.setProperty('--boot-loader-bar-progress', String(next));\n if (next > 0 && next < 100) {\n element.setAttribute('data-progress-active', '');\n }\n }, CREEP_TICK_MS);\n }\n\n function stopCreep() {\n if (creepHandle != null) {\n clearInterval(creepHandle);\n creepHandle = null;\n }\n }\n\n window.__bootLoader = {\n /**\n * Update the visible status line. The caller owns formatting \u2014 the\n * loader just renders `humanized` and records the structured fields\n * for the trace. Idempotent on the full structured payload: equal\n * back-to-back updates are a no-op, but two updates with the same\n * visible text and different `event` / `module` ids still produce a\n * fresh trace entry so the timeline can distinguish those transitions.\n *\n * Payload: `{ event?, module?, humanized, range? }`.\n * - `humanized`: the exact string to display (e.g. \"Loading framework\u2026\",\n * \"Activating Observability: react-surface\").\n * - `event` / `module`: optional raw ids for the trace, when the\n * update originates from an activation transition.\n * - `range`: optional `{ index, total }` for ticking progress within\n * a single phase (e.g. \"Loading plugins (12/80)\"). When present,\n * the loader replaces the current line in place rather than\n * appending a new one \u2014 so 80 plugin loads produce one trace\n * entry with an updating suffix instead of 80 separate lines.\n */\n status: function (payload) {\n if (!payload || typeof payload !== 'object') {\n return;\n }\n var humanized = payload.humanized || '';\n var event = payload.event || null;\n var moduleId = payload.module || null;\n var range =\n payload.range && typeof payload.range.index === 'number' && typeof payload.range.total === 'number'\n ? payload.range\n : null;\n // Display text appends the (i/n) suffix when a range is provided so\n // the same `humanized` string can tick through a count without the\n // caller having to format it.\n var displayText = range ? humanized + ' (' + range.index + '/' + range.total + ')' : humanized;\n // Compare against the previous entry's structured fields, not the\n // DOM text alone \u2014 two different transitions can humanize to the same\n // visible string (e.g. an event-level \"Activating Foo\" followed by a\n // module-level \"Activating Foo: react-surface\" reduced to \"Activating\n // Foo\" by a custom formatter), and the trace should still carry both.\n var previous = timings.length > 0 ? timings[timings.length - 1] : null;\n if (\n previous &&\n previous.text === displayText &&\n (previous.event || null) === event &&\n (previous.module || null) === moduleId\n ) {\n return;\n }\n if (range && previous) {\n // Range tick \u2014 collapse into the previous trace entry instead of\n // appending. The trace timeline records one transition per phase,\n // not one per `(i/n)` step, keeping the boot trace compact.\n previous.text = displayText;\n } else {\n if (previous) {\n previous.duration = Date.now() - last;\n }\n var entry = { text: displayText };\n if (event) {\n entry.event = event;\n }\n if (moduleId) {\n entry.module = moduleId;\n }\n timings.push(entry);\n last = Date.now();\n }\n var element = document.getElementById('boot-loader-status');\n if (!element) {\n return;\n }\n // The track holds every appended status line. On the first\n // `status()` call we hoist any pre-existing lines (the initial\n // status injected by `bootLoaderPlugin`) into the track so the\n // CSS `transform` translation applies uniformly.\n var track = document.getElementById('boot-loader-status-track');\n if (!track) {\n track = document.createElement('div');\n track.id = 'boot-loader-status-track';\n while (element.firstChild) {\n track.appendChild(element.firstChild);\n }\n element.appendChild(track);\n }\n var lastLine = track.lastElementChild;\n if (range && lastLine) {\n // Range tick \u2014 replace the current visible line's text in place,\n // no slide. The line keeps its position so the (i/n) counter just\n // updates over the same row.\n lastLine.textContent = displayText;\n } else {\n // Fresh phase (or first line) \u2014 append and slide the track up so\n // the new line aligns with the single-line viewport. The CSS\n // `transition` on the track's `transform` eases the move; we\n // measure in pixels (not `em`) because some engines (and headless\n // Chromium) don't reliably interpolate `transform` between\n // `em`-valued translateY's.\n var line = document.createElement('div');\n line.className = 'boot-loader-status-line';\n line.textContent = displayText;\n track.appendChild(line);\n var lineHeight = line.getBoundingClientRect().height || 0;\n track.style.transform = 'translateY(' + (track.children.length - 1) * -lineHeight + 'px)';\n }\n },\n\n /**\n * Enter state 2 (host-driven progress) \u2014 set the determinate ring to\n * `fraction` \u2208 [0, 1]. Invalid / negative / non-finite values clamp to\n * 0 (the empty ring) rather than letting `NaN`/`Infinity` slip into\n * `--boot-loader-bar-progress`, which CSS would treat as invalid and\n * silently reset to the 0% var() default. The state-1 creep timer is\n * left running with a new ceiling so the ring keeps inching forward\n * between host updates.\n *\n * The ring never regresses: if the requested value is below the\n * current var (e.g. the host's first call is `progress(0)` while the\n * creep had already reached ~12%), the existing value is held. The\n * host's progress catches up once it exceeds the held floor, so the\n * ring's motion stays monotonic across the state-1 \u2192 state-2 boundary.\n */\n progress: function (fraction) {\n state = 2;\n // Set the var on the disc so both the masked ring and the orbiting\n // dot (siblings inside `#boot-loader-disc`) inherit the same value.\n var element = document.getElementById('boot-loader-disc');\n if (!element) {\n return;\n }\n // Flip into \"host-driven\" mode the first time `progress()` lands \u2014\n // CSS keys the brand mark's grayscale\u2192color transition off this\n // attribute, so the mark eases from monochrome to full palette as\n // real progress starts arriving.\n element.setAttribute('data-host-driven', '');\n var clamped = typeof fraction !== 'number' || !isFinite(fraction) || fraction < 0 ? 0 : Math.min(1, fraction);\n var requestedPct = clamped * 100;\n var currentPct = parseFloat(element.style.getPropertyValue('--boot-loader-bar-progress')) || 0;\n var nextPct = Math.max(currentPct, requestedPct);\n element.style.setProperty('--boot-loader-bar-progress', String(nextPct));\n // Switch the ongoing creep to its state-2 cadence \u2014 faster ease and\n // a larger lead bump so the ring keeps moving while the host is\n // silent (e.g. composer-app's \"Starting Composer\u2026\" stretch while the\n // first slow plugin module activates).\n creepRate = STATE_2_RATE;\n var newCeiling = Math.min(nextPct + STATE_2_BUMP, ABSOLUTE_CEILING);\n if (newCeiling > creepCeiling) {\n creepCeiling = newCeiling;\n }\n ensureCreep();\n // Toggle the leading-edge dot only while progress is strictly in (0, 1).\n if (nextPct > 0 && nextPct < 100) {\n element.setAttribute('data-progress-active', '');\n } else {\n element.removeAttribute('data-progress-active');\n }\n },\n\n dismiss: function () {\n stopCreep();\n var element = document.getElementById('boot-loader');\n if (element && element.parentNode) {\n element.parentNode.removeChild(element);\n }\n\n if (trace) {\n if (timings.length > 0) {\n timings[timings.length - 1].duration = Date.now() - last;\n }\n console.log(JSON.stringify({ total: Date.now() - start, timings }, null, 2));\n }\n },\n };\n\n // Auto-promote idle \u2192 slow tick the moment this inline script executes,\n // so the disc starts moving on the very first frame the loader paints.\n // The host calls `progress()` later to take over.\n state = 1;\n ensureCreep();\n})();\n";
|
|
8
|
+
|
|
9
|
+
// src/vite-plugin/boot-loader/index.ts
|
|
10
|
+
var bootLoaderPlugin = ({ status, markSvg } = {}) => {
|
|
11
|
+
return {
|
|
12
|
+
name: "app-framework:boot-loader",
|
|
13
|
+
transformIndexHtml() {
|
|
14
|
+
const markChildren = markSvg ? [
|
|
15
|
+
{
|
|
16
|
+
tag: "div",
|
|
17
|
+
attrs: {
|
|
18
|
+
id: "boot-loader-mark"
|
|
19
|
+
},
|
|
20
|
+
children: markSvg
|
|
21
|
+
}
|
|
22
|
+
] : [];
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
tag: "style",
|
|
26
|
+
injectTo: "head",
|
|
27
|
+
children: boot_loader_default
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
tag: "div",
|
|
31
|
+
injectTo: "body-prepend",
|
|
32
|
+
attrs: {
|
|
33
|
+
id: "boot-loader",
|
|
34
|
+
role: "status",
|
|
35
|
+
"aria-live": "polite",
|
|
36
|
+
"aria-label": "Initializing"
|
|
37
|
+
},
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
tag: "div",
|
|
41
|
+
attrs: {
|
|
42
|
+
id: "boot-loader-disc"
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
{
|
|
46
|
+
tag: "div",
|
|
47
|
+
attrs: {
|
|
48
|
+
id: "boot-loader-bar"
|
|
49
|
+
},
|
|
50
|
+
children: ""
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tag: "div",
|
|
54
|
+
attrs: {
|
|
55
|
+
id: "boot-loader-dot"
|
|
56
|
+
},
|
|
57
|
+
children: ""
|
|
58
|
+
},
|
|
59
|
+
...markChildren
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
tag: "div",
|
|
64
|
+
attrs: {
|
|
65
|
+
id: "boot-loader-status"
|
|
66
|
+
},
|
|
67
|
+
children: status ? [
|
|
68
|
+
{
|
|
69
|
+
tag: "div",
|
|
70
|
+
attrs: {
|
|
71
|
+
class: "boot-loader-status-line"
|
|
72
|
+
},
|
|
73
|
+
children: status
|
|
74
|
+
}
|
|
75
|
+
] : []
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
tag: "script",
|
|
81
|
+
injectTo: "body-prepend",
|
|
82
|
+
children: boot_loader_default2
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/vite-plugin/manifest.ts
|
|
90
|
+
import { PLUGIN_ENTRY_FILENAME } from "@dxos/protocols";
|
|
91
|
+
var MANIFEST_ASSET_NAME = "manifest.json";
|
|
92
|
+
var ENTRY_FILENAME = PLUGIN_ENTRY_FILENAME;
|
|
93
|
+
var serializeManifest = (meta, { assets }) => JSON.stringify({
|
|
94
|
+
...meta,
|
|
95
|
+
assets
|
|
96
|
+
}, null, 2);
|
|
97
|
+
|
|
98
|
+
// src/vite-plugin/packages.ts
|
|
99
|
+
var THIRD_PARTY_SHARED_PACKAGES = [
|
|
100
|
+
"@effect-atom/atom",
|
|
101
|
+
"@effect-atom/atom-react",
|
|
102
|
+
"@effect/platform",
|
|
103
|
+
"effect",
|
|
104
|
+
"lit",
|
|
105
|
+
"react",
|
|
106
|
+
"react-dom",
|
|
107
|
+
"solid-js"
|
|
108
|
+
];
|
|
109
|
+
var DEFAULT_PACKAGES = [
|
|
110
|
+
// packages/common
|
|
111
|
+
"@dxos/async",
|
|
112
|
+
"@dxos/codec-protobuf",
|
|
113
|
+
"@dxos/context",
|
|
114
|
+
"@dxos/crypto",
|
|
115
|
+
"@dxos/debug",
|
|
116
|
+
"@dxos/display-name",
|
|
117
|
+
"@dxos/effect",
|
|
118
|
+
"@dxos/effect-atom-solid",
|
|
119
|
+
"@dxos/errors",
|
|
120
|
+
"@dxos/feed-store",
|
|
121
|
+
"@dxos/graph",
|
|
122
|
+
"@dxos/hypercore",
|
|
123
|
+
"@dxos/invariant",
|
|
124
|
+
"@dxos/keyboard",
|
|
125
|
+
"@dxos/keys",
|
|
126
|
+
"@dxos/kv-store",
|
|
127
|
+
"@dxos/log",
|
|
128
|
+
"@dxos/merkle-search-tree",
|
|
129
|
+
"@dxos/random",
|
|
130
|
+
"@dxos/random-access-storage",
|
|
131
|
+
"@dxos/timeframe",
|
|
132
|
+
"@dxos/tracing",
|
|
133
|
+
"@dxos/util",
|
|
134
|
+
"@dxos/web-context",
|
|
135
|
+
"@dxos/web-context-react",
|
|
136
|
+
"@dxos/web-context-solid",
|
|
137
|
+
// packages/core/echo
|
|
138
|
+
"@dxos/echo",
|
|
139
|
+
"@dxos/echo-atom",
|
|
140
|
+
"@dxos/echo-db",
|
|
141
|
+
"@dxos/echo-pipeline",
|
|
142
|
+
"@dxos/echo-protocol",
|
|
143
|
+
"@dxos/echo-query",
|
|
144
|
+
"@dxos/echo-react",
|
|
145
|
+
"@dxos/echo-solid",
|
|
146
|
+
"@dxos/feed",
|
|
147
|
+
"@dxos/index-core",
|
|
148
|
+
// packages/core/halo
|
|
149
|
+
"@dxos/credentials",
|
|
150
|
+
"@dxos/keyring",
|
|
151
|
+
// packages/core/mesh
|
|
152
|
+
"@dxos/edge-client",
|
|
153
|
+
"@dxos/messaging",
|
|
154
|
+
"@dxos/network-manager",
|
|
155
|
+
"@dxos/rpc",
|
|
156
|
+
"@dxos/rpc-tunnel",
|
|
157
|
+
"@dxos/teleport",
|
|
158
|
+
"@dxos/teleport-extension-automerge-replicator",
|
|
159
|
+
"@dxos/teleport-extension-gossip",
|
|
160
|
+
"@dxos/teleport-extension-object-sync",
|
|
161
|
+
"@dxos/teleport-extension-replicator",
|
|
162
|
+
"@dxos/websocket-rpc",
|
|
163
|
+
// packages/core
|
|
164
|
+
"@dxos/ai",
|
|
165
|
+
"@dxos/assistant",
|
|
166
|
+
"@dxos/assistant-toolkit",
|
|
167
|
+
"@dxos/blueprints",
|
|
168
|
+
"@dxos/compute",
|
|
169
|
+
"@dxos/conductor",
|
|
170
|
+
"@dxos/functions",
|
|
171
|
+
"@dxos/functions-runtime",
|
|
172
|
+
"@dxos/mcp-client",
|
|
173
|
+
"@dxos/operation",
|
|
174
|
+
"@dxos/protocols",
|
|
175
|
+
// packages/devtools
|
|
176
|
+
"@dxos/devtools",
|
|
177
|
+
// packages/sdk
|
|
178
|
+
"@dxos/app-framework",
|
|
179
|
+
"@dxos/app-graph",
|
|
180
|
+
"@dxos/app-solid",
|
|
181
|
+
"@dxos/app-toolkit",
|
|
182
|
+
"@dxos/client",
|
|
183
|
+
"@dxos/client-protocol",
|
|
184
|
+
"@dxos/client-services",
|
|
185
|
+
"@dxos/config",
|
|
186
|
+
"@dxos/migrations",
|
|
187
|
+
"@dxos/observability",
|
|
188
|
+
"@dxos/react-client",
|
|
189
|
+
"@dxos/react-edge-client",
|
|
190
|
+
"@dxos/schema",
|
|
191
|
+
"@dxos/types",
|
|
192
|
+
// packages/ui
|
|
193
|
+
"@dxos/lit-grid",
|
|
194
|
+
"@dxos/lit-ui",
|
|
195
|
+
"@dxos/react-hooks",
|
|
196
|
+
"@dxos/react-ui",
|
|
197
|
+
"@dxos/react-ui-attention",
|
|
198
|
+
"@dxos/react-ui-board",
|
|
199
|
+
"@dxos/react-ui-calendar",
|
|
200
|
+
"@dxos/react-ui-canvas",
|
|
201
|
+
"@dxos/react-ui-canvas-compute",
|
|
202
|
+
"@dxos/react-ui-canvas-editor",
|
|
203
|
+
"@dxos/react-ui-chat",
|
|
204
|
+
"@dxos/react-ui-components",
|
|
205
|
+
"@dxos/react-ui-dnd",
|
|
206
|
+
"@dxos/react-ui-editor",
|
|
207
|
+
"@dxos/react-ui-form",
|
|
208
|
+
"@dxos/react-ui-gameboard",
|
|
209
|
+
"@dxos/react-ui-geo",
|
|
210
|
+
"@dxos/react-ui-graph",
|
|
211
|
+
"@dxos/react-ui-grid",
|
|
212
|
+
"@dxos/react-ui-list",
|
|
213
|
+
"@dxos/react-ui-markdown",
|
|
214
|
+
"@dxos/react-ui-masonry",
|
|
215
|
+
"@dxos/react-ui-menu",
|
|
216
|
+
"@dxos/react-ui-mosaic",
|
|
217
|
+
"@dxos/react-ui-pickers",
|
|
218
|
+
"@dxos/react-ui-list",
|
|
219
|
+
"@dxos/react-ui-sfx",
|
|
220
|
+
"@dxos/react-ui-stack",
|
|
221
|
+
"@dxos/react-ui-syntax-highlighter",
|
|
222
|
+
"@dxos/react-ui-table",
|
|
223
|
+
"@dxos/react-ui-tabs",
|
|
224
|
+
"@dxos/react-ui-text-tooltip",
|
|
225
|
+
"@dxos/react-ui-thread",
|
|
226
|
+
"@dxos/solid-ui",
|
|
227
|
+
"@dxos/solid-ui-geo",
|
|
228
|
+
"@dxos/ui",
|
|
229
|
+
"@dxos/ui-editor",
|
|
230
|
+
"@dxos/ui-theme",
|
|
231
|
+
"@dxos/ui-types",
|
|
232
|
+
// third-party
|
|
233
|
+
...THIRD_PARTY_SHARED_PACKAGES
|
|
234
|
+
];
|
|
235
|
+
var isSharedPackage = (id) => DEFAULT_PACKAGES.some((pkg) => id === pkg || id.startsWith(`${pkg}/`));
|
|
236
|
+
|
|
237
|
+
// src/vite-plugin/composer/index.ts
|
|
238
|
+
var JSX_DEV_RUNTIME = "react/jsx-dev-runtime";
|
|
239
|
+
var isExternal = (id) => id !== JSX_DEV_RUNTIME && isSharedPackage(id);
|
|
240
|
+
var REQUIRE_SHIM_BANNER = [
|
|
241
|
+
"// --- composer-plugin: CJS require shim ---",
|
|
242
|
+
"// See @dxos/app-framework/vite-plugin/composer-plugin.ts for rationale.",
|
|
243
|
+
"import * as __composerReact from 'react';",
|
|
244
|
+
"import * as __composerReactDom from 'react-dom';",
|
|
245
|
+
"import * as __composerReactJsxRuntime from 'react/jsx-runtime';",
|
|
246
|
+
"const __composerRequireShim = new Map([",
|
|
247
|
+
" ['react', __composerReact.default ?? __composerReact],",
|
|
248
|
+
" ['react-dom', __composerReactDom.default ?? __composerReactDom],",
|
|
249
|
+
" ['react/jsx-runtime', __composerReactJsxRuntime],",
|
|
250
|
+
"]);",
|
|
251
|
+
"// Module-local binding: rolldown's CJS fallback does a `typeof require` check",
|
|
252
|
+
"// and uses whichever `require` is in lexical scope. Declaring this as `const`",
|
|
253
|
+
"// (instead of `globalThis.require ??=`) keeps each bundle's shim isolated from",
|
|
254
|
+
"// the host page and from other plugins sharing the window.",
|
|
255
|
+
"const require = (id) => {",
|
|
256
|
+
" if (__composerRequireShim.has(id)) return __composerRequireShim.get(id);",
|
|
257
|
+
" throw new Error('composer-plugin: unsupported CJS require at runtime: ' + id);",
|
|
258
|
+
"};",
|
|
259
|
+
"// --- end CJS require shim ---"
|
|
260
|
+
].join("\n");
|
|
261
|
+
var composerPlugin = (options) => {
|
|
262
|
+
const entry = options?.entry ?? "src/plugin.tsx";
|
|
263
|
+
const port = options?.port ?? 3967;
|
|
264
|
+
const meta = options?.meta;
|
|
265
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
266
|
+
let base = "/";
|
|
267
|
+
const plugins = [
|
|
268
|
+
// Configure vite for library-mode builds with externalized deps.
|
|
269
|
+
{
|
|
270
|
+
name: "composer-plugin",
|
|
271
|
+
config: () => ({
|
|
272
|
+
server: {
|
|
273
|
+
port,
|
|
274
|
+
// Allow the Composer host (different origin) to dynamically import plugin modules.
|
|
275
|
+
cors: true
|
|
276
|
+
},
|
|
277
|
+
preview: {
|
|
278
|
+
port
|
|
279
|
+
},
|
|
280
|
+
build: {
|
|
281
|
+
sourcemap: true,
|
|
282
|
+
// Transitively-bundled WASM modules (automerge, tiktoken, …) emit top-level
|
|
283
|
+
// await; `esnext` lets rolldown pass that through without an explicit polyfill.
|
|
284
|
+
target: "esnext",
|
|
285
|
+
lib: {
|
|
286
|
+
entry,
|
|
287
|
+
formats: [
|
|
288
|
+
"es"
|
|
289
|
+
],
|
|
290
|
+
fileName: () => ENTRY_FILENAME
|
|
291
|
+
},
|
|
292
|
+
rolldownOptions: {
|
|
293
|
+
external: (id) => isExternal(id),
|
|
294
|
+
output: {
|
|
295
|
+
chunkFileNames: "chunks/[name]-[hash].js",
|
|
296
|
+
assetFileNames: "assets/[name]-[hash][extname]",
|
|
297
|
+
// Install the CJS require shim at the top of plugin.mjs so transitively
|
|
298
|
+
// bundled CJS helpers (that call `require('react')` et al. at runtime) can
|
|
299
|
+
// resolve against the host-provided externals instead of throwing.
|
|
300
|
+
banner: REQUIRE_SHIM_BANNER
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
},
|
|
306
|
+
// Dev-time externalization.
|
|
307
|
+
// Vite's dev server doesn't use rollup externals, so we need to handle it manually.
|
|
308
|
+
// We intercept imports of shared deps at resolve time, mark them external, and then
|
|
309
|
+
// strip the `/@id/` prefix that Vite's import analysis injects for external modules.
|
|
310
|
+
{
|
|
311
|
+
name: "composer-plugin:externalize",
|
|
312
|
+
enforce: "pre",
|
|
313
|
+
apply: "serve",
|
|
314
|
+
// Exclude shared packages from Vite's dependency pre-bundling.
|
|
315
|
+
config: () => ({
|
|
316
|
+
optimizeDeps: {
|
|
317
|
+
exclude: DEFAULT_PACKAGES
|
|
318
|
+
}
|
|
319
|
+
}),
|
|
320
|
+
// Mark shared deps as external so Vite doesn't try to bundle them.
|
|
321
|
+
resolveId: (id) => {
|
|
322
|
+
if (isExternal(id)) {
|
|
323
|
+
resolved.add(id);
|
|
324
|
+
return {
|
|
325
|
+
id,
|
|
326
|
+
external: true
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
// Return a stub for any externalized module that Vite tries to load directly.
|
|
331
|
+
load: (id) => {
|
|
332
|
+
if (resolved.has(id)) {
|
|
333
|
+
return {
|
|
334
|
+
code: "export default {};"
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
// After all plugins are resolved, inject a late-stage transform plugin that strips
|
|
339
|
+
// the `/@id/` prefix from externalized bare specifiers in the output.
|
|
340
|
+
// This must run after Vite's internal import analysis which rewrites bare specifiers.
|
|
341
|
+
configResolved: (config) => {
|
|
342
|
+
base = config.base ?? "/";
|
|
343
|
+
config.plugins.push({
|
|
344
|
+
name: "composer-plugin:strip-prefix",
|
|
345
|
+
transform: (code) => {
|
|
346
|
+
if (resolved.size === 0) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const escaped = [
|
|
350
|
+
...resolved
|
|
351
|
+
].map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
352
|
+
const pattern = new RegExp(`${base}@id/(${escaped})`, "g");
|
|
353
|
+
if (pattern.test(code)) {
|
|
354
|
+
return code.replace(pattern, (_, dep) => dep);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
// JSX dev runtime shim.
|
|
361
|
+
// React refresh (used by @vitejs/plugin-react) imports from `react/jsx-dev-runtime`,
|
|
362
|
+
// but the externalized React only exposes `react/jsx-runtime`. This virtual module
|
|
363
|
+
// bridges the gap by re-exporting jsx-runtime's functions under jsx-dev-runtime's API.
|
|
364
|
+
{
|
|
365
|
+
name: "composer-plugin:jsx-dev-shim",
|
|
366
|
+
enforce: "pre",
|
|
367
|
+
apply: "serve",
|
|
368
|
+
resolveId: (id) => id === JSX_DEV_RUNTIME ? `\0${JSX_DEV_RUNTIME}` : void 0,
|
|
369
|
+
load: (id) => id === `\0${JSX_DEV_RUNTIME}` ? [
|
|
370
|
+
'import { jsx, jsxs, Fragment } from "react/jsx-runtime";',
|
|
371
|
+
"export { Fragment };",
|
|
372
|
+
"export function jsxDEV(type, props, key, isStaticChildren) {",
|
|
373
|
+
" return isStaticChildren ? jsxs(type, props, key) : jsx(type, props, key);",
|
|
374
|
+
"}"
|
|
375
|
+
].join("\n") : void 0
|
|
376
|
+
},
|
|
377
|
+
// React Refresh preamble stub.
|
|
378
|
+
//
|
|
379
|
+
// @vitejs/plugin-react's JSX transform prepends a runtime check to every module:
|
|
380
|
+
// if (!window.$RefreshReg$) throw new Error("@vitejs/plugin-react can't detect preamble…");
|
|
381
|
+
// In a normal single-origin app, vite injects a `<script type="module">` preamble
|
|
382
|
+
// into `index.html` that sets up `$RefreshReg$` / `$RefreshSig$` on `window` before any
|
|
383
|
+
// app code runs. When a community plugin is dev-served at its own origin and then
|
|
384
|
+
// dynamic-imported into the Composer host at a different origin, the host's window
|
|
385
|
+
// never receives that preamble, so every JSX module throws on first import.
|
|
386
|
+
//
|
|
387
|
+
// Inject a no-op refresh shim on the host's window from the plugin's entrypoint: fast-
|
|
388
|
+
// refresh itself doesn't work cross-origin anyway, so silencing the check lets the
|
|
389
|
+
// plugin load and ordinary page reloads take care of picking up edits. Production
|
|
390
|
+
// builds are untouched (`apply: 'serve'`).
|
|
391
|
+
{
|
|
392
|
+
name: "composer-plugin:react-refresh-shim",
|
|
393
|
+
enforce: "pre",
|
|
394
|
+
apply: "serve",
|
|
395
|
+
transform(code, id) {
|
|
396
|
+
if (!id.endsWith(entry.replace(/^\.?\//, "/"))) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const shim = [
|
|
400
|
+
"// composer-plugin: no-op React Refresh shim so cross-origin plugin modules",
|
|
401
|
+
"// don't throw the @vitejs/plugin-react preamble check at dynamic-import time.",
|
|
402
|
+
'if (typeof window !== "undefined") {',
|
|
403
|
+
" window.$RefreshReg$ = window.$RefreshReg$ || (() => {});",
|
|
404
|
+
" window.$RefreshSig$ = window.$RefreshSig$ || (() => (type) => type);",
|
|
405
|
+
" window.__vite_plugin_react_preamble_installed__ = true;",
|
|
406
|
+
"}",
|
|
407
|
+
""
|
|
408
|
+
].join("\n");
|
|
409
|
+
return {
|
|
410
|
+
code: shim + code,
|
|
411
|
+
map: null
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
];
|
|
416
|
+
if (meta) {
|
|
417
|
+
plugins.push({
|
|
418
|
+
name: "composer-plugin:emit-manifest",
|
|
419
|
+
apply: "build",
|
|
420
|
+
// `enforce: 'post'` is load-bearing: vite's CSS extraction plugin emits sibling
|
|
421
|
+
// `.css` assets in its own `generateBundle` hook. Without `post`, ours runs first
|
|
422
|
+
// and sees only the JS chunks — the manifest then omits CSS, so the host can't
|
|
423
|
+
// inject `<link>` tags for the plugin's stylesheet at install time.
|
|
424
|
+
enforce: "post",
|
|
425
|
+
generateBundle(_options, bundle) {
|
|
426
|
+
const assets = Object.keys(bundle).filter((name) => name !== MANIFEST_ASSET_NAME && !name.endsWith(".map")).sort();
|
|
427
|
+
this.emitFile({
|
|
428
|
+
type: "asset",
|
|
429
|
+
fileName: MANIFEST_ASSET_NAME,
|
|
430
|
+
source: serializeManifest(meta, {
|
|
431
|
+
assets
|
|
432
|
+
})
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
return plugins;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// src/vite-plugin/import-map/index.ts
|
|
441
|
+
import { init as initCjsLexer, parse as parseCjs } from "cjs-module-lexer";
|
|
442
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
443
|
+
import { createRequire as nodeCreateRequire } from "node:module";
|
|
444
|
+
import path from "node:path";
|
|
445
|
+
var require2 = nodeCreateRequire(import.meta.url);
|
|
446
|
+
var trimQueryString = (id) => id.replace(/\?.*$/, "");
|
|
447
|
+
var resolvedIdIsEsmModule = (resolvedId) => {
|
|
448
|
+
const file = trimQueryString(resolvedId);
|
|
449
|
+
if (file.endsWith(".mjs") || file.endsWith(".mts")) {
|
|
450
|
+
return true;
|
|
451
|
+
}
|
|
452
|
+
if (file.endsWith(".cjs") || file.endsWith(".cts")) {
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
let directory = path.dirname(file);
|
|
456
|
+
while (directory !== path.dirname(directory)) {
|
|
457
|
+
const packageJsonPath = path.join(directory, "package.json");
|
|
458
|
+
if (existsSync(packageJsonPath)) {
|
|
459
|
+
try {
|
|
460
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
461
|
+
return pkg.type === "module";
|
|
462
|
+
} catch {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
directory = path.dirname(directory);
|
|
467
|
+
}
|
|
468
|
+
return false;
|
|
469
|
+
};
|
|
470
|
+
var findPackageJsonPath = (resolvedId, packageName) => {
|
|
471
|
+
let directory = path.dirname(trimQueryString(resolvedId));
|
|
472
|
+
while (directory !== path.dirname(directory)) {
|
|
473
|
+
const packageJsonPath = path.join(directory, "package.json");
|
|
474
|
+
if (existsSync(packageJsonPath)) {
|
|
475
|
+
try {
|
|
476
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
477
|
+
if (packageJson.name === packageName) {
|
|
478
|
+
return packageJsonPath;
|
|
479
|
+
}
|
|
480
|
+
} catch {
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
directory = path.dirname(directory);
|
|
484
|
+
}
|
|
485
|
+
return void 0;
|
|
486
|
+
};
|
|
487
|
+
var resolvePackageJsonPath = (packageName) => {
|
|
488
|
+
try {
|
|
489
|
+
return findPackageJsonPath(require2.resolve(packageName), packageName);
|
|
490
|
+
} catch {
|
|
491
|
+
return void 0;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
var resolvePackageJsonPathViaContext = async (ctx, packageName) => {
|
|
495
|
+
try {
|
|
496
|
+
const resolved = await ctx.resolve(packageName);
|
|
497
|
+
if (resolved) {
|
|
498
|
+
const viaResolved = findPackageJsonPath(resolved.id, packageName);
|
|
499
|
+
if (viaResolved) {
|
|
500
|
+
return viaResolved;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
} catch {
|
|
504
|
+
}
|
|
505
|
+
return resolvePackageJsonPath(packageName);
|
|
506
|
+
};
|
|
507
|
+
var importMapExcludedSubpaths = {
|
|
508
|
+
"@dxos/app-framework": /* @__PURE__ */ new Set([
|
|
509
|
+
"vite-plugin"
|
|
510
|
+
]),
|
|
511
|
+
// `@dxos/lit-grid/testing` re-exports a playwright page-object manager and pulls
|
|
512
|
+
// `@playwright/test` (and transitive playwright-core) into the browser bundle.
|
|
513
|
+
"@dxos/lit-grid": /* @__PURE__ */ new Set([
|
|
514
|
+
"testing"
|
|
515
|
+
]),
|
|
516
|
+
"@dxos/react-ui-mosaic": /* @__PURE__ */ new Set([
|
|
517
|
+
"playwright"
|
|
518
|
+
]),
|
|
519
|
+
"@dxos/react-ui-stack": /* @__PURE__ */ new Set([
|
|
520
|
+
"playwright"
|
|
521
|
+
]),
|
|
522
|
+
"@dxos/react-ui-table": /* @__PURE__ */ new Set([
|
|
523
|
+
"playwright"
|
|
524
|
+
]),
|
|
525
|
+
"@dxos/ui-theme": /* @__PURE__ */ new Set([
|
|
526
|
+
"plugin"
|
|
527
|
+
]),
|
|
528
|
+
// `solid-js/web/storage` is a server-only helper that pulls
|
|
529
|
+
// `node:async_hooks` (AsyncLocalStorage) and has no browser shim. Client
|
|
530
|
+
// code imports `solid-js`, `solid-js/store`, and `solid-js/web` only.
|
|
531
|
+
"solid-js": /* @__PURE__ */ new Set([
|
|
532
|
+
"web/storage"
|
|
533
|
+
])
|
|
534
|
+
};
|
|
535
|
+
var GLOBALLY_EXCLUDED_SUBPATHS = /* @__PURE__ */ new Set([
|
|
536
|
+
"playwright",
|
|
537
|
+
"testing"
|
|
538
|
+
]);
|
|
539
|
+
var BUILD_TOOL_SUBPATH = /^(vite-plugin|esbuild-plugin|rollup-plugin|plugin)$/;
|
|
540
|
+
var ASSET_SUBPATH = /\.(css|pcss|scss|sass|less|json|node|wasm|html|svg|png|jpe?g|gif|webp|ico)$/;
|
|
541
|
+
var isAssetSubpath = (specifier) => ASSET_SUBPATH.test(specifier);
|
|
542
|
+
var walkDirectoryForExtension = (baseDir, extension) => {
|
|
543
|
+
if (!existsSync(baseDir)) {
|
|
544
|
+
return [];
|
|
545
|
+
}
|
|
546
|
+
const results = [];
|
|
547
|
+
const walk = (dir) => {
|
|
548
|
+
let entries;
|
|
549
|
+
try {
|
|
550
|
+
entries = readdirSync(dir);
|
|
551
|
+
} catch {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
for (const entry of entries) {
|
|
555
|
+
const full = path.join(dir, entry);
|
|
556
|
+
let stat;
|
|
557
|
+
try {
|
|
558
|
+
stat = statSync(full);
|
|
559
|
+
} catch {
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
if (stat.isDirectory()) {
|
|
563
|
+
walk(full);
|
|
564
|
+
} else if (entry.endsWith(extension)) {
|
|
565
|
+
results.push(path.relative(baseDir, full).slice(0, -extension.length));
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
walk(baseDir);
|
|
570
|
+
return results;
|
|
571
|
+
};
|
|
572
|
+
var pickPatternTarget = (value) => {
|
|
573
|
+
if (typeof value === "string") {
|
|
574
|
+
return value;
|
|
575
|
+
}
|
|
576
|
+
if (value && typeof value === "object") {
|
|
577
|
+
const obj = value;
|
|
578
|
+
const preferred = obj.browser ?? obj.import ?? obj.default ?? obj.module;
|
|
579
|
+
return typeof preferred === "string" ? preferred : void 0;
|
|
580
|
+
}
|
|
581
|
+
return void 0;
|
|
582
|
+
};
|
|
583
|
+
var expandWildcardExport = (packageName, packageJsonDir, exportKey, exportValue) => {
|
|
584
|
+
const target = pickPatternTarget(exportValue);
|
|
585
|
+
if (!target || !target.includes("*")) {
|
|
586
|
+
return [];
|
|
587
|
+
}
|
|
588
|
+
const keyStarIndex = exportKey.indexOf("*");
|
|
589
|
+
const targetStarIndex = target.indexOf("*");
|
|
590
|
+
if (keyStarIndex === -1 || targetStarIndex === -1) {
|
|
591
|
+
return [];
|
|
592
|
+
}
|
|
593
|
+
const keyPrefix = exportKey.slice(2, keyStarIndex);
|
|
594
|
+
const targetPrefix = target.slice(2, targetStarIndex);
|
|
595
|
+
const targetSuffix = target.slice(targetStarIndex + 1);
|
|
596
|
+
const baseDir = path.resolve(packageJsonDir, targetPrefix);
|
|
597
|
+
const files = walkDirectoryForExtension(baseDir, targetSuffix || ".js");
|
|
598
|
+
return files.map((relativeNoExt) => `${packageName}/${keyPrefix}${relativeNoExt}`);
|
|
599
|
+
};
|
|
600
|
+
var getPackageEntrypoints = (packageName, packageJsonPath) => {
|
|
601
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
602
|
+
const exportsField = packageJson.exports;
|
|
603
|
+
if (!exportsField || typeof exportsField === "string" || Array.isArray(exportsField)) {
|
|
604
|
+
return [
|
|
605
|
+
packageName
|
|
606
|
+
];
|
|
607
|
+
}
|
|
608
|
+
const exportKeys = Object.keys(exportsField);
|
|
609
|
+
if (!exportKeys.some((key) => key.startsWith("."))) {
|
|
610
|
+
return [
|
|
611
|
+
packageName
|
|
612
|
+
];
|
|
613
|
+
}
|
|
614
|
+
const excluded = importMapExcludedSubpaths[packageName];
|
|
615
|
+
const packageJsonDir = path.dirname(packageJsonPath);
|
|
616
|
+
const modules = exportKeys.flatMap((key) => {
|
|
617
|
+
if (key === ".") {
|
|
618
|
+
return [
|
|
619
|
+
packageName
|
|
620
|
+
];
|
|
621
|
+
}
|
|
622
|
+
if (!key.startsWith("./") || key === "./package.json") {
|
|
623
|
+
return [];
|
|
624
|
+
}
|
|
625
|
+
if (key.endsWith(".d.ts")) {
|
|
626
|
+
return [];
|
|
627
|
+
}
|
|
628
|
+
if (key.includes("*")) {
|
|
629
|
+
return expandWildcardExport(packageName, packageJsonDir, key, exportsField[key]);
|
|
630
|
+
}
|
|
631
|
+
const subpath = key.slice(2);
|
|
632
|
+
if (excluded?.has(subpath) || GLOBALLY_EXCLUDED_SUBPATHS.has(subpath) || BUILD_TOOL_SUBPATH.test(subpath)) {
|
|
633
|
+
return [];
|
|
634
|
+
}
|
|
635
|
+
return [
|
|
636
|
+
`${packageName}/${subpath}`
|
|
637
|
+
];
|
|
638
|
+
});
|
|
639
|
+
return modules.length > 0 ? modules : [
|
|
640
|
+
packageName
|
|
641
|
+
];
|
|
642
|
+
};
|
|
643
|
+
var getCjsNamedExports = (filePath, seen = /* @__PURE__ */ new Set()) => {
|
|
644
|
+
const normalized = trimQueryString(filePath);
|
|
645
|
+
if (seen.has(normalized)) {
|
|
646
|
+
return [];
|
|
647
|
+
}
|
|
648
|
+
seen.add(normalized);
|
|
649
|
+
try {
|
|
650
|
+
const source = readFileSync(normalized, "utf8");
|
|
651
|
+
const { exports: directExports, reexports } = parseCjs(source);
|
|
652
|
+
const reexportedNames = reexports.flatMap((reexport) => {
|
|
653
|
+
const resolved = path.resolve(path.dirname(normalized), reexport);
|
|
654
|
+
const candidates = [
|
|
655
|
+
resolved,
|
|
656
|
+
`${resolved}.js`,
|
|
657
|
+
`${resolved}.cjs`
|
|
658
|
+
];
|
|
659
|
+
const found = candidates.find((candidate) => existsSync(candidate));
|
|
660
|
+
return found ? getCjsNamedExports(found, seen) : [];
|
|
661
|
+
});
|
|
662
|
+
return [
|
|
663
|
+
.../* @__PURE__ */ new Set([
|
|
664
|
+
...directExports,
|
|
665
|
+
...reexportedNames
|
|
666
|
+
])
|
|
667
|
+
].filter((name) => name !== "default" && name !== "__esModule");
|
|
668
|
+
} catch {
|
|
669
|
+
return [];
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
var importMapPlugin = (options) => {
|
|
673
|
+
const packages = options?.packages ?? DEFAULT_PACKAGES;
|
|
674
|
+
const WRAPPER_PREFIX = "\0import-map:";
|
|
675
|
+
const chunkRefIds = {};
|
|
676
|
+
const resolvedIds = {};
|
|
677
|
+
let imports = {};
|
|
678
|
+
let modules = [];
|
|
679
|
+
let importMapIsDev = false;
|
|
680
|
+
let base = "/";
|
|
681
|
+
return [
|
|
682
|
+
// Phase 1: Resolve all package entrypoints and emit chunks.
|
|
683
|
+
//
|
|
684
|
+
// Build-only. The dev-mode path (recording absolute `/@fs/` paths in
|
|
685
|
+
// `imports[]`) is non-functional today and was actively harmful: calling
|
|
686
|
+
// `this.resolve()` for every shared package's subpath entrypoints during
|
|
687
|
+
// `buildStart` races with Vite's optimize-deps static scan, producing
|
|
688
|
+
// non-deterministic chunk content (~34 drifting chunks per warm-start) and
|
|
689
|
+
// triggering Vite 8.0.10's `runOptimizer` / `commitProcessing` crashes
|
|
690
|
+
// (`fileHash` / `browserHash` undefined on partial-discovery batches) when
|
|
691
|
+
// the resolved set doesn't match the optimizer's metadata. The importmap
|
|
692
|
+
// is only meaningful for production builds where remote plugins consume
|
|
693
|
+
// the emitted wrapper chunks.
|
|
694
|
+
{
|
|
695
|
+
name: "import-map:get-chunk-ref-ids",
|
|
696
|
+
apply: "build",
|
|
697
|
+
configResolved(config) {
|
|
698
|
+
base = config.base ?? "/";
|
|
699
|
+
},
|
|
700
|
+
async buildStart() {
|
|
701
|
+
importMapIsDev = this.environment.mode === "dev";
|
|
702
|
+
await initCjsLexer();
|
|
703
|
+
modules = [
|
|
704
|
+
...new Set((await Promise.all(packages.map(async (packageName) => {
|
|
705
|
+
const packageJsonPath = await resolvePackageJsonPathViaContext(this, packageName);
|
|
706
|
+
if (!packageJsonPath) {
|
|
707
|
+
this.warn(`Unable to locate package.json for import map package: ${packageName}`);
|
|
708
|
+
return [
|
|
709
|
+
packageName
|
|
710
|
+
];
|
|
711
|
+
}
|
|
712
|
+
return getPackageEntrypoints(packageName, packageJsonPath);
|
|
713
|
+
}))).flat())
|
|
714
|
+
];
|
|
715
|
+
for (const specifier of modules) {
|
|
716
|
+
if (isAssetSubpath(specifier)) {
|
|
717
|
+
imports[specifier] = "data:text/javascript;charset=utf-8,export%20%7B%7D%3B";
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
const resolved = await this.resolve(specifier);
|
|
721
|
+
if (!resolved) {
|
|
722
|
+
this.warn(`Import map: unable to resolve "${specifier}"; omitting from import map.`);
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
if (importMapIsDev) {
|
|
726
|
+
const filePath = trimQueryString(resolved.id);
|
|
727
|
+
imports[specifier] = filePath.startsWith("/") ? `/@fs${filePath}` : filePath;
|
|
728
|
+
} else {
|
|
729
|
+
resolvedIds[specifier] = resolved.id;
|
|
730
|
+
chunkRefIds[specifier] = this.emitFile({
|
|
731
|
+
type: "chunk",
|
|
732
|
+
id: `${WRAPPER_PREFIX}${specifier}`,
|
|
733
|
+
preserveSignature: "strict"
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
// Intercept virtual wrapper IDs so Rollup doesn't try to resolve them as files.
|
|
739
|
+
resolveId(id) {
|
|
740
|
+
if (id.startsWith(WRAPPER_PREFIX)) {
|
|
741
|
+
return id;
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
// Generate the source for each virtual wrapper module.
|
|
745
|
+
// For CJS packages, explicitly re-export named exports (discovered via static analysis)
|
|
746
|
+
// because Rollup's `export *` interop doesn't preserve them for CJS.
|
|
747
|
+
//
|
|
748
|
+
// Each wrapper also emits a local `__keepalive` export. Without this, Rolldown
|
|
749
|
+
// (Vite 8) tree-shakes wrappers whose `export *` re-exports happen to coincide
|
|
750
|
+
// with another already-emitted chunk's exports — typical for umbrella packages
|
|
751
|
+
// (e.g. `@dxos/compute` re-exports from `@dxos/operation`, so the operation
|
|
752
|
+
// wrapper looks "redundant" to Rolldown and gets merged away). A local const
|
|
753
|
+
// export has no upstream source for Rolldown to dedupe against, so the chunk
|
|
754
|
+
// is always preserved and the import-map entry resolves at runtime.
|
|
755
|
+
load(id) {
|
|
756
|
+
if (!id.startsWith(WRAPPER_PREFIX)) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
const specifier = id.slice(WRAPPER_PREFIX.length);
|
|
760
|
+
const keepalive = `export const __dxosImportMapKeepalive = ${JSON.stringify(specifier)};`;
|
|
761
|
+
const resolvedId = resolvedIds[specifier];
|
|
762
|
+
if (!resolvedId) {
|
|
763
|
+
return `export * from ${JSON.stringify(specifier)};
|
|
764
|
+
${keepalive}
|
|
765
|
+
`;
|
|
766
|
+
}
|
|
767
|
+
const filePath = trimQueryString(resolvedId);
|
|
768
|
+
const isCjs = filePath.endsWith(".cjs") || !filePath.endsWith(".mjs") && !resolvedIdIsEsmModule(filePath);
|
|
769
|
+
if (isCjs) {
|
|
770
|
+
const named = getCjsNamedExports(filePath);
|
|
771
|
+
if (named.length > 0) {
|
|
772
|
+
return `export { default, ${named.join(", ")} } from ${JSON.stringify(specifier)};
|
|
773
|
+
${keepalive}
|
|
774
|
+
`;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return `export * from ${JSON.stringify(specifier)};
|
|
778
|
+
${keepalive}
|
|
779
|
+
`;
|
|
780
|
+
},
|
|
781
|
+
// After bundling, map each specifier to the URL of its emitted chunk. Preserves
|
|
782
|
+
// asset-subpath entries already written to `imports` during `buildStart` (those
|
|
783
|
+
// use an inline data URL rather than an emitted chunk).
|
|
784
|
+
generateBundle() {
|
|
785
|
+
if (importMapIsDev) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
imports = {
|
|
789
|
+
...imports,
|
|
790
|
+
...Object.fromEntries(modules.filter((specifier) => chunkRefIds[specifier] !== void 0).map((specifier) => [
|
|
791
|
+
specifier,
|
|
792
|
+
`${base}${this.getFileName(chunkRefIds[specifier])}`
|
|
793
|
+
]))
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
// Phase 2: Inject the import map into the HTML as a <script type="importmap"> tag.
|
|
798
|
+
{
|
|
799
|
+
name: "import-map:transform-index-html",
|
|
800
|
+
apply: "build",
|
|
801
|
+
enforce: "post",
|
|
802
|
+
transformIndexHtml(html) {
|
|
803
|
+
const tags = [
|
|
804
|
+
{
|
|
805
|
+
tag: "script",
|
|
806
|
+
attrs: {
|
|
807
|
+
type: "importmap"
|
|
808
|
+
},
|
|
809
|
+
children: JSON.stringify({
|
|
810
|
+
imports
|
|
811
|
+
}, null, 2)
|
|
812
|
+
}
|
|
813
|
+
];
|
|
814
|
+
return {
|
|
815
|
+
html,
|
|
816
|
+
tags
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
];
|
|
821
|
+
};
|
|
822
|
+
export {
|
|
823
|
+
DEFAULT_PACKAGES,
|
|
824
|
+
ENTRY_FILENAME,
|
|
825
|
+
MANIFEST_ASSET_NAME,
|
|
826
|
+
bootLoaderPlugin,
|
|
827
|
+
composerPlugin,
|
|
828
|
+
importMapPlugin,
|
|
829
|
+
isSharedPackage,
|
|
830
|
+
serializeManifest
|
|
831
|
+
};
|
|
832
|
+
//# sourceMappingURL=index.mjs.map
|