@storybook/react 10.2.0-alpha.17 → 10.2.0-alpha.18
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.
- package/dist/preset.js +127 -127
- package/package.json +3 -3
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_9w8p5uoemvw from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9w8p5uoemvw from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9w8p5uoemvw from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9w8p5uoemvw.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9w8p5uoemvw.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9w8p5uoemvw.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -88,11 +88,11 @@ var require_filesystem = __commonJS({
|
|
|
88
88
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
89
89
|
exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
|
|
90
90
|
var fs = __require("fs");
|
|
91
|
-
function fileExistsSync(
|
|
92
|
-
if (!fs.existsSync(
|
|
91
|
+
function fileExistsSync(path3) {
|
|
92
|
+
if (!fs.existsSync(path3))
|
|
93
93
|
return !1;
|
|
94
94
|
try {
|
|
95
|
-
var stats = fs.statSync(
|
|
95
|
+
var stats = fs.statSync(path3);
|
|
96
96
|
return stats.isFile();
|
|
97
97
|
} catch {
|
|
98
98
|
return !1;
|
|
@@ -104,8 +104,8 @@ var require_filesystem = __commonJS({
|
|
|
104
104
|
return __require(packageJsonPath);
|
|
105
105
|
}
|
|
106
106
|
exports.readJsonFromDiskSync = readJsonFromDiskSync;
|
|
107
|
-
function readJsonFromDiskAsync(
|
|
108
|
-
fs.readFile(
|
|
107
|
+
function readJsonFromDiskAsync(path3, callback) {
|
|
108
|
+
fs.readFile(path3, "utf8", function(err, result) {
|
|
109
109
|
if (err || !result)
|
|
110
110
|
return callback();
|
|
111
111
|
var json = JSON.parse(result);
|
|
@@ -113,16 +113,16 @@ var require_filesystem = __commonJS({
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
|
|
116
|
-
function fileExistsAsync(
|
|
117
|
-
fs.stat(
|
|
116
|
+
function fileExistsAsync(path22, callback2) {
|
|
117
|
+
fs.stat(path22, function(err, stats) {
|
|
118
118
|
if (err)
|
|
119
119
|
return callback2(void 0, !1);
|
|
120
120
|
callback2(void 0, stats ? stats.isFile() : !1);
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
exports.fileExistsAsync = fileExistsAsync;
|
|
124
|
-
function removeExtension(
|
|
125
|
-
return
|
|
124
|
+
function removeExtension(path3) {
|
|
125
|
+
return path3.substring(0, path3.lastIndexOf(".")) || path3;
|
|
126
126
|
}
|
|
127
127
|
exports.removeExtension = removeExtension;
|
|
128
128
|
}
|
|
@@ -134,14 +134,14 @@ var require_mapping_entry = __commonJS({
|
|
|
134
134
|
"use strict";
|
|
135
135
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
136
136
|
exports.getAbsoluteMappingEntries = void 0;
|
|
137
|
-
var
|
|
137
|
+
var path3 = __require("path");
|
|
138
138
|
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
|
|
139
139
|
for (var sortedKeys = sortByLongestPrefix(Object.keys(paths)), absolutePaths = [], _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
|
|
140
140
|
var key = sortedKeys_1[_i];
|
|
141
141
|
absolutePaths.push({
|
|
142
142
|
pattern: key,
|
|
143
143
|
paths: paths[key].map(function(pathToResolve) {
|
|
144
|
-
return
|
|
144
|
+
return path3.resolve(absoluteBaseUrl, pathToResolve);
|
|
145
145
|
})
|
|
146
146
|
});
|
|
147
147
|
}
|
|
@@ -169,7 +169,7 @@ var require_try_path = __commonJS({
|
|
|
169
169
|
"use strict";
|
|
170
170
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
171
171
|
exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0;
|
|
172
|
-
var
|
|
172
|
+
var path3 = __require("path"), path_1 = __require("path"), filesystem_1 = require_filesystem();
|
|
173
173
|
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
|
|
174
174
|
if (!(!absolutePathMappings || !requestedModule || requestedModule[0] === ".")) {
|
|
175
175
|
for (var pathsToTry = [], _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
|
|
@@ -181,9 +181,9 @@ var require_try_path = __commonJS({
|
|
|
181
181
|
return { type: "extension", path: physicalPath + e };
|
|
182
182
|
})), pathsToTry.push({
|
|
183
183
|
type: "package",
|
|
184
|
-
path:
|
|
184
|
+
path: path3.join(physicalPath, "/package.json")
|
|
185
185
|
});
|
|
186
|
-
var indexPath =
|
|
186
|
+
var indexPath = path3.join(physicalPath, "/index");
|
|
187
187
|
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
188
188
|
return { type: "index", path: indexPath + e };
|
|
189
189
|
}));
|
|
@@ -225,7 +225,7 @@ var require_match_path_sync = __commonJS({
|
|
|
225
225
|
"use strict";
|
|
226
226
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
227
227
|
exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
|
|
228
|
-
var
|
|
228
|
+
var path3 = __require("path"), Filesystem = require_filesystem(), MappingEntry = require_mapping_entry(), TryPath = require_try_path();
|
|
229
229
|
function createMatchPath2(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
|
230
230
|
mainFields === void 0 && (mainFields = ["main"]), addMatchAll === void 0 && (addMatchAll = !0);
|
|
231
231
|
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
|
@@ -247,7 +247,7 @@ var require_match_path_sync = __commonJS({
|
|
|
247
247
|
return obj[key];
|
|
248
248
|
}, packageJson);
|
|
249
249
|
if (candidateMapping && typeof candidateMapping == "string") {
|
|
250
|
-
var candidateFilePath =
|
|
250
|
+
var candidateFilePath = path3.join(path3.dirname(packageJsonPath), candidateMapping);
|
|
251
251
|
if (fileExists(candidateFilePath))
|
|
252
252
|
return candidateFilePath;
|
|
253
253
|
}
|
|
@@ -280,7 +280,7 @@ var require_match_path_async = __commonJS({
|
|
|
280
280
|
"use strict";
|
|
281
281
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
282
282
|
exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0;
|
|
283
|
-
var
|
|
283
|
+
var path3 = __require("path"), TryPath = require_try_path(), MappingEntry = require_mapping_entry(), Filesystem = require_filesystem();
|
|
284
284
|
function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
|
285
285
|
mainFields === void 0 && (mainFields = ["main"]), addMatchAll === void 0 && (addMatchAll = !0);
|
|
286
286
|
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
|
@@ -307,7 +307,7 @@ var require_match_path_async = __commonJS({
|
|
|
307
307
|
}, packageJson);
|
|
308
308
|
if (typeof mainFieldMapping != "string")
|
|
309
309
|
return tryNext();
|
|
310
|
-
var mappedFilePath =
|
|
310
|
+
var mappedFilePath = path3.join(path3.dirname(packageJsonPath), mainFieldMapping);
|
|
311
311
|
fileExistsAsync(mappedFilePath, function(err, exists) {
|
|
312
312
|
return err ? doneCallback(err) : exists ? doneCallback(void 0, mappedFilePath) : tryNext();
|
|
313
313
|
});
|
|
@@ -1219,7 +1219,7 @@ var require_tsconfig_loader = __commonJS({
|
|
|
1219
1219
|
};
|
|
1220
1220
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
1221
1221
|
exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0;
|
|
1222
|
-
var
|
|
1222
|
+
var path3 = __require("path"), fs = __require("fs"), JSON5 = require_lib(), StripBom = require_strip_bom();
|
|
1223
1223
|
function tsConfigLoader(_a) {
|
|
1224
1224
|
var getEnv = _a.getEnv, cwd2 = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b, TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT"), TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL"), loadResult = loadSync(cwd2, TS_NODE_PROJECT, TS_NODE_BASEURL);
|
|
1225
1225
|
return loadResult;
|
|
@@ -1242,22 +1242,22 @@ var require_tsconfig_loader = __commonJS({
|
|
|
1242
1242
|
}
|
|
1243
1243
|
function resolveConfigPath(cwd2, filename) {
|
|
1244
1244
|
if (filename) {
|
|
1245
|
-
var absolutePath = fs.lstatSync(filename).isDirectory() ?
|
|
1245
|
+
var absolutePath = fs.lstatSync(filename).isDirectory() ? path3.resolve(filename, "./tsconfig.json") : path3.resolve(cwd2, filename);
|
|
1246
1246
|
return absolutePath;
|
|
1247
1247
|
}
|
|
1248
1248
|
if (fs.statSync(cwd2).isFile())
|
|
1249
|
-
return
|
|
1249
|
+
return path3.resolve(cwd2);
|
|
1250
1250
|
var configAbsolutePath = walkForTsConfig(cwd2);
|
|
1251
|
-
return configAbsolutePath ?
|
|
1251
|
+
return configAbsolutePath ? path3.resolve(configAbsolutePath) : void 0;
|
|
1252
1252
|
}
|
|
1253
1253
|
function walkForTsConfig(directory, readdirSync) {
|
|
1254
1254
|
readdirSync === void 0 && (readdirSync = fs.readdirSync);
|
|
1255
1255
|
for (var files = readdirSync(directory), filesToCheck = ["tsconfig.json", "jsconfig.json"], _i = 0, filesToCheck_1 = filesToCheck; _i < filesToCheck_1.length; _i++) {
|
|
1256
1256
|
var fileToCheck = filesToCheck_1[_i];
|
|
1257
1257
|
if (files.indexOf(fileToCheck) !== -1)
|
|
1258
|
-
return
|
|
1258
|
+
return path3.join(directory, fileToCheck);
|
|
1259
1259
|
}
|
|
1260
|
-
var parentDirectory =
|
|
1260
|
+
var parentDirectory = path3.dirname(directory);
|
|
1261
1261
|
if (directory !== parentDirectory)
|
|
1262
1262
|
return walkForTsConfig(parentDirectory, readdirSync);
|
|
1263
1263
|
}
|
|
@@ -1286,12 +1286,12 @@ var require_tsconfig_loader = __commonJS({
|
|
|
1286
1286
|
function loadTsconfigFromExtends(configFilePath, extendedConfigValue, existsSync3, readFileSync2) {
|
|
1287
1287
|
var _a;
|
|
1288
1288
|
typeof extendedConfigValue == "string" && extendedConfigValue.indexOf(".json") === -1 && (extendedConfigValue += ".json");
|
|
1289
|
-
var currentDir =
|
|
1290
|
-
extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync3(extendedConfigPath) && (extendedConfigPath =
|
|
1289
|
+
var currentDir = path3.dirname(configFilePath), extendedConfigPath = path3.join(currentDir, extendedConfigValue);
|
|
1290
|
+
extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync3(extendedConfigPath) && (extendedConfigPath = path3.join(currentDir, "node_modules", extendedConfigValue));
|
|
1291
1291
|
var config = loadTsconfig(extendedConfigPath, existsSync3, readFileSync2) || {};
|
|
1292
1292
|
if (!((_a = config.compilerOptions) === null || _a === void 0) && _a.baseUrl) {
|
|
1293
|
-
var extendsDir =
|
|
1294
|
-
config.compilerOptions.baseUrl =
|
|
1293
|
+
var extendsDir = path3.dirname(extendedConfigValue);
|
|
1294
|
+
config.compilerOptions.baseUrl = path3.join(extendsDir, config.compilerOptions.baseUrl);
|
|
1295
1295
|
}
|
|
1296
1296
|
return config;
|
|
1297
1297
|
}
|
|
@@ -1307,7 +1307,7 @@ var require_config_loader = __commonJS({
|
|
|
1307
1307
|
"use strict";
|
|
1308
1308
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
1309
1309
|
exports.configLoader = exports.loadConfig = void 0;
|
|
1310
|
-
var TsConfigLoader2 = require_tsconfig_loader(),
|
|
1310
|
+
var TsConfigLoader2 = require_tsconfig_loader(), path3 = __require("path");
|
|
1311
1311
|
function loadConfig2(cwd2) {
|
|
1312
1312
|
return cwd2 === void 0 && (cwd2 = process.cwd()), configLoader({ cwd: cwd2 });
|
|
1313
1313
|
}
|
|
@@ -1315,7 +1315,7 @@ var require_config_loader = __commonJS({
|
|
|
1315
1315
|
function configLoader(_a) {
|
|
1316
1316
|
var cwd2 = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
|
|
1317
1317
|
if (explicitParams) {
|
|
1318
|
-
var absoluteBaseUrl =
|
|
1318
|
+
var absoluteBaseUrl = path3.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path3.join(cwd2, explicitParams.baseUrl);
|
|
1319
1319
|
return {
|
|
1320
1320
|
resultType: "success",
|
|
1321
1321
|
configFileAbsolutePath: "",
|
|
@@ -1336,7 +1336,7 @@ var require_config_loader = __commonJS({
|
|
|
1336
1336
|
resultType: "success",
|
|
1337
1337
|
configFileAbsolutePath: loadResult.tsConfigPath,
|
|
1338
1338
|
baseUrl: loadResult.baseUrl,
|
|
1339
|
-
absoluteBaseUrl:
|
|
1339
|
+
absoluteBaseUrl: path3.resolve(path3.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
|
|
1340
1340
|
paths: loadResult.paths || {},
|
|
1341
1341
|
addMatchAll: loadResult.baseUrl !== void 0
|
|
1342
1342
|
} : {
|
|
@@ -1666,14 +1666,14 @@ var require_path_parse = __commonJS({
|
|
|
1666
1666
|
// ../../../node_modules/resolve/lib/node-modules-paths.js
|
|
1667
1667
|
var require_node_modules_paths = __commonJS({
|
|
1668
1668
|
"../../../node_modules/resolve/lib/node-modules-paths.js"(exports, module) {
|
|
1669
|
-
var
|
|
1669
|
+
var path3 = __require("path"), parse4 = path3.parse || require_path_parse(), driveLetterRegex = /^([A-Za-z]:)/, uncPathRegex = /^\\\\/, getNodeModulesDirs = function(absoluteStart, modules) {
|
|
1670
1670
|
var prefix = "/";
|
|
1671
1671
|
driveLetterRegex.test(absoluteStart) ? prefix = "" : uncPathRegex.test(absoluteStart) && (prefix = "\\\\");
|
|
1672
1672
|
for (var paths = [absoluteStart], parsed = parse4(absoluteStart); parsed.dir !== paths[paths.length - 1]; )
|
|
1673
1673
|
paths.push(parsed.dir), parsed = parse4(parsed.dir);
|
|
1674
1674
|
return paths.reduce(function(dirs, aPath) {
|
|
1675
1675
|
return dirs.concat(modules.map(function(moduleDir) {
|
|
1676
|
-
return
|
|
1676
|
+
return path3.resolve(prefix, aPath, moduleDir);
|
|
1677
1677
|
}));
|
|
1678
1678
|
}, []);
|
|
1679
1679
|
};
|
|
@@ -1697,7 +1697,7 @@ var require_node_modules_paths = __commonJS({
|
|
|
1697
1697
|
// ../../../node_modules/resolve/lib/normalize-options.js
|
|
1698
1698
|
var require_normalize_options = __commonJS({
|
|
1699
1699
|
"../../../node_modules/resolve/lib/normalize-options.js"(exports, module) {
|
|
1700
|
-
var
|
|
1700
|
+
var path3 = __require("path");
|
|
1701
1701
|
module.exports = function(_, opts) {
|
|
1702
1702
|
if (opts = opts || {}, opts.forceNodeResolution || !process.versions.pnp)
|
|
1703
1703
|
return opts;
|
|
@@ -1705,7 +1705,7 @@ var require_normalize_options = __commonJS({
|
|
|
1705
1705
|
let parts = request.match(/^((?:@[^/]+\/)?[^/]+)(\/.*)?/);
|
|
1706
1706
|
if (!parts)
|
|
1707
1707
|
throw new Error(`Assertion failed: Expected the "resolve" package to call the "paths" callback with package names only (got "${request}")`);
|
|
1708
|
-
basedir.charAt(basedir.length - 1) !== "/" && (basedir =
|
|
1708
|
+
basedir.charAt(basedir.length - 1) !== "/" && (basedir = path3.join(basedir, "/"));
|
|
1709
1709
|
let api = findPnpApi(basedir);
|
|
1710
1710
|
if (api === null)
|
|
1711
1711
|
return;
|
|
@@ -1717,7 +1717,7 @@ var require_normalize_options = __commonJS({
|
|
|
1717
1717
|
}
|
|
1718
1718
|
if (manifestPath === null)
|
|
1719
1719
|
throw new Error(`Assertion failed: The resolution thinks that "${parts[1]}" is a Node builtin`);
|
|
1720
|
-
let packagePath =
|
|
1720
|
+
let packagePath = path3.dirname(manifestPath), unqualifiedPath = typeof parts[2] < "u" ? path3.join(packagePath, parts[2]) : packagePath;
|
|
1721
1721
|
return { packagePath, unqualifiedPath };
|
|
1722
1722
|
}, runPnpResolutionOnArray = (request, paths2) => {
|
|
1723
1723
|
for (let i = 0; i < paths2.length; i++) {
|
|
@@ -1733,8 +1733,8 @@ var require_normalize_options = __commonJS({
|
|
|
1733
1733
|
let pathsToTest = [basedir].concat(originalPaths), resolution = runPnpResolutionOnArray(request, pathsToTest);
|
|
1734
1734
|
if (resolution == null)
|
|
1735
1735
|
return getNodeModulePaths().concat(originalPaths);
|
|
1736
|
-
let nodeModules =
|
|
1737
|
-
return request.match(/^@[^/]+\//) && (nodeModules =
|
|
1736
|
+
let nodeModules = path3.dirname(resolution.packagePath);
|
|
1737
|
+
return request.match(/^@[^/]+\//) && (nodeModules = path3.dirname(nodeModules)), [nodeModules];
|
|
1738
1738
|
}, isInsideIterator = !1;
|
|
1739
1739
|
return opts.__skipPackageIterator || (opts.packageIterator = function(request, basedir, getCandidates, opts2) {
|
|
1740
1740
|
isInsideIterator = !0;
|
|
@@ -2029,10 +2029,10 @@ var require_is_core_module = __commonJS({
|
|
|
2029
2029
|
// ../../../node_modules/resolve/lib/async.js
|
|
2030
2030
|
var require_async = __commonJS({
|
|
2031
2031
|
"../../../node_modules/resolve/lib/async.js"(exports, module) {
|
|
2032
|
-
var fs = __require("fs"), getHomedir = require_homedir(),
|
|
2032
|
+
var fs = __require("fs"), getHomedir = require_homedir(), path3 = __require("path"), caller = require_caller(), nodeModulesPaths = require_node_modules_paths(), normalizeOptions = require_normalize_options(), isCore = require_is_core_module(), realpathFS = process.platform !== "win32" && fs.realpath && typeof fs.realpath.native == "function" ? fs.realpath.native : fs.realpath, relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/, windowsDriveRegex = /^\w:[/\\]*$/, nodeModulesRegex = /[/\\]node_modules[/\\]*$/, homedir = getHomedir(), defaultPaths = function() {
|
|
2033
2033
|
return [
|
|
2034
|
-
|
|
2035
|
-
|
|
2034
|
+
path3.join(homedir, ".node_modules"),
|
|
2035
|
+
path3.join(homedir, ".node_libraries")
|
|
2036
2036
|
];
|
|
2037
2037
|
}, defaultIsFile = function(file, cb) {
|
|
2038
2038
|
fs.stat(file, function(err, stat) {
|
|
@@ -2061,7 +2061,7 @@ var require_async = __commonJS({
|
|
|
2061
2061
|
});
|
|
2062
2062
|
}, getPackageCandidates = function(x, start, opts) {
|
|
2063
2063
|
for (var dirs = nodeModulesPaths(start, opts, x), i = 0; i < dirs.length; i++)
|
|
2064
|
-
dirs[i] =
|
|
2064
|
+
dirs[i] = path3.join(dirs[i], x);
|
|
2065
2065
|
return dirs;
|
|
2066
2066
|
};
|
|
2067
2067
|
module.exports = function(x, options, callback) {
|
|
@@ -2080,9 +2080,9 @@ var require_async = __commonJS({
|
|
|
2080
2080
|
cb(conflictErr);
|
|
2081
2081
|
});
|
|
2082
2082
|
}
|
|
2083
|
-
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir ||
|
|
2083
|
+
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir || path3.dirname(caller()), parent = opts.filename || basedir;
|
|
2084
2084
|
opts.paths = opts.paths || defaultPaths();
|
|
2085
|
-
var absoluteStart =
|
|
2085
|
+
var absoluteStart = path3.resolve(basedir);
|
|
2086
2086
|
maybeRealpath(
|
|
2087
2087
|
realpath,
|
|
2088
2088
|
absoluteStart,
|
|
@@ -2094,7 +2094,7 @@ var require_async = __commonJS({
|
|
|
2094
2094
|
var res;
|
|
2095
2095
|
function init(basedir2) {
|
|
2096
2096
|
if (relativePathRegex.test(x))
|
|
2097
|
-
res =
|
|
2097
|
+
res = path3.resolve(basedir2, x), (x === "." || x === ".." || x.slice(-1) === "/") && (res += "/"), x.slice(-1) === "/" && res === basedir2 ? loadAsDirectory(res, opts.package, onfile) : loadAsFile(res, opts.package, onfile);
|
|
2098
2098
|
else {
|
|
2099
2099
|
if (includeCoreModules && isCore(x))
|
|
2100
2100
|
return cb(null, x);
|
|
@@ -2132,14 +2132,14 @@ var require_async = __commonJS({
|
|
|
2132
2132
|
function load(exts2, x3, loadPackage) {
|
|
2133
2133
|
if (exts2.length === 0) return cb2(null, void 0, loadPackage);
|
|
2134
2134
|
var file = x3 + exts2[0], pkg = loadPackage;
|
|
2135
|
-
pkg ? onpkg(null, pkg) : loadpkg(
|
|
2135
|
+
pkg ? onpkg(null, pkg) : loadpkg(path3.dirname(file), onpkg);
|
|
2136
2136
|
function onpkg(err2, pkg_, dir) {
|
|
2137
2137
|
if (pkg = pkg_, err2) return cb2(err2);
|
|
2138
2138
|
if (dir && pkg && opts.pathFilter) {
|
|
2139
|
-
var rfile =
|
|
2139
|
+
var rfile = path3.relative(dir, file), rel = rfile.slice(0, rfile.length - exts2[0].length), r = opts.pathFilter(pkg, x3, rel);
|
|
2140
2140
|
if (r) return load(
|
|
2141
2141
|
[""].concat(extensions.slice()),
|
|
2142
|
-
|
|
2142
|
+
path3.resolve(dir, r),
|
|
2143
2143
|
pkg
|
|
2144
2144
|
);
|
|
2145
2145
|
}
|
|
@@ -2155,10 +2155,10 @@ var require_async = __commonJS({
|
|
|
2155
2155
|
function loadpkg(dir, cb2) {
|
|
2156
2156
|
if (dir === "" || dir === "/" || process.platform === "win32" && windowsDriveRegex.test(dir) || nodeModulesRegex.test(dir)) return cb2(null);
|
|
2157
2157
|
maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
|
|
2158
|
-
if (unwrapErr) return loadpkg(
|
|
2159
|
-
var pkgfile =
|
|
2158
|
+
if (unwrapErr) return loadpkg(path3.dirname(dir), cb2);
|
|
2159
|
+
var pkgfile = path3.join(pkgdir, "package.json");
|
|
2160
2160
|
isFile(pkgfile, function(err2, ex) {
|
|
2161
|
-
if (!ex) return loadpkg(
|
|
2161
|
+
if (!ex) return loadpkg(path3.dirname(dir), cb2);
|
|
2162
2162
|
readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
|
2163
2163
|
err3 && cb2(err3);
|
|
2164
2164
|
var pkg = pkgParam;
|
|
@@ -2171,10 +2171,10 @@ var require_async = __commonJS({
|
|
|
2171
2171
|
var cb2 = callback2, fpkg = loadAsDirectoryPackage;
|
|
2172
2172
|
typeof fpkg == "function" && (cb2 = fpkg, fpkg = opts.package), maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
|
|
2173
2173
|
if (unwrapErr) return cb2(unwrapErr);
|
|
2174
|
-
var pkgfile =
|
|
2174
|
+
var pkgfile = path3.join(pkgdir, "package.json");
|
|
2175
2175
|
isFile(pkgfile, function(err2, ex) {
|
|
2176
2176
|
if (err2) return cb2(err2);
|
|
2177
|
-
if (!ex) return loadAsFile(
|
|
2177
|
+
if (!ex) return loadAsFile(path3.join(x2, "index"), fpkg, cb2);
|
|
2178
2178
|
readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
|
2179
2179
|
if (err3) return cb2(err3);
|
|
2180
2180
|
var pkg = pkgParam;
|
|
@@ -2183,20 +2183,20 @@ var require_async = __commonJS({
|
|
|
2183
2183
|
var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
|
|
2184
2184
|
return mainError.code = "INVALID_PACKAGE_MAIN", cb2(mainError);
|
|
2185
2185
|
}
|
|
2186
|
-
(pkg.main === "." || pkg.main === "./") && (pkg.main = "index"), loadAsFile(
|
|
2186
|
+
(pkg.main === "." || pkg.main === "./") && (pkg.main = "index"), loadAsFile(path3.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
|
|
2187
2187
|
if (err4) return cb2(err4);
|
|
2188
2188
|
if (m) return cb2(null, m, pkg2);
|
|
2189
|
-
if (!pkg2) return loadAsFile(
|
|
2190
|
-
var dir =
|
|
2189
|
+
if (!pkg2) return loadAsFile(path3.join(x2, "index"), pkg2, cb2);
|
|
2190
|
+
var dir = path3.resolve(x2, pkg2.main);
|
|
2191
2191
|
loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
|
|
2192
2192
|
if (err5) return cb2(err5);
|
|
2193
2193
|
if (n) return cb2(null, n, pkg3);
|
|
2194
|
-
loadAsFile(
|
|
2194
|
+
loadAsFile(path3.join(x2, "index"), pkg3, cb2);
|
|
2195
2195
|
});
|
|
2196
2196
|
});
|
|
2197
2197
|
return;
|
|
2198
2198
|
}
|
|
2199
|
-
loadAsFile(
|
|
2199
|
+
loadAsFile(path3.join(x2, "/index"), pkg, cb2);
|
|
2200
2200
|
});
|
|
2201
2201
|
});
|
|
2202
2202
|
});
|
|
@@ -2204,7 +2204,7 @@ var require_async = __commonJS({
|
|
|
2204
2204
|
function processDirs(cb2, dirs) {
|
|
2205
2205
|
if (dirs.length === 0) return cb2(null, void 0);
|
|
2206
2206
|
var dir = dirs[0];
|
|
2207
|
-
isDirectory(
|
|
2207
|
+
isDirectory(path3.dirname(dir), isdir);
|
|
2208
2208
|
function isdir(err2, isdir2) {
|
|
2209
2209
|
if (err2) return cb2(err2);
|
|
2210
2210
|
if (!isdir2) return processDirs(cb2, dirs.slice(1));
|
|
@@ -2427,10 +2427,10 @@ var require_is_core = __commonJS({
|
|
|
2427
2427
|
// ../../../node_modules/resolve/lib/sync.js
|
|
2428
2428
|
var require_sync = __commonJS({
|
|
2429
2429
|
"../../../node_modules/resolve/lib/sync.js"(exports, module) {
|
|
2430
|
-
var isCore = require_is_core_module(), fs = __require("fs"),
|
|
2430
|
+
var isCore = require_is_core_module(), fs = __require("fs"), path3 = __require("path"), getHomedir = require_homedir(), caller = require_caller(), nodeModulesPaths = require_node_modules_paths(), normalizeOptions = require_normalize_options(), realpathFS = process.platform !== "win32" && fs.realpathSync && typeof fs.realpathSync.native == "function" ? fs.realpathSync.native : fs.realpathSync, relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/, windowsDriveRegex = /^\w:[/\\]*$/, nodeModulesRegex = /[/\\]node_modules[/\\]*$/, homedir = getHomedir(), defaultPaths = function() {
|
|
2431
2431
|
return [
|
|
2432
|
-
|
|
2433
|
-
|
|
2432
|
+
path3.join(homedir, ".node_modules"),
|
|
2433
|
+
path3.join(homedir, ".node_libraries")
|
|
2434
2434
|
];
|
|
2435
2435
|
}, defaultIsFile = function(file) {
|
|
2436
2436
|
try {
|
|
@@ -2467,7 +2467,7 @@ var require_sync = __commonJS({
|
|
|
2467
2467
|
}
|
|
2468
2468
|
}, getPackageCandidates = function(x, start, opts) {
|
|
2469
2469
|
for (var dirs = nodeModulesPaths(start, opts, x), i = 0; i < dirs.length; i++)
|
|
2470
|
-
dirs[i] =
|
|
2470
|
+
dirs[i] = path3.join(dirs[i], x);
|
|
2471
2471
|
return dirs;
|
|
2472
2472
|
};
|
|
2473
2473
|
module.exports = function(x, options) {
|
|
@@ -2476,11 +2476,11 @@ var require_sync = __commonJS({
|
|
|
2476
2476
|
var opts = normalizeOptions(x, options), isFile = opts.isFile || defaultIsFile, readFileSync2 = opts.readFileSync || fs.readFileSync, isDirectory = opts.isDirectory || defaultIsDir, realpathSync = opts.realpathSync || defaultRealpathSync, readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
2477
2477
|
if (opts.readFileSync && opts.readPackageSync)
|
|
2478
2478
|
throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
|
|
2479
|
-
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir ||
|
|
2479
|
+
var packageIterator = opts.packageIterator, extensions = opts.extensions || [".js"], includeCoreModules = opts.includeCoreModules !== !1, basedir = opts.basedir || path3.dirname(caller()), parent = opts.filename || basedir;
|
|
2480
2480
|
opts.paths = opts.paths || defaultPaths();
|
|
2481
|
-
var absoluteStart = maybeRealpathSync(realpathSync,
|
|
2481
|
+
var absoluteStart = maybeRealpathSync(realpathSync, path3.resolve(basedir), opts);
|
|
2482
2482
|
if (relativePathRegex.test(x)) {
|
|
2483
|
-
var res =
|
|
2483
|
+
var res = path3.resolve(absoluteStart, x);
|
|
2484
2484
|
(x === "." || x === ".." || x.slice(-1) === "/") && (res += "/");
|
|
2485
2485
|
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
|
2486
2486
|
if (m) return maybeRealpathSync(realpathSync, m, opts);
|
|
@@ -2493,10 +2493,10 @@ var require_sync = __commonJS({
|
|
|
2493
2493
|
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
|
2494
2494
|
throw err.code = "MODULE_NOT_FOUND", err;
|
|
2495
2495
|
function loadAsFileSync(x2) {
|
|
2496
|
-
var pkg = loadpkg(
|
|
2496
|
+
var pkg = loadpkg(path3.dirname(x2));
|
|
2497
2497
|
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
|
2498
|
-
var rfile =
|
|
2499
|
-
r && (x2 =
|
|
2498
|
+
var rfile = path3.relative(pkg.dir, x2), r = opts.pathFilter(pkg.pkg, x2, rfile);
|
|
2499
|
+
r && (x2 = path3.resolve(pkg.dir, r));
|
|
2500
2500
|
}
|
|
2501
2501
|
if (isFile(x2))
|
|
2502
2502
|
return x2;
|
|
@@ -2508,9 +2508,9 @@ var require_sync = __commonJS({
|
|
|
2508
2508
|
}
|
|
2509
2509
|
function loadpkg(dir) {
|
|
2510
2510
|
if (!(dir === "" || dir === "/") && !(process.platform === "win32" && windowsDriveRegex.test(dir)) && !nodeModulesRegex.test(dir)) {
|
|
2511
|
-
var pkgfile =
|
|
2511
|
+
var pkgfile = path3.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
|
|
2512
2512
|
if (!isFile(pkgfile))
|
|
2513
|
-
return loadpkg(
|
|
2513
|
+
return loadpkg(path3.dirname(dir));
|
|
2514
2514
|
var pkg = readPackageSync(readFileSync2, pkgfile);
|
|
2515
2515
|
return pkg && opts.packageFilter && (pkg = opts.packageFilter(
|
|
2516
2516
|
pkg,
|
|
@@ -2520,7 +2520,7 @@ var require_sync = __commonJS({
|
|
|
2520
2520
|
}
|
|
2521
2521
|
}
|
|
2522
2522
|
function loadAsDirectorySync(x2) {
|
|
2523
|
-
var pkgfile =
|
|
2523
|
+
var pkgfile = path3.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
2524
2524
|
if (isFile(pkgfile)) {
|
|
2525
2525
|
try {
|
|
2526
2526
|
var pkg = readPackageSync(readFileSync2, pkgfile);
|
|
@@ -2537,22 +2537,22 @@ var require_sync = __commonJS({
|
|
|
2537
2537
|
}
|
|
2538
2538
|
(pkg.main === "." || pkg.main === "./") && (pkg.main = "index");
|
|
2539
2539
|
try {
|
|
2540
|
-
var m2 = loadAsFileSync(
|
|
2540
|
+
var m2 = loadAsFileSync(path3.resolve(x2, pkg.main));
|
|
2541
2541
|
if (m2) return m2;
|
|
2542
|
-
var n2 = loadAsDirectorySync(
|
|
2542
|
+
var n2 = loadAsDirectorySync(path3.resolve(x2, pkg.main));
|
|
2543
2543
|
if (n2) return n2;
|
|
2544
2544
|
} catch {
|
|
2545
2545
|
}
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
2548
|
-
return loadAsFileSync(
|
|
2548
|
+
return loadAsFileSync(path3.join(x2, "/index"));
|
|
2549
2549
|
}
|
|
2550
2550
|
function loadNodeModulesSync(x2, start) {
|
|
2551
2551
|
for (var thunk = function() {
|
|
2552
2552
|
return getPackageCandidates(x2, start, opts);
|
|
2553
2553
|
}, dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk(), i = 0; i < dirs.length; i++) {
|
|
2554
2554
|
var dir = dirs[i];
|
|
2555
|
-
if (isDirectory(
|
|
2555
|
+
if (isDirectory(path3.dirname(dir))) {
|
|
2556
2556
|
var m2 = loadAsFileSync(dir);
|
|
2557
2557
|
if (m2) return m2;
|
|
2558
2558
|
var n2 = loadAsDirectorySync(dir);
|
|
@@ -2576,7 +2576,7 @@ var require_resolve = __commonJS({
|
|
|
2576
2576
|
});
|
|
2577
2577
|
|
|
2578
2578
|
// src/preset.ts
|
|
2579
|
-
import { join as join5 } from "node:path";
|
|
2579
|
+
import path2, { join as join5 } from "node:path";
|
|
2580
2580
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2581
2581
|
import { getProjectRoot as getProjectRoot2 } from "storybook/internal/common";
|
|
2582
2582
|
|
|
@@ -2712,12 +2712,12 @@ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
|
2712
2712
|
function normalizeWindowsPath(input = "") {
|
|
2713
2713
|
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
2714
2714
|
}
|
|
2715
|
-
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, sep = "/", delimiter = ":", normalize = function(
|
|
2716
|
-
if (
|
|
2715
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, sep = "/", delimiter = ":", normalize = function(path3) {
|
|
2716
|
+
if (path3.length === 0)
|
|
2717
2717
|
return ".";
|
|
2718
|
-
|
|
2719
|
-
let isUNCPath =
|
|
2720
|
-
return
|
|
2718
|
+
path3 = normalizeWindowsPath(path3);
|
|
2719
|
+
let isUNCPath = path3.match(_UNC_REGEX), isPathAbsolute = isAbsolute(path3), trailingSeparator = path3[path3.length - 1] === "/";
|
|
2720
|
+
return path3 = normalizeString(path3, !isPathAbsolute), path3.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path3 += "/"), _DRIVE_LETTER_RE.test(path3) && (path3 += "/"), isUNCPath ? isPathAbsolute ? `//${path3}` : `//./${path3}` : isPathAbsolute && !isAbsolute(path3) ? `/${path3}` : path3);
|
|
2721
2721
|
}, join = function(...arguments_) {
|
|
2722
2722
|
if (arguments_.length === 0)
|
|
2723
2723
|
return ".";
|
|
@@ -2733,16 +2733,16 @@ var resolve = function(...arguments_) {
|
|
|
2733
2733
|
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
2734
2734
|
let resolvedPath = "", resolvedAbsolute = !1;
|
|
2735
2735
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
2736
|
-
let
|
|
2737
|
-
!
|
|
2736
|
+
let path3 = index >= 0 ? arguments_[index] : cwd();
|
|
2737
|
+
!path3 || path3.length === 0 || (resolvedPath = `${path3}/${resolvedPath}`, resolvedAbsolute = isAbsolute(path3));
|
|
2738
2738
|
}
|
|
2739
2739
|
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
2740
2740
|
};
|
|
2741
|
-
function normalizeString(
|
|
2741
|
+
function normalizeString(path3, allowAboveRoot) {
|
|
2742
2742
|
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
2743
|
-
for (let index = 0; index <=
|
|
2744
|
-
if (index <
|
|
2745
|
-
char =
|
|
2743
|
+
for (let index = 0; index <= path3.length; ++index) {
|
|
2744
|
+
if (index < path3.length)
|
|
2745
|
+
char = path3[index];
|
|
2746
2746
|
else {
|
|
2747
2747
|
if (char === "/")
|
|
2748
2748
|
break;
|
|
@@ -2762,7 +2762,7 @@ function normalizeString(path2, allowAboveRoot) {
|
|
|
2762
2762
|
}
|
|
2763
2763
|
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
2764
2764
|
} else
|
|
2765
|
-
res.length > 0 ? res += `/${
|
|
2765
|
+
res.length > 0 ? res += `/${path3.slice(lastSlash + 1, index)}` : res = path3.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
2766
2766
|
lastSlash = index, dots = 0;
|
|
2767
2767
|
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
2768
2768
|
}
|
|
@@ -3226,16 +3226,16 @@ var ReactDocgenResolveError = class extends Error {
|
|
|
3226
3226
|
// src/componentManifest/reactDocgen/exportNameHandler.ts
|
|
3227
3227
|
import { utils as utils2 } from "react-docgen";
|
|
3228
3228
|
var { isReactForwardRefCall: isReactForwardRefCall2 } = utils2;
|
|
3229
|
-
function nameFromId(
|
|
3230
|
-
if (
|
|
3231
|
-
if (
|
|
3232
|
-
return
|
|
3233
|
-
if (
|
|
3234
|
-
return
|
|
3229
|
+
function nameFromId(path3) {
|
|
3230
|
+
if (path3) {
|
|
3231
|
+
if (path3.isIdentifier())
|
|
3232
|
+
return path3.node.name;
|
|
3233
|
+
if (path3.isStringLiteral())
|
|
3234
|
+
return path3.node.value;
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
3237
|
-
function isInlineDefaultExport(
|
|
3238
|
-
let p =
|
|
3237
|
+
function isInlineDefaultExport(path3) {
|
|
3238
|
+
let p = path3;
|
|
3239
3239
|
for (; p && p.parentPath; ) {
|
|
3240
3240
|
if (p.parentPath.isExportDefaultDeclaration())
|
|
3241
3241
|
return !0;
|
|
@@ -3243,8 +3243,8 @@ function isInlineDefaultExport(path2) {
|
|
|
3243
3243
|
}
|
|
3244
3244
|
return !1;
|
|
3245
3245
|
}
|
|
3246
|
-
function findProgram(
|
|
3247
|
-
let found =
|
|
3246
|
+
function findProgram(path3) {
|
|
3247
|
+
let found = path3.findParent((p) => p.isProgram());
|
|
3248
3248
|
return found && found.isProgram() ? found : void 0;
|
|
3249
3249
|
}
|
|
3250
3250
|
function getLocalName(componentDefinition, fallback) {
|
|
@@ -3357,13 +3357,13 @@ var getTsConfig = cached(
|
|
|
3357
3357
|
},
|
|
3358
3358
|
{ name: "getTsConfig" }
|
|
3359
3359
|
), parseWithReactDocgen = cached(
|
|
3360
|
-
(code,
|
|
3360
|
+
(code, path3) => parse3(code, {
|
|
3361
3361
|
resolver: defaultResolver,
|
|
3362
3362
|
handlers,
|
|
3363
3363
|
importer: getReactDocgenImporter(),
|
|
3364
|
-
filename:
|
|
3364
|
+
filename: path3
|
|
3365
3365
|
}),
|
|
3366
|
-
{ key: (code,
|
|
3366
|
+
{ key: (code, path3) => path3, name: "parseWithReactDocgen" }
|
|
3367
3367
|
), getExportPaths = cached(
|
|
3368
3368
|
(code, filePath) => {
|
|
3369
3369
|
let ast;
|
|
@@ -3385,13 +3385,13 @@ var getTsConfig = cached(
|
|
|
3385
3385
|
},
|
|
3386
3386
|
{ name: "getExportPaths" }
|
|
3387
3387
|
), gatherDocgensForPath = cached(
|
|
3388
|
-
(
|
|
3389
|
-
if (
|
|
3388
|
+
(path3, depth) => {
|
|
3389
|
+
if (path3.includes("node_modules"))
|
|
3390
3390
|
return {
|
|
3391
3391
|
docgens: [],
|
|
3392
3392
|
errors: [
|
|
3393
3393
|
{
|
|
3394
|
-
path:
|
|
3394
|
+
path: path3,
|
|
3395
3395
|
code: "/* File in node_modules */",
|
|
3396
3396
|
name: "Component file in node_modules",
|
|
3397
3397
|
message: import_ts_dedent.dedent`
|
|
@@ -3420,16 +3420,16 @@ var getTsConfig = cached(
|
|
|
3420
3420
|
};
|
|
3421
3421
|
let code;
|
|
3422
3422
|
try {
|
|
3423
|
-
code = cachedReadFileSync(
|
|
3423
|
+
code = cachedReadFileSync(path3, "utf-8");
|
|
3424
3424
|
} catch {
|
|
3425
3425
|
return {
|
|
3426
3426
|
docgens: [],
|
|
3427
3427
|
errors: [
|
|
3428
3428
|
{
|
|
3429
|
-
path:
|
|
3429
|
+
path: path3,
|
|
3430
3430
|
code: "/* File not found or unreadable */",
|
|
3431
3431
|
name: "Component file could not be read",
|
|
3432
|
-
message: `Could not read the component file located at "${
|
|
3432
|
+
message: `Could not read the component file located at "${path3}".
|
|
3433
3433
|
Prefer relative imports if possible.`
|
|
3434
3434
|
}
|
|
3435
3435
|
]
|
|
@@ -3440,7 +3440,7 @@ Prefer relative imports if possible.`
|
|
|
3440
3440
|
docgens: [],
|
|
3441
3441
|
errors: [
|
|
3442
3442
|
{
|
|
3443
|
-
path:
|
|
3443
|
+
path: path3,
|
|
3444
3444
|
code,
|
|
3445
3445
|
name: "Max re-export depth exceeded",
|
|
3446
3446
|
message: import_ts_dedent.dedent`
|
|
@@ -3452,10 +3452,10 @@ Prefer relative imports if possible.`
|
|
|
3452
3452
|
}
|
|
3453
3453
|
]
|
|
3454
3454
|
};
|
|
3455
|
-
let exportPaths = getExportPaths(code,
|
|
3455
|
+
let exportPaths = getExportPaths(code, path3).map((p) => gatherDocgensForPath(p, depth + 1)), docgens = exportPaths.flatMap((r) => r.docgens), errors = exportPaths.flatMap((r) => r.errors);
|
|
3456
3456
|
try {
|
|
3457
3457
|
return {
|
|
3458
|
-
docgens: [...parseWithReactDocgen(code,
|
|
3458
|
+
docgens: [...parseWithReactDocgen(code, path3), ...docgens],
|
|
3459
3459
|
errors
|
|
3460
3460
|
};
|
|
3461
3461
|
} catch (e) {
|
|
@@ -3464,7 +3464,7 @@ Prefer relative imports if possible.`
|
|
|
3464
3464
|
docgens,
|
|
3465
3465
|
errors: [
|
|
3466
3466
|
{
|
|
3467
|
-
path:
|
|
3467
|
+
path: path3,
|
|
3468
3468
|
code,
|
|
3469
3469
|
name: "No component definition found",
|
|
3470
3470
|
message: import_ts_dedent.dedent`
|
|
@@ -3479,8 +3479,8 @@ Prefer relative imports if possible.`
|
|
|
3479
3479
|
},
|
|
3480
3480
|
{ name: "gatherDocgensWithTrace", key: (filePath) => filePath }
|
|
3481
3481
|
), getReactDocgen = cached(
|
|
3482
|
-
(
|
|
3483
|
-
let { docgens, errors } = gatherDocgensForPath(
|
|
3482
|
+
(path3, component) => {
|
|
3483
|
+
let { docgens, errors } = gatherDocgensForPath(path3, 0), docgen = getMatchingDocgen(docgens, component);
|
|
3484
3484
|
return docgen ? { type: "success", data: docgen } : { type: "error", error: {
|
|
3485
3485
|
name: errors.at(-1)?.name ?? "No component definition found",
|
|
3486
3486
|
message: errors.map(
|
|
@@ -3495,7 +3495,7 @@ Prefer relative imports if possible.`
|
|
|
3495
3495
|
`)
|
|
3496
3496
|
} };
|
|
3497
3497
|
},
|
|
3498
|
-
{ name: "getReactDocgen", key: (
|
|
3498
|
+
{ name: "getReactDocgen", key: (path3, component) => path3 + JSON.stringify(component) }
|
|
3499
3499
|
);
|
|
3500
3500
|
function getReactDocgenImporter() {
|
|
3501
3501
|
return makeFsImporter((filename, basedir) => {
|
|
@@ -4014,9 +4014,9 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
4014
4014
|
importName: direct.importName
|
|
4015
4015
|
} : { componentName: c };
|
|
4016
4016
|
}).map((component) => {
|
|
4017
|
-
let
|
|
4017
|
+
let path3, isPackage = !1;
|
|
4018
4018
|
try {
|
|
4019
|
-
component.importId && storyFilePath && (
|
|
4019
|
+
component.importId && storyFilePath && (path3 = cachedResolveImport(matchPath(component.importId, dirname4(storyFilePath)), {
|
|
4020
4020
|
basedir: dirname4(storyFilePath)
|
|
4021
4021
|
}));
|
|
4022
4022
|
} catch (e) {
|
|
@@ -4027,11 +4027,11 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
4027
4027
|
} catch {
|
|
4028
4028
|
}
|
|
4029
4029
|
let componentWithPackage = { ...component, isPackage };
|
|
4030
|
-
if (
|
|
4031
|
-
let reactDocgen = getReactDocgen(
|
|
4030
|
+
if (path3) {
|
|
4031
|
+
let reactDocgen = getReactDocgen(path3, componentWithPackage);
|
|
4032
4032
|
return {
|
|
4033
4033
|
...componentWithPackage,
|
|
4034
|
-
path:
|
|
4034
|
+
path: path3,
|
|
4035
4035
|
reactDocgen,
|
|
4036
4036
|
importOverride: reactDocgen.type === "success" ? getImportTag(reactDocgen.data) : void 0
|
|
4037
4037
|
};
|
|
@@ -4397,7 +4397,7 @@ async function internal_getArgTypesData(_input, options) {
|
|
|
4397
4397
|
if (!componentFilePath)
|
|
4398
4398
|
return null;
|
|
4399
4399
|
let argTypesData = extractArgTypesFromDocgen({
|
|
4400
|
-
componentFilePath: join5(getProjectRoot2(), componentFilePath),
|
|
4400
|
+
componentFilePath: path2.isAbsolute(componentFilePath) ? componentFilePath : join5(getProjectRoot2(), componentFilePath),
|
|
4401
4401
|
componentExportName
|
|
4402
4402
|
});
|
|
4403
4403
|
if (!argTypesData?.props)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "10.2.0-alpha.
|
|
3
|
+
"version": "10.2.0-alpha.18",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@storybook/global": "^5.0.0",
|
|
53
|
-
"@storybook/react-dom-shim": "10.2.0-alpha.
|
|
53
|
+
"@storybook/react-dom-shim": "10.2.0-alpha.18",
|
|
54
54
|
"react-docgen": "^8.0.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
79
79
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
80
|
-
"storybook": "^10.2.0-alpha.
|
|
80
|
+
"storybook": "^10.2.0-alpha.18",
|
|
81
81
|
"typescript": ">= 4.9.x"
|
|
82
82
|
},
|
|
83
83
|
"peerDependenciesMeta": {
|