@storybook/preset-react-webpack 10.0.0-beta.1 → 10.0.0-beta.11

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.
@@ -0,0 +1,17 @@
1
+ import CJS_COMPAT_NODE_URL_pj46kobnpo from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_pj46kobnpo from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_pj46kobnpo from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_pj46kobnpo.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_pj46kobnpo.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_pj46kobnpo.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ var __defProp = Object.defineProperty;
13
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
+
15
+ export {
16
+ __name
17
+ };
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_l1pymz4uknn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_l1pymz4uknn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_l1pymz4uknn from "node:module";
1
+ import CJS_COMPAT_NODE_URL_pj46kobnpo from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_pj46kobnpo from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_pj46kobnpo from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_l1pymz4uknn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_l1pymz4uknn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_l1pymz4uknn.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_pj46kobnpo.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_pj46kobnpo.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_pj46kobnpo.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
13
  __name
14
- } from "./_node-chunks/chunk-4BQ3AVSQ.js";
14
+ } from "./_node-chunks/chunk-WHMASQAG.js";
15
15
 
16
16
  // src/framework-preset-cra.ts
17
17
  import { logger as logger2 } from "storybook/internal/node-logger";
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_l1pymz4uknn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_l1pymz4uknn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_l1pymz4uknn from "node:module";
1
+ import CJS_COMPAT_NODE_URL_pj46kobnpo from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_pj46kobnpo from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_pj46kobnpo from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_l1pymz4uknn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_l1pymz4uknn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_l1pymz4uknn.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_pj46kobnpo.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_pj46kobnpo.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_pj46kobnpo.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
13
  __name
14
- } from "./_node-chunks/chunk-4BQ3AVSQ.js";
14
+ } from "./_node-chunks/chunk-WHMASQAG.js";
15
15
 
16
16
  // src/framework-preset-react-docs.ts
17
17
  import { fileURLToPath } from "node:url";
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import CJS_COMPAT_NODE_URL_l1pymz4uknn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_l1pymz4uknn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_l1pymz4uknn from "node:module";
1
+ import CJS_COMPAT_NODE_URL_pj46kobnpo from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_pj46kobnpo from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_pj46kobnpo from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_l1pymz4uknn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_l1pymz4uknn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_l1pymz4uknn.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_pj46kobnpo.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_pj46kobnpo.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_pj46kobnpo.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import "./_node-chunks/chunk-4BQ3AVSQ.js";
12
+ import "./_node-chunks/chunk-WHMASQAG.js";
13
13
 
14
14
  // src/index.ts
15
15
  import { fileURLToPath } from "node:url";
@@ -1,270 +1,61 @@
1
- import CJS_COMPAT_NODE_URL_l1pymz4uknn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_l1pymz4uknn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_l1pymz4uknn from "node:module";
1
+ import CJS_COMPAT_NODE_URL_pj46kobnpo from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_pj46kobnpo from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_pj46kobnpo from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_l1pymz4uknn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_l1pymz4uknn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_l1pymz4uknn.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_pj46kobnpo.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_pj46kobnpo.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_pj46kobnpo.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
13
  __name
14
- } from "../_node-chunks/chunk-4BQ3AVSQ.js";
14
+ } from "../_node-chunks/chunk-WHMASQAG.js";
15
15
 
16
16
  // src/loaders/react-docgen-loader.ts
17
17
  import { getProjectRoot } from "storybook/internal/common";
18
18
  import { logger } from "storybook/internal/node-logger";
19
19
 
20
- // ../../node_modules/find-up/index.js
21
- import path2 from "node:path";
20
+ // ../../node_modules/empathic/find.mjs
21
+ import { join as join2 } from "node:path";
22
+ import { existsSync, statSync } from "node:fs";
22
23
 
23
- // ../../node_modules/locate-path/index.js
24
- import process2 from "node:process";
25
- import path from "node:path";
26
- import fs, { promises as fsPromises } from "node:fs";
27
- import { fileURLToPath } from "node:url";
24
+ // ../../node_modules/empathic/walk.mjs
25
+ import { dirname } from "node:path";
28
26
 
29
- // ../../node_modules/yocto-queue/index.js
30
- var Node = class {
31
- static {
32
- __name(this, "Node");
33
- }
34
- value;
35
- next;
36
- constructor(value) {
37
- this.value = value;
38
- }
39
- };
40
- var Queue = class {
41
- static {
42
- __name(this, "Queue");
43
- }
44
- #head;
45
- #tail;
46
- #size;
47
- constructor() {
48
- this.clear();
49
- }
50
- enqueue(value) {
51
- const node = new Node(value);
52
- if (this.#head) {
53
- this.#tail.next = node;
54
- this.#tail = node;
55
- } else {
56
- this.#head = node;
57
- this.#tail = node;
58
- }
59
- this.#size++;
60
- }
61
- dequeue() {
62
- const current = this.#head;
63
- if (!current) {
64
- return;
65
- }
66
- this.#head = this.#head.next;
67
- this.#size--;
68
- return current.value;
69
- }
70
- peek() {
71
- if (!this.#head) {
72
- return;
73
- }
74
- return this.#head.value;
75
- }
76
- clear() {
77
- this.#head = void 0;
78
- this.#tail = void 0;
79
- this.#size = 0;
80
- }
81
- get size() {
82
- return this.#size;
83
- }
84
- *[Symbol.iterator]() {
85
- let current = this.#head;
86
- while (current) {
87
- yield current.value;
88
- current = current.next;
89
- }
90
- }
91
- *drain() {
92
- while (this.#head) {
93
- yield this.dequeue();
94
- }
95
- }
96
- };
97
-
98
- // ../../node_modules/locate-path/node_modules/p-limit/index.js
99
- function pLimit(concurrency) {
100
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
101
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
102
- }
103
- const queue = new Queue();
104
- let activeCount = 0;
105
- const next = /* @__PURE__ */ __name(() => {
106
- activeCount--;
107
- if (queue.size > 0) {
108
- queue.dequeue()();
109
- }
110
- }, "next");
111
- const run = /* @__PURE__ */ __name(async (fn, resolve2, args) => {
112
- activeCount++;
113
- const result = (async () => fn(...args))();
114
- resolve2(result);
115
- try {
116
- await result;
117
- } catch {
118
- }
119
- next();
120
- }, "run");
121
- const enqueue = /* @__PURE__ */ __name((fn, resolve2, args) => {
122
- queue.enqueue(run.bind(void 0, fn, resolve2, args));
123
- (async () => {
124
- await Promise.resolve();
125
- if (activeCount < concurrency && queue.size > 0) {
126
- queue.dequeue()();
127
- }
128
- })();
129
- }, "enqueue");
130
- const generator = /* @__PURE__ */ __name((fn, ...args) => new Promise((resolve2) => {
131
- enqueue(fn, resolve2, args);
132
- }), "generator");
133
- Object.defineProperties(generator, {
134
- activeCount: {
135
- get: /* @__PURE__ */ __name(() => activeCount, "get")
136
- },
137
- pendingCount: {
138
- get: /* @__PURE__ */ __name(() => queue.size, "get")
139
- },
140
- clearQueue: {
141
- value: /* @__PURE__ */ __name(() => {
142
- queue.clear();
143
- }, "value")
144
- }
145
- });
146
- return generator;
147
- }
148
- __name(pLimit, "pLimit");
149
-
150
- // ../../node_modules/locate-path/node_modules/p-locate/index.js
151
- var EndError = class extends Error {
152
- static {
153
- __name(this, "EndError");
154
- }
155
- constructor(value) {
156
- super();
157
- this.value = value;
158
- }
159
- };
160
- var testElement = /* @__PURE__ */ __name(async (element, tester) => tester(await element), "testElement");
161
- var finder = /* @__PURE__ */ __name(async (element) => {
162
- const values = await Promise.all(element);
163
- if (values[1] === true) {
164
- throw new EndError(values[0]);
165
- }
166
- return false;
167
- }, "finder");
168
- async function pLocate(iterable, tester, {
169
- concurrency = Number.POSITIVE_INFINITY,
170
- preserveOrder = true
171
- } = {}) {
172
- const limit = pLimit(concurrency);
173
- const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
174
- const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
175
- try {
176
- await Promise.all(items.map((element) => checkLimit(finder, element)));
177
- } catch (error) {
178
- if (error instanceof EndError) {
179
- return error.value;
180
- }
181
- throw error;
182
- }
27
+ // ../../node_modules/empathic/resolve.mjs
28
+ import { isAbsolute, join, resolve } from "node:path";
29
+ function absolute(input, root) {
30
+ return isAbsolute(input) ? input : resolve(root || ".", input);
183
31
  }
184
- __name(pLocate, "pLocate");
32
+ __name(absolute, "absolute");
185
33
 
186
- // ../../node_modules/locate-path/index.js
187
- var typeMappings = {
188
- directory: "isDirectory",
189
- file: "isFile"
190
- };
191
- function checkType(type) {
192
- if (Object.hasOwnProperty.call(typeMappings, type)) {
193
- return;
194
- }
195
- throw new Error(`Invalid type specified: ${type}`);
196
- }
197
- __name(checkType, "checkType");
198
- var matchType = /* @__PURE__ */ __name((type, stat) => stat[typeMappings[type]](), "matchType");
199
- var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
200
- async function locatePath(paths, {
201
- cwd = process2.cwd(),
202
- type = "file",
203
- allowSymlinks = true,
204
- concurrency,
205
- preserveOrder
206
- } = {}) {
207
- checkType(type);
208
- cwd = toPath(cwd);
209
- const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;
210
- return pLocate(paths, async (path_) => {
211
- try {
212
- const stat = await statFunction(path.resolve(cwd, path_));
213
- return matchType(type, stat);
214
- } catch {
215
- return false;
216
- }
217
- }, { concurrency, preserveOrder });
34
+ // ../../node_modules/empathic/walk.mjs
35
+ function up(base, options) {
36
+ let { last, cwd } = options || {};
37
+ let tmp = absolute(base, cwd);
38
+ let root = absolute(last || "/", cwd);
39
+ let prev, arr = [];
40
+ while (prev !== root) {
41
+ arr.push(tmp);
42
+ tmp = dirname(prev = tmp);
43
+ if (tmp === prev) break;
44
+ }
45
+ return arr;
218
46
  }
219
- __name(locatePath, "locatePath");
47
+ __name(up, "up");
220
48
 
221
- // ../../node_modules/find-up/node_modules/unicorn-magic/node.js
222
- import { fileURLToPath as fileURLToPath2 } from "node:url";
223
- function toPath2(urlOrPath) {
224
- return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
225
- }
226
- __name(toPath2, "toPath");
227
-
228
- // ../../node_modules/find-up/index.js
229
- var findUpStop = Symbol("findUpStop");
230
- async function findUpMultiple(name, options = {}) {
231
- let directory = path2.resolve(toPath2(options.cwd) ?? "");
232
- const { root } = path2.parse(directory);
233
- const stopAt = path2.resolve(directory, toPath2(options.stopAt ?? root));
234
- const limit = options.limit ?? Number.POSITIVE_INFINITY;
235
- const paths = [name].flat();
236
- const runMatcher = /* @__PURE__ */ __name(async (locateOptions) => {
237
- if (typeof name !== "function") {
238
- return locatePath(paths, locateOptions);
239
- }
240
- const foundPath = await name(locateOptions.cwd);
241
- if (typeof foundPath === "string") {
242
- return locatePath([foundPath], locateOptions);
243
- }
244
- return foundPath;
245
- }, "runMatcher");
246
- const matches = [];
247
- while (true) {
248
- const foundPath = await runMatcher({ ...options, cwd: directory });
249
- if (foundPath === findUpStop) {
250
- break;
251
- }
252
- if (foundPath) {
253
- matches.push(path2.resolve(directory, foundPath));
254
- }
255
- if (directory === stopAt || matches.length >= limit) {
256
- break;
257
- }
258
- directory = path2.dirname(directory);
49
+ // ../../node_modules/empathic/find.mjs
50
+ function up2(name, options) {
51
+ let dir, tmp;
52
+ let start = options && options.cwd || "";
53
+ for (dir of up(start, options)) {
54
+ tmp = join2(dir, name);
55
+ if (existsSync(tmp)) return tmp;
259
56
  }
260
- return matches;
261
- }
262
- __name(findUpMultiple, "findUpMultiple");
263
- async function findUp(name, options = {}) {
264
- const matches = await findUpMultiple(name, { ...options, limit: 1 });
265
- return matches[0];
266
57
  }
267
- __name(findUp, "findUp");
58
+ __name(up2, "up");
268
59
 
269
60
  // src/loaders/react-docgen-loader.ts
270
61
  import MagicString from "magic-string";
@@ -280,7 +71,7 @@ import * as TsconfigPaths from "tsconfig-paths";
280
71
 
281
72
  // src/loaders/docgen-resolver.ts
282
73
  import { extname } from "node:path";
283
- import resolve from "resolve";
74
+ import resolve2 from "resolve";
284
75
  var ReactDocgenResolveError = class extends Error {
285
76
  constructor(filename) {
286
77
  super(`'${filename}' was ignored by react-docgen.`);
@@ -317,7 +108,7 @@ function defaultLookupModule(filename, basedir) {
317
108
  includeCoreModules: false
318
109
  };
319
110
  try {
320
- return resolve.sync(filename, resolveOptions);
111
+ return resolve2.sync(filename, resolveOptions);
321
112
  } catch (error) {
322
113
  const ext = extname(filename);
323
114
  let newFilename;
@@ -333,7 +124,7 @@ function defaultLookupModule(filename, basedir) {
333
124
  default:
334
125
  throw error;
335
126
  }
336
- return resolve.sync(newFilename, {
127
+ return resolve2.sync(newFilename, {
337
128
  ...resolveOptions,
338
129
  // we already know that there is an extension at this point, so no need to check other extensions
339
130
  extensions: []
@@ -380,10 +171,7 @@ async function reactDocgenLoader(source, map) {
380
171
  const options = this.getOptions() || {};
381
172
  const { debug = false } = options;
382
173
  if (!tsconfigPathsInitialized) {
383
- const tsconfigPath = await findUp("tsconfig.json", {
384
- cwd: process.cwd(),
385
- stopAt: getProjectRoot()
386
- });
174
+ const tsconfigPath = up2("tsconfig.json", { cwd: process.cwd(), last: getProjectRoot() });
387
175
  const tsconfig = TsconfigPaths.loadConfig(tsconfigPath);
388
176
  if (tsconfig.resultType === "success") {
389
177
  logger.info("Using tsconfig paths for react-docgen");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preset-react-webpack",
3
- "version": "10.0.0-beta.1",
3
+ "version": "10.0.0-beta.11",
4
4
  "description": "Storybook for React: Develop React Component in isolation with Hot Reloading",
5
5
  "keywords": [
6
6
  "storybook"
@@ -42,7 +42,7 @@
42
42
  "prep": "jiti ../../../scripts/build/build-package.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@storybook/core-webpack": "10.0.0-beta.1",
45
+ "@storybook/core-webpack": "10.0.0-beta.11",
46
46
  "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0",
47
47
  "@types/semver": "^7.3.4",
48
48
  "magic-string": "^0.30.5",
@@ -54,13 +54,13 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "^22.0.0",
57
- "find-up": "^7.0.0",
57
+ "empathic": "^2.0.0",
58
58
  "typescript": "^5.8.3"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
62
62
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
63
- "storybook": "^10.0.0-beta.1"
63
+ "storybook": "^10.0.0-beta.11"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
66
  "typescript": {
@@ -1,17 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_l1pymz4uknn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_l1pymz4uknn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_l1pymz4uknn from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_l1pymz4uknn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_l1pymz4uknn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_l1pymz4uknn.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- var __defProp = Object.defineProperty;
13
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
-
15
- export {
16
- __name
17
- };