@edynamix/mf-isolation 0.0.13 → 0.0.14

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.
@@ -5,4 +5,14 @@
5
5
  * importing an Angular bootstrap module.
6
6
  */
7
7
  export declare const assertHostZoneRuntime: () => void;
8
+ type TAngularLifecycleResult = void | Promise<void>;
9
+ export interface IAngularLifecycleImplementation<TShellContext> {
10
+ mount: (host: HTMLElement, shellContext: TShellContext) => TAngularLifecycleResult;
11
+ unmount: (host: HTMLElement) => TAngularLifecycleResult;
12
+ }
13
+ export interface IHostedAngularLifecycle<TShellContext> extends IAngularLifecycleImplementation<TShellContext> {
14
+ preload: () => Promise<void>;
15
+ }
16
+ export declare const createHostedAngularLifecycle: <TShellContext>(importImplementation: () => Promise<IAngularLifecycleImplementation<TShellContext>>) => IHostedAngularLifecycle<TShellContext>;
17
+ export {};
8
18
  //# sourceMappingURL=angular-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"angular-runtime.d.ts","sourceRoot":"","sources":["../src/angular-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,IAMxC,CAAC","sourcesContent":["/**\n * Verifies the host-owned Zone.js runtime before Angular is loaded.\n *\n * This check is intentionally framework-free and must run before dynamically\n * importing an Angular bootstrap module.\n */\nexport const assertHostZoneRuntime = (): void => {\n const zoneRuntime = (globalThis as typeof globalThis & { Zone?: unknown }).Zone;\n\n if (typeof zoneRuntime !== 'function') {\n throw new Error('Host Zone.js runtime is missing. Expected globalThis.Zone to be a function before loading Angular.');\n }\n};\n"]}
1
+ {"version":3,"file":"angular-runtime.d.ts","sourceRoot":"","sources":["../src/angular-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,IAMxC,CAAC;AAEF,KAAK,uBAAuB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpD,MAAM,WAAW,+BAA+B,CAAC,aAAa;IAC5D,KAAK,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,KAAK,uBAAuB,CAAC;IACnF,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,uBAAuB,CAAC;CACzD;AAED,MAAM,WAAW,uBAAuB,CAAC,aAAa,CAAE,SAAQ,+BAA+B,CAAC,aAAa,CAAC;IAC5G,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,4BAA4B,GAAI,aAAa,EACxD,sBAAsB,MAAM,OAAO,CAAC,+BAA+B,CAAC,aAAa,CAAC,CAAC,KAClF,uBAAuB,CAAC,aAAa,CAiCvC,CAAC","sourcesContent":["/**\n * Verifies the host-owned Zone.js runtime before Angular is loaded.\n *\n * This check is intentionally framework-free and must run before dynamically\n * importing an Angular bootstrap module.\n */\nexport const assertHostZoneRuntime = (): void => {\n const zoneRuntime = (globalThis as typeof globalThis & { Zone?: unknown }).Zone;\n\n if (typeof zoneRuntime !== 'function') {\n throw new Error('Host Zone.js runtime is missing. Expected globalThis.Zone to be a function before loading Angular.');\n }\n};\n\ntype TAngularLifecycleResult = void | Promise<void>;\n\nexport interface IAngularLifecycleImplementation<TShellContext> {\n mount: (host: HTMLElement, shellContext: TShellContext) => TAngularLifecycleResult;\n unmount: (host: HTMLElement) => TAngularLifecycleResult;\n}\n\nexport interface IHostedAngularLifecycle<TShellContext> extends IAngularLifecycleImplementation<TShellContext> {\n preload: () => Promise<void>;\n}\n\nexport const createHostedAngularLifecycle = <TShellContext>(\n importImplementation: () => Promise<IAngularLifecycleImplementation<TShellContext>>,\n): IHostedAngularLifecycle<TShellContext> => {\n let implementation: Promise<IAngularLifecycleImplementation<TShellContext>> | undefined;\n\n const loadImplementation = (): Promise<IAngularLifecycleImplementation<TShellContext>> => {\n if (!implementation) {\n assertHostZoneRuntime();\n const pending = importImplementation();\n const cached = pending.catch((error: unknown) => {\n if (implementation === cached) {\n implementation = undefined;\n }\n throw error;\n });\n implementation = cached;\n }\n\n return implementation;\n };\n\n return {\n preload: async () => {\n await loadImplementation();\n },\n mount: async (host, shellContext) => {\n await (await loadImplementation()).mount(host, shellContext);\n },\n unmount: async (host) => {\n if (!implementation) {\n return;\n }\n await (await implementation).unmount(host);\n },\n };\n};\n"]}
@@ -10,4 +10,35 @@ export const assertHostZoneRuntime = () => {
10
10
  throw new Error('Host Zone.js runtime is missing. Expected globalThis.Zone to be a function before loading Angular.');
11
11
  }
12
12
  };
13
+ export const createHostedAngularLifecycle = (importImplementation) => {
14
+ let implementation;
15
+ const loadImplementation = () => {
16
+ if (!implementation) {
17
+ assertHostZoneRuntime();
18
+ const pending = importImplementation();
19
+ const cached = pending.catch((error) => {
20
+ if (implementation === cached) {
21
+ implementation = undefined;
22
+ }
23
+ throw error;
24
+ });
25
+ implementation = cached;
26
+ }
27
+ return implementation;
28
+ };
29
+ return {
30
+ preload: async () => {
31
+ await loadImplementation();
32
+ },
33
+ mount: async (host, shellContext) => {
34
+ await (await loadImplementation()).mount(host, shellContext);
35
+ },
36
+ unmount: async (host) => {
37
+ if (!implementation) {
38
+ return;
39
+ }
40
+ await (await implementation).unmount(host);
41
+ },
42
+ };
43
+ };
13
44
  //# sourceMappingURL=angular-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"angular-runtime.js","sourceRoot":"","sources":["../src/angular-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAS,EAAE;IAC9C,MAAM,WAAW,GAAI,UAAqD,CAAC,IAAI,CAAC;IAEhF,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,oGAAoG,CAAC,CAAC;IACxH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * Verifies the host-owned Zone.js runtime before Angular is loaded.\n *\n * This check is intentionally framework-free and must run before dynamically\n * importing an Angular bootstrap module.\n */\nexport const assertHostZoneRuntime = (): void => {\n const zoneRuntime = (globalThis as typeof globalThis & { Zone?: unknown }).Zone;\n\n if (typeof zoneRuntime !== 'function') {\n throw new Error('Host Zone.js runtime is missing. Expected globalThis.Zone to be a function before loading Angular.');\n }\n};\n"]}
1
+ {"version":3,"file":"angular-runtime.js","sourceRoot":"","sources":["../src/angular-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAS,EAAE;IAC9C,MAAM,WAAW,GAAI,UAAqD,CAAC,IAAI,CAAC;IAEhF,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,oGAAoG,CAAC,CAAC;IACxH,CAAC;AACH,CAAC,CAAC;AAaF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,oBAAmF,EAC3C,EAAE;IAC1C,IAAI,cAAmF,CAAC;IAExF,MAAM,kBAAkB,GAAG,GAA4D,EAAE;QACvF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,qBAAqB,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC9C,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;oBAC9B,cAAc,GAAG,SAAS,CAAC;gBAC7B,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC,CAAC,CAAC;YACH,cAAc,GAAG,MAAM,CAAC;QAC1B,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,kBAAkB,EAAE,CAAC;QAC7B,CAAC;QACD,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;YAClC,MAAM,CAAC,MAAM,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,OAAO;YACT,CAAC;YACD,MAAM,CAAC,MAAM,cAAc,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * Verifies the host-owned Zone.js runtime before Angular is loaded.\n *\n * This check is intentionally framework-free and must run before dynamically\n * importing an Angular bootstrap module.\n */\nexport const assertHostZoneRuntime = (): void => {\n const zoneRuntime = (globalThis as typeof globalThis & { Zone?: unknown }).Zone;\n\n if (typeof zoneRuntime !== 'function') {\n throw new Error('Host Zone.js runtime is missing. Expected globalThis.Zone to be a function before loading Angular.');\n }\n};\n\ntype TAngularLifecycleResult = void | Promise<void>;\n\nexport interface IAngularLifecycleImplementation<TShellContext> {\n mount: (host: HTMLElement, shellContext: TShellContext) => TAngularLifecycleResult;\n unmount: (host: HTMLElement) => TAngularLifecycleResult;\n}\n\nexport interface IHostedAngularLifecycle<TShellContext> extends IAngularLifecycleImplementation<TShellContext> {\n preload: () => Promise<void>;\n}\n\nexport const createHostedAngularLifecycle = <TShellContext>(\n importImplementation: () => Promise<IAngularLifecycleImplementation<TShellContext>>,\n): IHostedAngularLifecycle<TShellContext> => {\n let implementation: Promise<IAngularLifecycleImplementation<TShellContext>> | undefined;\n\n const loadImplementation = (): Promise<IAngularLifecycleImplementation<TShellContext>> => {\n if (!implementation) {\n assertHostZoneRuntime();\n const pending = importImplementation();\n const cached = pending.catch((error: unknown) => {\n if (implementation === cached) {\n implementation = undefined;\n }\n throw error;\n });\n implementation = cached;\n }\n\n return implementation;\n };\n\n return {\n preload: async () => {\n await loadImplementation();\n },\n mount: async (host, shellContext) => {\n await (await loadImplementation()).mount(host, shellContext);\n },\n unmount: async (host) => {\n if (!implementation) {\n return;\n }\n await (await implementation).unmount(host);\n },\n };\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edynamix/mf-isolation",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "CSS and overlay isolation helpers for eDynamix microfrontends.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",