@module-federation/sdk 0.0.0-next-20240521035527 → 0.0.0-next-20240521123600
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 +6 -10
- package/dist/index.esm.js +6 -10
- package/dist/package.json +1 -1
- package/dist/src/dom.d.ts +2 -6
- package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +5 -0
- package/dist/src/types/snapshot.d.ts +3 -0
- package/dist/src/types/stats.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -507,7 +507,7 @@ function generateSnapshotFromManifest(manifest) {
|
|
|
507
507
|
matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
|
|
508
508
|
};
|
|
509
509
|
});
|
|
510
|
-
var _manifest_metaData2 = manifest.metaData, _manifest_metaData_remoteEntry = _manifest_metaData2.remoteEntry, remoteEntryPath = _manifest_metaData_remoteEntry.path, remoteEntryName = _manifest_metaData_remoteEntry.name, remoteEntryType = _manifest_metaData_remoteEntry.type, remoteTypes = _manifest_metaData2.types, buildVersion = _manifest_metaData2.buildInfo.buildVersion, globalName = _manifest_metaData2.globalName;
|
|
510
|
+
var _manifest_metaData2 = manifest.metaData, _manifest_metaData_remoteEntry = _manifest_metaData2.remoteEntry, remoteEntryPath = _manifest_metaData_remoteEntry.path, remoteEntryName = _manifest_metaData_remoteEntry.name, remoteEntryType = _manifest_metaData_remoteEntry.type, remoteTypes = _manifest_metaData2.types, buildVersion = _manifest_metaData2.buildInfo.buildVersion, globalName = _manifest_metaData2.globalName, ssrRemoteEntry = _manifest_metaData2.ssrRemoteEntry;
|
|
511
511
|
var exposes = manifest.exposes;
|
|
512
512
|
var basicRemoteSnapshot = {
|
|
513
513
|
version: version ? version : '',
|
|
@@ -556,6 +556,11 @@ function generateSnapshotFromManifest(manifest) {
|
|
|
556
556
|
getPublicPath: getPublicPath()
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
|
+
if (ssrRemoteEntry) {
|
|
560
|
+
var fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
|
|
561
|
+
remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
|
|
562
|
+
remoteSnapshot.ssrRemoteEntryType = 'cjs:webpack';
|
|
563
|
+
}
|
|
559
564
|
return remoteSnapshot;
|
|
560
565
|
}
|
|
561
566
|
function isManifestProvider(moduleInfo) {
|
|
@@ -750,8 +755,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
750
755
|
// Retrieve the existing script element by its src attribute
|
|
751
756
|
var script = null;
|
|
752
757
|
var needAttach = true;
|
|
753
|
-
var timeout = 20000;
|
|
754
|
-
var timeoutId;
|
|
755
758
|
var scripts = document.getElementsByTagName('script');
|
|
756
759
|
for(var i = 0; i < scripts.length; i++){
|
|
757
760
|
var s = scripts[i];
|
|
@@ -770,9 +773,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
770
773
|
var createScriptRes = createScriptHook(url);
|
|
771
774
|
if (_instanceof(createScriptRes, HTMLScriptElement)) {
|
|
772
775
|
script = createScriptRes;
|
|
773
|
-
} else if (typeof createScriptRes === 'object') {
|
|
774
|
-
if (createScriptRes.script) script = createScriptRes.script;
|
|
775
|
-
if (createScriptRes.timeout) timeout = createScriptRes.timeout;
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
778
|
}
|
|
@@ -789,7 +789,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
789
789
|
}
|
|
790
790
|
var onScriptComplete = function(prev, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
791
791
|
event) {
|
|
792
|
-
clearTimeout(timeoutId);
|
|
793
792
|
// Prevent memory leaks in IE.
|
|
794
793
|
if (script) {
|
|
795
794
|
script.onerror = null;
|
|
@@ -808,9 +807,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
808
807
|
};
|
|
809
808
|
script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
810
809
|
script.onload = onScriptComplete.bind(null, script.onload);
|
|
811
|
-
timeoutId = setTimeout(function() {
|
|
812
|
-
onScriptComplete(null, new Error('Remote script "'.concat(url, '" time-outed.')));
|
|
813
|
-
}, timeout);
|
|
814
810
|
return {
|
|
815
811
|
script: script,
|
|
816
812
|
needAttach: needAttach
|
package/dist/index.esm.js
CHANGED
|
@@ -503,7 +503,7 @@ function generateSnapshotFromManifest(manifest) {
|
|
|
503
503
|
matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
|
|
504
504
|
};
|
|
505
505
|
});
|
|
506
|
-
var _manifest_metaData2 = manifest.metaData, _manifest_metaData_remoteEntry = _manifest_metaData2.remoteEntry, remoteEntryPath = _manifest_metaData_remoteEntry.path, remoteEntryName = _manifest_metaData_remoteEntry.name, remoteEntryType = _manifest_metaData_remoteEntry.type, remoteTypes = _manifest_metaData2.types, buildVersion = _manifest_metaData2.buildInfo.buildVersion, globalName = _manifest_metaData2.globalName;
|
|
506
|
+
var _manifest_metaData2 = manifest.metaData, _manifest_metaData_remoteEntry = _manifest_metaData2.remoteEntry, remoteEntryPath = _manifest_metaData_remoteEntry.path, remoteEntryName = _manifest_metaData_remoteEntry.name, remoteEntryType = _manifest_metaData_remoteEntry.type, remoteTypes = _manifest_metaData2.types, buildVersion = _manifest_metaData2.buildInfo.buildVersion, globalName = _manifest_metaData2.globalName, ssrRemoteEntry = _manifest_metaData2.ssrRemoteEntry;
|
|
507
507
|
var exposes = manifest.exposes;
|
|
508
508
|
var basicRemoteSnapshot = {
|
|
509
509
|
version: version ? version : '',
|
|
@@ -552,6 +552,11 @@ function generateSnapshotFromManifest(manifest) {
|
|
|
552
552
|
getPublicPath: getPublicPath()
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
|
+
if (ssrRemoteEntry) {
|
|
556
|
+
var fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
|
|
557
|
+
remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
|
|
558
|
+
remoteSnapshot.ssrRemoteEntryType = 'cjs:webpack';
|
|
559
|
+
}
|
|
555
560
|
return remoteSnapshot;
|
|
556
561
|
}
|
|
557
562
|
function isManifestProvider(moduleInfo) {
|
|
@@ -746,8 +751,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
746
751
|
// Retrieve the existing script element by its src attribute
|
|
747
752
|
var script = null;
|
|
748
753
|
var needAttach = true;
|
|
749
|
-
var timeout = 20000;
|
|
750
|
-
var timeoutId;
|
|
751
754
|
var scripts = document.getElementsByTagName('script');
|
|
752
755
|
for(var i = 0; i < scripts.length; i++){
|
|
753
756
|
var s = scripts[i];
|
|
@@ -766,9 +769,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
766
769
|
var createScriptRes = createScriptHook(url);
|
|
767
770
|
if (_instanceof(createScriptRes, HTMLScriptElement)) {
|
|
768
771
|
script = createScriptRes;
|
|
769
|
-
} else if (typeof createScriptRes === 'object') {
|
|
770
|
-
if (createScriptRes.script) script = createScriptRes.script;
|
|
771
|
-
if (createScriptRes.timeout) timeout = createScriptRes.timeout;
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
}
|
|
@@ -785,7 +785,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
785
785
|
}
|
|
786
786
|
var onScriptComplete = function(prev, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
787
787
|
event) {
|
|
788
|
-
clearTimeout(timeoutId);
|
|
789
788
|
// Prevent memory leaks in IE.
|
|
790
789
|
if (script) {
|
|
791
790
|
script.onerror = null;
|
|
@@ -804,9 +803,6 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
804
803
|
};
|
|
805
804
|
script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
806
805
|
script.onload = onScriptComplete.bind(null, script.onload);
|
|
807
|
-
timeoutId = setTimeout(function() {
|
|
808
|
-
onScriptComplete(null, new Error('Remote script "'.concat(url, '" time-outed.')));
|
|
809
|
-
}, timeout);
|
|
810
806
|
return {
|
|
811
807
|
script: script,
|
|
812
808
|
needAttach: needAttach
|
package/dist/package.json
CHANGED
package/dist/src/dom.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export declare function safeWrapper<T extends (...args: Array<any>) => any>(callback: T, disableWarn?: boolean): Promise<ReturnType<T> | undefined>;
|
|
2
2
|
export declare function isStaticResourcesEqual(url1: string, url2: string): boolean;
|
|
3
|
-
export
|
|
4
|
-
script?: HTMLScriptElement;
|
|
5
|
-
timeout?: number;
|
|
6
|
-
} | void;
|
|
7
|
-
export declare function createScript(url: string, cb: (value: void | PromiseLike<void>) => void, attrs?: Record<string, any>, createScriptHook?: (url: string) => CreateScriptHookReturn): {
|
|
3
|
+
export declare function createScript(url: string, cb: (value: void | PromiseLike<void>) => void, attrs?: Record<string, any>, createScriptHook?: (url: string) => HTMLScriptElement | void): {
|
|
8
4
|
script: HTMLScriptElement;
|
|
9
5
|
needAttach: boolean;
|
|
10
6
|
};
|
|
@@ -14,5 +10,5 @@ export declare function createLink(url: string, cb: (value: void | PromiseLike<v
|
|
|
14
10
|
};
|
|
15
11
|
export declare function loadScript(url: string, info: {
|
|
16
12
|
attrs?: Record<string, any>;
|
|
17
|
-
createScriptHook?: (url: string) =>
|
|
13
|
+
createScriptHook?: (url: string) => HTMLScriptElement | void;
|
|
18
14
|
}): Promise<void>;
|
|
@@ -111,6 +111,10 @@ export interface PluginDtsOptions {
|
|
|
111
111
|
extraOptions?: Record<string, any>;
|
|
112
112
|
implementation?: string;
|
|
113
113
|
}
|
|
114
|
+
export type AsyncBoundaryOptions = {
|
|
115
|
+
eager?: RegExp | ((module: any) => boolean);
|
|
116
|
+
excludeChunk?: (chunk: any) => boolean;
|
|
117
|
+
};
|
|
114
118
|
export interface ModuleFederationPluginOptions {
|
|
115
119
|
/**
|
|
116
120
|
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
|
@@ -159,6 +163,7 @@ export interface ModuleFederationPluginOptions {
|
|
|
159
163
|
manifest?: boolean | PluginManifestOptions;
|
|
160
164
|
dev?: boolean | PluginDevOptions;
|
|
161
165
|
dts?: boolean | PluginDtsOptions;
|
|
166
|
+
async?: boolean | AsyncBoundaryOptions;
|
|
162
167
|
}
|
|
163
168
|
/**
|
|
164
169
|
* Modules that should be exposed by this container. Property names are used as public paths.
|
|
@@ -23,6 +23,8 @@ interface BasicModuleInfo {
|
|
|
23
23
|
export interface BasicProviderModuleInfo extends BasicModuleInfo {
|
|
24
24
|
remoteEntry: string;
|
|
25
25
|
remoteEntryType: RemoteEntryType;
|
|
26
|
+
ssrRemoteEntry?: string;
|
|
27
|
+
ssrRemoteEntryType?: RemoteEntryType;
|
|
26
28
|
remoteManifest?: string;
|
|
27
29
|
globalName: string;
|
|
28
30
|
modules: Array<{
|
|
@@ -42,6 +44,7 @@ interface BasicProviderModuleInfoWithGetPublicPath extends BasicProviderModuleIn
|
|
|
42
44
|
}
|
|
43
45
|
export interface ManifestProvider {
|
|
44
46
|
remoteEntry: string;
|
|
47
|
+
ssrRemoteEntry?: string;
|
|
45
48
|
version?: string;
|
|
46
49
|
}
|
|
47
50
|
export interface PureEntryProvider extends ManifestProvider {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RemoteWithEntry, RemoteWithVersion } from './common';
|
|
2
|
-
export type RemoteEntryType = 'esm' | 'global';
|
|
3
|
-
interface ResourceInfo {
|
|
2
|
+
export type RemoteEntryType = 'esm' | 'global' | 'cjs:webpack';
|
|
3
|
+
export interface ResourceInfo {
|
|
4
4
|
path: string;
|
|
5
5
|
name: string;
|
|
6
6
|
type: RemoteEntryType;
|
|
@@ -20,6 +20,7 @@ export interface BasicStatsMetaData {
|
|
|
20
20
|
globalName: string;
|
|
21
21
|
buildInfo: StatsBuildInfo;
|
|
22
22
|
remoteEntry: ResourceInfo;
|
|
23
|
+
ssrRemoteEntry?: ResourceInfo;
|
|
23
24
|
prefetchInterface?: boolean;
|
|
24
25
|
prefetchEntry?: ResourceInfo;
|
|
25
26
|
types: MetaDataTypes;
|