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