@storybook/react 11.0.0-alpha.7 → 11.0.0-alpha.8
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_lya8clainfq from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_lya8clainfq from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_lya8clainfq from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_lya8clainfq.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_lya8clainfq.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_lya8clainfq.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
extractArgTypes,
|
|
16
16
|
posix,
|
|
17
17
|
resolveStoryFileComponents
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
18
|
+
} from "../_node-chunks/chunk-2ZVWQVNL.js";
|
|
19
19
|
|
|
20
20
|
// src/docgen/docgen-worker.ts
|
|
21
21
|
import { createLazyDocgenMiddleware } from "storybook/internal/common";
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_lya8clainfq from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_lya8clainfq from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_lya8clainfq from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_lya8clainfq.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_lya8clainfq.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_lya8clainfq.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -20,11 +20,12 @@ import {
|
|
|
20
20
|
getCodeSnippet,
|
|
21
21
|
invalidateCache,
|
|
22
22
|
invalidateParser,
|
|
23
|
+
isAbsolute,
|
|
23
24
|
join,
|
|
24
25
|
parseWithReactDocgen,
|
|
25
26
|
posix,
|
|
26
27
|
resolveStoryFileComponents
|
|
27
|
-
} from "./_node-chunks/chunk-
|
|
28
|
+
} from "./_node-chunks/chunk-2ZVWQVNL.js";
|
|
28
29
|
|
|
29
30
|
// ../../../node_modules/semver/internal/constants.js
|
|
30
31
|
var require_constants = __commonJS({
|
|
@@ -73,7 +74,7 @@ var require_re = __commonJS({
|
|
|
73
74
|
MAX_LENGTH
|
|
74
75
|
} = require_constants(), debug = require_debug();
|
|
75
76
|
exports = module.exports = {};
|
|
76
|
-
var re = exports.re = [], safeRe = exports.safeRe = [], src = exports.src = [], safeSrc = exports.safeSrc = [],
|
|
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 = [
|
|
77
78
|
["\\s", 1],
|
|
78
79
|
["\\d", MAX_LENGTH],
|
|
79
80
|
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
@@ -83,51 +84,51 @@ var require_re = __commonJS({
|
|
|
83
84
|
return value;
|
|
84
85
|
}, createToken = (name, value, isGlobal) => {
|
|
85
86
|
let safe = makeSafeRegex(value), index = R++;
|
|
86
|
-
debug(name, index, value),
|
|
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);
|
|
87
88
|
};
|
|
88
89
|
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
89
90
|
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
90
91
|
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
91
|
-
createToken("MAINVERSION", `(${src[
|
|
92
|
-
createToken("MAINVERSIONLOOSE", `(${src[
|
|
93
|
-
createToken("PRERELEASEIDENTIFIER", `(?:${src[
|
|
94
|
-
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[
|
|
95
|
-
createToken("PRERELEASE", `(?:-(${src[
|
|
96
|
-
createToken("PRERELEASELOOSE", `(?:-?(${src[
|
|
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]})*))`);
|
|
97
98
|
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
98
|
-
createToken("BUILD", `(?:\\+(${src[
|
|
99
|
-
createToken("FULLPLAIN", `v?${src[
|
|
100
|
-
createToken("FULL", `^${src[
|
|
101
|
-
createToken("LOOSEPLAIN", `[v=\\s]*${src[
|
|
102
|
-
createToken("LOOSE", `^${src[
|
|
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]}$`);
|
|
103
104
|
createToken("GTLT", "((?:<|>)?=?)");
|
|
104
|
-
createToken("XRANGEIDENTIFIERLOOSE", `${src[
|
|
105
|
-
createToken("XRANGEIDENTIFIER", `${src[
|
|
106
|
-
createToken("XRANGEPLAIN", `[v=\\s]*(${src[
|
|
107
|
-
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[
|
|
108
|
-
createToken("XRANGE", `^${src[
|
|
109
|
-
createToken("XRANGELOOSE", `^${src[
|
|
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]}$`);
|
|
110
111
|
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
111
|
-
createToken("COERCE", `${src[
|
|
112
|
-
createToken("COERCEFULL", src[
|
|
113
|
-
createToken("COERCERTL", src[
|
|
114
|
-
createToken("COERCERTLFULL", src[
|
|
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);
|
|
115
116
|
createToken("LONETILDE", "(?:~>?)");
|
|
116
|
-
createToken("TILDETRIM", `(\\s*)${src[
|
|
117
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, !0);
|
|
117
118
|
exports.tildeTrimReplace = "$1~";
|
|
118
|
-
createToken("TILDE", `^${src[
|
|
119
|
-
createToken("TILDELOOSE", `^${src[
|
|
119
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
120
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
120
121
|
createToken("LONECARET", "(?:\\^)");
|
|
121
|
-
createToken("CARETTRIM", `(\\s*)${src[
|
|
122
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, !0);
|
|
122
123
|
exports.caretTrimReplace = "$1^";
|
|
123
|
-
createToken("CARET", `^${src[
|
|
124
|
-
createToken("CARETLOOSE", `^${src[
|
|
125
|
-
createToken("COMPARATORLOOSE", `^${src[
|
|
126
|
-
createToken("COMPARATOR", `^${src[
|
|
127
|
-
createToken("COMPARATORTRIM", `(\\s*)${src[
|
|
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);
|
|
128
129
|
exports.comparatorTrimReplace = "$1$2$3";
|
|
129
|
-
createToken("HYPHENRANGE", `^\\s*(${src[
|
|
130
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[
|
|
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*$`);
|
|
131
132
|
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
132
133
|
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
133
134
|
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
@@ -164,7 +165,7 @@ var require_identifiers = __commonJS({
|
|
|
164
165
|
var require_semver = __commonJS({
|
|
165
166
|
"../../../node_modules/semver/classes/semver.js"(exports, module) {
|
|
166
167
|
"use strict";
|
|
167
|
-
var debug = require_debug(), { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants(), { safeRe: re, t
|
|
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) => {
|
|
168
169
|
let identifiers = identifier.split(".");
|
|
169
170
|
if (identifiers.length > prerelease.length)
|
|
170
171
|
return !1;
|
|
@@ -185,7 +186,7 @@ var require_semver = __commonJS({
|
|
|
185
186
|
`version is longer than ${MAX_LENGTH} characters`
|
|
186
187
|
);
|
|
187
188
|
debug("SemVer", version, options), this.options = options, this.loose = !!options.loose, this.includePrerelease = !!options.includePrerelease;
|
|
188
|
-
let m = version.trim().match(options.loose ? re[
|
|
189
|
+
let m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
189
190
|
if (!m)
|
|
190
191
|
throw new TypeError(`Invalid Version: ${version}`);
|
|
191
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)
|
|
@@ -264,7 +265,7 @@ var require_semver = __commonJS({
|
|
|
264
265
|
if (!identifier && identifierBase === !1)
|
|
265
266
|
throw new Error("invalid increment argument: identifier is empty");
|
|
266
267
|
if (identifier) {
|
|
267
|
-
let match = `-${identifier}`.match(this.options.loose ? re[
|
|
268
|
+
let match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
268
269
|
if (!match || match[1] !== identifier)
|
|
269
270
|
throw new Error(`invalid identifier: ${identifier}`);
|
|
270
271
|
}
|
|
@@ -604,7 +605,7 @@ var require_cmp = __commonJS({
|
|
|
604
605
|
var require_coerce = __commonJS({
|
|
605
606
|
"../../../node_modules/semver/functions/coerce.js"(exports, module) {
|
|
606
607
|
"use strict";
|
|
607
|
-
var SemVer = require_semver(), parse2 = require_parse(), { safeRe: re, t
|
|
608
|
+
var SemVer = require_semver(), parse2 = require_parse(), { safeRe: re, t } = require_re(), coerce = (version, options) => {
|
|
608
609
|
if (version instanceof SemVer)
|
|
609
610
|
return version;
|
|
610
611
|
if (typeof version == "number" && (version = String(version)), typeof version != "string")
|
|
@@ -612,9 +613,9 @@ var require_coerce = __commonJS({
|
|
|
612
613
|
options = options || {};
|
|
613
614
|
let match = null;
|
|
614
615
|
if (!options.rtl)
|
|
615
|
-
match = version.match(options.includePrerelease ? re[
|
|
616
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
616
617
|
else {
|
|
617
|
-
let coerceRtlRegex = options.includePrerelease ? re[
|
|
618
|
+
let coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL], next;
|
|
618
619
|
for (; (next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length); )
|
|
619
620
|
(!match || next.index + next[0].length !== match.index + match[0].length) && (match = next), coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
620
621
|
coerceRtlRegex.lastIndex = -1;
|
|
@@ -737,10 +738,10 @@ var require_range = __commonJS({
|
|
|
737
738
|
let memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range, cached = cache.get(memoKey);
|
|
738
739
|
if (cached)
|
|
739
740
|
return cached;
|
|
740
|
-
let loose = this.options.loose, hr = loose ? re[
|
|
741
|
-
range = range.replace(hr, hyphenReplace(this.options.includePrerelease)), debug("hyphen replace", range), range = range.replace(re[
|
|
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);
|
|
742
743
|
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
743
|
-
loose && (rangeList = rangeList.filter((comp) => (debug("loose invalid filter", comp, this.options), !!comp.match(re[
|
|
744
|
+
loose && (rangeList = rangeList.filter((comp) => (debug("loose invalid filter", comp, this.options), !!comp.match(re[t.COMPARATORLOOSE])))), debug("range list", rangeList);
|
|
744
745
|
let rangeMap = /* @__PURE__ */ new Map(), comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
745
746
|
for (let comp of comparators) {
|
|
746
747
|
if (isNullSet(comp))
|
|
@@ -776,17 +777,17 @@ var require_range = __commonJS({
|
|
|
776
777
|
var LRU = require_lrucache(), cache = new LRU(), parseOptions = require_parse_options(), Comparator = require_comparator(), debug = require_debug(), SemVer = require_semver(), {
|
|
777
778
|
safeRe: re,
|
|
778
779
|
src,
|
|
779
|
-
t
|
|
780
|
+
t,
|
|
780
781
|
comparatorTrimReplace,
|
|
781
782
|
tildeTrimReplace,
|
|
782
783
|
caretTrimReplace
|
|
783
|
-
} = require_re(), { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants(), BUILDSTRIPRE = new RegExp(src[
|
|
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) => {
|
|
784
785
|
let result = !0, remainingComparators = comparators.slice(), testComparator = remainingComparators.pop();
|
|
785
786
|
for (; result && remainingComparators.length; )
|
|
786
787
|
result = remainingComparators.every((otherComparator) => testComparator.intersects(otherComparator, options)), testComparator = remainingComparators.pop();
|
|
787
788
|
return result;
|
|
788
|
-
}, parseComparator = (comp, options) => (comp = comp.replace(re[
|
|
789
|
-
let r = options.loose ? re[
|
|
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" : "";
|
|
790
791
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
791
792
|
debug("tilde", comp, _, M, m, p, pr);
|
|
792
793
|
let ret;
|
|
@@ -794,7 +795,7 @@ var require_range = __commonJS({
|
|
|
794
795
|
});
|
|
795
796
|
}, replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "), replaceCaret = (comp, options) => {
|
|
796
797
|
debug("caret", comp, options);
|
|
797
|
-
let r = options.loose ? re[
|
|
798
|
+
let r = options.loose ? re[t.CARETLOOSE] : re[t.CARET], z = options.includePrerelease ? "-0" : "";
|
|
798
799
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
799
800
|
debug("caret", comp, _, M, m, p, pr);
|
|
800
801
|
let ret;
|
|
@@ -802,14 +803,14 @@ var require_range = __commonJS({
|
|
|
802
803
|
});
|
|
803
804
|
}, replaceXRanges = (comp, options) => (debug("replaceXRanges", comp, options), comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ")), replaceXRange = (comp, options) => {
|
|
804
805
|
comp = comp.trim();
|
|
805
|
-
let r = options.loose ? re[
|
|
806
|
+
let r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
806
807
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
807
808
|
if (debug("xRange", comp, ret, gtlt, M, m, p, pr), invalidXRangeOrder(M, m, p))
|
|
808
809
|
return comp;
|
|
809
810
|
let xM = isX(M), xm = xM || isX(m), xp = xm || isX(p), anyX = xp;
|
|
810
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;
|
|
811
812
|
});
|
|
812
|
-
}, replaceStars = (comp, options) => (debug("replaceStars", comp, options), comp.trim().replace(re[
|
|
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) => {
|
|
813
814
|
for (let i = 0; i < set.length; i++)
|
|
814
815
|
if (!set[i].test(version))
|
|
815
816
|
return !1;
|
|
@@ -844,7 +845,7 @@ var require_comparator = __commonJS({
|
|
|
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);
|
|
845
846
|
}
|
|
846
847
|
parse(comp) {
|
|
847
|
-
let r = this.options.loose ? re[
|
|
848
|
+
let r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR], m = comp.match(r);
|
|
848
849
|
if (!m)
|
|
849
850
|
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
850
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;
|
|
@@ -870,7 +871,7 @@ var require_comparator = __commonJS({
|
|
|
870
871
|
}
|
|
871
872
|
};
|
|
872
873
|
module.exports = Comparator;
|
|
873
|
-
var parseOptions = require_parse_options(), { safeRe: re, t
|
|
874
|
+
var parseOptions = require_parse_options(), { safeRe: re, t } = require_re(), cmp = require_cmp(), debug = require_debug(), SemVer = require_semver(), Range = require_range();
|
|
874
875
|
}
|
|
875
876
|
});
|
|
876
877
|
|
|
@@ -1359,8 +1360,8 @@ var normalize = function(path3) {
|
|
|
1359
1360
|
if (path3.length === 0)
|
|
1360
1361
|
return ".";
|
|
1361
1362
|
path3 = normalizeWindowsPath(path3);
|
|
1362
|
-
let isUNCPath = path3.match(_UNC_REGEX), isPathAbsolute =
|
|
1363
|
-
return path3 = normalizeString(path3, !isPathAbsolute), path3.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path3 += "/"), _DRIVE_LETTER_RE.test(path3) && (path3 += "/"), isUNCPath ? isPathAbsolute ? `//${path3}` : `//./${path3}` : isPathAbsolute && !
|
|
1363
|
+
let isUNCPath = path3.match(_UNC_REGEX), isPathAbsolute = isAbsolute2(path3), trailingSeparator = path3[path3.length - 1] === "/";
|
|
1364
|
+
return path3 = normalizeString(path3, !isPathAbsolute), path3.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path3 += "/"), _DRIVE_LETTER_RE.test(path3) && (path3 += "/"), isUNCPath ? isPathAbsolute ? `//${path3}` : `//./${path3}` : isPathAbsolute && !isAbsolute2(path3) ? `/${path3}` : path3);
|
|
1364
1365
|
}, join2 = function(...arguments_) {
|
|
1365
1366
|
if (arguments_.length === 0)
|
|
1366
1367
|
return ".";
|
|
@@ -1399,12 +1400,12 @@ function normalizeString(path3, allowAboveRoot) {
|
|
|
1399
1400
|
}
|
|
1400
1401
|
return res;
|
|
1401
1402
|
}
|
|
1402
|
-
var
|
|
1403
|
+
var isAbsolute2 = function(p) {
|
|
1403
1404
|
return _IS_ABSOLUTE_RE.test(p);
|
|
1404
1405
|
};
|
|
1405
1406
|
var dirname = function(p) {
|
|
1406
1407
|
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
1407
|
-
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (
|
|
1408
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
1408
1409
|
};
|
|
1409
1410
|
|
|
1410
1411
|
// ../../core/src/shared/utils/module.ts
|
|
@@ -1423,6 +1424,40 @@ var importMetaResolve = (...args) => typeof import.meta.resolve != "function" &&
|
|
|
1423
1424
|
}
|
|
1424
1425
|
};
|
|
1425
1426
|
|
|
1427
|
+
// src/preview-react-alias.ts
|
|
1428
|
+
var reactResolveAlias = ({ react, reactDom }) => ({
|
|
1429
|
+
react,
|
|
1430
|
+
...isAbsolute(reactDom) ? { "react-dom/server": `${reactDom}/server.browser.js` } : {},
|
|
1431
|
+
"react-dom": reactDom
|
|
1432
|
+
}), reactViteAlias = ({ react, reactDom }) => [
|
|
1433
|
+
...isAbsolute(reactDom) ? [{ find: /^react-dom\/server$/, replacement: `${reactDom}/server.browser.js` }] : [],
|
|
1434
|
+
{ find: /^react-dom(\/.*)?$/, replacement: `${reactDom}$1` },
|
|
1435
|
+
{ find: /^react(\/.*)?$/, replacement: `${react}$1` }
|
|
1436
|
+
], reactDedupeVitePlugin = (target) => ({
|
|
1437
|
+
name: "storybook:react-dedupe",
|
|
1438
|
+
enforce: "pre",
|
|
1439
|
+
config: () => ({
|
|
1440
|
+
resolve: {
|
|
1441
|
+
alias: reactViteAlias(target)
|
|
1442
|
+
}
|
|
1443
|
+
})
|
|
1444
|
+
}), prependReactDedupePlugin = (config, target) => ({
|
|
1445
|
+
...config,
|
|
1446
|
+
plugins: [reactDedupeVitePlugin(target), ...config.plugins ?? []]
|
|
1447
|
+
}), aliasReactInWebpack = (config, target) => {
|
|
1448
|
+
let alias = reactResolveAlias(target), current = config.resolve?.alias, nextAlias = Array.isArray(current) ? [
|
|
1449
|
+
...current,
|
|
1450
|
+
...Object.entries(alias).map(([name, aliasPath]) => ({ name, alias: aliasPath }))
|
|
1451
|
+
] : { ...current, ...alias };
|
|
1452
|
+
return {
|
|
1453
|
+
...config,
|
|
1454
|
+
resolve: {
|
|
1455
|
+
...config.resolve,
|
|
1456
|
+
alias: nextAlias
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1426
1461
|
// src/componentManifest/reactDocgen/extractReactDocgenInfo.ts
|
|
1427
1462
|
import { logger } from "storybook/internal/node-logger";
|
|
1428
1463
|
function getComponentDocgen(filePath, componentName) {
|
|
@@ -1645,7 +1680,6 @@ var manifests = async (existingManifests = {}, options) => {
|
|
|
1645
1680
|
};
|
|
1646
1681
|
|
|
1647
1682
|
// src/enrichCsf.ts
|
|
1648
|
-
import { recast, types as t } from "storybook/internal/babel";
|
|
1649
1683
|
import { getPrettier } from "storybook/internal/common";
|
|
1650
1684
|
var enrichCsf = async (input, options) => {
|
|
1651
1685
|
let features2 = await options.presets.apply("features");
|
|
@@ -1654,16 +1688,16 @@ var enrichCsf = async (input, options) => {
|
|
|
1654
1688
|
let promises = Object.keys(csf._stories).map(async (key) => {
|
|
1655
1689
|
if (!csfSource._meta?.component)
|
|
1656
1690
|
return;
|
|
1657
|
-
let { format: format3 } = await getPrettier(),
|
|
1691
|
+
let { format: format3 } = await getPrettier(), code, snippet;
|
|
1658
1692
|
try {
|
|
1659
|
-
|
|
1693
|
+
code = getCodeSnippet(csfSource, key, csfSource._meta?.component).code;
|
|
1660
1694
|
} catch (e) {
|
|
1661
1695
|
if (!(e instanceof Error))
|
|
1662
1696
|
return;
|
|
1663
1697
|
snippet = e.message;
|
|
1664
1698
|
}
|
|
1665
1699
|
try {
|
|
1666
|
-
!snippet &&
|
|
1700
|
+
!snippet && code && (snippet = await format3(code, {
|
|
1667
1701
|
filepath: join(process.cwd(), "component.tsx")
|
|
1668
1702
|
}));
|
|
1669
1703
|
} catch (e) {
|
|
@@ -1673,45 +1707,9 @@ var enrichCsf = async (input, options) => {
|
|
|
1673
1707
|
}
|
|
1674
1708
|
if (!snippet)
|
|
1675
1709
|
return;
|
|
1676
|
-
let
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
), docsParameter = t.optionalMemberExpression(
|
|
1680
|
-
originalParameters,
|
|
1681
|
-
t.identifier("docs"),
|
|
1682
|
-
!1,
|
|
1683
|
-
!0
|
|
1684
|
-
);
|
|
1685
|
-
csf._ast.program.body.push(
|
|
1686
|
-
t.expressionStatement(
|
|
1687
|
-
t.assignmentExpression(
|
|
1688
|
-
"=",
|
|
1689
|
-
originalParameters,
|
|
1690
|
-
t.objectExpression([
|
|
1691
|
-
t.spreadElement(originalParameters),
|
|
1692
|
-
t.objectProperty(
|
|
1693
|
-
t.identifier("docs"),
|
|
1694
|
-
t.objectExpression([
|
|
1695
|
-
t.spreadElement(docsParameter),
|
|
1696
|
-
t.objectProperty(
|
|
1697
|
-
t.identifier("source"),
|
|
1698
|
-
t.objectExpression([
|
|
1699
|
-
t.objectProperty(t.identifier("code"), t.stringLiteral(snippet)),
|
|
1700
|
-
t.spreadElement(
|
|
1701
|
-
t.optionalMemberExpression(
|
|
1702
|
-
docsParameter,
|
|
1703
|
-
t.identifier("source"),
|
|
1704
|
-
!1,
|
|
1705
|
-
!0
|
|
1706
|
-
)
|
|
1707
|
-
)
|
|
1708
|
-
])
|
|
1709
|
-
)
|
|
1710
|
-
])
|
|
1711
|
-
)
|
|
1712
|
-
])
|
|
1713
|
-
)
|
|
1714
|
-
)
|
|
1710
|
+
let parameters = `${key}${csf._metaIsFactory ? ".input" : ""}.parameters`;
|
|
1711
|
+
csf.appendStatement(
|
|
1712
|
+
`${parameters} = { ...${parameters}, docs: { ...${parameters}?.docs, source: { code: ${JSON.stringify(snippet)}, ...${parameters}?.docs?.source } } };`
|
|
1715
1713
|
);
|
|
1716
1714
|
});
|
|
1717
1715
|
await Promise.all(promises);
|
|
@@ -1803,13 +1801,23 @@ var isDocgenProviderEnabled = () => {
|
|
|
1803
1801
|
try {
|
|
1804
1802
|
return {
|
|
1805
1803
|
...existing,
|
|
1806
|
-
react: resolvePackageDir("react"),
|
|
1807
|
-
reactDom: resolvePackageDir("react-dom")
|
|
1804
|
+
react: resolvePackageDir("react", import.meta.url),
|
|
1805
|
+
reactDom: resolvePackageDir("react-dom", import.meta.url)
|
|
1808
1806
|
};
|
|
1809
1807
|
} catch {
|
|
1810
1808
|
return existing;
|
|
1811
1809
|
}
|
|
1810
|
+
}, readReactAliasTarget = async (options) => {
|
|
1811
|
+
let resolved = await options.presets.apply("resolvedReact", {});
|
|
1812
|
+
return !resolved?.react || !resolved.reactDom ? null : { react: resolved.react, reactDom: resolved.reactDom };
|
|
1813
|
+
}, viteFinal = async (config = {}, options) => {
|
|
1814
|
+
let target = await readReactAliasTarget(options);
|
|
1815
|
+
return target ? prependReactDedupePlugin(config, target) : config;
|
|
1812
1816
|
};
|
|
1817
|
+
async function webpack(config = {}, options) {
|
|
1818
|
+
let target = await readReactAliasTarget(options);
|
|
1819
|
+
return target ? aliasReactInWebpack(config, target) : config;
|
|
1820
|
+
}
|
|
1813
1821
|
async function internal_getArgTypesData(_input, options) {
|
|
1814
1822
|
let { componentFilePath, componentExportName, presets } = options ?? {};
|
|
1815
1823
|
if (!componentFilePath)
|
|
@@ -1834,6 +1842,15 @@ async function internal_getArgTypesData(_input, options) {
|
|
|
1834
1842
|
}), argTypesData;
|
|
1835
1843
|
}
|
|
1836
1844
|
var optimizeViteDeps = [
|
|
1845
|
+
// The vitest project-annotations setup file imports this renderer's entry previews through a
|
|
1846
|
+
// virtual module, and those chunks import React by the bare specifier. In the observed failure
|
|
1847
|
+
// (react 19.3.1, vite 7.3.7, vitest 5.0.5, chromium browser mode) the dependency scan had not
|
|
1848
|
+
// registered plain `react`, so the browser loaded react's CJS index.js raw and module linking
|
|
1849
|
+
// failed with "The requested module 'react/index.js' does not provide an export named 'default'".
|
|
1850
|
+
// Projects only hit this when their stories use the automatic JSX runtime and never import
|
|
1851
|
+
// `react` by name; a story importing `react` (for `useState`, say) registers it in the scan
|
|
1852
|
+
// and masks the failure.
|
|
1853
|
+
"react",
|
|
1837
1854
|
"react-dom/client",
|
|
1838
1855
|
"react-dom/test-utils",
|
|
1839
1856
|
"react/jsx-runtime"
|
|
@@ -1848,5 +1865,7 @@ export {
|
|
|
1848
1865
|
isDocgenProviderEnabled,
|
|
1849
1866
|
optimizeViteDeps,
|
|
1850
1867
|
previewAnnotations,
|
|
1851
|
-
resolvedReact
|
|
1868
|
+
resolvedReact,
|
|
1869
|
+
viteFinal,
|
|
1870
|
+
webpack
|
|
1852
1871
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.8",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
82
82
|
"react": "^18.0.0 || ^19.0.0",
|
|
83
83
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
84
|
-
"storybook": "^11.0.0-alpha.
|
|
84
|
+
"storybook": "^11.0.0-alpha.8",
|
|
85
85
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|