@storybook/addon-vitest 0.0.0-pr-31311-sha-927762ce → 0.0.0-pr-31819-sha-dc7e86b3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/chunk-JFJ5UJ7Q.js +11 -0
- package/dist/_browser-chunks/chunk-PMYV6BH2.js +76 -0
- package/dist/_node-chunks/chunk-25O5SVIM.js +6873 -0
- package/dist/_node-chunks/chunk-3EUT2BMY.js +103 -0
- package/dist/_node-chunks/chunk-CH4X2FJX.js +247 -0
- package/dist/_node-chunks/chunk-N5JG56NT.js +295 -0
- package/dist/_node-chunks/chunk-O7XSKP6J.js +91 -0
- package/dist/_node-chunks/chunk-ORH7C7ZG.js +481 -0
- package/dist/_node-chunks/chunk-PJERO7S2.js +2264 -0
- package/dist/_node-chunks/chunk-ZUQ3ULQ5.js +55 -0
- package/dist/index.js +9 -6
- package/dist/manager.js +7516 -8
- package/dist/node/coverage-reporter.js +1898 -4
- package/dist/node/vitest.js +740 -17
- package/dist/postinstall.js +2072 -88
- package/dist/preset.js +360 -31
- package/dist/vitest-plugin/global-setup.js +200 -6
- package/dist/vitest-plugin/index.js +3823 -43
- package/dist/vitest-plugin/setup-file.js +30 -8
- package/dist/vitest-plugin/test-utils.js +102 -8
- package/manager.js +1 -1
- package/package.json +16 -89
- package/preset.js +1 -1
- package/dist/chunk-55WZLVGN.mjs +0 -11
- package/dist/chunk-JKRQGT2U.mjs +0 -10
- package/dist/index.mjs +0 -5
- package/dist/node/coverage-reporter.d.ts +0 -184
- package/dist/node/coverage-reporter.mjs +0 -12
- package/dist/node/vitest.d.ts +0 -2
- package/dist/node/vitest.mjs +0 -19
- package/dist/vitest-plugin/global-setup.d.ts +0 -6
- package/dist/vitest-plugin/global-setup.mjs +0 -13
- package/dist/vitest-plugin/index.mjs +0 -28
- package/dist/vitest-plugin/setup-file.d.ts +0 -14
- package/dist/vitest-plugin/setup-file.mjs +0 -9
- package/dist/vitest-plugin/test-utils.d.ts +0 -20
- package/dist/vitest-plugin/test-utils.mjs +0 -8
- package/manager.mjs +0 -1
- package/postinstall.js +0 -1
- package/postinstall.mjs +0 -1
- package/preset.mjs +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_njqfnofv4rp from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_njqfnofv4rp from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_njqfnofv4rp from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_njqfnofv4rp.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_njqfnofv4rp.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_njqfnofv4rp.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// ../../core/src/component-testing/constants.ts
|
|
14
|
+
var ADDON_ID = "storybook/interactions";
|
|
15
|
+
var PANEL_ID = `${ADDON_ID}/panel`;
|
|
16
|
+
var DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon";
|
|
17
|
+
var DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`;
|
|
18
|
+
|
|
19
|
+
// ../a11y/src/constants.ts
|
|
20
|
+
var ADDON_ID2 = "storybook/a11y";
|
|
21
|
+
var PANEL_ID2 = `${ADDON_ID2}/panel`;
|
|
22
|
+
var RESULT = `${ADDON_ID2}/result`;
|
|
23
|
+
var REQUEST = `${ADDON_ID2}/request`;
|
|
24
|
+
var RUNNING = `${ADDON_ID2}/running`;
|
|
25
|
+
var ERROR = `${ADDON_ID2}/error`;
|
|
26
|
+
var MANUAL = `${ADDON_ID2}/manual`;
|
|
27
|
+
var SELECT = `${ADDON_ID2}/select`;
|
|
28
|
+
var DOCUMENTATION_LINK2 = "writing-tests/accessibility-testing";
|
|
29
|
+
var DOCUMENTATION_DISCREPANCY_LINK2 = `${DOCUMENTATION_LINK2}#why-are-my-tests-failing-in-different-environments`;
|
|
30
|
+
|
|
31
|
+
// src/constants.ts
|
|
32
|
+
var ADDON_ID3 = "storybook/test";
|
|
33
|
+
var TEST_PROVIDER_ID = `${ADDON_ID3}/test-provider`;
|
|
34
|
+
var STORYBOOK_ADDON_TEST_CHANNEL = "STORYBOOK_ADDON_TEST_CHANNEL";
|
|
35
|
+
var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon";
|
|
36
|
+
var DOCUMENTATION_FATAL_ERROR_LINK = `${DOCUMENTATION_LINK3}#what-happens-if-vitest-itself-has-an-error`;
|
|
37
|
+
var COVERAGE_DIRECTORY = "coverage";
|
|
38
|
+
var SUPPORTED_FRAMEWORKS = [
|
|
39
|
+
"@storybook/nextjs",
|
|
40
|
+
"@storybook/nextjs-vite",
|
|
41
|
+
"@storybook/react-vite",
|
|
42
|
+
"@storybook/svelte-vite",
|
|
43
|
+
"@storybook/vue3-vite",
|
|
44
|
+
"@storybook/html-vite",
|
|
45
|
+
"@storybook/web-components-vite",
|
|
46
|
+
"@storybook/sveltekit",
|
|
47
|
+
"@storybook/react-native-web-vite"
|
|
48
|
+
];
|
|
49
|
+
var storeOptions = {
|
|
50
|
+
id: ADDON_ID3,
|
|
51
|
+
initialState: {
|
|
52
|
+
config: {
|
|
53
|
+
coverage: false,
|
|
54
|
+
a11y: false
|
|
55
|
+
},
|
|
56
|
+
watching: false,
|
|
57
|
+
cancelling: false,
|
|
58
|
+
fatalError: void 0,
|
|
59
|
+
indexUrl: void 0,
|
|
60
|
+
previewAnnotations: [],
|
|
61
|
+
currentRun: {
|
|
62
|
+
triggeredBy: void 0,
|
|
63
|
+
config: {
|
|
64
|
+
coverage: false,
|
|
65
|
+
a11y: false
|
|
66
|
+
},
|
|
67
|
+
componentTestCount: {
|
|
68
|
+
success: 0,
|
|
69
|
+
error: 0
|
|
70
|
+
},
|
|
71
|
+
a11yCount: {
|
|
72
|
+
success: 0,
|
|
73
|
+
warning: 0,
|
|
74
|
+
error: 0
|
|
75
|
+
},
|
|
76
|
+
storyIds: void 0,
|
|
77
|
+
totalTestCount: void 0,
|
|
78
|
+
startedAt: void 0,
|
|
79
|
+
finishedAt: void 0,
|
|
80
|
+
unhandledErrors: [],
|
|
81
|
+
coverageSummary: void 0
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`;
|
|
86
|
+
var STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/status";
|
|
87
|
+
var TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider";
|
|
88
|
+
var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test";
|
|
89
|
+
var STATUS_TYPE_ID_A11Y = "storybook/a11y";
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
ADDON_ID3 as ADDON_ID,
|
|
93
|
+
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
94
|
+
DOCUMENTATION_LINK3 as DOCUMENTATION_LINK,
|
|
95
|
+
COVERAGE_DIRECTORY,
|
|
96
|
+
SUPPORTED_FRAMEWORKS,
|
|
97
|
+
storeOptions,
|
|
98
|
+
STORE_CHANNEL_EVENT_NAME,
|
|
99
|
+
STATUS_STORE_CHANNEL_EVENT_NAME,
|
|
100
|
+
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
101
|
+
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
102
|
+
STATUS_TYPE_ID_A11Y
|
|
103
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_njqfnofv4rp from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_njqfnofv4rp from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_njqfnofv4rp from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_njqfnofv4rp.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_njqfnofv4rp.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_njqfnofv4rp.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-ZUQ3ULQ5.js";
|
|
15
|
+
|
|
16
|
+
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
17
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
18
|
+
function normalizeWindowsPath(input = "") {
|
|
19
|
+
if (!input) {
|
|
20
|
+
return input;
|
|
21
|
+
}
|
|
22
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
23
|
+
}
|
|
24
|
+
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
25
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
26
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
27
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
28
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
29
|
+
var sep = "/";
|
|
30
|
+
var delimiter = ":";
|
|
31
|
+
var normalize = /* @__PURE__ */ __name(function(path2) {
|
|
32
|
+
if (path2.length === 0) {
|
|
33
|
+
return ".";
|
|
34
|
+
}
|
|
35
|
+
path2 = normalizeWindowsPath(path2);
|
|
36
|
+
const isUNCPath = path2.match(_UNC_REGEX);
|
|
37
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
38
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
39
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
40
|
+
if (path2.length === 0) {
|
|
41
|
+
if (isPathAbsolute) {
|
|
42
|
+
return "/";
|
|
43
|
+
}
|
|
44
|
+
return trailingSeparator ? "./" : ".";
|
|
45
|
+
}
|
|
46
|
+
if (trailingSeparator) {
|
|
47
|
+
path2 += "/";
|
|
48
|
+
}
|
|
49
|
+
if (_DRIVE_LETTER_RE.test(path2)) {
|
|
50
|
+
path2 += "/";
|
|
51
|
+
}
|
|
52
|
+
if (isUNCPath) {
|
|
53
|
+
if (!isPathAbsolute) {
|
|
54
|
+
return `//./${path2}`;
|
|
55
|
+
}
|
|
56
|
+
return `//${path2}`;
|
|
57
|
+
}
|
|
58
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
59
|
+
}, "normalize");
|
|
60
|
+
var join = /* @__PURE__ */ __name(function(...arguments_) {
|
|
61
|
+
if (arguments_.length === 0) {
|
|
62
|
+
return ".";
|
|
63
|
+
}
|
|
64
|
+
let joined;
|
|
65
|
+
for (const argument of arguments_) {
|
|
66
|
+
if (argument && argument.length > 0) {
|
|
67
|
+
if (joined === void 0) {
|
|
68
|
+
joined = argument;
|
|
69
|
+
} else {
|
|
70
|
+
joined += `/${argument}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (joined === void 0) {
|
|
75
|
+
return ".";
|
|
76
|
+
}
|
|
77
|
+
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
78
|
+
}, "join");
|
|
79
|
+
function cwd() {
|
|
80
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
81
|
+
return process.cwd().replace(/\\/g, "/");
|
|
82
|
+
}
|
|
83
|
+
return "/";
|
|
84
|
+
}
|
|
85
|
+
__name(cwd, "cwd");
|
|
86
|
+
var resolve = /* @__PURE__ */ __name(function(...arguments_) {
|
|
87
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
88
|
+
let resolvedPath = "";
|
|
89
|
+
let resolvedAbsolute = false;
|
|
90
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
91
|
+
const path2 = index >= 0 ? arguments_[index] : cwd();
|
|
92
|
+
if (!path2 || path2.length === 0) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
resolvedPath = `${path2}/${resolvedPath}`;
|
|
96
|
+
resolvedAbsolute = isAbsolute(path2);
|
|
97
|
+
}
|
|
98
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
99
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
100
|
+
return `/${resolvedPath}`;
|
|
101
|
+
}
|
|
102
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
103
|
+
}, "resolve");
|
|
104
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
105
|
+
let res = "";
|
|
106
|
+
let lastSegmentLength = 0;
|
|
107
|
+
let lastSlash = -1;
|
|
108
|
+
let dots = 0;
|
|
109
|
+
let char = null;
|
|
110
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
111
|
+
if (index < path2.length) {
|
|
112
|
+
char = path2[index];
|
|
113
|
+
} else if (char === "/") {
|
|
114
|
+
break;
|
|
115
|
+
} else {
|
|
116
|
+
char = "/";
|
|
117
|
+
}
|
|
118
|
+
if (char === "/") {
|
|
119
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
120
|
+
else if (dots === 2) {
|
|
121
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
122
|
+
if (res.length > 2) {
|
|
123
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
124
|
+
if (lastSlashIndex === -1) {
|
|
125
|
+
res = "";
|
|
126
|
+
lastSegmentLength = 0;
|
|
127
|
+
} else {
|
|
128
|
+
res = res.slice(0, lastSlashIndex);
|
|
129
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
130
|
+
}
|
|
131
|
+
lastSlash = index;
|
|
132
|
+
dots = 0;
|
|
133
|
+
continue;
|
|
134
|
+
} else if (res.length > 0) {
|
|
135
|
+
res = "";
|
|
136
|
+
lastSegmentLength = 0;
|
|
137
|
+
lastSlash = index;
|
|
138
|
+
dots = 0;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (allowAboveRoot) {
|
|
143
|
+
res += res.length > 0 ? "/.." : "..";
|
|
144
|
+
lastSegmentLength = 2;
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
if (res.length > 0) {
|
|
148
|
+
res += `/${path2.slice(lastSlash + 1, index)}`;
|
|
149
|
+
} else {
|
|
150
|
+
res = path2.slice(lastSlash + 1, index);
|
|
151
|
+
}
|
|
152
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
153
|
+
}
|
|
154
|
+
lastSlash = index;
|
|
155
|
+
dots = 0;
|
|
156
|
+
} else if (char === "." && dots !== -1) {
|
|
157
|
+
++dots;
|
|
158
|
+
} else {
|
|
159
|
+
dots = -1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return res;
|
|
163
|
+
}
|
|
164
|
+
__name(normalizeString, "normalizeString");
|
|
165
|
+
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
166
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
167
|
+
}, "isAbsolute");
|
|
168
|
+
var toNamespacedPath = /* @__PURE__ */ __name(function(p) {
|
|
169
|
+
return normalizeWindowsPath(p);
|
|
170
|
+
}, "toNamespacedPath");
|
|
171
|
+
var _EXTNAME_RE = /.(\.[^./]+)$/;
|
|
172
|
+
var extname = /* @__PURE__ */ __name(function(p) {
|
|
173
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
174
|
+
return match && match[1] || "";
|
|
175
|
+
}, "extname");
|
|
176
|
+
var relative = /* @__PURE__ */ __name(function(from, to) {
|
|
177
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
178
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
179
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
180
|
+
return _to.join("/");
|
|
181
|
+
}
|
|
182
|
+
const _fromCopy = [..._from];
|
|
183
|
+
for (const segment of _fromCopy) {
|
|
184
|
+
if (_to[0] !== segment) {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
_from.shift();
|
|
188
|
+
_to.shift();
|
|
189
|
+
}
|
|
190
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
191
|
+
}, "relative");
|
|
192
|
+
var dirname = /* @__PURE__ */ __name(function(p) {
|
|
193
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
194
|
+
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
|
|
195
|
+
segments[0] += "/";
|
|
196
|
+
}
|
|
197
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
198
|
+
}, "dirname");
|
|
199
|
+
var format = /* @__PURE__ */ __name(function(p) {
|
|
200
|
+
const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
|
|
201
|
+
return normalizeWindowsPath(
|
|
202
|
+
p.root ? resolve(...segments) : segments.join("/")
|
|
203
|
+
);
|
|
204
|
+
}, "format");
|
|
205
|
+
var basename = /* @__PURE__ */ __name(function(p, extension) {
|
|
206
|
+
const lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
207
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
208
|
+
}, "basename");
|
|
209
|
+
var parse = /* @__PURE__ */ __name(function(p) {
|
|
210
|
+
const root = normalizeWindowsPath(p).split("/").shift() || "/";
|
|
211
|
+
const base = basename(p);
|
|
212
|
+
const extension = extname(base);
|
|
213
|
+
return {
|
|
214
|
+
root,
|
|
215
|
+
dir: dirname(p),
|
|
216
|
+
base,
|
|
217
|
+
ext: extension,
|
|
218
|
+
name: base.slice(0, base.length - extension.length)
|
|
219
|
+
};
|
|
220
|
+
}, "parse");
|
|
221
|
+
var path = {
|
|
222
|
+
__proto__: null,
|
|
223
|
+
basename,
|
|
224
|
+
delimiter,
|
|
225
|
+
dirname,
|
|
226
|
+
extname,
|
|
227
|
+
format,
|
|
228
|
+
isAbsolute,
|
|
229
|
+
join,
|
|
230
|
+
normalize,
|
|
231
|
+
normalizeString,
|
|
232
|
+
parse,
|
|
233
|
+
relative,
|
|
234
|
+
resolve,
|
|
235
|
+
sep,
|
|
236
|
+
toNamespacedPath
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
sep,
|
|
241
|
+
normalize,
|
|
242
|
+
join,
|
|
243
|
+
resolve,
|
|
244
|
+
relative,
|
|
245
|
+
dirname,
|
|
246
|
+
path
|
|
247
|
+
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_njqfnofv4rp from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_njqfnofv4rp from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_njqfnofv4rp from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_njqfnofv4rp.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_njqfnofv4rp.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_njqfnofv4rp.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-ZUQ3ULQ5.js";
|
|
15
|
+
|
|
16
|
+
// src/utils.ts
|
|
17
|
+
function getAddonNames(mainConfig) {
|
|
18
|
+
const addons = mainConfig.addons || [];
|
|
19
|
+
const addonList = addons.map((addon) => {
|
|
20
|
+
let name = "";
|
|
21
|
+
if (typeof addon === "string") {
|
|
22
|
+
name = addon;
|
|
23
|
+
} else if (typeof addon === "object") {
|
|
24
|
+
name = addon.name;
|
|
25
|
+
}
|
|
26
|
+
return name;
|
|
27
|
+
});
|
|
28
|
+
return addonList.filter((item) => item != null);
|
|
29
|
+
}
|
|
30
|
+
__name(getAddonNames, "getAddonNames");
|
|
31
|
+
function errorToErrorLike(error) {
|
|
32
|
+
return {
|
|
33
|
+
message: error.message,
|
|
34
|
+
name: error.name,
|
|
35
|
+
// avoid duplicating the error message in the stack trace
|
|
36
|
+
stack: error.stack?.replace(error.message, ""),
|
|
37
|
+
cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
__name(errorToErrorLike, "errorToErrorLike");
|
|
41
|
+
|
|
42
|
+
// ../../node_modules/find-up/index.js
|
|
43
|
+
import path2 from "node:path";
|
|
44
|
+
|
|
45
|
+
// ../../node_modules/locate-path/index.js
|
|
46
|
+
import process from "node:process";
|
|
47
|
+
import path from "node:path";
|
|
48
|
+
import fs, { promises as fsPromises } from "node:fs";
|
|
49
|
+
import { fileURLToPath } from "node:url";
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/yocto-queue/index.js
|
|
52
|
+
var Node = class {
|
|
53
|
+
static {
|
|
54
|
+
__name(this, "Node");
|
|
55
|
+
}
|
|
56
|
+
value;
|
|
57
|
+
next;
|
|
58
|
+
constructor(value) {
|
|
59
|
+
this.value = value;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var Queue = class {
|
|
63
|
+
static {
|
|
64
|
+
__name(this, "Queue");
|
|
65
|
+
}
|
|
66
|
+
#head;
|
|
67
|
+
#tail;
|
|
68
|
+
#size;
|
|
69
|
+
constructor() {
|
|
70
|
+
this.clear();
|
|
71
|
+
}
|
|
72
|
+
enqueue(value) {
|
|
73
|
+
const node = new Node(value);
|
|
74
|
+
if (this.#head) {
|
|
75
|
+
this.#tail.next = node;
|
|
76
|
+
this.#tail = node;
|
|
77
|
+
} else {
|
|
78
|
+
this.#head = node;
|
|
79
|
+
this.#tail = node;
|
|
80
|
+
}
|
|
81
|
+
this.#size++;
|
|
82
|
+
}
|
|
83
|
+
dequeue() {
|
|
84
|
+
const current = this.#head;
|
|
85
|
+
if (!current) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.#head = this.#head.next;
|
|
89
|
+
this.#size--;
|
|
90
|
+
return current.value;
|
|
91
|
+
}
|
|
92
|
+
peek() {
|
|
93
|
+
if (!this.#head) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return this.#head.value;
|
|
97
|
+
}
|
|
98
|
+
clear() {
|
|
99
|
+
this.#head = void 0;
|
|
100
|
+
this.#tail = void 0;
|
|
101
|
+
this.#size = 0;
|
|
102
|
+
}
|
|
103
|
+
get size() {
|
|
104
|
+
return this.#size;
|
|
105
|
+
}
|
|
106
|
+
*[Symbol.iterator]() {
|
|
107
|
+
let current = this.#head;
|
|
108
|
+
while (current) {
|
|
109
|
+
yield current.value;
|
|
110
|
+
current = current.next;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
*drain() {
|
|
114
|
+
while (this.#head) {
|
|
115
|
+
yield this.dequeue();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// ../../node_modules/locate-path/node_modules/p-limit/index.js
|
|
121
|
+
function pLimit(concurrency) {
|
|
122
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
123
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
124
|
+
}
|
|
125
|
+
const queue = new Queue();
|
|
126
|
+
let activeCount = 0;
|
|
127
|
+
const next = /* @__PURE__ */ __name(() => {
|
|
128
|
+
activeCount--;
|
|
129
|
+
if (queue.size > 0) {
|
|
130
|
+
queue.dequeue()();
|
|
131
|
+
}
|
|
132
|
+
}, "next");
|
|
133
|
+
const run = /* @__PURE__ */ __name(async (fn, resolve, args) => {
|
|
134
|
+
activeCount++;
|
|
135
|
+
const result = (async () => fn(...args))();
|
|
136
|
+
resolve(result);
|
|
137
|
+
try {
|
|
138
|
+
await result;
|
|
139
|
+
} catch {
|
|
140
|
+
}
|
|
141
|
+
next();
|
|
142
|
+
}, "run");
|
|
143
|
+
const enqueue = /* @__PURE__ */ __name((fn, resolve, args) => {
|
|
144
|
+
queue.enqueue(run.bind(void 0, fn, resolve, args));
|
|
145
|
+
(async () => {
|
|
146
|
+
await Promise.resolve();
|
|
147
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
148
|
+
queue.dequeue()();
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
}, "enqueue");
|
|
152
|
+
const generator = /* @__PURE__ */ __name((fn, ...args) => new Promise((resolve) => {
|
|
153
|
+
enqueue(fn, resolve, args);
|
|
154
|
+
}), "generator");
|
|
155
|
+
Object.defineProperties(generator, {
|
|
156
|
+
activeCount: {
|
|
157
|
+
get: /* @__PURE__ */ __name(() => activeCount, "get")
|
|
158
|
+
},
|
|
159
|
+
pendingCount: {
|
|
160
|
+
get: /* @__PURE__ */ __name(() => queue.size, "get")
|
|
161
|
+
},
|
|
162
|
+
clearQueue: {
|
|
163
|
+
value: /* @__PURE__ */ __name(() => {
|
|
164
|
+
queue.clear();
|
|
165
|
+
}, "value")
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return generator;
|
|
169
|
+
}
|
|
170
|
+
__name(pLimit, "pLimit");
|
|
171
|
+
|
|
172
|
+
// ../../node_modules/locate-path/node_modules/p-locate/index.js
|
|
173
|
+
var EndError = class extends Error {
|
|
174
|
+
static {
|
|
175
|
+
__name(this, "EndError");
|
|
176
|
+
}
|
|
177
|
+
constructor(value) {
|
|
178
|
+
super();
|
|
179
|
+
this.value = value;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var testElement = /* @__PURE__ */ __name(async (element, tester) => tester(await element), "testElement");
|
|
183
|
+
var finder = /* @__PURE__ */ __name(async (element) => {
|
|
184
|
+
const values = await Promise.all(element);
|
|
185
|
+
if (values[1] === true) {
|
|
186
|
+
throw new EndError(values[0]);
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}, "finder");
|
|
190
|
+
async function pLocate(iterable, tester, {
|
|
191
|
+
concurrency = Number.POSITIVE_INFINITY,
|
|
192
|
+
preserveOrder = true
|
|
193
|
+
} = {}) {
|
|
194
|
+
const limit = pLimit(concurrency);
|
|
195
|
+
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
196
|
+
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
197
|
+
try {
|
|
198
|
+
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error instanceof EndError) {
|
|
201
|
+
return error.value;
|
|
202
|
+
}
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
__name(pLocate, "pLocate");
|
|
207
|
+
|
|
208
|
+
// ../../node_modules/locate-path/index.js
|
|
209
|
+
var typeMappings = {
|
|
210
|
+
directory: "isDirectory",
|
|
211
|
+
file: "isFile"
|
|
212
|
+
};
|
|
213
|
+
function checkType(type) {
|
|
214
|
+
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
throw new Error(`Invalid type specified: ${type}`);
|
|
218
|
+
}
|
|
219
|
+
__name(checkType, "checkType");
|
|
220
|
+
var matchType = /* @__PURE__ */ __name((type, stat) => stat[typeMappings[type]](), "matchType");
|
|
221
|
+
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
222
|
+
async function locatePath(paths, {
|
|
223
|
+
cwd = process.cwd(),
|
|
224
|
+
type = "file",
|
|
225
|
+
allowSymlinks = true,
|
|
226
|
+
concurrency,
|
|
227
|
+
preserveOrder
|
|
228
|
+
} = {}) {
|
|
229
|
+
checkType(type);
|
|
230
|
+
cwd = toPath(cwd);
|
|
231
|
+
const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;
|
|
232
|
+
return pLocate(paths, async (path_) => {
|
|
233
|
+
try {
|
|
234
|
+
const stat = await statFunction(path.resolve(cwd, path_));
|
|
235
|
+
return matchType(type, stat);
|
|
236
|
+
} catch {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}, { concurrency, preserveOrder });
|
|
240
|
+
}
|
|
241
|
+
__name(locatePath, "locatePath");
|
|
242
|
+
|
|
243
|
+
// ../../node_modules/find-up/node_modules/unicorn-magic/node.js
|
|
244
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
245
|
+
function toPath2(urlOrPath) {
|
|
246
|
+
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
|
|
247
|
+
}
|
|
248
|
+
__name(toPath2, "toPath");
|
|
249
|
+
|
|
250
|
+
// ../../node_modules/find-up/index.js
|
|
251
|
+
var findUpStop = Symbol("findUpStop");
|
|
252
|
+
async function findUpMultiple(name, options = {}) {
|
|
253
|
+
let directory = path2.resolve(toPath2(options.cwd) ?? "");
|
|
254
|
+
const { root } = path2.parse(directory);
|
|
255
|
+
const stopAt = path2.resolve(directory, toPath2(options.stopAt ?? root));
|
|
256
|
+
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
257
|
+
const paths = [name].flat();
|
|
258
|
+
const runMatcher = /* @__PURE__ */ __name(async (locateOptions) => {
|
|
259
|
+
if (typeof name !== "function") {
|
|
260
|
+
return locatePath(paths, locateOptions);
|
|
261
|
+
}
|
|
262
|
+
const foundPath = await name(locateOptions.cwd);
|
|
263
|
+
if (typeof foundPath === "string") {
|
|
264
|
+
return locatePath([foundPath], locateOptions);
|
|
265
|
+
}
|
|
266
|
+
return foundPath;
|
|
267
|
+
}, "runMatcher");
|
|
268
|
+
const matches = [];
|
|
269
|
+
while (true) {
|
|
270
|
+
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
271
|
+
if (foundPath === findUpStop) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
if (foundPath) {
|
|
275
|
+
matches.push(path2.resolve(directory, foundPath));
|
|
276
|
+
}
|
|
277
|
+
if (directory === stopAt || matches.length >= limit) {
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
directory = path2.dirname(directory);
|
|
281
|
+
}
|
|
282
|
+
return matches;
|
|
283
|
+
}
|
|
284
|
+
__name(findUpMultiple, "findUpMultiple");
|
|
285
|
+
async function findUp(name, options = {}) {
|
|
286
|
+
const matches = await findUpMultiple(name, { ...options, limit: 1 });
|
|
287
|
+
return matches[0];
|
|
288
|
+
}
|
|
289
|
+
__name(findUp, "findUp");
|
|
290
|
+
|
|
291
|
+
export {
|
|
292
|
+
getAddonNames,
|
|
293
|
+
errorToErrorLike,
|
|
294
|
+
findUp
|
|
295
|
+
};
|