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