storybook 10.2.0-alpha.9 → 10.2.0-beta.0

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 (97) hide show
  1. package/dist/_browser-chunks/{Color-E5XDEOX4.js → Color-XESOIGZP.js} +57 -3
  2. package/dist/_browser-chunks/chunk-AFVOZMXQ.js +23 -0
  3. package/dist/_browser-chunks/{chunk-3PJE6VLG.js → chunk-ASKQZAOS.js} +1 -12
  4. package/dist/_browser-chunks/chunk-IYCKG66Y.js +171 -0
  5. package/dist/_browser-chunks/chunk-LCHBOIHN.js +64 -0
  6. package/dist/_browser-chunks/{chunk-IPA5A322.js → chunk-MEXTPDJG.js} +1 -1
  7. package/dist/_browser-chunks/{chunk-54PNNATT.js → chunk-NQJGOFZV.js} +18 -1
  8. package/dist/_browser-chunks/{chunk-VUZYLZ4B.js → chunk-QOXZ7W26.js} +31 -15
  9. package/dist/_browser-chunks/{chunk-LOTN4ZCW.js → chunk-SI6AKD4S.js} +2 -2
  10. package/dist/_browser-chunks/chunk-YK43Z22A.js +263 -0
  11. package/dist/_node-chunks/{builder-manager-FTCODGJP.js → builder-manager-JEJE63VV.js} +15 -12
  12. package/dist/_node-chunks/camelcase-HALRJETF.js +62 -0
  13. package/dist/_node-chunks/{chunk-3Y5VHKPI.js → chunk-3SKE4CCB.js} +9 -9
  14. package/dist/_node-chunks/chunk-4UYAC7Y2.js +18 -0
  15. package/dist/_node-chunks/{chunk-NYUFS6LX.js → chunk-6UAQEBJX.js} +10 -10
  16. package/dist/_node-chunks/{chunk-SPOUBCPJ.js → chunk-72K4WVI5.js} +18 -14
  17. package/dist/_node-chunks/{chunk-FGI35IGB.js → chunk-7ZX5CX6B.js} +15 -69
  18. package/dist/_node-chunks/{chunk-6SH5SI6S.js → chunk-ADTWC7QJ.js} +7 -7
  19. package/dist/_node-chunks/{chunk-OUDQWDHY.js → chunk-APUXGW3Y.js} +7 -7
  20. package/dist/_node-chunks/{chunk-PZCWRKQE.js → chunk-AXDM43NU.js} +6 -6
  21. package/dist/_node-chunks/{chunk-73GYSTNZ.js → chunk-B422K4XV.js} +6 -6
  22. package/dist/_node-chunks/{chunk-WTQGSYRO.js → chunk-BJOXVTWM.js} +12 -571
  23. package/dist/_node-chunks/{chunk-LRBEW57O.js → chunk-BLGRU6F5.js} +7 -7
  24. package/dist/_node-chunks/{chunk-6ABJZZWS.js → chunk-CG47ALAV.js} +7 -7
  25. package/dist/_node-chunks/chunk-FH4FRUMP.js +23 -0
  26. package/dist/_node-chunks/{chunk-RF3L36MK.js → chunk-GBZ23FIZ.js} +125 -73
  27. package/dist/_node-chunks/{chunk-MWWAQ5S4.js → chunk-IZ3ATSWZ.js} +5262 -1480
  28. package/dist/_node-chunks/{chunk-SBPB3VWI.js → chunk-IZFEBWVB.js} +6 -6
  29. package/dist/_node-chunks/{chunk-33XC4R6P.js → chunk-KL5CKFPT.js} +9 -9
  30. package/dist/_node-chunks/{chunk-D4TCQXIF.js → chunk-MLXCYULR.js} +7 -7
  31. package/dist/_node-chunks/{chunk-LB74XOLW.js → chunk-MV2QM7P3.js} +6 -6
  32. package/dist/_node-chunks/chunk-PHX5XNP7.js +144 -0
  33. package/dist/_node-chunks/{chunk-XZ6V3G6J.js → chunk-QL6L57W7.js} +533 -143
  34. package/dist/_node-chunks/{chunk-IIBBQZLT.js → chunk-RPBXVPRB.js} +6 -6
  35. package/dist/_node-chunks/{chunk-BQX766MA.js → chunk-UH2GWMFP.js} +260 -162
  36. package/dist/_node-chunks/chunk-WNGL2VRJ.js +126 -0
  37. package/dist/_node-chunks/{chunk-CO7N5AG7.js → chunk-XAL452XB.js} +36 -14
  38. package/dist/_node-chunks/{chunk-YN6FEZAF.js → chunk-YVXXMWQO.js} +7 -7
  39. package/dist/_node-chunks/chunk-YYDL7JOC.js +61 -0
  40. package/dist/_node-chunks/{chunk-3DPKKQ6P.js → chunk-Z7FLE2TR.js} +6 -6
  41. package/dist/_node-chunks/{globby-AXGFF6I5.js → globby-4D4NBVG7.js} +11 -20
  42. package/dist/_node-chunks/{lib-ESB7KQ6D.js → lib-RM2DWHZQ.js} +7 -7
  43. package/dist/_node-chunks/{mdx-N42X6CFJ-XXQ6YIDF.js → mdx-N42X6CFJ-RAL72UTP.js} +8 -8
  44. package/dist/_node-chunks/{p-limit-P6ND7SUA.js → p-limit-6PUJQL5X.js} +18 -14
  45. package/dist/babel/index.js +10 -10
  46. package/dist/bin/core.js +12 -12
  47. package/dist/bin/dispatcher.js +11 -11
  48. package/dist/bin/loader.js +9 -9
  49. package/dist/cli/index.d.ts +1504 -424
  50. package/dist/cli/index.js +18 -18
  51. package/dist/common/index.d.ts +1319 -271
  52. package/dist/common/index.js +19 -19
  53. package/dist/components/index.d.ts +4 -1
  54. package/dist/components/index.js +228 -227
  55. package/dist/core-events/index.d.ts +23 -7
  56. package/dist/core-events/index.js +5 -1
  57. package/dist/core-server/index.d.ts +105 -3
  58. package/dist/core-server/index.js +992 -613
  59. package/dist/core-server/presets/common-manager.js +208 -160
  60. package/dist/core-server/presets/common-override-preset.js +11 -11
  61. package/dist/core-server/presets/common-preset.js +558 -4534
  62. package/dist/csf/index.d.ts +147 -15
  63. package/dist/csf/index.js +52 -23
  64. package/dist/csf-tools/index.d.ts +19 -1
  65. package/dist/csf-tools/index.js +11 -9
  66. package/dist/docs-tools/index.d.ts +2 -2
  67. package/dist/docs-tools/index.js +4 -5
  68. package/dist/manager/globals-runtime.js +2749 -6907
  69. package/dist/manager/runtime.js +2939 -2295
  70. package/dist/manager-api/index.d.ts +89 -21
  71. package/dist/manager-api/index.js +82 -23
  72. package/dist/mocking-utils/index.js +8 -8
  73. package/dist/node-logger/index.d.ts +1453 -108
  74. package/dist/node-logger/index.js +9 -9
  75. package/dist/preview/runtime.js +784 -5059
  76. package/dist/preview-api/index.d.ts +26 -1
  77. package/dist/preview-api/index.js +11 -8
  78. package/dist/router/index.js +5 -4
  79. package/dist/server-errors.js +11 -11
  80. package/dist/telemetry/index.d.ts +14 -2
  81. package/dist/telemetry/index.js +23 -22
  82. package/dist/theming/index.d.ts +5 -5
  83. package/dist/theming/index.js +21 -2
  84. package/dist/types/index.d.ts +21 -9
  85. package/dist/viewport/index.d.ts +5 -3
  86. package/dist/viewport/index.js +12 -3
  87. package/package.json +27 -26
  88. package/dist/_browser-chunks/chunk-2NDLAB5X.js +0 -363
  89. package/dist/_browser-chunks/chunk-CLSHX4VX.js +0 -4140
  90. package/dist/_browser-chunks/chunk-HPYUT3WS.js +0 -199
  91. package/dist/_browser-chunks/chunk-XCZK5QUJ.js +0 -0
  92. package/dist/_node-chunks/camelcase-5XDKQT3J.js +0 -37
  93. package/dist/_node-chunks/chunk-GXQRT5M6.js +0 -61
  94. package/dist/_node-chunks/chunk-MOQRBTWA.js +0 -70
  95. package/dist/_node-chunks/chunk-PRNP2HO6.js +0 -23
  96. package/dist/_node-chunks/chunk-VKMYOVNS.js +0 -18
  97. package/dist/_node-chunks/dist-YRSVYE5A.js +0 -121
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_3h3bsnbtanf from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_3h3bsnbtanf from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_3h3bsnbtanf from "node:module";
1
+ import CJS_COMPAT_NODE_URL_phceqgr585q from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_phceqgr585q from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_phceqgr585q from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_3h3bsnbtanf.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_3h3bsnbtanf.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_3h3bsnbtanf.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_phceqgr585q.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_phceqgr585q.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_phceqgr585q.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __commonJS
14
- } from "./chunk-PZCWRKQE.js";
14
+ } from "./chunk-AXDM43NU.js";
15
15
 
16
16
  // ../../node_modules/picocolors/picocolors.js
17
17
  var require_picocolors = __commonJS({
@@ -0,0 +1,23 @@
1
+ import CJS_COMPAT_NODE_URL_phceqgr585q from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_phceqgr585q from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_phceqgr585q from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_phceqgr585q.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_phceqgr585q.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_phceqgr585q.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ any
14
+ } from "./chunk-WNGL2VRJ.js";
15
+
16
+ // src/cli/detect.ts
17
+ async function detectPnp() {
18
+ return !!any([".pnp.js", ".pnp.cjs"]);
19
+ }
20
+
21
+ export {
22
+ detectPnp
23
+ };
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_3h3bsnbtanf from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_3h3bsnbtanf from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_3h3bsnbtanf from "node:module";
1
+ import CJS_COMPAT_NODE_URL_phceqgr585q from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_phceqgr585q from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_phceqgr585q from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_3h3bsnbtanf.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_3h3bsnbtanf.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_3h3bsnbtanf.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_phceqgr585q.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_phceqgr585q.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_phceqgr585q.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
  version
14
- } from "./chunk-VKMYOVNS.js";
14
+ } from "./chunk-4UYAC7Y2.js";
15
15
  import {
16
16
  createFileSystemCache,
17
17
  execa,
@@ -19,20 +19,30 @@ import {
19
19
  getProjectRoot,
20
20
  resolvePathInStorybookCache,
21
21
  up
22
- } from "./chunk-MWWAQ5S4.js";
22
+ } from "./chunk-IZ3ATSWZ.js";
23
+ import {
24
+ DATA_FETCHING_PACKAGES,
25
+ I18N_PACKAGES,
26
+ ROUTER_PACKAGES,
27
+ STATE_MANAGEMENT_PACKAGES,
28
+ STYLING_PACKAGES,
29
+ TEST_PACKAGES,
30
+ UI_LIBRARY_PACKAGES,
31
+ matchesPackagePattern
32
+ } from "./chunk-PHX5XNP7.js";
23
33
  import {
24
34
  globalSettings
25
- } from "./chunk-3Y5VHKPI.js";
35
+ } from "./chunk-3SKE4CCB.js";
26
36
  import {
27
37
  resolvePackageDir
28
- } from "./chunk-OUDQWDHY.js";
38
+ } from "./chunk-APUXGW3Y.js";
29
39
  import {
30
40
  slash
31
- } from "./chunk-73GYSTNZ.js";
41
+ } from "./chunk-B422K4XV.js";
32
42
  import {
33
43
  __commonJS,
34
44
  __toESM
35
- } from "./chunk-PZCWRKQE.js";
45
+ } from "./chunk-AXDM43NU.js";
36
46
 
37
47
  // ../../node_modules/fetch-retry/index.js
38
48
  var require_fetch_retry = __commonJS({
@@ -278,6 +288,106 @@ function getHasRouterPackage(packageJson) {
278
288
  );
279
289
  }
280
290
 
291
+ // src/telemetry/get-known-packages.ts
292
+ import semver from "semver";
293
+
294
+ // src/telemetry/package-json.ts
295
+ import { fileURLToPath, pathToFileURL } from "node:url";
296
+ var getActualPackageVersions = async (packages) => {
297
+ let packageNames = Object.keys(packages);
298
+ return Promise.all(packageNames.map(getActualPackageVersion));
299
+ }, getActualPackageVersion = async (packageName) => {
300
+ try {
301
+ let packageJson = await getActualPackageJson(packageName);
302
+ return {
303
+ name: packageJson?.name || packageName,
304
+ version: packageJson?.version || null
305
+ };
306
+ } catch {
307
+ return {
308
+ name: packageName,
309
+ version: null
310
+ };
311
+ }
312
+ }, getActualPackageJson = async (packageName) => {
313
+ try {
314
+ let resolvedPackageJsonPath = up({
315
+ cwd: fileURLToPath(import.meta.resolve(packageName, process.cwd()))
316
+ });
317
+ resolvedPackageJsonPath || (resolvedPackageJsonPath = import.meta.resolve(`${packageName}/package.json`, process.cwd()));
318
+ let { default: packageJson } = await import(pathToFileURL(resolvedPackageJsonPath).href, {
319
+ with: { type: "json" }
320
+ });
321
+ return packageJson;
322
+ } catch {
323
+ return;
324
+ }
325
+ };
326
+
327
+ // src/telemetry/get-known-packages.ts
328
+ function getSafeVersionSpecifier(version2) {
329
+ if (!version2)
330
+ return null;
331
+ if (version2 === "*")
332
+ return "latest";
333
+ if (version2.includes(":"))
334
+ return "custom-protocol";
335
+ if ([
336
+ "latest",
337
+ "next",
338
+ "canary",
339
+ "beta",
340
+ "alpha",
341
+ "rc",
342
+ "nightly",
343
+ "dev",
344
+ "stable",
345
+ "experimental",
346
+ "insiders",
347
+ "preview"
348
+ ].includes(version2))
349
+ return version2;
350
+ try {
351
+ let operator = version2.trim().match(/^[~^]/)?.[0] ?? "", coerced = semver.coerce(version2);
352
+ return coerced ? `${operator}${coerced.version}` : null;
353
+ } catch {
354
+ return "could-not-be-parsed-by-semver";
355
+ }
356
+ }
357
+ async function analyzeEcosystemPackages(packageJson) {
358
+ let allDependencies = {
359
+ ...packageJson?.dependencies,
360
+ ...packageJson?.devDependencies,
361
+ ...packageJson?.peerDependencies
362
+ }, depNames = Object.keys(allDependencies), pickMatches = (packages) => depNames.filter((dep) => matchesPackagePattern(dep, packages)), pickDepsObject = (packages) => {
363
+ let result = Object.fromEntries(
364
+ pickMatches(packages).map((dep) => {
365
+ let rawVersion = allDependencies[dep], version2 = getSafeVersionSpecifier(rawVersion);
366
+ return [dep, version2];
367
+ })
368
+ );
369
+ return Object.keys(result).length === 0 ? null : result;
370
+ }, testPackagesResult = Object.fromEntries(
371
+ await Promise.all(
372
+ depNames.filter((dep) => matchesPackagePattern(dep, TEST_PACKAGES)).map(async (dep) => {
373
+ let resolved = (await getActualPackageVersion(dep))?.version ?? allDependencies[dep], version2 = getSafeVersionSpecifier(resolved);
374
+ return [dep, version2];
375
+ })
376
+ )
377
+ ), testPackages = Object.keys(testPackagesResult).length === 0 ? null : testPackagesResult, stylingPackages = pickDepsObject(STYLING_PACKAGES), stateManagementPackages = pickDepsObject(STATE_MANAGEMENT_PACKAGES), dataFetchingPackages = pickDepsObject(DATA_FETCHING_PACKAGES), uiLibraryPackages = pickDepsObject(UI_LIBRARY_PACKAGES), i18nPackages = pickDepsObject(I18N_PACKAGES), routerPackages2 = pickDepsObject(ROUTER_PACKAGES);
378
+ return {
379
+ ...testPackages && { testPackages },
380
+ ...stylingPackages && { stylingPackages },
381
+ ...stateManagementPackages && {
382
+ stateManagementPackages
383
+ },
384
+ ...dataFetchingPackages && { dataFetchingPackages },
385
+ ...uiLibraryPackages && { uiLibraryPackages },
386
+ ...i18nPackages && { i18nPackages },
387
+ ...routerPackages2 && { routerPackages: routerPackages2 }
388
+ };
389
+ }
390
+
281
391
  // src/telemetry/get-monorepo-type.ts
282
392
  import { existsSync, readFileSync } from "node:fs";
283
393
  import { join } from "node:path";
@@ -578,39 +688,6 @@ var getPortableStoriesFileCountUncached = async (path3) => {
578
688
  async () => getPortableStoriesFileCountUncached(path3)
579
689
  );
580
690
 
581
- // src/telemetry/package-json.ts
582
- import { fileURLToPath, pathToFileURL } from "node:url";
583
- var getActualPackageVersions = async (packages) => {
584
- let packageNames = Object.keys(packages);
585
- return Promise.all(packageNames.map(getActualPackageVersion));
586
- }, getActualPackageVersion = async (packageName) => {
587
- try {
588
- let packageJson = await getActualPackageJson(packageName);
589
- return {
590
- name: packageJson?.name || packageName,
591
- version: packageJson?.version || null
592
- };
593
- } catch {
594
- return {
595
- name: packageName,
596
- version: null
597
- };
598
- }
599
- }, getActualPackageJson = async (packageName) => {
600
- try {
601
- let resolvedPackageJsonPath = up({
602
- cwd: fileURLToPath(import.meta.resolve(packageName, process.cwd()))
603
- });
604
- resolvedPackageJsonPath || (resolvedPackageJsonPath = import.meta.resolve(`${packageName}/package.json`, process.cwd()));
605
- let { default: packageJson } = await import(pathToFileURL(resolvedPackageJsonPath).href, {
606
- with: { type: "json" }
607
- });
608
- return packageJson;
609
- } catch {
610
- return;
611
- }
612
- };
613
-
614
691
  // src/telemetry/storybook-metadata.ts
615
692
  var metaFrameworks = {
616
693
  next: "Next",
@@ -650,33 +727,7 @@ var metaFrameworks = {
650
727
  version: version2 || "unknown"
651
728
  };
652
729
  }
653
- let testPackages = [
654
- "playwright",
655
- "vitest",
656
- "jest",
657
- "cypress",
658
- "nightwatch",
659
- "webdriver",
660
- "@web/test-runner",
661
- "puppeteer",
662
- "karma",
663
- "jasmine",
664
- "chai",
665
- "testing-library",
666
- "@ngneat/spectator",
667
- "wdio",
668
- "msw",
669
- "miragejs",
670
- "sinon",
671
- "chromatic"
672
- ], testPackageDeps = Object.keys(allDependencies).filter(
673
- (dep) => testPackages.find((pkg) => dep.includes(pkg))
674
- );
675
- metadata.testPackages = Object.fromEntries(
676
- await Promise.all(
677
- testPackageDeps.map(async (dep) => [dep, (await getActualPackageVersion(dep))?.version])
678
- )
679
- ), metadata.hasRouterPackage = getHasRouterPackage(packageJson);
730
+ metadata.knownPackages = await analyzeEcosystemPackages(packageJson), metadata.hasRouterPackage = getHasRouterPackage(packageJson);
680
731
  let monorepoType = getMonorepoType();
681
732
  monorepoType && (metadata.monorepo = monorepoType), metadata.packageManager = await getPackageManagerInfo();
682
733
  let language = allDependencies.typescript ? "typescript" : "javascript";
@@ -738,7 +789,8 @@ var metaFrameworks = {
738
789
  language,
739
790
  storybookPackages,
740
791
  addons,
741
- hasStorybookEslint
792
+ hasStorybookEslint,
793
+ packageJsonType: packageJson.type ?? "unknown"
742
794
  };
743
795
  };
744
796
  async function getPackageJsonDetails() {