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