@modern-js/plugin-garfish 2.14.0 → 2.16.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/CHANGELOG.md +27 -0
- package/dist/cjs/cli/index.js +224 -236
- package/dist/cjs/cli/utils.js +24 -48
- package/dist/cjs/deps/index.js +12 -35
- package/dist/cjs/index.js +26 -36
- package/dist/cjs/runtime/index.js +24 -44
- package/dist/cjs/runtime/loadable.js +46 -58
- package/dist/cjs/runtime/plugin.js +86 -82
- package/dist/cjs/runtime/useModuleApps.js +70 -56
- package/dist/cjs/runtime/utils/Context.js +18 -36
- package/dist/cjs/runtime/utils/MApp.js +88 -87
- package/dist/cjs/runtime/utils/apps.js +114 -94
- package/dist/cjs/runtime/utils/setExternal.js +23 -41
- package/dist/cjs/util.js +21 -40
- package/dist/esm/cli/index.js +409 -402
- package/dist/esm/cli/utils.js +25 -26
- package/dist/esm/deps/index.js +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/runtime/index.js +3 -4
- package/dist/esm/runtime/loadable.js +226 -210
- package/dist/esm/runtime/plugin.js +456 -426
- package/dist/esm/runtime/useModuleApps.js +49 -50
- package/dist/esm/runtime/utils/Context.js +1 -1
- package/dist/esm/runtime/utils/MApp.js +337 -316
- package/dist/esm/runtime/utils/apps.js +468 -442
- package/dist/esm/runtime/utils/setExternal.js +9 -9
- package/dist/esm/util.js +4 -5
- package/dist/esm-node/cli/index.js +209 -219
- package/dist/esm-node/cli/utils.js +15 -30
- package/dist/esm-node/deps/index.js +1 -4
- package/dist/esm-node/index.js +1 -4
- package/dist/esm-node/runtime/index.js +3 -10
- package/dist/esm-node/runtime/loadable.js +34 -31
- package/dist/esm-node/runtime/plugin.js +50 -33
- package/dist/esm-node/runtime/useModuleApps.js +12 -19
- package/dist/esm-node/runtime/utils/Context.js +2 -5
- package/dist/esm-node/runtime/utils/MApp.js +61 -40
- package/dist/esm-node/runtime/utils/apps.js +38 -44
- package/dist/esm-node/runtime/utils/setExternal.js +5 -5
- package/dist/esm-node/util.js +4 -9
- package/package.json +15 -12
|
@@ -1,317 +1,346 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length)
|
|
3
|
+
len = arr.length;
|
|
4
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
5
|
+
arr2[i] = arr[i];
|
|
6
|
+
return arr2;
|
|
5
7
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
+
function _array_without_holes(arr) {
|
|
9
|
+
if (Array.isArray(arr))
|
|
10
|
+
return _array_like_to_array(arr);
|
|
8
11
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
function _assert_this_initialized(self) {
|
|
13
|
+
if (self === void 0) {
|
|
14
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15
|
+
}
|
|
16
|
+
return self;
|
|
14
17
|
}
|
|
15
18
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
try {
|
|
20
|
+
var info = gen[key](arg);
|
|
21
|
+
var value = info.value;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
reject(error);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (info.done) {
|
|
27
|
+
resolve(value);
|
|
28
|
+
} else {
|
|
29
|
+
Promise.resolve(value).then(_next, _throw);
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
function _async_to_generator(fn) {
|
|
33
|
+
return function() {
|
|
34
|
+
var self = this, args = arguments;
|
|
35
|
+
return new Promise(function(resolve, reject) {
|
|
36
|
+
var gen = fn.apply(self, args);
|
|
37
|
+
function _next(value) {
|
|
38
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
39
|
+
}
|
|
40
|
+
function _throw(err) {
|
|
41
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
42
|
+
}
|
|
43
|
+
_next(void 0);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
43
46
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
function _class_call_check(instance, Constructor) {
|
|
48
|
+
if (!(instance instanceof Constructor)) {
|
|
49
|
+
throw new TypeError("Cannot call a class as a function");
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
52
|
function _defineProperties(target, props) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
for (var i = 0; i < props.length; i++) {
|
|
54
|
+
var descriptor = props[i];
|
|
55
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
56
|
+
descriptor.configurable = true;
|
|
57
|
+
if ("value" in descriptor)
|
|
58
|
+
descriptor.writable = true;
|
|
59
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
63
|
+
if (protoProps)
|
|
64
|
+
_defineProperties(Constructor.prototype, protoProps);
|
|
65
|
+
if (staticProps)
|
|
66
|
+
_defineProperties(Constructor, staticProps);
|
|
67
|
+
return Constructor;
|
|
62
68
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
function _define_property(obj, key, value) {
|
|
70
|
+
if (key in obj) {
|
|
71
|
+
Object.defineProperty(obj, key, {
|
|
72
|
+
value,
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
obj[key] = value;
|
|
79
|
+
}
|
|
80
|
+
return obj;
|
|
75
81
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
function _get_prototype_of(o) {
|
|
83
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
|
|
84
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
85
|
+
};
|
|
86
|
+
return _get_prototype_of(o);
|
|
81
87
|
}
|
|
82
88
|
function _inherits(subClass, superClass) {
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
90
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
91
|
+
}
|
|
92
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
93
|
+
constructor: {
|
|
94
|
+
value: subClass,
|
|
95
|
+
writable: true,
|
|
96
|
+
configurable: true
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
writable: true,
|
|
90
|
-
configurable: true
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
98
|
+
});
|
|
99
|
+
if (superClass)
|
|
100
|
+
_set_prototype_of(subClass, superClass);
|
|
94
101
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
102
|
+
function _iterable_to_array(iter) {
|
|
103
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
104
|
+
return Array.from(iter);
|
|
97
105
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
106
|
+
function _non_iterable_spread() {
|
|
107
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
108
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
ownKeys.forEach(function(key) {
|
|
111
|
-
_defineProperty(target, key, source[key]);
|
|
112
|
-
});
|
|
109
|
+
function _object_spread(target) {
|
|
110
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
111
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
112
|
+
var ownKeys2 = Object.keys(source);
|
|
113
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
114
|
+
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
115
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
116
|
+
}));
|
|
113
117
|
}
|
|
114
|
-
|
|
118
|
+
ownKeys2.forEach(function(key) {
|
|
119
|
+
_define_property(target, key, source[key]);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return target;
|
|
115
123
|
}
|
|
116
124
|
function ownKeys(object, enumerableOnly) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
keys.push.apply(keys, symbols);
|
|
125
|
+
var keys = Object.keys(object);
|
|
126
|
+
if (Object.getOwnPropertySymbols) {
|
|
127
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
128
|
+
if (enumerableOnly) {
|
|
129
|
+
symbols = symbols.filter(function(sym) {
|
|
130
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
131
|
+
});
|
|
126
132
|
}
|
|
127
|
-
|
|
133
|
+
keys.push.apply(keys, symbols);
|
|
134
|
+
}
|
|
135
|
+
return keys;
|
|
128
136
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
function _object_spread_props(target, source) {
|
|
138
|
+
source = source != null ? source : {};
|
|
139
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
140
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
141
|
+
} else {
|
|
142
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
143
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return target;
|
|
139
147
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
function _object_without_properties(source, excluded) {
|
|
149
|
+
if (source == null)
|
|
150
|
+
return {};
|
|
151
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
152
|
+
var key, i;
|
|
153
|
+
if (Object.getOwnPropertySymbols) {
|
|
154
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
155
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
156
|
+
key = sourceSymbolKeys[i];
|
|
157
|
+
if (excluded.indexOf(key) >= 0)
|
|
158
|
+
continue;
|
|
159
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
160
|
+
continue;
|
|
161
|
+
target[key] = source[key];
|
|
152
162
|
}
|
|
153
|
-
|
|
163
|
+
}
|
|
164
|
+
return target;
|
|
154
165
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
function _object_without_properties_loose(source, excluded) {
|
|
167
|
+
if (source == null)
|
|
168
|
+
return {};
|
|
169
|
+
var target = {};
|
|
170
|
+
var sourceKeys = Object.keys(source);
|
|
171
|
+
var key, i;
|
|
172
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
173
|
+
key = sourceKeys[i];
|
|
174
|
+
if (excluded.indexOf(key) >= 0)
|
|
175
|
+
continue;
|
|
176
|
+
target[key] = source[key];
|
|
177
|
+
}
|
|
178
|
+
return target;
|
|
166
179
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
180
|
+
function _possible_constructor_return(self, call) {
|
|
181
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
182
|
+
return call;
|
|
183
|
+
}
|
|
184
|
+
return _assert_this_initialized(self);
|
|
172
185
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
function _set_prototype_of(o, p) {
|
|
187
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
|
|
188
|
+
o2.__proto__ = p2;
|
|
189
|
+
return o2;
|
|
190
|
+
};
|
|
191
|
+
return _set_prototype_of(o, p);
|
|
179
192
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
193
|
+
function _to_consumable_array(arr) {
|
|
194
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
182
195
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
187
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
188
|
-
if (!o) return;
|
|
189
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
190
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
191
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
192
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
193
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
196
|
+
function _type_of(obj) {
|
|
197
|
+
"@swc/helpers - typeof";
|
|
198
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
194
199
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
201
|
+
if (!o)
|
|
202
|
+
return;
|
|
203
|
+
if (typeof o === "string")
|
|
204
|
+
return _array_like_to_array(o, minLen);
|
|
205
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
206
|
+
if (n === "Object" && o.constructor)
|
|
207
|
+
n = o.constructor.name;
|
|
208
|
+
if (n === "Map" || n === "Set")
|
|
209
|
+
return Array.from(n);
|
|
210
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
211
|
+
return _array_like_to_array(o, minLen);
|
|
205
212
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
function _is_native_reflect_construct() {
|
|
214
|
+
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
215
|
+
return false;
|
|
216
|
+
if (Reflect.construct.sham)
|
|
217
|
+
return false;
|
|
218
|
+
if (typeof Proxy === "function")
|
|
219
|
+
return true;
|
|
220
|
+
try {
|
|
221
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
222
|
+
}));
|
|
223
|
+
return true;
|
|
224
|
+
} catch (e) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
218
227
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
};
|
|
229
|
-
return(g = {
|
|
230
|
-
next: verb(0),
|
|
231
|
-
"throw": verb(1),
|
|
232
|
-
"return": verb(2)
|
|
233
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
234
|
-
return this;
|
|
235
|
-
}), g);
|
|
236
|
-
function verb(n) {
|
|
237
|
-
return function(v) {
|
|
238
|
-
return step([
|
|
239
|
-
n,
|
|
240
|
-
v
|
|
241
|
-
]);
|
|
242
|
-
};
|
|
228
|
+
function _create_super(Derived) {
|
|
229
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
230
|
+
return function _createSuperInternal() {
|
|
231
|
+
var Super = _get_prototype_of(Derived), result;
|
|
232
|
+
if (hasNativeReflectConstruct) {
|
|
233
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
234
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
235
|
+
} else {
|
|
236
|
+
result = Super.apply(this, arguments);
|
|
243
237
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
238
|
+
return _possible_constructor_return(this, result);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
var __generator = function(thisArg, body) {
|
|
242
|
+
var f, y, t, g, _ = {
|
|
243
|
+
label: 0,
|
|
244
|
+
sent: function() {
|
|
245
|
+
if (t[0] & 1)
|
|
246
|
+
throw t[1];
|
|
247
|
+
return t[1];
|
|
248
|
+
},
|
|
249
|
+
trys: [],
|
|
250
|
+
ops: []
|
|
251
|
+
};
|
|
252
|
+
return g = {
|
|
253
|
+
next: verb(0),
|
|
254
|
+
"throw": verb(1),
|
|
255
|
+
"return": verb(2)
|
|
256
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
257
|
+
return this;
|
|
258
|
+
}), g;
|
|
259
|
+
function verb(n) {
|
|
260
|
+
return function(v) {
|
|
261
|
+
return step([
|
|
262
|
+
n,
|
|
263
|
+
v
|
|
264
|
+
]);
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function step(op) {
|
|
268
|
+
if (f)
|
|
269
|
+
throw new TypeError("Generator is already executing.");
|
|
270
|
+
while (_)
|
|
271
|
+
try {
|
|
272
|
+
if (f = 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)
|
|
273
|
+
return t;
|
|
274
|
+
if (y = 0, t)
|
|
275
|
+
op = [
|
|
276
|
+
op[0] & 2,
|
|
277
|
+
t.value
|
|
278
|
+
];
|
|
279
|
+
switch (op[0]) {
|
|
280
|
+
case 0:
|
|
281
|
+
case 1:
|
|
282
|
+
t = op;
|
|
283
|
+
break;
|
|
284
|
+
case 4:
|
|
285
|
+
_.label++;
|
|
286
|
+
return {
|
|
287
|
+
value: op[1],
|
|
288
|
+
done: false
|
|
289
|
+
};
|
|
290
|
+
case 5:
|
|
291
|
+
_.label++;
|
|
292
|
+
y = op[1];
|
|
299
293
|
op = [
|
|
300
|
-
|
|
301
|
-
e
|
|
294
|
+
0
|
|
302
295
|
];
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
296
|
+
continue;
|
|
297
|
+
case 7:
|
|
298
|
+
op = _.ops.pop();
|
|
299
|
+
_.trys.pop();
|
|
300
|
+
continue;
|
|
301
|
+
default:
|
|
302
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
303
|
+
_ = 0;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
307
|
+
_.label = op[1];
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
311
|
+
_.label = t[1];
|
|
312
|
+
t = op;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
if (t && _.label < t[2]) {
|
|
316
|
+
_.label = t[2];
|
|
317
|
+
_.ops.push(op);
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
if (t[2])
|
|
321
|
+
_.ops.pop();
|
|
322
|
+
_.trys.pop();
|
|
323
|
+
continue;
|
|
306
324
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
325
|
+
op = body.call(thisArg, _);
|
|
326
|
+
} catch (e) {
|
|
327
|
+
op = [
|
|
328
|
+
6,
|
|
329
|
+
e
|
|
330
|
+
];
|
|
331
|
+
y = 0;
|
|
332
|
+
} finally {
|
|
333
|
+
f = t = 0;
|
|
334
|
+
}
|
|
335
|
+
if (op[0] & 5)
|
|
336
|
+
throw op[1];
|
|
337
|
+
return {
|
|
338
|
+
value: op[0] ? op[1] : void 0,
|
|
339
|
+
done: true
|
|
340
|
+
};
|
|
341
|
+
}
|
|
313
342
|
};
|
|
314
|
-
import { jsx } from "react/jsx-runtime";
|
|
343
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
315
344
|
import GarfishInstance from "garfish";
|
|
316
345
|
import React from "react";
|
|
317
346
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
@@ -321,159 +350,160 @@ import setExternal from "./utils/setExternal";
|
|
|
321
350
|
import { generateMApp } from "./utils/MApp";
|
|
322
351
|
import { generateApps } from "./utils/apps";
|
|
323
352
|
function initOptions() {
|
|
324
|
-
|
|
353
|
+
return _initOptions.apply(this, arguments);
|
|
325
354
|
}
|
|
326
355
|
function _initOptions() {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
logger("manifest modules", apps);
|
|
340
|
-
}
|
|
341
|
-
if (!(manifest === null || manifest === void 0 ? void 0 : manifest.getAppList)) return [
|
|
342
|
-
3,
|
|
343
|
-
2
|
|
344
|
-
];
|
|
345
|
-
return [
|
|
346
|
-
4,
|
|
347
|
-
manifest === null || manifest === void 0 ? void 0 : manifest.getAppList(manifest)
|
|
348
|
-
];
|
|
349
|
-
case 1:
|
|
350
|
-
getAppList = _state.sent();
|
|
351
|
-
if (getAppList.length > 0) {
|
|
352
|
-
apps = getAppList;
|
|
353
|
-
}
|
|
354
|
-
logger("getAppList modules", apps);
|
|
355
|
-
_state.label = 2;
|
|
356
|
-
case 2:
|
|
357
|
-
if ((window === null || window === void 0 ? void 0 : (_window_modern_manifest = window.modern_manifest) === null || _window_modern_manifest === void 0 ? void 0 : _window_modern_manifest.modules) && (window === null || window === void 0 ? void 0 : (_window_modern_manifest1 = window.modern_manifest) === null || _window_modern_manifest1 === void 0 ? void 0 : _window_modern_manifest1.modules.length) > 0) {
|
|
358
|
-
;
|
|
359
|
-
apps = window === null || window === void 0 ? void 0 : (_window_modern_manifest2 = window.modern_manifest) === null || _window_modern_manifest2 === void 0 ? void 0 : _window_modern_manifest2.modules;
|
|
360
|
-
logger("modern_manifest", apps);
|
|
361
|
-
}
|
|
362
|
-
return [
|
|
363
|
-
2,
|
|
364
|
-
_objectSpreadProps(_objectSpread({}, options), {
|
|
365
|
-
apps: apps
|
|
366
|
-
})
|
|
367
|
-
];
|
|
356
|
+
_initOptions = _async_to_generator(function() {
|
|
357
|
+
var manifest, options, _window_modern_manifest, _window_modern_manifest1, apps, getAppList, _window_modern_manifest2;
|
|
358
|
+
var _arguments = arguments;
|
|
359
|
+
return __generator(this, function(_state) {
|
|
360
|
+
switch (_state.label) {
|
|
361
|
+
case 0:
|
|
362
|
+
manifest = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, options = _arguments.length > 1 ? _arguments[1] : void 0;
|
|
363
|
+
apps = options.apps || [];
|
|
364
|
+
if (manifest === null || manifest === void 0 ? void 0 : manifest.modules) {
|
|
365
|
+
if ((manifest === null || manifest === void 0 ? void 0 : manifest.modules.length) > 0) {
|
|
366
|
+
apps = manifest === null || manifest === void 0 ? void 0 : manifest.modules;
|
|
368
367
|
}
|
|
369
|
-
|
|
368
|
+
logger("manifest modules", apps);
|
|
369
|
+
}
|
|
370
|
+
if (!(manifest === null || manifest === void 0 ? void 0 : manifest.getAppList))
|
|
371
|
+
return [
|
|
372
|
+
3,
|
|
373
|
+
2
|
|
374
|
+
];
|
|
375
|
+
return [
|
|
376
|
+
4,
|
|
377
|
+
manifest === null || manifest === void 0 ? void 0 : manifest.getAppList(manifest)
|
|
378
|
+
];
|
|
379
|
+
case 1:
|
|
380
|
+
getAppList = _state.sent();
|
|
381
|
+
if (getAppList.length > 0) {
|
|
382
|
+
apps = getAppList;
|
|
383
|
+
}
|
|
384
|
+
logger("getAppList modules", apps);
|
|
385
|
+
_state.label = 2;
|
|
386
|
+
case 2:
|
|
387
|
+
if ((window === null || window === void 0 ? void 0 : (_window_modern_manifest = window.modern_manifest) === null || _window_modern_manifest === void 0 ? void 0 : _window_modern_manifest.modules) && (window === null || window === void 0 ? void 0 : (_window_modern_manifest1 = window.modern_manifest) === null || _window_modern_manifest1 === void 0 ? void 0 : _window_modern_manifest1.modules.length) > 0) {
|
|
388
|
+
;
|
|
389
|
+
apps = window === null || window === void 0 ? void 0 : (_window_modern_manifest2 = window.modern_manifest) === null || _window_modern_manifest2 === void 0 ? void 0 : _window_modern_manifest2.modules;
|
|
390
|
+
logger("modern_manifest", apps);
|
|
391
|
+
}
|
|
392
|
+
return [
|
|
393
|
+
2,
|
|
394
|
+
_object_spread_props(_object_spread({}, options), {
|
|
395
|
+
apps
|
|
396
|
+
})
|
|
397
|
+
];
|
|
398
|
+
}
|
|
370
399
|
});
|
|
371
|
-
|
|
400
|
+
});
|
|
401
|
+
return _initOptions.apply(this, arguments);
|
|
372
402
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
]);
|
|
469
|
-
return GetMicroFrontendApp;
|
|
470
|
-
}(React.Component);
|
|
471
|
-
return next({
|
|
472
|
-
App: hoistNonReactStatics(GetMicroFrontendApp, App)
|
|
473
|
-
});
|
|
403
|
+
export default function(config) {
|
|
404
|
+
return {
|
|
405
|
+
name: "@modern-js/garfish-plugin",
|
|
406
|
+
setup: function() {
|
|
407
|
+
setExternal();
|
|
408
|
+
var manifest = config.manifest, options = _object_without_properties(config, [
|
|
409
|
+
"manifest"
|
|
410
|
+
]);
|
|
411
|
+
logger("createPlugin", config);
|
|
412
|
+
var promise = initOptions(manifest, options);
|
|
413
|
+
return {
|
|
414
|
+
hoc: function hoc(param, next) {
|
|
415
|
+
var App = param.App;
|
|
416
|
+
var GetMicroFrontendApp = /* @__PURE__ */ function(_React_Component) {
|
|
417
|
+
"use strict";
|
|
418
|
+
_inherits(GetMicroFrontendApp2, _React_Component);
|
|
419
|
+
var _super = _create_super(GetMicroFrontendApp2);
|
|
420
|
+
function GetMicroFrontendApp2(props) {
|
|
421
|
+
_class_call_check(this, GetMicroFrontendApp2);
|
|
422
|
+
var _this;
|
|
423
|
+
_this = _super.call(this, props);
|
|
424
|
+
_define_property(_assert_this_initialized(_this), "state", {
|
|
425
|
+
MApp: function() {
|
|
426
|
+
logger("MApp init Component Render");
|
|
427
|
+
return /* @__PURE__ */ React.createElement("div");
|
|
428
|
+
},
|
|
429
|
+
apps: new Proxy({}, {
|
|
430
|
+
get: function get() {
|
|
431
|
+
return function() {
|
|
432
|
+
return /* @__PURE__ */ React.createElement("div");
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}),
|
|
436
|
+
appInfoList: []
|
|
437
|
+
});
|
|
438
|
+
var _this1 = _assert_this_initialized(_this);
|
|
439
|
+
var load = function() {
|
|
440
|
+
var _ref = _async_to_generator(function() {
|
|
441
|
+
var GarfishConfig, _generateApps, appInfoList, apps, MApp;
|
|
442
|
+
return __generator(this, function(_state) {
|
|
443
|
+
switch (_state.label) {
|
|
444
|
+
case 0:
|
|
445
|
+
GarfishInstance.setOptions(_object_spread_props(_object_spread({}, options), {
|
|
446
|
+
insulationVariable: _to_consumable_array(options.insulationVariable || []).concat([
|
|
447
|
+
"_SERVER_DATA"
|
|
448
|
+
]),
|
|
449
|
+
apps: []
|
|
450
|
+
}));
|
|
451
|
+
return [
|
|
452
|
+
4,
|
|
453
|
+
promise
|
|
454
|
+
];
|
|
455
|
+
case 1:
|
|
456
|
+
GarfishConfig = _state.sent();
|
|
457
|
+
_generateApps = generateApps(GarfishConfig, manifest), appInfoList = _generateApps.appInfoList, apps = _generateApps.apps;
|
|
458
|
+
GarfishInstance.registerApp(appInfoList);
|
|
459
|
+
MApp = generateMApp(GarfishConfig, manifest);
|
|
460
|
+
logger("initOptions result", {
|
|
461
|
+
manifest,
|
|
462
|
+
GarfishConfig
|
|
463
|
+
});
|
|
464
|
+
logger("generateApps", {
|
|
465
|
+
MApp,
|
|
466
|
+
apps,
|
|
467
|
+
appInfoList
|
|
468
|
+
});
|
|
469
|
+
_this1.setState({
|
|
470
|
+
MApp,
|
|
471
|
+
apps,
|
|
472
|
+
appInfoList
|
|
473
|
+
});
|
|
474
|
+
return [
|
|
475
|
+
2
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
return function load2() {
|
|
481
|
+
return _ref.apply(this, arguments);
|
|
482
|
+
};
|
|
483
|
+
}();
|
|
484
|
+
load();
|
|
485
|
+
return _this;
|
|
486
|
+
}
|
|
487
|
+
_create_class(GetMicroFrontendApp2, [
|
|
488
|
+
{
|
|
489
|
+
key: "render",
|
|
490
|
+
value: function render() {
|
|
491
|
+
logger("GarfishProvider state", this.state);
|
|
492
|
+
return /* @__PURE__ */ _jsx(GarfishProvider, {
|
|
493
|
+
value: this.state,
|
|
494
|
+
children: /* @__PURE__ */ _jsx(App, _object_spread({}, this.props))
|
|
495
|
+
});
|
|
474
496
|
}
|
|
475
|
-
|
|
497
|
+
}
|
|
498
|
+
]);
|
|
499
|
+
return GetMicroFrontendApp2;
|
|
500
|
+
}(React.Component);
|
|
501
|
+
return next({
|
|
502
|
+
App: hoistNonReactStatics(GetMicroFrontendApp, App)
|
|
503
|
+
});
|
|
476
504
|
}
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
;
|