@module-federation/sdk 0.0.0-next-20240723065243 → 0.0.0-next-20240724103050
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 +9 -2
- package/dist/index.esm.js +9 -3
- package/dist/package.json +1 -1
- package/dist/src/constant.d.ts +1 -0
- package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +6 -0
- package/dist/src/types/snapshot.d.ts +3 -0
- package/dist/src/types/stats.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -30,6 +30,7 @@ const MFModuleType = {
|
|
|
30
30
|
};
|
|
31
31
|
const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
32
32
|
const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
33
|
+
const TEMP_DIR = '.federation';
|
|
33
34
|
|
|
34
35
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
35
36
|
__proto__: null
|
|
@@ -336,7 +337,7 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
336
337
|
// overrides will override dependencies
|
|
337
338
|
matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
|
|
338
339
|
});
|
|
339
|
-
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;
|
|
340
341
|
const { exposes } = manifest;
|
|
341
342
|
let basicRemoteSnapshot = {
|
|
342
343
|
version: version ? version : '',
|
|
@@ -381,6 +382,11 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
381
382
|
getPublicPath: getPublicPath()
|
|
382
383
|
});
|
|
383
384
|
}
|
|
385
|
+
if (ssrRemoteEntry) {
|
|
386
|
+
const fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
|
|
387
|
+
remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
|
|
388
|
+
remoteSnapshot.ssrRemoteEntryType = 'commonjs-module';
|
|
389
|
+
}
|
|
384
390
|
return remoteSnapshot;
|
|
385
391
|
}
|
|
386
392
|
function isManifestProvider(moduleInfo) {
|
|
@@ -652,7 +658,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
652
658
|
}
|
|
653
659
|
cb(undefined, exportedInterface);
|
|
654
660
|
} catch (e) {
|
|
655
|
-
cb(new Error(`Script execution error: ${e}`));
|
|
661
|
+
cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
|
|
656
662
|
}
|
|
657
663
|
};
|
|
658
664
|
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
|
|
@@ -710,6 +716,7 @@ exports.NameTransformMap = NameTransformMap;
|
|
|
710
716
|
exports.NameTransformSymbol = NameTransformSymbol;
|
|
711
717
|
exports.SEPARATOR = SEPARATOR;
|
|
712
718
|
exports.StatsFileName = StatsFileName;
|
|
719
|
+
exports.TEMP_DIR = TEMP_DIR;
|
|
713
720
|
exports.assert = assert;
|
|
714
721
|
exports.composeKeyWithSeparator = composeKeyWithSeparator;
|
|
715
722
|
exports.containerPlugin = ContainerPlugin;
|
package/dist/index.esm.js
CHANGED
|
@@ -26,6 +26,7 @@ const MFModuleType = {
|
|
|
26
26
|
};
|
|
27
27
|
const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
28
28
|
const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
29
|
+
const TEMP_DIR = '.federation';
|
|
29
30
|
|
|
30
31
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
31
32
|
__proto__: null
|
|
@@ -332,7 +333,7 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
332
333
|
// overrides will override dependencies
|
|
333
334
|
matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
|
|
334
335
|
});
|
|
335
|
-
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;
|
|
336
337
|
const { exposes } = manifest;
|
|
337
338
|
let basicRemoteSnapshot = {
|
|
338
339
|
version: version ? version : '',
|
|
@@ -377,6 +378,11 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
377
378
|
getPublicPath: getPublicPath()
|
|
378
379
|
});
|
|
379
380
|
}
|
|
381
|
+
if (ssrRemoteEntry) {
|
|
382
|
+
const fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
|
|
383
|
+
remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
|
|
384
|
+
remoteSnapshot.ssrRemoteEntryType = 'commonjs-module';
|
|
385
|
+
}
|
|
380
386
|
return remoteSnapshot;
|
|
381
387
|
}
|
|
382
388
|
function isManifestProvider(moduleInfo) {
|
|
@@ -648,7 +654,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
648
654
|
}
|
|
649
655
|
cb(undefined, exportedInterface);
|
|
650
656
|
} catch (e) {
|
|
651
|
-
cb(new Error(`Script execution error: ${e}`));
|
|
657
|
+
cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
|
|
652
658
|
}
|
|
653
659
|
};
|
|
654
660
|
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
|
|
@@ -692,4 +698,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
692
698
|
};
|
|
693
699
|
}
|
|
694
700
|
|
|
695
|
-
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, inferAutoPublicPath, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
|
|
701
|
+
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, inferAutoPublicPath, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
|
package/dist/package.json
CHANGED
package/dist/src/constant.d.ts
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;
|