@module-federation/runtime 0.0.12 → 0.0.13
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/index.cjs.js +24 -12
- package/dist/index.esm.js +25 -13
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +1 -1
- package/dist/share.esm.js +1 -1
- package/dist/src/core.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -561,27 +561,38 @@ function preloadAssets(remoteInfo, host, assets) {
|
|
|
561
561
|
});
|
|
562
562
|
const fragment = document.createDocumentFragment();
|
|
563
563
|
cssAssets.forEach((cssUrl)=>{
|
|
564
|
-
const cssEl =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
564
|
+
const { link: cssEl, needAttach } = sdk.createLink(cssUrl, ()=>{}, {
|
|
565
|
+
rel: 'preload',
|
|
566
|
+
as: 'style'
|
|
567
|
+
}, (url)=>{
|
|
568
|
+
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
569
|
+
url
|
|
570
|
+
});
|
|
571
|
+
if (res instanceof HTMLLinkElement) {
|
|
572
|
+
return res;
|
|
573
|
+
}
|
|
574
|
+
return;
|
|
575
|
+
});
|
|
576
|
+
needAttach && fragment.appendChild(cssEl);
|
|
569
577
|
});
|
|
570
|
-
document.head.appendChild(fragment);
|
|
571
578
|
jsAssetsWithoutEntry.forEach((jsUrl)=>{
|
|
572
|
-
const {
|
|
579
|
+
const { link: linkEl, needAttach } = sdk.createLink(jsUrl, ()=>{
|
|
573
580
|
// noop
|
|
574
|
-
}, {
|
|
575
|
-
|
|
581
|
+
}, {
|
|
582
|
+
rel: 'preload',
|
|
583
|
+
as: 'script'
|
|
584
|
+
}, (url)=>{
|
|
585
|
+
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
576
586
|
url
|
|
577
587
|
});
|
|
578
|
-
if (res instanceof
|
|
588
|
+
if (res instanceof HTMLLinkElement) {
|
|
579
589
|
return res;
|
|
580
590
|
}
|
|
581
591
|
return;
|
|
582
592
|
});
|
|
583
|
-
document.head.appendChild(
|
|
593
|
+
needAttach && document.head.appendChild(linkEl);
|
|
584
594
|
});
|
|
595
|
+
document.head.appendChild(fragment);
|
|
585
596
|
}
|
|
586
597
|
}
|
|
587
598
|
|
|
@@ -1579,12 +1590,13 @@ class FederationHost {
|
|
|
1579
1590
|
// not used yet
|
|
1580
1591
|
afterPreloadRemote: new AsyncHook()
|
|
1581
1592
|
});
|
|
1582
|
-
this.version = "0.0.
|
|
1593
|
+
this.version = "0.0.13";
|
|
1583
1594
|
this.moduleCache = new Map();
|
|
1584
1595
|
this.loaderHook = new PluginSystem({
|
|
1585
1596
|
// FIXME: may not be suitable , not open to the public yet
|
|
1586
1597
|
getModuleInfo: new SyncHook(),
|
|
1587
1598
|
createScript: new SyncHook(),
|
|
1599
|
+
createLink: new SyncHook(),
|
|
1588
1600
|
// only work for manifest , so not open to the public yet
|
|
1589
1601
|
fetch: new AsyncHook('fetch')
|
|
1590
1602
|
});
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, c as getRemoteEntryExports, d as assert, s as safeToString, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRegisteredShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as addGlobalSnapshot, r as setGlobalSnapshotInfoByModuleInfo, t as getGlobalSnapshot, G as Global, u as getGlobalShareScope, v as formatShareConfigs, x as isBrowserEnv, y as getBuilderId, z as addUniqueItem, A as setGlobalFederationConstructor, B as getGlobalFederationInstance, C as getGlobalFederationConstructor, E as setGlobalFederationInstance } from './share.esm.js';
|
|
2
2
|
export { F as registerGlobalPlugins } from './share.esm.js';
|
|
3
|
-
import { composeKeyWithSeparator, loadScriptNode, loadScript,
|
|
3
|
+
import { composeKeyWithSeparator, loadScriptNode, loadScript, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest } from '@module-federation/sdk';
|
|
4
4
|
export { loadScript } from '@module-federation/sdk';
|
|
5
5
|
|
|
6
6
|
// Function to match a remote with its name and expose
|
|
@@ -559,27 +559,38 @@ function preloadAssets(remoteInfo, host, assets) {
|
|
|
559
559
|
});
|
|
560
560
|
const fragment = document.createDocumentFragment();
|
|
561
561
|
cssAssets.forEach((cssUrl)=>{
|
|
562
|
-
const cssEl =
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
562
|
+
const { link: cssEl, needAttach } = createLink(cssUrl, ()=>{}, {
|
|
563
|
+
rel: 'preload',
|
|
564
|
+
as: 'style'
|
|
565
|
+
}, (url)=>{
|
|
566
|
+
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
567
|
+
url
|
|
568
|
+
});
|
|
569
|
+
if (res instanceof HTMLLinkElement) {
|
|
570
|
+
return res;
|
|
571
|
+
}
|
|
572
|
+
return;
|
|
573
|
+
});
|
|
574
|
+
needAttach && fragment.appendChild(cssEl);
|
|
567
575
|
});
|
|
568
|
-
document.head.appendChild(fragment);
|
|
569
576
|
jsAssetsWithoutEntry.forEach((jsUrl)=>{
|
|
570
|
-
const {
|
|
577
|
+
const { link: linkEl, needAttach } = createLink(jsUrl, ()=>{
|
|
571
578
|
// noop
|
|
572
|
-
}, {
|
|
573
|
-
|
|
579
|
+
}, {
|
|
580
|
+
rel: 'preload',
|
|
581
|
+
as: 'script'
|
|
582
|
+
}, (url)=>{
|
|
583
|
+
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
574
584
|
url
|
|
575
585
|
});
|
|
576
|
-
if (res instanceof
|
|
586
|
+
if (res instanceof HTMLLinkElement) {
|
|
577
587
|
return res;
|
|
578
588
|
}
|
|
579
589
|
return;
|
|
580
590
|
});
|
|
581
|
-
document.head.appendChild(
|
|
591
|
+
needAttach && document.head.appendChild(linkEl);
|
|
582
592
|
});
|
|
593
|
+
document.head.appendChild(fragment);
|
|
583
594
|
}
|
|
584
595
|
}
|
|
585
596
|
|
|
@@ -1577,12 +1588,13 @@ class FederationHost {
|
|
|
1577
1588
|
// not used yet
|
|
1578
1589
|
afterPreloadRemote: new AsyncHook()
|
|
1579
1590
|
});
|
|
1580
|
-
this.version = "0.0.
|
|
1591
|
+
this.version = "0.0.13";
|
|
1581
1592
|
this.moduleCache = new Map();
|
|
1582
1593
|
this.loaderHook = new PluginSystem({
|
|
1583
1594
|
// FIXME: may not be suitable , not open to the public yet
|
|
1584
1595
|
getModuleInfo: new SyncHook(),
|
|
1585
1596
|
createScript: new SyncHook(),
|
|
1597
|
+
createLink: new SyncHook(),
|
|
1586
1598
|
// only work for manifest , so not open to the public yet
|
|
1587
1599
|
fetch: new AsyncHook('fetch')
|
|
1588
1600
|
});
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -176,7 +176,7 @@ function getGlobalFederationConstructor() {
|
|
|
176
176
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
177
177
|
if (isDebug) {
|
|
178
178
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
179
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.
|
|
179
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.13";
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
package/dist/share.esm.js
CHANGED
|
@@ -174,7 +174,7 @@ function getGlobalFederationConstructor() {
|
|
|
174
174
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
175
175
|
if (isDebug) {
|
|
176
176
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
177
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.
|
|
177
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.13";
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
package/dist/src/core.d.ts
CHANGED
|
@@ -126,6 +126,9 @@ export declare class FederationHost {
|
|
|
126
126
|
createScript: SyncHook<[{
|
|
127
127
|
url: string;
|
|
128
128
|
}], void | HTMLScriptElement>;
|
|
129
|
+
createLink: SyncHook<[{
|
|
130
|
+
url: string;
|
|
131
|
+
}], void | HTMLLinkElement>;
|
|
129
132
|
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
130
133
|
}>;
|
|
131
134
|
constructor(userOptions: UserOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@module-federation/sdk": "0.0.
|
|
48
|
+
"@module-federation/sdk": "0.0.13"
|
|
49
49
|
}
|
|
50
50
|
}
|