@storybook/preset-react-webpack 10.1.0-alpha.10 → 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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
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-4GMQCHVS.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
|
-
|
|
28
|
+
if (/node_modules[\\/]\.bin[\\/]react-scripts/i.test(
|
|
34
29
|
reactScriptsScriptPath
|
|
35
|
-
)
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
|
63
|
-
return
|
|
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 =
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
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-4GMQCHVS.js";
|
|
15
12
|
|
|
16
13
|
// src/framework-preset-react-docs.ts
|
|
17
14
|
import { fileURLToPath } from "node:url";
|
|
18
|
-
var webpackFinal =
|
|
19
|
-
|
|
20
|
-
|
|
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:
|
|
65
|
+
savePropValueAsString: !0
|
|
73
66
|
})
|
|
74
67
|
]
|
|
75
68
|
};
|
|
76
|
-
}
|
|
69
|
+
};
|
|
77
70
|
export {
|
|
78
71
|
webpackFinal
|
|
79
72
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
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-4GMQCHVS.js";
|
|
13
12
|
|
|
14
13
|
// src/index.ts
|
|
15
14
|
import { fileURLToPath } from "node:url";
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
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-4GMQCHVS.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
|
-
|
|
38
|
-
|
|
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
|
-
|
|
53
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
89
|
+
includeCoreModules: !1
|
|
109
90
|
};
|
|
110
91
|
try {
|
|
111
92
|
return resolve2.sync(filename, resolveOptions);
|
|
112
93
|
} catch (error) {
|
|
113
|
-
|
|
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
|
-
|
|
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
|
-
|
|
122
|
+
else if (componentDefinition.isArrowFunctionExpression() || componentDefinition.isFunctionExpression() || isReactForwardRefCall(componentDefinition)) {
|
|
146
123
|
let currentPath = componentDefinition;
|
|
147
|
-
|
|
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
|
-
|
|
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,93 +137,59 @@ var actualNameHandler = /* @__PURE__ */ __name(function actualNameHandler2(docum
|
|
|
160
137
|
}
|
|
161
138
|
documentation.set("actualName", "");
|
|
162
139
|
}
|
|
163
|
-
},
|
|
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
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"main"
|
|
181
|
-
]);
|
|
182
|
-
}
|
|
183
|
-
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;
|
|
184
150
|
}
|
|
185
151
|
try {
|
|
186
|
-
|
|
152
|
+
let docgenResults = parse(source, {
|
|
187
153
|
filename: this.resourcePath,
|
|
188
154
|
resolver: defaultResolver,
|
|
189
155
|
handlers,
|
|
190
156
|
importer: getReactDocgenImporter(matchPath),
|
|
191
157
|
babelOptions: {
|
|
192
|
-
babelrc:
|
|
193
|
-
configFile:
|
|
158
|
+
babelrc: !1,
|
|
159
|
+
configFile: !1
|
|
194
160
|
}
|
|
195
|
-
});
|
|
196
|
-
const magicString = new MagicString(source);
|
|
161
|
+
}), magicString = new MagicString(source);
|
|
197
162
|
docgenResults.forEach((info) => {
|
|
198
|
-
|
|
163
|
+
let { actualName, definedInFile, ...docgenInfo } = info;
|
|
199
164
|
if (actualName && definedInFile == this.resourcePath) {
|
|
200
|
-
|
|
165
|
+
let docNode = JSON.stringify(docgenInfo);
|
|
201
166
|
magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
|
|
202
167
|
}
|
|
203
|
-
})
|
|
204
|
-
callback(
|
|
168
|
+
}), callback(
|
|
205
169
|
null,
|
|
206
170
|
magicString.toString(),
|
|
207
171
|
map ?? magicString.generateMap({
|
|
208
|
-
hires:
|
|
172
|
+
hires: !0,
|
|
209
173
|
source: this.resourcePath,
|
|
210
|
-
includeContent:
|
|
174
|
+
includeContent: !0
|
|
211
175
|
})
|
|
212
176
|
);
|
|
213
177
|
} catch (error) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
`Failed to parse ${this.resourcePath} with react-docgen. Rerun Storybook with --loglevel=debug to get more info.`
|
|
220
|
-
);
|
|
221
|
-
} else {
|
|
222
|
-
logger.warn(
|
|
223
|
-
`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`
|
|
224
|
-
);
|
|
225
|
-
logger.error(error);
|
|
226
|
-
}
|
|
227
|
-
callback(null, source);
|
|
228
|
-
}
|
|
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);
|
|
229
183
|
}
|
|
230
184
|
}
|
|
231
|
-
__name(reactDocgenLoader, "reactDocgenLoader");
|
|
232
185
|
function getReactDocgenImporter(matchingPath) {
|
|
233
186
|
return makeFsImporter((filename, basedir) => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const match = matchingPath(filename);
|
|
237
|
-
return match || filename;
|
|
238
|
-
} else {
|
|
239
|
-
return filename;
|
|
240
|
-
}
|
|
241
|
-
})();
|
|
242
|
-
const result = defaultLookupModule(mappedFilenameByPaths, basedir);
|
|
243
|
-
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)))
|
|
244
189
|
return result;
|
|
245
|
-
}
|
|
246
190
|
throw new ReactDocgenResolveError(filename);
|
|
247
191
|
});
|
|
248
192
|
}
|
|
249
|
-
__name(getReactDocgenImporter, "getReactDocgenImporter");
|
|
250
193
|
export {
|
|
251
194
|
reactDocgenLoader as default,
|
|
252
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.
|
|
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.
|
|
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.
|
|
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": "
|
|
73
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
|
|
74
74
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_6kmuek8ya0l from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_6kmuek8ya0l from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_6kmuek8ya0l from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_6kmuek8ya0l.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_6kmuek8ya0l.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_6kmuek8ya0l.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
|
-
};
|