@storybook/cli 10.0.0-beta.3 → 10.0.0-beta.4

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,24 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  findOutdatedPackage
14
- } from "./chunk-J26XVIEI.js";
15
- import "./chunk-Q34DTK4O.js";
14
+ } from "./chunk-H67YXLYS.js";
15
+ import "./chunk-SU2D6UUF.js";
16
16
  import {
17
17
  createBlocker
18
- } from "./chunk-QXLXOJ2F.js";
19
- import "./chunk-MX3I2NJD.js";
20
- import "./chunk-QHB4E557.js";
21
- import "./chunk-42LUW6OW.js";
18
+ } from "./chunk-SSFPIHJY.js";
19
+ import "./chunk-CROPCQRR.js";
20
+ import "./chunk-N7B6DFER.js";
22
21
 
23
22
  // src/autoblock/block-dependencies-versions.ts
24
23
  import { dedent } from "ts-dedent";
@@ -1,23 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  createBlocker
14
- } from "./chunk-QXLXOJ2F.js";
14
+ } from "./chunk-SSFPIHJY.js";
15
15
  import {
16
16
  require_semver
17
- } from "./chunk-MX3I2NJD.js";
17
+ } from "./chunk-CROPCQRR.js";
18
18
  import {
19
19
  __toESM
20
- } from "./chunk-42LUW6OW.js";
20
+ } from "./chunk-N7B6DFER.js";
21
21
 
22
22
  // src/autoblock/block-experimental-addon-test.ts
23
23
  var import_semver = __toESM(require_semver(), 1);
@@ -1,24 +1,24 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  createBlocker
14
- } from "./chunk-QXLXOJ2F.js";
14
+ } from "./chunk-SSFPIHJY.js";
15
15
  import {
16
16
  require_semver
17
- } from "./chunk-MX3I2NJD.js";
17
+ } from "./chunk-CROPCQRR.js";
18
18
  import {
19
19
  __name,
20
20
  __toESM
21
- } from "./chunk-42LUW6OW.js";
21
+ } from "./chunk-N7B6DFER.js";
22
22
 
23
23
  // src/autoblock/block-major-version.ts
24
24
  var import_semver = __toESM(require_semver(), 1);
@@ -1,23 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  createBlocker
14
- } from "./chunk-QXLXOJ2F.js";
14
+ } from "./chunk-SSFPIHJY.js";
15
15
  import {
16
16
  require_semver
17
- } from "./chunk-MX3I2NJD.js";
17
+ } from "./chunk-CROPCQRR.js";
18
18
  import {
19
19
  __toESM
20
- } from "./chunk-42LUW6OW.js";
20
+ } from "./chunk-N7B6DFER.js";
21
21
 
22
22
  // src/autoblock/block-node-version.ts
23
23
  var import_semver = __toESM(require_semver(), 1);
@@ -1,24 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  findOutdatedPackage
14
- } from "./chunk-J26XVIEI.js";
15
- import "./chunk-Q34DTK4O.js";
14
+ } from "./chunk-H67YXLYS.js";
15
+ import "./chunk-SU2D6UUF.js";
16
16
  import {
17
17
  createBlocker
18
- } from "./chunk-QXLXOJ2F.js";
19
- import "./chunk-MX3I2NJD.js";
20
- import "./chunk-QHB4E557.js";
21
- import "./chunk-42LUW6OW.js";
18
+ } from "./chunk-SSFPIHJY.js";
19
+ import "./chunk-CROPCQRR.js";
20
+ import "./chunk-N7B6DFER.js";
22
21
 
23
22
  // src/autoblock/block-webpack5-frameworks.ts
24
23
  var minimalVersionsMap = {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
12
12
  import {
13
13
  __commonJS,
14
14
  __name
15
- } from "./chunk-42LUW6OW.js";
15
+ } from "./chunk-N7B6DFER.js";
16
16
 
17
17
  // ../../node_modules/semver/internal/constants.js
18
18
  var require_constants = __commonJS({
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,15 +12,15 @@ var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
12
12
  import {
13
13
  globby,
14
14
  globbySync
15
- } from "./chunk-Q34DTK4O.js";
15
+ } from "./chunk-SU2D6UUF.js";
16
16
  import {
17
17
  require_semver
18
- } from "./chunk-MX3I2NJD.js";
18
+ } from "./chunk-CROPCQRR.js";
19
19
  import {
20
20
  __commonJS,
21
21
  __name,
22
22
  __toESM
23
- } from "./chunk-42LUW6OW.js";
23
+ } from "./chunk-N7B6DFER.js";
24
24
 
25
25
  // ../../node_modules/picocolors/picocolors.js
26
26
  var require_picocolors = __commonJS({
@@ -1185,94 +1185,30 @@ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
1185
1185
  // ../../node_modules/boxen/index.js
1186
1186
  var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
1187
1187
 
1188
- // ../../node_modules/find-up/index.js
1189
- import path2 from "node:path";
1188
+ // ../../node_modules/empathic/walk.mjs
1189
+ import { dirname } from "node:path";
1190
1190
 
1191
- // ../../node_modules/locate-path/index.js
1192
- import process3 from "node:process";
1193
- import path from "node:path";
1194
- import fs, { promises as fsPromises } from "node:fs";
1195
- import { fileURLToPath } from "node:url";
1196
- var typeMappings = {
1197
- directory: "isDirectory",
1198
- file: "isFile"
1199
- };
1200
- function checkType(type) {
1201
- if (Object.hasOwnProperty.call(typeMappings, type)) {
1202
- return;
1203
- }
1204
- throw new Error(`Invalid type specified: ${type}`);
1205
- }
1206
- __name(checkType, "checkType");
1207
- var matchType = /* @__PURE__ */ __name((type, stat) => stat[typeMappings[type]](), "matchType");
1208
- var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
1209
- function locatePathSync(paths, {
1210
- cwd = process3.cwd(),
1211
- type = "file",
1212
- allowSymlinks = true
1213
- } = {}) {
1214
- checkType(type);
1215
- cwd = toPath(cwd);
1216
- const statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;
1217
- for (const path_ of paths) {
1218
- try {
1219
- const stat = statFunction(path.resolve(cwd, path_), {
1220
- throwIfNoEntry: false
1221
- });
1222
- if (!stat) {
1223
- continue;
1224
- }
1225
- if (matchType(type, stat)) {
1226
- return path_;
1227
- }
1228
- } catch {
1229
- }
1230
- }
1231
- }
1232
- __name(locatePathSync, "locatePathSync");
1233
-
1234
- // ../../node_modules/find-up/node_modules/unicorn-magic/node.js
1235
- import { fileURLToPath as fileURLToPath2 } from "node:url";
1236
- function toPath2(urlOrPath) {
1237
- return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
1191
+ // ../../node_modules/empathic/resolve.mjs
1192
+ import { isAbsolute, join, resolve } from "node:path";
1193
+ function absolute(input, root) {
1194
+ return isAbsolute(input) ? input : resolve(root || ".", input);
1238
1195
  }
1239
- __name(toPath2, "toPath");
1196
+ __name(absolute, "absolute");
1240
1197
 
1241
- // ../../node_modules/find-up/index.js
1242
- var findUpStop = Symbol("findUpStop");
1243
- function findUpMultipleSync(name, options = {}) {
1244
- let directory = path2.resolve(toPath2(options.cwd) ?? "");
1245
- const { root } = path2.parse(directory);
1246
- const stopAt = path2.resolve(directory, toPath2(options.stopAt) ?? root);
1247
- const limit = options.limit ?? Number.POSITIVE_INFINITY;
1248
- const paths = [name].flat();
1249
- const runMatcher = /* @__PURE__ */ __name((locateOptions) => {
1250
- if (typeof name !== "function") {
1251
- return locatePathSync(paths, locateOptions);
1252
- }
1253
- const foundPath = name(locateOptions.cwd);
1254
- if (typeof foundPath === "string") {
1255
- return locatePathSync([foundPath], locateOptions);
1256
- }
1257
- return foundPath;
1258
- }, "runMatcher");
1259
- const matches = [];
1260
- while (true) {
1261
- const foundPath = runMatcher({ ...options, cwd: directory });
1262
- if (foundPath === findUpStop) {
1263
- break;
1264
- }
1265
- if (foundPath) {
1266
- matches.push(path2.resolve(directory, foundPath));
1267
- }
1268
- if (directory === stopAt || matches.length >= limit) {
1269
- break;
1270
- }
1271
- directory = path2.dirname(directory);
1272
- }
1273
- return matches;
1198
+ // ../../node_modules/empathic/walk.mjs
1199
+ function up(base, options) {
1200
+ let { last, cwd } = options || {};
1201
+ let tmp = absolute(base, cwd);
1202
+ let root = absolute(last || "/", cwd);
1203
+ let prev, arr = [];
1204
+ while (prev !== root) {
1205
+ arr.push(tmp);
1206
+ tmp = dirname(prev = tmp);
1207
+ if (tmp === prev) break;
1208
+ }
1209
+ return arr;
1274
1210
  }
1275
- __name(findUpMultipleSync, "findUpMultipleSync");
1211
+ __name(up, "up");
1276
1212
 
1277
1213
  // src/util.ts
1278
1214
  var import_picocolors2 = __toESM(require_picocolors(), 1);
@@ -1281,11 +1217,11 @@ var import_semver = __toESM(require_semver(), 1);
1281
1217
  // src/autoblock/index.ts
1282
1218
  var blockers = /* @__PURE__ */ __name(() => [
1283
1219
  // add/remove blockers here
1284
- import("./block-dependencies-versions-ECFHKRTC.js"),
1285
- import("./block-node-version-V43RSSN2.js"),
1286
- import("./block-webpack5-frameworks-B72WCNZS.js"),
1287
- import("./block-major-version-3ZY3MRTH.js"),
1288
- import("./block-experimental-addon-test-H3PGBGKX.js")
1220
+ import("./block-dependencies-versions-VAJ43FYF.js"),
1221
+ import("./block-node-version-NESQ7RBO.js"),
1222
+ import("./block-webpack5-frameworks-PEPHOPVV.js"),
1223
+ import("./block-major-version-5TJOKHAM.js"),
1224
+ import("./block-experimental-addon-test-FECEZIC5.js")
1289
1225
  ], "blockers");
1290
1226
  var autoblock = /* @__PURE__ */ __name(async (options, list = blockers()) => {
1291
1227
  if (list.length === 0) {
@@ -1302,7 +1238,7 @@ var autoblock = /* @__PURE__ */ __name(async (options, list = blockers()) => {
1302
1238
 
1303
1239
  // src/automigrate/helpers/mainConfigFile.ts
1304
1240
  var import_picocolors = __toESM(require_picocolors(), 1);
1305
- import { dirname, isAbsolute, join, normalize } from "node:path";
1241
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, normalize } from "node:path";
1306
1242
  import {
1307
1243
  JsPackageManagerFactory,
1308
1244
  builderPackages,
@@ -1345,7 +1281,7 @@ var getStorybookData = /* @__PURE__ */ __name(async ({
1345
1281
  dedent`Unable to find or evaluate ${import_picocolors.default.blue(mainConfigPath)}: ${String(err)}`
1346
1282
  );
1347
1283
  }
1348
- const workingDir = isAbsolute(configDir) ? dirname(configDir) : dirname(join(cwd ?? process.cwd(), configDir));
1284
+ const workingDir = isAbsolute2(configDir) ? dirname2(configDir) : dirname2(join2(cwd ?? process.cwd(), configDir));
1349
1285
  logger.debug("Getting stories paths...");
1350
1286
  const storiesPaths = await getStoriesPathsFromConfig({
1351
1287
  stories: mainConfig.stories,
@@ -1523,9 +1459,9 @@ var processProject = /* @__PURE__ */ __name(async ({
1523
1459
  }
1524
1460
  }, "processProject");
1525
1461
  var collectProjects = /* @__PURE__ */ __name(async (options, configDirs, onProjectScanStart) => {
1526
- const { default: pLimit2 } = await import("./p-limit-EQE3ITLA.js");
1462
+ const { default: pLimit } = await import("./p-limit-6BT3Z2NP.js");
1527
1463
  const currentCLIVersion = versions.storybook;
1528
- const limit = pLimit2(5);
1464
+ const limit = pLimit(5);
1529
1465
  const projectPromises = configDirs.map(
1530
1466
  (configDir) => limit(
1531
1467
  () => processProject({
@@ -1632,9 +1568,9 @@ var formatProjectDirectories = /* @__PURE__ */ __name((projectData, modifier) =>
1632
1568
  }
1633
1569
  return projectData.map((project) => project.configDir).map((dir) => `${modifier} ${import_picocolors2.default.cyan(shortenPath(dir))}`).join("\n");
1634
1570
  }, "formatProjectDirectories");
1635
- var shortenPath = /* @__PURE__ */ __name((path3) => {
1571
+ var shortenPath = /* @__PURE__ */ __name((path) => {
1636
1572
  const gitRoot = getProjectRoot();
1637
- return path3.replace(gitRoot, "");
1573
+ return path.replace(gitRoot, "");
1638
1574
  }, "shortenPath");
1639
1575
  var handleMultipleProjects = /* @__PURE__ */ __name(async (validProjects, errorProjects, detectedConfigDirs, yes) => {
1640
1576
  const allPackageJsonPaths = validProjects.flatMap((data) => data.packageManager.packageJsonPaths).filter(JsPackageManager.hasAnyStorybookDependency);
@@ -1729,21 +1665,15 @@ Please fix the errors and run the upgrade command again.`
1729
1665
  }, "getProjects");
1730
1666
  var findFilesUp = /* @__PURE__ */ __name((matchers, cwd) => {
1731
1667
  const matchingFiles = [];
1732
- findUpMultipleSync(
1733
- (directory) => {
1734
- matchingFiles.push(
1735
- ...globbySync(matchers, {
1736
- gitignore: true,
1737
- cwd: directory
1738
- })
1739
- );
1740
- return void 0;
1741
- },
1742
- {
1743
- cwd,
1744
- stopAt: getProjectRoot()
1745
- }
1746
- );
1668
+ for (const directory of up(cwd, { last: getProjectRoot() })) {
1669
+ matchingFiles.push(
1670
+ ...globbySync(matchers, {
1671
+ gitignore: true,
1672
+ absolute: true,
1673
+ cwd: directory
1674
+ })
1675
+ );
1676
+ }
1747
1677
  return matchingFiles;
1748
1678
  }, "findFilesUp");
1749
1679
  var getStoriesPathsFromConfig = /* @__PURE__ */ __name(async ({
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __name
14
- } from "./chunk-42LUW6OW.js";
14
+ } from "./chunk-N7B6DFER.js";
15
15
 
16
16
  // src/autoblock/types.ts
17
17
  function createBlocker(block) {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,7 +14,7 @@ import {
14
14
  __name,
15
15
  __require,
16
16
  __toESM
17
- } from "./chunk-42LUW6OW.js";
17
+ } from "./chunk-N7B6DFER.js";
18
18
 
19
19
  // ../../node_modules/fast-glob/out/utils/array.js
20
20
  var require_array = __commonJS({
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -21,8 +21,8 @@ import {
21
21
  isGitIgnoredSync,
22
22
  isIgnoredByIgnoreFiles,
23
23
  isIgnoredByIgnoreFilesSync
24
- } from "./chunk-Q34DTK4O.js";
25
- import "./chunk-42LUW6OW.js";
24
+ } from "./chunk-SU2D6UUF.js";
25
+ import "./chunk-N7B6DFER.js";
26
26
  export {
27
27
  convertPathToPattern,
28
28
  generateGlobTasks,
@@ -1,20 +1,86 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import {
13
- Queue
14
- } from "./chunk-QHB4E557.js";
15
12
  import {
16
13
  __name
17
- } from "./chunk-42LUW6OW.js";
14
+ } from "./chunk-N7B6DFER.js";
15
+
16
+ // ../../node_modules/yocto-queue/index.js
17
+ var Node = class {
18
+ static {
19
+ __name(this, "Node");
20
+ }
21
+ value;
22
+ next;
23
+ constructor(value) {
24
+ this.value = value;
25
+ }
26
+ };
27
+ var Queue = class {
28
+ static {
29
+ __name(this, "Queue");
30
+ }
31
+ #head;
32
+ #tail;
33
+ #size;
34
+ constructor() {
35
+ this.clear();
36
+ }
37
+ enqueue(value) {
38
+ const node = new Node(value);
39
+ if (this.#head) {
40
+ this.#tail.next = node;
41
+ this.#tail = node;
42
+ } else {
43
+ this.#head = node;
44
+ this.#tail = node;
45
+ }
46
+ this.#size++;
47
+ }
48
+ dequeue() {
49
+ const current = this.#head;
50
+ if (!current) {
51
+ return;
52
+ }
53
+ this.#head = this.#head.next;
54
+ this.#size--;
55
+ return current.value;
56
+ }
57
+ peek() {
58
+ if (!this.#head) {
59
+ return;
60
+ }
61
+ return this.#head.value;
62
+ }
63
+ clear() {
64
+ this.#head = void 0;
65
+ this.#tail = void 0;
66
+ this.#size = 0;
67
+ }
68
+ get size() {
69
+ return this.#size;
70
+ }
71
+ *[Symbol.iterator]() {
72
+ let current = this.#head;
73
+ while (current) {
74
+ yield current.value;
75
+ current = current.next;
76
+ }
77
+ }
78
+ *drain() {
79
+ while (this.#head) {
80
+ yield this.dequeue();
81
+ }
82
+ }
83
+ };
18
84
 
19
85
  // ../../node_modules/p-limit/index.js
20
86
  function pLimit(concurrency) {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -19,20 +19,19 @@ import {
19
19
  shortenPath,
20
20
  updateMainConfig,
21
21
  upgradeStorybookDependencies
22
- } from "./chunk-J26XVIEI.js";
22
+ } from "./chunk-H67YXLYS.js";
23
23
  import {
24
24
  slash
25
- } from "./chunk-Q34DTK4O.js";
25
+ } from "./chunk-SU2D6UUF.js";
26
26
  import {
27
27
  require_semver
28
- } from "./chunk-MX3I2NJD.js";
29
- import "./chunk-QHB4E557.js";
28
+ } from "./chunk-CROPCQRR.js";
30
29
  import {
31
30
  __commonJS,
32
31
  __name,
33
32
  __require,
34
33
  __toESM
35
- } from "./chunk-42LUW6OW.js";
34
+ } from "./chunk-N7B6DFER.js";
36
35
 
37
36
  // ../../node_modules/envinfo/dist/envinfo.js
38
37
  var require_envinfo = __commonJS({
@@ -4900,7 +4899,7 @@ __name(leven, "leven");
4900
4899
  var import_picocolors17 = __toESM(require_picocolors(), 1);
4901
4900
 
4902
4901
  // package.json
4903
- var version = "10.0.0-beta.3";
4902
+ var version = "10.0.0-beta.4";
4904
4903
 
4905
4904
  // src/add.ts
4906
4905
  var import_semver = __toESM(require_semver(), 1);
@@ -6065,7 +6064,7 @@ async function runCodemod(globPattern = "**/*.stories.*", transform, { dryRun =
6065
6064
  let modifiedCount = 0;
6066
6065
  let unmodifiedCount = 0;
6067
6066
  let errorCount = 0;
6068
- const { globby } = await import("./globby-G7I6RDHZ.js");
6067
+ const { globby } = await import("./globby-Q6MFNC5B.js");
6069
6068
  const files = await globby(slash(globPattern), {
6070
6069
  followSymbolicLinks: true,
6071
6070
  ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**", "**/build/**"]
@@ -6079,7 +6078,7 @@ Please try a different pattern.
6079
6078
  throw new Error("No files matched");
6080
6079
  }
6081
6080
  try {
6082
- const pLimit = (await import("./p-limit-EQE3ITLA.js")).default;
6081
+ const pLimit = (await import("./p-limit-6BT3Z2NP.js")).default;
6083
6082
  const limit = pLimit(maxConcurrentTasks);
6084
6083
  await Promise.all(
6085
6084
  files.map(
@@ -7017,7 +7016,7 @@ var addonA11yParameters = {
7017
7016
  }
7018
7017
  }
7019
7018
  }
7020
- const { default: pLimit } = await import("./p-limit-EQE3ITLA.js");
7019
+ const { default: pLimit } = await import("./p-limit-6BT3Z2NP.js");
7021
7020
  const limit = pLimit(10);
7022
7021
  await Promise.all(
7023
7022
  storyFilesToUpdate.map(
@@ -7263,7 +7262,7 @@ function transformPackageJson(content) {
7263
7262
  __name(transformPackageJson, "transformPackageJson");
7264
7263
  var transformPackageJsonFiles = /* @__PURE__ */ __name(async (files, dryRun) => {
7265
7264
  const errors = [];
7266
- const { default: pLimit } = await import("./p-limit-EQE3ITLA.js");
7265
+ const { default: pLimit } = await import("./p-limit-6BT3Z2NP.js");
7267
7266
  const limit = pLimit(10);
7268
7267
  await Promise.all(
7269
7268
  files.map(
@@ -7325,7 +7324,7 @@ var consolidatedImports = {
7325
7324
  dryRun
7326
7325
  );
7327
7326
  errors.push(...packageJsonErrors);
7328
- const { globby } = await import("./globby-G7I6RDHZ.js");
7327
+ const { globby } = await import("./globby-Q6MFNC5B.js");
7329
7328
  const configFiles = await globby([`${configDir}/**/*`]);
7330
7329
  const importErrors = await transformImportFiles(
7331
7330
  [...storiesPaths, ...configFiles].filter(Boolean),
@@ -7867,7 +7866,7 @@ var replaceImports = /* @__PURE__ */ __name((source, renderer, framework) => {
7867
7866
  }, "replaceImports");
7868
7867
  var transformSourceFiles = /* @__PURE__ */ __name(async (files, renderer, framework, dryRun) => {
7869
7868
  const errors = [];
7870
- const { default: pLimit } = await import("./p-limit-EQE3ITLA.js");
7869
+ const { default: pLimit } = await import("./p-limit-6BT3Z2NP.js");
7871
7870
  const limit = pLimit(10);
7872
7871
  await Promise.all(
7873
7872
  files.map(
@@ -7969,7 +7968,7 @@ var rendererToFramework = {
7969
7968
  }
7970
7969
  logger12.debug(`
7971
7970
  Migrating ${rendererPackage} to ${selectedFramework}`);
7972
- const { globby } = await import("./globby-G7I6RDHZ.js");
7971
+ const { globby } = await import("./globby-Q6MFNC5B.js");
7973
7972
  const configFiles = await globby([`${configDir}/**/*`]);
7974
7973
  await transformSourceFiles(
7975
7974
  [...storiesPaths, ...configFiles].filter(Boolean),
@@ -8004,7 +8003,7 @@ async function renameInFile(filePath, oldText, newText) {
8004
8003
  __name(renameInFile, "renameInFile");
8005
8004
  var getDotStorybookReferences = /* @__PURE__ */ __name(async (searchDir) => {
8006
8005
  try {
8007
- const { globby } = await import("./globby-G7I6RDHZ.js");
8006
+ const { globby } = await import("./globby-Q6MFNC5B.js");
8008
8007
  const { readFile: readFile7 } = await import("node:fs/promises");
8009
8008
  const files = await globby(`${searchDir}/**/*`, {
8010
8009
  onlyFiles: true,
@@ -8039,7 +8038,7 @@ var rnstorybookConfig = {
8039
8038
  const projectDir = mainConfigPath ? join2(mainConfigPath, "..", "..") : process.cwd();
8040
8039
  const storybookDir = join2(projectDir, ".storybook");
8041
8040
  const rnStorybookDir = join2(projectDir, ".rnstorybook");
8042
- const { globby } = await import("./globby-G7I6RDHZ.js");
8041
+ const { globby } = await import("./globby-Q6MFNC5B.js");
8043
8042
  const requiresFiles = await globby(join2(storybookDir, "storybook.requires.*"));
8044
8043
  if (existsSync2(storybookDir) && requiresFiles.length > 0 && !existsSync2(rnStorybookDir)) {
8045
8044
  return { storybookDir, rnStorybookDir };
package/dist/bin/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
3
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
4
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
2
+ import CJS_COMPAT_NODE_URL_7epsbhjaewn from 'node:url';
3
+ import CJS_COMPAT_NODE_PATH_7epsbhjaewn from 'node:path';
4
+ import CJS_COMPAT_NODE_MODULE_7epsbhjaewn from "node:module";
5
5
 
6
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
7
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
8
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
6
+ var __filename = CJS_COMPAT_NODE_URL_7epsbhjaewn.fileURLToPath(import.meta.url);
7
+ var __dirname = CJS_COMPAT_NODE_PATH_7epsbhjaewn.dirname(__filename);
8
+ var require = CJS_COMPAT_NODE_MODULE_7epsbhjaewn.createRequire(import.meta.url);
9
9
 
10
10
  // ------------------------------------------------------------
11
11
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -22,4 +22,4 @@ if (majorNodeVersion < 20 || majorNodeVersion === 20 && minorNodeVersion < 19 ||
22
22
  );
23
23
  process.exit(1);
24
24
  }
25
- import("../_node-chunks/run-7HHVXZYG.js");
25
+ import("../_node-chunks/run-W6KO2BME.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/cli",
3
- "version": "10.0.0-beta.3",
3
+ "version": "10.0.0-beta.4",
4
4
  "description": "Storybook CLI: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -41,13 +41,13 @@
41
41
  "prep": "jiti ../../../scripts/build/build-package.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@storybook/codemod": "10.0.0-beta.3",
44
+ "@storybook/codemod": "10.0.0-beta.4",
45
45
  "@types/semver": "^7.3.4",
46
46
  "commander": "^12.1.0",
47
- "create-storybook": "10.0.0-beta.3",
47
+ "create-storybook": "10.0.0-beta.4",
48
48
  "giget": "^1.0.0",
49
49
  "jscodeshift": "^0.15.1",
50
- "storybook": "10.0.0-beta.3",
50
+ "storybook": "10.0.0-beta.4",
51
51
  "ts-dedent": "^2.0.0"
52
52
  },
53
53
  "devDependencies": {
@@ -56,9 +56,9 @@
56
56
  "boxen": "^7.1.1",
57
57
  "comment-json": "^4.2.5",
58
58
  "cross-spawn": "^7.0.6",
59
+ "empathic": "^2.0.0",
59
60
  "envinfo": "^7.14.0",
60
61
  "execa": "^9.6.0",
61
- "find-up": "^7.0.0",
62
62
  "globby": "^14.0.1",
63
63
  "leven": "^4.0.0",
64
64
  "p-limit": "^6.2.0",
@@ -1,87 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_ovdoyekg4cg from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ovdoyekg4cg from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ovdoyekg4cg from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_ovdoyekg4cg.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ovdoyekg4cg.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ovdoyekg4cg.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- __name
14
- } from "./chunk-42LUW6OW.js";
15
-
16
- // ../../node_modules/yocto-queue/index.js
17
- var Node = class {
18
- static {
19
- __name(this, "Node");
20
- }
21
- value;
22
- next;
23
- constructor(value) {
24
- this.value = value;
25
- }
26
- };
27
- var Queue = class {
28
- static {
29
- __name(this, "Queue");
30
- }
31
- #head;
32
- #tail;
33
- #size;
34
- constructor() {
35
- this.clear();
36
- }
37
- enqueue(value) {
38
- const node = new Node(value);
39
- if (this.#head) {
40
- this.#tail.next = node;
41
- this.#tail = node;
42
- } else {
43
- this.#head = node;
44
- this.#tail = node;
45
- }
46
- this.#size++;
47
- }
48
- dequeue() {
49
- const current = this.#head;
50
- if (!current) {
51
- return;
52
- }
53
- this.#head = this.#head.next;
54
- this.#size--;
55
- return current.value;
56
- }
57
- peek() {
58
- if (!this.#head) {
59
- return;
60
- }
61
- return this.#head.value;
62
- }
63
- clear() {
64
- this.#head = void 0;
65
- this.#tail = void 0;
66
- this.#size = 0;
67
- }
68
- get size() {
69
- return this.#size;
70
- }
71
- *[Symbol.iterator]() {
72
- let current = this.#head;
73
- while (current) {
74
- yield current.value;
75
- current = current.next;
76
- }
77
- }
78
- *drain() {
79
- while (this.#head) {
80
- yield this.dequeue();
81
- }
82
- }
83
- };
84
-
85
- export {
86
- Queue
87
- };