@doracli/rollup-react 0.0.4 → 0.0.5
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 +3 -827
- package/lib/esm/index.js +3 -831
- package/lib/type/index.d.ts +12 -28
- package/package.json +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -1,827 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
e =
|
|
4
|
-
r = require('@dorabag/file-pro'),
|
|
5
|
-
n = require('@doracli/rollup');
|
|
6
|
-
function o(t, e, r, n, o, u, i) {
|
|
7
|
-
try {
|
|
8
|
-
var c = t[u](i),
|
|
9
|
-
a = c.value;
|
|
10
|
-
} catch (t) {
|
|
11
|
-
return void r(t);
|
|
12
|
-
}
|
|
13
|
-
c.done ? e(a) : Promise.resolve(a).then(n, o);
|
|
14
|
-
}
|
|
15
|
-
function u(t) {
|
|
16
|
-
return function () {
|
|
17
|
-
var e = this,
|
|
18
|
-
r = arguments;
|
|
19
|
-
return new Promise(function (n, u) {
|
|
20
|
-
var i = t.apply(e, r);
|
|
21
|
-
function c(t) {
|
|
22
|
-
o(i, n, u, c, a, 'next', t);
|
|
23
|
-
}
|
|
24
|
-
function a(t) {
|
|
25
|
-
o(i, n, u, c, a, 'throw', t);
|
|
26
|
-
}
|
|
27
|
-
c(void 0);
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function i(t, e, r) {
|
|
32
|
-
return (
|
|
33
|
-
(e = (function (t) {
|
|
34
|
-
var e = (function (t, e) {
|
|
35
|
-
if ('object' != typeof t || !t) return t;
|
|
36
|
-
var r = t[Symbol.toPrimitive];
|
|
37
|
-
if (void 0 !== r) {
|
|
38
|
-
var n = r.call(t, e);
|
|
39
|
-
if ('object' != typeof n) return n;
|
|
40
|
-
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
41
|
-
}
|
|
42
|
-
return ('string' === e ? String : Number)(t);
|
|
43
|
-
})(t, 'string');
|
|
44
|
-
return 'symbol' == typeof e ? e : e + '';
|
|
45
|
-
})(e)) in t
|
|
46
|
-
? Object.defineProperty(t, e, {
|
|
47
|
-
value: r,
|
|
48
|
-
enumerable: !0,
|
|
49
|
-
configurable: !0,
|
|
50
|
-
writable: !0,
|
|
51
|
-
})
|
|
52
|
-
: (t[e] = r),
|
|
53
|
-
t
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
function c(t, e) {
|
|
57
|
-
var r = Object.keys(t);
|
|
58
|
-
if (Object.getOwnPropertySymbols) {
|
|
59
|
-
var n = Object.getOwnPropertySymbols(t);
|
|
60
|
-
(e &&
|
|
61
|
-
(n = n.filter(function (e) {
|
|
62
|
-
return Object.getOwnPropertyDescriptor(t, e).enumerable;
|
|
63
|
-
})),
|
|
64
|
-
r.push.apply(r, n));
|
|
65
|
-
}
|
|
66
|
-
return r;
|
|
67
|
-
}
|
|
68
|
-
function a(t) {
|
|
69
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
70
|
-
var r = null != arguments[e] ? arguments[e] : {};
|
|
71
|
-
e % 2
|
|
72
|
-
? c(Object(r), !0).forEach(function (e) {
|
|
73
|
-
i(t, e, r[e]);
|
|
74
|
-
})
|
|
75
|
-
: Object.getOwnPropertyDescriptors
|
|
76
|
-
? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r))
|
|
77
|
-
: c(Object(r)).forEach(function (e) {
|
|
78
|
-
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return t;
|
|
82
|
-
}
|
|
83
|
-
function s() {
|
|
84
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
85
|
-
var t,
|
|
86
|
-
e,
|
|
87
|
-
r = 'function' == typeof Symbol ? Symbol : {},
|
|
88
|
-
n = r.iterator || '@@iterator',
|
|
89
|
-
o = r.toStringTag || '@@toStringTag';
|
|
90
|
-
function u(r, n, o, u) {
|
|
91
|
-
var a = n && n.prototype instanceof c ? n : c,
|
|
92
|
-
s = Object.create(a.prototype);
|
|
93
|
-
return (
|
|
94
|
-
l(
|
|
95
|
-
s,
|
|
96
|
-
'_invoke',
|
|
97
|
-
(function (r, n, o) {
|
|
98
|
-
var u,
|
|
99
|
-
c,
|
|
100
|
-
a,
|
|
101
|
-
s = 0,
|
|
102
|
-
l = o || [],
|
|
103
|
-
f = !1,
|
|
104
|
-
p = {
|
|
105
|
-
p: 0,
|
|
106
|
-
n: 0,
|
|
107
|
-
v: t,
|
|
108
|
-
a: m,
|
|
109
|
-
f: m.bind(t, 4),
|
|
110
|
-
d: function (e, r) {
|
|
111
|
-
return ((u = e), (c = 0), (a = t), (p.n = r), i);
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
function m(r, n) {
|
|
115
|
-
for (c = r, a = n, e = 0; !f && s && !o && e < l.length; e++) {
|
|
116
|
-
var o,
|
|
117
|
-
u = l[e],
|
|
118
|
-
m = p.p,
|
|
119
|
-
w = u[2];
|
|
120
|
-
r > 3
|
|
121
|
-
? (o = w === n) &&
|
|
122
|
-
((a = u[(c = u[4]) ? 5 : ((c = 3), 3)]), (u[4] = u[5] = t))
|
|
123
|
-
: u[0] <= m &&
|
|
124
|
-
((o = r < 2 && m < u[1])
|
|
125
|
-
? ((c = 0), (p.v = n), (p.n = u[1]))
|
|
126
|
-
: m < w &&
|
|
127
|
-
(o = r < 3 || u[0] > n || n > w) &&
|
|
128
|
-
((u[4] = r), (u[5] = n), (p.n = w), (c = 0)));
|
|
129
|
-
}
|
|
130
|
-
if (o || r > 1) return i;
|
|
131
|
-
throw ((f = !0), n);
|
|
132
|
-
}
|
|
133
|
-
return function (o, l, w) {
|
|
134
|
-
if (s > 1) throw TypeError('Generator is already running');
|
|
135
|
-
for (
|
|
136
|
-
f && 1 === l && m(l, w), c = l, a = w;
|
|
137
|
-
(e = c < 2 ? t : a) || !f;
|
|
138
|
-
|
|
139
|
-
) {
|
|
140
|
-
u ||
|
|
141
|
-
(c
|
|
142
|
-
? c < 3
|
|
143
|
-
? (c > 1 && (p.n = -1), m(c, a))
|
|
144
|
-
: (p.n = a)
|
|
145
|
-
: (p.v = a));
|
|
146
|
-
try {
|
|
147
|
-
if (((s = 2), u)) {
|
|
148
|
-
if ((c || (o = 'next'), (e = u[o]))) {
|
|
149
|
-
if (!(e = e.call(u, a)))
|
|
150
|
-
throw TypeError('iterator result is not an object');
|
|
151
|
-
if (!e.done) return e;
|
|
152
|
-
((a = e.value), c < 2 && (c = 0));
|
|
153
|
-
} else
|
|
154
|
-
(1 === c && (e = u.return) && e.call(u),
|
|
155
|
-
c < 2 &&
|
|
156
|
-
((a = TypeError(
|
|
157
|
-
"The iterator does not provide a '" + o + "' method"
|
|
158
|
-
)),
|
|
159
|
-
(c = 1)));
|
|
160
|
-
u = t;
|
|
161
|
-
} else if ((e = (f = p.n < 0) ? a : r.call(n, p)) !== i) break;
|
|
162
|
-
} catch (e) {
|
|
163
|
-
((u = t), (c = 1), (a = e));
|
|
164
|
-
} finally {
|
|
165
|
-
s = 1;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return { value: e, done: f };
|
|
169
|
-
};
|
|
170
|
-
})(r, o, u),
|
|
171
|
-
!0
|
|
172
|
-
),
|
|
173
|
-
s
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
var i = {};
|
|
177
|
-
function c() {}
|
|
178
|
-
function a() {}
|
|
179
|
-
function f() {}
|
|
180
|
-
e = Object.getPrototypeOf;
|
|
181
|
-
var p = [][n]
|
|
182
|
-
? e(e([][n]()))
|
|
183
|
-
: (l((e = {}), n, function () {
|
|
184
|
-
return this;
|
|
185
|
-
}),
|
|
186
|
-
e),
|
|
187
|
-
m = (f.prototype = c.prototype = Object.create(p));
|
|
188
|
-
function w(t) {
|
|
189
|
-
return (
|
|
190
|
-
Object.setPrototypeOf
|
|
191
|
-
? Object.setPrototypeOf(t, f)
|
|
192
|
-
: ((t.__proto__ = f), l(t, o, 'GeneratorFunction')),
|
|
193
|
-
(t.prototype = Object.create(m)),
|
|
194
|
-
t
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
return (
|
|
198
|
-
(a.prototype = f),
|
|
199
|
-
l(m, 'constructor', f),
|
|
200
|
-
l(f, 'constructor', a),
|
|
201
|
-
(a.displayName = 'GeneratorFunction'),
|
|
202
|
-
l(f, o, 'GeneratorFunction'),
|
|
203
|
-
l(m),
|
|
204
|
-
l(m, o, 'Generator'),
|
|
205
|
-
l(m, n, function () {
|
|
206
|
-
return this;
|
|
207
|
-
}),
|
|
208
|
-
l(m, 'toString', function () {
|
|
209
|
-
return '[object Generator]';
|
|
210
|
-
}),
|
|
211
|
-
(s = function () {
|
|
212
|
-
return { w: u, m: w };
|
|
213
|
-
})()
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
function l(t, e, r, n) {
|
|
217
|
-
var o = Object.defineProperty;
|
|
218
|
-
try {
|
|
219
|
-
o({}, '', {});
|
|
220
|
-
} catch (t) {
|
|
221
|
-
o = 0;
|
|
222
|
-
}
|
|
223
|
-
((l = function (t, e, r, n) {
|
|
224
|
-
function u(e, r) {
|
|
225
|
-
l(t, e, function (t) {
|
|
226
|
-
return this._invoke(e, r, t);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
e
|
|
230
|
-
? o
|
|
231
|
-
? o(t, e, { value: r, enumerable: !n, configurable: !n, writable: !n })
|
|
232
|
-
: (t[e] = r)
|
|
233
|
-
: (u('next', 0), u('throw', 1), u('return', 2));
|
|
234
|
-
}),
|
|
235
|
-
l(t, e, r, n));
|
|
236
|
-
}
|
|
237
|
-
var f = {
|
|
238
|
-
multiple: !1,
|
|
239
|
-
output: { path: './lib' },
|
|
240
|
-
formatList: ['cjs', 'esm'],
|
|
241
|
-
alias: {},
|
|
242
|
-
externals: [],
|
|
243
|
-
internals: [],
|
|
244
|
-
minimize: !0,
|
|
245
|
-
clear: !1,
|
|
246
|
-
copy: [],
|
|
247
|
-
dts: {},
|
|
248
|
-
},
|
|
249
|
-
p = a(a({}, f), {}, { minimize: !0, clear: !0 }),
|
|
250
|
-
m = { dev: 'development', build: 'production', watch: 'development' },
|
|
251
|
-
w = (function () {
|
|
252
|
-
var t = u(
|
|
253
|
-
s().m(function t(r, n, o) {
|
|
254
|
-
var u;
|
|
255
|
-
return s().w(function (t) {
|
|
256
|
-
for (;;)
|
|
257
|
-
switch (t.n) {
|
|
258
|
-
case 0:
|
|
259
|
-
return (
|
|
260
|
-
(u = e.configCtxWorkflow(new e.ConfigCtx())).use(
|
|
261
|
-
e.collectBaseConfigMw(r.workRootDir, n)
|
|
262
|
-
),
|
|
263
|
-
u.use(e.collectPackageJsonMw()),
|
|
264
|
-
u.use(e.collectTsconfigJsonMw()),
|
|
265
|
-
u.use(e.collectDoraConfigMw(m[r.action])),
|
|
266
|
-
u.use(e.wholeDoraConfigMw(o)),
|
|
267
|
-
u.use(e.wholeDoraInoutMw()),
|
|
268
|
-
u.use(e.clearMw()),
|
|
269
|
-
(t.n = 1),
|
|
270
|
-
u.getResult()
|
|
271
|
-
);
|
|
272
|
-
case 1:
|
|
273
|
-
return t.a(2, t.v);
|
|
274
|
-
}
|
|
275
|
-
}, t);
|
|
276
|
-
})
|
|
277
|
-
);
|
|
278
|
-
return function (e, r, n) {
|
|
279
|
-
return t.apply(this, arguments);
|
|
280
|
-
};
|
|
281
|
-
})(),
|
|
282
|
-
g = function (t, r) {
|
|
283
|
-
var o = e.configCtxWorkflow(new n.Ctx(t));
|
|
284
|
-
return (
|
|
285
|
-
o.use(n.envParamsMw(r)),
|
|
286
|
-
o.use(n.rollupInoutMw()),
|
|
287
|
-
o.use(n.rollupExternalMw()),
|
|
288
|
-
o.use(n.rollupReactPluginMw()),
|
|
289
|
-
o.use(n.insertTsMw()),
|
|
290
|
-
o.getResult()
|
|
291
|
-
);
|
|
292
|
-
},
|
|
293
|
-
v = (function () {
|
|
294
|
-
var o = u(
|
|
295
|
-
s().m(function o(i) {
|
|
296
|
-
var c, a, l, f;
|
|
297
|
-
return s().w(function (o) {
|
|
298
|
-
for (;;)
|
|
299
|
-
switch (o.n) {
|
|
300
|
-
case 0:
|
|
301
|
-
return (
|
|
302
|
-
(c = i.rollupOutputList),
|
|
303
|
-
(a = c.length > 1),
|
|
304
|
-
(l = new n.Compiler(i.rollupOptions)),
|
|
305
|
-
(o.n = 1),
|
|
306
|
-
l.input()
|
|
307
|
-
);
|
|
308
|
-
case 1:
|
|
309
|
-
return (
|
|
310
|
-
(f = o.v),
|
|
311
|
-
o.a(
|
|
312
|
-
2,
|
|
313
|
-
Promise.all(
|
|
314
|
-
c.map(
|
|
315
|
-
(function () {
|
|
316
|
-
var o = u(
|
|
317
|
-
s().m(function o(u) {
|
|
318
|
-
var c;
|
|
319
|
-
return s().w(function (o) {
|
|
320
|
-
for (;;)
|
|
321
|
-
if (0 === o.n)
|
|
322
|
-
return (
|
|
323
|
-
(c = n.getOutputRuntime(
|
|
324
|
-
u,
|
|
325
|
-
a,
|
|
326
|
-
i.envParams.workRootDir
|
|
327
|
-
)),
|
|
328
|
-
o.a(
|
|
329
|
-
2,
|
|
330
|
-
f.output(c).then(function () {
|
|
331
|
-
e.cLog.info(
|
|
332
|
-
'build',
|
|
333
|
-
'success',
|
|
334
|
-
'输出类型 => '.concat(
|
|
335
|
-
c.format,
|
|
336
|
-
';'
|
|
337
|
-
),
|
|
338
|
-
'路径 =>'.concat(
|
|
339
|
-
t.relative(r.getCwd(), c.file)
|
|
340
|
-
)
|
|
341
|
-
);
|
|
342
|
-
})
|
|
343
|
-
)
|
|
344
|
-
);
|
|
345
|
-
}, o);
|
|
346
|
-
})
|
|
347
|
-
);
|
|
348
|
-
return function (t) {
|
|
349
|
-
return o.apply(this, arguments);
|
|
350
|
-
};
|
|
351
|
-
})()
|
|
352
|
-
)
|
|
353
|
-
)
|
|
354
|
-
)
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
}, o);
|
|
358
|
-
})
|
|
359
|
-
);
|
|
360
|
-
return function (t) {
|
|
361
|
-
return o.apply(this, arguments);
|
|
362
|
-
};
|
|
363
|
-
})(),
|
|
364
|
-
d = function (t, r) {
|
|
365
|
-
var o = e.configCtxWorkflow(new n.Ctx(t));
|
|
366
|
-
return (
|
|
367
|
-
o.use(n.envParamsMw(r)),
|
|
368
|
-
o.use(n.rollupInputMw()),
|
|
369
|
-
o.use(n.rollupDtsInoutMw()),
|
|
370
|
-
o.use(n.rollupDtsExternalMw()),
|
|
371
|
-
o.use(n.rollupDtsPluginMw()),
|
|
372
|
-
o.getResult()
|
|
373
|
-
);
|
|
374
|
-
},
|
|
375
|
-
h = (function () {
|
|
376
|
-
var o = u(
|
|
377
|
-
s().m(function o(u) {
|
|
378
|
-
var i, c, a, l, f, p;
|
|
379
|
-
return s().w(function (o) {
|
|
380
|
-
for (;;)
|
|
381
|
-
switch (o.n) {
|
|
382
|
-
case 0:
|
|
383
|
-
if (((i = u.configCtx.getDoraConfig()), i.dts)) {
|
|
384
|
-
o.n = 1;
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
return (
|
|
388
|
-
e.cLog.log(
|
|
389
|
-
'dts',
|
|
390
|
-
'skip',
|
|
391
|
-
'未配置 dts 相关配置, 跳过打包类型声明文件'
|
|
392
|
-
),
|
|
393
|
-
o.a(2)
|
|
394
|
-
);
|
|
395
|
-
case 1:
|
|
396
|
-
if (
|
|
397
|
-
((c = u.rollupOptions.input),
|
|
398
|
-
(a = u.rollupOutputList[0].file),
|
|
399
|
-
t
|
|
400
|
-
.extname(c || '')
|
|
401
|
-
.toLowerCase()
|
|
402
|
-
.includes('ts'))
|
|
403
|
-
) {
|
|
404
|
-
o.n = 2;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
return (
|
|
408
|
-
e.cLog.log(
|
|
409
|
-
'dts ',
|
|
410
|
-
'skip',
|
|
411
|
-
'类型声明文件入口 '.concat(
|
|
412
|
-
c,
|
|
413
|
-
' 不是 .ts 或 .tsx 结尾, 跳过打包类型声明文件'
|
|
414
|
-
)
|
|
415
|
-
),
|
|
416
|
-
o.a(2)
|
|
417
|
-
);
|
|
418
|
-
case 2:
|
|
419
|
-
return (
|
|
420
|
-
e.cLog.log('dts ', 'init', '开始打包类型声明文件'),
|
|
421
|
-
(l = u.rollupOutputList[0]),
|
|
422
|
-
(f = new n.Compiler(u.rollupOptions)),
|
|
423
|
-
(o.n = 3),
|
|
424
|
-
f.input()
|
|
425
|
-
);
|
|
426
|
-
case 3:
|
|
427
|
-
return (
|
|
428
|
-
(p = o.v),
|
|
429
|
-
o.a(
|
|
430
|
-
2,
|
|
431
|
-
p.output(l).then(function () {
|
|
432
|
-
e.cLog.info(
|
|
433
|
-
'dts',
|
|
434
|
-
'success',
|
|
435
|
-
'输出类型 => ts;',
|
|
436
|
-
'路径 =>'.concat(t.relative(r.getCwd(), a))
|
|
437
|
-
);
|
|
438
|
-
})
|
|
439
|
-
)
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
}, o);
|
|
443
|
-
})
|
|
444
|
-
);
|
|
445
|
-
return function (t) {
|
|
446
|
-
return o.apply(this, arguments);
|
|
447
|
-
};
|
|
448
|
-
})(),
|
|
449
|
-
y = (function () {
|
|
450
|
-
var t = u(
|
|
451
|
-
s().m(function t(r, n) {
|
|
452
|
-
var o, u;
|
|
453
|
-
return s().w(function (t) {
|
|
454
|
-
for (;;)
|
|
455
|
-
switch (t.n) {
|
|
456
|
-
case 0:
|
|
457
|
-
return (
|
|
458
|
-
e.cLog.log('build', 'init', '开始打包'),
|
|
459
|
-
(o = v),
|
|
460
|
-
(t.n = 1),
|
|
461
|
-
g(r, n)
|
|
462
|
-
);
|
|
463
|
-
case 1:
|
|
464
|
-
return ((t.n = 2), o(t.v));
|
|
465
|
-
case 2:
|
|
466
|
-
return ((u = h), (t.n = 3), d(r, n));
|
|
467
|
-
case 3:
|
|
468
|
-
return ((t.n = 4), u(t.v));
|
|
469
|
-
case 4:
|
|
470
|
-
e.cLog.info('build', 'all_end', '打包完成', '🎉🎉🎉');
|
|
471
|
-
case 5:
|
|
472
|
-
return t.a(2);
|
|
473
|
-
}
|
|
474
|
-
}, t);
|
|
475
|
-
})
|
|
476
|
-
);
|
|
477
|
-
return function (e, r) {
|
|
478
|
-
return t.apply(this, arguments);
|
|
479
|
-
};
|
|
480
|
-
})(),
|
|
481
|
-
b = (function () {
|
|
482
|
-
var t = u(
|
|
483
|
-
s().m(function t(r, n) {
|
|
484
|
-
var o;
|
|
485
|
-
return s().w(function (t) {
|
|
486
|
-
for (;;)
|
|
487
|
-
switch (t.n) {
|
|
488
|
-
case 0:
|
|
489
|
-
(e.cLog.log(
|
|
490
|
-
'build',
|
|
491
|
-
'start',
|
|
492
|
-
'开始执行多任务构建,共 '.concat(r.length, ' 个任务')
|
|
493
|
-
),
|
|
494
|
-
(o = 0));
|
|
495
|
-
case 1:
|
|
496
|
-
if (!(o < r.length)) {
|
|
497
|
-
t.n = 4;
|
|
498
|
-
break;
|
|
499
|
-
}
|
|
500
|
-
return ((t.n = 2), y(r[o], n));
|
|
501
|
-
case 2:
|
|
502
|
-
e.cLog.log(
|
|
503
|
-
'build',
|
|
504
|
-
'task_end',
|
|
505
|
-
'第 '
|
|
506
|
-
.concat(o + 1, ' 个任务构建结束,共 ')
|
|
507
|
-
.concat(r.length, ' 个任务')
|
|
508
|
-
);
|
|
509
|
-
case 3:
|
|
510
|
-
(o++, (t.n = 1));
|
|
511
|
-
break;
|
|
512
|
-
case 4:
|
|
513
|
-
e.cLog.info('build', 'all_end', '多任务构建结束');
|
|
514
|
-
case 5:
|
|
515
|
-
return t.a(2);
|
|
516
|
-
}
|
|
517
|
-
}, t);
|
|
518
|
-
})
|
|
519
|
-
);
|
|
520
|
-
return function (e, r) {
|
|
521
|
-
return t.apply(this, arguments);
|
|
522
|
-
};
|
|
523
|
-
})(),
|
|
524
|
-
O = (function () {
|
|
525
|
-
var r = u(
|
|
526
|
-
s().m(function r(n) {
|
|
527
|
-
var o, u, i, c, a, l;
|
|
528
|
-
return s().w(function (r) {
|
|
529
|
-
for (;;)
|
|
530
|
-
switch (r.n) {
|
|
531
|
-
case 0:
|
|
532
|
-
return (
|
|
533
|
-
(o = {
|
|
534
|
-
workRootDir:
|
|
535
|
-
null != n && n.workRootDir
|
|
536
|
-
? t.resolve(null == n ? void 0 : n.workRootDir)
|
|
537
|
-
: process.cwd(),
|
|
538
|
-
action: 'build',
|
|
539
|
-
}),
|
|
540
|
-
(r.n = 1),
|
|
541
|
-
w(o, n, p)
|
|
542
|
-
);
|
|
543
|
-
case 1:
|
|
544
|
-
if (
|
|
545
|
-
((u = r.v),
|
|
546
|
-
(i = u.getDoraConfig()),
|
|
547
|
-
(c = e.splitDoraCliConfig(i)).length)
|
|
548
|
-
) {
|
|
549
|
-
r.n = 2;
|
|
550
|
-
break;
|
|
551
|
-
}
|
|
552
|
-
return (
|
|
553
|
-
e.cLog.error('init', 'error', '没有找到构建任务'),
|
|
554
|
-
r.a(2)
|
|
555
|
-
);
|
|
556
|
-
case 2:
|
|
557
|
-
if (1 !== c.length) {
|
|
558
|
-
r.n = 3;
|
|
559
|
-
break;
|
|
560
|
-
}
|
|
561
|
-
return ((a = u.copy()).setDoraConfig(c[0]), r.a(2, y(a, o)));
|
|
562
|
-
case 3:
|
|
563
|
-
return (
|
|
564
|
-
(l = c.map(function (t) {
|
|
565
|
-
var e = u.copy();
|
|
566
|
-
return (e.setDoraConfig(t), e);
|
|
567
|
-
})),
|
|
568
|
-
r.a(2, b(l, o))
|
|
569
|
-
);
|
|
570
|
-
}
|
|
571
|
-
}, r);
|
|
572
|
-
})
|
|
573
|
-
);
|
|
574
|
-
return function (t) {
|
|
575
|
-
return r.apply(this, arguments);
|
|
576
|
-
};
|
|
577
|
-
})(),
|
|
578
|
-
k = a(a({}, f), {}, { clear: !1, minimize: !1 }),
|
|
579
|
-
j = function (t, r) {
|
|
580
|
-
var o = e.configCtxWorkflow(new n.Ctx(t));
|
|
581
|
-
return (
|
|
582
|
-
o.use(n.envParamsMw(r)),
|
|
583
|
-
o.use(n.rollupInoutMw()),
|
|
584
|
-
o.use(n.rollupWatchMw()),
|
|
585
|
-
o.use(n.rollupExternalMw()),
|
|
586
|
-
o.use(n.rollupReactPluginMw()),
|
|
587
|
-
o.use(n.insertTsMw()),
|
|
588
|
-
o.use(n.rollupWatchOutputMw()),
|
|
589
|
-
o.getResult()
|
|
590
|
-
);
|
|
591
|
-
},
|
|
592
|
-
C = (function () {
|
|
593
|
-
var t = u(
|
|
594
|
-
s().m(function t(e) {
|
|
595
|
-
var r, o;
|
|
596
|
-
return s().w(function (t) {
|
|
597
|
-
for (;;)
|
|
598
|
-
switch (t.n) {
|
|
599
|
-
case 0:
|
|
600
|
-
((r = new n.Compiler(e)),
|
|
601
|
-
(o = r.watch({ logLevel: 'debug' })),
|
|
602
|
-
n.rollupWatchLog(o));
|
|
603
|
-
case 1:
|
|
604
|
-
return t.a(2);
|
|
605
|
-
}
|
|
606
|
-
}, t);
|
|
607
|
-
})
|
|
608
|
-
);
|
|
609
|
-
return function (e) {
|
|
610
|
-
return t.apply(this, arguments);
|
|
611
|
-
};
|
|
612
|
-
})(),
|
|
613
|
-
D = (function () {
|
|
614
|
-
var t = u(
|
|
615
|
-
s().m(function t(r, n) {
|
|
616
|
-
var o, u, i, c;
|
|
617
|
-
return s().w(function (t) {
|
|
618
|
-
for (;;)
|
|
619
|
-
switch (t.n) {
|
|
620
|
-
case 0:
|
|
621
|
-
if (((o = r[0]), (u = o.getCmd()), !u.watch)) {
|
|
622
|
-
t.n = 3;
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
return (
|
|
626
|
-
e.cLog.log(
|
|
627
|
-
'dev',
|
|
628
|
-
'watch_start',
|
|
629
|
-
'watch 模式下只会启动第一个任务,共 '.concat(
|
|
630
|
-
r.length,
|
|
631
|
-
' 个任务'
|
|
632
|
-
)
|
|
633
|
-
),
|
|
634
|
-
(t.n = 1),
|
|
635
|
-
j(o, n)
|
|
636
|
-
);
|
|
637
|
-
case 1:
|
|
638
|
-
return (
|
|
639
|
-
(i = t.v).updateEnvParams(n),
|
|
640
|
-
(t.n = 2),
|
|
641
|
-
C(i.rollupOptions)
|
|
642
|
-
);
|
|
643
|
-
case 2:
|
|
644
|
-
return t.a(2);
|
|
645
|
-
case 3:
|
|
646
|
-
(e.cLog.log(
|
|
647
|
-
'dev',
|
|
648
|
-
'start',
|
|
649
|
-
'开始执行多任务构建,共 '.concat(r.length, ' 个任务')
|
|
650
|
-
),
|
|
651
|
-
(c = 0));
|
|
652
|
-
case 4:
|
|
653
|
-
if (!(c < r.length)) {
|
|
654
|
-
t.n = 7;
|
|
655
|
-
break;
|
|
656
|
-
}
|
|
657
|
-
return ((t.n = 5), y(r[c], n));
|
|
658
|
-
case 5:
|
|
659
|
-
e.cLog.log(
|
|
660
|
-
'dev',
|
|
661
|
-
'task_end',
|
|
662
|
-
'第 '
|
|
663
|
-
.concat(c + 1, ' 个任务构建结束,共 ')
|
|
664
|
-
.concat(r.length, ' 个任务')
|
|
665
|
-
);
|
|
666
|
-
case 6:
|
|
667
|
-
(c++, (t.n = 4));
|
|
668
|
-
break;
|
|
669
|
-
case 7:
|
|
670
|
-
e.cLog.info('dev', 'all_end', '多任务构建结束');
|
|
671
|
-
case 8:
|
|
672
|
-
return t.a(2);
|
|
673
|
-
}
|
|
674
|
-
}, t);
|
|
675
|
-
})
|
|
676
|
-
);
|
|
677
|
-
return function (e, r) {
|
|
678
|
-
return t.apply(this, arguments);
|
|
679
|
-
};
|
|
680
|
-
})(),
|
|
681
|
-
P = (function () {
|
|
682
|
-
var t = u(
|
|
683
|
-
s().m(function t(e, r) {
|
|
684
|
-
var n, o;
|
|
685
|
-
return s().w(function (t) {
|
|
686
|
-
for (;;)
|
|
687
|
-
switch (t.n) {
|
|
688
|
-
case 0:
|
|
689
|
-
if (((n = e.getCmd()), !n.watch)) {
|
|
690
|
-
t.n = 3;
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
return ((t.n = 1), j(e, r));
|
|
694
|
-
case 1:
|
|
695
|
-
return ((o = t.v), (t.n = 2), C(o.rollupOptions));
|
|
696
|
-
case 2:
|
|
697
|
-
case 4:
|
|
698
|
-
return t.a(2);
|
|
699
|
-
case 3:
|
|
700
|
-
return ((t.n = 4), y(e, r));
|
|
701
|
-
}
|
|
702
|
-
}, t);
|
|
703
|
-
})
|
|
704
|
-
);
|
|
705
|
-
return function (e, r) {
|
|
706
|
-
return t.apply(this, arguments);
|
|
707
|
-
};
|
|
708
|
-
})(),
|
|
709
|
-
M = (function () {
|
|
710
|
-
var r = u(
|
|
711
|
-
s().m(function r(n) {
|
|
712
|
-
var o, u, i, c, a, l;
|
|
713
|
-
return s().w(function (r) {
|
|
714
|
-
for (;;)
|
|
715
|
-
switch (r.n) {
|
|
716
|
-
case 0:
|
|
717
|
-
return (
|
|
718
|
-
(o = (n || {}).watch),
|
|
719
|
-
(u = {
|
|
720
|
-
workRootDir:
|
|
721
|
-
null != n && n.workRootDir
|
|
722
|
-
? t.resolve(null == n ? void 0 : n.workRootDir)
|
|
723
|
-
: process.cwd(),
|
|
724
|
-
action: o ? 'watch' : 'dev',
|
|
725
|
-
}),
|
|
726
|
-
(r.n = 1),
|
|
727
|
-
w(u, n, k)
|
|
728
|
-
);
|
|
729
|
-
case 1:
|
|
730
|
-
if (
|
|
731
|
-
((i = r.v),
|
|
732
|
-
(c = i.getDoraConfig()),
|
|
733
|
-
(a = e.splitDoraCliConfig(c)).length)
|
|
734
|
-
) {
|
|
735
|
-
r.n = 2;
|
|
736
|
-
break;
|
|
737
|
-
}
|
|
738
|
-
return (
|
|
739
|
-
e.cLog.error('init', 'error', '没有找到构建任务'),
|
|
740
|
-
r.a(2)
|
|
741
|
-
);
|
|
742
|
-
case 2:
|
|
743
|
-
if (1 !== a.length) {
|
|
744
|
-
r.n = 3;
|
|
745
|
-
break;
|
|
746
|
-
}
|
|
747
|
-
return r.a(2, P(i, u));
|
|
748
|
-
case 3:
|
|
749
|
-
return (
|
|
750
|
-
(l = a.map(function (t) {
|
|
751
|
-
var e = i.copy();
|
|
752
|
-
return (e.setDoraConfig(t), e);
|
|
753
|
-
})),
|
|
754
|
-
r.a(2, D(l, u))
|
|
755
|
-
);
|
|
756
|
-
}
|
|
757
|
-
}, r);
|
|
758
|
-
})
|
|
759
|
-
);
|
|
760
|
-
return function (t) {
|
|
761
|
-
return r.apply(this, arguments);
|
|
762
|
-
};
|
|
763
|
-
})(),
|
|
764
|
-
x = {
|
|
765
|
-
name: '@doracli/rollup-node',
|
|
766
|
-
usage: 'drn <command> [option]',
|
|
767
|
-
version: '0.0.3',
|
|
768
|
-
childCommands: [
|
|
769
|
-
{
|
|
770
|
-
command: 'dev',
|
|
771
|
-
description: 'run a project by dev',
|
|
772
|
-
options: [
|
|
773
|
-
{
|
|
774
|
-
name: 'watch',
|
|
775
|
-
simpleName: 'w',
|
|
776
|
-
type: '[boolean]',
|
|
777
|
-
description: 'set output module type',
|
|
778
|
-
defaultValue: !1,
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
name: 'format',
|
|
782
|
-
simpleName: 'f',
|
|
783
|
-
type: "<'amd','cjs','es','iife','system','umd','commonjs','esm','module','systemjs'>",
|
|
784
|
-
description: 'set output module type',
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
name: 'workRootDir',
|
|
788
|
-
simpleName: 'r',
|
|
789
|
-
type: '[string]',
|
|
790
|
-
description: 'set work root path',
|
|
791
|
-
defaultValue: './',
|
|
792
|
-
},
|
|
793
|
-
],
|
|
794
|
-
action: function (t) {
|
|
795
|
-
M(t);
|
|
796
|
-
},
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
command: 'build',
|
|
800
|
-
description: 'build a project by dev',
|
|
801
|
-
options: [
|
|
802
|
-
{
|
|
803
|
-
name: 'format',
|
|
804
|
-
simpleName: 'f',
|
|
805
|
-
type: '<"amd","cjs","es","iife","system","umd","commonjs","esm","module","systemjs">',
|
|
806
|
-
description: 'set output module type',
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
name: 'workRootDir',
|
|
810
|
-
simpleName: 'r',
|
|
811
|
-
type: '[string]',
|
|
812
|
-
description: 'set work root path',
|
|
813
|
-
defaultValue: './',
|
|
814
|
-
},
|
|
815
|
-
],
|
|
816
|
-
action: function (t) {
|
|
817
|
-
O(t);
|
|
818
|
-
},
|
|
819
|
-
},
|
|
820
|
-
],
|
|
821
|
-
};
|
|
822
|
-
((exports.buildEntry = O),
|
|
823
|
-
(exports.buildMultiple = b),
|
|
824
|
-
(exports.buildSingle = y),
|
|
825
|
-
(exports.commandOptions = x),
|
|
826
|
-
(exports.devEntry = M),
|
|
827
|
-
(exports.devSingle = P));
|
|
1
|
+
"use strict";var t=require("path"),e=require("@doracli/helper"),r=require("@dorabag/file-pro"),n=require("@doracli/rollup");function o(t,e,r,n,o,u,i){try{var c=t[u](i),a=c.value}catch(t){return void r(t)}c.done?e(a):Promise.resolve(a).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise(function(n,u){var i=t.apply(e,r);function c(t){o(i,n,u,c,a,"next",t)}function a(t){o(i,n,u,c,a,"throw",t)}c(void 0)})}}function i(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function s(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
+
var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function u(r,n,o,u){var a=n&&n.prototype instanceof c?n:c,s=Object.create(a.prototype);return l(s,"_invoke",function(r,n,o){var u,c,a,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:m,f:m.bind(t,4),d:function(e,r){return u=e,c=0,a=t,p.n=r,i}};function m(r,n){for(c=r,a=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,u=l[e],m=p.p,w=u[2];r>3?(o=w===n)&&(a=u[(c=u[4])?5:(c=3,3)],u[4]=u[5]=t):u[0]<=m&&((o=r<2&&m<u[1])?(c=0,p.v=n,p.n=u[1]):m<w&&(o=r<3||u[0]>n||n>w)&&(u[4]=r,u[5]=n,p.n=w,c=0))}if(o||r>1)return i;throw f=!0,n}return function(o,l,w){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&m(l,w),c=l,a=w;(e=c<2?t:a)||!f;){u||(c?c<3?(c>1&&(p.n=-1),m(c,a)):p.n=a:p.v=a);try{if(s=2,u){if(c||(o="next"),e=u[o]){if(!(e=e.call(u,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,c<2&&(c=0)}else 1===c&&(e=u.return)&&e.call(u),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);u=t}else if((e=(f=p.n<0)?a:r.call(n,p))!==i)break}catch(e){u=t,c=1,a=e}finally{s=1}}return{value:e,done:f}}}(r,o,u),!0),s}var i={};function c(){}function a(){}function f(){}e=Object.getPrototypeOf;var p=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),m=f.prototype=c.prototype=Object.create(p);function w(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,l(t,o,"GeneratorFunction")),t.prototype=Object.create(m),t}return a.prototype=f,l(m,"constructor",f),l(f,"constructor",a),a.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(m),l(m,o,"Generator"),l(m,n,function(){return this}),l(m,"toString",function(){return"[object Generator]"}),(s=function(){return{w:u,m:w}})()}function l(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}l=function(t,e,r,n){function u(e,r){l(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(u("next",0),u("throw",1),u("return",2))},l(t,e,r,n)}var f={multiple:!1,output:{path:"./lib"},formatList:["cjs","esm"],alias:{},externals:[],internals:[],minimize:!0,clear:!1,copy:[],dts:{}},p=a(a({},f),{},{minimize:!0,clear:!0}),m={dev:"development",build:"production",watch:"development"},w=function(){var t=u(s().m(function t(r,n,o){var u;return s().w(function(t){for(;;)switch(t.n){case 0:return(u=e.configCtxWorkflow(new e.ConfigCtx)).use(e.collectBaseConfigMw(r.workRootDir,n)),u.use(e.collectPackageJsonMw()),u.use(e.collectTsconfigJsonMw()),u.use(e.collectDoraConfigMw(m[r.action])),u.use(e.wholeDoraConfigMw(o)),u.use(e.wholeDoraInoutMw()),u.use(e.clearMw()),t.n=1,u.getResult();case 1:return t.a(2,t.v)}},t)}));return function(e,r,n){return t.apply(this,arguments)}}(),g=function(t,r){var o=e.configCtxWorkflow(new n.Ctx(t));return o.use(n.envParamsMw(r)),o.use(n.rollupInoutMw()),o.use(n.rollupExternalMw()),o.use(n.rollupReactPluginMw()),o.use(n.insertTsMw()),o.getResult()},v=function(){var o=u(s().m(function o(i){var c,a,l,f;return s().w(function(o){for(;;)switch(o.n){case 0:return c=i.rollupOutputList,a=c.length>1,l=new n.Compiler(i.rollupOptions),o.n=1,l.input();case 1:return f=o.v,o.a(2,Promise.all(c.map(function(){var o=u(s().m(function o(u){var c;return s().w(function(o){for(;;)if(0===o.n)return c=n.getOutputRuntime(u,a,i.envParams.workRootDir),o.a(2,f.output(c).then(function(){e.cLog.info("build","success","输出类型 => ".concat(c.format,";"),"路径 =>".concat(t.relative(r.getCwd(),c.file)))}))},o)}));return function(t){return o.apply(this,arguments)}}())))}},o)}));return function(t){return o.apply(this,arguments)}}(),d=function(t,r){var o=e.configCtxWorkflow(new n.Ctx(t));return o.use(n.envParamsMw(r)),o.use(n.rollupInputMw()),o.use(n.rollupDtsInoutMw()),o.use(n.rollupDtsExternalMw()),o.use(n.rollupDtsPluginMw()),o.getResult()},h=function(){var o=u(s().m(function o(u){var i,c,a,l,f,p;return s().w(function(o){for(;;)switch(o.n){case 0:if(i=u.configCtx.getDoraConfig(),i.dts){o.n=1;break}return e.cLog.log("dts","skip","未配置 dts 相关配置, 跳过打包类型声明文件"),o.a(2);case 1:if(c=u.rollupOptions.input,a=u.rollupOutputList[0].file,t.extname(c||"").toLowerCase().includes("ts")){o.n=2;break}return e.cLog.log("dts ","skip","类型声明文件入口 ".concat(c," 不是 .ts 或 .tsx 结尾, 跳过打包类型声明文件")),o.a(2);case 2:return e.cLog.log("dts ","init","开始打包类型声明文件"),l=u.rollupOutputList[0],f=new n.Compiler(u.rollupOptions),o.n=3,f.input();case 3:return p=o.v,o.a(2,p.output(l).then(function(){e.cLog.info("dts","success","输出类型 => ts;","路径 =>".concat(t.relative(r.getCwd(),a)))}))}},o)}));return function(t){return o.apply(this,arguments)}}(),y=function(){var t=u(s().m(function t(r,n){var o,u;return s().w(function(t){for(;;)switch(t.n){case 0:return e.cLog.log("build","init","开始打包"),o=v,t.n=1,g(r,n);case 1:return t.n=2,o(t.v);case 2:return u=h,t.n=3,d(r,n);case 3:return t.n=4,u(t.v);case 4:e.cLog.info("build","all_end","打包完成","🎉🎉🎉");case 5:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}(),b=function(){var t=u(s().m(function t(r,n){var o;return s().w(function(t){for(;;)switch(t.n){case 0:e.cLog.log("build","start","开始执行多任务构建,共 ".concat(r.length," 个任务")),o=0;case 1:if(!(o<r.length)){t.n=4;break}return t.n=2,y(r[o],n);case 2:e.cLog.log("build","task_end","第 ".concat(o+1," 个任务构建结束,共 ").concat(r.length," 个任务"));case 3:o++,t.n=1;break;case 4:e.cLog.info("build","all_end","多任务构建结束");case 5:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}(),O=function(){var r=u(s().m(function r(n){var o,u,i,c,a,l;return s().w(function(r){for(;;)switch(r.n){case 0:return o={workRootDir:null!=n&&n.workRootDir?t.resolve(null==n?void 0:n.workRootDir):process.cwd(),action:"build"},r.n=1,w(o,n,p);case 1:if(u=r.v,i=u.getDoraConfig(),(c=e.splitDoraCliConfig(i)).length){r.n=2;break}return e.cLog.error("init","error","没有找到构建任务"),r.a(2);case 2:if(1!==c.length){r.n=3;break}return(a=u.copy()).setDoraConfig(c[0]),r.a(2,y(a,o));case 3:return l=c.map(function(t){var e=u.copy();return e.setDoraConfig(t),e}),r.a(2,b(l,o))}},r)}));return function(t){return r.apply(this,arguments)}}(),k=a(a({},f),{},{clear:!1,minimize:!1}),j=function(t,r){var o=e.configCtxWorkflow(new n.Ctx(t));return o.use(n.envParamsMw(r)),o.use(n.rollupInoutMw()),o.use(n.rollupWatchMw()),o.use(n.rollupExternalMw()),o.use(n.rollupReactPluginMw()),o.use(n.insertTsMw()),o.use(n.rollupWatchOutputMw()),o.getResult()},C=function(){var t=u(s().m(function t(e){var r,o;return s().w(function(t){for(;;)switch(t.n){case 0:r=new n.Compiler(e),o=r.watch({logLevel:"debug"}),n.rollupWatchLog(o);case 1:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),D=function(){var t=u(s().m(function t(r,n){var o,u,i,c;return s().w(function(t){for(;;)switch(t.n){case 0:if(o=r[0],u=o.getCmd(),!u.watch){t.n=3;break}return e.cLog.log("dev","watch_start","watch 模式下只会启动第一个任务,共 ".concat(r.length," 个任务")),t.n=1,j(o,n);case 1:return(i=t.v).updateEnvParams(n),t.n=2,C(i.rollupOptions);case 2:return t.a(2);case 3:e.cLog.log("dev","start","开始执行多任务构建,共 ".concat(r.length," 个任务")),c=0;case 4:if(!(c<r.length)){t.n=7;break}return t.n=5,y(r[c],n);case 5:e.cLog.log("dev","task_end","第 ".concat(c+1," 个任务构建结束,共 ").concat(r.length," 个任务"));case 6:c++,t.n=4;break;case 7:e.cLog.info("dev","all_end","多任务构建结束");case 8:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}(),P=function(){var t=u(s().m(function t(e,r){var n,o;return s().w(function(t){for(;;)switch(t.n){case 0:if(n=e.getCmd(),!n.watch){t.n=3;break}return t.n=1,j(e,r);case 1:return o=t.v,t.n=2,C(o.rollupOptions);case 2:case 4:return t.a(2);case 3:return t.n=4,y(e,r)}},t)}));return function(e,r){return t.apply(this,arguments)}}(),M=function(){var r=u(s().m(function r(n){var o,u,i,c,a,l;return s().w(function(r){for(;;)switch(r.n){case 0:return o=(n||{}).watch,u={workRootDir:null!=n&&n.workRootDir?t.resolve(null==n?void 0:n.workRootDir):process.cwd(),action:o?"watch":"dev"},r.n=1,w(u,n,k);case 1:if(i=r.v,c=i.getDoraConfig(),(a=e.splitDoraCliConfig(c)).length){r.n=2;break}return e.cLog.error("init","error","没有找到构建任务"),r.a(2);case 2:if(1!==a.length){r.n=3;break}return r.a(2,P(i,u));case 3:return l=a.map(function(t){var e=i.copy();return e.setDoraConfig(t),e}),r.a(2,D(l,u))}},r)}));return function(t){return r.apply(this,arguments)}}(),x={name:"@doracli/rollup-node",usage:"drr <command> [option]",version:"0.0.4",childCommands:[{command:"dev",description:"run a project by dev",options:[{name:"watch",simpleName:"w",type:"[boolean]",description:"set output module type",defaultValue:!1},{name:"format",simpleName:"f",type:"<'amd','cjs','es','iife','system','umd','commonjs','esm','module','systemjs'>",description:"set output module type"},{name:"workRootDir",simpleName:"r",type:"[string]",description:"set work root path",defaultValue:"./"}],action:function(t){M(t)}},{command:"build",description:"build a project by dev",options:[{name:"format",simpleName:"f",type:'<"amd","cjs","es","iife","system","umd","commonjs","esm","module","systemjs">',description:"set output module type"},{name:"workRootDir",simpleName:"r",type:"[string]",description:"set work root path",defaultValue:"./"}],action:function(t){O(t)}}]};exports.buildEntry=O,exports.buildMultiple=b,exports.buildSingle=y,exports.commandOptions=x,exports.devEntry=M,exports.devSingle=P;
|