@module-federation/runtime 0.3.4 → 0.4.0
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 +32 -25
- package/dist/index.esm.js +32 -25
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +2 -2
- package/dist/share.esm.js +2 -2
- package/dist/src/core.d.ts +1 -0
- package/dist/src/type/config.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -642,18 +642,20 @@ useLinkPreload = true) {
|
|
|
642
642
|
}
|
|
643
643
|
});
|
|
644
644
|
if (useLinkPreload) {
|
|
645
|
+
const defaultAttrs = {
|
|
646
|
+
rel: 'preload',
|
|
647
|
+
as: 'style',
|
|
648
|
+
crossorigin: 'anonymous'
|
|
649
|
+
};
|
|
645
650
|
cssAssets.forEach((cssUrl)=>{
|
|
646
651
|
const { link: cssEl, needAttach } = sdk.createLink({
|
|
647
652
|
url: cssUrl,
|
|
648
653
|
cb: ()=>{},
|
|
649
|
-
attrs:
|
|
650
|
-
|
|
651
|
-
as: 'style',
|
|
652
|
-
crossorigin: 'anonymous'
|
|
653
|
-
},
|
|
654
|
-
createLinkHook: (url)=>{
|
|
654
|
+
attrs: defaultAttrs,
|
|
655
|
+
createLinkHook: (url, attrs)=>{
|
|
655
656
|
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
656
|
-
url
|
|
657
|
+
url,
|
|
658
|
+
attrs
|
|
657
659
|
});
|
|
658
660
|
if (res instanceof HTMLLinkElement) {
|
|
659
661
|
return res;
|
|
@@ -664,17 +666,19 @@ useLinkPreload = true) {
|
|
|
664
666
|
needAttach && document.head.appendChild(cssEl);
|
|
665
667
|
});
|
|
666
668
|
} else {
|
|
669
|
+
const defaultAttrs = {
|
|
670
|
+
rel: 'stylesheet',
|
|
671
|
+
type: 'text/css'
|
|
672
|
+
};
|
|
667
673
|
cssAssets.forEach((cssUrl)=>{
|
|
668
674
|
const { link: cssEl, needAttach } = sdk.createLink({
|
|
669
675
|
url: cssUrl,
|
|
670
676
|
cb: ()=>{},
|
|
671
|
-
attrs:
|
|
672
|
-
|
|
673
|
-
type: 'text/css'
|
|
674
|
-
},
|
|
675
|
-
createLinkHook: (url)=>{
|
|
677
|
+
attrs: defaultAttrs,
|
|
678
|
+
createLinkHook: (url, attrs)=>{
|
|
676
679
|
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
677
|
-
url
|
|
680
|
+
url,
|
|
681
|
+
attrs
|
|
678
682
|
});
|
|
679
683
|
if (res instanceof HTMLLinkElement) {
|
|
680
684
|
return res;
|
|
@@ -687,18 +691,20 @@ useLinkPreload = true) {
|
|
|
687
691
|
});
|
|
688
692
|
}
|
|
689
693
|
if (useLinkPreload) {
|
|
694
|
+
const defaultAttrs = {
|
|
695
|
+
rel: 'preload',
|
|
696
|
+
as: 'script',
|
|
697
|
+
crossorigin: 'anonymous'
|
|
698
|
+
};
|
|
690
699
|
jsAssetsWithoutEntry.forEach((jsUrl)=>{
|
|
691
700
|
const { link: linkEl, needAttach } = sdk.createLink({
|
|
692
701
|
url: jsUrl,
|
|
693
702
|
cb: ()=>{},
|
|
694
|
-
attrs:
|
|
695
|
-
|
|
696
|
-
as: 'script',
|
|
697
|
-
crossorigin: 'anonymous'
|
|
698
|
-
},
|
|
699
|
-
createLinkHook: (url)=>{
|
|
703
|
+
attrs: defaultAttrs,
|
|
704
|
+
createLinkHook: (url, attrs)=>{
|
|
700
705
|
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
701
|
-
url
|
|
706
|
+
url,
|
|
707
|
+
attrs
|
|
702
708
|
});
|
|
703
709
|
if (res instanceof HTMLLinkElement) {
|
|
704
710
|
return res;
|
|
@@ -709,14 +715,15 @@ useLinkPreload = true) {
|
|
|
709
715
|
needAttach && document.head.appendChild(linkEl);
|
|
710
716
|
});
|
|
711
717
|
} else {
|
|
718
|
+
const defaultAttrs = {
|
|
719
|
+
fetchpriority: 'high',
|
|
720
|
+
type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
|
|
721
|
+
};
|
|
712
722
|
jsAssetsWithoutEntry.forEach((jsUrl)=>{
|
|
713
723
|
const { script: scriptEl, needAttach } = sdk.createScript({
|
|
714
724
|
url: jsUrl,
|
|
715
725
|
cb: ()=>{},
|
|
716
|
-
attrs:
|
|
717
|
-
fetchpriority: 'high',
|
|
718
|
-
type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
|
|
719
|
-
},
|
|
726
|
+
attrs: defaultAttrs,
|
|
720
727
|
createScriptHook: (url, attrs)=>{
|
|
721
728
|
const res = host.loaderHook.lifecycle.createScript.emit({
|
|
722
729
|
url,
|
|
@@ -2066,7 +2073,7 @@ class FederationHost {
|
|
|
2066
2073
|
// maybe will change, temporarily for internal use only
|
|
2067
2074
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
2068
2075
|
});
|
|
2069
|
-
this.version = "0.
|
|
2076
|
+
this.version = "0.4.0";
|
|
2070
2077
|
this.moduleCache = new Map();
|
|
2071
2078
|
this.loaderHook = new PluginSystem({
|
|
2072
2079
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/index.esm.js
CHANGED
|
@@ -640,18 +640,20 @@ useLinkPreload = true) {
|
|
|
640
640
|
}
|
|
641
641
|
});
|
|
642
642
|
if (useLinkPreload) {
|
|
643
|
+
const defaultAttrs = {
|
|
644
|
+
rel: 'preload',
|
|
645
|
+
as: 'style',
|
|
646
|
+
crossorigin: 'anonymous'
|
|
647
|
+
};
|
|
643
648
|
cssAssets.forEach((cssUrl)=>{
|
|
644
649
|
const { link: cssEl, needAttach } = createLink({
|
|
645
650
|
url: cssUrl,
|
|
646
651
|
cb: ()=>{},
|
|
647
|
-
attrs:
|
|
648
|
-
|
|
649
|
-
as: 'style',
|
|
650
|
-
crossorigin: 'anonymous'
|
|
651
|
-
},
|
|
652
|
-
createLinkHook: (url)=>{
|
|
652
|
+
attrs: defaultAttrs,
|
|
653
|
+
createLinkHook: (url, attrs)=>{
|
|
653
654
|
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
654
|
-
url
|
|
655
|
+
url,
|
|
656
|
+
attrs
|
|
655
657
|
});
|
|
656
658
|
if (res instanceof HTMLLinkElement) {
|
|
657
659
|
return res;
|
|
@@ -662,17 +664,19 @@ useLinkPreload = true) {
|
|
|
662
664
|
needAttach && document.head.appendChild(cssEl);
|
|
663
665
|
});
|
|
664
666
|
} else {
|
|
667
|
+
const defaultAttrs = {
|
|
668
|
+
rel: 'stylesheet',
|
|
669
|
+
type: 'text/css'
|
|
670
|
+
};
|
|
665
671
|
cssAssets.forEach((cssUrl)=>{
|
|
666
672
|
const { link: cssEl, needAttach } = createLink({
|
|
667
673
|
url: cssUrl,
|
|
668
674
|
cb: ()=>{},
|
|
669
|
-
attrs:
|
|
670
|
-
|
|
671
|
-
type: 'text/css'
|
|
672
|
-
},
|
|
673
|
-
createLinkHook: (url)=>{
|
|
675
|
+
attrs: defaultAttrs,
|
|
676
|
+
createLinkHook: (url, attrs)=>{
|
|
674
677
|
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
675
|
-
url
|
|
678
|
+
url,
|
|
679
|
+
attrs
|
|
676
680
|
});
|
|
677
681
|
if (res instanceof HTMLLinkElement) {
|
|
678
682
|
return res;
|
|
@@ -685,18 +689,20 @@ useLinkPreload = true) {
|
|
|
685
689
|
});
|
|
686
690
|
}
|
|
687
691
|
if (useLinkPreload) {
|
|
692
|
+
const defaultAttrs = {
|
|
693
|
+
rel: 'preload',
|
|
694
|
+
as: 'script',
|
|
695
|
+
crossorigin: 'anonymous'
|
|
696
|
+
};
|
|
688
697
|
jsAssetsWithoutEntry.forEach((jsUrl)=>{
|
|
689
698
|
const { link: linkEl, needAttach } = createLink({
|
|
690
699
|
url: jsUrl,
|
|
691
700
|
cb: ()=>{},
|
|
692
|
-
attrs:
|
|
693
|
-
|
|
694
|
-
as: 'script',
|
|
695
|
-
crossorigin: 'anonymous'
|
|
696
|
-
},
|
|
697
|
-
createLinkHook: (url)=>{
|
|
701
|
+
attrs: defaultAttrs,
|
|
702
|
+
createLinkHook: (url, attrs)=>{
|
|
698
703
|
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
699
|
-
url
|
|
704
|
+
url,
|
|
705
|
+
attrs
|
|
700
706
|
});
|
|
701
707
|
if (res instanceof HTMLLinkElement) {
|
|
702
708
|
return res;
|
|
@@ -707,14 +713,15 @@ useLinkPreload = true) {
|
|
|
707
713
|
needAttach && document.head.appendChild(linkEl);
|
|
708
714
|
});
|
|
709
715
|
} else {
|
|
716
|
+
const defaultAttrs = {
|
|
717
|
+
fetchpriority: 'high',
|
|
718
|
+
type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
|
|
719
|
+
};
|
|
710
720
|
jsAssetsWithoutEntry.forEach((jsUrl)=>{
|
|
711
721
|
const { script: scriptEl, needAttach } = createScript({
|
|
712
722
|
url: jsUrl,
|
|
713
723
|
cb: ()=>{},
|
|
714
|
-
attrs:
|
|
715
|
-
fetchpriority: 'high',
|
|
716
|
-
type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
|
|
717
|
-
},
|
|
724
|
+
attrs: defaultAttrs,
|
|
718
725
|
createScriptHook: (url, attrs)=>{
|
|
719
726
|
const res = host.loaderHook.lifecycle.createScript.emit({
|
|
720
727
|
url,
|
|
@@ -2064,7 +2071,7 @@ class FederationHost {
|
|
|
2064
2071
|
// maybe will change, temporarily for internal use only
|
|
2065
2072
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
2066
2073
|
});
|
|
2067
|
-
this.version = "0.
|
|
2074
|
+
this.version = "0.4.0";
|
|
2068
2075
|
this.moduleCache = new Map();
|
|
2069
2076
|
this.loaderHook = new PluginSystem({
|
|
2070
2077
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -212,7 +212,7 @@ function getGlobalFederationConstructor() {
|
|
|
212
212
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
213
213
|
if (isDebug) {
|
|
214
214
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
215
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
215
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.4.0";
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -711,7 +711,7 @@ function formatShare(shareArgs, from, name) {
|
|
|
711
711
|
strictVersion: false
|
|
712
712
|
}, shareArgs.shareConfig),
|
|
713
713
|
get,
|
|
714
|
-
loaded: 'lib' in shareArgs ? true : undefined,
|
|
714
|
+
loaded: (shareArgs == null ? void 0 : shareArgs.loaded) || 'lib' in shareArgs ? true : undefined,
|
|
715
715
|
version: (_shareArgs_version = shareArgs.version) != null ? _shareArgs_version : '0',
|
|
716
716
|
scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
|
|
717
717
|
(_shareArgs_scope = shareArgs.scope) != null ? _shareArgs_scope : 'default'
|
package/dist/share.esm.js
CHANGED
|
@@ -210,7 +210,7 @@ function getGlobalFederationConstructor() {
|
|
|
210
210
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
211
211
|
if (isDebug) {
|
|
212
212
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
213
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
213
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.4.0";
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -709,7 +709,7 @@ function formatShare(shareArgs, from, name) {
|
|
|
709
709
|
strictVersion: false
|
|
710
710
|
}, shareArgs.shareConfig),
|
|
711
711
|
get,
|
|
712
|
-
loaded: 'lib' in shareArgs ? true : undefined,
|
|
712
|
+
loaded: (shareArgs == null ? void 0 : shareArgs.loaded) || 'lib' in shareArgs ? true : undefined,
|
|
713
713
|
version: (_shareArgs_version = shareArgs.version) != null ? _shareArgs_version : '0',
|
|
714
714
|
scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
|
|
715
715
|
(_shareArgs_scope = shareArgs.scope) != null ? _shareArgs_scope : 'default'
|
package/dist/src/core.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ type SharedBaseArgs = {
|
|
|
41
41
|
scope?: string | Array<string>;
|
|
42
42
|
deps?: Array<string>;
|
|
43
43
|
strategy?: 'version-first' | 'loaded-first';
|
|
44
|
+
loaded?: boolean;
|
|
44
45
|
};
|
|
45
46
|
export type SharedGetter = (() => () => Module) | (() => Promise<() => Module>);
|
|
46
47
|
export type ShareArgs = (SharedBaseArgs & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@module-federation/sdk": "0.
|
|
48
|
+
"@module-federation/sdk": "0.4.0"
|
|
49
49
|
}
|
|
50
50
|
}
|