@storybook/react 11.0.0-beta.0 → 11.0.0-beta.2

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 (37) hide show
  1. package/dist/_browser-chunks/{chunk-2TQVKMJE.js → chunk-EA5DV32Q.js} +36 -1
  2. package/dist/_browser-chunks/{chunk-EZD3TIPB.js → chunk-I62VTYU3.js} +17 -4
  3. package/dist/_browser-chunks/{chunk-7QIM3PHH.js → chunk-U7XUEUFQ.js} +3 -3
  4. package/dist/_browser-chunks/{chunk-LGSTPTL6.js → chunk-WWHCZJWM.js} +10 -9
  5. package/dist/_node-chunks/{chunk-27VFNEPI.js → chunk-2DNUEB5U.js} +6798 -15258
  6. package/dist/_node-chunks/chunk-ASUAJQT5.js +63 -0
  7. package/dist/_node-chunks/chunk-BWU7O3KC.js +61 -0
  8. package/dist/_node-chunks/chunk-DW2HJ23M.js +1674 -0
  9. package/dist/_node-chunks/chunk-PXKXGEPO.js +6643 -0
  10. package/dist/_node-chunks/chunk-QRCEILHM.js +93 -0
  11. package/dist/_node-chunks/chunk-TP7UUO2M.js +18 -0
  12. package/dist/_node-chunks/chunk-VQBUQHU3.js +33 -0
  13. package/dist/_node-chunks/chunk-XIFLZILW.js +65 -0
  14. package/dist/_node-chunks/chunk-XQPV7U3R.js +1395 -0
  15. package/dist/_node-chunks/extractArgTypesFromComponentFile-PKEIPQGN.js +44 -0
  16. package/dist/_node-chunks/extractReactDocgenInfo-J6CKNSQN.js +59 -0
  17. package/dist/_node-chunks/extractReactTypescriptDocgenInfo-AJTC3KA3.js +105 -0
  18. package/dist/_node-chunks/reactDocgen-YAGNM6ZQ.js +26 -0
  19. package/dist/builder-docgen.d.ts +51 -0
  20. package/dist/builder-docgen.js +25 -0
  21. package/dist/{chunk-DwM7QKaD.d.ts → chunk-6b3AvPEC.d.ts} +66 -1
  22. package/dist/docgen/docgen-worker.js +23 -87
  23. package/dist/entry-preview-argtypes.js +1 -1
  24. package/dist/entry-preview-docs.js +1 -1
  25. package/dist/entry-preview.js +1 -1
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +4 -4
  28. package/dist/preset.js +79 -1363
  29. package/dist/preview.d.ts +1 -1
  30. package/dist/preview.js +4 -4
  31. package/package.json +21 -6
  32. package/template/cli/js/Button.stories.js +11 -10
  33. package/template/cli/js/Header.stories.js +6 -5
  34. package/template/cli/js/Page.stories.js +6 -5
  35. package/template/cli/ts/Button.stories.ts +11 -14
  36. package/template/cli/ts/Header.stories.ts +6 -9
  37. package/template/cli/ts/Page.stories.ts +6 -9
package/dist/preset.js CHANGED
@@ -1,1223 +1,48 @@
1
- import CJS_COMPAT_NODE_URL_z12wrn40ro from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_z12wrn40ro from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_z12wrn40ro from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0pbco1v5vos from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0pbco1v5vos from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0pbco1v5vos from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_z12wrn40ro.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_z12wrn40ro.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_z12wrn40ro.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0pbco1v5vos.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0pbco1v5vos.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0pbco1v5vos.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
- ComponentMetaManager,
14
- __commonJS,
15
- __toESM,
13
+ REACT_BUILDER_DOCGEN_PACKAGES
14
+ } from "./_node-chunks/chunk-XIFLZILW.js";
15
+ import {
16
+ getSharedComponentMetaManager
17
+ } from "./_node-chunks/chunk-VQBUQHU3.js";
18
+ import {
16
19
  buildReactComponentDocgenFromResolved,
17
20
  buildStoryDocsFromResolved,
18
- cachedReadFileSync,
19
- extractArgTypes,
20
21
  getCodeSnippet,
21
- invalidateCache,
22
22
  invalidateParser,
23
23
  isAbsolute,
24
24
  join,
25
- parseWithReactDocgen,
26
25
  posix,
27
26
  resolveStoryFileComponents
28
- } from "./_node-chunks/chunk-27VFNEPI.js";
29
-
30
- // ../../../node_modules/semver/internal/constants.js
31
- var require_constants = __commonJS({
32
- "../../../node_modules/semver/internal/constants.js"(exports, module) {
33
- "use strict";
34
- var SEMVER_SPEC_VERSION = "2.0.0", MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
35
- 9007199254740991, MAX_SAFE_COMPONENT_LENGTH = 16, MAX_SAFE_BUILD_LENGTH = 250, RELEASE_TYPES = [
36
- "major",
37
- "premajor",
38
- "minor",
39
- "preminor",
40
- "patch",
41
- "prepatch",
42
- "prerelease"
43
- ];
44
- module.exports = {
45
- MAX_LENGTH: 256,
46
- MAX_SAFE_COMPONENT_LENGTH,
47
- MAX_SAFE_BUILD_LENGTH,
48
- MAX_SAFE_INTEGER,
49
- RELEASE_TYPES,
50
- SEMVER_SPEC_VERSION,
51
- FLAG_INCLUDE_PRERELEASE: 1,
52
- FLAG_LOOSE: 2
53
- };
54
- }
55
- });
56
-
57
- // ../../../node_modules/semver/internal/debug.js
58
- var require_debug = __commonJS({
59
- "../../../node_modules/semver/internal/debug.js"(exports, module) {
60
- "use strict";
61
- var debug = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
62
- };
63
- module.exports = debug;
64
- }
65
- });
66
-
67
- // ../../../node_modules/semver/internal/re.js
68
- var require_re = __commonJS({
69
- "../../../node_modules/semver/internal/re.js"(exports, module) {
70
- "use strict";
71
- var {
72
- MAX_SAFE_COMPONENT_LENGTH,
73
- MAX_SAFE_BUILD_LENGTH,
74
- MAX_LENGTH
75
- } = require_constants(), debug = require_debug();
76
- exports = module.exports = {};
77
- var re = exports.re = [], safeRe = exports.safeRe = [], src = exports.src = [], safeSrc = exports.safeSrc = [], t = exports.t = {}, R = 0, LETTERDASHNUMBER = "[a-zA-Z0-9-]", safeRegexReplacements = [
78
- ["\\s", 1],
79
- ["\\d", MAX_LENGTH],
80
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
81
- ], makeSafeRegex = (value) => {
82
- for (let [token, max] of safeRegexReplacements)
83
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
84
- return value;
85
- }, createToken = (name, value, isGlobal) => {
86
- let safe = makeSafeRegex(value), index = R++;
87
- debug(name, index, value), t[name] = index, src[index] = value, safeSrc[index] = safe, re[index] = new RegExp(value, isGlobal ? "g" : void 0), safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
88
- };
89
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
90
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
91
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
92
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
93
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
94
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
95
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
96
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
97
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
98
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
99
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
100
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
101
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
102
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
103
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
104
- createToken("GTLT", "((?:<|>)?=?)");
105
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
106
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
107
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
108
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
109
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
110
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
111
- createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
112
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
113
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
114
- createToken("COERCERTL", src[t.COERCE], !0);
115
- createToken("COERCERTLFULL", src[t.COERCEFULL], !0);
116
- createToken("LONETILDE", "(?:~>?)");
117
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, !0);
118
- exports.tildeTrimReplace = "$1~";
119
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
120
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
121
- createToken("LONECARET", "(?:\\^)");
122
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, !0);
123
- exports.caretTrimReplace = "$1^";
124
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
125
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
126
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
127
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
128
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, !0);
129
- exports.comparatorTrimReplace = "$1$2$3";
130
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
131
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
132
- createToken("STAR", "(<|>)?=?\\s*\\*");
133
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
134
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
135
- }
136
- });
137
-
138
- // ../../../node_modules/semver/internal/parse-options.js
139
- var require_parse_options = __commonJS({
140
- "../../../node_modules/semver/internal/parse-options.js"(exports, module) {
141
- "use strict";
142
- var looseOption = Object.freeze({ loose: !0 }), emptyOpts = Object.freeze({}), parseOptions = (options) => options ? typeof options != "object" ? looseOption : options : emptyOpts;
143
- module.exports = parseOptions;
144
- }
145
- });
146
-
147
- // ../../../node_modules/semver/internal/identifiers.js
148
- var require_identifiers = __commonJS({
149
- "../../../node_modules/semver/internal/identifiers.js"(exports, module) {
150
- "use strict";
151
- var numeric = /^[0-9]+$/, compareIdentifiers = (a, b) => {
152
- if (typeof a == "number" && typeof b == "number")
153
- return a === b ? 0 : a < b ? -1 : 1;
154
- let anum = numeric.test(a), bnum = numeric.test(b);
155
- return anum && bnum && (a = +a, b = +b), a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
156
- }, rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
157
- module.exports = {
158
- compareIdentifiers,
159
- rcompareIdentifiers
160
- };
161
- }
162
- });
163
-
164
- // ../../../node_modules/semver/classes/semver.js
165
- var require_semver = __commonJS({
166
- "../../../node_modules/semver/classes/semver.js"(exports, module) {
167
- "use strict";
168
- var debug = require_debug(), { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants(), { safeRe: re, t } = require_re(), parseOptions = require_parse_options(), { compareIdentifiers } = require_identifiers(), isPrereleaseIdentifier = (prerelease, identifier) => {
169
- let identifiers = identifier.split(".");
170
- if (identifiers.length > prerelease.length)
171
- return !1;
172
- for (let i = 0; i < identifiers.length; i++)
173
- if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0)
174
- return !1;
175
- return !0;
176
- }, SemVer = class _SemVer {
177
- constructor(version, options) {
178
- if (options = parseOptions(options), version instanceof _SemVer) {
179
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease)
180
- return version;
181
- version = version.version;
182
- } else if (typeof version != "string")
183
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
184
- if (version.length > MAX_LENGTH)
185
- throw new TypeError(
186
- `version is longer than ${MAX_LENGTH} characters`
187
- );
188
- debug("SemVer", version, options), this.options = options, this.loose = !!options.loose, this.includePrerelease = !!options.includePrerelease;
189
- let m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
190
- if (!m)
191
- throw new TypeError(`Invalid Version: ${version}`);
192
- if (this.raw = version, this.major = +m[1], this.minor = +m[2], this.patch = +m[3], this.major > MAX_SAFE_INTEGER || this.major < 0)
193
- throw new TypeError("Invalid major version");
194
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
195
- throw new TypeError("Invalid minor version");
196
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
197
- throw new TypeError("Invalid patch version");
198
- m[4] ? this.prerelease = m[4].split(".").map((id) => {
199
- if (/^[0-9]+$/.test(id)) {
200
- let num = +id;
201
- if (num >= 0 && num < MAX_SAFE_INTEGER)
202
- return num;
203
- }
204
- return id;
205
- }) : this.prerelease = [], this.build = m[5] ? m[5].split(".") : [], this.format();
206
- }
207
- format() {
208
- return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
209
- }
210
- toString() {
211
- return this.version;
212
- }
213
- compare(other) {
214
- if (debug("SemVer.compare", this.version, this.options, other), !(other instanceof _SemVer)) {
215
- if (typeof other == "string" && other === this.version)
216
- return 0;
217
- other = new _SemVer(other, this.options);
218
- }
219
- return other.version === this.version ? 0 : this.compareMain(other) || this.comparePre(other);
220
- }
221
- compareMain(other) {
222
- return other instanceof _SemVer || (other = new _SemVer(other, this.options)), this.major < other.major ? -1 : this.major > other.major ? 1 : this.minor < other.minor ? -1 : this.minor > other.minor ? 1 : this.patch < other.patch ? -1 : this.patch > other.patch ? 1 : 0;
223
- }
224
- comparePre(other) {
225
- if (other instanceof _SemVer || (other = new _SemVer(other, this.options)), this.prerelease.length && !other.prerelease.length)
226
- return -1;
227
- if (!this.prerelease.length && other.prerelease.length)
228
- return 1;
229
- if (!this.prerelease.length && !other.prerelease.length)
230
- return 0;
231
- let i = 0;
232
- do {
233
- let a = this.prerelease[i], b = other.prerelease[i];
234
- if (debug("prerelease compare", i, a, b), a === void 0 && b === void 0)
235
- return 0;
236
- if (b === void 0)
237
- return 1;
238
- if (a === void 0)
239
- return -1;
240
- if (a === b)
241
- continue;
242
- return compareIdentifiers(a, b);
243
- } while (++i);
244
- }
245
- compareBuild(other) {
246
- other instanceof _SemVer || (other = new _SemVer(other, this.options));
247
- let i = 0;
248
- do {
249
- let a = this.build[i], b = other.build[i];
250
- if (debug("build compare", i, a, b), a === void 0 && b === void 0)
251
- return 0;
252
- if (b === void 0)
253
- return 1;
254
- if (a === void 0)
255
- return -1;
256
- if (a === b)
257
- continue;
258
- return compareIdentifiers(a, b);
259
- } while (++i);
260
- }
261
- // preminor will bump the version up to the next minor release, and immediately
262
- // down to pre-release. premajor and prepatch work the same way.
263
- inc(release, identifier, identifierBase) {
264
- if (release.startsWith("pre")) {
265
- if (!identifier && identifierBase === !1)
266
- throw new Error("invalid increment argument: identifier is empty");
267
- if (identifier) {
268
- let match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
269
- if (!match || match[1] !== identifier)
270
- throw new Error(`invalid identifier: ${identifier}`);
271
- }
272
- }
273
- switch (release) {
274
- case "premajor":
275
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", identifier, identifierBase);
276
- break;
277
- case "preminor":
278
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", identifier, identifierBase);
279
- break;
280
- case "prepatch":
281
- this.prerelease.length = 0, this.inc("patch", identifier, identifierBase), this.inc("pre", identifier, identifierBase);
282
- break;
283
- // If the input is a non-prerelease version, this acts the same as
284
- // prepatch.
285
- case "prerelease":
286
- this.prerelease.length === 0 && this.inc("patch", identifier, identifierBase), this.inc("pre", identifier, identifierBase);
287
- break;
288
- case "release":
289
- if (this.prerelease.length === 0)
290
- throw new Error(`version ${this.raw} is not a prerelease`);
291
- this.prerelease.length = 0;
292
- break;
293
- case "major":
294
- (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
295
- break;
296
- case "minor":
297
- (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
298
- break;
299
- case "patch":
300
- this.prerelease.length === 0 && this.patch++, this.prerelease = [];
301
- break;
302
- // This probably shouldn't be used publicly.
303
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
304
- case "pre": {
305
- let base = Number(identifierBase) ? 1 : 0;
306
- if (this.prerelease.length === 0)
307
- this.prerelease = [base];
308
- else {
309
- let i = this.prerelease.length;
310
- for (; --i >= 0; )
311
- typeof this.prerelease[i] == "number" && (this.prerelease[i]++, i = -2);
312
- if (i === -1) {
313
- if (identifier === this.prerelease.join(".") && identifierBase === !1)
314
- throw new Error("invalid increment argument: identifier already exists");
315
- this.prerelease.push(base);
316
- }
317
- }
318
- if (identifier) {
319
- let prerelease = [identifier, base];
320
- if (identifierBase === !1 && (prerelease = [identifier]), isPrereleaseIdentifier(this.prerelease, identifier)) {
321
- let prereleaseBase = this.prerelease[identifier.split(".").length];
322
- isNaN(prereleaseBase) && (this.prerelease = prerelease);
323
- } else
324
- this.prerelease = prerelease;
325
- }
326
- break;
327
- }
328
- default:
329
- throw new Error(`invalid increment argument: ${release}`);
330
- }
331
- return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
332
- }
333
- };
334
- module.exports = SemVer;
335
- }
336
- });
337
-
338
- // ../../../node_modules/semver/functions/parse.js
339
- var require_parse = __commonJS({
340
- "../../../node_modules/semver/functions/parse.js"(exports, module) {
341
- "use strict";
342
- var SemVer = require_semver(), parse2 = (version, options, throwErrors = !1) => {
343
- if (version instanceof SemVer)
344
- return version;
345
- try {
346
- return new SemVer(version, options);
347
- } catch (er) {
348
- if (!throwErrors)
349
- return null;
350
- throw er;
351
- }
352
- };
353
- module.exports = parse2;
354
- }
355
- });
356
-
357
- // ../../../node_modules/semver/functions/valid.js
358
- var require_valid = __commonJS({
359
- "../../../node_modules/semver/functions/valid.js"(exports, module) {
360
- "use strict";
361
- var parse2 = require_parse(), valid = (version, options) => {
362
- let v = parse2(version, options);
363
- return v ? v.version : null;
364
- };
365
- module.exports = valid;
366
- }
367
- });
368
-
369
- // ../../../node_modules/semver/functions/clean.js
370
- var require_clean = __commonJS({
371
- "../../../node_modules/semver/functions/clean.js"(exports, module) {
372
- "use strict";
373
- var parse2 = require_parse(), clean = (version, options) => {
374
- let s = parse2(version.trim().replace(/^[=v]+/, ""), options);
375
- return s ? s.version : null;
376
- };
377
- module.exports = clean;
378
- }
379
- });
380
-
381
- // ../../../node_modules/semver/functions/inc.js
382
- var require_inc = __commonJS({
383
- "../../../node_modules/semver/functions/inc.js"(exports, module) {
384
- "use strict";
385
- var SemVer = require_semver(), inc = (version, release, options, identifier, identifierBase) => {
386
- typeof options == "string" && (identifierBase = identifier, identifier = options, options = void 0);
387
- try {
388
- return new SemVer(
389
- version instanceof SemVer ? version.version : version,
390
- options
391
- ).inc(release, identifier, identifierBase).version;
392
- } catch {
393
- return null;
394
- }
395
- };
396
- module.exports = inc;
397
- }
398
- });
399
-
400
- // ../../../node_modules/semver/functions/diff.js
401
- var require_diff = __commonJS({
402
- "../../../node_modules/semver/functions/diff.js"(exports, module) {
403
- "use strict";
404
- var parse2 = require_parse(), diff = (version1, version2) => {
405
- let v1 = parse2(version1, null, !0), v2 = parse2(version2, null, !0), comparison = v1.compare(v2);
406
- if (comparison === 0)
407
- return null;
408
- let v1Higher = comparison > 0, highVersion = v1Higher ? v1 : v2, lowVersion = v1Higher ? v2 : v1, highHasPre = !!highVersion.prerelease.length;
409
- if (!!lowVersion.prerelease.length && !highHasPre) {
410
- if (!lowVersion.patch && !lowVersion.minor)
411
- return "major";
412
- if (lowVersion.compareMain(highVersion) === 0)
413
- return lowVersion.minor && !lowVersion.patch ? "minor" : "patch";
414
- }
415
- let prefix = highHasPre ? "pre" : "";
416
- return v1.major !== v2.major ? prefix + "major" : v1.minor !== v2.minor ? prefix + "minor" : v1.patch !== v2.patch ? prefix + "patch" : "prerelease";
417
- };
418
- module.exports = diff;
419
- }
420
- });
421
-
422
- // ../../../node_modules/semver/functions/major.js
423
- var require_major = __commonJS({
424
- "../../../node_modules/semver/functions/major.js"(exports, module) {
425
- "use strict";
426
- var SemVer = require_semver(), major = (a, loose) => new SemVer(a, loose).major;
427
- module.exports = major;
428
- }
429
- });
430
-
431
- // ../../../node_modules/semver/functions/minor.js
432
- var require_minor = __commonJS({
433
- "../../../node_modules/semver/functions/minor.js"(exports, module) {
434
- "use strict";
435
- var SemVer = require_semver(), minor = (a, loose) => new SemVer(a, loose).minor;
436
- module.exports = minor;
437
- }
438
- });
439
-
440
- // ../../../node_modules/semver/functions/patch.js
441
- var require_patch = __commonJS({
442
- "../../../node_modules/semver/functions/patch.js"(exports, module) {
443
- "use strict";
444
- var SemVer = require_semver(), patch = (a, loose) => new SemVer(a, loose).patch;
445
- module.exports = patch;
446
- }
447
- });
448
-
449
- // ../../../node_modules/semver/functions/prerelease.js
450
- var require_prerelease = __commonJS({
451
- "../../../node_modules/semver/functions/prerelease.js"(exports, module) {
452
- "use strict";
453
- var parse2 = require_parse(), prerelease = (version, options) => {
454
- let parsed = parse2(version, options);
455
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
456
- };
457
- module.exports = prerelease;
458
- }
459
- });
460
-
461
- // ../../../node_modules/semver/functions/compare.js
462
- var require_compare = __commonJS({
463
- "../../../node_modules/semver/functions/compare.js"(exports, module) {
464
- "use strict";
465
- var SemVer = require_semver(), compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
466
- module.exports = compare;
467
- }
468
- });
469
-
470
- // ../../../node_modules/semver/functions/rcompare.js
471
- var require_rcompare = __commonJS({
472
- "../../../node_modules/semver/functions/rcompare.js"(exports, module) {
473
- "use strict";
474
- var compare = require_compare(), rcompare = (a, b, loose) => compare(b, a, loose);
475
- module.exports = rcompare;
476
- }
477
- });
478
-
479
- // ../../../node_modules/semver/functions/compare-loose.js
480
- var require_compare_loose = __commonJS({
481
- "../../../node_modules/semver/functions/compare-loose.js"(exports, module) {
482
- "use strict";
483
- var compare = require_compare(), compareLoose = (a, b) => compare(a, b, !0);
484
- module.exports = compareLoose;
485
- }
486
- });
487
-
488
- // ../../../node_modules/semver/functions/compare-build.js
489
- var require_compare_build = __commonJS({
490
- "../../../node_modules/semver/functions/compare-build.js"(exports, module) {
491
- "use strict";
492
- var SemVer = require_semver(), compareBuild = (a, b, loose) => {
493
- let versionA = new SemVer(a, loose), versionB = new SemVer(b, loose);
494
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
495
- };
496
- module.exports = compareBuild;
497
- }
498
- });
499
-
500
- // ../../../node_modules/semver/functions/sort.js
501
- var require_sort = __commonJS({
502
- "../../../node_modules/semver/functions/sort.js"(exports, module) {
503
- "use strict";
504
- var compareBuild = require_compare_build(), sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
505
- module.exports = sort;
506
- }
507
- });
508
-
509
- // ../../../node_modules/semver/functions/rsort.js
510
- var require_rsort = __commonJS({
511
- "../../../node_modules/semver/functions/rsort.js"(exports, module) {
512
- "use strict";
513
- var compareBuild = require_compare_build(), rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
514
- module.exports = rsort;
515
- }
516
- });
517
-
518
- // ../../../node_modules/semver/functions/gt.js
519
- var require_gt = __commonJS({
520
- "../../../node_modules/semver/functions/gt.js"(exports, module) {
521
- "use strict";
522
- var compare = require_compare(), gt = (a, b, loose) => compare(a, b, loose) > 0;
523
- module.exports = gt;
524
- }
525
- });
526
-
527
- // ../../../node_modules/semver/functions/lt.js
528
- var require_lt = __commonJS({
529
- "../../../node_modules/semver/functions/lt.js"(exports, module) {
530
- "use strict";
531
- var compare = require_compare(), lt = (a, b, loose) => compare(a, b, loose) < 0;
532
- module.exports = lt;
533
- }
534
- });
535
-
536
- // ../../../node_modules/semver/functions/eq.js
537
- var require_eq = __commonJS({
538
- "../../../node_modules/semver/functions/eq.js"(exports, module) {
539
- "use strict";
540
- var compare = require_compare(), eq = (a, b, loose) => compare(a, b, loose) === 0;
541
- module.exports = eq;
542
- }
543
- });
544
-
545
- // ../../../node_modules/semver/functions/neq.js
546
- var require_neq = __commonJS({
547
- "../../../node_modules/semver/functions/neq.js"(exports, module) {
548
- "use strict";
549
- var compare = require_compare(), neq = (a, b, loose) => compare(a, b, loose) !== 0;
550
- module.exports = neq;
551
- }
552
- });
553
-
554
- // ../../../node_modules/semver/functions/gte.js
555
- var require_gte = __commonJS({
556
- "../../../node_modules/semver/functions/gte.js"(exports, module) {
557
- "use strict";
558
- var compare = require_compare(), gte = (a, b, loose) => compare(a, b, loose) >= 0;
559
- module.exports = gte;
560
- }
561
- });
562
-
563
- // ../../../node_modules/semver/functions/lte.js
564
- var require_lte = __commonJS({
565
- "../../../node_modules/semver/functions/lte.js"(exports, module) {
566
- "use strict";
567
- var compare = require_compare(), lte = (a, b, loose) => compare(a, b, loose) <= 0;
568
- module.exports = lte;
569
- }
570
- });
571
-
572
- // ../../../node_modules/semver/functions/cmp.js
573
- var require_cmp = __commonJS({
574
- "../../../node_modules/semver/functions/cmp.js"(exports, module) {
575
- "use strict";
576
- var eq = require_eq(), neq = require_neq(), gt = require_gt(), gte = require_gte(), lt = require_lt(), lte = require_lte(), cmp = (a, op, b, loose) => {
577
- switch (op) {
578
- case "===":
579
- return typeof a == "object" && (a = a.version), typeof b == "object" && (b = b.version), a === b;
580
- case "!==":
581
- return typeof a == "object" && (a = a.version), typeof b == "object" && (b = b.version), a !== b;
582
- case "":
583
- case "=":
584
- case "==":
585
- return eq(a, b, loose);
586
- case "!=":
587
- return neq(a, b, loose);
588
- case ">":
589
- return gt(a, b, loose);
590
- case ">=":
591
- return gte(a, b, loose);
592
- case "<":
593
- return lt(a, b, loose);
594
- case "<=":
595
- return lte(a, b, loose);
596
- default:
597
- throw new TypeError(`Invalid operator: ${op}`);
598
- }
599
- };
600
- module.exports = cmp;
601
- }
602
- });
603
-
604
- // ../../../node_modules/semver/functions/coerce.js
605
- var require_coerce = __commonJS({
606
- "../../../node_modules/semver/functions/coerce.js"(exports, module) {
607
- "use strict";
608
- var SemVer = require_semver(), parse2 = require_parse(), { safeRe: re, t } = require_re(), coerce = (version, options) => {
609
- if (version instanceof SemVer)
610
- return version;
611
- if (typeof version == "number" && (version = String(version)), typeof version != "string")
612
- return null;
613
- options = options || {};
614
- let match = null;
615
- if (!options.rtl)
616
- match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
617
- else {
618
- let coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL], next;
619
- for (; (next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length); )
620
- (!match || next.index + next[0].length !== match.index + match[0].length) && (match = next), coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
621
- coerceRtlRegex.lastIndex = -1;
622
- }
623
- if (match === null)
624
- return null;
625
- let major = match[2], minor = match[3] || "0", patch = match[4] || "0", prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "", build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
626
- return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
627
- };
628
- module.exports = coerce;
629
- }
630
- });
631
-
632
- // ../../../node_modules/semver/functions/truncate.js
633
- var require_truncate = __commonJS({
634
- "../../../node_modules/semver/functions/truncate.js"(exports, module) {
635
- "use strict";
636
- var parse2 = require_parse(), constants = require_constants(), SemVer = require_semver(), truncate = (version, truncation, options) => {
637
- if (!constants.RELEASE_TYPES.includes(truncation))
638
- return null;
639
- let clonedVersion = cloneInputVersion(version, options);
640
- return clonedVersion && doTruncation(clonedVersion, truncation);
641
- }, cloneInputVersion = (version, options) => {
642
- let versionStringToParse = version instanceof SemVer ? version.version : version;
643
- return parse2(versionStringToParse, options);
644
- }, doTruncation = (version, truncation) => {
645
- if (isPrerelease(truncation))
646
- return version.version;
647
- switch (version.prerelease = [], truncation) {
648
- case "major":
649
- version.minor = 0, version.patch = 0;
650
- break;
651
- case "minor":
652
- version.patch = 0;
653
- break;
654
- }
655
- return version.format();
656
- }, isPrerelease = (type) => type.startsWith("pre");
657
- module.exports = truncate;
658
- }
659
- });
660
-
661
- // ../../../node_modules/semver/internal/lrucache.js
662
- var require_lrucache = __commonJS({
663
- "../../../node_modules/semver/internal/lrucache.js"(exports, module) {
664
- "use strict";
665
- var LRUCache = class {
666
- constructor() {
667
- this.max = 1e3, this.map = /* @__PURE__ */ new Map();
668
- }
669
- get(key) {
670
- let value = this.map.get(key);
671
- if (value !== void 0)
672
- return this.map.delete(key), this.map.set(key, value), value;
673
- }
674
- delete(key) {
675
- return this.map.delete(key);
676
- }
677
- set(key, value) {
678
- if (!this.delete(key) && value !== void 0) {
679
- if (this.map.size >= this.max) {
680
- let firstKey = this.map.keys().next().value;
681
- this.delete(firstKey);
682
- }
683
- this.map.set(key, value);
684
- }
685
- return this;
686
- }
687
- };
688
- module.exports = LRUCache;
689
- }
690
- });
691
-
692
- // ../../../node_modules/semver/classes/range.js
693
- var require_range = __commonJS({
694
- "../../../node_modules/semver/classes/range.js"(exports, module) {
695
- "use strict";
696
- var SPACE_CHARACTERS = /\s+/g, Range = class _Range {
697
- constructor(range, options) {
698
- if (options = parseOptions(options), range instanceof _Range)
699
- return range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease ? range : new _Range(range.raw, options);
700
- if (range instanceof Comparator)
701
- return this.raw = range.value, this.set = [[range]], this.formatted = void 0, this;
702
- if (this.options = options, this.loose = !!options.loose, this.includePrerelease = !!options.includePrerelease, this.raw = range.trim().replace(SPACE_CHARACTERS, " "), this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length), !this.set.length)
703
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
704
- if (this.set.length > 1) {
705
- let first = this.set[0];
706
- if (this.set = this.set.filter((c) => !isNullSet(c[0])), this.set.length === 0)
707
- this.set = [first];
708
- else if (this.set.length > 1) {
709
- for (let c of this.set)
710
- if (c.length === 1 && isAny(c[0])) {
711
- this.set = [c];
712
- break;
713
- }
714
- }
715
- }
716
- this.formatted = void 0;
717
- }
718
- get range() {
719
- if (this.formatted === void 0) {
720
- this.formatted = "";
721
- for (let i = 0; i < this.set.length; i++) {
722
- i > 0 && (this.formatted += "||");
723
- let comps = this.set[i];
724
- for (let k = 0; k < comps.length; k++)
725
- k > 0 && (this.formatted += " "), this.formatted += comps[k].toString().trim();
726
- }
727
- }
728
- return this.formatted;
729
- }
730
- format() {
731
- return this.range;
732
- }
733
- toString() {
734
- return this.range;
735
- }
736
- parseRange(range) {
737
- range = range.replace(BUILDSTRIPRE, "");
738
- let memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range, cached = cache.get(memoKey);
739
- if (cached)
740
- return cached;
741
- let loose = this.options.loose, hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
742
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease)), debug("hyphen replace", range), range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace), debug("comparator trim", range), range = range.replace(re[t.TILDETRIM], tildeTrimReplace), debug("tilde trim", range), range = range.replace(re[t.CARETTRIM], caretTrimReplace), debug("caret trim", range);
743
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
744
- loose && (rangeList = rangeList.filter((comp) => (debug("loose invalid filter", comp, this.options), !!comp.match(re[t.COMPARATORLOOSE])))), debug("range list", rangeList);
745
- let rangeMap = /* @__PURE__ */ new Map(), comparators = rangeList.map((comp) => new Comparator(comp, this.options));
746
- for (let comp of comparators) {
747
- if (isNullSet(comp))
748
- return [comp];
749
- rangeMap.set(comp.value, comp);
750
- }
751
- rangeMap.size > 1 && rangeMap.has("") && rangeMap.delete("");
752
- let result = [...rangeMap.values()];
753
- return cache.set(memoKey, result), result;
754
- }
755
- intersects(range, options) {
756
- if (!(range instanceof _Range))
757
- throw new TypeError("a Range is required");
758
- return this.set.some((thisComparators) => isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => rangeComparators.every((rangeComparator) => thisComparator.intersects(rangeComparator, options)))));
759
- }
760
- // if ANY of the sets match ALL of its comparators, then pass
761
- test(version) {
762
- if (!version)
763
- return !1;
764
- if (typeof version == "string")
765
- try {
766
- version = new SemVer(version, this.options);
767
- } catch {
768
- return !1;
769
- }
770
- for (let i = 0; i < this.set.length; i++)
771
- if (testSet(this.set[i], version, this.options))
772
- return !0;
773
- return !1;
774
- }
775
- };
776
- module.exports = Range;
777
- var LRU = require_lrucache(), cache = new LRU(), parseOptions = require_parse_options(), Comparator = require_comparator(), debug = require_debug(), SemVer = require_semver(), {
778
- safeRe: re,
779
- src,
780
- t,
781
- comparatorTrimReplace,
782
- tildeTrimReplace,
783
- caretTrimReplace
784
- } = require_re(), { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants(), BUILDSTRIPRE = new RegExp(src[t.BUILD], "g"), isNullSet = (c) => c.value === "<0.0.0-0", isAny = (c) => c.value === "", isSatisfiable = (comparators, options) => {
785
- let result = !0, remainingComparators = comparators.slice(), testComparator = remainingComparators.pop();
786
- for (; result && remainingComparators.length; )
787
- result = remainingComparators.every((otherComparator) => testComparator.intersects(otherComparator, options)), testComparator = remainingComparators.pop();
788
- return result;
789
- }, parseComparator = (comp, options) => (comp = comp.replace(re[t.BUILD], ""), debug("comp", comp, options), comp = replaceCarets(comp, options), debug("caret", comp), comp = replaceTildes(comp, options), debug("tildes", comp), comp = replaceXRanges(comp, options), debug("xrange", comp), comp = replaceStars(comp, options), debug("stars", comp), comp), isX = (id) => !id || id.toLowerCase() === "x" || id === "*", invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p), replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" "), replaceTilde = (comp, options) => {
790
- let r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE], z = options.includePrerelease ? "-0" : "";
791
- return comp.replace(r, (_, M, m, p, pr) => {
792
- debug("tilde", comp, _, M, m, p, pr);
793
- let ret;
794
- return isX(M) ? ret = "" : isX(m) ? ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` : isX(p) ? ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` : pr ? (debug("replaceTilde pr", pr), ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`) : ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`, debug("tilde return", ret), ret;
795
- });
796
- }, replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "), replaceCaret = (comp, options) => {
797
- debug("caret", comp, options);
798
- let r = options.loose ? re[t.CARETLOOSE] : re[t.CARET], z = options.includePrerelease ? "-0" : "";
799
- return comp.replace(r, (_, M, m, p, pr) => {
800
- debug("caret", comp, _, M, m, p, pr);
801
- let ret;
802
- return isX(M) ? ret = "" : isX(m) ? ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` : isX(p) ? M === "0" ? ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` : pr ? (debug("replaceCaret pr", pr), M === "0" ? m === "0" ? ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0` : ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`) : (debug("no pr"), M === "0" ? m === "0" ? ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0` : ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`), debug("caret return", ret), ret;
803
- });
804
- }, replaceXRanges = (comp, options) => (debug("replaceXRanges", comp, options), comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ")), replaceXRange = (comp, options) => {
805
- comp = comp.trim();
806
- let r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
807
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
808
- if (debug("xRange", comp, ret, gtlt, M, m, p, pr), invalidXRangeOrder(M, m, p))
809
- return comp;
810
- let xM = isX(M), xm = xM || isX(m), xp = xm || isX(p), anyX = xp;
811
- return gtlt === "=" && anyX && (gtlt = ""), pr = options.includePrerelease ? "-0" : "", xM ? gtlt === ">" || gtlt === "<" ? ret = "<0.0.0-0" : ret = "*" : gtlt && anyX ? (xm && (m = 0), p = 0, gtlt === ">" ? (gtlt = ">=", xm ? (M = +M + 1, m = 0, p = 0) : (m = +m + 1, p = 0)) : gtlt === "<=" && (gtlt = "<", xm ? M = +M + 1 : m = +m + 1), gtlt === "<" && (pr = "-0"), ret = `${gtlt + M}.${m}.${p}${pr}`) : xm ? ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` : xp && (ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`), debug("xRange return", ret), ret;
812
- });
813
- }, replaceStars = (comp, options) => (debug("replaceStars", comp, options), comp.trim().replace(re[t.STAR], "")), replaceGTE0 = (comp, options) => (debug("replaceGTE0", comp, options), comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "")), hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => (isX(fM) ? from = "" : isX(fm) ? from = `>=${fM}.0.0${incPr ? "-0" : ""}` : isX(fp) ? from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}` : fpr ? from = `>=${from}` : from = `>=${from}${incPr ? "-0" : ""}`, isX(tM) ? to = "" : isX(tm) ? to = `<${+tM + 1}.0.0-0` : isX(tp) ? to = `<${tM}.${+tm + 1}.0-0` : tpr ? to = `<=${tM}.${tm}.${tp}-${tpr}` : incPr ? to = `<${tM}.${tm}.${+tp + 1}-0` : to = `<=${to}`, `${from} ${to}`.trim()), testSet = (set, version, options) => {
814
- for (let i = 0; i < set.length; i++)
815
- if (!set[i].test(version))
816
- return !1;
817
- if (version.prerelease.length && !options.includePrerelease) {
818
- for (let i = 0; i < set.length; i++)
819
- if (debug(set[i].semver), set[i].semver !== Comparator.ANY && set[i].semver.prerelease.length > 0) {
820
- let allowed = set[i].semver;
821
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch)
822
- return !0;
823
- }
824
- return !1;
825
- }
826
- return !0;
827
- };
828
- }
829
- });
830
-
831
- // ../../../node_modules/semver/classes/comparator.js
832
- var require_comparator = __commonJS({
833
- "../../../node_modules/semver/classes/comparator.js"(exports, module) {
834
- "use strict";
835
- var ANY = /* @__PURE__ */ Symbol("SemVer ANY"), Comparator = class _Comparator {
836
- static get ANY() {
837
- return ANY;
838
- }
839
- constructor(comp, options) {
840
- if (options = parseOptions(options), comp instanceof _Comparator) {
841
- if (comp.loose === !!options.loose)
842
- return comp;
843
- comp = comp.value;
844
- }
845
- comp = comp.trim().split(/\s+/).join(" "), debug("comparator", comp, options), this.options = options, this.loose = !!options.loose, this.parse(comp), this.semver === ANY ? this.value = "" : this.value = this.operator + this.semver.version, debug("comp", this);
846
- }
847
- parse(comp) {
848
- let r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR], m = comp.match(r);
849
- if (!m)
850
- throw new TypeError(`Invalid comparator: ${comp}`);
851
- this.operator = m[1] !== void 0 ? m[1] : "", this.operator === "=" && (this.operator = ""), m[2] ? this.semver = new SemVer(m[2], this.options.loose) : this.semver = ANY;
852
- }
853
- toString() {
854
- return this.value;
855
- }
856
- test(version) {
857
- if (debug("Comparator.test", version, this.options.loose), this.semver === ANY || version === ANY)
858
- return !0;
859
- if (typeof version == "string")
860
- try {
861
- version = new SemVer(version, this.options);
862
- } catch {
863
- return !1;
864
- }
865
- return cmp(version, this.operator, this.semver, this.options);
866
- }
867
- intersects(comp, options) {
868
- if (!(comp instanceof _Comparator))
869
- throw new TypeError("a Comparator is required");
870
- return this.operator === "" ? this.value === "" ? !0 : new Range(comp.value, options).test(this.value) : comp.operator === "" ? comp.value === "" ? !0 : new Range(this.value, options).test(comp.semver) : (options = parseOptions(options), options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0") || !options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && comp.operator.startsWith(">") || this.operator.startsWith("<") && comp.operator.startsWith("<") || this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=") || cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<") || cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")));
871
- }
872
- };
873
- module.exports = Comparator;
874
- var parseOptions = require_parse_options(), { safeRe: re, t } = require_re(), cmp = require_cmp(), debug = require_debug(), SemVer = require_semver(), Range = require_range();
875
- }
876
- });
877
-
878
- // ../../../node_modules/semver/functions/satisfies.js
879
- var require_satisfies = __commonJS({
880
- "../../../node_modules/semver/functions/satisfies.js"(exports, module) {
881
- "use strict";
882
- var Range = require_range(), satisfies = (version, range, options) => {
883
- try {
884
- range = new Range(range, options);
885
- } catch {
886
- return !1;
887
- }
888
- return range.test(version);
889
- };
890
- module.exports = satisfies;
891
- }
892
- });
893
-
894
- // ../../../node_modules/semver/ranges/to-comparators.js
895
- var require_to_comparators = __commonJS({
896
- "../../../node_modules/semver/ranges/to-comparators.js"(exports, module) {
897
- "use strict";
898
- var Range = require_range(), toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
899
- module.exports = toComparators;
900
- }
901
- });
902
-
903
- // ../../../node_modules/semver/ranges/max-satisfying.js
904
- var require_max_satisfying = __commonJS({
905
- "../../../node_modules/semver/ranges/max-satisfying.js"(exports, module) {
906
- "use strict";
907
- var SemVer = require_semver(), Range = require_range(), maxSatisfying = (versions, range, options) => {
908
- let max = null, maxSV = null, rangeObj = null;
909
- try {
910
- rangeObj = new Range(range, options);
911
- } catch {
912
- return null;
913
- }
914
- return versions.forEach((v) => {
915
- rangeObj.test(v) && (!max || maxSV.compare(v) === -1) && (max = v, maxSV = new SemVer(max, options));
916
- }), max;
917
- };
918
- module.exports = maxSatisfying;
919
- }
920
- });
921
-
922
- // ../../../node_modules/semver/ranges/min-satisfying.js
923
- var require_min_satisfying = __commonJS({
924
- "../../../node_modules/semver/ranges/min-satisfying.js"(exports, module) {
925
- "use strict";
926
- var SemVer = require_semver(), Range = require_range(), minSatisfying = (versions, range, options) => {
927
- let min = null, minSV = null, rangeObj = null;
928
- try {
929
- rangeObj = new Range(range, options);
930
- } catch {
931
- return null;
932
- }
933
- return versions.forEach((v) => {
934
- rangeObj.test(v) && (!min || minSV.compare(v) === 1) && (min = v, minSV = new SemVer(min, options));
935
- }), min;
936
- };
937
- module.exports = minSatisfying;
938
- }
939
- });
940
-
941
- // ../../../node_modules/semver/ranges/min-version.js
942
- var require_min_version = __commonJS({
943
- "../../../node_modules/semver/ranges/min-version.js"(exports, module) {
944
- "use strict";
945
- var SemVer = require_semver(), Range = require_range(), gt = require_gt(), minVersion = (range, loose) => {
946
- range = new Range(range, loose);
947
- let minver = new SemVer("0.0.0");
948
- if (range.test(minver) || (minver = new SemVer("0.0.0-0"), range.test(minver)))
949
- return minver;
950
- minver = null;
951
- for (let i = 0; i < range.set.length; ++i) {
952
- let comparators = range.set[i], setMin = null;
953
- comparators.forEach((comparator) => {
954
- let compver = new SemVer(comparator.semver.version);
955
- switch (comparator.operator) {
956
- case ">":
957
- compver.prerelease.length === 0 ? compver.patch++ : compver.prerelease.push(0), compver.raw = compver.format();
958
- /* fallthrough */
959
- case "":
960
- case ">=":
961
- (!setMin || gt(compver, setMin)) && (setMin = compver);
962
- break;
963
- case "<":
964
- case "<=":
965
- break;
966
- /* istanbul ignore next */
967
- default:
968
- throw new Error(`Unexpected operation: ${comparator.operator}`);
969
- }
970
- }), setMin && (!minver || gt(minver, setMin)) && (minver = setMin);
971
- }
972
- return minver && range.test(minver) ? minver : null;
973
- };
974
- module.exports = minVersion;
975
- }
976
- });
977
-
978
- // ../../../node_modules/semver/ranges/valid.js
979
- var require_valid2 = __commonJS({
980
- "../../../node_modules/semver/ranges/valid.js"(exports, module) {
981
- "use strict";
982
- var Range = require_range(), validRange = (range, options) => {
983
- try {
984
- return new Range(range, options).range || "*";
985
- } catch {
986
- return null;
987
- }
988
- };
989
- module.exports = validRange;
990
- }
991
- });
992
-
993
- // ../../../node_modules/semver/ranges/outside.js
994
- var require_outside = __commonJS({
995
- "../../../node_modules/semver/ranges/outside.js"(exports, module) {
996
- "use strict";
997
- var SemVer = require_semver(), Comparator = require_comparator(), { ANY } = Comparator, Range = require_range(), satisfies = require_satisfies(), gt = require_gt(), lt = require_lt(), lte = require_lte(), gte = require_gte(), outside = (version, range, hilo, options) => {
998
- version = new SemVer(version, options), range = new Range(range, options);
999
- let gtfn, ltefn, ltfn, comp, ecomp;
1000
- switch (hilo) {
1001
- case ">":
1002
- gtfn = gt, ltefn = lte, ltfn = lt, comp = ">", ecomp = ">=";
1003
- break;
1004
- case "<":
1005
- gtfn = lt, ltefn = gte, ltfn = gt, comp = "<", ecomp = "<=";
1006
- break;
1007
- default:
1008
- throw new TypeError('Must provide a hilo val of "<" or ">"');
1009
- }
1010
- if (satisfies(version, range, options))
1011
- return !1;
1012
- for (let i = 0; i < range.set.length; ++i) {
1013
- let comparators = range.set[i], high = null, low = null;
1014
- if (comparators.forEach((comparator) => {
1015
- comparator.semver === ANY && (comparator = new Comparator(">=0.0.0")), high = high || comparator, low = low || comparator, gtfn(comparator.semver, high.semver, options) ? high = comparator : ltfn(comparator.semver, low.semver, options) && (low = comparator);
1016
- }), high.operator === comp || high.operator === ecomp || (!low.operator || low.operator === comp) && ltefn(version, low.semver))
1017
- return !1;
1018
- if (low.operator === ecomp && ltfn(version, low.semver))
1019
- return !1;
1020
- }
1021
- return !0;
1022
- };
1023
- module.exports = outside;
1024
- }
1025
- });
1026
-
1027
- // ../../../node_modules/semver/ranges/gtr.js
1028
- var require_gtr = __commonJS({
1029
- "../../../node_modules/semver/ranges/gtr.js"(exports, module) {
1030
- "use strict";
1031
- var outside = require_outside(), gtr = (version, range, options) => outside(version, range, ">", options);
1032
- module.exports = gtr;
1033
- }
1034
- });
1035
-
1036
- // ../../../node_modules/semver/ranges/ltr.js
1037
- var require_ltr = __commonJS({
1038
- "../../../node_modules/semver/ranges/ltr.js"(exports, module) {
1039
- "use strict";
1040
- var outside = require_outside(), ltr = (version, range, options) => outside(version, range, "<", options);
1041
- module.exports = ltr;
1042
- }
1043
- });
1044
-
1045
- // ../../../node_modules/semver/ranges/intersects.js
1046
- var require_intersects = __commonJS({
1047
- "../../../node_modules/semver/ranges/intersects.js"(exports, module) {
1048
- "use strict";
1049
- var Range = require_range(), intersects = (r1, r2, options) => (r1 = new Range(r1, options), r2 = new Range(r2, options), r1.intersects(r2, options));
1050
- module.exports = intersects;
1051
- }
1052
- });
1053
-
1054
- // ../../../node_modules/semver/ranges/simplify.js
1055
- var require_simplify = __commonJS({
1056
- "../../../node_modules/semver/ranges/simplify.js"(exports, module) {
1057
- "use strict";
1058
- var satisfies = require_satisfies(), compare = require_compare();
1059
- module.exports = (versions, range, options) => {
1060
- let set = [], first = null, prev = null, v = versions.sort((a, b) => compare(a, b, options));
1061
- for (let version of v)
1062
- satisfies(version, range, options) ? (prev = version, first || (first = version)) : (prev && set.push([first, prev]), prev = null, first = null);
1063
- first && set.push([first, null]);
1064
- let ranges = [];
1065
- for (let [min, max] of set)
1066
- min === max ? ranges.push(min) : !max && min === v[0] ? ranges.push("*") : max ? min === v[0] ? ranges.push(`<=${max}`) : ranges.push(`${min} - ${max}`) : ranges.push(`>=${min}`);
1067
- let simplified = ranges.join(" || "), original = typeof range.raw == "string" ? range.raw : String(range);
1068
- return simplified.length < original.length ? simplified : range;
1069
- };
1070
- }
1071
- });
1072
-
1073
- // ../../../node_modules/semver/ranges/subset.js
1074
- var require_subset = __commonJS({
1075
- "../../../node_modules/semver/ranges/subset.js"(exports, module) {
1076
- "use strict";
1077
- var Range = require_range(), Comparator = require_comparator(), { ANY } = Comparator, satisfies = require_satisfies(), compare = require_compare(), subset = (sub, dom, options = {}) => {
1078
- if (sub === dom)
1079
- return !0;
1080
- sub = new Range(sub, options), dom = new Range(dom, options);
1081
- let sawNonNull = !1;
1082
- OUTER: for (let simpleSub of sub.set) {
1083
- for (let simpleDom of dom.set) {
1084
- let isSub = simpleSubset(simpleSub, simpleDom, options);
1085
- if (sawNonNull = sawNonNull || isSub !== null, isSub)
1086
- continue OUTER;
1087
- }
1088
- if (sawNonNull)
1089
- return !1;
1090
- }
1091
- return !0;
1092
- }, minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")], minimumVersion = [new Comparator(">=0.0.0")], simpleSubset = (sub, dom, options) => {
1093
- if (sub === dom)
1094
- return !0;
1095
- if (sub.length === 1 && sub[0].semver === ANY) {
1096
- if (dom.length === 1 && dom[0].semver === ANY)
1097
- return !0;
1098
- options.includePrerelease ? sub = minimumVersionWithPreRelease : sub = minimumVersion;
1099
- }
1100
- if (dom.length === 1 && dom[0].semver === ANY) {
1101
- if (options.includePrerelease)
1102
- return !0;
1103
- dom = minimumVersion;
1104
- }
1105
- let eqSet = /* @__PURE__ */ new Set(), gt, lt;
1106
- for (let c of sub)
1107
- c.operator === ">" || c.operator === ">=" ? gt = higherGT(gt, c, options) : c.operator === "<" || c.operator === "<=" ? lt = lowerLT(lt, c, options) : eqSet.add(c.semver);
1108
- if (eqSet.size > 1)
1109
- return null;
1110
- let gtltComp;
1111
- if (gt && lt) {
1112
- if (gtltComp = compare(gt.semver, lt.semver, options), gtltComp > 0)
1113
- return null;
1114
- if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
1115
- return null;
1116
- }
1117
- for (let eq of eqSet) {
1118
- if (gt && !satisfies(eq, String(gt), options) || lt && !satisfies(eq, String(lt), options))
1119
- return null;
1120
- for (let c of dom)
1121
- if (!satisfies(eq, String(c), options))
1122
- return !1;
1123
- return !0;
1124
- }
1125
- let higher, lower, hasDomLT, hasDomGT, needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : !1, needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : !1;
1126
- needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0 && (needDomLTPre = !1);
1127
- for (let c of dom) {
1128
- if (hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=", hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=", gt) {
1129
- if (needDomGTPre && c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch && (needDomGTPre = !1), c.operator === ">" || c.operator === ">=") {
1130
- if (higher = higherGT(gt, c, options), higher === c && higher !== gt)
1131
- return !1;
1132
- } else if (gt.operator === ">=" && !c.test(gt.semver))
1133
- return !1;
1134
- }
1135
- if (lt) {
1136
- if (needDomLTPre && c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch && (needDomLTPre = !1), c.operator === "<" || c.operator === "<=") {
1137
- if (lower = lowerLT(lt, c, options), lower === c && lower !== lt)
1138
- return !1;
1139
- } else if (lt.operator === "<=" && !c.test(lt.semver))
1140
- return !1;
1141
- }
1142
- if (!c.operator && (lt || gt) && gtltComp !== 0)
1143
- return !1;
1144
- }
1145
- return !(gt && hasDomLT && !lt && gtltComp !== 0 || lt && hasDomGT && !gt && gtltComp !== 0 || needDomGTPre || needDomLTPre);
1146
- }, higherGT = (a, b, options) => {
1147
- if (!a)
1148
- return b;
1149
- let comp = compare(a.semver, b.semver, options);
1150
- return comp > 0 ? a : comp < 0 || b.operator === ">" && a.operator === ">=" ? b : a;
1151
- }, lowerLT = (a, b, options) => {
1152
- if (!a)
1153
- return b;
1154
- let comp = compare(a.semver, b.semver, options);
1155
- return comp < 0 ? a : comp > 0 || b.operator === "<" && a.operator === "<=" ? b : a;
1156
- };
1157
- module.exports = subset;
1158
- }
1159
- });
1160
-
1161
- // ../../../node_modules/semver/index.js
1162
- var require_semver2 = __commonJS({
1163
- "../../../node_modules/semver/index.js"(exports, module) {
1164
- "use strict";
1165
- var internalRe = require_re(), constants = require_constants(), SemVer = require_semver(), identifiers = require_identifiers(), parse2 = require_parse(), valid = require_valid(), clean = require_clean(), inc = require_inc(), diff = require_diff(), major = require_major(), minor = require_minor(), patch = require_patch(), prerelease = require_prerelease(), compare = require_compare(), rcompare = require_rcompare(), compareLoose = require_compare_loose(), compareBuild = require_compare_build(), sort = require_sort(), rsort = require_rsort(), gt = require_gt(), lt = require_lt(), eq = require_eq(), neq = require_neq(), gte = require_gte(), lte = require_lte(), cmp = require_cmp(), coerce = require_coerce(), truncate = require_truncate(), Comparator = require_comparator(), Range = require_range(), satisfies = require_satisfies(), toComparators = require_to_comparators(), maxSatisfying = require_max_satisfying(), minSatisfying = require_min_satisfying(), minVersion = require_min_version(), validRange = require_valid2(), outside = require_outside(), gtr = require_gtr(), ltr = require_ltr(), intersects = require_intersects(), simplifyRange = require_simplify(), subset = require_subset();
1166
- module.exports = {
1167
- parse: parse2,
1168
- valid,
1169
- clean,
1170
- inc,
1171
- diff,
1172
- major,
1173
- minor,
1174
- patch,
1175
- prerelease,
1176
- compare,
1177
- rcompare,
1178
- compareLoose,
1179
- compareBuild,
1180
- sort,
1181
- rsort,
1182
- gt,
1183
- lt,
1184
- eq,
1185
- neq,
1186
- gte,
1187
- lte,
1188
- cmp,
1189
- coerce,
1190
- truncate,
1191
- Comparator,
1192
- Range,
1193
- satisfies,
1194
- toComparators,
1195
- maxSatisfying,
1196
- minSatisfying,
1197
- minVersion,
1198
- validRange,
1199
- outside,
1200
- gtr,
1201
- ltr,
1202
- intersects,
1203
- simplifyRange,
1204
- subset,
1205
- SemVer,
1206
- re: internalRe.re,
1207
- src: internalRe.src,
1208
- tokens: internalRe.t,
1209
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
1210
- RELEASE_TYPES: constants.RELEASE_TYPES,
1211
- compareIdentifiers: identifiers.compareIdentifiers,
1212
- rcompareIdentifiers: identifiers.rcompareIdentifiers
1213
- };
1214
- }
1215
- });
27
+ } from "./_node-chunks/chunk-PXKXGEPO.js";
28
+ import {
29
+ REACT_DOCGEN_TYPESCRIPT_APIS
30
+ } from "./_node-chunks/chunk-TP7UUO2M.js";
31
+ import {
32
+ invalidateCache
33
+ } from "./_node-chunks/chunk-DW2HJ23M.js";
34
+ import "./_node-chunks/chunk-ASUAJQT5.js";
1216
35
 
1217
36
  // src/preset.ts
1218
37
  import path2, { join as join3 } from "node:path";
1219
38
  import { fileURLToPath as fileURLToPath3 } from "node:url";
1220
- import { getProjectRoot, isTypeScriptReadyForDocgen } from "storybook/internal/common";
39
+ import {
40
+ getProjectRoot,
41
+ getTypeScriptSpecifierForDocgen as getTypeScriptSpecifierForDocgen3,
42
+ isModuleNotFoundError,
43
+ isTypeScriptReadyForDocgen
44
+ } from "storybook/internal/common";
45
+ import { logger } from "storybook/internal/node-logger";
1221
46
 
1222
47
  // ../../core/src/shared/utils/module.ts
1223
48
  import nodeModule, { createRequire } from "node:module";
@@ -1347,9 +172,6 @@ var hasOwnProperty = {}.hasOwnProperty;
1347
172
  var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty;
1348
173
  var isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
1349
174
 
1350
- // ../../core/src/shared/utils/module.ts
1351
- var import_semver = __toESM(require_semver2(), 1);
1352
-
1353
175
  // ../../core/node_modules/pathe/dist/shared/pathe.ff20891b.mjs
1354
176
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
1355
177
  function normalizeWindowsPath(input = "") {
@@ -1458,149 +280,12 @@ var reactResolveAlias = ({ react, reactDom }) => ({
1458
280
  };
1459
281
  };
1460
282
 
1461
- // src/componentManifest/reactDocgen/extractReactDocgenInfo.ts
1462
- import { logger } from "storybook/internal/node-logger";
1463
- function getComponentDocgen(filePath, componentName) {
1464
- try {
1465
- let code = cachedReadFileSync(filePath, "utf-8"), docgens = parseWithReactDocgen(code, filePath);
1466
- if (docgens.length === 0)
1467
- return null;
1468
- if (componentName) {
1469
- let matchingDocgen = docgens.find(
1470
- (docgen) => docgen.actualName === componentName || docgen.displayName === componentName || docgen.exportName === componentName
1471
- );
1472
- return matchingDocgen ? {
1473
- componentName: matchingDocgen.actualName || matchingDocgen.displayName || componentName,
1474
- reactDocgen: { type: "success", data: matchingDocgen }
1475
- } : null;
1476
- }
1477
- let firstDocgen = docgens[0];
1478
- return {
1479
- componentName: firstDocgen.actualName || firstDocgen.displayName || "Unknown",
1480
- reactDocgen: { type: "success", data: firstDocgen }
1481
- };
1482
- } catch (error) {
1483
- return logger.debug(`Error parsing component file for docgen ${filePath}: ${error}`), null;
1484
- }
1485
- }
1486
- var extractArgTypesFromDocgen = ({
1487
- componentFilePath,
1488
- componentExportName
1489
- }) => {
1490
- let docgen = getComponentDocgen(componentFilePath, componentExportName);
1491
- return !docgen || docgen.reactDocgen.type !== "success" ? null : extractArgTypes({ __docgenInfo: docgen.reactDocgen.data }) ?? {};
1492
- };
1493
-
1494
- // src/componentManifest/reactDocgen/extractReactTypescriptDocgenInfo.ts
1495
- import { logger as logger2 } from "storybook/internal/node-logger";
1496
-
1497
- // src/componentManifest/reactDocgen/utils.ts
1498
- import { findTsconfigPathForFile } from "storybook/internal/common";
1499
- import { dirname as dirname2 } from "node:path";
1500
- var REACT_NODE_TYPES = /* @__PURE__ */ new Set([
1501
- "JSX.Element",
1502
- "ComponentType",
1503
- "ReactComponentType",
1504
- "ReactElement",
1505
- "ReactReactElement",
1506
- "ElementType",
1507
- "ReactElementType",
1508
- "ReactNode",
1509
- "ReactReactNode"
1510
- ]), KNOWN_TYPE_NAMES = /* @__PURE__ */ new Set([
1511
- "boolean",
1512
- "string",
1513
- "number",
1514
- "Date",
1515
- ...REACT_NODE_TYPES,
1516
- "signature",
1517
- "union",
1518
- "Array",
1519
- "tuple",
1520
- "literal",
1521
- "null",
1522
- "void",
1523
- "any",
1524
- "unknown"
1525
- ]);
1526
- var getTsConfig = async (componentFilePath) => {
1527
- try {
1528
- let imported = await import("typescript"), ts = imported.default ?? imported, tsconfigPath = componentFilePath ? findTsconfigPathForFile(dirname2(componentFilePath), componentFilePath) : ts.findConfigFile(process.cwd(), ts.sys.fileExists);
1529
- if (tsconfigPath === void 0)
1530
- return {};
1531
- let basePath = dirname2(tsconfigPath), { config, error } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
1532
- return error ? {} : ts.parseJsonConfigFileContent(config, ts.sys, basePath, {}, tsconfigPath).options;
1533
- } catch {
1534
- return {};
1535
- }
1536
- };
1537
-
1538
- // src/componentManifest/reactDocgen/extractReactTypescriptDocgenInfo.ts
1539
- var extractArgTypesFromDocgenTypescript = async ({
1540
- componentFilePath,
1541
- componentExportName,
1542
- reactDocgenTypescriptOptions
1543
- }) => {
1544
- try {
1545
- let { withCompilerOptions } = (await import("react-docgen-typescript")).default, defaultOptions = {
1546
- shouldExtractLiteralValuesFromEnum: !0,
1547
- shouldRemoveUndefinedFromOptional: !0,
1548
- propFilter: (prop) => prop.parent ? !/node_modules/.test(prop.parent.fileName) : !0,
1549
- // We *need* this set so that RDT returns default values in the same format as react-docgen
1550
- savePropValueAsString: !0
1551
- }, tsConfig = await getTsConfig(componentFilePath), mergedOptions = {
1552
- ...defaultOptions,
1553
- ...reactDocgenTypescriptOptions,
1554
- // Always ensure savePropValueAsString is true for consistency
1555
- savePropValueAsString: !0
1556
- }, docgens = withCompilerOptions(
1557
- { ...tsConfig, noErrorTruncation: !0, strict: !0 },
1558
- mergedOptions
1559
- ).parse(componentFilePath);
1560
- if (!docgens || docgens.length === 0)
1561
- return null;
1562
- let targetDocgen = docgens[0];
1563
- if (componentExportName) {
1564
- let match = docgens.find(
1565
- (d) => d.displayName === componentExportName || d.filePath?.includes(componentExportName)
1566
- );
1567
- if (match)
1568
- targetDocgen = match;
1569
- else
1570
- return null;
1571
- }
1572
- return extractArgTypes({ __docgenInfo: targetDocgen }) ?? {};
1573
- } catch (error) {
1574
- return logger2.debug(
1575
- `Error parsing component file with react-docgen-typescript ${componentFilePath}: ${error}`
1576
- ), null;
1577
- }
1578
- };
1579
-
1580
283
  // src/componentManifest/generator.ts
1581
284
  import {
1582
285
  getStoryImportPathFromEntry,
286
+ getTypeScriptSpecifierForDocgen,
1583
287
  selectComponentEntriesByComponentId
1584
288
  } from "storybook/internal/common";
1585
-
1586
- // src/componentManifest/componentMetaManagerSingleton.ts
1587
- import { loadTypeScriptCompilerApi } from "storybook/internal/common";
1588
- import { logger as logger3 } from "storybook/internal/node-logger";
1589
- var componentMetaManagerPromise;
1590
- function getSharedComponentMetaManager() {
1591
- return componentMetaManagerPromise || (componentMetaManagerPromise = (async () => {
1592
- try {
1593
- return new ComponentMetaManager(
1594
- await loadTypeScriptCompilerApi(() => import("typescript"))
1595
- );
1596
- } catch (err) {
1597
- logger3.debug(`[reactComponentMeta] Skipping component metadata extraction: ${err}`);
1598
- return;
1599
- }
1600
- })()), componentMetaManagerPromise;
1601
- }
1602
-
1603
- // src/componentManifest/generator.ts
1604
289
  var manifests = async (existingManifests = {}, options) => {
1605
290
  let { manifestEntries, presets, watch } = options, typescriptOptions = await presets?.apply("typescript", {}) ?? {}, features2 = await presets?.apply("features", {});
1606
291
  if (features2?.docgenServer)
@@ -1614,7 +299,7 @@ var manifests = async (existingManifests = {}, options) => {
1614
299
  };
1615
300
  let docgenEngine = features2?.experimentalReactComponentMeta ? "react-component-meta" : typescriptOptions.reactDocgen || "react-docgen";
1616
301
  invalidateCache(), invalidateParser();
1617
- let startTime = performance.now(), manager = docgenEngine === "react-component-meta" ? await getSharedComponentMetaManager() : void 0, entriesByUniqueComponent = [
302
+ let startTime = performance.now(), manager = docgenEngine === "react-component-meta" ? await getSharedComponentMetaManager(await getTypeScriptSpecifierForDocgen(options)) : void 0, entriesByUniqueComponent = [
1618
303
  ...selectComponentEntriesByComponentId(manifestEntries).values()
1619
304
  ], resolvedEntries = await Promise.all(
1620
305
  entriesByUniqueComponent.map(async (entry) => {
@@ -1692,7 +377,7 @@ var enrichCsf = async (input, options) => {
1692
377
  return;
1693
378
  let { format: format3 } = await getPrettier(), code, snippet;
1694
379
  try {
1695
- code = getCodeSnippet(csfSource, key, csfSource._meta?.component).code;
380
+ code = getCodeSnippet(csfSource, key, csfSource._meta?.component).snippet;
1696
381
  } catch (e) {
1697
382
  if (!(e instanceof Error))
1698
383
  return;
@@ -1720,12 +405,14 @@ var enrichCsf = async (input, options) => {
1720
405
 
1721
406
  // src/docgen/preset.ts
1722
407
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1723
- var experimental_docgenProvider = async (existing = []) => [
1724
- ...existing,
1725
- {
1726
- moduleSpecifier: fileURLToPath2(import.meta.resolve("@storybook/react/internal/docgen-worker"))
1727
- }
1728
- ];
408
+ import { getTypeScriptSpecifierForDocgen as getTypeScriptSpecifierForDocgen2 } from "storybook/internal/common";
409
+ var experimental_docgenProvider = async (existing = [], options) => {
410
+ let descriptor = {
411
+ moduleSpecifier: fileURLToPath2(import.meta.resolve("@storybook/react/internal/docgen-worker")),
412
+ options: { typeScriptSpecifier: await getTypeScriptSpecifierForDocgen2(options) }
413
+ };
414
+ return [...existing, descriptor];
415
+ };
1729
416
 
1730
417
  // src/docgen/story-docs-preset.ts
1731
418
  import { STORY_FILE_TEST_REGEXP, getStoryImportPathFromEntry as getStoryImportPathFromEntry3 } from "storybook/internal/common";
@@ -1755,7 +442,8 @@ async function buildStoryDocsPayload(input, context) {
1755
442
  csf,
1756
443
  componentName,
1757
444
  component,
1758
- allComponents
445
+ allComponents,
446
+ withTemplate: !0
1759
447
  });
1760
448
  }
1761
449
 
@@ -1777,7 +465,13 @@ var experimental_storyDocsProvider = async (nextStoryDocs, options) => {
1777
465
  };
1778
466
 
1779
467
  // src/preset.ts
1780
- var isDocgenProviderEnabled = (_existing, options) => isTypeScriptReadyForDocgen((specifier) => import.meta.resolve(specifier), options), features = async (existing) => ({
468
+ var isDocgenProviderEnabled = async (_existing, options) => {
469
+ let { reactDocgen } = await options.presets?.apply("typescript", {}) ?? {};
470
+ return isTypeScriptReadyForDocgen((specifier) => import.meta.resolve(specifier), options, {
471
+ apis: REACT_DOCGEN_TYPESCRIPT_APIS,
472
+ builderDocgenFallback: reactDocgen === !1 ? void 0 : { packageName: "react-docgen", range: REACT_BUILDER_DOCGEN_PACKAGES["react-docgen"] }
473
+ });
474
+ }, features = async (existing) => ({
1781
475
  ...existing,
1782
476
  componentsManifest: !0
1783
477
  }), previewAnnotations = async (input = [], options) => {
@@ -1815,9 +509,18 @@ async function webpack(config = {}, options) {
1815
509
  return target ? aliasReactInWebpack(config, target) : config;
1816
510
  }
1817
511
  async function internal_getArgTypesData(_input, options) {
1818
- let { componentFilePath, componentExportName, presets } = options ?? {};
512
+ let { componentFilePath, componentExportName, presets, configDir } = options ?? {};
1819
513
  if (!componentFilePath)
1820
514
  return null;
515
+ let absoluteComponentFilePath = path2.isAbsolute(componentFilePath) ? componentFilePath : join3(getProjectRoot(), componentFilePath);
516
+ if ((await presets?.apply("features", {}))?.docgenServer) {
517
+ let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-PKEIPQGN.js");
518
+ return extractArgTypesFromComponentFile({
519
+ componentFilePath: absoluteComponentFilePath,
520
+ componentExportName,
521
+ typeScriptSpecifier: configDir && presets ? await getTypeScriptSpecifierForDocgen3({ configDir, presets }) : void 0
522
+ });
523
+ }
1821
524
  let typescriptOptions = {};
1822
525
  if (presets)
1823
526
  try {
@@ -1827,15 +530,28 @@ async function internal_getArgTypesData(_input, options) {
1827
530
  let { reactDocgen = "react-docgen", reactDocgenTypescriptOptions } = typescriptOptions;
1828
531
  if (reactDocgen === !1)
1829
532
  return null;
1830
- let resolvedFilePath = path2.isAbsolute(componentFilePath) ? componentFilePath : join3(getProjectRoot(), componentFilePath), argTypesData;
1831
- return reactDocgen === "react-docgen-typescript" ? argTypesData = await extractArgTypesFromDocgenTypescript({
1832
- componentFilePath: resolvedFilePath,
1833
- componentExportName,
1834
- reactDocgenTypescriptOptions
1835
- }) : argTypesData = extractArgTypesFromDocgen({
1836
- componentFilePath: resolvedFilePath,
1837
- componentExportName
1838
- }), argTypesData;
533
+ let argTypesData;
534
+ try {
535
+ if (reactDocgen === "react-docgen-typescript") {
536
+ let { extractArgTypesFromDocgenTypescript } = await import("./_node-chunks/extractReactTypescriptDocgenInfo-AJTC3KA3.js");
537
+ argTypesData = await extractArgTypesFromDocgenTypescript({
538
+ componentFilePath: absoluteComponentFilePath,
539
+ componentExportName,
540
+ reactDocgenTypescriptOptions
541
+ });
542
+ } else {
543
+ let { extractArgTypesFromDocgen } = await import("./_node-chunks/extractReactDocgenInfo-J6CKNSQN.js");
544
+ argTypesData = extractArgTypesFromDocgen({
545
+ componentFilePath: absoluteComponentFilePath,
546
+ componentExportName
547
+ });
548
+ }
549
+ } catch (error) {
550
+ if (!isModuleNotFoundError(error))
551
+ throw error;
552
+ return logger.debug(`Skipping arg types inference, because ${reactDocgen} is not installed: ${error}`), null;
553
+ }
554
+ return argTypesData;
1839
555
  }
1840
556
  var optimizeViteDeps = [
1841
557
  // The vitest project-annotations setup file imports this renderer's entry previews through a