@module-federation/sdk 0.0.0-feat-node-support-1702930274548 → 0.3.0
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/index.cjs.js +24 -339
- package/index.esm.js +25 -338
- package/package.json +14 -4
- package/src/index.d.ts +0 -1
- package/src/node.d.ts +0 -5
package/index.cjs.js
CHANGED
|
@@ -43,13 +43,13 @@ var getProcessEnv = function getProcessEnv() {
|
|
|
43
43
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
function _array_like_to_array$
|
|
46
|
+
function _array_like_to_array$1(arr, len) {
|
|
47
47
|
if (len == null || len > arr.length) len = arr.length;
|
|
48
48
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
49
49
|
return arr2;
|
|
50
50
|
}
|
|
51
51
|
function _array_without_holes(arr) {
|
|
52
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
52
|
+
if (Array.isArray(arr)) return _array_like_to_array$1(arr);
|
|
53
53
|
}
|
|
54
54
|
function _class_call_check(instance, Constructor) {
|
|
55
55
|
if (!(instance instanceof Constructor)) {
|
|
@@ -90,15 +90,15 @@ function _non_iterable_spread() {
|
|
|
90
90
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
91
91
|
}
|
|
92
92
|
function _to_consumable_array(arr) {
|
|
93
|
-
return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$
|
|
93
|
+
return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
|
|
94
94
|
}
|
|
95
|
-
function _unsupported_iterable_to_array$
|
|
95
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
96
96
|
if (!o) return;
|
|
97
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
97
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
98
98
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
99
99
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
100
100
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
101
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
101
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
102
102
|
}
|
|
103
103
|
function safeToString(info) {
|
|
104
104
|
try {
|
|
@@ -157,18 +157,18 @@ var Logger = /*#__PURE__*/ function() {
|
|
|
157
157
|
return Logger;
|
|
158
158
|
}();
|
|
159
159
|
|
|
160
|
-
function _array_like_to_array
|
|
160
|
+
function _array_like_to_array(arr, len) {
|
|
161
161
|
if (len == null || len > arr.length) len = arr.length;
|
|
162
162
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
163
163
|
return arr2;
|
|
164
164
|
}
|
|
165
|
-
function _array_with_holes
|
|
165
|
+
function _array_with_holes(arr) {
|
|
166
166
|
if (Array.isArray(arr)) return arr;
|
|
167
167
|
}
|
|
168
168
|
function _iterable_to_array(iter) {
|
|
169
169
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
170
170
|
}
|
|
171
|
-
function _iterable_to_array_limit
|
|
171
|
+
function _iterable_to_array_limit(arr, i) {
|
|
172
172
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
173
173
|
if (_i == null) return;
|
|
174
174
|
var _arr = [];
|
|
@@ -192,22 +192,22 @@ function _iterable_to_array_limit$1(arr, i) {
|
|
|
192
192
|
}
|
|
193
193
|
return _arr;
|
|
194
194
|
}
|
|
195
|
-
function _non_iterable_rest
|
|
195
|
+
function _non_iterable_rest() {
|
|
196
196
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
197
197
|
}
|
|
198
|
-
function _sliced_to_array
|
|
199
|
-
return _array_with_holes
|
|
198
|
+
function _sliced_to_array(arr, i) {
|
|
199
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
200
200
|
}
|
|
201
201
|
function _to_array(arr) {
|
|
202
|
-
return _array_with_holes
|
|
202
|
+
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
203
203
|
}
|
|
204
|
-
function _unsupported_iterable_to_array
|
|
204
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
205
205
|
if (!o) return;
|
|
206
|
-
if (typeof o === "string") return _array_like_to_array
|
|
206
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
207
207
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
208
208
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
209
209
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
210
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array
|
|
210
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
211
211
|
}
|
|
212
212
|
var LOG_CATEGORY = "[ Federation Runtime ]";
|
|
213
213
|
// entry: name:version version : 1.0.0 | ^1.2.3
|
|
@@ -237,7 +237,7 @@ var parseEntry = function(str, devVerOrUrl) {
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
} else if (strSplit.length === 1) {
|
|
240
|
-
var _strSplit1 = _sliced_to_array
|
|
240
|
+
var _strSplit1 = _sliced_to_array(strSplit, 1), name1 = _strSplit1[0];
|
|
241
241
|
if (devVersionOrUrl && isEntry(devVersionOrUrl)) {
|
|
242
242
|
return {
|
|
243
243
|
name: name1,
|
|
@@ -513,7 +513,7 @@ function isManifestProvider(moduleInfo) {
|
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
function asyncGeneratorStep
|
|
516
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
517
517
|
try {
|
|
518
518
|
var info = gen[key](arg);
|
|
519
519
|
var value = info.value;
|
|
@@ -527,16 +527,16 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
527
527
|
Promise.resolve(value).then(_next, _throw);
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
function _async_to_generator
|
|
530
|
+
function _async_to_generator(fn) {
|
|
531
531
|
return function() {
|
|
532
532
|
var self = this, args = arguments;
|
|
533
533
|
return new Promise(function(resolve, reject) {
|
|
534
534
|
var gen = fn.apply(self, args);
|
|
535
535
|
function _next(value) {
|
|
536
|
-
asyncGeneratorStep
|
|
536
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
537
537
|
}
|
|
538
538
|
function _throw(err) {
|
|
539
|
-
asyncGeneratorStep
|
|
539
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
540
540
|
}
|
|
541
541
|
_next(undefined);
|
|
542
542
|
});
|
|
@@ -549,7 +549,7 @@ function _instanceof(left, right) {
|
|
|
549
549
|
return left instanceof right;
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
function _ts_generator
|
|
552
|
+
function _ts_generator(thisArg, body) {
|
|
553
553
|
var f, y, t, g, _ = {
|
|
554
554
|
label: 0,
|
|
555
555
|
sent: function() {
|
|
@@ -649,9 +649,9 @@ function safeWrapper(callback, disableWarn) {
|
|
|
649
649
|
return _safeWrapper.apply(this, arguments);
|
|
650
650
|
}
|
|
651
651
|
function _safeWrapper() {
|
|
652
|
-
_safeWrapper = _async_to_generator
|
|
652
|
+
_safeWrapper = _async_to_generator(function(callback, disableWarn) {
|
|
653
653
|
var res, e;
|
|
654
|
-
return _ts_generator
|
|
654
|
+
return _ts_generator(this, function(_state) {
|
|
655
655
|
switch(_state.label){
|
|
656
656
|
case 0:
|
|
657
657
|
_state.trys.push([
|
|
@@ -762,319 +762,6 @@ function loadScript(url, info) {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
function _array_like_to_array(arr, len) {
|
|
766
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
767
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
768
|
-
return arr2;
|
|
769
|
-
}
|
|
770
|
-
function _array_with_holes(arr) {
|
|
771
|
-
if (Array.isArray(arr)) return arr;
|
|
772
|
-
}
|
|
773
|
-
function asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, key, arg) {
|
|
774
|
-
try {
|
|
775
|
-
var info1 = gen[key](arg);
|
|
776
|
-
var value = info1.value;
|
|
777
|
-
} catch (error1) {
|
|
778
|
-
reject1(error1);
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
if (info1.done) {
|
|
782
|
-
resolve1(value);
|
|
783
|
-
} else {
|
|
784
|
-
Promise.resolve(value).then(_next, _throw);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function _async_to_generator(fn) {
|
|
788
|
-
return function() {
|
|
789
|
-
var self = this, args = arguments;
|
|
790
|
-
return new Promise(function(resolve1, reject1) {
|
|
791
|
-
var gen = fn.apply(self, args);
|
|
792
|
-
function _next(value) {
|
|
793
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "next", value);
|
|
794
|
-
}
|
|
795
|
-
function _throw(err1) {
|
|
796
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "throw", err1);
|
|
797
|
-
}
|
|
798
|
-
_next(undefined);
|
|
799
|
-
});
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function _iterable_to_array_limit(arr, i) {
|
|
803
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
804
|
-
if (_i == null) return;
|
|
805
|
-
var _arr = [];
|
|
806
|
-
var _n = true;
|
|
807
|
-
var _d = false;
|
|
808
|
-
var _s, _e;
|
|
809
|
-
try {
|
|
810
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
811
|
-
_arr.push(_s.value);
|
|
812
|
-
if (i && _arr.length === i) break;
|
|
813
|
-
}
|
|
814
|
-
} catch (err1) {
|
|
815
|
-
_d = true;
|
|
816
|
-
_e = err1;
|
|
817
|
-
} finally{
|
|
818
|
-
try {
|
|
819
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
820
|
-
} finally{
|
|
821
|
-
if (_d) throw _e;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
return _arr;
|
|
825
|
-
}
|
|
826
|
-
function _non_iterable_rest() {
|
|
827
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
828
|
-
}
|
|
829
|
-
function _sliced_to_array(arr, i) {
|
|
830
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
831
|
-
}
|
|
832
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
833
|
-
if (!o) return;
|
|
834
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
835
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
836
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
837
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
838
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
839
|
-
}
|
|
840
|
-
function _ts_generator(thisArg, body) {
|
|
841
|
-
var f1, y, t, g, _ = {
|
|
842
|
-
label: 0,
|
|
843
|
-
sent: function() {
|
|
844
|
-
if (t[0] & 1) throw t[1];
|
|
845
|
-
return t[1];
|
|
846
|
-
},
|
|
847
|
-
trys: [],
|
|
848
|
-
ops: []
|
|
849
|
-
};
|
|
850
|
-
return g = {
|
|
851
|
-
next: verb(0),
|
|
852
|
-
"throw": verb(1),
|
|
853
|
-
"return": verb(2)
|
|
854
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
855
|
-
return this;
|
|
856
|
-
}), g;
|
|
857
|
-
function verb(n) {
|
|
858
|
-
return function(v) {
|
|
859
|
-
return step([
|
|
860
|
-
n,
|
|
861
|
-
v
|
|
862
|
-
]);
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
function step(op) {
|
|
866
|
-
if (f1) throw new TypeError("Generator is already executing.");
|
|
867
|
-
while(_)try {
|
|
868
|
-
if (f1 = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
869
|
-
if (y = 0, t) op = [
|
|
870
|
-
op[0] & 2,
|
|
871
|
-
t.value
|
|
872
|
-
];
|
|
873
|
-
switch(op[0]){
|
|
874
|
-
case 0:
|
|
875
|
-
case 1:
|
|
876
|
-
t = op;
|
|
877
|
-
break;
|
|
878
|
-
case 4:
|
|
879
|
-
_.label++;
|
|
880
|
-
return {
|
|
881
|
-
value: op[1],
|
|
882
|
-
done: false
|
|
883
|
-
};
|
|
884
|
-
case 5:
|
|
885
|
-
_.label++;
|
|
886
|
-
y = op[1];
|
|
887
|
-
op = [
|
|
888
|
-
0
|
|
889
|
-
];
|
|
890
|
-
continue;
|
|
891
|
-
case 7:
|
|
892
|
-
op = _.ops.pop();
|
|
893
|
-
_.trys.pop();
|
|
894
|
-
continue;
|
|
895
|
-
default:
|
|
896
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
897
|
-
_ = 0;
|
|
898
|
-
continue;
|
|
899
|
-
}
|
|
900
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
901
|
-
_.label = op[1];
|
|
902
|
-
break;
|
|
903
|
-
}
|
|
904
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
905
|
-
_.label = t[1];
|
|
906
|
-
t = op;
|
|
907
|
-
break;
|
|
908
|
-
}
|
|
909
|
-
if (t && _.label < t[2]) {
|
|
910
|
-
_.label = t[2];
|
|
911
|
-
_.ops.push(op);
|
|
912
|
-
break;
|
|
913
|
-
}
|
|
914
|
-
if (t[2]) _.ops.pop();
|
|
915
|
-
_.trys.pop();
|
|
916
|
-
continue;
|
|
917
|
-
}
|
|
918
|
-
op = body.call(thisArg, _);
|
|
919
|
-
} catch (e1) {
|
|
920
|
-
op = [
|
|
921
|
-
6,
|
|
922
|
-
e1
|
|
923
|
-
];
|
|
924
|
-
y = 0;
|
|
925
|
-
} finally{
|
|
926
|
-
f1 = t = 0;
|
|
927
|
-
}
|
|
928
|
-
if (op[0] & 5) throw op[1];
|
|
929
|
-
return {
|
|
930
|
-
value: op[0] ? op[1] : void 0,
|
|
931
|
-
done: true
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
function importNodeModule(name1) {
|
|
936
|
-
if (!name1) {
|
|
937
|
-
throw new Error("import specifier is require");
|
|
938
|
-
}
|
|
939
|
-
return new Promise(function(resolve1, reject1) {
|
|
940
|
-
new Function("callbacks", 'import("'.concat(name1, '").then((res)=>{callbacks.resolve(res);}, (error)=> callbacks.reject(error))'))({
|
|
941
|
-
resolve: resolve1,
|
|
942
|
-
reject: reject1
|
|
943
|
-
});
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
947
|
-
if (createScriptHook) {
|
|
948
|
-
var hookResult = createScriptHook(url);
|
|
949
|
-
if (hookResult && typeof hookResult === "object" && "url" in hookResult) {
|
|
950
|
-
url = hookResult.url;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
var urlObj;
|
|
954
|
-
try {
|
|
955
|
-
urlObj = new URL(url);
|
|
956
|
-
} catch (e) {
|
|
957
|
-
console.error("Error constructing URL:", e);
|
|
958
|
-
cb(new Error("Invalid URL: ".concat(e)));
|
|
959
|
-
return;
|
|
960
|
-
}
|
|
961
|
-
var getFetch = function() {
|
|
962
|
-
var _ref = _async_to_generator(function() {
|
|
963
|
-
var fetchModule1;
|
|
964
|
-
return _ts_generator(this, function(_state) {
|
|
965
|
-
switch(_state.label){
|
|
966
|
-
case 0:
|
|
967
|
-
if (!(typeof fetch === "undefined")) return [
|
|
968
|
-
3,
|
|
969
|
-
2
|
|
970
|
-
];
|
|
971
|
-
return [
|
|
972
|
-
4,
|
|
973
|
-
importNodeModule("node-fetch")
|
|
974
|
-
];
|
|
975
|
-
case 1:
|
|
976
|
-
fetchModule1 = _state.sent();
|
|
977
|
-
//@ts-ignore
|
|
978
|
-
return [
|
|
979
|
-
2,
|
|
980
|
-
(fetchModule1 === null || fetchModule1 === void 0 ? void 0 : fetchModule1.default) || fetchModule1
|
|
981
|
-
];
|
|
982
|
-
case 2:
|
|
983
|
-
return [
|
|
984
|
-
2,
|
|
985
|
-
fetch
|
|
986
|
-
];
|
|
987
|
-
case 3:
|
|
988
|
-
return [
|
|
989
|
-
2
|
|
990
|
-
];
|
|
991
|
-
}
|
|
992
|
-
});
|
|
993
|
-
});
|
|
994
|
-
return function getFetch1() {
|
|
995
|
-
return _ref.apply(this, arguments);
|
|
996
|
-
};
|
|
997
|
-
}();
|
|
998
|
-
console.log("fetching", urlObj.href);
|
|
999
|
-
getFetch().then(function(f) {
|
|
1000
|
-
f(urlObj.href).then(function(res1) {
|
|
1001
|
-
return res1.text();
|
|
1002
|
-
}).then(function() {
|
|
1003
|
-
var _ref = _async_to_generator(function(data1) {
|
|
1004
|
-
var _ref, path, vm, scriptContext, urlDirname, filename, script, exportedInterface, container;
|
|
1005
|
-
return _ts_generator(this, function(_state) {
|
|
1006
|
-
switch(_state.label){
|
|
1007
|
-
case 0:
|
|
1008
|
-
return [
|
|
1009
|
-
4,
|
|
1010
|
-
Promise.all([
|
|
1011
|
-
importNodeModule("path"),
|
|
1012
|
-
importNodeModule("vm")
|
|
1013
|
-
])
|
|
1014
|
-
];
|
|
1015
|
-
case 1:
|
|
1016
|
-
_ref = _sliced_to_array.apply(void 0, [
|
|
1017
|
-
_state.sent(),
|
|
1018
|
-
2
|
|
1019
|
-
]), path = _ref[0], vm = _ref[1];
|
|
1020
|
-
scriptContext = {
|
|
1021
|
-
exports: {},
|
|
1022
|
-
module: {
|
|
1023
|
-
exports: {}
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/");
|
|
1027
|
-
filename = path.basename(urlObj.pathname);
|
|
1028
|
-
try {
|
|
1029
|
-
script = new vm.Script("(function(exports, module, require, __dirname, __filename) {".concat(data1, "\n})"), {
|
|
1030
|
-
filename: filename
|
|
1031
|
-
});
|
|
1032
|
-
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
1033
|
-
exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
1034
|
-
if (attrs && exportedInterface && attrs["globalName"]) {
|
|
1035
|
-
container = exportedInterface[attrs["globalName"]];
|
|
1036
|
-
cb(undefined, container);
|
|
1037
|
-
return [
|
|
1038
|
-
2
|
|
1039
|
-
];
|
|
1040
|
-
}
|
|
1041
|
-
cb(undefined, exportedInterface);
|
|
1042
|
-
} catch (e) {
|
|
1043
|
-
console.error("Error running script:", e);
|
|
1044
|
-
cb(new Error("Script execution error: ".concat(e)));
|
|
1045
|
-
}
|
|
1046
|
-
return [
|
|
1047
|
-
2
|
|
1048
|
-
];
|
|
1049
|
-
}
|
|
1050
|
-
});
|
|
1051
|
-
});
|
|
1052
|
-
return function(data1) {
|
|
1053
|
-
return _ref.apply(this, arguments);
|
|
1054
|
-
};
|
|
1055
|
-
}()).catch(function(err1) {
|
|
1056
|
-
console.error("Error fetching script:", err1);
|
|
1057
|
-
cb(err1);
|
|
1058
|
-
});
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
function loadScriptNode(url1, info1) {
|
|
1062
|
-
return new Promise(function(resolve1, reject1) {
|
|
1063
|
-
createScriptNode(url1, function(error1, scriptContext1) {
|
|
1064
|
-
if (error1) {
|
|
1065
|
-
reject1(error1);
|
|
1066
|
-
} else {
|
|
1067
|
-
var _info_attrs, _info_attrs1;
|
|
1068
|
-
// Handle the loaded script context as needed
|
|
1069
|
-
console.log("Script loaded successfully:", scriptContext1);
|
|
1070
|
-
var remoteEntryKey1 = (info1 === null || info1 === void 0 ? void 0 : (_info_attrs = info1.attrs) === null || _info_attrs === void 0 ? void 0 : _info_attrs["globalName"]) || "__FEDERATION_".concat(info1 === null || info1 === void 0 ? void 0 : (_info_attrs1 = info1.attrs) === null || _info_attrs1 === void 0 ? void 0 : _info_attrs1["name"], ":custom__");
|
|
1071
|
-
var entryExports1 = globalThis[remoteEntryKey1] = scriptContext1;
|
|
1072
|
-
resolve1(entryExports1);
|
|
1073
|
-
}
|
|
1074
|
-
}, info1.attrs, info1.createScriptHook);
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
765
|
exports.BROWSER_LOG_KEY = BROWSER_LOG_KEY;
|
|
1079
766
|
exports.BROWSER_LOG_VALUE = BROWSER_LOG_VALUE;
|
|
1080
767
|
exports.EncodedNameTransformMap = EncodedNameTransformMap;
|
|
@@ -1087,7 +774,6 @@ exports.SEPARATOR = SEPARATOR;
|
|
|
1087
774
|
exports.assert = assert;
|
|
1088
775
|
exports.composeKeyWithSeparator = composeKeyWithSeparator;
|
|
1089
776
|
exports.createScript = createScript;
|
|
1090
|
-
exports.createScriptNode = createScriptNode;
|
|
1091
777
|
exports.decodeName = decodeName;
|
|
1092
778
|
exports.encodeName = encodeName;
|
|
1093
779
|
exports.error = error;
|
|
@@ -1101,7 +787,6 @@ exports.isDebugMode = isDebugMode;
|
|
|
1101
787
|
exports.isManifestProvider = isManifestProvider;
|
|
1102
788
|
exports.isStaticResourcesEqual = isStaticResourcesEqual;
|
|
1103
789
|
exports.loadScript = loadScript;
|
|
1104
|
-
exports.loadScriptNode = loadScriptNode;
|
|
1105
790
|
exports.logger = logger;
|
|
1106
791
|
exports.parseEntry = parseEntry;
|
|
1107
792
|
exports.safeWrapper = safeWrapper;
|
package/index.esm.js
CHANGED
|
@@ -39,13 +39,13 @@ var getProcessEnv = function getProcessEnv() {
|
|
|
39
39
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
function _array_like_to_array$
|
|
42
|
+
function _array_like_to_array$1(arr, len) {
|
|
43
43
|
if (len == null || len > arr.length) len = arr.length;
|
|
44
44
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
45
45
|
return arr2;
|
|
46
46
|
}
|
|
47
47
|
function _array_without_holes(arr) {
|
|
48
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
48
|
+
if (Array.isArray(arr)) return _array_like_to_array$1(arr);
|
|
49
49
|
}
|
|
50
50
|
function _class_call_check(instance, Constructor) {
|
|
51
51
|
if (!(instance instanceof Constructor)) {
|
|
@@ -86,15 +86,15 @@ function _non_iterable_spread() {
|
|
|
86
86
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
87
87
|
}
|
|
88
88
|
function _to_consumable_array(arr) {
|
|
89
|
-
return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$
|
|
89
|
+
return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
|
|
90
90
|
}
|
|
91
|
-
function _unsupported_iterable_to_array$
|
|
91
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
92
92
|
if (!o) return;
|
|
93
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
93
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
94
94
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
95
95
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
96
96
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
97
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
97
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
98
98
|
}
|
|
99
99
|
function safeToString(info) {
|
|
100
100
|
try {
|
|
@@ -153,18 +153,18 @@ var Logger = /*#__PURE__*/ function() {
|
|
|
153
153
|
return Logger;
|
|
154
154
|
}();
|
|
155
155
|
|
|
156
|
-
function _array_like_to_array
|
|
156
|
+
function _array_like_to_array(arr, len) {
|
|
157
157
|
if (len == null || len > arr.length) len = arr.length;
|
|
158
158
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
159
159
|
return arr2;
|
|
160
160
|
}
|
|
161
|
-
function _array_with_holes
|
|
161
|
+
function _array_with_holes(arr) {
|
|
162
162
|
if (Array.isArray(arr)) return arr;
|
|
163
163
|
}
|
|
164
164
|
function _iterable_to_array(iter) {
|
|
165
165
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
166
166
|
}
|
|
167
|
-
function _iterable_to_array_limit
|
|
167
|
+
function _iterable_to_array_limit(arr, i) {
|
|
168
168
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
169
169
|
if (_i == null) return;
|
|
170
170
|
var _arr = [];
|
|
@@ -188,22 +188,22 @@ function _iterable_to_array_limit$1(arr, i) {
|
|
|
188
188
|
}
|
|
189
189
|
return _arr;
|
|
190
190
|
}
|
|
191
|
-
function _non_iterable_rest
|
|
191
|
+
function _non_iterable_rest() {
|
|
192
192
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
193
193
|
}
|
|
194
|
-
function _sliced_to_array
|
|
195
|
-
return _array_with_holes
|
|
194
|
+
function _sliced_to_array(arr, i) {
|
|
195
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
196
196
|
}
|
|
197
197
|
function _to_array(arr) {
|
|
198
|
-
return _array_with_holes
|
|
198
|
+
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
199
199
|
}
|
|
200
|
-
function _unsupported_iterable_to_array
|
|
200
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
201
201
|
if (!o) return;
|
|
202
|
-
if (typeof o === "string") return _array_like_to_array
|
|
202
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
203
203
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
204
204
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
205
205
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
206
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array
|
|
206
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
207
207
|
}
|
|
208
208
|
var LOG_CATEGORY = "[ Federation Runtime ]";
|
|
209
209
|
// entry: name:version version : 1.0.0 | ^1.2.3
|
|
@@ -233,7 +233,7 @@ var parseEntry = function(str, devVerOrUrl) {
|
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
235
|
} else if (strSplit.length === 1) {
|
|
236
|
-
var _strSplit1 = _sliced_to_array
|
|
236
|
+
var _strSplit1 = _sliced_to_array(strSplit, 1), name1 = _strSplit1[0];
|
|
237
237
|
if (devVersionOrUrl && isEntry(devVersionOrUrl)) {
|
|
238
238
|
return {
|
|
239
239
|
name: name1,
|
|
@@ -509,7 +509,7 @@ function isManifestProvider(moduleInfo) {
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
function asyncGeneratorStep
|
|
512
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
513
513
|
try {
|
|
514
514
|
var info = gen[key](arg);
|
|
515
515
|
var value = info.value;
|
|
@@ -523,16 +523,16 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
523
523
|
Promise.resolve(value).then(_next, _throw);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
function _async_to_generator
|
|
526
|
+
function _async_to_generator(fn) {
|
|
527
527
|
return function() {
|
|
528
528
|
var self = this, args = arguments;
|
|
529
529
|
return new Promise(function(resolve, reject) {
|
|
530
530
|
var gen = fn.apply(self, args);
|
|
531
531
|
function _next(value) {
|
|
532
|
-
asyncGeneratorStep
|
|
532
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
533
533
|
}
|
|
534
534
|
function _throw(err) {
|
|
535
|
-
asyncGeneratorStep
|
|
535
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
536
536
|
}
|
|
537
537
|
_next(undefined);
|
|
538
538
|
});
|
|
@@ -545,7 +545,7 @@ function _instanceof(left, right) {
|
|
|
545
545
|
return left instanceof right;
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
function _ts_generator
|
|
548
|
+
function _ts_generator(thisArg, body) {
|
|
549
549
|
var f, y, t, g, _ = {
|
|
550
550
|
label: 0,
|
|
551
551
|
sent: function() {
|
|
@@ -645,9 +645,9 @@ function safeWrapper(callback, disableWarn) {
|
|
|
645
645
|
return _safeWrapper.apply(this, arguments);
|
|
646
646
|
}
|
|
647
647
|
function _safeWrapper() {
|
|
648
|
-
_safeWrapper = _async_to_generator
|
|
648
|
+
_safeWrapper = _async_to_generator(function(callback, disableWarn) {
|
|
649
649
|
var res, e;
|
|
650
|
-
return _ts_generator
|
|
650
|
+
return _ts_generator(this, function(_state) {
|
|
651
651
|
switch(_state.label){
|
|
652
652
|
case 0:
|
|
653
653
|
_state.trys.push([
|
|
@@ -758,317 +758,4 @@ function loadScript(url, info) {
|
|
|
758
758
|
});
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
-
|
|
762
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
763
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
764
|
-
return arr2;
|
|
765
|
-
}
|
|
766
|
-
function _array_with_holes(arr) {
|
|
767
|
-
if (Array.isArray(arr)) return arr;
|
|
768
|
-
}
|
|
769
|
-
function asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, key, arg) {
|
|
770
|
-
try {
|
|
771
|
-
var info1 = gen[key](arg);
|
|
772
|
-
var value = info1.value;
|
|
773
|
-
} catch (error1) {
|
|
774
|
-
reject1(error1);
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
if (info1.done) {
|
|
778
|
-
resolve1(value);
|
|
779
|
-
} else {
|
|
780
|
-
Promise.resolve(value).then(_next, _throw);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
function _async_to_generator(fn) {
|
|
784
|
-
return function() {
|
|
785
|
-
var self = this, args = arguments;
|
|
786
|
-
return new Promise(function(resolve1, reject1) {
|
|
787
|
-
var gen = fn.apply(self, args);
|
|
788
|
-
function _next(value) {
|
|
789
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "next", value);
|
|
790
|
-
}
|
|
791
|
-
function _throw(err1) {
|
|
792
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "throw", err1);
|
|
793
|
-
}
|
|
794
|
-
_next(undefined);
|
|
795
|
-
});
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
function _iterable_to_array_limit(arr, i) {
|
|
799
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
800
|
-
if (_i == null) return;
|
|
801
|
-
var _arr = [];
|
|
802
|
-
var _n = true;
|
|
803
|
-
var _d = false;
|
|
804
|
-
var _s, _e;
|
|
805
|
-
try {
|
|
806
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
807
|
-
_arr.push(_s.value);
|
|
808
|
-
if (i && _arr.length === i) break;
|
|
809
|
-
}
|
|
810
|
-
} catch (err1) {
|
|
811
|
-
_d = true;
|
|
812
|
-
_e = err1;
|
|
813
|
-
} finally{
|
|
814
|
-
try {
|
|
815
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
816
|
-
} finally{
|
|
817
|
-
if (_d) throw _e;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
return _arr;
|
|
821
|
-
}
|
|
822
|
-
function _non_iterable_rest() {
|
|
823
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
824
|
-
}
|
|
825
|
-
function _sliced_to_array(arr, i) {
|
|
826
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
827
|
-
}
|
|
828
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
829
|
-
if (!o) return;
|
|
830
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
831
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
832
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
833
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
834
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
835
|
-
}
|
|
836
|
-
function _ts_generator(thisArg, body) {
|
|
837
|
-
var f1, y, t, g, _ = {
|
|
838
|
-
label: 0,
|
|
839
|
-
sent: function() {
|
|
840
|
-
if (t[0] & 1) throw t[1];
|
|
841
|
-
return t[1];
|
|
842
|
-
},
|
|
843
|
-
trys: [],
|
|
844
|
-
ops: []
|
|
845
|
-
};
|
|
846
|
-
return g = {
|
|
847
|
-
next: verb(0),
|
|
848
|
-
"throw": verb(1),
|
|
849
|
-
"return": verb(2)
|
|
850
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
851
|
-
return this;
|
|
852
|
-
}), g;
|
|
853
|
-
function verb(n) {
|
|
854
|
-
return function(v) {
|
|
855
|
-
return step([
|
|
856
|
-
n,
|
|
857
|
-
v
|
|
858
|
-
]);
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
function step(op) {
|
|
862
|
-
if (f1) throw new TypeError("Generator is already executing.");
|
|
863
|
-
while(_)try {
|
|
864
|
-
if (f1 = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
865
|
-
if (y = 0, t) op = [
|
|
866
|
-
op[0] & 2,
|
|
867
|
-
t.value
|
|
868
|
-
];
|
|
869
|
-
switch(op[0]){
|
|
870
|
-
case 0:
|
|
871
|
-
case 1:
|
|
872
|
-
t = op;
|
|
873
|
-
break;
|
|
874
|
-
case 4:
|
|
875
|
-
_.label++;
|
|
876
|
-
return {
|
|
877
|
-
value: op[1],
|
|
878
|
-
done: false
|
|
879
|
-
};
|
|
880
|
-
case 5:
|
|
881
|
-
_.label++;
|
|
882
|
-
y = op[1];
|
|
883
|
-
op = [
|
|
884
|
-
0
|
|
885
|
-
];
|
|
886
|
-
continue;
|
|
887
|
-
case 7:
|
|
888
|
-
op = _.ops.pop();
|
|
889
|
-
_.trys.pop();
|
|
890
|
-
continue;
|
|
891
|
-
default:
|
|
892
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
893
|
-
_ = 0;
|
|
894
|
-
continue;
|
|
895
|
-
}
|
|
896
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
897
|
-
_.label = op[1];
|
|
898
|
-
break;
|
|
899
|
-
}
|
|
900
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
901
|
-
_.label = t[1];
|
|
902
|
-
t = op;
|
|
903
|
-
break;
|
|
904
|
-
}
|
|
905
|
-
if (t && _.label < t[2]) {
|
|
906
|
-
_.label = t[2];
|
|
907
|
-
_.ops.push(op);
|
|
908
|
-
break;
|
|
909
|
-
}
|
|
910
|
-
if (t[2]) _.ops.pop();
|
|
911
|
-
_.trys.pop();
|
|
912
|
-
continue;
|
|
913
|
-
}
|
|
914
|
-
op = body.call(thisArg, _);
|
|
915
|
-
} catch (e1) {
|
|
916
|
-
op = [
|
|
917
|
-
6,
|
|
918
|
-
e1
|
|
919
|
-
];
|
|
920
|
-
y = 0;
|
|
921
|
-
} finally{
|
|
922
|
-
f1 = t = 0;
|
|
923
|
-
}
|
|
924
|
-
if (op[0] & 5) throw op[1];
|
|
925
|
-
return {
|
|
926
|
-
value: op[0] ? op[1] : void 0,
|
|
927
|
-
done: true
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
function importNodeModule(name1) {
|
|
932
|
-
if (!name1) {
|
|
933
|
-
throw new Error("import specifier is require");
|
|
934
|
-
}
|
|
935
|
-
return new Promise(function(resolve1, reject1) {
|
|
936
|
-
new Function("callbacks", 'import("'.concat(name1, '").then((res)=>{callbacks.resolve(res);}, (error)=> callbacks.reject(error))'))({
|
|
937
|
-
resolve: resolve1,
|
|
938
|
-
reject: reject1
|
|
939
|
-
});
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
943
|
-
if (createScriptHook) {
|
|
944
|
-
var hookResult = createScriptHook(url);
|
|
945
|
-
if (hookResult && typeof hookResult === "object" && "url" in hookResult) {
|
|
946
|
-
url = hookResult.url;
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
var urlObj;
|
|
950
|
-
try {
|
|
951
|
-
urlObj = new URL(url);
|
|
952
|
-
} catch (e) {
|
|
953
|
-
console.error("Error constructing URL:", e);
|
|
954
|
-
cb(new Error("Invalid URL: ".concat(e)));
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
var getFetch = function() {
|
|
958
|
-
var _ref = _async_to_generator(function() {
|
|
959
|
-
var fetchModule1;
|
|
960
|
-
return _ts_generator(this, function(_state) {
|
|
961
|
-
switch(_state.label){
|
|
962
|
-
case 0:
|
|
963
|
-
if (!(typeof fetch === "undefined")) return [
|
|
964
|
-
3,
|
|
965
|
-
2
|
|
966
|
-
];
|
|
967
|
-
return [
|
|
968
|
-
4,
|
|
969
|
-
importNodeModule("node-fetch")
|
|
970
|
-
];
|
|
971
|
-
case 1:
|
|
972
|
-
fetchModule1 = _state.sent();
|
|
973
|
-
//@ts-ignore
|
|
974
|
-
return [
|
|
975
|
-
2,
|
|
976
|
-
(fetchModule1 === null || fetchModule1 === void 0 ? void 0 : fetchModule1.default) || fetchModule1
|
|
977
|
-
];
|
|
978
|
-
case 2:
|
|
979
|
-
return [
|
|
980
|
-
2,
|
|
981
|
-
fetch
|
|
982
|
-
];
|
|
983
|
-
case 3:
|
|
984
|
-
return [
|
|
985
|
-
2
|
|
986
|
-
];
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
});
|
|
990
|
-
return function getFetch1() {
|
|
991
|
-
return _ref.apply(this, arguments);
|
|
992
|
-
};
|
|
993
|
-
}();
|
|
994
|
-
console.log("fetching", urlObj.href);
|
|
995
|
-
getFetch().then(function(f) {
|
|
996
|
-
f(urlObj.href).then(function(res1) {
|
|
997
|
-
return res1.text();
|
|
998
|
-
}).then(function() {
|
|
999
|
-
var _ref = _async_to_generator(function(data1) {
|
|
1000
|
-
var _ref, path, vm, scriptContext, urlDirname, filename, script, exportedInterface, container;
|
|
1001
|
-
return _ts_generator(this, function(_state) {
|
|
1002
|
-
switch(_state.label){
|
|
1003
|
-
case 0:
|
|
1004
|
-
return [
|
|
1005
|
-
4,
|
|
1006
|
-
Promise.all([
|
|
1007
|
-
importNodeModule("path"),
|
|
1008
|
-
importNodeModule("vm")
|
|
1009
|
-
])
|
|
1010
|
-
];
|
|
1011
|
-
case 1:
|
|
1012
|
-
_ref = _sliced_to_array.apply(void 0, [
|
|
1013
|
-
_state.sent(),
|
|
1014
|
-
2
|
|
1015
|
-
]), path = _ref[0], vm = _ref[1];
|
|
1016
|
-
scriptContext = {
|
|
1017
|
-
exports: {},
|
|
1018
|
-
module: {
|
|
1019
|
-
exports: {}
|
|
1020
|
-
}
|
|
1021
|
-
};
|
|
1022
|
-
urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/");
|
|
1023
|
-
filename = path.basename(urlObj.pathname);
|
|
1024
|
-
try {
|
|
1025
|
-
script = new vm.Script("(function(exports, module, require, __dirname, __filename) {".concat(data1, "\n})"), {
|
|
1026
|
-
filename: filename
|
|
1027
|
-
});
|
|
1028
|
-
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
1029
|
-
exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
1030
|
-
if (attrs && exportedInterface && attrs["globalName"]) {
|
|
1031
|
-
container = exportedInterface[attrs["globalName"]];
|
|
1032
|
-
cb(undefined, container);
|
|
1033
|
-
return [
|
|
1034
|
-
2
|
|
1035
|
-
];
|
|
1036
|
-
}
|
|
1037
|
-
cb(undefined, exportedInterface);
|
|
1038
|
-
} catch (e) {
|
|
1039
|
-
console.error("Error running script:", e);
|
|
1040
|
-
cb(new Error("Script execution error: ".concat(e)));
|
|
1041
|
-
}
|
|
1042
|
-
return [
|
|
1043
|
-
2
|
|
1044
|
-
];
|
|
1045
|
-
}
|
|
1046
|
-
});
|
|
1047
|
-
});
|
|
1048
|
-
return function(data1) {
|
|
1049
|
-
return _ref.apply(this, arguments);
|
|
1050
|
-
};
|
|
1051
|
-
}()).catch(function(err1) {
|
|
1052
|
-
console.error("Error fetching script:", err1);
|
|
1053
|
-
cb(err1);
|
|
1054
|
-
});
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1057
|
-
function loadScriptNode(url1, info1) {
|
|
1058
|
-
return new Promise(function(resolve1, reject1) {
|
|
1059
|
-
createScriptNode(url1, function(error1, scriptContext1) {
|
|
1060
|
-
if (error1) {
|
|
1061
|
-
reject1(error1);
|
|
1062
|
-
} else {
|
|
1063
|
-
var _info_attrs, _info_attrs1;
|
|
1064
|
-
// Handle the loaded script context as needed
|
|
1065
|
-
console.log("Script loaded successfully:", scriptContext1);
|
|
1066
|
-
var remoteEntryKey1 = (info1 === null || info1 === void 0 ? void 0 : (_info_attrs = info1.attrs) === null || _info_attrs === void 0 ? void 0 : _info_attrs["globalName"]) || "__FEDERATION_".concat(info1 === null || info1 === void 0 ? void 0 : (_info_attrs1 = info1.attrs) === null || _info_attrs1 === void 0 ? void 0 : _info_attrs1["name"], ":custom__");
|
|
1067
|
-
var entryExports1 = globalThis[remoteEntryKey1] = scriptContext1;
|
|
1068
|
-
resolve1(entryExports1);
|
|
1069
|
-
}
|
|
1070
|
-
}, info1.attrs, info1.createScriptHook);
|
|
1071
|
-
});
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, NameTransformMap, NameTransformSymbol, SEPARATOR, assert, composeKeyWithSeparator, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, parseEntry, safeWrapper, warn };
|
|
761
|
+
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, NameTransformMap, NameTransformSymbol, SEPARATOR, assert, composeKeyWithSeparator, createScript, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, logger, parseEntry, safeWrapper, warn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A sdk for support module federation",
|
|
6
6
|
"keywords": [
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"main": "./index.cjs.js",
|
|
16
16
|
"module": "./index.esm.js",
|
|
17
|
-
"types": "./index.cjs.d.ts",
|
|
17
|
+
"types": "./dist/index.cjs.d.ts",
|
|
18
18
|
"exports": {
|
|
19
|
-
"./package.json": "./package.json",
|
|
20
19
|
".": {
|
|
21
20
|
"module": "./index.esm.js",
|
|
22
21
|
"import": "./index.cjs.mjs",
|
|
@@ -26,6 +25,17 @@
|
|
|
26
25
|
"module": "./normalize-webpack-path.esm.js",
|
|
27
26
|
"import": "./normalize-webpack-path.cjs.mjs",
|
|
28
27
|
"default": "./normalize-webpack-path.cjs.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"typesVersions": {
|
|
32
|
+
"*": {
|
|
33
|
+
".": [
|
|
34
|
+
"./dist/index.cjs.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"normalize-webpack-path": [
|
|
37
|
+
"./dist/normalize-webpack-path.cjs.d.ts"
|
|
38
|
+
]
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
|
-
}
|
|
41
|
+
}
|
package/src/index.d.ts
CHANGED
package/src/node.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function createScriptNode(url: string, cb: (error?: Error, scriptContext?: any) => void, attrs?: Record<string, any>, createScriptHook?: (url: string) => any | void): void;
|
|
2
|
-
export declare function loadScriptNode(url: string, info: {
|
|
3
|
-
attrs?: Record<string, any>;
|
|
4
|
-
createScriptHook?: (url: string) => void;
|
|
5
|
-
}): Promise<void>;
|