storybook 10.1.0-alpha.12 → 10.1.0-alpha.14

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 (99) 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/_browser-chunks/{chunk-WXP2XJ3O.js → chunk-P4F4UVXX.js} +1 -0
  5. package/dist/_browser-chunks/{chunk-BE2DAXKJ.js → chunk-SS2NHR7W.js} +4 -1
  6. package/dist/_browser-chunks/{syntaxhighlighter-WKBQ5RC7.js → syntaxhighlighter-IQDEPFLK.js} +1 -1
  7. package/dist/_node-chunks/{builder-manager-YUOHSIUB.js → builder-manager-FQ5J6V3U.js} +32 -22
  8. package/dist/_node-chunks/{chunk-B6JWY6PC.js → camelcase-VGUYV77Z.js} +8 -8
  9. package/dist/_node-chunks/{chunk-FZLRAH4N.js → chunk-2JR3QBT2.js} +7 -7
  10. package/dist/_node-chunks/chunk-3EBH66BB.js +23 -0
  11. package/dist/_node-chunks/{chunk-E5FJS66Z.js → chunk-4ZFHN3ZY.js} +6 -6
  12. package/dist/_node-chunks/{chunk-5HV3B5OP.js → chunk-63PL4NNE.js} +1104 -13
  13. package/dist/_node-chunks/{chunk-NAOYEL54.js → chunk-A4KENTXT.js} +7 -7
  14. package/dist/_node-chunks/{chunk-4FT2DHGE.js → chunk-ALIA3J6S.js} +44 -10
  15. package/dist/_node-chunks/{chunk-WFLWJO24.js → chunk-C2HKH2XQ.js} +5710 -2414
  16. package/dist/_node-chunks/{chunk-WA6KZQZ2.js → chunk-DQNBAQYT.js} +6 -6
  17. package/dist/_node-chunks/{chunk-JARUEMEP.js → chunk-F74UHHR6.js} +7 -7
  18. package/dist/_node-chunks/{chunk-WUXQMQCB.js → chunk-H5XWXVWR.js} +6 -6
  19. package/dist/_node-chunks/{chunk-OP3INKUD.js → chunk-JMP7YFX2.js} +6 -6
  20. package/dist/_node-chunks/{chunk-DWXTZT3D.js → chunk-JZR4DHG2.js} +19 -7
  21. package/dist/_node-chunks/{chunk-QCO2ZM7F.js → chunk-KEA7CVMZ.js} +122 -32
  22. package/dist/_node-chunks/{chunk-DUXPWBOK.js → chunk-KF3WTAEP.js} +7 -7
  23. package/dist/_node-chunks/{chunk-2D2IODUU.js → chunk-LPPM7L5D.js} +51 -71
  24. package/dist/_node-chunks/{chunk-2DMESZFJ.js → chunk-MJUDR7HQ.js} +7 -7
  25. package/dist/_node-chunks/chunk-NPB4THZQ.js +18 -0
  26. package/dist/_node-chunks/chunk-NZBK3DSJ.js +29 -0
  27. package/dist/_node-chunks/{chunk-5KLIDWFN.js → chunk-Q2QUNQK6.js} +7 -7
  28. package/dist/_node-chunks/{chunk-EZWWR7AR.js → chunk-TMCKISJR.js} +101 -118
  29. package/dist/_node-chunks/chunk-TWK7AR3U.js +6024 -0
  30. package/dist/_node-chunks/{chunk-CZ5GHJCC.js → chunk-V7CXWJXC.js} +7 -7
  31. package/dist/_node-chunks/chunk-W4F3T6CY.js +3781 -0
  32. package/dist/_node-chunks/{chunk-SEMIAAWG.js → chunk-WACDSFMO.js} +9 -9
  33. package/dist/_node-chunks/{chunk-A4APXFQ2.js → chunk-WVXZFQQU.js} +14 -8
  34. package/dist/_node-chunks/chunk-XBPE4PT7.js +78 -0
  35. package/dist/_node-chunks/chunk-YMM6BYF2.js +61 -0
  36. package/dist/_node-chunks/{chunk-XXPJ7XR3.js → chunk-ZGZKNZ5S.js} +6 -6
  37. package/dist/_node-chunks/{dist-DS2B5A3J.js → dist-DR3AP3RJ.js} +9 -9
  38. package/dist/_node-chunks/{globby-6THB7HVX.js → globby-D4FPSHY2.js} +9 -9
  39. package/dist/_node-chunks/{lib-5NKX4YGG.js → lib-ZEFOVNTK.js} +7 -7
  40. package/dist/_node-chunks/{mdx-N42X6CFJ-ZLT3QOFF.js → mdx-N42X6CFJ-PJF3ICCG.js} +8 -8
  41. package/dist/_node-chunks/{p-limit-PDMWNG7W.js → p-limit-CYQOFYPV.js} +7 -7
  42. package/dist/babel/index.js +10 -11
  43. package/dist/bin/core.js +33 -26
  44. package/dist/bin/dispatcher.js +31 -20
  45. package/dist/bin/loader.js +10 -13
  46. package/dist/cli/index.d.ts +1479 -133
  47. package/dist/cli/index.js +30 -5159
  48. package/dist/common/index.d.ts +139 -62
  49. package/dist/common/index.js +66 -51
  50. package/dist/components/index.d.ts +136 -26
  51. package/dist/components/index.js +3163 -2859
  52. package/dist/core-server/index.d.ts +3 -2
  53. package/dist/core-server/index.js +112 -1486
  54. package/dist/core-server/presets/common-manager.js +5 -5
  55. package/dist/core-server/presets/common-override-preset.js +9 -9
  56. package/dist/core-server/presets/common-preset.js +272 -81
  57. package/dist/csf/index.js +2 -2
  58. package/dist/csf-tools/index.js +9 -9
  59. package/dist/manager/globals-runtime.js +21557 -21133
  60. package/dist/manager/manager-stores.d.ts +1 -0
  61. package/dist/manager/manager-stores.js +23 -0
  62. package/dist/manager/runtime.js +6695 -720
  63. package/dist/manager-api/index.d.ts +1802 -1
  64. package/dist/manager-api/index.js +105 -11
  65. package/dist/manager-errors.d.ts +6 -0
  66. package/dist/manager-errors.js +2 -2
  67. package/dist/mocking-utils/index.d.ts +1126 -0
  68. package/dist/{_node-chunks/chunk-ZXSD6L3S.js → mocking-utils/index.js} +441 -16
  69. package/dist/node-logger/index.d.ts +192 -24
  70. package/dist/node-logger/index.js +23 -3148
  71. package/dist/preview/runtime.js +35 -3
  72. package/dist/preview-api/index.d.ts +69 -68
  73. package/dist/preview-api/index.js +2 -2
  74. package/dist/preview-errors.d.ts +6 -0
  75. package/dist/preview-errors.js +2 -2
  76. package/dist/server-errors.d.ts +31 -1
  77. package/dist/server-errors.js +17 -10
  78. package/dist/telemetry/index.d.ts +24 -3
  79. package/dist/telemetry/index.js +25 -24
  80. package/dist/types/index.d.ts +71 -8
  81. package/dist/types/index.js +25 -1
  82. package/package.json +11 -9
  83. package/dist/_node-chunks/camelcase-JREIL7NV.js +0 -18
  84. package/dist/_node-chunks/chunk-FDXFVHIL.js +0 -1114
  85. package/dist/_node-chunks/chunk-HZG65SU3.js +0 -34
  86. package/dist/_node-chunks/chunk-IXVYNBMD.js +0 -18
  87. package/dist/_node-chunks/chunk-LIH7MTP7.js +0 -3214
  88. package/dist/_node-chunks/chunk-N5GIRUP5.js +0 -1047
  89. package/dist/_node-chunks/chunk-O5DA7YLO.js +0 -3171
  90. package/dist/_node-chunks/chunk-QYQIZBS6.js +0 -26
  91. package/dist/_node-chunks/chunk-TS2UUH2J.js +0 -301
  92. package/dist/_node-chunks/chunk-Y4E6IGQF.js +0 -61
  93. package/dist/_node-chunks/chunk-ZL3AFKRX.js +0 -1029
  94. package/dist/_node-chunks/plugin-6XMWOGPO.js +0 -123
  95. package/dist/_node-chunks/plugin-LTOXVT6A.js +0 -109
  96. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-2SFE5LQS.js +0 -46582
  97. package/dist/_node-chunks/webpack-mock-plugin-CX5J2U56.js +0 -92
  98. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -32
  99. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -28
@@ -1,5 +1,5 @@
1
1
  import * as storybook_internal_types from 'storybook/internal/types';
2
- import { CLIOptions, LoadOptions, BuilderOptions, StorybookConfigRaw, PresetConfig, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, LoadedPreset, Presets, PackageJson, CoreCommon_AddonInfo, SupportedFrameworks, SupportedRenderers, Options as Options$1, CoreCommon_StorybookInfo, Ref, StorybookConfig, StoriesEntry, NormalizedStoriesSpecifier } from 'storybook/internal/types';
2
+ import { CLIOptions, LoadOptions, BuilderOptions, StorybookConfigRaw, PresetConfig, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, LoadedPreset, Presets, PackageJson, CoreCommon_AddonInfo, SupportedFramework, SupportedRenderer, SupportedBuilder, Options as Options$2, CoreWebpackCompiler, CoreCommon_StorybookInfo, Ref, StorybookConfig, StoriesEntry, NormalizedStoriesSpecifier } from 'storybook/internal/types';
3
3
  export { PackageJson } from 'storybook/internal/types';
4
4
  import { WriteStream } from 'node:fs';
5
5
  import { Buffer } from 'node:buffer';
@@ -7,6 +7,7 @@ import { ChildProcess } from 'node:child_process';
7
7
  import { Readable, Writable, Stream } from 'node:stream';
8
8
  import * as prettier from 'prettier';
9
9
  import { ConfigFile } from 'storybook/internal/csf-tools';
10
+ import { types } from 'storybook/internal/babel';
10
11
 
11
12
  declare const _default: {
12
13
  '@storybook/addon-a11y': string;
@@ -441,6 +442,38 @@ type CommonOptions<EncodingType extends EncodingOption = DefaultEncodingOption>
441
442
  readonly verbose?: boolean;
442
443
  };
443
444
 
445
+ type Options$1<EncodingType extends EncodingOption = DefaultEncodingOption> = {
446
+ /**
447
+ Write some input to the `stdin` of your binary.
448
+
449
+ If the input is a file, use the `inputFile` option instead.
450
+ */
451
+ readonly input?: string | Buffer | Readable;
452
+
453
+ /**
454
+ Use a file as input to the the `stdin` of your binary.
455
+
456
+ If the input is not a file, use the `input` option instead.
457
+ */
458
+ readonly inputFile?: string;
459
+ } & CommonOptions<EncodingType>;
460
+
461
+ type NodeOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {
462
+ /**
463
+ The Node.js executable to use.
464
+
465
+ @default process.execPath
466
+ */
467
+ readonly nodePath?: string;
468
+
469
+ /**
470
+ List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
471
+
472
+ @default process.execArgv
473
+ */
474
+ readonly nodeOptions?: string[];
475
+ } & Options$1<EncodingType>;
476
+
444
477
  type StdoutStderrAll = string | Buffer | undefined;
445
478
 
446
479
  type ExecaReturnBase<StdoutStderrType extends StdoutStderrAll> = {
@@ -646,6 +679,21 @@ type ExecaChildProcess<StdoutStderrType extends StdoutStderrAll = string> = Chil
646
679
  ExecaChildPromise<StdoutStderrType> &
647
680
  Promise<ExecaReturnValue<StdoutStderrType>>;
648
681
 
682
+ type ExecuteCommandOptions = CommonOptions<'utf8'> & {
683
+ command: string;
684
+ args?: string[];
685
+ cwd?: string;
686
+ ignoreError?: boolean;
687
+ env?: Record<string, any>;
688
+ };
689
+ declare function executeCommand(options: ExecuteCommandOptions): ExecaChildProcess;
690
+ declare function executeCommandSync(options: ExecuteCommandOptions): string;
691
+ declare function executeNodeCommand({ scriptPath, args, options, }: {
692
+ scriptPath: string;
693
+ args?: string[];
694
+ options?: NodeOptions;
695
+ }): ExecaChildProcess;
696
+
649
697
  type PackageJsonWithDepsAndDevDeps = PackageJson & Required<Pick<PackageJson, 'dependencies' | 'devDependencies'>>;
650
698
  type PackageJsonWithMaybeDeps = Partial<Pick<PackageJson, 'dependencies' | 'devDependencies' | 'peerDependencies' | 'files'>>;
651
699
 
@@ -661,12 +709,13 @@ type InstallationMetadata = {
661
709
  dedupeCommand: string;
662
710
  };
663
711
 
664
- type PackageManagerName = 'npm' | 'yarn1' | 'yarn2' | 'pnpm' | 'bun';
665
- declare const COMMON_ENV_VARS: {
666
- COREPACK_ENABLE_STRICT: string;
667
- COREPACK_ENABLE_AUTO_PIN: string;
668
- NO_UPDATE_NOTIFIER: string;
669
- };
712
+ declare enum PackageManagerName {
713
+ NPM = "npm",
714
+ YARN1 = "yarn1",
715
+ YARN2 = "yarn2",
716
+ PNPM = "pnpm",
717
+ BUN = "bun"
718
+ }
670
719
  /**
671
720
  * Extract package name and version from input
672
721
  *
@@ -702,14 +751,11 @@ declare abstract class JsPackageManager {
702
751
  static readonly latestVersionCache: Map<string, string | null>;
703
752
  /** Cache for installed version results to avoid repeated file system calls. */
704
753
  static readonly installedVersionCache: Map<string, string | null>;
754
+ /** Cache for package.json files to avoid repeated file system calls. */
755
+ static readonly packageJsonCache: Map<string, PackageJsonWithDepsAndDevDeps>;
705
756
  constructor(options?: JsPackageManagerOptions);
706
757
  /** Runs arbitrary package scripts. */
707
758
  abstract getRunCommand(command: string): string;
708
- /**
709
- * Run a command from a local or remote. Fetches a package from the registry without installing it
710
- * as a dependency, hotloads it, and runs whatever default command binary it exposes.
711
- */
712
- abstract getRemoteRunCommand(pkg: string, args: string[], specifier?: string): string;
713
759
  /** Get the package.json file for a given module. */
714
760
  abstract getModulePackageJSON(packageName: string): Promise<PackageJson | null>;
715
761
  isStorybookInMonorepo(): boolean;
@@ -841,33 +887,14 @@ declare abstract class JsPackageManager {
841
887
  protected abstract runGetVersions<T extends boolean>(packageName: string, fetchAllVersions: T): Promise<T extends true ? string[] : string>;
842
888
  abstract getRegistryURL(): Promise<string | undefined>;
843
889
  abstract runInternalCommand(command: string, args: string[], cwd?: string, stdio?: 'inherit' | 'pipe' | 'ignore'): ExecaChildProcess;
844
- abstract runPackageCommand(command: string, args: string[], cwd?: string, stdio?: 'inherit' | 'pipe' | 'ignore'): ExecaChildProcess;
845
- abstract runPackageCommandSync(command: string, args: string[], cwd?: string, stdio?: 'inherit' | 'pipe' | 'ignore'): string;
890
+ abstract runPackageCommand(options: Omit<ExecuteCommandOptions, 'command'> & {
891
+ args: string[];
892
+ }): ExecaChildProcess;
846
893
  abstract findInstallations(pattern?: string[]): Promise<InstallationMetadata | undefined>;
847
894
  abstract findInstallations(pattern?: string[], options?: {
848
895
  depth: number;
849
896
  }): Promise<InstallationMetadata | undefined>;
850
897
  abstract parseErrorFromLogs(logs?: string): string;
851
- executeCommandSync({ command, args, stdio, cwd, ignoreError, env, ...execaOptions }: CommonOptions<'utf8'> & {
852
- command: string;
853
- args: string[];
854
- cwd?: string;
855
- ignoreError?: boolean;
856
- }): string;
857
- /**
858
- * Execute a command asynchronously and return the execa process. This allows you to hook into
859
- * stdout/stderr streams and monitor the process.
860
- *
861
- * @example Const process = packageManager.executeCommand({ command: 'npm', args: ['install'] });
862
- * process.stdout?.on('data', (data) => console.log(data.toString())); const result = await
863
- * process;
864
- */
865
- executeCommand({ command, args, stdio, cwd, ignoreError, env, ...execaOptions }: CommonOptions<'utf8'> & {
866
- command: string;
867
- args: string[];
868
- cwd?: string;
869
- ignoreError?: boolean;
870
- }): ExecaChildProcess;
871
898
  /** Returns the installed (within node_modules or pnp zip) version of a specified package */
872
899
  getInstalledVersion(packageName: string): Promise<string | null>;
873
900
  isPackageInstalled(packageName: string): Promise<boolean>;
@@ -965,7 +992,7 @@ declare function getEnvConfig(program: Record<string, any>, configEnv: Record<st
965
992
  * // SCENARIO 2:
966
993
  * // or you can pass it to stdio and capture the output of that command
967
994
  * try {
968
- * await this.executeCommand({
995
+ * await executeCommand({
969
996
  * command: 'pnpm',
970
997
  * args: ['info', packageName, ...args],
971
998
  * // do not output to the user, and send stdio and stderr to log file
@@ -1022,16 +1049,17 @@ declare const commonGlobOptions: (glob: string) => {
1022
1049
  ignore: string[];
1023
1050
  };
1024
1051
 
1025
- declare const frameworkToRenderer: Record<SupportedFrameworks | SupportedRenderers, SupportedRenderers | 'vue'>;
1052
+ declare const frameworkToRenderer: Record<SupportedFramework | SupportedRenderer, SupportedRenderer>;
1053
+ declare const frameworkToBuilder: Record<SupportedFramework, SupportedBuilder>;
1026
1054
 
1027
1055
  /**
1028
1056
  * Builder options can be specified in `core.builder.options` or `framework.options.builder`.
1029
1057
  * Preference is given here to `framework.options.builder` if both are specified.
1030
1058
  */
1031
- declare function getBuilderOptions<T extends Record<string, any>>(options: Options$1): Promise<T | Record<string, never>>;
1059
+ declare function getBuilderOptions<T extends Record<string, any>>(options: Options$2): Promise<T | Record<string, never>>;
1032
1060
 
1033
1061
  /** Framework can be a string or an object. This utility always returns the string name. */
1034
- declare function getFrameworkName(options: Options$1): Promise<string>;
1062
+ declare function getFrameworkName(options: Options$2): Promise<string>;
1035
1063
  /**
1036
1064
  * Extracts the proper framework name from the given framework field. The framework field can be the
1037
1065
  * framework package name or a path to the framework package.
@@ -1039,38 +1067,39 @@ declare function getFrameworkName(options: Options$1): Promise<string>;
1039
1067
  * @example
1040
1068
  *
1041
1069
  * ```ts
1042
- * ExtractProperFrameworkName('/path/to/@storybook/angular'); // => '@storybook/angular'
1043
- * extractProperFrameworkName('@third-party/framework'); // => '@third-party/framework'
1070
+ * extractFrameworkPackageName('/path/to/@storybook/angular'); // => '@storybook/angular'
1071
+ * extractFrameworkPackageName('@third-party/framework'); // => '@third-party/framework'
1044
1072
  * ```
1045
1073
  */
1046
- declare const extractProperFrameworkName: (framework: string) => string;
1074
+ declare const extractFrameworkPackageName: (framework: string) => string;
1047
1075
 
1048
1076
  /**
1049
1077
  * Render is set as a string on core. It must be set by the framework It falls back to the framework
1050
1078
  * name if not set
1051
1079
  */
1052
- declare function getRendererName(options: Options$1): Promise<string>;
1080
+ declare function getRendererName(options: Options$2): Promise<string>;
1053
1081
  /**
1054
1082
  * Extracts the proper renderer name from the given framework name.
1055
1083
  *
1056
1084
  * @example
1057
1085
  *
1058
1086
  * ```ts
1059
- * extractProperRendererNameFromFramework('@storybook/react'); // => 'react'
1060
- * extractProperRendererNameFromFramework('@storybook/angular'); // => 'angular'
1061
- * extractProperRendererNameFromFramework('@third-party/framework'); // => null
1087
+ * extractRenderer('@storybook/react'); // => 'react'
1088
+ * extractRenderer('@storybook/angular'); // => 'angular'
1089
+ * extractRenderer('@third-party/framework'); // => null
1062
1090
  * ```
1063
1091
  *
1064
1092
  * @param frameworkName The name of the framework.
1065
1093
  * @returns The name of the renderer.
1066
1094
  */
1067
- declare function extractProperRendererNameFromFramework(frameworkName: string): Promise<"vue" | storybook_internal_types.SupportedRenderers | null>;
1095
+ declare function extractRenderer(frameworkName: string): Promise<storybook_internal_types.SupportedRenderer | null>;
1068
1096
 
1069
1097
  declare function getStorybookConfiguration(storybookScript: string, shortName: string, longName: string): string | null;
1070
1098
 
1071
- declare const rendererPackages: Record<string, string>;
1072
- declare const frameworkPackages: Record<string, SupportedFrameworks>;
1073
- declare const builderPackages: string[];
1099
+ declare const rendererPackages: Record<string, SupportedRenderer>;
1100
+ declare const frameworkPackages: Record<string, SupportedFramework>;
1101
+ declare const builderPackages: Record<string, SupportedBuilder>;
1102
+ declare const compilerPackages: Record<string, CoreWebpackCompiler>;
1074
1103
  declare const findConfigFile: (prefix: string, configDir: string) => string | null;
1075
1104
  declare const getConfigInfo: (configDir?: string) => {
1076
1105
  configDir: string;
@@ -1078,10 +1107,10 @@ declare const getConfigInfo: (configDir?: string) => {
1078
1107
  previewConfigPath: string | null;
1079
1108
  managerConfigPath: string | null;
1080
1109
  };
1081
- declare const getStorybookInfo: (configDir?: string) => CoreCommon_StorybookInfo;
1110
+ declare const getStorybookInfo: (configDir?: string, cwd?: string) => Promise<CoreCommon_StorybookInfo>;
1082
1111
 
1083
- declare const getAutoRefs: (options: Options$1) => Promise<Record<string, Ref>>;
1084
- declare function getRefs(options: Options$1): Promise<Record<string, Ref>>;
1112
+ declare const getAutoRefs: (options: Options$2) => Promise<Record<string, Ref>>;
1113
+ declare function getRefs(options: Options$2): Promise<Record<string, Ref>>;
1085
1114
 
1086
1115
  declare function globToRegexp(glob: string): RegExp;
1087
1116
 
@@ -1305,11 +1334,6 @@ declare function loadPreviewOrConfigFile({ configDir }: {
1305
1334
  configDir: string;
1306
1335
  }): string | undefined;
1307
1336
 
1308
- declare const commandLog: (message: string) => (errorMessage?: string | void | undefined, errorInfo?: string) => void;
1309
- declare function paddedLog(message: string): void;
1310
- declare function getChars(char: string, amount: number): string;
1311
- declare function codeLog(codeLines: string[], leftPadAmount?: number): void;
1312
-
1313
1337
  declare function logConfig(caption: unknown, config: unknown): void;
1314
1338
 
1315
1339
  declare const DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|jsx|mjs|ts|tsx))";
@@ -1409,7 +1433,7 @@ type GetStoryIdOptions = StoryIdData & {
1409
1433
  userTitle?: string;
1410
1434
  storyFilePath: string;
1411
1435
  };
1412
- declare function getStoryId(data: StoryIdData, options: Options$1): Promise<{
1436
+ declare function getStoryId(data: StoryIdData, options: Options$2): Promise<{
1413
1437
  storyId: string;
1414
1438
  kind: string;
1415
1439
  }>;
@@ -1418,10 +1442,61 @@ declare function getStoryTitle({ storyFilePath, configDir, stories, workingDir,
1418
1442
  /** Replaces the path separator with forward slashes */
1419
1443
  declare const posix: (localPath: string, seperator?: string) => string;
1420
1444
 
1421
- declare const getAddonNames: (mainConfig: StorybookConfig) => string[];
1422
-
1423
1445
  declare function syncStorybookAddons(mainConfig: StorybookConfig, previewConfigPath: string, configDir: string): Promise<void>;
1424
- declare function getSyncedStorybookAddons(mainConfig: StorybookConfig, previewConfig: ConfigFile, configDir: string): Promise<ConfigFile>;
1446
+ declare function syncPreviewAddonsWithMainConfig(mainConfig: StorybookConfig, previewConfig: ConfigFile, configDir: string): Promise<ConfigFile>;
1447
+
1448
+ interface SetupAddonInConfigOptions {
1449
+ addonName: string;
1450
+ mainConfigCSFFile: ConfigFile;
1451
+ previewConfigPath: string | undefined;
1452
+ configDir: string;
1453
+ }
1454
+ /**
1455
+ * Setup an addon in the Storybook configuration by adding it to the addons array in main config and
1456
+ * syncing it with preview config.
1457
+ *
1458
+ * @param options Configuration options for setting up the addon
1459
+ */
1460
+ declare function setupAddonInConfig({ addonName, previewConfigPath, configDir, mainConfigCSFFile, }: SetupAddonInConfigOptions): Promise<void>;
1461
+
1462
+ /**
1463
+ * Checks if the following node declarations exists in the main config file.
1464
+ *
1465
+ * @example
1466
+ *
1467
+ * ```ts
1468
+ * const <name> = () => {};
1469
+ * function <name>() {}
1470
+ * ```
1471
+ */
1472
+ declare function doesVariableOrFunctionDeclarationExist(node: types.Node, name: string): boolean;
1473
+ /**
1474
+ * Returns the name of the getAbsolutePath wrapper function if it exists in the main config file.
1475
+ *
1476
+ * @returns Name of the getAbsolutePath wrapper function (e.g. `getAbsolutePath`).
1477
+ */
1478
+ declare function getAbsolutePathWrapperName(config: ConfigFile): string | null;
1479
+ /** Check if the node needs to be wrapped with getAbsolutePath wrapper. */
1480
+ declare function isGetAbsolutePathWrapperNecessary(node: types.Node, cb?: (node: types.StringLiteral | types.ObjectProperty | types.ArrayExpression) => void): boolean;
1481
+ /**
1482
+ * Get all fields that need to be wrapped with getAbsolutePath wrapper.
1483
+ *
1484
+ * @returns Array of fields that need to be wrapped with getAbsolutePath wrapper.
1485
+ */
1486
+ declare function getFieldsForGetAbsolutePathWrapper(config: ConfigFile): types.Node[];
1487
+ /**
1488
+ * Returns AST for the following function
1489
+ *
1490
+ * @example
1491
+ *
1492
+ * ```ts
1493
+ * function getAbsolutePath(value) {
1494
+ * return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
1495
+ * }
1496
+ * ```
1497
+ */
1498
+ declare function getAbsolutePathWrapperAsCallExpression(isConfigTypescript: boolean): types.FunctionDeclaration;
1499
+ declare function wrapValueWithGetAbsolutePathWrapper(config: ConfigFile, node: types.Node): void;
1425
1500
 
1426
1501
  /**
1427
1502
  * Helper function to scan for files matching a glob pattern and transform them
@@ -1509,7 +1584,9 @@ declare const safeResolveModule: ({ specifier, parent, extensions, }: {
1509
1584
  extensions?: string[];
1510
1585
  }) => string | undefined;
1511
1586
 
1587
+ declare const getAddonNames: (mainConfig: StorybookConfig) => string[];
1588
+
1512
1589
  declare const groupBy: <K extends PropertyKey, T>(items: T[], keySelector: (item: T, index: number) => K) => Record<K, T[]>;
1513
1590
  declare function invariant(condition: unknown, message?: string | (() => string)): asserts condition;
1514
1591
 
1515
- export { COMMON_ENV_VARS, DEFAULT_FILES_PATTERN, type FileOptions, FileSystemCache, HandledError, type InstallationMetadata, type InterPresetOptions, JsPackageManager, JsPackageManagerFactory, type PackageJsonInfo, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, type PackageManagerName, type PackageMetadata, type RemoveAddonOptions, builderPackages, cache, checkAddonOrder, codeLog, commandLog, commonGlobOptions, createFileSystemCache, createLogStream, extractProperFrameworkName, extractProperRendererNameFromFramework, filterPresetsConfig, findConfigFile, findFilesUp, formatFileContent, frameworkPackages, frameworkToRenderer, getAddonNames, getAutoRefs, getBuilderOptions, getChars, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFrameworkName, getInterpretedFile, getPackageDetails, getPresets, getPrettier, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStoryId, getStoryTitle, getStorybookConfiguration, getStorybookInfo, getSyncedStorybookAddons, globToRegexp, groupBy, importMetaResolve, importModule, interpolate, invalidateProjectRootCache, invariant, isCI, isCorePackage, isPreservingSymlinks, isSatelliteAddon, loadAllPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, optionalEnvToBoolean, paddedLog, parseList, posix, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolveImport, resolvePackageDir, resolvePathInStorybookCache, safeResolveModule, satisfies, scanAndTransformFiles, serverRequire, stringifyEnvs, stringifyProcessEnvs, supportedExtensions, syncStorybookAddons, temporaryDirectory, temporaryFile, transformImportFiles, validateConfigurationFiles, validateFrameworkName, _default as versions };
1592
+ export { DEFAULT_FILES_PATTERN, type ExecuteCommandOptions, type FileOptions, FileSystemCache, HandledError, type InstallationMetadata, type InterPresetOptions, JsPackageManager, JsPackageManagerFactory, type PackageJsonInfo, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, PackageManagerName, type PackageMetadata, type RemoveAddonOptions, type SetupAddonInConfigOptions, builderPackages, cache, checkAddonOrder, commonGlobOptions, compilerPackages, createFileSystemCache, createLogStream, doesVariableOrFunctionDeclarationExist, executeCommand, executeCommandSync, executeNodeCommand, extractFrameworkPackageName, extractRenderer, filterPresetsConfig, findConfigFile, findFilesUp, formatFileContent, frameworkPackages, frameworkToBuilder, frameworkToRenderer, getAbsolutePathWrapperAsCallExpression, getAbsolutePathWrapperName, getAddonNames, getAutoRefs, getBuilderOptions, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFieldsForGetAbsolutePathWrapper, getFrameworkName, getInterpretedFile, getPackageDetails, getPresets, getPrettier, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStoryId, getStoryTitle, getStorybookConfiguration, getStorybookInfo, globToRegexp, groupBy, importMetaResolve, importModule, interpolate, invalidateProjectRootCache, invariant, isCI, isCorePackage, isGetAbsolutePathWrapperNecessary, isPreservingSymlinks, isSatelliteAddon, loadAllPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, optionalEnvToBoolean, parseList, posix, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolveImport, resolvePackageDir, resolvePathInStorybookCache, safeResolveModule, satisfies, scanAndTransformFiles, serverRequire, setupAddonInConfig, stringifyEnvs, stringifyProcessEnvs, supportedExtensions, syncPreviewAddonsWithMainConfig, syncStorybookAddons, temporaryDirectory, temporaryFile, transformImportFiles, validateConfigurationFiles, validateFrameworkName, _default as versions, wrapValueWithGetAbsolutePathWrapper };
@@ -1,44 +1,51 @@
1
- import CJS_COMPAT_NODE_URL_57ru1wfqqjv from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_57ru1wfqqjv from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_57ru1wfqqjv from "node:module";
1
+ import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_57ru1wfqqjv.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_57ru1wfqqjv.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_57ru1wfqqjv.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.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
- COMMON_ENV_VARS,
14
13
  DEFAULT_FILES_PATTERN,
15
14
  FileSystemCache,
16
15
  HandledError,
17
16
  JsPackageManager,
18
17
  JsPackageManagerFactory,
18
+ PackageManagerName,
19
19
  builderPackages,
20
20
  cache,
21
21
  checkAddonOrder,
22
- codeLog,
23
- commandLog,
24
22
  commonGlobOptions,
23
+ compilerPackages,
25
24
  createFileSystemCache,
26
25
  createLogStream,
27
- extractProperFrameworkName,
28
- extractProperRendererNameFromFramework,
26
+ doesVariableOrFunctionDeclarationExist,
27
+ executeCommand,
28
+ executeCommandSync,
29
+ executeNodeCommand,
30
+ extractFrameworkPackageName,
31
+ extractRenderer,
29
32
  filterPresetsConfig,
30
33
  findConfigFile,
34
+ findFilesUp,
31
35
  formatFileContent,
32
36
  frameworkPackages,
37
+ frameworkToBuilder,
33
38
  frameworkToRenderer,
39
+ getAbsolutePathWrapperAsCallExpression,
40
+ getAbsolutePathWrapperName,
34
41
  getAddonNames,
35
42
  getAutoRefs,
36
43
  getBuilderOptions,
37
- getChars,
38
44
  getCoercedStorybookVersion,
39
45
  getConfigInfo,
40
46
  getDirectoryFromWorkingDir,
41
47
  getEnvConfig,
48
+ getFieldsForGetAbsolutePathWrapper,
42
49
  getFrameworkName,
43
50
  getInterpretedFile,
44
51
  getPackageDetails,
@@ -46,29 +53,33 @@ import {
46
53
  getPrettier,
47
54
  getPreviewBodyTemplate,
48
55
  getPreviewHeadTemplate,
56
+ getProjectRoot,
49
57
  getRefs,
50
58
  getRendererName,
51
59
  getStoryId,
52
60
  getStoryTitle,
53
61
  getStorybookConfiguration,
54
62
  getStorybookInfo,
55
- getSyncedStorybookAddons,
56
63
  globToRegexp,
57
- groupBy,
58
64
  interpolate,
59
- invariant,
65
+ invalidateProjectRootCache,
66
+ isCI,
60
67
  isCorePackage,
68
+ isGetAbsolutePathWrapperNecessary,
61
69
  isPreservingSymlinks,
62
70
  isSatelliteAddon,
63
71
  loadAllPresets,
72
+ loadEnvs,
64
73
  loadMainConfig,
65
74
  loadManagerOrAddonsFile,
66
75
  loadPreset,
67
76
  loadPreviewOrConfigFile,
68
77
  logConfig,
78
+ nodePathsToArray,
69
79
  normalizeStories,
70
80
  normalizeStoriesEntry,
71
- paddedLog,
81
+ normalizeStoryPath,
82
+ optionalEnvToBoolean,
72
83
  parseList,
73
84
  posix,
74
85
  readTemplate,
@@ -80,76 +91,78 @@ import {
80
91
  satisfies,
81
92
  scanAndTransformFiles,
82
93
  serverRequire,
94
+ setupAddonInConfig,
95
+ stringifyEnvs,
96
+ stringifyProcessEnvs,
83
97
  supportedExtensions,
98
+ syncPreviewAddonsWithMainConfig,
84
99
  syncStorybookAddons,
85
100
  temporaryDirectory,
86
101
  temporaryFile,
87
102
  transformImportFiles,
88
103
  validateConfigurationFiles,
89
- validateFrameworkName
90
- } from "../_node-chunks/chunk-WFLWJO24.js";
91
- import "../_node-chunks/chunk-2DMESZFJ.js";
104
+ validateFrameworkName,
105
+ wrapValueWithGetAbsolutePathWrapper
106
+ } from "../_node-chunks/chunk-C2HKH2XQ.js";
92
107
  import {
93
108
  versions_default
94
- } from "../_node-chunks/chunk-Y4E6IGQF.js";
95
- import {
96
- findFilesUp,
97
- getProjectRoot,
98
- invalidateProjectRootCache,
99
- isCI,
100
- loadEnvs,
101
- nodePathsToArray,
102
- normalizeStoryPath,
103
- optionalEnvToBoolean,
104
- stringifyEnvs,
105
- stringifyProcessEnvs
106
- } from "../_node-chunks/chunk-O5DA7YLO.js";
107
- import "../_node-chunks/chunk-DWXTZT3D.js";
108
- import "../_node-chunks/chunk-QYQIZBS6.js";
109
+ } from "../_node-chunks/chunk-YMM6BYF2.js";
110
+ import "../_node-chunks/chunk-MJUDR7HQ.js";
111
+ import "../_node-chunks/chunk-W4F3T6CY.js";
112
+ import "../_node-chunks/chunk-JZR4DHG2.js";
109
113
  import {
110
114
  importMetaResolve,
111
115
  importModule,
112
116
  resolvePackageDir,
113
117
  safeResolveModule
114
- } from "../_node-chunks/chunk-A4APXFQ2.js";
115
- import "../_node-chunks/chunk-WA6KZQZ2.js";
116
- import "../_node-chunks/chunk-LIH7MTP7.js";
117
- import "../_node-chunks/chunk-JARUEMEP.js";
118
- import "../_node-chunks/chunk-E5FJS66Z.js";
119
- import "../_node-chunks/chunk-DUXPWBOK.js";
120
- import "../_node-chunks/chunk-NAOYEL54.js";
121
- import "../_node-chunks/chunk-OP3INKUD.js";
118
+ } from "../_node-chunks/chunk-WVXZFQQU.js";
119
+ import {
120
+ groupBy,
121
+ invariant
122
+ } from "../_node-chunks/chunk-NZBK3DSJ.js";
123
+ import "../_node-chunks/chunk-DQNBAQYT.js";
124
+ import "../_node-chunks/chunk-F74UHHR6.js";
125
+ import "../_node-chunks/chunk-4ZFHN3ZY.js";
126
+ import "../_node-chunks/chunk-KF3WTAEP.js";
127
+ import "../_node-chunks/chunk-A4KENTXT.js";
128
+ import "../_node-chunks/chunk-JMP7YFX2.js";
122
129
  export {
123
- COMMON_ENV_VARS,
124
130
  DEFAULT_FILES_PATTERN,
125
131
  FileSystemCache,
126
132
  HandledError,
127
133
  JsPackageManager,
128
134
  JsPackageManagerFactory,
135
+ PackageManagerName,
129
136
  builderPackages,
130
137
  cache,
131
138
  checkAddonOrder,
132
- codeLog,
133
- commandLog,
134
139
  commonGlobOptions,
140
+ compilerPackages,
135
141
  createFileSystemCache,
136
142
  createLogStream,
137
- extractProperFrameworkName,
138
- extractProperRendererNameFromFramework,
143
+ doesVariableOrFunctionDeclarationExist,
144
+ executeCommand,
145
+ executeCommandSync,
146
+ executeNodeCommand,
147
+ extractFrameworkPackageName,
148
+ extractRenderer,
139
149
  filterPresetsConfig,
140
150
  findConfigFile,
141
151
  findFilesUp,
142
152
  formatFileContent,
143
153
  frameworkPackages,
154
+ frameworkToBuilder,
144
155
  frameworkToRenderer,
156
+ getAbsolutePathWrapperAsCallExpression,
157
+ getAbsolutePathWrapperName,
145
158
  getAddonNames,
146
159
  getAutoRefs,
147
160
  getBuilderOptions,
148
- getChars,
149
161
  getCoercedStorybookVersion,
150
162
  getConfigInfo,
151
163
  getDirectoryFromWorkingDir,
152
164
  getEnvConfig,
165
+ getFieldsForGetAbsolutePathWrapper,
153
166
  getFrameworkName,
154
167
  getInterpretedFile,
155
168
  getPackageDetails,
@@ -164,7 +177,6 @@ export {
164
177
  getStoryTitle,
165
178
  getStorybookConfiguration,
166
179
  getStorybookInfo,
167
- getSyncedStorybookAddons,
168
180
  globToRegexp,
169
181
  groupBy,
170
182
  importMetaResolve,
@@ -174,6 +186,7 @@ export {
174
186
  invariant,
175
187
  isCI,
176
188
  isCorePackage,
189
+ isGetAbsolutePathWrapperNecessary,
177
190
  isPreservingSymlinks,
178
191
  isSatelliteAddon,
179
192
  loadAllPresets,
@@ -188,7 +201,6 @@ export {
188
201
  normalizeStoriesEntry,
189
202
  normalizeStoryPath,
190
203
  optionalEnvToBoolean,
191
- paddedLog,
192
204
  parseList,
193
205
  posix,
194
206
  readTemplate,
@@ -202,14 +214,17 @@ export {
202
214
  satisfies,
203
215
  scanAndTransformFiles,
204
216
  serverRequire,
217
+ setupAddonInConfig,
205
218
  stringifyEnvs,
206
219
  stringifyProcessEnvs,
207
220
  supportedExtensions,
221
+ syncPreviewAddonsWithMainConfig,
208
222
  syncStorybookAddons,
209
223
  temporaryDirectory,
210
224
  temporaryFile,
211
225
  transformImportFiles,
212
226
  validateConfigurationFiles,
213
227
  validateFrameworkName,
214
- versions_default as versions
228
+ versions_default as versions,
229
+ wrapValueWithGetAbsolutePathWrapper
215
230
  };