@elliemae/pui-app-bridge 2.28.2 → 2.28.4

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 (29) hide show
  1. package/dist/cjs/loaders/script.js +60 -34
  2. package/dist/cjs/utils/script-origin.js +45 -0
  3. package/dist/cjs/utils/webpack-public-path.js +49 -0
  4. package/dist/esm/loaders/script.js +60 -34
  5. package/dist/esm/utils/script-origin.js +25 -0
  6. package/dist/esm/utils/webpack-public-path.js +29 -0
  7. package/dist/public/e2e-host.html +1 -1
  8. package/dist/public/e2e-index.html +1 -1
  9. package/dist/public/frame.html +1 -1
  10. package/dist/public/index.html +1 -1
  11. package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js +17 -0
  12. package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js.br +0 -0
  13. package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js.gz +0 -0
  14. package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js.map +1 -0
  15. package/dist/types/lib/loaders/script.d.ts +7 -9
  16. package/dist/types/lib/tests/utils/script-origin.test.d.ts +1 -0
  17. package/dist/types/lib/tests/utils/webpack-public-path.test.d.ts +1 -0
  18. package/dist/types/lib/utils/script-origin.d.ts +22 -0
  19. package/dist/types/lib/utils/webpack-public-path.d.ts +17 -0
  20. package/dist/types/tsconfig.tsbuildinfo +1 -1
  21. package/dist/umd/index.js +6 -6
  22. package/dist/umd/index.js.br +0 -0
  23. package/dist/umd/index.js.gz +0 -0
  24. package/dist/umd/index.js.map +1 -1
  25. package/package.json +2 -2
  26. package/dist/public/js/emuiAppBridge.867faf89adac3f81299e.js +0 -17
  27. package/dist/public/js/emuiAppBridge.867faf89adac3f81299e.js.br +0 -0
  28. package/dist/public/js/emuiAppBridge.867faf89adac3f81299e.js.gz +0 -0
  29. package/dist/public/js/emuiAppBridge.867faf89adac3f81299e.js.map +0 -1
@@ -39,7 +39,7 @@ export declare class ScriptLoader {
39
39
  #private;
40
40
  constructor(logger: Logger);
41
41
  /**
42
- * Loads multiple script assets sequentially, with CDN scripts loaded before non-CDN scripts.
42
+ * Loads multiple script assets in manifest order, like HTML module script tags.
43
43
  * @param assets - Array of script URLs (either full HTTP/HTTPS URLs or relative paths)
44
44
  * @param options - Configuration options for loading the scripts
45
45
  * @param options.name - The name of the application (used for generating script IDs)
@@ -49,20 +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
- * - Partitions assets into CDN (HTTP/HTTPS) and non-CDN (relative) arrays in a single pass
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
- * - Appends all script elements to the DOM synchronously so the browser
55
- * can download them in parallel
56
- * - Execution order is preserved by the spec: type="module" scripts
57
- * execute in document order; dynamic async=false scripts execute in
58
- * insertion order
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
59
57
  * @example
60
58
  * ```typescript
61
59
  * const scriptIds = await scriptLoader.load(
62
- * ['https://cdn.example.com/lib.js', 'app.js', 'config.js'],
60
+ * ['https://cdn.example.com/lib.js', 'global.js', 'runtime~app.js'],
63
61
  * {
64
62
  * name: 'myApp',
65
- * hostUrl: 'https://example.com',
63
+ * hostUrl: 'https://example.com/my-app/',
66
64
  * documentEle: document,
67
65
  * isESMModule: true
68
66
  * }
@@ -0,0 +1 @@
1
+ export {};
@@ -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
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @param {Window | null | undefined} [targetWindow] - Guest document defaultView whose webpack runtime should be synced.
3
+ */
4
+ export declare const syncWebpackPublicPathFromAssetPath: (targetWindow?: Window | null) => void;
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;