@elliemae/pui-app-bridge 2.28.3 → 2.28.5

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.
Files changed (37) hide show
  1. package/dist/cjs/frame.js +69 -27
  2. package/dist/cjs/loaders/manifest.js +2 -5
  3. package/dist/cjs/loaders/script.js +40 -36
  4. package/dist/cjs/utils/script-origin.js +45 -0
  5. package/dist/cjs/utils/webpack-public-path.js +20 -3
  6. package/dist/cjs/utils.js +17 -1
  7. package/dist/esm/frame.js +69 -27
  8. package/dist/esm/loaders/manifest.js +3 -6
  9. package/dist/esm/loaders/script.js +41 -40
  10. package/dist/esm/utils/script-origin.js +25 -0
  11. package/dist/esm/utils/webpack-public-path.js +20 -3
  12. package/dist/esm/utils.js +17 -1
  13. package/dist/public/e2e-host.html +1 -1
  14. package/dist/public/e2e-index.html +1 -1
  15. package/dist/public/frame.html +1 -1
  16. package/dist/public/index.html +1 -1
  17. package/dist/public/js/emuiAppBridge.d73405c86e4c6f166cfe.js +17 -0
  18. package/dist/public/js/emuiAppBridge.d73405c86e4c6f166cfe.js.br +0 -0
  19. package/dist/public/js/emuiAppBridge.d73405c86e4c6f166cfe.js.gz +0 -0
  20. package/dist/public/js/emuiAppBridge.d73405c86e4c6f166cfe.js.map +1 -0
  21. package/dist/types/lib/frame.d.ts +5 -0
  22. package/dist/types/lib/loaders/script.d.ts +5 -5
  23. package/dist/types/lib/tests/utils/script-origin.test.d.ts +1 -0
  24. package/dist/types/lib/typings/host.d.ts +4 -4
  25. package/dist/types/lib/utils/script-origin.d.ts +22 -0
  26. package/dist/types/lib/utils/webpack-public-path.d.ts +13 -2
  27. package/dist/types/lib/utils.d.ts +2 -0
  28. package/dist/types/tsconfig.tsbuildinfo +1 -1
  29. package/dist/umd/index.js +7 -7
  30. package/dist/umd/index.js.br +0 -0
  31. package/dist/umd/index.js.gz +0 -0
  32. package/dist/umd/index.js.map +1 -1
  33. package/package.json +3 -3
  34. package/dist/public/js/emuiAppBridge.13be9368ba5f8a719808.js +0 -17
  35. package/dist/public/js/emuiAppBridge.13be9368ba5f8a719808.js.br +0 -0
  36. package/dist/public/js/emuiAppBridge.13be9368ba5f8a719808.js.gz +0 -0
  37. package/dist/public/js/emuiAppBridge.13be9368ba5f8a719808.js.map +0 -1
@@ -34,6 +34,11 @@ export type FrameOptions = {
34
34
  * @example "microphone 'self' https://example.com; geolocation 'none'"
35
35
  */
36
36
  permissionPolicy?: string;
37
+ /**
38
+ * Optional signal to abort iframe creation (e.g. when the host unmounts
39
+ * before the iframe finishes loading).
40
+ */
41
+ signal?: AbortSignal;
37
42
  };
38
43
  export declare const FRAME_APP_CONTAINER_ID_PREFIX = "pui-app-container-";
39
44
  export declare const Frame: {
@@ -49,18 +49,18 @@ export declare class ScriptLoader {
49
49
  * @returns A promise that resolves with an array of script element IDs when all scripts are loaded
50
50
  * @remarks
51
51
  * This method:
52
- * - Preserves manifest order (CDN and local scripts stay in their original sequence)
52
+ * - Stages external (CDN) scripts before local guest-host scripts
53
+ * - Preserves manifest order within each origin group
53
54
  * - Creates modulepreload links for all assets for performance optimization
54
- * - Inserts script tags synchronously in batches so the browser can fetch in parallel
55
- * - Relies on module script execution order (document order) within each batch
56
- * - Waits for global.js before inserting dependent bundles, then syncs webpack public path
55
+ * - Inserts script tags synchronously per stage so the browser can fetch in parallel
56
+ * - Syncs webpack public path from hostUrl (or guest _ASSET_PATH) before local scripts run
57
57
  * @example
58
58
  * ```typescript
59
59
  * const scriptIds = await scriptLoader.load(
60
60
  * ['https://cdn.example.com/lib.js', 'global.js', 'runtime~app.js'],
61
61
  * {
62
62
  * name: 'myApp',
63
- * hostUrl: 'https://example.com',
63
+ * hostUrl: 'https://example.com/my-app/',
64
64
  * documentEle: document,
65
65
  * isESMModule: true
66
66
  * }
@@ -0,0 +1 @@
1
+ export {};
@@ -57,8 +57,8 @@ export type OpenAppParams = {
57
57
  };
58
58
  /**
59
59
  * Interface to connect and communicate with parent host
60
- * @typeParam AppObjects - type of the scripting objects that the application supports
61
- * @typeParam AppEvents - type of the events that the application supports
60
+ * @template AppObjects type of the scripting objects that the application supports
61
+ * @template AppEvents type of the events that the application supports
62
62
  */
63
63
  export interface IMicroFEHost<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> {
64
64
  /**
@@ -78,13 +78,13 @@ export interface IMicroFEHost<AppObjects extends ScriptingObjects = Partial<Scri
78
78
  setAppWindowSize(appSize: AppWindowSize): void;
79
79
  /**
80
80
  * add listener to the scripting object event
81
- * @param {SubscribeParam<EventId, EventType>} params - parameters to add event listener
81
+ * @param params parameters to add event listener
82
82
  * @returns subscription id
83
83
  */
84
84
  subscribe: <EventId extends Extract<keyof AppEvents, string>>(params: SubscribeParam<EventId, AppEvents[EventId]>) => string;
85
85
  /**
86
86
  * removes listener from the scripting object event
87
- * @param {UnsubscribeParam<EventId>} params - parameters to remove event listener
87
+ * @param params parameters to remove event listener
88
88
  */
89
89
  unsubscribe: <EventId extends Extract<keyof AppEvents, string>>(params: UnsubscribeParam<EventId>) => void;
90
90
  }
@@ -0,0 +1,22 @@
1
+ export type ScriptRef = {
2
+ id: string;
3
+ href: string;
4
+ };
5
+ /**
6
+ * True when href is an absolute URL outside the guest app's hostUrl origin.
7
+ * @param {string} href - Resolved script URL.
8
+ * @param {string} hostUrl - Guest application base URL.
9
+ * @returns {boolean} Whether the script is hosted outside the guest app.
10
+ */
11
+ export declare const isExternalScriptHref: (href: string, hostUrl: string) => boolean;
12
+ /**
13
+ * Splits scripts into external (CDN) and local (guest host) groups while
14
+ * preserving manifest order within each group.
15
+ * @param {ScriptRef[]} scripts - Ordered script entries to partition.
16
+ * @param {string} hostUrl - Guest application base URL.
17
+ * @returns {{ external: ScriptRef[]; local: ScriptRef[] }} Partitioned script groups.
18
+ */
19
+ export declare const partitionScriptsByOrigin: (scripts: ScriptRef[], hostUrl: string) => {
20
+ external: ScriptRef[];
21
+ local: ScriptRef[];
22
+ };
@@ -2,5 +2,16 @@
2
2
  * @param {Window | null | undefined} [targetWindow] - Guest document defaultView whose webpack runtime should be synced.
3
3
  */
4
4
  export declare const syncWebpackPublicPathFromAssetPath: (targetWindow?: Window | null) => void;
5
- /** Matches guest global.js / global-prod.js URLs. */
6
- export declare const GLOBAL_SCRIPT_PATTERN: RegExp;
5
+ /**
6
+ * Derives webpack public path from the guest hostUrl when _ASSET_PATH is not yet available.
7
+ * @param {Window | null | undefined} [targetWindow] - Guest document defaultView.
8
+ * @param {string} [hostUrl] - Guest application base URL from load options.
9
+ */
10
+ export declare const syncWebpackPublicPathFromHost: (targetWindow?: Window | null, hostUrl?: string) => void;
11
+ /**
12
+ * Prefers guest _ASSET_PATH when present, otherwise falls back to hostUrl.
13
+ * @param {Window | null | undefined} [targetWindow] - Guest document defaultView.
14
+ * @param {string} [hostUrl] - Guest application base URL from load options.
15
+ * @returns {void}
16
+ */
17
+ export declare const syncWebpackPublicPath: (targetWindow?: Window | null, hostUrl?: string) => void;
@@ -2,5 +2,7 @@ export declare const removeDoubleSlash: (url: string) => string;
2
2
  export declare const getAbsoluteUrl: (url: string) => string;
3
3
  export declare const appendTrailingSlash: (url: string) => string;
4
4
  export declare const appendPath: (base: string, path: string) => string;
5
+ export declare const resolveManifestBaseUrl: (hostUrl: string, manifestPath: string) => string;
6
+ export declare const resolveManifestUrl: (hostUrl: string, manifestPath: string) => string;
5
7
  export declare const isJSDOM: () => boolean;
6
8
  export declare const escapeRegExp: (str: string) => string;