@storybook/cli 10.6.0-alpha.7 → 10.6.0-alpha.9
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/_node-chunks/{block-dependencies-versions-RS26YIGJ.js → block-dependencies-versions-KMWWLUFS.js} +11 -11
- package/dist/_node-chunks/{block-experimental-addon-test-IAKOKCPP.js → block-experimental-addon-test-C4VG3VCO.js} +9 -9
- package/dist/_node-chunks/{block-major-version-CNWTEJ45.js → block-major-version-HOKPG6KB.js} +9 -9
- package/dist/_node-chunks/{block-node-version-4RXHQDKL.js → block-node-version-DZJ4XHR6.js} +9 -9
- package/dist/_node-chunks/{block-webpack5-frameworks-YVIFTSQ6.js → block-webpack5-frameworks-36Q6U4MI.js} +11 -11
- package/dist/_node-chunks/{chunk-V37L2J36.js → chunk-G4PYMLCC.js} +6 -6
- package/dist/_node-chunks/{chunk-YQTCVN7G.js → chunk-KGY55NOJ.js} +7 -7
- package/dist/_node-chunks/{chunk-N7YG2NBI.js → chunk-QUENR7U4.js} +7 -7
- package/dist/_node-chunks/{chunk-6I65HBVD.js → chunk-WDSDJOI6.js} +22 -15
- package/dist/_node-chunks/chunk-X5MM6XZI.js +11 -0
- package/dist/_node-chunks/{globby-GUCLXM7R.js → globby-2EA2TMCX.js} +8 -8
- package/dist/_node-chunks/{p-limit-CS3WZCC5.js → p-limit-3RBZGB4T.js} +7 -7
- package/dist/_node-chunks/{run-JBWNAVC5.js → run-G3VBZFUP.js} +249 -118
- package/dist/bin/index.js +7 -7
- package/package.json +4 -4
- package/dist/_node-chunks/chunk-IGRDHNPH.js +0 -11
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
findOutdatedPackage
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-WDSDJOI6.js";
|
|
15
|
+
import "./chunk-QUENR7U4.js";
|
|
16
|
+
import "./chunk-X5MM6XZI.js";
|
|
17
|
+
import "./chunk-KGY55NOJ.js";
|
|
18
|
+
import "./chunk-G4PYMLCC.js";
|
|
19
19
|
|
|
20
20
|
// src/autoblock/block-dependencies-versions.ts
|
|
21
21
|
import { dedent } from "ts-dedent";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.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 "./chunk-
|
|
12
|
+
import "./chunk-X5MM6XZI.js";
|
|
13
13
|
import {
|
|
14
14
|
require_semver
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KGY55NOJ.js";
|
|
16
16
|
import {
|
|
17
17
|
__toESM
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-G4PYMLCC.js";
|
|
19
19
|
|
|
20
20
|
// src/autoblock/block-experimental-addon-test.ts
|
|
21
21
|
var import_semver = __toESM(require_semver(), 1);
|
package/dist/_node-chunks/{block-major-version-CNWTEJ45.js → block-major-version-HOKPG6KB.js}
RENAMED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.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 "./chunk-
|
|
12
|
+
import "./chunk-X5MM6XZI.js";
|
|
13
13
|
import {
|
|
14
14
|
require_semver
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KGY55NOJ.js";
|
|
16
16
|
import {
|
|
17
17
|
__toESM
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-G4PYMLCC.js";
|
|
19
19
|
|
|
20
20
|
// src/autoblock/block-major-version.ts
|
|
21
21
|
var import_semver = __toESM(require_semver(), 1);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.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 "./chunk-
|
|
12
|
+
import "./chunk-X5MM6XZI.js";
|
|
13
13
|
import {
|
|
14
14
|
require_semver
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KGY55NOJ.js";
|
|
16
16
|
import {
|
|
17
17
|
__toESM
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-G4PYMLCC.js";
|
|
19
19
|
|
|
20
20
|
// src/autoblock/block-node-version.ts
|
|
21
21
|
var import_semver = __toESM(require_semver(), 1);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
findOutdatedPackage
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-WDSDJOI6.js";
|
|
15
|
+
import "./chunk-QUENR7U4.js";
|
|
16
|
+
import "./chunk-X5MM6XZI.js";
|
|
17
|
+
import "./chunk-KGY55NOJ.js";
|
|
18
|
+
import "./chunk-G4PYMLCC.js";
|
|
19
19
|
|
|
20
20
|
// src/autoblock/block-webpack5-frameworks.ts
|
|
21
21
|
var minimalVersionsMap = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-G4PYMLCC.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/semver/internal/constants.js
|
|
17
17
|
var require_constants = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.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 "./chunk-
|
|
16
|
+
} from "./chunk-G4PYMLCC.js";
|
|
17
17
|
|
|
18
18
|
// ../../../node_modules/fast-glob/out/utils/array.js
|
|
19
19
|
var require_array = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,14 +12,14 @@ var require = CJS_COMPAT_NODE_MODULE_koorielfsj.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
globby,
|
|
14
14
|
globbySync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QUENR7U4.js";
|
|
16
16
|
import {
|
|
17
17
|
require_semver
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KGY55NOJ.js";
|
|
19
19
|
import {
|
|
20
20
|
__commonJS,
|
|
21
21
|
__toESM
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G4PYMLCC.js";
|
|
23
23
|
|
|
24
24
|
// ../../../node_modules/picocolors/picocolors.js
|
|
25
25
|
var require_picocolors = __commonJS({
|
|
@@ -126,11 +126,11 @@ var import_picocolors2 = __toESM(require_picocolors(), 1), import_semver = __toE
|
|
|
126
126
|
// src/autoblock/index.ts
|
|
127
127
|
var blockers = () => [
|
|
128
128
|
// add/remove blockers here
|
|
129
|
-
import("./block-dependencies-versions-
|
|
130
|
-
import("./block-node-version-
|
|
131
|
-
import("./block-webpack5-frameworks-
|
|
132
|
-
import("./block-major-version-
|
|
133
|
-
import("./block-experimental-addon-test-
|
|
129
|
+
import("./block-dependencies-versions-KMWWLUFS.js"),
|
|
130
|
+
import("./block-node-version-DZJ4XHR6.js"),
|
|
131
|
+
import("./block-webpack5-frameworks-36Q6U4MI.js"),
|
|
132
|
+
import("./block-major-version-HOKPG6KB.js"),
|
|
133
|
+
import("./block-experimental-addon-test-C4VG3VCO.js")
|
|
134
134
|
], autoblock = async (options, list = blockers()) => list.length === 0 ? null : await Promise.all(
|
|
135
135
|
list.map(async (i) => {
|
|
136
136
|
let blocker = (await i).blocker;
|
|
@@ -152,6 +152,12 @@ import { getStorybookData } from "storybook/internal/cli";
|
|
|
152
152
|
var getFrameworkPackageName = (mainConfig) => {
|
|
153
153
|
let packageNameOrPath = typeof mainConfig?.framework == "string" ? mainConfig.framework : mainConfig?.framework?.name;
|
|
154
154
|
return packageNameOrPath ? extractFrameworkPackageName(packageNameOrPath) : null;
|
|
155
|
+
}, getRendererName = (mainConfig) => {
|
|
156
|
+
let frameworkPackageName = getFrameworkPackageName(mainConfig);
|
|
157
|
+
if (!frameworkPackageName)
|
|
158
|
+
return null;
|
|
159
|
+
let frameworkName = frameworkPackages[frameworkPackageName];
|
|
160
|
+
return frameworkToRenderer[frameworkName];
|
|
155
161
|
};
|
|
156
162
|
var updateMainConfig = async ({ mainConfigPath, dryRun }, callback) => {
|
|
157
163
|
try {
|
|
@@ -296,7 +302,7 @@ var processProject = async ({
|
|
|
296
302
|
};
|
|
297
303
|
}
|
|
298
304
|
}, collectProjects = async (options, configDirs, onProjectScanStart) => {
|
|
299
|
-
let { default: pLimit } = await import("./p-limit-
|
|
305
|
+
let { default: pLimit } = await import("./p-limit-3RBZGB4T.js"), currentCLIVersion = versions.storybook, limit = pLimit(5), projectPromises = configDirs.map(
|
|
300
306
|
(configDir) => limit(
|
|
301
307
|
() => processProject({
|
|
302
308
|
configDir,
|
|
@@ -531,6 +537,7 @@ After addressing this, you can try running the upgrade command again. You can al
|
|
|
531
537
|
export {
|
|
532
538
|
require_picocolors,
|
|
533
539
|
getFrameworkPackageName,
|
|
540
|
+
getRendererName,
|
|
534
541
|
updateMainConfig,
|
|
535
542
|
containsESMUsage,
|
|
536
543
|
containsRequireUsage,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
isGitIgnoredSync,
|
|
22
22
|
isIgnoredByIgnoreFiles,
|
|
23
23
|
isIgnoredByIgnoreFilesSync
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-QUENR7U4.js";
|
|
25
|
+
import "./chunk-G4PYMLCC.js";
|
|
26
26
|
export {
|
|
27
27
|
convertPathToPattern,
|
|
28
28
|
generateGlobTasks,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.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 "./chunk-
|
|
12
|
+
import "./chunk-G4PYMLCC.js";
|
|
13
13
|
|
|
14
14
|
// ../../../node_modules/yocto-queue/index.js
|
|
15
15
|
var Node = class {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
findFilesUp,
|
|
19
19
|
getFrameworkPackageName,
|
|
20
20
|
getProjects,
|
|
21
|
+
getRendererName,
|
|
21
22
|
getStorybookData,
|
|
22
23
|
hasRequireBanner,
|
|
23
24
|
processAutoblockerResults,
|
|
@@ -26,18 +27,18 @@ import {
|
|
|
26
27
|
up,
|
|
27
28
|
updateMainConfig,
|
|
28
29
|
upgradeStorybookDependencies
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WDSDJOI6.js";
|
|
30
31
|
import {
|
|
31
32
|
slash
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-QUENR7U4.js";
|
|
33
34
|
import {
|
|
34
35
|
require_semver
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-KGY55NOJ.js";
|
|
36
37
|
import {
|
|
37
38
|
__commonJS,
|
|
38
39
|
__require,
|
|
39
40
|
__toESM
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-G4PYMLCC.js";
|
|
41
42
|
|
|
42
43
|
// ../../../node_modules/envinfo/dist/envinfo.js
|
|
43
44
|
var require_envinfo = __commonJS({
|
|
@@ -4721,7 +4722,7 @@ import {
|
|
|
4721
4722
|
import { withTelemetry } from "storybook/internal/core-server";
|
|
4722
4723
|
import { CLI_COLORS as CLI_COLORS5, logTracker as logTracker4, logger as logger27 } from "storybook/internal/node-logger";
|
|
4723
4724
|
import { addToGlobalContext, telemetry as telemetry2 } from "storybook/internal/telemetry";
|
|
4724
|
-
import { Option, program } from "commander";
|
|
4725
|
+
import { InvalidArgumentError, Option, program } from "commander";
|
|
4725
4726
|
|
|
4726
4727
|
// ../../../node_modules/leven/index.js
|
|
4727
4728
|
var array = [], characterCodeCache = [];
|
|
@@ -4761,7 +4762,7 @@ function leven(first, second, options) {
|
|
|
4761
4762
|
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
4762
4763
|
|
|
4763
4764
|
// package.json
|
|
4764
|
-
var version = "10.6.0-alpha.
|
|
4765
|
+
var version = "10.6.0-alpha.9";
|
|
4765
4766
|
|
|
4766
4767
|
// src/add.ts
|
|
4767
4768
|
var import_semver = __toESM(require_semver(), 1);
|
|
@@ -5597,7 +5598,7 @@ import { logger as logger3 } from "storybook/internal/node-logger";
|
|
|
5597
5598
|
import { promises as fs } from "fs";
|
|
5598
5599
|
var maxConcurrentTasks = Math.max(1, os.cpus().length - 1);
|
|
5599
5600
|
async function runCodemod(globPattern = "**/*.{stories,story}.{js,jsx,ts,tsx,mjs,mjsx,mts,mtsx}", transform, { dryRun = !1, skipFormatting = !1 } = {}) {
|
|
5600
|
-
let modifiedCount = 0, unmodifiedCount = 0, errorCount = 0, { globby } = await import("./globby-
|
|
5601
|
+
let modifiedCount = 0, unmodifiedCount = 0, errorCount = 0, { globby } = await import("./globby-2EA2TMCX.js"), files = await globby(slash(globPattern), {
|
|
5601
5602
|
followSymbolicLinks: !0,
|
|
5602
5603
|
ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**", "**/build/**"]
|
|
5603
5604
|
});
|
|
@@ -5608,7 +5609,7 @@ Please try a different pattern.
|
|
|
5608
5609
|
`
|
|
5609
5610
|
), new Error("No files matched");
|
|
5610
5611
|
try {
|
|
5611
|
-
let pLimit = (await import("./p-limit-
|
|
5612
|
+
let pLimit = (await import("./p-limit-3RBZGB4T.js")).default, limit = pLimit(maxConcurrentTasks);
|
|
5612
5613
|
await Promise.all(
|
|
5613
5614
|
files.map(
|
|
5614
5615
|
(file) => limit(async () => {
|
|
@@ -6304,7 +6305,8 @@ import {
|
|
|
6304
6305
|
ANALOG_VITE_PLUGIN_ANGULAR_VERSION,
|
|
6305
6306
|
AngularJSON,
|
|
6306
6307
|
editJsonText as editJsonText2,
|
|
6307
|
-
isStorybookTarget as isStorybookTarget2
|
|
6308
|
+
isStorybookTarget as isStorybookTarget2,
|
|
6309
|
+
toDevkitVersion
|
|
6308
6310
|
} from "storybook/internal/cli";
|
|
6309
6311
|
import { formatFileContent as formatFileContent5, getProjectRoot as getProjectRoot2, transformImportFiles } from "storybook/internal/common";
|
|
6310
6312
|
import { formatConfig as formatConfig3, readConfig as readConfig3 } from "storybook/internal/csf-tools";
|
|
@@ -6628,7 +6630,7 @@ var asObject = (value) => typeof value == "object" && value !== null && !Array.i
|
|
|
6628
6630
|
let targets = asObject(root?.targets);
|
|
6629
6631
|
return targets && groups.push({ pathPrefix: ["targets"], targets }), groups;
|
|
6630
6632
|
}, findWorkspaceFiles = async (basename5) => {
|
|
6631
|
-
let { globby } = await import("./globby-
|
|
6633
|
+
let { globby } = await import("./globby-2EA2TMCX.js");
|
|
6632
6634
|
return globby([`**/${basename5}`], {
|
|
6633
6635
|
cwd: getProjectRoot(),
|
|
6634
6636
|
ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**"],
|
|
@@ -6868,7 +6870,10 @@ var COMPODOC_PACKAGE = "@compodoc/compodoc", SET_COMPODOC_JSON = "setCompodocJso
|
|
|
6868
6870
|
};
|
|
6869
6871
|
|
|
6870
6872
|
// src/automigrate/fixes/angular-to-angular-vite.ts
|
|
6871
|
-
var ANGULAR_PACKAGE = "@storybook/angular", ANGULAR_VITE_PACKAGE2 = "@storybook/angular-vite", ANALOG_VITE_PLUGIN_PACKAGE = "@analogjs/vite-plugin-angular", FRAMEWORK_DOC_URL = "https://storybook.js.org/docs/get-started/frameworks/angular-vite", VITE_CONFIG_DOC_URL = "https://storybook.js.org/docs/builders/vite#configure",
|
|
6873
|
+
var ANGULAR_PACKAGE = "@storybook/angular", ANALOG_PACKAGE = "@analogjs/storybook-angular", ANGULAR_VITE_PACKAGE2 = "@storybook/angular-vite", ANALOG_VITE_PLUGIN_PACKAGE = "@analogjs/vite-plugin-angular", ANGULAR_BUILD_PACKAGE = "@angular/build", ANGULAR_ANIMATIONS_PACKAGE = "@angular/animations", ANGULAR_DEVKIT_ARCHITECT_PACKAGE = "@angular-devkit/architect", MIGRATABLE_FRAMEWORKS = [ANGULAR_PACKAGE, ANALOG_PACKAGE], FRAMEWORK_DOC_URL = "https://storybook.js.org/docs/get-started/frameworks/angular-vite", VITE_CONFIG_DOC_URL = "https://storybook.js.org/docs/builders/vite#configure", ANGULAR_MIN_MAJOR = 21, rewriteBuilderRefs = (content) => MIGRATABLE_FRAMEWORKS.reduce(
|
|
6874
|
+
(acc, framework) => acc.replaceAll(`${framework}:start-storybook`, `${ANGULAR_VITE_PACKAGE2}:start-storybook`).replaceAll(`${framework}:build-storybook`, `${ANGULAR_VITE_PACKAGE2}:build-storybook`),
|
|
6875
|
+
content
|
|
6876
|
+
), rewriteTestStorybookScript = (content) => content.replace(/("test-storybook"\s*:\s*)"(?:[^"\\]|\\.)*"/, '$1"vitest run"'), VITE_CONFIG_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".cts", ".mts", ".cjs", ".mjs"], findExistingViteConfig = (configDir) => {
|
|
6872
6877
|
let search = (basename5, extensions) => any(
|
|
6873
6878
|
extensions.map((ext) => basename5 + ext),
|
|
6874
6879
|
{ last: getProjectRoot2(), cwd: configDir }
|
|
@@ -6913,17 +6918,34 @@ export default defineConfig({
|
|
|
6913
6918
|
],
|
|
6914
6919
|
},
|
|
6915
6920
|
});
|
|
6916
|
-
`, transformMainConfig = async (mainConfigPath, dryRun) => {
|
|
6921
|
+
`, transformMainConfig = async (mainConfigPath, dryRun, framework) => {
|
|
6917
6922
|
try {
|
|
6918
6923
|
let content = await readFile(mainConfigPath, "utf-8");
|
|
6919
|
-
if (!content.includes(
|
|
6924
|
+
if (!content.includes(framework))
|
|
6920
6925
|
return !1;
|
|
6921
|
-
let transformed = content.replace(/@storybook\/angular(?!-vite)/g, ANGULAR_VITE_PACKAGE2);
|
|
6926
|
+
let transformed = framework === ANGULAR_PACKAGE ? content.replace(/@storybook\/angular(?!-vite)/g, ANGULAR_VITE_PACKAGE2) : content.replaceAll(framework, ANGULAR_VITE_PACKAGE2);
|
|
6922
6927
|
return transformed !== content && !dryRun && await writeFile2(mainConfigPath, transformed), transformed !== content;
|
|
6923
6928
|
} catch (error) {
|
|
6924
6929
|
return logger8.error(`Failed to update main config at ${mainConfigPath}: ${error}`), !1;
|
|
6925
6930
|
}
|
|
6926
|
-
}, rewriteStorybookBuilderRef = (ref) =>
|
|
6931
|
+
}, rewriteStorybookBuilderRef = (ref) => {
|
|
6932
|
+
for (let framework of MIGRATABLE_FRAMEWORKS) {
|
|
6933
|
+
if (ref === `${framework}:start-storybook`)
|
|
6934
|
+
return `${ANGULAR_VITE_PACKAGE2}:start-storybook`;
|
|
6935
|
+
if (ref === `${framework}:build-storybook`)
|
|
6936
|
+
return `${ANGULAR_VITE_PACKAGE2}:build-storybook`;
|
|
6937
|
+
}
|
|
6938
|
+
return null;
|
|
6939
|
+
}, isMigratableStorybookTarget = (target) => MIGRATABLE_FRAMEWORKS.some((framework) => isStorybookTarget2(target, framework)), matchMigratableFramework = (frameworkPackageName) => {
|
|
6940
|
+
if (!frameworkPackageName)
|
|
6941
|
+
return;
|
|
6942
|
+
let normalized = frameworkPackageName.replace(/\\/g, "/");
|
|
6943
|
+
return MIGRATABLE_FRAMEWORKS.find(
|
|
6944
|
+
(framework) => normalized === framework || // `@storybook/angular` must not match a path ending in `@storybook/angular-vite`, which the
|
|
6945
|
+
// leading slash guarantees.
|
|
6946
|
+
normalized.endsWith(`/${framework}`) || normalized.includes(`/.pnpm/${framework.replace("/", "+")}@`)
|
|
6947
|
+
);
|
|
6948
|
+
}, TextJsonEditor = class {
|
|
6927
6949
|
constructor(content) {
|
|
6928
6950
|
this.content = content;
|
|
6929
6951
|
}
|
|
@@ -6931,14 +6953,14 @@ export default defineConfig({
|
|
|
6931
6953
|
this.content = editJsonText2(this.content, path4, value);
|
|
6932
6954
|
}
|
|
6933
6955
|
}, processStorybookTargets = (editor, targetGroups) => {
|
|
6934
|
-
let changed = !1, hasStorybookTarget = !1,
|
|
6956
|
+
let changed = !1, hasStorybookTarget = !1, anyZoneBasedTarget = !1;
|
|
6935
6957
|
for (let { pathPrefix, targets } of targetGroups)
|
|
6936
6958
|
for (let [targetName, target] of Object.entries(targets)) {
|
|
6937
|
-
if (!
|
|
6959
|
+
if (!isMigratableStorybookTarget(target) && !isStorybookTarget2(target, ANGULAR_VITE_PACKAGE2))
|
|
6938
6960
|
continue;
|
|
6939
6961
|
hasStorybookTarget = !0;
|
|
6940
6962
|
let currentRef = target.builder ?? target.executor ?? null, hasOldZonelessKey = !!target.options && "experimentalZoneless" in target.options, zonelessValue = target.options?.zoneless ?? target.options?.experimentalZoneless;
|
|
6941
|
-
if (zonelessValue
|
|
6963
|
+
if (zonelessValue === !1 && (anyZoneBasedTarget = !0), !isMigratableStorybookTarget(target))
|
|
6942
6964
|
continue;
|
|
6943
6965
|
let newRef = currentRef ? rewriteStorybookBuilderRef(currentRef) : null;
|
|
6944
6966
|
if (newRef) {
|
|
@@ -6947,7 +6969,7 @@ export default defineConfig({
|
|
|
6947
6969
|
}
|
|
6948
6970
|
hasOldZonelessKey && (editor.edit([...pathPrefix, targetName, "options", "zoneless"], zonelessValue), editor.edit([...pathPrefix, targetName, "options", "experimentalZoneless"], void 0), changed = !0);
|
|
6949
6971
|
}
|
|
6950
|
-
return { changed, hasStorybookTarget,
|
|
6972
|
+
return { changed, hasStorybookTarget, anyZoneBasedTarget };
|
|
6951
6973
|
}, transformAngularJson = (angularJsonPath, dryRun) => {
|
|
6952
6974
|
let angularJSON;
|
|
6953
6975
|
try {
|
|
@@ -6956,34 +6978,20 @@ export default defineConfig({
|
|
|
6956
6978
|
return {
|
|
6957
6979
|
changed: !1,
|
|
6958
6980
|
hasStorybookTarget: !1,
|
|
6959
|
-
|
|
6981
|
+
anyZoneBasedTarget: !1
|
|
6960
6982
|
};
|
|
6961
6983
|
}
|
|
6962
|
-
let
|
|
6963
|
-
|
|
6964
|
-
getTargetGroups(angularJSON.json)
|
|
6965
|
-
);
|
|
6966
|
-
return changed && !dryRun && angularJSON.write(), {
|
|
6967
|
-
changed,
|
|
6968
|
-
hasStorybookTarget,
|
|
6969
|
-
allStorybookTargetsZonelessTrue: allZonelessTrue
|
|
6970
|
-
};
|
|
6984
|
+
let result = processStorybookTargets(angularJSON, getTargetGroups(angularJSON.json));
|
|
6985
|
+
return result.changed && !dryRun && angularJSON.write(), result;
|
|
6971
6986
|
}, transformProjectJson = async (projectJsonPath, dryRun) => {
|
|
6972
6987
|
try {
|
|
6973
|
-
let original = await readFile(projectJsonPath, "utf-8"), json = JSON.parse(original), editor = new TextJsonEditor(original),
|
|
6974
|
-
|
|
6975
|
-
getTargetGroups(json)
|
|
6976
|
-
);
|
|
6977
|
-
return changed && !dryRun && await writeFile2(projectJsonPath, editor.content), {
|
|
6978
|
-
changed,
|
|
6979
|
-
hasStorybookTarget,
|
|
6980
|
-
allStorybookTargetsZonelessTrue: allZonelessTrue
|
|
6981
|
-
};
|
|
6988
|
+
let original = await readFile(projectJsonPath, "utf-8"), json = JSON.parse(original), editor = new TextJsonEditor(original), result = processStorybookTargets(editor, getTargetGroups(json));
|
|
6989
|
+
return result.changed && !dryRun && await writeFile2(projectJsonPath, editor.content), result;
|
|
6982
6990
|
} catch {
|
|
6983
6991
|
return {
|
|
6984
6992
|
changed: !1,
|
|
6985
6993
|
hasStorybookTarget: !1,
|
|
6986
|
-
|
|
6994
|
+
anyZoneBasedTarget: !1
|
|
6987
6995
|
};
|
|
6988
6996
|
}
|
|
6989
6997
|
}, addZoneJsPreviewImport = async (previewConfigPath, dryRun) => {
|
|
@@ -7001,20 +7009,31 @@ export default defineConfig({
|
|
|
7001
7009
|
`Could not add a \`zone.js\` import to ${previewConfigPath} automatically: ${error}. If your app uses zone-based change detection, add \`import 'zone.js';\` at the top of your preview.`
|
|
7002
7010
|
);
|
|
7003
7011
|
}
|
|
7012
|
+
}, getGuaranteedAngularMajor = (specifier) => {
|
|
7013
|
+
let range = specifier ? import_semver5.default.validRange(specifier) : null, major = range ? import_semver5.default.minVersion(range)?.major ?? null : null;
|
|
7014
|
+
return major === 0 ? null : major;
|
|
7004
7015
|
}, angularToAngularVite = {
|
|
7005
7016
|
id: "angular-to-angular-vite",
|
|
7006
7017
|
link: FRAMEWORK_DOC_URL,
|
|
7007
7018
|
defaultSelected: !1,
|
|
7008
7019
|
async check({ packageManager, mainConfig }) {
|
|
7009
7020
|
let allDeps = packageManager.getAllDependencies();
|
|
7010
|
-
if (
|
|
7021
|
+
if (allDeps[ANGULAR_VITE_PACKAGE2] || MIGRATABLE_FRAMEWORKS.every((pkg) => !allDeps[pkg]))
|
|
7011
7022
|
return null;
|
|
7012
|
-
let
|
|
7013
|
-
if (
|
|
7014
|
-
return
|
|
7015
|
-
`Skipped ${ANGULAR_VITE_PACKAGE2} migration: this project's Storybook framework is \`${frameworkPackageName ?? "not set"}\`, and only
|
|
7023
|
+
let angularSpecifier = await packageManager.getDeclaredVersionSpecifier("@angular/core"), frameworkPackageName = getFrameworkPackageName(mainConfig), framework = matchMigratableFramework(frameworkPackageName);
|
|
7024
|
+
if (!framework)
|
|
7025
|
+
return angularSpecifier && logger8.warn(
|
|
7026
|
+
`Skipped ${ANGULAR_VITE_PACKAGE2} migration: this project's Storybook framework is \`${frameworkPackageName ?? "not set"}\`, and only ${MIGRATABLE_FRAMEWORKS.map((pkg) => `\`${pkg}\``).join(" and ")} projects can be migrated automatically. See ${FRAMEWORK_DOC_URL} to switch frameworks by hand.`
|
|
7027
|
+
), null;
|
|
7028
|
+
let angularMajor = getGuaranteedAngularMajor(angularSpecifier);
|
|
7029
|
+
if (angularMajor !== null && angularMajor < ANGULAR_MIN_MAJOR)
|
|
7030
|
+
return logger8.warn(
|
|
7031
|
+
`Skipped ${ANGULAR_VITE_PACKAGE2} migration: it needs Angular ${ANGULAR_MIN_MAJOR}, and this project is on Angular ${angularMajor}. Run \`ng update @angular/core @angular/cli\` to upgrade, then run this migration again.`
|
|
7016
7032
|
), null;
|
|
7017
|
-
|
|
7033
|
+
angularMajor === null && logger8.warn(
|
|
7034
|
+
`Could not determine the \`@angular/core\` version, so the ${ANGULAR_VITE_PACKAGE2} migration cannot confirm this project is on Angular ${ANGULAR_MIN_MAJOR} or newer. Continuing anyway. If the migrated project fails to build, upgrade Angular first.`
|
|
7035
|
+
);
|
|
7036
|
+
let hasWebpackFinal = !1;
|
|
7018
7037
|
for (let pkgJsonPath of packageManager.packageJsonPaths) {
|
|
7019
7038
|
let dir = pkgJsonPath.replace(/[/\\]package\.json$/, "");
|
|
7020
7039
|
for (let mainName of [
|
|
@@ -7036,19 +7055,19 @@ export default defineConfig({
|
|
|
7036
7055
|
for (let pkgJsonPath of packageManager.packageJsonPaths)
|
|
7037
7056
|
try {
|
|
7038
7057
|
let raw = await readFile(pkgJsonPath, "utf-8"), pkg = JSON.parse(raw), deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
7039
|
-
|
|
7058
|
+
MIGRATABLE_FRAMEWORKS.some((pkg2) => pkg2 in deps) && packageJsonFiles.push(pkgJsonPath);
|
|
7040
7059
|
} catch {
|
|
7041
7060
|
continue;
|
|
7042
7061
|
}
|
|
7043
7062
|
return {
|
|
7044
|
-
|
|
7045
|
-
angularVersion,
|
|
7063
|
+
framework,
|
|
7046
7064
|
hasWebpackFinal,
|
|
7047
|
-
packageJsonFiles
|
|
7065
|
+
packageJsonFiles,
|
|
7066
|
+
angularVersion: angularMajor === null ? null : angularSpecifier
|
|
7048
7067
|
};
|
|
7049
7068
|
},
|
|
7050
7069
|
prompt() {
|
|
7051
|
-
return "Migrate from @storybook/angular (Webpack) to @storybook/angular-vite (in preview).";
|
|
7070
|
+
return "Migrate from @storybook/angular (Webpack) or @analogjs/storybook-angular to @storybook/angular-vite (in preview).";
|
|
7052
7071
|
},
|
|
7053
7072
|
async run({
|
|
7054
7073
|
result,
|
|
@@ -7065,15 +7084,6 @@ export default defineConfig({
|
|
|
7065
7084
|
}) {
|
|
7066
7085
|
if (!result)
|
|
7067
7086
|
return;
|
|
7068
|
-
if (result.angularUnsupportedVersion) {
|
|
7069
|
-
logger8.log(
|
|
7070
|
-
dedent6`
|
|
7071
|
-
Migration skipped: Angular 21 is required.
|
|
7072
|
-
Run \`ng update @angular/core @angular/cli\` to upgrade, then try again.
|
|
7073
|
-
`
|
|
7074
|
-
);
|
|
7075
|
-
return;
|
|
7076
|
-
}
|
|
7077
7087
|
if (result.hasWebpackFinal && (logger8.logBox(
|
|
7078
7088
|
dedent6`
|
|
7079
7089
|
We detected a \`webpackFinal\` hook in your Storybook main config.
|
|
@@ -7091,11 +7101,11 @@ export default defineConfig({
|
|
|
7091
7101
|
);
|
|
7092
7102
|
return;
|
|
7093
7103
|
}
|
|
7094
|
-
if (logger8.step(`Migrating from ${
|
|
7104
|
+
if (logger8.step(`Migrating from ${result.framework} to ${ANGULAR_VITE_PACKAGE2}...`), logger8.debug("Updating main config..."), !mainConfigPath || !await transformMainConfig(mainConfigPath, dryRun, result.framework)) {
|
|
7095
7105
|
logger8.error(
|
|
7096
7106
|
dedent6`
|
|
7097
7107
|
Migration stopped: the \`framework\` field could not be rewritten in ${mainConfigPath ?? "your Storybook main config"}.
|
|
7098
|
-
That file names no \`${
|
|
7108
|
+
That file names no \`${result.framework}\`, so it most likely inherits the framework from a shared config.
|
|
7099
7109
|
Point \`framework\` at \`${ANGULAR_VITE_PACKAGE2}\` where it is declared, then run this migration again.
|
|
7100
7110
|
`
|
|
7101
7111
|
);
|
|
@@ -7104,25 +7114,41 @@ export default defineConfig({
|
|
|
7104
7114
|
if (dryRun)
|
|
7105
7115
|
logger8.debug("Dry run: Skipping dependency updates.");
|
|
7106
7116
|
else {
|
|
7107
|
-
logger8.debug("Updating dependencies..."), await packageManager.removeDependencies(
|
|
7108
|
-
|
|
7109
|
-
|
|
7117
|
+
logger8.debug("Updating dependencies..."), await packageManager.removeDependencies(
|
|
7118
|
+
result.framework === ANALOG_PACKAGE ? [ANALOG_PACKAGE, ANGULAR_PACKAGE] : [ANGULAR_PACKAGE]
|
|
7119
|
+
);
|
|
7120
|
+
let allDeps = packageManager.getAllDependencies(), { angularVersion } = result, architectVersion = toDevkitVersion(angularVersion), unpinnableAngularPeers = angularVersion ? [] : [
|
|
7121
|
+
ANGULAR_BUILD_PACKAGE,
|
|
7122
|
+
ANGULAR_ANIMATIONS_PACKAGE,
|
|
7123
|
+
ANGULAR_DEVKIT_ARCHITECT_PACKAGE
|
|
7124
|
+
].filter((pkg) => !allDeps[pkg]);
|
|
7125
|
+
unpinnableAngularPeers.length > 0 && logger8.warn(
|
|
7126
|
+
`Could not determine the \`@angular/core\` version, so ${unpinnableAngularPeers.map((pkg) => `\`${pkg}\``).join(", ")} were not added. ${ANGULAR_VITE_PACKAGE2} needs them at your Angular version, and adding them unpinned would install the next Angular major. Add them by hand before starting Storybook.`
|
|
7127
|
+
), await packageManager.addDependencies({ type: "devDependencies", skipInstall: !0 }, [
|
|
7110
7128
|
`${ANGULAR_VITE_PACKAGE2}@${storybookVersion}`,
|
|
7111
|
-
...allDeps[ANALOG_VITE_PLUGIN_PACKAGE] ? [] : [`${ANALOG_VITE_PLUGIN_PACKAGE}@${ANALOG_VITE_PLUGIN_ANGULAR_VERSION}`]
|
|
7129
|
+
...allDeps[ANALOG_VITE_PLUGIN_PACKAGE] ? [] : [`${ANALOG_VITE_PLUGIN_PACKAGE}@${ANALOG_VITE_PLUGIN_ANGULAR_VERSION}`],
|
|
7130
|
+
...allDeps[ANGULAR_BUILD_PACKAGE] || !angularVersion ? [] : [`${ANGULAR_BUILD_PACKAGE}@${angularVersion}`],
|
|
7131
|
+
...allDeps[ANGULAR_ANIMATIONS_PACKAGE] || !angularVersion ? [] : [`${ANGULAR_ANIMATIONS_PACKAGE}@${angularVersion}`],
|
|
7132
|
+
...allDeps[ANGULAR_DEVKIT_ARCHITECT_PACKAGE] || !architectVersion ? [] : [`${ANGULAR_DEVKIT_ARCHITECT_PACKAGE}@${architectVersion}`]
|
|
7112
7133
|
]);
|
|
7113
7134
|
}
|
|
7114
|
-
let anyStorybookTarget = !1,
|
|
7135
|
+
let anyStorybookTarget = !1, anyZoneBasedTarget = !1;
|
|
7115
7136
|
for (let pkgJsonPath of packageManager.packageJsonPaths) {
|
|
7116
|
-
let angularJsonPath = `${pkgJsonPath.replace(/[/\\]package\.json$/, "")}/angular.json`, {
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7137
|
+
let angularJsonPath = `${pkgJsonPath.replace(/[/\\]package\.json$/, "")}/angular.json`, {
|
|
7138
|
+
changed,
|
|
7139
|
+
hasStorybookTarget,
|
|
7140
|
+
anyZoneBasedTarget: zoneBased
|
|
7141
|
+
} = transformAngularJson(angularJsonPath, dryRun);
|
|
7142
|
+
hasStorybookTarget && (anyStorybookTarget = !0, anyZoneBasedTarget = anyZoneBasedTarget || zoneBased), changed && logger8.debug(`Updated Angular CLI builder references in ${angularJsonPath}`);
|
|
7121
7143
|
}
|
|
7122
7144
|
let projectJsonFiles = await findWorkspaceFiles("project.json");
|
|
7123
7145
|
for (let projectJsonPath of projectJsonFiles) {
|
|
7124
|
-
let {
|
|
7125
|
-
|
|
7146
|
+
let {
|
|
7147
|
+
changed,
|
|
7148
|
+
hasStorybookTarget,
|
|
7149
|
+
anyZoneBasedTarget: zoneBased
|
|
7150
|
+
} = await transformProjectJson(projectJsonPath, dryRun);
|
|
7151
|
+
hasStorybookTarget && (anyStorybookTarget = !0, anyZoneBasedTarget = anyZoneBasedTarget || zoneBased), changed && logger8.debug(`Updated Nx builder references in ${projectJsonPath}`);
|
|
7126
7152
|
}
|
|
7127
7153
|
for (let pkgJsonPath of packageManager.packageJsonPaths)
|
|
7128
7154
|
try {
|
|
@@ -7137,7 +7163,7 @@ export default defineConfig({
|
|
|
7137
7163
|
mainConfig,
|
|
7138
7164
|
previewConfigPath,
|
|
7139
7165
|
packageManager,
|
|
7140
|
-
builderPackages: [ANGULAR_VITE_PACKAGE2,
|
|
7166
|
+
builderPackages: [ANGULAR_VITE_PACKAGE2, ...MIGRATABLE_FRAMEWORKS]
|
|
7141
7167
|
});
|
|
7142
7168
|
compodocSetup && await removeCompodocSetup({
|
|
7143
7169
|
result: compodocSetup,
|
|
@@ -7151,13 +7177,17 @@ export default defineConfig({
|
|
|
7151
7177
|
`Could not remove the Compodoc setup automatically: ${error}. Compodoc no longer runs, so its options and the \`setCompodocJson\` wiring can go.`
|
|
7152
7178
|
);
|
|
7153
7179
|
}
|
|
7154
|
-
let
|
|
7180
|
+
let hasZoneJsDependency = packageManager.isDependencyInstalled("zone.js");
|
|
7181
|
+
anyStorybookTarget && anyZoneBasedTarget && !hasZoneJsDependency && logger8.warn(
|
|
7182
|
+
"A Storybook builder target sets `zoneless: false`, but this project does not depend on `zone.js`, so no `import 'zone.js';` was added to your preview - it could not resolve, and every story would fail to load. Install `zone.js`, or set `zoneless: true` on that target if your app uses zoneless change detection."
|
|
7183
|
+
);
|
|
7184
|
+
let needsZoneJs = anyStorybookTarget && hasZoneJsDependency;
|
|
7155
7185
|
needsZoneJs && previewConfigPath ? await addZoneJsPreviewImport(previewConfigPath, dryRun) : needsZoneJs && !previewConfigPath && logger8.warn(
|
|
7156
7186
|
"Could not find a Storybook preview file to add the zone.js import to. If your app uses zone-based change detection, add `import 'zone.js';` at the top of your preview file manually."
|
|
7157
7187
|
), logger8.debug("Scanning and updating import statements...");
|
|
7158
|
-
let { globby } = await import("./globby-
|
|
7188
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), configFiles = configDir ? await globby([`${configDir}/**/*`]) : [], allFiles = [...storiesPaths, ...configFiles].filter(Boolean), transformErrors = await transformImportFiles(
|
|
7159
7189
|
allFiles,
|
|
7160
|
-
|
|
7190
|
+
Object.fromEntries(MIGRATABLE_FRAMEWORKS.map((pkg) => [pkg, ANGULAR_VITE_PACKAGE2])),
|
|
7161
7191
|
!!dryRun
|
|
7162
7192
|
);
|
|
7163
7193
|
if (transformErrors.length > 0 && (logger8.warn(`Encountered ${transformErrors.length} error(s) during file transformation:`), transformErrors.forEach(({ file, error }) => {
|
|
@@ -7367,7 +7397,7 @@ var addonA11yParameters = {
|
|
|
7367
7397
|
errors.push({ file: previewFileToUpdate, error });
|
|
7368
7398
|
}
|
|
7369
7399
|
}
|
|
7370
|
-
let { default: pLimit } = await import("./p-limit-
|
|
7400
|
+
let { default: pLimit } = await import("./p-limit-3RBZGB4T.js"), limit = pLimit(10);
|
|
7371
7401
|
if (await Promise.all(
|
|
7372
7402
|
storyFilesToUpdate.map(
|
|
7373
7403
|
(file) => limit(async () => {
|
|
@@ -7521,7 +7551,7 @@ var addonGlobalsApi = {
|
|
|
7521
7551
|
}
|
|
7522
7552
|
};
|
|
7523
7553
|
async function transformStoryFiles(files, options, dryRun) {
|
|
7524
|
-
let errors = [], { default: pLimit } = await import("./p-limit-
|
|
7554
|
+
let errors = [], { default: pLimit } = await import("./p-limit-3RBZGB4T.js"), limit = pLimit(10);
|
|
7525
7555
|
return await Promise.all(
|
|
7526
7556
|
files.map(
|
|
7527
7557
|
(file) => limit(async () => {
|
|
@@ -7748,7 +7778,7 @@ function transformPackageJson(content) {
|
|
|
7748
7778
|
return hasChanges ? JSON.stringify(packageJson, null, 2) : null;
|
|
7749
7779
|
}
|
|
7750
7780
|
var transformPackageJsonFiles = async (files, dryRun) => {
|
|
7751
|
-
let errors = [], { default: pLimit } = await import("./p-limit-
|
|
7781
|
+
let errors = [], { default: pLimit } = await import("./p-limit-3RBZGB4T.js"), limit = pLimit(10);
|
|
7752
7782
|
return await Promise.all(
|
|
7753
7783
|
files.map(
|
|
7754
7784
|
(file) => limit(async () => {
|
|
@@ -7787,7 +7817,7 @@ var transformPackageJsonFiles = async (files, dryRun) => {
|
|
|
7787
7817
|
dryRun
|
|
7788
7818
|
);
|
|
7789
7819
|
errors.push(...packageJsonErrors);
|
|
7790
|
-
let { globby } = await import("./globby-
|
|
7820
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), configFiles = await globby([`${configDir}/**/*`]), importErrors = await transformImportFiles2(
|
|
7791
7821
|
[...storiesPaths, ...configFiles].filter(Boolean),
|
|
7792
7822
|
{
|
|
7793
7823
|
...consolidatedPackages,
|
|
@@ -7860,6 +7890,71 @@ var eslintPlugin = {
|
|
|
7860
7890
|
}
|
|
7861
7891
|
};
|
|
7862
7892
|
|
|
7893
|
+
// src/automigrate/fixes/experimental-features.ts
|
|
7894
|
+
import { SupportedRenderer } from "storybook/internal/types";
|
|
7895
|
+
|
|
7896
|
+
// src/automigrate/helpers/versionBoundary.ts
|
|
7897
|
+
var import_semver6 = __toESM(require_semver(), 1), crossesVersionBoundary = (beforeVersion, targetVersion, introducedIn) => {
|
|
7898
|
+
let before = import_semver6.default.coerce(beforeVersion), target = import_semver6.default.coerce(targetVersion);
|
|
7899
|
+
return !before || !target ? !1 : import_semver6.default.lt(before, introducedIn) && import_semver6.default.gte(target, introducedIn);
|
|
7900
|
+
}, isAtOrPastVersion = (version2, introducedIn) => {
|
|
7901
|
+
let coerced = import_semver6.default.coerce(version2);
|
|
7902
|
+
return coerced !== null && import_semver6.default.gte(coerced, introducedIn);
|
|
7903
|
+
};
|
|
7904
|
+
|
|
7905
|
+
// src/automigrate/fixes/experimental-features.ts
|
|
7906
|
+
var hasDocgenProvider = (mainConfig) => getRendererName(mainConfig) === SupportedRenderer.REACT || ["@storybook/vue3-vite", "@storybook/angular-vite"].includes(
|
|
7907
|
+
getFrameworkPackageName(mainConfig) ?? ""
|
|
7908
|
+
), createExperimentalFeatureFix = ({
|
|
7909
|
+
id,
|
|
7910
|
+
name,
|
|
7911
|
+
introducedIn,
|
|
7912
|
+
link: link2,
|
|
7913
|
+
prompt: prompt9,
|
|
7914
|
+
requires,
|
|
7915
|
+
isSupported
|
|
7916
|
+
}) => ({
|
|
7917
|
+
id,
|
|
7918
|
+
link: link2,
|
|
7919
|
+
defaultSelected: !1,
|
|
7920
|
+
prompt: () => prompt9,
|
|
7921
|
+
async check({ mainConfigPath, mainConfig, beforeVersion, storybookVersion, requested }) {
|
|
7922
|
+
return !mainConfigPath || isSupported && !isSupported(mainConfig) || !isAtOrPastVersion(storybookVersion, introducedIn) || !requested && !(beforeVersion && crossesVersionBoundary(beforeVersion, storybookVersion, introducedIn)) || mainConfig.features?.[name] !== void 0 || requires && mainConfig.features?.[requires] === !1 ? null : {};
|
|
7923
|
+
},
|
|
7924
|
+
run: async ({ mainConfigPath, dryRun }) => {
|
|
7925
|
+
await updateMainConfig({ mainConfigPath, dryRun: !!dryRun }, async (main) => {
|
|
7926
|
+
main.setFieldValue(["features", name], !0);
|
|
7927
|
+
});
|
|
7928
|
+
}
|
|
7929
|
+
}), enableExperimentalReview = createExperimentalFeatureFix({
|
|
7930
|
+
id: "enable-experimental-review",
|
|
7931
|
+
name: "experimentalReview",
|
|
7932
|
+
introducedIn: "10.5.0",
|
|
7933
|
+
requires: "changeDetection",
|
|
7934
|
+
link: "https://storybook.js.org/docs/api/main-config/main-config-features#experimentalreview",
|
|
7935
|
+
prompt: "Enable experimentalReview to offer the agentic review workflow to all MCP clients, not just the storybook ai CLI."
|
|
7936
|
+
}), enableExperimentalDocgenServer = createExperimentalFeatureFix({
|
|
7937
|
+
id: "enable-experimental-docgen-server",
|
|
7938
|
+
name: "experimentalDocgenServer",
|
|
7939
|
+
introducedIn: "10.5.0",
|
|
7940
|
+
isSupported: hasDocgenProvider,
|
|
7941
|
+
link: "https://storybook.js.org/docs/api/main-config/main-config-features#experimentaldocgenserver",
|
|
7942
|
+
prompt: "Enable experimentalDocgenServer for faster startup and more accurate Controls/ArgTypes."
|
|
7943
|
+
}), FEATURE_FLAG_FIXES = {
|
|
7944
|
+
experimentalReview: enableExperimentalReview,
|
|
7945
|
+
experimentalDocgenServer: enableExperimentalDocgenServer
|
|
7946
|
+
}, resolveRequestedFeatures = (features) => {
|
|
7947
|
+
let names = features?.split(",").map((name) => name.trim()).filter(Boolean) ?? [], unknown = names.filter((name) => !Object.hasOwn(FEATURE_FLAG_FIXES, name));
|
|
7948
|
+
if (unknown.length > 0)
|
|
7949
|
+
throw new Error(
|
|
7950
|
+
`Unknown feature flag(s): ${unknown.join(", ")}. Available: ${Object.keys(FEATURE_FLAG_FIXES).join(", ")}.`
|
|
7951
|
+
);
|
|
7952
|
+
return names.map((name) => ({
|
|
7953
|
+
name,
|
|
7954
|
+
fixId: FEATURE_FLAG_FIXES[name].id
|
|
7955
|
+
}));
|
|
7956
|
+
};
|
|
7957
|
+
|
|
7863
7958
|
// src/automigrate/fixes/fix-faux-esm-require.ts
|
|
7864
7959
|
import { readFile as readFile5, writeFile as writeFile5 } from "node:fs/promises";
|
|
7865
7960
|
import { types as t10 } from "storybook/internal/babel";
|
|
@@ -8143,7 +8238,7 @@ var VITE_DEFAULT_VERSION = "^7.0.0", transformMainConfig2 = async (mainConfigPat
|
|
|
8143
8238
|
]);
|
|
8144
8239
|
}
|
|
8145
8240
|
mainConfigPath && (logger14.debug("Updating main config file..."), await transformMainConfig2(mainConfigPath, dryRun)), logger14.debug("Scanning and updating import statements...");
|
|
8146
|
-
let { globby } = await import("./globby-
|
|
8241
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), configFiles = await globby([`${configDir}/**/*`]), allFiles = [...storiesPaths, ...configFiles].filter(Boolean), transformErrors = await transformImportFiles3(
|
|
8147
8242
|
allFiles,
|
|
8148
8243
|
{
|
|
8149
8244
|
"@storybook/nextjs": "@storybook/nextjs-vite"
|
|
@@ -8221,7 +8316,7 @@ var REACT_VITE_PACKAGE = "@storybook/react-vite", TANSTACK_REACT_PACKAGE = "@sto
|
|
|
8221
8316
|
configDir,
|
|
8222
8317
|
storiesPaths
|
|
8223
8318
|
}) => {
|
|
8224
|
-
let { globby } = await import("./globby-
|
|
8319
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), configFiles = configDir ? await globby([`${configDir}/**/*.{ts,tsx,js,jsx,mjs,cjs}`], {
|
|
8225
8320
|
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
8226
8321
|
}) : [], candidateFiles = Array.from(
|
|
8227
8322
|
/* @__PURE__ */ new Set([...previewConfigPath ? [previewConfigPath] : [], ...configFiles, ...storiesPaths])
|
|
@@ -8440,7 +8535,7 @@ var REACT_VITE_PACKAGE = "@storybook/react-vite", TANSTACK_REACT_PACKAGE = "@sto
|
|
|
8440
8535
|
logger15.step(`Migrating from ${REACT_VITE_PACKAGE} to ${TANSTACK_REACT_PACKAGE}...`), dryRun ? logger15.debug("Dry run: Skipping package.json updates.") : (logger15.debug("Updating package.json files..."), await packageManager.removeDependencies([REACT_VITE_PACKAGE]), await packageManager.addDependencies({ type: "devDependencies", skipInstall: !0 }, [
|
|
8441
8536
|
`${TANSTACK_REACT_PACKAGE}@${storybookVersion}`
|
|
8442
8537
|
])), mainConfigPath && (logger15.debug("Updating main config file..."), await transformMainConfig3(mainConfigPath, dryRun)), logger15.debug("Scanning and updating import statements...");
|
|
8443
|
-
let { globby } = await import("./globby-
|
|
8538
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), configFiles = configDir ? await globby([`${configDir}/**/*.{ts,tsx,js,jsx,mjs,cjs}`], {
|
|
8444
8539
|
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
8445
8540
|
}) : [], allFiles = [...storiesPaths, ...configFiles, previewConfigPath].filter(
|
|
8446
8541
|
Boolean
|
|
@@ -8681,7 +8776,7 @@ var getAllDependencies = (packageJson) => Object.keys({
|
|
|
8681
8776
|
let regex = new RegExp(`(['"])${renderer}(['"])`, "g");
|
|
8682
8777
|
return regex.test(source) ? source.replace(regex, `$1${framework}$2`) : null;
|
|
8683
8778
|
}, transformSourceFiles = async (files, renderer, framework, dryRun) => {
|
|
8684
|
-
let errors = [], { default: pLimit } = await import("./p-limit-
|
|
8779
|
+
let errors = [], { default: pLimit } = await import("./p-limit-3RBZGB4T.js"), limit = pLimit(10);
|
|
8685
8780
|
return await Promise.all(
|
|
8686
8781
|
files.map(
|
|
8687
8782
|
(file) => limit(async () => {
|
|
@@ -8748,7 +8843,7 @@ var getAllDependencies = (packageJson) => Object.keys({
|
|
|
8748
8843
|
continue;
|
|
8749
8844
|
logger17.debug(`
|
|
8750
8845
|
Migrating ${rendererPackage} to ${selectedFramework}`);
|
|
8751
|
-
let { globby } = await import("./globby-
|
|
8846
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), configFiles = await globby([`${configDir}/**/*`]);
|
|
8752
8847
|
await transformSourceFiles(
|
|
8753
8848
|
[...storiesPaths, ...configFiles].filter(Boolean),
|
|
8754
8849
|
rendererPackage,
|
|
@@ -8854,7 +8949,7 @@ async function renameInFile(filePath, oldText, newText) {
|
|
|
8854
8949
|
}
|
|
8855
8950
|
var getDotStorybookReferences = async (searchDir) => {
|
|
8856
8951
|
try {
|
|
8857
|
-
let { globby } = await import("./globby-
|
|
8952
|
+
let { globby } = await import("./globby-2EA2TMCX.js"), { readFile: readFile12 } = await import("node:fs/promises"), files = await globby(`${searchDir}/**/*`, {
|
|
8858
8953
|
onlyFiles: !0,
|
|
8859
8954
|
gitignore: !0
|
|
8860
8955
|
}), referencedFiles = [];
|
|
@@ -8875,7 +8970,7 @@ var getDotStorybookReferences = async (searchDir) => {
|
|
|
8875
8970
|
async check({ packageManager, mainConfigPath }) {
|
|
8876
8971
|
if (!packageManager.getAllDependencies()["@storybook/react-native"])
|
|
8877
8972
|
return null;
|
|
8878
|
-
let projectDir = mainConfigPath ? join6(mainConfigPath, "..", "..") : process.cwd(), storybookDir = join6(projectDir, ".storybook"), rnStorybookDir = join6(projectDir, RN_STORYBOOK_DIR), { globby } = await import("./globby-
|
|
8973
|
+
let projectDir = mainConfigPath ? join6(mainConfigPath, "..", "..") : process.cwd(), storybookDir = join6(projectDir, ".storybook"), rnStorybookDir = join6(projectDir, RN_STORYBOOK_DIR), { globby } = await import("./globby-2EA2TMCX.js"), requiresFiles = await globby(join6(storybookDir, "storybook.requires.*"));
|
|
8879
8974
|
return existsSync5(storybookDir) && requiresFiles.length > 0 && !existsSync5(rnStorybookDir) ? { storybookDir, rnStorybookDir } : null;
|
|
8880
8975
|
},
|
|
8881
8976
|
prompt() {
|
|
@@ -8917,7 +9012,7 @@ var storybookPackageNameConflict = {
|
|
|
8917
9012
|
};
|
|
8918
9013
|
|
|
8919
9014
|
// src/automigrate/fixes/upgrade-storybook-related-dependencies.ts
|
|
8920
|
-
var
|
|
9015
|
+
var import_semver7 = __toESM(require_semver(), 1);
|
|
8921
9016
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
8922
9017
|
import { dirname as dirname4 } from "node:path";
|
|
8923
9018
|
import { isCorePackage, isSatelliteAddon } from "storybook/internal/common";
|
|
@@ -8952,7 +9047,7 @@ var upgradeStorybookRelatedDependencies = {
|
|
|
8952
9047
|
)
|
|
8953
9048
|
)
|
|
8954
9049
|
).map((packageName) => [packageName, allDependencies[packageName]]), upgradablePackages = (await getLatestVersions(packageManager, uniquePackages)).filter(
|
|
8955
|
-
({ afterVersion, beforeVersion, packageName }) => beforeVersion === null || afterVersion === null || allDependencies[packageName] === null ? !1 : (0,
|
|
9050
|
+
({ afterVersion, beforeVersion, packageName }) => beforeVersion === null || afterVersion === null || allDependencies[packageName] === null ? !1 : (0, import_semver7.gt)(afterVersion, beforeVersion)
|
|
8956
9051
|
);
|
|
8957
9052
|
return upgradablePackages.length > 0 ? { upgradable: upgradablePackages } : null;
|
|
8958
9053
|
},
|
|
@@ -9053,7 +9148,9 @@ var allFixes = [
|
|
|
9053
9148
|
removeDocsAutodocs,
|
|
9054
9149
|
wrapGetAbsolutePath,
|
|
9055
9150
|
fixFauxEsmRequire,
|
|
9056
|
-
storybookPackageNameConflict
|
|
9151
|
+
storybookPackageNameConflict,
|
|
9152
|
+
enableExperimentalReview,
|
|
9153
|
+
enableExperimentalDocgenServer
|
|
9057
9154
|
];
|
|
9058
9155
|
var commandFixes = [csfFactories];
|
|
9059
9156
|
|
|
@@ -9199,6 +9296,7 @@ var logAvailableMigrations = () => {
|
|
|
9199
9296
|
logger21.step("Checking possible migrations..");
|
|
9200
9297
|
let { fixResults, fixSummary, preCheckFailure, addonsToPostinstall } = await runFixes({
|
|
9201
9298
|
fixes,
|
|
9299
|
+
fixId,
|
|
9202
9300
|
packageManager,
|
|
9203
9301
|
rendererPackage,
|
|
9204
9302
|
skipInstall,
|
|
@@ -9220,6 +9318,7 @@ var logAvailableMigrations = () => {
|
|
|
9220
9318
|
};
|
|
9221
9319
|
async function runFixes({
|
|
9222
9320
|
fixes,
|
|
9321
|
+
fixId,
|
|
9223
9322
|
dryRun,
|
|
9224
9323
|
yes,
|
|
9225
9324
|
rendererPackage,
|
|
@@ -9246,7 +9345,8 @@ async function runFixes({
|
|
|
9246
9345
|
previewConfigPath,
|
|
9247
9346
|
mainConfigPath,
|
|
9248
9347
|
storiesPaths,
|
|
9249
|
-
hasCsfFactoryPreview
|
|
9348
|
+
hasCsfFactoryPreview,
|
|
9349
|
+
requested: fixId === f.id
|
|
9250
9350
|
}), logger21.debug(`End of ${import_picocolors16.default.cyan(f.id)} migration checks`);
|
|
9251
9351
|
} catch (error) {
|
|
9252
9352
|
logger21.warn(`\u26A0\uFE0F failed to check fix ${import_picocolors16.default.bold(f.id)}`), error instanceof Error && (logger21.error(`
|
|
@@ -9427,7 +9527,7 @@ import {
|
|
|
9427
9527
|
versions as versions4
|
|
9428
9528
|
} from "storybook/internal/common";
|
|
9429
9529
|
import { logger as logger24, prompt as prompt6 } from "storybook/internal/node-logger";
|
|
9430
|
-
var import_picocolors17 = __toESM(require_picocolors(), 1),
|
|
9530
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1), import_semver8 = __toESM(require_semver(), 1);
|
|
9431
9531
|
import { dedent as dedent19 } from "ts-dedent";
|
|
9432
9532
|
|
|
9433
9533
|
// src/sandbox-templates.ts
|
|
@@ -9684,8 +9784,7 @@ var baseTemplates = {
|
|
|
9684
9784
|
},
|
|
9685
9785
|
modifications: {
|
|
9686
9786
|
useCsfFactory: !0,
|
|
9687
|
-
extraDevDependencies: ["prop-types", "@types/prop-types"
|
|
9688
|
-
editAddons: (addons) => [...addons, "@storybook/addon-mcp"],
|
|
9787
|
+
extraDevDependencies: ["prop-types", "@types/prop-types"],
|
|
9689
9788
|
mainConfig: {
|
|
9690
9789
|
features: {
|
|
9691
9790
|
developmentModeForBuild: !0,
|
|
@@ -10570,7 +10669,7 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
|
|
|
10570
10669
|
}) => {
|
|
10571
10670
|
let selectedConfig = allTemplates[filterValue], templateId = selectedConfig ? filterValue : null, packageManager = JsPackageManagerFactory.getPackageManager({
|
|
10572
10671
|
force: PackageManagerName.NPM
|
|
10573
|
-
}), latestVersion = await packageManager.latestVersion("storybook"), nextVersion = await packageManager.latestVersion("storybook@next") ?? "0.0.0", currentVersion = versions4.storybook, isPrerelease = (0,
|
|
10672
|
+
}), latestVersion = await packageManager.latestVersion("storybook"), nextVersion = await packageManager.latestVersion("storybook@next") ?? "0.0.0", currentVersion = versions4.storybook, isPrerelease = (0, import_semver8.prerelease)(currentVersion), isOutdated = (0, import_semver8.lt)(currentVersion, isPrerelease ? nextVersion : latestVersion), downloadType = !isOutdated && init ? "after-storybook" : "before-storybook", branch = isPrerelease ? "next" : "main", messages2 = {
|
|
10574
10673
|
welcome: `Creating a Storybook ${import_picocolors17.default.bold(currentVersion)} sandbox..`,
|
|
10575
10674
|
notLatest: import_picocolors17.default.red(dedent19`
|
|
10576
10675
|
This version is behind the latest release, which is: ${import_picocolors17.default.bold(latestVersion)}!
|
|
@@ -10701,7 +10800,7 @@ async function promptSelectedTemplate(choices) {
|
|
|
10701
10800
|
}
|
|
10702
10801
|
|
|
10703
10802
|
// src/upgrade.ts
|
|
10704
|
-
var import_cross_spawn3 = __toESM(require_cross_spawn(), 1), import_picocolors18 = __toESM(require_picocolors(), 1),
|
|
10803
|
+
var import_cross_spawn3 = __toESM(require_cross_spawn(), 1), import_picocolors18 = __toESM(require_picocolors(), 1), import_semver9 = __toESM(require_semver(), 1);
|
|
10705
10804
|
import { PackageManagerName as PackageManagerName2 } from "storybook/internal/common";
|
|
10706
10805
|
import {
|
|
10707
10806
|
HandledError,
|
|
@@ -10728,7 +10827,7 @@ import { dedent as dedent20 } from "ts-dedent";
|
|
|
10728
10827
|
import { CLI_COLORS as CLI_COLORS3, logger as logger25, prompt as prompt7 } from "storybook/internal/node-logger";
|
|
10729
10828
|
import { ErrorCollector, sanitizeError } from "storybook/internal/telemetry";
|
|
10730
10829
|
async function collectAutomigrationsAcrossProjects(options) {
|
|
10731
|
-
let { fixes, projects, taskLog } = options, automigrationMap = /* @__PURE__ */ new Map();
|
|
10830
|
+
let { fixes, projects, taskLog, requestedFixIds } = options, automigrationMap = /* @__PURE__ */ new Map();
|
|
10732
10831
|
logger25.debug(
|
|
10733
10832
|
`Starting automigration collection across ${projects.length} projects and ${fixes.length} fixes...`
|
|
10734
10833
|
);
|
|
@@ -10760,6 +10859,8 @@ async function collectAutomigrationsAcrossProjects(options) {
|
|
|
10760
10859
|
configDir: project.configDir,
|
|
10761
10860
|
mainConfig: project.mainConfig,
|
|
10762
10861
|
storybookVersion: project.storybookVersion,
|
|
10862
|
+
beforeVersion: project.beforeVersion,
|
|
10863
|
+
requested: requestedFixIds?.includes(fix.id),
|
|
10763
10864
|
previewConfigPath: project.previewConfigPath,
|
|
10764
10865
|
mainConfigPath: project.mainConfigPath,
|
|
10765
10866
|
storiesPaths: project.storiesPaths,
|
|
@@ -10802,14 +10903,19 @@ var formatProjectDirs = (list) => {
|
|
|
10802
10903
|
async function promptForAutomigrations(automigrations, options) {
|
|
10803
10904
|
if (automigrations.length === 0)
|
|
10804
10905
|
return [];
|
|
10805
|
-
|
|
10806
|
-
|
|
10906
|
+
let logSelection = (title, selection) => {
|
|
10907
|
+
logger25.log(title), selection.forEach(({ fix, reports: list }) => {
|
|
10807
10908
|
logger25.log(` - ${fix.id} (${formatProjectDirs(list)})`);
|
|
10808
|
-
})
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10909
|
+
});
|
|
10910
|
+
}, preselectedIds = new Set(options.preselectedIds ?? []);
|
|
10911
|
+
if (options.dryRun)
|
|
10912
|
+
return logSelection("Detected automigrations (dry run - no changes will be made):", automigrations), [];
|
|
10913
|
+
if (options.yes) {
|
|
10914
|
+
let selected = automigrations.filter(
|
|
10915
|
+
({ fix }) => preselectedIds.has(fix.id) || fix.defaultSelected !== !1 || fix.promptType === "auto"
|
|
10916
|
+
);
|
|
10917
|
+
return logSelection("Running all detected automigrations:", selected), selected;
|
|
10918
|
+
}
|
|
10813
10919
|
let choices = automigrations.map((am) => {
|
|
10814
10920
|
let hint = [];
|
|
10815
10921
|
hint.push(`${am.fix.prompt()}`), am.fix.link && hint.push(`More info: ${am.fix.link}`);
|
|
@@ -10819,7 +10925,7 @@ async function promptForAutomigrations(automigrations, options) {
|
|
|
10819
10925
|
label,
|
|
10820
10926
|
hint: hint.join(`
|
|
10821
10927
|
`),
|
|
10822
|
-
defaultSelected: am.fix.defaultSelected ?? !0
|
|
10928
|
+
defaultSelected: preselectedIds.has(am.fix.id) || (am.fix.defaultSelected ?? !0)
|
|
10823
10929
|
};
|
|
10824
10930
|
}), selectedIds = await prompt7.multiselect({
|
|
10825
10931
|
message: "Select automigrations to run",
|
|
@@ -10922,7 +11028,7 @@ async function runAutomigrationsForProjects(selectedAutomigrations, options) {
|
|
|
10922
11028
|
return projectResults;
|
|
10923
11029
|
}
|
|
10924
11030
|
async function runAutomigrations(projects, options) {
|
|
10925
|
-
let projectAutomigrationData = projects.map((project) => ({
|
|
11031
|
+
let requestedFeatures = resolveRequestedFeatures(options.features), requestedFixIds = requestedFeatures.map(({ fixId }) => fixId), projectAutomigrationData = projects.map((project) => ({
|
|
10926
11032
|
configDir: project.configDir,
|
|
10927
11033
|
packageManager: project.packageManager,
|
|
10928
11034
|
mainConfig: project.mainConfig,
|
|
@@ -10941,12 +11047,21 @@ async function runAutomigrations(projects, options) {
|
|
|
10941
11047
|
dryRun: options.dryRun,
|
|
10942
11048
|
yes: options.yes,
|
|
10943
11049
|
skipInstall: options.skipInstall,
|
|
10944
|
-
taskLog: detectingAutomigrationTask
|
|
11050
|
+
taskLog: detectingAutomigrationTask,
|
|
11051
|
+
requestedFixIds
|
|
10945
11052
|
}), successfulAutomigrations = detectedAutomigrations.filter(
|
|
10946
11053
|
(am) => am.reports.some((report) => report.status === "check_succeeded")
|
|
10947
|
-
)
|
|
11054
|
+
);
|
|
11055
|
+
requestedFeatures.filter(({ fixId }) => !successfulAutomigrations.some((am) => am.fix.id === fixId)).forEach(({ name, fixId }) => {
|
|
11056
|
+
let checkFailed = detectedAutomigrations.find((am) => am.fix.id === fixId)?.reports.some((report) => report.status === "check_failed");
|
|
11057
|
+
logger25.warn(
|
|
11058
|
+
checkFailed ? `Skipping --features ${name}: the '${fixId}' migration check failed. Run with --debug for details.` : `Skipping --features ${name}: the '${fixId}' migration does not apply here. ${name} is either already set in your main config, unsupported by your Storybook version, or missing a prerequisite.`
|
|
11059
|
+
);
|
|
11060
|
+
});
|
|
11061
|
+
let selectedAutomigrations = await promptForAutomigrations(successfulAutomigrations, {
|
|
10948
11062
|
dryRun: options.dryRun,
|
|
10949
|
-
yes: options.yes
|
|
11063
|
+
yes: options.yes,
|
|
11064
|
+
preselectedIds: requestedFixIds
|
|
10950
11065
|
}), automigrationResults = await runAutomigrationsForProjects(selectedAutomigrations, {
|
|
10951
11066
|
automigrations: detectedAutomigrations,
|
|
10952
11067
|
dryRun: options.dryRun,
|
|
@@ -11086,6 +11201,10 @@ async function sendMultiUpgradeTelemetry(options) {
|
|
|
11086
11201
|
}
|
|
11087
11202
|
}
|
|
11088
11203
|
async function upgrade(options) {
|
|
11204
|
+
if (options.features && options.skipAutomigrations)
|
|
11205
|
+
throw logger26.error(
|
|
11206
|
+
"The --features flag enables feature flags through automigrations, so it cannot be combined with --skip-automigrations."
|
|
11207
|
+
), new HandledError("--features cannot be combined with --skip-automigrations");
|
|
11089
11208
|
let projectsResult = await getProjects(options);
|
|
11090
11209
|
if (projectsResult === void 0 || projectsResult.selectedProjects.length === 0)
|
|
11091
11210
|
return;
|
|
@@ -11113,7 +11232,7 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
|
|
|
11113
11232
|
}))
|
|
11114
11233
|
throw new HandledError("Blockers detected");
|
|
11115
11234
|
if (storybookProjects.some((project) => {
|
|
11116
|
-
if (!project.isCanary && (0,
|
|
11235
|
+
if (!project.isCanary && (0, import_semver9.lt)(project.currentCLIVersion, project.beforeVersion))
|
|
11117
11236
|
throw new UpgradeStorybookToLowerVersionError({
|
|
11118
11237
|
beforeVersion: project.beforeVersion,
|
|
11119
11238
|
currentVersion: project.currentCLIVersion
|
|
@@ -11308,7 +11427,19 @@ command("upgrade").description(`Upgrade your Storybook packages to v${versions5.
|
|
|
11308
11427
|
new Option("--package-manager <type>", "Force package manager for installing deps").choices(
|
|
11309
11428
|
Object.values(PackageManagerName3)
|
|
11310
11429
|
)
|
|
11311
|
-
).option("-y --yes", "Skip prompting the user").
|
|
11430
|
+
).option("-y --yes", "Skip prompting the user").addOption(
|
|
11431
|
+
new Option(
|
|
11432
|
+
"--features <list>",
|
|
11433
|
+
"Comma-separated list of experimental feature flags to enable during the upgrade"
|
|
11434
|
+
).argParser((value) => {
|
|
11435
|
+
try {
|
|
11436
|
+
resolveRequestedFeatures(value);
|
|
11437
|
+
} catch (error) {
|
|
11438
|
+
throw new InvalidArgumentError(error instanceof Error ? error.message : String(error));
|
|
11439
|
+
}
|
|
11440
|
+
return value;
|
|
11441
|
+
})
|
|
11442
|
+
).option("-f --force", "force the upgrade, skipping autoblockers").option("-n --dry-run", "Only check for upgrades, do not install").option("-s --skip-check", "Skip postinstall version and automigration checks").option(
|
|
11312
11443
|
"--skip-automigrations",
|
|
11313
11444
|
"Skip running automigrations entirely (only update package versions and install)"
|
|
11314
11445
|
).option(
|
package/dist/bin/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import CJS_COMPAT_NODE_URL_qa68dlrk09e from 'node:url';
|
|
3
|
+
import CJS_COMPAT_NODE_PATH_qa68dlrk09e from 'node:path';
|
|
4
|
+
import CJS_COMPAT_NODE_MODULE_qa68dlrk09e from "node:module";
|
|
5
5
|
|
|
6
|
-
var __filename =
|
|
7
|
-
var __dirname =
|
|
8
|
-
var require =
|
|
6
|
+
var __filename = CJS_COMPAT_NODE_URL_qa68dlrk09e.fileURLToPath(import.meta.url);
|
|
7
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qa68dlrk09e.dirname(__filename);
|
|
8
|
+
var require = CJS_COMPAT_NODE_MODULE_qa68dlrk09e.createRequire(import.meta.url);
|
|
9
9
|
|
|
10
10
|
// ------------------------------------------------------------
|
|
11
11
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -20,4 +20,4 @@ isNodeVersionSupported(major, minor, patch) || (logger.error(
|
|
|
20
20
|
dedent`To run Storybook, you need Node.js version ${MIN_SUPPORTED_NODE_DESCRIPTION}.
|
|
21
21
|
You are currently running Node.js ${process.version}. Please upgrade your Node.js installation.`
|
|
22
22
|
), process.exit(1));
|
|
23
|
-
import("../_node-chunks/run-
|
|
23
|
+
import("../_node-chunks/run-G3VBZFUP.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/cli",
|
|
3
|
-
"version": "10.6.0-alpha.
|
|
3
|
+
"version": "10.6.0-alpha.9",
|
|
4
4
|
"description": "Storybook CLI: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"!src/**/*"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@storybook/codemod": "10.6.0-alpha.
|
|
40
|
+
"@storybook/codemod": "10.6.0-alpha.9",
|
|
41
41
|
"@types/semver": "^7.7.1",
|
|
42
42
|
"commander": "^14.0.2",
|
|
43
|
-
"create-storybook": "10.6.0-alpha.
|
|
43
|
+
"create-storybook": "10.6.0-alpha.9",
|
|
44
44
|
"jscodeshift": "^0.15.1",
|
|
45
|
-
"storybook": "10.6.0-alpha.
|
|
45
|
+
"storybook": "10.6.0-alpha.9",
|
|
46
46
|
"ts-dedent": "^2.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_koorielfsj from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_koorielfsj from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_koorielfsj from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_koorielfsj.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_koorielfsj.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_koorielfsj.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|