storybook 9.0.0-alpha.20 → 9.0.0-alpha.21

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 (72) hide show
  1. package/assets/server/base-preview-head.html +1 -3
  2. package/dist/actions/decorator.js +34 -38
  3. package/dist/actions/index.cjs +1 -4
  4. package/dist/actions/index.js +1 -4
  5. package/dist/actions/preview.cjs +1 -4
  6. package/dist/actions/preview.js +1 -4
  7. package/dist/babel/index.cjs +822 -816
  8. package/dist/babel/index.js +822 -816
  9. package/dist/backgrounds/index.cjs +16 -16
  10. package/dist/backgrounds/index.js +14 -14
  11. package/dist/backgrounds/preview.cjs +34 -34
  12. package/dist/backgrounds/preview.js +29 -29
  13. package/dist/bin/index.cjs +67 -65
  14. package/dist/bin/index.js +61 -59
  15. package/dist/builder-manager/index.cjs +482 -472
  16. package/dist/builder-manager/index.js +283 -273
  17. package/dist/channels/index.js +941 -919
  18. package/dist/cli/bin/index.cjs +1 -1
  19. package/dist/cli/bin/index.js +1 -1
  20. package/dist/cli/index.cjs +61752 -7591
  21. package/dist/cli/index.d.ts +22 -14
  22. package/dist/cli/index.js +61775 -7614
  23. package/dist/common/index.cjs +16015 -8979
  24. package/dist/common/index.d.ts +30 -1
  25. package/dist/common/index.js +16105 -9063
  26. package/dist/components/index.cjs +3694 -3643
  27. package/dist/components/index.d.ts +5 -2
  28. package/dist/components/index.js +2352 -2294
  29. package/dist/core-server/index.cjs +3540 -3540
  30. package/dist/core-server/index.js +730 -730
  31. package/dist/core-server/presets/common-manager.js +2642 -2592
  32. package/dist/core-server/presets/common-preset.cjs +723 -715
  33. package/dist/core-server/presets/common-preset.js +10 -2
  34. package/dist/docs-tools/index.js +640 -632
  35. package/dist/highlight/index.cjs +16 -16
  36. package/dist/highlight/index.d.ts +45 -1
  37. package/dist/highlight/index.js +2 -2
  38. package/dist/highlight/preview.cjs +522 -68
  39. package/dist/highlight/preview.js +508 -56
  40. package/dist/instrumenter/index.js +1179 -1170
  41. package/dist/manager/globals-module-info.cjs +1 -0
  42. package/dist/manager/globals-module-info.js +1 -0
  43. package/dist/manager/globals-runtime.js +19385 -19190
  44. package/dist/manager/runtime.js +2084 -2079
  45. package/dist/manager-api/index.cjs +352 -352
  46. package/dist/manager-api/index.js +1694 -1663
  47. package/dist/manager-errors.js +41 -37
  48. package/dist/measure/index.cjs +99 -97
  49. package/dist/measure/index.js +95 -93
  50. package/dist/measure/preview.cjs +127 -125
  51. package/dist/measure/preview.js +125 -123
  52. package/dist/outline/index.cjs +41 -41
  53. package/dist/outline/index.js +12 -12
  54. package/dist/outline/preview.cjs +23 -23
  55. package/dist/outline/preview.js +7 -7
  56. package/dist/preview/runtime.js +13577 -12959
  57. package/dist/preview-api/index.cjs +0 -1
  58. package/dist/preview-api/index.d.ts +120 -385
  59. package/dist/preview-api/index.js +827 -812
  60. package/dist/preview-errors.cjs +65 -51
  61. package/dist/preview-errors.d.ts +6 -2
  62. package/dist/preview-errors.js +176 -142
  63. package/dist/server-errors.cjs +105 -72
  64. package/dist/server-errors.d.ts +9 -1
  65. package/dist/server-errors.js +87 -54
  66. package/dist/telemetry/index.cjs +374 -370
  67. package/dist/telemetry/index.js +460 -456
  68. package/dist/test/index.js +9831 -9743
  69. package/dist/test/preview.d.ts +0 -6
  70. package/dist/test/preview.js +3628 -3568
  71. package/dist/types/index.d.ts +72 -6
  72. package/package.json +1 -1
@@ -4,20 +4,20 @@ import { dirname as ESM_COMPAT_dirname } from 'node:path';
4
4
  const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
5
5
  const __dirname = ESM_COMPAT_dirname(__filename);
6
6
  const require = ESM_COMPAT_Module.createRequire(import.meta.url);
7
- var ie = Object.create;
7
+ var ce = Object.create;
8
8
  var R = Object.defineProperty;
9
- var ce = Object.getOwnPropertyDescriptor;
10
- var ue = Object.getOwnPropertyNames;
11
- var le = Object.getPrototypeOf, me = Object.prototype.hasOwnProperty;
9
+ var ue = Object.getOwnPropertyDescriptor;
10
+ var le = Object.getOwnPropertyNames;
11
+ var me = Object.getPrototypeOf, de = Object.prototype.hasOwnProperty;
12
12
  var r = (t, e) => R(t, "name", { value: e, configurable: !0 });
13
13
  var O = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
14
- var de = (t, e, o, n) => {
14
+ var ge = (t, e, o, n) => {
15
15
  if (e && typeof e == "object" || typeof e == "function")
16
- for (let c of ue(e))
17
- !me.call(t, c) && c !== o && R(t, c, { get: () => e[c], enumerable: !(n = ce(e, c)) || n.enumerable });
16
+ for (let c of le(e))
17
+ !de.call(t, c) && c !== o && R(t, c, { get: () => e[c], enumerable: !(n = ue(e, c)) || n.enumerable });
18
18
  return t;
19
19
  };
20
- var A = (t, e, o) => (o = t != null ? ie(le(t)) : {}, de(
20
+ var A = (t, e, o) => (o = t != null ? ce(me(t)) : {}, ge(
21
21
  // If the importer is in node compatibility mode or this is not an ESM
22
22
  // file that has been converted to a CommonJS file using a Babel-
23
23
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -27,19 +27,19 @@ var A = (t, e, o) => (o = t != null ? ie(le(t)) : {}, de(
27
27
  ));
28
28
 
29
29
  // ../node_modules/picocolors/picocolors.js
30
- var w = O((Ee, k) => {
30
+ var C = O((fe, k) => {
31
31
  var E = process || {}, _ = E.argv || [], h = E.env || {}, be = !(h.NO_COLOR || _.includes("--no-color")) && (!!h.FORCE_COLOR || _.includes(
32
- "--color") || E.platform === "win32" || (E.stdout || {}).isTTY && h.TERM !== "dumb" || !!h.CI), ge = /* @__PURE__ */ r((t, e, o = t) => (n) => {
32
+ "--color") || E.platform === "win32" || (E.stdout || {}).isTTY && h.TERM !== "dumb" || !!h.CI), pe = /* @__PURE__ */ r((t, e, o = t) => (n) => {
33
33
  let c = "" + n, u = c.indexOf(e, t.length);
34
- return ~u ? t + pe(c, e, o, u) + e : t + c + e;
35
- }, "formatter"), pe = /* @__PURE__ */ r((t, e, o, n) => {
34
+ return ~u ? t + ye(c, e, o, u) + e : t + c + e;
35
+ }, "formatter"), ye = /* @__PURE__ */ r((t, e, o, n) => {
36
36
  let c = "", u = 0;
37
37
  do
38
38
  c += t.substring(u, n) + o, u = n + e.length, n = t.indexOf(e, u);
39
39
  while (~n);
40
40
  return c + t.substring(u);
41
- }, "replaceClose"), C = /* @__PURE__ */ r((t = be) => {
42
- let e = t ? ge : () => String;
41
+ }, "replaceClose"), w = /* @__PURE__ */ r((t = be) => {
42
+ let e = t ? pe : () => String;
43
43
  return {
44
44
  isColorSupported: t,
45
45
  reset: e("\x1B[0m", "\x1B[0m"),
@@ -85,12 +85,12 @@ var w = O((Ee, k) => {
85
85
  bgWhiteBright: e("\x1B[107m", "\x1B[49m")
86
86
  };
87
87
  }, "createColors");
88
- k.exports = C();
89
- k.exports.createColors = C;
88
+ k.exports = w();
89
+ k.exports.createColors = w;
90
90
  });
91
91
 
92
92
  // ../node_modules/ts-dedent/dist/index.js
93
- var M = O((y) => {
93
+ var S = O((y) => {
94
94
  "use strict";
95
95
  Object.defineProperty(y, "__esModule", { value: !0 });
96
96
  y.dedent = void 0;
@@ -99,11 +99,11 @@ var M = O((y) => {
99
99
  e[o - 1] = arguments[o];
100
100
  var n = Array.from(typeof t == "string" ? [t] : t);
101
101
  n[n.length - 1] = n[n.length - 1].replace(/\r?\n([\t ]*)$/, "");
102
- var c = n.reduce(function(m, x) {
103
- var p = x.match(/\n([\t ]+|(?!\s).)/g);
104
- return p ? m.concat(p.map(function(f) {
105
- var b, g;
106
- return (g = (b = f.match(/[\t ]/g)) === null || b === void 0 ? void 0 : b.length) !== null && g !== void 0 ? g : 0;
102
+ var c = n.reduce(function(m, f) {
103
+ var p = f.match(/\n([\t ]+|(?!\s).)/g);
104
+ return p ? m.concat(p.map(function(x) {
105
+ var g, b;
106
+ return (b = (g = x.match(/[\t ]/g)) === null || g === void 0 ? void 0 : g.length) !== null && b !== void 0 ? b : 0;
107
107
  })) : m;
108
108
  }, []);
109
109
  if (c.length) {
@@ -116,14 +116,14 @@ var M = O((y) => {
116
116
  }
117
117
  n[0] = n[0].replace(/^\r?\n/, "");
118
118
  var d = n[0];
119
- return e.forEach(function(m, x) {
120
- var p = d.match(/(?:^|\n)( *)$/), f = p ? p[1] : "", b = m;
119
+ return e.forEach(function(m, f) {
120
+ var p = d.match(/(?:^|\n)( *)$/), x = p ? p[1] : "", g = m;
121
121
  typeof m == "string" && m.includes(`
122
- `) && (b = String(m).split(`
123
- `).map(function(g, ae) {
124
- return ae === 0 ? g : "" + f + g;
122
+ `) && (g = String(m).split(`
123
+ `).map(function(b, ie) {
124
+ return ie === 0 ? b : "" + x + b;
125
125
  }).join(`
126
- `)), d += b + n[x + 1];
126
+ `)), d += g + n[f + 1];
127
127
  }), d;
128
128
  }
129
129
  r(I, "dedent");
@@ -132,17 +132,17 @@ var M = O((y) => {
132
132
  });
133
133
 
134
134
  // src/server-errors.ts
135
- var l = A(w(), 1), i = A(M(), 1);
135
+ var l = A(C(), 1), i = A(S(), 1);
136
136
 
137
137
  // src/storybook-error.ts
138
- function S({
138
+ function M({
139
139
  code: t,
140
140
  category: e
141
141
  }) {
142
142
  let o = String(t).padStart(4, "0");
143
143
  return `SB_${e}_${o}`;
144
144
  }
145
- r(S, "parseErrorCode");
145
+ r(M, "parseErrorCode");
146
146
  var a = class t extends Error {
147
147
  constructor(o) {
148
148
  super(t.getFullMessage(o));
@@ -159,7 +159,7 @@ var a = class t extends Error {
159
159
  r(this, "StorybookError");
160
160
  }
161
161
  get fullErrorCode() {
162
- return S({ code: this.code, category: this.category });
162
+ return M({ code: this.code, category: this.category });
163
163
  }
164
164
  /** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
165
165
  get name() {
@@ -174,7 +174,7 @@ var a = class t extends Error {
174
174
  message: u
175
175
  }) {
176
176
  let d;
177
- return o === !0 ? d = `https://storybook.js.org/error/${S({ code: n, category: c })}` : typeof o == "string" ? d = o : Array.isArray(o) &&
177
+ return o === !0 ? d = `https://storybook.js.org/error/${M({ code: n, category: c })}` : typeof o == "string" ? d = o : Array.isArray(o) &&
178
178
  (d = `
179
179
  ${o.map((m) => ` - ${m}`).join(`
180
180
  `)}`), `${u}${d != null ? `
@@ -185,7 +185,7 @@ More info: ${d}
185
185
  };
186
186
 
187
187
  // src/server-errors.ts
188
- var ye = /* @__PURE__ */ ((s) => (s.CLI = "CLI", s.CLI_INIT = "CLI_INIT", s.CLI_AUTOMIGRATE = "CLI_AUTOMIGRATE", s.CLI_UPGRADE = "CLI_UPGRAD\
188
+ var he = /* @__PURE__ */ ((s) => (s.CLI = "CLI", s.CLI_INIT = "CLI_INIT", s.CLI_AUTOMIGRATE = "CLI_AUTOMIGRATE", s.CLI_UPGRADE = "CLI_UPGRAD\
189
189
  E", s.CLI_ADD = "CLI_ADD", s.CODEMOD = "CODEMOD", s.CORE_SERVER = "CORE-SERVER", s.CSF_PLUGIN = "CSF-PLUGIN", s.CSF_TOOLS = "CSF-TOOLS", s.CORE_COMMON =
190
190
  "CORE-COMMON", s.NODE_LOGGER = "NODE-LOGGER", s.TELEMETRY = "TELEMETRY", s.BUILDER_MANAGER = "BUILDER-MANAGER", s.BUILDER_VITE = "BUILDER-VI\
191
191
  TE", s.BUILDER_WEBPACK5 = "BUILDER-WEBPACK5", s.SOURCE_LOADER = "SOURCE-LOADER", s.POSTINSTALL = "POSTINSTALL", s.DOCS_TOOLS = "DOCS-TOOLS",
@@ -195,7 +195,7 @@ FRAMEWORK_HTML-VITE", s.FRAMEWORK_HTML_WEBPACK5 = "FRAMEWORK_HTML-WEBPACK5", s.F
195
195
  "FRAMEWORK_REACT-WEBPACK5", s.FRAMEWORK_SERVER_WEBPACK5 = "FRAMEWORK_SERVER-WEBPACK5", s.FRAMEWORK_SVELTE_VITE = "FRAMEWORK_SVELTE-VITE", s.
196
196
  FRAMEWORK_SVELTEKIT = "FRAMEWORK_SVELTEKIT", s.FRAMEWORK_VUE_VITE = "FRAMEWORK_VUE-VITE", s.FRAMEWORK_VUE_WEBPACK5 = "FRAMEWORK_VUE-WEBPACK5",
197
197
  s.FRAMEWORK_VUE3_VITE = "FRAMEWORK_VUE3-VITE", s.FRAMEWORK_VUE3_WEBPACK5 = "FRAMEWORK_VUE3-WEBPACK5", s.FRAMEWORK_WEB_COMPONENTS_VITE = "FRA\
198
- MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WEB-COMPONENTS-WEBPACK5", s))(ye || {}), T = class extends a {
198
+ MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WEB-COMPONENTS-WEBPACK5", s))(he || {}), T = class extends a {
199
199
  static {
200
200
  r(this, "NxProjectDetectedError");
201
201
  }
@@ -209,7 +209,7 @@ MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WE
209
209
  Run "nx g @nx/storybook:configuration" to add Storybook to your project.`
210
210
  });
211
211
  }
212
- }, v = class extends a {
212
+ }, W = class extends a {
213
213
  static {
214
214
  r(this, "MissingFrameworkFieldError");
215
215
  }
@@ -224,7 +224,7 @@ MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WE
224
224
  Please run 'npx storybook automigrate' to automatically fix your config.`
225
225
  });
226
226
  }
227
- }, W = class extends a {
227
+ }, v = class extends a {
228
228
  constructor(o) {
229
229
  super({
230
230
  category: "CORE-COMMON",
@@ -290,7 +290,7 @@ MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WE
290
290
  Please check your main configuration file and make sure it exports a 'stories' field that is not an empty array.`
291
291
  });
292
292
  }
293
- }, P = class extends a {
293
+ }, N = class extends a {
294
294
  static {
295
295
  r(this, "WebpackMissingStatsError");
296
296
  }
@@ -307,7 +307,7 @@ MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WE
307
307
  Storybook needs Webpack stats (including errors) in order to build correctly.`
308
308
  });
309
309
  }
310
- }, N = class extends a {
310
+ }, j = class extends a {
311
311
  constructor(o) {
312
312
  super({
313
313
  category: "BUILDER-WEBPACK5",
@@ -320,16 +320,16 @@ MEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WE
320
320
  r(this, "WebpackInvocationError");
321
321
  }
322
322
  };
323
- function j(t = "") {
323
+ function P(t = "") {
324
324
  return t.replace(/\u001B\[[0-9;]*m/g, "");
325
325
  }
326
- r(j, "removeAnsiEscapeCodes");
326
+ r(P, "removeAnsiEscapeCodes");
327
327
  var V = class extends a {
328
328
  constructor(o) {
329
329
  o.errors = o.errors.map((n) => ({
330
330
  ...n,
331
- message: j(n.message),
332
- stack: j(n.stack),
331
+ message: P(n.message),
332
+ stack: P(n.stack),
333
333
  name: n.name
334
334
  }));
335
335
  super({
@@ -451,7 +451,7 @@ var V = class extends a {
451
451
  static {
452
452
  r(this, "GoogleFontsLoadingError");
453
453
  }
454
- }, H = class extends a {
454
+ }, J = class extends a {
455
455
  static {
456
456
  r(this, "SvelteViteWithSvelteKitError");
457
457
  }
@@ -465,7 +465,7 @@ var V = class extends a {
465
465
  Please use the @storybook/sveltekit framework instead.`
466
466
  });
467
467
  }
468
- }, J = class extends a {
468
+ }, X = class extends a {
469
469
  constructor(o) {
470
470
  super({
471
471
  category: "CORE-SERVER",
@@ -488,7 +488,7 @@ var V = class extends a {
488
488
  static {
489
489
  r(this, "NoMatchingExportError");
490
490
  }
491
- }, X = class extends a {
491
+ }, H = class extends a {
492
492
  constructor(o) {
493
493
  let n = [
494
494
  `Storybook failed to load ${o.location}`,
@@ -708,10 +708,42 @@ var V = class extends a {
708
708
  static {
709
709
  r(this, "FindPackageVersionsError");
710
710
  }
711
+ }, ae = class extends a {
712
+ constructor(o) {
713
+ super({
714
+ category: "FRAMEWORK_NEXTJS",
715
+ code: 3,
716
+ message: i.dedent`
717
+ Incompatible PostCSS configuration format detected.
718
+
719
+ Next.js uses an array-based format for plugins which is not compatible with Vite:
720
+
721
+ // ❌ Incompatible format (used by Next.js)
722
+ const config = {
723
+ plugins: ["@tailwindcss/postcss"],
724
+ };
725
+
726
+ Please transform your PostCSS config to use the object-based format, which is compatible with Next.js and Vite:
727
+
728
+ // ✅ Compatible format (works with Next.js and Vite)
729
+ const config = {
730
+ plugins: {
731
+ "@tailwindcss/postcss": {},
732
+ },
733
+ };
734
+
735
+ Original error: ${o.error.message}
736
+ `
737
+ });
738
+ this.data = o;
739
+ }
740
+ static {
741
+ r(this, "IncompatiblePostCssConfigError");
742
+ }
711
743
  };
712
744
  export {
713
745
  F as AngularLegacyBuildOptionsError,
714
- ye as Category,
746
+ he as Category,
715
747
  L as ConflictingStaticDirConfigError,
716
748
  K as CouldNotEvaluateFrameworkError,
717
749
  D as CriticalPresetLoadError,
@@ -719,24 +751,25 @@ export {
719
751
  Z as GenerateNewProjectOnInitError,
720
752
  G as GoogleFontsDownloadError,
721
753
  Y as GoogleFontsLoadingError,
722
- W as InvalidFrameworkNameError,
754
+ ae as IncompatiblePostCssConfigError,
755
+ v as InvalidFrameworkNameError,
723
756
  B as InvalidStoriesEntryError,
724
- X as MainFileESMOnlyImportError,
757
+ H as MainFileESMOnlyImportError,
725
758
  q as MainFileEvaluationError,
726
759
  z as MainFileMissingError,
727
760
  $ as MissingAngularJsonError,
728
761
  U as MissingBuilderError,
729
- v as MissingFrameworkFieldError,
730
- J as NoMatchingExportError,
762
+ W as MissingFrameworkFieldError,
763
+ X as NoMatchingExportError,
731
764
  se as NoStatsForViteDevError,
732
765
  T as NxProjectDetectedError,
733
766
  Q as StatusTypeIdMismatchError,
734
- H as SvelteViteWithSvelteKitError,
767
+ J as SvelteViteWithSvelteKitError,
735
768
  re as UpgradeStorybookInWrongWorkingDirectory,
736
769
  ee as UpgradeStorybookToLowerVersionError,
737
770
  oe as UpgradeStorybookToSameVersionError,
738
771
  te as UpgradeStorybookUnknownCurrentVersionError,
739
772
  V as WebpackCompilationError,
740
- N as WebpackInvocationError,
741
- P as WebpackMissingStatsError
773
+ j as WebpackInvocationError,
774
+ N as WebpackMissingStatsError
742
775
  };