@storybook/builder-vite 10.0.0-beta.2 → 10.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +151 -1771
  2. package/package.json +4 -5
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_tlndqj8hk3j from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tlndqj8hk3j from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tlndqj8hk3j from "node:module";
1
+ import CJS_COMPAT_NODE_URL_z9tbuo6b9mi from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_z9tbuo6b9mi from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_z9tbuo6b9mi from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_tlndqj8hk3j.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tlndqj8hk3j.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tlndqj8hk3j.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_z9tbuo6b9mi.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_z9tbuo6b9mi.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_z9tbuo6b9mi.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) => {
@@ -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,
@@ -7107,10 +5401,10 @@ var Minipass = class extends EventEmitter {
7107
5401
  * Return a void Promise that resolves once the stream ends.
7108
5402
  */
7109
5403
  async promise() {
7110
- return new Promise((resolve3, reject) => {
5404
+ return new Promise((resolve4, reject) => {
7111
5405
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
7112
5406
  this.on("error", (er) => reject(er));
7113
- this.on("end", () => resolve3());
5407
+ this.on("end", () => resolve4());
7114
5408
  });
7115
5409
  }
7116
5410
  /**
@@ -7134,7 +5428,7 @@ var Minipass = class extends EventEmitter {
7134
5428
  return Promise.resolve({ done: false, value: res });
7135
5429
  if (this[EOF])
7136
5430
  return stop();
7137
- let resolve3;
5431
+ let resolve4;
7138
5432
  let reject;
7139
5433
  const onerr = /* @__PURE__ */ __name((er) => {
7140
5434
  this.off("data", ondata);
@@ -7148,19 +5442,19 @@ var Minipass = class extends EventEmitter {
7148
5442
  this.off("end", onend);
7149
5443
  this.off(DESTROYED, ondestroy);
7150
5444
  this.pause();
7151
- resolve3({ value, done: !!this[EOF] });
5445
+ resolve4({ value, done: !!this[EOF] });
7152
5446
  }, "ondata");
7153
5447
  const onend = /* @__PURE__ */ __name(() => {
7154
5448
  this.off("error", onerr);
7155
5449
  this.off("data", ondata);
7156
5450
  this.off(DESTROYED, ondestroy);
7157
5451
  stop();
7158
- resolve3({ done: true, value: void 0 });
5452
+ resolve4({ done: true, value: void 0 });
7159
5453
  }, "onend");
7160
5454
  const ondestroy = /* @__PURE__ */ __name(() => onerr(new Error("stream destroyed")), "ondestroy");
7161
5455
  return new Promise((res2, rej) => {
7162
5456
  reject = rej;
7163
- resolve3 = res2;
5457
+ resolve4 = res2;
7164
5458
  this.once(DESTROYED, ondestroy);
7165
5459
  this.once("error", onerr);
7166
5460
  this.once("end", onend);
@@ -8137,9 +6431,9 @@ var PathBase = class {
8137
6431
  if (this.#asyncReaddirInFlight) {
8138
6432
  await this.#asyncReaddirInFlight;
8139
6433
  } else {
8140
- let resolve3 = /* @__PURE__ */ __name(() => {
6434
+ let resolve4 = /* @__PURE__ */ __name(() => {
8141
6435
  }, "resolve");
8142
- this.#asyncReaddirInFlight = new Promise((res) => resolve3 = res);
6436
+ this.#asyncReaddirInFlight = new Promise((res) => resolve4 = res);
8143
6437
  try {
8144
6438
  for (const e of await this.#fs.promises.readdir(fullpath, {
8145
6439
  withFileTypes: true
@@ -8152,7 +6446,7 @@ var PathBase = class {
8152
6446
  children.provisional = 0;
8153
6447
  }
8154
6448
  this.#asyncReaddirInFlight = void 0;
8155
- resolve3();
6449
+ resolve4();
8156
6450
  }
8157
6451
  return children.slice(0, children.provisional);
8158
6452
  }
@@ -9222,13 +7516,13 @@ var Ignore = class {
9222
7516
  const p = new Pattern(parsed, globParts, 0, this.platform);
9223
7517
  const m = new Minimatch(p.globString(), this.mmopts);
9224
7518
  const children = globParts[globParts.length - 1] === "**";
9225
- const absolute = p.isAbsolute();
9226
- if (absolute)
7519
+ const absolute2 = p.isAbsolute();
7520
+ if (absolute2)
9227
7521
  this.absolute.push(m);
9228
7522
  else
9229
7523
  this.relative.push(m);
9230
7524
  if (children) {
9231
- if (absolute)
7525
+ if (absolute2)
9232
7526
  this.absoluteChildren.push(m);
9233
7527
  else
9234
7528
  this.relativeChildren.push(m);
@@ -9294,8 +7588,8 @@ var MatchRecord = class {
9294
7588
  __name(this, "MatchRecord");
9295
7589
  }
9296
7590
  store = /* @__PURE__ */ new Map();
9297
- add(target, absolute, ifDir) {
9298
- const n2 = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
7591
+ add(target, absolute2, ifDir) {
7592
+ const n2 = (absolute2 ? 2 : 0) | (ifDir ? 1 : 0);
9299
7593
  const current = this.store.get(target);
9300
7594
  this.store.set(target, current === void 0 ? n2 : n2 & current);
9301
7595
  }
@@ -9362,7 +7656,7 @@ var Processor = class _Processor {
9362
7656
  for (let [t, pattern] of processingSet) {
9363
7657
  this.hasWalkedCache.storeWalked(t, pattern);
9364
7658
  const root = pattern.root();
9365
- const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
7659
+ const absolute2 = pattern.isAbsolute() && this.opts.absolute !== false;
9366
7660
  if (root) {
9367
7661
  t = t.resolve(root === "/" && this.opts.root !== void 0 ? this.opts.root : root);
9368
7662
  const rest2 = pattern.rest();
@@ -9393,7 +7687,7 @@ var Processor = class _Processor {
9393
7687
  }
9394
7688
  if (typeof p === "string") {
9395
7689
  const ifDir = p === ".." || p === "" || p === ".";
9396
- this.matches.add(t.resolve(p), absolute, ifDir);
7690
+ this.matches.add(t.resolve(p), absolute2, ifDir);
9397
7691
  continue;
9398
7692
  } else if (p === GLOBSTAR) {
9399
7693
  if (!t.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) {
@@ -9402,12 +7696,12 @@ var Processor = class _Processor {
9402
7696
  const rp = rest?.pattern();
9403
7697
  const rrest = rest?.rest();
9404
7698
  if (!rest || (rp === "" || rp === ".") && !rrest) {
9405
- this.matches.add(t, absolute, rp === "" || rp === ".");
7699
+ this.matches.add(t, absolute2, rp === "" || rp === ".");
9406
7700
  } else {
9407
7701
  if (rp === "..") {
9408
7702
  const tp = t.parent || t;
9409
7703
  if (!rrest)
9410
- this.matches.add(tp, absolute, true);
7704
+ this.matches.add(tp, absolute2, true);
9411
7705
  else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {
9412
7706
  this.subwalks.add(tp, rrest);
9413
7707
  }
@@ -9434,24 +7728,24 @@ var Processor = class _Processor {
9434
7728
  const results = this.child();
9435
7729
  for (const e of entries) {
9436
7730
  for (const pattern of patterns) {
9437
- const absolute = pattern.isAbsolute();
7731
+ const absolute2 = pattern.isAbsolute();
9438
7732
  const p = pattern.pattern();
9439
7733
  const rest = pattern.rest();
9440
7734
  if (p === GLOBSTAR) {
9441
- results.testGlobstar(e, pattern, rest, absolute);
7735
+ results.testGlobstar(e, pattern, rest, absolute2);
9442
7736
  } else if (p instanceof RegExp) {
9443
- results.testRegExp(e, p, rest, absolute);
7737
+ results.testRegExp(e, p, rest, absolute2);
9444
7738
  } else {
9445
- results.testString(e, p, rest, absolute);
7739
+ results.testString(e, p, rest, absolute2);
9446
7740
  }
9447
7741
  }
9448
7742
  }
9449
7743
  return results;
9450
7744
  }
9451
- testGlobstar(e, pattern, rest, absolute) {
7745
+ testGlobstar(e, pattern, rest, absolute2) {
9452
7746
  if (this.dot || !e.name.startsWith(".")) {
9453
7747
  if (!pattern.hasMore()) {
9454
- this.matches.add(e, absolute, false);
7748
+ this.matches.add(e, absolute2, false);
9455
7749
  }
9456
7750
  if (e.canReaddir()) {
9457
7751
  if (this.follow || !e.isSymbolicLink()) {
@@ -9469,29 +7763,29 @@ var Processor = class _Processor {
9469
7763
  const rp = rest.pattern();
9470
7764
  if (typeof rp === "string" && // dots and empty were handled already
9471
7765
  rp !== ".." && rp !== "" && rp !== ".") {
9472
- this.testString(e, rp, rest.rest(), absolute);
7766
+ this.testString(e, rp, rest.rest(), absolute2);
9473
7767
  } else if (rp === "..") {
9474
7768
  const ep = e.parent || e;
9475
7769
  this.subwalks.add(ep, rest);
9476
7770
  } else if (rp instanceof RegExp) {
9477
- this.testRegExp(e, rp, rest.rest(), absolute);
7771
+ this.testRegExp(e, rp, rest.rest(), absolute2);
9478
7772
  }
9479
7773
  }
9480
7774
  }
9481
- testRegExp(e, p, rest, absolute) {
7775
+ testRegExp(e, p, rest, absolute2) {
9482
7776
  if (!p.test(e.name))
9483
7777
  return;
9484
7778
  if (!rest) {
9485
- this.matches.add(e, absolute, false);
7779
+ this.matches.add(e, absolute2, false);
9486
7780
  } else {
9487
7781
  this.subwalks.add(e, rest);
9488
7782
  }
9489
7783
  }
9490
- testString(e, p, rest, absolute) {
7784
+ testString(e, p, rest, absolute2) {
9491
7785
  if (!e.isNamed(p))
9492
7786
  return;
9493
7787
  if (!rest) {
9494
- this.matches.add(e, absolute, false);
7788
+ this.matches.add(e, absolute2, false);
9495
7789
  } else {
9496
7790
  this.subwalks.add(e, rest);
9497
7791
  }
@@ -9610,14 +7904,14 @@ var GlobUtil = class {
9610
7904
  }
9611
7905
  return this.matchCheckTest(s, ifDir);
9612
7906
  }
9613
- matchFinish(e, absolute) {
7907
+ matchFinish(e, absolute2) {
9614
7908
  if (this.#ignored(e))
9615
7909
  return;
9616
7910
  if (!this.includeChildMatches && this.#ignore?.add) {
9617
7911
  const ign = `${e.relativePosix()}/**`;
9618
7912
  this.#ignore.add(ign);
9619
7913
  }
9620
- const abs = this.opts.absolute === void 0 ? absolute : this.opts.absolute;
7914
+ const abs = this.opts.absolute === void 0 ? absolute2 : this.opts.absolute;
9621
7915
  this.seen.add(e);
9622
7916
  const mark = this.opts.mark && e.isDirectory() ? this.#sep : "";
9623
7917
  if (this.opts.withFileTypes) {
@@ -9631,15 +7925,15 @@ var GlobUtil = class {
9631
7925
  this.matchEmit(!rel ? "." + mark : pre + rel + mark);
9632
7926
  }
9633
7927
  }
9634
- async match(e, absolute, ifDir) {
7928
+ async match(e, absolute2, ifDir) {
9635
7929
  const p = await this.matchCheck(e, ifDir);
9636
7930
  if (p)
9637
- this.matchFinish(p, absolute);
7931
+ this.matchFinish(p, absolute2);
9638
7932
  }
9639
- matchSync(e, absolute, ifDir) {
7933
+ matchSync(e, absolute2, ifDir) {
9640
7934
  const p = this.matchCheckSync(e, ifDir);
9641
7935
  if (p)
9642
- this.matchFinish(p, absolute);
7936
+ this.matchFinish(p, absolute2);
9643
7937
  }
9644
7938
  walkCB(target, patterns, cb) {
9645
7939
  if (this.signal?.aborted)
@@ -9661,11 +7955,11 @@ var GlobUtil = class {
9661
7955
  if (--tasks === 0)
9662
7956
  cb();
9663
7957
  }, "next");
9664
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
7958
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9665
7959
  if (this.#ignored(m))
9666
7960
  continue;
9667
7961
  tasks++;
9668
- this.match(m, absolute, ifDir).then(() => next());
7962
+ this.match(m, absolute2, ifDir).then(() => next());
9669
7963
  }
9670
7964
  for (const t of processor.subwalkTargets()) {
9671
7965
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
@@ -9688,11 +7982,11 @@ var GlobUtil = class {
9688
7982
  if (--tasks === 0)
9689
7983
  cb();
9690
7984
  }, "next");
9691
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
7985
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9692
7986
  if (this.#ignored(m))
9693
7987
  continue;
9694
7988
  tasks++;
9695
- this.match(m, absolute, ifDir).then(() => next());
7989
+ this.match(m, absolute2, ifDir).then(() => next());
9696
7990
  }
9697
7991
  for (const [target2, patterns] of processor.subwalks.entries()) {
9698
7992
  tasks++;
@@ -9720,10 +8014,10 @@ var GlobUtil = class {
9720
8014
  if (--tasks === 0)
9721
8015
  cb();
9722
8016
  }, "next");
9723
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
8017
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9724
8018
  if (this.#ignored(m))
9725
8019
  continue;
9726
- this.matchSync(m, absolute, ifDir);
8020
+ this.matchSync(m, absolute2, ifDir);
9727
8021
  }
9728
8022
  for (const t of processor.subwalkTargets()) {
9729
8023
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
@@ -9742,10 +8036,10 @@ var GlobUtil = class {
9742
8036
  if (--tasks === 0)
9743
8037
  cb();
9744
8038
  }, "next");
9745
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
8039
+ for (const [m, absolute2, ifDir] of processor.matches.entries()) {
9746
8040
  if (this.#ignored(m))
9747
8041
  continue;
9748
- this.matchSync(m, absolute, ifDir);
8042
+ this.matchSync(m, absolute2, ifDir);
9749
8043
  }
9750
8044
  for (const [target2, patterns] of processor.subwalks.entries()) {
9751
8045
  tasks++;
@@ -10470,10 +8764,99 @@ async function csfPlugin(config) {
10470
8764
  __name(csfPlugin, "csfPlugin");
10471
8765
 
10472
8766
  // src/plugins/external-globals-plugin.ts
10473
- import { existsSync } from "node:fs";
8767
+ import { existsSync as existsSync3 } from "node:fs";
10474
8768
  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);
8769
+ import { dirname as dirname4, join as join6 } from "node:path";
8770
+
8771
+ // ../../node_modules/empathic/package.mjs
8772
+ import { env } from "node:process";
8773
+ import { dirname as dirname3, join as join5 } from "node:path";
8774
+ import { existsSync as existsSync2, mkdirSync } from "node:fs";
8775
+
8776
+ // ../../node_modules/empathic/access.mjs
8777
+ import { accessSync, constants } from "node:fs";
8778
+ function ok(path3, mode) {
8779
+ try {
8780
+ accessSync(path3, mode);
8781
+ return true;
8782
+ } catch {
8783
+ return false;
8784
+ }
8785
+ }
8786
+ __name(ok, "ok");
8787
+ function writable(path3) {
8788
+ return ok(path3, constants.W_OK);
8789
+ }
8790
+ __name(writable, "writable");
8791
+
8792
+ // ../../node_modules/empathic/find.mjs
8793
+ import { join as join4 } from "node:path";
8794
+ import { existsSync, statSync } from "node:fs";
8795
+
8796
+ // ../../node_modules/empathic/walk.mjs
8797
+ import { dirname as dirname2 } from "node:path";
8798
+
8799
+ // ../../node_modules/empathic/resolve.mjs
8800
+ import { isAbsolute as isAbsolute3, join as join3, resolve as resolve2 } from "node:path";
8801
+ function absolute(input, root) {
8802
+ return isAbsolute3(input) ? input : resolve2(root || ".", input);
8803
+ }
8804
+ __name(absolute, "absolute");
8805
+
8806
+ // ../../node_modules/empathic/walk.mjs
8807
+ function up(base, options) {
8808
+ let { last, cwd: cwd2 } = options || {};
8809
+ let tmp = absolute(base, cwd2);
8810
+ let root = absolute(last || "/", cwd2);
8811
+ let prev, arr = [];
8812
+ while (prev !== root) {
8813
+ arr.push(tmp);
8814
+ tmp = dirname2(prev = tmp);
8815
+ if (tmp === prev) break;
8816
+ }
8817
+ return arr;
8818
+ }
8819
+ __name(up, "up");
8820
+
8821
+ // ../../node_modules/empathic/find.mjs
8822
+ function up2(name, options) {
8823
+ let dir, tmp;
8824
+ let start2 = options && options.cwd || "";
8825
+ for (dir of up(start2, options)) {
8826
+ tmp = join4(dir, name);
8827
+ if (existsSync(tmp)) return tmp;
8828
+ }
8829
+ }
8830
+ __name(up2, "up");
8831
+
8832
+ // ../../node_modules/empathic/package.mjs
8833
+ function up3(options) {
8834
+ return up2("package.json", options);
8835
+ }
8836
+ __name(up3, "up");
8837
+ function cache(name, options) {
8838
+ options = options || {};
8839
+ let dir = env.CACHE_DIR;
8840
+ if (!dir || /^(1|0|true|false)$/.test(dir)) {
8841
+ let pkg = up3(options);
8842
+ if (dir = pkg && dirname3(pkg)) {
8843
+ let mods = join5(dir, "node_modules");
8844
+ let exists = existsSync2(mods);
8845
+ if (!writable(exists ? mods : dir)) return;
8846
+ dir = join5(mods, ".cache");
8847
+ }
8848
+ }
8849
+ if (dir) {
8850
+ dir = join5(dir, name);
8851
+ if (options.create && !existsSync2(dir)) {
8852
+ mkdirSync(dir, { recursive: true });
8853
+ }
8854
+ return dir;
8855
+ }
8856
+ }
8857
+ __name(cache, "cache");
8858
+
8859
+ // src/plugins/external-globals-plugin.ts
10477
8860
  var escapeKeys = /* @__PURE__ */ __name((key) => key.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "escapeKeys");
10478
8861
  var defaultImportRegExp = "import ([^*{}]+) from";
10479
8862
  var replacementMap = /* @__PURE__ */ new Map([
@@ -10496,16 +8879,13 @@ async function externalGlobalsPlugin(externals) {
10496
8879
  return void 0;
10497
8880
  }
10498
8881
  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
- });
8882
+ const cachePath = cache("sb-vite-plugin-externals", { create: true });
10503
8883
  await Promise.all(
10504
8884
  Object.keys(externals).map(async (externalKey) => {
10505
- const externalCachePath = join3(cachePath, `${externalKey}.js`);
8885
+ const externalCachePath = join6(cachePath, `${externalKey}.js`);
10506
8886
  newAlias.push({ find: new RegExp(`^${externalKey}$`), replacement: externalCachePath });
10507
- if (!existsSync(externalCachePath)) {
10508
- const directory = dirname2(externalCachePath);
8887
+ if (!existsSync3(externalCachePath)) {
8888
+ const directory = dirname4(externalCachePath);
10509
8889
  await mkdir(directory, { recursive: true });
10510
8890
  }
10511
8891
  await writeFile(externalCachePath, `module.exports = ${externals[externalKey]};`);
@@ -10652,7 +9032,7 @@ async function commonConfig(options, _type) {
10652
9032
  const configEnv = _type === "development" ? configEnvServe : configEnvBuild;
10653
9033
  const { loadConfigFromFile, mergeConfig, defaultClientConditions = [] } = await import("vite");
10654
9034
  const { viteConfigPath } = await getBuilderOptions(options);
10655
- const projectRoot = resolve2(options.configDir, "..");
9035
+ const projectRoot = resolve3(options.configDir, "..");
10656
9036
  const { config: { build: buildProperty = void 0, ...userConfig } = {} } = await loadConfigFromFile(configEnv, viteConfigPath, projectRoot) ?? {};
10657
9037
  const sbConfig = {
10658
9038
  configFile: false,
@@ -10896,10 +9276,10 @@ async function getOptimizeDeps(config, options) {
10896
9276
  const absoluteStories = await listStories(options);
10897
9277
  const stories = absoluteStories.map((storyPath) => normalizePath(relative3(root, storyPath)));
10898
9278
  const resolvedConfig = await resolveConfig(config, "serve", "development");
10899
- const resolve3 = resolvedConfig.createResolver({ asSrc: false });
9279
+ const resolve4 = resolvedConfig.createResolver({ asSrc: false });
10900
9280
  const include = await asyncFilter(
10901
9281
  Array.from(/* @__PURE__ */ new Set([...INCLUDE_CANDIDATES, ...extraOptimizeDeps])),
10902
- async (id) => Boolean(await resolve3(id))
9282
+ async (id) => Boolean(await resolve4(id))
10903
9283
  );
10904
9284
  const optimizeDeps = {
10905
9285
  ...config.optimizeDeps,