vite-plugin-storybook-nextjs 3.0.2 → 3.0.3--canary.68.2eff9c3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var path2 = require('path');
4
3
  var module$1 = require('module');
5
4
  var tsconfigPaths = require('vite-tsconfig-paths');
6
5
  var fs3 = require('fs');
@@ -25,7 +24,6 @@ var constants_js = require('next/dist/shared/lib/constants.js');
25
24
  var MagicString = require('magic-string');
26
25
  var querystring = require('querystring');
27
26
  var imageSize = require('image-size');
28
- var posix = require('path/posix');
29
27
 
30
28
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
31
29
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -48,7 +46,6 @@ function _interopNamespace(e) {
48
46
  return Object.freeze(n);
49
47
  }
50
48
 
51
- var path2__default = /*#__PURE__*/_interopDefault(path2);
52
49
  var tsconfigPaths__default = /*#__PURE__*/_interopDefault(tsconfigPaths);
53
50
  var fs3__default = /*#__PURE__*/_interopDefault(fs3);
54
51
  var nextEnv__namespace = /*#__PURE__*/_interopNamespace(nextEnv);
@@ -536,7 +533,7 @@ var require_semver = __commonJS({
536
533
  var require_parse = __commonJS({
537
534
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js"(exports, module) {
538
535
  var SemVer = require_semver();
539
- var parse = (version, options, throwErrors = false) => {
536
+ var parse2 = (version, options, throwErrors = false) => {
540
537
  if (version instanceof SemVer) {
541
538
  return version;
542
539
  }
@@ -549,16 +546,16 @@ var require_parse = __commonJS({
549
546
  throw er;
550
547
  }
551
548
  };
552
- module.exports = parse;
549
+ module.exports = parse2;
553
550
  }
554
551
  });
555
552
 
556
553
  // node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
557
554
  var require_valid = __commonJS({
558
555
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js"(exports, module) {
559
- var parse = require_parse();
556
+ var parse2 = require_parse();
560
557
  var valid = (version, options) => {
561
- const v = parse(version, options);
558
+ const v = parse2(version, options);
562
559
  return v ? v.version : null;
563
560
  };
564
561
  module.exports = valid;
@@ -568,9 +565,9 @@ var require_valid = __commonJS({
568
565
  // node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
569
566
  var require_clean = __commonJS({
570
567
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js"(exports, module) {
571
- var parse = require_parse();
568
+ var parse2 = require_parse();
572
569
  var clean = (version, options) => {
573
- const s = parse(version.trim().replace(/^[=v]+/, ""), options);
570
+ const s = parse2(version.trim().replace(/^[=v]+/, ""), options);
574
571
  return s ? s.version : null;
575
572
  };
576
573
  module.exports = clean;
@@ -603,10 +600,10 @@ var require_inc = __commonJS({
603
600
  // node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js
604
601
  var require_diff = __commonJS({
605
602
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js"(exports, module) {
606
- var parse = require_parse();
603
+ var parse2 = require_parse();
607
604
  var diff = (version1, version2) => {
608
- const v1 = parse(version1, null, true);
609
- const v2 = parse(version2, null, true);
605
+ const v1 = parse2(version1, null, true);
606
+ const v2 = parse2(version2, null, true);
610
607
  const comparison = v1.compare(v2);
611
608
  if (comparison === 0) {
612
609
  return null;
@@ -673,9 +670,9 @@ var require_patch = __commonJS({
673
670
  // node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
674
671
  var require_prerelease = __commonJS({
675
672
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js"(exports, module) {
676
- var parse = require_parse();
673
+ var parse2 = require_parse();
677
674
  var prerelease = (version, options) => {
678
- const parsed = parse(version, options);
675
+ const parsed = parse2(version, options);
679
676
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
680
677
  };
681
678
  module.exports = prerelease;
@@ -847,7 +844,7 @@ var require_cmp = __commonJS({
847
844
  var require_coerce = __commonJS({
848
845
  "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js"(exports, module) {
849
846
  var SemVer = require_semver();
850
- var parse = require_parse();
847
+ var parse2 = require_parse();
851
848
  var { safeRe: re, t } = require_re();
852
849
  var coerce = (version, options) => {
853
850
  if (version instanceof SemVer) {
@@ -882,7 +879,7 @@ var require_coerce = __commonJS({
882
879
  const patch = match[4] || "0";
883
880
  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
884
881
  const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
885
- return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
882
+ return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
886
883
  };
887
884
  module.exports = coerce;
888
885
  }
@@ -1883,7 +1880,7 @@ var require_semver2 = __commonJS({
1883
1880
  var constants = require_constants();
1884
1881
  var SemVer = require_semver();
1885
1882
  var identifiers = require_identifiers();
1886
- var parse = require_parse();
1883
+ var parse2 = require_parse();
1887
1884
  var valid = require_valid();
1888
1885
  var clean = require_clean();
1889
1886
  var inc = require_inc();
@@ -1921,7 +1918,7 @@ var require_semver2 = __commonJS({
1921
1918
  var simplifyRange = require_simplify();
1922
1919
  var subset = require_subset();
1923
1920
  module.exports = {
1924
- parse,
1921
+ parse: parse2,
1925
1922
  valid,
1926
1923
  clean,
1927
1924
  inc,
@@ -1969,6 +1966,424 @@ var require_semver2 = __commonJS({
1969
1966
  };
1970
1967
  }
1971
1968
  });
1969
+
1970
+ // node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
1971
+ var _lazyMatch = () => {
1972
+ var __lib__ = (() => {
1973
+ var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
1974
+ for (var n in e) m(r, n, { get: e[n], enumerable: true });
1975
+ }, H = (r, e, n, a) => {
1976
+ if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r, t) && t !== n && m(r, t, { get: () => e[t], enumerable: !(a = V(e, t)) || a.enumerable });
1977
+ return r;
1978
+ }, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
1979
+ q(w, { default: () => re });
1980
+ var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
1981
+ const e = /* @__PURE__ */ new Map();
1982
+ return (n) => {
1983
+ const a = e.get(n);
1984
+ if (a) return a;
1985
+ const t = r(n);
1986
+ return e.set(n, t), t;
1987
+ };
1988
+ }, rr = (r, e, n = {}) => {
1989
+ const a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
1990
+ if (v(e)(a) && a.index === r.length) return a.output;
1991
+ throw new Error(`Failed to parse at index ${a.indexMax}`);
1992
+ }, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
1993
+ const n = {};
1994
+ for (const a of r) {
1995
+ if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
1996
+ const t = a.charCodeAt(0);
1997
+ n[t] = true;
1998
+ }
1999
+ return (a) => {
2000
+ const t = a.index, o = a.input;
2001
+ for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
2002
+ const u = a.index;
2003
+ if (u > t) {
2004
+ if (!h(e) && !a.options.silent) {
2005
+ const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
2006
+ h(c) || a.output.push(c);
2007
+ }
2008
+ a.indexMax = Math.max(a.indexMax, a.index);
2009
+ }
2010
+ return true;
2011
+ };
2012
+ }, nr = (r, e) => {
2013
+ const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
2014
+ return g((o) => {
2015
+ t.lastIndex = o.index;
2016
+ const u = t.exec(o.input);
2017
+ if (u) {
2018
+ if (!h(e) && !o.options.silent) {
2019
+ const s = d(e) ? e(...u, o.input, String(o.index)) : e;
2020
+ h(s) || o.output.push(s);
2021
+ }
2022
+ return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
2023
+ } else return false;
2024
+ });
2025
+ }, ar = (r, e) => (n) => {
2026
+ if (n.input.startsWith(r, n.index)) {
2027
+ if (!h(e) && !n.options.silent) {
2028
+ const t = d(e) ? e(r, n.input, String(n.index)) : e;
2029
+ h(t) || n.output.push(t);
2030
+ }
2031
+ return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
2032
+ } else return false;
2033
+ }, C = (r, e, n, a) => {
2034
+ const t = v(r);
2035
+ return g(_(M((o) => {
2036
+ let u = 0;
2037
+ for (; u < n; ) {
2038
+ const s = o.index;
2039
+ if (!t(o) || (u += 1, o.index === s)) break;
2040
+ }
2041
+ return u >= e;
2042
+ })));
2043
+ }, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
2044
+ const n = r.map(v);
2045
+ return g(_(M((a) => {
2046
+ for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
2047
+ return true;
2048
+ })));
2049
+ }, l = (r, e) => {
2050
+ const n = r.map(v);
2051
+ return g(_((a) => {
2052
+ for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return true;
2053
+ return false;
2054
+ }));
2055
+ }, M = (r, e = false) => {
2056
+ const n = v(r);
2057
+ return (a) => {
2058
+ const t = a.index, o = a.output.length, u = n(a);
2059
+ return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
2060
+ };
2061
+ }, _ = (r, e) => {
2062
+ const n = v(r);
2063
+ return n;
2064
+ }, g = /* @__PURE__ */ (() => {
2065
+ let r = 0;
2066
+ return (e) => {
2067
+ const n = v(e), a = r += 1;
2068
+ return (t) => {
2069
+ var o;
2070
+ if (t.options.memoization === false) return n(t);
2071
+ const u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
2072
+ if (c === false) return false;
2073
+ if (W(c)) return t.index = c, true;
2074
+ if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
2075
+ {
2076
+ const Z = t.output.length;
2077
+ if (n(t)) {
2078
+ const D = t.index, U = t.output.length;
2079
+ if (U > Z) {
2080
+ const ee = t.output.slice(Z, U);
2081
+ s.set(u, { index: D, output: ee });
2082
+ } else s.set(u, D);
2083
+ return true;
2084
+ } else return s.set(u, false), false;
2085
+ }
2086
+ };
2087
+ };
2088
+ })(), E = (r) => {
2089
+ let e;
2090
+ return (n) => (e || (e = v(r())), e(n));
2091
+ }, v = Y((r) => {
2092
+ if (d(r)) return Q(r) ? E(r) : r;
2093
+ if (b(r) || X(r)) return i(r);
2094
+ if (A(r)) return x(r);
2095
+ if (K(r)) return l(Object.values(r));
2096
+ throw new Error("Invalid rule");
2097
+ }), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
2098
+ let e = "";
2099
+ for (; r > 0; ) {
2100
+ const n = (r - 1) % 26;
2101
+ e = P[n] + e, r = Math.floor((r - 1) / 26);
2102
+ }
2103
+ return e;
2104
+ }, O = (r) => {
2105
+ let e = 0;
2106
+ for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
2107
+ return e;
2108
+ }, S = (r, e) => {
2109
+ if (e < r) return S(e, r);
2110
+ const n = [];
2111
+ for (; r <= e; ) n.push(r++);
2112
+ return n;
2113
+ }, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
2114
+ const e = {};
2115
+ return (n) => e[n] ?? (e[n] = r(n));
2116
+ }, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([hr, dr]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([Sr, yr]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, tr(Ar), f(Er), wr]), Pr = i("{", "(?:"), Or = i("}", ")"), Rr = i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([Rr, zr, jr]), I = x([Pr, Nr, Or]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), Zr = E(() => F), Dr = l([j, N, k, B, I, Zr, y, Fr, Ir, Lr]), F = x([kr, f(Dr), Br]), Ur = f(l([sr, cr, lr, fr, j, N, k, B, I, F, y, pr, vr])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e) => {
2117
+ const n = Array.isArray(r) ? r : [r];
2118
+ if (!n.length) return false;
2119
+ const a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
2120
+ return a.some((s) => s.test(o));
2121
+ };
2122
+ $.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
2123
+ var re = $;
2124
+ return J(w);
2125
+ })();
2126
+ return __lib__.default || __lib__;
2127
+ };
2128
+ var _match;
2129
+ var zeptomatch = (path, pattern) => {
2130
+ if (!_match) {
2131
+ _match = _lazyMatch();
2132
+ _lazyMatch = null;
2133
+ }
2134
+ return _match(path, pattern);
2135
+ };
2136
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2137
+ function normalizeWindowsPath(input = "") {
2138
+ if (!input) {
2139
+ return input;
2140
+ }
2141
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
2142
+ }
2143
+ var _UNC_REGEX = /^[/\\]{2}/;
2144
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
2145
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
2146
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
2147
+ var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
2148
+ var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
2149
+ var sep = "/";
2150
+ var normalize = function(path) {
2151
+ if (path.length === 0) {
2152
+ return ".";
2153
+ }
2154
+ path = normalizeWindowsPath(path);
2155
+ const isUNCPath = path.match(_UNC_REGEX);
2156
+ const isPathAbsolute = isAbsolute(path);
2157
+ const trailingSeparator = path[path.length - 1] === "/";
2158
+ path = normalizeString(path, !isPathAbsolute);
2159
+ if (path.length === 0) {
2160
+ if (isPathAbsolute) {
2161
+ return "/";
2162
+ }
2163
+ return trailingSeparator ? "./" : ".";
2164
+ }
2165
+ if (trailingSeparator) {
2166
+ path += "/";
2167
+ }
2168
+ if (_DRIVE_LETTER_RE.test(path)) {
2169
+ path += "/";
2170
+ }
2171
+ if (isUNCPath) {
2172
+ if (!isPathAbsolute) {
2173
+ return `//./${path}`;
2174
+ }
2175
+ return `//${path}`;
2176
+ }
2177
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
2178
+ };
2179
+ var join = function(...segments) {
2180
+ let path = "";
2181
+ for (const seg of segments) {
2182
+ if (!seg) {
2183
+ continue;
2184
+ }
2185
+ if (path.length > 0) {
2186
+ const pathTrailing = path[path.length - 1] === "/";
2187
+ const segLeading = seg[0] === "/";
2188
+ const both = pathTrailing && segLeading;
2189
+ if (both) {
2190
+ path += seg.slice(1);
2191
+ } else {
2192
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
2193
+ }
2194
+ } else {
2195
+ path += seg;
2196
+ }
2197
+ }
2198
+ return normalize(path);
2199
+ };
2200
+ function cwd() {
2201
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
2202
+ return process.cwd().replace(/\\/g, "/");
2203
+ }
2204
+ return "/";
2205
+ }
2206
+ var resolve = function(...arguments_) {
2207
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
2208
+ let resolvedPath = "";
2209
+ let resolvedAbsolute = false;
2210
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
2211
+ const path = index >= 0 ? arguments_[index] : cwd();
2212
+ if (!path || path.length === 0) {
2213
+ continue;
2214
+ }
2215
+ resolvedPath = `${path}/${resolvedPath}`;
2216
+ resolvedAbsolute = isAbsolute(path);
2217
+ }
2218
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
2219
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
2220
+ return `/${resolvedPath}`;
2221
+ }
2222
+ return resolvedPath.length > 0 ? resolvedPath : ".";
2223
+ };
2224
+ function normalizeString(path, allowAboveRoot) {
2225
+ let res = "";
2226
+ let lastSegmentLength = 0;
2227
+ let lastSlash = -1;
2228
+ let dots = 0;
2229
+ let char = null;
2230
+ for (let index = 0; index <= path.length; ++index) {
2231
+ if (index < path.length) {
2232
+ char = path[index];
2233
+ } else if (char === "/") {
2234
+ break;
2235
+ } else {
2236
+ char = "/";
2237
+ }
2238
+ if (char === "/") {
2239
+ if (lastSlash === index - 1 || dots === 1) ;
2240
+ else if (dots === 2) {
2241
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2242
+ if (res.length > 2) {
2243
+ const lastSlashIndex = res.lastIndexOf("/");
2244
+ if (lastSlashIndex === -1) {
2245
+ res = "";
2246
+ lastSegmentLength = 0;
2247
+ } else {
2248
+ res = res.slice(0, lastSlashIndex);
2249
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2250
+ }
2251
+ lastSlash = index;
2252
+ dots = 0;
2253
+ continue;
2254
+ } else if (res.length > 0) {
2255
+ res = "";
2256
+ lastSegmentLength = 0;
2257
+ lastSlash = index;
2258
+ dots = 0;
2259
+ continue;
2260
+ }
2261
+ }
2262
+ if (allowAboveRoot) {
2263
+ res += res.length > 0 ? "/.." : "..";
2264
+ lastSegmentLength = 2;
2265
+ }
2266
+ } else {
2267
+ if (res.length > 0) {
2268
+ res += `/${path.slice(lastSlash + 1, index)}`;
2269
+ } else {
2270
+ res = path.slice(lastSlash + 1, index);
2271
+ }
2272
+ lastSegmentLength = index - lastSlash - 1;
2273
+ }
2274
+ lastSlash = index;
2275
+ dots = 0;
2276
+ } else if (char === "." && dots !== -1) {
2277
+ ++dots;
2278
+ } else {
2279
+ dots = -1;
2280
+ }
2281
+ }
2282
+ return res;
2283
+ }
2284
+ var isAbsolute = function(p) {
2285
+ return _IS_ABSOLUTE_RE.test(p);
2286
+ };
2287
+ var toNamespacedPath = function(p) {
2288
+ return normalizeWindowsPath(p);
2289
+ };
2290
+ var extname = function(p) {
2291
+ if (p === "..") return "";
2292
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
2293
+ return match && match[1] || "";
2294
+ };
2295
+ var relative = function(from, to) {
2296
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
2297
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
2298
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
2299
+ return _to.join("/");
2300
+ }
2301
+ const _fromCopy = [..._from];
2302
+ for (const segment of _fromCopy) {
2303
+ if (_to[0] !== segment) {
2304
+ break;
2305
+ }
2306
+ _from.shift();
2307
+ _to.shift();
2308
+ }
2309
+ return [..._from.map(() => ".."), ..._to].join("/");
2310
+ };
2311
+ var dirname = function(p) {
2312
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
2313
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
2314
+ segments[0] += "/";
2315
+ }
2316
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
2317
+ };
2318
+ var format = function(p) {
2319
+ const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
2320
+ const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
2321
+ Boolean
2322
+ );
2323
+ return normalizeWindowsPath(
2324
+ p.root ? resolve(...segments) : segments.join("/")
2325
+ );
2326
+ };
2327
+ var basename = function(p, extension) {
2328
+ const segments = normalizeWindowsPath(p).split("/");
2329
+ let lastSegment = "";
2330
+ for (let i = segments.length - 1; i >= 0; i--) {
2331
+ const val = segments[i];
2332
+ if (val) {
2333
+ lastSegment = val;
2334
+ break;
2335
+ }
2336
+ }
2337
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
2338
+ };
2339
+ var parse = function(p) {
2340
+ const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
2341
+ const base = basename(p);
2342
+ const extension = extname(base);
2343
+ return {
2344
+ root,
2345
+ dir: dirname(p),
2346
+ base,
2347
+ ext: extension,
2348
+ name: base.slice(0, base.length - extension.length)
2349
+ };
2350
+ };
2351
+ var matchesGlob = (path, pattern) => {
2352
+ return zeptomatch(pattern, normalize(path));
2353
+ };
2354
+ var _path = {
2355
+ __proto__: null,
2356
+ basename,
2357
+ dirname,
2358
+ extname,
2359
+ format,
2360
+ isAbsolute,
2361
+ join,
2362
+ matchesGlob,
2363
+ normalize,
2364
+ normalizeString,
2365
+ parse,
2366
+ relative,
2367
+ resolve,
2368
+ sep,
2369
+ toNamespacedPath
2370
+ };
2371
+
2372
+ // node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
2373
+ var delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
2374
+ var _platforms = { posix: void 0, win32: void 0 };
2375
+ var mix = (del = delimiter) => {
2376
+ return new Proxy(_path, {
2377
+ get(_, prop) {
2378
+ if (prop === "delimiter") return del;
2379
+ if (prop === "posix") return posix;
2380
+ if (prop === "win32") return win32;
2381
+ return _platforms[prop] || _path[prop];
2382
+ }
2383
+ });
2384
+ };
2385
+ var posix = /* @__PURE__ */ mix(":");
2386
+ var win32 = /* @__PURE__ */ mix(";");
1972
2387
  var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
1973
2388
  var { loadEnvConfig } = nextEnv__namespace.default || nextEnv__namespace;
1974
2389
  async function loadEnvironmentConfig(dir, dev) {
@@ -1990,7 +2405,7 @@ async function loadClosestPackageJson(dir, attempts = 1) {
1990
2405
  const mainPath = attempts === 1 ? ["."] : new Array(attempts).fill("..");
1991
2406
  try {
1992
2407
  const file = await fs3__default.default.promises.readFile(
1993
- path2.join(dir, ...mainPath, "package.json"),
2408
+ join(dir, ...mainPath, "package.json"),
1994
2409
  "utf8"
1995
2410
  );
1996
2411
  return JSON.parse(file);
@@ -2003,8 +2418,8 @@ function findNextDirectories(dir) {
2003
2418
  return findPagesDir_js.findPagesDir(dir);
2004
2419
  } catch (e) {
2005
2420
  return {
2006
- appDir: path2__default.default.join(dir, "app"),
2007
- pagesDir: path2__default.default.join(dir, "pages")
2421
+ appDir: posix.join(dir, "app"),
2422
+ pagesDir: posix.join(dir, "pages")
2008
2423
  };
2009
2424
  }
2010
2425
  }
@@ -2013,7 +2428,7 @@ function findNextDirectories(dir) {
2013
2428
  async function vitePluginNextEnv(rootDir, nextConfigResolver) {
2014
2429
  let envConfig;
2015
2430
  let isDev;
2016
- const resolvedDir = path2.resolve(rootDir);
2431
+ const resolvedDir = resolve(rootDir);
2017
2432
  let getDefineEnv;
2018
2433
  let isNext1540 = false;
2019
2434
  try {
@@ -2260,7 +2675,7 @@ function vitePluginNextFont() {
2260
2675
  return config;
2261
2676
  },
2262
2677
  async resolveId(source, importer) {
2263
- const cwd = process.cwd();
2678
+ const cwd2 = process.cwd();
2264
2679
  if (!includePattern.test(source) || !importer) {
2265
2680
  return null;
2266
2681
  }
@@ -2276,7 +2691,7 @@ function vitePluginNextFont() {
2276
2691
  return null;
2277
2692
  }
2278
2693
  let fontFaceDeclaration;
2279
- const pathSep = path2__default.default.sep;
2694
+ const pathSep = posix.sep;
2280
2695
  if (sourceWithoutQuery.endsWith(
2281
2696
  ["next", "font", "google", "target.css"].join(pathSep)
2282
2697
  )) {
@@ -2285,17 +2700,17 @@ function vitePluginNextFont() {
2285
2700
  if (sourceWithoutQuery.endsWith(
2286
2701
  ["next", "font", "local", "target.css"].join(pathSep)
2287
2702
  )) {
2288
- const importerDirPath = path2__default.default.dirname(fontOptions.filename);
2703
+ const importerDirPath = posix.dirname(fontOptions.filename);
2289
2704
  const emitFont = async (importerRelativeFontPath) => {
2290
- const fontExtension = path2__default.default.extname(importerRelativeFontPath);
2291
- const fontBaseName = path2__default.default.basename(
2705
+ const fontExtension = posix.extname(importerRelativeFontPath);
2706
+ const fontBaseName = posix.basename(
2292
2707
  importerRelativeFontPath,
2293
2708
  fontExtension
2294
2709
  );
2295
- const fontPath = path2__default.default.join(importerDirPath, importerRelativeFontPath);
2710
+ const fontPath = posix.join(importerDirPath, importerRelativeFontPath);
2296
2711
  if (devMode) {
2297
2712
  return {
2298
- fontPath: path2__default.default.join(cwd, fontPath),
2713
+ fontPath: posix.join(cwd2, fontPath),
2299
2714
  fontReferenceId: void 0
2300
2715
  };
2301
2716
  }
@@ -2542,7 +2957,7 @@ var getVitestSWCTransformConfig = ({
2542
2957
  swcPlugins: nextConfig.experimental.swcPlugins,
2543
2958
  compiler: nextConfig?.compiler,
2544
2959
  esm: isEsmProject,
2545
- swcCacheDir: path2__default.default.join(
2960
+ swcCacheDir: posix.join(
2546
2961
  rootDir,
2547
2962
  nextConfig.distDir ?? ".next",
2548
2963
  "cache",
@@ -2555,7 +2970,7 @@ var getVitestSWCTransformConfig = ({
2555
2970
  ...baseOptions,
2556
2971
  fontLoaders: {
2557
2972
  fontLoaders: ["next/font/local", "next/font/google"],
2558
- relativeFilePathFromRoot: path2__default.default.relative(rootDir, filename)
2973
+ relativeFilePathFromRoot: posix.relative(rootDir, filename)
2559
2974
  },
2560
2975
  cjsRequireOptimizer: {
2561
2976
  packages: {
@@ -2614,7 +3029,7 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
2614
3029
  let isDev;
2615
3030
  let isEsmProject;
2616
3031
  const filter = vite.createFilter(included, excluded);
2617
- const resolvedDir = path2.resolve(rootDir);
3032
+ const resolvedDir = resolve(rootDir);
2618
3033
  return {
2619
3034
  name: "vite-plugin-storybook-nextjs-swc",
2620
3035
  enforce: "pre",
@@ -2673,13 +3088,13 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
2673
3088
  // src/polyfills/promise-with-resolvers.ts
2674
3089
  if (typeof Promise.withResolvers === "undefined") {
2675
3090
  Promise.withResolvers = () => {
2676
- let resolve5;
3091
+ let resolve2;
2677
3092
  let reject;
2678
3093
  const promise = new Promise((res, rej) => {
2679
- resolve5 = res;
3094
+ resolve2 = res;
2680
3095
  reject = rej;
2681
3096
  });
2682
- return { promise, resolve: resolve5, reject };
3097
+ return { promise, resolve: resolve2, reject };
2683
3098
  };
2684
3099
  }
2685
3100
  var vitePluginNextDynamic = () => ({
@@ -2714,11 +3129,11 @@ var getNextjsVersion = () => require3(scopedResolve("next/package.json")).versio
2714
3129
  var scopedResolve = (id) => {
2715
3130
  let scopedModulePath;
2716
3131
  try {
2717
- scopedModulePath = require3.resolve(id, { paths: [posix.resolve()] });
3132
+ scopedModulePath = require3.resolve(id, { paths: [resolve()] });
2718
3133
  } catch (e) {
2719
3134
  scopedModulePath = require3.resolve(id);
2720
3135
  }
2721
- const idWithNativePathSep = id.replace(/\//g, posix.sep);
3136
+ const idWithNativePathSep = id.replace(/\//g, sep);
2722
3137
  if (scopedModulePath.endsWith(idWithNativePathSep)) {
2723
3138
  return scopedModulePath;
2724
3139
  }
@@ -2769,8 +3184,8 @@ function vitePluginNextImage(nextConfigResolver) {
2769
3184
  return null;
2770
3185
  }
2771
3186
  if (includePattern2.test(source) && !excludeImporterPattern.test(importer ?? "") && !importer?.startsWith(virtualImage)) {
2772
- const isAbsolute = path2__default.default.isAbsolute(id);
2773
- const imagePath = importer ? isAbsolute ? source : path2__default.default.join(path2__default.default.dirname(importer), source) : source;
3187
+ const isAbsolute2 = posix.isAbsolute(id);
3188
+ const imagePath = importer ? isAbsolute2 ? source : posix.join(posix.dirname(importer), source) : source;
2774
3189
  return `${virtualImage}?${querystring.encode({ imagePath })}`;
2775
3190
  }
2776
3191
  if (id === "next/image" && importer !== virtualNextImage) {
@@ -2918,7 +3333,7 @@ var loadConfig = (
2918
3333
  function VitePlugin({
2919
3334
  dir = process.cwd()
2920
3335
  } = {}) {
2921
- const resolvedDir = path2.resolve(dir);
3336
+ const resolvedDir = resolve(dir);
2922
3337
  const nextConfigResolver = Promise.withResolvers();
2923
3338
  return [
2924
3339
  tsconfigPaths__default.default({ root: resolvedDir }),