@storybook/builder-vite 10.0.0-beta.1 → 10.0.0-beta.10

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 (2) hide show
  1. package/dist/index.js +483 -1787
  2. package/package.json +4 -5
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_uubrhnqyjwo from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_uubrhnqyjwo from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_uubrhnqyjwo from "node:module";
1
+ import CJS_COMPAT_NODE_URL_znz9qdyfvq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_znz9qdyfvq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_znz9qdyfvq from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_uubrhnqyjwo.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_uubrhnqyjwo.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_uubrhnqyjwo.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_znz9qdyfvq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_znz9qdyfvq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_znz9qdyfvq.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -16,13 +16,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
16
16
  var __getProtoOf = Object.getPrototypeOf;
17
17
  var __hasOwnProp = Object.prototype.hasOwnProperty;
18
18
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
19
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
20
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
21
- }) : x)(function(x) {
22
- if (typeof require !== "undefined") return require.apply(this, arguments);
23
- throw Error('Dynamic require of "' + x + '" is not supported');
24
- });
25
- var __commonJS = (cb, mod) => function __require2() {
19
+ var __commonJS = (cb, mod) => function __require() {
26
20
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
21
  };
28
22
  var __copyProps = (to, from, except, desc) => {
@@ -188,7 +182,7 @@ var require_brace_expansion = __commonJS({
188
182
  var isSequence = isNumericSequence || isAlphaSequence;
189
183
  var isOptions = m.body.indexOf(",") >= 0;
190
184
  if (!isSequence && !isOptions) {
191
- if (m.post.match(/,.*\}/)) {
185
+ if (m.post.match(/,(?!,).*\}/)) {
192
186
  str = m.pre + "{" + m.body + escClose + m.post;
193
187
  return expand2(str);
194
188
  }
@@ -263,1706 +257,6 @@ var require_brace_expansion = __commonJS({
263
257
  }
264
258
  });
265
259
 
266
- // ../../node_modules/commondir/index.js
267
- var require_commondir = __commonJS({
268
- "../../node_modules/commondir/index.js"(exports, module) {
269
- var path3 = __require("path");
270
- module.exports = function(basedir, relfiles) {
271
- if (relfiles) {
272
- var files = relfiles.map(function(r) {
273
- return path3.resolve(basedir, r);
274
- });
275
- } else {
276
- var files = basedir;
277
- }
278
- var res = files.slice(1).reduce(function(ps, file) {
279
- if (!file.match(/^([A-Za-z]:)?\/|\\/)) {
280
- throw new Error("relative path without a basedir");
281
- }
282
- var xs = file.split(/\/+|\\+/);
283
- for (var i = 0; ps[i] === xs[i] && i < Math.min(ps.length, xs.length); i++) ;
284
- return ps.slice(0, i);
285
- }, files[0].split(/\/+|\\+/));
286
- return res.length > 1 ? res.join("/") : "/";
287
- };
288
- }
289
- });
290
-
291
- // ../../node_modules/p-try/index.js
292
- var require_p_try = __commonJS({
293
- "../../node_modules/p-try/index.js"(exports, module) {
294
- "use strict";
295
- var pTry = /* @__PURE__ */ __name((fn, ...arguments_) => new Promise((resolve3) => {
296
- resolve3(fn(...arguments_));
297
- }), "pTry");
298
- module.exports = pTry;
299
- module.exports.default = pTry;
300
- }
301
- });
302
-
303
- // ../../node_modules/find-cache-dir/node_modules/p-limit/index.js
304
- var require_p_limit = __commonJS({
305
- "../../node_modules/find-cache-dir/node_modules/p-limit/index.js"(exports, module) {
306
- "use strict";
307
- var pTry = require_p_try();
308
- var pLimit = /* @__PURE__ */ __name((concurrency) => {
309
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
310
- return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));
311
- }
312
- const queue = [];
313
- let activeCount = 0;
314
- const next = /* @__PURE__ */ __name(() => {
315
- activeCount--;
316
- if (queue.length > 0) {
317
- queue.shift()();
318
- }
319
- }, "next");
320
- const run = /* @__PURE__ */ __name((fn, resolve3, ...args) => {
321
- activeCount++;
322
- const result = pTry(fn, ...args);
323
- resolve3(result);
324
- result.then(next, next);
325
- }, "run");
326
- const enqueue = /* @__PURE__ */ __name((fn, resolve3, ...args) => {
327
- if (activeCount < concurrency) {
328
- run(fn, resolve3, ...args);
329
- } else {
330
- queue.push(run.bind(null, fn, resolve3, ...args));
331
- }
332
- }, "enqueue");
333
- const generator = /* @__PURE__ */ __name((fn, ...args) => new Promise((resolve3) => enqueue(fn, resolve3, ...args)), "generator");
334
- Object.defineProperties(generator, {
335
- activeCount: {
336
- get: /* @__PURE__ */ __name(() => activeCount, "get")
337
- },
338
- pendingCount: {
339
- get: /* @__PURE__ */ __name(() => queue.length, "get")
340
- },
341
- clearQueue: {
342
- value: /* @__PURE__ */ __name(() => {
343
- queue.length = 0;
344
- }, "value")
345
- }
346
- });
347
- return generator;
348
- }, "pLimit");
349
- module.exports = pLimit;
350
- module.exports.default = pLimit;
351
- }
352
- });
353
-
354
- // ../../node_modules/find-cache-dir/node_modules/p-locate/index.js
355
- var require_p_locate = __commonJS({
356
- "../../node_modules/find-cache-dir/node_modules/p-locate/index.js"(exports, module) {
357
- "use strict";
358
- var pLimit = require_p_limit();
359
- var EndError = class extends Error {
360
- static {
361
- __name(this, "EndError");
362
- }
363
- constructor(value) {
364
- super();
365
- this.value = value;
366
- }
367
- };
368
- var testElement = /* @__PURE__ */ __name(async (element, tester) => tester(await element), "testElement");
369
- var finder = /* @__PURE__ */ __name(async (element) => {
370
- const values = await Promise.all(element);
371
- if (values[1] === true) {
372
- throw new EndError(values[0]);
373
- }
374
- return false;
375
- }, "finder");
376
- var pLocate = /* @__PURE__ */ __name(async (iterable, tester, options) => {
377
- options = {
378
- concurrency: Infinity,
379
- preserveOrder: true,
380
- ...options
381
- };
382
- const limit = pLimit(options.concurrency);
383
- const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
384
- const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
385
- try {
386
- await Promise.all(items.map((element) => checkLimit(finder, element)));
387
- } catch (error) {
388
- if (error instanceof EndError) {
389
- return error.value;
390
- }
391
- throw error;
392
- }
393
- }, "pLocate");
394
- module.exports = pLocate;
395
- module.exports.default = pLocate;
396
- }
397
- });
398
-
399
- // ../../node_modules/find-cache-dir/node_modules/locate-path/index.js
400
- var require_locate_path = __commonJS({
401
- "../../node_modules/find-cache-dir/node_modules/locate-path/index.js"(exports, module) {
402
- "use strict";
403
- var path3 = __require("path");
404
- var fs = __require("fs");
405
- var { promisify } = __require("util");
406
- var pLocate = require_p_locate();
407
- var fsStat = promisify(fs.stat);
408
- var fsLStat = promisify(fs.lstat);
409
- var typeMappings = {
410
- directory: "isDirectory",
411
- file: "isFile"
412
- };
413
- function checkType({ type }) {
414
- if (type in typeMappings) {
415
- return;
416
- }
417
- throw new Error(`Invalid type specified: ${type}`);
418
- }
419
- __name(checkType, "checkType");
420
- var matchType = /* @__PURE__ */ __name((type, stat) => type === void 0 || stat[typeMappings[type]](), "matchType");
421
- module.exports = async (paths, options) => {
422
- options = {
423
- cwd: process.cwd(),
424
- type: "file",
425
- allowSymlinks: true,
426
- ...options
427
- };
428
- checkType(options);
429
- const statFn = options.allowSymlinks ? fsStat : fsLStat;
430
- return pLocate(paths, async (path_) => {
431
- try {
432
- const stat = await statFn(path3.resolve(options.cwd, path_));
433
- return matchType(options.type, stat);
434
- } catch (_) {
435
- return false;
436
- }
437
- }, options);
438
- };
439
- module.exports.sync = (paths, options) => {
440
- options = {
441
- cwd: process.cwd(),
442
- allowSymlinks: true,
443
- type: "file",
444
- ...options
445
- };
446
- checkType(options);
447
- const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
448
- for (const path_ of paths) {
449
- try {
450
- const stat = statFn(path3.resolve(options.cwd, path_));
451
- if (matchType(options.type, stat)) {
452
- return path_;
453
- }
454
- } catch (_) {
455
- }
456
- }
457
- };
458
- }
459
- });
460
-
461
- // ../../node_modules/find-cache-dir/node_modules/path-exists/index.js
462
- var require_path_exists = __commonJS({
463
- "../../node_modules/find-cache-dir/node_modules/path-exists/index.js"(exports, module) {
464
- "use strict";
465
- var fs = __require("fs");
466
- var { promisify } = __require("util");
467
- var pAccess = promisify(fs.access);
468
- module.exports = async (path3) => {
469
- try {
470
- await pAccess(path3);
471
- return true;
472
- } catch (_) {
473
- return false;
474
- }
475
- };
476
- module.exports.sync = (path3) => {
477
- try {
478
- fs.accessSync(path3);
479
- return true;
480
- } catch (_) {
481
- return false;
482
- }
483
- };
484
- }
485
- });
486
-
487
- // ../../node_modules/find-cache-dir/node_modules/find-up/index.js
488
- var require_find_up = __commonJS({
489
- "../../node_modules/find-cache-dir/node_modules/find-up/index.js"(exports, module) {
490
- "use strict";
491
- var path3 = __require("path");
492
- var locatePath = require_locate_path();
493
- var pathExists = require_path_exists();
494
- var stop = Symbol("findUp.stop");
495
- module.exports = async (name, options = {}) => {
496
- let directory = path3.resolve(options.cwd || "");
497
- const { root } = path3.parse(directory);
498
- const paths = [].concat(name);
499
- const runMatcher = /* @__PURE__ */ __name(async (locateOptions) => {
500
- if (typeof name !== "function") {
501
- return locatePath(paths, locateOptions);
502
- }
503
- const foundPath = await name(locateOptions.cwd);
504
- if (typeof foundPath === "string") {
505
- return locatePath([foundPath], locateOptions);
506
- }
507
- return foundPath;
508
- }, "runMatcher");
509
- while (true) {
510
- const foundPath = await runMatcher({ ...options, cwd: directory });
511
- if (foundPath === stop) {
512
- return;
513
- }
514
- if (foundPath) {
515
- return path3.resolve(directory, foundPath);
516
- }
517
- if (directory === root) {
518
- return;
519
- }
520
- directory = path3.dirname(directory);
521
- }
522
- };
523
- module.exports.sync = (name, options = {}) => {
524
- let directory = path3.resolve(options.cwd || "");
525
- const { root } = path3.parse(directory);
526
- const paths = [].concat(name);
527
- const runMatcher = /* @__PURE__ */ __name((locateOptions) => {
528
- if (typeof name !== "function") {
529
- return locatePath.sync(paths, locateOptions);
530
- }
531
- const foundPath = name(locateOptions.cwd);
532
- if (typeof foundPath === "string") {
533
- return locatePath.sync([foundPath], locateOptions);
534
- }
535
- return foundPath;
536
- }, "runMatcher");
537
- while (true) {
538
- const foundPath = runMatcher({ ...options, cwd: directory });
539
- if (foundPath === stop) {
540
- return;
541
- }
542
- if (foundPath) {
543
- return path3.resolve(directory, foundPath);
544
- }
545
- if (directory === root) {
546
- return;
547
- }
548
- directory = path3.dirname(directory);
549
- }
550
- };
551
- module.exports.exists = pathExists;
552
- module.exports.sync.exists = pathExists.sync;
553
- module.exports.stop = stop;
554
- }
555
- });
556
-
557
- // ../../node_modules/find-cache-dir/node_modules/pkg-dir/index.js
558
- var require_pkg_dir = __commonJS({
559
- "../../node_modules/find-cache-dir/node_modules/pkg-dir/index.js"(exports, module) {
560
- "use strict";
561
- var path3 = __require("path");
562
- var findUp = require_find_up();
563
- var pkgDir = /* @__PURE__ */ __name(async (cwd2) => {
564
- const filePath = await findUp("package.json", { cwd: cwd2 });
565
- return filePath && path3.dirname(filePath);
566
- }, "pkgDir");
567
- module.exports = pkgDir;
568
- module.exports.default = pkgDir;
569
- module.exports.sync = (cwd2) => {
570
- const filePath = findUp.sync("package.json", { cwd: cwd2 });
571
- return filePath && path3.dirname(filePath);
572
- };
573
- }
574
- });
575
-
576
- // ../../node_modules/find-cache-dir/node_modules/semver/semver.js
577
- var require_semver = __commonJS({
578
- "../../node_modules/find-cache-dir/node_modules/semver/semver.js"(exports, module) {
579
- exports = module.exports = SemVer;
580
- var debug;
581
- if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
582
- debug = /* @__PURE__ */ __name(function() {
583
- var args = Array.prototype.slice.call(arguments, 0);
584
- args.unshift("SEMVER");
585
- console.log.apply(console, args);
586
- }, "debug");
587
- } else {
588
- debug = /* @__PURE__ */ __name(function() {
589
- }, "debug");
590
- }
591
- exports.SEMVER_SPEC_VERSION = "2.0.0";
592
- var MAX_LENGTH = 256;
593
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
594
- 9007199254740991;
595
- var MAX_SAFE_COMPONENT_LENGTH = 16;
596
- var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
597
- var re = exports.re = [];
598
- var safeRe = exports.safeRe = [];
599
- var src = exports.src = [];
600
- var t = exports.tokens = {};
601
- var R = 0;
602
- function tok(n2) {
603
- t[n2] = R++;
604
- }
605
- __name(tok, "tok");
606
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
607
- var safeRegexReplacements = [
608
- ["\\s", 1],
609
- ["\\d", MAX_LENGTH],
610
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
611
- ];
612
- function makeSafeRe(value) {
613
- for (var i2 = 0; i2 < safeRegexReplacements.length; i2++) {
614
- var token = safeRegexReplacements[i2][0];
615
- var max = safeRegexReplacements[i2][1];
616
- value = value.split(token + "*").join(token + "{0," + max + "}").split(token + "+").join(token + "{1," + max + "}");
617
- }
618
- return value;
619
- }
620
- __name(makeSafeRe, "makeSafeRe");
621
- tok("NUMERICIDENTIFIER");
622
- src[t.NUMERICIDENTIFIER] = "0|[1-9]\\d*";
623
- tok("NUMERICIDENTIFIERLOOSE");
624
- src[t.NUMERICIDENTIFIERLOOSE] = "\\d+";
625
- tok("NONNUMERICIDENTIFIER");
626
- src[t.NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-]" + LETTERDASHNUMBER + "*";
627
- tok("MAINVERSION");
628
- src[t.MAINVERSION] = "(" + src[t.NUMERICIDENTIFIER] + ")\\.(" + src[t.NUMERICIDENTIFIER] + ")\\.(" + src[t.NUMERICIDENTIFIER] + ")";
629
- tok("MAINVERSIONLOOSE");
630
- src[t.MAINVERSIONLOOSE] = "(" + src[t.NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[t.NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[t.NUMERICIDENTIFIERLOOSE] + ")";
631
- tok("PRERELEASEIDENTIFIER");
632
- src[t.PRERELEASEIDENTIFIER] = "(?:" + src[t.NUMERICIDENTIFIER] + "|" + src[t.NONNUMERICIDENTIFIER] + ")";
633
- tok("PRERELEASEIDENTIFIERLOOSE");
634
- src[t.PRERELEASEIDENTIFIERLOOSE] = "(?:" + src[t.NUMERICIDENTIFIERLOOSE] + "|" + src[t.NONNUMERICIDENTIFIER] + ")";
635
- tok("PRERELEASE");
636
- src[t.PRERELEASE] = "(?:-(" + src[t.PRERELEASEIDENTIFIER] + "(?:\\." + src[t.PRERELEASEIDENTIFIER] + ")*))";
637
- tok("PRERELEASELOOSE");
638
- src[t.PRERELEASELOOSE] = "(?:-?(" + src[t.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + src[t.PRERELEASEIDENTIFIERLOOSE] + ")*))";
639
- tok("BUILDIDENTIFIER");
640
- src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + "+";
641
- tok("BUILD");
642
- src[t.BUILD] = "(?:\\+(" + src[t.BUILDIDENTIFIER] + "(?:\\." + src[t.BUILDIDENTIFIER] + ")*))";
643
- tok("FULL");
644
- tok("FULLPLAIN");
645
- src[t.FULLPLAIN] = "v?" + src[t.MAINVERSION] + src[t.PRERELEASE] + "?" + src[t.BUILD] + "?";
646
- src[t.FULL] = "^" + src[t.FULLPLAIN] + "$";
647
- tok("LOOSEPLAIN");
648
- src[t.LOOSEPLAIN] = "[v=\\s]*" + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + "?" + src[t.BUILD] + "?";
649
- tok("LOOSE");
650
- src[t.LOOSE] = "^" + src[t.LOOSEPLAIN] + "$";
651
- tok("GTLT");
652
- src[t.GTLT] = "((?:<|>)?=?)";
653
- tok("XRANGEIDENTIFIERLOOSE");
654
- src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + "|x|X|\\*";
655
- tok("XRANGEIDENTIFIER");
656
- src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + "|x|X|\\*";
657
- tok("XRANGEPLAIN");
658
- src[t.XRANGEPLAIN] = "[v=\\s]*(" + src[t.XRANGEIDENTIFIER] + ")(?:\\.(" + src[t.XRANGEIDENTIFIER] + ")(?:\\.(" + src[t.XRANGEIDENTIFIER] + ")(?:" + src[t.PRERELEASE] + ")?" + src[t.BUILD] + "?)?)?";
659
- tok("XRANGEPLAINLOOSE");
660
- src[t.XRANGEPLAINLOOSE] = "[v=\\s]*(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:" + src[t.PRERELEASELOOSE] + ")?" + src[t.BUILD] + "?)?)?";
661
- tok("XRANGE");
662
- src[t.XRANGE] = "^" + src[t.GTLT] + "\\s*" + src[t.XRANGEPLAIN] + "$";
663
- tok("XRANGELOOSE");
664
- src[t.XRANGELOOSE] = "^" + src[t.GTLT] + "\\s*" + src[t.XRANGEPLAINLOOSE] + "$";
665
- tok("COERCE");
666
- src[t.COERCE] = "(^|[^\\d])(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "})(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:$|[^\\d])";
667
- tok("COERCERTL");
668
- re[t.COERCERTL] = new RegExp(src[t.COERCE], "g");
669
- safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), "g");
670
- tok("LONETILDE");
671
- src[t.LONETILDE] = "(?:~>?)";
672
- tok("TILDETRIM");
673
- src[t.TILDETRIM] = "(\\s*)" + src[t.LONETILDE] + "\\s+";
674
- re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], "g");
675
- safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), "g");
676
- var tildeTrimReplace = "$1~";
677
- tok("TILDE");
678
- src[t.TILDE] = "^" + src[t.LONETILDE] + src[t.XRANGEPLAIN] + "$";
679
- tok("TILDELOOSE");
680
- src[t.TILDELOOSE] = "^" + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + "$";
681
- tok("LONECARET");
682
- src[t.LONECARET] = "(?:\\^)";
683
- tok("CARETTRIM");
684
- src[t.CARETTRIM] = "(\\s*)" + src[t.LONECARET] + "\\s+";
685
- re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], "g");
686
- safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), "g");
687
- var caretTrimReplace = "$1^";
688
- tok("CARET");
689
- src[t.CARET] = "^" + src[t.LONECARET] + src[t.XRANGEPLAIN] + "$";
690
- tok("CARETLOOSE");
691
- src[t.CARETLOOSE] = "^" + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + "$";
692
- tok("COMPARATORLOOSE");
693
- src[t.COMPARATORLOOSE] = "^" + src[t.GTLT] + "\\s*(" + src[t.LOOSEPLAIN] + ")$|^$";
694
- tok("COMPARATOR");
695
- src[t.COMPARATOR] = "^" + src[t.GTLT] + "\\s*(" + src[t.FULLPLAIN] + ")$|^$";
696
- tok("COMPARATORTRIM");
697
- src[t.COMPARATORTRIM] = "(\\s*)" + src[t.GTLT] + "\\s*(" + src[t.LOOSEPLAIN] + "|" + src[t.XRANGEPLAIN] + ")";
698
- re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], "g");
699
- safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), "g");
700
- var comparatorTrimReplace = "$1$2$3";
701
- tok("HYPHENRANGE");
702
- src[t.HYPHENRANGE] = "^\\s*(" + src[t.XRANGEPLAIN] + ")\\s+-\\s+(" + src[t.XRANGEPLAIN] + ")\\s*$";
703
- tok("HYPHENRANGELOOSE");
704
- src[t.HYPHENRANGELOOSE] = "^\\s*(" + src[t.XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + src[t.XRANGEPLAINLOOSE] + ")\\s*$";
705
- tok("STAR");
706
- src[t.STAR] = "(<|>)?=?\\s*\\*";
707
- for (i = 0; i < R; i++) {
708
- debug(i, src[i]);
709
- if (!re[i]) {
710
- re[i] = new RegExp(src[i]);
711
- safeRe[i] = new RegExp(makeSafeRe(src[i]));
712
- }
713
- }
714
- var i;
715
- exports.parse = parse3;
716
- function parse3(version, options) {
717
- if (!options || typeof options !== "object") {
718
- options = {
719
- loose: !!options,
720
- includePrerelease: false
721
- };
722
- }
723
- if (version instanceof SemVer) {
724
- return version;
725
- }
726
- if (typeof version !== "string") {
727
- return null;
728
- }
729
- if (version.length > MAX_LENGTH) {
730
- return null;
731
- }
732
- var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL];
733
- if (!r.test(version)) {
734
- return null;
735
- }
736
- try {
737
- return new SemVer(version, options);
738
- } catch (er) {
739
- return null;
740
- }
741
- }
742
- __name(parse3, "parse");
743
- exports.valid = valid;
744
- function valid(version, options) {
745
- var v = parse3(version, options);
746
- return v ? v.version : null;
747
- }
748
- __name(valid, "valid");
749
- exports.clean = clean;
750
- function clean(version, options) {
751
- var s = parse3(version.trim().replace(/^[=v]+/, ""), options);
752
- return s ? s.version : null;
753
- }
754
- __name(clean, "clean");
755
- exports.SemVer = SemVer;
756
- function SemVer(version, options) {
757
- if (!options || typeof options !== "object") {
758
- options = {
759
- loose: !!options,
760
- includePrerelease: false
761
- };
762
- }
763
- if (version instanceof SemVer) {
764
- if (version.loose === options.loose) {
765
- return version;
766
- } else {
767
- version = version.version;
768
- }
769
- } else if (typeof version !== "string") {
770
- throw new TypeError("Invalid Version: " + version);
771
- }
772
- if (version.length > MAX_LENGTH) {
773
- throw new TypeError("version is longer than " + MAX_LENGTH + " characters");
774
- }
775
- if (!(this instanceof SemVer)) {
776
- return new SemVer(version, options);
777
- }
778
- debug("SemVer", version, options);
779
- this.options = options;
780
- this.loose = !!options.loose;
781
- var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]);
782
- if (!m) {
783
- throw new TypeError("Invalid Version: " + version);
784
- }
785
- this.raw = version;
786
- this.major = +m[1];
787
- this.minor = +m[2];
788
- this.patch = +m[3];
789
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
790
- throw new TypeError("Invalid major version");
791
- }
792
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
793
- throw new TypeError("Invalid minor version");
794
- }
795
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
796
- throw new TypeError("Invalid patch version");
797
- }
798
- if (!m[4]) {
799
- this.prerelease = [];
800
- } else {
801
- this.prerelease = m[4].split(".").map(function(id) {
802
- if (/^[0-9]+$/.test(id)) {
803
- var num = +id;
804
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
805
- return num;
806
- }
807
- }
808
- return id;
809
- });
810
- }
811
- this.build = m[5] ? m[5].split(".") : [];
812
- this.format();
813
- }
814
- __name(SemVer, "SemVer");
815
- SemVer.prototype.format = function() {
816
- this.version = this.major + "." + this.minor + "." + this.patch;
817
- if (this.prerelease.length) {
818
- this.version += "-" + this.prerelease.join(".");
819
- }
820
- return this.version;
821
- };
822
- SemVer.prototype.toString = function() {
823
- return this.version;
824
- };
825
- SemVer.prototype.compare = function(other) {
826
- debug("SemVer.compare", this.version, this.options, other);
827
- if (!(other instanceof SemVer)) {
828
- other = new SemVer(other, this.options);
829
- }
830
- return this.compareMain(other) || this.comparePre(other);
831
- };
832
- SemVer.prototype.compareMain = function(other) {
833
- if (!(other instanceof SemVer)) {
834
- other = new SemVer(other, this.options);
835
- }
836
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
837
- };
838
- SemVer.prototype.comparePre = function(other) {
839
- if (!(other instanceof SemVer)) {
840
- other = new SemVer(other, this.options);
841
- }
842
- if (this.prerelease.length && !other.prerelease.length) {
843
- return -1;
844
- } else if (!this.prerelease.length && other.prerelease.length) {
845
- return 1;
846
- } else if (!this.prerelease.length && !other.prerelease.length) {
847
- return 0;
848
- }
849
- var i2 = 0;
850
- do {
851
- var a = this.prerelease[i2];
852
- var b = other.prerelease[i2];
853
- debug("prerelease compare", i2, a, b);
854
- if (a === void 0 && b === void 0) {
855
- return 0;
856
- } else if (b === void 0) {
857
- return 1;
858
- } else if (a === void 0) {
859
- return -1;
860
- } else if (a === b) {
861
- continue;
862
- } else {
863
- return compareIdentifiers(a, b);
864
- }
865
- } while (++i2);
866
- };
867
- SemVer.prototype.compareBuild = function(other) {
868
- if (!(other instanceof SemVer)) {
869
- other = new SemVer(other, this.options);
870
- }
871
- var i2 = 0;
872
- do {
873
- var a = this.build[i2];
874
- var b = other.build[i2];
875
- debug("prerelease compare", i2, a, b);
876
- if (a === void 0 && b === void 0) {
877
- return 0;
878
- } else if (b === void 0) {
879
- return 1;
880
- } else if (a === void 0) {
881
- return -1;
882
- } else if (a === b) {
883
- continue;
884
- } else {
885
- return compareIdentifiers(a, b);
886
- }
887
- } while (++i2);
888
- };
889
- SemVer.prototype.inc = function(release, identifier) {
890
- switch (release) {
891
- case "premajor":
892
- this.prerelease.length = 0;
893
- this.patch = 0;
894
- this.minor = 0;
895
- this.major++;
896
- this.inc("pre", identifier);
897
- break;
898
- case "preminor":
899
- this.prerelease.length = 0;
900
- this.patch = 0;
901
- this.minor++;
902
- this.inc("pre", identifier);
903
- break;
904
- case "prepatch":
905
- this.prerelease.length = 0;
906
- this.inc("patch", identifier);
907
- this.inc("pre", identifier);
908
- break;
909
- // If the input is a non-prerelease version, this acts the same as
910
- // prepatch.
911
- case "prerelease":
912
- if (this.prerelease.length === 0) {
913
- this.inc("patch", identifier);
914
- }
915
- this.inc("pre", identifier);
916
- break;
917
- case "major":
918
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
919
- this.major++;
920
- }
921
- this.minor = 0;
922
- this.patch = 0;
923
- this.prerelease = [];
924
- break;
925
- case "minor":
926
- if (this.patch !== 0 || this.prerelease.length === 0) {
927
- this.minor++;
928
- }
929
- this.patch = 0;
930
- this.prerelease = [];
931
- break;
932
- case "patch":
933
- if (this.prerelease.length === 0) {
934
- this.patch++;
935
- }
936
- this.prerelease = [];
937
- break;
938
- // This probably shouldn't be used publicly.
939
- // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
940
- case "pre":
941
- if (this.prerelease.length === 0) {
942
- this.prerelease = [0];
943
- } else {
944
- var i2 = this.prerelease.length;
945
- while (--i2 >= 0) {
946
- if (typeof this.prerelease[i2] === "number") {
947
- this.prerelease[i2]++;
948
- i2 = -2;
949
- }
950
- }
951
- if (i2 === -1) {
952
- this.prerelease.push(0);
953
- }
954
- }
955
- if (identifier) {
956
- if (this.prerelease[0] === identifier) {
957
- if (isNaN(this.prerelease[1])) {
958
- this.prerelease = [identifier, 0];
959
- }
960
- } else {
961
- this.prerelease = [identifier, 0];
962
- }
963
- }
964
- break;
965
- default:
966
- throw new Error("invalid increment argument: " + release);
967
- }
968
- this.format();
969
- this.raw = this.version;
970
- return this;
971
- };
972
- exports.inc = inc;
973
- function inc(version, release, loose, identifier) {
974
- if (typeof loose === "string") {
975
- identifier = loose;
976
- loose = void 0;
977
- }
978
- try {
979
- return new SemVer(version, loose).inc(release, identifier).version;
980
- } catch (er) {
981
- return null;
982
- }
983
- }
984
- __name(inc, "inc");
985
- exports.diff = diff;
986
- function diff(version1, version2) {
987
- if (eq(version1, version2)) {
988
- return null;
989
- } else {
990
- var v1 = parse3(version1);
991
- var v2 = parse3(version2);
992
- var prefix = "";
993
- if (v1.prerelease.length || v2.prerelease.length) {
994
- prefix = "pre";
995
- var defaultResult = "prerelease";
996
- }
997
- for (var key in v1) {
998
- if (key === "major" || key === "minor" || key === "patch") {
999
- if (v1[key] !== v2[key]) {
1000
- return prefix + key;
1001
- }
1002
- }
1003
- }
1004
- return defaultResult;
1005
- }
1006
- }
1007
- __name(diff, "diff");
1008
- exports.compareIdentifiers = compareIdentifiers;
1009
- var numeric = /^[0-9]+$/;
1010
- function compareIdentifiers(a, b) {
1011
- var anum = numeric.test(a);
1012
- var bnum = numeric.test(b);
1013
- if (anum && bnum) {
1014
- a = +a;
1015
- b = +b;
1016
- }
1017
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
1018
- }
1019
- __name(compareIdentifiers, "compareIdentifiers");
1020
- exports.rcompareIdentifiers = rcompareIdentifiers;
1021
- function rcompareIdentifiers(a, b) {
1022
- return compareIdentifiers(b, a);
1023
- }
1024
- __name(rcompareIdentifiers, "rcompareIdentifiers");
1025
- exports.major = major;
1026
- function major(a, loose) {
1027
- return new SemVer(a, loose).major;
1028
- }
1029
- __name(major, "major");
1030
- exports.minor = minor;
1031
- function minor(a, loose) {
1032
- return new SemVer(a, loose).minor;
1033
- }
1034
- __name(minor, "minor");
1035
- exports.patch = patch;
1036
- function patch(a, loose) {
1037
- return new SemVer(a, loose).patch;
1038
- }
1039
- __name(patch, "patch");
1040
- exports.compare = compare;
1041
- function compare(a, b, loose) {
1042
- return new SemVer(a, loose).compare(new SemVer(b, loose));
1043
- }
1044
- __name(compare, "compare");
1045
- exports.compareLoose = compareLoose;
1046
- function compareLoose(a, b) {
1047
- return compare(a, b, true);
1048
- }
1049
- __name(compareLoose, "compareLoose");
1050
- exports.compareBuild = compareBuild;
1051
- function compareBuild(a, b, loose) {
1052
- var versionA = new SemVer(a, loose);
1053
- var versionB = new SemVer(b, loose);
1054
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
1055
- }
1056
- __name(compareBuild, "compareBuild");
1057
- exports.rcompare = rcompare;
1058
- function rcompare(a, b, loose) {
1059
- return compare(b, a, loose);
1060
- }
1061
- __name(rcompare, "rcompare");
1062
- exports.sort = sort;
1063
- function sort(list, loose) {
1064
- return list.sort(function(a, b) {
1065
- return exports.compareBuild(a, b, loose);
1066
- });
1067
- }
1068
- __name(sort, "sort");
1069
- exports.rsort = rsort;
1070
- function rsort(list, loose) {
1071
- return list.sort(function(a, b) {
1072
- return exports.compareBuild(b, a, loose);
1073
- });
1074
- }
1075
- __name(rsort, "rsort");
1076
- exports.gt = gt;
1077
- function gt(a, b, loose) {
1078
- return compare(a, b, loose) > 0;
1079
- }
1080
- __name(gt, "gt");
1081
- exports.lt = lt;
1082
- function lt(a, b, loose) {
1083
- return compare(a, b, loose) < 0;
1084
- }
1085
- __name(lt, "lt");
1086
- exports.eq = eq;
1087
- function eq(a, b, loose) {
1088
- return compare(a, b, loose) === 0;
1089
- }
1090
- __name(eq, "eq");
1091
- exports.neq = neq;
1092
- function neq(a, b, loose) {
1093
- return compare(a, b, loose) !== 0;
1094
- }
1095
- __name(neq, "neq");
1096
- exports.gte = gte;
1097
- function gte(a, b, loose) {
1098
- return compare(a, b, loose) >= 0;
1099
- }
1100
- __name(gte, "gte");
1101
- exports.lte = lte;
1102
- function lte(a, b, loose) {
1103
- return compare(a, b, loose) <= 0;
1104
- }
1105
- __name(lte, "lte");
1106
- exports.cmp = cmp;
1107
- function cmp(a, op, b, loose) {
1108
- switch (op) {
1109
- case "===":
1110
- if (typeof a === "object")
1111
- a = a.version;
1112
- if (typeof b === "object")
1113
- b = b.version;
1114
- return a === b;
1115
- case "!==":
1116
- if (typeof a === "object")
1117
- a = a.version;
1118
- if (typeof b === "object")
1119
- b = b.version;
1120
- return a !== b;
1121
- case "":
1122
- case "=":
1123
- case "==":
1124
- return eq(a, b, loose);
1125
- case "!=":
1126
- return neq(a, b, loose);
1127
- case ">":
1128
- return gt(a, b, loose);
1129
- case ">=":
1130
- return gte(a, b, loose);
1131
- case "<":
1132
- return lt(a, b, loose);
1133
- case "<=":
1134
- return lte(a, b, loose);
1135
- default:
1136
- throw new TypeError("Invalid operator: " + op);
1137
- }
1138
- }
1139
- __name(cmp, "cmp");
1140
- exports.Comparator = Comparator;
1141
- function Comparator(comp, options) {
1142
- if (!options || typeof options !== "object") {
1143
- options = {
1144
- loose: !!options,
1145
- includePrerelease: false
1146
- };
1147
- }
1148
- if (comp instanceof Comparator) {
1149
- if (comp.loose === !!options.loose) {
1150
- return comp;
1151
- } else {
1152
- comp = comp.value;
1153
- }
1154
- }
1155
- if (!(this instanceof Comparator)) {
1156
- return new Comparator(comp, options);
1157
- }
1158
- comp = comp.trim().split(/\s+/).join(" ");
1159
- debug("comparator", comp, options);
1160
- this.options = options;
1161
- this.loose = !!options.loose;
1162
- this.parse(comp);
1163
- if (this.semver === ANY) {
1164
- this.value = "";
1165
- } else {
1166
- this.value = this.operator + this.semver.version;
1167
- }
1168
- debug("comp", this);
1169
- }
1170
- __name(Comparator, "Comparator");
1171
- var ANY = {};
1172
- Comparator.prototype.parse = function(comp) {
1173
- var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR];
1174
- var m = comp.match(r);
1175
- if (!m) {
1176
- throw new TypeError("Invalid comparator: " + comp);
1177
- }
1178
- this.operator = m[1] !== void 0 ? m[1] : "";
1179
- if (this.operator === "=") {
1180
- this.operator = "";
1181
- }
1182
- if (!m[2]) {
1183
- this.semver = ANY;
1184
- } else {
1185
- this.semver = new SemVer(m[2], this.options.loose);
1186
- }
1187
- };
1188
- Comparator.prototype.toString = function() {
1189
- return this.value;
1190
- };
1191
- Comparator.prototype.test = function(version) {
1192
- debug("Comparator.test", version, this.options.loose);
1193
- if (this.semver === ANY || version === ANY) {
1194
- return true;
1195
- }
1196
- if (typeof version === "string") {
1197
- try {
1198
- version = new SemVer(version, this.options);
1199
- } catch (er) {
1200
- return false;
1201
- }
1202
- }
1203
- return cmp(version, this.operator, this.semver, this.options);
1204
- };
1205
- Comparator.prototype.intersects = function(comp, options) {
1206
- if (!(comp instanceof Comparator)) {
1207
- throw new TypeError("a Comparator is required");
1208
- }
1209
- if (!options || typeof options !== "object") {
1210
- options = {
1211
- loose: !!options,
1212
- includePrerelease: false
1213
- };
1214
- }
1215
- var rangeTmp;
1216
- if (this.operator === "") {
1217
- if (this.value === "") {
1218
- return true;
1219
- }
1220
- rangeTmp = new Range(comp.value, options);
1221
- return satisfies(this.value, rangeTmp, options);
1222
- } else if (comp.operator === "") {
1223
- if (comp.value === "") {
1224
- return true;
1225
- }
1226
- rangeTmp = new Range(this.value, options);
1227
- return satisfies(comp.semver, rangeTmp, options);
1228
- }
1229
- var sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
1230
- var sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
1231
- var sameSemVer = this.semver.version === comp.semver.version;
1232
- var differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
1233
- var oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && ((this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<"));
1234
- var oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && ((this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">"));
1235
- return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
1236
- };
1237
- exports.Range = Range;
1238
- function Range(range, options) {
1239
- if (!options || typeof options !== "object") {
1240
- options = {
1241
- loose: !!options,
1242
- includePrerelease: false
1243
- };
1244
- }
1245
- if (range instanceof Range) {
1246
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1247
- return range;
1248
- } else {
1249
- return new Range(range.raw, options);
1250
- }
1251
- }
1252
- if (range instanceof Comparator) {
1253
- return new Range(range.value, options);
1254
- }
1255
- if (!(this instanceof Range)) {
1256
- return new Range(range, options);
1257
- }
1258
- this.options = options;
1259
- this.loose = !!options.loose;
1260
- this.includePrerelease = !!options.includePrerelease;
1261
- this.raw = range.trim().split(/\s+/).join(" ");
1262
- this.set = this.raw.split("||").map(function(range2) {
1263
- return this.parseRange(range2.trim());
1264
- }, this).filter(function(c) {
1265
- return c.length;
1266
- });
1267
- if (!this.set.length) {
1268
- throw new TypeError("Invalid SemVer Range: " + this.raw);
1269
- }
1270
- this.format();
1271
- }
1272
- __name(Range, "Range");
1273
- Range.prototype.format = function() {
1274
- this.range = this.set.map(function(comps) {
1275
- return comps.join(" ").trim();
1276
- }).join("||").trim();
1277
- return this.range;
1278
- };
1279
- Range.prototype.toString = function() {
1280
- return this.range;
1281
- };
1282
- Range.prototype.parseRange = function(range) {
1283
- var loose = this.options.loose;
1284
- var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE];
1285
- range = range.replace(hr, hyphenReplace);
1286
- debug("hyphen replace", range);
1287
- range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace);
1288
- debug("comparator trim", range, safeRe[t.COMPARATORTRIM]);
1289
- range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace);
1290
- range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace);
1291
- range = range.split(/\s+/).join(" ");
1292
- var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR];
1293
- var set = range.split(" ").map(function(comp) {
1294
- return parseComparator(comp, this.options);
1295
- }, this).join(" ").split(/\s+/);
1296
- if (this.options.loose) {
1297
- set = set.filter(function(comp) {
1298
- return !!comp.match(compRe);
1299
- });
1300
- }
1301
- set = set.map(function(comp) {
1302
- return new Comparator(comp, this.options);
1303
- }, this);
1304
- return set;
1305
- };
1306
- Range.prototype.intersects = function(range, options) {
1307
- if (!(range instanceof Range)) {
1308
- throw new TypeError("a Range is required");
1309
- }
1310
- return this.set.some(function(thisComparators) {
1311
- return isSatisfiable(thisComparators, options) && range.set.some(function(rangeComparators) {
1312
- return isSatisfiable(rangeComparators, options) && thisComparators.every(function(thisComparator) {
1313
- return rangeComparators.every(function(rangeComparator) {
1314
- return thisComparator.intersects(rangeComparator, options);
1315
- });
1316
- });
1317
- });
1318
- });
1319
- };
1320
- function isSatisfiable(comparators, options) {
1321
- var result = true;
1322
- var remainingComparators = comparators.slice();
1323
- var testComparator = remainingComparators.pop();
1324
- while (result && remainingComparators.length) {
1325
- result = remainingComparators.every(function(otherComparator) {
1326
- return testComparator.intersects(otherComparator, options);
1327
- });
1328
- testComparator = remainingComparators.pop();
1329
- }
1330
- return result;
1331
- }
1332
- __name(isSatisfiable, "isSatisfiable");
1333
- exports.toComparators = toComparators;
1334
- function toComparators(range, options) {
1335
- return new Range(range, options).set.map(function(comp) {
1336
- return comp.map(function(c) {
1337
- return c.value;
1338
- }).join(" ").trim().split(" ");
1339
- });
1340
- }
1341
- __name(toComparators, "toComparators");
1342
- function parseComparator(comp, options) {
1343
- debug("comp", comp, options);
1344
- comp = replaceCarets(comp, options);
1345
- debug("caret", comp);
1346
- comp = replaceTildes(comp, options);
1347
- debug("tildes", comp);
1348
- comp = replaceXRanges(comp, options);
1349
- debug("xrange", comp);
1350
- comp = replaceStars(comp, options);
1351
- debug("stars", comp);
1352
- return comp;
1353
- }
1354
- __name(parseComparator, "parseComparator");
1355
- function isX(id) {
1356
- return !id || id.toLowerCase() === "x" || id === "*";
1357
- }
1358
- __name(isX, "isX");
1359
- function replaceTildes(comp, options) {
1360
- return comp.trim().split(/\s+/).map(function(comp2) {
1361
- return replaceTilde(comp2, options);
1362
- }).join(" ");
1363
- }
1364
- __name(replaceTildes, "replaceTildes");
1365
- function replaceTilde(comp, options) {
1366
- var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE];
1367
- return comp.replace(r, function(_, M, m, p, pr) {
1368
- debug("tilde", comp, _, M, m, p, pr);
1369
- var ret;
1370
- if (isX(M)) {
1371
- ret = "";
1372
- } else if (isX(m)) {
1373
- ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
1374
- } else if (isX(p)) {
1375
- ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
1376
- } else if (pr) {
1377
- debug("replaceTilde pr", pr);
1378
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
1379
- } else {
1380
- ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
1381
- }
1382
- debug("tilde return", ret);
1383
- return ret;
1384
- });
1385
- }
1386
- __name(replaceTilde, "replaceTilde");
1387
- function replaceCarets(comp, options) {
1388
- return comp.trim().split(/\s+/).map(function(comp2) {
1389
- return replaceCaret(comp2, options);
1390
- }).join(" ");
1391
- }
1392
- __name(replaceCarets, "replaceCarets");
1393
- function replaceCaret(comp, options) {
1394
- debug("caret", comp, options);
1395
- var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET];
1396
- return comp.replace(r, function(_, M, m, p, pr) {
1397
- debug("caret", comp, _, M, m, p, pr);
1398
- var ret;
1399
- if (isX(M)) {
1400
- ret = "";
1401
- } else if (isX(m)) {
1402
- ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
1403
- } else if (isX(p)) {
1404
- if (M === "0") {
1405
- ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
1406
- } else {
1407
- ret = ">=" + M + "." + m + ".0 <" + (+M + 1) + ".0.0";
1408
- }
1409
- } else if (pr) {
1410
- debug("replaceCaret pr", pr);
1411
- if (M === "0") {
1412
- if (m === "0") {
1413
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + m + "." + (+p + 1);
1414
- } else {
1415
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
1416
- }
1417
- } else {
1418
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + (+M + 1) + ".0.0";
1419
- }
1420
- } else {
1421
- debug("no pr");
1422
- if (M === "0") {
1423
- if (m === "0") {
1424
- ret = ">=" + M + "." + m + "." + p + " <" + M + "." + m + "." + (+p + 1);
1425
- } else {
1426
- ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
1427
- }
1428
- } else {
1429
- ret = ">=" + M + "." + m + "." + p + " <" + (+M + 1) + ".0.0";
1430
- }
1431
- }
1432
- debug("caret return", ret);
1433
- return ret;
1434
- });
1435
- }
1436
- __name(replaceCaret, "replaceCaret");
1437
- function replaceXRanges(comp, options) {
1438
- debug("replaceXRanges", comp, options);
1439
- return comp.split(/\s+/).map(function(comp2) {
1440
- return replaceXRange(comp2, options);
1441
- }).join(" ");
1442
- }
1443
- __name(replaceXRanges, "replaceXRanges");
1444
- function replaceXRange(comp, options) {
1445
- comp = comp.trim();
1446
- var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE];
1447
- return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
1448
- debug("xRange", comp, ret, gtlt, M, m, p, pr);
1449
- var xM = isX(M);
1450
- var xm = xM || isX(m);
1451
- var xp = xm || isX(p);
1452
- var anyX = xp;
1453
- if (gtlt === "=" && anyX) {
1454
- gtlt = "";
1455
- }
1456
- pr = options.includePrerelease ? "-0" : "";
1457
- if (xM) {
1458
- if (gtlt === ">" || gtlt === "<") {
1459
- ret = "<0.0.0-0";
1460
- } else {
1461
- ret = "*";
1462
- }
1463
- } else if (gtlt && anyX) {
1464
- if (xm) {
1465
- m = 0;
1466
- }
1467
- p = 0;
1468
- if (gtlt === ">") {
1469
- gtlt = ">=";
1470
- if (xm) {
1471
- M = +M + 1;
1472
- m = 0;
1473
- p = 0;
1474
- } else {
1475
- m = +m + 1;
1476
- p = 0;
1477
- }
1478
- } else if (gtlt === "<=") {
1479
- gtlt = "<";
1480
- if (xm) {
1481
- M = +M + 1;
1482
- } else {
1483
- m = +m + 1;
1484
- }
1485
- }
1486
- ret = gtlt + M + "." + m + "." + p + pr;
1487
- } else if (xm) {
1488
- ret = ">=" + M + ".0.0" + pr + " <" + (+M + 1) + ".0.0" + pr;
1489
- } else if (xp) {
1490
- ret = ">=" + M + "." + m + ".0" + pr + " <" + M + "." + (+m + 1) + ".0" + pr;
1491
- }
1492
- debug("xRange return", ret);
1493
- return ret;
1494
- });
1495
- }
1496
- __name(replaceXRange, "replaceXRange");
1497
- function replaceStars(comp, options) {
1498
- debug("replaceStars", comp, options);
1499
- return comp.trim().replace(safeRe[t.STAR], "");
1500
- }
1501
- __name(replaceStars, "replaceStars");
1502
- function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
1503
- if (isX(fM)) {
1504
- from = "";
1505
- } else if (isX(fm)) {
1506
- from = ">=" + fM + ".0.0";
1507
- } else if (isX(fp)) {
1508
- from = ">=" + fM + "." + fm + ".0";
1509
- } else {
1510
- from = ">=" + from;
1511
- }
1512
- if (isX(tM)) {
1513
- to = "";
1514
- } else if (isX(tm)) {
1515
- to = "<" + (+tM + 1) + ".0.0";
1516
- } else if (isX(tp)) {
1517
- to = "<" + tM + "." + (+tm + 1) + ".0";
1518
- } else if (tpr) {
1519
- to = "<=" + tM + "." + tm + "." + tp + "-" + tpr;
1520
- } else {
1521
- to = "<=" + to;
1522
- }
1523
- return (from + " " + to).trim();
1524
- }
1525
- __name(hyphenReplace, "hyphenReplace");
1526
- Range.prototype.test = function(version) {
1527
- if (!version) {
1528
- return false;
1529
- }
1530
- if (typeof version === "string") {
1531
- try {
1532
- version = new SemVer(version, this.options);
1533
- } catch (er) {
1534
- return false;
1535
- }
1536
- }
1537
- for (var i2 = 0; i2 < this.set.length; i2++) {
1538
- if (testSet(this.set[i2], version, this.options)) {
1539
- return true;
1540
- }
1541
- }
1542
- return false;
1543
- };
1544
- function testSet(set, version, options) {
1545
- for (var i2 = 0; i2 < set.length; i2++) {
1546
- if (!set[i2].test(version)) {
1547
- return false;
1548
- }
1549
- }
1550
- if (version.prerelease.length && !options.includePrerelease) {
1551
- for (i2 = 0; i2 < set.length; i2++) {
1552
- debug(set[i2].semver);
1553
- if (set[i2].semver === ANY) {
1554
- continue;
1555
- }
1556
- if (set[i2].semver.prerelease.length > 0) {
1557
- var allowed = set[i2].semver;
1558
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
1559
- return true;
1560
- }
1561
- }
1562
- }
1563
- return false;
1564
- }
1565
- return true;
1566
- }
1567
- __name(testSet, "testSet");
1568
- exports.satisfies = satisfies;
1569
- function satisfies(version, range, options) {
1570
- try {
1571
- range = new Range(range, options);
1572
- } catch (er) {
1573
- return false;
1574
- }
1575
- return range.test(version);
1576
- }
1577
- __name(satisfies, "satisfies");
1578
- exports.maxSatisfying = maxSatisfying;
1579
- function maxSatisfying(versions, range, options) {
1580
- var max = null;
1581
- var maxSV = null;
1582
- try {
1583
- var rangeObj = new Range(range, options);
1584
- } catch (er) {
1585
- return null;
1586
- }
1587
- versions.forEach(function(v) {
1588
- if (rangeObj.test(v)) {
1589
- if (!max || maxSV.compare(v) === -1) {
1590
- max = v;
1591
- maxSV = new SemVer(max, options);
1592
- }
1593
- }
1594
- });
1595
- return max;
1596
- }
1597
- __name(maxSatisfying, "maxSatisfying");
1598
- exports.minSatisfying = minSatisfying;
1599
- function minSatisfying(versions, range, options) {
1600
- var min = null;
1601
- var minSV = null;
1602
- try {
1603
- var rangeObj = new Range(range, options);
1604
- } catch (er) {
1605
- return null;
1606
- }
1607
- versions.forEach(function(v) {
1608
- if (rangeObj.test(v)) {
1609
- if (!min || minSV.compare(v) === 1) {
1610
- min = v;
1611
- minSV = new SemVer(min, options);
1612
- }
1613
- }
1614
- });
1615
- return min;
1616
- }
1617
- __name(minSatisfying, "minSatisfying");
1618
- exports.minVersion = minVersion;
1619
- function minVersion(range, loose) {
1620
- range = new Range(range, loose);
1621
- var minver = new SemVer("0.0.0");
1622
- if (range.test(minver)) {
1623
- return minver;
1624
- }
1625
- minver = new SemVer("0.0.0-0");
1626
- if (range.test(minver)) {
1627
- return minver;
1628
- }
1629
- minver = null;
1630
- for (var i2 = 0; i2 < range.set.length; ++i2) {
1631
- var comparators = range.set[i2];
1632
- comparators.forEach(function(comparator) {
1633
- var compver = new SemVer(comparator.semver.version);
1634
- switch (comparator.operator) {
1635
- case ">":
1636
- if (compver.prerelease.length === 0) {
1637
- compver.patch++;
1638
- } else {
1639
- compver.prerelease.push(0);
1640
- }
1641
- compver.raw = compver.format();
1642
- /* fallthrough */
1643
- case "":
1644
- case ">=":
1645
- if (!minver || gt(minver, compver)) {
1646
- minver = compver;
1647
- }
1648
- break;
1649
- case "<":
1650
- case "<=":
1651
- break;
1652
- /* istanbul ignore next */
1653
- default:
1654
- throw new Error("Unexpected operation: " + comparator.operator);
1655
- }
1656
- });
1657
- }
1658
- if (minver && range.test(minver)) {
1659
- return minver;
1660
- }
1661
- return null;
1662
- }
1663
- __name(minVersion, "minVersion");
1664
- exports.validRange = validRange;
1665
- function validRange(range, options) {
1666
- try {
1667
- return new Range(range, options).range || "*";
1668
- } catch (er) {
1669
- return null;
1670
- }
1671
- }
1672
- __name(validRange, "validRange");
1673
- exports.ltr = ltr;
1674
- function ltr(version, range, options) {
1675
- return outside(version, range, "<", options);
1676
- }
1677
- __name(ltr, "ltr");
1678
- exports.gtr = gtr;
1679
- function gtr(version, range, options) {
1680
- return outside(version, range, ">", options);
1681
- }
1682
- __name(gtr, "gtr");
1683
- exports.outside = outside;
1684
- function outside(version, range, hilo, options) {
1685
- version = new SemVer(version, options);
1686
- range = new Range(range, options);
1687
- var gtfn, ltefn, ltfn, comp, ecomp;
1688
- switch (hilo) {
1689
- case ">":
1690
- gtfn = gt;
1691
- ltefn = lte;
1692
- ltfn = lt;
1693
- comp = ">";
1694
- ecomp = ">=";
1695
- break;
1696
- case "<":
1697
- gtfn = lt;
1698
- ltefn = gte;
1699
- ltfn = gt;
1700
- comp = "<";
1701
- ecomp = "<=";
1702
- break;
1703
- default:
1704
- throw new TypeError('Must provide a hilo val of "<" or ">"');
1705
- }
1706
- if (satisfies(version, range, options)) {
1707
- return false;
1708
- }
1709
- for (var i2 = 0; i2 < range.set.length; ++i2) {
1710
- var comparators = range.set[i2];
1711
- var high = null;
1712
- var low = null;
1713
- comparators.forEach(function(comparator) {
1714
- if (comparator.semver === ANY) {
1715
- comparator = new Comparator(">=0.0.0");
1716
- }
1717
- high = high || comparator;
1718
- low = low || comparator;
1719
- if (gtfn(comparator.semver, high.semver, options)) {
1720
- high = comparator;
1721
- } else if (ltfn(comparator.semver, low.semver, options)) {
1722
- low = comparator;
1723
- }
1724
- });
1725
- if (high.operator === comp || high.operator === ecomp) {
1726
- return false;
1727
- }
1728
- if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
1729
- return false;
1730
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
1731
- return false;
1732
- }
1733
- }
1734
- return true;
1735
- }
1736
- __name(outside, "outside");
1737
- exports.prerelease = prerelease;
1738
- function prerelease(version, options) {
1739
- var parsed = parse3(version, options);
1740
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
1741
- }
1742
- __name(prerelease, "prerelease");
1743
- exports.intersects = intersects;
1744
- function intersects(r1, r2, options) {
1745
- r1 = new Range(r1, options);
1746
- r2 = new Range(r2, options);
1747
- return r1.intersects(r2);
1748
- }
1749
- __name(intersects, "intersects");
1750
- exports.coerce = coerce;
1751
- function coerce(version, options) {
1752
- if (version instanceof SemVer) {
1753
- return version;
1754
- }
1755
- if (typeof version === "number") {
1756
- version = String(version);
1757
- }
1758
- if (typeof version !== "string") {
1759
- return null;
1760
- }
1761
- options = options || {};
1762
- var match2 = null;
1763
- if (!options.rtl) {
1764
- match2 = version.match(safeRe[t.COERCE]);
1765
- } else {
1766
- var next;
1767
- while ((next = safeRe[t.COERCERTL].exec(version)) && (!match2 || match2.index + match2[0].length !== version.length)) {
1768
- if (!match2 || next.index + next[0].length !== match2.index + match2[0].length) {
1769
- match2 = next;
1770
- }
1771
- safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
1772
- }
1773
- safeRe[t.COERCERTL].lastIndex = -1;
1774
- }
1775
- if (match2 === null) {
1776
- return null;
1777
- }
1778
- return parse3(match2[2] + "." + (match2[3] || "0") + "." + (match2[4] || "0"), options);
1779
- }
1780
- __name(coerce, "coerce");
1781
- }
1782
- });
1783
-
1784
- // ../../node_modules/find-cache-dir/node_modules/make-dir/index.js
1785
- var require_make_dir = __commonJS({
1786
- "../../node_modules/find-cache-dir/node_modules/make-dir/index.js"(exports, module) {
1787
- "use strict";
1788
- var fs = __require("fs");
1789
- var path3 = __require("path");
1790
- var { promisify } = __require("util");
1791
- var semver = require_semver();
1792
- var useNativeRecursiveOption = semver.satisfies(process.version, ">=10.12.0");
1793
- var checkPath = /* @__PURE__ */ __name((pth) => {
1794
- if (process.platform === "win32") {
1795
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path3.parse(pth).root, ""));
1796
- if (pathHasInvalidWinCharacters) {
1797
- const error = new Error(`Path contains invalid characters: ${pth}`);
1798
- error.code = "EINVAL";
1799
- throw error;
1800
- }
1801
- }
1802
- }, "checkPath");
1803
- var processOptions = /* @__PURE__ */ __name((options) => {
1804
- const defaults2 = {
1805
- mode: 511,
1806
- fs
1807
- };
1808
- return {
1809
- ...defaults2,
1810
- ...options
1811
- };
1812
- }, "processOptions");
1813
- var permissionError = /* @__PURE__ */ __name((pth) => {
1814
- const error = new Error(`operation not permitted, mkdir '${pth}'`);
1815
- error.code = "EPERM";
1816
- error.errno = -4048;
1817
- error.path = pth;
1818
- error.syscall = "mkdir";
1819
- return error;
1820
- }, "permissionError");
1821
- var makeDir = /* @__PURE__ */ __name(async (input, options) => {
1822
- checkPath(input);
1823
- options = processOptions(options);
1824
- const mkdir2 = promisify(options.fs.mkdir);
1825
- const stat = promisify(options.fs.stat);
1826
- if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
1827
- const pth = path3.resolve(input);
1828
- await mkdir2(pth, {
1829
- mode: options.mode,
1830
- recursive: true
1831
- });
1832
- return pth;
1833
- }
1834
- const make = /* @__PURE__ */ __name(async (pth) => {
1835
- try {
1836
- await mkdir2(pth, options.mode);
1837
- return pth;
1838
- } catch (error) {
1839
- if (error.code === "EPERM") {
1840
- throw error;
1841
- }
1842
- if (error.code === "ENOENT") {
1843
- if (path3.dirname(pth) === pth) {
1844
- throw permissionError(pth);
1845
- }
1846
- if (error.message.includes("null bytes")) {
1847
- throw error;
1848
- }
1849
- await make(path3.dirname(pth));
1850
- return make(pth);
1851
- }
1852
- try {
1853
- const stats = await stat(pth);
1854
- if (!stats.isDirectory()) {
1855
- throw new Error("The path is not a directory");
1856
- }
1857
- } catch (_) {
1858
- throw error;
1859
- }
1860
- return pth;
1861
- }
1862
- }, "make");
1863
- return make(path3.resolve(input));
1864
- }, "makeDir");
1865
- module.exports = makeDir;
1866
- module.exports.sync = (input, options) => {
1867
- checkPath(input);
1868
- options = processOptions(options);
1869
- if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
1870
- const pth = path3.resolve(input);
1871
- fs.mkdirSync(pth, {
1872
- mode: options.mode,
1873
- recursive: true
1874
- });
1875
- return pth;
1876
- }
1877
- const make = /* @__PURE__ */ __name((pth) => {
1878
- try {
1879
- options.fs.mkdirSync(pth, options.mode);
1880
- } catch (error) {
1881
- if (error.code === "EPERM") {
1882
- throw error;
1883
- }
1884
- if (error.code === "ENOENT") {
1885
- if (path3.dirname(pth) === pth) {
1886
- throw permissionError(pth);
1887
- }
1888
- if (error.message.includes("null bytes")) {
1889
- throw error;
1890
- }
1891
- make(path3.dirname(pth));
1892
- return make(pth);
1893
- }
1894
- try {
1895
- if (!options.fs.statSync(pth).isDirectory()) {
1896
- throw new Error("The path is not a directory");
1897
- }
1898
- } catch (_) {
1899
- throw error;
1900
- }
1901
- }
1902
- return pth;
1903
- }, "make");
1904
- return make(path3.resolve(input));
1905
- };
1906
- }
1907
- });
1908
-
1909
- // ../../node_modules/find-cache-dir/index.js
1910
- var require_find_cache_dir = __commonJS({
1911
- "../../node_modules/find-cache-dir/index.js"(exports, module) {
1912
- "use strict";
1913
- var path3 = __require("path");
1914
- var fs = __require("fs");
1915
- var commonDir = require_commondir();
1916
- var pkgDir = require_pkg_dir();
1917
- var makeDir = require_make_dir();
1918
- var { env, cwd: cwd2 } = process;
1919
- var isWritable2 = /* @__PURE__ */ __name((path4) => {
1920
- try {
1921
- fs.accessSync(path4, fs.constants.W_OK);
1922
- return true;
1923
- } catch (_) {
1924
- return false;
1925
- }
1926
- }, "isWritable");
1927
- function useDirectory(directory, options) {
1928
- if (options.create) {
1929
- makeDir.sync(directory);
1930
- }
1931
- if (options.thunk) {
1932
- return (...arguments_) => path3.join(directory, ...arguments_);
1933
- }
1934
- return directory;
1935
- }
1936
- __name(useDirectory, "useDirectory");
1937
- function getNodeModuleDirectory(directory) {
1938
- const nodeModules = path3.join(directory, "node_modules");
1939
- if (!isWritable2(nodeModules) && (fs.existsSync(nodeModules) || !isWritable2(path3.join(directory)))) {
1940
- return;
1941
- }
1942
- return nodeModules;
1943
- }
1944
- __name(getNodeModuleDirectory, "getNodeModuleDirectory");
1945
- module.exports = (options = {}) => {
1946
- if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) {
1947
- return useDirectory(path3.join(env.CACHE_DIR, options.name), options);
1948
- }
1949
- let { cwd: directory = cwd2() } = options;
1950
- if (options.files) {
1951
- directory = commonDir(directory, options.files);
1952
- }
1953
- directory = pkgDir.sync(directory);
1954
- if (!directory) {
1955
- return;
1956
- }
1957
- const nodeModules = getNodeModuleDirectory(directory);
1958
- if (!nodeModules) {
1959
- return void 0;
1960
- }
1961
- return useDirectory(path3.join(directory, "node_modules", ".cache", options.name), options);
1962
- };
1963
- }
1964
- });
1965
-
1966
260
  // src/index.ts
1967
261
  import { readFile } from "node:fs/promises";
1968
262
  import { fileURLToPath as fileURLToPath5 } from "node:url";
@@ -2049,7 +343,7 @@ var withoutVitePlugins = /* @__PURE__ */ __name(async (plugins = [], namesToRemo
2049
343
  }, "withoutVitePlugins");
2050
344
 
2051
345
  // src/vite-config.ts
2052
- import { resolve as resolve2 } from "node:path";
346
+ import { resolve as resolve3 } from "node:path";
2053
347
  import {
2054
348
  getBuilderOptions,
2055
349
  isPreservingSymlinks,
@@ -2130,8 +424,7 @@ function encodeInteger(builder, num, relative4) {
2130
424
  do {
2131
425
  let clamped = delta & 31;
2132
426
  delta >>>= 5;
2133
- if (delta > 0)
2134
- clamped |= 32;
427
+ if (delta > 0) clamped |= 32;
2135
428
  builder.write(intToChar[clamped]);
2136
429
  } while (delta > 0);
2137
430
  return num;
@@ -2182,23 +475,18 @@ function encode(decoded) {
2182
475
  let namesIndex = 0;
2183
476
  for (let i = 0; i < decoded.length; i++) {
2184
477
  const line = decoded[i];
2185
- if (i > 0)
2186
- writer.write(semicolon);
2187
- if (line.length === 0)
2188
- continue;
478
+ if (i > 0) writer.write(semicolon);
479
+ if (line.length === 0) continue;
2189
480
  let genColumn = 0;
2190
481
  for (let j = 0; j < line.length; j++) {
2191
482
  const segment = line[j];
2192
- if (j > 0)
2193
- writer.write(comma);
483
+ if (j > 0) writer.write(comma);
2194
484
  genColumn = encodeInteger(writer, segment[0], genColumn);
2195
- if (segment.length === 1)
2196
- continue;
485
+ if (segment.length === 1) continue;
2197
486
  sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
2198
487
  sourceLine = encodeInteger(writer, segment[2], sourceLine);
2199
488
  sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
2200
- if (segment.length === 4)
2201
- continue;
489
+ if (segment.length === 4) continue;
2202
490
  namesIndex = encodeInteger(writer, segment[4], namesIndex);
2203
491
  }
2204
492
  }
@@ -2663,6 +951,9 @@ var MagicString = class _MagicString {
2663
951
  }
2664
952
  if (chunk.outro.length) mappings.advance(chunk.outro);
2665
953
  });
954
+ if (this.outro) {
955
+ mappings.advance(this.outro);
956
+ }
2666
957
  return {
2667
958
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
2668
959
  sources: [
@@ -3020,10 +1311,13 @@ var MagicString = class _MagicString {
3020
1311
  _split(index) {
3021
1312
  if (this.byStart[index] || this.byEnd[index]) return;
3022
1313
  let chunk = this.lastSearchedChunk;
1314
+ let previousChunk = chunk;
3023
1315
  const searchForward = index > chunk.end;
3024
1316
  while (chunk) {
3025
1317
  if (chunk.contains(index)) return this._splitChunk(chunk, index);
3026
1318
  chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
1319
+ if (chunk === previousChunk) return;
1320
+ previousChunk = chunk;
3027
1321
  }
3028
1322
  }
3029
1323
  _splitChunk(chunk, index) {
@@ -3172,7 +1466,12 @@ var MagicString = class _MagicString {
3172
1466
  const { original } = this;
3173
1467
  const index = original.indexOf(string);
3174
1468
  if (index !== -1) {
3175
- this.overwrite(index, index + string.length, replacement);
1469
+ if (typeof replacement === "function") {
1470
+ replacement = replacement(string, index, original);
1471
+ }
1472
+ if (string !== replacement) {
1473
+ this.overwrite(index, index + string.length, replacement);
1474
+ }
3176
1475
  }
3177
1476
  return this;
3178
1477
  }
@@ -3187,7 +1486,11 @@ var MagicString = class _MagicString {
3187
1486
  const stringLength = string.length;
3188
1487
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
3189
1488
  const previous = original.slice(index, index + stringLength);
3190
- if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
1489
+ let _replacement = replacement;
1490
+ if (typeof replacement === "function") {
1491
+ _replacement = replacement(previous, index, original);
1492
+ }
1493
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
3191
1494
  }
3192
1495
  return this;
3193
1496
  }
@@ -3263,6 +1566,314 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
3263
1566
  // ../../core/src/shared/utils/module.ts
3264
1567
  import { fileURLToPath, pathToFileURL } from "node:url";
3265
1568
 
1569
+ // ../../node_modules/exsolve/dist/index.mjs
1570
+ import assert from "node:assert";
1571
+ import v8 from "node:v8";
1572
+ import { format, inspect } from "node:util";
1573
+ var own$1 = {}.hasOwnProperty;
1574
+ var classRegExp = /^([A-Z][a-z\d]*)+$/;
1575
+ var kTypes = /* @__PURE__ */ new Set([
1576
+ "string",
1577
+ "function",
1578
+ "number",
1579
+ "object",
1580
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
1581
+ "Function",
1582
+ "Object",
1583
+ "boolean",
1584
+ "bigint",
1585
+ "symbol"
1586
+ ]);
1587
+ var messages = /* @__PURE__ */ new Map();
1588
+ var nodeInternalPrefix = "__node_internal_";
1589
+ var userStackTraceLimit;
1590
+ function formatList(array, type = "and") {
1591
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
1592
+ }
1593
+ __name(formatList, "formatList");
1594
+ function createError(sym, value, constructor) {
1595
+ messages.set(sym, value);
1596
+ return makeNodeErrorWithCode(constructor, sym);
1597
+ }
1598
+ __name(createError, "createError");
1599
+ function makeNodeErrorWithCode(Base, key) {
1600
+ return /* @__PURE__ */ __name(function NodeError(...parameters) {
1601
+ const limit = Error.stackTraceLimit;
1602
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
1603
+ const error = new Base();
1604
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
1605
+ const message = getMessage(key, parameters, error);
1606
+ Object.defineProperties(error, {
1607
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
1608
+ // probably.
1609
+ message: {
1610
+ value: message,
1611
+ enumerable: false,
1612
+ writable: true,
1613
+ configurable: true
1614
+ },
1615
+ toString: {
1616
+ /** @this {Error} */
1617
+ value() {
1618
+ return `${this.name} [${key}]: ${this.message}`;
1619
+ },
1620
+ enumerable: false,
1621
+ writable: true,
1622
+ configurable: true
1623
+ }
1624
+ });
1625
+ captureLargerStackTrace(error);
1626
+ error.code = key;
1627
+ return error;
1628
+ }, "NodeError");
1629
+ }
1630
+ __name(makeNodeErrorWithCode, "makeNodeErrorWithCode");
1631
+ function isErrorStackTraceLimitWritable() {
1632
+ try {
1633
+ if (v8.startupSnapshot.isBuildingSnapshot()) {
1634
+ return false;
1635
+ }
1636
+ } catch {
1637
+ }
1638
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
1639
+ if (desc === void 0) {
1640
+ return Object.isExtensible(Error);
1641
+ }
1642
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
1643
+ }
1644
+ __name(isErrorStackTraceLimitWritable, "isErrorStackTraceLimitWritable");
1645
+ function hideStackFrames(wrappedFunction) {
1646
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
1647
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
1648
+ return wrappedFunction;
1649
+ }
1650
+ __name(hideStackFrames, "hideStackFrames");
1651
+ var captureLargerStackTrace = hideStackFrames(function(error) {
1652
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
1653
+ if (stackTraceLimitIsWritable) {
1654
+ userStackTraceLimit = Error.stackTraceLimit;
1655
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
1656
+ }
1657
+ Error.captureStackTrace(error);
1658
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
1659
+ return error;
1660
+ });
1661
+ function getMessage(key, parameters, self) {
1662
+ const message = messages.get(key);
1663
+ assert(message !== void 0, "expected `message` to be found");
1664
+ if (typeof message === "function") {
1665
+ assert(
1666
+ message.length <= parameters.length,
1667
+ // Default options do not count.
1668
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
1669
+ );
1670
+ return Reflect.apply(message, self, parameters);
1671
+ }
1672
+ const regex = /%[dfijoOs]/g;
1673
+ let expectedLength = 0;
1674
+ while (regex.exec(message) !== null) expectedLength++;
1675
+ assert(
1676
+ expectedLength === parameters.length,
1677
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
1678
+ );
1679
+ if (parameters.length === 0) return message;
1680
+ parameters.unshift(message);
1681
+ return Reflect.apply(format, null, parameters);
1682
+ }
1683
+ __name(getMessage, "getMessage");
1684
+ function determineSpecificType(value) {
1685
+ if (value === null || value === void 0) {
1686
+ return String(value);
1687
+ }
1688
+ if (typeof value === "function" && value.name) {
1689
+ return `function ${value.name}`;
1690
+ }
1691
+ if (typeof value === "object") {
1692
+ if (value.constructor && value.constructor.name) {
1693
+ return `an instance of ${value.constructor.name}`;
1694
+ }
1695
+ return `${inspect(value, { depth: -1 })}`;
1696
+ }
1697
+ let inspected = inspect(value, { colors: false });
1698
+ if (inspected.length > 28) {
1699
+ inspected = `${inspected.slice(0, 25)}...`;
1700
+ }
1701
+ return `type ${typeof value} (${inspected})`;
1702
+ }
1703
+ __name(determineSpecificType, "determineSpecificType");
1704
+ createError(
1705
+ "ERR_INVALID_ARG_TYPE",
1706
+ (name, expected, actual) => {
1707
+ assert(typeof name === "string", "'name' must be a string");
1708
+ if (!Array.isArray(expected)) {
1709
+ expected = [expected];
1710
+ }
1711
+ let message = "The ";
1712
+ if (name.endsWith(" argument")) {
1713
+ message += `${name} `;
1714
+ } else {
1715
+ const type = name.includes(".") ? "property" : "argument";
1716
+ message += `"${name}" ${type} `;
1717
+ }
1718
+ message += "must be ";
1719
+ const types2 = [];
1720
+ const instances = [];
1721
+ const other = [];
1722
+ for (const value of expected) {
1723
+ assert(
1724
+ typeof value === "string",
1725
+ "All expected entries have to be of type string"
1726
+ );
1727
+ if (kTypes.has(value)) {
1728
+ types2.push(value.toLowerCase());
1729
+ } else if (classRegExp.exec(value) === null) {
1730
+ assert(
1731
+ value !== "object",
1732
+ 'The value "object" should be written as "Object"'
1733
+ );
1734
+ other.push(value);
1735
+ } else {
1736
+ instances.push(value);
1737
+ }
1738
+ }
1739
+ if (instances.length > 0) {
1740
+ const pos = types2.indexOf("object");
1741
+ if (pos !== -1) {
1742
+ types2.slice(pos, 1);
1743
+ instances.push("Object");
1744
+ }
1745
+ }
1746
+ if (types2.length > 0) {
1747
+ message += `${types2.length > 1 ? "one of type" : "of type"} ${formatList(
1748
+ types2,
1749
+ "or"
1750
+ )}`;
1751
+ if (instances.length > 0 || other.length > 0) message += " or ";
1752
+ }
1753
+ if (instances.length > 0) {
1754
+ message += `an instance of ${formatList(instances, "or")}`;
1755
+ if (other.length > 0) message += " or ";
1756
+ }
1757
+ if (other.length > 0) {
1758
+ if (other.length > 1) {
1759
+ message += `one of ${formatList(other, "or")}`;
1760
+ } else {
1761
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
1762
+ message += `${other[0]}`;
1763
+ }
1764
+ }
1765
+ message += `. Received ${determineSpecificType(actual)}`;
1766
+ return message;
1767
+ },
1768
+ TypeError
1769
+ );
1770
+ var ERR_INVALID_MODULE_SPECIFIER = createError(
1771
+ "ERR_INVALID_MODULE_SPECIFIER",
1772
+ /**
1773
+ * @param {string} request
1774
+ * @param {string} reason
1775
+ * @param {string} [base]
1776
+ */
1777
+ (request, reason, base) => {
1778
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
1779
+ },
1780
+ TypeError
1781
+ );
1782
+ var ERR_INVALID_PACKAGE_CONFIG = createError(
1783
+ "ERR_INVALID_PACKAGE_CONFIG",
1784
+ (path3, base, message) => {
1785
+ return `Invalid package config ${path3}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
1786
+ },
1787
+ Error
1788
+ );
1789
+ var ERR_INVALID_PACKAGE_TARGET = createError(
1790
+ "ERR_INVALID_PACKAGE_TARGET",
1791
+ (packagePath, key, target, isImport = false, base) => {
1792
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
1793
+ if (key === ".") {
1794
+ assert(isImport === false);
1795
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
1796
+ }
1797
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
1798
+ target
1799
+ )} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
1800
+ },
1801
+ Error
1802
+ );
1803
+ var ERR_MODULE_NOT_FOUND = createError(
1804
+ "ERR_MODULE_NOT_FOUND",
1805
+ (path3, base, exactUrl = false) => {
1806
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path3}' imported from ${base}`;
1807
+ },
1808
+ Error
1809
+ );
1810
+ createError(
1811
+ "ERR_NETWORK_IMPORT_DISALLOWED",
1812
+ "import of '%s' by %s is not supported: %s",
1813
+ Error
1814
+ );
1815
+ var ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
1816
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
1817
+ (specifier, packagePath, base) => {
1818
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
1819
+ },
1820
+ TypeError
1821
+ );
1822
+ var ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
1823
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
1824
+ /**
1825
+ * @param {string} packagePath
1826
+ * @param {string} subpath
1827
+ * @param {string} [base]
1828
+ */
1829
+ (packagePath, subpath, base) => {
1830
+ if (subpath === ".")
1831
+ return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
1832
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
1833
+ },
1834
+ Error
1835
+ );
1836
+ var ERR_UNSUPPORTED_DIR_IMPORT = createError(
1837
+ "ERR_UNSUPPORTED_DIR_IMPORT",
1838
+ "Directory import '%s' is not supported resolving ES modules imported from %s",
1839
+ Error
1840
+ );
1841
+ var ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
1842
+ "ERR_UNSUPPORTED_RESOLVE_REQUEST",
1843
+ 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
1844
+ TypeError
1845
+ );
1846
+ var ERR_UNKNOWN_FILE_EXTENSION = createError(
1847
+ "ERR_UNKNOWN_FILE_EXTENSION",
1848
+ (extension, path3) => {
1849
+ return `Unknown file extension "${extension}" for ${path3}`;
1850
+ },
1851
+ TypeError
1852
+ );
1853
+ createError(
1854
+ "ERR_INVALID_ARG_VALUE",
1855
+ (name, value, reason = "is invalid") => {
1856
+ let inspected = inspect(value);
1857
+ if (inspected.length > 128) {
1858
+ inspected = `${inspected.slice(0, 128)}...`;
1859
+ }
1860
+ const type = name.includes(".") ? "property" : "argument";
1861
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
1862
+ },
1863
+ TypeError
1864
+ // Note: extra classes have been shaken out.
1865
+ // , RangeError
1866
+ );
1867
+ var hasOwnProperty$1 = {}.hasOwnProperty;
1868
+ var hasOwnProperty = {}.hasOwnProperty;
1869
+ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
1870
+ var own = {}.hasOwnProperty;
1871
+ var isWindows = (() => process.platform === "win32")();
1872
+ var globalCache = (() => (
1873
+ // eslint-disable-next-line unicorn/no-unreadable-iife
1874
+ globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map()
1875
+ ))();
1876
+
3266
1877
  // ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
3267
1878
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
3268
1879
  function normalizeWindowsPath(input = "") {
@@ -7107,10 +5718,10 @@ var Minipass = class extends EventEmitter {
7107
5718
  * Return a void Promise that resolves once the stream ends.
7108
5719
  */
7109
5720
  async promise() {
7110
- return new Promise((resolve3, reject) => {
5721
+ return new Promise((resolve4, reject) => {
7111
5722
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
7112
5723
  this.on("error", (er) => reject(er));
7113
- this.on("end", () => resolve3());
5724
+ this.on("end", () => resolve4());
7114
5725
  });
7115
5726
  }
7116
5727
  /**
@@ -7134,7 +5745,7 @@ var Minipass = class extends EventEmitter {
7134
5745
  return Promise.resolve({ done: false, value: res });
7135
5746
  if (this[EOF])
7136
5747
  return stop();
7137
- let resolve3;
5748
+ let resolve4;
7138
5749
  let reject;
7139
5750
  const onerr = /* @__PURE__ */ __name((er) => {
7140
5751
  this.off("data", ondata);
@@ -7148,19 +5759,19 @@ var Minipass = class extends EventEmitter {
7148
5759
  this.off("end", onend);
7149
5760
  this.off(DESTROYED, ondestroy);
7150
5761
  this.pause();
7151
- resolve3({ value, done: !!this[EOF] });
5762
+ resolve4({ value, done: !!this[EOF] });
7152
5763
  }, "ondata");
7153
5764
  const onend = /* @__PURE__ */ __name(() => {
7154
5765
  this.off("error", onerr);
7155
5766
  this.off("data", ondata);
7156
5767
  this.off(DESTROYED, ondestroy);
7157
5768
  stop();
7158
- resolve3({ done: true, value: void 0 });
5769
+ resolve4({ done: true, value: void 0 });
7159
5770
  }, "onend");
7160
5771
  const ondestroy = /* @__PURE__ */ __name(() => onerr(new Error("stream destroyed")), "ondestroy");
7161
5772
  return new Promise((res2, rej) => {
7162
5773
  reject = rej;
7163
- resolve3 = res2;
5774
+ resolve4 = res2;
7164
5775
  this.once(DESTROYED, ondestroy);
7165
5776
  this.once("error", onerr);
7166
5777
  this.once("end", onend);
@@ -8137,9 +6748,9 @@ var PathBase = class {
8137
6748
  if (this.#asyncReaddirInFlight) {
8138
6749
  await this.#asyncReaddirInFlight;
8139
6750
  } else {
8140
- let resolve3 = /* @__PURE__ */ __name(() => {
6751
+ let resolve4 = /* @__PURE__ */ __name(() => {
8141
6752
  }, "resolve");
8142
- this.#asyncReaddirInFlight = new Promise((res) => resolve3 = res);
6753
+ this.#asyncReaddirInFlight = new Promise((res) => resolve4 = res);
8143
6754
  try {
8144
6755
  for (const e of await this.#fs.promises.readdir(fullpath, {
8145
6756
  withFileTypes: true
@@ -8152,7 +6763,7 @@ var PathBase = class {
8152
6763
  children.provisional = 0;
8153
6764
  }
8154
6765
  this.#asyncReaddirInFlight = void 0;
8155
- resolve3();
6766
+ resolve4();
8156
6767
  }
8157
6768
  return children.slice(0, children.provisional);
8158
6769
  }
@@ -9222,13 +7833,13 @@ var Ignore = class {
9222
7833
  const p = new Pattern(parsed, globParts, 0, this.platform);
9223
7834
  const m = new Minimatch(p.globString(), this.mmopts);
9224
7835
  const children = globParts[globParts.length - 1] === "**";
9225
- const absolute = p.isAbsolute();
9226
- if (absolute)
7836
+ const absolute2 = p.isAbsolute();
7837
+ if (absolute2)
9227
7838
  this.absolute.push(m);
9228
7839
  else
9229
7840
  this.relative.push(m);
9230
7841
  if (children) {
9231
- if (absolute)
7842
+ if (absolute2)
9232
7843
  this.absoluteChildren.push(m);
9233
7844
  else
9234
7845
  this.relativeChildren.push(m);
@@ -9294,8 +7905,8 @@ var MatchRecord = class {
9294
7905
  __name(this, "MatchRecord");
9295
7906
  }
9296
7907
  store = /* @__PURE__ */ new Map();
9297
- add(target, absolute, ifDir) {
9298
- const n2 = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
7908
+ add(target, absolute2, ifDir) {
7909
+ const n2 = (absolute2 ? 2 : 0) | (ifDir ? 1 : 0);
9299
7910
  const current = this.store.get(target);
9300
7911
  this.store.set(target, current === void 0 ? n2 : n2 & current);
9301
7912
  }
@@ -9362,7 +7973,7 @@ var Processor = class _Processor {
9362
7973
  for (let [t, pattern] of processingSet) {
9363
7974
  this.hasWalkedCache.storeWalked(t, pattern);
9364
7975
  const root = pattern.root();
9365
- const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
7976
+ const absolute2 = pattern.isAbsolute() && this.opts.absolute !== false;
9366
7977
  if (root) {
9367
7978
  t = t.resolve(root === "/" && this.opts.root !== void 0 ? this.opts.root : root);
9368
7979
  const rest2 = pattern.rest();
@@ -9393,7 +8004,7 @@ var Processor = class _Processor {
9393
8004
  }
9394
8005
  if (typeof p === "string") {
9395
8006
  const ifDir = p === ".." || p === "" || p === ".";
9396
- this.matches.add(t.resolve(p), absolute, ifDir);
8007
+ this.matches.add(t.resolve(p), absolute2, ifDir);
9397
8008
  continue;
9398
8009
  } else if (p === GLOBSTAR) {
9399
8010
  if (!t.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) {
@@ -9402,12 +8013,12 @@ var Processor = class _Processor {
9402
8013
  const rp = rest?.pattern();
9403
8014
  const rrest = rest?.rest();
9404
8015
  if (!rest || (rp === "" || rp === ".") && !rrest) {
9405
- this.matches.add(t, absolute, rp === "" || rp === ".");
8016
+ this.matches.add(t, absolute2, rp === "" || rp === ".");
9406
8017
  } else {
9407
8018
  if (rp === "..") {
9408
8019
  const tp = t.parent || t;
9409
8020
  if (!rrest)
9410
- this.matches.add(tp, absolute, true);
8021
+ this.matches.add(tp, absolute2, true);
9411
8022
  else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {
9412
8023
  this.subwalks.add(tp, rrest);
9413
8024
  }
@@ -9434,24 +8045,24 @@ var Processor = class _Processor {
9434
8045
  const results = this.child();
9435
8046
  for (const e of entries) {
9436
8047
  for (const pattern of patterns) {
9437
- const absolute = pattern.isAbsolute();
8048
+ const absolute2 = pattern.isAbsolute();
9438
8049
  const p = pattern.pattern();
9439
8050
  const rest = pattern.rest();
9440
8051
  if (p === GLOBSTAR) {
9441
- results.testGlobstar(e, pattern, rest, absolute);
8052
+ results.testGlobstar(e, pattern, rest, absolute2);
9442
8053
  } else if (p instanceof RegExp) {
9443
- results.testRegExp(e, p, rest, absolute);
8054
+ results.testRegExp(e, p, rest, absolute2);
9444
8055
  } else {
9445
- results.testString(e, p, rest, absolute);
8056
+ results.testString(e, p, rest, absolute2);
9446
8057
  }
9447
8058
  }
9448
8059
  }
9449
8060
  return results;
9450
8061
  }
9451
- testGlobstar(e, pattern, rest, absolute) {
8062
+ testGlobstar(e, pattern, rest, absolute2) {
9452
8063
  if (this.dot || !e.name.startsWith(".")) {
9453
8064
  if (!pattern.hasMore()) {
9454
- this.matches.add(e, absolute, false);
8065
+ this.matches.add(e, absolute2, false);
9455
8066
  }
9456
8067
  if (e.canReaddir()) {
9457
8068
  if (this.follow || !e.isSymbolicLink()) {
@@ -9469,29 +8080,29 @@ var Processor = class _Processor {
9469
8080
  const rp = rest.pattern();
9470
8081
  if (typeof rp === "string" && // dots and empty were handled already
9471
8082
  rp !== ".." && rp !== "" && rp !== ".") {
9472
- this.testString(e, rp, rest.rest(), absolute);
8083
+ this.testString(e, rp, rest.rest(), absolute2);
9473
8084
  } else if (rp === "..") {
9474
8085
  const ep = e.parent || e;
9475
8086
  this.subwalks.add(ep, rest);
9476
8087
  } else if (rp instanceof RegExp) {
9477
- this.testRegExp(e, rp, rest.rest(), absolute);
8088
+ this.testRegExp(e, rp, rest.rest(), absolute2);
9478
8089
  }
9479
8090
  }
9480
8091
  }
9481
- testRegExp(e, p, rest, absolute) {
8092
+ testRegExp(e, p, rest, absolute2) {
9482
8093
  if (!p.test(e.name))
9483
8094
  return;
9484
8095
  if (!rest) {
9485
- this.matches.add(e, absolute, false);
8096
+ this.matches.add(e, absolute2, false);
9486
8097
  } else {
9487
8098
  this.subwalks.add(e, rest);
9488
8099
  }
9489
8100
  }
9490
- testString(e, p, rest, absolute) {
8101
+ testString(e, p, rest, absolute2) {
9491
8102
  if (!e.isNamed(p))
9492
8103
  return;
9493
8104
  if (!rest) {
9494
- this.matches.add(e, absolute, false);
8105
+ this.matches.add(e, absolute2, false);
9495
8106
  } else {
9496
8107
  this.subwalks.add(e, rest);
9497
8108
  }
@@ -9610,14 +8221,14 @@ var GlobUtil = class {
9610
8221
  }
9611
8222
  return this.matchCheckTest(s, ifDir);
9612
8223
  }
9613
- matchFinish(e, absolute) {
8224
+ matchFinish(e, absolute2) {
9614
8225
  if (this.#ignored(e))
9615
8226
  return;
9616
8227
  if (!this.includeChildMatches && this.#ignore?.add) {
9617
8228
  const ign = `${e.relativePosix()}/**`;
9618
8229
  this.#ignore.add(ign);
9619
8230
  }
9620
- const abs = this.opts.absolute === void 0 ? absolute : this.opts.absolute;
8231
+ const abs = this.opts.absolute === void 0 ? absolute2 : this.opts.absolute;
9621
8232
  this.seen.add(e);
9622
8233
  const mark = this.opts.mark && e.isDirectory() ? this.#sep : "";
9623
8234
  if (this.opts.withFileTypes) {
@@ -9631,15 +8242,15 @@ var GlobUtil = class {
9631
8242
  this.matchEmit(!rel ? "." + mark : pre + rel + mark);
9632
8243
  }
9633
8244
  }
9634
- async match(e, absolute, ifDir) {
8245
+ async match(e, absolute2, ifDir) {
9635
8246
  const p = await this.matchCheck(e, ifDir);
9636
8247
  if (p)
9637
- this.matchFinish(p, absolute);
8248
+ this.matchFinish(p, absolute2);
9638
8249
  }
9639
- matchSync(e, absolute, ifDir) {
8250
+ matchSync(e, absolute2, ifDir) {
9640
8251
  const p = this.matchCheckSync(e, ifDir);
9641
8252
  if (p)
9642
- this.matchFinish(p, absolute);
8253
+ this.matchFinish(p, absolute2);
9643
8254
  }
9644
8255
  walkCB(target, patterns, cb) {
9645
8256
  if (this.signal?.aborted)
@@ -9661,11 +8272,11 @@ var GlobUtil = class {
9661
8272
  if (--tasks === 0)
9662
8273
  cb();
9663
8274
  }, "next");
9664
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
8275
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9665
8276
  if (this.#ignored(m))
9666
8277
  continue;
9667
8278
  tasks++;
9668
- this.match(m, absolute, ifDir).then(() => next());
8279
+ this.match(m, absolute2, ifDir).then(() => next());
9669
8280
  }
9670
8281
  for (const t of processor.subwalkTargets()) {
9671
8282
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
@@ -9688,11 +8299,11 @@ var GlobUtil = class {
9688
8299
  if (--tasks === 0)
9689
8300
  cb();
9690
8301
  }, "next");
9691
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
8302
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9692
8303
  if (this.#ignored(m))
9693
8304
  continue;
9694
8305
  tasks++;
9695
- this.match(m, absolute, ifDir).then(() => next());
8306
+ this.match(m, absolute2, ifDir).then(() => next());
9696
8307
  }
9697
8308
  for (const [target2, patterns] of processor.subwalks.entries()) {
9698
8309
  tasks++;
@@ -9720,10 +8331,10 @@ var GlobUtil = class {
9720
8331
  if (--tasks === 0)
9721
8332
  cb();
9722
8333
  }, "next");
9723
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
8334
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9724
8335
  if (this.#ignored(m))
9725
8336
  continue;
9726
- this.matchSync(m, absolute, ifDir);
8337
+ this.matchSync(m, absolute2, ifDir);
9727
8338
  }
9728
8339
  for (const t of processor.subwalkTargets()) {
9729
8340
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
@@ -9742,10 +8353,10 @@ var GlobUtil = class {
9742
8353
  if (--tasks === 0)
9743
8354
  cb();
9744
8355
  }, "next");
9745
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
8356
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9746
8357
  if (this.#ignored(m))
9747
8358
  continue;
9748
- this.matchSync(m, absolute, ifDir);
8359
+ this.matchSync(m, absolute2, ifDir);
9749
8360
  }
9750
8361
  for (const [target2, patterns] of processor.subwalks.entries()) {
9751
8362
  tasks++;
@@ -10470,10 +9081,99 @@ async function csfPlugin(config) {
10470
9081
  __name(csfPlugin, "csfPlugin");
10471
9082
 
10472
9083
  // src/plugins/external-globals-plugin.ts
10473
- import { existsSync } from "node:fs";
9084
+ import { existsSync as existsSync3 } from "node:fs";
10474
9085
  import { mkdir, writeFile } from "node:fs/promises";
10475
- import { dirname as dirname2, join as join3 } from "node:path";
10476
- var import_find_cache_dir = __toESM(require_find_cache_dir(), 1);
9086
+ import { dirname as dirname4, join as join6 } from "node:path";
9087
+
9088
+ // ../../node_modules/empathic/package.mjs
9089
+ import { env } from "node:process";
9090
+ import { dirname as dirname3, join as join5 } from "node:path";
9091
+ import { existsSync as existsSync2, mkdirSync } from "node:fs";
9092
+
9093
+ // ../../node_modules/empathic/access.mjs
9094
+ import { accessSync, constants } from "node:fs";
9095
+ function ok(path3, mode) {
9096
+ try {
9097
+ accessSync(path3, mode);
9098
+ return true;
9099
+ } catch {
9100
+ return false;
9101
+ }
9102
+ }
9103
+ __name(ok, "ok");
9104
+ function writable(path3) {
9105
+ return ok(path3, constants.W_OK);
9106
+ }
9107
+ __name(writable, "writable");
9108
+
9109
+ // ../../node_modules/empathic/find.mjs
9110
+ import { join as join4 } from "node:path";
9111
+ import { existsSync, statSync } from "node:fs";
9112
+
9113
+ // ../../node_modules/empathic/walk.mjs
9114
+ import { dirname as dirname2 } from "node:path";
9115
+
9116
+ // ../../node_modules/empathic/resolve.mjs
9117
+ import { isAbsolute as isAbsolute3, join as join3, resolve as resolve2 } from "node:path";
9118
+ function absolute(input, root) {
9119
+ return isAbsolute3(input) ? input : resolve2(root || ".", input);
9120
+ }
9121
+ __name(absolute, "absolute");
9122
+
9123
+ // ../../node_modules/empathic/walk.mjs
9124
+ function up(base, options) {
9125
+ let { last, cwd: cwd2 } = options || {};
9126
+ let tmp = absolute(base, cwd2);
9127
+ let root = absolute(last || "/", cwd2);
9128
+ let prev, arr = [];
9129
+ while (prev !== root) {
9130
+ arr.push(tmp);
9131
+ tmp = dirname2(prev = tmp);
9132
+ if (tmp === prev) break;
9133
+ }
9134
+ return arr;
9135
+ }
9136
+ __name(up, "up");
9137
+
9138
+ // ../../node_modules/empathic/find.mjs
9139
+ function up2(name, options) {
9140
+ let dir, tmp;
9141
+ let start2 = options && options.cwd || "";
9142
+ for (dir of up(start2, options)) {
9143
+ tmp = join4(dir, name);
9144
+ if (existsSync(tmp)) return tmp;
9145
+ }
9146
+ }
9147
+ __name(up2, "up");
9148
+
9149
+ // ../../node_modules/empathic/package.mjs
9150
+ function up3(options) {
9151
+ return up2("package.json", options);
9152
+ }
9153
+ __name(up3, "up");
9154
+ function cache(name, options) {
9155
+ options = options || {};
9156
+ let dir = env.CACHE_DIR;
9157
+ if (!dir || /^(1|0|true|false)$/.test(dir)) {
9158
+ let pkg = up3(options);
9159
+ if (dir = pkg && dirname3(pkg)) {
9160
+ let mods = join5(dir, "node_modules");
9161
+ let exists = existsSync2(mods);
9162
+ if (!writable(exists ? mods : dir)) return;
9163
+ dir = join5(mods, ".cache");
9164
+ }
9165
+ }
9166
+ if (dir) {
9167
+ dir = join5(dir, name);
9168
+ if (options.create && !existsSync2(dir)) {
9169
+ mkdirSync(dir, { recursive: true });
9170
+ }
9171
+ return dir;
9172
+ }
9173
+ }
9174
+ __name(cache, "cache");
9175
+
9176
+ // src/plugins/external-globals-plugin.ts
10477
9177
  var escapeKeys = /* @__PURE__ */ __name((key) => key.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "escapeKeys");
10478
9178
  var defaultImportRegExp = "import ([^*{}]+) from";
10479
9179
  var replacementMap = /* @__PURE__ */ new Map([
@@ -10496,16 +9196,13 @@ async function externalGlobalsPlugin(externals) {
10496
9196
  return void 0;
10497
9197
  }
10498
9198
  const newAlias = mergeAlias([], config.resolve?.alias);
10499
- const cachePath = (0, import_find_cache_dir.default)({
10500
- name: "sb-vite-plugin-externals",
10501
- create: true
10502
- });
9199
+ const cachePath = cache("sb-vite-plugin-externals", { create: true }) ?? join6(process.cwd(), "node_modules", ".cache", "sb-vite-plugin-externals");
10503
9200
  await Promise.all(
10504
9201
  Object.keys(externals).map(async (externalKey) => {
10505
- const externalCachePath = join3(cachePath, `${externalKey}.js`);
9202
+ const externalCachePath = join6(cachePath, `${externalKey}.js`);
10506
9203
  newAlias.push({ find: new RegExp(`^${externalKey}$`), replacement: externalCachePath });
10507
- if (!existsSync(externalCachePath)) {
10508
- const directory = dirname2(externalCachePath);
9204
+ if (!existsSync3(externalCachePath)) {
9205
+ const directory = dirname4(externalCachePath);
10509
9206
  await mkdir(directory, { recursive: true });
10510
9207
  }
10511
9208
  await writeFile(externalCachePath, `module.exports = ${externals[externalKey]};`);
@@ -10652,7 +9349,7 @@ async function commonConfig(options, _type) {
10652
9349
  const configEnv = _type === "development" ? configEnvServe : configEnvBuild;
10653
9350
  const { loadConfigFromFile, mergeConfig, defaultClientConditions = [] } = await import("vite");
10654
9351
  const { viteConfigPath } = await getBuilderOptions(options);
10655
- const projectRoot = resolve2(options.configDir, "..");
9352
+ const projectRoot = resolve3(options.configDir, "..");
10656
9353
  const { config: { build: buildProperty = void 0, ...userConfig } = {} } = await loadConfigFromFile(configEnv, viteConfigPath, projectRoot) ?? {};
10657
9354
  const sbConfig = {
10658
9355
  configFile: false,
@@ -10874,7 +9571,6 @@ var INCLUDE_CANDIDATES = [
10874
9571
  "storybook/actions/decorator",
10875
9572
  "storybook/internal/core-events",
10876
9573
  "storybook/internal/csf",
10877
- "storybook/internal/preview-api",
10878
9574
  "storybook/internal/preview/runtime",
10879
9575
  "storybook/preview-api",
10880
9576
  "storybook/viewport",
@@ -10896,10 +9592,10 @@ async function getOptimizeDeps(config, options) {
10896
9592
  const absoluteStories = await listStories(options);
10897
9593
  const stories = absoluteStories.map((storyPath) => normalizePath(relative3(root, storyPath)));
10898
9594
  const resolvedConfig = await resolveConfig(config, "serve", "development");
10899
- const resolve3 = resolvedConfig.createResolver({ asSrc: false });
9595
+ const resolve4 = resolvedConfig.createResolver({ asSrc: false });
10900
9596
  const include = await asyncFilter(
10901
9597
  Array.from(/* @__PURE__ */ new Set([...INCLUDE_CANDIDATES, ...extraOptimizeDeps])),
10902
- async (id) => Boolean(await resolve3(id))
9598
+ async (id) => Boolean(await resolve4(id))
10903
9599
  );
10904
9600
  const optimizeDeps = {
10905
9601
  ...config.optimizeDeps,