@storybook/react 10.1.0-alpha.11 → 10.1.0-alpha.13
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 +38 -9
- 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_s5wolzyhbrm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_s5wolzyhbrm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_s5wolzyhbrm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_s5wolzyhbrm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_s5wolzyhbrm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_s5wolzyhbrm.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -2825,7 +2825,13 @@ var isAbsolute = function(p) {
|
|
|
2825
2825
|
// ../../core/src/shared/utils/module.ts
|
|
2826
2826
|
var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
|
|
2827
2827
|
"importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
|
|
2828
|
-
), pathToFileURL(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) =>
|
|
2828
|
+
), pathToFileURL(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => {
|
|
2829
|
+
try {
|
|
2830
|
+
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
|
|
2831
|
+
} catch {
|
|
2832
|
+
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"))));
|
|
2833
|
+
}
|
|
2834
|
+
};
|
|
2829
2835
|
|
|
2830
2836
|
// src/componentManifest/generator.ts
|
|
2831
2837
|
import { recast as recast2 } from "storybook/internal/babel";
|
|
@@ -3790,6 +3796,29 @@ function getImportTag(docgen) {
|
|
|
3790
3796
|
return (jsdocComment ? extractJSDocInfo(jsdocComment).tags : void 0)?.import?.[0];
|
|
3791
3797
|
}
|
|
3792
3798
|
|
|
3799
|
+
// src/componentManifest/valid-package-name.ts
|
|
3800
|
+
var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
|
|
3801
|
+
function stripSubpath(name) {
|
|
3802
|
+
let parts = name.split("/");
|
|
3803
|
+
return name.startsWith("@") ? parts.length >= 3 ? `${parts[0]}/${parts[1]}` : name : parts[0];
|
|
3804
|
+
}
|
|
3805
|
+
function validPackageName(name) {
|
|
3806
|
+
if (!name.length || name.startsWith(".") || name.match(/^_/) || name.trim() !== name || name.length > 214 || name.toLowerCase() !== name || /[~'!()*]/.test(name.split("/").slice(-1)[0]))
|
|
3807
|
+
return !1;
|
|
3808
|
+
if (encodeURIComponent(name) !== name) {
|
|
3809
|
+
let nameMatch = name.match(scopedPackagePattern);
|
|
3810
|
+
if (nameMatch) {
|
|
3811
|
+
let org = nameMatch[1], pkg = nameMatch[2];
|
|
3812
|
+
if (pkg.startsWith("."))
|
|
3813
|
+
return !1;
|
|
3814
|
+
if (encodeURIComponent(org) === org && encodeURIComponent(pkg) === pkg)
|
|
3815
|
+
return !0;
|
|
3816
|
+
}
|
|
3817
|
+
return !1;
|
|
3818
|
+
}
|
|
3819
|
+
return !0;
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3793
3822
|
// src/componentManifest/getComponentImports.ts
|
|
3794
3823
|
var baseIdentifier = (component) => component.split(".")[0] ?? component, isTypeSpecifier = (s) => t3.isImportSpecifier(s) && s.importKind === "type", importedName = (im) => t3.isIdentifier(im) ? im.name : im.value, addUniqueBy = (arr, item, eq) => {
|
|
3795
3824
|
arr.find(eq) || arr.push(item);
|
|
@@ -3889,7 +3918,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
3889
3918
|
components,
|
|
3890
3919
|
packageName
|
|
3891
3920
|
}) => {
|
|
3892
|
-
let
|
|
3921
|
+
let withSource = components.filter((c) => !!c.importId).map((c, idx) => {
|
|
3893
3922
|
let importId = c.importId, overrideSource = (() => {
|
|
3894
3923
|
if (c.importOverride)
|
|
3895
3924
|
try {
|
|
@@ -3898,7 +3927,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
3898
3927
|
} catch {
|
|
3899
3928
|
return;
|
|
3900
3929
|
}
|
|
3901
|
-
})(), rewritten = overrideSource !== void 0 ? overrideSource : packageName &&
|
|
3930
|
+
})(), rewritten = overrideSource !== void 0 ? overrideSource : packageName && !validPackageName(stripSubpath(importId)) ? packageName : importId;
|
|
3902
3931
|
return { c, src: t3.stringLiteral(rewritten), key: rewritten, ord: idx };
|
|
3903
3932
|
}), orderOfSource = {};
|
|
3904
3933
|
for (let w of withSource)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "10.1.0-alpha.
|
|
3
|
+
"version": "10.1.0-alpha.13",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@storybook/global": "^5.0.0",
|
|
57
|
-
"@storybook/react-dom-shim": "10.1.0-alpha.
|
|
57
|
+
"@storybook/react-dom-shim": "10.1.0-alpha.13",
|
|
58
58
|
"react-docgen": "^8.0.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
83
83
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
84
|
-
"storybook": "^10.1.0-alpha.
|
|
84
|
+
"storybook": "^10.1.0-alpha.13",
|
|
85
85
|
"typescript": ">= 4.9.x"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|