@rolldown/browser 1.0.0-beta.42 → 1.0.0-beta.44

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