@doracli/rollup 0.0.2 → 0.0.4
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/lib/cjs/index.js +1505 -660
- package/lib/esm/index.js +1533 -669
- package/lib/type/index.d.ts +228 -118
- package/package.json +13 -13
package/lib/cjs/index.js
CHANGED
|
@@ -20,7 +20,8 @@ var postcss = require('rollup-plugin-postcss');
|
|
|
20
20
|
var resolve = require('@rollup/plugin-node-resolve');
|
|
21
21
|
var presetBabel = require('@doracli/preset-babel');
|
|
22
22
|
|
|
23
|
-
var _documentCurrentScript =
|
|
23
|
+
var _documentCurrentScript =
|
|
24
|
+
typeof document !== 'undefined' ? document.currentScript : null;
|
|
24
25
|
function _arrayLikeToArray(r, a) {
|
|
25
26
|
(null == a || a > r.length) && (a = r.length);
|
|
26
27
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -33,7 +34,10 @@ function _arrayWithoutHoles(r) {
|
|
|
33
34
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
34
35
|
}
|
|
35
36
|
function _assertThisInitialized(e) {
|
|
36
|
-
if (void 0 === e)
|
|
37
|
+
if (void 0 === e)
|
|
38
|
+
throw new ReferenceError(
|
|
39
|
+
"this hasn't been initialised - super() hasn't been called"
|
|
40
|
+
);
|
|
37
41
|
return e;
|
|
38
42
|
}
|
|
39
43
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
@@ -52,70 +56,108 @@ function _asyncToGenerator(n) {
|
|
|
52
56
|
return new Promise(function (r, o) {
|
|
53
57
|
var a = n.apply(t, e);
|
|
54
58
|
function _next(n) {
|
|
55
|
-
asyncGeneratorStep(a, r, o, _next, _throw,
|
|
59
|
+
asyncGeneratorStep(a, r, o, _next, _throw, 'next', n);
|
|
56
60
|
}
|
|
57
61
|
function _throw(n) {
|
|
58
|
-
asyncGeneratorStep(a, r, o, _next, _throw,
|
|
62
|
+
asyncGeneratorStep(a, r, o, _next, _throw, 'throw', n);
|
|
59
63
|
}
|
|
60
64
|
_next(void 0);
|
|
61
65
|
});
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
function _callSuper(t, o, e) {
|
|
65
|
-
return
|
|
69
|
+
return (
|
|
70
|
+
(o = _getPrototypeOf(o)),
|
|
71
|
+
_possibleConstructorReturn(
|
|
72
|
+
t,
|
|
73
|
+
_isNativeReflectConstruct()
|
|
74
|
+
? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor)
|
|
75
|
+
: o.apply(t, e)
|
|
76
|
+
)
|
|
77
|
+
);
|
|
66
78
|
}
|
|
67
79
|
function _classCallCheck(a, n) {
|
|
68
|
-
if (!(a instanceof n))
|
|
80
|
+
if (!(a instanceof n))
|
|
81
|
+
throw new TypeError('Cannot call a class as a function');
|
|
69
82
|
}
|
|
70
83
|
function _defineProperties(e, r) {
|
|
71
84
|
for (var t = 0; t < r.length; t++) {
|
|
72
85
|
var o = r[t];
|
|
73
|
-
o.enumerable = o.enumerable || false
|
|
86
|
+
((o.enumerable = o.enumerable || false),
|
|
87
|
+
(o.configurable = true),
|
|
88
|
+
'value' in o && (o.writable = true),
|
|
89
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o));
|
|
74
90
|
}
|
|
75
91
|
}
|
|
76
92
|
function _createClass(e, r, t) {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
93
|
+
return (
|
|
94
|
+
r && _defineProperties(e.prototype, r),
|
|
95
|
+
Object.defineProperty(e, 'prototype', {
|
|
96
|
+
writable: false,
|
|
97
|
+
}),
|
|
98
|
+
e
|
|
99
|
+
);
|
|
80
100
|
}
|
|
81
101
|
function _defineProperty(e, r, t) {
|
|
82
|
-
return (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
102
|
+
return (
|
|
103
|
+
(r = _toPropertyKey(r)) in e
|
|
104
|
+
? Object.defineProperty(e, r, {
|
|
105
|
+
value: t,
|
|
106
|
+
enumerable: true,
|
|
107
|
+
configurable: true,
|
|
108
|
+
writable: true,
|
|
109
|
+
})
|
|
110
|
+
: (e[r] = t),
|
|
111
|
+
e
|
|
112
|
+
);
|
|
88
113
|
}
|
|
89
114
|
function _getPrototypeOf(t) {
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
115
|
+
return (
|
|
116
|
+
(_getPrototypeOf = Object.setPrototypeOf
|
|
117
|
+
? Object.getPrototypeOf.bind()
|
|
118
|
+
: function (t) {
|
|
119
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
120
|
+
}),
|
|
121
|
+
_getPrototypeOf(t)
|
|
122
|
+
);
|
|
93
123
|
}
|
|
94
124
|
function _inherits(t, e) {
|
|
95
|
-
if (
|
|
96
|
-
|
|
125
|
+
if ('function' != typeof e && null !== e)
|
|
126
|
+
throw new TypeError('Super expression must either be null or a function');
|
|
127
|
+
((t.prototype = Object.create(e && e.prototype, {
|
|
97
128
|
constructor: {
|
|
98
129
|
value: t,
|
|
99
130
|
writable: true,
|
|
100
|
-
configurable: true
|
|
101
|
-
}
|
|
102
|
-
}),
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
configurable: true,
|
|
132
|
+
},
|
|
133
|
+
})),
|
|
134
|
+
Object.defineProperty(t, 'prototype', {
|
|
135
|
+
writable: false,
|
|
136
|
+
}),
|
|
137
|
+
e && _setPrototypeOf(t, e));
|
|
105
138
|
}
|
|
106
139
|
function _isNativeReflectConstruct() {
|
|
107
140
|
try {
|
|
108
|
-
var t = !Boolean.prototype.valueOf.call(
|
|
141
|
+
var t = !Boolean.prototype.valueOf.call(
|
|
142
|
+
Reflect.construct(Boolean, [], function () {})
|
|
143
|
+
);
|
|
109
144
|
} catch (t) {}
|
|
110
145
|
return (_isNativeReflectConstruct = function () {
|
|
111
146
|
return !!t;
|
|
112
147
|
})();
|
|
113
148
|
}
|
|
114
149
|
function _iterableToArray(r) {
|
|
115
|
-
if (
|
|
150
|
+
if (
|
|
151
|
+
('undefined' != typeof Symbol && null != r[Symbol.iterator]) ||
|
|
152
|
+
null != r['@@iterator']
|
|
153
|
+
)
|
|
154
|
+
return Array.from(r);
|
|
116
155
|
}
|
|
117
156
|
function _iterableToArrayLimit(r, l) {
|
|
118
|
-
var t =
|
|
157
|
+
var t =
|
|
158
|
+
null == r
|
|
159
|
+
? null
|
|
160
|
+
: ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
|
|
119
161
|
if (null != t) {
|
|
120
162
|
var e,
|
|
121
163
|
n,
|
|
@@ -125,12 +167,19 @@ function _iterableToArrayLimit(r, l) {
|
|
|
125
167
|
f = true,
|
|
126
168
|
o = false;
|
|
127
169
|
try {
|
|
128
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
170
|
+
if (((i = (t = t.call(r)).next), 0 === l));
|
|
171
|
+
else
|
|
172
|
+
for (
|
|
173
|
+
;
|
|
174
|
+
!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l);
|
|
175
|
+
f = !0
|
|
176
|
+
);
|
|
129
177
|
} catch (r) {
|
|
130
|
-
o = true, n = r;
|
|
178
|
+
((o = true), (n = r));
|
|
131
179
|
} finally {
|
|
132
180
|
try {
|
|
133
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u))
|
|
181
|
+
if (!f && null != t.return && ((u = t.return()), Object(u) !== u))
|
|
182
|
+
return;
|
|
134
183
|
} finally {
|
|
135
184
|
if (o) throw n;
|
|
136
185
|
}
|
|
@@ -139,29 +188,39 @@ function _iterableToArrayLimit(r, l) {
|
|
|
139
188
|
}
|
|
140
189
|
}
|
|
141
190
|
function _nonIterableRest() {
|
|
142
|
-
throw new TypeError(
|
|
191
|
+
throw new TypeError(
|
|
192
|
+
'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
|
|
193
|
+
);
|
|
143
194
|
}
|
|
144
195
|
function _nonIterableSpread() {
|
|
145
|
-
throw new TypeError(
|
|
196
|
+
throw new TypeError(
|
|
197
|
+
'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
|
|
198
|
+
);
|
|
146
199
|
}
|
|
147
200
|
function ownKeys(e, r) {
|
|
148
201
|
var t = Object.keys(e);
|
|
149
202
|
if (Object.getOwnPropertySymbols) {
|
|
150
203
|
var o = Object.getOwnPropertySymbols(e);
|
|
151
|
-
r &&
|
|
152
|
-
|
|
153
|
-
|
|
204
|
+
(r &&
|
|
205
|
+
(o = o.filter(function (r) {
|
|
206
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
207
|
+
})),
|
|
208
|
+
t.push.apply(t, o));
|
|
154
209
|
}
|
|
155
210
|
return t;
|
|
156
211
|
}
|
|
157
212
|
function _objectSpread2(e) {
|
|
158
213
|
for (var r = 1; r < arguments.length; r++) {
|
|
159
214
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
160
|
-
r % 2
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
215
|
+
r % 2
|
|
216
|
+
? ownKeys(Object(t), true).forEach(function (r) {
|
|
217
|
+
_defineProperty(e, r, t[r]);
|
|
218
|
+
})
|
|
219
|
+
: Object.getOwnPropertyDescriptors
|
|
220
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
221
|
+
: ownKeys(Object(t)).forEach(function (r) {
|
|
222
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
223
|
+
});
|
|
165
224
|
}
|
|
166
225
|
return e;
|
|
167
226
|
}
|
|
@@ -172,162 +231,258 @@ function _objectWithoutProperties(e, t) {
|
|
|
172
231
|
i = _objectWithoutPropertiesLoose(e, t);
|
|
173
232
|
if (Object.getOwnPropertySymbols) {
|
|
174
233
|
var n = Object.getOwnPropertySymbols(e);
|
|
175
|
-
for (r = 0; r < n.length; r++)
|
|
234
|
+
for (r = 0; r < n.length; r++)
|
|
235
|
+
((o = n[r]),
|
|
236
|
+
-1 === t.indexOf(o) &&
|
|
237
|
+
{}.propertyIsEnumerable.call(e, o) &&
|
|
238
|
+
(i[o] = e[o]));
|
|
176
239
|
}
|
|
177
240
|
return i;
|
|
178
241
|
}
|
|
179
242
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
180
243
|
if (null == r) return {};
|
|
181
244
|
var t = {};
|
|
182
|
-
for (var n in r)
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
245
|
+
for (var n in r)
|
|
246
|
+
if ({}.hasOwnProperty.call(r, n)) {
|
|
247
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
248
|
+
t[n] = r[n];
|
|
249
|
+
}
|
|
186
250
|
return t;
|
|
187
251
|
}
|
|
188
252
|
function _possibleConstructorReturn(t, e) {
|
|
189
|
-
if (e && (
|
|
190
|
-
if (void 0 !== e)
|
|
253
|
+
if (e && ('object' == typeof e || 'function' == typeof e)) return e;
|
|
254
|
+
if (void 0 !== e)
|
|
255
|
+
throw new TypeError(
|
|
256
|
+
'Derived constructors may only return object or undefined'
|
|
257
|
+
);
|
|
191
258
|
return _assertThisInitialized(t);
|
|
192
259
|
}
|
|
193
260
|
function _regenerator() {
|
|
194
261
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
195
262
|
var e,
|
|
196
263
|
t,
|
|
197
|
-
r =
|
|
198
|
-
n = r.iterator ||
|
|
199
|
-
o = r.toStringTag ||
|
|
264
|
+
r = 'function' == typeof Symbol ? Symbol : {},
|
|
265
|
+
n = r.iterator || '@@iterator',
|
|
266
|
+
o = r.toStringTag || '@@toStringTag';
|
|
200
267
|
function i(r, n, o, i) {
|
|
201
268
|
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
202
269
|
u = Object.create(c.prototype);
|
|
203
|
-
return
|
|
204
|
-
|
|
205
|
-
c,
|
|
270
|
+
return (
|
|
271
|
+
_regeneratorDefine(
|
|
206
272
|
u,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
273
|
+
'_invoke',
|
|
274
|
+
(function (r, n, o) {
|
|
275
|
+
var i,
|
|
276
|
+
c,
|
|
277
|
+
u,
|
|
278
|
+
f = 0,
|
|
279
|
+
p = o || [],
|
|
280
|
+
y = false,
|
|
281
|
+
G = {
|
|
282
|
+
p: 0,
|
|
283
|
+
n: 0,
|
|
284
|
+
v: e,
|
|
285
|
+
a: d,
|
|
286
|
+
f: d.bind(e, 4),
|
|
287
|
+
d: function (t, r) {
|
|
288
|
+
return ((i = t), (c = 0), (u = e), (G.n = r), a);
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
function d(r, n) {
|
|
292
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
293
|
+
var o,
|
|
294
|
+
i = p[t],
|
|
295
|
+
d = G.p,
|
|
296
|
+
l = i[2];
|
|
297
|
+
r > 3
|
|
298
|
+
? (o = l === n) &&
|
|
299
|
+
((u = i[(c = i[4]) ? 5 : ((c = 3), 3)]), (i[4] = i[5] = e))
|
|
300
|
+
: i[0] <= d &&
|
|
301
|
+
((o = r < 2 && d < i[1])
|
|
302
|
+
? ((c = 0), (G.v = n), (G.n = i[1]))
|
|
303
|
+
: d < l &&
|
|
304
|
+
(o = r < 3 || i[0] > n || n > l) &&
|
|
305
|
+
((i[4] = r), (i[5] = n), (G.n = l), (c = 0)));
|
|
306
|
+
}
|
|
307
|
+
if (o || r > 1) return a;
|
|
308
|
+
throw ((y = true), n);
|
|
218
309
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
310
|
+
return function (o, p, l) {
|
|
311
|
+
if (f > 1) throw TypeError('Generator is already running');
|
|
312
|
+
for (
|
|
313
|
+
y && 1 === p && d(p, l), c = p, u = l;
|
|
314
|
+
(t = c < 2 ? e : u) || !y;
|
|
315
|
+
|
|
316
|
+
) {
|
|
317
|
+
i ||
|
|
318
|
+
(c
|
|
319
|
+
? c < 3
|
|
320
|
+
? (c > 1 && (G.n = -1), d(c, u))
|
|
321
|
+
: (G.n = u)
|
|
322
|
+
: (G.v = u));
|
|
323
|
+
try {
|
|
324
|
+
if (((f = 2), i)) {
|
|
325
|
+
if ((c || (o = 'next'), (t = i[o]))) {
|
|
326
|
+
if (!(t = t.call(i, u)))
|
|
327
|
+
throw TypeError('iterator result is not an object');
|
|
328
|
+
if (!t.done) return t;
|
|
329
|
+
((u = t.value), c < 2 && (c = 0));
|
|
330
|
+
} else
|
|
331
|
+
(1 === c && (t = i.return) && t.call(i),
|
|
332
|
+
c < 2 &&
|
|
333
|
+
((u = TypeError(
|
|
334
|
+
"The iterator does not provide a '" + o + "' method"
|
|
335
|
+
)),
|
|
336
|
+
(c = 1)));
|
|
337
|
+
i = e;
|
|
338
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
339
|
+
} catch (t) {
|
|
340
|
+
((i = e), (c = 1), (u = t));
|
|
341
|
+
} finally {
|
|
342
|
+
f = 1;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
value: t,
|
|
347
|
+
done: y,
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
})(r, o, i),
|
|
351
|
+
true
|
|
352
|
+
),
|
|
353
|
+
u
|
|
354
|
+
);
|
|
256
355
|
}
|
|
257
356
|
var a = {};
|
|
258
357
|
function Generator() {}
|
|
259
358
|
function GeneratorFunction() {}
|
|
260
359
|
function GeneratorFunctionPrototype() {}
|
|
261
360
|
t = Object.getPrototypeOf;
|
|
262
|
-
var c = [][n]
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
361
|
+
var c = [][n]
|
|
362
|
+
? t(t([][n]()))
|
|
363
|
+
: (_regeneratorDefine((t = {}), n, function () {
|
|
364
|
+
return this;
|
|
365
|
+
}),
|
|
366
|
+
t),
|
|
367
|
+
u =
|
|
368
|
+
(GeneratorFunctionPrototype.prototype =
|
|
369
|
+
Generator.prototype =
|
|
370
|
+
Object.create(c));
|
|
266
371
|
function f(e) {
|
|
267
|
-
return
|
|
372
|
+
return (
|
|
373
|
+
Object.setPrototypeOf
|
|
374
|
+
? Object.setPrototypeOf(e, GeneratorFunctionPrototype)
|
|
375
|
+
: ((e.__proto__ = GeneratorFunctionPrototype),
|
|
376
|
+
_regeneratorDefine(e, o, 'GeneratorFunction')),
|
|
377
|
+
(e.prototype = Object.create(u)),
|
|
378
|
+
e
|
|
379
|
+
);
|
|
268
380
|
}
|
|
269
|
-
return
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
381
|
+
return (
|
|
382
|
+
(GeneratorFunction.prototype = GeneratorFunctionPrototype),
|
|
383
|
+
_regeneratorDefine(u, 'constructor', GeneratorFunctionPrototype),
|
|
384
|
+
_regeneratorDefine(
|
|
385
|
+
GeneratorFunctionPrototype,
|
|
386
|
+
'constructor',
|
|
387
|
+
GeneratorFunction
|
|
388
|
+
),
|
|
389
|
+
(GeneratorFunction.displayName = 'GeneratorFunction'),
|
|
390
|
+
_regeneratorDefine(GeneratorFunctionPrototype, o, 'GeneratorFunction'),
|
|
391
|
+
_regeneratorDefine(u),
|
|
392
|
+
_regeneratorDefine(u, o, 'Generator'),
|
|
393
|
+
_regeneratorDefine(u, n, function () {
|
|
394
|
+
return this;
|
|
395
|
+
}),
|
|
396
|
+
_regeneratorDefine(u, 'toString', function () {
|
|
397
|
+
return '[object Generator]';
|
|
398
|
+
}),
|
|
399
|
+
(_regenerator = function () {
|
|
400
|
+
return {
|
|
401
|
+
w: i,
|
|
402
|
+
m: f,
|
|
403
|
+
};
|
|
404
|
+
})()
|
|
405
|
+
);
|
|
279
406
|
}
|
|
280
407
|
function _regeneratorDefine(e, r, n, t) {
|
|
281
408
|
var i = Object.defineProperty;
|
|
282
409
|
try {
|
|
283
|
-
i({},
|
|
410
|
+
i({}, '', {});
|
|
284
411
|
} catch (e) {
|
|
285
412
|
i = 0;
|
|
286
413
|
}
|
|
287
|
-
_regeneratorDefine = function (e, r, n, t) {
|
|
414
|
+
((_regeneratorDefine = function (e, r, n, t) {
|
|
288
415
|
function o(r, n) {
|
|
289
416
|
_regeneratorDefine(e, r, function (e) {
|
|
290
417
|
return this._invoke(r, n, e);
|
|
291
418
|
});
|
|
292
419
|
}
|
|
293
|
-
r
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
420
|
+
r
|
|
421
|
+
? i
|
|
422
|
+
? i(e, r, {
|
|
423
|
+
value: n,
|
|
424
|
+
enumerable: !t,
|
|
425
|
+
configurable: !t,
|
|
426
|
+
writable: !t,
|
|
427
|
+
})
|
|
428
|
+
: (e[r] = n)
|
|
429
|
+
: (o('next', 0), o('throw', 1), o('return', 2));
|
|
430
|
+
}),
|
|
431
|
+
_regeneratorDefine(e, r, n, t));
|
|
300
432
|
}
|
|
301
433
|
function _setPrototypeOf(t, e) {
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
|
|
434
|
+
return (
|
|
435
|
+
(_setPrototypeOf = Object.setPrototypeOf
|
|
436
|
+
? Object.setPrototypeOf.bind()
|
|
437
|
+
: function (t, e) {
|
|
438
|
+
return ((t.__proto__ = e), t);
|
|
439
|
+
}),
|
|
440
|
+
_setPrototypeOf(t, e)
|
|
441
|
+
);
|
|
305
442
|
}
|
|
306
443
|
function _slicedToArray(r, e) {
|
|
307
|
-
return
|
|
444
|
+
return (
|
|
445
|
+
_arrayWithHoles(r) ||
|
|
446
|
+
_iterableToArrayLimit(r, e) ||
|
|
447
|
+
_unsupportedIterableToArray(r, e) ||
|
|
448
|
+
_nonIterableRest()
|
|
449
|
+
);
|
|
308
450
|
}
|
|
309
451
|
function _toConsumableArray(r) {
|
|
310
|
-
return
|
|
452
|
+
return (
|
|
453
|
+
_arrayWithoutHoles(r) ||
|
|
454
|
+
_iterableToArray(r) ||
|
|
455
|
+
_unsupportedIterableToArray(r) ||
|
|
456
|
+
_nonIterableSpread()
|
|
457
|
+
);
|
|
311
458
|
}
|
|
312
459
|
function _toPrimitive(t, r) {
|
|
313
|
-
if (
|
|
460
|
+
if ('object' != typeof t || !t) return t;
|
|
314
461
|
var e = t[Symbol.toPrimitive];
|
|
315
462
|
if (void 0 !== e) {
|
|
316
463
|
var i = e.call(t, r);
|
|
317
|
-
if (
|
|
318
|
-
throw new TypeError(
|
|
464
|
+
if ('object' != typeof i) return i;
|
|
465
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
319
466
|
}
|
|
320
|
-
return (
|
|
467
|
+
return ('string' === r ? String : Number)(t);
|
|
321
468
|
}
|
|
322
469
|
function _toPropertyKey(t) {
|
|
323
|
-
var i = _toPrimitive(t,
|
|
324
|
-
return
|
|
470
|
+
var i = _toPrimitive(t, 'string');
|
|
471
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
325
472
|
}
|
|
326
473
|
function _unsupportedIterableToArray(r, a) {
|
|
327
474
|
if (r) {
|
|
328
|
-
if (
|
|
475
|
+
if ('string' == typeof r) return _arrayLikeToArray(r, a);
|
|
329
476
|
var t = {}.toString.call(r).slice(8, -1);
|
|
330
|
-
return
|
|
477
|
+
return (
|
|
478
|
+
'Object' === t && r.constructor && (t = r.constructor.name),
|
|
479
|
+
'Map' === t || 'Set' === t
|
|
480
|
+
? Array.from(r)
|
|
481
|
+
: 'Arguments' === t ||
|
|
482
|
+
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
483
|
+
? _arrayLikeToArray(r, a)
|
|
484
|
+
: void 0
|
|
485
|
+
);
|
|
331
486
|
}
|
|
332
487
|
}
|
|
333
488
|
|
|
@@ -337,216 +492,293 @@ var mergeRollupOptions = function mergeRollupOptions(first, second) {
|
|
|
337
492
|
return _objectSpread2(_objectSpread2({}, first), second);
|
|
338
493
|
};
|
|
339
494
|
|
|
340
|
-
var Compiler = /*#__PURE__*/function (_CompilerBase) {
|
|
495
|
+
var Compiler = /*#__PURE__*/ (function (_CompilerBase) {
|
|
341
496
|
function Compiler() {
|
|
342
497
|
var _this;
|
|
343
498
|
_classCallCheck(this, Compiler);
|
|
344
|
-
for (
|
|
499
|
+
for (
|
|
500
|
+
var _len = arguments.length, args = new Array(_len), _key = 0;
|
|
501
|
+
_key < _len;
|
|
502
|
+
_key++
|
|
503
|
+
) {
|
|
345
504
|
args[_key] = arguments[_key];
|
|
346
505
|
}
|
|
347
506
|
_this = _callSuper(this, Compiler, [].concat(args));
|
|
348
|
-
_defineProperty(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
507
|
+
_defineProperty(
|
|
508
|
+
_this,
|
|
509
|
+
'context',
|
|
510
|
+
/*#__PURE__*/ (function () {
|
|
511
|
+
var _ref = _asyncToGenerator(
|
|
512
|
+
/*#__PURE__*/ _regenerator().m(function _callee3(options) {
|
|
513
|
+
var rollupBuild, outputList;
|
|
514
|
+
return _regenerator().w(function (_context3) {
|
|
515
|
+
while (1)
|
|
516
|
+
switch (_context3.n) {
|
|
517
|
+
case 0:
|
|
518
|
+
_context3.n = 1;
|
|
519
|
+
return rollup.rollup(
|
|
520
|
+
mergeRollupOptions(_this.initOptions, options)
|
|
521
|
+
);
|
|
522
|
+
case 1:
|
|
523
|
+
rollupBuild = _context3.v;
|
|
524
|
+
outputList = [];
|
|
525
|
+
if (options.output) {
|
|
526
|
+
outputList = lang.isArray(options.output)
|
|
527
|
+
? options.output
|
|
528
|
+
: [options.output];
|
|
529
|
+
}
|
|
530
|
+
return _context3.a(
|
|
531
|
+
2,
|
|
532
|
+
Promise.resolve({
|
|
533
|
+
rebuild: (function () {
|
|
534
|
+
var _rebuild = _asyncToGenerator(
|
|
535
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
536
|
+
var outputOptions, i, output, writeRes;
|
|
537
|
+
return _regenerator().w(function (_context) {
|
|
538
|
+
while (1)
|
|
539
|
+
switch (_context.n) {
|
|
540
|
+
case 0:
|
|
541
|
+
outputOptions = [];
|
|
542
|
+
i = 0;
|
|
543
|
+
case 1:
|
|
544
|
+
if (!(i < outputList.length)) {
|
|
545
|
+
_context.n = 4;
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
output = outputList[i];
|
|
549
|
+
_context.n = 2;
|
|
550
|
+
return rollupBuild.write(output);
|
|
551
|
+
case 2:
|
|
552
|
+
writeRes = _context.v;
|
|
553
|
+
outputOptions.push(writeRes);
|
|
554
|
+
case 3:
|
|
555
|
+
i++;
|
|
556
|
+
_context.n = 1;
|
|
557
|
+
break;
|
|
558
|
+
case 4:
|
|
559
|
+
return _context.a(
|
|
560
|
+
2,
|
|
561
|
+
Promise.resolve({
|
|
562
|
+
rollupBuild: rollupBuild,
|
|
563
|
+
outputOptions: outputOptions,
|
|
564
|
+
})
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
}, _callee);
|
|
568
|
+
})
|
|
569
|
+
);
|
|
570
|
+
function rebuild() {
|
|
571
|
+
return _rebuild.apply(this, arguments);
|
|
375
572
|
}
|
|
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
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
573
|
+
return rebuild;
|
|
574
|
+
})(),
|
|
575
|
+
cancel: (function () {
|
|
576
|
+
var _cancel = _asyncToGenerator(
|
|
577
|
+
/*#__PURE__*/ _regenerator().m(function _callee2() {
|
|
578
|
+
return _regenerator().w(function (_context2) {
|
|
579
|
+
while (1)
|
|
580
|
+
switch (_context2.n) {
|
|
581
|
+
case 0:
|
|
582
|
+
helper.cLog.warn(
|
|
583
|
+
'build',
|
|
584
|
+
'empty',
|
|
585
|
+
'Rollup does not need to be canceled.'
|
|
586
|
+
);
|
|
587
|
+
case 1:
|
|
588
|
+
return _context2.a(2);
|
|
589
|
+
}
|
|
590
|
+
}, _callee2);
|
|
591
|
+
})
|
|
592
|
+
);
|
|
593
|
+
function cancel() {
|
|
594
|
+
return _cancel.apply(this, arguments);
|
|
595
|
+
}
|
|
596
|
+
return cancel;
|
|
597
|
+
})(),
|
|
598
|
+
})
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
}, _callee3);
|
|
602
|
+
})
|
|
603
|
+
);
|
|
604
|
+
return function (_x) {
|
|
605
|
+
return _ref.apply(this, arguments);
|
|
606
|
+
};
|
|
607
|
+
})()
|
|
608
|
+
);
|
|
609
|
+
_defineProperty(
|
|
610
|
+
_this,
|
|
611
|
+
'inOutMap',
|
|
612
|
+
/*#__PURE__*/ (function () {
|
|
613
|
+
var _ref2 = _asyncToGenerator(
|
|
614
|
+
/*#__PURE__*/ _regenerator().m(function _callee4(inputOutputMap) {
|
|
615
|
+
var input;
|
|
616
|
+
return _regenerator().w(function (_context4) {
|
|
617
|
+
while (1)
|
|
618
|
+
switch (_context4.n) {
|
|
619
|
+
case 0:
|
|
620
|
+
input = {};
|
|
621
|
+
Object.entries(inputOutputMap).forEach(function (_ref3) {
|
|
622
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
623
|
+
input = _ref4[0],
|
|
624
|
+
output = _ref4[1];
|
|
625
|
+
input[output] = input;
|
|
626
|
+
});
|
|
627
|
+
return _context4.a(
|
|
628
|
+
2,
|
|
629
|
+
_this.build({
|
|
630
|
+
input: input,
|
|
631
|
+
})
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
}, _callee4);
|
|
635
|
+
})
|
|
636
|
+
);
|
|
637
|
+
return function (_x2) {
|
|
638
|
+
return _ref2.apply(this, arguments);
|
|
639
|
+
};
|
|
640
|
+
})()
|
|
641
|
+
);
|
|
642
|
+
_defineProperty(
|
|
643
|
+
_this,
|
|
644
|
+
'input',
|
|
645
|
+
/*#__PURE__*/ (function () {
|
|
646
|
+
var _ref5 = _asyncToGenerator(
|
|
647
|
+
/*#__PURE__*/ _regenerator().m(function _callee6(input) {
|
|
648
|
+
var rollupBuild;
|
|
649
|
+
return _regenerator().w(function (_context6) {
|
|
650
|
+
while (1)
|
|
651
|
+
switch (_context6.n) {
|
|
652
|
+
case 0:
|
|
653
|
+
_context6.n = 1;
|
|
654
|
+
return rollup.rollup(
|
|
655
|
+
mergeRollupOptions(_this.initOptions, {
|
|
656
|
+
input: input || _this.initOptions.input,
|
|
657
|
+
})
|
|
658
|
+
);
|
|
659
|
+
case 1:
|
|
660
|
+
rollupBuild = _context6.v;
|
|
661
|
+
return _context6.a(2, {
|
|
662
|
+
output: (function () {
|
|
663
|
+
var _output2 = _asyncToGenerator(
|
|
664
|
+
/*#__PURE__*/ _regenerator().m(
|
|
665
|
+
function _callee5(_output) {
|
|
666
|
+
var writeRes;
|
|
667
|
+
return _regenerator().w(function (_context5) {
|
|
668
|
+
while (1)
|
|
669
|
+
switch (_context5.n) {
|
|
670
|
+
case 0:
|
|
671
|
+
_context5.n = 1;
|
|
672
|
+
return rollupBuild.write(_output);
|
|
673
|
+
case 1:
|
|
674
|
+
writeRes = _context5.v;
|
|
675
|
+
return _context5.a(2, {
|
|
676
|
+
rollupBuild: rollupBuild,
|
|
677
|
+
outputOption: writeRes,
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}, _callee5);
|
|
681
|
+
}
|
|
682
|
+
)
|
|
683
|
+
);
|
|
684
|
+
function output(_x4) {
|
|
685
|
+
return _output2.apply(this, arguments);
|
|
686
|
+
}
|
|
687
|
+
return output;
|
|
688
|
+
})(),
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
}, _callee6);
|
|
692
|
+
})
|
|
693
|
+
);
|
|
694
|
+
return function (_x3) {
|
|
695
|
+
return _ref5.apply(this, arguments);
|
|
696
|
+
};
|
|
697
|
+
})()
|
|
698
|
+
);
|
|
699
|
+
_defineProperty(
|
|
700
|
+
_this,
|
|
701
|
+
'build',
|
|
702
|
+
/*#__PURE__*/ (function () {
|
|
703
|
+
var _ref6 = _asyncToGenerator(
|
|
704
|
+
/*#__PURE__*/ _regenerator().m(function _callee7(options) {
|
|
705
|
+
var rollupBuild, outputList, outputOptions, i, output, writeRes;
|
|
706
|
+
return _regenerator().w(function (_context7) {
|
|
707
|
+
while (1)
|
|
708
|
+
switch (_context7.n) {
|
|
709
|
+
case 0:
|
|
710
|
+
_context7.n = 1;
|
|
711
|
+
return rollup.rollup(
|
|
712
|
+
mergeRollupOptions(_this.initOptions, options)
|
|
713
|
+
);
|
|
714
|
+
case 1:
|
|
715
|
+
rollupBuild = _context7.v;
|
|
716
|
+
outputList = [];
|
|
717
|
+
if (options.output) {
|
|
718
|
+
outputList = lang.isArray(options.output)
|
|
719
|
+
? options.output
|
|
720
|
+
: [options.output];
|
|
721
|
+
}
|
|
722
|
+
outputOptions = [];
|
|
723
|
+
i = 0;
|
|
724
|
+
case 2:
|
|
725
|
+
if (!(i < outputList.length)) {
|
|
726
|
+
_context7.n = 5;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
output = outputList[i];
|
|
730
|
+
_context7.n = 3;
|
|
731
|
+
return rollupBuild.write(output);
|
|
732
|
+
case 3:
|
|
733
|
+
writeRes = _context7.v;
|
|
734
|
+
outputOptions.push(writeRes);
|
|
735
|
+
case 4:
|
|
736
|
+
i++;
|
|
737
|
+
_context7.n = 2;
|
|
738
|
+
break;
|
|
739
|
+
case 5:
|
|
740
|
+
return _context7.a(2, {
|
|
741
|
+
rollupBuild: rollupBuild,
|
|
742
|
+
outputOptions: outputOptions,
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
}, _callee7);
|
|
746
|
+
})
|
|
747
|
+
);
|
|
748
|
+
return function (_x5) {
|
|
749
|
+
return _ref6.apply(this, arguments);
|
|
750
|
+
};
|
|
751
|
+
})()
|
|
752
|
+
);
|
|
753
|
+
_defineProperty(_this, 'watch', function (options) {
|
|
533
754
|
var watchOptions = mergeRollupOptions(_this.initOptions, options);
|
|
534
755
|
return rollup.watch(watchOptions);
|
|
535
756
|
});
|
|
536
|
-
_defineProperty(
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
757
|
+
_defineProperty(
|
|
758
|
+
_this,
|
|
759
|
+
'server',
|
|
760
|
+
/*#__PURE__*/ _asyncToGenerator(
|
|
761
|
+
/*#__PURE__*/ _regenerator().m(function _callee8() {
|
|
762
|
+
return _regenerator().w(function (_context8) {
|
|
763
|
+
while (1)
|
|
764
|
+
switch (_context8.n) {
|
|
765
|
+
case 0:
|
|
766
|
+
helper.cLog.warn(
|
|
767
|
+
'serve',
|
|
768
|
+
'empty',
|
|
769
|
+
'Rollup does not support serve functionality.'
|
|
770
|
+
);
|
|
771
|
+
return _context8.a(2);
|
|
772
|
+
}
|
|
773
|
+
}, _callee8);
|
|
774
|
+
})
|
|
775
|
+
)
|
|
776
|
+
);
|
|
545
777
|
return _this;
|
|
546
778
|
}
|
|
547
779
|
_inherits(Compiler, _CompilerBase);
|
|
548
780
|
return _createClass(Compiler);
|
|
549
|
-
}(helper.CompilerBase);
|
|
781
|
+
})(helper.CompilerBase);
|
|
550
782
|
|
|
551
783
|
/**
|
|
552
784
|
* 获取external配置
|
|
@@ -565,17 +797,26 @@ var getExternal = function getExternal(_envParams, options) {
|
|
|
565
797
|
if (filter) return filter;
|
|
566
798
|
|
|
567
799
|
// 需要打包的模块
|
|
568
|
-
var internalsMap = lang.isArray(internals)
|
|
569
|
-
prev
|
|
570
|
-
|
|
571
|
-
|
|
800
|
+
var internalsMap = lang.isArray(internals)
|
|
801
|
+
? internals.reduce(function (prev, cur) {
|
|
802
|
+
prev[cur] = cur;
|
|
803
|
+
return prev;
|
|
804
|
+
}, {})
|
|
805
|
+
: internals || {};
|
|
572
806
|
|
|
573
807
|
// 不需要打包的模块
|
|
574
|
-
var extraExternals = lang.isArray(externals)
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
808
|
+
var extraExternals = lang.isArray(externals)
|
|
809
|
+
? externals
|
|
810
|
+
: Object.keys(externals || {});
|
|
811
|
+
var obj = _objectSpread2(
|
|
812
|
+
_objectSpread2(_objectSpread2({}, dependencies), peerDependencies),
|
|
813
|
+
devDependencies
|
|
814
|
+
);
|
|
815
|
+
var externalList = Object.keys(obj)
|
|
816
|
+
.concat(extraExternals)
|
|
817
|
+
.filter(function (key) {
|
|
818
|
+
return !internalsMap[key];
|
|
819
|
+
});
|
|
579
820
|
return function (source, _importer, _isResolved) {
|
|
580
821
|
if (/^@doracli\//.test(source)) return true;
|
|
581
822
|
var isExternal = externalList.find(function (externalModule) {
|
|
@@ -592,46 +833,64 @@ var getExternal = function getExternal(_envParams, options) {
|
|
|
592
833
|
* @param input 入口文件路径
|
|
593
834
|
* @returnscj
|
|
594
835
|
*/
|
|
595
|
-
var getInput = /*#__PURE__*/function () {
|
|
596
|
-
var _ref = _asyncToGenerator(
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
836
|
+
var getInput = /*#__PURE__*/ (function () {
|
|
837
|
+
var _ref = _asyncToGenerator(
|
|
838
|
+
/*#__PURE__*/ _regenerator().m(function _callee(envParams, input) {
|
|
839
|
+
var workRootDir, rightFile;
|
|
840
|
+
return _regenerator().w(function (_context) {
|
|
841
|
+
while (1)
|
|
842
|
+
switch (_context.n) {
|
|
843
|
+
case 0:
|
|
844
|
+
workRootDir = envParams.workRootDir;
|
|
845
|
+
rightFile = input;
|
|
846
|
+
if (!lang.isString(input)) {
|
|
847
|
+
_context.n = 2;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
_context.n = 1;
|
|
851
|
+
return filePro.isValidDir(input);
|
|
852
|
+
case 1:
|
|
853
|
+
if (_context.v) {
|
|
854
|
+
_context.n = 2;
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
helper.cLog.warn(
|
|
858
|
+
'rollup',
|
|
859
|
+
'input',
|
|
860
|
+
'\u65E0\u6709\u6548\u5165\u53E3\u8DEF\u5F84 '.concat(
|
|
861
|
+
input,
|
|
862
|
+
'\uFF0C\u5C06\u81EA\u52A8\u5BFB\u627E\u6709\u6548\u8DEF\u5F84'
|
|
863
|
+
)
|
|
864
|
+
);
|
|
865
|
+
rightFile = undefined;
|
|
866
|
+
case 2:
|
|
867
|
+
if (!rightFile) {
|
|
868
|
+
rightFile = helper.findInput(workRootDir);
|
|
869
|
+
}
|
|
870
|
+
if (!rightFile) {
|
|
871
|
+
helper.cLog.error(
|
|
872
|
+
'common',
|
|
873
|
+
'find_input',
|
|
874
|
+
'需要有一个入口文件 index 或者 src/index'
|
|
875
|
+
);
|
|
876
|
+
process.exit();
|
|
877
|
+
}
|
|
878
|
+
helper.cLog.log(
|
|
879
|
+
'rollup',
|
|
880
|
+
'input',
|
|
881
|
+
'\u5165\u53E3\u6587\u4EF6\u8DEF\u5F84 '.concat(rightFile)
|
|
882
|
+
);
|
|
883
|
+
return _context.a(2, rightFile);
|
|
623
884
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}, _callee);
|
|
628
|
-
}));
|
|
885
|
+
}, _callee);
|
|
886
|
+
})
|
|
887
|
+
);
|
|
629
888
|
return function getInput(_x, _x2) {
|
|
630
889
|
return _ref.apply(this, arguments);
|
|
631
890
|
};
|
|
632
|
-
}();
|
|
891
|
+
})();
|
|
633
892
|
|
|
634
|
-
var _excluded$
|
|
893
|
+
var _excluded$4 = ['format'];
|
|
635
894
|
/**
|
|
636
895
|
* 生成单个output
|
|
637
896
|
* @description 如果不配置output,则默认生成cjs格式的output,输出路径为`lib/index.js`
|
|
@@ -645,19 +904,22 @@ var getOutput = function getOutput(envParams, options) {
|
|
|
645
904
|
return {
|
|
646
905
|
file: path.join(workRootDir, 'lib/index.js'),
|
|
647
906
|
format: 'esm',
|
|
648
|
-
sourcemap: false
|
|
907
|
+
sourcemap: false,
|
|
649
908
|
};
|
|
650
909
|
}
|
|
651
910
|
var format = options.format,
|
|
652
|
-
outputOptions = _objectWithoutProperties(options, _excluded$
|
|
911
|
+
outputOptions = _objectWithoutProperties(options, _excluded$4);
|
|
653
912
|
var realFormat = format || 'esm';
|
|
654
|
-
return _objectSpread2(
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
913
|
+
return _objectSpread2(
|
|
914
|
+
{
|
|
915
|
+
format: realFormat,
|
|
916
|
+
sourcemap: false,
|
|
917
|
+
},
|
|
918
|
+
outputOptions
|
|
919
|
+
);
|
|
658
920
|
};
|
|
659
921
|
|
|
660
|
-
var _excluded$
|
|
922
|
+
var _excluded$3 = ['entries'];
|
|
661
923
|
|
|
662
924
|
/**
|
|
663
925
|
* 获取别名插件
|
|
@@ -671,10 +933,19 @@ var getAliasPlugin = function getAliasPlugin(config, pluginConfig) {
|
|
|
671
933
|
var aliasObj = helper.getTsPathAlias(tsConfigPath || []);
|
|
672
934
|
var _ref = pluginConfig || {},
|
|
673
935
|
entries = _ref.entries,
|
|
674
|
-
extPluginConfig = _objectWithoutProperties(_ref, _excluded$
|
|
675
|
-
return alias(
|
|
676
|
-
|
|
677
|
-
|
|
936
|
+
extPluginConfig = _objectWithoutProperties(_ref, _excluded$3);
|
|
937
|
+
return alias(
|
|
938
|
+
_objectSpread2(
|
|
939
|
+
_objectSpread2({}, extPluginConfig),
|
|
940
|
+
{},
|
|
941
|
+
{
|
|
942
|
+
entries: _objectSpread2(
|
|
943
|
+
_objectSpread2(_objectSpread2({}, entries), userConfig),
|
|
944
|
+
aliasObj
|
|
945
|
+
),
|
|
946
|
+
}
|
|
947
|
+
)
|
|
948
|
+
);
|
|
678
949
|
};
|
|
679
950
|
|
|
680
951
|
/**
|
|
@@ -684,16 +955,31 @@ var getAliasPlugin = function getAliasPlugin(config, pluginConfig) {
|
|
|
684
955
|
* @returns Babel插件
|
|
685
956
|
*/
|
|
686
957
|
var getBabelPlugin = function getBabelPlugin(_config, pluginConfig) {
|
|
687
|
-
return babel(
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
958
|
+
return babel(
|
|
959
|
+
_objectSpread2(
|
|
960
|
+
{
|
|
961
|
+
babelrc: false,
|
|
962
|
+
configFile: false,
|
|
963
|
+
compact: false,
|
|
964
|
+
cwd: filePro.getNodeModulesDir(
|
|
965
|
+
filePro.getDirname({
|
|
966
|
+
url:
|
|
967
|
+
typeof document === 'undefined'
|
|
968
|
+
? require('u' + 'rl').pathToFileURL(__filename).href
|
|
969
|
+
: (_documentCurrentScript &&
|
|
970
|
+
_documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' &&
|
|
971
|
+
_documentCurrentScript.src) ||
|
|
972
|
+
new URL('index.js', document.baseURI).href,
|
|
973
|
+
})
|
|
974
|
+
),
|
|
975
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs'],
|
|
976
|
+
ignore: ['node_modules/**'],
|
|
977
|
+
babelHelpers: 'bundled',
|
|
978
|
+
exclude: 'node_modules/**',
|
|
979
|
+
},
|
|
980
|
+
pluginConfig
|
|
981
|
+
)
|
|
982
|
+
);
|
|
697
983
|
};
|
|
698
984
|
|
|
699
985
|
/**
|
|
@@ -707,7 +993,7 @@ var getCommonjsPlugin = function getCommonjsPlugin(_config, pluginConfig) {
|
|
|
707
993
|
return commonjs(pluginConfig);
|
|
708
994
|
};
|
|
709
995
|
|
|
710
|
-
var _excluded$
|
|
996
|
+
var _excluded$2 = ['targets'];
|
|
711
997
|
/**
|
|
712
998
|
* 获取拷贝插件
|
|
713
999
|
* @param config 快捷配置
|
|
@@ -719,14 +1005,20 @@ var getCopyPlugin = function getCopyPlugin(config, pluginConfig) {
|
|
|
719
1005
|
copyList = _ref.copyList;
|
|
720
1006
|
var _ref2 = pluginConfig || {},
|
|
721
1007
|
targets = _ref2.targets,
|
|
722
|
-
extPluginConfig = _objectWithoutProperties(_ref2, _excluded$
|
|
1008
|
+
extPluginConfig = _objectWithoutProperties(_ref2, _excluded$2);
|
|
723
1009
|
var resTargets = _toConsumableArray(targets || []);
|
|
724
1010
|
if (copyList) {
|
|
725
1011
|
resTargets.push.apply(resTargets, _toConsumableArray(copyList));
|
|
726
1012
|
}
|
|
727
|
-
return copy(
|
|
728
|
-
|
|
729
|
-
|
|
1013
|
+
return copy(
|
|
1014
|
+
_objectSpread2(
|
|
1015
|
+
_objectSpread2({}, extPluginConfig),
|
|
1016
|
+
{},
|
|
1017
|
+
{
|
|
1018
|
+
targets: resTargets,
|
|
1019
|
+
}
|
|
1020
|
+
)
|
|
1021
|
+
);
|
|
730
1022
|
};
|
|
731
1023
|
|
|
732
1024
|
/**
|
|
@@ -736,11 +1028,16 @@ var getCopyPlugin = function getCopyPlugin(config, pluginConfig) {
|
|
|
736
1028
|
* @returns
|
|
737
1029
|
*/
|
|
738
1030
|
var getDtsPlugin = function getDtsPlugin(_config, pluginConfig) {
|
|
739
|
-
return rollupPluginDts.dts(
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1031
|
+
return rollupPluginDts.dts(
|
|
1032
|
+
_objectSpread2(
|
|
1033
|
+
{
|
|
1034
|
+
respectExternal: false,
|
|
1035
|
+
tsconfig: 'tsconfig.json',
|
|
1036
|
+
compilerOptions: {},
|
|
1037
|
+
},
|
|
1038
|
+
pluginConfig
|
|
1039
|
+
)
|
|
1040
|
+
);
|
|
744
1041
|
};
|
|
745
1042
|
|
|
746
1043
|
/**
|
|
@@ -762,7 +1059,7 @@ var getMinimizePlugin = function getMinimizePlugin() {
|
|
|
762
1059
|
return terser();
|
|
763
1060
|
};
|
|
764
1061
|
|
|
765
|
-
var _excluded = [
|
|
1062
|
+
var _excluded$1 = ['plugins'];
|
|
766
1063
|
|
|
767
1064
|
/**
|
|
768
1065
|
* 创建Postcss插件
|
|
@@ -775,11 +1072,22 @@ var getPostcssPlugin = function getPostcssPlugin(config, pluginConfig) {
|
|
|
775
1072
|
output = config.output;
|
|
776
1073
|
var _ref = pluginConfig || {},
|
|
777
1074
|
injectPlugin = _ref.plugins,
|
|
778
|
-
otherConfig = _objectWithoutProperties(_ref, _excluded);
|
|
779
|
-
var outputWhole = path.isAbsolute(output)
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1075
|
+
otherConfig = _objectWithoutProperties(_ref, _excluded$1);
|
|
1076
|
+
var outputWhole = path.isAbsolute(output)
|
|
1077
|
+
? output
|
|
1078
|
+
: path.resolve(process.cwd(), output);
|
|
1079
|
+
var plugins = [
|
|
1080
|
+
autoprefixer({
|
|
1081
|
+
overrideBrowserslist: [
|
|
1082
|
+
'defaults',
|
|
1083
|
+
'not ie < 8',
|
|
1084
|
+
'last 2 versions',
|
|
1085
|
+
'> 1%',
|
|
1086
|
+
'iOS 7',
|
|
1087
|
+
'last 3 iOS versions',
|
|
1088
|
+
],
|
|
1089
|
+
}),
|
|
1090
|
+
].concat(_toConsumableArray(injectPlugin || []));
|
|
783
1091
|
if (minimize) {
|
|
784
1092
|
plugins.push(cssnanoPlugin());
|
|
785
1093
|
}
|
|
@@ -789,47 +1097,64 @@ var getPostcssPlugin = function getPostcssPlugin(config, pluginConfig) {
|
|
|
789
1097
|
* 当输出n个格式时,会被同时调用n次
|
|
790
1098
|
*/
|
|
791
1099
|
var codeFileNameLock = '';
|
|
792
|
-
return postcss(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
1100
|
+
return postcss(
|
|
1101
|
+
_objectSpread2(
|
|
1102
|
+
{
|
|
1103
|
+
plugins: plugins,
|
|
1104
|
+
extract: true,
|
|
1105
|
+
onExtract: (function () {
|
|
1106
|
+
var _ref2 = _asyncToGenerator(
|
|
1107
|
+
/*#__PURE__*/ _regenerator().m(function _callee(getExtracted) {
|
|
1108
|
+
var _ref3, code, codeFileName, dir;
|
|
1109
|
+
return _regenerator().w(function (_context) {
|
|
1110
|
+
while (1)
|
|
1111
|
+
switch (_context.n) {
|
|
1112
|
+
case 0:
|
|
1113
|
+
((_ref3 = getExtracted()),
|
|
1114
|
+
(code = _ref3.code),
|
|
1115
|
+
(codeFileName = _ref3.codeFileName));
|
|
1116
|
+
if (!(codeFileNameLock === codeFileName)) {
|
|
1117
|
+
_context.n = 1;
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
return _context.a(2, false);
|
|
1121
|
+
case 1:
|
|
1122
|
+
codeFileNameLock = codeFileName;
|
|
1123
|
+
if (filePro.isValidFilePathSync(outputWhole)) {
|
|
1124
|
+
fs.rmSync(outputWhole, {
|
|
1125
|
+
recursive: true,
|
|
1126
|
+
force: true,
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
dir = path.dirname(outputWhole);
|
|
1130
|
+
_context.n = 2;
|
|
1131
|
+
return filePro.mkdirRecursive(dir);
|
|
1132
|
+
case 2:
|
|
1133
|
+
_context.n = 3;
|
|
1134
|
+
return promises.writeFile(outputWhole, code);
|
|
1135
|
+
case 3:
|
|
1136
|
+
helper.cLog.info(
|
|
1137
|
+
'style',
|
|
1138
|
+
'success',
|
|
1139
|
+
'\u8F93\u51FA\u7C7B\u578B => css\uFF1B',
|
|
1140
|
+
'\u8DEF\u5F84 =>'.concat(
|
|
1141
|
+
path.relative(filePro.getCwd(), outputWhole)
|
|
1142
|
+
)
|
|
1143
|
+
);
|
|
1144
|
+
codeFileNameLock = '';
|
|
1145
|
+
return _context.a(2, false);
|
|
1146
|
+
}
|
|
1147
|
+
}, _callee);
|
|
1148
|
+
})
|
|
1149
|
+
);
|
|
1150
|
+
return function onExtract(_x) {
|
|
1151
|
+
return _ref2.apply(this, arguments);
|
|
1152
|
+
};
|
|
1153
|
+
})(),
|
|
1154
|
+
},
|
|
1155
|
+
otherConfig
|
|
1156
|
+
)
|
|
1157
|
+
);
|
|
833
1158
|
};
|
|
834
1159
|
|
|
835
1160
|
/**
|
|
@@ -840,10 +1165,15 @@ var getPostcssPlugin = function getPostcssPlugin(config, pluginConfig) {
|
|
|
840
1165
|
*/
|
|
841
1166
|
var getResolvePlugin = function getResolvePlugin(config, pluginConfig) {
|
|
842
1167
|
var extensions = config.extensions;
|
|
843
|
-
return resolve(
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
1168
|
+
return resolve(
|
|
1169
|
+
_objectSpread2(
|
|
1170
|
+
{
|
|
1171
|
+
extensions: extensions,
|
|
1172
|
+
preferBuiltins: true,
|
|
1173
|
+
},
|
|
1174
|
+
pluginConfig
|
|
1175
|
+
)
|
|
1176
|
+
);
|
|
847
1177
|
};
|
|
848
1178
|
|
|
849
1179
|
/**
|
|
@@ -853,20 +1183,32 @@ var getResolvePlugin = function getResolvePlugin(config, pluginConfig) {
|
|
|
853
1183
|
*/
|
|
854
1184
|
var getNodePlugins = function getNodePlugins(config) {
|
|
855
1185
|
var alias = config.alias,
|
|
856
|
-
minimize = config.minimize
|
|
857
|
-
config.
|
|
858
|
-
var plugins = [
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
1186
|
+
minimize = config.minimize,
|
|
1187
|
+
copyList = config.copyList;
|
|
1188
|
+
var plugins = [
|
|
1189
|
+
getResolvePlugin(
|
|
1190
|
+
{
|
|
1191
|
+
extensions: ['.js', '.ts', '.json'],
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
preferBuiltins: true,
|
|
1195
|
+
}
|
|
1196
|
+
),
|
|
1197
|
+
getAliasPlugin({
|
|
1198
|
+
alias: _objectSpread2(
|
|
1199
|
+
{
|
|
1200
|
+
'@': 'src',
|
|
1201
|
+
},
|
|
1202
|
+
alias
|
|
1203
|
+
),
|
|
1204
|
+
}),
|
|
1205
|
+
getCopyPlugin({
|
|
1206
|
+
copyList: copyList,
|
|
1207
|
+
}),
|
|
1208
|
+
getCommonjsPlugin(),
|
|
1209
|
+
getJsonPlugin(),
|
|
1210
|
+
];
|
|
1211
|
+
plugins.push(getBabelPlugin({}, presetBabel.nodeBabelPreset()));
|
|
870
1212
|
if (minimize) {
|
|
871
1213
|
plugins.push(getMinimizePlugin());
|
|
872
1214
|
}
|
|
@@ -878,49 +1220,70 @@ var getNodePlugins = function getNodePlugins(config) {
|
|
|
878
1220
|
* @param config 快捷配置
|
|
879
1221
|
* @returns
|
|
880
1222
|
*/
|
|
881
|
-
var getReactPlugins = /*#__PURE__*/function () {
|
|
882
|
-
var _ref = _asyncToGenerator(
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1223
|
+
var getReactPlugins = /*#__PURE__*/ (function () {
|
|
1224
|
+
var _ref = _asyncToGenerator(
|
|
1225
|
+
/*#__PURE__*/ _regenerator().m(function _callee(config) {
|
|
1226
|
+
var alias,
|
|
1227
|
+
minimize,
|
|
1228
|
+
cssOutput,
|
|
1229
|
+
copy,
|
|
1230
|
+
plugins,
|
|
1231
|
+
_t,
|
|
1232
|
+
_t2,
|
|
1233
|
+
_t3,
|
|
1234
|
+
_t4,
|
|
1235
|
+
_t5,
|
|
1236
|
+
_t6;
|
|
1237
|
+
return _regenerator().w(function (_context) {
|
|
1238
|
+
while (1)
|
|
1239
|
+
switch (_context.n) {
|
|
1240
|
+
case 0:
|
|
1241
|
+
((alias = config.alias),
|
|
1242
|
+
(minimize = config.minimize),
|
|
1243
|
+
(cssOutput = config.cssOutput),
|
|
1244
|
+
(copy = config.copy));
|
|
1245
|
+
_context.n = 1;
|
|
1246
|
+
return getPostcssPlugin({
|
|
1247
|
+
minimize: !!minimize,
|
|
1248
|
+
output: cssOutput || 'lib/css/index.css',
|
|
1249
|
+
});
|
|
1250
|
+
case 1:
|
|
1251
|
+
_t = _context.v;
|
|
1252
|
+
_t2 = getResolvePlugin(
|
|
1253
|
+
{
|
|
1254
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs'],
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
preferBuiltins: true,
|
|
1258
|
+
}
|
|
1259
|
+
);
|
|
1260
|
+
_t3 = getAliasPlugin({
|
|
1261
|
+
alias: _objectSpread2(
|
|
1262
|
+
{
|
|
1263
|
+
'@': 'src',
|
|
1264
|
+
},
|
|
1265
|
+
alias
|
|
1266
|
+
),
|
|
1267
|
+
});
|
|
1268
|
+
_t4 = getCopyPlugin({
|
|
1269
|
+
copyList: copy,
|
|
1270
|
+
});
|
|
1271
|
+
_t5 = getCommonjsPlugin();
|
|
1272
|
+
_t6 = getJsonPlugin();
|
|
1273
|
+
plugins = [_t, _t2, _t3, _t4, _t5, _t6];
|
|
1274
|
+
plugins.push(getBabelPlugin({}, presetBabel.reactBabelPreset()));
|
|
1275
|
+
if (minimize) {
|
|
1276
|
+
plugins.push(getMinimizePlugin());
|
|
1277
|
+
}
|
|
1278
|
+
return _context.a(2, plugins);
|
|
915
1279
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
}));
|
|
1280
|
+
}, _callee);
|
|
1281
|
+
})
|
|
1282
|
+
);
|
|
920
1283
|
return function getReactPlugins(_x) {
|
|
921
1284
|
return _ref.apply(this, arguments);
|
|
922
1285
|
};
|
|
923
|
-
}();
|
|
1286
|
+
})();
|
|
924
1287
|
|
|
925
1288
|
/**
|
|
926
1289
|
* 获取watch配置
|
|
@@ -929,134 +1292,145 @@ var getReactPlugins = /*#__PURE__*/function () {
|
|
|
929
1292
|
*/
|
|
930
1293
|
var getWatch = function getWatch(envParams, options) {
|
|
931
1294
|
var workRootDir = envParams.workRootDir;
|
|
932
|
-
return _objectSpread2(
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1295
|
+
return _objectSpread2(
|
|
1296
|
+
{
|
|
1297
|
+
exclude: 'node_modules/**',
|
|
1298
|
+
include: path.join(workRootDir, 'src/**'),
|
|
1299
|
+
clearScreen: false,
|
|
1300
|
+
skipWrite: false,
|
|
1301
|
+
buildDelay: 500,
|
|
1302
|
+
chokidar: {
|
|
1303
|
+
usePolling: true,
|
|
1304
|
+
},
|
|
1305
|
+
},
|
|
1306
|
+
options
|
|
1307
|
+
);
|
|
942
1308
|
};
|
|
943
1309
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1310
|
+
var envParamsMw = function envParamsMw(envParams) {
|
|
1311
|
+
return function (ctx) {
|
|
1312
|
+
return function (next) {
|
|
1313
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1314
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
1315
|
+
return _regenerator().w(function (_context) {
|
|
1316
|
+
while (1)
|
|
1317
|
+
switch (_context.n) {
|
|
1318
|
+
case 0:
|
|
1319
|
+
ctx.updateEnvParams(envParams);
|
|
1320
|
+
return _context.a(2, next());
|
|
1321
|
+
}
|
|
1322
|
+
}, _callee);
|
|
1323
|
+
})
|
|
1324
|
+
);
|
|
1325
|
+
};
|
|
1326
|
+
};
|
|
951
1327
|
};
|
|
952
1328
|
|
|
953
|
-
var
|
|
954
|
-
function
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
var
|
|
1004
|
-
|
|
1005
|
-
|
|
1329
|
+
var rollupExternalMw = function rollupExternalMw() {
|
|
1330
|
+
return function (ctx) {
|
|
1331
|
+
return function (next) {
|
|
1332
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1333
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
1334
|
+
var _ref2,
|
|
1335
|
+
dependencies,
|
|
1336
|
+
devDependencies,
|
|
1337
|
+
peerDependencies,
|
|
1338
|
+
_ref3,
|
|
1339
|
+
externals,
|
|
1340
|
+
internals,
|
|
1341
|
+
dependFilter;
|
|
1342
|
+
return _regenerator().w(function (_context) {
|
|
1343
|
+
while (1)
|
|
1344
|
+
switch (_context.n) {
|
|
1345
|
+
case 0:
|
|
1346
|
+
((_ref2 = ctx.configCtx.getPackageConfig() || {}),
|
|
1347
|
+
(dependencies = _ref2.dependencies),
|
|
1348
|
+
(devDependencies = _ref2.devDependencies),
|
|
1349
|
+
(peerDependencies = _ref2.peerDependencies));
|
|
1350
|
+
((_ref3 = ctx.configCtx.getDoraConfig() || {}),
|
|
1351
|
+
(externals = _ref3.externals),
|
|
1352
|
+
(internals = _ref3.internals));
|
|
1353
|
+
dependFilter = helper.createDependFilter({
|
|
1354
|
+
dependencies: dependencies,
|
|
1355
|
+
devDependencies: devDependencies,
|
|
1356
|
+
peerDependencies: peerDependencies,
|
|
1357
|
+
externals: externals,
|
|
1358
|
+
internals: internals,
|
|
1359
|
+
});
|
|
1360
|
+
ctx.updateRollupOptions({
|
|
1361
|
+
external: function external(moduleId) {
|
|
1362
|
+
if (/^@doracli\//.test(moduleId)) return true;
|
|
1363
|
+
return dependFilter(moduleId);
|
|
1364
|
+
},
|
|
1365
|
+
});
|
|
1366
|
+
return _context.a(2, next());
|
|
1367
|
+
}
|
|
1368
|
+
}, _callee);
|
|
1369
|
+
})
|
|
1370
|
+
);
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
1373
|
+
};
|
|
1374
|
+
var rollupDtsExternalMw = function rollupDtsExternalMw() {
|
|
1375
|
+
return function (ctx) {
|
|
1376
|
+
return function (next) {
|
|
1377
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1378
|
+
/*#__PURE__*/ _regenerator().m(function _callee2() {
|
|
1379
|
+
var external;
|
|
1380
|
+
return _regenerator().w(function (_context2) {
|
|
1381
|
+
while (1)
|
|
1382
|
+
switch (_context2.n) {
|
|
1383
|
+
case 0:
|
|
1384
|
+
external = function external(id) {
|
|
1385
|
+
if (
|
|
1386
|
+
/\.(css|less|scss|sass|styl|png|jpe?g|svg|gif|webp|ico)$/.test(
|
|
1387
|
+
id
|
|
1388
|
+
)
|
|
1389
|
+
) {
|
|
1390
|
+
return true;
|
|
1391
|
+
}
|
|
1392
|
+
return false;
|
|
1393
|
+
};
|
|
1394
|
+
ctx.updateRollupOptions({
|
|
1395
|
+
external: external,
|
|
1396
|
+
});
|
|
1397
|
+
return _context2.a(2, next());
|
|
1398
|
+
}
|
|
1399
|
+
}, _callee2);
|
|
1400
|
+
})
|
|
1401
|
+
);
|
|
1402
|
+
};
|
|
1006
1403
|
};
|
|
1007
1404
|
};
|
|
1008
1405
|
|
|
1406
|
+
var _excluded = ['file', 'dir', 'format'];
|
|
1009
1407
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
* @param
|
|
1408
|
+
* 获取运行时输出配置
|
|
1409
|
+
* @param output
|
|
1410
|
+
* @param isMultiple
|
|
1411
|
+
* @param workRootDir
|
|
1412
|
+
* @returns
|
|
1012
1413
|
*/
|
|
1013
|
-
var
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
preferBuiltins: true
|
|
1034
|
-
}), getDtsPlugin()]
|
|
1035
|
-
});
|
|
1036
|
-
case 2:
|
|
1037
|
-
dtsBuild = _context.v;
|
|
1038
|
-
_context.n = 3;
|
|
1039
|
-
return getRollupWrite(dtsBuild)({
|
|
1040
|
-
file: output
|
|
1041
|
-
});
|
|
1042
|
-
case 3:
|
|
1043
|
-
_context.n = 5;
|
|
1044
|
-
break;
|
|
1045
|
-
case 4:
|
|
1046
|
-
_context.p = 4;
|
|
1047
|
-
_t = _context.v;
|
|
1048
|
-
helper.cLog.error('dts ', 'dts_error', 'dts构建捕获到错误');
|
|
1049
|
-
console.log(_t);
|
|
1050
|
-
throw new Error(_t);
|
|
1051
|
-
case 5:
|
|
1052
|
-
return _context.a(2);
|
|
1053
|
-
}
|
|
1054
|
-
}, _callee, null, [[1, 4]]);
|
|
1055
|
-
}));
|
|
1056
|
-
return function dealDts(_x) {
|
|
1057
|
-
return _ref.apply(this, arguments);
|
|
1058
|
-
};
|
|
1059
|
-
}();
|
|
1414
|
+
var getOutputRuntime = function getOutputRuntime(
|
|
1415
|
+
output,
|
|
1416
|
+
isMultiple,
|
|
1417
|
+
workRootDir
|
|
1418
|
+
) {
|
|
1419
|
+
var file = output.file,
|
|
1420
|
+
dir = output.dir,
|
|
1421
|
+
format = output.format,
|
|
1422
|
+
extOutput = _objectWithoutProperties(output, _excluded);
|
|
1423
|
+
var fileWhole = isMultiple
|
|
1424
|
+
? path.join(workRootDir, dir, format, file)
|
|
1425
|
+
: path.join(workRootDir, dir, file);
|
|
1426
|
+
return _objectSpread2(
|
|
1427
|
+
{
|
|
1428
|
+
file: fileWhole,
|
|
1429
|
+
format: format,
|
|
1430
|
+
},
|
|
1431
|
+
extOutput
|
|
1432
|
+
);
|
|
1433
|
+
};
|
|
1060
1434
|
|
|
1061
1435
|
/**
|
|
1062
1436
|
* 从rollup配置中,获取第一个input
|
|
@@ -1068,21 +1442,21 @@ var getFirstInput = function getFirstInput(inputOrigin) {
|
|
|
1068
1442
|
var name = filePro.getFilename(inputOrigin);
|
|
1069
1443
|
return {
|
|
1070
1444
|
path: inputOrigin,
|
|
1071
|
-
name: name
|
|
1445
|
+
name: name,
|
|
1072
1446
|
};
|
|
1073
1447
|
} else if (Array.isArray(inputOrigin) && inputOrigin.length > 0) {
|
|
1074
1448
|
var firstInput = inputOrigin[0];
|
|
1075
1449
|
var _name = filePro.getFilename(firstInput);
|
|
1076
1450
|
return {
|
|
1077
1451
|
path: firstInput,
|
|
1078
|
-
name: _name
|
|
1452
|
+
name: _name,
|
|
1079
1453
|
};
|
|
1080
1454
|
} else if (lang.isObject(inputOrigin)) {
|
|
1081
1455
|
var firstKey = Object.keys(inputOrigin)[0];
|
|
1082
1456
|
var _firstInput = inputOrigin[firstKey];
|
|
1083
1457
|
return {
|
|
1084
1458
|
path: _firstInput,
|
|
1085
|
-
name: firstKey
|
|
1459
|
+
name: firstKey,
|
|
1086
1460
|
};
|
|
1087
1461
|
}
|
|
1088
1462
|
return undefined;
|
|
@@ -1123,22 +1497,44 @@ var rollupWatchLog = function rollupWatchLog(watcher) {
|
|
|
1123
1497
|
switch (event.code) {
|
|
1124
1498
|
case 'BUNDLE_END':
|
|
1125
1499
|
// 这将确保在每次运行后正确关闭打包
|
|
1126
|
-
helper.cLog.info(
|
|
1500
|
+
helper.cLog.info(
|
|
1501
|
+
'serve',
|
|
1502
|
+
event.code,
|
|
1503
|
+
'\u5355\u6B21\u6253\u5305\u5B8C\u6210'
|
|
1504
|
+
);
|
|
1127
1505
|
event.result.close();
|
|
1128
1506
|
break;
|
|
1129
1507
|
case 'ERROR':
|
|
1130
|
-
helper.cLog.error(
|
|
1508
|
+
helper.cLog.error(
|
|
1509
|
+
'serve',
|
|
1510
|
+
event.code,
|
|
1511
|
+
'\u5355\u6B21\u6253\u5305\u6355\u83B7\u5230\u9519\u8BEF'
|
|
1512
|
+
);
|
|
1131
1513
|
handleError(event.error, true);
|
|
1132
|
-
(_event$result = event.result) === null ||
|
|
1514
|
+
(_event$result = event.result) === null ||
|
|
1515
|
+
_event$result === void 0 ||
|
|
1516
|
+
_event$result.close();
|
|
1133
1517
|
break;
|
|
1134
1518
|
case 'BUNDLE_START':
|
|
1135
|
-
helper.cLog.log(
|
|
1519
|
+
helper.cLog.log(
|
|
1520
|
+
'serve',
|
|
1521
|
+
event.code,
|
|
1522
|
+
'\u5355\u6B21\u6253\u5305\u4E2D....'
|
|
1523
|
+
);
|
|
1136
1524
|
break;
|
|
1137
1525
|
case 'END':
|
|
1138
|
-
helper.cLog.info(
|
|
1526
|
+
helper.cLog.info(
|
|
1527
|
+
'serve',
|
|
1528
|
+
event.code,
|
|
1529
|
+
'\u5B8C\u6210\u5355\u6B21\u6784\u5EFA'
|
|
1530
|
+
);
|
|
1139
1531
|
break;
|
|
1140
1532
|
case 'START':
|
|
1141
|
-
helper.cLog.log(
|
|
1533
|
+
helper.cLog.log(
|
|
1534
|
+
'serve',
|
|
1535
|
+
event.code,
|
|
1536
|
+
'\u76D1\u89C6\u5668\u6B63\u5728\uFF08\u91CD\u65B0\uFF09\u542F\u52A8'
|
|
1537
|
+
);
|
|
1142
1538
|
break;
|
|
1143
1539
|
}
|
|
1144
1540
|
});
|
|
@@ -1148,7 +1544,13 @@ var rollupWatchLog = function rollupWatchLog(watcher) {
|
|
|
1148
1544
|
watcher.on('change', function (id, _ref) {
|
|
1149
1545
|
var event = _ref.event;
|
|
1150
1546
|
/* 更改了一个文件 */
|
|
1151
|
-
helper.cLog.log(
|
|
1547
|
+
helper.cLog.log(
|
|
1548
|
+
'serve',
|
|
1549
|
+
event.toUpperCase(),
|
|
1550
|
+
''
|
|
1551
|
+
.concat('检测到文件变动'.padEnd(12, ' '), ' ')
|
|
1552
|
+
.concat(helper.picocolors.cyan(path.relative(filePro.getCwd(), id)))
|
|
1553
|
+
);
|
|
1152
1554
|
});
|
|
1153
1555
|
watcher.on('restart', function () {
|
|
1154
1556
|
/* 新触发了一次运行 */
|
|
@@ -1166,45 +1568,477 @@ var _picocolors$createCol = helper.picocolors.createColors(),
|
|
|
1166
1568
|
|
|
1167
1569
|
// log to stderr to keep `rollup main.js > bundle.js` from breaking
|
|
1168
1570
|
var stderr = function stderr() {
|
|
1169
|
-
for (
|
|
1571
|
+
for (
|
|
1572
|
+
var _len = arguments.length, parameters = new Array(_len), _key = 0;
|
|
1573
|
+
_key < _len;
|
|
1574
|
+
_key++
|
|
1575
|
+
) {
|
|
1170
1576
|
parameters[_key] = arguments[_key];
|
|
1171
1577
|
}
|
|
1172
|
-
return process.stderr.write(
|
|
1578
|
+
return process.stderr.write(''.concat(parameters.join(''), '\n'));
|
|
1173
1579
|
};
|
|
1174
1580
|
function handleError(error) {
|
|
1175
1581
|
var _error$cause;
|
|
1176
|
-
var recover =
|
|
1177
|
-
|
|
1178
|
-
var
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1582
|
+
var recover =
|
|
1583
|
+
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1584
|
+
var name =
|
|
1585
|
+
error.name ||
|
|
1586
|
+
((_error$cause = error.cause) === null || _error$cause === void 0
|
|
1587
|
+
? void 0
|
|
1588
|
+
: _error$cause.name);
|
|
1589
|
+
var nameSection = name ? ''.concat(name, ': ') : '';
|
|
1590
|
+
var pluginSection = error.plugin ? '(plugin '.concat(error.plugin, ') ') : '';
|
|
1591
|
+
var message = ''
|
|
1592
|
+
.concat(pluginSection)
|
|
1593
|
+
.concat(nameSection)
|
|
1594
|
+
.concat(error.message);
|
|
1595
|
+
var outputLines = [bold(red('[!] '.concat(bold(message.toString()))))];
|
|
1182
1596
|
if (error.url) {
|
|
1183
1597
|
outputLines.push(cyan(error.url));
|
|
1184
1598
|
}
|
|
1185
1599
|
if (error.loc) {
|
|
1186
|
-
outputLines.push(
|
|
1600
|
+
outputLines.push(
|
|
1601
|
+
' ('.concat(error.loc.line, ':').concat(error.loc.column, ')')
|
|
1602
|
+
);
|
|
1187
1603
|
}
|
|
1188
1604
|
if (error.frame) {
|
|
1189
1605
|
outputLines.push(dim(error.frame));
|
|
1190
1606
|
}
|
|
1191
1607
|
if (error.stack) {
|
|
1192
1608
|
var _error$stack;
|
|
1193
|
-
outputLines.push(
|
|
1609
|
+
outputLines.push(
|
|
1610
|
+
dim(
|
|
1611
|
+
(_error$stack = error.stack) === null || _error$stack === void 0
|
|
1612
|
+
? void 0
|
|
1613
|
+
: _error$stack.replace(
|
|
1614
|
+
''.concat(nameSection).concat(error.message, '\n'),
|
|
1615
|
+
''
|
|
1616
|
+
)
|
|
1617
|
+
)
|
|
1618
|
+
);
|
|
1194
1619
|
}
|
|
1195
1620
|
outputLines.push('', '');
|
|
1196
1621
|
stderr(outputLines.join('\n'));
|
|
1197
1622
|
if (!recover) process.exit(1);
|
|
1198
1623
|
}
|
|
1199
1624
|
|
|
1200
|
-
var
|
|
1201
|
-
return
|
|
1625
|
+
var rollupInputMw = function rollupInputMw() {
|
|
1626
|
+
return function (ctx) {
|
|
1627
|
+
return function (next) {
|
|
1628
|
+
return function () {
|
|
1629
|
+
var _ctx$getDoraConfig = ctx.getDoraConfig(),
|
|
1630
|
+
input = _ctx$getDoraConfig.input;
|
|
1631
|
+
var inputWhole = input;
|
|
1632
|
+
if (!inputWhole) {
|
|
1633
|
+
inputWhole = helper.findInput(ctx.envParams.workRootDir);
|
|
1634
|
+
if (!inputWhole) {
|
|
1635
|
+
helper.cLog.error(
|
|
1636
|
+
'common',
|
|
1637
|
+
'find_input',
|
|
1638
|
+
'需要有一个入口文件 index 或者 src/index'
|
|
1639
|
+
);
|
|
1640
|
+
process.exit();
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
ctx.updateRollupOptions({
|
|
1644
|
+
input: inputWhole,
|
|
1645
|
+
});
|
|
1646
|
+
return next();
|
|
1647
|
+
};
|
|
1648
|
+
};
|
|
1649
|
+
};
|
|
1650
|
+
};
|
|
1651
|
+
var rollupOutputListMw = function rollupOutputListMw() {
|
|
1652
|
+
return function (ctx) {
|
|
1653
|
+
return function (next) {
|
|
1654
|
+
return function () {
|
|
1655
|
+
var _ctx$getDoraConfig2 = ctx.getDoraConfig(),
|
|
1656
|
+
input = _ctx$getDoraConfig2.input,
|
|
1657
|
+
output = _ctx$getDoraConfig2.output,
|
|
1658
|
+
formatList = _ctx$getDoraConfig2.formatList;
|
|
1659
|
+
var file = output.file,
|
|
1660
|
+
path = output.path;
|
|
1661
|
+
var outputFile = file;
|
|
1662
|
+
if (!outputFile) {
|
|
1663
|
+
var moduleName = filePro.getFilename(input);
|
|
1664
|
+
outputFile = ''.concat(moduleName, '.js');
|
|
1665
|
+
}
|
|
1666
|
+
var outputList = formatList.map(function (format) {
|
|
1667
|
+
return {
|
|
1668
|
+
dir: path,
|
|
1669
|
+
file: outputFile,
|
|
1670
|
+
format: format,
|
|
1671
|
+
};
|
|
1672
|
+
});
|
|
1673
|
+
ctx.updateRollupOutputList(outputList);
|
|
1674
|
+
return next();
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1202
1678
|
};
|
|
1679
|
+
var rollupInoutMw = function rollupInoutMw() {
|
|
1680
|
+
return function (ctx) {
|
|
1681
|
+
return function (next) {
|
|
1682
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1683
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
1684
|
+
var _ctx$getDoraConfig3,
|
|
1685
|
+
input,
|
|
1686
|
+
output,
|
|
1687
|
+
formatList,
|
|
1688
|
+
file,
|
|
1689
|
+
path,
|
|
1690
|
+
inputWhole,
|
|
1691
|
+
outputFile,
|
|
1692
|
+
moduleName,
|
|
1693
|
+
outputList;
|
|
1694
|
+
return _regenerator().w(function (_context) {
|
|
1695
|
+
while (1)
|
|
1696
|
+
switch (_context.n) {
|
|
1697
|
+
case 0:
|
|
1698
|
+
((_ctx$getDoraConfig3 = ctx.getDoraConfig()),
|
|
1699
|
+
(input = _ctx$getDoraConfig3.input),
|
|
1700
|
+
(output = _ctx$getDoraConfig3.output),
|
|
1701
|
+
(formatList = _ctx$getDoraConfig3.formatList));
|
|
1702
|
+
((file = output.file), (path = output.path));
|
|
1703
|
+
inputWhole = input;
|
|
1704
|
+
outputFile = file;
|
|
1705
|
+
if (!inputWhole) {
|
|
1706
|
+
inputWhole = helper.findInput(ctx.envParams.workRootDir);
|
|
1707
|
+
if (!inputWhole) {
|
|
1708
|
+
helper.cLog.error(
|
|
1709
|
+
'common',
|
|
1710
|
+
'find_input',
|
|
1711
|
+
'需要有一个入口文件 index 或者 src/index'
|
|
1712
|
+
);
|
|
1713
|
+
process.exit();
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
if (!outputFile) {
|
|
1717
|
+
moduleName = filePro.getFilename(inputWhole);
|
|
1718
|
+
outputFile = ''.concat(moduleName, '.js');
|
|
1719
|
+
}
|
|
1720
|
+
outputList = formatList.map(function (format) {
|
|
1721
|
+
return {
|
|
1722
|
+
dir: path,
|
|
1723
|
+
file: outputFile,
|
|
1724
|
+
format: format,
|
|
1725
|
+
};
|
|
1726
|
+
});
|
|
1727
|
+
ctx.updateRollupOptions({
|
|
1728
|
+
input: inputWhole,
|
|
1729
|
+
});
|
|
1730
|
+
ctx.updateRollupOutputList(outputList);
|
|
1731
|
+
return _context.a(2, next());
|
|
1732
|
+
}
|
|
1733
|
+
}, _callee);
|
|
1734
|
+
})
|
|
1735
|
+
);
|
|
1736
|
+
};
|
|
1737
|
+
};
|
|
1738
|
+
};
|
|
1739
|
+
var rollupWatchOutputMw = function rollupWatchOutputMw() {
|
|
1740
|
+
return function (ctx) {
|
|
1741
|
+
return function (next) {
|
|
1742
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1743
|
+
/*#__PURE__*/ _regenerator().m(function _callee2() {
|
|
1744
|
+
return _regenerator().w(function (_context2) {
|
|
1745
|
+
while (1)
|
|
1746
|
+
switch (_context2.n) {
|
|
1747
|
+
case 0:
|
|
1748
|
+
ctx.updateRollupOptions({
|
|
1749
|
+
output: ctx.rollupOutputList.map(function (output) {
|
|
1750
|
+
return getOutputRuntime(
|
|
1751
|
+
output,
|
|
1752
|
+
ctx.rollupOutputList.length > 1,
|
|
1753
|
+
ctx.envParams.workRootDir
|
|
1754
|
+
);
|
|
1755
|
+
}),
|
|
1756
|
+
});
|
|
1757
|
+
return _context2.a(2, next());
|
|
1758
|
+
}
|
|
1759
|
+
}, _callee2);
|
|
1760
|
+
})
|
|
1761
|
+
);
|
|
1762
|
+
};
|
|
1763
|
+
};
|
|
1764
|
+
};
|
|
1765
|
+
var rollupDtsInoutMw = function rollupDtsInoutMw() {
|
|
1766
|
+
return function (ctx) {
|
|
1767
|
+
return function (next) {
|
|
1768
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1769
|
+
/*#__PURE__*/ _regenerator().m(function _callee3() {
|
|
1770
|
+
var _ctx$getDoraConfig4, output, dts, dtsInput, dtsOutput;
|
|
1771
|
+
return _regenerator().w(function (_context3) {
|
|
1772
|
+
while (1)
|
|
1773
|
+
switch (_context3.n) {
|
|
1774
|
+
case 0:
|
|
1775
|
+
((_ctx$getDoraConfig4 = ctx.getDoraConfig()),
|
|
1776
|
+
(output = _ctx$getDoraConfig4.output),
|
|
1777
|
+
(dts = _ctx$getDoraConfig4.dts));
|
|
1778
|
+
if (dts) {
|
|
1779
|
+
_context3.n = 1;
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1782
|
+
return _context3.a(2);
|
|
1783
|
+
case 1:
|
|
1784
|
+
dtsInput =
|
|
1785
|
+
(dts === null || dts === void 0 ? void 0 : dts.input) ||
|
|
1786
|
+
ctx.rollupOptions.input;
|
|
1787
|
+
dtsOutput =
|
|
1788
|
+
(dts === null || dts === void 0 ? void 0 : dts.output) ||
|
|
1789
|
+
path.resolve(output.path || './lib', 'type/index.d.ts');
|
|
1790
|
+
ctx.updateRollupOptions({
|
|
1791
|
+
input: dtsInput,
|
|
1792
|
+
});
|
|
1793
|
+
ctx.updateRollupOutputList([
|
|
1794
|
+
{
|
|
1795
|
+
file: dtsOutput,
|
|
1796
|
+
},
|
|
1797
|
+
]);
|
|
1798
|
+
return _context3.a(2, next());
|
|
1799
|
+
}
|
|
1800
|
+
}, _callee3);
|
|
1801
|
+
})
|
|
1802
|
+
);
|
|
1803
|
+
};
|
|
1804
|
+
};
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
var insertTsMw = function insertTsMw() {
|
|
1808
|
+
return function (ctx) {
|
|
1809
|
+
return function (next) {
|
|
1810
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1811
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
1812
|
+
var input;
|
|
1813
|
+
return _regenerator().w(function (_context) {
|
|
1814
|
+
while (1)
|
|
1815
|
+
switch (_context.n) {
|
|
1816
|
+
case 0:
|
|
1817
|
+
input = ctx.rollupOptions.input;
|
|
1818
|
+
if (!path.extname(input).toLowerCase().includes('ts')) {
|
|
1819
|
+
_context.n = 1;
|
|
1820
|
+
break;
|
|
1821
|
+
}
|
|
1822
|
+
_context.n = 1;
|
|
1823
|
+
return helper.insertTsconfig(ctx.envParams.workRootDir);
|
|
1824
|
+
case 1:
|
|
1825
|
+
return _context.a(2, next());
|
|
1826
|
+
}
|
|
1827
|
+
}, _callee);
|
|
1828
|
+
})
|
|
1829
|
+
);
|
|
1830
|
+
};
|
|
1831
|
+
};
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1834
|
+
var rollupReactPluginMw = function rollupReactPluginMw() {
|
|
1835
|
+
return function (ctx) {
|
|
1836
|
+
return function (next) {
|
|
1837
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1838
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
1839
|
+
var _ctx$getDoraConfig,
|
|
1840
|
+
minimize,
|
|
1841
|
+
alias,
|
|
1842
|
+
copy,
|
|
1843
|
+
output,
|
|
1844
|
+
path$1,
|
|
1845
|
+
tsConfig,
|
|
1846
|
+
tsAlias,
|
|
1847
|
+
plugins;
|
|
1848
|
+
return _regenerator().w(function (_context) {
|
|
1849
|
+
while (1)
|
|
1850
|
+
switch (_context.n) {
|
|
1851
|
+
case 0:
|
|
1852
|
+
((_ctx$getDoraConfig = ctx.getDoraConfig()),
|
|
1853
|
+
(minimize = _ctx$getDoraConfig.minimize),
|
|
1854
|
+
(alias = _ctx$getDoraConfig.alias),
|
|
1855
|
+
(copy = _ctx$getDoraConfig.copy),
|
|
1856
|
+
(output = _ctx$getDoraConfig.output));
|
|
1857
|
+
path$1 = output.path;
|
|
1858
|
+
tsConfig = ctx.configCtx.getTsConfig();
|
|
1859
|
+
tsAlias = helper.getTsPathAlias(tsConfig);
|
|
1860
|
+
_context.n = 1;
|
|
1861
|
+
return getReactPlugins({
|
|
1862
|
+
minimize: minimize,
|
|
1863
|
+
alias: _objectSpread2(_objectSpread2({}, tsAlias), alias),
|
|
1864
|
+
copy: copy,
|
|
1865
|
+
cssOutput: path.resolve(
|
|
1866
|
+
ctx.envParams.workRootDir,
|
|
1867
|
+
path$1,
|
|
1868
|
+
'style/index.css'
|
|
1869
|
+
),
|
|
1870
|
+
});
|
|
1871
|
+
case 1:
|
|
1872
|
+
plugins = _context.v;
|
|
1873
|
+
ctx.updateRollupOptions({
|
|
1874
|
+
plugins: plugins,
|
|
1875
|
+
});
|
|
1876
|
+
return _context.a(2, next());
|
|
1877
|
+
}
|
|
1878
|
+
}, _callee);
|
|
1879
|
+
})
|
|
1880
|
+
);
|
|
1881
|
+
};
|
|
1882
|
+
};
|
|
1883
|
+
};
|
|
1884
|
+
var rollupNodePluginMw = function rollupNodePluginMw() {
|
|
1885
|
+
return function (ctx) {
|
|
1886
|
+
return function (next) {
|
|
1887
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1888
|
+
/*#__PURE__*/ _regenerator().m(function _callee2() {
|
|
1889
|
+
var _ctx$getDoraConfig2, minimize, alias, tsConfig, tsAlias, plugins;
|
|
1890
|
+
return _regenerator().w(function (_context2) {
|
|
1891
|
+
while (1)
|
|
1892
|
+
switch (_context2.n) {
|
|
1893
|
+
case 0:
|
|
1894
|
+
((_ctx$getDoraConfig2 = ctx.getDoraConfig()),
|
|
1895
|
+
(minimize = _ctx$getDoraConfig2.minimize),
|
|
1896
|
+
(alias = _ctx$getDoraConfig2.alias));
|
|
1897
|
+
tsConfig = ctx.configCtx.getTsConfig();
|
|
1898
|
+
tsAlias = helper.getTsPathAlias(tsConfig);
|
|
1899
|
+
_context2.n = 1;
|
|
1900
|
+
return getNodePlugins({
|
|
1901
|
+
minimize: minimize,
|
|
1902
|
+
alias: _objectSpread2(_objectSpread2({}, tsAlias), alias),
|
|
1903
|
+
});
|
|
1904
|
+
case 1:
|
|
1905
|
+
plugins = _context2.v;
|
|
1906
|
+
ctx.updateRollupOptions({
|
|
1907
|
+
plugins: plugins,
|
|
1908
|
+
});
|
|
1909
|
+
return _context2.a(2, next());
|
|
1910
|
+
}
|
|
1911
|
+
}, _callee2);
|
|
1912
|
+
})
|
|
1913
|
+
);
|
|
1914
|
+
};
|
|
1915
|
+
};
|
|
1916
|
+
};
|
|
1917
|
+
var rollupDtsPluginMw = function rollupDtsPluginMw() {
|
|
1918
|
+
return function (ctx) {
|
|
1919
|
+
return function (next) {
|
|
1920
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1921
|
+
/*#__PURE__*/ _regenerator().m(function _callee3() {
|
|
1922
|
+
var plugins;
|
|
1923
|
+
return _regenerator().w(function (_context3) {
|
|
1924
|
+
while (1)
|
|
1925
|
+
switch (_context3.n) {
|
|
1926
|
+
case 0:
|
|
1927
|
+
plugins = [
|
|
1928
|
+
getResolvePlugin(
|
|
1929
|
+
{
|
|
1930
|
+
extensions: ['.ts'],
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
preferBuiltins: true,
|
|
1934
|
+
}
|
|
1935
|
+
),
|
|
1936
|
+
getDtsPlugin(),
|
|
1937
|
+
];
|
|
1938
|
+
ctx.updateRollupOptions({
|
|
1939
|
+
plugins: plugins,
|
|
1940
|
+
});
|
|
1941
|
+
return _context3.a(2, next());
|
|
1942
|
+
}
|
|
1943
|
+
}, _callee3);
|
|
1944
|
+
})
|
|
1945
|
+
);
|
|
1946
|
+
};
|
|
1947
|
+
};
|
|
1948
|
+
};
|
|
1949
|
+
|
|
1950
|
+
var rollupWatchMw = function rollupWatchMw() {
|
|
1951
|
+
return function (ctx) {
|
|
1952
|
+
return function (next) {
|
|
1953
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
1954
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
1955
|
+
var watch;
|
|
1956
|
+
return _regenerator().w(function (_context) {
|
|
1957
|
+
while (1)
|
|
1958
|
+
switch (_context.n) {
|
|
1959
|
+
case 0:
|
|
1960
|
+
_context.n = 1;
|
|
1961
|
+
return getWatch(ctx.envParams);
|
|
1962
|
+
case 1:
|
|
1963
|
+
watch = _context.v;
|
|
1964
|
+
ctx.updateRollupOptions({
|
|
1965
|
+
watch: watch,
|
|
1966
|
+
});
|
|
1967
|
+
return _context.a(2, next());
|
|
1968
|
+
}
|
|
1969
|
+
}, _callee);
|
|
1970
|
+
})
|
|
1971
|
+
);
|
|
1972
|
+
};
|
|
1973
|
+
};
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
var Ctx = /*#__PURE__*/ (function () {
|
|
1977
|
+
function Ctx(configCtx) {
|
|
1978
|
+
_classCallCheck(this, Ctx);
|
|
1979
|
+
_defineProperty(this, 'configCtx', void 0);
|
|
1980
|
+
_defineProperty(this, 'rollupOptions', {});
|
|
1981
|
+
_defineProperty(this, 'rollupOutputList', []);
|
|
1982
|
+
_defineProperty(this, 'envParams', {
|
|
1983
|
+
action: 'build',
|
|
1984
|
+
workRootDir: filePro.getCwd(),
|
|
1985
|
+
});
|
|
1986
|
+
this.configCtx = configCtx;
|
|
1987
|
+
}
|
|
1988
|
+
return _createClass(Ctx, [
|
|
1989
|
+
{
|
|
1990
|
+
key: 'updateEnvParams',
|
|
1991
|
+
value: function updateEnvParams(argv) {
|
|
1992
|
+
this.envParams = _objectSpread2(
|
|
1993
|
+
_objectSpread2({}, this.envParams),
|
|
1994
|
+
argv
|
|
1995
|
+
);
|
|
1996
|
+
},
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
key: 'updateRollupOptions',
|
|
2000
|
+
value: function updateRollupOptions(options) {
|
|
2001
|
+
this.rollupOptions = _objectSpread2(
|
|
2002
|
+
_objectSpread2({}, this.rollupOptions),
|
|
2003
|
+
options
|
|
2004
|
+
);
|
|
2005
|
+
},
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
key: 'updateRollupOutputList',
|
|
2009
|
+
value: function updateRollupOutputList(list) {
|
|
2010
|
+
var force =
|
|
2011
|
+
arguments.length > 1 && arguments[1] !== undefined
|
|
2012
|
+
? arguments[1]
|
|
2013
|
+
: false;
|
|
2014
|
+
if (force) {
|
|
2015
|
+
this.rollupOutputList = list;
|
|
2016
|
+
} else {
|
|
2017
|
+
this.rollupOutputList = [].concat(
|
|
2018
|
+
_toConsumableArray(this.rollupOutputList),
|
|
2019
|
+
_toConsumableArray(list)
|
|
2020
|
+
);
|
|
2021
|
+
}
|
|
2022
|
+
},
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
key: 'getDoraConfig',
|
|
2026
|
+
value: function getDoraConfig() {
|
|
2027
|
+
return this.configCtx.getDoraConfig();
|
|
2028
|
+
},
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
key: 'geTDoraConfigRollup',
|
|
2032
|
+
value: function geTDoraConfigRollup() {
|
|
2033
|
+
return this.configCtx.getDoraConfig().rollupConfig || {};
|
|
2034
|
+
},
|
|
2035
|
+
},
|
|
2036
|
+
]);
|
|
2037
|
+
})();
|
|
1203
2038
|
|
|
1204
2039
|
exports.Compiler = Compiler;
|
|
1205
2040
|
exports.Ctx = Ctx;
|
|
1206
|
-
exports.
|
|
1207
|
-
exports.dealDts = dealDts;
|
|
2041
|
+
exports.envParamsMw = envParamsMw;
|
|
1208
2042
|
exports.getAliasPlugin = getAliasPlugin;
|
|
1209
2043
|
exports.getBabelPlugin = getBabelPlugin;
|
|
1210
2044
|
exports.getCommonjsPlugin = getCommonjsPlugin;
|
|
@@ -1217,12 +2051,23 @@ exports.getJsonPlugin = getJsonPlugin;
|
|
|
1217
2051
|
exports.getMinimizePlugin = getMinimizePlugin;
|
|
1218
2052
|
exports.getNodePlugins = getNodePlugins;
|
|
1219
2053
|
exports.getOutput = getOutput;
|
|
2054
|
+
exports.getOutputRuntime = getOutputRuntime;
|
|
1220
2055
|
exports.getPostcssPlugin = getPostcssPlugin;
|
|
1221
2056
|
exports.getReactPlugins = getReactPlugins;
|
|
1222
2057
|
exports.getResolvePlugin = getResolvePlugin;
|
|
1223
|
-
exports.getRollupWrite = getRollupWrite;
|
|
1224
2058
|
exports.getWatch = getWatch;
|
|
1225
2059
|
exports.handleError = handleError;
|
|
2060
|
+
exports.insertTsMw = insertTsMw;
|
|
1226
2061
|
exports.mergeRollupOptions = mergeRollupOptions;
|
|
1227
|
-
exports.
|
|
2062
|
+
exports.rollupDtsExternalMw = rollupDtsExternalMw;
|
|
2063
|
+
exports.rollupDtsInoutMw = rollupDtsInoutMw;
|
|
2064
|
+
exports.rollupDtsPluginMw = rollupDtsPluginMw;
|
|
2065
|
+
exports.rollupExternalMw = rollupExternalMw;
|
|
2066
|
+
exports.rollupInoutMw = rollupInoutMw;
|
|
2067
|
+
exports.rollupInputMw = rollupInputMw;
|
|
2068
|
+
exports.rollupNodePluginMw = rollupNodePluginMw;
|
|
2069
|
+
exports.rollupOutputListMw = rollupOutputListMw;
|
|
2070
|
+
exports.rollupReactPluginMw = rollupReactPluginMw;
|
|
1228
2071
|
exports.rollupWatchLog = rollupWatchLog;
|
|
2072
|
+
exports.rollupWatchMw = rollupWatchMw;
|
|
2073
|
+
exports.rollupWatchOutputMw = rollupWatchOutputMw;
|