@module-federation/sdk 0.0.0-next-20240102063242 → 0.0.0-next-20240103035759
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 +24 -341
- package/dist/index.esm.js +25 -340
- package/dist/normalize-webpack-path.cjs.js +0 -9
- package/dist/normalize-webpack-path.esm.js +0 -9
- package/dist/src/index.d.ts +0 -1
- package/dist/src/normalize-webpack-path.d.ts +1 -3
- package/package.json +1 -1
- package/dist/src/node.d.ts +0 -5
package/dist/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,
|
|
@@ -283,9 +283,6 @@ var decodeName = function decodeName(name, prefix, withExt) {
|
|
|
283
283
|
try {
|
|
284
284
|
var decodedName = name;
|
|
285
285
|
if (prefix) {
|
|
286
|
-
if (!decodedName.startsWith(prefix)) {
|
|
287
|
-
return decodedName;
|
|
288
|
-
}
|
|
289
286
|
decodedName = decodedName.replace(new RegExp(prefix, "g"), "");
|
|
290
287
|
}
|
|
291
288
|
decodedName = decodedName.replace(new RegExp("".concat(NameTransformMap[NameTransformSymbol.AT]), "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.AT]]).replace(new RegExp("".concat(NameTransformMap[NameTransformSymbol.SLASH]), "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.SLASH]]).replace(new RegExp("".concat(NameTransformMap[NameTransformSymbol.HYPHEN]), "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.HYPHEN]]);
|
|
@@ -516,7 +513,7 @@ function isManifestProvider(moduleInfo) {
|
|
|
516
513
|
}
|
|
517
514
|
}
|
|
518
515
|
|
|
519
|
-
function asyncGeneratorStep
|
|
516
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
520
517
|
try {
|
|
521
518
|
var info = gen[key](arg);
|
|
522
519
|
var value = info.value;
|
|
@@ -530,16 +527,16 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
530
527
|
Promise.resolve(value).then(_next, _throw);
|
|
531
528
|
}
|
|
532
529
|
}
|
|
533
|
-
function _async_to_generator
|
|
530
|
+
function _async_to_generator(fn) {
|
|
534
531
|
return function() {
|
|
535
532
|
var self = this, args = arguments;
|
|
536
533
|
return new Promise(function(resolve, reject) {
|
|
537
534
|
var gen = fn.apply(self, args);
|
|
538
535
|
function _next(value) {
|
|
539
|
-
asyncGeneratorStep
|
|
536
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
540
537
|
}
|
|
541
538
|
function _throw(err) {
|
|
542
|
-
asyncGeneratorStep
|
|
539
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
543
540
|
}
|
|
544
541
|
_next(undefined);
|
|
545
542
|
});
|
|
@@ -552,7 +549,7 @@ function _instanceof(left, right) {
|
|
|
552
549
|
return left instanceof right;
|
|
553
550
|
}
|
|
554
551
|
}
|
|
555
|
-
function _ts_generator
|
|
552
|
+
function _ts_generator(thisArg, body) {
|
|
556
553
|
var f, y, t, g, _ = {
|
|
557
554
|
label: 0,
|
|
558
555
|
sent: function() {
|
|
@@ -652,9 +649,9 @@ function safeWrapper(callback, disableWarn) {
|
|
|
652
649
|
return _safeWrapper.apply(this, arguments);
|
|
653
650
|
}
|
|
654
651
|
function _safeWrapper() {
|
|
655
|
-
_safeWrapper = _async_to_generator
|
|
652
|
+
_safeWrapper = _async_to_generator(function(callback, disableWarn) {
|
|
656
653
|
var res, e;
|
|
657
|
-
return _ts_generator
|
|
654
|
+
return _ts_generator(this, function(_state) {
|
|
658
655
|
switch(_state.label){
|
|
659
656
|
case 0:
|
|
660
657
|
_state.trys.push([
|
|
@@ -765,318 +762,6 @@ function loadScript(url, info) {
|
|
|
765
762
|
});
|
|
766
763
|
}
|
|
767
764
|
|
|
768
|
-
function _array_like_to_array(arr, len) {
|
|
769
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
770
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
771
|
-
return arr2;
|
|
772
|
-
}
|
|
773
|
-
function _array_with_holes(arr) {
|
|
774
|
-
if (Array.isArray(arr)) return arr;
|
|
775
|
-
}
|
|
776
|
-
function asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, key, arg) {
|
|
777
|
-
try {
|
|
778
|
-
var info1 = gen[key](arg);
|
|
779
|
-
var value = info1.value;
|
|
780
|
-
} catch (error1) {
|
|
781
|
-
reject1(error1);
|
|
782
|
-
return;
|
|
783
|
-
}
|
|
784
|
-
if (info1.done) {
|
|
785
|
-
resolve1(value);
|
|
786
|
-
} else {
|
|
787
|
-
Promise.resolve(value).then(_next, _throw);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
function _async_to_generator(fn) {
|
|
791
|
-
return function() {
|
|
792
|
-
var self = this, args = arguments;
|
|
793
|
-
return new Promise(function(resolve1, reject1) {
|
|
794
|
-
var gen = fn.apply(self, args);
|
|
795
|
-
function _next(value) {
|
|
796
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "next", value);
|
|
797
|
-
}
|
|
798
|
-
function _throw(err1) {
|
|
799
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "throw", err1);
|
|
800
|
-
}
|
|
801
|
-
_next(undefined);
|
|
802
|
-
});
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
function _iterable_to_array_limit(arr, i) {
|
|
806
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
807
|
-
if (_i == null) return;
|
|
808
|
-
var _arr = [];
|
|
809
|
-
var _n = true;
|
|
810
|
-
var _d = false;
|
|
811
|
-
var _s, _e;
|
|
812
|
-
try {
|
|
813
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
814
|
-
_arr.push(_s.value);
|
|
815
|
-
if (i && _arr.length === i) break;
|
|
816
|
-
}
|
|
817
|
-
} catch (err1) {
|
|
818
|
-
_d = true;
|
|
819
|
-
_e = err1;
|
|
820
|
-
} finally{
|
|
821
|
-
try {
|
|
822
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
823
|
-
} finally{
|
|
824
|
-
if (_d) throw _e;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
return _arr;
|
|
828
|
-
}
|
|
829
|
-
function _non_iterable_rest() {
|
|
830
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
831
|
-
}
|
|
832
|
-
function _sliced_to_array(arr, i) {
|
|
833
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
834
|
-
}
|
|
835
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
836
|
-
if (!o) return;
|
|
837
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
838
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
839
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
840
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
841
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
842
|
-
}
|
|
843
|
-
function _ts_generator(thisArg, body) {
|
|
844
|
-
var f1, y, t, g, _ = {
|
|
845
|
-
label: 0,
|
|
846
|
-
sent: function() {
|
|
847
|
-
if (t[0] & 1) throw t[1];
|
|
848
|
-
return t[1];
|
|
849
|
-
},
|
|
850
|
-
trys: [],
|
|
851
|
-
ops: []
|
|
852
|
-
};
|
|
853
|
-
return g = {
|
|
854
|
-
next: verb(0),
|
|
855
|
-
"throw": verb(1),
|
|
856
|
-
"return": verb(2)
|
|
857
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
858
|
-
return this;
|
|
859
|
-
}), g;
|
|
860
|
-
function verb(n) {
|
|
861
|
-
return function(v) {
|
|
862
|
-
return step([
|
|
863
|
-
n,
|
|
864
|
-
v
|
|
865
|
-
]);
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
function step(op) {
|
|
869
|
-
if (f1) throw new TypeError("Generator is already executing.");
|
|
870
|
-
while(_)try {
|
|
871
|
-
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;
|
|
872
|
-
if (y = 0, t) op = [
|
|
873
|
-
op[0] & 2,
|
|
874
|
-
t.value
|
|
875
|
-
];
|
|
876
|
-
switch(op[0]){
|
|
877
|
-
case 0:
|
|
878
|
-
case 1:
|
|
879
|
-
t = op;
|
|
880
|
-
break;
|
|
881
|
-
case 4:
|
|
882
|
-
_.label++;
|
|
883
|
-
return {
|
|
884
|
-
value: op[1],
|
|
885
|
-
done: false
|
|
886
|
-
};
|
|
887
|
-
case 5:
|
|
888
|
-
_.label++;
|
|
889
|
-
y = op[1];
|
|
890
|
-
op = [
|
|
891
|
-
0
|
|
892
|
-
];
|
|
893
|
-
continue;
|
|
894
|
-
case 7:
|
|
895
|
-
op = _.ops.pop();
|
|
896
|
-
_.trys.pop();
|
|
897
|
-
continue;
|
|
898
|
-
default:
|
|
899
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
900
|
-
_ = 0;
|
|
901
|
-
continue;
|
|
902
|
-
}
|
|
903
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
904
|
-
_.label = op[1];
|
|
905
|
-
break;
|
|
906
|
-
}
|
|
907
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
908
|
-
_.label = t[1];
|
|
909
|
-
t = op;
|
|
910
|
-
break;
|
|
911
|
-
}
|
|
912
|
-
if (t && _.label < t[2]) {
|
|
913
|
-
_.label = t[2];
|
|
914
|
-
_.ops.push(op);
|
|
915
|
-
break;
|
|
916
|
-
}
|
|
917
|
-
if (t[2]) _.ops.pop();
|
|
918
|
-
_.trys.pop();
|
|
919
|
-
continue;
|
|
920
|
-
}
|
|
921
|
-
op = body.call(thisArg, _);
|
|
922
|
-
} catch (e1) {
|
|
923
|
-
op = [
|
|
924
|
-
6,
|
|
925
|
-
e1
|
|
926
|
-
];
|
|
927
|
-
y = 0;
|
|
928
|
-
} finally{
|
|
929
|
-
f1 = t = 0;
|
|
930
|
-
}
|
|
931
|
-
if (op[0] & 5) throw op[1];
|
|
932
|
-
return {
|
|
933
|
-
value: op[0] ? op[1] : void 0,
|
|
934
|
-
done: true
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
function importNodeModule(name1) {
|
|
939
|
-
if (!name1) {
|
|
940
|
-
throw new Error("import specifier is required");
|
|
941
|
-
}
|
|
942
|
-
var importModule1 = new Function("name", "return import(name)");
|
|
943
|
-
return importModule1(name1).then(function(res1) {
|
|
944
|
-
return res1.default;
|
|
945
|
-
}).catch(function(error1) {
|
|
946
|
-
console.error("Error importing module ".concat(name1, ":"), error1);
|
|
947
|
-
throw error1;
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
951
|
-
if (createScriptHook) {
|
|
952
|
-
var hookResult = createScriptHook(url);
|
|
953
|
-
if (hookResult && typeof hookResult === "object" && "url" in hookResult) {
|
|
954
|
-
url = hookResult.url;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
var urlObj;
|
|
958
|
-
try {
|
|
959
|
-
urlObj = new URL(url);
|
|
960
|
-
} catch (e) {
|
|
961
|
-
console.error("Error constructing URL:", e);
|
|
962
|
-
cb(new Error("Invalid URL: ".concat(e)));
|
|
963
|
-
return;
|
|
964
|
-
}
|
|
965
|
-
var getFetch = function() {
|
|
966
|
-
var _ref = _async_to_generator(function() {
|
|
967
|
-
var fetchModule1;
|
|
968
|
-
return _ts_generator(this, function(_state) {
|
|
969
|
-
switch(_state.label){
|
|
970
|
-
case 0:
|
|
971
|
-
if (!(typeof fetch === "undefined")) return [
|
|
972
|
-
3,
|
|
973
|
-
2
|
|
974
|
-
];
|
|
975
|
-
return [
|
|
976
|
-
4,
|
|
977
|
-
importNodeModule("node-fetch")
|
|
978
|
-
];
|
|
979
|
-
case 1:
|
|
980
|
-
fetchModule1 = _state.sent();
|
|
981
|
-
//@ts-ignore
|
|
982
|
-
return [
|
|
983
|
-
2,
|
|
984
|
-
(fetchModule1 === null || fetchModule1 === void 0 ? void 0 : fetchModule1.default) || fetchModule1
|
|
985
|
-
];
|
|
986
|
-
case 2:
|
|
987
|
-
return [
|
|
988
|
-
2,
|
|
989
|
-
fetch
|
|
990
|
-
];
|
|
991
|
-
case 3:
|
|
992
|
-
return [
|
|
993
|
-
2
|
|
994
|
-
];
|
|
995
|
-
}
|
|
996
|
-
});
|
|
997
|
-
});
|
|
998
|
-
return function getFetch1() {
|
|
999
|
-
return _ref.apply(this, arguments);
|
|
1000
|
-
};
|
|
1001
|
-
}();
|
|
1002
|
-
console.log("fetching", urlObj.href);
|
|
1003
|
-
getFetch().then(function(f) {
|
|
1004
|
-
f(urlObj.href).then(function(res1) {
|
|
1005
|
-
return res1.text();
|
|
1006
|
-
}).then(function() {
|
|
1007
|
-
var _ref = _async_to_generator(function(data1) {
|
|
1008
|
-
var _ref, path, vm, scriptContext, urlDirname, filename, script, exportedInterface, container;
|
|
1009
|
-
return _ts_generator(this, function(_state) {
|
|
1010
|
-
switch(_state.label){
|
|
1011
|
-
case 0:
|
|
1012
|
-
return [
|
|
1013
|
-
4,
|
|
1014
|
-
Promise.all([
|
|
1015
|
-
importNodeModule("path"),
|
|
1016
|
-
importNodeModule("vm")
|
|
1017
|
-
])
|
|
1018
|
-
];
|
|
1019
|
-
case 1:
|
|
1020
|
-
_ref = _sliced_to_array.apply(void 0, [
|
|
1021
|
-
_state.sent(),
|
|
1022
|
-
2
|
|
1023
|
-
]), path = _ref[0], vm = _ref[1];
|
|
1024
|
-
scriptContext = {
|
|
1025
|
-
exports: {},
|
|
1026
|
-
module: {
|
|
1027
|
-
exports: {}
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/");
|
|
1031
|
-
filename = path.basename(urlObj.pathname);
|
|
1032
|
-
try {
|
|
1033
|
-
script = new vm.Script("(function(exports, module, require, __dirname, __filename) {".concat(data1, "\n})"), {
|
|
1034
|
-
filename: filename
|
|
1035
|
-
});
|
|
1036
|
-
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
1037
|
-
exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
1038
|
-
if (attrs && exportedInterface && attrs["globalName"]) {
|
|
1039
|
-
container = exportedInterface[attrs["globalName"]];
|
|
1040
|
-
cb(undefined, container);
|
|
1041
|
-
return [
|
|
1042
|
-
2
|
|
1043
|
-
];
|
|
1044
|
-
}
|
|
1045
|
-
cb(undefined, exportedInterface);
|
|
1046
|
-
} catch (e) {
|
|
1047
|
-
// console.error('Error running script:', e);
|
|
1048
|
-
cb(new Error("Script execution error: ".concat(e)));
|
|
1049
|
-
}
|
|
1050
|
-
return [
|
|
1051
|
-
2
|
|
1052
|
-
];
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
});
|
|
1056
|
-
return function(data1) {
|
|
1057
|
-
return _ref.apply(this, arguments);
|
|
1058
|
-
};
|
|
1059
|
-
}()).catch(function(err1) {
|
|
1060
|
-
// console.error('Error fetching script:', err);
|
|
1061
|
-
cb(err1);
|
|
1062
|
-
});
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
function loadScriptNode(url1, info1) {
|
|
1066
|
-
return new Promise(function(resolve1, reject1) {
|
|
1067
|
-
createScriptNode(url1, function(error1, scriptContext1) {
|
|
1068
|
-
if (error1) {
|
|
1069
|
-
reject1(error1);
|
|
1070
|
-
} else {
|
|
1071
|
-
var _info_attrs, _info_attrs1;
|
|
1072
|
-
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__");
|
|
1073
|
-
var entryExports1 = globalThis[remoteEntryKey1] = scriptContext1;
|
|
1074
|
-
resolve1(entryExports1);
|
|
1075
|
-
}
|
|
1076
|
-
}, info1.attrs, info1.createScriptHook);
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
765
|
exports.BROWSER_LOG_KEY = BROWSER_LOG_KEY;
|
|
1081
766
|
exports.BROWSER_LOG_VALUE = BROWSER_LOG_VALUE;
|
|
1082
767
|
exports.EncodedNameTransformMap = EncodedNameTransformMap;
|
|
@@ -1089,7 +774,6 @@ exports.SEPARATOR = SEPARATOR;
|
|
|
1089
774
|
exports.assert = assert;
|
|
1090
775
|
exports.composeKeyWithSeparator = composeKeyWithSeparator;
|
|
1091
776
|
exports.createScript = createScript;
|
|
1092
|
-
exports.createScriptNode = createScriptNode;
|
|
1093
777
|
exports.decodeName = decodeName;
|
|
1094
778
|
exports.encodeName = encodeName;
|
|
1095
779
|
exports.error = error;
|
|
@@ -1103,7 +787,6 @@ exports.isDebugMode = isDebugMode;
|
|
|
1103
787
|
exports.isManifestProvider = isManifestProvider;
|
|
1104
788
|
exports.isStaticResourcesEqual = isStaticResourcesEqual;
|
|
1105
789
|
exports.loadScript = loadScript;
|
|
1106
|
-
exports.loadScriptNode = loadScriptNode;
|
|
1107
790
|
exports.logger = logger;
|
|
1108
791
|
exports.parseEntry = parseEntry;
|
|
1109
792
|
exports.safeWrapper = safeWrapper;
|
package/dist/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,
|
|
@@ -279,9 +279,6 @@ var decodeName = function decodeName(name, prefix, withExt) {
|
|
|
279
279
|
try {
|
|
280
280
|
var decodedName = name;
|
|
281
281
|
if (prefix) {
|
|
282
|
-
if (!decodedName.startsWith(prefix)) {
|
|
283
|
-
return decodedName;
|
|
284
|
-
}
|
|
285
282
|
decodedName = decodedName.replace(new RegExp(prefix, "g"), "");
|
|
286
283
|
}
|
|
287
284
|
decodedName = decodedName.replace(new RegExp("".concat(NameTransformMap[NameTransformSymbol.AT]), "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.AT]]).replace(new RegExp("".concat(NameTransformMap[NameTransformSymbol.SLASH]), "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.SLASH]]).replace(new RegExp("".concat(NameTransformMap[NameTransformSymbol.HYPHEN]), "g"), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.HYPHEN]]);
|
|
@@ -512,7 +509,7 @@ function isManifestProvider(moduleInfo) {
|
|
|
512
509
|
}
|
|
513
510
|
}
|
|
514
511
|
|
|
515
|
-
function asyncGeneratorStep
|
|
512
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
516
513
|
try {
|
|
517
514
|
var info = gen[key](arg);
|
|
518
515
|
var value = info.value;
|
|
@@ -526,16 +523,16 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
526
523
|
Promise.resolve(value).then(_next, _throw);
|
|
527
524
|
}
|
|
528
525
|
}
|
|
529
|
-
function _async_to_generator
|
|
526
|
+
function _async_to_generator(fn) {
|
|
530
527
|
return function() {
|
|
531
528
|
var self = this, args = arguments;
|
|
532
529
|
return new Promise(function(resolve, reject) {
|
|
533
530
|
var gen = fn.apply(self, args);
|
|
534
531
|
function _next(value) {
|
|
535
|
-
asyncGeneratorStep
|
|
532
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
536
533
|
}
|
|
537
534
|
function _throw(err) {
|
|
538
|
-
asyncGeneratorStep
|
|
535
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
539
536
|
}
|
|
540
537
|
_next(undefined);
|
|
541
538
|
});
|
|
@@ -548,7 +545,7 @@ function _instanceof(left, right) {
|
|
|
548
545
|
return left instanceof right;
|
|
549
546
|
}
|
|
550
547
|
}
|
|
551
|
-
function _ts_generator
|
|
548
|
+
function _ts_generator(thisArg, body) {
|
|
552
549
|
var f, y, t, g, _ = {
|
|
553
550
|
label: 0,
|
|
554
551
|
sent: function() {
|
|
@@ -648,9 +645,9 @@ function safeWrapper(callback, disableWarn) {
|
|
|
648
645
|
return _safeWrapper.apply(this, arguments);
|
|
649
646
|
}
|
|
650
647
|
function _safeWrapper() {
|
|
651
|
-
_safeWrapper = _async_to_generator
|
|
648
|
+
_safeWrapper = _async_to_generator(function(callback, disableWarn) {
|
|
652
649
|
var res, e;
|
|
653
|
-
return _ts_generator
|
|
650
|
+
return _ts_generator(this, function(_state) {
|
|
654
651
|
switch(_state.label){
|
|
655
652
|
case 0:
|
|
656
653
|
_state.trys.push([
|
|
@@ -761,316 +758,4 @@ function loadScript(url, info) {
|
|
|
761
758
|
});
|
|
762
759
|
}
|
|
763
760
|
|
|
764
|
-
|
|
765
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
766
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
767
|
-
return arr2;
|
|
768
|
-
}
|
|
769
|
-
function _array_with_holes(arr) {
|
|
770
|
-
if (Array.isArray(arr)) return arr;
|
|
771
|
-
}
|
|
772
|
-
function asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, key, arg) {
|
|
773
|
-
try {
|
|
774
|
-
var info1 = gen[key](arg);
|
|
775
|
-
var value = info1.value;
|
|
776
|
-
} catch (error1) {
|
|
777
|
-
reject1(error1);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
if (info1.done) {
|
|
781
|
-
resolve1(value);
|
|
782
|
-
} else {
|
|
783
|
-
Promise.resolve(value).then(_next, _throw);
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
function _async_to_generator(fn) {
|
|
787
|
-
return function() {
|
|
788
|
-
var self = this, args = arguments;
|
|
789
|
-
return new Promise(function(resolve1, reject1) {
|
|
790
|
-
var gen = fn.apply(self, args);
|
|
791
|
-
function _next(value) {
|
|
792
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "next", value);
|
|
793
|
-
}
|
|
794
|
-
function _throw(err1) {
|
|
795
|
-
asyncGeneratorStep(gen, resolve1, reject1, _next, _throw, "throw", err1);
|
|
796
|
-
}
|
|
797
|
-
_next(undefined);
|
|
798
|
-
});
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
function _iterable_to_array_limit(arr, i) {
|
|
802
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
803
|
-
if (_i == null) return;
|
|
804
|
-
var _arr = [];
|
|
805
|
-
var _n = true;
|
|
806
|
-
var _d = false;
|
|
807
|
-
var _s, _e;
|
|
808
|
-
try {
|
|
809
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
810
|
-
_arr.push(_s.value);
|
|
811
|
-
if (i && _arr.length === i) break;
|
|
812
|
-
}
|
|
813
|
-
} catch (err1) {
|
|
814
|
-
_d = true;
|
|
815
|
-
_e = err1;
|
|
816
|
-
} finally{
|
|
817
|
-
try {
|
|
818
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
819
|
-
} finally{
|
|
820
|
-
if (_d) throw _e;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
return _arr;
|
|
824
|
-
}
|
|
825
|
-
function _non_iterable_rest() {
|
|
826
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
827
|
-
}
|
|
828
|
-
function _sliced_to_array(arr, i) {
|
|
829
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
830
|
-
}
|
|
831
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
832
|
-
if (!o) return;
|
|
833
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
834
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
835
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
836
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
837
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
838
|
-
}
|
|
839
|
-
function _ts_generator(thisArg, body) {
|
|
840
|
-
var f1, y, t, g, _ = {
|
|
841
|
-
label: 0,
|
|
842
|
-
sent: function() {
|
|
843
|
-
if (t[0] & 1) throw t[1];
|
|
844
|
-
return t[1];
|
|
845
|
-
},
|
|
846
|
-
trys: [],
|
|
847
|
-
ops: []
|
|
848
|
-
};
|
|
849
|
-
return g = {
|
|
850
|
-
next: verb(0),
|
|
851
|
-
"throw": verb(1),
|
|
852
|
-
"return": verb(2)
|
|
853
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
854
|
-
return this;
|
|
855
|
-
}), g;
|
|
856
|
-
function verb(n) {
|
|
857
|
-
return function(v) {
|
|
858
|
-
return step([
|
|
859
|
-
n,
|
|
860
|
-
v
|
|
861
|
-
]);
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
function step(op) {
|
|
865
|
-
if (f1) throw new TypeError("Generator is already executing.");
|
|
866
|
-
while(_)try {
|
|
867
|
-
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;
|
|
868
|
-
if (y = 0, t) op = [
|
|
869
|
-
op[0] & 2,
|
|
870
|
-
t.value
|
|
871
|
-
];
|
|
872
|
-
switch(op[0]){
|
|
873
|
-
case 0:
|
|
874
|
-
case 1:
|
|
875
|
-
t = op;
|
|
876
|
-
break;
|
|
877
|
-
case 4:
|
|
878
|
-
_.label++;
|
|
879
|
-
return {
|
|
880
|
-
value: op[1],
|
|
881
|
-
done: false
|
|
882
|
-
};
|
|
883
|
-
case 5:
|
|
884
|
-
_.label++;
|
|
885
|
-
y = op[1];
|
|
886
|
-
op = [
|
|
887
|
-
0
|
|
888
|
-
];
|
|
889
|
-
continue;
|
|
890
|
-
case 7:
|
|
891
|
-
op = _.ops.pop();
|
|
892
|
-
_.trys.pop();
|
|
893
|
-
continue;
|
|
894
|
-
default:
|
|
895
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
896
|
-
_ = 0;
|
|
897
|
-
continue;
|
|
898
|
-
}
|
|
899
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
900
|
-
_.label = op[1];
|
|
901
|
-
break;
|
|
902
|
-
}
|
|
903
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
904
|
-
_.label = t[1];
|
|
905
|
-
t = op;
|
|
906
|
-
break;
|
|
907
|
-
}
|
|
908
|
-
if (t && _.label < t[2]) {
|
|
909
|
-
_.label = t[2];
|
|
910
|
-
_.ops.push(op);
|
|
911
|
-
break;
|
|
912
|
-
}
|
|
913
|
-
if (t[2]) _.ops.pop();
|
|
914
|
-
_.trys.pop();
|
|
915
|
-
continue;
|
|
916
|
-
}
|
|
917
|
-
op = body.call(thisArg, _);
|
|
918
|
-
} catch (e1) {
|
|
919
|
-
op = [
|
|
920
|
-
6,
|
|
921
|
-
e1
|
|
922
|
-
];
|
|
923
|
-
y = 0;
|
|
924
|
-
} finally{
|
|
925
|
-
f1 = t = 0;
|
|
926
|
-
}
|
|
927
|
-
if (op[0] & 5) throw op[1];
|
|
928
|
-
return {
|
|
929
|
-
value: op[0] ? op[1] : void 0,
|
|
930
|
-
done: true
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
function importNodeModule(name1) {
|
|
935
|
-
if (!name1) {
|
|
936
|
-
throw new Error("import specifier is required");
|
|
937
|
-
}
|
|
938
|
-
var importModule1 = new Function("name", "return import(name)");
|
|
939
|
-
return importModule1(name1).then(function(res1) {
|
|
940
|
-
return res1.default;
|
|
941
|
-
}).catch(function(error1) {
|
|
942
|
-
console.error("Error importing module ".concat(name1, ":"), error1);
|
|
943
|
-
throw error1;
|
|
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:', err);
|
|
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
|
-
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__");
|
|
1069
|
-
var entryExports1 = globalThis[remoteEntryKey1] = scriptContext1;
|
|
1070
|
-
resolve1(entryExports1);
|
|
1071
|
-
}
|
|
1072
|
-
}, info1.attrs, info1.createScriptHook);
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
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, simpleJoinRemoteEntry, 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, simpleJoinRemoteEntry, warn };
|
|
@@ -9,9 +9,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
10
10
|
|
|
11
11
|
function getWebpackPath(compiler) {
|
|
12
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
13
|
-
framework: "other"
|
|
14
|
-
};
|
|
15
12
|
try {
|
|
16
13
|
// @ts-ignore just throw err
|
|
17
14
|
compiler.webpack();
|
|
@@ -24,12 +21,6 @@ function getWebpackPath(compiler) {
|
|
|
24
21
|
}) || "";
|
|
25
22
|
var webpackLocationWithDetail = webpackErrLocation.replace(/[^\(\)]+/, "").slice(1, -1);
|
|
26
23
|
var webpackPath = webpackLocationWithDetail.split(":").slice(0, -2)[0];
|
|
27
|
-
if ((options === null || options === void 0 ? void 0 : options.framework) === "nextjs") {
|
|
28
|
-
if (webpackPath.endsWith("webpack.js")) {
|
|
29
|
-
return webpackPath.replace("webpack.js", "index.js");
|
|
30
|
-
}
|
|
31
|
-
return "";
|
|
32
|
-
}
|
|
33
24
|
return require.resolve("webpack", {
|
|
34
25
|
paths: [
|
|
35
26
|
webpackPath
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
|
|
3
3
|
function getWebpackPath(compiler) {
|
|
4
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
5
|
-
framework: "other"
|
|
6
|
-
};
|
|
7
4
|
try {
|
|
8
5
|
// @ts-ignore just throw err
|
|
9
6
|
compiler.webpack();
|
|
@@ -16,12 +13,6 @@ function getWebpackPath(compiler) {
|
|
|
16
13
|
}) || "";
|
|
17
14
|
var webpackLocationWithDetail = webpackErrLocation.replace(/[^\(\)]+/, "").slice(1, -1);
|
|
18
15
|
var webpackPath = webpackLocationWithDetail.split(":").slice(0, -2)[0];
|
|
19
|
-
if ((options === null || options === void 0 ? void 0 : options.framework) === "nextjs") {
|
|
20
|
-
if (webpackPath.endsWith("webpack.js")) {
|
|
21
|
-
return webpackPath.replace("webpack.js", "index.js");
|
|
22
|
-
}
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
16
|
return require.resolve("webpack", {
|
|
26
17
|
paths: [
|
|
27
18
|
webpackPath
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type webpack from 'webpack';
|
|
2
|
-
export declare function getWebpackPath(compiler: webpack.Compiler
|
|
3
|
-
framework: 'nextjs' | 'other';
|
|
4
|
-
}): string;
|
|
2
|
+
export declare function getWebpackPath(compiler: webpack.Compiler): string;
|
|
5
3
|
export declare const normalizeWebpackPath: (fullPath: string) => string;
|
package/package.json
CHANGED
package/dist/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>;
|