@storybook/react 10.1.0-alpha.11 → 10.1.0-alpha.12
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 +31 -8
- 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_qxg3ymdvu from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qxg3ymdvu from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qxg3ymdvu from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qxg3ymdvu.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qxg3ymdvu.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qxg3ymdvu.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -3790,6 +3790,29 @@ function getImportTag(docgen) {
|
|
|
3790
3790
|
return (jsdocComment ? extractJSDocInfo(jsdocComment).tags : void 0)?.import?.[0];
|
|
3791
3791
|
}
|
|
3792
3792
|
|
|
3793
|
+
// src/componentManifest/valid-package-name.ts
|
|
3794
|
+
var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
|
|
3795
|
+
function stripSubpath(name) {
|
|
3796
|
+
let parts = name.split("/");
|
|
3797
|
+
return name.startsWith("@") ? parts.length >= 3 ? `${parts[0]}/${parts[1]}` : name : parts[0];
|
|
3798
|
+
}
|
|
3799
|
+
function validPackageName(name) {
|
|
3800
|
+
if (!name.length || name.startsWith(".") || name.match(/^_/) || name.trim() !== name || name.length > 214 || name.toLowerCase() !== name || /[~'!()*]/.test(name.split("/").slice(-1)[0]))
|
|
3801
|
+
return !1;
|
|
3802
|
+
if (encodeURIComponent(name) !== name) {
|
|
3803
|
+
let nameMatch = name.match(scopedPackagePattern);
|
|
3804
|
+
if (nameMatch) {
|
|
3805
|
+
let org = nameMatch[1], pkg = nameMatch[2];
|
|
3806
|
+
if (pkg.startsWith("."))
|
|
3807
|
+
return !1;
|
|
3808
|
+
if (encodeURIComponent(org) === org && encodeURIComponent(pkg) === pkg)
|
|
3809
|
+
return !0;
|
|
3810
|
+
}
|
|
3811
|
+
return !1;
|
|
3812
|
+
}
|
|
3813
|
+
return !0;
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3793
3816
|
// src/componentManifest/getComponentImports.ts
|
|
3794
3817
|
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
3818
|
arr.find(eq) || arr.push(item);
|
|
@@ -3889,7 +3912,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
3889
3912
|
components,
|
|
3890
3913
|
packageName
|
|
3891
3914
|
}) => {
|
|
3892
|
-
let
|
|
3915
|
+
let withSource = components.filter((c) => !!c.importId).map((c, idx) => {
|
|
3893
3916
|
let importId = c.importId, overrideSource = (() => {
|
|
3894
3917
|
if (c.importOverride)
|
|
3895
3918
|
try {
|
|
@@ -3898,7 +3921,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
|
|
|
3898
3921
|
} catch {
|
|
3899
3922
|
return;
|
|
3900
3923
|
}
|
|
3901
|
-
})(), rewritten = overrideSource !== void 0 ? overrideSource : packageName &&
|
|
3924
|
+
})(), rewritten = overrideSource !== void 0 ? overrideSource : packageName && !validPackageName(stripSubpath(importId)) ? packageName : importId;
|
|
3902
3925
|
return { c, src: t3.stringLiteral(rewritten), key: rewritten, ord: idx };
|
|
3903
3926
|
}), orderOfSource = {};
|
|
3904
3927
|
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.12",
|
|
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.12",
|
|
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.12",
|
|
85
85
|
"typescript": ">= 4.9.x"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|