@module-federation/sdk 0.0.0-next-20240910102933 → 0.0.0-next-20240911025149
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 +16 -17
- package/dist/index.esm.js +10 -12
- package/dist/package.json +1 -1
- package/dist/polyfills.cjs.js +14 -0
- package/dist/polyfills.esm.js +12 -0
- package/dist/src/constant.d.ts +7 -0
- package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +9 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var polyfills = require('./polyfills.cjs.js');
|
|
6
|
+
|
|
5
7
|
const FederationModuleManifest = 'federation-manifest.json';
|
|
6
8
|
const MANIFEST_EXT = '.json';
|
|
7
9
|
const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';
|
|
@@ -31,6 +33,13 @@ const MFModuleType = {
|
|
|
31
33
|
const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
32
34
|
const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
33
35
|
const TEMP_DIR = '.federation';
|
|
36
|
+
const MFPrefetchCommon = {
|
|
37
|
+
identifier: 'MFDataPrefetch',
|
|
38
|
+
globalKey: '__PREFETCH__',
|
|
39
|
+
library: 'mf-data-prefetch',
|
|
40
|
+
exportsKey: '__PREFETCH_EXPORTS__',
|
|
41
|
+
fileName: 'bootstrap.js'
|
|
42
|
+
};
|
|
34
43
|
|
|
35
44
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
36
45
|
__proto__: null
|
|
@@ -248,17 +257,6 @@ function safeToString(info) {
|
|
|
248
257
|
}
|
|
249
258
|
}
|
|
250
259
|
|
|
251
|
-
function _extends() {
|
|
252
|
-
_extends = Object.assign || function assign(target) {
|
|
253
|
-
for(var i = 1; i < arguments.length; i++){
|
|
254
|
-
var source = arguments[i];
|
|
255
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
256
|
-
}
|
|
257
|
-
return target;
|
|
258
|
-
};
|
|
259
|
-
return _extends.apply(this, arguments);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
260
|
const simpleJoinRemoteEntry = (rPath, rName)=>{
|
|
263
261
|
if (!rPath) {
|
|
264
262
|
return rName;
|
|
@@ -362,23 +360,23 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
362
360
|
};
|
|
363
361
|
if ((_manifest_metaData = manifest.metaData) == null ? void 0 : _manifest_metaData.prefetchInterface) {
|
|
364
362
|
const prefetchInterface = manifest.metaData.prefetchInterface;
|
|
365
|
-
basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
363
|
+
basicRemoteSnapshot = polyfills._extends({}, basicRemoteSnapshot, {
|
|
366
364
|
prefetchInterface
|
|
367
365
|
});
|
|
368
366
|
}
|
|
369
367
|
if ((_manifest_metaData1 = manifest.metaData) == null ? void 0 : _manifest_metaData1.prefetchEntry) {
|
|
370
368
|
const { path, name, type } = manifest.metaData.prefetchEntry;
|
|
371
|
-
basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
369
|
+
basicRemoteSnapshot = polyfills._extends({}, basicRemoteSnapshot, {
|
|
372
370
|
prefetchEntry: simpleJoinRemoteEntry(path, name),
|
|
373
371
|
prefetchEntryType: type
|
|
374
372
|
});
|
|
375
373
|
}
|
|
376
374
|
if ('publicPath' in manifest.metaData) {
|
|
377
|
-
remoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
375
|
+
remoteSnapshot = polyfills._extends({}, basicRemoteSnapshot, {
|
|
378
376
|
publicPath: getPublicPath()
|
|
379
377
|
});
|
|
380
378
|
} else {
|
|
381
|
-
remoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
379
|
+
remoteSnapshot = polyfills._extends({}, basicRemoteSnapshot, {
|
|
382
380
|
getPublicPath: getPublicPath()
|
|
383
381
|
});
|
|
384
382
|
}
|
|
@@ -571,7 +569,7 @@ function loadScript(url, info) {
|
|
|
571
569
|
const { script, needAttach } = createScript({
|
|
572
570
|
url,
|
|
573
571
|
cb: resolve,
|
|
574
|
-
attrs: _extends({
|
|
572
|
+
attrs: polyfills._extends({
|
|
575
573
|
fetchpriority: 'high'
|
|
576
574
|
}, attrs),
|
|
577
575
|
createScriptHook,
|
|
@@ -707,7 +705,7 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
707
705
|
return defaultOptions;
|
|
708
706
|
}
|
|
709
707
|
if (options && typeof options === 'object') {
|
|
710
|
-
return _extends({}, defaultOptions, options);
|
|
708
|
+
return polyfills._extends({}, defaultOptions, options);
|
|
711
709
|
}
|
|
712
710
|
throw new Error(`Unexpected type for \`${key}\`, expect boolean/undefined/object, got: ${typeof options}`);
|
|
713
711
|
};
|
|
@@ -721,6 +719,7 @@ exports.FederationModuleManifest = FederationModuleManifest;
|
|
|
721
719
|
exports.Logger = Logger;
|
|
722
720
|
exports.MANIFEST_EXT = MANIFEST_EXT;
|
|
723
721
|
exports.MFModuleType = MFModuleType;
|
|
722
|
+
exports.MFPrefetchCommon = MFPrefetchCommon;
|
|
724
723
|
exports.MODULE_DEVTOOL_IDENTIFIER = MODULE_DEVTOOL_IDENTIFIER;
|
|
725
724
|
exports.ManifestFileName = ManifestFileName;
|
|
726
725
|
exports.NameTransformMap = NameTransformMap;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { _ as _extends } from './polyfills.esm.js';
|
|
2
|
+
|
|
1
3
|
const FederationModuleManifest = 'federation-manifest.json';
|
|
2
4
|
const MANIFEST_EXT = '.json';
|
|
3
5
|
const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';
|
|
@@ -27,6 +29,13 @@ const MFModuleType = {
|
|
|
27
29
|
const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
28
30
|
const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
29
31
|
const TEMP_DIR = '.federation';
|
|
32
|
+
const MFPrefetchCommon = {
|
|
33
|
+
identifier: 'MFDataPrefetch',
|
|
34
|
+
globalKey: '__PREFETCH__',
|
|
35
|
+
library: 'mf-data-prefetch',
|
|
36
|
+
exportsKey: '__PREFETCH_EXPORTS__',
|
|
37
|
+
fileName: 'bootstrap.js'
|
|
38
|
+
};
|
|
30
39
|
|
|
31
40
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
32
41
|
__proto__: null
|
|
@@ -244,17 +253,6 @@ function safeToString(info) {
|
|
|
244
253
|
}
|
|
245
254
|
}
|
|
246
255
|
|
|
247
|
-
function _extends() {
|
|
248
|
-
_extends = Object.assign || function assign(target) {
|
|
249
|
-
for(var i = 1; i < arguments.length; i++){
|
|
250
|
-
var source = arguments[i];
|
|
251
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
252
|
-
}
|
|
253
|
-
return target;
|
|
254
|
-
};
|
|
255
|
-
return _extends.apply(this, arguments);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
256
|
const simpleJoinRemoteEntry = (rPath, rName)=>{
|
|
259
257
|
if (!rPath) {
|
|
260
258
|
return rName;
|
|
@@ -709,4 +707,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
709
707
|
};
|
|
710
708
|
}
|
|
711
709
|
|
|
712
|
-
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, safeToString, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
|
|
710
|
+
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, 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, safeToString, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
|
package/dist/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _extends() {
|
|
4
|
+
_extends = Object.assign || function assign(target) {
|
|
5
|
+
for(var i = 1; i < arguments.length; i++){
|
|
6
|
+
var source = arguments[i];
|
|
7
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
8
|
+
}
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
return _extends.apply(this, arguments);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports._extends = _extends;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
_extends = Object.assign || function assign(target) {
|
|
3
|
+
for(var i = 1; i < arguments.length; i++){
|
|
4
|
+
var source = arguments[i];
|
|
5
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
6
|
+
}
|
|
7
|
+
return target;
|
|
8
|
+
};
|
|
9
|
+
return _extends.apply(this, arguments);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { _extends as _ };
|
package/dist/src/constant.d.ts
CHANGED
|
@@ -23,3 +23,10 @@ export declare const MFModuleType: {
|
|
|
23
23
|
export declare const MODULE_DEVTOOL_IDENTIFIER = "__MF_DEVTOOLS_MODULE_INFO__";
|
|
24
24
|
export declare const ENCODE_NAME_PREFIX = "ENCODE_NAME_PREFIX";
|
|
25
25
|
export declare const TEMP_DIR = ".federation";
|
|
26
|
+
export declare const MFPrefetchCommon: {
|
|
27
|
+
identifier: string;
|
|
28
|
+
globalKey: string;
|
|
29
|
+
library: string;
|
|
30
|
+
exportsKey: string;
|
|
31
|
+
fileName: string;
|
|
32
|
+
};
|
|
@@ -40,7 +40,7 @@ export type UmdNamedDefine = boolean;
|
|
|
40
40
|
/**
|
|
41
41
|
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
|
|
42
42
|
*/
|
|
43
|
-
export type ExternalsType = 'var' | 'module' | 'assign' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | 'promise' | 'import' | 'script' | '
|
|
43
|
+
export type ExternalsType = 'var' | 'module' | 'assign' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | 'promise' | 'import' | 'script' | 'node-commonjs';
|
|
44
44
|
/**
|
|
45
45
|
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
|
46
46
|
*/
|
|
@@ -65,6 +65,10 @@ export type Shared = (SharedItem | SharedObject)[] | SharedObject;
|
|
|
65
65
|
* A module that should be shared in the share scope.
|
|
66
66
|
*/
|
|
67
67
|
export type SharedItem = string;
|
|
68
|
+
/**
|
|
69
|
+
* Enable Data Prefetch
|
|
70
|
+
*/
|
|
71
|
+
export type DataPrefetch = boolean;
|
|
68
72
|
export interface AdditionalDataOptions {
|
|
69
73
|
stats: Stats;
|
|
70
74
|
manifest?: Manifest;
|
|
@@ -174,7 +178,11 @@ export interface ModuleFederationPluginOptions {
|
|
|
174
178
|
dev?: boolean | PluginDevOptions;
|
|
175
179
|
dts?: boolean | PluginDtsOptions;
|
|
176
180
|
async?: boolean | AsyncBoundaryOptions;
|
|
181
|
+
dataPrefetch?: DataPrefetch;
|
|
177
182
|
virtualRuntimeEntry?: boolean;
|
|
183
|
+
experiments?: {
|
|
184
|
+
federationRuntime?: false | 'hoisted';
|
|
185
|
+
};
|
|
178
186
|
}
|
|
179
187
|
/**
|
|
180
188
|
* Modules that should be exposed by this container. Property names are used as public paths.
|