@dsh-plugin/dsh-loader 1.3.1 → 1.3.2-dev.33147555949

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/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const LOADER_VERSION = "1.3.1";
1
+ export declare const LOADER_VERSION = "1.3.2";
2
2
  export declare const LOG_PREFIX = "[dshloader]";
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // dshloader version — keep in sync with package.json.
2
- export const LOADER_VERSION = '1.3.1';
2
+ export const LOADER_VERSION = '1.3.2';
3
3
  // Prefix used in every console log / error so users can grep dshloader output.
4
4
  export const LOG_PREFIX = '[dshloader]';
5
5
  //# sourceMappingURL=version.js.map
package/lib/client.js CHANGED
@@ -32,7 +32,7 @@ window.__ModuleLoader__.load({
32
32
  let react_dom_client = require("react-dom/client");
33
33
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
34
34
  //#region src/version.ts
35
- const LOADER_VERSION = "1.3.1";
35
+ const LOADER_VERSION = "1.3.2";
36
36
  const LOG_PREFIX = "[dshloader]";
37
37
  //#endregion
38
38
  //#region src/adapters/dsh-1-x.ts
@@ -58,6 +58,32 @@ window.__ModuleLoader__.load({
58
58
  //#endregion
59
59
  //#region src/client.ts
60
60
  /**
61
+ * Compatibility shim: mount `window.__DSH_MODULES__` for plugins that read the
62
+ * client module system off the global.
63
+ *
64
+ * dsh ≤ 0.1.0-rc.7 set `globalThis.__DSH_MODULES__ = <ClientModuleSystem>`
65
+ * during web boot; 0.1.0-rc.8+ stopped exposing it globally and instead hands
66
+ * the same instance to the cordis client loader as `ctx.loader.internal`.
67
+ * Plugins built against the old global (e.g. dsh-better-sidebar's lazy chunks)
68
+ * break with "client module system unavailable" on the new versions. dshloader
69
+ * bridges the gap so those plugins need no change across every dsh version:
70
+ * when the global is missing but the cordis loader carries the module system,
71
+ * mirror it back onto the global.
72
+ *
73
+ * Returns true when the global is present after this call (either it already
74
+ * was, or we just mirrored it).
75
+ */
76
+ function ensureDshModulesGlobal(win, ctx) {
77
+ const scope = globalThis;
78
+ if (scope.__DSH_MODULES__ !== void 0) return true;
79
+ const internal = ctx?.loader?.internal;
80
+ if (internal !== void 0 && typeof internal.import === "function") {
81
+ scope.__DSH_MODULES__ = internal;
82
+ return true;
83
+ }
84
+ return false;
85
+ }
86
+ /**
61
87
  * The ambient browser `window`, when this module runs in a browser-like realm.
62
88
  * Read off `globalThis` so no DOM lib and no global declaration is required.
63
89
  */
@@ -2983,14 +3009,18 @@ window.__ModuleLoader__.load({
2983
3009
  /**
2984
3010
  * cordis client-plugin entry.
2985
3011
  *
2986
- * Mounts the infrastructure first (so the `__ModuleLoader__` wrapper is in place
2987
- * before any sibling bundle materialises), then the UI facade, then publishes it
2988
- * both as the `dshLoaderUi` cordis service (ordered access) and on
2989
- * `window.__dshLoader__.ui` (ad-hoc access from non-cordis code).
3012
+ * Mirrors the client module system back onto `window.__DSH_MODULES__` first
3013
+ * (legacy plugins' lazy chunks read the global; dsh 0.1.0-rc.8+ stopped
3014
+ * installing it), then mounts the infrastructure (so the `__ModuleLoader__`
3015
+ * wrapper is in place before any sibling bundle materialises), then the UI
3016
+ * facade, then publishes it both as the `dshLoaderUi` cordis service
3017
+ * (ordered access) and on `window.__dshLoader__.ui` (ad-hoc access from
3018
+ * non-cordis code).
2990
3019
  */
2991
3020
  function apply(ctx) {
2992
3021
  const win = ambientWindow();
2993
3022
  if (win === void 0) return;
3023
+ ensureDshModulesGlobal(win, ctx);
2994
3024
  const api = installClient({
2995
3025
  window: win,
2996
3026
  clientCtx: ctx
@@ -3037,6 +3067,7 @@ window.__ModuleLoader__.load({
3037
3067
  exports.createUi = createUi;
3038
3068
  exports.createUiAPI = createUiAPI;
3039
3069
  exports.cx = cx;
3070
+ exports.ensureDshModulesGlobal = ensureDshModulesGlobal;
3040
3071
  exports.ensureStyles = ensureStyles;
3041
3072
  exports.getUi = getUi;
3042
3073
  exports.icon = icon;