@module-federation/sdk 0.1.19 → 0.1.21
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
|
@@ -36,6 +36,7 @@ var MFModuleType = {
|
|
|
36
36
|
APP: 'app'
|
|
37
37
|
};
|
|
38
38
|
var MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
39
|
+
var ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
39
40
|
|
|
40
41
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
41
42
|
__proto__: null
|
|
@@ -256,6 +257,12 @@ var parseEntry = function(str, devVerOrUrl) {
|
|
|
256
257
|
// Check if the string starts with a type
|
|
257
258
|
if (strSplit.length >= 2) {
|
|
258
259
|
var _strSplit = _to_array(strSplit), name = _strSplit[0], versionOrEntryArr = _strSplit.slice(1);
|
|
260
|
+
if (str.startsWith(separator)) {
|
|
261
|
+
versionOrEntryArr = [
|
|
262
|
+
devVersionOrUrl || strSplit.slice(-1)[0]
|
|
263
|
+
];
|
|
264
|
+
name = strSplit.slice(0, -1).join(separator);
|
|
265
|
+
}
|
|
259
266
|
var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator);
|
|
260
267
|
if (isEntry(versionOrEntry)) {
|
|
261
268
|
return {
|
|
@@ -630,6 +637,10 @@ function _object_spread$1(target) {
|
|
|
630
637
|
}
|
|
631
638
|
return target;
|
|
632
639
|
}
|
|
640
|
+
function _type_of$2(obj) {
|
|
641
|
+
"@swc/helpers - typeof";
|
|
642
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
643
|
+
}
|
|
633
644
|
function _ts_generator$1(thisArg, body) {
|
|
634
645
|
var f, y, t, g, _ = {
|
|
635
646
|
label: 0,
|
|
@@ -798,7 +809,7 @@ function createScript(info) {
|
|
|
798
809
|
var createScriptRes = info.createScriptHook(info.url);
|
|
799
810
|
if (_instanceof(createScriptRes, HTMLScriptElement)) {
|
|
800
811
|
script = createScriptRes;
|
|
801
|
-
} else if (typeof createScriptRes === 'object') {
|
|
812
|
+
} else if ((typeof createScriptRes === "undefined" ? "undefined" : _type_of$2(createScriptRes)) === 'object') {
|
|
802
813
|
if (createScriptRes.script) script = createScriptRes.script;
|
|
803
814
|
if (createScriptRes.timeout) timeout = createScriptRes.timeout;
|
|
804
815
|
}
|
|
@@ -809,7 +820,8 @@ function createScript(info) {
|
|
|
809
820
|
if (script) {
|
|
810
821
|
if (name === 'async' || name === 'defer') {
|
|
811
822
|
script[name] = attrs[name];
|
|
812
|
-
|
|
823
|
+
// Attributes that do not exist are considered overridden
|
|
824
|
+
} else if (!script.getAttribute(name)) {
|
|
813
825
|
script.setAttribute(name, attrs[name]);
|
|
814
826
|
}
|
|
815
827
|
}
|
|
@@ -878,7 +890,7 @@ function createLink(info) {
|
|
|
878
890
|
var attrs = info.attrs;
|
|
879
891
|
if (attrs) {
|
|
880
892
|
Object.keys(attrs).forEach(function(name) {
|
|
881
|
-
if (link) {
|
|
893
|
+
if (link && !link.getAttribute(name)) {
|
|
882
894
|
link.setAttribute(name, attrs[name]);
|
|
883
895
|
}
|
|
884
896
|
});
|
|
@@ -996,6 +1008,10 @@ function _non_iterable_rest() {
|
|
|
996
1008
|
function _sliced_to_array(arr, i) {
|
|
997
1009
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
998
1010
|
}
|
|
1011
|
+
function _type_of$1(obj) {
|
|
1012
|
+
"@swc/helpers - typeof";
|
|
1013
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1014
|
+
}
|
|
999
1015
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
1000
1016
|
if (!o) return;
|
|
1001
1017
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -1114,7 +1130,7 @@ function importNodeModule(name) {
|
|
|
1114
1130
|
function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
1115
1131
|
if (createScriptHook) {
|
|
1116
1132
|
var hookResult = createScriptHook(url);
|
|
1117
|
-
if (hookResult && typeof hookResult === 'object' && 'url' in hookResult) {
|
|
1133
|
+
if (hookResult && (typeof hookResult === "undefined" ? "undefined" : _type_of$1(hookResult)) === 'object' && 'url' in hookResult) {
|
|
1118
1134
|
url = hookResult.url;
|
|
1119
1135
|
}
|
|
1120
1136
|
}
|
|
@@ -1286,7 +1302,7 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
1286
1302
|
if (options === true) {
|
|
1287
1303
|
return defaultOptions;
|
|
1288
1304
|
}
|
|
1289
|
-
if (options && typeof options === 'object') {
|
|
1305
|
+
if (options && (typeof options === "undefined" ? "undefined" : _type_of(options)) === 'object') {
|
|
1290
1306
|
return _object_spread({}, defaultOptions, options);
|
|
1291
1307
|
}
|
|
1292
1308
|
throw new Error("Unexpected type for `".concat(key, "`, expect boolean/undefined/object, got: ").concat(typeof options === "undefined" ? "undefined" : _type_of(options)));
|
|
@@ -1295,6 +1311,7 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
1295
1311
|
|
|
1296
1312
|
exports.BROWSER_LOG_KEY = BROWSER_LOG_KEY;
|
|
1297
1313
|
exports.BROWSER_LOG_VALUE = BROWSER_LOG_VALUE;
|
|
1314
|
+
exports.ENCODE_NAME_PREFIX = ENCODE_NAME_PREFIX;
|
|
1298
1315
|
exports.EncodedNameTransformMap = EncodedNameTransformMap;
|
|
1299
1316
|
exports.FederationModuleManifest = FederationModuleManifest;
|
|
1300
1317
|
exports.Logger = Logger;
|
package/dist/index.esm.js
CHANGED
|
@@ -32,6 +32,7 @@ var MFModuleType = {
|
|
|
32
32
|
APP: 'app'
|
|
33
33
|
};
|
|
34
34
|
var MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
35
|
+
var ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
35
36
|
|
|
36
37
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
37
38
|
__proto__: null
|
|
@@ -252,6 +253,12 @@ var parseEntry = function(str, devVerOrUrl) {
|
|
|
252
253
|
// Check if the string starts with a type
|
|
253
254
|
if (strSplit.length >= 2) {
|
|
254
255
|
var _strSplit = _to_array(strSplit), name = _strSplit[0], versionOrEntryArr = _strSplit.slice(1);
|
|
256
|
+
if (str.startsWith(separator)) {
|
|
257
|
+
versionOrEntryArr = [
|
|
258
|
+
devVersionOrUrl || strSplit.slice(-1)[0]
|
|
259
|
+
];
|
|
260
|
+
name = strSplit.slice(0, -1).join(separator);
|
|
261
|
+
}
|
|
255
262
|
var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator);
|
|
256
263
|
if (isEntry(versionOrEntry)) {
|
|
257
264
|
return {
|
|
@@ -626,6 +633,10 @@ function _object_spread$1(target) {
|
|
|
626
633
|
}
|
|
627
634
|
return target;
|
|
628
635
|
}
|
|
636
|
+
function _type_of$2(obj) {
|
|
637
|
+
"@swc/helpers - typeof";
|
|
638
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
639
|
+
}
|
|
629
640
|
function _ts_generator$1(thisArg, body) {
|
|
630
641
|
var f, y, t, g, _ = {
|
|
631
642
|
label: 0,
|
|
@@ -794,7 +805,7 @@ function createScript(info) {
|
|
|
794
805
|
var createScriptRes = info.createScriptHook(info.url);
|
|
795
806
|
if (_instanceof(createScriptRes, HTMLScriptElement)) {
|
|
796
807
|
script = createScriptRes;
|
|
797
|
-
} else if (typeof createScriptRes === 'object') {
|
|
808
|
+
} else if ((typeof createScriptRes === "undefined" ? "undefined" : _type_of$2(createScriptRes)) === 'object') {
|
|
798
809
|
if (createScriptRes.script) script = createScriptRes.script;
|
|
799
810
|
if (createScriptRes.timeout) timeout = createScriptRes.timeout;
|
|
800
811
|
}
|
|
@@ -805,7 +816,8 @@ function createScript(info) {
|
|
|
805
816
|
if (script) {
|
|
806
817
|
if (name === 'async' || name === 'defer') {
|
|
807
818
|
script[name] = attrs[name];
|
|
808
|
-
|
|
819
|
+
// Attributes that do not exist are considered overridden
|
|
820
|
+
} else if (!script.getAttribute(name)) {
|
|
809
821
|
script.setAttribute(name, attrs[name]);
|
|
810
822
|
}
|
|
811
823
|
}
|
|
@@ -874,7 +886,7 @@ function createLink(info) {
|
|
|
874
886
|
var attrs = info.attrs;
|
|
875
887
|
if (attrs) {
|
|
876
888
|
Object.keys(attrs).forEach(function(name) {
|
|
877
|
-
if (link) {
|
|
889
|
+
if (link && !link.getAttribute(name)) {
|
|
878
890
|
link.setAttribute(name, attrs[name]);
|
|
879
891
|
}
|
|
880
892
|
});
|
|
@@ -992,6 +1004,10 @@ function _non_iterable_rest() {
|
|
|
992
1004
|
function _sliced_to_array(arr, i) {
|
|
993
1005
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
994
1006
|
}
|
|
1007
|
+
function _type_of$1(obj) {
|
|
1008
|
+
"@swc/helpers - typeof";
|
|
1009
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1010
|
+
}
|
|
995
1011
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
996
1012
|
if (!o) return;
|
|
997
1013
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -1110,7 +1126,7 @@ function importNodeModule(name) {
|
|
|
1110
1126
|
function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
1111
1127
|
if (createScriptHook) {
|
|
1112
1128
|
var hookResult = createScriptHook(url);
|
|
1113
|
-
if (hookResult && typeof hookResult === 'object' && 'url' in hookResult) {
|
|
1129
|
+
if (hookResult && (typeof hookResult === "undefined" ? "undefined" : _type_of$1(hookResult)) === 'object' && 'url' in hookResult) {
|
|
1114
1130
|
url = hookResult.url;
|
|
1115
1131
|
}
|
|
1116
1132
|
}
|
|
@@ -1282,11 +1298,11 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
1282
1298
|
if (options === true) {
|
|
1283
1299
|
return defaultOptions;
|
|
1284
1300
|
}
|
|
1285
|
-
if (options && typeof options === 'object') {
|
|
1301
|
+
if (options && (typeof options === "undefined" ? "undefined" : _type_of(options)) === 'object') {
|
|
1286
1302
|
return _object_spread({}, defaultOptions, options);
|
|
1287
1303
|
}
|
|
1288
1304
|
throw new Error("Unexpected type for `".concat(key, "`, expect boolean/undefined/object, got: ").concat(typeof options === "undefined" ? "undefined" : _type_of(options)));
|
|
1289
1305
|
};
|
|
1290
1306
|
}
|
|
1291
1307
|
|
|
1292
|
-
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, 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 };
|
|
1308
|
+
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 };
|
package/dist/package.json
CHANGED
package/dist/src/constant.d.ts
CHANGED