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