@rolldown/browser 1.0.0-beta.43 → 1.0.0-beta.45
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/dist/cli-setup.d.mts +1 -0
- package/dist/cli-setup.mjs +16 -0
- package/dist/cli.mjs +1049 -76
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +34 -453
- package/dist/experimental-index.d.mts +21 -6
- package/dist/experimental-index.mjs +39 -16
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +3 -3
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +1 -2
- package/dist/rolldown-binding.wasi.cjs +1 -2
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-BkaKdpud.d.mts → binding-DRegrFdE.d.mts} +98 -22
- package/dist/shared/{dist-CU0dSkK2.mjs → composable-filters-D_PY7Qa7.mjs} +2 -2
- package/dist/shared/{define-config-D5LB7YAC.d.mts → define-config-C6-goOPh.d.mts} +217 -99
- package/dist/shared/{load-config-DBsf9ada.mjs → load-config-Z2MWPLZO.mjs} +4 -4
- package/dist/shared/{parse-ast-index-Gktxd-oi.mjs → parse-ast-index-Ck5SwMSC.mjs} +37 -6
- package/dist/shared/{prompt-B4e-jZUR.mjs → prompt-BDwA3jSr.mjs} +1 -1
- package/dist/shared/{src-Dqrw8WuH.mjs → src-B4ZmdjD5.mjs} +637 -669
- package/dist/{src-DXN0YLUN.js → src-CLWy1Uip.js} +871 -873
- package/package.json +1 -1
- package/dist/shared/logger-B83ocDok.mjs +0 -985
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/
|
|
2
|
-
import
|
|
1
|
+
import { n as ConfigExport, t as defineConfig } from "./shared/define-config-C6-goOPh.mjs";
|
|
2
|
+
import "./shared/binding-DRegrFdE.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/load-config.d.ts
|
|
5
5
|
declare function loadConfig(configPath: string): Promise<ConfigExport>;
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
3
|
-
import "./shared/
|
|
4
|
-
import { loadConfig } from "./shared/load-config-
|
|
1
|
+
import { C as version, r as defineConfig } from "./shared/src-B4ZmdjD5.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-Ck5SwMSC.mjs";
|
|
3
|
+
import "./shared/composable-filters-D_PY7Qa7.mjs";
|
|
4
|
+
import { t as loadConfig } from "./shared/load-config-Z2MWPLZO.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/config.ts
|
|
7
7
|
const VERSION = version;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuiltinPlugin, PluginDriver, RolldownBuild,
|
|
1
|
+
import { c as createBundlerOptions, d as transformToRollupOutput, f as bindingifySourcemap, h as makeBuiltinPluginCallable, l as normalizedStringOrRegex, m as BuiltinPlugin, p as PluginDriver, s as RolldownBuild, u as normalizeBindingResult } from "./src-CLWy1Uip.js";
|
|
2
2
|
import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-engine.ts
|
|
@@ -25,7 +25,12 @@ var DevEngine = class DevEngine {
|
|
|
25
25
|
const bindingDevOptions = {
|
|
26
26
|
onHmrUpdates: bindingOnHmrUpdates,
|
|
27
27
|
onOutput: userOnOutput ? function(rawResult) {
|
|
28
|
-
|
|
28
|
+
const result = normalizeBindingResult(rawResult);
|
|
29
|
+
if (result instanceof Error) {
|
|
30
|
+
userOnOutput(result);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
userOnOutput(transformToRollupOutput(result));
|
|
29
34
|
} : void 0,
|
|
30
35
|
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
|
|
31
36
|
watch: devOptions.watch && {
|
|
@@ -76,7 +81,7 @@ var DevEngine = class DevEngine {
|
|
|
76
81
|
|
|
77
82
|
//#endregion
|
|
78
83
|
//#region src/api/dev/index.ts
|
|
79
|
-
|
|
84
|
+
const dev = (...args) => DevEngine.create(...args);
|
|
80
85
|
|
|
81
86
|
//#endregion
|
|
82
87
|
//#region src/api/experimental.ts
|
|
@@ -142,9 +147,6 @@ function viteResolvePlugin(config) {
|
|
|
142
147
|
function isolatedDeclarationPlugin(config) {
|
|
143
148
|
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
144
149
|
}
|
|
145
|
-
function assetPlugin(config) {
|
|
146
|
-
return new BuiltinPlugin("builtin:asset", config);
|
|
147
|
-
}
|
|
148
150
|
function webWorkerPostPlugin() {
|
|
149
151
|
return new BuiltinPlugin("builtin:web-worker-post");
|
|
150
152
|
}
|
|
@@ -158,6 +160,12 @@ function reactRefreshWrapperPlugin(config) {
|
|
|
158
160
|
}
|
|
159
161
|
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
|
|
160
162
|
}
|
|
163
|
+
function viteCSSPostPlugin(config) {
|
|
164
|
+
return new BuiltinPlugin("builtin:vite-css-post", config);
|
|
165
|
+
}
|
|
166
|
+
function viteHtmlPlugin(config) {
|
|
167
|
+
return new BuiltinPlugin("builtin:vite-html", config);
|
|
168
|
+
}
|
|
161
169
|
|
|
162
170
|
//#endregion
|
|
163
171
|
//#region src/builtin-plugin/alias-plugin.ts
|
|
@@ -166,447 +174,10 @@ function aliasPlugin(config) {
|
|
|
166
174
|
}
|
|
167
175
|
|
|
168
176
|
//#endregion
|
|
169
|
-
//#region
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
fatal: 0,
|
|
173
|
-
error: 0,
|
|
174
|
-
warn: 1,
|
|
175
|
-
log: 2,
|
|
176
|
-
info: 3,
|
|
177
|
-
success: 3,
|
|
178
|
-
fail: 3,
|
|
179
|
-
ready: 3,
|
|
180
|
-
start: 3,
|
|
181
|
-
box: 3,
|
|
182
|
-
debug: 4,
|
|
183
|
-
trace: 5,
|
|
184
|
-
verbose: Number.POSITIVE_INFINITY
|
|
185
|
-
};
|
|
186
|
-
const LogTypes = {
|
|
187
|
-
silent: { level: -1 },
|
|
188
|
-
fatal: { level: LogLevels.fatal },
|
|
189
|
-
error: { level: LogLevels.error },
|
|
190
|
-
warn: { level: LogLevels.warn },
|
|
191
|
-
log: { level: LogLevels.log },
|
|
192
|
-
info: { level: LogLevels.info },
|
|
193
|
-
success: { level: LogLevels.success },
|
|
194
|
-
fail: { level: LogLevels.fail },
|
|
195
|
-
ready: { level: LogLevels.info },
|
|
196
|
-
start: { level: LogLevels.info },
|
|
197
|
-
box: { level: LogLevels.info },
|
|
198
|
-
debug: { level: LogLevels.debug },
|
|
199
|
-
trace: { level: LogLevels.trace },
|
|
200
|
-
verbose: { level: LogLevels.verbose }
|
|
201
|
-
};
|
|
202
|
-
function isPlainObject$1(value) {
|
|
203
|
-
if (value === null || typeof value !== "object") return false;
|
|
204
|
-
const prototype = Object.getPrototypeOf(value);
|
|
205
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
206
|
-
if (Symbol.iterator in value) return false;
|
|
207
|
-
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
211
|
-
if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
212
|
-
const object = Object.assign({}, defaults);
|
|
213
|
-
for (const key in baseObject) {
|
|
214
|
-
if (key === "__proto__" || key === "constructor") continue;
|
|
215
|
-
const value = baseObject[key];
|
|
216
|
-
if (value === null || value === void 0) continue;
|
|
217
|
-
if (merger && merger(object, key, value, namespace)) continue;
|
|
218
|
-
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
219
|
-
else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
220
|
-
else object[key] = value;
|
|
221
|
-
}
|
|
222
|
-
return object;
|
|
223
|
-
}
|
|
224
|
-
function createDefu(merger) {
|
|
225
|
-
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
226
|
-
}
|
|
227
|
-
const defu = createDefu();
|
|
228
|
-
function isPlainObject(obj) {
|
|
229
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
230
|
-
}
|
|
231
|
-
function isLogObj(arg) {
|
|
232
|
-
if (!isPlainObject(arg)) return false;
|
|
233
|
-
if (!arg.message && !arg.args) return false;
|
|
234
|
-
if (arg.stack) return false;
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
let paused = false;
|
|
238
|
-
const queue = [];
|
|
239
|
-
var Consola = class Consola {
|
|
240
|
-
options;
|
|
241
|
-
_lastLog;
|
|
242
|
-
_mockFn;
|
|
243
|
-
/**
|
|
244
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
245
|
-
*
|
|
246
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
247
|
-
*/
|
|
248
|
-
constructor(options = {}) {
|
|
249
|
-
const types = options.types || LogTypes;
|
|
250
|
-
this.options = defu({
|
|
251
|
-
...options,
|
|
252
|
-
defaults: { ...options.defaults },
|
|
253
|
-
level: _normalizeLogLevel(options.level, types),
|
|
254
|
-
reporters: [...options.reporters || []]
|
|
255
|
-
}, {
|
|
256
|
-
types: LogTypes,
|
|
257
|
-
throttle: 1e3,
|
|
258
|
-
throttleMin: 5,
|
|
259
|
-
formatOptions: {
|
|
260
|
-
date: true,
|
|
261
|
-
colors: false,
|
|
262
|
-
compact: true
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
for (const type in types) {
|
|
266
|
-
const defaults = {
|
|
267
|
-
type,
|
|
268
|
-
...this.options.defaults,
|
|
269
|
-
...types[type]
|
|
270
|
-
};
|
|
271
|
-
this[type] = this._wrapLogFn(defaults);
|
|
272
|
-
this[type].raw = this._wrapLogFn(defaults, true);
|
|
273
|
-
}
|
|
274
|
-
if (this.options.mockFn) this.mockTypes();
|
|
275
|
-
this._lastLog = {};
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Gets the current log level of the Consola instance.
|
|
279
|
-
*
|
|
280
|
-
* @returns {number} The current log level.
|
|
281
|
-
*/
|
|
282
|
-
get level() {
|
|
283
|
-
return this.options.level;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Sets the minimum log level that will be output by the instance.
|
|
287
|
-
*
|
|
288
|
-
* @param {number} level - The new log level to set.
|
|
289
|
-
*/
|
|
290
|
-
set level(level) {
|
|
291
|
-
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Displays a prompt to the user and returns the response.
|
|
295
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
296
|
-
*
|
|
297
|
-
* @template T
|
|
298
|
-
* @param {string} message - The message to display in the prompt.
|
|
299
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
300
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
301
|
-
*/
|
|
302
|
-
prompt(message, opts) {
|
|
303
|
-
if (!this.options.prompt) throw new Error("prompt is not supported!");
|
|
304
|
-
return this.options.prompt(message, opts);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
308
|
-
*
|
|
309
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
310
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
311
|
-
*/
|
|
312
|
-
create(options) {
|
|
313
|
-
const instance = new Consola({
|
|
314
|
-
...this.options,
|
|
315
|
-
...options
|
|
316
|
-
});
|
|
317
|
-
if (this._mockFn) instance.mockTypes(this._mockFn);
|
|
318
|
-
return instance;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
322
|
-
*
|
|
323
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
324
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
325
|
-
*/
|
|
326
|
-
withDefaults(defaults) {
|
|
327
|
-
return this.create({
|
|
328
|
-
...this.options,
|
|
329
|
-
defaults: {
|
|
330
|
-
...this.options.defaults,
|
|
331
|
-
...defaults
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
337
|
-
*
|
|
338
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
339
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
340
|
-
*/
|
|
341
|
-
withTag(tag) {
|
|
342
|
-
return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Adds a custom reporter to the Consola instance.
|
|
346
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
347
|
-
*
|
|
348
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
349
|
-
* @returns {Consola} The current Consola instance.
|
|
350
|
-
*/
|
|
351
|
-
addReporter(reporter) {
|
|
352
|
-
this.options.reporters.push(reporter);
|
|
353
|
-
return this;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Removes a custom reporter from the Consola instance.
|
|
357
|
-
* If no reporter is specified, all reporters will be removed.
|
|
358
|
-
*
|
|
359
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
360
|
-
* @returns {Consola} The current Consola instance.
|
|
361
|
-
*/
|
|
362
|
-
removeReporter(reporter) {
|
|
363
|
-
if (reporter) {
|
|
364
|
-
const i = this.options.reporters.indexOf(reporter);
|
|
365
|
-
if (i !== -1) return this.options.reporters.splice(i, 1);
|
|
366
|
-
} else this.options.reporters.splice(0);
|
|
367
|
-
return this;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
371
|
-
*
|
|
372
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
373
|
-
* @returns {Consola} The current Consola instance.
|
|
374
|
-
*/
|
|
375
|
-
setReporters(reporters) {
|
|
376
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
377
|
-
return this;
|
|
378
|
-
}
|
|
379
|
-
wrapAll() {
|
|
380
|
-
this.wrapConsole();
|
|
381
|
-
this.wrapStd();
|
|
382
|
-
}
|
|
383
|
-
restoreAll() {
|
|
384
|
-
this.restoreConsole();
|
|
385
|
-
this.restoreStd();
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
389
|
-
*/
|
|
390
|
-
wrapConsole() {
|
|
391
|
-
for (const type in this.options.types) {
|
|
392
|
-
if (!console["__" + type]) console["__" + type] = console[type];
|
|
393
|
-
console[type] = this[type].raw;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Restores the original console methods, removing Consola overrides.
|
|
398
|
-
*/
|
|
399
|
-
restoreConsole() {
|
|
400
|
-
for (const type in this.options.types) if (console["__" + type]) {
|
|
401
|
-
console[type] = console["__" + type];
|
|
402
|
-
delete console["__" + type];
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
407
|
-
*/
|
|
408
|
-
wrapStd() {
|
|
409
|
-
this._wrapStream(this.options.stdout, "log");
|
|
410
|
-
this._wrapStream(this.options.stderr, "log");
|
|
411
|
-
}
|
|
412
|
-
_wrapStream(stream, type) {
|
|
413
|
-
if (!stream) return;
|
|
414
|
-
if (!stream.__write) stream.__write = stream.write;
|
|
415
|
-
stream.write = (data) => {
|
|
416
|
-
this[type].raw(String(data).trim());
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
421
|
-
*/
|
|
422
|
-
restoreStd() {
|
|
423
|
-
this._restoreStream(this.options.stdout);
|
|
424
|
-
this._restoreStream(this.options.stderr);
|
|
425
|
-
}
|
|
426
|
-
_restoreStream(stream) {
|
|
427
|
-
if (!stream) return;
|
|
428
|
-
if (stream.__write) {
|
|
429
|
-
stream.write = stream.__write;
|
|
430
|
-
delete stream.__write;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
435
|
-
*/
|
|
436
|
-
pauseLogs() {
|
|
437
|
-
paused = true;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Resumes logging, processing any queued logs.
|
|
441
|
-
*/
|
|
442
|
-
resumeLogs() {
|
|
443
|
-
paused = false;
|
|
444
|
-
const _queue = queue.splice(0);
|
|
445
|
-
for (const item of _queue) item[0]._logFn(item[1], item[2]);
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
449
|
-
*
|
|
450
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
451
|
-
*/
|
|
452
|
-
mockTypes(mockFn) {
|
|
453
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
454
|
-
this._mockFn = _mockFn;
|
|
455
|
-
if (typeof _mockFn !== "function") return;
|
|
456
|
-
for (const type in this.options.types) {
|
|
457
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
458
|
-
this[type].raw = this[type];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
_wrapLogFn(defaults, isRaw) {
|
|
462
|
-
return (...args) => {
|
|
463
|
-
if (paused) {
|
|
464
|
-
queue.push([
|
|
465
|
-
this,
|
|
466
|
-
defaults,
|
|
467
|
-
args,
|
|
468
|
-
isRaw
|
|
469
|
-
]);
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
return this._logFn(defaults, args, isRaw);
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
_logFn(defaults, args, isRaw) {
|
|
476
|
-
if ((defaults.level || 0) > this.level) return false;
|
|
477
|
-
const logObj = {
|
|
478
|
-
date: /* @__PURE__ */ new Date(),
|
|
479
|
-
args: [],
|
|
480
|
-
...defaults,
|
|
481
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
482
|
-
};
|
|
483
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
|
|
484
|
-
else logObj.args = [...args];
|
|
485
|
-
if (logObj.message) {
|
|
486
|
-
logObj.args.unshift(logObj.message);
|
|
487
|
-
delete logObj.message;
|
|
488
|
-
}
|
|
489
|
-
if (logObj.additional) {
|
|
490
|
-
if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
|
|
491
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
492
|
-
delete logObj.additional;
|
|
493
|
-
}
|
|
494
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
495
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
496
|
-
const resolveLog = (newLog = false) => {
|
|
497
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
498
|
-
if (this._lastLog.object && repeated > 0) {
|
|
499
|
-
const args2 = [...this._lastLog.object.args];
|
|
500
|
-
if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
|
|
501
|
-
this._log({
|
|
502
|
-
...this._lastLog.object,
|
|
503
|
-
args: args2
|
|
504
|
-
});
|
|
505
|
-
this._lastLog.count = 1;
|
|
506
|
-
}
|
|
507
|
-
if (newLog) {
|
|
508
|
-
this._lastLog.object = logObj;
|
|
509
|
-
this._log(logObj);
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
clearTimeout(this._lastLog.timeout);
|
|
513
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
514
|
-
this._lastLog.time = logObj.date;
|
|
515
|
-
if (diffTime < this.options.throttle) try {
|
|
516
|
-
const serializedLog = JSON.stringify([
|
|
517
|
-
logObj.type,
|
|
518
|
-
logObj.tag,
|
|
519
|
-
logObj.args
|
|
520
|
-
]);
|
|
521
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
522
|
-
this._lastLog.serialized = serializedLog;
|
|
523
|
-
if (isSameLog) {
|
|
524
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
525
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
526
|
-
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
} catch {}
|
|
531
|
-
resolveLog(true);
|
|
532
|
-
}
|
|
533
|
-
_log(logObj) {
|
|
534
|
-
for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
538
|
-
if (input === void 0) return defaultLevel;
|
|
539
|
-
if (typeof input === "number") return input;
|
|
540
|
-
if (types[input] && types[input].level !== void 0) return types[input].level;
|
|
541
|
-
return defaultLevel;
|
|
542
|
-
}
|
|
543
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
544
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
545
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
546
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
547
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
548
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
549
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
550
|
-
function createConsola$1(options = {}) {
|
|
551
|
-
return new Consola(options);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
//#endregion
|
|
555
|
-
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/browser.mjs
|
|
556
|
-
var BrowserReporter = class {
|
|
557
|
-
options;
|
|
558
|
-
defaultColor;
|
|
559
|
-
levelColorMap;
|
|
560
|
-
typeColorMap;
|
|
561
|
-
constructor(options) {
|
|
562
|
-
this.options = { ...options };
|
|
563
|
-
this.defaultColor = "#7f8c8d";
|
|
564
|
-
this.levelColorMap = {
|
|
565
|
-
0: "#c0392b",
|
|
566
|
-
1: "#f39c12",
|
|
567
|
-
3: "#00BCD4"
|
|
568
|
-
};
|
|
569
|
-
this.typeColorMap = { success: "#2ecc71" };
|
|
570
|
-
}
|
|
571
|
-
_getLogFn(level) {
|
|
572
|
-
if (level < 1) return console.__error || console.error;
|
|
573
|
-
if (level === 1) return console.__warn || console.warn;
|
|
574
|
-
return console.__log || console.log;
|
|
575
|
-
}
|
|
576
|
-
log(logObj) {
|
|
577
|
-
const consoleLogFn = this._getLogFn(logObj.level);
|
|
578
|
-
const type = logObj.type === "log" ? "" : logObj.type;
|
|
579
|
-
const tag = logObj.tag || "";
|
|
580
|
-
const style = `
|
|
581
|
-
background: ${this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor};
|
|
582
|
-
border-radius: 0.5em;
|
|
583
|
-
color: white;
|
|
584
|
-
font-weight: bold;
|
|
585
|
-
padding: 2px 0.5em;
|
|
586
|
-
`;
|
|
587
|
-
const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
|
|
588
|
-
if (typeof logObj.args[0] === "string") consoleLogFn(`${badge}%c ${logObj.args[0]}`, style, "", ...logObj.args.slice(1));
|
|
589
|
-
else consoleLogFn(badge, style, ...logObj.args);
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
function createConsola(options = {}) {
|
|
593
|
-
return createConsola$1({
|
|
594
|
-
reporters: options.reporters || [new BrowserReporter({})],
|
|
595
|
-
prompt(message, options2 = {}) {
|
|
596
|
-
if (options2.type === "confirm") return Promise.resolve(confirm(message));
|
|
597
|
-
return Promise.resolve(prompt(message));
|
|
598
|
-
},
|
|
599
|
-
...options
|
|
600
|
-
});
|
|
177
|
+
//#region src/builtin-plugin/asset-plugin.ts
|
|
178
|
+
function assetPlugin(config) {
|
|
179
|
+
return new BuiltinPlugin("builtin:asset", config);
|
|
601
180
|
}
|
|
602
|
-
const consola = createConsola();
|
|
603
|
-
|
|
604
|
-
//#endregion
|
|
605
|
-
//#region src/cli/logger.ts
|
|
606
|
-
/**
|
|
607
|
-
* Console logger
|
|
608
|
-
*/
|
|
609
|
-
const logger = createConsola({ formatOptions: { date: false } });
|
|
610
181
|
|
|
611
182
|
//#endregion
|
|
612
183
|
//#region src/builtin-plugin/replace-plugin.ts
|
|
@@ -633,15 +204,10 @@ const logger = createConsola({ formatOptions: { date: false } });
|
|
|
633
204
|
* ```
|
|
634
205
|
*/
|
|
635
206
|
function replacePlugin(values = {}, options = {}) {
|
|
636
|
-
let hasNonStringValues = false;
|
|
637
207
|
Object.keys(values).forEach((key) => {
|
|
638
208
|
const value = values[key];
|
|
639
|
-
if (typeof value !== "string")
|
|
640
|
-
hasNonStringValues = true;
|
|
641
|
-
values[key] = String(value);
|
|
642
|
-
}
|
|
209
|
+
if (typeof value !== "string") values[key] = String(value);
|
|
643
210
|
});
|
|
644
|
-
if (hasNonStringValues) logger.warn("Some values provided to `replacePlugin` are not strings. They will be converted to strings, but for better performance consider converting them manually.");
|
|
645
211
|
return new BuiltinPlugin("builtin:replace", {
|
|
646
212
|
...options,
|
|
647
213
|
values
|
|
@@ -662,4 +228,19 @@ function transformPlugin(config) {
|
|
|
662
228
|
}
|
|
663
229
|
|
|
664
230
|
//#endregion
|
|
665
|
-
|
|
231
|
+
//#region src/builtin-plugin/vite-css-plugin.ts
|
|
232
|
+
function viteCSSPlugin(config) {
|
|
233
|
+
return new BuiltinPlugin("builtin:vite-css", config ? {
|
|
234
|
+
...config,
|
|
235
|
+
async compileCSS(url, importer, resolver) {
|
|
236
|
+
let result = await config.compileCSS(url, importer, resolver);
|
|
237
|
+
return {
|
|
238
|
+
...result,
|
|
239
|
+
map: bindingifySourcemap(result.map)
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
} : void 0);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
//#endregion
|
|
246
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as BuiltinPlugin, N as SourceMapInput, U as defineParallelPlugin, bt as OutputOptions, kt as RolldownOutput, o as InputOptions, wt as StringOrRegExp } from "./shared/define-config-C6-goOPh.mjs";
|
|
2
|
+
import { A as IsolatedDeclarationsResult, B as TransformResult, C as BindingViteCssPluginConfig, D as BindingWasmHelperPluginConfig, E as BindingViteResolvePluginConfig, H as moduleRunnerTransform, L as ResolveResult, N as NapiResolveOptions, R as ResolverFactory, S as BindingUrlResolver, T as BindingViteHtmlPluginConfig, U as transform, V as isolatedDeclaration, a as BindingClientHmrUpdate, d as BindingJsonPluginConfig, g as BindingRebuildStrategy, h as BindingReactRefreshWrapperPluginConfig, k as IsolatedDeclarationsOptions, l as BindingImportGlobPluginConfig, m as BindingModulePreloadPolyfillPluginConfig, n as BindingBuildImportAnalysisPluginConfig, o as BindingDynamicImportVarsPluginConfig, p as BindingManifestPluginConfig, s as BindingEsmExternalRequirePluginConfig, t as BindingAssetPluginConfig, u as BindingIsolatedDeclarationPluginConfig, v as BindingReplacePluginConfig, w as BindingViteCssPostPluginConfig, x as BindingTransformPluginConfig, y as BindingReporterPluginConfig, z as TransformOptions } from "./shared/binding-DRegrFdE.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-options.d.ts
|
|
5
5
|
type DevOnHmrUpdates = (result: Error | {
|
|
6
6
|
updates: BindingClientHmrUpdate[];
|
|
7
7
|
changedFiles: string[];
|
|
8
8
|
}) => void | Promise<void>;
|
|
9
|
-
type DevOnOutput = (result: Error |
|
|
9
|
+
type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
|
|
10
10
|
interface DevWatchOptions {
|
|
11
11
|
/**
|
|
12
12
|
* If `true`, files are not written to disk.
|
|
@@ -77,7 +77,7 @@ declare class DevEngine {
|
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/api/dev/index.d.ts
|
|
80
|
-
declare
|
|
80
|
+
declare const dev: typeof DevEngine.create;
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/api/experimental.d.ts
|
|
83
83
|
/**
|
|
@@ -104,7 +104,6 @@ declare function jsonPlugin(config?: BindingJsonPluginConfig): BuiltinPlugin;
|
|
|
104
104
|
declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuiltinPlugin;
|
|
105
105
|
declare function viteResolvePlugin(config: BindingViteResolvePluginConfig): BuiltinPlugin;
|
|
106
106
|
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
|
|
107
|
-
declare function assetPlugin(config?: BindingAssetPluginConfig): BuiltinPlugin;
|
|
108
107
|
declare function webWorkerPostPlugin(): BuiltinPlugin;
|
|
109
108
|
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
|
|
110
109
|
type ReactRefreshWrapperPluginConfig = Omit<BindingReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
|
|
@@ -112,6 +111,8 @@ type ReactRefreshWrapperPluginConfig = Omit<BindingReactRefreshWrapperPluginConf
|
|
|
112
111
|
exclude?: StringOrRegExp | StringOrRegExp[];
|
|
113
112
|
};
|
|
114
113
|
declare function reactRefreshWrapperPlugin(config: ReactRefreshWrapperPluginConfig): BuiltinPlugin;
|
|
114
|
+
declare function viteCSSPostPlugin(config?: BindingViteCssPostPluginConfig): BuiltinPlugin;
|
|
115
|
+
declare function viteHtmlPlugin(config?: BindingViteHtmlPluginConfig): BuiltinPlugin;
|
|
115
116
|
//#endregion
|
|
116
117
|
//#region src/builtin-plugin/alias-plugin.d.ts
|
|
117
118
|
type AliasPluginAlias = {
|
|
@@ -123,6 +124,9 @@ type AliasPluginConfig = {
|
|
|
123
124
|
};
|
|
124
125
|
declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
|
|
125
126
|
//#endregion
|
|
127
|
+
//#region src/builtin-plugin/asset-plugin.d.ts
|
|
128
|
+
declare function assetPlugin(config: BindingAssetPluginConfig): BuiltinPlugin;
|
|
129
|
+
//#endregion
|
|
126
130
|
//#region src/builtin-plugin/replace-plugin.d.ts
|
|
127
131
|
/**
|
|
128
132
|
* Replaces targeted strings in files while bundling.
|
|
@@ -158,4 +162,15 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
|
|
|
158
162
|
};
|
|
159
163
|
declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
|
|
160
164
|
//#endregion
|
|
161
|
-
|
|
165
|
+
//#region src/builtin-plugin/vite-css-plugin.d.ts
|
|
166
|
+
type ViteCssPluginConfig = Omit<BindingViteCssPluginConfig, "compileCSS"> & {
|
|
167
|
+
compileCSS: (url: string, importer: string, resolver: BindingUrlResolver) => Promise<{
|
|
168
|
+
code: string;
|
|
169
|
+
map?: SourceMapInput;
|
|
170
|
+
modules?: Record<string, string>;
|
|
171
|
+
deps?: Set<string>;
|
|
172
|
+
}>;
|
|
173
|
+
};
|
|
174
|
+
declare function viteCSSPlugin(config?: ViteCssPluginConfig): BuiltinPlugin;
|
|
175
|
+
//#endregion
|
|
176
|
+
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|