@storybook/react 10.0.0-beta.7 → 10.0.0-beta.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.
Files changed (2) hide show
  1. package/dist/preset.js +314 -6
  2. package/package.json +3 -3
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_zacvk63icm from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_zacvk63icm from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_zacvk63icm from "node:module";
1
+ import CJS_COMPAT_NODE_URL_q1lvh4oqay from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_q1lvh4oqay from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_q1lvh4oqay from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_zacvk63icm.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_zacvk63icm.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_zacvk63icm.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_q1lvh4oqay.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_q1lvh4oqay.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_q1lvh4oqay.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -18,6 +18,314 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
18
18
  // ../../core/src/shared/utils/module.ts
19
19
  import { fileURLToPath, pathToFileURL } from "node:url";
20
20
 
21
+ // ../../node_modules/exsolve/dist/index.mjs
22
+ import assert from "node:assert";
23
+ import v8 from "node:v8";
24
+ import { format, inspect } from "node:util";
25
+ var own$1 = {}.hasOwnProperty;
26
+ var classRegExp = /^([A-Z][a-z\d]*)+$/;
27
+ var kTypes = /* @__PURE__ */ new Set([
28
+ "string",
29
+ "function",
30
+ "number",
31
+ "object",
32
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
33
+ "Function",
34
+ "Object",
35
+ "boolean",
36
+ "bigint",
37
+ "symbol"
38
+ ]);
39
+ var messages = /* @__PURE__ */ new Map();
40
+ var nodeInternalPrefix = "__node_internal_";
41
+ var userStackTraceLimit;
42
+ function formatList(array, type = "and") {
43
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
44
+ }
45
+ __name(formatList, "formatList");
46
+ function createError(sym, value, constructor) {
47
+ messages.set(sym, value);
48
+ return makeNodeErrorWithCode(constructor, sym);
49
+ }
50
+ __name(createError, "createError");
51
+ function makeNodeErrorWithCode(Base, key) {
52
+ return /* @__PURE__ */ __name(function NodeError(...parameters) {
53
+ const limit = Error.stackTraceLimit;
54
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
55
+ const error = new Base();
56
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
57
+ const message = getMessage(key, parameters, error);
58
+ Object.defineProperties(error, {
59
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
60
+ // probably.
61
+ message: {
62
+ value: message,
63
+ enumerable: false,
64
+ writable: true,
65
+ configurable: true
66
+ },
67
+ toString: {
68
+ /** @this {Error} */
69
+ value() {
70
+ return `${this.name} [${key}]: ${this.message}`;
71
+ },
72
+ enumerable: false,
73
+ writable: true,
74
+ configurable: true
75
+ }
76
+ });
77
+ captureLargerStackTrace(error);
78
+ error.code = key;
79
+ return error;
80
+ }, "NodeError");
81
+ }
82
+ __name(makeNodeErrorWithCode, "makeNodeErrorWithCode");
83
+ function isErrorStackTraceLimitWritable() {
84
+ try {
85
+ if (v8.startupSnapshot.isBuildingSnapshot()) {
86
+ return false;
87
+ }
88
+ } catch {
89
+ }
90
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
91
+ if (desc === void 0) {
92
+ return Object.isExtensible(Error);
93
+ }
94
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
95
+ }
96
+ __name(isErrorStackTraceLimitWritable, "isErrorStackTraceLimitWritable");
97
+ function hideStackFrames(wrappedFunction) {
98
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
99
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
100
+ return wrappedFunction;
101
+ }
102
+ __name(hideStackFrames, "hideStackFrames");
103
+ var captureLargerStackTrace = hideStackFrames(function(error) {
104
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
105
+ if (stackTraceLimitIsWritable) {
106
+ userStackTraceLimit = Error.stackTraceLimit;
107
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
108
+ }
109
+ Error.captureStackTrace(error);
110
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
111
+ return error;
112
+ });
113
+ function getMessage(key, parameters, self) {
114
+ const message = messages.get(key);
115
+ assert(message !== void 0, "expected `message` to be found");
116
+ if (typeof message === "function") {
117
+ assert(
118
+ message.length <= parameters.length,
119
+ // Default options do not count.
120
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
121
+ );
122
+ return Reflect.apply(message, self, parameters);
123
+ }
124
+ const regex = /%[dfijoOs]/g;
125
+ let expectedLength = 0;
126
+ while (regex.exec(message) !== null) expectedLength++;
127
+ assert(
128
+ expectedLength === parameters.length,
129
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
130
+ );
131
+ if (parameters.length === 0) return message;
132
+ parameters.unshift(message);
133
+ return Reflect.apply(format, null, parameters);
134
+ }
135
+ __name(getMessage, "getMessage");
136
+ function determineSpecificType(value) {
137
+ if (value === null || value === void 0) {
138
+ return String(value);
139
+ }
140
+ if (typeof value === "function" && value.name) {
141
+ return `function ${value.name}`;
142
+ }
143
+ if (typeof value === "object") {
144
+ if (value.constructor && value.constructor.name) {
145
+ return `an instance of ${value.constructor.name}`;
146
+ }
147
+ return `${inspect(value, { depth: -1 })}`;
148
+ }
149
+ let inspected = inspect(value, { colors: false });
150
+ if (inspected.length > 28) {
151
+ inspected = `${inspected.slice(0, 25)}...`;
152
+ }
153
+ return `type ${typeof value} (${inspected})`;
154
+ }
155
+ __name(determineSpecificType, "determineSpecificType");
156
+ createError(
157
+ "ERR_INVALID_ARG_TYPE",
158
+ (name, expected, actual) => {
159
+ assert(typeof name === "string", "'name' must be a string");
160
+ if (!Array.isArray(expected)) {
161
+ expected = [expected];
162
+ }
163
+ let message = "The ";
164
+ if (name.endsWith(" argument")) {
165
+ message += `${name} `;
166
+ } else {
167
+ const type = name.includes(".") ? "property" : "argument";
168
+ message += `"${name}" ${type} `;
169
+ }
170
+ message += "must be ";
171
+ const types = [];
172
+ const instances = [];
173
+ const other = [];
174
+ for (const value of expected) {
175
+ assert(
176
+ typeof value === "string",
177
+ "All expected entries have to be of type string"
178
+ );
179
+ if (kTypes.has(value)) {
180
+ types.push(value.toLowerCase());
181
+ } else if (classRegExp.exec(value) === null) {
182
+ assert(
183
+ value !== "object",
184
+ 'The value "object" should be written as "Object"'
185
+ );
186
+ other.push(value);
187
+ } else {
188
+ instances.push(value);
189
+ }
190
+ }
191
+ if (instances.length > 0) {
192
+ const pos = types.indexOf("object");
193
+ if (pos !== -1) {
194
+ types.slice(pos, 1);
195
+ instances.push("Object");
196
+ }
197
+ }
198
+ if (types.length > 0) {
199
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
200
+ types,
201
+ "or"
202
+ )}`;
203
+ if (instances.length > 0 || other.length > 0) message += " or ";
204
+ }
205
+ if (instances.length > 0) {
206
+ message += `an instance of ${formatList(instances, "or")}`;
207
+ if (other.length > 0) message += " or ";
208
+ }
209
+ if (other.length > 0) {
210
+ if (other.length > 1) {
211
+ message += `one of ${formatList(other, "or")}`;
212
+ } else {
213
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
214
+ message += `${other[0]}`;
215
+ }
216
+ }
217
+ message += `. Received ${determineSpecificType(actual)}`;
218
+ return message;
219
+ },
220
+ TypeError
221
+ );
222
+ var ERR_INVALID_MODULE_SPECIFIER = createError(
223
+ "ERR_INVALID_MODULE_SPECIFIER",
224
+ /**
225
+ * @param {string} request
226
+ * @param {string} reason
227
+ * @param {string} [base]
228
+ */
229
+ (request, reason, base) => {
230
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
231
+ },
232
+ TypeError
233
+ );
234
+ var ERR_INVALID_PACKAGE_CONFIG = createError(
235
+ "ERR_INVALID_PACKAGE_CONFIG",
236
+ (path2, base, message) => {
237
+ return `Invalid package config ${path2}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
238
+ },
239
+ Error
240
+ );
241
+ var ERR_INVALID_PACKAGE_TARGET = createError(
242
+ "ERR_INVALID_PACKAGE_TARGET",
243
+ (packagePath, key, target, isImport = false, base) => {
244
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
245
+ if (key === ".") {
246
+ assert(isImport === false);
247
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
248
+ }
249
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
250
+ target
251
+ )} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
252
+ },
253
+ Error
254
+ );
255
+ var ERR_MODULE_NOT_FOUND = createError(
256
+ "ERR_MODULE_NOT_FOUND",
257
+ (path2, base, exactUrl = false) => {
258
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path2}' imported from ${base}`;
259
+ },
260
+ Error
261
+ );
262
+ createError(
263
+ "ERR_NETWORK_IMPORT_DISALLOWED",
264
+ "import of '%s' by %s is not supported: %s",
265
+ Error
266
+ );
267
+ var ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
268
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
269
+ (specifier, packagePath, base) => {
270
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
271
+ },
272
+ TypeError
273
+ );
274
+ var ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
275
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
276
+ /**
277
+ * @param {string} packagePath
278
+ * @param {string} subpath
279
+ * @param {string} [base]
280
+ */
281
+ (packagePath, subpath, base) => {
282
+ if (subpath === ".")
283
+ return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
284
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
285
+ },
286
+ Error
287
+ );
288
+ var ERR_UNSUPPORTED_DIR_IMPORT = createError(
289
+ "ERR_UNSUPPORTED_DIR_IMPORT",
290
+ "Directory import '%s' is not supported resolving ES modules imported from %s",
291
+ Error
292
+ );
293
+ var ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
294
+ "ERR_UNSUPPORTED_RESOLVE_REQUEST",
295
+ 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
296
+ TypeError
297
+ );
298
+ var ERR_UNKNOWN_FILE_EXTENSION = createError(
299
+ "ERR_UNKNOWN_FILE_EXTENSION",
300
+ (extension, path2) => {
301
+ return `Unknown file extension "${extension}" for ${path2}`;
302
+ },
303
+ TypeError
304
+ );
305
+ createError(
306
+ "ERR_INVALID_ARG_VALUE",
307
+ (name, value, reason = "is invalid") => {
308
+ let inspected = inspect(value);
309
+ if (inspected.length > 128) {
310
+ inspected = `${inspected.slice(0, 128)}...`;
311
+ }
312
+ const type = name.includes(".") ? "property" : "argument";
313
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
314
+ },
315
+ TypeError
316
+ // Note: extra classes have been shaken out.
317
+ // , RangeError
318
+ );
319
+ var hasOwnProperty$1 = {}.hasOwnProperty;
320
+ var hasOwnProperty = {}.hasOwnProperty;
321
+ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
322
+ var own = {}.hasOwnProperty;
323
+ var isWindows = (() => process.platform === "win32")();
324
+ var globalCache = (() => (
325
+ // eslint-disable-next-line unicorn/no-unreadable-iife
326
+ globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map()
327
+ ))();
328
+
21
329
  // ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
22
330
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
23
331
  function normalizeWindowsPath(input = "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react",
3
- "version": "10.0.0-beta.7",
3
+ "version": "10.0.0-beta.8",
4
4
  "description": "Storybook React renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@storybook/global": "^5.0.0",
57
- "@storybook/react-dom-shim": "10.0.0-beta.7"
57
+ "@storybook/react-dom-shim": "10.0.0-beta.8"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/babel-plugin-react-docgen": "^4.2.3",
@@ -80,7 +80,7 @@
80
80
  "peerDependencies": {
81
81
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
82
82
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
83
- "storybook": "^10.0.0-beta.7",
83
+ "storybook": "^10.0.0-beta.8",
84
84
  "typescript": ">= 4.9.x"
85
85
  },
86
86
  "peerDependenciesMeta": {