storybook 9.0.0-alpha.1 → 9.0.0-alpha.3

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