@storybook/preset-react-webpack 10.1.0-alpha.1 → 10.1.0-alpha.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.
@@ -1,17 +1,14 @@
1
- import CJS_COMPAT_NODE_URL_50hdxysojm3 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_50hdxysojm3 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_50hdxysojm3 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0o4u5phjrl2 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0o4u5phjrl2 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0o4u5phjrl2 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_50hdxysojm3.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_50hdxysojm3.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_50hdxysojm3.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0o4u5phjrl2.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0o4u5phjrl2.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0o4u5phjrl2.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 {
13
- __name
14
- } from "./_node-chunks/chunk-JQYM4SBP.js";
15
12
 
16
13
  // src/framework-preset-cra.ts
17
14
  import { logger as logger2 } from "storybook/internal/node-logger";
@@ -22,85 +19,58 @@ import { join } from "node:path";
22
19
  import { pathToFileURL } from "node:url";
23
20
  import { logger } from "storybook/internal/node-logger";
24
21
  import semver from "semver";
25
- var appDirectory = realpathSync(process.cwd());
26
- var reactScriptsPath;
22
+ var appDirectory = realpathSync(process.cwd()), reactScriptsPath;
27
23
  function getReactScriptsPath({ noCache } = {}) {
28
- if (reactScriptsPath && !noCache) {
24
+ if (reactScriptsPath && !noCache)
29
25
  return reactScriptsPath;
30
- }
31
26
  let reactScriptsScriptPath = realpathSync(join(appDirectory, "/node_modules/.bin/react-scripts"));
32
27
  try {
33
- const pathIsNotResolved = /node_modules[\\/]\.bin[\\/]react-scripts/i.test(
28
+ if (/node_modules[\\/]\.bin[\\/]react-scripts/i.test(
34
29
  reactScriptsScriptPath
35
- );
36
- if (pathIsNotResolved) {
37
- const content = readFileSync(reactScriptsScriptPath, "utf8");
38
- const packagePathMatch = content.match(
30
+ )) {
31
+ let packagePathMatch = readFileSync(reactScriptsScriptPath, "utf8").match(
39
32
  /"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i
40
33
  );
41
- if (packagePathMatch && packagePathMatch.length > 1) {
42
- reactScriptsScriptPath = join(appDirectory, "/node_modules/.bin/", packagePathMatch[1]);
43
- }
34
+ packagePathMatch && packagePathMatch.length > 1 && (reactScriptsScriptPath = join(appDirectory, "/node_modules/.bin/", packagePathMatch[1]));
44
35
  }
45
36
  } catch (e) {
46
37
  logger.warn(`Error occurred during react-scripts package path resolving: ${e}`);
47
38
  }
48
39
  reactScriptsPath = join(reactScriptsScriptPath, "../..");
49
- const scriptsPkgJson = join(reactScriptsPath, "package.json");
50
- if (!existsSync(scriptsPkgJson)) {
51
- reactScriptsPath = "react-scripts";
52
- }
53
- return reactScriptsPath;
40
+ let scriptsPkgJson = join(reactScriptsPath, "package.json");
41
+ return existsSync(scriptsPkgJson) || (reactScriptsPath = "react-scripts"), reactScriptsPath;
54
42
  }
55
- __name(getReactScriptsPath, "getReactScriptsPath");
56
43
  async function isReactScriptsInstalled(minimumVersion = "2.0.0") {
57
44
  try {
58
- const { default: reactScriptsJson } = await import(pathToFileURL(join(getReactScriptsPath(), "package.json")).href, {
45
+ let { default: reactScriptsJson } = await import(pathToFileURL(join(getReactScriptsPath(), "package.json")).href, {
59
46
  with: { type: "json" }
60
47
  });
61
48
  return !semver.gtr(minimumVersion, reactScriptsJson.version);
62
- } catch (e) {
63
- return false;
49
+ } catch {
50
+ return !1;
64
51
  }
65
52
  }
66
- __name(isReactScriptsInstalled, "isReactScriptsInstalled");
67
53
 
68
54
  // src/framework-preset-cra.ts
69
- var checkForNewPreset = /* @__PURE__ */ __name((presetsList) => {
70
- const hasNewPreset = presetsList.some((preset) => {
71
- const presetName = typeof preset === "string" ? preset : preset.name;
55
+ var checkForNewPreset = (presetsList) => {
56
+ presetsList.some((preset) => {
57
+ let presetName = typeof preset == "string" ? preset : preset.name;
72
58
  return /@storybook(\/|\\)preset-create-react-app/.test(presetName);
73
- });
74
- if (!hasNewPreset) {
75
- logger2.warn("Storybook support for Create React App is now a separate preset.");
76
- logger2.warn(
77
- "To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file."
78
- );
79
- logger2.warn("The built-in preset has been disabled in Storybook 6.0.");
80
- }
81
- }, "checkForNewPreset");
82
- var webpackFinal = /* @__PURE__ */ __name(async (config, { presetsList }) => {
83
- if (await isReactScriptsInstalled()) {
84
- if (presetsList) {
85
- checkForNewPreset(presetsList);
59
+ }) || (logger2.warn("Storybook support for Create React App is now a separate preset."), logger2.warn(
60
+ "To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file."
61
+ ), logger2.warn("The built-in preset has been disabled in Storybook 6.0."));
62
+ }, webpackFinal = async (config, { presetsList }) => (await isReactScriptsInstalled() && presetsList && checkForNewPreset(presetsList), config.module?.rules?.push(
63
+ {
64
+ test: /\.m?js$/,
65
+ type: "javascript/auto"
66
+ },
67
+ {
68
+ test: /\.m?js$/,
69
+ resolve: {
70
+ fullySpecified: !1
86
71
  }
87
72
  }
88
- config.module?.rules?.push(
89
- ...[
90
- {
91
- test: /\.m?js$/,
92
- type: "javascript/auto"
93
- },
94
- {
95
- test: /\.m?js$/,
96
- resolve: {
97
- fullySpecified: false
98
- }
99
- }
100
- ]
101
- );
102
- return config;
103
- }, "webpackFinal");
73
+ ), config);
104
74
  export {
105
75
  webpackFinal
106
76
  };
@@ -1,28 +1,22 @@
1
- import CJS_COMPAT_NODE_URL_50hdxysojm3 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_50hdxysojm3 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_50hdxysojm3 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0o4u5phjrl2 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0o4u5phjrl2 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0o4u5phjrl2 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_50hdxysojm3.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_50hdxysojm3.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_50hdxysojm3.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0o4u5phjrl2.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0o4u5phjrl2.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0o4u5phjrl2.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 {
13
- __name
14
- } from "./_node-chunks/chunk-JQYM4SBP.js";
15
12
 
16
13
  // src/framework-preset-react-docs.ts
17
14
  import { fileURLToPath } from "node:url";
18
- var webpackFinal = /* @__PURE__ */ __name(async (config, options) => {
19
- const typescriptOptions = await options.presets.apply("typescript", {});
20
- const debug = options.loglevel === "debug";
21
- const { reactDocgen, reactDocgenTypescriptOptions } = typescriptOptions || {};
22
- if (typeof reactDocgen !== "string") {
15
+ var webpackFinal = async (config, options) => {
16
+ let typescriptOptions = await options.presets.apply("typescript", {}), debug = options.loglevel === "debug", { reactDocgen, reactDocgenTypescriptOptions } = typescriptOptions || {};
17
+ if (typeof reactDocgen != "string")
23
18
  return config;
24
- }
25
- if (reactDocgen !== "react-docgen-typescript") {
19
+ if (reactDocgen !== "react-docgen-typescript")
26
20
  return {
27
21
  ...config,
28
22
  module: {
@@ -43,8 +37,7 @@ var webpackFinal = /* @__PURE__ */ __name(async (config, options) => {
43
37
  ]
44
38
  }
45
39
  };
46
- }
47
- const { ReactDocgenTypeScriptPlugin } = await import("@storybook/react-docgen-typescript-plugin");
40
+ let { ReactDocgenTypeScriptPlugin } = await import("@storybook/react-docgen-typescript-plugin");
48
41
  return {
49
42
  ...config,
50
43
  module: {
@@ -69,11 +62,11 @@ var webpackFinal = /* @__PURE__ */ __name(async (config, options) => {
69
62
  new ReactDocgenTypeScriptPlugin({
70
63
  ...reactDocgenTypescriptOptions,
71
64
  // We *need* this set so that RDT returns default values in the same format as react-docgen
72
- savePropValueAsString: true
65
+ savePropValueAsString: !0
73
66
  })
74
67
  ]
75
68
  };
76
- }, "webpackFinal");
69
+ };
77
70
  export {
78
71
  webpackFinal
79
72
  };
package/dist/index.js CHANGED
@@ -1,15 +1,14 @@
1
- import CJS_COMPAT_NODE_URL_50hdxysojm3 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_50hdxysojm3 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_50hdxysojm3 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0o4u5phjrl2 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0o4u5phjrl2 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0o4u5phjrl2 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_50hdxysojm3.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_50hdxysojm3.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_50hdxysojm3.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0o4u5phjrl2.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0o4u5phjrl2.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0o4u5phjrl2.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-JQYM4SBP.js";
13
12
 
14
13
  // src/index.ts
15
14
  import { fileURLToPath } from "node:url";
@@ -1,17 +1,14 @@
1
- import CJS_COMPAT_NODE_URL_50hdxysojm3 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_50hdxysojm3 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_50hdxysojm3 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0o4u5phjrl2 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0o4u5phjrl2 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0o4u5phjrl2 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_50hdxysojm3.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_50hdxysojm3.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_50hdxysojm3.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0o4u5phjrl2.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0o4u5phjrl2.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0o4u5phjrl2.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 {
13
- __name
14
- } from "../_node-chunks/chunk-JQYM4SBP.js";
15
12
 
16
13
  // src/loaders/react-docgen-loader.ts
17
14
  import { getProjectRoot } from "storybook/internal/common";
@@ -29,33 +26,21 @@ import { isAbsolute, join, resolve } from "node:path";
29
26
  function absolute(input, root) {
30
27
  return isAbsolute(input) ? input : resolve(root || ".", input);
31
28
  }
32
- __name(absolute, "absolute");
33
29
 
34
30
  // ../../node_modules/empathic/walk.mjs
35
31
  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
- }
32
+ let { last, cwd } = options || {}, tmp = absolute(base, cwd), root = absolute(last || "/", cwd), prev, arr = [];
33
+ for (; prev !== root && (arr.push(tmp), tmp = dirname(prev = tmp), tmp !== prev); )
34
+ ;
45
35
  return arr;
46
36
  }
47
- __name(up, "up");
48
37
 
49
38
  // ../../node_modules/empathic/find.mjs
50
39
  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;
56
- }
40
+ let dir, tmp, start = options && options.cwd || "";
41
+ for (dir of up(start, options))
42
+ if (tmp = join2(dir, name), existsSync(tmp)) return tmp;
57
43
  }
58
- __name(up2, "up");
59
44
 
60
45
  // src/loaders/react-docgen-loader.ts
61
46
  import MagicString from "magic-string";
@@ -78,11 +63,7 @@ var ReactDocgenResolveError = class extends Error {
78
63
  // the magic string that react-docgen uses to check if a module is ignored
79
64
  this.code = "MODULE_NOT_FOUND";
80
65
  }
81
- static {
82
- __name(this, "ReactDocgenResolveError");
83
- }
84
- };
85
- var RESOLVE_EXTENSIONS = [
66
+ }, RESOLVE_EXTENSIONS = [
86
67
  ".js",
87
68
  ".cts",
88
69
  // These were originally not in the code, I added them
@@ -101,17 +82,16 @@ var RESOLVE_EXTENSIONS = [
101
82
  ".jsx"
102
83
  ];
103
84
  function defaultLookupModule(filename, basedir) {
104
- const resolveOptions = {
85
+ let resolveOptions = {
105
86
  basedir,
106
87
  extensions: RESOLVE_EXTENSIONS,
107
88
  // we do not need to check core modules as we cannot import them anyway
108
- includeCoreModules: false
89
+ includeCoreModules: !1
109
90
  };
110
91
  try {
111
92
  return resolve2.sync(filename, resolveOptions);
112
93
  } catch (error) {
113
- const ext = extname(filename);
114
- let newFilename;
94
+ let ext = extname(filename), newFilename;
115
95
  switch (ext) {
116
96
  case ".js":
117
97
  case ".mjs":
@@ -131,26 +111,23 @@ function defaultLookupModule(filename, basedir) {
131
111
  });
132
112
  }
133
113
  }
134
- __name(defaultLookupModule, "defaultLookupModule");
135
114
 
136
115
  // src/loaders/react-docgen-loader.ts
137
- var { getNameOrValue, isReactForwardRefCall } = utils;
138
- var actualNameHandler = /* @__PURE__ */ __name(function actualNameHandler2(documentation, componentDefinition) {
139
- documentation.set("definedInFile", componentDefinition.hub.file.opts.filename);
140
- if ((componentDefinition.isClassDeclaration() || componentDefinition.isFunctionDeclaration()) && componentDefinition.has("id")) {
116
+ var { getNameOrValue, isReactForwardRefCall } = utils, actualNameHandler = function(documentation, componentDefinition) {
117
+ if (documentation.set("definedInFile", componentDefinition.hub.file.opts.filename), (componentDefinition.isClassDeclaration() || componentDefinition.isFunctionDeclaration()) && componentDefinition.has("id"))
141
118
  documentation.set(
142
119
  "actualName",
143
120
  getNameOrValue(componentDefinition.get("id"))
144
121
  );
145
- } else if (componentDefinition.isArrowFunctionExpression() || componentDefinition.isFunctionExpression() || isReactForwardRefCall(componentDefinition)) {
122
+ else if (componentDefinition.isArrowFunctionExpression() || componentDefinition.isFunctionExpression() || isReactForwardRefCall(componentDefinition)) {
146
123
  let currentPath = componentDefinition;
147
- while (currentPath.parentPath) {
124
+ for (; currentPath.parentPath; ) {
148
125
  if (currentPath.parentPath.isVariableDeclarator()) {
149
126
  documentation.set("actualName", getNameOrValue(currentPath.parentPath.get("id")));
150
127
  return;
151
128
  }
152
129
  if (currentPath.parentPath.isAssignmentExpression()) {
153
- const leftPath = currentPath.parentPath.get("left");
130
+ let leftPath = currentPath.parentPath.get("left");
154
131
  if (leftPath.isIdentifier() || leftPath.isLiteral()) {
155
132
  documentation.set("actualName", getNameOrValue(leftPath));
156
133
  return;
@@ -160,94 +137,59 @@ var actualNameHandler = /* @__PURE__ */ __name(function actualNameHandler2(docum
160
137
  }
161
138
  documentation.set("actualName", "");
162
139
  }
163
- }, "actualNameHandler");
164
- var defaultHandlers = Object.values(docgenHandlers).map((handler) => handler);
165
- var defaultResolver = new docgenResolver.FindExportedDefinitionsResolver();
166
- var handlers = [...defaultHandlers, actualNameHandler];
167
- var tsconfigPathsInitialized = false;
168
- var matchPath;
140
+ }, defaultHandlers = Object.values(docgenHandlers).map((handler) => handler), defaultResolver = new docgenResolver.FindExportedDefinitionsResolver(), handlers = [...defaultHandlers, actualNameHandler], tsconfigPathsInitialized = !1, matchPath;
169
141
  async function reactDocgenLoader(source, map) {
170
- const callback = this.async();
171
- const options = this.getOptions() || {};
172
- const { debug = false } = options;
142
+ let callback = this.async(), options = this.getOptions() || {}, { debug = !1 } = options;
173
143
  if (!tsconfigPathsInitialized) {
174
- const tsconfigPath = up2("tsconfig.json", { cwd: process.cwd(), last: getProjectRoot() });
175
- const tsconfig = TsconfigPaths.loadConfig(tsconfigPath);
176
- if (tsconfig.resultType === "success") {
177
- logger.info("Using tsconfig paths for react-docgen");
178
- matchPath = TsconfigPaths.createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths, [
179
- "browser",
180
- "module",
181
- "main"
182
- ]);
183
- }
184
- tsconfigPathsInitialized = true;
144
+ let tsconfigPath = up2("tsconfig.json", { cwd: process.cwd(), last: getProjectRoot() }), tsconfig = TsconfigPaths.loadConfig(tsconfigPath);
145
+ tsconfig.resultType === "success" && (matchPath = TsconfigPaths.createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths, [
146
+ "browser",
147
+ "module",
148
+ "main"
149
+ ])), tsconfigPathsInitialized = !0;
185
150
  }
186
151
  try {
187
- const docgenResults = parse(source, {
152
+ let docgenResults = parse(source, {
188
153
  filename: this.resourcePath,
189
154
  resolver: defaultResolver,
190
155
  handlers,
191
156
  importer: getReactDocgenImporter(matchPath),
192
157
  babelOptions: {
193
- babelrc: false,
194
- configFile: false
158
+ babelrc: !1,
159
+ configFile: !1
195
160
  }
196
- });
197
- const magicString = new MagicString(source);
161
+ }), magicString = new MagicString(source);
198
162
  docgenResults.forEach((info) => {
199
- const { actualName, definedInFile, ...docgenInfo } = info;
163
+ let { actualName, definedInFile, ...docgenInfo } = info;
200
164
  if (actualName && definedInFile == this.resourcePath) {
201
- const docNode = JSON.stringify(docgenInfo);
165
+ let docNode = JSON.stringify(docgenInfo);
202
166
  magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
203
167
  }
204
- });
205
- callback(
168
+ }), callback(
206
169
  null,
207
170
  magicString.toString(),
208
171
  map ?? magicString.generateMap({
209
- hires: true,
172
+ hires: !0,
210
173
  source: this.resourcePath,
211
- includeContent: true
174
+ includeContent: !0
212
175
  })
213
176
  );
214
177
  } catch (error) {
215
- if (error.code === ERROR_CODES.MISSING_DEFINITION) {
216
- callback(null, source);
217
- } else {
218
- if (!debug) {
219
- logger.warn(
220
- `Failed to parse ${this.resourcePath} with react-docgen. Rerun Storybook with --loglevel=debug to get more info.`
221
- );
222
- } else {
223
- logger.warn(
224
- `Failed to parse ${this.resourcePath} with react-docgen. Please use the below error message and the content of the file which causes the error to report the issue to the maintainers of react-docgen. https://github.com/reactjs/react-docgen`
225
- );
226
- logger.error(error);
227
- }
228
- callback(null, source);
229
- }
178
+ error.code === ERROR_CODES.MISSING_DEFINITION || (debug ? (logger.warn(
179
+ `Failed to parse ${this.resourcePath} with react-docgen. Please use the below error message and the content of the file which causes the error to report the issue to the maintainers of react-docgen. https://github.com/reactjs/react-docgen`
180
+ ), logger.error(error)) : logger.warn(
181
+ `Failed to parse ${this.resourcePath} with react-docgen. Rerun Storybook with --loglevel=debug to get more info.`
182
+ )), callback(null, source);
230
183
  }
231
184
  }
232
- __name(reactDocgenLoader, "reactDocgenLoader");
233
185
  function getReactDocgenImporter(matchingPath) {
234
186
  return makeFsImporter((filename, basedir) => {
235
- const mappedFilenameByPaths = (() => {
236
- if (matchingPath) {
237
- const match = matchingPath(filename);
238
- return match || filename;
239
- } else {
240
- return filename;
241
- }
242
- })();
243
- const result = defaultLookupModule(mappedFilenameByPaths, basedir);
244
- if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
187
+ let mappedFilenameByPaths = matchingPath && matchingPath(filename) || filename, result = defaultLookupModule(mappedFilenameByPaths, basedir);
188
+ if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext)))
245
189
  return result;
246
- }
247
190
  throw new ReactDocgenResolveError(filename);
248
191
  });
249
192
  }
250
- __name(getReactDocgenImporter, "getReactDocgenImporter");
251
193
  export {
252
194
  reactDocgenLoader as default,
253
195
  getReactDocgenImporter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preset-react-webpack",
3
- "version": "10.1.0-alpha.1",
3
+ "version": "10.1.0-alpha.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.1.0-alpha.1",
45
+ "@storybook/core-webpack": "10.1.0-alpha.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",
@@ -60,7 +60,7 @@
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.1.0-alpha.1"
63
+ "storybook": "^10.1.0-alpha.11"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
66
  "typescript": {
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae16"
73
+ "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
74
74
  }
@@ -1,17 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_50hdxysojm3 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_50hdxysojm3 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_50hdxysojm3 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_50hdxysojm3.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_50hdxysojm3.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_50hdxysojm3.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
- };