@module-federation/sdk 0.0.0-next-20240521125425 → 0.0.0-next-20240523085338
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 +10 -6
- package/dist/index.esm.js +10 -6
- package/dist/package.json +1 -1
- package/dist/src/dom.d.ts +6 -2
- package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +0 -5
- package/dist/src/types/snapshot.d.ts +0 -3
- package/dist/src/types/stats.d.ts +2 -3
- 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;
|
|
511
511
|
var exposes = manifest.exposes;
|
|
512
512
|
var basicRemoteSnapshot = {
|
|
513
513
|
version: version ? version : '',
|
|
@@ -556,11 +556,6 @@ 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
|
-
}
|
|
564
559
|
return remoteSnapshot;
|
|
565
560
|
}
|
|
566
561
|
function isManifestProvider(moduleInfo) {
|
|
@@ -755,6 +750,8 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
755
750
|
// Retrieve the existing script element by its src attribute
|
|
756
751
|
var script = null;
|
|
757
752
|
var needAttach = true;
|
|
753
|
+
var timeout = 20000;
|
|
754
|
+
var timeoutId;
|
|
758
755
|
var scripts = document.getElementsByTagName('script');
|
|
759
756
|
for(var i = 0; i < scripts.length; i++){
|
|
760
757
|
var s = scripts[i];
|
|
@@ -773,6 +770,9 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
773
770
|
var createScriptRes = createScriptHook(url);
|
|
774
771
|
if (_instanceof(createScriptRes, HTMLScriptElement)) {
|
|
775
772
|
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,6 +789,7 @@ 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);
|
|
792
793
|
// Prevent memory leaks in IE.
|
|
793
794
|
if (script) {
|
|
794
795
|
script.onerror = null;
|
|
@@ -807,6 +808,9 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
807
808
|
};
|
|
808
809
|
script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
809
810
|
script.onload = onScriptComplete.bind(null, script.onload);
|
|
811
|
+
timeoutId = setTimeout(function() {
|
|
812
|
+
onScriptComplete(null, new Error('Remote script "'.concat(url, '" time-outed.')));
|
|
813
|
+
}, timeout);
|
|
810
814
|
return {
|
|
811
815
|
script: script,
|
|
812
816
|
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;
|
|
507
507
|
var exposes = manifest.exposes;
|
|
508
508
|
var basicRemoteSnapshot = {
|
|
509
509
|
version: version ? version : '',
|
|
@@ -552,11 +552,6 @@ 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
|
-
}
|
|
560
555
|
return remoteSnapshot;
|
|
561
556
|
}
|
|
562
557
|
function isManifestProvider(moduleInfo) {
|
|
@@ -751,6 +746,8 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
751
746
|
// Retrieve the existing script element by its src attribute
|
|
752
747
|
var script = null;
|
|
753
748
|
var needAttach = true;
|
|
749
|
+
var timeout = 20000;
|
|
750
|
+
var timeoutId;
|
|
754
751
|
var scripts = document.getElementsByTagName('script');
|
|
755
752
|
for(var i = 0; i < scripts.length; i++){
|
|
756
753
|
var s = scripts[i];
|
|
@@ -769,6 +766,9 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
769
766
|
var createScriptRes = createScriptHook(url);
|
|
770
767
|
if (_instanceof(createScriptRes, HTMLScriptElement)) {
|
|
771
768
|
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,6 +785,7 @@ 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);
|
|
788
789
|
// Prevent memory leaks in IE.
|
|
789
790
|
if (script) {
|
|
790
791
|
script.onerror = null;
|
|
@@ -803,6 +804,9 @@ function createScript(url, cb, attrs, createScriptHook) {
|
|
|
803
804
|
};
|
|
804
805
|
script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
805
806
|
script.onload = onScriptComplete.bind(null, script.onload);
|
|
807
|
+
timeoutId = setTimeout(function() {
|
|
808
|
+
onScriptComplete(null, new Error('Remote script "'.concat(url, '" time-outed.')));
|
|
809
|
+
}, timeout);
|
|
806
810
|
return {
|
|
807
811
|
script: script,
|
|
808
812
|
needAttach: needAttach
|
package/dist/package.json
CHANGED
package/dist/src/dom.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
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
|
|
3
|
+
export type CreateScriptHookReturn = HTMLScriptElement | {
|
|
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): {
|
|
4
8
|
script: HTMLScriptElement;
|
|
5
9
|
needAttach: boolean;
|
|
6
10
|
};
|
|
@@ -10,5 +14,5 @@ export declare function createLink(url: string, cb: (value: void | PromiseLike<v
|
|
|
10
14
|
};
|
|
11
15
|
export declare function loadScript(url: string, info: {
|
|
12
16
|
attrs?: Record<string, any>;
|
|
13
|
-
createScriptHook?: (url: string) =>
|
|
17
|
+
createScriptHook?: (url: string) => CreateScriptHookReturn;
|
|
14
18
|
}): Promise<void>;
|
|
@@ -111,10 +111,6 @@ 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
|
-
};
|
|
118
114
|
export interface ModuleFederationPluginOptions {
|
|
119
115
|
/**
|
|
120
116
|
* 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.
|
|
@@ -163,7 +159,6 @@ export interface ModuleFederationPluginOptions {
|
|
|
163
159
|
manifest?: boolean | PluginManifestOptions;
|
|
164
160
|
dev?: boolean | PluginDevOptions;
|
|
165
161
|
dts?: boolean | PluginDtsOptions;
|
|
166
|
-
async?: boolean | AsyncBoundaryOptions;
|
|
167
162
|
}
|
|
168
163
|
/**
|
|
169
164
|
* Modules that should be exposed by this container. Property names are used as public paths.
|
|
@@ -23,8 +23,6 @@ interface BasicModuleInfo {
|
|
|
23
23
|
export interface BasicProviderModuleInfo extends BasicModuleInfo {
|
|
24
24
|
remoteEntry: string;
|
|
25
25
|
remoteEntryType: RemoteEntryType;
|
|
26
|
-
ssrRemoteEntry?: string;
|
|
27
|
-
ssrRemoteEntryType?: RemoteEntryType;
|
|
28
26
|
remoteManifest?: string;
|
|
29
27
|
globalName: string;
|
|
30
28
|
modules: Array<{
|
|
@@ -44,7 +42,6 @@ interface BasicProviderModuleInfoWithGetPublicPath extends BasicProviderModuleIn
|
|
|
44
42
|
}
|
|
45
43
|
export interface ManifestProvider {
|
|
46
44
|
remoteEntry: string;
|
|
47
|
-
ssrRemoteEntry?: string;
|
|
48
45
|
version?: string;
|
|
49
46
|
}
|
|
50
47
|
export interface PureEntryProvider extends ManifestProvider {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RemoteWithEntry, RemoteWithVersion } from './common';
|
|
2
|
-
export type RemoteEntryType = 'esm' | 'global'
|
|
3
|
-
|
|
2
|
+
export type RemoteEntryType = 'esm' | 'global';
|
|
3
|
+
interface ResourceInfo {
|
|
4
4
|
path: string;
|
|
5
5
|
name: string;
|
|
6
6
|
type: RemoteEntryType;
|
|
@@ -20,7 +20,6 @@ export interface BasicStatsMetaData {
|
|
|
20
20
|
globalName: string;
|
|
21
21
|
buildInfo: StatsBuildInfo;
|
|
22
22
|
remoteEntry: ResourceInfo;
|
|
23
|
-
ssrRemoteEntry?: ResourceInfo;
|
|
24
23
|
prefetchInterface?: boolean;
|
|
25
24
|
prefetchEntry?: ResourceInfo;
|
|
26
25
|
types: MetaDataTypes;
|