@uxland/primary-shell 7.45.17 → 7.46.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "7.45.17",
3
+ "version": "7.46.0",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -22,20 +22,41 @@ interface PrimariaBootstrappedPlugin extends BootstrappedPlugin<PrimariaApi> {
22
22
  importedPlugin: PrimariaPlugin;
23
23
  }
24
24
 
25
- const internalPlugins: PluginDefinition[] = [
26
- {
27
- pluginId: "activity-history",
28
- importer: () =>
29
- Promise.resolve({
30
- initialize: activityHistoryInitialize,
31
- dispose: activityHistoryDispose,
32
- }),
33
- },
34
- ];
25
+ const CORE_FIRST_ID = "activity-history";
26
+
27
+ // activity-history must finish initializing before any other plugin: it
28
+ // registers the broker requests the rest depend on. In production it is loaded
29
+ // from the plugin store (versioned/uploadable) like any other plugin; this
30
+ // bundled copy is the fallback used when the caller does not provide it — e.g.
31
+ // third-party sandboxes that install primary-shell without a plugin store.
32
+ const bundledActivityHistory: PluginDefinition = {
33
+ pluginId: CORE_FIRST_ID,
34
+ importer: () =>
35
+ Promise.resolve({
36
+ initialize: activityHistoryInitialize,
37
+ dispose: activityHistoryDispose,
38
+ }),
39
+ };
35
40
 
36
41
  export const bootstrapPlugins = async (plugins: PluginDefinition[], startup?: PrimariaStartupPlugin) => {
37
- const finalPlugins = internalPlugins.concat(plugins || []);
38
- bootstrappedPlugins = (await pluginBootstrapper(finalPlugins, primariaApiFactory)) as BootstrappedPlugin<PrimariaApi>[];
42
+ const incoming = plugins ?? [];
43
+ const provided = incoming.filter((plugin) => plugin.pluginId === CORE_FIRST_ID);
44
+ const rest = incoming.filter((plugin) => plugin.pluginId !== CORE_FIRST_ID);
45
+
46
+ // Prefer the store/sandbox-provided activity-history; fall back to the bundled
47
+ // copy. Either way it is bootstrapped — and fully initialized — before the
48
+ // rest, which run in parallel as before.
49
+ const corePlugins = provided.length ? provided : [bundledActivityHistory];
50
+
51
+ const coreBootstrapped = (await pluginBootstrapper(
52
+ corePlugins,
53
+ primariaApiFactory,
54
+ )) as BootstrappedPlugin<PrimariaApi>[];
55
+ const restBootstrapped = rest.length
56
+ ? ((await pluginBootstrapper(rest, primariaApiFactory)) as BootstrappedPlugin<PrimariaApi>[])
57
+ : [];
58
+
59
+ bootstrappedPlugins = [...coreBootstrapped, ...restBootstrapped];
39
60
  handleStartupPlugin(bootstrappedPlugins as PrimariaBootstrappedPlugin[], startup);
40
61
  };
41
62