@doracli/esbuild 0.0.3 → 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 +632 -312
- package/lib/esm/index.js +648 -317
- package/lib/type/index.d.ts +412 -323
- package/package.json +9 -9
package/lib/esm/index.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import autoprefixer from 'autoprefixer';
|
|
1
2
|
import { build, context } from 'esbuild';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import { isArray, isString, isObject } from '@cclr/lang';
|
|
4
|
-
import { CompilerBase, findInput, cLog } from '@doracli/helper';
|
|
5
|
-
import { htmlPlugin } from '@craftamap/esbuild-plugin-html';
|
|
6
3
|
import { lessLoader } from 'esbuild-plugin-less';
|
|
7
|
-
import autoprefixer from 'autoprefixer';
|
|
8
4
|
import postCssPlugin from 'esbuild-plugin-postcss';
|
|
9
5
|
import esbuildPluginSass from 'esbuild-plugin-sass';
|
|
6
|
+
import { join, resolve } from 'path';
|
|
7
|
+
import { isArray, isObject, isString } from '@cclr/lang';
|
|
8
|
+
import { htmlPlugin } from '@craftamap/esbuild-plugin-html';
|
|
10
9
|
import { getCwd } from '@dorabag/file-pro';
|
|
10
|
+
import { cLog, CompilerBase, EnvEnum, findInput } from '@doracli/helper';
|
|
11
11
|
|
|
12
12
|
function _assertThisInitialized(e) {
|
|
13
|
-
if (void 0 === e)
|
|
13
|
+
if (void 0 === e)
|
|
14
|
+
throw new ReferenceError(
|
|
15
|
+
"this hasn't been initialised - super() hasn't been called"
|
|
16
|
+
);
|
|
14
17
|
return e;
|
|
15
18
|
}
|
|
16
19
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
@@ -29,60 +32,91 @@ function _asyncToGenerator(n) {
|
|
|
29
32
|
return new Promise(function (r, o) {
|
|
30
33
|
var a = n.apply(t, e);
|
|
31
34
|
function _next(n) {
|
|
32
|
-
asyncGeneratorStep(a, r, o, _next, _throw,
|
|
35
|
+
asyncGeneratorStep(a, r, o, _next, _throw, 'next', n);
|
|
33
36
|
}
|
|
34
37
|
function _throw(n) {
|
|
35
|
-
asyncGeneratorStep(a, r, o, _next, _throw,
|
|
38
|
+
asyncGeneratorStep(a, r, o, _next, _throw, 'throw', n);
|
|
36
39
|
}
|
|
37
40
|
_next(void 0);
|
|
38
41
|
});
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
44
|
function _callSuper(t, o, e) {
|
|
42
|
-
return
|
|
45
|
+
return (
|
|
46
|
+
(o = _getPrototypeOf(o)),
|
|
47
|
+
_possibleConstructorReturn(
|
|
48
|
+
t,
|
|
49
|
+
_isNativeReflectConstruct()
|
|
50
|
+
? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor)
|
|
51
|
+
: o.apply(t, e)
|
|
52
|
+
)
|
|
53
|
+
);
|
|
43
54
|
}
|
|
44
55
|
function _classCallCheck(a, n) {
|
|
45
|
-
if (!(a instanceof n))
|
|
56
|
+
if (!(a instanceof n))
|
|
57
|
+
throw new TypeError('Cannot call a class as a function');
|
|
46
58
|
}
|
|
47
59
|
function _defineProperties(e, r) {
|
|
48
60
|
for (var t = 0; t < r.length; t++) {
|
|
49
61
|
var o = r[t];
|
|
50
|
-
o.enumerable = o.enumerable || false
|
|
62
|
+
((o.enumerable = o.enumerable || false),
|
|
63
|
+
(o.configurable = true),
|
|
64
|
+
'value' in o && (o.writable = true),
|
|
65
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o));
|
|
51
66
|
}
|
|
52
67
|
}
|
|
53
68
|
function _createClass(e, r, t) {
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
return (
|
|
70
|
+
r && _defineProperties(e.prototype, r),
|
|
71
|
+
Object.defineProperty(e, 'prototype', {
|
|
72
|
+
writable: false,
|
|
73
|
+
}),
|
|
74
|
+
e
|
|
75
|
+
);
|
|
57
76
|
}
|
|
58
77
|
function _defineProperty(e, r, t) {
|
|
59
|
-
return (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
return (
|
|
79
|
+
(r = _toPropertyKey(r)) in e
|
|
80
|
+
? Object.defineProperty(e, r, {
|
|
81
|
+
value: t,
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true,
|
|
85
|
+
})
|
|
86
|
+
: (e[r] = t),
|
|
87
|
+
e
|
|
88
|
+
);
|
|
65
89
|
}
|
|
66
90
|
function _getPrototypeOf(t) {
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
91
|
+
return (
|
|
92
|
+
(_getPrototypeOf = Object.setPrototypeOf
|
|
93
|
+
? Object.getPrototypeOf.bind()
|
|
94
|
+
: function (t) {
|
|
95
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
96
|
+
}),
|
|
97
|
+
_getPrototypeOf(t)
|
|
98
|
+
);
|
|
70
99
|
}
|
|
71
100
|
function _inherits(t, e) {
|
|
72
|
-
if (
|
|
73
|
-
|
|
101
|
+
if ('function' != typeof e && null !== e)
|
|
102
|
+
throw new TypeError('Super expression must either be null or a function');
|
|
103
|
+
((t.prototype = Object.create(e && e.prototype, {
|
|
74
104
|
constructor: {
|
|
75
105
|
value: t,
|
|
76
106
|
writable: true,
|
|
77
|
-
configurable: true
|
|
78
|
-
}
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
configurable: true,
|
|
108
|
+
},
|
|
109
|
+
})),
|
|
110
|
+
Object.defineProperty(t, 'prototype', {
|
|
111
|
+
writable: false,
|
|
112
|
+
}),
|
|
113
|
+
e && _setPrototypeOf(t, e));
|
|
82
114
|
}
|
|
83
115
|
function _isNativeReflectConstruct() {
|
|
84
116
|
try {
|
|
85
|
-
var t = !Boolean.prototype.valueOf.call(
|
|
117
|
+
var t = !Boolean.prototype.valueOf.call(
|
|
118
|
+
Reflect.construct(Boolean, [], function () {})
|
|
119
|
+
);
|
|
86
120
|
} catch (t) {}
|
|
87
121
|
return (_isNativeReflectConstruct = function () {
|
|
88
122
|
return !!t;
|
|
@@ -92,317 +126,458 @@ function ownKeys(e, r) {
|
|
|
92
126
|
var t = Object.keys(e);
|
|
93
127
|
if (Object.getOwnPropertySymbols) {
|
|
94
128
|
var o = Object.getOwnPropertySymbols(e);
|
|
95
|
-
r &&
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
(r &&
|
|
130
|
+
(o = o.filter(function (r) {
|
|
131
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
132
|
+
})),
|
|
133
|
+
t.push.apply(t, o));
|
|
98
134
|
}
|
|
99
135
|
return t;
|
|
100
136
|
}
|
|
101
137
|
function _objectSpread2(e) {
|
|
102
138
|
for (var r = 1; r < arguments.length; r++) {
|
|
103
139
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
104
|
-
r % 2
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
140
|
+
r % 2
|
|
141
|
+
? ownKeys(Object(t), true).forEach(function (r) {
|
|
142
|
+
_defineProperty(e, r, t[r]);
|
|
143
|
+
})
|
|
144
|
+
: Object.getOwnPropertyDescriptors
|
|
145
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
146
|
+
: ownKeys(Object(t)).forEach(function (r) {
|
|
147
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
148
|
+
});
|
|
109
149
|
}
|
|
110
150
|
return e;
|
|
111
151
|
}
|
|
112
152
|
function _possibleConstructorReturn(t, e) {
|
|
113
|
-
if (e && (
|
|
114
|
-
if (void 0 !== e)
|
|
153
|
+
if (e && ('object' == typeof e || 'function' == typeof e)) return e;
|
|
154
|
+
if (void 0 !== e)
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
'Derived constructors may only return object or undefined'
|
|
157
|
+
);
|
|
115
158
|
return _assertThisInitialized(t);
|
|
116
159
|
}
|
|
117
160
|
function _regenerator() {
|
|
118
161
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
119
162
|
var e,
|
|
120
163
|
t,
|
|
121
|
-
r =
|
|
122
|
-
n = r.iterator ||
|
|
123
|
-
o = r.toStringTag ||
|
|
164
|
+
r = 'function' == typeof Symbol ? Symbol : {},
|
|
165
|
+
n = r.iterator || '@@iterator',
|
|
166
|
+
o = r.toStringTag || '@@toStringTag';
|
|
124
167
|
function i(r, n, o, i) {
|
|
125
168
|
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
126
169
|
u = Object.create(c.prototype);
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
c,
|
|
170
|
+
return (
|
|
171
|
+
_regeneratorDefine(
|
|
130
172
|
u,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
168
|
-
} catch (t) {
|
|
169
|
-
i = e, c = 1, u = t;
|
|
170
|
-
} finally {
|
|
171
|
-
f = 1;
|
|
173
|
+
'_invoke',
|
|
174
|
+
(function (r, n, o) {
|
|
175
|
+
var i,
|
|
176
|
+
c,
|
|
177
|
+
u,
|
|
178
|
+
f = 0,
|
|
179
|
+
p = o || [],
|
|
180
|
+
y = false,
|
|
181
|
+
G = {
|
|
182
|
+
p: 0,
|
|
183
|
+
n: 0,
|
|
184
|
+
v: e,
|
|
185
|
+
a: d,
|
|
186
|
+
f: d.bind(e, 4),
|
|
187
|
+
d: function (t, r) {
|
|
188
|
+
return ((i = t), (c = 0), (u = e), (G.n = r), a);
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
function d(r, n) {
|
|
192
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
193
|
+
var o,
|
|
194
|
+
i = p[t],
|
|
195
|
+
d = G.p,
|
|
196
|
+
l = i[2];
|
|
197
|
+
r > 3
|
|
198
|
+
? (o = l === n) &&
|
|
199
|
+
((u = i[(c = i[4]) ? 5 : ((c = 3), 3)]), (i[4] = i[5] = e))
|
|
200
|
+
: i[0] <= d &&
|
|
201
|
+
((o = r < 2 && d < i[1])
|
|
202
|
+
? ((c = 0), (G.v = n), (G.n = i[1]))
|
|
203
|
+
: d < l &&
|
|
204
|
+
(o = r < 3 || i[0] > n || n > l) &&
|
|
205
|
+
((i[4] = r), (i[5] = n), (G.n = l), (c = 0)));
|
|
206
|
+
}
|
|
207
|
+
if (o || r > 1) return a;
|
|
208
|
+
throw ((y = true), n);
|
|
172
209
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
210
|
+
return function (o, p, l) {
|
|
211
|
+
if (f > 1) throw TypeError('Generator is already running');
|
|
212
|
+
for (
|
|
213
|
+
y && 1 === p && d(p, l), c = p, u = l;
|
|
214
|
+
(t = c < 2 ? e : u) || !y;
|
|
215
|
+
|
|
216
|
+
) {
|
|
217
|
+
i ||
|
|
218
|
+
(c
|
|
219
|
+
? c < 3
|
|
220
|
+
? (c > 1 && (G.n = -1), d(c, u))
|
|
221
|
+
: (G.n = u)
|
|
222
|
+
: (G.v = u));
|
|
223
|
+
try {
|
|
224
|
+
if (((f = 2), i)) {
|
|
225
|
+
if ((c || (o = 'next'), (t = i[o]))) {
|
|
226
|
+
if (!(t = t.call(i, u)))
|
|
227
|
+
throw TypeError('iterator result is not an object');
|
|
228
|
+
if (!t.done) return t;
|
|
229
|
+
((u = t.value), c < 2 && (c = 0));
|
|
230
|
+
} else
|
|
231
|
+
(1 === c && (t = i.return) && t.call(i),
|
|
232
|
+
c < 2 &&
|
|
233
|
+
((u = TypeError(
|
|
234
|
+
"The iterator does not provide a '" + o + "' method"
|
|
235
|
+
)),
|
|
236
|
+
(c = 1)));
|
|
237
|
+
i = e;
|
|
238
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
239
|
+
} catch (t) {
|
|
240
|
+
((i = e), (c = 1), (u = t));
|
|
241
|
+
} finally {
|
|
242
|
+
f = 1;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
value: t,
|
|
247
|
+
done: y,
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
})(r, o, i),
|
|
251
|
+
true
|
|
252
|
+
),
|
|
253
|
+
u
|
|
254
|
+
);
|
|
180
255
|
}
|
|
181
256
|
var a = {};
|
|
182
257
|
function Generator() {}
|
|
183
258
|
function GeneratorFunction() {}
|
|
184
259
|
function GeneratorFunctionPrototype() {}
|
|
185
260
|
t = Object.getPrototypeOf;
|
|
186
|
-
var c = [][n]
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
261
|
+
var c = [][n]
|
|
262
|
+
? t(t([][n]()))
|
|
263
|
+
: (_regeneratorDefine((t = {}), n, function () {
|
|
264
|
+
return this;
|
|
265
|
+
}),
|
|
266
|
+
t),
|
|
267
|
+
u =
|
|
268
|
+
(GeneratorFunctionPrototype.prototype =
|
|
269
|
+
Generator.prototype =
|
|
270
|
+
Object.create(c));
|
|
190
271
|
function f(e) {
|
|
191
|
-
return
|
|
272
|
+
return (
|
|
273
|
+
Object.setPrototypeOf
|
|
274
|
+
? Object.setPrototypeOf(e, GeneratorFunctionPrototype)
|
|
275
|
+
: ((e.__proto__ = GeneratorFunctionPrototype),
|
|
276
|
+
_regeneratorDefine(e, o, 'GeneratorFunction')),
|
|
277
|
+
(e.prototype = Object.create(u)),
|
|
278
|
+
e
|
|
279
|
+
);
|
|
192
280
|
}
|
|
193
|
-
return
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
281
|
+
return (
|
|
282
|
+
(GeneratorFunction.prototype = GeneratorFunctionPrototype),
|
|
283
|
+
_regeneratorDefine(u, 'constructor', GeneratorFunctionPrototype),
|
|
284
|
+
_regeneratorDefine(
|
|
285
|
+
GeneratorFunctionPrototype,
|
|
286
|
+
'constructor',
|
|
287
|
+
GeneratorFunction
|
|
288
|
+
),
|
|
289
|
+
(GeneratorFunction.displayName = 'GeneratorFunction'),
|
|
290
|
+
_regeneratorDefine(GeneratorFunctionPrototype, o, 'GeneratorFunction'),
|
|
291
|
+
_regeneratorDefine(u),
|
|
292
|
+
_regeneratorDefine(u, o, 'Generator'),
|
|
293
|
+
_regeneratorDefine(u, n, function () {
|
|
294
|
+
return this;
|
|
295
|
+
}),
|
|
296
|
+
_regeneratorDefine(u, 'toString', function () {
|
|
297
|
+
return '[object Generator]';
|
|
298
|
+
}),
|
|
299
|
+
(_regenerator = function () {
|
|
300
|
+
return {
|
|
301
|
+
w: i,
|
|
302
|
+
m: f,
|
|
303
|
+
};
|
|
304
|
+
})()
|
|
305
|
+
);
|
|
203
306
|
}
|
|
204
307
|
function _regeneratorDefine(e, r, n, t) {
|
|
205
308
|
var i = Object.defineProperty;
|
|
206
309
|
try {
|
|
207
|
-
i({},
|
|
310
|
+
i({}, '', {});
|
|
208
311
|
} catch (e) {
|
|
209
312
|
i = 0;
|
|
210
313
|
}
|
|
211
|
-
_regeneratorDefine = function (e, r, n, t) {
|
|
314
|
+
((_regeneratorDefine = function (e, r, n, t) {
|
|
212
315
|
function o(r, n) {
|
|
213
316
|
_regeneratorDefine(e, r, function (e) {
|
|
214
317
|
return this._invoke(r, n, e);
|
|
215
318
|
});
|
|
216
319
|
}
|
|
217
|
-
r
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
320
|
+
r
|
|
321
|
+
? i
|
|
322
|
+
? i(e, r, {
|
|
323
|
+
value: n,
|
|
324
|
+
enumerable: !t,
|
|
325
|
+
configurable: !t,
|
|
326
|
+
writable: !t,
|
|
327
|
+
})
|
|
328
|
+
: (e[r] = n)
|
|
329
|
+
: (o('next', 0), o('throw', 1), o('return', 2));
|
|
330
|
+
}),
|
|
331
|
+
_regeneratorDefine(e, r, n, t));
|
|
224
332
|
}
|
|
225
333
|
function _setPrototypeOf(t, e) {
|
|
226
|
-
return
|
|
227
|
-
|
|
228
|
-
|
|
334
|
+
return (
|
|
335
|
+
(_setPrototypeOf = Object.setPrototypeOf
|
|
336
|
+
? Object.setPrototypeOf.bind()
|
|
337
|
+
: function (t, e) {
|
|
338
|
+
return ((t.__proto__ = e), t);
|
|
339
|
+
}),
|
|
340
|
+
_setPrototypeOf(t, e)
|
|
341
|
+
);
|
|
229
342
|
}
|
|
230
343
|
function _toPrimitive(t, r) {
|
|
231
|
-
if (
|
|
344
|
+
if ('object' != typeof t || !t) return t;
|
|
232
345
|
var e = t[Symbol.toPrimitive];
|
|
233
346
|
if (void 0 !== e) {
|
|
234
347
|
var i = e.call(t, r);
|
|
235
|
-
if (
|
|
236
|
-
throw new TypeError(
|
|
348
|
+
if ('object' != typeof i) return i;
|
|
349
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
237
350
|
}
|
|
238
|
-
return (
|
|
351
|
+
return ('string' === r ? String : Number)(t);
|
|
239
352
|
}
|
|
240
353
|
function _toPropertyKey(t) {
|
|
241
|
-
var i = _toPrimitive(t,
|
|
242
|
-
return
|
|
354
|
+
var i = _toPrimitive(t, 'string');
|
|
355
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
243
356
|
}
|
|
244
357
|
|
|
245
|
-
var builder = /*#__PURE__*/function () {
|
|
246
|
-
var _ref = _asyncToGenerator(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
358
|
+
var builder = /*#__PURE__*/ (function () {
|
|
359
|
+
var _ref = _asyncToGenerator(
|
|
360
|
+
/*#__PURE__*/ _regenerator().m(function _callee(config) {
|
|
361
|
+
return _regenerator().w(function (_context) {
|
|
362
|
+
while (1)
|
|
363
|
+
switch (_context.n) {
|
|
364
|
+
case 0:
|
|
365
|
+
return _context.a(2, build(config));
|
|
366
|
+
}
|
|
367
|
+
}, _callee);
|
|
368
|
+
})
|
|
369
|
+
);
|
|
254
370
|
return function builder(_x) {
|
|
255
371
|
return _ref.apply(this, arguments);
|
|
256
372
|
};
|
|
257
|
-
}();
|
|
373
|
+
})();
|
|
258
374
|
|
|
259
|
-
var Compiler = /*#__PURE__*/function (_CompilerBase) {
|
|
375
|
+
var Compiler = /*#__PURE__*/ (function (_CompilerBase) {
|
|
260
376
|
function Compiler(config) {
|
|
261
377
|
var _this;
|
|
262
378
|
_classCallCheck(this, Compiler);
|
|
263
379
|
_this = _callSuper(this, Compiler, [config]);
|
|
264
|
-
_defineProperty(_this,
|
|
380
|
+
_defineProperty(_this, 'inOutMap', function (inputOutputMap) {
|
|
265
381
|
var inOutList = [];
|
|
266
382
|
Object.keys(inputOutputMap).forEach(function (input) {
|
|
267
383
|
var output = inputOutputMap[input];
|
|
268
384
|
inOutList.push({
|
|
269
385
|
in: input,
|
|
270
|
-
out: output
|
|
386
|
+
out: output,
|
|
271
387
|
});
|
|
272
388
|
});
|
|
273
389
|
return _this.build({
|
|
274
|
-
entryPoints: inOutList
|
|
390
|
+
entryPoints: inOutList,
|
|
275
391
|
});
|
|
276
392
|
});
|
|
277
|
-
_defineProperty(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
393
|
+
_defineProperty(
|
|
394
|
+
_this,
|
|
395
|
+
'context',
|
|
396
|
+
/*#__PURE__*/ (function () {
|
|
397
|
+
var _ref = _asyncToGenerator(
|
|
398
|
+
/*#__PURE__*/ _regenerator().m(function _callee(opt) {
|
|
399
|
+
var ctx;
|
|
400
|
+
return _regenerator().w(function (_context) {
|
|
401
|
+
while (1)
|
|
402
|
+
switch (_context.n) {
|
|
403
|
+
case 0:
|
|
404
|
+
_context.n = 1;
|
|
405
|
+
return context(
|
|
406
|
+
_objectSpread2(_objectSpread2({}, _this.initOptions), opt)
|
|
407
|
+
);
|
|
408
|
+
case 1:
|
|
409
|
+
ctx = _context.v;
|
|
410
|
+
return _context.a(2, {
|
|
411
|
+
rebuild: function rebuild() {
|
|
412
|
+
return ctx.rebuild();
|
|
413
|
+
},
|
|
414
|
+
cancel: function cancel() {
|
|
415
|
+
return ctx.cancel();
|
|
416
|
+
},
|
|
417
|
+
});
|
|
293
418
|
}
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
_defineProperty(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
419
|
+
}, _callee);
|
|
420
|
+
})
|
|
421
|
+
);
|
|
422
|
+
return function (_x) {
|
|
423
|
+
return _ref.apply(this, arguments);
|
|
424
|
+
};
|
|
425
|
+
})()
|
|
426
|
+
);
|
|
427
|
+
_defineProperty(
|
|
428
|
+
_this,
|
|
429
|
+
'input',
|
|
430
|
+
/*#__PURE__*/ (function () {
|
|
431
|
+
var _ref2 = _asyncToGenerator(
|
|
432
|
+
/*#__PURE__*/ _regenerator().m(function _callee3(input) {
|
|
433
|
+
return _regenerator().w(function (_context3) {
|
|
434
|
+
while (1)
|
|
435
|
+
switch (_context3.n) {
|
|
436
|
+
case 0:
|
|
437
|
+
return _context3.a(2, {
|
|
438
|
+
output: (function () {
|
|
439
|
+
var _output = _asyncToGenerator(
|
|
440
|
+
/*#__PURE__*/ _regenerator().m(
|
|
441
|
+
function _callee2(outputConfig) {
|
|
442
|
+
var finalConfig;
|
|
443
|
+
return _regenerator().w(function (_context2) {
|
|
444
|
+
while (1)
|
|
445
|
+
switch (_context2.n) {
|
|
446
|
+
case 0:
|
|
447
|
+
finalConfig = _objectSpread2(
|
|
448
|
+
_objectSpread2({}, _this.initOptions),
|
|
449
|
+
{},
|
|
450
|
+
{
|
|
451
|
+
entryPoints: isArray(input)
|
|
452
|
+
? input
|
|
453
|
+
: [input],
|
|
454
|
+
outfile: resolve(
|
|
455
|
+
outputConfig.dir,
|
|
456
|
+
outputConfig.filename
|
|
457
|
+
),
|
|
458
|
+
format: outputConfig.format || 'esm',
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
return _context2.a(2, build(finalConfig));
|
|
462
|
+
}
|
|
463
|
+
}, _callee2);
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
);
|
|
467
|
+
function output(_x3) {
|
|
468
|
+
return _output.apply(this, arguments);
|
|
469
|
+
}
|
|
470
|
+
return output;
|
|
471
|
+
})(),
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}, _callee3);
|
|
475
|
+
})
|
|
476
|
+
);
|
|
477
|
+
return function (_x2) {
|
|
478
|
+
return _ref2.apply(this, arguments);
|
|
479
|
+
};
|
|
480
|
+
})()
|
|
481
|
+
);
|
|
482
|
+
_defineProperty(_this, 'build', function (options) {
|
|
483
|
+
return build(
|
|
484
|
+
_objectSpread2(_objectSpread2({}, _this.initOptions), options)
|
|
485
|
+
);
|
|
328
486
|
});
|
|
329
|
-
_defineProperty(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
487
|
+
_defineProperty(
|
|
488
|
+
_this,
|
|
489
|
+
'watch',
|
|
490
|
+
/*#__PURE__*/ (function () {
|
|
491
|
+
var _ref3 = _asyncToGenerator(
|
|
492
|
+
/*#__PURE__*/ _regenerator().m(function _callee4(options) {
|
|
493
|
+
var ctx, server;
|
|
494
|
+
return _regenerator().w(function (_context4) {
|
|
495
|
+
while (1)
|
|
496
|
+
switch (_context4.n) {
|
|
497
|
+
case 0:
|
|
498
|
+
_context4.n = 1;
|
|
499
|
+
return context(_this.initOptions);
|
|
500
|
+
case 1:
|
|
501
|
+
ctx = _context4.v;
|
|
502
|
+
_context4.n = 2;
|
|
503
|
+
return ctx.watch(options);
|
|
504
|
+
case 2:
|
|
505
|
+
server = _context4.v;
|
|
506
|
+
return _context4.a(2, server);
|
|
507
|
+
}
|
|
508
|
+
}, _callee4);
|
|
509
|
+
})
|
|
510
|
+
);
|
|
511
|
+
return function (_x4) {
|
|
512
|
+
return _ref3.apply(this, arguments);
|
|
513
|
+
};
|
|
514
|
+
})()
|
|
515
|
+
);
|
|
516
|
+
_defineProperty(
|
|
517
|
+
_this,
|
|
518
|
+
'server',
|
|
519
|
+
/*#__PURE__*/ (function () {
|
|
520
|
+
var _ref4 = _asyncToGenerator(
|
|
521
|
+
/*#__PURE__*/ _regenerator().m(function _callee5(serverConfig) {
|
|
522
|
+
var ctx, server;
|
|
523
|
+
return _regenerator().w(function (_context5) {
|
|
524
|
+
while (1)
|
|
525
|
+
switch (_context5.n) {
|
|
526
|
+
case 0:
|
|
527
|
+
_context5.n = 1;
|
|
528
|
+
return context(_this.initOptions);
|
|
529
|
+
case 1:
|
|
530
|
+
ctx = _context5.v;
|
|
531
|
+
_context5.n = 2;
|
|
532
|
+
return ctx.serve(serverConfig);
|
|
533
|
+
case 2:
|
|
534
|
+
server = _context5.v;
|
|
535
|
+
return _context5.a(2, server);
|
|
536
|
+
}
|
|
537
|
+
}, _callee5);
|
|
538
|
+
})
|
|
539
|
+
);
|
|
540
|
+
return function (_x5) {
|
|
541
|
+
return _ref4.apply(this, arguments);
|
|
542
|
+
};
|
|
543
|
+
})()
|
|
544
|
+
);
|
|
373
545
|
return _this;
|
|
374
546
|
}
|
|
375
547
|
_inherits(Compiler, _CompilerBase);
|
|
376
548
|
return _createClass(Compiler);
|
|
377
|
-
}(CompilerBase);
|
|
549
|
+
})(CompilerBase);
|
|
378
550
|
var createCompiler = function createCompiler(baseConfig) {
|
|
379
|
-
var esBuildOptions = _objectSpread2(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
551
|
+
var esBuildOptions = _objectSpread2(
|
|
552
|
+
{
|
|
553
|
+
bundle: true,
|
|
554
|
+
// 打包所有依赖
|
|
555
|
+
minify: true,
|
|
556
|
+
// 压缩代码
|
|
557
|
+
sourcemap: true,
|
|
558
|
+
// 生成 Source Map
|
|
559
|
+
platform: 'node',
|
|
560
|
+
// 运行平台('node' 或 'browser')
|
|
561
|
+
target: ['esnext'],
|
|
562
|
+
// 目标环境
|
|
563
|
+
format: 'esm',
|
|
564
|
+
// 输出格式('esm'、'cjs' 或 'iife')
|
|
565
|
+
external: ['react', 'react-dom'],
|
|
566
|
+
// 标记为外部依赖,不打包
|
|
567
|
+
loader: {
|
|
568
|
+
'.ts': 'ts', // TypeScript 文件加载器
|
|
569
|
+
},
|
|
570
|
+
plugins: [],
|
|
396
571
|
},
|
|
397
|
-
|
|
398
|
-
|
|
572
|
+
baseConfig
|
|
573
|
+
);
|
|
399
574
|
return new Compiler(esBuildOptions);
|
|
400
575
|
};
|
|
401
576
|
|
|
402
577
|
var getDefine = function getDefine(params) {
|
|
403
578
|
var NODE_ENV = params.NODE_ENV;
|
|
404
579
|
return {
|
|
405
|
-
'process.env.NODE_ENV': "
|
|
580
|
+
'process.env.NODE_ENV': '"'.concat(NODE_ENV || 'production', '"'),
|
|
406
581
|
};
|
|
407
582
|
};
|
|
408
583
|
|
|
@@ -434,29 +609,35 @@ var getReactLoaderPreset = function getReactLoaderPreset() {
|
|
|
434
609
|
// 处理 PNG 图片
|
|
435
610
|
'.svg': 'file',
|
|
436
611
|
// 处理 SVG 文件
|
|
437
|
-
'.json': 'json' // 处理 SVG 文件
|
|
612
|
+
'.json': 'json', // 处理 SVG 文件
|
|
438
613
|
};
|
|
439
614
|
};
|
|
440
615
|
var getNodeLoaderPreset = function getNodeLoaderPreset() {
|
|
441
616
|
return {
|
|
442
617
|
'.js': 'jsx',
|
|
443
618
|
// 处理 JS 文件中的 JSX
|
|
444
|
-
'.ts': 'ts' // 处理 TypeScript 文件
|
|
619
|
+
'.ts': 'ts', // 处理 TypeScript 文件
|
|
445
620
|
};
|
|
446
621
|
};
|
|
447
622
|
|
|
448
|
-
var htmlPresetStr =
|
|
623
|
+
var htmlPresetStr =
|
|
624
|
+
'\n<!DOCTYPE html>\n<html lang="zh-CN">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>cclr</title>\n <!-- \u5F15\u5165\u6837\u5F0F -->\n <% for (var i in define.headBeforeStyle) { %>\n <link\n href="<%= define.headBeforeStyle[i] %>"\n rel="stylesheet"\n />\n <% } %>\n\n <!-- \u5F15\u5165js -->\n <% for (var i in define.headAfterScript) { %>\n <script src="<%= define.headAfterScript[i] %>"></script>\n <% } %>\n </head>\n <body>\n <div id="main">welcome use cclr !!</div>\n </body>\n</html>\n';
|
|
449
625
|
|
|
450
626
|
var getEsbuildPluginHtml = function getEsbuildPluginHtml(params) {
|
|
451
627
|
var cdnConfig = params.cdnConfig,
|
|
452
628
|
entry = params.entry;
|
|
453
629
|
return htmlPlugin({
|
|
454
|
-
files: [
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
630
|
+
files: [
|
|
631
|
+
_objectSpread2(
|
|
632
|
+
{
|
|
633
|
+
filename: 'index.html',
|
|
634
|
+
entryPoints: [entry],
|
|
635
|
+
htmlTemplate: htmlPresetStr,
|
|
636
|
+
define: _objectSpread2({}, cdnConfig),
|
|
637
|
+
},
|
|
638
|
+
params
|
|
639
|
+
),
|
|
640
|
+
],
|
|
460
641
|
});
|
|
461
642
|
};
|
|
462
643
|
|
|
@@ -466,8 +647,9 @@ var getLessPlugin = function getLessPlugin() {
|
|
|
466
647
|
|
|
467
648
|
var getPostCssPlugin = function getPostCssPlugin() {
|
|
468
649
|
return postCssPlugin.default({
|
|
469
|
-
postcssPlugin: [
|
|
470
|
-
|
|
650
|
+
postcssPlugin: [
|
|
651
|
+
autoprefixer, // 自动添加浏览器前缀
|
|
652
|
+
],
|
|
471
653
|
});
|
|
472
654
|
};
|
|
473
655
|
|
|
@@ -475,22 +657,132 @@ var getSassPlugin = function getSassPlugin() {
|
|
|
475
657
|
return esbuildPluginSass();
|
|
476
658
|
};
|
|
477
659
|
|
|
660
|
+
var esbuildEntryPointsMw = function esbuildEntryPointsMw() {
|
|
661
|
+
return function (ctx) {
|
|
662
|
+
return function (next) {
|
|
663
|
+
return function () {
|
|
664
|
+
var _ctx$getDoraConfig = ctx.getDoraConfig(),
|
|
665
|
+
input = _ctx$getDoraConfig.input;
|
|
666
|
+
ctx.updateEsbuildConfig({
|
|
667
|
+
entryPoints: getEntryPoints(
|
|
668
|
+
ctx.envParams,
|
|
669
|
+
input ? [input] : undefined
|
|
670
|
+
),
|
|
671
|
+
});
|
|
672
|
+
return next();
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
var envParamsMw = function envParamsMw(envParams) {
|
|
679
|
+
return function (ctx) {
|
|
680
|
+
return function (next) {
|
|
681
|
+
return /*#__PURE__*/ _asyncToGenerator(
|
|
682
|
+
/*#__PURE__*/ _regenerator().m(function _callee() {
|
|
683
|
+
return _regenerator().w(function (_context) {
|
|
684
|
+
while (1)
|
|
685
|
+
switch (_context.n) {
|
|
686
|
+
case 0:
|
|
687
|
+
ctx.updateEnvParams(envParams);
|
|
688
|
+
return _context.a(2, next());
|
|
689
|
+
}
|
|
690
|
+
}, _callee);
|
|
691
|
+
})
|
|
692
|
+
);
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
var esbuildReactLoaderMw = function esbuildReactLoaderMw() {
|
|
698
|
+
return function (ctx) {
|
|
699
|
+
return function (next) {
|
|
700
|
+
return function () {
|
|
701
|
+
ctx.updateEsbuildConfig({
|
|
702
|
+
loader: getReactLoaderPreset(),
|
|
703
|
+
});
|
|
704
|
+
return next();
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
var esbuildOutputMw = function esbuildOutputMw() {
|
|
711
|
+
return function (ctx) {
|
|
712
|
+
return function (next) {
|
|
713
|
+
return function () {
|
|
714
|
+
var _ctx$getDoraConfig = ctx.getDoraConfig(),
|
|
715
|
+
output = _ctx$getDoraConfig.output;
|
|
716
|
+
var workRootDir = ctx.envParams.workRootDir;
|
|
717
|
+
var path = output.path,
|
|
718
|
+
file = output.file;
|
|
719
|
+
ctx.updateEsbuildConfig({
|
|
720
|
+
outfile: join(workRootDir, path, file || 'index.js'),
|
|
721
|
+
});
|
|
722
|
+
return next();
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
var esbuildPlainMw = function esbuildPlainMw() {
|
|
729
|
+
return function (ctx) {
|
|
730
|
+
return function (next) {
|
|
731
|
+
return function () {
|
|
732
|
+
var action = ctx.envParams.action;
|
|
733
|
+
var _ctx$getDoraConfig = ctx.getDoraConfig(),
|
|
734
|
+
minimize = _ctx$getDoraConfig.minimize;
|
|
735
|
+
ctx.updateEsbuildConfig({
|
|
736
|
+
define: getDefine({
|
|
737
|
+
NODE_ENV: action === 'build' ? EnvEnum.prod : EnvEnum.dev,
|
|
738
|
+
}),
|
|
739
|
+
minify: minimize,
|
|
740
|
+
bundle: true,
|
|
741
|
+
platform: 'browser',
|
|
742
|
+
target: ['es2020'],
|
|
743
|
+
resolveExtensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
|
|
744
|
+
logLevel: 'info',
|
|
745
|
+
});
|
|
746
|
+
return next();
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
var esbuildStylePluginMw = function esbuildStylePluginMw() {
|
|
753
|
+
return function (ctx) {
|
|
754
|
+
return function (next) {
|
|
755
|
+
return function () {
|
|
756
|
+
var plugins = ctx.esbuildConfig.plugins || [];
|
|
757
|
+
plugins.push(getLessPlugin(), getPostCssPlugin());
|
|
758
|
+
ctx.updateEsbuildConfig({
|
|
759
|
+
plugins: plugins,
|
|
760
|
+
});
|
|
761
|
+
return next();
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
|
|
478
767
|
var getNodeBuildConfigPreset = function getNodeBuildConfigPreset(options) {
|
|
479
|
-
return _objectSpread2(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
768
|
+
return _objectSpread2(
|
|
769
|
+
{
|
|
770
|
+
bundle: true,
|
|
771
|
+
minify: true,
|
|
772
|
+
sourcemap: true,
|
|
773
|
+
target: ['es2020'],
|
|
774
|
+
platform: 'browser',
|
|
775
|
+
define: {
|
|
776
|
+
'process.env.NODE_ENV': '"production"',
|
|
777
|
+
},
|
|
778
|
+
loader: {
|
|
779
|
+
'.png': 'file',
|
|
780
|
+
'.svg': 'file',
|
|
781
|
+
},
|
|
782
|
+
plugins: [],
|
|
487
783
|
},
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
'.svg': 'file'
|
|
491
|
-
},
|
|
492
|
-
plugins: []
|
|
493
|
-
}, options);
|
|
784
|
+
options
|
|
785
|
+
);
|
|
494
786
|
};
|
|
495
787
|
|
|
496
788
|
var getReactBuildConfigPreset = function getReactBuildConfigPreset() {
|
|
@@ -504,13 +796,13 @@ var getReactBuildConfigPreset = function getReactBuildConfigPreset() {
|
|
|
504
796
|
platform: 'browser',
|
|
505
797
|
external: ['react', 'react-dom'],
|
|
506
798
|
define: {
|
|
507
|
-
'process.env.NODE_ENV': '"production"'
|
|
799
|
+
'process.env.NODE_ENV': '"production"',
|
|
508
800
|
},
|
|
509
801
|
loader: {
|
|
510
802
|
'.png': 'file',
|
|
511
|
-
'.svg': 'file'
|
|
803
|
+
'.svg': 'file',
|
|
512
804
|
},
|
|
513
|
-
plugins: []
|
|
805
|
+
plugins: [],
|
|
514
806
|
};
|
|
515
807
|
};
|
|
516
808
|
|
|
@@ -518,47 +810,61 @@ var createContext = function createContext() {
|
|
|
518
810
|
return context({});
|
|
519
811
|
};
|
|
520
812
|
|
|
521
|
-
var Ctx = /*#__PURE__*/function () {
|
|
813
|
+
var Ctx = /*#__PURE__*/ (function () {
|
|
522
814
|
function Ctx(configCtx) {
|
|
523
815
|
_classCallCheck(this, Ctx);
|
|
524
|
-
_defineProperty(this,
|
|
525
|
-
_defineProperty(this,
|
|
526
|
-
_defineProperty(this,
|
|
816
|
+
_defineProperty(this, 'configCtx', void 0);
|
|
817
|
+
_defineProperty(this, 'esbuildConfig', {});
|
|
818
|
+
_defineProperty(this, 'envParams', {
|
|
527
819
|
action: 'build',
|
|
528
|
-
workRootDir: getCwd()
|
|
820
|
+
workRootDir: getCwd(),
|
|
529
821
|
});
|
|
530
822
|
this.configCtx = configCtx;
|
|
531
823
|
}
|
|
532
|
-
return _createClass(Ctx, [
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
824
|
+
return _createClass(Ctx, [
|
|
825
|
+
{
|
|
826
|
+
key: 'updateEnvParams',
|
|
827
|
+
value: function updateEnvParams(argv) {
|
|
828
|
+
this.envParams = _objectSpread2(
|
|
829
|
+
_objectSpread2({}, this.envParams),
|
|
830
|
+
argv
|
|
831
|
+
);
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
key: 'updateEsbuildConfig',
|
|
836
|
+
value: function updateEsbuildConfig(config) {
|
|
837
|
+
this.esbuildConfig = _objectSpread2(
|
|
838
|
+
_objectSpread2({}, this.esbuildConfig),
|
|
839
|
+
config
|
|
840
|
+
);
|
|
841
|
+
},
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
key: 'getDoraConfig',
|
|
845
|
+
value: function getDoraConfig() {
|
|
846
|
+
return this.configCtx.getDoraConfig();
|
|
847
|
+
},
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
key: 'geTDoraConfigEsbuild',
|
|
851
|
+
value: function geTDoraConfigEsbuild() {
|
|
852
|
+
return this.configCtx.getDoraConfig().esbuildConfig || {};
|
|
853
|
+
},
|
|
854
|
+
},
|
|
855
|
+
]);
|
|
856
|
+
})();
|
|
554
857
|
|
|
555
858
|
var extractEntry = function extractEntry(entryPoints) {
|
|
556
859
|
var files = [];
|
|
557
860
|
if (!entryPoints) return [];
|
|
558
|
-
if (isString(entryPoints)) files.push(entryPoints);
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
861
|
+
if (isString(entryPoints)) files.push(entryPoints);
|
|
862
|
+
else if (isArray(entryPoints))
|
|
863
|
+
entryPoints.forEach(function (entry) {
|
|
864
|
+
if (isString(entry)) files.push(entry);
|
|
865
|
+
if (isObject(entry) && entry.in) files.push(entry.in);
|
|
866
|
+
});
|
|
867
|
+
else if (isObject(entryPoints)) {
|
|
562
868
|
// 对象可能是 { import: '...' } 或 { import: ['...'] }
|
|
563
869
|
// 也可能是其它描述符
|
|
564
870
|
// 尝试提取 import 字段
|
|
@@ -570,4 +876,29 @@ var extractEntry = function extractEntry(entryPoints) {
|
|
|
570
876
|
return files;
|
|
571
877
|
};
|
|
572
878
|
|
|
573
|
-
export {
|
|
879
|
+
export {
|
|
880
|
+
builder,
|
|
881
|
+
Compiler,
|
|
882
|
+
createCompiler,
|
|
883
|
+
createContext,
|
|
884
|
+
Ctx,
|
|
885
|
+
envParamsMw,
|
|
886
|
+
esbuildEntryPointsMw,
|
|
887
|
+
esbuildOutputMw,
|
|
888
|
+
esbuildPlainMw,
|
|
889
|
+
esbuildReactLoaderMw,
|
|
890
|
+
esbuildStylePluginMw,
|
|
891
|
+
extractEntry,
|
|
892
|
+
getDefine,
|
|
893
|
+
getEntryPoints,
|
|
894
|
+
getEsbuildPluginHtml,
|
|
895
|
+
getLessPlugin,
|
|
896
|
+
getNodeBuildConfigPreset,
|
|
897
|
+
getNodeLoaderPreset,
|
|
898
|
+
getPostCssPlugin,
|
|
899
|
+
getReactBuildConfigPreset,
|
|
900
|
+
getReactLoaderPreset,
|
|
901
|
+
getSassPlugin,
|
|
902
|
+
inputFileDirList,
|
|
903
|
+
inputFileTypeList,
|
|
904
|
+
};
|