storybook 10.1.0-alpha.11 → 10.1.0-alpha.13

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 (88) hide show
  1. package/dist/_browser-chunks/{chunk-74YHFU5B.js → chunk-2XZMBGTA.js} +1 -1
  2. package/dist/_browser-chunks/{chunk-EBHB6RPS.js → chunk-FQ7SLVLR.js} +6 -1
  3. package/dist/_browser-chunks/{chunk-X3DUQ5RA.js → chunk-GFY5R5EY.js} +1 -1
  4. package/dist/_node-chunks/{builder-manager-PMPHOSM2.js → builder-manager-DWDUVXZM.js} +27 -22
  5. package/dist/_node-chunks/{chunk-MJ3WOS6F.js → camelcase-EETCRTJX.js} +8 -8
  6. package/dist/_node-chunks/{chunk-UY26MQLT.js → chunk-2W4GZCLE.js} +7 -7
  7. package/dist/_node-chunks/chunk-447655DM.js +20 -0
  8. package/dist/_node-chunks/{chunk-GG2WQZSG.js → chunk-4EJUC2SD.js} +4998 -1685
  9. package/dist/_node-chunks/chunk-4ZJOH2UN.js +61 -0
  10. package/dist/_node-chunks/chunk-654SJIMS.js +23 -0
  11. package/dist/_node-chunks/{chunk-5QK5MSOI.js → chunk-7IAVT2FU.js} +7 -7
  12. package/dist/_node-chunks/{chunk-WLHMN7AP.js → chunk-7KFHRNOT.js} +7 -7
  13. package/dist/_node-chunks/{chunk-6ZOLETQK.js → chunk-AZIPBEBK.js} +6 -6
  14. package/dist/_node-chunks/{chunk-AKTRSR3O.js → chunk-B76FDKVB.js} +6 -6
  15. package/dist/_node-chunks/chunk-B7PGKETD.js +3781 -0
  16. package/dist/_node-chunks/{chunk-QECOQWRJ.js → chunk-CLUBH2LP.js} +55 -36
  17. package/dist/_node-chunks/{chunk-PHOZWZZO.js → chunk-CMYD2JNN.js} +7 -7
  18. package/dist/_node-chunks/{chunk-LR3QITDI.js → chunk-DIPKXLEP.js} +55 -32
  19. package/dist/_node-chunks/{chunk-4GZCFQFG.js → chunk-DPFYWXEA.js} +6 -6
  20. package/dist/_node-chunks/{chunk-LCZO45L7.js → chunk-FCVNHU2F.js} +7 -7
  21. package/dist/_node-chunks/{chunk-R6HWGZWD.js → chunk-JQ7RQS5Q.js} +6 -6
  22. package/dist/_node-chunks/chunk-LEL5OSY3.js +18 -0
  23. package/dist/_node-chunks/{chunk-BBOP3XCK.js → chunk-LPKSBF62.js} +6 -6
  24. package/dist/_node-chunks/chunk-LYEZOJ43.js +78 -0
  25. package/dist/_node-chunks/{chunk-ZZALGOA6.js → chunk-MIA5324I.js} +7 -7
  26. package/dist/_node-chunks/{chunk-SPQXMU2Q.js → chunk-MJM4TEMP.js} +14 -8
  27. package/dist/_node-chunks/{chunk-32NE3UE3.js → chunk-OVVZIUHS.js} +7 -7
  28. package/dist/_node-chunks/{chunk-ZZSRFAC6.js → chunk-RUUNVQ6W.js} +1108 -17
  29. package/dist/_node-chunks/{chunk-YHRFI6BE.js → chunk-URLNGLC2.js} +52 -72
  30. package/dist/_node-chunks/{chunk-XGVLB4UJ.js → chunk-WC2YEQHJ.js} +6 -6
  31. package/dist/_node-chunks/{chunk-JCRM2YVK.js → chunk-XKRVQL2G.js} +8 -8
  32. package/dist/_node-chunks/{chunk-TXZY6V6O.js → chunk-Z2OWEMX3.js} +8 -8
  33. package/dist/_node-chunks/{dist-4DWOCZUD.js → dist-22CLJ4BC.js} +9 -9
  34. package/dist/_node-chunks/{globby-AAARUKEU.js → globby-GR24TGSK.js} +9 -9
  35. package/dist/_node-chunks/{lib-HEUKGL62.js → lib-G2LGVRPC.js} +7 -7
  36. package/dist/_node-chunks/{mdx-N42X6CFJ-DCVRPS6N.js → mdx-N42X6CFJ-W6P6IDDW.js} +8 -8
  37. package/dist/_node-chunks/{p-limit-F5ZKJ6WZ.js → p-limit-K4FZHG2F.js} +7 -7
  38. package/dist/babel/index.js +10 -11
  39. package/dist/bin/core.js +32 -26
  40. package/dist/bin/dispatcher.js +31 -20
  41. package/dist/bin/loader.js +10 -13
  42. package/dist/cli/index.d.ts +692 -133
  43. package/dist/cli/index.js +1005 -177
  44. package/dist/common/index.d.ts +139 -62
  45. package/dist/common/index.js +63 -49
  46. package/dist/core-server/index.d.ts +3 -2
  47. package/dist/core-server/index.js +96 -1413
  48. package/dist/core-server/presets/common-override-preset.js +9 -9
  49. package/dist/core-server/presets/common-preset.js +25 -65
  50. package/dist/csf-tools/index.js +9 -9
  51. package/dist/manager/globals-runtime.js +32 -3
  52. package/dist/manager/runtime.js +1 -1
  53. package/dist/manager-api/index.d.ts +1 -1
  54. package/dist/manager-api/index.js +4 -4
  55. package/dist/manager-errors.d.ts +6 -0
  56. package/dist/manager-errors.js +2 -2
  57. package/dist/mocking-utils/index.d.ts +1126 -0
  58. package/dist/{_node-chunks/chunk-UGDPX5LE.js → mocking-utils/index.js} +441 -16
  59. package/dist/node-logger/index.d.ts +192 -24
  60. package/dist/node-logger/index.js +23 -3148
  61. package/dist/preview/runtime.js +31 -2
  62. package/dist/preview-api/index.d.ts +69 -68
  63. package/dist/preview-errors.d.ts +6 -0
  64. package/dist/preview-errors.js +2 -2
  65. package/dist/server-errors.d.ts +31 -1
  66. package/dist/server-errors.js +17 -10
  67. package/dist/telemetry/index.d.ts +23 -2
  68. package/dist/telemetry/index.js +25 -24
  69. package/dist/types/index.d.ts +71 -8
  70. package/dist/types/index.js +25 -1
  71. package/package.json +7 -9
  72. package/dist/_node-chunks/camelcase-K3IOOFQW.js +0 -18
  73. package/dist/_node-chunks/chunk-7I22Y76Z.js +0 -1047
  74. package/dist/_node-chunks/chunk-C2GQVDWI.js +0 -34
  75. package/dist/_node-chunks/chunk-GQJOWVVR.js +0 -3214
  76. package/dist/_node-chunks/chunk-KK4AT5F3.js +0 -1029
  77. package/dist/_node-chunks/chunk-L7MYXJUM.js +0 -1114
  78. package/dist/_node-chunks/chunk-LXG4DK35.js +0 -3171
  79. package/dist/_node-chunks/chunk-QH4V5YDB.js +0 -20
  80. package/dist/_node-chunks/chunk-WK3EMYK6.js +0 -61
  81. package/dist/_node-chunks/chunk-YK4KVMFW.js +0 -18
  82. package/dist/_node-chunks/chunk-ZZPBSYA5.js +0 -301
  83. package/dist/_node-chunks/plugin-7YY7JXCH.js +0 -123
  84. package/dist/_node-chunks/plugin-SZP3CW6W.js +0 -109
  85. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +0 -46623
  86. package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +0 -92
  87. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -32
  88. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -28
@@ -1,8 +1,32 @@
1
1
  /// <reference types="node" />
2
+ import { Readable, Writable } from 'node:stream';
2
3
  import { EventEmitter } from 'events';
3
4
  import { Buffer } from 'node:buffer';
4
5
  import { ChildProcess } from 'node:child_process';
5
- import { Readable, Writable } from 'node:stream';
6
+
7
+ interface CommonOptions {
8
+ input?: Readable;
9
+ output?: Writable;
10
+ signal?: AbortSignal;
11
+ }
12
+
13
+ type BoxAlignment = 'left' | 'center' | 'right';
14
+ interface BoxOptions extends CommonOptions {
15
+ contentAlign?: BoxAlignment;
16
+ titleAlign?: BoxAlignment;
17
+ width?: number | 'auto';
18
+ titlePadding?: number;
19
+ contentPadding?: number;
20
+ rounded?: boolean;
21
+ includePrefix?: boolean;
22
+ formatBorder?: (text: string) => string;
23
+ }
24
+
25
+ interface LogMessageOptions extends CommonOptions {
26
+ symbol?: string;
27
+ spacing?: number;
28
+ secondarySymbol?: string;
29
+ }
6
30
 
7
31
  declare namespace npmlog {
8
32
  // TODO: newStream, newGroup, setGaugeTemplate and setGaugeTemplateSet need to be added
@@ -144,6 +168,11 @@ interface TaskLogInstance {
144
168
  showLog?: boolean;
145
169
  }) => void;
146
170
  error: (message: string) => void;
171
+ group: (title: string) => {
172
+ message: (text: string, options?: any) => void;
173
+ success: (message: string) => void;
174
+ error: (message: string) => void;
175
+ };
147
176
  }
148
177
  interface SpinnerOptions {
149
178
  /** The id of the task, to be used by the log tracker. */
@@ -371,24 +400,23 @@ ExecaChildPromise<StdoutStderrType> &
371
400
  Promise<ExecaReturnValue<StdoutStderrType>>;
372
401
 
373
402
  declare const prompt: {
374
- executeTask: (childProcessFactories: (() => ExecaChildProcess) | (() => ExecaChildProcess)[], { id, intro, error, success, limitLines, }: {
375
- id: string;
403
+ executeTask: (childProcessFactories: ((signal?: AbortSignal) => ExecaChildProcess) | ((signal?: AbortSignal) => ExecaChildProcess)[], { intro, error, success, abortable, }: {
376
404
  intro: string;
377
405
  error: string;
378
406
  success: string;
379
- limitLines?: number;
407
+ abortable?: boolean;
380
408
  }) => Promise<void>;
381
- executeTaskWithSpinner: (childProcessFactories: (() => ExecaChildProcess) | (() => ExecaChildProcess)[], { id, intro, error, success }: {
409
+ executeTaskWithSpinner: (childProcessFactories: ((signal?: AbortSignal) => ExecaChildProcess) | ((signal?: AbortSignal) => ExecaChildProcess)[], { id, intro, error, success, abortable, }: {
382
410
  id: string;
383
411
  intro: string;
384
412
  error: string;
385
413
  success: string;
414
+ abortable?: boolean;
386
415
  }) => Promise<void>;
387
- setPromptLibrary: (library: "clack" | "prompts") => void;
388
- getPromptLibrary: () => "clack" | "prompts";
416
+ setPromptLibrary: (library: "clack") => void;
417
+ getPromptLibrary: () => "clack";
389
418
  getPromptProvider: () => PromptProvider;
390
419
  isClackEnabled: () => boolean;
391
- isPromptsEnabled: () => boolean;
392
420
  getPreferredStdio: () => "inherit" | "pipe";
393
421
  text: (options: TextPromptOptions, promptOptions?: PromptOptions) => Promise<string>;
394
422
  confirm: (options: ConfirmPromptOptions, promptOptions?: PromptOptions) => Promise<boolean>;
@@ -411,13 +439,10 @@ interface LogEntry {
411
439
  */
412
440
  declare class LogTracker {
413
441
  #private;
414
- constructor();
415
442
  /** Enables writing logs to file. */
416
443
  enableLogWriting(): void;
417
444
  /** Returns whether logs should be written to file. */
418
445
  get shouldWriteLogsToFile(): boolean;
419
- /** Returns the configured log file path. */
420
- get logFilePath(): string;
421
446
  /** Returns a copy of all stored logs. */
422
447
  get logs(): LogEntry[];
423
448
  /**
@@ -437,7 +462,7 @@ declare class LogTracker {
437
462
  * @returns The path where logs were written, by default is debug-storybook.log in current working
438
463
  * directory
439
464
  */
440
- writeToFile(filePath?: string): Promise<string>;
465
+ writeToFile(filePath: string | boolean | undefined): Promise<string>;
441
466
  }
442
467
  declare const logTracker: LogTracker;
443
468
 
@@ -450,8 +475,156 @@ declare const CLI_COLORS: {
450
475
  info: Formatter;
451
476
  debug: Formatter;
452
477
  cta: Formatter;
478
+ muted: Formatter;
479
+ storybook: (text: string) => string;
453
480
  };
454
481
 
482
+ interface ConsoleLoggerOptions {
483
+ prefix: string;
484
+ color: 'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' | 'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgYellowBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright';
485
+ }
486
+ declare class ConsoleLogger implements Console {
487
+ Console: typeof ConsoleLogger;
488
+ protected timers: Map<string, number>;
489
+ protected counters: Map<string, number>;
490
+ protected lastStatusLine: string | null;
491
+ protected statusLineCount: number;
492
+ protected get prefix(): string;
493
+ protected get color(): (text: string) => string;
494
+ protected formatMessage(...data: any[]): string;
495
+ assert(condition?: boolean, ...data: any[]): void;
496
+ /**
497
+ * The **`console.clear()`** static method clears the console if possible.
498
+ *
499
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)
500
+ */
501
+ clear(): void;
502
+ /**
503
+ * The **`console.count()`** static method logs the number of times that this particular call to
504
+ * `count()` has been called.
505
+ *
506
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)
507
+ */
508
+ count(label?: string): void;
509
+ /**
510
+ * The **`console.countReset()`** static method resets counter used with console/count_static.
511
+ *
512
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
513
+ */
514
+ countReset(label?: string): void;
515
+ /**
516
+ * The **`console.debug()`** static method outputs a message to the console at the 'debug' log
517
+ * level.
518
+ *
519
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
520
+ */
521
+ debug(...data: any[]): void;
522
+ /**
523
+ * The **`console.dir()`** static method displays a list of the properties of the specified
524
+ * JavaScript object.
525
+ *
526
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
527
+ */
528
+ dir(item?: any, options?: any): void;
529
+ /**
530
+ * The **`console.dirxml()`** static method displays an interactive tree of the descendant
531
+ * elements of the specified XML/HTML element.
532
+ *
533
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
534
+ */
535
+ dirxml(...data: any[]): void;
536
+ /**
537
+ * The **`console.error()`** static method outputs a message to the console at the 'error' log
538
+ * level.
539
+ *
540
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
541
+ */
542
+ error(...data: any[]): void;
543
+ /**
544
+ * The **`console.group()`** static method creates a new inline group in the Web console log,
545
+ * causing any subsequent console messages to be indented by an additional level, until
546
+ * console/groupEnd_static is called.
547
+ *
548
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
549
+ */
550
+ group(...data: any[]): void;
551
+ /**
552
+ * The **`console.groupCollapsed()`** static method creates a new inline group in the console.
553
+ *
554
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
555
+ */
556
+ groupCollapsed(...data: any[]): void;
557
+ /**
558
+ * The **`console.groupEnd()`** static method exits the current inline group in the console.
559
+ *
560
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
561
+ */
562
+ groupEnd(): void;
563
+ /**
564
+ * The **`console.info()`** static method outputs a message to the console at the 'info' log
565
+ * level.
566
+ *
567
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
568
+ */
569
+ info(...data: any[]): void;
570
+ /**
571
+ * The **`console.log()`** static method outputs a message to the console.
572
+ *
573
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
574
+ */
575
+ log(...data: any[]): void;
576
+ /**
577
+ * The **`console.table()`** static method displays tabular data as a table.
578
+ *
579
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)
580
+ */
581
+ table(tabularData?: any, properties?: string[]): void;
582
+ /**
583
+ * The **`console.time()`** static method starts a timer you can use to track how long an
584
+ * operation takes.
585
+ *
586
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
587
+ */
588
+ time(label?: string): void;
589
+ /**
590
+ * The **`console.timeEnd()`** static method stops a timer that was previously started by calling
591
+ * console/time_static.
592
+ *
593
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
594
+ */
595
+ timeEnd(label?: string): void;
596
+ /**
597
+ * The **`console.timeLog()`** static method logs the current value of a timer that was previously
598
+ * started by calling console/time_static.
599
+ *
600
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
601
+ */
602
+ timeLog(label?: string, ...data: any[]): void;
603
+ timeStamp(label?: string): void;
604
+ /**
605
+ * The **`console.trace()`** static method outputs a stack trace to the console.
606
+ *
607
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
608
+ */
609
+ trace(...data: any[]): void;
610
+ /**
611
+ * The **`console.warn()`** static method outputs a warning message to the console at the
612
+ * 'warning' log level.
613
+ *
614
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
615
+ */
616
+ warn(...data: any[]): void;
617
+ profile(label?: string): void;
618
+ profileEnd(label?: string): void;
619
+ }
620
+ declare class StyledConsoleLogger extends ConsoleLogger {
621
+ private _prefix;
622
+ private _color;
623
+ constructor(options: ConsoleLoggerOptions);
624
+ protected get prefix(): string;
625
+ protected get color(): Formatter;
626
+ }
627
+
455
628
  /** @deprecated Use CLI_COLORS instead */
456
629
  declare const colors: {
457
630
  pink: (text: string) => string;
@@ -464,9 +637,8 @@ declare const colors: {
464
637
  };
465
638
  declare const logger: {
466
639
  verbose: (message: string) => void;
467
- info: (message: string) => void;
468
- plain: (message: string) => void;
469
640
  line: (count?: number) => void;
641
+ /** For non-critical issues or warnings */
470
642
  warn: (message: string) => void;
471
643
  trace: ({ message, time }: {
472
644
  message: string;
@@ -477,16 +649,12 @@ declare const logger: {
477
649
  setLogLevel: (level: LogLevel) => void;
478
650
  getLogLevel: () => LogLevel;
479
651
  shouldLog: (level: LogLevel) => boolean;
480
- debug: (...args: any[]) => void;
481
- log: (...args: any[]) => void;
482
- logBox: (message: string, options?: {
483
- borderStyle?: "round" | "none";
484
- padding?: number;
652
+ debug: (message: any) => void;
653
+ log: (message?: string | string[] | undefined, args_1?: LogMessageOptions | undefined) => void;
654
+ info: (message: string, opts?: LogMessageOptions | undefined) => void;
655
+ logBox: (message: string, { title, ...options }?: {
485
656
  title?: string;
486
- titleAlignment?: "left" | "center" | "right";
487
- borderColor?: string;
488
- backgroundColor?: string;
489
- }) => void;
657
+ } & BoxOptions) => void;
490
658
  intro: (message: string) => void;
491
659
  outro: (message: string) => void;
492
660
  step: (message: string) => void;
@@ -507,4 +675,4 @@ declare const once: {
507
675
  };
508
676
  declare const deprecate: (message: string) => void;
509
677
 
510
- export { CLI_COLORS, type SpinnerInstance, type TaskLogInstance, colors, createHyperlink, deprecate, npmlog as instance, logTracker, logger, once, prompt, protectUrls };
678
+ export { CLI_COLORS, ConsoleLogger, type SpinnerInstance, StyledConsoleLogger, type TaskLogInstance, colors, createHyperlink, deprecate, npmlog as instance, logTracker, logger, once, prompt, protectUrls };