@storybook/react 10.2.14 → 10.2.16
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,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1i4lafgul14 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1i4lafgul14 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1i4lafgul14 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1i4lafgul14.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1i4lafgul14.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1i4lafgul14.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1i4lafgul14 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1i4lafgul14 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1i4lafgul14 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1i4lafgul14.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1i4lafgul14.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1i4lafgul14.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_lyi1dv3yavm.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7HNRWMGC.js";
|
|
16
16
|
|
|
17
17
|
// ../../../node_modules/react-docgen-typescript/lib/buildFilter.js
|
|
18
18
|
var require_buildFilter = __commonJS({
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1i4lafgul14 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1i4lafgul14 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1i4lafgul14 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1i4lafgul14.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1i4lafgul14.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1i4lafgul14.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require,
|
|
15
15
|
__toESM
|
|
16
|
-
} from "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-7HNRWMGC.js";
|
|
17
17
|
|
|
18
18
|
// ../../../node_modules/estraverse/estraverse.js
|
|
19
19
|
var require_estraverse = __commonJS({
|
|
@@ -7918,7 +7918,7 @@ var require_register = __commonJS({
|
|
|
7918
7918
|
}
|
|
7919
7919
|
return coreModules;
|
|
7920
7920
|
}
|
|
7921
|
-
function
|
|
7921
|
+
function register2(params) {
|
|
7922
7922
|
var cwd2, explicitParams;
|
|
7923
7923
|
if (params)
|
|
7924
7924
|
cwd2 = params.cwd, (params.baseUrl || params.paths) && (explicitParams = params);
|
|
@@ -7953,7 +7953,7 @@ var require_register = __commonJS({
|
|
|
7953
7953
|
Module._resolveFilename = originalResolveFilename;
|
|
7954
7954
|
};
|
|
7955
7955
|
}
|
|
7956
|
-
exports.register =
|
|
7956
|
+
exports.register = register2;
|
|
7957
7957
|
}
|
|
7958
7958
|
});
|
|
7959
7959
|
|
|
@@ -8982,6 +8982,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8982
8982
|
import { getProjectRoot as getProjectRoot2 } from "storybook/internal/common";
|
|
8983
8983
|
|
|
8984
8984
|
// ../../core/src/shared/utils/module.ts
|
|
8985
|
+
import { createRequire, register } from "node:module";
|
|
8985
8986
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8986
8987
|
|
|
8987
8988
|
// ../../../node_modules/exsolve/dist/index.mjs
|
|
@@ -9232,7 +9233,12 @@ var importMetaResolve = (...args) => typeof import.meta.resolve != "function" &&
|
|
|
9232
9233
|
try {
|
|
9233
9234
|
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
|
|
9234
9235
|
} catch {
|
|
9235
|
-
|
|
9236
|
+
try {
|
|
9237
|
+
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"))));
|
|
9238
|
+
} catch {
|
|
9239
|
+
let req = createRequire(parent ?? import.meta.url);
|
|
9240
|
+
return dirname(req.resolve(join(pkg, "package.json")));
|
|
9241
|
+
}
|
|
9236
9242
|
}
|
|
9237
9243
|
};
|
|
9238
9244
|
|
|
@@ -11193,7 +11199,7 @@ var extractArgTypesFromDocgenTypescript = async ({
|
|
|
11193
11199
|
reactDocgenTypescriptOptions
|
|
11194
11200
|
}) => {
|
|
11195
11201
|
try {
|
|
11196
|
-
let { withCompilerOptions } = (await import("./_node-chunks/lib-
|
|
11202
|
+
let { withCompilerOptions } = (await import("./_node-chunks/lib-5CDBGOUC.js")).default, defaultOptions = {
|
|
11197
11203
|
shouldExtractLiteralValuesFromEnum: !0,
|
|
11198
11204
|
shouldRemoveUndefinedFromOptional: !0,
|
|
11199
11205
|
propFilter: (prop) => prop.parent ? !/node_modules/.test(prop.parent.fileName) : !0,
|
|
@@ -11272,7 +11278,7 @@ function getCodeSnippet(csf, storyName, componentName) {
|
|
|
11272
11278
|
if (callee.isMemberExpression()) {
|
|
11273
11279
|
let obj = callee.get("object"), prop = callee.get("property"), isBind = prop.isIdentifier() && prop.node.name === "bind" || t2.isStringLiteral(prop.node) && prop.node.value === "bind";
|
|
11274
11280
|
if (obj.isIdentifier() && isBind) {
|
|
11275
|
-
let resolved =
|
|
11281
|
+
let resolved = resolveIdentifierInit(storyDeclaration, obj);
|
|
11276
11282
|
resolved && (normalizedPath = resolved);
|
|
11277
11283
|
}
|
|
11278
11284
|
}
|
|
@@ -11300,14 +11306,20 @@ function getCodeSnippet(csf, storyName, componentName) {
|
|
|
11300
11306
|
"Expected story to be csf factory, function or an object expression"
|
|
11301
11307
|
);
|
|
11302
11308
|
let storyProps = normalizedPath.isObjectExpression() ? normalizedPath.get("properties").filter((p) => p.isObjectProperty()) : [], metaPath = pathForNode(csf._file.path, metaObj), metaProps = metaPath?.isObjectExpression() ? metaPath.get("properties").filter((p) => p.isObjectProperty()) : [], getRenderPath = (object) => {
|
|
11303
|
-
let
|
|
11304
|
-
if (
|
|
11305
|
-
|
|
11309
|
+
let renderPath = object.find((p) => keyOf(p.node) === "render")?.get("value");
|
|
11310
|
+
if (!renderPath)
|
|
11311
|
+
return { kind: "missing" };
|
|
11312
|
+
if (renderPath.isIdentifier()) {
|
|
11313
|
+
let resolved = resolveIdentifierInit(storyDeclaration, renderPath);
|
|
11314
|
+
return resolved && (resolved.isArrowFunctionExpression() || resolved.isFunctionExpression() || resolved.isFunctionDeclaration()) ? { kind: "resolved", path: resolved } : { kind: "unresolved" };
|
|
11315
|
+
}
|
|
11316
|
+
if (!(renderPath.isArrowFunctionExpression() || renderPath.isFunctionExpression()))
|
|
11317
|
+
throw renderPath.buildCodeFrameError(
|
|
11306
11318
|
"Expected render to be an arrow function or function expression"
|
|
11307
11319
|
);
|
|
11308
|
-
return
|
|
11309
|
-
},
|
|
11310
|
-
storyFn
|
|
11320
|
+
return { kind: "resolved", path: renderPath };
|
|
11321
|
+
}, metaRender = getRenderPath(metaProps), storyRender = getRenderPath(storyProps);
|
|
11322
|
+
storyFn || (storyFn = storyRender.kind === "resolved" ? storyRender.path : storyRender.kind === "missing" && metaRender.kind === "resolved" ? metaRender.path : void 0);
|
|
11311
11323
|
let metaArgs = metaArgsRecord(metaObj ?? null), storyArgsPath = storyProps.filter((p) => keyOf(p.node) === "args").map((p) => p.get("value")).find((v) => v.isObjectExpression()), storyArgs = argsRecordFromObjectPath(storyArgsPath), storyAssignedArgsPath = storyArgsAssignmentPath(csf._file.path, storyName), storyAssignedArgs = argsRecordFromObjectPath(storyAssignedArgsPath), merged = { ...metaArgs, ...storyArgs, ...storyAssignedArgs }, entries = Object.entries(merged).filter(([k]) => k !== "children"), validEntries = entries.filter(([k, v]) => isValidJsxAttrName(k) && v != null), invalidEntries = entries.filter(([k, v]) => !isValidJsxAttrName(k) && v != null), injectedAttrs = validEntries.map(([k, v]) => toAttr(k, v)).filter((a) => a != null);
|
|
11312
11324
|
if (storyFn) {
|
|
11313
11325
|
let fn = storyFn.node;
|
|
@@ -11331,14 +11343,20 @@ function getCodeSnippet(csf, storyName, componentName) {
|
|
|
11331
11343
|
return stmt;
|
|
11332
11344
|
});
|
|
11333
11345
|
if (changed)
|
|
11334
|
-
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(
|
|
11346
|
+
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(
|
|
11347
|
+
t2.identifier(storyName),
|
|
11348
|
+
[],
|
|
11349
|
+
t2.blockStatement(newBody),
|
|
11350
|
+
fn.generator,
|
|
11351
|
+
fn.async
|
|
11352
|
+
) : t2.variableDeclaration("const", [
|
|
11335
11353
|
t2.variableDeclarator(
|
|
11336
11354
|
t2.identifier(storyName),
|
|
11337
11355
|
t2.arrowFunctionExpression([], t2.blockStatement(newBody), fn.async)
|
|
11338
11356
|
)
|
|
11339
11357
|
]);
|
|
11340
11358
|
}
|
|
11341
|
-
return t2.isFunctionDeclaration(fn) ? fn : t2.variableDeclaration("const", [t2.variableDeclarator(t2.identifier(storyName), fn)]);
|
|
11359
|
+
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(t2.identifier(storyName), fn.params, fn.body, fn.generator, fn.async) : t2.variableDeclaration("const", [t2.variableDeclarator(t2.identifier(storyName), fn)]);
|
|
11342
11360
|
}
|
|
11343
11361
|
invariant(componentName, "Could not generate snippet without component name.");
|
|
11344
11362
|
let invalidSpread = buildInvalidSpread(invalidEntries), name = t2.jsxIdentifier(componentName), openingElAttrs = invalidSpread ? [...injectedAttrs, invalidSpread] : injectedAttrs, children = toJsxChildren(merged.children), selfClosing = children.length === 0, arrow = t2.arrowFunctionExpression(
|
|
@@ -11482,10 +11500,19 @@ function transformArgsSpreadsInJsx(node, merged) {
|
|
|
11482
11500
|
});
|
|
11483
11501
|
return { node: t2.jsxFragment(node.openingFragment, node.closingFragment, fragChildren), changed };
|
|
11484
11502
|
}
|
|
11485
|
-
function
|
|
11503
|
+
function resolveIdentifierInit(storyPath, identifier) {
|
|
11486
11504
|
let programPath = storyPath.findParent((p) => p.isProgram());
|
|
11487
11505
|
if (!programPath)
|
|
11488
11506
|
return null;
|
|
11507
|
+
for (let stmt of programPath.get("body")) {
|
|
11508
|
+
if (stmt.isFunctionDeclaration() && stmt.node.id?.name === identifier.node.name)
|
|
11509
|
+
return stmt;
|
|
11510
|
+
if (stmt.isExportNamedDeclaration()) {
|
|
11511
|
+
let decl = stmt.get("declaration");
|
|
11512
|
+
if (decl.isFunctionDeclaration() && decl.node.id?.name === identifier.node.name)
|
|
11513
|
+
return decl;
|
|
11514
|
+
}
|
|
11515
|
+
}
|
|
11489
11516
|
let match = programPath.get("body").flatMap((stmt) => {
|
|
11490
11517
|
if (stmt.isVariableDeclaration())
|
|
11491
11518
|
return stmt.get("declarations");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.16",
|
|
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.
|
|
53
|
+
"@storybook/react-dom-shim": "10.2.16",
|
|
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.
|
|
80
|
+
"storybook": "^10.2.16",
|
|
81
81
|
"typescript": ">= 4.9.x"
|
|
82
82
|
},
|
|
83
83
|
"peerDependenciesMeta": {
|