@storybook/cli 11.0.0-alpha.4 → 11.0.0-alpha.5

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.
Files changed (18) hide show
  1. package/dist/_node-chunks/{block-create-react-app-TLUHF4IT.js → block-create-react-app-MUJEAJWZ.js} +8 -8
  2. package/dist/_node-chunks/{block-dependencies-versions-LYYCZWML.js → block-dependencies-versions-NO7SGHPX.js} +22 -11
  3. package/dist/_node-chunks/{block-experimental-addon-test-B4XO5OJB.js → block-experimental-addon-test-P5AIPERY.js} +9 -9
  4. package/dist/_node-chunks/{block-major-version-65KQDEYM.js → block-major-version-WWI2WIS2.js} +9 -9
  5. package/dist/_node-chunks/{block-node-version-X6H65JCO.js → block-node-version-43NYZKC4.js} +8 -8
  6. package/dist/_node-chunks/{block-react-legacy-root-api-JF345D2G.js → block-react-legacy-root-api-4JKQEIN5.js} +8 -8
  7. package/dist/_node-chunks/{block-webpack5-frameworks-LFSI53LP.js → block-webpack5-frameworks-ELINHXW5.js} +11 -11
  8. package/dist/_node-chunks/{chunk-Y43KIKHK.js → chunk-2MUKNWW5.js} +30 -30
  9. package/dist/_node-chunks/chunk-4GUNVUYY.js +11 -0
  10. package/dist/_node-chunks/{chunk-YBPPS4RU.js → chunk-7BUFIZL4.js} +7 -7
  11. package/dist/_node-chunks/{chunk-A7DKVA5E.js → chunk-AGADK3RL.js} +7 -7
  12. package/dist/_node-chunks/{chunk-WXEOBYYK.js → chunk-SJEUIQ46.js} +6 -6
  13. package/dist/_node-chunks/{globby-I74JNCO6.js → globby-6YVPAXG5.js} +8 -8
  14. package/dist/_node-chunks/{p-limit-LF2SB6TM.js → p-limit-GSIPL3UA.js} +7 -7
  15. package/dist/_node-chunks/{run-SOSXGFEL.js → run-ZECBPVC4.js} +326 -311
  16. package/dist/bin/index.js +7 -7
  17. package/package.json +4 -4
  18. package/dist/_node-chunks/chunk-3NH7GMSS.js +0 -11
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ahve6ing6uv from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ahve6ing6uv from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ahve6ing6uv from "node:module";
1
+ import CJS_COMPAT_NODE_URL_p28xbsg3xzj from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_p28xbsg3xzj from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_p28xbsg3xzj from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ahve6ing6uv.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ahve6ing6uv.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ahve6ing6uv.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_p28xbsg3xzj.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_p28xbsg3xzj.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_p28xbsg3xzj.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,25 +13,24 @@ import {
13
13
  findFilesUp,
14
14
  getFrameworkPackageName,
15
15
  getProjects,
16
- getRendererName,
17
16
  getStorybookData,
18
17
  processAutoblockerResults,
19
18
  require_picocolors,
20
19
  shortenPath,
21
20
  up,
22
21
  upgradeStorybookDependencies
23
- } from "./chunk-Y43KIKHK.js";
22
+ } from "./chunk-2MUKNWW5.js";
24
23
  import {
25
24
  slash
26
- } from "./chunk-A7DKVA5E.js";
25
+ } from "./chunk-AGADK3RL.js";
27
26
  import {
28
27
  require_semver
29
- } from "./chunk-YBPPS4RU.js";
28
+ } from "./chunk-7BUFIZL4.js";
30
29
  import {
31
30
  __commonJS,
32
31
  __require,
33
32
  __toESM
34
- } from "./chunk-WXEOBYYK.js";
33
+ } from "./chunk-SJEUIQ46.js";
35
34
 
36
35
  // ../../../node_modules/envinfo/dist/envinfo.js
37
36
  var require_envinfo = __commonJS({
@@ -4713,7 +4712,7 @@ import {
4713
4712
  versions as versions4
4714
4713
  } from "storybook/internal/common";
4715
4714
  import { withTelemetry } from "storybook/internal/core-server";
4716
- import { CLI_COLORS as CLI_COLORS5, logTracker as logTracker4, logger as logger24 } from "storybook/internal/node-logger";
4715
+ import { CLI_COLORS as CLI_COLORS5, logTracker as logTracker4, logger as logger23 } from "storybook/internal/node-logger";
4717
4716
  import { addToGlobalContext, telemetry as telemetry2 } from "storybook/internal/telemetry";
4718
4717
  import { InvalidArgumentError, Option, program } from "commander";
4719
4718
 
@@ -4755,7 +4754,7 @@ function leven(first, second, options) {
4755
4754
  var import_picocolors22 = __toESM(require_picocolors(), 1);
4756
4755
 
4757
4756
  // package.json
4758
- var version = "11.0.0-alpha.4";
4757
+ var version = "11.0.0-alpha.5";
4759
4758
 
4760
4759
  // src/add.ts
4761
4760
  var import_semver2 = __toESM(require_semver(), 1);
@@ -4948,7 +4947,7 @@ try {
4948
4947
  } catch (error) {
4949
4948
  process.exit(error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED' ? ${NO_HOOK_EXIT_CODE} : 1);
4950
4949
  }`, postinstallAddon = async (addonName, options) => {
4951
- let hookPath = `${addonName}/postinstall`, logger25 = options.logger, modulePath;
4950
+ let hookPath = `${addonName}/postinstall`, logger24 = options.logger, modulePath;
4952
4951
  try {
4953
4952
  modulePath = require2.resolve(hookPath, { paths: [DIR_CWD] });
4954
4953
  } catch {
@@ -4965,7 +4964,7 @@ try {
4965
4964
  try {
4966
4965
  modulePath = import.meta.resolve(hookPath);
4967
4966
  } catch {
4968
- logger25.warn(
4967
+ logger24.warn(
4969
4968
  `Could not resolve the postinstall hook of ${addonName}, skipping its configuration. Run \`npx storybook add ${addonName}\` to set it up manually.`
4970
4969
  );
4971
4970
  return;
@@ -4974,7 +4973,7 @@ try {
4974
4973
  try {
4975
4974
  moduledLoaded = await import(pathToFileURL2(moduleFilePath).href).catch(() => importModule(moduleFilePath)).catch(() => require2(moduleFilePath)).catch(() => import(hookPath)).catch(() => importModule(hookPath)).catch(() => require2(hookPath));
4976
4975
  } catch (e) {
4977
- logger25.warn(
4976
+ logger24.warn(
4978
4977
  `Could not load the postinstall hook of ${addonName} (${String(
4979
4978
  e
4980
4979
  )}), skipping its configuration. Run \`npx storybook add ${addonName}\` to set it up manually.`
@@ -4983,7 +4982,7 @@ try {
4983
4982
  }
4984
4983
  let postinstall = moduledLoaded?.default || moduledLoaded?.postinstall || moduledLoaded;
4985
4984
  if (!postinstall || typeof postinstall != "function") {
4986
- logger25.error(`Error finding postinstall function for ${addonName}`);
4985
+ logger24.error(`Error finding postinstall function for ${addonName}`);
4987
4986
  return;
4988
4987
  }
4989
4988
  try {
@@ -5013,7 +5012,7 @@ async function add(addon, {
5013
5012
  configDir: userSpecifiedConfigDir,
5014
5013
  yes,
5015
5014
  skipInstall
5016
- }, logger25 = nodeLogger) {
5015
+ }, logger24 = nodeLogger) {
5017
5016
  let [addonName, inputVersion] = getVersionSpecifier(addon), { mainConfig, mainConfigPath, configDir, previewConfigPath, packageManager } = await getStorybookData({
5018
5017
  configDir: userSpecifiedConfigDir,
5019
5018
  packageManagerName: pkgMgr,
@@ -5024,16 +5023,16 @@ async function add(addon, {
5024
5023
  Unable to find storybook config directory. Please specify your Storybook config directory with the --config-dir flag.
5025
5024
  `);
5026
5025
  if (!mainConfigPath) {
5027
- logger25.error("Unable to find Storybook main.js config");
5026
+ logger24.error("Unable to find Storybook main.js config");
5028
5027
  return;
5029
5028
  }
5030
5029
  let shouldAddToMain = !0;
5031
- if (checkInstalled(addonName, mainConfig) && (shouldAddToMain = !1, !yes && (logger25.log(`The Storybook addon "${addonName}" is already present in ${mainConfigPath}.`), !await prompt.confirm({
5030
+ if (checkInstalled(addonName, mainConfig) && (shouldAddToMain = !1, !yes && (logger24.log(`The Storybook addon "${addonName}" is already present in ${mainConfigPath}.`), !await prompt.confirm({
5032
5031
  message: "Do you wish to install it again?"
5033
5032
  }))))
5034
5033
  return;
5035
5034
  let main = await readConfig(mainConfigPath);
5036
- logger25.log(`Verifying ${addonName}`);
5035
+ logger24.log(`Verifying ${addonName}`);
5037
5036
  let version2 = inputVersion;
5038
5037
  if (!version2 && isCoreAddon(addonName) && (version2 = versions.storybook), !version2) {
5039
5038
  let latestVersion = await packageManager.latestVersion(addonName);
@@ -5042,14 +5041,14 @@ async function add(addon, {
5042
5041
  version2 = latestVersion;
5043
5042
  }
5044
5043
  let storybookVersion = versions.storybook, versionIsStorybook = version2 === versions.storybook;
5045
- isCoreAddon(addonName) && !versionIsStorybook && logger25.warn(
5044
+ isCoreAddon(addonName) && !versionIsStorybook && logger24.warn(
5046
5045
  `The version of ${addonName} (${version2}) you are installing is not the same as the version of Storybook you are using (${storybookVersion}). This may lead to unexpected behavior.`
5047
5046
  );
5048
5047
  let versionRange = packageManager.getDependencyVersion("storybook")?.match(/^[~^]/)?.[0] ?? "", addonWithVersion = versionIsStorybook ? `${addonName}@${versionRange}${storybookVersion}` : isValidVersion(version2) && !version2.includes("-pr-") ? `${addonName}@^${version2}` : `${addonName}@${version2}`;
5049
- logger25.log(`Installing ${addonWithVersion}`), await packageManager.addDependencies(
5048
+ logger24.log(`Installing ${addonWithVersion}`), await packageManager.addDependencies(
5050
5049
  { type: "devDependencies", writeOutputToFile: !1, skipInstall },
5051
5050
  [addonWithVersion]
5052
- ), shouldAddToMain && (logger25.log(
5051
+ ), shouldAddToMain && (logger24.log(
5053
5052
  `Adding '${addon}' to the "addons" field in ${relative2(process.cwd(), mainConfigPath)}`
5054
5053
  ), await setupAddonInConfig({
5055
5054
  addonName,
@@ -5060,7 +5059,7 @@ async function add(addon, {
5060
5059
  packageManager: packageManager.type,
5061
5060
  configDir,
5062
5061
  yes,
5063
- logger: logger25,
5062
+ logger: logger24,
5064
5063
  prompt,
5065
5064
  skipInstall
5066
5065
  });
@@ -5072,7 +5071,7 @@ function isValidVersion(version2) {
5072
5071
  // src/automigrate/index.ts
5073
5072
  var import_picocolors19 = __toESM(require_picocolors(), 1);
5074
5073
  import { versions as versions2 } from "storybook/internal/common";
5075
- import { logTracker as logTracker2, logger as logger18, prompt as prompt5 } from "storybook/internal/node-logger";
5074
+ import { logTracker as logTracker2, logger as logger17, prompt as prompt5 } from "storybook/internal/node-logger";
5076
5075
  import { AutomigrateError } from "storybook/internal/server-errors";
5077
5076
 
5078
5077
  // ../../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
@@ -5753,7 +5752,7 @@ var KIND_ORDER = ["main", "preview", "manager", "config", "story"], parse2 = (co
5753
5752
  project.mainConfigPath && claim(project.mainConfigPath, "main"), project.previewConfigPath && claim(project.previewConfigPath, "preview");
5754
5753
  let managerConfigPath = project.configDir && findConfigFile("manager", project.configDir);
5755
5754
  if (managerConfigPath && claim(managerConfigPath, "manager"), project.storiesPaths.forEach((id) => claim(id, "story")), kinds.has("config")) {
5756
- let { globby } = await import("./globby-I74JNCO6.js");
5755
+ let { globby } = await import("./globby-6YVPAXG5.js");
5757
5756
  (await globby("**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}", {
5758
5757
  cwd: project.configDir,
5759
5758
  absolute: !0,
@@ -5933,7 +5932,7 @@ import { logger as logger4 } from "storybook/internal/node-logger";
5933
5932
  import { promises as fs } from "fs";
5934
5933
  var maxConcurrentTasks = Math.max(1, os.cpus().length - 1);
5935
5934
  async function runCodemod(globPattern = "**/*.{stories,story}.{js,jsx,ts,tsx,mjs,mjsx,mts,mtsx}", transform, { dryRun = !1, skipFormatting = !1 } = {}) {
5936
- let modifiedCount = 0, unmodifiedCount = 0, errorCount = 0, { globby } = await import("./globby-I74JNCO6.js"), files = await globby(slash(globPattern), {
5935
+ let modifiedCount = 0, unmodifiedCount = 0, errorCount = 0, { globby } = await import("./globby-6YVPAXG5.js"), files = await globby(slash(globPattern), {
5937
5936
  followSymbolicLinks: !0,
5938
5937
  ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**", "**/build/**"]
5939
5938
  });
@@ -5944,7 +5943,7 @@ Please try a different pattern.
5944
5943
  `
5945
5944
  ), new Error("No files matched");
5946
5945
  try {
5947
- let pLimit = (await import("./p-limit-LF2SB6TM.js")).default, limit = pLimit(maxConcurrentTasks);
5946
+ let pLimit = (await import("./p-limit-GSIPL3UA.js")).default, limit = pLimit(maxConcurrentTasks);
5948
5947
  await Promise.all(
5949
5948
  files.map(
5950
5949
  (file) => limit(async () => {
@@ -6685,10 +6684,16 @@ import { logger as logger10, prompt as prompt3 } from "storybook/internal/node-l
6685
6684
  import { join as join4 } from "node:path";
6686
6685
  import { existsSync, statSync } from "node:fs";
6687
6686
  function any(names, options) {
6688
- let dir, start = options && options.cwd || "", j = 0, len = names.length, tmp;
6687
+ let dir, start = options && options.cwd || "", j = 0, len = names.length, tmp, stats, type = options?.type, kind = type ? type === "dir" ? 1 : -1 : 0;
6689
6688
  for (dir of up(start, options))
6690
6689
  for (j = 0; j < len; j++)
6691
- if (tmp = join4(dir, names[j]), existsSync(tmp)) return tmp;
6690
+ if (tmp = join4(dir, names[j]), kind)
6691
+ try {
6692
+ if (stats = statSync(tmp), kind === 1 ? stats.isDirectory() : stats.isFile()) return tmp;
6693
+ } catch {
6694
+ }
6695
+ else if (existsSync(tmp))
6696
+ return tmp;
6692
6697
  }
6693
6698
 
6694
6699
  // ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
@@ -7023,7 +7028,7 @@ var readJsonFile = async (files, path4) => {
7023
7028
  let targets = asObject(root?.targets);
7024
7029
  return targets && groups.push({ pathPrefix: ["targets"], targets }), groups;
7025
7030
  }, findWorkspaceFiles = async (basename5) => {
7026
- let { globby } = await import("./globby-I74JNCO6.js");
7031
+ let { globby } = await import("./globby-6YVPAXG5.js");
7027
7032
  return globby([`**/${basename5}`], {
7028
7033
  cwd: getProjectRoot2(),
7029
7034
  ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**"],
@@ -7117,7 +7122,10 @@ var COMPODOC_PACKAGE = "@compodoc/compodoc", SET_COMPODOC_JSON = "setCompodocJso
7117
7122
  id: "angular-vite-remove-compodoc",
7118
7123
  link: "https://storybook.js.org/docs/get-started/frameworks/angular-vite",
7119
7124
  async check({ files, mainConfig, mainConfigPath, previewConfigPath, packageManager }) {
7120
- return !mainConfigPath || getFrameworkPackageName(mainConfig) !== ANGULAR_VITE_PACKAGE || mainConfig.features?.experimentalDocgenServer === !1 ? null : findCompodocSetup({ files, mainConfig, previewConfigPath, packageManager });
7125
+ if (!mainConfigPath || getFrameworkPackageName(mainConfig) !== ANGULAR_VITE_PACKAGE)
7126
+ return null;
7127
+ let features = mainConfig.features ?? {};
7128
+ return (features.docgenServer ?? features.experimentalDocgenServer) === !1 ? null : findCompodocSetup({ files, mainConfig, previewConfigPath, packageManager });
7121
7129
  },
7122
7130
  prompt: () => dedent5`
7123
7131
  "@storybook/angular-vite" now extracts Angular metadata on the server, so Compodoc no longer runs.
@@ -7539,12 +7547,37 @@ var introducedIn = "11.0.0", csfNextMockedArgs = {
7539
7547
 
7540
7548
  // src/automigrate/fixes/addon-svelte-csf-to-core.ts
7541
7549
  var import_picocolors9 = __toESM(require_picocolors(), 1);
7542
- import { resolve as resolve5 } from "node:path";
7550
+ import { relative as relative5, resolve as resolve5 } from "node:path";
7543
7551
  import { parser, traverse as traverse6, types as t9 } from "storybook/internal/babel";
7544
- import { normalizeAddonName, removeAddon } from "storybook/internal/common";
7545
- import { logger as logger11 } from "storybook/internal/node-logger";
7552
+ import { getProjectRoot as getProjectRoot4, normalizeAddonName, removeAddon } from "storybook/internal/common";
7546
7553
  import { dedent as dedent7 } from "ts-dedent";
7547
- var ADDON_SVELTE_CSF = "@storybook/addon-svelte-csf", SVELTE_CSF_FRAMEWORKS = ["@storybook/svelte-vite", "@storybook/sveltekit"], MIGRATION_GUIDE = "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md", LEGACY_SYNTAX_LINK = `${MIGRATION_GUIDE}#svelte-csf-legacy-story-syntax-removed`, ADDON_IMPORT = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"`])@storybook\/addon-svelte-csf\2/g, COMMENT_IMPORT = /(\bimport\s*\(\s*)(['"`])@storybook\/addon-svelte-csf\2/g, SCRIPT_BLOCK = /(<script\b(?:[^>"']|"[^"]*"|'[^']*')*>)([\s\S]*?)(<\/script>)/g, REWRITTEN_KINDS = ["main", "preview", "manager", "config", "story"], isAddonSvelteCsf = (addon) => normalizeAddonName(addon) === ADDON_SVELTE_CSF, needsLegacyWarning = (result) => result.legacyTemplate || result.legacyStoryFiles.length > 0, parse4 = (code) => {
7554
+ var ADDON_SVELTE_CSF = "@storybook/addon-svelte-csf", SVELTE_CSF_FRAMEWORKS = ["@storybook/svelte-vite", "@storybook/sveltekit"], MIGRATION_GUIDE = "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md", LEGACY_SYNTAX_LINK = `${MIGRATION_GUIDE}#svelte-csf-legacy-story-syntax-removed`, ADDON_IMPORT = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"`])@storybook\/addon-svelte-csf\2/g, COMMENT_IMPORT = /(\bimport\s*\(\s*)(['"`])@storybook\/addon-svelte-csf\2/g, SCRIPT_BLOCK = /(<script\b(?:[^>"']|"[^"]*"|'[^']*')*>)([\s\S]*?)(<\/script>)/g, REWRITTEN_KINDS = ["main", "preview", "manager", "config", "story"], isAddonSvelteCsf = (addon) => normalizeAddonName(addon) === ADDON_SVELTE_CSF, needsLegacyWarning = (result) => result.legacyStoryFiles.length > 0 || Object.keys(result.legacySyntax).length > 0, LEGACY_STORY_ATTRIBUTES = ["let:args", "let:context", "id", "autodocs", "source"], storyTagAttributes = (markup, start) => {
7555
+ let names = [], name = "", quote = "", depth = 0, expression = "", shorthand = !1, afterEquals = !1;
7556
+ for (let index = start; index < markup.length; index++) {
7557
+ let char = markup[index];
7558
+ if (quote)
7559
+ quote = char === quote ? "" : quote;
7560
+ else if (depth > 0)
7561
+ depth += char === "{" ? 1 : char === "}" ? -1 : 0, depth > 0 ? expression += char : shorthand && names.push(expression.trim());
7562
+ else if (char === '"' || char === "'")
7563
+ quote = char, afterEquals = !1;
7564
+ else if (char === "{")
7565
+ depth = 1, expression = "", shorthand = !afterEquals && !name, afterEquals = !1;
7566
+ else if (char === "=")
7567
+ name && names.push(name), name = "", afterEquals = !0;
7568
+ else if (char === ">" || /[\s/]/.test(char)) {
7569
+ if (name && names.push(name), name = "", afterEquals = !1, char === ">")
7570
+ break;
7571
+ } else afterEquals || (name += char);
7572
+ }
7573
+ return names;
7574
+ }, legacyStorySyntax = (code) => {
7575
+ let markup = code.replace(SCRIPT_BLOCK, "").replace(/<style\b[\s\S]*?<\/style>/g, "").replace(/<!--[\s\S]*?-->/g, ""), found = /* @__PURE__ */ new Set();
7576
+ for (let match of markup.matchAll(/<Story(?=[\s/>])/g))
7577
+ for (let name of storyTagAttributes(markup, match.index + match[0].length))
7578
+ LEGACY_STORY_ATTRIBUTES.includes(name) && found.add(name);
7579
+ return LEGACY_STORY_ATTRIBUTES.filter((name) => found.has(name));
7580
+ }, parse4 = (code) => {
7548
7581
  for (let plugins of [["typescript", "jsx"], ["typescript"]])
7549
7582
  try {
7550
7583
  return parser.parse(code, { sourceType: "module", plugins: [...plugins] });
@@ -7637,13 +7670,19 @@ var ADDON_SVELTE_CSF = "@storybook/addon-svelte-csf", SVELTE_CSF_FRAMEWORKS = ["
7637
7670
  path4.node.name === "defineMeta" && (found = !0, path4.stop());
7638
7671
  }
7639
7672
  }), found;
7640
- }), fileList = (paths) => paths.map((path4) => `- ${path4}`).join(`
7641
- `), legacyWarning = (legacyStoryFiles) => dedent7`
7642
- Storybook 11 removes the legacy Svelte CSF syntax, such as ${import_picocolors9.default.cyan("<Meta>")}, ${import_picocolors9.default.cyan("export const meta")} and ${import_picocolors9.default.cyan("<Template>")}. Migrate your legacy stories to ${import_picocolors9.default.cyan("defineMeta")} by hand${legacyStoryFiles.length > 0 ? `:
7643
- ${fileList(legacyStoryFiles)}` : "."}
7673
+ }), fileList = (paths, notes = {}) => paths.map((path4) => `- ${relative5(getProjectRoot4(), path4)}${notes[path4] ? ` (${notes[path4]})` : ""}`).join(`
7674
+ `), legacyWarning = ({ legacyStoryFiles, legacySyntax }) => {
7675
+ let notes = Object.fromEntries([
7676
+ ...legacyStoryFiles.map((path4) => [path4, "no defineMeta"]),
7677
+ ...Object.entries(legacySyntax).map(([path4, syntax]) => [path4, syntax.join(", ")])
7678
+ ]);
7679
+ return dedent7`
7680
+ Storybook 11 removes the legacy Svelte CSF syntax, such as ${import_picocolors9.default.cyan("<Meta>")}, ${import_picocolors9.default.cyan("<Template>")}, ${import_picocolors9.default.cyan("let:args")} and the ${import_picocolors9.default.cyan("id")}, ${import_picocolors9.default.cyan("autodocs")} and ${import_picocolors9.default.cyan("source")} props on ${import_picocolors9.default.cyan("<Story>")}. Migrate these stories by hand:
7681
+ ${fileList(Object.keys(notes), notes)}
7644
7682
 
7645
- See ${LEGACY_SYNTAX_LINK}
7646
- `, addonSvelteCsfToCore = {
7683
+ See ${LEGACY_SYNTAX_LINK}
7684
+ `;
7685
+ }, addonSvelteCsfToCore = {
7647
7686
  id: "addon-svelte-csf-to-core",
7648
7687
  link: `${MIGRATION_GUIDE}#svelte-csf-is-built-into-the-svelte-frameworks`,
7649
7688
  async check({
@@ -7662,19 +7701,26 @@ ${fileList(legacyStoryFiles)}` : "."}
7662
7701
  let projectFiles = configDir ? await collectFiles(
7663
7702
  { configDir, mainConfigPath, previewConfigPath, storiesPaths },
7664
7703
  new Set(REWRITTEN_KINDS)
7665
- ) : storiesPaths.map((id) => ({ id, kind: "story" })), importFiles = [], legacyStoryFiles = [];
7704
+ ) : storiesPaths.map((id) => ({ id, kind: "story" })), importFiles = [], legacyStoryFiles = [], legacySyntax = {};
7666
7705
  for (let { id, kind } of projectFiles) {
7667
7706
  let code = await files.read(id);
7668
7707
  if (rewriteImports(code, id, framework) === null)
7669
7708
  continue;
7670
- (kind === "story" && id.endsWith(".svelte") && !usesDefineMeta(code) ? legacyStoryFiles : importFiles).push(resolve5(id));
7709
+ let path4 = resolve5(id), isSvelteStory = kind === "story" && id.endsWith(".svelte");
7710
+ if (isSvelteStory && !usesDefineMeta(code)) {
7711
+ legacyStoryFiles.push(path4);
7712
+ continue;
7713
+ }
7714
+ importFiles.push(path4);
7715
+ let syntax = isSvelteStory ? legacyStorySyntax(code) : [];
7716
+ syntax.length > 0 && (legacySyntax[path4] = syntax);
7671
7717
  }
7672
7718
  return {
7673
7719
  framework,
7674
7720
  mainConfigPath: addonEntry ? mainConfigPath : void 0,
7675
7721
  importFiles,
7676
7722
  legacyStoryFiles,
7677
- legacyTemplate: typeof addonEntry == "object" && addonEntry.options?.legacyTemplate === !0
7723
+ legacySyntax
7678
7724
  };
7679
7725
  },
7680
7726
  prompt(result) {
@@ -7693,7 +7739,7 @@ ${fileList(changedFiles)}
7693
7739
 
7694
7740
  Change other files that import the addon by hand.` : "", legacy = needsLegacyWarning(result) ? `
7695
7741
 
7696
- ${legacyWarning(result.legacyStoryFiles)}` : "";
7742
+ ${legacyWarning(result)}` : "";
7697
7743
  return summary + changes + legacy;
7698
7744
  },
7699
7745
  transform: ({ result }) => {
@@ -7706,7 +7752,7 @@ ${legacyWarning(result.legacyStoryFiles)}` : "";
7706
7752
  ];
7707
7753
  },
7708
7754
  async run({ packageManager, result, configDir, storybookVersion }) {
7709
- needsLegacyWarning(result) && logger11.warn(legacyWarning(result.legacyStoryFiles)), packageManager.replaceDependency(ADDON_SVELTE_CSF, result.framework, `^${storybookVersion}`), await removeAddon(ADDON_SVELTE_CSF, { packageManager, configDir, skipInstall: !0 });
7755
+ packageManager.replaceDependency(ADDON_SVELTE_CSF, result.framework, `^${storybookVersion}`), await removeAddon(ADDON_SVELTE_CSF, { packageManager, configDir, skipInstall: !0 });
7710
7756
  }
7711
7757
  };
7712
7758
 
@@ -7768,7 +7814,7 @@ import {
7768
7814
  configureEslintPlugin,
7769
7815
  extractEslintInfo
7770
7816
  } from "storybook/internal/cli";
7771
- import { logger as logger12 } from "storybook/internal/node-logger";
7817
+ import { logger as logger11 } from "storybook/internal/node-logger";
7772
7818
  import { dedent as dedent8 } from "ts-dedent";
7773
7819
  var eslintPlugin = {
7774
7820
  id: "eslintPlugin",
@@ -7781,7 +7827,7 @@ var eslintPlugin = {
7781
7827
  unsupportedExtension,
7782
7828
  isFlatConfig
7783
7829
  } = await extractEslintInfo(packageManager);
7784
- return isStorybookPluginInstalled || !hasEslint ? null : eslintConfigFile ? { eslintConfigFile, unsupportedExtension, isFlatConfig } : (logger12.debug("Unable to find eslint config file, skipping"), null);
7830
+ return isStorybookPluginInstalled || !hasEslint ? null : eslintConfigFile ? { eslintConfigFile, unsupportedExtension, isFlatConfig } : (logger11.debug("Unable to find eslint config file, skipping"), null);
7785
7831
  },
7786
7832
  prompt() {
7787
7833
  return "We'll install and configure the Storybook ESLint plugin for you.";
@@ -7794,7 +7840,7 @@ var eslintPlugin = {
7794
7840
  if (await packageManager.addDependencies({ type: "devDependencies", skipInstall: !0 }, [
7795
7841
  `eslint-plugin-storybook@${storybookVersion}`
7796
7842
  ]), unsupportedExtension) {
7797
- logger12.warn(dedent8`
7843
+ logger11.warn(dedent8`
7798
7844
  The plugin was successfully installed but failed to be configured.
7799
7845
 
7800
7846
  Found an eslint config file with an unsupported automigration format: .eslintrc.${unsupportedExtension}.
@@ -7808,47 +7854,19 @@ var eslintPlugin = {
7808
7854
  }
7809
7855
  };
7810
7856
 
7811
- // src/automigrate/fixes/experimental-features.ts
7812
- import { SupportedRenderer } from "storybook/internal/types";
7813
- var createExperimentalFeatureFix = ({
7814
- id,
7815
- name,
7816
- introducedIn: introducedIn3,
7817
- link: link2,
7818
- prompt: prompt9,
7819
- isSupported
7820
- }) => ({
7821
- id,
7822
- link: link2,
7823
- defaultSelected: !1,
7824
- prompt: () => prompt9,
7825
- async check({ mainConfig, beforeVersion, storybookVersion, requested }) {
7826
- return isSupported && !isSupported(mainConfig) || !isAtOrPastVersion(storybookVersion, introducedIn3) || !requested && !(beforeVersion && crossesVersionBoundary(beforeVersion, storybookVersion, introducedIn3)) || mainConfig.features?.[name] !== void 0 ? null : {};
7827
- },
7857
+ // src/automigrate/fixes/docgen-server.ts
7858
+ var docgenServer = {
7859
+ id: "docgen-server",
7860
+ link: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#docgenserver-is-stable-and-enabled-by-default",
7861
+ prompt: () => "Rename features.experimentalDocgenServer to features.docgenServer",
7828
7862
  transform: () => [
7829
- { filter: { kind: ["main"] }, editConfig: (main) => main.set(["features", name], !0) }
7863
+ {
7864
+ filter: { kind: ["main"], code: "experimentalDocgenServer" },
7865
+ editConfig: (main) => {
7866
+ main.get(["features", "experimentalDocgenServer"]) && (main.get(["features", "docgenServer"]) ? main.remove(["features", "experimentalDocgenServer"]) : main.rename(["features", "experimentalDocgenServer"], "docgenServer"));
7867
+ }
7868
+ }
7830
7869
  ]
7831
- }), enableExperimentalDocgenServer = createExperimentalFeatureFix({
7832
- id: "enable-experimental-docgen-server",
7833
- name: "experimentalDocgenServer",
7834
- introducedIn: "10.5.0",
7835
- isSupported: (mainConfig) => getRendererName(mainConfig) === SupportedRenderer.REACT || ["@storybook/vue3-vite", "@storybook/angular-vite"].includes(
7836
- getFrameworkPackageName(mainConfig) ?? ""
7837
- ),
7838
- link: "https://storybook.js.org/docs/api/main-config/main-config-features#experimentaldocgenserver",
7839
- prompt: "Enable experimentalDocgenServer for faster startup and more accurate Controls/ArgTypes."
7840
- }), FEATURE_FLAG_FIXES = {
7841
- experimentalDocgenServer: enableExperimentalDocgenServer
7842
- }, resolveRequestedFeatures = (features) => {
7843
- let names = features?.split(",").map((name) => name.trim()).filter(Boolean) ?? [], unknown = names.filter((name) => !Object.hasOwn(FEATURE_FLAG_FIXES, name));
7844
- if (unknown.length > 0)
7845
- throw new Error(
7846
- `Unknown feature flag(s): ${unknown.join(", ")}. Available: ${Object.keys(FEATURE_FLAG_FIXES).join(", ")}.`
7847
- );
7848
- return names.map((name) => ({
7849
- name,
7850
- fixId: FEATURE_FLAG_FIXES[name].id
7851
- }));
7852
7870
  };
7853
7871
 
7854
7872
  // src/automigrate/fixes/nextjs-to-nextjs-vite.ts
@@ -7888,7 +7906,7 @@ var VITE_DEFAULT_VERSION = "^7.0.0", NEXTJS_FRAMEWORK = /@storybook\/nextjs(?!-v
7888
7906
 
7889
7907
  // src/automigrate/fixes/react-vite-to-tanstack-react.ts
7890
7908
  import { transformImports as transformImports3 } from "storybook/internal/common";
7891
- import { logger as logger13, prompt as prompt4 } from "storybook/internal/node-logger";
7909
+ import { logger as logger12, prompt as prompt4 } from "storybook/internal/node-logger";
7892
7910
 
7893
7911
  // ../../../node_modules/tinyclip/dist/index.js
7894
7912
  import { spawn } from "node:child_process";
@@ -8143,9 +8161,9 @@ var REACT_VITE_PACKAGE = "@storybook/react-vite", TANSTACK_REACT_PACKAGE = "@sto
8143
8161
  if (await assertMainConfigNamesFramework(files, mainConfigPath, MIGRATED_OR_NOT, {
8144
8162
  from: REACT_VITE_PACKAGE,
8145
8163
  to: TANSTACK_REACT_PACKAGE
8146
- }), logger13.step(`Migrating from ${REACT_VITE_PACKAGE} to ${TANSTACK_REACT_PACKAGE}...`), await packageManager.removeDependencies([REACT_VITE_PACKAGE]), await packageManager.addDependencies({ type: "devDependencies", skipInstall: !0 }, [
8164
+ }), logger12.step(`Migrating from ${REACT_VITE_PACKAGE} to ${TANSTACK_REACT_PACKAGE}...`), await packageManager.removeDependencies([REACT_VITE_PACKAGE]), await packageManager.addDependencies({ type: "devDependencies", skipInstall: !0 }, [
8147
8165
  `${TANSTACK_REACT_PACKAGE}@${storybookVersion}`
8148
- ]), result.hasTanstackRouterDecorator && (logger13.logBox(
8166
+ ]), result.hasTanstackRouterDecorator && (logger12.logBox(
8149
8167
  dedent9`
8150
8168
  We detected what looks like a manual TanStack Router decorator in
8151
8169
  ${import_picocolors12.default.cyan(previewConfigPath ?? ".storybook/preview")}.
@@ -8161,7 +8179,7 @@ var REACT_VITE_PACKAGE = "@storybook/react-vite", TANSTACK_REACT_PACKAGE = "@sto
8161
8179
  () => !0,
8162
8180
  () => !1
8163
8181
  );
8164
- logger13.logBox(
8182
+ logger12.logBox(
8165
8183
  dedent9`${copied ? "AI migration prompt copied to clipboard. Full prompt below:" : "Clipboard not available in this environment. Copy the AI migration prompt below manually:"}
8166
8184
 
8167
8185
  ${separator}
@@ -8169,10 +8187,28 @@ var REACT_VITE_PACKAGE = "@storybook/react-vite", TANSTACK_REACT_PACKAGE = "@sto
8169
8187
  ${separator}`
8170
8188
  );
8171
8189
  }
8172
- logger13.step("Migration completed successfully!"), logger13.log(`For more information, see: ${DOCS_URL}`);
8190
+ logger12.step("Migration completed successfully!"), logger12.log(`For more information, see: ${DOCS_URL}`);
8173
8191
  }
8174
8192
  };
8175
8193
 
8194
+ // src/automigrate/fixes/remove-change-detection-flag.ts
8195
+ var removeChangeDetectionFlag = {
8196
+ id: "remove-change-detection-flag",
8197
+ link: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#changedetection-feature-flag-removed",
8198
+ prompt: () => "Remove features.changeDetection. Change detection is always on in Storybook 11.",
8199
+ // Storybook 10 still reads the flag, so removing it there turns change detection back on.
8200
+ check: async ({ storybookVersion }) => isAtOrPastVersion(storybookVersion, "11.0.0") ? {} : null,
8201
+ transform: () => [
8202
+ {
8203
+ filter: { kind: ["main"], code: "changeDetection" },
8204
+ // `remove` fails on a spread in `features`, even when the flag is only mentioned in a comment.
8205
+ editConfig: (main) => {
8206
+ main.getFieldNode(["features", "changeDetection"]) && main.remove(["features", "changeDetection"]);
8207
+ }
8208
+ }
8209
+ ]
8210
+ };
8211
+
8176
8212
  // src/automigrate/fixes/remove-experimental-review.ts
8177
8213
  var removeExperimentalReview = {
8178
8214
  id: "remove-experimental-review",
@@ -8192,7 +8228,7 @@ var removeExperimentalReview = {
8192
8228
  import { existsSync as existsSync3 } from "node:fs";
8193
8229
  import { basename as basename3, dirname as dirname3, join as join6, resolve as resolve6 } from "node:path";
8194
8230
  import { findConfigFile as findConfigFile2, loadMainConfig } from "storybook/internal/common";
8195
- import { logger as logger14 } from "storybook/internal/node-logger";
8231
+ import { logger as logger13 } from "storybook/internal/node-logger";
8196
8232
 
8197
8233
  // ../../core/src/shared/constants/config-folder.ts
8198
8234
  var RN_STORYBOOK_DIR = ".rnstorybook";
@@ -8219,7 +8255,7 @@ var SIBLING_CONFIG_DIR = {
8219
8255
  try {
8220
8256
  config = await loadMainConfig({ configDir: dir });
8221
8257
  } catch (e) {
8222
- logger14.debug(
8258
+ logger13.debug(
8223
8259
  `Failed to load Storybook main config at ${dir}: ${e instanceof Error ? e.message : String(e)}`
8224
8260
  );
8225
8261
  continue;
@@ -8377,7 +8413,7 @@ var managerApiPackages2 = ["storybook/manager-api", "@storybook/manager-api"], s
8377
8413
  // src/automigrate/fixes/skills.ts
8378
8414
  import { hasStorybookSkills, installSkills, supportsSkills } from "storybook/internal/cli";
8379
8415
  import { frameworkPackages as frameworkPackages3, frameworkToRenderer, isCI } from "storybook/internal/common";
8380
- import { logger as logger15 } from "storybook/internal/node-logger";
8416
+ import { logger as logger14 } from "storybook/internal/node-logger";
8381
8417
  var introducedIn2 = "11.0.0", skills = {
8382
8418
  id: "skills",
8383
8419
  link: "https://github.com/storybookjs/skills",
@@ -8392,7 +8428,7 @@ var introducedIn2 = "11.0.0", skills = {
8392
8428
  if (await hasStorybookSkills())
8393
8429
  return;
8394
8430
  if (result.afterAngularViteMigration && !packageManager.getAllDependencies()[ANGULAR_VITE_PACKAGE2])
8395
- return logger15.warn(
8431
+ return logger14.warn(
8396
8432
  `The Storybook skills need ${ANGULAR_VITE_PACKAGE2}, so they were not installed. Run \`npx storybook automigrate angular-to-angular-vite\` and then \`npx storybook automigrate skills\`.`
8397
8433
  ), !1;
8398
8434
  if ((await installSkills({
@@ -8481,13 +8517,13 @@ var tagOptionRenames = {
8481
8517
  var import_semver8 = __toESM(require_semver(), 1);
8482
8518
  import { dirname as dirname4 } from "node:path";
8483
8519
  import { JsPackageManager as JsPackageManager2, isCorePackage, isSatelliteAddon } from "storybook/internal/common";
8484
- import { logger as logger16 } from "storybook/internal/node-logger";
8485
- var NON_REGISTRY_SPECIFIER = /^(patch|file|link|portal|git|http|https|workspace):|^git\+/, upgradeStorybookRelatedDependencies = {
8520
+ import { logger as logger15 } from "storybook/internal/node-logger";
8521
+ var NON_REGISTRY_SPECIFIER = /^(patch|file|link|portal|git|http|https|workspace):|^git\+/, LOCKSTEP_SCOPES = /* @__PURE__ */ new Set(["@nx"]), scopeOf = (packageName) => packageName.startsWith("@") ? packageName.slice(0, packageName.indexOf("/")) : null, upgradeStorybookRelatedDependencies = {
8486
8522
  id: "upgrade-storybook-related-dependencies",
8487
8523
  promptType: "auto",
8488
8524
  defaultSelected: !1,
8489
8525
  async check({ packageManager, storybookVersion }) {
8490
- logger16.debug("Checking for incompatible storybook packages...");
8526
+ logger15.debug("Checking for incompatible storybook packages...");
8491
8527
  let analyzedPackages = await getIncompatibleStorybookPackages({
8492
8528
  currentStorybookVersion: storybookVersion,
8493
8529
  packageManager,
@@ -8497,14 +8533,22 @@ var NON_REGISTRY_SPECIFIER = /^(patch|file|link|portal|git|http|https|workspace)
8497
8533
  ), incompatibleDependencies = analyzedPackages.filter((pkg) => pkg.hasIncompatibleDependencies).map((pkg) => pkg.packageName), packageNames = new Set(
8498
8534
  [...storybookDependencies, ...incompatibleDependencies].filter((dep) => {
8499
8535
  let specifier = allDependencies[dep];
8500
- return specifier !== void 0 && !NON_REGISTRY_SPECIFIER.test(specifier) ? !0 : (logger16.debug(`Skipping ${dep}: it is not declared with a registry version (${specifier})`), !1);
8536
+ return specifier !== void 0 && !NON_REGISTRY_SPECIFIER.test(specifier) ? !0 : (logger15.debug(`Skipping ${dep}: it is not declared with a registry version (${specifier})`), !1);
8501
8537
  })
8538
+ ), scopesStayingBehind = new Set(
8539
+ Object.keys(allDependencies).filter((dependency) => !packageNames.has(dependency)).map(scopeOf).filter((scope) => scope !== null && LOCKSTEP_SCOPES.has(scope))
8502
8540
  ), upgradable = (await Promise.all(
8503
- [...packageNames].map(async (packageName) => ({
8504
- packageName,
8505
- beforeVersion: await packageManager.getInstalledVersion(packageName),
8506
- afterVersion: await packageManager.latestVersion(packageName)
8507
- }))
8541
+ [...packageNames].map(async (packageName) => {
8542
+ let beforeVersion = await packageManager.getInstalledVersion(packageName), keepMajor = !!beforeVersion && scopesStayingBehind.has(scopeOf(packageName));
8543
+ return {
8544
+ packageName,
8545
+ beforeVersion,
8546
+ afterVersion: await packageManager.latestVersion(
8547
+ packageName,
8548
+ keepMajor ? `^${beforeVersion}` : void 0
8549
+ )
8550
+ };
8551
+ })
8508
8552
  )).filter(
8509
8553
  (pkg) => pkg.beforeVersion !== null && pkg.afterVersion !== null && (0, import_semver8.gt)(pkg.afterVersion, pkg.beforeVersion)
8510
8554
  );
@@ -8536,6 +8580,7 @@ import {
8536
8580
  import jscodeshift from "jscodeshift";
8537
8581
  import path3 from "path";
8538
8582
  import { dedent as dedent11 } from "ts-dedent";
8583
+ import { getHeaderComments } from "storybook/internal/csf-tools";
8539
8584
  var VITEST_ADDON_NAME = "@storybook/addon-vitest", VITEST_PLUGIN_MODULE = "@storybook/addon-vitest/vitest-plugin", A11Y_ADDON_NAME = "@storybook/addon-a11y", A11Y_PREVIEW_MODULE = "@storybook/addon-a11y/preview", PRINT_OPTIONS = { lineTerminator: `
8540
8585
  ` }, SETUP_FILE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".cts", ".mts", ".cjs", ".mjs"], CONFIG_FILE_PATTERNS = [
8541
8586
  "vitest.config.{js,ts,mjs,cjs,mts,cts}",
@@ -8709,7 +8754,7 @@ function transformSetupFile(source, options) {
8709
8754
  kind: "manual",
8710
8755
  reason: `it passes "${A11Y_PREVIEW_MODULE}" annotations, but ${A11Y_ADDON_NAME} is not registered in the "addons" field of your .storybook/main`
8711
8756
  } : unsupportedAnnotation(node);
8712
- }, removedStatements = /* @__PURE__ */ new Set(), capturedNames = /* @__PURE__ */ new Set(), annotationNames = /* @__PURE__ */ new Set();
8757
+ }, [firstStatement] = program2.body, removedStatements = /* @__PURE__ */ new Set(), capturedNames = /* @__PURE__ */ new Set(), annotationNames = /* @__PURE__ */ new Set();
8713
8758
  for (let statement of program2.body) {
8714
8759
  let call = statement.type === "ExpressionStatement" && isCallOf(statement.expression, callBinding[0]) ? statement.expression : statement.type === "VariableDeclaration" && statement.declarations.length === 1 && statement.declarations[0].id.type === "Identifier" && isCallOf(statement.declarations[0].init, callBinding[0]) ? statement.declarations[0].init : null;
8715
8760
  if (!call)
@@ -8749,7 +8794,14 @@ function transformSetupFile(source, options) {
8749
8794
  (specifier) => specifier !== binding.specifier
8750
8795
  ), binding.declaration.specifiers.length === 0 && (program2.body = program2.body.filter((statement) => statement !== binding.declaration)));
8751
8796
  }
8752
- return program2.body.length === 0 ? { kind: "empty" } : { kind: "rewritten", code: root.toSource(PRINT_OPTIONS) };
8797
+ return program2.body.length === 0 ? { kind: "empty" } : (keepHeader(firstStatement, program2.body[0]), { kind: "rewritten", code: root.toSource(PRINT_OPTIONS) });
8798
+ }
8799
+ function keepHeader(removed, first) {
8800
+ let header = getHeaderComments(removed);
8801
+ if (removed === first || !header.length)
8802
+ return;
8803
+ let commented = first;
8804
+ commented.comments = [...header, ...commented.comments ?? []];
8753
8805
  }
8754
8806
  function resolvesToPreview(importSource, options) {
8755
8807
  return importSource.startsWith(".") ? path3.resolve(path3.dirname(options.setupFilePath), importSource).replace(SCRIPT_EXTENSION, "") === path3.resolve(options.configDir, "preview") : !1;
@@ -8903,10 +8955,10 @@ function resolveStaticPath(node, configFile) {
8903
8955
  if (isImportMetaUrl(argument))
8904
8956
  return configFile;
8905
8957
  if (argument.type === "NewExpression" && calleeName(argument.callee) === "URL") {
8906
- let [relative5, base] = argument.arguments;
8958
+ let [relative6, base] = argument.arguments;
8907
8959
  if (argument.arguments.length !== 2 || !isImportMetaUrl(base))
8908
8960
  return null;
8909
- let relativePath = resolveStaticPath(relative5, configFile);
8961
+ let relativePath = resolveStaticPath(relative6, configFile);
8910
8962
  return relativePath === null ? null : path3.resolve(configDir, relativePath);
8911
8963
  }
8912
8964
  return null;
@@ -8955,6 +9007,7 @@ function isKeyNamed(key, name) {
8955
9007
 
8956
9008
  // src/automigrate/fixes/wrap-getAbsolutePath.ts
8957
9009
  import {
9010
+ ensureNamedImport,
8958
9011
  getAbsolutePathWrapperAsCallExpression,
8959
9012
  getAbsolutePathWrapperName,
8960
9013
  getFieldsForGetAbsolutePathWrapper,
@@ -8979,7 +9032,13 @@ var wrapGetAbsolutePath = {
8979
9032
  if (fields.some((node) => isGetAbsolutePathWrapperNecessary(node)) && (fields.forEach((node) => wrapValueWithGetAbsolutePathWrapper(mainConfig, node)), getAbsolutePathWrapperName(mainConfig) === null)) {
8980
9033
  if (/\.c[jt]sx?$/.test(id) || mainConfig._code.includes("module.exports"))
8981
9034
  throw new CommonJsConfigNotSupportedError();
8982
- mainConfig.setImport(["dirname"], "node:path"), mainConfig.setImport(["fileURLToPath"], "node:url"), mainConfig.setBodyDeclaration(getAbsolutePathWrapperAsCallExpression(/\.tsx?$/.test(id)));
9035
+ let names = {
9036
+ dirname: ensureNamedImport(mainConfig, "dirname", "node:path"),
9037
+ fileURLToPath: ensureNamedImport(mainConfig, "fileURLToPath", "node:url")
9038
+ };
9039
+ mainConfig.setBodyDeclaration(
9040
+ getAbsolutePathWrapperAsCallExpression(/\.tsx?$/.test(id), names)
9041
+ );
8983
9042
  }
8984
9043
  }
8985
9044
  }
@@ -9007,13 +9066,14 @@ var allFixes = [
9007
9066
  sidebarFilters,
9008
9067
  csfNextMockedArgs,
9009
9068
  removeExperimentalReview,
9010
- enableExperimentalDocgenServer,
9011
- skills
9069
+ removeChangeDetectionFlag,
9070
+ skills,
9071
+ docgenServer
9012
9072
  ], commandFixes = [csfFactories];
9013
9073
 
9014
9074
  // src/automigrate/helpers/logMigrationSummary.ts
9015
9075
  var import_picocolors18 = __toESM(require_picocolors(), 1);
9016
- import { CLI_COLORS as CLI_COLORS2, logger as logger17 } from "storybook/internal/node-logger";
9076
+ import { CLI_COLORS as CLI_COLORS2, logger as logger16 } from "storybook/internal/node-logger";
9017
9077
  import { dedent as dedent12 } from "ts-dedent";
9018
9078
  var messageDivider2 = `
9019
9079
 
@@ -9022,7 +9082,7 @@ var messageDivider2 = `
9022
9082
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
9023
9083
 
9024
9084
  `;
9025
- function getGlossaryMessages(fixSummary, fixResults) {
9085
+ function getGlossaryMessages(fixSummary, fixResults, dryRun) {
9026
9086
  let messages2 = [];
9027
9087
  return fixSummary.succeeded.length > 0 && (messages2.push(import_picocolors18.default.bold("Successful migrations:")), messages2.push(fixSummary.succeeded.map((m) => import_picocolors18.default.green(m)).join(", "))), Object.keys(fixSummary.failed).length > 0 && (messages2.push(import_picocolors18.default.bold("Failed migrations:")), messages2.push(
9028
9088
  Object.entries(fixSummary.failed).map(([id, error]) => `${import_picocolors18.default.bold(import_picocolors18.default.red(id))}:
@@ -9032,15 +9092,20 @@ ${error}`).join(`
9032
9092
  fixSummary.manual.map(
9033
9093
  (m) => fixResults[m] === "manual_succeeded" /* MANUAL_SUCCEEDED */ ? import_picocolors18.default.green(m) : import_picocolors18.default.blue(m)
9034
9094
  ).join(", ")
9035
- )), fixSummary.skipped.length > 0 && (messages2.push(import_picocolors18.default.bold("Skipped migrations:")), messages2.push(fixSummary.skipped.map((m) => import_picocolors18.default.cyan(m)).join(", "))), messages2;
9095
+ )), fixSummary.skipped.length > 0 && (messages2.push(
9096
+ import_picocolors18.default.bold(
9097
+ dryRun ? "Migrations that a run would apply (dry run, no files changed):" : "Skipped migrations:"
9098
+ )
9099
+ ), messages2.push(fixSummary.skipped.map((m) => import_picocolors18.default.cyan(m)).join(", "))), messages2;
9036
9100
  }
9037
9101
  function logMigrationSummary({
9038
9102
  fixResults,
9039
9103
  fixSummary,
9040
- skippedFiles = 0
9104
+ skippedFiles = 0,
9105
+ dryRun = !1
9041
9106
  }) {
9042
9107
  let messages2 = [];
9043
- messages2.push(getGlossaryMessages(fixSummary, fixResults).join(messageDivider2)), messages2.push(dedent12`If you'd like to run the migrations again, you can do so by running
9108
+ messages2.push(getGlossaryMessages(fixSummary, fixResults, dryRun).join(messageDivider2)), messages2.push(dedent12`If you'd like to run the migrations again, you can do so by running
9044
9109
  ${import_picocolors18.default.cyan("npx storybook automigrate")}
9045
9110
 
9046
9111
  The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.
@@ -9052,23 +9117,23 @@ function logMigrationSummary({
9052
9117
  let hasNoFixes = Object.values(fixResults).every((r) => r === "unnecessary" /* UNNECESSARY */), hasFailures2 = Object.values(fixResults).some(
9053
9118
  (r) => r === "failed" /* FAILED */ || r === "check_failed" /* CHECK_FAILED */
9054
9119
  );
9055
- hasNoFixes ? logger17.warn("No migrations were applicable to your project") : hasFailures2 ? logger17.error("Migration check ran with failures") : skippedFiles > 0 ? logger17.warn(
9120
+ hasNoFixes ? logger16.warn("No migrations were applicable to your project") : dryRun && !hasFailures2 ? logger16.step(CLI_COLORS2.success("Dry run finished: no files were changed")) : hasFailures2 ? logger16.error("Migration check ran with failures") : skippedFiles > 0 ? logger16.warn(
9056
9121
  `Migrations ran, but ${pluralFiles(skippedFiles)} could not be migrated automatically`
9057
- ) : logger17.step(CLI_COLORS2.success("Migration check ran successfully")), logger17.log(messages2.filter(Boolean).join(segmentDivider));
9122
+ ) : logger16.step(CLI_COLORS2.success("Migration check ran successfully")), logger16.log(messages2.filter(Boolean).join(segmentDivider));
9058
9123
  }
9059
9124
 
9060
9125
  // src/automigrate/index.ts
9061
9126
  var logAvailableMigrations = () => {
9062
9127
  let availableFixes = [...allFixes, ...commandFixes].map((f) => import_picocolors19.default.yellow(f.id)).map((x) => `- ${x}`).join(`
9063
9128
  `);
9064
- logger18.log(dedent13`
9129
+ logger17.log(dedent13`
9065
9130
  The following migrations are available:
9066
9131
  ${availableFixes}
9067
9132
  `);
9068
9133
  }, hasFailures = (fixResults) => Object.values(fixResults || {}).some(
9069
9134
  (r) => r === "failed" /* FAILED */ || r === "check_failed" /* CHECK_FAILED */
9070
9135
  ), doAutomigrate = async (options) => {
9071
- logger18.debug("Extracting storybook data...");
9136
+ logger17.debug("Extracting storybook data...");
9072
9137
  let {
9073
9138
  mainConfig,
9074
9139
  mainConfigPath,
@@ -9101,7 +9166,7 @@ var logAvailableMigrations = () => {
9101
9166
  packageManager: packageManager.type,
9102
9167
  configDir,
9103
9168
  yes: options.yes,
9104
- logger: logger18,
9169
+ logger: logger17,
9105
9170
  prompt: prompt5
9106
9171
  })), outcome && !options.skipDoctor && await doctor({ configDir, packageManager: options.packageManager });
9107
9172
  let failedMigrations = Object.entries(outcome?.fixResults ?? {}).filter(([, status]) => status === "failed" /* FAILED */ || status === "check_failed" /* CHECK_FAILED */).map(([id, status]) => {
@@ -9133,7 +9198,7 @@ var logAvailableMigrations = () => {
9133
9198
  return logAvailableMigrations(), null;
9134
9199
  let commandFix = commandFixes.find((f) => f.id === fixId);
9135
9200
  if (commandFix)
9136
- return logger18.step(`Running migration ${import_picocolors19.default.magenta(fixId)}..`), await commandFix.run({
9201
+ return logger17.step(`Running migration ${import_picocolors19.default.magenta(fixId)}..`), await commandFix.run({
9137
9202
  mainConfigPath,
9138
9203
  previewConfigPath,
9139
9204
  packageManager,
@@ -9148,8 +9213,8 @@ var logAvailableMigrations = () => {
9148
9213
  }), null;
9149
9214
  let selectedFixes = inputFixes || allFixes.filter((fix) => !(fix.id === upgradeStorybookRelatedDependencies.id && isLatest === !1 && fixId !== upgradeStorybookRelatedDependencies.id)), fixes = fixId ? selectedFixes.filter((f) => f.id === fixId) : selectedFixes;
9150
9215
  if (fixId && fixes.length === 0)
9151
- return logger18.log(`\u{1F4ED} No migrations found for ${import_picocolors19.default.magenta(fixId)}.`), logAvailableMigrations(), null;
9152
- logger18.step("Checking possible migrations..");
9216
+ return logger17.log(`\u{1F4ED} No migrations found for ${import_picocolors19.default.magenta(fixId)}.`), logAvailableMigrations(), null;
9217
+ logger17.step("Checking possible migrations..");
9153
9218
  let { fixResults, fixSummary, preCheckFailure, addonsToPostinstall, fileFailures, verified } = await runFixes({
9154
9219
  fixes,
9155
9220
  fixId,
@@ -9172,7 +9237,8 @@ var logAvailableMigrations = () => {
9172
9237
  ]), hasFailures(fixResults) && logTracker2.enableLogWriting(), hideMigrationSummary || logMigrationSummary({
9173
9238
  fixResults,
9174
9239
  fixSummary,
9175
- skippedFiles: fileFailures.filter(({ fixId: fixId2 }) => fixResults[fixId2] === "succeeded" /* SUCCEEDED */).length
9240
+ skippedFiles: fileFailures.filter(({ fixId: fixId2 }) => fixResults[fixId2] === "succeeded" /* SUCCEEDED */).length,
9241
+ dryRun
9176
9242
  }), { fixResults, preCheckFailure, addonsToPostinstall, fileFailures };
9177
9243
  };
9178
9244
  async function runFixes({
@@ -9201,7 +9267,7 @@ async function runFixes({
9201
9267
  for (let f of fixes) {
9202
9268
  let check;
9203
9269
  try {
9204
- logger18.debug(`Running ${import_picocolors19.default.cyan(f.id)} migration checks`), check = await runCheck(f, {
9270
+ logger17.debug(`Running ${import_picocolors19.default.cyan(f.id)} migration checks`), check = await runCheck(f, {
9205
9271
  packageManager,
9206
9272
  configDir,
9207
9273
  mainConfig,
@@ -9210,9 +9276,9 @@ async function runFixes({
9210
9276
  mainConfigPath,
9211
9277
  storiesPaths,
9212
9278
  requested: fixId === f.id
9213
- }), logger18.debug(`End of ${import_picocolors19.default.cyan(f.id)} migration checks`);
9279
+ }), logger17.debug(`End of ${import_picocolors19.default.cyan(f.id)} migration checks`);
9214
9280
  } catch (error) {
9215
- logger18.warn(`\u26A0\uFE0F failed to check fix ${import_picocolors19.default.bold(f.id)}`), error instanceof Error && (logger18.error(`
9281
+ logger17.warn(`\u26A0\uFE0F failed to check fix ${import_picocolors19.default.bold(f.id)}`), error instanceof Error && (logger17.error(`
9216
9282
  ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "check_failed" /* CHECK_FAILED */;
9217
9283
  }
9218
9284
  check?.result ? checked.push(check) : fixResults[f.id] = fixResults[f.id] || "unnecessary" /* UNNECESSARY */;
@@ -9223,7 +9289,7 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
9223
9289
  let selected = [];
9224
9290
  for (let check of applicable) {
9225
9291
  let { fix: f, result } = check, promptType = typeof f.promptType == "function" ? await f.promptType(result) : f.promptType ?? "auto";
9226
- logger18.log(`\u{1F50E} found a '${import_picocolors19.default.cyan(f.id)}' migration:`);
9292
+ logger17.log(`\u{1F50E} found a '${import_picocolors19.default.cyan(f.id)}' migration:`);
9227
9293
  let getTitle = () => {
9228
9294
  switch (promptType) {
9229
9295
  case "auto":
@@ -9234,7 +9300,7 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
9234
9300
  return "Migration notification";
9235
9301
  }
9236
9302
  };
9237
- logger18.step(`${getTitle()}: ${import_picocolors19.default.cyan(f.id)}`), logger18.logBox(f.prompt(result));
9303
+ logger17.step(`${getTitle()}: ${import_picocolors19.default.cyan(f.id)}`), logger17.logBox(f.prompt(result));
9238
9304
  let runAnswer;
9239
9305
  try {
9240
9306
  if (dryRun)
@@ -9283,7 +9349,7 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
9283
9349
  } catch {
9284
9350
  break;
9285
9351
  }
9286
- promptType === "auto" && (invariant(runAnswer, "runAnswer must be defined if not promptOnly"), runAnswer.fix ? selected.push(check) : (fixResults[f.id] = "skipped" /* SKIPPED */, fixSummary.skipped.push(f.id), logger18.log(`Skipped ${import_picocolors19.default.cyan(f.id)} migration`)));
9352
+ promptType === "auto" && (invariant(runAnswer, "runAnswer must be defined if not promptOnly"), runAnswer.fix ? selected.push(check) : (fixResults[f.id] = "skipped" /* SKIPPED */, fixSummary.skipped.push(f.id), logger17.log(`Skipped ${import_picocolors19.default.cyan(f.id)} migration`)));
9287
9353
  }
9288
9354
  if (selected.length === 0)
9289
9355
  return { fixResults, fixSummary, addonsToPostinstall, fileFailures, verified };
@@ -9300,12 +9366,12 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
9300
9366
  continue;
9301
9367
  }
9302
9368
  if (fileFailures.push(...outcome.fileFailures.map((failure) => ({ ...failure, fixId: fixId2 }))), outcome.status === "failed")
9303
- fixResults[fixId2] = "failed" /* FAILED */, fixSummary.failed[fixId2] = outcome.error instanceof Error ? outcome.error.message : "Failed to run migration", taskLog.message(`${logger18.SYMBOLS.error} ${import_picocolors19.default.cyan(fixId2)}`);
9369
+ fixResults[fixId2] = "failed" /* FAILED */, fixSummary.failed[fixId2] = outcome.error instanceof Error ? outcome.error.message : "Failed to run migration", taskLog.message(`${logger17.SYMBOLS.error} ${import_picocolors19.default.cyan(fixId2)}`);
9304
9370
  else {
9305
9371
  fixResults[fixId2] = "succeeded" /* SUCCEEDED */, fixSummary.succeeded.push(fixId2);
9306
9372
  let skipped = outcome.fileFailures.length;
9307
9373
  taskLog.message(
9308
- `${logger18.SYMBOLS.success} ${import_picocolors19.default.cyan(fixId2)}${skipped > 0 ? ` (${pluralFiles(skipped)} skipped)` : ""}`
9374
+ `${logger17.SYMBOLS.success} ${import_picocolors19.default.cyan(fixId2)}${skipped > 0 ? ` (${pluralFiles(skipped)} skipped)` : ""}`
9309
9375
  );
9310
9376
  }
9311
9377
  }
@@ -9313,12 +9379,25 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
9313
9379
  return Object.values(fixResults).includes("failed" /* FAILED */) ? taskLog.error(selected.length === 1 ? `Could not run ${ran}` : "Some automigrations failed") : taskLog.success(`Ran ${ran}`), { fixResults, fixSummary, addonsToPostinstall, fileFailures, verified };
9314
9380
  }
9315
9381
 
9382
+ // src/automigrate/fixes/experimental-features.ts
9383
+ var FEATURE_FLAG_FIXES = {}, resolveRequestedFeatures = (features) => {
9384
+ let names = features?.split(",").map((name) => name.trim()).filter(Boolean) ?? [], unknown = names.filter((name) => !Object.hasOwn(FEATURE_FLAG_FIXES, name));
9385
+ if (unknown.length > 0)
9386
+ throw new Error(
9387
+ `Unknown feature flag(s): ${unknown.join(", ")}. Available: ${Object.keys(FEATURE_FLAG_FIXES).join(", ") || "none"}.`
9388
+ );
9389
+ return names.map((name) => ({
9390
+ name,
9391
+ fixId: FEATURE_FLAG_FIXES[name].id
9392
+ }));
9393
+ };
9394
+
9316
9395
  // src/link.ts
9317
9396
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
9318
9397
  import { mkdir, readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
9319
9398
  import { basename as basename4, extname as extname3, join as join7 } from "node:path";
9320
9399
  import { executeCommand } from "storybook/internal/common";
9321
- import { logger as logger19 } from "storybook/internal/node-logger";
9400
+ import { logger as logger18 } from "storybook/internal/node-logger";
9322
9401
  var link = async ({ target, local, start }) => {
9323
9402
  let storybookDir = process.cwd();
9324
9403
  try {
@@ -9330,7 +9409,7 @@ var link = async ({ target, local, start }) => {
9330
9409
  let reproDir = target, reproName = basename4(target);
9331
9410
  if (!local) {
9332
9411
  let reprosDir = join7(storybookDir, "../storybook-repros");
9333
- logger19.info(`Ensuring directory ${reprosDir}`), await mkdir(reprosDir, { recursive: !0 }), logger19.info(`Cloning ${target}`), await executeCommand({
9412
+ logger18.info(`Ensuring directory ${reprosDir}`), await mkdir(reprosDir, { recursive: !0 }), logger18.info(`Cloning ${target}`), await executeCommand({
9334
9413
  command: "git",
9335
9414
  args: ["clone", target],
9336
9415
  cwd: reprosDir
@@ -9342,14 +9421,14 @@ var link = async ({ target, local, start }) => {
9342
9421
  shell: !0
9343
9422
  }).stdout.toString();
9344
9423
  if (!/^[2-4]\./.test(version2)) {
9345
- logger19.warn(`\u{1F6A8} Expected yarn 2 or higher in ${reproDir}!`), logger19.warn(""), logger19.warn("Please set it up with `yarn set version berry`,"), logger19.warn(`then link '${reproDir}' with the '--local' flag.`);
9424
+ logger18.warn(`\u{1F6A8} Expected yarn 2 or higher in ${reproDir}!`), logger18.warn(""), logger18.warn("Please set it up with `yarn set version berry`,"), logger18.warn(`then link '${reproDir}' with the '--local' flag.`);
9346
9425
  return;
9347
9426
  }
9348
- logger19.info(`Linking ${reproDir}`), await executeCommand({
9427
+ logger18.info(`Linking ${reproDir}`), await executeCommand({
9349
9428
  command: "yarn",
9350
9429
  args: ["link", "--all", "--relative", storybookDir],
9351
9430
  cwd: reproDir
9352
- }), logger19.info(`Installing ${reproName}`);
9431
+ }), logger18.info(`Installing ${reproName}`);
9353
9432
  let reproPackageJson = JSON.parse(
9354
9433
  await readFile4(join7(reproDir, "package.json"), { encoding: "utf8" })
9355
9434
  );
@@ -9363,7 +9442,7 @@ var link = async ({ target, local, start }) => {
9363
9442
  command: "yarn",
9364
9443
  args: ["install"],
9365
9444
  cwd: reproDir
9366
- }), start && (logger19.info(`Running ${reproName} storybook`), await executeCommand({
9445
+ }), start && (logger18.info(`Running ${reproName} storybook`), await executeCommand({
9367
9446
  command: "yarn",
9368
9447
  args: ["run", "storybook"],
9369
9448
  cwd: reproDir
@@ -9371,13 +9450,13 @@ var link = async ({ target, local, start }) => {
9371
9450
  };
9372
9451
 
9373
9452
  // src/migrate.ts
9374
- import { logger as logger20 } from "storybook/internal/node-logger";
9453
+ import { logger as logger19 } from "storybook/internal/node-logger";
9375
9454
  import { listCodemods, runCodemod as runCodemod2 } from "@storybook/codemod";
9376
9455
  async function migrate2(migration, { glob, dryRun, list, rename, parser: parser2 }) {
9377
9456
  if (list)
9378
- listCodemods().forEach((key) => logger20.log(key));
9457
+ listCodemods().forEach((key) => logger19.log(key));
9379
9458
  else if (migration)
9380
- await runCodemod2(migration, { glob, dryRun, logger: logger20, rename, parser: parser2 });
9459
+ await runCodemod2(migration, { glob, dryRun, logger: logger19, rename, parser: parser2 });
9381
9460
  else
9382
9461
  throw new Error("Migrate: please specify a migration name or --list");
9383
9462
  }
@@ -9394,7 +9473,7 @@ import {
9394
9473
  optionalEnvToBoolean as optionalEnvToBoolean2,
9395
9474
  versions as versions3
9396
9475
  } from "storybook/internal/common";
9397
- import { logger as logger21, prompt as prompt6 } from "storybook/internal/node-logger";
9476
+ import { logger as logger20, prompt as prompt6 } from "storybook/internal/node-logger";
9398
9477
  var import_picocolors20 = __toESM(require_picocolors(), 1), import_semver10 = __toESM(require_semver(), 1);
9399
9478
  import { dedent as dedent14 } from "ts-dedent";
9400
9479
 
@@ -9438,8 +9517,7 @@ var baseTemplates = {
9438
9517
  features: {
9439
9518
  experimentalRSC: !0,
9440
9519
  developmentModeForBuild: !0,
9441
- experimentalTestSyntax: !0,
9442
- changeDetection: !0
9520
+ experimentalTestSyntax: !0
9443
9521
  }
9444
9522
  },
9445
9523
  extraDevDependencies: ["server-only", "prop-types"]
@@ -9519,8 +9597,7 @@ var baseTemplates = {
9519
9597
  features: {
9520
9598
  experimentalRSC: !0,
9521
9599
  developmentModeForBuild: !0,
9522
- experimentalTestSyntax: !0,
9523
- changeDetection: !0
9600
+ experimentalTestSyntax: !0
9524
9601
  }
9525
9602
  },
9526
9603
  extraDevDependencies: ["server-only", "vite", "prop-types"]
@@ -9562,8 +9639,7 @@ var baseTemplates = {
9562
9639
  mainConfig: {
9563
9640
  features: {
9564
9641
  developmentModeForBuild: !0,
9565
- experimentalTestSyntax: !0,
9566
- changeDetection: !0
9642
+ experimentalTestSyntax: !0
9567
9643
  }
9568
9644
  }
9569
9645
  },
@@ -9760,33 +9836,17 @@ var baseTemplates = {
9760
9836
  renderer: "@storybook/vue3",
9761
9837
  builder: "@storybook/builder-vite"
9762
9838
  },
9763
- modifications: {
9764
- useCsfFactory: !0
9765
- },
9766
- skipTasks: ["bench"]
9767
- },
9768
- "vue3-vite/docgen-server-ts": {
9769
- name: "Vue Server Docgen v3 (Vite | TypeScript)",
9770
- script: "npm create vite --yes {{beforeDir}} -- --template vue-ts",
9771
- minAgeGateExemptions: ["vue-component-meta", "@vue/language-core"],
9772
- expected: {
9773
- framework: "@storybook/vue3-vite",
9774
- renderer: "@storybook/vue3",
9775
- builder: "@storybook/builder-vite"
9776
- },
9777
9839
  modifications: {
9778
9840
  extraDevDependencies: ["@storybook/addon-mcp"],
9779
9841
  editAddons: (addons) => [...addons, "@storybook/addon-mcp"],
9780
9842
  useCsfFactory: !0,
9781
- storiesVariant: "vue3-vite-default-ts",
9782
9843
  mainConfig: {
9783
9844
  features: {
9784
- experimentalDocgenServer: !0,
9785
9845
  componentsManifest: !0
9786
9846
  }
9787
9847
  }
9788
9848
  },
9789
- skipTasks: ["bench", "chromatic"]
9849
+ skipTasks: ["bench"]
9790
9850
  },
9791
9851
  "vue3-rsbuild/default-ts": {
9792
9852
  name: "Vue Latest (RsBuild | TypeScript)",
@@ -9882,7 +9942,12 @@ var baseTemplates = {
9882
9942
  },
9883
9943
  "svelte-kit/skeleton-ts": {
9884
9944
  name: "SvelteKit Latest (Vite | TypeScript)",
9885
- script: "npx sv@latest create --template minimal --types ts --no-add-ons --no-install {{beforeDir}}",
9945
+ // TODO: Remove `--min-release-age=0`, `minAgeGateExemptions` and `inDevelopment` once the
9946
+ // published sandbox has SvelteKit 3. SvelteKit 3 and the `sv` release that scaffolds it are
9947
+ // younger than the sandbox age gate, and npx ignores `minAgeGateExemptions`.
9948
+ script: "npx --min-release-age=0 sv@latest create --template minimal --types ts --no-add-ons --no-install {{beforeDir}}",
9949
+ minAgeGateExemptions: ["@sveltejs/kit", "@sveltejs/adapter-auto"],
9950
+ inDevelopment: !0,
9886
9951
  expected: {
9887
9952
  framework: "@storybook/sveltekit",
9888
9953
  renderer: "@storybook/svelte",
@@ -9947,52 +10012,17 @@ var baseTemplates = {
9947
10012
  // `@compodoc/compodoc` is no longer installed by `storybook init` for the Vite builder, but
9948
10013
  // the sandbox harness prepends its own `docs:json` Compodoc pass to every Angular sandbox
9949
10014
  // (see `sandbox-parts.ts`), so the sandboxes still have to carry the binary themselves.
9950
- extraDependencies: ["@angular/forms@^22", "typescript@^6", "@compodoc/compodoc"],
9951
- useCsfFactory: !0,
9952
- // `@storybook/angular-vite` turns the docgen server on by default, so guarding the browser
9953
- // docgen path is now an explicit opt-out rather than the absence of a flag.
9954
- mainConfig: {
9955
- features: {
9956
- experimentalDocgenServer: !1
9957
- }
9958
- }
9959
- },
9960
- extraCiSteps: {
9961
- ensureMinNodeVersion: !0
9962
- },
9963
- minAgeGateExemptions: ["@analogjs/vite-plugin-angular"],
9964
- expected: {
9965
- framework: "@storybook/angular-vite",
9966
- renderer: "@storybook/angular-vite",
9967
- builder: "@storybook/builder-vite"
9968
- },
9969
- skipTasks: ["bench"],
9970
- initOptions: { builder: "vite" /* VITE */ }
9971
- },
9972
- "angular-vite/docgen-server-ts": {
9973
- name: "Angular CLI Server Docgen Latest (Vite | TypeScript)",
9974
- // Identical to `angular-vite/default-ts` apart from the two feature flags below. Kept as its own
9975
- // template so the stable Angular sandbox keeps guarding today's browser docgen while the server
9976
- // path is proven separately, rather than both riding on one configuration.
9977
- script: "npx -p @angular/cli ng new angular-latest --directory {{beforeDir}} --routing=true --minimal=true --style=scss --strict --skip-git --skip-install --package-manager=yarn --ssr",
9978
- modifications: {
9979
- // Compodoc is unused under the flag, but the sandbox harness runs it regardless.
9980
10015
  extraDependencies: [
9981
10016
  "@angular/forms@^22",
9982
10017
  "@angular/animations@^22",
9983
10018
  "typescript@^6",
9984
10019
  "@compodoc/compodoc"
9985
10020
  ],
9986
- // The only Angular sandbox on the docgen-server path, so it is the only one that can prove
9987
- // what an agent reads about an Angular component.
9988
10021
  extraDevDependencies: ["@storybook/addon-mcp"],
9989
10022
  editAddons: (addons) => [...addons, "@storybook/addon-mcp"],
9990
10023
  useCsfFactory: !0,
9991
- // These two flags are what brings a template into docgen baseline coverage; see
9992
- // `docgenServerTemplates`.
9993
10024
  mainConfig: {
9994
10025
  features: {
9995
- experimentalDocgenServer: !0,
9996
10026
  componentsManifest: !0
9997
10027
  }
9998
10028
  }
@@ -10006,11 +10036,7 @@ var baseTemplates = {
10006
10036
  renderer: "@storybook/angular-vite",
10007
10037
  builder: "@storybook/builder-vite"
10008
10038
  },
10009
- // This sandbox exists to guard the docgen baselines, and it differs from
10010
- // `angular-vite/default-ts` only by two feature flags. Rendering, visual output and story
10011
- // execution are already covered there on every run, so repeating them here would double the
10012
- // Angular cost for no extra signal.
10013
- skipTasks: ["bench", "chromatic"],
10039
+ skipTasks: ["bench"],
10014
10040
  initOptions: { builder: "vite" /* VITE */ }
10015
10041
  },
10016
10042
  "lit-vite/default-js": {
@@ -10064,7 +10090,11 @@ var baseTemplates = {
10064
10090
  builder: "@storybook/builder-vite"
10065
10091
  },
10066
10092
  modifications: {
10067
- extraDependencies: ["preact-render-to-string"]
10093
+ // create-vite still scaffolds Preact 10.
10094
+ extraDependencies: ["preact-render-to-string", "preact@^11"],
10095
+ resolutions: {
10096
+ preact: "npm:preact@^11"
10097
+ }
10068
10098
  },
10069
10099
  skipTasks: ["e2e-tests", "bench"]
10070
10100
  },
@@ -10078,23 +10108,10 @@ var baseTemplates = {
10078
10108
  builder: "@storybook/builder-vite"
10079
10109
  },
10080
10110
  modifications: {
10081
- extraDependencies: ["preact-render-to-string"]
10082
- },
10083
- skipTasks: ["e2e-tests", "bench"]
10084
- },
10085
- "preact-vite/prerelease-ts": {
10086
- name: "Preact Prerelease (Vite | TypeScript)",
10087
- script: "npm create vite --yes {{beforeDir}} -- --template preact-ts",
10088
- preferNoLink: !0,
10089
- expected: {
10090
- framework: "@storybook/preact-vite",
10091
- renderer: "@storybook/preact",
10092
- builder: "@storybook/builder-vite"
10093
- },
10094
- modifications: {
10095
- extraDependencies: ["preact-render-to-string", "preact@beta"],
10111
+ // create-vite still scaffolds Preact 10.
10112
+ extraDependencies: ["preact-render-to-string", "preact@^11"],
10096
10113
  resolutions: {
10097
- preact: "npm:preact@beta"
10114
+ preact: "npm:preact@^11"
10098
10115
  }
10099
10116
  },
10100
10117
  skipTasks: ["e2e-tests", "bench"]
@@ -10327,15 +10344,7 @@ var baseTemplates = {
10327
10344
  // 'ember/default-js',
10328
10345
  "react-rsbuild/default-ts",
10329
10346
  "tanstack-react-router/default-ts",
10330
- "tanstack-react-start/default-ts",
10331
- // The sandboxes that record docgen baselines. Running them daily meant a change to the
10332
- // extraction could merge without ever touching them, which is how the props-table visibility
10333
- // rules landed on a stale recording.
10334
- // TODO(11.0): remove these templates. The standard sandboxes ship the new docgen approach by
10335
- // default from then on, so the `default-ts` templates carry the baselines and these are
10336
- // redundant.
10337
- "angular-vite/docgen-server-ts",
10338
- "vue3-vite/docgen-server-ts"
10347
+ "tanstack-react-start/default-ts"
10339
10348
  ], merged = [
10340
10349
  ...normal,
10341
10350
  "react-webpack/18-ts",
@@ -10357,9 +10366,6 @@ var baseTemplates = {
10357
10366
  "nextjs/prerelease",
10358
10367
  // 'qwik-vite/default-ts',
10359
10368
  "preact-vite/default-js",
10360
- // Disabled for cost-saving reasons, enable when we see signs that Preact 11 is about to release.
10361
- // After release, replace the default-js config with this one and delete this one.
10362
- // 'preact-vite/prerelease-ts',
10363
10369
  "html-vite/default-js",
10364
10370
  "internal/react18-webpack-babel",
10365
10371
  "react-native-web-vite/expo-ts",
@@ -10391,7 +10397,7 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10391
10397
  ),
10392
10398
  prerelease: import_picocolors20.default.yellow("This is a pre-release version.")
10393
10399
  };
10394
- if (logger21.logBox(
10400
+ if (logger20.logBox(
10395
10401
  [messages2.welcome].concat(isOutdated && !isPrerelease ? [messages2.notLatest] : []).concat(init && (isOutdated || isPrerelease) ? [messages2.longInitTime] : []).concat(isPrerelease ? [messages2.prerelease] : []).join(`
10396
10402
  `),
10397
10403
  {
@@ -10402,7 +10408,7 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10402
10408
  let current = allTemplates[group];
10403
10409
  return (!filterValue || current.name.match(filterRegex) || group.match(filterRegex) || current.expected.builder.match(filterRegex) || current.expected.framework.match(filterRegex) || current.expected.renderer.match(filterRegex)) && acc.push(group), acc;
10404
10410
  }, []);
10405
- if (choices.length === 0 && (logger21.logBox(
10411
+ if (choices.length === 0 && (logger20.logBox(
10406
10412
  dedent14`
10407
10413
  🔎 You filtered out all templates. 🔍
10408
10414
 
@@ -10415,7 +10421,7 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10415
10421
  `)}
10416
10422
  `.trim(),
10417
10423
  { borderStyle: "round", padding: 1, borderColor: "#F1618C" }
10418
- ), process.exit(1)), choices.length === 1 ? [templateId] = choices : (logger21.logBox(
10424
+ ), process.exit(1)), choices.length === 1 ? [templateId] = choices : (logger20.logBox(
10419
10425
  dedent14`
10420
10426
  🤗 Welcome to ${import_picocolors20.default.yellow("sb sandbox")}! 🤗
10421
10427
 
@@ -10428,14 +10434,14 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10428
10434
  `.trim(),
10429
10435
  { borderStyle: "round", padding: 1, borderColor: "#F1618C" }
10430
10436
  ), templateId = await promptSelectedTemplate(choices)), !!!(templateId ?? null)) {
10431
- logger21.error("Somehow we got no templates. Please rerun this command!");
10437
+ logger20.error("Somehow we got no templates. Please rerun this command!");
10432
10438
  return;
10433
10439
  }
10434
10440
  if (selectedConfig = templateId ? allTemplates[templateId] : void 0, !selectedConfig)
10435
10441
  throw new Error("\u{1F6A8} Sandbox: please specify a valid template type");
10436
10442
  }
10437
10443
  let selectedDirectory = outputDirectory, outputDirectoryName = outputDirectory || templateId;
10438
- selectedDirectory && existsSync5(`${selectedDirectory}`) && (logger21.log(`\u26A0\uFE0F ${selectedDirectory} already exists! Overwriting...`), await rm2(selectedDirectory, { recursive: !0, force: !0 })), selectedDirectory || (selectedDirectory = await prompt6.text(
10444
+ selectedDirectory && existsSync5(`${selectedDirectory}`) && (logger20.log(`\u26A0\uFE0F ${selectedDirectory} already exists! Overwriting...`), await rm2(selectedDirectory, { recursive: !0, force: !0 })), selectedDirectory || (selectedDirectory = await prompt6.text(
10439
10445
  {
10440
10446
  message: "Enter the output directory",
10441
10447
  initialValue: outputDirectoryName ?? void 0,
@@ -10443,13 +10449,13 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10443
10449
  },
10444
10450
  {
10445
10451
  onCancel: () => {
10446
- logger21.log("Command cancelled by the user. Exiting..."), process.exit(1);
10452
+ logger20.log("Command cancelled by the user. Exiting..."), process.exit(1);
10447
10453
  }
10448
10454
  }
10449
10455
  )), invariant(selectedDirectory);
10450
10456
  try {
10451
10457
  let templateDestination = isAbsolute3(selectedDirectory) ? selectedDirectory : join5(process.cwd(), selectedDirectory);
10452
- logger21.log(`\u{1F3C3} Adding ${selectedConfig.name} into ${templateDestination}`), logger21.log(`\u{1F4E6} Downloading sandbox template (${import_picocolors20.default.bold(downloadType)})...`);
10458
+ logger20.log(`\u{1F3C3} Adding ${selectedConfig.name} into ${templateDestination}`), logger20.log(`\u{1F4E6} Downloading sandbox template (${import_picocolors20.default.bold(downloadType)})...`);
10453
10459
  try {
10454
10460
  let gitPath = `storybookjs/sandboxes/tree/${branch}/${templateId}/${downloadType}`;
10455
10461
  if (await mkdir2(templateDestination, { recursive: !0 }), (0, import_cross_spawn2.sync)("npx", ["gitpick@4.12.4", gitPath, templateDestination, "-o"], {
@@ -10473,13 +10479,13 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10473
10479
  }), process.chdir(before);
10474
10480
  }
10475
10481
  } catch (err) {
10476
- throw logger21.error(`\u{1F6A8} Failed to download sandbox template: ${String(err)}`), err;
10482
+ throw logger20.error(`\u{1F6A8} Failed to download sandbox template: ${String(err)}`), err;
10477
10483
  }
10478
10484
  let initMessage = init ? import_picocolors20.default.yellow(dedent14`
10479
10485
  yarn install
10480
10486
  yarn storybook
10481
10487
  `) : `Recreate your setup, then ${import_picocolors20.default.yellow("npx storybook@latest init")}`;
10482
- logger21.logBox(
10488
+ logger20.logBox(
10483
10489
  dedent14`
10484
10490
  🎉 Your Storybook reproduction project is ready to use! 🎉
10485
10491
 
@@ -10497,7 +10503,7 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
10497
10503
  { rounded: !0 }
10498
10504
  );
10499
10505
  } catch (error) {
10500
- throw logger21.error("\u{1F6A8} Failed to create sandbox"), error;
10506
+ throw logger20.error("\u{1F6A8} Failed to create sandbox"), error;
10501
10507
  }
10502
10508
  };
10503
10509
  async function promptSelectedTemplate(choices) {
@@ -10523,7 +10529,7 @@ import {
10523
10529
  CLI_COLORS as CLI_COLORS4,
10524
10530
  createHyperlink,
10525
10531
  logTracker as logTracker3,
10526
- logger as logger23,
10532
+ logger as logger22,
10527
10533
  prompt as prompt8
10528
10534
  } from "storybook/internal/node-logger";
10529
10535
  import {
@@ -10535,11 +10541,11 @@ import { telemetry } from "storybook/internal/telemetry";
10535
10541
  import { dedent as dedent15 } from "ts-dedent";
10536
10542
 
10537
10543
  // src/automigrate/multi-project.ts
10538
- import { CLI_COLORS as CLI_COLORS3, logger as logger22, prompt as prompt7 } from "storybook/internal/node-logger";
10544
+ import { CLI_COLORS as CLI_COLORS3, logger as logger21, prompt as prompt7 } from "storybook/internal/node-logger";
10539
10545
  import { ErrorCollector, sanitizeError } from "storybook/internal/telemetry";
10540
10546
  async function collectAutomigrationsAcrossProjects(options) {
10541
10547
  let { fixes, projects, taskLog, requestedFixIds } = options, automigrationMap = /* @__PURE__ */ new Map();
10542
- logger22.debug(
10548
+ logger21.debug(
10543
10549
  `Starting automigration collection across ${projects.length} projects and ${fixes.length} fixes...`
10544
10550
  );
10545
10551
  function collectResult(fix, project, status, result, verified, recheck) {
@@ -10548,11 +10554,11 @@ async function collectAutomigrationsAcrossProjects(options) {
10548
10554
  }
10549
10555
  for (let project of projects) {
10550
10556
  let projectName = shortenPath(project.configDir);
10551
- taskLog.message(`Checking automigrations for ${projectName}...`), logger22.debug(`Processing project: ${projectName}`);
10557
+ taskLog.message(`Checking automigrations for ${projectName}...`), logger21.debug(`Processing project: ${projectName}`);
10552
10558
  let checks = [];
10553
10559
  for (let fix of fixes)
10554
10560
  try {
10555
- logger22.debug(`Checking fix ${fix.id} for project ${projectName}...`), checks.push(
10561
+ logger21.debug(`Checking fix ${fix.id} for project ${projectName}...`), checks.push(
10556
10562
  await runCheck(fix, {
10557
10563
  packageManager: project.packageManager,
10558
10564
  configDir: project.configDir,
@@ -10566,9 +10572,9 @@ async function collectAutomigrationsAcrossProjects(options) {
10566
10572
  })
10567
10573
  );
10568
10574
  } catch (error) {
10569
- checks.push({ fix, result: null, failed: !0 }), logger22.debug(
10575
+ checks.push({ fix, result: null, failed: !0 }), logger21.debug(
10570
10576
  `Failed to check fix ${fix.id} for project ${shortenPath(project.configDir)}.`
10571
- ), logger22.debug(`${error instanceof Error ? error.stack : String(error)}`), ErrorCollector.addError(error);
10577
+ ), logger21.debug(`${error instanceof Error ? error.stack : String(error)}`), ErrorCollector.addError(error);
10572
10578
  }
10573
10579
  let applicable = await detectApplicable(
10574
10580
  project,
@@ -10596,9 +10602,9 @@ async function collectAutomigrationsAcrossProjects(options) {
10596
10602
  );
10597
10603
  return taskLog.message(`
10598
10604
  Automigrations detected:`), successAutomigrations.forEach((fixId) => {
10599
- taskLog.message(`${CLI_COLORS3.success(`${logger22.SYMBOLS.success} ${fixId}`)}`);
10605
+ taskLog.message(`${CLI_COLORS3.success(`${logger21.SYMBOLS.success} ${fixId}`)}`);
10600
10606
  }), failedAutomigrations.forEach((fixId) => {
10601
- taskLog.message(`${CLI_COLORS3.error(`${logger22.SYMBOLS.error} ${fixId}`)}`);
10607
+ taskLog.message(`${CLI_COLORS3.error(`${logger21.SYMBOLS.error} ${fixId}`)}`);
10602
10608
  }), failedAutomigrations.length > 0 ? taskLog.error(
10603
10609
  `${failedAutomigrations.length} automigration ${failedAutomigrations.length > 1 ? "checks" : "check"} failed`
10604
10610
  ) : taskLog.success(
@@ -10611,17 +10617,25 @@ var formatProjectDirs = (list) => {
10611
10617
  return relativeDirs.join(", ");
10612
10618
  let remaining = relativeDirs.length - 1;
10613
10619
  return `${relativeDirs.slice(0, 1).join(", ")}${remaining > 0 ? ` and ${remaining} more...` : ""}`;
10620
+ }, logAutomigrationDetails = (automigrations) => {
10621
+ for (let { fix, reports } of automigrations) {
10622
+ let hint = fix.prompt();
10623
+ for (let { result, status, project } of reports) {
10624
+ let details = status === "check_succeeded" ? fix.prompt(result) : hint;
10625
+ details !== hint && logger21.logBox(details, { title: `${fix.id} (${shortenPath(project.configDir) || "."})` });
10626
+ }
10627
+ }
10614
10628
  };
10615
10629
  async function promptForAutomigrations(automigrations, options) {
10616
10630
  if (automigrations.length === 0)
10617
10631
  return [];
10618
10632
  let logSelection = (title, selection) => {
10619
- logger22.log(title), selection.forEach(({ fix, reports: list }) => {
10620
- logger22.log(` - ${fix.id} (${formatProjectDirs(list)})`);
10633
+ logger21.log(title), selection.forEach(({ fix, reports: list }) => {
10634
+ logger21.log(` - ${fix.id} (${formatProjectDirs(list)})`);
10621
10635
  });
10622
10636
  }, preselectedIds = new Set(options.preselectedIds ?? []);
10623
10637
  if (options.dryRun)
10624
- return logSelection("Detected automigrations (dry run - no changes will be made):", automigrations), [];
10638
+ return logSelection("Detected automigrations (dry run - no changes will be made):", automigrations), logAutomigrationDetails(automigrations), [];
10625
10639
  if (options.yes) {
10626
10640
  let selected = automigrations.filter(
10627
10641
  ({ fix }) => preselectedIds.has(fix.id) || fix.defaultSelected !== !1 || fix.promptType === "auto"
@@ -10662,6 +10676,7 @@ async function runAutomigrationsForProjects(selectedAutomigrations, options) {
10662
10676
  let { project } = report, existing = projectAutomigrationResults.get(project.configDir) || [];
10663
10677
  existing.length > 0 ? existing.push({ ...report, fix: automigration.fix }) : projectAutomigrationResults.set(project.configDir, [{ ...report, fix: automigration.fix }]);
10664
10678
  }
10679
+ logAutomigrationDetails(applicableAutomigrations);
10665
10680
  let projectIndex = 0;
10666
10681
  for (let [configDir, projectAutomigration] of projectAutomigrationResults) {
10667
10682
  let countPrefix = projectAutomigrationResults.size > 1 ? `(${++projectIndex}/${projectAutomigrationResults.size}) ` : "", { project } = projectAutomigration[0], projectName = shortenPath(project.configDir), taskLog = applicableAutomigrations.length > 0 ? prompt7.taskLog({
@@ -10669,13 +10684,13 @@ async function runAutomigrationsForProjects(selectedAutomigrations, options) {
10669
10684
  title: `${countPrefix}Running automigrations for ${projectName}`
10670
10685
  }) : {
10671
10686
  message: (message) => {
10672
- logger22.debug(`${message}`);
10687
+ logger21.debug(`${message}`);
10673
10688
  },
10674
10689
  error: (message) => {
10675
- logger22.debug(`${message}`);
10690
+ logger21.debug(`${message}`);
10676
10691
  },
10677
10692
  success: (message) => {
10678
- logger22.debug(`${message}`);
10693
+ logger21.debug(`${message}`);
10679
10694
  }
10680
10695
  }, fixResults = {}, fixFailures = {}, addonsToPostinstall = [], fileFailures = [], isSelected = (fix) => selectedAutomigrations.some(
10681
10696
  (am) => am.fix.id === fix.id && am.reports.some((report) => report.project.configDir === project.configDir)
@@ -10704,11 +10719,11 @@ async function runAutomigrationsForProjects(selectedAutomigrations, options) {
10704
10719
  }
10705
10720
  fileFailures.push(...outcome.fileFailures.map((failure) => ({ ...failure, fixId })));
10706
10721
  let skipped = outcome.fileFailures.length;
10707
- outcome.status === "failed" ? (fixResults[fixId] = "failed" /* FAILED */, fixFailures[fixId] = sanitizeError(outcome.error), taskLog.message(CLI_COLORS3.error(`${logger22.SYMBOLS.error} ${fixId}`)), taskLog.message(
10722
+ outcome.status === "failed" ? (fixResults[fixId] = "failed" /* FAILED */, fixFailures[fixId] = sanitizeError(outcome.error), taskLog.message(CLI_COLORS3.error(`${logger21.SYMBOLS.error} ${fixId}`)), taskLog.message(
10708
10723
  outcome.error instanceof Error ? outcome.error.message : String(outcome.error)
10709
- ), logger22.debug(outcome.error instanceof Error ? outcome.error.stack : String(outcome.error)), ErrorCollector.addError(outcome.error)) : (fixResults[fixId] = "succeeded" /* SUCCEEDED */, taskLog.message(
10724
+ ), logger21.debug(outcome.error instanceof Error ? outcome.error.stack : String(outcome.error)), ErrorCollector.addError(outcome.error)) : (fixResults[fixId] = "succeeded" /* SUCCEEDED */, taskLog.message(
10710
10725
  CLI_COLORS3.success(
10711
- `${logger22.SYMBOLS.success} ${fixId}${skipped > 0 ? ` (${pluralFiles(skipped)} skipped)` : ""}`
10726
+ `${logger21.SYMBOLS.success} ${fixId}${skipped > 0 ? ` (${pluralFiles(skipped)} skipped)` : ""}`
10712
10727
  )
10713
10728
  ));
10714
10729
  }
@@ -10755,7 +10770,7 @@ async function runAutomigrations(projects, options) {
10755
10770
  );
10756
10771
  requestedFeatures.filter(({ fixId }) => !successfulAutomigrations.some((am) => am.fix.id === fixId)).forEach(({ name, fixId }) => {
10757
10772
  let checkFailed = detectedAutomigrations.find((am) => am.fix.id === fixId)?.reports.some((report) => report.status === "check_failed");
10758
- logger22.warn(
10773
+ logger21.warn(
10759
10774
  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 or unsupported by your framework or Storybook version.`
10760
10775
  );
10761
10776
  });
@@ -10840,28 +10855,28 @@ function logUpgradeResults(projectResults, detectedAutomigrations, doctorResults
10840
10855
  doctorResults
10841
10856
  );
10842
10857
  if (failedProjects.length > 0) {
10843
- if (logTracker3.enableLogWriting(), logger23.step(
10858
+ if (logTracker3.enableLogWriting(), logger22.step(
10844
10859
  "The upgrade is complete, but some projects failed to upgrade or migrate completely. Please see the debug logs for more details."
10845
10860
  ), successfulProjects.length > 0) {
10846
10861
  let successfulProjectsList = successfulProjects.map((dir) => ` \u2022 ${shortenPath(dir)}`).join(`
10847
10862
  `);
10848
- logger23.log(`${CLI_COLORS4.success("Successfully upgraded:")}
10863
+ logger22.log(`${CLI_COLORS4.success("Successfully upgraded:")}
10849
10864
  ${successfulProjectsList}`);
10850
10865
  }
10851
10866
  let failedProjectsList = failedProjects.map((dir) => ` \u2022 ${shortenPath(dir)}`).join(`
10852
10867
  `);
10853
- if (logger23.log(
10868
+ if (logger22.log(
10854
10869
  `${CLI_COLORS4.error("Failed to upgrade:")}
10855
10870
  Some automigrations failed, please check the logs in the log file for more details.
10856
10871
  ${failedProjectsList}`
10857
10872
  ), projectsWithNoFixes.length > 0) {
10858
10873
  let projectList = projectsWithNoFixes.map((dir) => ` \u2022 ${shortenPath(dir)}`).join(`
10859
10874
  `);
10860
- logger23.log(`${CLI_COLORS4.info("No applicable migrations:")}
10875
+ logger22.log(`${CLI_COLORS4.info("No applicable migrations:")}
10861
10876
  ${projectList}`);
10862
10877
  }
10863
10878
  } else
10864
- Object.values(doctorResults).every((result) => result.status === "healthy") ? logger23.step(`${CLI_COLORS4.success("Your project(s) have been upgraded successfully! \u{1F389}")}`) : logger23.step(
10879
+ Object.values(doctorResults).every((result) => result.status === "healthy") ? logger22.step(`${CLI_COLORS4.success("Your project(s) have been upgraded successfully! \u{1F389}")}`) : logger22.step(
10865
10880
  `${import_picocolors21.default.yellow("Your project(s) have been upgraded successfully, but some issues were found which need your attention, please check Storybook doctor logs above.")}`
10866
10881
  );
10867
10882
  let automigrationLinks = detectedAutomigrations.filter(
@@ -10875,9 +10890,9 @@ ${projectList}`);
10875
10890
  ...automigrationLinks
10876
10891
  ].join(`
10877
10892
  `);
10878
- logger23.log(automigrationLinksMessage);
10893
+ logger22.log(automigrationLinksMessage);
10879
10894
  }
10880
- logger23.log(
10895
+ logger22.log(
10881
10896
  `For a full list of changes, please check our migration guide: ${CLI_COLORS4.cta("https://storybook.js.org/docs/releases/migration-guide?ref=upgrade")}`
10882
10897
  );
10883
10898
  }
@@ -10909,25 +10924,25 @@ async function sendMultiUpgradeTelemetry(options) {
10909
10924
  hasUserInterrupted
10910
10925
  });
10911
10926
  } catch (error) {
10912
- logger23.debug(`Failed to send multi-upgrade telemetry: ${String(error)}`);
10927
+ logger22.debug(`Failed to send multi-upgrade telemetry: ${String(error)}`);
10913
10928
  }
10914
10929
  }
10915
10930
  async function upgrade(options) {
10916
10931
  if (options.features && options.skipAutomigrations)
10917
- throw logger23.error(
10932
+ throw logger22.error(
10918
10933
  "The --features flag enables feature flags through automigrations, so it cannot be combined with --skip-automigrations."
10919
10934
  ), new HandledError5("--features cannot be combined with --skip-automigrations");
10920
10935
  let storybookVersionSpecifier = getStorybookVersionSpecifierFromCli(), projectsResult = await getProjects(options);
10921
10936
  if (projectsResult === void 0 || projectsResult.selectedProjects.length === 0)
10922
10937
  return;
10923
10938
  let { allProjects, selectedProjects: storybookProjects } = projectsResult;
10924
- storybookProjects.length > 1 ? logger23.info(`Upgrading the following projects:
10939
+ storybookProjects.length > 1 ? logger22.info(`Upgrading the following projects:
10925
10940
  ${storybookProjects.map((p) => `${import_picocolors21.default.cyan(shortenPath(p.configDir))}: ${import_picocolors21.default.bold(p.beforeVersion)} -> ${import_picocolors21.default.bold(p.currentCLIVersion)}`).join(`
10926
- `)}`) : logger23.info(
10941
+ `)}`) : logger22.info(
10927
10942
  `Upgrading from ${import_picocolors21.default.bold(storybookProjects[0].beforeVersion)} to ${import_picocolors21.default.bold(storybookProjects[0].currentCLIVersion)}`
10928
10943
  );
10929
10944
  let automigrationResults = {}, doctorResults = {}, handleInterruption = async () => {
10930
- throw logger23.log(`
10945
+ throw logger22.log(`
10931
10946
 
10932
10947
  Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgradeTelemetry({
10933
10948
  allProjects,
@@ -10940,7 +10955,7 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
10940
10955
  process.on("SIGINT", handleInterruption), process.on("SIGTERM", handleInterruption);
10941
10956
  try {
10942
10957
  if (processAutoblockerResults(storybookProjects, (message) => {
10943
- logger23.error(dedent15`Blockers detected\n\n${message}`);
10958
+ logger22.error(dedent15`Blockers detected\n\n${message}`);
10944
10959
  }))
10945
10960
  throw new HandledError5("Blockers detected");
10946
10961
  if (storybookProjects.some((project) => {
@@ -10962,7 +10977,7 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
10962
10977
  } catch (error) {
10963
10978
  if (error instanceof MinimumReleaseAgeHandledError)
10964
10979
  throw error;
10965
- logger23.debug(
10980
+ logger22.debug(
10966
10981
  `Skipping minimum-release-age precheck for ${project.configDir} after an unexpected failure: ${error}`
10967
10982
  );
10968
10983
  }
@@ -10973,7 +10988,7 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
10973
10988
  try {
10974
10989
  let loggedPaths = [];
10975
10990
  for (let project of storybookProjects) {
10976
- logger23.debug(`Updating dependencies in ${shortenPath(project.configDir)}...`);
10991
+ logger22.debug(`Updating dependencies in ${shortenPath(project.configDir)}...`);
10977
10992
  let newPaths = project.packageManager.packageJsonPaths.map(shortenPath).filter((path4) => !loggedPaths.includes(path4));
10978
10993
  newPaths.length > 0 && (task.message(newPaths.join(`
10979
10994
  `)), loggedPaths.push(...newPaths)), await upgradeStorybookDependencies({
@@ -10992,37 +11007,37 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
10992
11007
  }
10993
11008
  }
10994
11009
  let hadSkills = await hasStorybookSkills2(), automigrationResults2 = {}, detectedAutomigrations = [];
10995
- options.skipAutomigrations ? logger23.log("Skipping automigrations (--skip-automigrations).") : { automigrationResults: automigrationResults2, detectedAutomigrations } = await runAutomigrations(
11010
+ options.skipAutomigrations ? logger22.log("Skipping automigrations (--skip-automigrations).") : { automigrationResults: automigrationResults2, detectedAutomigrations } = await runAutomigrations(
10996
11011
  storybookProjects,
10997
11012
  options
10998
11013
  );
10999
11014
  let rootPackageManager = storybookProjects.length > 1 ? JsPackageManagerFactory2.getPackageManager({ force: options.packageManager }) : storybookProjects[0].packageManager;
11000
- if (rootPackageManager.type === "npm" ? await rootPackageManager.installDependencies({ force: !0 }) : await rootPackageManager.installDependencies(), rootPackageManager.type !== PackageManagerName2.YARN1 && rootPackageManager.isStorybookInMonorepo() && (logger23.warn(
11015
+ if (rootPackageManager.type === "npm" ? await rootPackageManager.installDependencies({ force: !0 }) : await rootPackageManager.installDependencies(), rootPackageManager.type !== PackageManagerName2.YARN1 && rootPackageManager.isStorybookInMonorepo() && (logger22.warn(
11001
11016
  "Since you are in a monorepo, we advise you to deduplicate your dependencies. We can do this for you but it might take some time."
11002
11017
  ), options.yes || await prompt8.confirm({
11003
11018
  message: `Execute ${rootPackageManager.getRunCommand("dedupe")}?`,
11004
11019
  initialValue: !0
11005
- }) ? rootPackageManager.type === "npm" ? await rootPackageManager.dedupeDependencies({ force: !0 }) : await rootPackageManager.dedupeDependencies() : logger23.log(
11020
+ }) ? rootPackageManager.type === "npm" ? await rootPackageManager.dedupeDependencies({ force: !0 }) : await rootPackageManager.dedupeDependencies() : logger22.log(
11006
11021
  `If you find any issues running Storybook, you can run ${rootPackageManager.getRunCommand("dedupe")} manually to deduplicate your dependencies and try again.`
11007
11022
  )), !options.dryRun && !options.skipInstall)
11008
11023
  for (let project of storybookProjects) {
11009
11024
  let addonsToPostinstall = automigrationResults2[project.configDir]?.addonsToPostinstall;
11010
11025
  if (addonsToPostinstall?.length) {
11011
- logger23.step(`Configuring addons: ${addonsToPostinstall.join(", ")}..`);
11026
+ logger22.step(`Configuring addons: ${addonsToPostinstall.join(", ")}..`);
11012
11027
  try {
11013
11028
  await configureDeferredAddons(addonsToPostinstall, {
11014
11029
  packageManager: project.packageManager.type,
11015
11030
  configDir: project.configDir,
11016
11031
  yes: options.yes,
11017
- logger: logger23,
11032
+ logger: logger22,
11018
11033
  prompt: prompt8
11019
11034
  });
11020
11035
  } catch (error) {
11021
- logger23.warn(
11036
+ logger22.warn(
11022
11037
  `Configuring ${addonsToPostinstall.join(", ")} failed: ${String(
11023
11038
  error
11024
11039
  )}. Run "npx storybook add <addon>" manually for each addon to finish the setup.`
11025
- ), logger23.debug(error instanceof Error ? error.stack ?? error.message : String(error));
11040
+ ), logger22.debug(error instanceof Error ? error.stack ?? error.message : String(error));
11026
11041
  }
11027
11042
  }
11028
11043
  }
@@ -11032,7 +11047,7 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
11032
11047
  storybookVersion: project.currentCLIVersion,
11033
11048
  mainConfig: project.mainConfig
11034
11049
  }));
11035
- logger23.step("Checking the health of your project(s).."), doctorResults = await runMultiProjectDoctor(doctorProjects), displayDoctorResults(doctorResults) && logTracker3.enableLogWriting(), logUpgradeResults(automigrationResults2, detectedAutomigrations, doctorResults);
11050
+ logger22.step("Checking the health of your project(s).."), doctorResults = await runMultiProjectDoctor(doctorProjects), displayDoctorResults(doctorResults) && logTracker3.enableLogWriting(), logUpgradeResults(automigrationResults2, detectedAutomigrations, doctorResults);
11036
11051
  for (let project of storybookProjects) {
11037
11052
  let resultData = automigrationResults2[project.configDir] || {
11038
11053
  automigrationStatuses: {},
@@ -11069,13 +11084,13 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
11069
11084
  // src/bin/run.ts
11070
11085
  addToGlobalContext("cliVersion", versions4.storybook);
11071
11086
  var handleCommandFailure = (logFilePath) => async (error) => {
11072
- error instanceof HandledError6 || logger24.error(String(error));
11087
+ error instanceof HandledError6 || logger23.error(String(error));
11073
11088
  try {
11074
11089
  let logFile = await logTracker4.writeToFile(logFilePath);
11075
- logger24.log(`Debug logs are written to: ${logFile}`);
11090
+ logger23.log(`Debug logs are written to: ${logFile}`);
11076
11091
  } catch {
11077
11092
  }
11078
- logger24.outro(""), process.exit(1);
11093
+ logger23.outro(""), process.exit(1);
11079
11094
  }, command = (name) => program.command(name).option(
11080
11095
  "--disable-telemetry",
11081
11096
  "Disable sending telemetry data",
@@ -11085,21 +11100,21 @@ var handleCommandFailure = (logFilePath) => async (error) => {
11085
11100
  "Write all debug logs to the specified file at the end of the run. Defaults to debug-storybook.log when [path] is not provided"
11086
11101
  ).option("--loglevel <trace | debug | info | warn | error | silent>", "Define log level", "info").hook("preAction", async (self2) => {
11087
11102
  let options = self2.opts();
11088
- options.debug && logger24.setLogLevel("debug"), options.loglevel && logger24.setLogLevel(options.loglevel), options.logfile && logTracker4.enableLogWriting();
11103
+ options.debug && logger23.setLogLevel("debug"), options.loglevel && logger23.setLogLevel(options.loglevel), options.logfile && logTracker4.enableLogWriting();
11089
11104
  try {
11090
11105
  await globalSettings();
11091
11106
  } catch (e) {
11092
- logger24.error(`Error loading global settings:
11107
+ logger23.error(`Error loading global settings:
11093
11108
  ` + String(e));
11094
11109
  }
11095
11110
  }).hook("postAction", async (command2) => {
11096
11111
  if (logTracker4.shouldWriteLogsToFile) {
11097
11112
  try {
11098
11113
  let logFile = await logTracker4.writeToFile(command2.getOptionValue("logfile"));
11099
- logger24.log(`Debug logs are written to: ${logFile}`);
11114
+ logger23.log(`Debug logs are written to: ${logFile}`);
11100
11115
  } catch {
11101
11116
  }
11102
- logger24.outro(CLI_COLORS5.success("Done!"));
11117
+ logger23.outro(CLI_COLORS5.success("Done!"));
11103
11118
  }
11104
11119
  });
11105
11120
  command("init").description("Initialize Storybook into your project").option("-f --force", "Force add Storybook").option("-s --skip-install", "Skip installing deps").addOption(
@@ -11116,7 +11131,7 @@ command("add <addon>").description("Add an addon to your Storybook").addOption(
11116
11131
  )
11117
11132
  ).option("-c, --config-dir <dir-name>", "Directory where to load Storybook configurations from").option("--skip-install", "Skip installing deps").option("-s --skip-postinstall", "Skip package specific postinstall config modifications").option("-y --yes", "Skip prompting the user").option("--skip-doctor", "Skip doctor check").action((addonName, options) => {
11118
11133
  withTelemetry("add", { cliOptions: options }, async () => {
11119
- logger24.intro(`Setting up your project for ${addonName}`), await add(addonName, options), await telemetry2("add", { addon: addonName, source: "cli" }), logger24.outro("Done!");
11134
+ logger23.intro(`Setting up your project for ${addonName}`), await add(addonName, options), await telemetry2("add", { addon: addonName, source: "cli" }), logger23.outro("Done!");
11120
11135
  }).catch(handleCommandFailure);
11121
11136
  });
11122
11137
  command("remove <addon>").description("Remove an addon from your Storybook").addOption(
@@ -11125,7 +11140,7 @@ command("remove <addon>").description("Remove an addon from your Storybook").add
11125
11140
  )
11126
11141
  ).option("-c, --config-dir <dir-name>", "Directory where to load Storybook configurations from").option("-s --skip-install", "Skip installing deps").action(
11127
11142
  (addonName, options) => withTelemetry("remove", { cliOptions: options }, async () => {
11128
- logger24.intro(`Removing ${addonName} from your Storybook`);
11143
+ logger23.intro(`Removing ${addonName} from your Storybook`);
11129
11144
  let packageManager = JsPackageManagerFactory3.getPackageManager({
11130
11145
  configDir: options.configDir,
11131
11146
  force: options.packageManager
@@ -11134,7 +11149,7 @@ command("remove <addon>").description("Remove an addon from your Storybook").add
11134
11149
  configDir: options.configDir,
11135
11150
  packageManager,
11136
11151
  skipInstall: options.skipInstall
11137
- }), await telemetry2("remove", { addon: addonName, source: "cli" }), logger24.outro("Done!");
11152
+ }), await telemetry2("remove", { addon: addonName, source: "cli" }), logger23.outro("Done!");
11138
11153
  }).catch(handleCommandFailure(options.logfile))
11139
11154
  );
11140
11155
  command("upgrade").description(`Upgrade your Storybook packages to v${versions4.storybook}`).addOption(
@@ -11164,12 +11179,12 @@ command("upgrade").description(`Upgrade your Storybook packages to v${versions4.
11164
11179
  "upgrade",
11165
11180
  { cliOptions: { ...options, configDir: options.configDir?.[0] } },
11166
11181
  async () => {
11167
- logger24.intro(`Storybook upgrade - v${versions4.storybook}`), await upgrade(options), logger24.outro("Storybook upgrade completed!");
11182
+ logger23.intro(`Storybook upgrade - v${versions4.storybook}`), await upgrade(options), logger23.outro("Storybook upgrade completed!");
11168
11183
  }
11169
11184
  ).catch(handleCommandFailure(options.logfile));
11170
11185
  });
11171
11186
  command("info").description("Prints debugging information about the local environment").action(async () => {
11172
- logger24.log(import_picocolors22.default.bold(`
11187
+ logger23.log(import_picocolors22.default.bold(`
11173
11188
  Storybook Environment Info:`));
11174
11189
  let activePackageManager = JsPackageManagerFactory3.getPackageManager().type.replace(/\d/, ""), output = await import_envinfo.default.run({
11175
11190
  System: ["OS", "CPU", "Shell"],
@@ -11178,7 +11193,7 @@ Storybook Environment Info:`));
11178
11193
  npmPackages: "{@storybook/*,*storybook*,sb,chromatic}",
11179
11194
  npmGlobalPackages: "{@storybook/*,*storybook*,sb,chromatic}"
11180
11195
  }), activePackageManagerLine = output.match(new RegExp(`${activePackageManager}:.*`, "i"));
11181
- logger24.log(
11196
+ logger23.log(
11182
11197
  output.replace(
11183
11198
  activePackageManagerLine,
11184
11199
  import_picocolors22.default.bold(`${activePackageManagerLine} <----- active`)
@@ -11193,12 +11208,12 @@ command("migrate [migration]").description("Run a Storybook codemod migration on
11193
11208
  'Rename suffix of matching files after codemod has been applied, e.g. ".js:.ts"'
11194
11209
  ).action((migration, options) => {
11195
11210
  withTelemetry("migrate", { cliOptions: options }, async () => {
11196
- logger24.intro(`Running ${migration} migration`), await migrate2(migration, options), logger24.outro("Migration completed");
11211
+ logger23.intro(`Running ${migration} migration`), await migrate2(migration, options), logger23.outro("Migration completed");
11197
11212
  }).catch(handleCommandFailure(options.logfile));
11198
11213
  });
11199
11214
  command("sandbox [filterValue]").alias("repro").description("Create a sandbox from a set of possible templates").option("-o --output <outDir>", "Define an output directory").option("--no-init", "Whether to download a template without an initialized Storybook", !1).action((filterValue, options) => {
11200
- logger24.intro("Creating a Storybook sandbox..."), sandbox({ filterValue, ...options }).catch(handleCommandFailure).finally(() => {
11201
- logger24.outro("Done!");
11215
+ logger23.intro("Creating a Storybook sandbox..."), sandbox({ filterValue, ...options }).catch(handleCommandFailure).finally(() => {
11216
+ logger23.outro("Done!");
11202
11217
  });
11203
11218
  });
11204
11219
  command("link <repo-url-or-directory>").description("Pull down a repro from a URL (or a local directory), link it, and run storybook").option("--local", "Link a local directory already in your file system").option("--no-start", "Start the storybook", !0).action(
@@ -11210,7 +11225,7 @@ command("automigrate [fixId]").description("Check storybook for incompatibilitie
11210
11225
  )
11211
11226
  ).option("-l --list", "List available migrations").option("-c, --config-dir <dir-name>", "Directory of Storybook configurations to migrate").option("-s --skip-install", "Skip installing deps").option("--skip-doctor", "Skip doctor check").option("--glob <pattern>", "Glob pattern for story files (for csf-factories codemod)").action(async (fixId, options) => {
11212
11227
  withTelemetry("automigrate", { cliOptions: options }, async () => {
11213
- logger24.intro(fixId ? `Running ${fixId} automigration` : "Running automigrations"), await doAutomigrate({ fixId, ...options }), logger24.outro("Done");
11228
+ logger23.intro(fixId ? `Running ${fixId} automigration` : "Running automigrations"), await doAutomigrate({ fixId, ...options }), logger23.outro("Done");
11214
11229
  }).catch(handleCommandFailure(options.logfile));
11215
11230
  });
11216
11231
  command("doctor").description("Check Storybook for known problems and provide suggestions or fixes").addOption(
@@ -11219,13 +11234,13 @@ command("doctor").description("Check Storybook for known problems and provide su
11219
11234
  )
11220
11235
  ).option("-c, --config-dir <dir-name>", "Directory of Storybook configuration").action(async (options) => {
11221
11236
  withTelemetry("doctor", { cliOptions: options }, async () => {
11222
- logger24.intro("Doctoring Storybook"), await doctor(options), logger24.outro("Done");
11237
+ logger23.intro("Doctoring Storybook"), await doctor(options), logger23.outro("Done");
11223
11238
  }).catch(handleCommandFailure(options.logfile));
11224
11239
  });
11225
11240
  program.on("command:*", ([invalidCmd]) => {
11226
11241
  let errorMessage = ` Invalid command: ${import_picocolors22.default.bold(invalidCmd)}.
11227
11242
  See --help for a list of available commands.`, suggestion = program.commands.map((cmd) => cmd.name()).find((cmd) => leven(cmd, invalidCmd) < 3);
11228
11243
  suggestion && (errorMessage += `
11229
- Did you mean ${import_picocolors22.default.yellow(suggestion)}?`), logger24.error(errorMessage), process.exit(1);
11244
+ Did you mean ${import_picocolors22.default.yellow(suggestion)}?`), logger23.error(errorMessage), process.exit(1);
11230
11245
  });
11231
11246
  program.usage("<command> [options]").version(String(version)).parse(process.argv);