storybook 9.0.0-alpha.0 → 9.0.0-alpha.2

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 (211) hide show
  1. package/README.md +31 -29
  2. package/assets/browser/favicon.svg +1 -0
  3. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  4. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  5. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  6. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  7. package/assets/docs/message-reference.png +0 -0
  8. package/assets/server/addon.tsconfig.json +6 -0
  9. package/assets/server/base-preview-body.html +119 -0
  10. package/assets/server/base-preview-head.html +451 -0
  11. package/assets/server/template.ejs +87 -0
  12. package/bin/index.cjs +1 -1
  13. package/dist/babel/index.cjs +54034 -0
  14. package/dist/babel/index.d.ts +7488 -0
  15. package/dist/babel/index.js +54044 -0
  16. package/dist/bin/index.cjs +124 -0
  17. package/dist/bin/index.js +118 -0
  18. package/dist/builder-manager/index.cjs +2167 -0
  19. package/dist/builder-manager/index.d.ts +19 -0
  20. package/dist/builder-manager/index.js +2189 -0
  21. package/dist/channels/index.cjs +1938 -0
  22. package/dist/channels/index.d.ts +108 -0
  23. package/dist/channels/index.js +1885 -0
  24. package/dist/cli/bin/index.cjs +2687 -0
  25. package/dist/cli/bin/index.d.ts +2 -0
  26. package/dist/cli/bin/index.js +2707 -0
  27. package/dist/cli/index.cjs +17327 -0
  28. package/dist/cli/index.d.ts +209 -0
  29. package/dist/cli/index.js +17349 -0
  30. package/dist/client-logger/index.cjs +112 -0
  31. package/dist/client-logger/index.d.ts +29 -0
  32. package/dist/client-logger/index.js +70 -0
  33. package/dist/common/index.cjs +20558 -0
  34. package/dist/common/index.d.ts +955 -0
  35. package/dist/common/index.js +20643 -0
  36. package/dist/components/index.cjs +30056 -0
  37. package/dist/components/index.d.ts +1423 -0
  38. package/dist/components/index.js +25416 -0
  39. package/dist/core-events/index.cjs +167 -0
  40. package/dist/core-events/index.d.ts +313 -0
  41. package/dist/core-events/index.js +149 -0
  42. package/dist/core-server/index.cjs +37872 -0
  43. package/dist/core-server/index.d.ts +462 -0
  44. package/dist/core-server/index.js +37966 -0
  45. package/dist/core-server/presets/common-manager.js +28 -0
  46. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  47. package/dist/core-server/presets/common-override-preset.js +4829 -0
  48. package/dist/core-server/presets/common-preset.cjs +10228 -0
  49. package/dist/core-server/presets/common-preset.js +10306 -0
  50. package/dist/csf/index.cjs +223 -0
  51. package/dist/csf/index.d.ts +752 -0
  52. package/dist/csf/index.js +216 -0
  53. package/dist/csf-tools/index.cjs +1422 -0
  54. package/dist/csf-tools/index.d.ts +250 -0
  55. package/dist/csf-tools/index.js +1439 -0
  56. package/dist/docs-tools/index.cjs +923 -0
  57. package/dist/docs-tools/index.d.ts +162 -0
  58. package/dist/docs-tools/index.js +909 -0
  59. package/dist/index.cjs +17 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +2 -7
  62. package/dist/instrumenter/index.cjs +3273 -0
  63. package/dist/instrumenter/index.d.ts +104 -0
  64. package/dist/instrumenter/index.js +4800 -0
  65. package/dist/manager/globals-module-info.cjs +666 -0
  66. package/dist/manager/globals-module-info.d.ts +36 -0
  67. package/dist/manager/globals-module-info.js +653 -0
  68. package/dist/manager/globals-runtime.js +41567 -0
  69. package/dist/manager/globals.cjs +43 -0
  70. package/dist/manager/globals.d.ts +21 -0
  71. package/dist/manager/globals.js +30 -0
  72. package/dist/manager/runtime.js +12043 -0
  73. package/dist/manager-api/index.cjs +10772 -0
  74. package/dist/manager-api/index.d.ts +1211 -0
  75. package/dist/manager-api/index.js +4547 -0
  76. package/dist/manager-errors.d.ts +65 -0
  77. package/dist/manager-errors.js +83 -0
  78. package/dist/node-logger/index.cjs +1642 -0
  79. package/dist/node-logger/index.d.ts +117 -0
  80. package/dist/node-logger/index.js +1652 -0
  81. package/dist/preview/globals.cjs +34 -0
  82. package/dist/preview/globals.d.ts +12 -0
  83. package/dist/preview/globals.js +21 -0
  84. package/dist/preview/runtime.js +7723 -0
  85. package/dist/preview-api/index.cjs +5658 -0
  86. package/dist/preview-api/index.d.ts +1356 -0
  87. package/dist/preview-api/index.js +5665 -0
  88. package/dist/preview-errors.cjs +486 -0
  89. package/dist/preview-errors.d.ts +188 -0
  90. package/dist/preview-errors.js +433 -0
  91. package/dist/router/index.cjs +3320 -0
  92. package/dist/router/index.d.ts +385 -0
  93. package/dist/router/index.js +1849 -0
  94. package/dist/server-errors.cjs +710 -0
  95. package/dist/server-errors.d.ts +272 -0
  96. package/dist/server-errors.js +711 -0
  97. package/dist/telemetry/index.cjs +3683 -0
  98. package/dist/telemetry/index.d.ts +112 -0
  99. package/dist/telemetry/index.js +3720 -0
  100. package/dist/theming/create.cjs +2422 -0
  101. package/dist/theming/create.d.ts +50 -0
  102. package/dist/theming/create.js +990 -0
  103. package/dist/theming/index.cjs +4832 -0
  104. package/dist/theming/index.d.ts +11939 -0
  105. package/dist/theming/index.js +3253 -0
  106. package/dist/types/index.cjs +27 -0
  107. package/dist/types/index.d.ts +2541 -0
  108. package/dist/types/index.js +7 -0
  109. package/package.json +308 -212
  110. package/.eslintrc.cjs +0 -31
  111. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  112. package/core/babel/index.cjs +0 -1
  113. package/core/babel/index.d.ts +0 -2
  114. package/core/babel/index.js +0 -1
  115. package/core/builder-manager/index.cjs +0 -1
  116. package/core/builder-manager/index.d.ts +0 -2
  117. package/core/builder-manager/index.js +0 -1
  118. package/core/channels/index.cjs +0 -1
  119. package/core/channels/index.d.ts +0 -2
  120. package/core/channels/index.js +0 -1
  121. package/core/cli/bin/index.cjs +0 -1
  122. package/core/cli/bin/index.d.ts +0 -2
  123. package/core/cli/bin/index.js +0 -1
  124. package/core/cli/index.cjs +0 -1
  125. package/core/cli/index.d.ts +0 -2
  126. package/core/cli/index.js +0 -1
  127. package/core/client-logger/index.cjs +0 -1
  128. package/core/client-logger/index.d.ts +0 -2
  129. package/core/client-logger/index.js +0 -1
  130. package/core/common/index.cjs +0 -1
  131. package/core/common/index.d.ts +0 -2
  132. package/core/common/index.js +0 -1
  133. package/core/components/index.cjs +0 -1
  134. package/core/components/index.d.ts +0 -2
  135. package/core/components/index.js +0 -1
  136. package/core/core-events/index.cjs +0 -1
  137. package/core/core-events/index.d.ts +0 -2
  138. package/core/core-events/index.js +0 -1
  139. package/core/core-server/index.cjs +0 -1
  140. package/core/core-server/index.d.ts +0 -2
  141. package/core/core-server/index.js +0 -1
  142. package/core/core-server/presets/common-manager.js +0 -1
  143. package/core/core-server/presets/common-override-preset.cjs +0 -1
  144. package/core/core-server/presets/common-override-preset.js +0 -1
  145. package/core/core-server/presets/common-preset.cjs +0 -1
  146. package/core/core-server/presets/common-preset.js +0 -1
  147. package/core/csf/index.cjs +0 -1
  148. package/core/csf/index.d.ts +0 -2
  149. package/core/csf/index.js +0 -1
  150. package/core/csf-tools/index.cjs +0 -1
  151. package/core/csf-tools/index.d.ts +0 -2
  152. package/core/csf-tools/index.js +0 -1
  153. package/core/docs-tools/index.cjs +0 -1
  154. package/core/docs-tools/index.d.ts +0 -2
  155. package/core/docs-tools/index.js +0 -1
  156. package/core/index.cjs +0 -1
  157. package/core/index.d.ts +0 -2
  158. package/core/index.js +0 -1
  159. package/core/manager/globals-module-info.cjs +0 -1
  160. package/core/manager/globals-module-info.d.ts +0 -2
  161. package/core/manager/globals-module-info.js +0 -1
  162. package/core/manager/globals-runtime.js +0 -1
  163. package/core/manager/globals.cjs +0 -1
  164. package/core/manager/globals.d.ts +0 -2
  165. package/core/manager/globals.js +0 -1
  166. package/core/manager-api/index.cjs +0 -1
  167. package/core/manager-api/index.d.ts +0 -2
  168. package/core/manager-api/index.js +0 -1
  169. package/core/manager-errors.d.ts +0 -2
  170. package/core/manager-errors.js +0 -1
  171. package/core/node-logger/index.cjs +0 -1
  172. package/core/node-logger/index.d.ts +0 -2
  173. package/core/node-logger/index.js +0 -1
  174. package/core/preview/globals.cjs +0 -1
  175. package/core/preview/globals.d.ts +0 -2
  176. package/core/preview/globals.js +0 -1
  177. package/core/preview/runtime.js +0 -1
  178. package/core/preview-api/index.cjs +0 -1
  179. package/core/preview-api/index.d.ts +0 -2
  180. package/core/preview-api/index.js +0 -1
  181. package/core/preview-errors.cjs +0 -1
  182. package/core/preview-errors.d.ts +0 -2
  183. package/core/preview-errors.js +0 -1
  184. package/core/router/index.cjs +0 -1
  185. package/core/router/index.d.ts +0 -2
  186. package/core/router/index.js +0 -1
  187. package/core/server-errors.cjs +0 -1
  188. package/core/server-errors.d.ts +0 -2
  189. package/core/server-errors.js +0 -1
  190. package/core/telemetry/index.cjs +0 -1
  191. package/core/telemetry/index.d.ts +0 -2
  192. package/core/telemetry/index.js +0 -1
  193. package/core/theming/create.cjs +0 -1
  194. package/core/theming/create.d.ts +0 -2
  195. package/core/theming/create.js +0 -1
  196. package/core/theming/index.cjs +0 -1
  197. package/core/theming/index.d.ts +0 -2
  198. package/core/theming/index.js +0 -1
  199. package/core/types/index.cjs +0 -1
  200. package/core/types/index.d.ts +0 -2
  201. package/core/types/index.js +0 -1
  202. package/core.cjs +0 -0
  203. package/core.d.ts +0 -0
  204. package/core.js +0 -1
  205. package/dist/chunk-OWLSIX54.js +0 -8
  206. package/dist/core-path.cjs +0 -1
  207. package/dist/core-path.d.ts +0 -3
  208. package/dist/core-path.js +0 -9
  209. package/dist/proxy.cjs +0 -1
  210. package/dist/proxy.d.ts +0 -2
  211. package/dist/proxy.js +0 -9
@@ -0,0 +1,955 @@
1
+ import * as storybook_internal_types from 'storybook/internal/types';
2
+ import { PresetConfig, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CLIOptions, LoadOptions, BuilderOptions, StorybookConfigRaw, LoadedPreset, Presets, PackageJson, CoreCommon_AddonInfo, SupportedFrameworks, SupportedRenderers, Options as Options$1, CoreCommon_StorybookInfo, Ref, StorybookConfig, StoriesEntry, NormalizedStoriesSpecifier } from 'storybook/internal/types';
3
+ export { PackageJson } from 'storybook/internal/types';
4
+ import { WriteStream } from 'node:fs';
5
+ import { Stream } from 'node:stream';
6
+ import { ConfigFile } from 'storybook/internal/csf-tools';
7
+
8
+ declare const _default: {
9
+ '@storybook/addon-a11y': string;
10
+ '@storybook/addon-actions': string;
11
+ '@storybook/addon-backgrounds': string;
12
+ '@storybook/addon-controls': string;
13
+ '@storybook/addon-docs': string;
14
+ '@storybook/addon-essentials': string;
15
+ '@storybook/addon-mdx-gfm': string;
16
+ '@storybook/addon-highlight': string;
17
+ '@storybook/addon-interactions': string;
18
+ '@storybook/addon-jest': string;
19
+ '@storybook/addon-links': string;
20
+ '@storybook/addon-measure': string;
21
+ '@storybook/addon-onboarding': string;
22
+ '@storybook/addon-outline': string;
23
+ '@storybook/addon-storysource': string;
24
+ '@storybook/addon-test': string;
25
+ '@storybook/addon-themes': string;
26
+ '@storybook/addon-toolbars': string;
27
+ '@storybook/addon-viewport': string;
28
+ '@storybook/builder-vite': string;
29
+ '@storybook/builder-webpack5': string;
30
+ storybook: string;
31
+ '@storybook/angular': string;
32
+ '@storybook/ember': string;
33
+ '@storybook/experimental-nextjs-vite': string;
34
+ '@storybook/html-vite': string;
35
+ '@storybook/html-webpack5': string;
36
+ '@storybook/nextjs': string;
37
+ '@storybook/preact-vite': string;
38
+ '@storybook/preact-webpack5': string;
39
+ '@storybook/react-native-web-vite': string;
40
+ '@storybook/react-vite': string;
41
+ '@storybook/react-webpack5': string;
42
+ '@storybook/server-webpack5': string;
43
+ '@storybook/svelte-vite': string;
44
+ '@storybook/svelte-webpack5': string;
45
+ '@storybook/sveltekit': string;
46
+ '@storybook/vue3-vite': string;
47
+ '@storybook/vue3-webpack5': string;
48
+ '@storybook/web-components-vite': string;
49
+ '@storybook/web-components-webpack5': string;
50
+ '@storybook/blocks': string;
51
+ sb: string;
52
+ '@storybook/cli': string;
53
+ '@storybook/codemod': string;
54
+ '@storybook/core-webpack': string;
55
+ 'create-storybook': string;
56
+ '@storybook/csf-plugin': string;
57
+ '@storybook/react-dom-shim': string;
58
+ '@storybook/source-loader': string;
59
+ '@storybook/test': string;
60
+ '@storybook/preset-create-react-app': string;
61
+ '@storybook/preset-html-webpack': string;
62
+ '@storybook/preset-preact-webpack': string;
63
+ '@storybook/preset-react-webpack': string;
64
+ '@storybook/preset-server-webpack': string;
65
+ '@storybook/preset-svelte-webpack': string;
66
+ '@storybook/preset-vue3-webpack': string;
67
+ '@storybook/html': string;
68
+ '@storybook/preact': string;
69
+ '@storybook/react': string;
70
+ '@storybook/server': string;
71
+ '@storybook/svelte': string;
72
+ '@storybook/vue3': string;
73
+ '@storybook/web-components': string;
74
+ };
75
+
76
+ type InterPresetOptions = Omit<CLIOptions & LoadOptions & BuilderOptions & {
77
+ isCritical?: boolean;
78
+ build?: StorybookConfigRaw['build'];
79
+ }, 'frameworkPresets'>;
80
+ declare function filterPresetsConfig(presetsConfig: PresetConfig[]): PresetConfig[];
81
+ /**
82
+ * Parse an addon into either a managerEntries or a preset. Throw on invalid input.
83
+ *
84
+ * Valid inputs:
85
+ *
86
+ * - `'@storybook/addon-actions/manager' => { type: 'virtual', item }`
87
+ * - `'@storybook/addon-docs/preset' => { type: 'presets', item }`
88
+ * - `'@storybook/addon-docs' => { type: 'presets', item: '@storybook/addon-docs/preset' }`
89
+ * - `{ name: '@storybook/addon-docs(/preset)?', options: { } } => { type: 'presets', item: { name:
90
+ * '@storybook/addon-docs/preset', options } }`
91
+ */
92
+ declare const resolveAddonName: (configDir: string, name: string, options: any) => CoreCommon_ResolvedAddonPreset | CoreCommon_ResolvedAddonVirtual | undefined;
93
+ declare function loadPreset(input: PresetConfig, level: number, storybookOptions: InterPresetOptions): Promise<LoadedPreset[]>;
94
+ declare function getPresets(presets: PresetConfig[], storybookOptions: InterPresetOptions): Promise<Presets>;
95
+ declare function loadAllPresets(options: CLIOptions & LoadOptions & BuilderOptions & {
96
+ corePresets: PresetConfig[];
97
+ overridePresets: PresetConfig[];
98
+ /** Whether preset failures should be critical or not */
99
+ isCritical?: boolean;
100
+ build?: StorybookConfigRaw['build'];
101
+ }): Promise<Presets>;
102
+
103
+ interface FileSystemCacheOptions {
104
+ ns?: string;
105
+ prefix?: string;
106
+ hash_alg?: string;
107
+ basePath?: string;
108
+ ttl?: number;
109
+ }
110
+ interface CacheItem {
111
+ key: string;
112
+ content?: any;
113
+ value?: any;
114
+ }
115
+ interface CacheSetOptions {
116
+ ttl?: number;
117
+ encoding?: BufferEncoding;
118
+ }
119
+ declare class FileSystemCache {
120
+ private prefix;
121
+ private hash_alg;
122
+ private cache_dir;
123
+ private ttl;
124
+ constructor(options?: FileSystemCacheOptions);
125
+ private generateHash;
126
+ private isExpired;
127
+ private parseCacheData;
128
+ private parseSetData;
129
+ get<T = any>(name: string, fallback?: T): Promise<T>;
130
+ getSync<T>(name: string, fallback?: T): T;
131
+ set<T>(name: string, data: T, orgOpts?: CacheSetOptions | number): Promise<void>;
132
+ setSync<T>(name: string, data: T, orgOpts?: CacheSetOptions | number): void;
133
+ setMany(items: CacheItem[], options?: CacheSetOptions): Promise<void>;
134
+ setManySync(items: CacheItem[], options?: CacheSetOptions): void;
135
+ remove(name: string): Promise<void>;
136
+ removeSync(name: string): void;
137
+ clear(): Promise<void>;
138
+ clearSync(): void;
139
+ getAll(): Promise<CacheItem[]>;
140
+ load(): Promise<{
141
+ files: CacheItem[];
142
+ }>;
143
+ }
144
+ declare function createFileSystemCache(options: FileSystemCacheOptions): FileSystemCache;
145
+
146
+ declare const cache: FileSystemCache;
147
+
148
+ declare global {
149
+ interface SymbolConstructor {
150
+ readonly observable: symbol;
151
+ }
152
+ }
153
+
154
+ // Helper type. Not useful on its own.
155
+ type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never};
156
+
157
+ /**
158
+ Create a type that has mutually exclusive keys.
159
+
160
+ This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604).
161
+
162
+ This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`.
163
+
164
+ @example
165
+ ```
166
+ import type {MergeExclusive} from 'type-fest';
167
+
168
+ interface ExclusiveVariation1 {
169
+ exclusive1: boolean;
170
+ }
171
+
172
+ interface ExclusiveVariation2 {
173
+ exclusive2: string;
174
+ }
175
+
176
+ type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;
177
+
178
+ let exclusiveOptions: ExclusiveOptions;
179
+
180
+ exclusiveOptions = {exclusive1: true};
181
+ //=> Works
182
+ exclusiveOptions = {exclusive2: 'hi'};
183
+ //=> Works
184
+ exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
185
+ //=> Error
186
+ ```
187
+
188
+ @category Object
189
+ */
190
+ type MergeExclusive<FirstType, SecondType> =
191
+ (FirstType | SecondType) extends object ?
192
+ (Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) :
193
+ FirstType | SecondType;
194
+
195
+ type StdioOption =
196
+ | 'pipe'
197
+ | 'overlapped'
198
+ | 'ipc'
199
+ | 'ignore'
200
+ | 'inherit'
201
+ | Stream
202
+ | number
203
+ | undefined;
204
+
205
+ type EncodingOption =
206
+ | 'utf8'
207
+ // eslint-disable-next-line unicorn/text-encoding-identifier-case
208
+ | 'utf-8'
209
+ | 'utf16le'
210
+ | 'utf-16le'
211
+ | 'ucs2'
212
+ | 'ucs-2'
213
+ | 'latin1'
214
+ | 'binary'
215
+ | 'ascii'
216
+ | 'hex'
217
+ | 'base64'
218
+ | 'base64url'
219
+ | 'buffer'
220
+ | null
221
+ | undefined;
222
+ type DefaultEncodingOption = 'utf8';
223
+
224
+ type CommonOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {
225
+ /**
226
+ Kill the spawned process when the parent process exits unless either:
227
+ - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
228
+ - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
229
+
230
+ @default true
231
+ */
232
+ readonly cleanup?: boolean;
233
+
234
+ /**
235
+ Prefer locally installed binaries when looking for a binary to execute.
236
+
237
+ If you `$ npm install foo`, you can then `execa('foo')`.
238
+
239
+ @default `true` with `$`, `false` otherwise
240
+ */
241
+ readonly preferLocal?: boolean;
242
+
243
+ /**
244
+ Preferred path to find locally installed binaries in (use with `preferLocal`).
245
+
246
+ @default process.cwd()
247
+ */
248
+ readonly localDir?: string | URL;
249
+
250
+ /**
251
+ Path to the Node.js executable to use in child processes.
252
+
253
+ This can be either an absolute path or a path relative to the `cwd` option.
254
+
255
+ Requires `preferLocal` to be `true`.
256
+
257
+ For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
258
+
259
+ @default process.execPath
260
+ */
261
+ readonly execPath?: string;
262
+
263
+ /**
264
+ Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.
265
+
266
+ If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
267
+
268
+ @default true
269
+ */
270
+ readonly buffer?: boolean;
271
+
272
+ /**
273
+ Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
274
+
275
+ @default `inherit` with `$`, `pipe` otherwise
276
+ */
277
+ readonly stdin?: StdioOption;
278
+
279
+ /**
280
+ Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
281
+
282
+ @default 'pipe'
283
+ */
284
+ readonly stdout?: StdioOption;
285
+
286
+ /**
287
+ Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
288
+
289
+ @default 'pipe'
290
+ */
291
+ readonly stderr?: StdioOption;
292
+
293
+ /**
294
+ Setting this to `false` resolves the promise with the error instead of rejecting it.
295
+
296
+ @default true
297
+ */
298
+ readonly reject?: boolean;
299
+
300
+ /**
301
+ Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
302
+
303
+ @default false
304
+ */
305
+ readonly all?: boolean;
306
+
307
+ /**
308
+ Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
309
+
310
+ @default true
311
+ */
312
+ readonly stripFinalNewline?: boolean;
313
+
314
+ /**
315
+ Set to `false` if you don't want to extend the environment variables when providing the `env` property.
316
+
317
+ @default true
318
+ */
319
+ readonly extendEnv?: boolean;
320
+
321
+ /**
322
+ Current working directory of the child process.
323
+
324
+ @default process.cwd()
325
+ */
326
+ readonly cwd?: string | URL;
327
+
328
+ /**
329
+ Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
330
+
331
+ @default process.env
332
+ */
333
+ readonly env?: NodeJS.ProcessEnv;
334
+
335
+ /**
336
+ Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
337
+ */
338
+ readonly argv0?: string;
339
+
340
+ /**
341
+ Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
342
+
343
+ @default 'pipe'
344
+ */
345
+ readonly stdio?: 'pipe' | 'overlapped' | 'ignore' | 'inherit' | readonly StdioOption[];
346
+
347
+ /**
348
+ Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:
349
+ - `json`: Uses `JSON.stringify()` and `JSON.parse()`.
350
+ - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
351
+
352
+ [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
353
+
354
+ @default 'json'
355
+ */
356
+ readonly serialization?: 'json' | 'advanced';
357
+
358
+ /**
359
+ Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
360
+
361
+ @default false
362
+ */
363
+ readonly detached?: boolean;
364
+
365
+ /**
366
+ Sets the user identity of the process.
367
+ */
368
+ readonly uid?: number;
369
+
370
+ /**
371
+ Sets the group identity of the process.
372
+ */
373
+ readonly gid?: number;
374
+
375
+ /**
376
+ If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
377
+
378
+ We recommend against using this option since it is:
379
+ - not cross-platform, encouraging shell-specific syntax.
380
+ - slower, because of the additional shell interpretation.
381
+ - unsafe, potentially allowing command injection.
382
+
383
+ @default false
384
+ */
385
+ readonly shell?: boolean | string;
386
+
387
+ /**
388
+ Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `'buffer'` or `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
389
+
390
+ @default 'utf8'
391
+ */
392
+ readonly encoding?: EncodingType;
393
+
394
+ /**
395
+ If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds.
396
+
397
+ @default 0
398
+ */
399
+ readonly timeout?: number;
400
+
401
+ /**
402
+ Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
403
+
404
+ @default 100_000_000
405
+ */
406
+ readonly maxBuffer?: number;
407
+
408
+ /**
409
+ Signal value to be used when the spawned process will be killed.
410
+
411
+ @default 'SIGTERM'
412
+ */
413
+ readonly killSignal?: string | number;
414
+
415
+ /**
416
+ You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
417
+
418
+ When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`.
419
+
420
+ @example
421
+ ```
422
+ import {execa} from 'execa';
423
+
424
+ const abortController = new AbortController();
425
+ const subprocess = execa('node', [], {signal: abortController.signal});
426
+
427
+ setTimeout(() => {
428
+ abortController.abort();
429
+ }, 1000);
430
+
431
+ try {
432
+ await subprocess;
433
+ } catch (error) {
434
+ console.log(subprocess.killed); // true
435
+ console.log(error.isCanceled); // true
436
+ }
437
+ ```
438
+ */
439
+ readonly signal?: AbortSignal;
440
+
441
+ /**
442
+ If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
443
+
444
+ @default false
445
+ */
446
+ readonly windowsVerbatimArguments?: boolean;
447
+
448
+ /**
449
+ On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
450
+
451
+ @default true
452
+ */
453
+ readonly windowsHide?: boolean;
454
+
455
+ /**
456
+ Print each command on `stderr` before executing it.
457
+
458
+ This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.
459
+
460
+ @default false
461
+ */
462
+ readonly verbose?: boolean;
463
+ };
464
+
465
+ type PackageJsonWithDepsAndDevDeps = PackageJson & Required<Pick<PackageJson, 'dependencies' | 'devDependencies'>>;
466
+ type PackageJsonWithMaybeDeps = Partial<Pick<PackageJson, 'dependencies' | 'devDependencies' | 'peerDependencies' | 'files'>>;
467
+
468
+ type PackageMetadata = {
469
+ version: string;
470
+ location?: string;
471
+ reasons?: string[];
472
+ };
473
+ type InstallationMetadata = {
474
+ dependencies: Record<string, PackageMetadata[]>;
475
+ duplicatedDependencies: Record<string, string[]>;
476
+ infoCommand: string;
477
+ dedupeCommand: string;
478
+ };
479
+
480
+ type PackageManagerName = 'npm' | 'yarn1' | 'yarn2' | 'pnpm' | 'bun';
481
+ /**
482
+ * Extract package name and version from input
483
+ *
484
+ * @param pkg A string like `@storybook/cli`, `react` or `react@^16`
485
+ * @returns A tuple of 2 elements: [packageName, packageVersion]
486
+ */
487
+ declare function getPackageDetails(pkg: string): [string, string?];
488
+ interface JsPackageManagerOptions {
489
+ cwd?: string;
490
+ }
491
+ declare abstract class JsPackageManager {
492
+ abstract readonly type: PackageManagerName;
493
+ abstract initPackageJson(): Promise<void>;
494
+ abstract getRunStorybookCommand(): string;
495
+ abstract getRunCommand(command: string): string;
496
+ abstract getRemoteRunCommand(): string;
497
+ readonly cwd?: string;
498
+ abstract getPackageJSON(packageName: string, basePath?: string): Promise<PackageJson | null>;
499
+ /** Get the INSTALLED version of a package from the package.json file */
500
+ getPackageVersion(packageName: string, basePath?: string | undefined): Promise<string | null>;
501
+ constructor(options?: JsPackageManagerOptions);
502
+ /**
503
+ * Detect whether Storybook gets initialized in a mono-repository/workspace environment The cwd
504
+ * doesn't have to be the root of the monorepo, it can be a subdirectory
505
+ *
506
+ * @returns `true`, if Storybook is initialized inside a mono-repository/workspace
507
+ */
508
+ isStorybookInMonorepo(): boolean;
509
+ /** Install dependencies listed in `package.json` */
510
+ installDependencies(): Promise<void>;
511
+ packageJsonPath(): string;
512
+ readPackageJson(): Promise<PackageJson>;
513
+ writePackageJson(packageJson: PackageJson): Promise<void>;
514
+ /**
515
+ * Read the `package.json` file available in the directory the command was call from If there is
516
+ * no `package.json` it will create one.
517
+ */
518
+ retrievePackageJson(): Promise<PackageJsonWithDepsAndDevDeps>;
519
+ getAllDependencies(): Promise<Partial<Record<string, string>>>;
520
+ /**
521
+ * Add dependencies to a project using `yarn add` or `npm install`.
522
+ *
523
+ * @example
524
+ *
525
+ * ```ts
526
+ * addDependencies(options, [
527
+ * `@storybook/react@${storybookVersion}`,
528
+ * `@storybook/addon-actions@${actionsVersion}`,
529
+ * `@storybook/addon-links@${linksVersion}`,
530
+ * ]);
531
+ * ```
532
+ *
533
+ * @param {Object} options Contains `skipInstall`, `packageJson` and `installAsDevDependencies`
534
+ * which we use to determine how we install packages.
535
+ * @param {Array} dependencies Contains a list of packages to add.
536
+ */
537
+ addDependencies(options: {
538
+ skipInstall?: boolean;
539
+ installAsDevDependencies?: boolean;
540
+ packageJson?: PackageJson;
541
+ }, dependencies: string[]): Promise<void>;
542
+ /**
543
+ * Remove dependencies from a project using `yarn remove` or `npm uninstall`.
544
+ *
545
+ * @example
546
+ *
547
+ * ```ts
548
+ * removeDependencies(options, [`@storybook/react`, `@storybook/addon-actions`]);
549
+ * ```
550
+ *
551
+ * @param {Object} options Contains `skipInstall`, `packageJson` and `installAsDevDependencies`
552
+ * which we use to determine how we install packages.
553
+ * @param {Array} dependencies Contains a list of packages to remove.
554
+ */
555
+ removeDependencies(options: {
556
+ skipInstall?: boolean;
557
+ packageJson?: PackageJson;
558
+ }, dependencies: string[]): Promise<void>;
559
+ /**
560
+ * Return an array of strings matching following format: `<package_name>@<package_latest_version>`
561
+ *
562
+ * For packages in the storybook monorepo, when the latest version is equal to the version of the
563
+ * current CLI the version is not added to the string.
564
+ *
565
+ * When a package is in the monorepo, and the version is not equal to the CLI version, the version
566
+ * is taken from the versions.ts file and added to the string.
567
+ *
568
+ * @param packages
569
+ */
570
+ getVersionedPackages(packages: string[]): Promise<string[]>;
571
+ /**
572
+ * Return an array of string standing for the latest version of the input packages. To be able to
573
+ * identify which version goes with which package the order of the input array is keep.
574
+ *
575
+ * @param packageNames
576
+ */
577
+ getVersions(...packageNames: string[]): Promise<string[]>;
578
+ /**
579
+ * Return the latest version of the input package available on npmjs registry. If constraint are
580
+ * provided it return the latest version matching the constraints.
581
+ *
582
+ * For `@storybook/*` packages the latest version is retrieved from `cli/src/versions.json` file
583
+ * directly
584
+ *
585
+ * @param packageName The name of the package
586
+ * @param constraint A valid semver constraint, example: '1.x || >=2.5.0 || 5.0.0 - 7.2.3'
587
+ */
588
+ getVersion(packageName: string, constraint?: string): Promise<string>;
589
+ /**
590
+ * Get the latest version of the package available on npmjs.com. If constraint is set then it
591
+ * returns a version satisfying it, otherwise the latest version available is returned.
592
+ *
593
+ * @param packageName Name of the package
594
+ * @param constraint Version range to use to constraint the returned version
595
+ */
596
+ latestVersion(packageName: string, constraint?: string): Promise<string>;
597
+ addStorybookCommandInScripts(options?: {
598
+ port: number;
599
+ preCommand?: string;
600
+ }): Promise<void>;
601
+ addScripts(scripts: Record<string, string>): Promise<void>;
602
+ addPackageResolutions(versions: Record<string, string>): Promise<void>;
603
+ protected abstract runInstall(): Promise<void>;
604
+ protected abstract runAddDeps(dependencies: string[], installAsDevDependencies: boolean): Promise<void>;
605
+ protected abstract runRemoveDeps(dependencies: string[]): Promise<void>;
606
+ protected abstract getResolutions(packageJson: PackageJson, versions: Record<string, string>): Record<string, any>;
607
+ /**
608
+ * Get the latest or all versions of the input package available on npmjs.com
609
+ *
610
+ * @param packageName Name of the package
611
+ * @param fetchAllVersions Should return
612
+ */
613
+ protected abstract runGetVersions<T extends boolean>(packageName: string, fetchAllVersions: T): Promise<T extends true ? string[] : string>;
614
+ abstract getRegistryURL(): Promise<string | undefined>;
615
+ abstract runPackageCommand(command: string, args: string[], cwd?: string, stdio?: string): Promise<string>;
616
+ abstract runPackageCommandSync(command: string, args: string[], cwd?: string, stdio?: 'inherit' | 'pipe'): string;
617
+ abstract findInstallations(pattern?: string[]): Promise<InstallationMetadata | undefined>;
618
+ abstract findInstallations(pattern?: string[], options?: {
619
+ depth: number;
620
+ }): Promise<InstallationMetadata | undefined>;
621
+ abstract parseErrorFromLogs(logs?: string): string;
622
+ executeCommandSync({ command, args, stdio, cwd, ignoreError, env, ...execaOptions }: CommonOptions<'utf8'> & {
623
+ command: string;
624
+ args: string[];
625
+ cwd?: string;
626
+ ignoreError?: boolean;
627
+ }): string;
628
+ /** Returns the installed (within node_modules or pnp zip) version of a specified package */
629
+ getInstalledVersion(packageName: string): Promise<string | null>;
630
+ executeCommand({ command, args, stdio, cwd, ignoreError, env, ...execaOptions }: CommonOptions<'utf8'> & {
631
+ command: string;
632
+ args: string[];
633
+ cwd?: string;
634
+ ignoreError?: boolean;
635
+ }): Promise<string>;
636
+ }
637
+
638
+ declare class JsPackageManagerFactory {
639
+ static getPackageManager({ force }?: {
640
+ force?: PackageManagerName;
641
+ }, cwd?: string): JsPackageManager;
642
+ /** Look up map of package manager proxies by name */
643
+ private static PROXY_MAP;
644
+ /**
645
+ * Infer the package manager based on the command the user is running. Each package manager sets
646
+ * the `npm_config_user_agent` environment variable with its name and version e.g. "npm/7.24.0"
647
+ * Which is really useful when invoking commands via npx/pnpx/yarn create/etc.
648
+ */
649
+ private static inferPackageManagerFromUserAgent;
650
+ }
651
+
652
+ declare function temporaryDirectory({ prefix }?: {
653
+ prefix?: string | undefined;
654
+ }): Promise<string>;
655
+ type FileOptions = MergeExclusive<{
656
+ /**
657
+ * File extension.
658
+ *
659
+ * Mutually exclusive with the `name` option.
660
+ *
661
+ * _You usually won't need this option. Specify it only when actually needed._
662
+ */
663
+ readonly extension?: string;
664
+ }, {
665
+ /**
666
+ * Filename.
667
+ *
668
+ * Mutually exclusive with the `extension` option.
669
+ *
670
+ * _You usually won't need this option. Specify it only when actually needed._
671
+ */
672
+ readonly name?: string;
673
+ }>;
674
+ declare function temporaryFile({ name, extension }?: FileOptions): Promise<string>;
675
+ declare function parseList(str: string): string[];
676
+ /**
677
+ * Given a package manager, returns the coerced version of Storybook. It tries to find renderer
678
+ * packages in the project and returns the coerced version of the first one found. Example: If
679
+ *
680
+ * @storybook/react version 8.0.0-alpha.14 is installed, it returns the coerced version 8.0.0
681
+ */
682
+ declare function getCoercedStorybookVersion(packageManager: JsPackageManager): Promise<string>;
683
+ declare function getEnvConfig(program: Record<string, any>, configEnv: Record<string, any>): void;
684
+ /**
685
+ * Given a file name, creates an object with utilities to manage a log file. It creates a temporary
686
+ * log file which you can manage with the returned functions. You can then decide whether to move
687
+ * the log file to the users project, or remove it.
688
+ *
689
+ * @example
690
+ *
691
+ * ```ts
692
+ * const { logStream, moveLogFile, removeLogFile, clearLogFile, readLogFile } =
693
+ * await createLogStream('my-log-file.log');
694
+ *
695
+ * // SCENARIO 1:
696
+ * // you can write custom messages to generate a log file
697
+ * logStream.write('my log message');
698
+ * await moveLogFile();
699
+ *
700
+ * // SCENARIO 2:
701
+ * // or you can pass it to stdio and capture the output of that command
702
+ * try {
703
+ * await this.executeCommand({
704
+ * command: 'pnpm',
705
+ * args: ['info', packageName, ...args],
706
+ * // do not output to the user, and send stdio and stderr to log file
707
+ * stdio: ['ignore', logStream, logStream],
708
+ * });
709
+ * } catch (err) {
710
+ * // do something with the log file content
711
+ * const output = await readLogFile();
712
+ * // move the log file to the users project
713
+ * await moveLogFile();
714
+ * }
715
+ * // success, no need to keep the log file
716
+ * await removeLogFile();
717
+ * ```
718
+ */
719
+ declare const createLogStream: (logFileName?: string) => Promise<{
720
+ moveLogFile: () => Promise<void>;
721
+ removeLogFile: () => Promise<void>;
722
+ clearLogFile: () => Promise<void>;
723
+ readLogFile: () => Promise<string>;
724
+ logStream: WriteStream;
725
+ }>;
726
+ declare const isCorePackage: (pkg: string) => boolean;
727
+
728
+ interface Options {
729
+ before: CoreCommon_AddonInfo;
730
+ after: CoreCommon_AddonInfo;
731
+ configFile: string;
732
+ getConfig: (path: string) => any;
733
+ }
734
+ declare const checkAddonOrder: ({ before, after, configFile, getConfig }: Options) => Promise<void>;
735
+
736
+ declare function loadEnvs(options?: {
737
+ production?: boolean;
738
+ }): {
739
+ stringified: Record<string, string>;
740
+ raw: Record<string, string>;
741
+ };
742
+ declare const stringifyEnvs: (raw: Record<string, string>) => Record<string, string>;
743
+ declare const stringifyProcessEnvs: (raw: Record<string, string>) => Record<string, string>;
744
+
745
+ declare const commonGlobOptions: (glob: string) => {
746
+ ignore?: undefined;
747
+ } | {
748
+ ignore: string[];
749
+ };
750
+
751
+ declare const frameworkToRenderer: Record<SupportedFrameworks | SupportedRenderers, SupportedRenderers | 'vue'>;
752
+
753
+ /**
754
+ * Builder options can be specified in `core.builder.options` or `framework.options.builder`.
755
+ * Preference is given here to `framework.options.builder` if both are specified.
756
+ */
757
+ declare function getBuilderOptions<T extends Record<string, any>>(options: Options$1): Promise<T | Record<string, never>>;
758
+
759
+ /** Framework can be a string or an object. This utility always returns the string name. */
760
+ declare function getFrameworkName(options: Options$1): Promise<string>;
761
+ /**
762
+ * Extracts the proper framework name from the given framework field. The framework field can be the
763
+ * framework package name or a path to the framework package.
764
+ *
765
+ * @example
766
+ *
767
+ * ```ts
768
+ * ExtractProperFrameworkName('/path/to/@storybook/angular'); // => '@storybook/angular'
769
+ * extractProperFrameworkName('@third-party/framework'); // => '@third-party/framework'
770
+ * ```
771
+ */
772
+ declare const extractProperFrameworkName: (framework: string) => string;
773
+
774
+ /**
775
+ * Render is set as a string on core. It must be set by the framework It falls back to the framework
776
+ * name if not set
777
+ */
778
+ declare function getRendererName(options: Options$1): Promise<string>;
779
+ /**
780
+ * Extracts the proper renderer name from the given framework name.
781
+ *
782
+ * @example
783
+ *
784
+ * ```ts
785
+ * extractProperRendererNameFromFramework('@storybook/react'); // => 'react'
786
+ * extractProperRendererNameFromFramework('@storybook/angular'); // => 'angular'
787
+ * extractProperRendererNameFromFramework('@third-party/framework'); // => null
788
+ * ```
789
+ *
790
+ * @param frameworkName The name of the framework.
791
+ * @returns The name of the renderer.
792
+ */
793
+ declare function extractProperRendererNameFromFramework(frameworkName: string): Promise<storybook_internal_types.SupportedRenderers | "vue" | null>;
794
+
795
+ declare function getStorybookConfiguration(storybookScript: string, shortName: string, longName: string): string | null;
796
+
797
+ declare const rendererPackages: Record<string, string>;
798
+ declare const frameworkPackages: Record<string, SupportedFrameworks>;
799
+ declare const builderPackages: string[];
800
+ declare const findConfigFile: (prefix: string, configDir: string) => string | null;
801
+ declare const getConfigInfo: (packageJson: PackageJson, configDir?: string) => {
802
+ configDir: string;
803
+ mainConfig: string | null;
804
+ previewConfig: string | null;
805
+ managerConfig: string | null;
806
+ };
807
+ declare const getStorybookInfo: (packageJson: PackageJson, configDir?: string) => CoreCommon_StorybookInfo;
808
+
809
+ declare const getAutoRefs: (options: Options$1) => Promise<Record<string, Ref>>;
810
+ declare function getRefs(options: Options$1): Promise<Record<string, Ref>>;
811
+
812
+ declare function globToRegexp(glob: string): RegExp;
813
+
814
+ declare class HandledError extends Error {
815
+ handled: boolean;
816
+ constructor(error: unknown);
817
+ }
818
+
819
+ /**
820
+ * Return a string corresponding to template filled with bindings using following pattern: For each
821
+ * (key, value) of `bindings` replace, in template, `{{key}}` by escaped version of `value`
822
+ *
823
+ * @param template {String} Template with `{{binding}}`
824
+ * @param bindings {Object} key-value object use to fill the template, `{{key}}` will be replaced by
825
+ * `escaped(value)`
826
+ * @returns {String} Filled template
827
+ */
828
+ declare const interpolate: (template: string, bindings: Record<string, string>) => string;
829
+
830
+ declare const boost: Set<string>;
831
+ declare function getInterpretedFile(pathToFile: string): string | undefined;
832
+ declare function getInterpretedFileWithExt(pathToFile: string): {
833
+ path: string;
834
+ ext: string;
835
+ } | undefined;
836
+
837
+ declare function interopRequireDefault(filePath: string): any;
838
+ declare function serverRequire(filePath: string | string[]): any;
839
+ declare function serverResolve(filePath: string | string[]): string | null;
840
+
841
+ declare function loadCustomPresets({ configDir }: {
842
+ configDir: string;
843
+ }): PresetConfig[];
844
+
845
+ declare function loadMainConfig({ configDir, noCache, }: {
846
+ configDir: string;
847
+ noCache?: boolean;
848
+ }): Promise<StorybookConfig>;
849
+
850
+ declare function loadManagerOrAddonsFile({ configDir }: {
851
+ configDir: string;
852
+ }): string | undefined;
853
+
854
+ declare function loadPreviewOrConfigFile({ configDir }: {
855
+ configDir: string;
856
+ }): string | undefined;
857
+
858
+ declare const commandLog: (message: string) => (errorMessage?: string | void | undefined, errorInfo?: string) => void;
859
+ declare function paddedLog(message: string): void;
860
+ declare function getChars(char: string, amount: number): string;
861
+ declare function codeLog(codeLines: string[], leftPadAmount?: number): void;
862
+
863
+ declare function logConfig(caption: unknown, config: unknown): void;
864
+
865
+ declare const getDirectoryFromWorkingDir: ({ configDir, workingDir, directory, }: NormalizeOptions & {
866
+ directory: string;
867
+ }) => string;
868
+ declare const normalizeStoriesEntry: (entry: StoriesEntry, { configDir, workingDir, defaultFilesPattern }: NormalizeOptions) => NormalizedStoriesSpecifier;
869
+ interface NormalizeOptions {
870
+ configDir: string;
871
+ workingDir: string;
872
+ defaultFilesPattern?: string;
873
+ }
874
+ declare const normalizeStories: (entries: StoriesEntry[], options: NormalizeOptions) => NormalizedStoriesSpecifier[];
875
+
876
+ declare const getProjectRoot: () => string;
877
+ declare const nodePathsToArray: (nodePath: string) => string[];
878
+ /** Ensures that a path starts with `./` or `../`, or is entirely `.` or `..` */
879
+ declare function normalizeStoryPath(filename: string): string;
880
+
881
+ declare function readTemplate(filename: string): Promise<string>;
882
+
883
+ /**
884
+ * Remove the given addon package and remove it from main.js
885
+ *
886
+ * @example
887
+ *
888
+ * ```sh
889
+ * sb remove @storybook/addon-links
890
+ * ```
891
+ */
892
+ declare function removeAddon(addon: string, options?: {
893
+ packageManager?: PackageManagerName;
894
+ cwd?: string;
895
+ configDir?: string;
896
+ }): Promise<void>;
897
+
898
+ /**
899
+ * Get the path of the file or directory with input name inside the Storybook cache directory:
900
+ *
901
+ * - `node_modules/.cache/storybook/{directoryName}` in a Node.js project or npm package
902
+ * - `.cache/storybook/{directoryName}` otherwise
903
+ *
904
+ * @param fileOrDirectoryName {string} Name of the file or directory
905
+ * @returns {string} Absolute path to the file or directory
906
+ */
907
+ declare function resolvePathInStorybookCache(fileOrDirectoryName: string, sub?: string): string;
908
+
909
+ declare function isPreservingSymlinks(): boolean | undefined;
910
+
911
+ declare function getPreviewBodyTemplate(configDirPath: string, interpolations?: Record<string, string>): string;
912
+ declare function getPreviewHeadTemplate(configDirPath: string, interpolations?: Record<string, string>): string;
913
+
914
+ declare function validateFrameworkName(frameworkName: string | undefined): asserts frameworkName is string;
915
+
916
+ declare function validateConfigurationFiles(configDir: string): Promise<void>;
917
+
918
+ /** Mimicking the satisfies operator until we can upgrade to TS4.9 */
919
+ declare function satisfies<A>(): <T extends A>(x: T) => T;
920
+
921
+ declare function stripAbsNodeModulesPath(absPath: string): string;
922
+
923
+ /**
924
+ * Format the content of a file using prettier. If prettier is not available in the user's project,
925
+ * it will fallback to use editorconfig settings if available and formats the file by a
926
+ * prettier-fallback.
927
+ */
928
+ declare function formatFileContent(filePath: string, content: string): Promise<string>;
929
+
930
+ interface StoryIdData {
931
+ storyFilePath: string;
932
+ exportedStoryName: string;
933
+ }
934
+ type GetStoryIdOptions = StoryIdData & {
935
+ configDir: string;
936
+ stories: StoriesEntry[];
937
+ workingDir?: string;
938
+ userTitle?: string;
939
+ storyFilePath: string;
940
+ };
941
+ declare function getStoryId(data: StoryIdData, options: Options$1): Promise<{
942
+ storyId: string;
943
+ kind: string;
944
+ }>;
945
+ declare function getStoryTitle({ storyFilePath, configDir, stories, workingDir, userTitle, }: Omit<GetStoryIdOptions, 'exportedStoryName'>): string | undefined;
946
+
947
+ /** Replaces the path separator with forward slashes */
948
+ declare const posix: (localPath: string, seperator?: string) => string;
949
+
950
+ declare const getAddonNames: (mainConfig: StorybookConfig) => string[];
951
+
952
+ declare function syncStorybookAddons(mainConfig: StorybookConfig, previewConfigPath: string): Promise<void>;
953
+ declare function getSyncedStorybookAddons(mainConfig: StorybookConfig, previewConfig: ConfigFile): Promise<ConfigFile>;
954
+
955
+ export { type FileOptions, FileSystemCache, HandledError, type InstallationMetadata, JsPackageManager, JsPackageManagerFactory, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, type PackageManagerName, type PackageMetadata, boost, builderPackages, cache, checkAddonOrder, codeLog, commandLog, commonGlobOptions, createFileSystemCache, createLogStream, extractProperFrameworkName, extractProperRendererNameFromFramework, filterPresetsConfig, findConfigFile, formatFileContent, frameworkPackages, frameworkToRenderer, getAddonNames, getAutoRefs, getBuilderOptions, getChars, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFrameworkName, getInterpretedFile, getInterpretedFileWithExt, getPackageDetails, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStoryId, getStoryTitle, getStorybookConfiguration, getStorybookInfo, getSyncedStorybookAddons, globToRegexp, interopRequireDefault, interpolate, isCorePackage, isPreservingSymlinks, loadAllPresets, loadCustomPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, paddedLog, parseList, posix, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolvePathInStorybookCache, satisfies, serverRequire, serverResolve, stringifyEnvs, stringifyProcessEnvs, stripAbsNodeModulesPath, syncStorybookAddons, temporaryDirectory, temporaryFile, validateConfigurationFiles, validateFrameworkName, _default as versions };