@doracli/rspack 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/lib/cjs/index.js +918 -510
- package/lib/esm/index.js +877 -505
- package/lib/type/index.d.ts +130 -54
- package/package.json +11 -11
package/lib/esm/index.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import path, { isAbsolute, join } from 'path';
|
|
2
|
+
import { isArray, isObject, noop } from '@cclr/lang';
|
|
3
|
+
import {
|
|
4
|
+
getCwd,
|
|
5
|
+
getDirname,
|
|
6
|
+
getPackageRoot,
|
|
7
|
+
lookupFile,
|
|
8
|
+
requireResolve,
|
|
9
|
+
resolveCwd,
|
|
10
|
+
} from '@dorabag/file-pro';
|
|
2
11
|
import openBrowser from '@dorabag/open-browser';
|
|
3
|
-
import {
|
|
12
|
+
import { cLog, CompilerBase, insertTsconfig } from '@doracli/helper';
|
|
4
13
|
import rspack, { CssExtractRspackPlugin } from '@rspack/core';
|
|
5
14
|
import { RspackDevServer } from '@rspack/dev-server';
|
|
6
|
-
import { resolveCwd, lookupFile, requireResolve, getDirname, getPackageRoot, getCwd } from '@dorabag/file-pro';
|
|
7
|
-
import path, { isAbsolute, join } from 'path';
|
|
8
15
|
import HtmlRspackPlugin from '@rspack/plugin-html';
|
|
9
16
|
|
|
10
17
|
function _arrayLikeToArray(r, a) {
|
|
@@ -19,7 +26,10 @@ function _arrayWithoutHoles(r) {
|
|
|
19
26
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
20
27
|
}
|
|
21
28
|
function _assertThisInitialized(e) {
|
|
22
|
-
if (void 0 === e)
|
|
29
|
+
if (void 0 === e)
|
|
30
|
+
throw new ReferenceError(
|
|
31
|
+
"this hasn't been initialised - super() hasn't been called"
|
|
32
|
+
);
|
|
23
33
|
return e;
|
|
24
34
|
}
|
|
25
35
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
@@ -38,70 +48,108 @@ function _asyncToGenerator(n) {
|
|
|
38
48
|
return new Promise(function (r, o) {
|
|
39
49
|
var a = n.apply(t, e);
|
|
40
50
|
function _next(n) {
|
|
41
|
-
asyncGeneratorStep(a, r, o, _next, _throw,
|
|
51
|
+
asyncGeneratorStep(a, r, o, _next, _throw, 'next', n);
|
|
42
52
|
}
|
|
43
53
|
function _throw(n) {
|
|
44
|
-
asyncGeneratorStep(a, r, o, _next, _throw,
|
|
54
|
+
asyncGeneratorStep(a, r, o, _next, _throw, 'throw', n);
|
|
45
55
|
}
|
|
46
56
|
_next(void 0);
|
|
47
57
|
});
|
|
48
58
|
};
|
|
49
59
|
}
|
|
50
60
|
function _callSuper(t, o, e) {
|
|
51
|
-
return
|
|
61
|
+
return (
|
|
62
|
+
(o = _getPrototypeOf(o)),
|
|
63
|
+
_possibleConstructorReturn(
|
|
64
|
+
t,
|
|
65
|
+
_isNativeReflectConstruct()
|
|
66
|
+
? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor)
|
|
67
|
+
: o.apply(t, e)
|
|
68
|
+
)
|
|
69
|
+
);
|
|
52
70
|
}
|
|
53
71
|
function _classCallCheck(a, n) {
|
|
54
|
-
if (!(a instanceof n))
|
|
72
|
+
if (!(a instanceof n))
|
|
73
|
+
throw new TypeError('Cannot call a class as a function');
|
|
55
74
|
}
|
|
56
75
|
function _defineProperties(e, r) {
|
|
57
76
|
for (var t = 0; t < r.length; t++) {
|
|
58
77
|
var o = r[t];
|
|
59
|
-
o.enumerable = o.enumerable || false
|
|
78
|
+
((o.enumerable = o.enumerable || false),
|
|
79
|
+
(o.configurable = true),
|
|
80
|
+
'value' in o && (o.writable = true),
|
|
81
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o));
|
|
60
82
|
}
|
|
61
83
|
}
|
|
62
84
|
function _createClass(e, r, t) {
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
85
|
+
return (
|
|
86
|
+
r && _defineProperties(e.prototype, r),
|
|
87
|
+
Object.defineProperty(e, 'prototype', {
|
|
88
|
+
writable: false,
|
|
89
|
+
}),
|
|
90
|
+
e
|
|
91
|
+
);
|
|
66
92
|
}
|
|
67
93
|
function _defineProperty(e, r, t) {
|
|
68
|
-
return (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
return (
|
|
95
|
+
(r = _toPropertyKey(r)) in e
|
|
96
|
+
? Object.defineProperty(e, r, {
|
|
97
|
+
value: t,
|
|
98
|
+
enumerable: true,
|
|
99
|
+
configurable: true,
|
|
100
|
+
writable: true,
|
|
101
|
+
})
|
|
102
|
+
: (e[r] = t),
|
|
103
|
+
e
|
|
104
|
+
);
|
|
74
105
|
}
|
|
75
106
|
function _getPrototypeOf(t) {
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
107
|
+
return (
|
|
108
|
+
(_getPrototypeOf = Object.setPrototypeOf
|
|
109
|
+
? Object.getPrototypeOf.bind()
|
|
110
|
+
: function (t) {
|
|
111
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
112
|
+
}),
|
|
113
|
+
_getPrototypeOf(t)
|
|
114
|
+
);
|
|
79
115
|
}
|
|
80
116
|
function _inherits(t, e) {
|
|
81
|
-
if (
|
|
82
|
-
|
|
117
|
+
if ('function' != typeof e && null !== e)
|
|
118
|
+
throw new TypeError('Super expression must either be null or a function');
|
|
119
|
+
((t.prototype = Object.create(e && e.prototype, {
|
|
83
120
|
constructor: {
|
|
84
121
|
value: t,
|
|
85
122
|
writable: true,
|
|
86
|
-
configurable: true
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
|
|
90
|
-
|
|
123
|
+
configurable: true,
|
|
124
|
+
},
|
|
125
|
+
})),
|
|
126
|
+
Object.defineProperty(t, 'prototype', {
|
|
127
|
+
writable: false,
|
|
128
|
+
}),
|
|
129
|
+
e && _setPrototypeOf(t, e));
|
|
91
130
|
}
|
|
92
131
|
function _isNativeReflectConstruct() {
|
|
93
132
|
try {
|
|
94
|
-
var t = !Boolean.prototype.valueOf.call(
|
|
133
|
+
var t = !Boolean.prototype.valueOf.call(
|
|
134
|
+
Reflect.construct(Boolean, [], function () {})
|
|
135
|
+
);
|
|
95
136
|
} catch (t) {}
|
|
96
137
|
return (_isNativeReflectConstruct = function () {
|
|
97
138
|
return !!t;
|
|
98
139
|
})();
|
|
99
140
|
}
|
|
100
141
|
function _iterableToArray(r) {
|
|
101
|
-
if (
|
|
142
|
+
if (
|
|
143
|
+
('undefined' != typeof Symbol && null != r[Symbol.iterator]) ||
|
|
144
|
+
null != r['@@iterator']
|
|
145
|
+
)
|
|
146
|
+
return Array.from(r);
|
|
102
147
|
}
|
|
103
148
|
function _iterableToArrayLimit(r, l) {
|
|
104
|
-
var t =
|
|
149
|
+
var t =
|
|
150
|
+
null == r
|
|
151
|
+
? null
|
|
152
|
+
: ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
|
|
105
153
|
if (null != t) {
|
|
106
154
|
var e,
|
|
107
155
|
n,
|
|
@@ -111,12 +159,19 @@ function _iterableToArrayLimit(r, l) {
|
|
|
111
159
|
f = true,
|
|
112
160
|
o = false;
|
|
113
161
|
try {
|
|
114
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
162
|
+
if (((i = (t = t.call(r)).next), 0 === l));
|
|
163
|
+
else
|
|
164
|
+
for (
|
|
165
|
+
;
|
|
166
|
+
!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l);
|
|
167
|
+
f = !0
|
|
168
|
+
);
|
|
115
169
|
} catch (r) {
|
|
116
|
-
o = true, n = r;
|
|
170
|
+
((o = true), (n = r));
|
|
117
171
|
} finally {
|
|
118
172
|
try {
|
|
119
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u))
|
|
173
|
+
if (!f && null != t.return && ((u = t.return()), Object(u) !== u))
|
|
174
|
+
return;
|
|
120
175
|
} finally {
|
|
121
176
|
if (o) throw n;
|
|
122
177
|
}
|
|
@@ -125,29 +180,39 @@ function _iterableToArrayLimit(r, l) {
|
|
|
125
180
|
}
|
|
126
181
|
}
|
|
127
182
|
function _nonIterableRest() {
|
|
128
|
-
throw new TypeError(
|
|
183
|
+
throw new TypeError(
|
|
184
|
+
'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
|
|
185
|
+
);
|
|
129
186
|
}
|
|
130
187
|
function _nonIterableSpread() {
|
|
131
|
-
throw new TypeError(
|
|
188
|
+
throw new TypeError(
|
|
189
|
+
'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
|
|
190
|
+
);
|
|
132
191
|
}
|
|
133
192
|
function ownKeys(e, r) {
|
|
134
193
|
var t = Object.keys(e);
|
|
135
194
|
if (Object.getOwnPropertySymbols) {
|
|
136
195
|
var o = Object.getOwnPropertySymbols(e);
|
|
137
|
-
r &&
|
|
138
|
-
|
|
139
|
-
|
|
196
|
+
(r &&
|
|
197
|
+
(o = o.filter(function (r) {
|
|
198
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
199
|
+
})),
|
|
200
|
+
t.push.apply(t, o));
|
|
140
201
|
}
|
|
141
202
|
return t;
|
|
142
203
|
}
|
|
143
204
|
function _objectSpread2(e) {
|
|
144
205
|
for (var r = 1; r < arguments.length; r++) {
|
|
145
206
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
146
|
-
r % 2
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
207
|
+
r % 2
|
|
208
|
+
? ownKeys(Object(t), true).forEach(function (r) {
|
|
209
|
+
_defineProperty(e, r, t[r]);
|
|
210
|
+
})
|
|
211
|
+
: Object.getOwnPropertyDescriptors
|
|
212
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
213
|
+
: ownKeys(Object(t)).forEach(function (r) {
|
|
214
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
215
|
+
});
|
|
151
216
|
}
|
|
152
217
|
return e;
|
|
153
218
|
}
|
|
@@ -158,168 +223,264 @@ function _objectWithoutProperties(e, t) {
|
|
|
158
223
|
i = _objectWithoutPropertiesLoose(e, t);
|
|
159
224
|
if (Object.getOwnPropertySymbols) {
|
|
160
225
|
var n = Object.getOwnPropertySymbols(e);
|
|
161
|
-
for (r = 0; r < n.length; r++)
|
|
226
|
+
for (r = 0; r < n.length; r++)
|
|
227
|
+
((o = n[r]),
|
|
228
|
+
-1 === t.indexOf(o) &&
|
|
229
|
+
{}.propertyIsEnumerable.call(e, o) &&
|
|
230
|
+
(i[o] = e[o]));
|
|
162
231
|
}
|
|
163
232
|
return i;
|
|
164
233
|
}
|
|
165
234
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
166
235
|
if (null == r) return {};
|
|
167
236
|
var t = {};
|
|
168
|
-
for (var n in r)
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
|
|
237
|
+
for (var n in r)
|
|
238
|
+
if ({}.hasOwnProperty.call(r, n)) {
|
|
239
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
240
|
+
t[n] = r[n];
|
|
241
|
+
}
|
|
172
242
|
return t;
|
|
173
243
|
}
|
|
174
244
|
function _possibleConstructorReturn(t, e) {
|
|
175
|
-
if (e && (
|
|
176
|
-
if (void 0 !== e)
|
|
245
|
+
if (e && ('object' == typeof e || 'function' == typeof e)) return e;
|
|
246
|
+
if (void 0 !== e)
|
|
247
|
+
throw new TypeError(
|
|
248
|
+
'Derived constructors may only return object or undefined'
|
|
249
|
+
);
|
|
177
250
|
return _assertThisInitialized(t);
|
|
178
251
|
}
|
|
179
252
|
function _regenerator() {
|
|
180
253
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
181
254
|
var e,
|
|
182
255
|
t,
|
|
183
|
-
r =
|
|
184
|
-
n = r.iterator ||
|
|
185
|
-
o = r.toStringTag ||
|
|
256
|
+
r = 'function' == typeof Symbol ? Symbol : {},
|
|
257
|
+
n = r.iterator || '@@iterator',
|
|
258
|
+
o = r.toStringTag || '@@toStringTag';
|
|
186
259
|
function i(r, n, o, i) {
|
|
187
260
|
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
188
261
|
u = Object.create(c.prototype);
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
c,
|
|
262
|
+
return (
|
|
263
|
+
_regeneratorDefine(
|
|
192
264
|
u,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
230
|
-
} catch (t) {
|
|
231
|
-
i = e, c = 1, u = t;
|
|
232
|
-
} finally {
|
|
233
|
-
f = 1;
|
|
265
|
+
'_invoke',
|
|
266
|
+
(function (r, n, o) {
|
|
267
|
+
var i,
|
|
268
|
+
c,
|
|
269
|
+
u,
|
|
270
|
+
f = 0,
|
|
271
|
+
p = o || [],
|
|
272
|
+
y = false,
|
|
273
|
+
G = {
|
|
274
|
+
p: 0,
|
|
275
|
+
n: 0,
|
|
276
|
+
v: e,
|
|
277
|
+
a: d,
|
|
278
|
+
f: d.bind(e, 4),
|
|
279
|
+
d: function (t, r) {
|
|
280
|
+
return ((i = t), (c = 0), (u = e), (G.n = r), a);
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
function d(r, n) {
|
|
284
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
285
|
+
var o,
|
|
286
|
+
i = p[t],
|
|
287
|
+
d = G.p,
|
|
288
|
+
l = i[2];
|
|
289
|
+
r > 3
|
|
290
|
+
? (o = l === n) &&
|
|
291
|
+
((u = i[(c = i[4]) ? 5 : ((c = 3), 3)]), (i[4] = i[5] = e))
|
|
292
|
+
: i[0] <= d &&
|
|
293
|
+
((o = r < 2 && d < i[1])
|
|
294
|
+
? ((c = 0), (G.v = n), (G.n = i[1]))
|
|
295
|
+
: d < l &&
|
|
296
|
+
(o = r < 3 || i[0] > n || n > l) &&
|
|
297
|
+
((i[4] = r), (i[5] = n), (G.n = l), (c = 0)));
|
|
298
|
+
}
|
|
299
|
+
if (o || r > 1) return a;
|
|
300
|
+
throw ((y = true), n);
|
|
234
301
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
302
|
+
return function (o, p, l) {
|
|
303
|
+
if (f > 1) throw TypeError('Generator is already running');
|
|
304
|
+
for (
|
|
305
|
+
y && 1 === p && d(p, l), c = p, u = l;
|
|
306
|
+
(t = c < 2 ? e : u) || !y;
|
|
307
|
+
|
|
308
|
+
) {
|
|
309
|
+
i ||
|
|
310
|
+
(c
|
|
311
|
+
? c < 3
|
|
312
|
+
? (c > 1 && (G.n = -1), d(c, u))
|
|
313
|
+
: (G.n = u)
|
|
314
|
+
: (G.v = u));
|
|
315
|
+
try {
|
|
316
|
+
if (((f = 2), i)) {
|
|
317
|
+
if ((c || (o = 'next'), (t = i[o]))) {
|
|
318
|
+
if (!(t = t.call(i, u)))
|
|
319
|
+
throw TypeError('iterator result is not an object');
|
|
320
|
+
if (!t.done) return t;
|
|
321
|
+
((u = t.value), c < 2 && (c = 0));
|
|
322
|
+
} else
|
|
323
|
+
(1 === c && (t = i.return) && t.call(i),
|
|
324
|
+
c < 2 &&
|
|
325
|
+
((u = TypeError(
|
|
326
|
+
"The iterator does not provide a '" + o + "' method"
|
|
327
|
+
)),
|
|
328
|
+
(c = 1)));
|
|
329
|
+
i = e;
|
|
330
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
331
|
+
} catch (t) {
|
|
332
|
+
((i = e), (c = 1), (u = t));
|
|
333
|
+
} finally {
|
|
334
|
+
f = 1;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
value: t,
|
|
339
|
+
done: y,
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
})(r, o, i),
|
|
343
|
+
true
|
|
344
|
+
),
|
|
345
|
+
u
|
|
346
|
+
);
|
|
242
347
|
}
|
|
243
348
|
var a = {};
|
|
244
349
|
function Generator() {}
|
|
245
350
|
function GeneratorFunction() {}
|
|
246
351
|
function GeneratorFunctionPrototype() {}
|
|
247
352
|
t = Object.getPrototypeOf;
|
|
248
|
-
var c = [][n]
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
353
|
+
var c = [][n]
|
|
354
|
+
? t(t([][n]()))
|
|
355
|
+
: (_regeneratorDefine((t = {}), n, function () {
|
|
356
|
+
return this;
|
|
357
|
+
}),
|
|
358
|
+
t),
|
|
359
|
+
u =
|
|
360
|
+
(GeneratorFunctionPrototype.prototype =
|
|
361
|
+
Generator.prototype =
|
|
362
|
+
Object.create(c));
|
|
252
363
|
function f(e) {
|
|
253
|
-
return
|
|
364
|
+
return (
|
|
365
|
+
Object.setPrototypeOf
|
|
366
|
+
? Object.setPrototypeOf(e, GeneratorFunctionPrototype)
|
|
367
|
+
: ((e.__proto__ = GeneratorFunctionPrototype),
|
|
368
|
+
_regeneratorDefine(e, o, 'GeneratorFunction')),
|
|
369
|
+
(e.prototype = Object.create(u)),
|
|
370
|
+
e
|
|
371
|
+
);
|
|
254
372
|
}
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
373
|
+
return (
|
|
374
|
+
(GeneratorFunction.prototype = GeneratorFunctionPrototype),
|
|
375
|
+
_regeneratorDefine(u, 'constructor', GeneratorFunctionPrototype),
|
|
376
|
+
_regeneratorDefine(
|
|
377
|
+
GeneratorFunctionPrototype,
|
|
378
|
+
'constructor',
|
|
379
|
+
GeneratorFunction
|
|
380
|
+
),
|
|
381
|
+
(GeneratorFunction.displayName = 'GeneratorFunction'),
|
|
382
|
+
_regeneratorDefine(GeneratorFunctionPrototype, o, 'GeneratorFunction'),
|
|
383
|
+
_regeneratorDefine(u),
|
|
384
|
+
_regeneratorDefine(u, o, 'Generator'),
|
|
385
|
+
_regeneratorDefine(u, n, function () {
|
|
386
|
+
return this;
|
|
387
|
+
}),
|
|
388
|
+
_regeneratorDefine(u, 'toString', function () {
|
|
389
|
+
return '[object Generator]';
|
|
390
|
+
}),
|
|
391
|
+
(_regenerator = function () {
|
|
392
|
+
return {
|
|
393
|
+
w: i,
|
|
394
|
+
m: f,
|
|
395
|
+
};
|
|
396
|
+
})()
|
|
397
|
+
);
|
|
265
398
|
}
|
|
266
399
|
function _regeneratorDefine(e, r, n, t) {
|
|
267
400
|
var i = Object.defineProperty;
|
|
268
401
|
try {
|
|
269
|
-
i({},
|
|
402
|
+
i({}, '', {});
|
|
270
403
|
} catch (e) {
|
|
271
404
|
i = 0;
|
|
272
405
|
}
|
|
273
|
-
_regeneratorDefine = function (e, r, n, t) {
|
|
406
|
+
((_regeneratorDefine = function (e, r, n, t) {
|
|
274
407
|
function o(r, n) {
|
|
275
408
|
_regeneratorDefine(e, r, function (e) {
|
|
276
409
|
return this._invoke(r, n, e);
|
|
277
410
|
});
|
|
278
411
|
}
|
|
279
|
-
r
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
412
|
+
r
|
|
413
|
+
? i
|
|
414
|
+
? i(e, r, {
|
|
415
|
+
value: n,
|
|
416
|
+
enumerable: !t,
|
|
417
|
+
configurable: !t,
|
|
418
|
+
writable: !t,
|
|
419
|
+
})
|
|
420
|
+
: (e[r] = n)
|
|
421
|
+
: (o('next', 0), o('throw', 1), o('return', 2));
|
|
422
|
+
}),
|
|
423
|
+
_regeneratorDefine(e, r, n, t));
|
|
286
424
|
}
|
|
287
425
|
function _setPrototypeOf(t, e) {
|
|
288
|
-
return
|
|
289
|
-
|
|
290
|
-
|
|
426
|
+
return (
|
|
427
|
+
(_setPrototypeOf = Object.setPrototypeOf
|
|
428
|
+
? Object.setPrototypeOf.bind()
|
|
429
|
+
: function (t, e) {
|
|
430
|
+
return ((t.__proto__ = e), t);
|
|
431
|
+
}),
|
|
432
|
+
_setPrototypeOf(t, e)
|
|
433
|
+
);
|
|
291
434
|
}
|
|
292
435
|
function _slicedToArray(r, e) {
|
|
293
|
-
return
|
|
436
|
+
return (
|
|
437
|
+
_arrayWithHoles(r) ||
|
|
438
|
+
_iterableToArrayLimit(r, e) ||
|
|
439
|
+
_unsupportedIterableToArray(r, e) ||
|
|
440
|
+
_nonIterableRest()
|
|
441
|
+
);
|
|
294
442
|
}
|
|
295
443
|
function _toConsumableArray(r) {
|
|
296
|
-
return
|
|
444
|
+
return (
|
|
445
|
+
_arrayWithoutHoles(r) ||
|
|
446
|
+
_iterableToArray(r) ||
|
|
447
|
+
_unsupportedIterableToArray(r) ||
|
|
448
|
+
_nonIterableSpread()
|
|
449
|
+
);
|
|
297
450
|
}
|
|
298
451
|
function _toPrimitive(t, r) {
|
|
299
|
-
if (
|
|
452
|
+
if ('object' != typeof t || !t) return t;
|
|
300
453
|
var e = t[Symbol.toPrimitive];
|
|
301
454
|
if (void 0 !== e) {
|
|
302
455
|
var i = e.call(t, r);
|
|
303
|
-
if (
|
|
304
|
-
throw new TypeError(
|
|
456
|
+
if ('object' != typeof i) return i;
|
|
457
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
305
458
|
}
|
|
306
|
-
return (
|
|
459
|
+
return ('string' === r ? String : Number)(t);
|
|
307
460
|
}
|
|
308
461
|
function _toPropertyKey(t) {
|
|
309
|
-
var i = _toPrimitive(t,
|
|
310
|
-
return
|
|
462
|
+
var i = _toPrimitive(t, 'string');
|
|
463
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
311
464
|
}
|
|
312
465
|
function _unsupportedIterableToArray(r, a) {
|
|
313
466
|
if (r) {
|
|
314
|
-
if (
|
|
467
|
+
if ('string' == typeof r) return _arrayLikeToArray(r, a);
|
|
315
468
|
var t = {}.toString.call(r).slice(8, -1);
|
|
316
|
-
return
|
|
469
|
+
return (
|
|
470
|
+
'Object' === t && r.constructor && (t = r.constructor.name),
|
|
471
|
+
'Map' === t || 'Set' === t
|
|
472
|
+
? Array.from(r)
|
|
473
|
+
: 'Arguments' === t ||
|
|
474
|
+
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
475
|
+
? _arrayLikeToArray(r, a)
|
|
476
|
+
: void 0
|
|
477
|
+
);
|
|
317
478
|
}
|
|
318
479
|
}
|
|
319
480
|
|
|
320
|
-
var _excluded$3 = [
|
|
321
|
-
_excluded2 = [
|
|
322
|
-
_excluded3 = [
|
|
481
|
+
var _excluded$3 = ['output'],
|
|
482
|
+
_excluded2 = ['output'],
|
|
483
|
+
_excluded3 = ['static', 'headers'];
|
|
323
484
|
var mergeRspackConfigs = function mergeRspackConfigs(first, second) {
|
|
324
485
|
if (!first) return second;
|
|
325
486
|
if (!second) return first;
|
|
@@ -331,9 +492,15 @@ var mergeRspackConfigs = function mergeRspackConfigs(first, second) {
|
|
|
331
492
|
if (isObject(firstOutput) && isObject(secondOutput)) {
|
|
332
493
|
output = _objectSpread2(_objectSpread2({}, firstOutput), secondOutput);
|
|
333
494
|
}
|
|
334
|
-
return _objectSpread2(
|
|
335
|
-
|
|
336
|
-
|
|
495
|
+
return _objectSpread2(
|
|
496
|
+
_objectSpread2(
|
|
497
|
+
{
|
|
498
|
+
output: output,
|
|
499
|
+
},
|
|
500
|
+
restFirst
|
|
501
|
+
),
|
|
502
|
+
restSecond
|
|
503
|
+
);
|
|
337
504
|
};
|
|
338
505
|
|
|
339
506
|
/**
|
|
@@ -344,9 +511,13 @@ var mergeRspackConfigs = function mergeRspackConfigs(first, second) {
|
|
|
344
511
|
var mergeServerConfig = function mergeServerConfig() {
|
|
345
512
|
var result = {
|
|
346
513
|
static: [],
|
|
347
|
-
headers: {}
|
|
514
|
+
headers: {},
|
|
348
515
|
};
|
|
349
|
-
for (
|
|
516
|
+
for (
|
|
517
|
+
var _len = arguments.length, configs = new Array(_len), _key = 0;
|
|
518
|
+
_key < _len;
|
|
519
|
+
_key++
|
|
520
|
+
) {
|
|
350
521
|
configs[_key] = arguments[_key];
|
|
351
522
|
}
|
|
352
523
|
configs.forEach(function (config) {
|
|
@@ -356,203 +527,303 @@ var mergeServerConfig = function mergeServerConfig() {
|
|
|
356
527
|
otherConfig = _objectWithoutProperties(config, _excluded3);
|
|
357
528
|
if (isArray(result.static) && isArray(staticConfig)) {
|
|
358
529
|
var _result$static;
|
|
359
|
-
(_result$static = result.static).push.apply(
|
|
530
|
+
(_result$static = result.static).push.apply(
|
|
531
|
+
_result$static,
|
|
532
|
+
_toConsumableArray(staticConfig)
|
|
533
|
+
);
|
|
360
534
|
}
|
|
361
535
|
if (headers) {
|
|
362
|
-
result.headers = _objectSpread2(
|
|
536
|
+
result.headers = _objectSpread2(
|
|
537
|
+
_objectSpread2({}, result.headers),
|
|
538
|
+
headers
|
|
539
|
+
);
|
|
363
540
|
}
|
|
364
541
|
Object.assign(result, otherConfig);
|
|
365
542
|
});
|
|
366
543
|
return result;
|
|
367
544
|
};
|
|
368
545
|
|
|
369
|
-
var Compiler = /*#__PURE__*/function (_CompilerBase) {
|
|
546
|
+
var Compiler = /*#__PURE__*/ (function (_CompilerBase) {
|
|
370
547
|
function Compiler() {
|
|
371
548
|
var _this;
|
|
372
549
|
_classCallCheck(this, Compiler);
|
|
373
|
-
for (
|
|
550
|
+
for (
|
|
551
|
+
var _len = arguments.length, args = new Array(_len), _key = 0;
|
|
552
|
+
_key < _len;
|
|
553
|
+
_key++
|
|
554
|
+
) {
|
|
374
555
|
args[_key] = arguments[_key];
|
|
375
556
|
}
|
|
376
557
|
_this = _callSuper(this, Compiler, [].concat(args));
|
|
377
|
-
_defineProperty(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
558
|
+
_defineProperty(
|
|
559
|
+
_this,
|
|
560
|
+
'context',
|
|
561
|
+
/*#__PURE__*/ (function () {
|
|
562
|
+
var _ref = _asyncToGenerator(
|
|
563
|
+
/*#__PURE__*/ _regenerator().m(function _callee2(rspackConfig) {
|
|
564
|
+
var compiler;
|
|
565
|
+
return _regenerator().w(function (_context2) {
|
|
566
|
+
while (1)
|
|
567
|
+
switch (_context2.n) {
|
|
568
|
+
case 0:
|
|
569
|
+
compiler = rspack(
|
|
570
|
+
mergeRspackConfigs(_this.initOptions, rspackConfig)
|
|
571
|
+
);
|
|
572
|
+
return _context2.a(2, {
|
|
573
|
+
rebuild: function rebuild() {
|
|
574
|
+
return new Promise(function (resolve, reject) {
|
|
575
|
+
compiler.run(function (err, stats) {
|
|
576
|
+
if (err) return reject(err);
|
|
577
|
+
resolve({
|
|
578
|
+
err: err,
|
|
579
|
+
stats: stats,
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
});
|
|
583
|
+
},
|
|
584
|
+
cancel: (function () {
|
|
585
|
+
var _cancel = _asyncToGenerator(
|
|
586
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
587
|
+
return _regenerator().w(function (_context) {
|
|
588
|
+
while (1)
|
|
589
|
+
switch (_context.n) {
|
|
590
|
+
case 0:
|
|
591
|
+
cLog.warn(
|
|
592
|
+
'build',
|
|
593
|
+
'empty',
|
|
594
|
+
'Webpack compiler cancel is empty implementation.'
|
|
595
|
+
);
|
|
596
|
+
return _context.a(2);
|
|
597
|
+
}
|
|
598
|
+
}, _callee);
|
|
599
|
+
})
|
|
600
|
+
);
|
|
601
|
+
function cancel() {
|
|
602
|
+
return _cancel.apply(this, arguments);
|
|
603
|
+
}
|
|
604
|
+
return cancel;
|
|
605
|
+
})(),
|
|
393
606
|
});
|
|
394
|
-
});
|
|
395
|
-
},
|
|
396
|
-
cancel: function () {
|
|
397
|
-
var _cancel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
398
|
-
return _regenerator().w(function (_context) {
|
|
399
|
-
while (1) switch (_context.n) {
|
|
400
|
-
case 0:
|
|
401
|
-
cLog.warn('build', 'empty', 'Webpack compiler cancel is empty implementation.');
|
|
402
|
-
return _context.a(2);
|
|
403
|
-
}
|
|
404
|
-
}, _callee);
|
|
405
|
-
}));
|
|
406
|
-
function cancel() {
|
|
407
|
-
return _cancel.apply(this, arguments);
|
|
408
|
-
}
|
|
409
|
-
return cancel;
|
|
410
|
-
}()
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
}, _callee2);
|
|
414
|
-
}));
|
|
415
|
-
return function (_x) {
|
|
416
|
-
return _ref.apply(this, arguments);
|
|
417
|
-
};
|
|
418
|
-
}());
|
|
419
|
-
_defineProperty(_this, "inOutMap", /*#__PURE__*/function () {
|
|
420
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(inputOutputMap) {
|
|
421
|
-
var entry, output;
|
|
422
|
-
return _regenerator().w(function (_context3) {
|
|
423
|
-
while (1) switch (_context3.n) {
|
|
424
|
-
case 0:
|
|
425
|
-
// 构造多入口对象
|
|
426
|
-
entry = {};
|
|
427
|
-
Object.entries(inputOutputMap).forEach(function (_ref3) {
|
|
428
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
429
|
-
input = _ref4[0],
|
|
430
|
-
output = _ref4[1];
|
|
431
|
-
entry[output] = input;
|
|
432
|
-
});
|
|
433
|
-
output = {
|
|
434
|
-
path: 'dist',
|
|
435
|
-
filename: '[name].js'
|
|
436
|
-
};
|
|
437
|
-
return _context3.a(2, _this.build({
|
|
438
|
-
entry: entry,
|
|
439
|
-
output: output
|
|
440
|
-
}));
|
|
441
|
-
}
|
|
442
|
-
}, _callee3);
|
|
443
|
-
}));
|
|
444
|
-
return function (_x2) {
|
|
445
|
-
return _ref2.apply(this, arguments);
|
|
446
|
-
};
|
|
447
|
-
}());
|
|
448
|
-
_defineProperty(_this, "input", /*#__PURE__*/function () {
|
|
449
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(input) {
|
|
450
|
-
return _regenerator().w(function (_context4) {
|
|
451
|
-
while (1) switch (_context4.n) {
|
|
452
|
-
case 0:
|
|
453
|
-
return _context4.a(2, {
|
|
454
|
-
output: function output(_output) {
|
|
455
|
-
return _this.build({
|
|
456
|
-
entry: input,
|
|
457
|
-
output: _output
|
|
458
|
-
});
|
|
459
607
|
}
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
_defineProperty(
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
608
|
+
}, _callee2);
|
|
609
|
+
})
|
|
610
|
+
);
|
|
611
|
+
return function (_x) {
|
|
612
|
+
return _ref.apply(this, arguments);
|
|
613
|
+
};
|
|
614
|
+
})()
|
|
615
|
+
);
|
|
616
|
+
_defineProperty(
|
|
617
|
+
_this,
|
|
618
|
+
'inOutMap',
|
|
619
|
+
/*#__PURE__*/ (function () {
|
|
620
|
+
var _ref2 = _asyncToGenerator(
|
|
621
|
+
/*#__PURE__*/ _regenerator().m(function _callee3(inputOutputMap) {
|
|
622
|
+
var entry, output;
|
|
623
|
+
return _regenerator().w(function (_context3) {
|
|
624
|
+
while (1)
|
|
625
|
+
switch (_context3.n) {
|
|
626
|
+
case 0:
|
|
627
|
+
// 构造多入口对象
|
|
628
|
+
entry = {};
|
|
629
|
+
Object.entries(inputOutputMap).forEach(function (_ref3) {
|
|
630
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
631
|
+
input = _ref4[0],
|
|
632
|
+
output = _ref4[1];
|
|
633
|
+
entry[output] = input;
|
|
634
|
+
});
|
|
635
|
+
output = {
|
|
636
|
+
path: 'dist',
|
|
637
|
+
filename: '[name].js',
|
|
638
|
+
};
|
|
639
|
+
return _context3.a(
|
|
640
|
+
2,
|
|
641
|
+
_this.build({
|
|
642
|
+
entry: entry,
|
|
643
|
+
output: output,
|
|
644
|
+
})
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
}, _callee3);
|
|
648
|
+
})
|
|
649
|
+
);
|
|
650
|
+
return function (_x2) {
|
|
651
|
+
return _ref2.apply(this, arguments);
|
|
652
|
+
};
|
|
653
|
+
})()
|
|
654
|
+
);
|
|
655
|
+
_defineProperty(
|
|
656
|
+
_this,
|
|
657
|
+
'input',
|
|
658
|
+
/*#__PURE__*/ (function () {
|
|
659
|
+
var _ref5 = _asyncToGenerator(
|
|
660
|
+
/*#__PURE__*/ _regenerator().m(function _callee4(input) {
|
|
661
|
+
return _regenerator().w(function (_context4) {
|
|
662
|
+
while (1)
|
|
663
|
+
switch (_context4.n) {
|
|
664
|
+
case 0:
|
|
665
|
+
return _context4.a(2, {
|
|
666
|
+
output: function output(_output) {
|
|
667
|
+
return _this.build({
|
|
668
|
+
entry: input,
|
|
669
|
+
output: _output,
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}, _callee4);
|
|
675
|
+
})
|
|
676
|
+
);
|
|
677
|
+
return function (_x3) {
|
|
678
|
+
return _ref5.apply(this, arguments);
|
|
679
|
+
};
|
|
680
|
+
})()
|
|
681
|
+
);
|
|
682
|
+
_defineProperty(
|
|
683
|
+
_this,
|
|
684
|
+
'build',
|
|
685
|
+
/*#__PURE__*/ (function () {
|
|
686
|
+
var _ref6 = _asyncToGenerator(
|
|
687
|
+
/*#__PURE__*/ _regenerator().m(function _callee5(rspackConfig) {
|
|
688
|
+
return _regenerator().w(function (_context5) {
|
|
689
|
+
while (1)
|
|
690
|
+
switch (_context5.n) {
|
|
691
|
+
case 0:
|
|
692
|
+
return _context5.a(
|
|
693
|
+
2,
|
|
694
|
+
new Promise(function (resolve, reject) {
|
|
695
|
+
rspack(
|
|
696
|
+
mergeRspackConfigs(_this.initOptions, rspackConfig),
|
|
697
|
+
function (err, stats) {
|
|
698
|
+
if (err) return reject(err);
|
|
699
|
+
resolve({
|
|
700
|
+
err: err,
|
|
701
|
+
stats: stats,
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
);
|
|
705
|
+
})
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
}, _callee5);
|
|
709
|
+
})
|
|
710
|
+
);
|
|
711
|
+
return function (_x4) {
|
|
712
|
+
return _ref6.apply(this, arguments);
|
|
713
|
+
};
|
|
714
|
+
})()
|
|
715
|
+
);
|
|
716
|
+
_defineProperty(_this, 'watch', function (watchOptions, rspackConfig) {
|
|
717
|
+
var cb =
|
|
718
|
+
arguments.length > 2 && arguments[2] !== undefined
|
|
719
|
+
? arguments[2]
|
|
720
|
+
: noop;
|
|
721
|
+
var compiler = rspack(
|
|
722
|
+
mergeRspackConfigs(_this.initOptions, rspackConfig)
|
|
723
|
+
);
|
|
492
724
|
return compiler.watch(watchOptions || {}, cb);
|
|
493
725
|
});
|
|
494
|
-
_defineProperty(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
tempSrvConfig
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
726
|
+
_defineProperty(
|
|
727
|
+
_this,
|
|
728
|
+
'server',
|
|
729
|
+
/*#__PURE__*/ (function () {
|
|
730
|
+
var _ref7 = _asyncToGenerator(
|
|
731
|
+
/*#__PURE__*/ _regenerator().m(
|
|
732
|
+
function _callee6(serverOptions, rspackConfig) {
|
|
733
|
+
var compiler, tempSrvConfig, open, port, host, devServer;
|
|
734
|
+
return _regenerator().w(function (_context6) {
|
|
735
|
+
while (1)
|
|
736
|
+
switch (_context6.n) {
|
|
737
|
+
case 0:
|
|
738
|
+
compiler = rspack(
|
|
739
|
+
mergeRspackConfigs(_this.initOptions, rspackConfig)
|
|
740
|
+
);
|
|
741
|
+
tempSrvConfig = mergeServerConfig(serverOptions, {
|
|
742
|
+
client: {
|
|
743
|
+
logging: 'none',
|
|
744
|
+
},
|
|
745
|
+
devMiddleware: {
|
|
746
|
+
stats: 'none',
|
|
747
|
+
},
|
|
748
|
+
});
|
|
749
|
+
((open = tempSrvConfig.open),
|
|
750
|
+
(port = tempSrvConfig.port),
|
|
751
|
+
(host = tempSrvConfig.host));
|
|
752
|
+
devServer = new RspackDevServer(
|
|
753
|
+
mergeServerConfig(
|
|
754
|
+
_objectSpread2(
|
|
755
|
+
_objectSpread2({}, tempSrvConfig),
|
|
756
|
+
{},
|
|
757
|
+
{
|
|
758
|
+
open: false,
|
|
759
|
+
}
|
|
760
|
+
)
|
|
761
|
+
),
|
|
762
|
+
compiler
|
|
763
|
+
);
|
|
764
|
+
_context6.n = 1;
|
|
765
|
+
return devServer.start();
|
|
766
|
+
case 1:
|
|
767
|
+
if (open) {
|
|
768
|
+
openBrowser('http://'.concat(host, ':').concat(port));
|
|
769
|
+
}
|
|
770
|
+
return _context6.a(2, devServer);
|
|
771
|
+
}
|
|
772
|
+
}, _callee6);
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
);
|
|
776
|
+
return function (_x5, _x6) {
|
|
777
|
+
return _ref7.apply(this, arguments);
|
|
778
|
+
};
|
|
779
|
+
})()
|
|
780
|
+
);
|
|
520
781
|
return _this;
|
|
521
782
|
}
|
|
522
783
|
_inherits(Compiler, _CompilerBase);
|
|
523
784
|
return _createClass(Compiler);
|
|
524
|
-
}(CompilerBase);
|
|
785
|
+
})(CompilerBase);
|
|
525
786
|
|
|
526
|
-
var _excluded$2 = [
|
|
787
|
+
var _excluded$2 = ['port'];
|
|
527
788
|
var getDevServer = function getDevServer(serviceConfig) {
|
|
528
789
|
var configPort = serviceConfig.port,
|
|
529
790
|
extServiceConfig = _objectWithoutProperties(serviceConfig, _excluded$2);
|
|
530
791
|
var host = '127.0.0.1';
|
|
531
|
-
return _objectSpread2(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
792
|
+
return _objectSpread2(
|
|
793
|
+
_objectSpread2(
|
|
794
|
+
{
|
|
795
|
+
host: host,
|
|
796
|
+
// 地址
|
|
797
|
+
open: false,
|
|
798
|
+
// 是否自动打开,关闭
|
|
799
|
+
setupExitSignals: true,
|
|
800
|
+
// 允许在 SIGINT 和 SIGTERM 信号时关闭开发服务器和退出进程。
|
|
801
|
+
compress: false,
|
|
802
|
+
// gzip压缩,开发环境不开启,提升热更新速度
|
|
803
|
+
hot: true,
|
|
804
|
+
// 开启热更新
|
|
805
|
+
historyApiFallback: true,
|
|
806
|
+
// 解决history路由404问题
|
|
807
|
+
// 托管静态资源public文件夹
|
|
808
|
+
static: [
|
|
809
|
+
{
|
|
810
|
+
directory: resolveCwd('./public'),
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
directory: resolveCwd('./dist'),
|
|
814
|
+
},
|
|
815
|
+
],
|
|
816
|
+
headers: {
|
|
817
|
+
'Access-Control-Allow-Origin': '*',
|
|
818
|
+
},
|
|
819
|
+
},
|
|
820
|
+
extServiceConfig
|
|
821
|
+
),
|
|
822
|
+
{},
|
|
823
|
+
{
|
|
824
|
+
port: configPort || '7777',
|
|
552
825
|
}
|
|
553
|
-
|
|
554
|
-
port: configPort || '7777'
|
|
555
|
-
});
|
|
826
|
+
);
|
|
556
827
|
};
|
|
557
828
|
|
|
558
829
|
var getDevtool = function getDevtool(envParams, devtoolConfig) {
|
|
@@ -614,23 +885,28 @@ var getCssBaseLoader = function getCssBaseLoader(envParams, options) {
|
|
|
614
885
|
var action = envParams.action;
|
|
615
886
|
var _ref = options || {},
|
|
616
887
|
postcssPluginExtra = _ref.postcssPluginExtra;
|
|
617
|
-
var baseCssLoaderList = [
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
888
|
+
var baseCssLoaderList = [
|
|
889
|
+
cssLoader,
|
|
890
|
+
{
|
|
891
|
+
loader: postcssLoader,
|
|
892
|
+
options: {
|
|
893
|
+
postcssOptions: {
|
|
894
|
+
plugins: [[postcssPresetEnv]].concat(
|
|
895
|
+
_toConsumableArray(postcssPluginExtra || [])
|
|
896
|
+
),
|
|
897
|
+
},
|
|
898
|
+
},
|
|
899
|
+
},
|
|
900
|
+
];
|
|
625
901
|
|
|
626
902
|
// dev环境使用style-loader
|
|
627
903
|
if (action === 'server') {
|
|
628
904
|
baseCssLoaderList.unshift({
|
|
629
|
-
loader: styleLoader
|
|
905
|
+
loader: styleLoader,
|
|
630
906
|
});
|
|
631
907
|
} else {
|
|
632
908
|
baseCssLoaderList.unshift({
|
|
633
|
-
loader: CssExtractRspackPlugin.loader
|
|
909
|
+
loader: CssExtractRspackPlugin.loader,
|
|
634
910
|
});
|
|
635
911
|
}
|
|
636
912
|
return baseCssLoaderList;
|
|
@@ -639,57 +915,64 @@ var getCssBaseLoader = function getCssBaseLoader(envParams, options) {
|
|
|
639
915
|
var getReactModulePreset = function getReactModulePreset(envParams, options) {
|
|
640
916
|
var publicCss = getCssBaseLoader(envParams, options);
|
|
641
917
|
var module = {
|
|
642
|
-
rules: [
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
918
|
+
rules: [
|
|
919
|
+
{
|
|
920
|
+
oneOf: [
|
|
921
|
+
{
|
|
922
|
+
test: /\.(js|jsx|ts|tsx)$/,
|
|
923
|
+
loader: 'swc-loader',
|
|
924
|
+
options: {
|
|
925
|
+
jsc: {
|
|
926
|
+
parser: {
|
|
927
|
+
syntax: 'typescript',
|
|
928
|
+
tsx: true, // 支持 tsx/jsx
|
|
929
|
+
},
|
|
930
|
+
transform: {
|
|
931
|
+
react: {
|
|
932
|
+
runtime: 'automatic',
|
|
933
|
+
}, // React 17+ 新 JSX
|
|
934
|
+
},
|
|
935
|
+
},
|
|
936
|
+
},
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
test: /\.css$/,
|
|
940
|
+
use: _toConsumableArray(publicCss),
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
test: /\.less$/,
|
|
944
|
+
use: [].concat(_toConsumableArray(publicCss), [lessLoader]),
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
948
|
+
type: 'asset',
|
|
949
|
+
// 一般会转换为 "asset/resource"
|
|
950
|
+
generator: {
|
|
951
|
+
filename: 'img/[name]_[hash:8][ext]', // 独立的配置
|
|
952
|
+
},
|
|
648
953
|
parser: {
|
|
649
|
-
|
|
650
|
-
|
|
954
|
+
dataUrlCondition: {
|
|
955
|
+
maxSize: 8 * 1024, // 8kb (低于8kb都会压缩成 base64)
|
|
956
|
+
},
|
|
651
957
|
},
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
// 一般会转换为 "asset/resource"
|
|
669
|
-
generator: {
|
|
670
|
-
filename: 'img/[name]_[hash:8][ext]' // 独立的配置
|
|
671
|
-
},
|
|
672
|
-
parser: {
|
|
673
|
-
dataUrlCondition: {
|
|
674
|
-
maxSize: 8 * 1024 // 8kb (低于8kb都会压缩成 base64)
|
|
675
|
-
}
|
|
676
|
-
}
|
|
958
|
+
},
|
|
959
|
+
// 字体文件
|
|
960
|
+
{
|
|
961
|
+
test: /\.(otf|eot|woff2?|ttf|svg)$/i,
|
|
962
|
+
type: 'asset',
|
|
963
|
+
// 一般会转换为 "asset/inline"
|
|
964
|
+
generator: {
|
|
965
|
+
filename: 'icon/[name]_[hash:8][ext]', // 独立的配置
|
|
966
|
+
},
|
|
967
|
+
parser: {
|
|
968
|
+
dataUrlCondition: {
|
|
969
|
+
maxSize: 2 * 1024, // 2kb (低于2kb都会压缩)
|
|
970
|
+
},
|
|
971
|
+
},
|
|
972
|
+
},
|
|
973
|
+
],
|
|
677
974
|
},
|
|
678
|
-
|
|
679
|
-
{
|
|
680
|
-
test: /\.(otf|eot|woff2?|ttf|svg)$/i,
|
|
681
|
-
type: 'asset',
|
|
682
|
-
// 一般会转换为 "asset/inline"
|
|
683
|
-
generator: {
|
|
684
|
-
filename: 'icon/[name]_[hash:8][ext]' // 独立的配置
|
|
685
|
-
},
|
|
686
|
-
parser: {
|
|
687
|
-
dataUrlCondition: {
|
|
688
|
-
maxSize: 2 * 1024 // 2kb (低于2kb都会压缩)
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}]
|
|
692
|
-
}]
|
|
975
|
+
],
|
|
693
976
|
};
|
|
694
977
|
return module;
|
|
695
978
|
};
|
|
@@ -698,60 +981,73 @@ var getOptimization = function getOptimization(params) {
|
|
|
698
981
|
var minimize = params.minimize;
|
|
699
982
|
if (!minimize) {
|
|
700
983
|
return {
|
|
701
|
-
minimize: false
|
|
984
|
+
minimize: false,
|
|
702
985
|
};
|
|
703
986
|
}
|
|
704
987
|
return {
|
|
705
|
-
minimize: minimize
|
|
988
|
+
minimize: minimize,
|
|
706
989
|
};
|
|
707
990
|
};
|
|
708
991
|
|
|
709
|
-
var _excluded$1 = [
|
|
992
|
+
var _excluded$1 = ['path', 'filename'];
|
|
710
993
|
var getOutput = function getOutput(envParams, output) {
|
|
711
994
|
var workRootDir = envParams.workRootDir;
|
|
712
995
|
var _ref = output || {},
|
|
713
996
|
path = _ref.path,
|
|
714
997
|
filename = _ref.filename,
|
|
715
998
|
extOutput = _objectWithoutProperties(_ref, _excluded$1);
|
|
716
|
-
return _objectSpread2(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
999
|
+
return _objectSpread2(
|
|
1000
|
+
{
|
|
1001
|
+
filename: filename || 'js/[name].[contenthash].js',
|
|
1002
|
+
path: path && isAbsolute(path) ? path : join(workRootDir, path || 'dist'),
|
|
1003
|
+
clean: true,
|
|
1004
|
+
publicPath: '/',
|
|
1005
|
+
},
|
|
1006
|
+
extOutput
|
|
1007
|
+
);
|
|
722
1008
|
};
|
|
723
1009
|
|
|
724
1010
|
var dirname = getDirname(import.meta);
|
|
725
1011
|
var packageRootDir = getPackageRoot(dirname);
|
|
726
1012
|
var cliNodeModulesDir = join(packageRootDir, 'node_modules');
|
|
727
|
-
var presetHtmlTemplate = join(
|
|
1013
|
+
var presetHtmlTemplate = join(
|
|
1014
|
+
packageRootDir,
|
|
1015
|
+
'lib/preset/html/dev-preset.html'
|
|
1016
|
+
);
|
|
728
1017
|
|
|
729
|
-
var _excluded = [
|
|
1018
|
+
var _excluded = ['minimize', 'template'];
|
|
730
1019
|
var getHtmlWebpackPlugin = function getHtmlWebpackPlugin(params) {
|
|
731
1020
|
var minimize = params.minimize,
|
|
732
1021
|
template = params.template,
|
|
733
1022
|
extParams = _objectWithoutProperties(params, _excluded);
|
|
734
|
-
return new HtmlRspackPlugin.default(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
1023
|
+
return new HtmlRspackPlugin.default(
|
|
1024
|
+
_objectSpread2(
|
|
1025
|
+
{
|
|
1026
|
+
title: 'rspack-react-ts',
|
|
1027
|
+
filename: 'index.html',
|
|
1028
|
+
// 复制 'index.html' 文件,并自动引入打包输出的所有资源(js/css)
|
|
1029
|
+
template: template || presetHtmlTemplate,
|
|
1030
|
+
inject: true,
|
|
1031
|
+
// 自动注入静态资源
|
|
1032
|
+
hash: true,
|
|
1033
|
+
cache: false,
|
|
1034
|
+
// 压缩html资源
|
|
1035
|
+
minify: minimize
|
|
1036
|
+
? {
|
|
1037
|
+
removeAttributeQuotes: true,
|
|
1038
|
+
collapseWhitespace: true,
|
|
1039
|
+
//去空格
|
|
1040
|
+
removeComments: true,
|
|
1041
|
+
// 去注释
|
|
1042
|
+
minifyJS: true,
|
|
1043
|
+
// 在脚本元素和事件属性中缩小JavaScript(使用UglifyJS)
|
|
1044
|
+
minifyCSS: true, // 缩小CSS样式元素和样式属性
|
|
1045
|
+
}
|
|
1046
|
+
: false,
|
|
1047
|
+
},
|
|
1048
|
+
extParams
|
|
1049
|
+
)
|
|
1050
|
+
);
|
|
755
1051
|
};
|
|
756
1052
|
|
|
757
1053
|
function extractEntryFiles(entry) {
|
|
@@ -759,13 +1055,16 @@ function extractEntryFiles(entry) {
|
|
|
759
1055
|
var files = [];
|
|
760
1056
|
var _push = function push(v) {
|
|
761
1057
|
if (!v) return;
|
|
762
|
-
if (typeof v === 'string') files.push(v);
|
|
1058
|
+
if (typeof v === 'string') files.push(v);
|
|
1059
|
+
else if (Array.isArray(v)) v.forEach(_push);
|
|
1060
|
+
else if (typeof v === 'object') {
|
|
763
1061
|
// 对象可能是 { import: '...' } 或 { import: ['...'] }
|
|
764
1062
|
// 也可能是其它 webpack entry 描述符
|
|
765
1063
|
// 尝试提取 import 字段
|
|
766
|
-
|
|
1064
|
+
|
|
767
1065
|
var obj = v;
|
|
768
|
-
if (obj.import) _push(obj.import);
|
|
1066
|
+
if (obj.import) _push(obj.import);
|
|
1067
|
+
else {
|
|
769
1068
|
// 可能是 nested object of entry points
|
|
770
1069
|
Object.values(obj).forEach(_push);
|
|
771
1070
|
}
|
|
@@ -774,56 +1073,77 @@ function extractEntryFiles(entry) {
|
|
|
774
1073
|
_push(entry);
|
|
775
1074
|
return files;
|
|
776
1075
|
}
|
|
777
|
-
var TsconfigPlugin = /*#__PURE__*/function () {
|
|
1076
|
+
var TsconfigPlugin = /*#__PURE__*/ (function () {
|
|
778
1077
|
function TsconfigPlugin(workRootDir) {
|
|
779
1078
|
_classCallCheck(this, TsconfigPlugin);
|
|
780
|
-
_defineProperty(this,
|
|
1079
|
+
_defineProperty(this, 'workRootDir', void 0);
|
|
781
1080
|
this.workRootDir = workRootDir;
|
|
782
1081
|
}
|
|
783
|
-
return _createClass(TsconfigPlugin, [
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
1082
|
+
return _createClass(TsconfigPlugin, [
|
|
1083
|
+
{
|
|
1084
|
+
key: 'apply',
|
|
1085
|
+
value: function apply(compiler) {
|
|
1086
|
+
var _this = this;
|
|
1087
|
+
// 使用 beforeRun.tapPromise 以 async/await 方式在构建前完成 I/O
|
|
1088
|
+
compiler.hooks.beforeRun.tapPromise(
|
|
1089
|
+
'TsconfigPlugin',
|
|
1090
|
+
/*#__PURE__*/ (function () {
|
|
1091
|
+
var _ref = _asyncToGenerator(
|
|
1092
|
+
/*#__PURE__*/ _regenerator().m(function _callee(comp) {
|
|
1093
|
+
var _ref2, entry, entryFiles, hasTs;
|
|
1094
|
+
return _regenerator().w(
|
|
1095
|
+
function (_context) {
|
|
1096
|
+
while (1)
|
|
1097
|
+
switch ((_context.p = _context.n)) {
|
|
1098
|
+
case 0:
|
|
1099
|
+
_context.p = 0;
|
|
1100
|
+
entry =
|
|
1101
|
+
(_ref2 = comp.options && comp.options.entry) !==
|
|
1102
|
+
null && _ref2 !== void 0
|
|
1103
|
+
? _ref2
|
|
1104
|
+
: {};
|
|
1105
|
+
entryFiles = extractEntryFiles(entry); // 如果 entry 是函数/动态生成,entryFiles 可能为空,保守处理
|
|
1106
|
+
hasTs = entryFiles.some(function (f) {
|
|
1107
|
+
return /\.(ts|tsx)$/.test(path.extname(String(f)));
|
|
1108
|
+
});
|
|
1109
|
+
if (hasTs) {
|
|
1110
|
+
_context.n = 1;
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
return _context.a(2);
|
|
1114
|
+
case 1:
|
|
1115
|
+
_context.n = 2;
|
|
1116
|
+
return insertTsconfig(_this.workRootDir);
|
|
1117
|
+
case 2:
|
|
1118
|
+
_context.n = 4;
|
|
1119
|
+
break;
|
|
1120
|
+
case 3:
|
|
1121
|
+
_context.p = 3;
|
|
1122
|
+
_context.v;
|
|
1123
|
+
cLog.error(
|
|
1124
|
+
'init',
|
|
1125
|
+
'error',
|
|
1126
|
+
'自动注入 tsconfig.json 失败'
|
|
1127
|
+
);
|
|
1128
|
+
case 4:
|
|
1129
|
+
return _context.a(2);
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
_callee,
|
|
1133
|
+
null,
|
|
1134
|
+
[[0, 3]]
|
|
1135
|
+
);
|
|
1136
|
+
})
|
|
1137
|
+
);
|
|
1138
|
+
return function (_x) {
|
|
1139
|
+
return _ref.apply(this, arguments);
|
|
1140
|
+
};
|
|
1141
|
+
})()
|
|
1142
|
+
);
|
|
1143
|
+
},
|
|
1144
|
+
},
|
|
1145
|
+
]);
|
|
1146
|
+
})();
|
|
827
1147
|
|
|
828
1148
|
var getTsconfigPlugin = function getTsconfigPlugin(envParams) {
|
|
829
1149
|
return new TsconfigPlugin(envParams.workRootDir);
|
|
@@ -833,7 +1153,7 @@ var getReactPluginsPreset = function getReactPluginsPreset(envParams, options) {
|
|
|
833
1153
|
var action = envParams.action;
|
|
834
1154
|
var isDevelopment = action === 'server';
|
|
835
1155
|
options.WebpackBundleAnalyzerOptions;
|
|
836
|
-
|
|
1156
|
+
var HtmlWebpackPluginOptions = options.HtmlWebpackPluginOptions,
|
|
837
1157
|
minimize = options.minimize;
|
|
838
1158
|
|
|
839
1159
|
// html入口文件路径
|
|
@@ -843,15 +1163,24 @@ var getReactPluginsPreset = function getReactPluginsPreset(envParams, options) {
|
|
|
843
1163
|
}
|
|
844
1164
|
var plugins = [getTsconfigPlugin(envParams)];
|
|
845
1165
|
if (action !== 'lib') {
|
|
846
|
-
plugins.push(
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
1166
|
+
plugins.push(
|
|
1167
|
+
getHtmlWebpackPlugin(
|
|
1168
|
+
_objectSpread2(
|
|
1169
|
+
{
|
|
1170
|
+
minimize: minimize,
|
|
1171
|
+
template: rightFile || undefined,
|
|
1172
|
+
},
|
|
1173
|
+
HtmlWebpackPluginOptions
|
|
1174
|
+
)
|
|
1175
|
+
)
|
|
1176
|
+
);
|
|
850
1177
|
}
|
|
851
1178
|
if (!isDevelopment) {
|
|
852
|
-
plugins.push(
|
|
853
|
-
|
|
854
|
-
|
|
1179
|
+
plugins.push(
|
|
1180
|
+
new CssExtractRspackPlugin({
|
|
1181
|
+
filename: 'css/main.[contenthash].css',
|
|
1182
|
+
})
|
|
1183
|
+
);
|
|
855
1184
|
}
|
|
856
1185
|
|
|
857
1186
|
// if (WebpackBundleAnalyzerOptions) {
|
|
@@ -871,9 +1200,12 @@ var getReactPluginsPreset = function getReactPluginsPreset(envParams, options) {
|
|
|
871
1200
|
* @returns
|
|
872
1201
|
*/
|
|
873
1202
|
var getResolve = function getResolve(resolveConfig) {
|
|
874
|
-
var resolveObj = _objectSpread2(
|
|
875
|
-
|
|
876
|
-
|
|
1203
|
+
var resolveObj = _objectSpread2(
|
|
1204
|
+
{
|
|
1205
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
1206
|
+
},
|
|
1207
|
+
resolveConfig
|
|
1208
|
+
);
|
|
877
1209
|
return resolveObj;
|
|
878
1210
|
};
|
|
879
1211
|
|
|
@@ -881,48 +1213,88 @@ var getResolveLoader = function getResolveLoader() {
|
|
|
881
1213
|
return {
|
|
882
1214
|
modules: [cliNodeModulesDir],
|
|
883
1215
|
extensions: ['.js', '.json'],
|
|
884
|
-
mainFields: ['loader', 'main']
|
|
1216
|
+
mainFields: ['loader', 'main'],
|
|
885
1217
|
};
|
|
886
1218
|
};
|
|
887
1219
|
|
|
888
|
-
var Ctx = /*#__PURE__*/function () {
|
|
1220
|
+
var Ctx = /*#__PURE__*/ (function () {
|
|
889
1221
|
function Ctx(configCtx) {
|
|
890
1222
|
_classCallCheck(this, Ctx);
|
|
891
|
-
_defineProperty(this,
|
|
892
|
-
_defineProperty(this,
|
|
893
|
-
_defineProperty(this,
|
|
894
|
-
_defineProperty(this,
|
|
1223
|
+
_defineProperty(this, 'configCtx', void 0);
|
|
1224
|
+
_defineProperty(this, 'rspackConfig', {});
|
|
1225
|
+
_defineProperty(this, 'devServerConfig', {});
|
|
1226
|
+
_defineProperty(this, 'envParams', {
|
|
895
1227
|
action: 'build',
|
|
896
|
-
workRootDir: getCwd()
|
|
1228
|
+
workRootDir: getCwd(),
|
|
897
1229
|
});
|
|
898
1230
|
this.configCtx = configCtx;
|
|
899
1231
|
}
|
|
900
|
-
return _createClass(Ctx, [
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
1232
|
+
return _createClass(Ctx, [
|
|
1233
|
+
{
|
|
1234
|
+
key: 'updateEnvParams',
|
|
1235
|
+
value: function updateEnvParams(argv) {
|
|
1236
|
+
this.envParams = _objectSpread2(
|
|
1237
|
+
_objectSpread2({}, this.envParams),
|
|
1238
|
+
argv
|
|
1239
|
+
);
|
|
1240
|
+
},
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
key: 'updateRspackConfig',
|
|
1244
|
+
value: function updateRspackConfig(config) {
|
|
1245
|
+
this.rspackConfig = _objectSpread2(
|
|
1246
|
+
_objectSpread2({}, this.rspackConfig),
|
|
1247
|
+
config
|
|
1248
|
+
);
|
|
1249
|
+
},
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
key: 'updateDevServerConfig',
|
|
1253
|
+
value: function updateDevServerConfig(config) {
|
|
1254
|
+
this.devServerConfig = _objectSpread2(
|
|
1255
|
+
_objectSpread2({}, this.devServerConfig),
|
|
1256
|
+
config
|
|
1257
|
+
);
|
|
1258
|
+
},
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
key: 'getDoraConfig',
|
|
1262
|
+
value: function getDoraConfig() {
|
|
1263
|
+
return this.configCtx.getDoraConfig();
|
|
1264
|
+
},
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
key: 'geTDoraConfigRspack',
|
|
1268
|
+
value: function geTDoraConfigRspack() {
|
|
1269
|
+
return this.configCtx.getDoraConfig().rspackConfig || {};
|
|
1270
|
+
},
|
|
1271
|
+
},
|
|
1272
|
+
]);
|
|
1273
|
+
})();
|
|
927
1274
|
|
|
928
|
-
export {
|
|
1275
|
+
export {
|
|
1276
|
+
Compiler,
|
|
1277
|
+
cssLoader,
|
|
1278
|
+
Ctx,
|
|
1279
|
+
getCssBaseLoader,
|
|
1280
|
+
getDevServer,
|
|
1281
|
+
getDevtool,
|
|
1282
|
+
getEntry,
|
|
1283
|
+
getExternals,
|
|
1284
|
+
getHtmlWebpackPlugin,
|
|
1285
|
+
getMode,
|
|
1286
|
+
getOptimization,
|
|
1287
|
+
getOutput,
|
|
1288
|
+
getReactModulePreset,
|
|
1289
|
+
getReactPluginsPreset,
|
|
1290
|
+
getResolve,
|
|
1291
|
+
getResolveLoader,
|
|
1292
|
+
getTsconfigPlugin,
|
|
1293
|
+
lessLoader,
|
|
1294
|
+
mergeRspackConfigs,
|
|
1295
|
+
mergeServerConfig,
|
|
1296
|
+
postcssLoader,
|
|
1297
|
+
postcssPresetEnv,
|
|
1298
|
+
styleLoader,
|
|
1299
|
+
swcLoader,
|
|
1300
|
+
};
|