@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.
Files changed (41) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cjs/cli/index.js +224 -236
  3. package/dist/cjs/cli/utils.js +24 -48
  4. package/dist/cjs/deps/index.js +12 -35
  5. package/dist/cjs/index.js +26 -36
  6. package/dist/cjs/runtime/index.js +24 -44
  7. package/dist/cjs/runtime/loadable.js +46 -58
  8. package/dist/cjs/runtime/plugin.js +86 -82
  9. package/dist/cjs/runtime/useModuleApps.js +70 -56
  10. package/dist/cjs/runtime/utils/Context.js +18 -36
  11. package/dist/cjs/runtime/utils/MApp.js +88 -87
  12. package/dist/cjs/runtime/utils/apps.js +114 -94
  13. package/dist/cjs/runtime/utils/setExternal.js +23 -41
  14. package/dist/cjs/util.js +21 -40
  15. package/dist/esm/cli/index.js +409 -402
  16. package/dist/esm/cli/utils.js +25 -26
  17. package/dist/esm/deps/index.js +1 -2
  18. package/dist/esm/index.js +1 -2
  19. package/dist/esm/runtime/index.js +3 -4
  20. package/dist/esm/runtime/loadable.js +226 -210
  21. package/dist/esm/runtime/plugin.js +456 -426
  22. package/dist/esm/runtime/useModuleApps.js +49 -50
  23. package/dist/esm/runtime/utils/Context.js +1 -1
  24. package/dist/esm/runtime/utils/MApp.js +337 -316
  25. package/dist/esm/runtime/utils/apps.js +468 -442
  26. package/dist/esm/runtime/utils/setExternal.js +9 -9
  27. package/dist/esm/util.js +4 -5
  28. package/dist/esm-node/cli/index.js +209 -219
  29. package/dist/esm-node/cli/utils.js +15 -30
  30. package/dist/esm-node/deps/index.js +1 -4
  31. package/dist/esm-node/index.js +1 -4
  32. package/dist/esm-node/runtime/index.js +3 -10
  33. package/dist/esm-node/runtime/loadable.js +34 -31
  34. package/dist/esm-node/runtime/plugin.js +50 -33
  35. package/dist/esm-node/runtime/useModuleApps.js +12 -19
  36. package/dist/esm-node/runtime/utils/Context.js +2 -5
  37. package/dist/esm-node/runtime/utils/MApp.js +61 -40
  38. package/dist/esm-node/runtime/utils/apps.js +38 -44
  39. package/dist/esm-node/runtime/utils/setExternal.js +5 -5
  40. package/dist/esm-node/util.js +4 -9
  41. package/package.json +15 -12
@@ -1,317 +1,346 @@
1
- function _arrayLikeToArray(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
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 _arrayWithoutHoles(arr) {
7
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ function _array_without_holes(arr) {
9
+ if (Array.isArray(arr))
10
+ return _array_like_to_array(arr);
8
11
  }
9
- function _assertThisInitialized(self) {
10
- if (self === void 0) {
11
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12
- }
13
- return self;
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
- try {
17
- var info = gen[key](arg);
18
- var value = info.value;
19
- } catch (error) {
20
- reject(error);
21
- return;
22
- }
23
- if (info.done) {
24
- resolve(value);
25
- } else {
26
- Promise.resolve(value).then(_next, _throw);
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 _asyncToGenerator(fn) {
30
- return function() {
31
- var self = this, args = arguments;
32
- return new Promise(function(resolve, reject) {
33
- var gen = fn.apply(self, args);
34
- function _next(value) {
35
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
36
- }
37
- function _throw(err) {
38
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
39
- }
40
- _next(undefined);
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 _classCallCheck(instance, Constructor) {
45
- if (!(instance instanceof Constructor)) {
46
- throw new TypeError("Cannot call a class as a function");
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
- for(var i = 0; i < props.length; i++){
51
- var descriptor = props[i];
52
- descriptor.enumerable = descriptor.enumerable || false;
53
- descriptor.configurable = true;
54
- if ("value" in descriptor) descriptor.writable = true;
55
- Object.defineProperty(target, descriptor.key, descriptor);
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 _createClass(Constructor, protoProps, staticProps) {
59
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
60
- if (staticProps) _defineProperties(Constructor, staticProps);
61
- return Constructor;
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 _defineProperty(obj, key, value) {
64
- if (key in obj) {
65
- Object.defineProperty(obj, key, {
66
- value: value,
67
- enumerable: true,
68
- configurable: true,
69
- writable: true
70
- });
71
- } else {
72
- obj[key] = value;
73
- }
74
- return obj;
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 _getPrototypeOf(o) {
77
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
78
- return o.__proto__ || Object.getPrototypeOf(o);
79
- };
80
- return _getPrototypeOf(o);
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
- if (typeof superClass !== "function" && superClass !== null) {
84
- throw new TypeError("Super expression must either be null or a function");
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
- subClass.prototype = Object.create(superClass && superClass.prototype, {
87
- constructor: {
88
- value: subClass,
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 _iterableToArray(iter) {
96
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
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 _nonIterableSpread() {
99
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
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 _objectSpread(target) {
102
- for(var i = 1; i < arguments.length; i++){
103
- var source = arguments[i] != null ? arguments[i] : {};
104
- var ownKeys = Object.keys(source);
105
- if (typeof Object.getOwnPropertySymbols === "function") {
106
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
107
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
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
- return target;
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
- var keys = Object.keys(object);
118
- if (Object.getOwnPropertySymbols) {
119
- var symbols = Object.getOwnPropertySymbols(object);
120
- if (enumerableOnly) {
121
- symbols = symbols.filter(function(sym) {
122
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
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
- return keys;
133
+ keys.push.apply(keys, symbols);
134
+ }
135
+ return keys;
128
136
  }
129
- function _objectSpreadProps(target, source) {
130
- source = source != null ? source : {};
131
- if (Object.getOwnPropertyDescriptors) {
132
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
133
- } else {
134
- ownKeys(Object(source)).forEach(function(key) {
135
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
136
- });
137
- }
138
- return target;
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 _objectWithoutProperties(source, excluded) {
141
- if (source == null) return {};
142
- var target = _objectWithoutPropertiesLoose(source, excluded);
143
- var key, i;
144
- if (Object.getOwnPropertySymbols) {
145
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
146
- for(i = 0; i < sourceSymbolKeys.length; i++){
147
- key = sourceSymbolKeys[i];
148
- if (excluded.indexOf(key) >= 0) continue;
149
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
150
- target[key] = source[key];
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
- return target;
163
+ }
164
+ return target;
154
165
  }
155
- function _objectWithoutPropertiesLoose(source, excluded) {
156
- if (source == null) return {};
157
- var target = {};
158
- var sourceKeys = Object.keys(source);
159
- var key, i;
160
- for(i = 0; i < sourceKeys.length; i++){
161
- key = sourceKeys[i];
162
- if (excluded.indexOf(key) >= 0) continue;
163
- target[key] = source[key];
164
- }
165
- return target;
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 _possibleConstructorReturn(self, call) {
168
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
169
- return call;
170
- }
171
- return _assertThisInitialized(self);
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 _setPrototypeOf(o, p) {
174
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
175
- o.__proto__ = p;
176
- return o;
177
- };
178
- return _setPrototypeOf(o, p);
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 _toConsumableArray(arr) {
181
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
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
- var _typeof = function(obj) {
184
- "@swc/helpers - typeof";
185
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
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 _isNativeReflectConstruct() {
196
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
197
- if (Reflect.construct.sham) return false;
198
- if (typeof Proxy === "function") return true;
199
- try {
200
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
201
- return true;
202
- } catch (e) {
203
- return false;
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 _createSuper(Derived) {
207
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
208
- return function _createSuperInternal() {
209
- var Super = _getPrototypeOf(Derived), result;
210
- if (hasNativeReflectConstruct) {
211
- var NewTarget = _getPrototypeOf(this).constructor;
212
- result = Reflect.construct(Super, arguments, NewTarget);
213
- } else {
214
- result = Super.apply(this, arguments);
215
- }
216
- return _possibleConstructorReturn(this, result);
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
- var __generator = this && this.__generator || function(thisArg, body) {
220
- var f, y, t, g, _ = {
221
- label: 0,
222
- sent: function() {
223
- if (t[0] & 1) throw t[1];
224
- return t[1];
225
- },
226
- trys: [],
227
- ops: []
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
- function step(op) {
245
- if (f) throw new TypeError("Generator is already executing.");
246
- while(_)try {
247
- 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) return t;
248
- if (y = 0, t) op = [
249
- op[0] & 2,
250
- t.value
251
- ];
252
- switch(op[0]){
253
- case 0:
254
- case 1:
255
- t = op;
256
- break;
257
- case 4:
258
- _.label++;
259
- return {
260
- value: op[1],
261
- done: false
262
- };
263
- case 5:
264
- _.label++;
265
- y = op[1];
266
- op = [
267
- 0
268
- ];
269
- continue;
270
- case 7:
271
- op = _.ops.pop();
272
- _.trys.pop();
273
- continue;
274
- default:
275
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
276
- _ = 0;
277
- continue;
278
- }
279
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
280
- _.label = op[1];
281
- break;
282
- }
283
- if (op[0] === 6 && _.label < t[1]) {
284
- _.label = t[1];
285
- t = op;
286
- break;
287
- }
288
- if (t && _.label < t[2]) {
289
- _.label = t[2];
290
- _.ops.push(op);
291
- break;
292
- }
293
- if (t[2]) _.ops.pop();
294
- _.trys.pop();
295
- continue;
296
- }
297
- op = body.call(thisArg, _);
298
- } catch (e) {
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
- 6,
301
- e
294
+ 0
302
295
  ];
303
- y = 0;
304
- } finally{
305
- f = t = 0;
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
- if (op[0] & 5) throw op[1];
308
- return {
309
- value: op[0] ? op[1] : void 0,
310
- done: true
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
- return _initOptions.apply(this, arguments);
353
+ return _initOptions.apply(this, arguments);
325
354
  }
326
355
  function _initOptions() {
327
- _initOptions = _asyncToGenerator(function() {
328
- var manifest, options, _window_modern_manifest, _window_modern_manifest1, apps, getAppList, _window_modern_manifest2;
329
- var _arguments = arguments;
330
- return __generator(this, function(_state) {
331
- switch(_state.label){
332
- case 0:
333
- manifest = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, options = _arguments.length > 1 ? _arguments[1] : void 0;
334
- apps = options.apps || [];
335
- if (manifest === null || manifest === void 0 ? void 0 : manifest.modules) {
336
- if ((manifest === null || manifest === void 0 ? void 0 : manifest.modules.length) > 0) {
337
- apps = manifest === null || manifest === void 0 ? void 0 : manifest.modules;
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
- return _initOptions.apply(this, arguments);
400
+ });
401
+ return _initOptions.apply(this, arguments);
372
402
  }
373
- var plugin_default = function(config) {
374
- return {
375
- name: "@modern-js/garfish-plugin",
376
- setup: function() {
377
- setExternal();
378
- var manifest = config.manifest, options = _objectWithoutProperties(config, [
379
- "manifest"
380
- ]);
381
- logger("createPlugin", config);
382
- var promise = initOptions(manifest, options);
383
- return {
384
- hoc: function hoc(param, next) {
385
- var App = param.App;
386
- var GetMicroFrontendApp = /*#__PURE__*/ function(_React_Component) {
387
- "use strict";
388
- _inherits(GetMicroFrontendApp, _React_Component);
389
- var _super = _createSuper(GetMicroFrontendApp);
390
- function GetMicroFrontendApp(props) {
391
- _classCallCheck(this, GetMicroFrontendApp);
392
- var _this;
393
- _this = _super.call(this, props);
394
- _defineProperty(_assertThisInitialized(_this), "state", {
395
- MApp: function() {
396
- logger("MApp init Component Render");
397
- return React.createElement("div");
398
- },
399
- apps: new Proxy({}, {
400
- get: function get() {
401
- return function() {
402
- return React.createElement("div");
403
- };
404
- }
405
- }),
406
- appInfoList: []
407
- });
408
- var _this1 = _assertThisInitialized(_this);
409
- var load = function() {
410
- var _ref = _asyncToGenerator(function() {
411
- var GarfishConfig, _generateApps, appInfoList, apps, MApp;
412
- return __generator(this, function(_state) {
413
- switch(_state.label){
414
- case 0:
415
- GarfishInstance.setOptions(_objectSpreadProps(_objectSpread({}, options), {
416
- insulationVariable: _toConsumableArray(options.insulationVariable || []).concat([
417
- "_SERVER_DATA"
418
- ]),
419
- apps: []
420
- }));
421
- return [
422
- 4,
423
- promise
424
- ];
425
- case 1:
426
- GarfishConfig = _state.sent();
427
- _generateApps = generateApps(GarfishConfig, manifest), appInfoList = _generateApps.appInfoList, apps = _generateApps.apps;
428
- GarfishInstance.registerApp(appInfoList);
429
- MApp = generateMApp(GarfishConfig, manifest);
430
- logger("initOptions result", {
431
- manifest: manifest,
432
- GarfishConfig: GarfishConfig
433
- });
434
- logger("generateApps", {
435
- MApp: MApp,
436
- apps: apps,
437
- appInfoList: appInfoList
438
- });
439
- _this1.setState({
440
- MApp: MApp,
441
- apps: apps,
442
- appInfoList: appInfoList
443
- });
444
- return [
445
- 2
446
- ];
447
- }
448
- });
449
- });
450
- return function load() {
451
- return _ref.apply(this, arguments);
452
- };
453
- }();
454
- load();
455
- return _this;
456
- }
457
- _createClass(GetMicroFrontendApp, [
458
- {
459
- key: "render",
460
- value: function render() {
461
- logger("GarfishProvider state", this.state);
462
- return /* @__PURE__ */ jsx(GarfishProvider, {
463
- value: this.state,
464
- children: /* @__PURE__ */ jsx(App, _objectSpread({}, this.props))
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
- export { plugin_default as default };
505
+ };
506
+ }
507
+ };
508
+ }
509
+ ;