@storybook/cli 10.0.0-beta.7 → 10.0.0-beta.8

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.
@@ -1,37 +1,42 @@
1
- import CJS_COMPAT_NODE_URL_u30nddc261 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_u30nddc261 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_u30nddc261 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0cg1pmj6ouw from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0cg1pmj6ouw from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0cg1pmj6ouw from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_u30nddc261.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_u30nddc261.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_u30nddc261.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0cg1pmj6ouw.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0cg1pmj6ouw.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0cg1pmj6ouw.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
+ bannerComment,
14
+ containsESMUsage,
15
+ containsRequireUsage,
13
16
  findFilesUp,
14
17
  getFrameworkPackageName,
15
18
  getProjects,
19
+ getRequireBanner,
16
20
  getStorybookData,
21
+ hasRequireBanner,
17
22
  processAutoblockerResults,
18
23
  require_picocolors,
19
24
  shortenPath,
20
25
  updateMainConfig,
21
26
  upgradeStorybookDependencies
22
- } from "./chunk-V76KLINZ.js";
27
+ } from "./chunk-5GK6BISL.js";
23
28
  import {
24
29
  slash
25
- } from "./chunk-354BIXJP.js";
30
+ } from "./chunk-WAFXDNPZ.js";
26
31
  import {
27
32
  require_semver
28
- } from "./chunk-XESZQZ4T.js";
33
+ } from "./chunk-DOKPKYG5.js";
29
34
  import {
30
35
  __commonJS,
31
36
  __name,
32
37
  __require,
33
38
  __toESM
34
- } from "./chunk-4QXHO755.js";
39
+ } from "./chunk-ZUZDBWGR.js";
35
40
 
36
41
  // ../../node_modules/envinfo/dist/envinfo.js
37
42
  var require_envinfo = __commonJS({
@@ -4448,22 +4453,22 @@ var require_isexe = __commonJS({
4448
4453
  // ../../node_modules/which/which.js
4449
4454
  var require_which = __commonJS({
4450
4455
  "../../node_modules/which/which.js"(exports, module) {
4451
- var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
4456
+ var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
4452
4457
  var path4 = __require("path");
4453
- var COLON = isWindows ? ";" : ":";
4458
+ var COLON = isWindows2 ? ";" : ":";
4454
4459
  var isexe = require_isexe();
4455
4460
  var getNotFoundError = /* @__PURE__ */ __name((cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), "getNotFoundError");
4456
4461
  var getPathInfo = /* @__PURE__ */ __name((cmd, opt) => {
4457
4462
  const colon = opt.colon || COLON;
4458
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
4463
+ const pathEnv = cmd.match(/\//) || isWindows2 && cmd.match(/\\/) ? [""] : [
4459
4464
  // windows always checks the cwd first
4460
- ...isWindows ? [process.cwd()] : [],
4465
+ ...isWindows2 ? [process.cwd()] : [],
4461
4466
  ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
4462
4467
  "").split(colon)
4463
4468
  ];
4464
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
4465
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
4466
- if (isWindows) {
4469
+ const pathExtExe = isWindows2 ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
4470
+ const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
4471
+ if (isWindows2) {
4467
4472
  if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
4468
4473
  pathExt.unshift("");
4469
4474
  }
@@ -4916,7 +4921,7 @@ __name(leven, "leven");
4916
4921
  var import_picocolors17 = __toESM(require_picocolors(), 1);
4917
4922
 
4918
4923
  // package.json
4919
- var version = "10.0.0-beta.7";
4924
+ var version = "10.0.0-beta.8";
4920
4925
 
4921
4926
  // src/add.ts
4922
4927
  var import_semver = __toESM(require_semver(), 1);
@@ -5009,10 +5014,13 @@ function getAbsolutePathWrapperAsCallExpression(isConfigTypescript) {
5009
5014
  t.identifier("resolve")
5010
5015
  ),
5011
5016
  [
5012
- t.callExpression(t.identifier("join"), [
5013
- t.identifier("value"),
5014
- t.stringLiteral("package.json")
5015
- ])
5017
+ t.templateLiteral(
5018
+ [
5019
+ t.templateElement({ raw: "" }),
5020
+ t.templateElement({ raw: "/package.json" }, true)
5021
+ ],
5022
+ [t.identifier("value")]
5023
+ )
5016
5024
  ]
5017
5025
  )
5018
5026
  ])
@@ -5064,6 +5072,314 @@ import { createRequire, register } from "node:module";
5064
5072
  import { win32 } from "node:path/win32";
5065
5073
  import { fileURLToPath, pathToFileURL } from "node:url";
5066
5074
 
5075
+ // ../../node_modules/exsolve/dist/index.mjs
5076
+ import assert from "node:assert";
5077
+ import v8 from "node:v8";
5078
+ import { format, inspect } from "node:util";
5079
+ var own$1 = {}.hasOwnProperty;
5080
+ var classRegExp = /^([A-Z][a-z\d]*)+$/;
5081
+ var kTypes = /* @__PURE__ */ new Set([
5082
+ "string",
5083
+ "function",
5084
+ "number",
5085
+ "object",
5086
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
5087
+ "Function",
5088
+ "Object",
5089
+ "boolean",
5090
+ "bigint",
5091
+ "symbol"
5092
+ ]);
5093
+ var messages = /* @__PURE__ */ new Map();
5094
+ var nodeInternalPrefix = "__node_internal_";
5095
+ var userStackTraceLimit;
5096
+ function formatList(array2, type = "and") {
5097
+ return array2.length < 3 ? array2.join(` ${type} `) : `${array2.slice(0, -1).join(", ")}, ${type} ${array2.at(-1)}`;
5098
+ }
5099
+ __name(formatList, "formatList");
5100
+ function createError(sym, value, constructor) {
5101
+ messages.set(sym, value);
5102
+ return makeNodeErrorWithCode(constructor, sym);
5103
+ }
5104
+ __name(createError, "createError");
5105
+ function makeNodeErrorWithCode(Base, key) {
5106
+ return /* @__PURE__ */ __name(function NodeError(...parameters) {
5107
+ const limit = Error.stackTraceLimit;
5108
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
5109
+ const error = new Base();
5110
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
5111
+ const message = getMessage(key, parameters, error);
5112
+ Object.defineProperties(error, {
5113
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
5114
+ // probably.
5115
+ message: {
5116
+ value: message,
5117
+ enumerable: false,
5118
+ writable: true,
5119
+ configurable: true
5120
+ },
5121
+ toString: {
5122
+ /** @this {Error} */
5123
+ value() {
5124
+ return `${this.name} [${key}]: ${this.message}`;
5125
+ },
5126
+ enumerable: false,
5127
+ writable: true,
5128
+ configurable: true
5129
+ }
5130
+ });
5131
+ captureLargerStackTrace(error);
5132
+ error.code = key;
5133
+ return error;
5134
+ }, "NodeError");
5135
+ }
5136
+ __name(makeNodeErrorWithCode, "makeNodeErrorWithCode");
5137
+ function isErrorStackTraceLimitWritable() {
5138
+ try {
5139
+ if (v8.startupSnapshot.isBuildingSnapshot()) {
5140
+ return false;
5141
+ }
5142
+ } catch {
5143
+ }
5144
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
5145
+ if (desc === void 0) {
5146
+ return Object.isExtensible(Error);
5147
+ }
5148
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
5149
+ }
5150
+ __name(isErrorStackTraceLimitWritable, "isErrorStackTraceLimitWritable");
5151
+ function hideStackFrames(wrappedFunction) {
5152
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
5153
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
5154
+ return wrappedFunction;
5155
+ }
5156
+ __name(hideStackFrames, "hideStackFrames");
5157
+ var captureLargerStackTrace = hideStackFrames(function(error) {
5158
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
5159
+ if (stackTraceLimitIsWritable) {
5160
+ userStackTraceLimit = Error.stackTraceLimit;
5161
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
5162
+ }
5163
+ Error.captureStackTrace(error);
5164
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
5165
+ return error;
5166
+ });
5167
+ function getMessage(key, parameters, self2) {
5168
+ const message = messages.get(key);
5169
+ assert(message !== void 0, "expected `message` to be found");
5170
+ if (typeof message === "function") {
5171
+ assert(
5172
+ message.length <= parameters.length,
5173
+ // Default options do not count.
5174
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
5175
+ );
5176
+ return Reflect.apply(message, self2, parameters);
5177
+ }
5178
+ const regex = /%[dfijoOs]/g;
5179
+ let expectedLength = 0;
5180
+ while (regex.exec(message) !== null) expectedLength++;
5181
+ assert(
5182
+ expectedLength === parameters.length,
5183
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
5184
+ );
5185
+ if (parameters.length === 0) return message;
5186
+ parameters.unshift(message);
5187
+ return Reflect.apply(format, null, parameters);
5188
+ }
5189
+ __name(getMessage, "getMessage");
5190
+ function determineSpecificType(value) {
5191
+ if (value === null || value === void 0) {
5192
+ return String(value);
5193
+ }
5194
+ if (typeof value === "function" && value.name) {
5195
+ return `function ${value.name}`;
5196
+ }
5197
+ if (typeof value === "object") {
5198
+ if (value.constructor && value.constructor.name) {
5199
+ return `an instance of ${value.constructor.name}`;
5200
+ }
5201
+ return `${inspect(value, { depth: -1 })}`;
5202
+ }
5203
+ let inspected = inspect(value, { colors: false });
5204
+ if (inspected.length > 28) {
5205
+ inspected = `${inspected.slice(0, 25)}...`;
5206
+ }
5207
+ return `type ${typeof value} (${inspected})`;
5208
+ }
5209
+ __name(determineSpecificType, "determineSpecificType");
5210
+ createError(
5211
+ "ERR_INVALID_ARG_TYPE",
5212
+ (name, expected, actual) => {
5213
+ assert(typeof name === "string", "'name' must be a string");
5214
+ if (!Array.isArray(expected)) {
5215
+ expected = [expected];
5216
+ }
5217
+ let message = "The ";
5218
+ if (name.endsWith(" argument")) {
5219
+ message += `${name} `;
5220
+ } else {
5221
+ const type = name.includes(".") ? "property" : "argument";
5222
+ message += `"${name}" ${type} `;
5223
+ }
5224
+ message += "must be ";
5225
+ const types = [];
5226
+ const instances = [];
5227
+ const other = [];
5228
+ for (const value of expected) {
5229
+ assert(
5230
+ typeof value === "string",
5231
+ "All expected entries have to be of type string"
5232
+ );
5233
+ if (kTypes.has(value)) {
5234
+ types.push(value.toLowerCase());
5235
+ } else if (classRegExp.exec(value) === null) {
5236
+ assert(
5237
+ value !== "object",
5238
+ 'The value "object" should be written as "Object"'
5239
+ );
5240
+ other.push(value);
5241
+ } else {
5242
+ instances.push(value);
5243
+ }
5244
+ }
5245
+ if (instances.length > 0) {
5246
+ const pos = types.indexOf("object");
5247
+ if (pos !== -1) {
5248
+ types.slice(pos, 1);
5249
+ instances.push("Object");
5250
+ }
5251
+ }
5252
+ if (types.length > 0) {
5253
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
5254
+ types,
5255
+ "or"
5256
+ )}`;
5257
+ if (instances.length > 0 || other.length > 0) message += " or ";
5258
+ }
5259
+ if (instances.length > 0) {
5260
+ message += `an instance of ${formatList(instances, "or")}`;
5261
+ if (other.length > 0) message += " or ";
5262
+ }
5263
+ if (other.length > 0) {
5264
+ if (other.length > 1) {
5265
+ message += `one of ${formatList(other, "or")}`;
5266
+ } else {
5267
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
5268
+ message += `${other[0]}`;
5269
+ }
5270
+ }
5271
+ message += `. Received ${determineSpecificType(actual)}`;
5272
+ return message;
5273
+ },
5274
+ TypeError
5275
+ );
5276
+ var ERR_INVALID_MODULE_SPECIFIER = createError(
5277
+ "ERR_INVALID_MODULE_SPECIFIER",
5278
+ /**
5279
+ * @param {string} request
5280
+ * @param {string} reason
5281
+ * @param {string} [base]
5282
+ */
5283
+ (request, reason, base) => {
5284
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
5285
+ },
5286
+ TypeError
5287
+ );
5288
+ var ERR_INVALID_PACKAGE_CONFIG = createError(
5289
+ "ERR_INVALID_PACKAGE_CONFIG",
5290
+ (path4, base, message) => {
5291
+ return `Invalid package config ${path4}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
5292
+ },
5293
+ Error
5294
+ );
5295
+ var ERR_INVALID_PACKAGE_TARGET = createError(
5296
+ "ERR_INVALID_PACKAGE_TARGET",
5297
+ (packagePath, key, target, isImport = false, base) => {
5298
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
5299
+ if (key === ".") {
5300
+ assert(isImport === false);
5301
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
5302
+ }
5303
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
5304
+ target
5305
+ )} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
5306
+ },
5307
+ Error
5308
+ );
5309
+ var ERR_MODULE_NOT_FOUND = createError(
5310
+ "ERR_MODULE_NOT_FOUND",
5311
+ (path4, base, exactUrl = false) => {
5312
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path4}' imported from ${base}`;
5313
+ },
5314
+ Error
5315
+ );
5316
+ createError(
5317
+ "ERR_NETWORK_IMPORT_DISALLOWED",
5318
+ "import of '%s' by %s is not supported: %s",
5319
+ Error
5320
+ );
5321
+ var ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
5322
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
5323
+ (specifier, packagePath, base) => {
5324
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
5325
+ },
5326
+ TypeError
5327
+ );
5328
+ var ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
5329
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
5330
+ /**
5331
+ * @param {string} packagePath
5332
+ * @param {string} subpath
5333
+ * @param {string} [base]
5334
+ */
5335
+ (packagePath, subpath, base) => {
5336
+ if (subpath === ".")
5337
+ return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
5338
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
5339
+ },
5340
+ Error
5341
+ );
5342
+ var ERR_UNSUPPORTED_DIR_IMPORT = createError(
5343
+ "ERR_UNSUPPORTED_DIR_IMPORT",
5344
+ "Directory import '%s' is not supported resolving ES modules imported from %s",
5345
+ Error
5346
+ );
5347
+ var ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
5348
+ "ERR_UNSUPPORTED_RESOLVE_REQUEST",
5349
+ 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
5350
+ TypeError
5351
+ );
5352
+ var ERR_UNKNOWN_FILE_EXTENSION = createError(
5353
+ "ERR_UNKNOWN_FILE_EXTENSION",
5354
+ (extension, path4) => {
5355
+ return `Unknown file extension "${extension}" for ${path4}`;
5356
+ },
5357
+ TypeError
5358
+ );
5359
+ createError(
5360
+ "ERR_INVALID_ARG_VALUE",
5361
+ (name, value, reason = "is invalid") => {
5362
+ let inspected = inspect(value);
5363
+ if (inspected.length > 128) {
5364
+ inspected = `${inspected.slice(0, 128)}...`;
5365
+ }
5366
+ const type = name.includes(".") ? "property" : "argument";
5367
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
5368
+ },
5369
+ TypeError
5370
+ // Note: extra classes have been shaken out.
5371
+ // , RangeError
5372
+ );
5373
+ var hasOwnProperty$1 = {}.hasOwnProperty;
5374
+ var hasOwnProperty = {}.hasOwnProperty;
5375
+ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
5376
+ var own = {}.hasOwnProperty;
5377
+ var isWindows = (() => process.platform === "win32")();
5378
+ var globalCache = (() => (
5379
+ // eslint-disable-next-line unicorn/no-unreadable-iife
5380
+ globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map()
5381
+ ))();
5382
+
5067
5383
  // ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
5068
5384
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
5069
5385
  function normalizeWindowsPath(input = "") {
@@ -5387,7 +5703,7 @@ function invariant(condition, message) {
5387
5703
  __name(invariant, "invariant");
5388
5704
 
5389
5705
  // src/automigrate/index.ts
5390
- import { dedent as dedent12 } from "ts-dedent";
5706
+ import { dedent as dedent13 } from "ts-dedent";
5391
5707
 
5392
5708
  // src/doctor/index.ts
5393
5709
  var import_picocolors4 = __toESM(require_picocolors(), 1);
@@ -5456,7 +5772,7 @@ function getDuplicatedDepsWarnings(installationMetadata) {
5456
5772
  if (!installationMetadata || !installationMetadata?.duplicatedDependencies || Object.keys(installationMetadata.duplicatedDependencies).length === 0) {
5457
5773
  return void 0;
5458
5774
  }
5459
- const messages = [];
5775
+ const messages2 = [];
5460
5776
  const { critical, trivial } = Object.entries(
5461
5777
  installationMetadata?.duplicatedDependencies
5462
5778
  ).reduce(
@@ -5479,37 +5795,37 @@ ${packageVersions.join(", ")}`);
5479
5795
  { critical: [], trivial: [] }
5480
5796
  );
5481
5797
  if (critical.length === 0 && trivial.length === 0) {
5482
- return messages;
5798
+ return messages2;
5483
5799
  }
5484
5800
  if (critical.length > 0) {
5485
- messages.push(
5801
+ messages2.push(
5486
5802
  `${import_picocolors.default.bold(
5487
5803
  "Critical:"
5488
5804
  )} The following dependencies are duplicated and WILL cause unexpected behavior:`
5489
5805
  );
5490
- messages.push(critical.join(messageDivider), "\n");
5806
+ messages2.push(critical.join(messageDivider), "\n");
5491
5807
  }
5492
5808
  if (trivial.length > 0) {
5493
- messages.push(
5809
+ messages2.push(
5494
5810
  `${import_picocolors.default.bold(
5495
5811
  "Attention:"
5496
5812
  )} The following dependencies are duplicated which might cause unexpected behavior:`
5497
5813
  );
5498
- messages.push(trivial.join(messageDivider));
5814
+ messages2.push(trivial.join(messageDivider));
5499
5815
  }
5500
- messages.push(
5816
+ messages2.push(
5501
5817
  "\n",
5502
5818
  `Please try de-duplicating these dependencies by running ${import_picocolors.default.cyan(
5503
5819
  `${installationMetadata.dedupeCommand}`
5504
5820
  )}`
5505
5821
  );
5506
- messages.push(
5822
+ messages2.push(
5507
5823
  "\n",
5508
5824
  `You can find more information for a given dependency by running ${import_picocolors.default.cyan(
5509
5825
  `${installationMetadata.infoCommand} <package-name>`
5510
5826
  )}`
5511
5827
  );
5512
- return messages;
5828
+ return messages2;
5513
5829
  } catch (err) {
5514
5830
  return void 0;
5515
5831
  }
@@ -5684,7 +6000,7 @@ function getMismatchingVersionsWarnings(installationMetadata) {
5684
6000
  if (!installationMetadata) {
5685
6001
  return void 0;
5686
6002
  }
5687
- const messages = [];
6003
+ const messages2 = [];
5688
6004
  try {
5689
6005
  const frameworkPackageName = Object.keys(installationMetadata?.dependencies || []).find(
5690
6006
  (packageName) => {
@@ -5696,7 +6012,7 @@ function getMismatchingVersionsWarnings(installationMetadata) {
5696
6012
  if (!cliVersion || !frameworkVersion || import_semver4.default.eq(cliVersion, frameworkVersion)) {
5697
6013
  return void 0;
5698
6014
  }
5699
- messages.push(
6015
+ messages2.push(
5700
6016
  `${import_picocolors3.default.bold(
5701
6017
  "Attention:"
5702
6018
  )} There seems to be a mismatch between your Storybook package versions. This can result in a broken Storybook installation.`
@@ -5710,7 +6026,7 @@ function getMismatchingVersionsWarnings(installationMetadata) {
5710
6026
  versionToCompare = cliVersion;
5711
6027
  packageToDisplay = "storybook";
5712
6028
  }
5713
- messages.push(
6029
+ messages2.push(
5714
6030
  `The version of your storybook core packages should align with ${import_picocolors3.default.yellow(
5715
6031
  versionToCompare
5716
6032
  )} (from the ${import_picocolors3.default.cyan(packageToDisplay)} package) or higher.`
@@ -5725,17 +6041,17 @@ function getMismatchingVersionsWarnings(installationMetadata) {
5725
6041
  }
5726
6042
  );
5727
6043
  if (filteredDependencies.length > 0) {
5728
- messages.push(
6044
+ messages2.push(
5729
6045
  `Based on your lockfile, these dependencies should be aligned:`,
5730
6046
  filteredDependencies.map(([name, dep]) => `${import_picocolors3.default.yellow(name)}: ${dep[0].version}`).join("\n")
5731
6047
  );
5732
6048
  }
5733
- messages.push(
6049
+ messages2.push(
5734
6050
  `You can run ${import_picocolors3.default.cyan("npx storybook@latest upgrade")} to upgrade all of your Storybook packages to the latest version.
5735
6051
 
5736
6052
  Alternatively you can try manually changing the versions to match in your package.json. We also recommend regenerating your lockfile, or running the following command to possibly deduplicate your Storybook package versions: ${import_picocolors3.default.cyan(installationMetadata?.dedupeCommand)}`
5737
6053
  );
5738
- return messages.join("\n\n");
6054
+ return messages2.join("\n\n");
5739
6055
  } catch (err) {
5740
6056
  return void 0;
5741
6057
  }
@@ -6016,7 +6332,7 @@ async function collectDoctorResultsByProject(projectOptions) {
6016
6332
  try {
6017
6333
  const checkResults = await getDoctorDiagnostics(options);
6018
6334
  const diagnostics = {};
6019
- const messages = {};
6335
+ const messages2 = {};
6020
6336
  Object.values(DiagnosticType).forEach((type) => {
6021
6337
  diagnostics[type] = "passed" /* PASSED */;
6022
6338
  });
@@ -6030,30 +6346,30 @@ async function collectDoctorResultsByProject(projectOptions) {
6030
6346
  diagnostics[checkResult.type] = "has_issues" /* HAS_ISSUES */;
6031
6347
  hasIssues = true;
6032
6348
  }
6033
- messages[checkResult.type] = checkResult.message;
6349
+ messages2[checkResult.type] = checkResult.message;
6034
6350
  }
6035
6351
  const status = hasErrors ? "check_error" : hasIssues ? "has_issues" : "healthy";
6036
6352
  projectResults[configDir] = {
6037
6353
  configDir,
6038
6354
  status,
6039
6355
  diagnostics,
6040
- messages
6356
+ messages: messages2
6041
6357
  };
6042
6358
  } catch (error) {
6043
6359
  logger2.error(`Failed to run doctor checks for project ${configDir}:
6044
6360
  ${error}`);
6045
6361
  const diagnostics = {};
6046
- const messages = {};
6362
+ const messages2 = {};
6047
6363
  Object.values(DiagnosticType).forEach((type) => {
6048
6364
  diagnostics[type] = "passed" /* PASSED */;
6049
6365
  });
6050
6366
  diagnostics["configuration_error" /* CONFIGURATION_ERROR */] = "check_error" /* CHECK_ERROR */;
6051
- messages["configuration_error" /* CONFIGURATION_ERROR */] = `Failed to run doctor checks: ${error instanceof Error ? error.message : String(error)}`;
6367
+ messages2["configuration_error" /* CONFIGURATION_ERROR */] = `Failed to run doctor checks: ${error instanceof Error ? error.message : String(error)}`;
6052
6368
  projectResults[configDir] = {
6053
6369
  configDir,
6054
6370
  status: "check_error",
6055
6371
  diagnostics,
6056
- messages
6372
+ messages: messages2
6057
6373
  };
6058
6374
  }
6059
6375
  }
@@ -6081,7 +6397,7 @@ async function runCodemod(globPattern = "**/*.stories.*", transform, { dryRun =
6081
6397
  let modifiedCount = 0;
6082
6398
  let unmodifiedCount = 0;
6083
6399
  let errorCount = 0;
6084
- const { globby } = await import("./globby-ABJQTAFV.js");
6400
+ const { globby } = await import("./globby-475IGOM2.js");
6085
6401
  const files = await globby(slash(globPattern), {
6086
6402
  followSymbolicLinks: true,
6087
6403
  ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**", "**/build/**"]
@@ -6095,7 +6411,7 @@ Please try a different pattern.
6095
6411
  throw new Error("No files matched");
6096
6412
  }
6097
6413
  try {
6098
- const pLimit = (await import("./p-limit-AYJDCWBB.js")).default;
6414
+ const pLimit = (await import("./p-limit-OZUVCRX2.js")).default;
6099
6415
  const limit = pLimit(maxConcurrentTasks);
6100
6416
  await Promise.all(
6101
6417
  files.map(
@@ -7098,7 +7414,7 @@ var addonA11yParameters = {
7098
7414
  }
7099
7415
  }
7100
7416
  }
7101
- const { default: pLimit } = await import("./p-limit-AYJDCWBB.js");
7417
+ const { default: pLimit } = await import("./p-limit-OZUVCRX2.js");
7102
7418
  const limit = pLimit(10);
7103
7419
  await Promise.all(
7104
7420
  storyFilesToUpdate.map(
@@ -7344,7 +7660,7 @@ function transformPackageJson(content) {
7344
7660
  __name(transformPackageJson, "transformPackageJson");
7345
7661
  var transformPackageJsonFiles = /* @__PURE__ */ __name(async (files, dryRun) => {
7346
7662
  const errors = [];
7347
- const { default: pLimit } = await import("./p-limit-AYJDCWBB.js");
7663
+ const { default: pLimit } = await import("./p-limit-OZUVCRX2.js");
7348
7664
  const limit = pLimit(10);
7349
7665
  await Promise.all(
7350
7666
  files.map(
@@ -7406,11 +7722,22 @@ var consolidatedImports = {
7406
7722
  dryRun
7407
7723
  );
7408
7724
  errors.push(...packageJsonErrors);
7409
- const { globby } = await import("./globby-ABJQTAFV.js");
7725
+ const { globby } = await import("./globby-475IGOM2.js");
7410
7726
  const configFiles = await globby([`${configDir}/**/*`]);
7411
7727
  const importErrors = await transformImportFiles(
7412
7728
  [...storiesPaths, ...configFiles].filter(Boolean),
7413
- consolidatedPackages,
7729
+ {
7730
+ ...consolidatedPackages,
7731
+ "storybook/internal/manager-api": "storybook/manager-api",
7732
+ "storybook/internal/preview-api": "storybook/preview-api",
7733
+ "storybook/internal/theming": "storybook/theming",
7734
+ "storybook/internal/theming/create": "storybook/theming/create",
7735
+ "storybook/internal/test": "storybook/test",
7736
+ "storybook/internal/actions": "storybook/internal/actions",
7737
+ "storybook/internal/actions/decorator": "storybook/internal/actions/decorator",
7738
+ "storybook/internal/highlight": "storybook/internal/highlight",
7739
+ "storybook/internal/viewport": "storybook/internal/viewport"
7740
+ },
7414
7741
  !!dryRun
7415
7742
  );
7416
7743
  errors.push(...importErrors);
@@ -7484,9 +7811,49 @@ var eslintPlugin = {
7484
7811
  }
7485
7812
  };
7486
7813
 
7814
+ // src/automigrate/fixes/fix-faux-esm-require.ts
7815
+ import { readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
7816
+ import { dedent as dedent8 } from "ts-dedent";
7817
+ var fixFauxEsmRequire = {
7818
+ id: "fix-faux-esm-require",
7819
+ link: "https://storybook.js.org/docs/faq#how-do-i-fix-module-resolution-in-special-environments",
7820
+ async check({ mainConfigPath }) {
7821
+ if (!mainConfigPath) {
7822
+ return null;
7823
+ }
7824
+ const content = await readFile3(mainConfigPath, "utf-8");
7825
+ const isESM = containsESMUsage(content);
7826
+ const isWithRequire = containsRequireUsage(content);
7827
+ const isWithBanner = hasRequireBanner(content);
7828
+ if (!isESM) {
7829
+ return null;
7830
+ }
7831
+ if (isWithBanner) {
7832
+ return null;
7833
+ }
7834
+ if (!isWithRequire) {
7835
+ return null;
7836
+ }
7837
+ return true;
7838
+ },
7839
+ prompt() {
7840
+ return dedent8`Main config is ESM but uses 'require'. This will break in Storybook 10; Adding compatibility banner`;
7841
+ },
7842
+ async run({ dryRun, mainConfigPath }) {
7843
+ if (dryRun) {
7844
+ return;
7845
+ }
7846
+ const content = await readFile3(mainConfigPath, "utf-8");
7847
+ const banner = getRequireBanner();
7848
+ const comment = bannerComment;
7849
+ const newContent = [banner, comment, content].join("\n");
7850
+ await writeFile2(mainConfigPath, newContent);
7851
+ }
7852
+ };
7853
+
7487
7854
  // src/automigrate/fixes/initial-globals.ts
7488
7855
  var import_picocolors10 = __toESM(require_picocolors(), 1);
7489
- import { readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
7856
+ import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
7490
7857
  import { formatConfig as formatConfig2, loadConfig as loadConfig4 } from "storybook/internal/csf-tools";
7491
7858
  var initialGlobals = {
7492
7859
  id: "initial-globals",
@@ -7495,7 +7862,7 @@ var initialGlobals = {
7495
7862
  if (!previewConfigPath) {
7496
7863
  return null;
7497
7864
  }
7498
- const previewConfig = loadConfig4((await readFile3(previewConfigPath)).toString()).parse();
7865
+ const previewConfig = loadConfig4((await readFile4(previewConfigPath)).toString()).parse();
7499
7866
  const globals = previewConfig.getFieldNode(["globals"]);
7500
7867
  if (!globals) {
7501
7868
  return null;
@@ -7509,7 +7876,7 @@ var initialGlobals = {
7509
7876
  result.previewConfig.removeField(["globals"]);
7510
7877
  result.previewConfig.setFieldNode(["initialGlobals"], result.globals);
7511
7878
  if (!dryRun) {
7512
- await writeFile2(result.previewConfigPath, formatConfig2(result.previewConfig));
7879
+ await writeFile3(result.previewConfigPath, formatConfig2(result.previewConfig));
7513
7880
  }
7514
7881
  }
7515
7882
  };
@@ -7925,7 +8292,7 @@ ${errors.map(({ file, error }) => `- ${file}: ${error.message}`).join("\n")}`
7925
8292
  };
7926
8293
 
7927
8294
  // src/automigrate/fixes/renderer-to-framework.ts
7928
- import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
8295
+ import { readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
7929
8296
  import {
7930
8297
  frameworkPackages as frameworkPackages3,
7931
8298
  frameworkToRenderer,
@@ -7948,16 +8315,16 @@ var replaceImports = /* @__PURE__ */ __name((source, renderer, framework) => {
7948
8315
  }, "replaceImports");
7949
8316
  var transformSourceFiles = /* @__PURE__ */ __name(async (files, renderer, framework, dryRun) => {
7950
8317
  const errors = [];
7951
- const { default: pLimit } = await import("./p-limit-AYJDCWBB.js");
8318
+ const { default: pLimit } = await import("./p-limit-OZUVCRX2.js");
7952
8319
  const limit = pLimit(10);
7953
8320
  await Promise.all(
7954
8321
  files.map(
7955
8322
  (file) => limit(async () => {
7956
8323
  try {
7957
- const contents = await readFile4(file, "utf-8");
8324
+ const contents = await readFile5(file, "utf-8");
7958
8325
  const transformed = replaceImports(contents, renderer, framework);
7959
8326
  if (!dryRun && transformed) {
7960
- await writeFile3(file, transformed);
8327
+ await writeFile4(file, transformed);
7961
8328
  }
7962
8329
  } catch (error) {
7963
8330
  errors.push({ file, error });
@@ -7969,7 +8336,7 @@ var transformSourceFiles = /* @__PURE__ */ __name(async (files, renderer, framew
7969
8336
  }, "transformSourceFiles");
7970
8337
  var removeRendererInPackageJson = /* @__PURE__ */ __name(async (packageJsonPath, renderer, dryRun) => {
7971
8338
  try {
7972
- const content = await readFile4(packageJsonPath, "utf-8");
8339
+ const content = await readFile5(packageJsonPath, "utf-8");
7973
8340
  const packageJson = JSON.parse(content);
7974
8341
  let hasChanges = false;
7975
8342
  if (packageJson.dependencies?.[renderer]) {
@@ -7981,7 +8348,7 @@ var removeRendererInPackageJson = /* @__PURE__ */ __name(async (packageJsonPath,
7981
8348
  hasChanges = true;
7982
8349
  }
7983
8350
  if (!dryRun && hasChanges) {
7984
- await writeFile3(packageJsonPath, JSON.stringify(packageJson, null, 2));
8351
+ await writeFile4(packageJsonPath, JSON.stringify(packageJson, null, 2));
7985
8352
  }
7986
8353
  return hasChanges;
7987
8354
  } catch (error) {
@@ -7989,7 +8356,7 @@ var removeRendererInPackageJson = /* @__PURE__ */ __name(async (packageJsonPath,
7989
8356
  }
7990
8357
  }, "removeRendererInPackageJson");
7991
8358
  var checkPackageJson = /* @__PURE__ */ __name(async (packageJsonPath) => {
7992
- const content = await readFile4(packageJsonPath, "utf-8");
8359
+ const content = await readFile5(packageJsonPath, "utf-8");
7993
8360
  const packageJson = JSON.parse(content);
7994
8361
  const dependencies = getAllDependencies(packageJson);
7995
8362
  const frameworks = detectFrameworks(dependencies);
@@ -8050,7 +8417,7 @@ var rendererToFramework = {
8050
8417
  }
8051
8418
  logger12.debug(`
8052
8419
  Migrating ${rendererPackage} to ${selectedFramework}`);
8053
- const { globby } = await import("./globby-ABJQTAFV.js");
8420
+ const { globby } = await import("./globby-475IGOM2.js");
8054
8421
  const configFiles = await globby([`${configDir}/**/*`]);
8055
8422
  await transformSourceFiles(
8056
8423
  [...storiesPaths, ...configFiles].filter(Boolean),
@@ -8070,14 +8437,14 @@ Migrating ${rendererPackage} to ${selectedFramework}`);
8070
8437
 
8071
8438
  // src/automigrate/fixes/rnstorybook-config.ts
8072
8439
  import { existsSync as existsSync2 } from "node:fs";
8073
- import { readFile as readFile5, rename, writeFile as writeFile4 } from "node:fs/promises";
8440
+ import { readFile as readFile6, rename, writeFile as writeFile5 } from "node:fs/promises";
8074
8441
  import { join as join2 } from "node:path";
8075
- import { dedent as dedent8 } from "ts-dedent";
8442
+ import { dedent as dedent9 } from "ts-dedent";
8076
8443
  async function renameInFile(filePath, oldText, newText) {
8077
8444
  try {
8078
- const content = await readFile5(filePath, "utf8");
8445
+ const content = await readFile6(filePath, "utf8");
8079
8446
  const updatedContent = content.replaceAll(oldText, newText);
8080
- await writeFile4(filePath, updatedContent, "utf8");
8447
+ await writeFile5(filePath, updatedContent, "utf8");
8081
8448
  } catch (error) {
8082
8449
  console.error(`Error updating references in ${filePath}:`, error);
8083
8450
  }
@@ -8085,8 +8452,8 @@ async function renameInFile(filePath, oldText, newText) {
8085
8452
  __name(renameInFile, "renameInFile");
8086
8453
  var getDotStorybookReferences = /* @__PURE__ */ __name(async (searchDir) => {
8087
8454
  try {
8088
- const { globby } = await import("./globby-ABJQTAFV.js");
8089
- const { readFile: readFile7 } = await import("node:fs/promises");
8455
+ const { globby } = await import("./globby-475IGOM2.js");
8456
+ const { readFile: readFile8 } = await import("node:fs/promises");
8090
8457
  const files = await globby(`${searchDir}/**/*`, {
8091
8458
  onlyFiles: true,
8092
8459
  gitignore: true
@@ -8095,7 +8462,7 @@ var getDotStorybookReferences = /* @__PURE__ */ __name(async (searchDir) => {
8095
8462
  await Promise.all(
8096
8463
  files.map(async (file) => {
8097
8464
  try {
8098
- const content = await readFile7(file, "utf8");
8465
+ const content = await readFile8(file, "utf8");
8099
8466
  if (content.includes(".storybook")) {
8100
8467
  referencedFiles.push(file);
8101
8468
  }
@@ -8120,7 +8487,7 @@ var rnstorybookConfig = {
8120
8487
  const projectDir = mainConfigPath ? join2(mainConfigPath, "..", "..") : process.cwd();
8121
8488
  const storybookDir = join2(projectDir, ".storybook");
8122
8489
  const rnStorybookDir = join2(projectDir, ".rnstorybook");
8123
- const { globby } = await import("./globby-ABJQTAFV.js");
8490
+ const { globby } = await import("./globby-475IGOM2.js");
8124
8491
  const requiresFiles = await globby(join2(storybookDir, "storybook.requires.*"));
8125
8492
  if (existsSync2(storybookDir) && requiresFiles.length > 0 && !existsSync2(rnStorybookDir)) {
8126
8493
  return { storybookDir, rnStorybookDir };
@@ -8128,7 +8495,7 @@ var rnstorybookConfig = {
8128
8495
  return null;
8129
8496
  },
8130
8497
  prompt() {
8131
- return dedent8`We'll rename your .storybook directory to .rnstorybook and update all references to it.`;
8498
+ return dedent9`We'll rename your .storybook directory to .rnstorybook and update all references to it.`;
8132
8499
  },
8133
8500
  async run({ result: { storybookDir, rnStorybookDir }, dryRun, packageManager }) {
8134
8501
  const instanceDir = packageManager.instanceDir;
@@ -8150,7 +8517,7 @@ import { readFileSync as readFileSync4 } from "node:fs";
8150
8517
  import { dirname as dirname2 } from "node:path";
8151
8518
  import { isCorePackage, isSatelliteAddon } from "storybook/internal/common";
8152
8519
  import { logger as logger13 } from "storybook/internal/node-logger";
8153
- import { dedent as dedent9 } from "ts-dedent";
8520
+ import { dedent as dedent10 } from "ts-dedent";
8154
8521
  async function getLatestVersions(packageManager, packages) {
8155
8522
  return Promise.all(
8156
8523
  packages.map(async ([packageName]) => ({
@@ -8206,7 +8573,7 @@ var upgradeStorybookRelatedDependencies = {
8206
8573
  },
8207
8574
  async run({ result: { upgradable }, packageManager, dryRun }) {
8208
8575
  if (dryRun) {
8209
- logger13.log(dedent9`
8576
+ logger13.log(dedent10`
8210
8577
  The following would have been upgraded:
8211
8578
  ${upgradable.map(
8212
8579
  ({ packageName, afterVersion, beforeVersion }) => `${packageName}: ${beforeVersion} => ${afterVersion}`
@@ -8243,7 +8610,7 @@ var upgradeStorybookRelatedDependencies = {
8243
8610
  import { detectPnp } from "storybook/internal/cli";
8244
8611
  import { readConfig as readConfig3 } from "storybook/internal/csf-tools";
8245
8612
  import { CommonJsConfigNotSupportedError } from "storybook/internal/server-errors";
8246
- import { dedent as dedent10 } from "ts-dedent";
8613
+ import { dedent as dedent11 } from "ts-dedent";
8247
8614
  var wrapGetAbsolutePath = {
8248
8615
  id: "wrap-getAbsolutePath",
8249
8616
  link: "https://storybook.js.org/docs/faq#how-do-i-fix-module-resolution-in-special-environments",
@@ -8266,7 +8633,7 @@ var wrapGetAbsolutePath = {
8266
8633
  return { storybookVersion, isStorybookInMonorepo, isPnp, isConfigTypescript };
8267
8634
  },
8268
8635
  prompt() {
8269
- return dedent10`We have detected that you're using Storybook in a monorepo or PnP project. Some fields in your main config must be updated.`;
8636
+ return dedent11`We have detected that you're using Storybook in a monorepo or PnP project. Some fields in your main config must be updated.`;
8270
8637
  },
8271
8638
  async run({ dryRun, mainConfigPath, result }) {
8272
8639
  await updateMainConfig({ dryRun: !!dryRun, mainConfigPath }, (mainConfig) => {
@@ -8277,7 +8644,7 @@ var wrapGetAbsolutePath = {
8277
8644
  if (mainConfig?.fileName?.endsWith(".cjs") || mainConfig?.fileName?.endsWith(".cts") || mainConfig?.fileName?.endsWith(".cjsx") || mainConfig?.fileName?.endsWith(".ctsx") || mainConfig._code.includes("module.exports")) {
8278
8645
  throw new CommonJsConfigNotSupportedError();
8279
8646
  } else {
8280
- mainConfig.setImport(["dirname", "join"], "node:path");
8647
+ mainConfig.setImport(["dirname"], "node:path");
8281
8648
  mainConfig.setImport(["fileURLToPath"], "node:url");
8282
8649
  }
8283
8650
  mainConfig.setBodyDeclaration(
@@ -8305,25 +8672,26 @@ var allFixes = [
8305
8672
  removeEssentials,
8306
8673
  addonA11yParameters,
8307
8674
  removeDocsAutodocs,
8308
- wrapGetAbsolutePath
8675
+ wrapGetAbsolutePath,
8676
+ fixFauxEsmRequire
8309
8677
  ];
8310
8678
  var commandFixes = [csfFactories];
8311
8679
 
8312
8680
  // src/automigrate/helpers/logMigrationSummary.ts
8313
8681
  var import_picocolors12 = __toESM(require_picocolors(), 1);
8314
8682
  import { logger as logger14 } from "storybook/internal/node-logger";
8315
- import { dedent as dedent11 } from "ts-dedent";
8683
+ import { dedent as dedent12 } from "ts-dedent";
8316
8684
  var messageDivider2 = "\n\n";
8317
8685
  var segmentDivider = "\n\n\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\n\n";
8318
8686
  function getGlossaryMessages(fixSummary, fixResults) {
8319
- const messages = [];
8687
+ const messages2 = [];
8320
8688
  if (fixSummary.succeeded.length > 0) {
8321
- messages.push(import_picocolors12.default.bold("Successful migrations:"));
8322
- messages.push(fixSummary.succeeded.map((m) => import_picocolors12.default.green(m)).join(", "));
8689
+ messages2.push(import_picocolors12.default.bold("Successful migrations:"));
8690
+ messages2.push(fixSummary.succeeded.map((m) => import_picocolors12.default.green(m)).join(", "));
8323
8691
  }
8324
8692
  if (Object.keys(fixSummary.failed).length > 0) {
8325
- messages.push(import_picocolors12.default.bold("Failed migrations:"));
8326
- messages.push(
8693
+ messages2.push(import_picocolors12.default.bold("Failed migrations:"));
8694
+ messages2.push(
8327
8695
  Object.entries(fixSummary.failed).map(([id, error]) => {
8328
8696
  return `${import_picocolors12.default.bold(import_picocolors12.default.red(id))}:
8329
8697
  ${error}`;
@@ -8331,27 +8699,27 @@ ${error}`;
8331
8699
  );
8332
8700
  }
8333
8701
  if (fixSummary.manual.length > 0) {
8334
- messages.push(import_picocolors12.default.bold("Manual migrations:"));
8335
- messages.push(
8702
+ messages2.push(import_picocolors12.default.bold("Manual migrations:"));
8703
+ messages2.push(
8336
8704
  fixSummary.manual.map(
8337
8705
  (m) => fixResults[m] === "manual_succeeded" /* MANUAL_SUCCEEDED */ ? import_picocolors12.default.green(m) : import_picocolors12.default.blue(m)
8338
8706
  ).join(", ")
8339
8707
  );
8340
8708
  }
8341
8709
  if (fixSummary.skipped.length > 0) {
8342
- messages.push(import_picocolors12.default.bold("Skipped migrations:"));
8343
- messages.push(fixSummary.skipped.map((m) => import_picocolors12.default.cyan(m)).join(", "));
8710
+ messages2.push(import_picocolors12.default.bold("Skipped migrations:"));
8711
+ messages2.push(fixSummary.skipped.map((m) => import_picocolors12.default.cyan(m)).join(", "));
8344
8712
  }
8345
- return messages;
8713
+ return messages2;
8346
8714
  }
8347
8715
  __name(getGlossaryMessages, "getGlossaryMessages");
8348
8716
  function logMigrationSummary({
8349
8717
  fixResults,
8350
8718
  fixSummary
8351
8719
  }) {
8352
- const messages = [];
8353
- messages.push(getGlossaryMessages(fixSummary, fixResults).join(messageDivider2));
8354
- messages.push(dedent11`If you'd like to run the migrations again, you can do so by running '${import_picocolors12.default.cyan(
8720
+ const messages2 = [];
8721
+ messages2.push(getGlossaryMessages(fixSummary, fixResults).join(messageDivider2));
8722
+ messages2.push(dedent12`If you'd like to run the migrations again, you can do so by running '${import_picocolors12.default.cyan(
8355
8723
  "npx storybook automigrate"
8356
8724
  )}'
8357
8725
 
@@ -8367,7 +8735,7 @@ function logMigrationSummary({
8367
8735
  (r) => r === "failed" /* FAILED */ || r === "check_failed" /* CHECK_FAILED */
8368
8736
  );
8369
8737
  const title = hasNoFixes ? "No migrations were applicable to your project" : hasFailures2 ? "Migration check ran with failures" : "Migration check ran successfully";
8370
- return logger14.logBox(messages.filter(Boolean).join(segmentDivider), {
8738
+ return logger14.logBox(messages2.filter(Boolean).join(segmentDivider), {
8371
8739
  title,
8372
8740
  borderColor: hasFailures2 ? "red" : "green"
8373
8741
  });
@@ -8377,7 +8745,7 @@ __name(logMigrationSummary, "logMigrationSummary");
8377
8745
  // src/automigrate/index.ts
8378
8746
  var logAvailableMigrations = /* @__PURE__ */ __name(() => {
8379
8747
  const availableFixes = [...allFixes, ...commandFixes].map((f) => import_picocolors13.default.yellow(f.id)).map((x) => `- ${x}`).join("\n");
8380
- logger15.log(dedent12`
8748
+ logger15.log(dedent13`
8381
8749
  The following migrations are available:
8382
8750
  ${availableFixes}
8383
8751
  `);
@@ -8679,7 +9047,7 @@ __name(runFixes, "runFixes");
8679
9047
  // src/link.ts
8680
9048
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
8681
9049
  var import_picocolors14 = __toESM(require_picocolors(), 1);
8682
- import { mkdir, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
9050
+ import { mkdir, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
8683
9051
  import { basename as basename2, extname as extname2, join as join3 } from "node:path";
8684
9052
  import { logger as logger16 } from "storybook/internal/node-logger";
8685
9053
  var exec = /* @__PURE__ */ __name(async (command2, options = {}, {
@@ -8721,7 +9089,7 @@ var exec = /* @__PURE__ */ __name(async (command2, options = {}, {
8721
9089
  var link = /* @__PURE__ */ __name(async ({ target, local, start }) => {
8722
9090
  const storybookDir = process.cwd();
8723
9091
  try {
8724
- const packageJson = JSON.parse(await readFile6("package.json", { encoding: "utf8" }));
9092
+ const packageJson = JSON.parse(await readFile7("package.json", { encoding: "utf8" }));
8725
9093
  if (packageJson.name !== "@storybook/root") {
8726
9094
  throw new Error();
8727
9095
  }
@@ -8755,7 +9123,7 @@ var link = /* @__PURE__ */ __name(async ({ target, local, start }) => {
8755
9123
  await exec(`yarn link --all --relative "${storybookDir}"`, { cwd: reproDir });
8756
9124
  logger16.info(`Installing ${reproName}`);
8757
9125
  const reproPackageJson = JSON.parse(
8758
- await readFile6(join3(reproDir, "package.json"), { encoding: "utf8" })
9126
+ await readFile7(join3(reproDir, "package.json"), { encoding: "utf8" })
8759
9127
  );
8760
9128
  if (!reproPackageJson.devDependencies?.vite) {
8761
9129
  reproPackageJson.devDependencies = {
@@ -8767,7 +9135,7 @@ var link = /* @__PURE__ */ __name(async ({ target, local, start }) => {
8767
9135
  ...reproPackageJson.devDependencies,
8768
9136
  "@types/node": "^22"
8769
9137
  };
8770
- await writeFile5(join3(reproDir, "package.json"), JSON.stringify(reproPackageJson, null, 2));
9138
+ await writeFile6(join3(reproDir, "package.json"), JSON.stringify(reproPackageJson, null, 2));
8771
9139
  await exec(`yarn install`, { cwd: reproDir });
8772
9140
  if (start) {
8773
9141
  logger16.info(`Running ${reproName} storybook`);
@@ -8803,7 +9171,7 @@ import { logger as logger18, prompt as prompt4 } from "storybook/internal/node-l
8803
9171
  import { downloadTemplate } from "giget";
8804
9172
  var import_picocolors15 = __toESM(require_picocolors(), 1);
8805
9173
  var import_semver6 = __toESM(require_semver(), 1);
8806
- import { dedent as dedent13 } from "ts-dedent";
9174
+ import { dedent as dedent14 } from "ts-dedent";
8807
9175
 
8808
9176
  // src/sandbox-templates.ts
8809
9177
  var baseTemplates = {
@@ -9570,9 +9938,9 @@ var sandbox = /* @__PURE__ */ __name(async ({
9570
9938
  const borderColor = isOutdated ? "#FC521F" : "#F1618C";
9571
9939
  const downloadType = !isOutdated && init ? "after-storybook" : "before-storybook";
9572
9940
  const branch = isPrerelease ? "next" : "main";
9573
- const messages = {
9941
+ const messages2 = {
9574
9942
  welcome: `Creating a Storybook ${import_picocolors15.default.bold(currentVersion)} sandbox..`,
9575
- notLatest: import_picocolors15.default.red(dedent13`
9943
+ notLatest: import_picocolors15.default.red(dedent14`
9576
9944
  This version is behind the latest release, which is: ${import_picocolors15.default.bold(latestVersion)}!
9577
9945
  You likely ran the init command through npx, which can use a locally cached version, to get the latest please run:
9578
9946
  ${import_picocolors15.default.bold("npx storybook@latest sandbox")}
@@ -9585,7 +9953,7 @@ var sandbox = /* @__PURE__ */ __name(async ({
9585
9953
  prerelease: import_picocolors15.default.yellow("This is a pre-release version.")
9586
9954
  };
9587
9955
  logger18.logBox(
9588
- [messages.welcome].concat(isOutdated && !isPrerelease ? [messages.notLatest] : []).concat(init && (isOutdated || isPrerelease) ? [messages.longInitTime] : []).concat(isPrerelease ? [messages.prerelease] : []).join("\n"),
9956
+ [messages2.welcome].concat(isOutdated && !isPrerelease ? [messages2.notLatest] : []).concat(init && (isOutdated || isPrerelease) ? [messages2.longInitTime] : []).concat(isPrerelease ? [messages2.prerelease] : []).join("\n"),
9589
9957
  { borderStyle: "round", padding: 1, borderColor }
9590
9958
  );
9591
9959
  if (!selectedConfig) {
@@ -9605,7 +9973,7 @@ var sandbox = /* @__PURE__ */ __name(async ({
9605
9973
  }, []);
9606
9974
  if (choices.length === 0) {
9607
9975
  logger18.logBox(
9608
- dedent13`
9976
+ dedent14`
9609
9977
  🔎 You filtered out all templates. 🔍
9610
9978
 
9611
9979
  After filtering all the templates with "${import_picocolors15.default.yellow(
@@ -9623,7 +9991,7 @@ var sandbox = /* @__PURE__ */ __name(async ({
9623
9991
  [templateId] = choices;
9624
9992
  } else {
9625
9993
  logger18.logBox(
9626
- dedent13`
9994
+ dedent14`
9627
9995
  🤗 Welcome to ${import_picocolors15.default.yellow("sb sandbox")}! 🤗
9628
9996
 
9629
9997
  Create a ${import_picocolors15.default.green("new project")} to minimally reproduce Storybook issues.
@@ -9683,7 +10051,7 @@ var sandbox = /* @__PURE__ */ __name(async ({
9683
10051
  });
9684
10052
  if ((await readdir(templateDestination)).length === 0) {
9685
10053
  const selected = import_picocolors15.default.yellow(templateId);
9686
- throw new Error(dedent13`
10054
+ throw new Error(dedent14`
9687
10055
  Template downloaded from ${import_picocolors15.default.blue(gitPath)} is empty.
9688
10056
  Are you use it exists? Or did you want to set ${selected} to inDevelopment first?
9689
10057
  `);
@@ -9703,12 +10071,12 @@ var sandbox = /* @__PURE__ */ __name(async ({
9703
10071
  logger18.error(`\u{1F6A8} Failed to download sandbox template: ${String(err)}`);
9704
10072
  throw err;
9705
10073
  }
9706
- const initMessage = init ? import_picocolors15.default.yellow(dedent13`
10074
+ const initMessage = init ? import_picocolors15.default.yellow(dedent14`
9707
10075
  yarn install
9708
10076
  yarn storybook
9709
10077
  `) : `Recreate your setup, then ${import_picocolors15.default.yellow(`npx storybook@latest init`)}`;
9710
10078
  logger18.logBox(
9711
- dedent13`
10079
+ dedent14`
9712
10080
  🎉 Your Storybook reproduction project is ready to use! 🎉
9713
10081
 
9714
10082
  ${import_picocolors15.default.yellow(`cd ${selectedDirectory}`)}
@@ -9757,7 +10125,7 @@ import {
9757
10125
  UpgradeStorybookUnknownCurrentVersionError
9758
10126
  } from "storybook/internal/server-errors";
9759
10127
  import { telemetry } from "storybook/internal/telemetry";
9760
- import { dedent as dedent14 } from "ts-dedent";
10128
+ import { dedent as dedent15 } from "ts-dedent";
9761
10129
 
9762
10130
  // src/automigrate/multi-project.ts
9763
10131
  import { CLI_COLORS as CLI_COLORS2, logger as logger19, prompt as prompt5 } from "storybook/internal/node-logger";
@@ -10255,7 +10623,7 @@ async function upgrade(options) {
10255
10623
  process.on("SIGTERM", handleInterruption);
10256
10624
  try {
10257
10625
  const hasBlockers = processAutoblockerResults(storybookProjects, (message) => {
10258
- logger20.error(dedent14`Blockers detected\n\n${message}`);
10626
+ logger20.error(dedent15`Blockers detected\n\n${message}`);
10259
10627
  });
10260
10628
  if (hasBlockers) {
10261
10629
  throw new HandledError("Blockers detected");