@module-federation/sdk 0.2.8 → 0.3.1
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
CHANGED
|
@@ -337,7 +337,7 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
337
337
|
// overrides will override dependencies
|
|
338
338
|
matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
|
|
339
339
|
});
|
|
340
|
-
const { remoteEntry: { path: remoteEntryPath, name: remoteEntryName, type: remoteEntryType }, types: remoteTypes, buildInfo: { buildVersion }, globalName } = manifest.metaData;
|
|
340
|
+
const { remoteEntry: { path: remoteEntryPath, name: remoteEntryName, type: remoteEntryType }, types: remoteTypes, buildInfo: { buildVersion }, globalName, ssrRemoteEntry } = manifest.metaData;
|
|
341
341
|
const { exposes } = manifest;
|
|
342
342
|
let basicRemoteSnapshot = {
|
|
343
343
|
version: version ? version : '',
|
|
@@ -382,6 +382,11 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
382
382
|
getPublicPath: getPublicPath()
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
+
if (ssrRemoteEntry) {
|
|
386
|
+
const fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
|
|
387
|
+
remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
|
|
388
|
+
remoteSnapshot.ssrRemoteEntryType = 'commonjs-module';
|
|
389
|
+
}
|
|
385
390
|
return remoteSnapshot;
|
|
386
391
|
}
|
|
387
392
|
function isManifestProvider(moduleInfo) {
|
|
@@ -653,7 +658,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
653
658
|
}
|
|
654
659
|
cb(undefined, exportedInterface);
|
|
655
660
|
} catch (e) {
|
|
656
|
-
cb(new Error(`Script execution error: ${e}`));
|
|
661
|
+
cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
|
|
657
662
|
}
|
|
658
663
|
};
|
|
659
664
|
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
|
package/dist/index.esm.js
CHANGED
|
@@ -333,7 +333,7 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
333
333
|
// overrides will override dependencies
|
|
334
334
|
matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
|
|
335
335
|
});
|
|
336
|
-
const { remoteEntry: { path: remoteEntryPath, name: remoteEntryName, type: remoteEntryType }, types: remoteTypes, buildInfo: { buildVersion }, globalName } = manifest.metaData;
|
|
336
|
+
const { remoteEntry: { path: remoteEntryPath, name: remoteEntryName, type: remoteEntryType }, types: remoteTypes, buildInfo: { buildVersion }, globalName, ssrRemoteEntry } = manifest.metaData;
|
|
337
337
|
const { exposes } = manifest;
|
|
338
338
|
let basicRemoteSnapshot = {
|
|
339
339
|
version: version ? version : '',
|
|
@@ -378,6 +378,11 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
378
378
|
getPublicPath: getPublicPath()
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
|
+
if (ssrRemoteEntry) {
|
|
382
|
+
const fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
|
|
383
|
+
remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
|
|
384
|
+
remoteSnapshot.ssrRemoteEntryType = 'commonjs-module';
|
|
385
|
+
}
|
|
381
386
|
return remoteSnapshot;
|
|
382
387
|
}
|
|
383
388
|
function isManifestProvider(moduleInfo) {
|
|
@@ -649,7 +654,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
649
654
|
}
|
|
650
655
|
cb(undefined, exportedInterface);
|
|
651
656
|
} catch (e) {
|
|
652
|
-
cb(new Error(`Script execution error: ${e}`));
|
|
657
|
+
cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
|
|
653
658
|
}
|
|
654
659
|
};
|
|
655
660
|
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
|
package/dist/package.json
CHANGED
|
@@ -91,6 +91,7 @@ export interface DtsHostOptions {
|
|
|
91
91
|
deleteTypesFolder?: boolean;
|
|
92
92
|
maxRetries?: number;
|
|
93
93
|
consumeAPITypes?: boolean;
|
|
94
|
+
runtimePkgs?: string[];
|
|
94
95
|
}
|
|
95
96
|
export interface DtsRemoteOptions {
|
|
96
97
|
tsConfigPath?: string;
|
|
@@ -112,6 +113,10 @@ export interface PluginDtsOptions {
|
|
|
112
113
|
extraOptions?: Record<string, any>;
|
|
113
114
|
implementation?: string;
|
|
114
115
|
}
|
|
116
|
+
export type AsyncBoundaryOptions = {
|
|
117
|
+
eager?: RegExp | ((module: any) => boolean);
|
|
118
|
+
excludeChunk?: (chunk: any) => boolean;
|
|
119
|
+
};
|
|
115
120
|
export interface ModuleFederationPluginOptions {
|
|
116
121
|
/**
|
|
117
122
|
* 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.
|
|
@@ -164,6 +169,7 @@ export interface ModuleFederationPluginOptions {
|
|
|
164
169
|
manifest?: boolean | PluginManifestOptions;
|
|
165
170
|
dev?: boolean | PluginDevOptions;
|
|
166
171
|
dts?: boolean | PluginDtsOptions;
|
|
172
|
+
async?: boolean | AsyncBoundaryOptions;
|
|
167
173
|
}
|
|
168
174
|
/**
|
|
169
175
|
* 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
2
|
export type RemoteEntryType = 'var' | 'module' | 'assign' | 'assign-properties' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | string;
|
|
3
|
-
interface ResourceInfo {
|
|
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;
|