@storybook/core-common 7.0.0-alpha.43 → 7.0.0-alpha.44

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.
package/dist/index.d.ts CHANGED
@@ -1,1097 +1,7 @@
1
- import { Options as Options$3 } from 'telejson';
2
- import { TransformOptions } from '@babel/core';
3
- import { Router } from 'express';
4
- import { Server } from 'http';
5
- import { Parameters as Parameters$1 } from '@storybook/csf';
1
+ import { PresetConfig, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, LoadedPreset, CLIOptions, LoadOptions, BuilderOptions, Presets, CoreCommon_AddonInfo, Options as Options$2, PackageJson, CoreCommon_StorybookInfo, Ref, StorybookConfig, CoreCommon_StoriesEntry, CoreCommon_NormalizedStoriesSpecifier } from '@storybook/types';
6
2
  import * as Cache from 'file-system-cache';
7
3
  import Cache__default from 'file-system-cache';
8
-
9
- /**
10
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
11
-
12
- @category Type
13
- */
14
- type Primitive =
15
- | null
16
- | undefined
17
- | string
18
- | number
19
- | boolean
20
- | symbol
21
- | bigint;
22
-
23
- declare global {
24
- interface SymbolConstructor {
25
- readonly observable: symbol;
26
- }
27
- }
28
-
29
- /**
30
- Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
31
-
32
- Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
33
-
34
- This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
35
-
36
- @example
37
- ```
38
- import type {LiteralUnion} from 'type-fest';
39
-
40
- // Before
41
-
42
- type Pet = 'dog' | 'cat' | string;
43
-
44
- const pet: Pet = '';
45
- // Start typing in your TypeScript-enabled IDE.
46
- // You **will not** get auto-completion for `dog` and `cat` literals.
47
-
48
- // After
49
-
50
- type Pet2 = LiteralUnion<'dog' | 'cat', string>;
51
-
52
- const pet: Pet2 = '';
53
- // You **will** get auto-completion for `dog` and `cat` literals.
54
- ```
55
-
56
- @category Type
57
- */
58
- type LiteralUnion<
59
- LiteralType,
60
- BaseType extends Primitive,
61
- > = LiteralType | (BaseType & Record<never, never>);
62
-
63
- declare namespace PackageJson$1 {
64
- /**
65
- A person who has been involved in creating or maintaining the package.
66
- */
67
- export type Person =
68
- | string
69
- | {
70
- name: string;
71
- url?: string;
72
- email?: string;
73
- };
74
-
75
- export type BugsLocation =
76
- | string
77
- | {
78
- /**
79
- The URL to the package's issue tracker.
80
- */
81
- url?: string;
82
-
83
- /**
84
- The email address to which issues should be reported.
85
- */
86
- email?: string;
87
- };
88
-
89
- export interface DirectoryLocations {
90
- [directoryType: string]: unknown;
91
-
92
- /**
93
- Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
94
- */
95
- bin?: string;
96
-
97
- /**
98
- Location for Markdown files.
99
- */
100
- doc?: string;
101
-
102
- /**
103
- Location for example scripts.
104
- */
105
- example?: string;
106
-
107
- /**
108
- Location for the bulk of the library.
109
- */
110
- lib?: string;
111
-
112
- /**
113
- Location for man pages. Sugar to generate a `man` array by walking the folder.
114
- */
115
- man?: string;
116
-
117
- /**
118
- Location for test files.
119
- */
120
- test?: string;
121
- }
122
-
123
- export type Scripts = {
124
- /**
125
- Run **before** the package is published (Also run on local `npm install` without any arguments).
126
- */
127
- prepublish?: string;
128
-
129
- /**
130
- Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
131
- */
132
- prepare?: string;
133
-
134
- /**
135
- Run **before** the package is prepared and packed, **only** on `npm publish`.
136
- */
137
- prepublishOnly?: string;
138
-
139
- /**
140
- Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
141
- */
142
- prepack?: string;
143
-
144
- /**
145
- Run **after** the tarball has been generated and moved to its final destination.
146
- */
147
- postpack?: string;
148
-
149
- /**
150
- Run **after** the package is published.
151
- */
152
- publish?: string;
153
-
154
- /**
155
- Run **after** the package is published.
156
- */
157
- postpublish?: string;
158
-
159
- /**
160
- Run **before** the package is installed.
161
- */
162
- preinstall?: string;
163
-
164
- /**
165
- Run **after** the package is installed.
166
- */
167
- install?: string;
168
-
169
- /**
170
- Run **after** the package is installed and after `install`.
171
- */
172
- postinstall?: string;
173
-
174
- /**
175
- Run **before** the package is uninstalled and before `uninstall`.
176
- */
177
- preuninstall?: string;
178
-
179
- /**
180
- Run **before** the package is uninstalled.
181
- */
182
- uninstall?: string;
183
-
184
- /**
185
- Run **after** the package is uninstalled.
186
- */
187
- postuninstall?: string;
188
-
189
- /**
190
- Run **before** bump the package version and before `version`.
191
- */
192
- preversion?: string;
193
-
194
- /**
195
- Run **before** bump the package version.
196
- */
197
- version?: string;
198
-
199
- /**
200
- Run **after** bump the package version.
201
- */
202
- postversion?: string;
203
-
204
- /**
205
- Run with the `npm test` command, before `test`.
206
- */
207
- pretest?: string;
208
-
209
- /**
210
- Run with the `npm test` command.
211
- */
212
- test?: string;
213
-
214
- /**
215
- Run with the `npm test` command, after `test`.
216
- */
217
- posttest?: string;
218
-
219
- /**
220
- Run with the `npm stop` command, before `stop`.
221
- */
222
- prestop?: string;
223
-
224
- /**
225
- Run with the `npm stop` command.
226
- */
227
- stop?: string;
228
-
229
- /**
230
- Run with the `npm stop` command, after `stop`.
231
- */
232
- poststop?: string;
233
-
234
- /**
235
- Run with the `npm start` command, before `start`.
236
- */
237
- prestart?: string;
238
-
239
- /**
240
- Run with the `npm start` command.
241
- */
242
- start?: string;
243
-
244
- /**
245
- Run with the `npm start` command, after `start`.
246
- */
247
- poststart?: string;
248
-
249
- /**
250
- Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
251
- */
252
- prerestart?: string;
253
-
254
- /**
255
- Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
256
- */
257
- restart?: string;
258
-
259
- /**
260
- Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
261
- */
262
- postrestart?: string;
263
- } & Partial<Record<string, string>>;
264
-
265
- /**
266
- Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
267
- */
268
- export type Dependency = Partial<Record<string, string>>;
269
-
270
- /**
271
- Conditions which provide a way to resolve a package entry point based on the environment.
272
- */
273
- export type ExportCondition = LiteralUnion<
274
- | 'import'
275
- | 'require'
276
- | 'node'
277
- | 'node-addons'
278
- | 'deno'
279
- | 'browser'
280
- | 'electron'
281
- | 'react-native'
282
- | 'default',
283
- string
284
- >;
285
-
286
- type ExportConditions = {[condition in ExportCondition]: Exports};
287
-
288
- /**
289
- Entry points of a module, optionally with conditions and subpath exports.
290
- */
291
- export type Exports =
292
- | null
293
- | string
294
- | Array<string | ExportConditions>
295
- | ExportConditions
296
- | {[path: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
297
-
298
- /**
299
- Import map entries of a module, optionally with conditions.
300
- */
301
- export type Imports = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
302
- [key: string]: string | {[key in ExportCondition]: Exports};
303
- };
304
-
305
- export interface NonStandardEntryPoints {
306
- /**
307
- An ECMAScript module ID that is the primary entry point to the program.
308
- */
309
- module?: string;
310
-
311
- /**
312
- A module ID with untranspiled code that is the primary entry point to the program.
313
- */
314
- esnext?:
315
- | string
316
- | {
317
- [moduleName: string]: string | undefined;
318
- main?: string;
319
- browser?: string;
320
- };
321
-
322
- /**
323
- A hint to JavaScript bundlers or component tools when packaging modules for client side use.
324
- */
325
- browser?:
326
- | string
327
- | Partial<Record<string, string | false>>;
328
-
329
- /**
330
- Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
331
-
332
- [Read more.](https://webpack.js.org/guides/tree-shaking/)
333
- */
334
- sideEffects?: boolean | string[];
335
- }
336
-
337
- export interface TypeScriptConfiguration {
338
- /**
339
- Location of the bundled TypeScript declaration file.
340
- */
341
- types?: string;
342
-
343
- /**
344
- Version selection map of TypeScript.
345
- */
346
- typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;
347
-
348
- /**
349
- Location of the bundled TypeScript declaration file. Alias of `types`.
350
- */
351
- typings?: string;
352
- }
353
-
354
- /**
355
- An alternative configuration for Yarn workspaces.
356
- */
357
- export interface WorkspaceConfig {
358
- /**
359
- An array of workspace pattern strings which contain the workspace packages.
360
- */
361
- packages?: WorkspacePattern[];
362
-
363
- /**
364
- Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
365
-
366
- [Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
367
- */
368
- nohoist?: WorkspacePattern[];
369
- }
370
-
371
- /**
372
- A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
373
-
374
- The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
375
-
376
- @example
377
- `docs` → Include the docs directory and install its dependencies.
378
- `packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
379
- */
380
- type WorkspacePattern = string;
381
-
382
- export interface YarnConfiguration {
383
- /**
384
- Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
385
-
386
- Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
387
-
388
- Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
389
- */
390
- workspaces?: WorkspacePattern[] | WorkspaceConfig;
391
-
392
- /**
393
- If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
394
-
395
- Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
396
- */
397
- flat?: boolean;
398
-
399
- /**
400
- Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
401
- */
402
- resolutions?: Dependency;
403
- }
404
-
405
- export interface JSPMConfiguration {
406
- /**
407
- JSPM configuration.
408
- */
409
- jspm?: PackageJson$1;
410
- }
411
-
412
- /**
413
- Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
414
- */
415
- export interface PackageJsonStandard {
416
- /**
417
- The name of the package.
418
- */
419
- name?: string;
420
-
421
- /**
422
- Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
423
- */
424
- version?: string;
425
-
426
- /**
427
- Package description, listed in `npm search`.
428
- */
429
- description?: string;
430
-
431
- /**
432
- Keywords associated with package, listed in `npm search`.
433
- */
434
- keywords?: string[];
435
-
436
- /**
437
- The URL to the package's homepage.
438
- */
439
- homepage?: LiteralUnion<'.', string>;
440
-
441
- /**
442
- The URL to the package's issue tracker and/or the email address to which issues should be reported.
443
- */
444
- bugs?: BugsLocation;
445
-
446
- /**
447
- The license for the package.
448
- */
449
- license?: string;
450
-
451
- /**
452
- The licenses for the package.
453
- */
454
- licenses?: Array<{
455
- type?: string;
456
- url?: string;
457
- }>;
458
-
459
- author?: Person;
460
-
461
- /**
462
- A list of people who contributed to the package.
463
- */
464
- contributors?: Person[];
465
-
466
- /**
467
- A list of people who maintain the package.
468
- */
469
- maintainers?: Person[];
470
-
471
- /**
472
- The files included in the package.
473
- */
474
- files?: string[];
475
-
476
- /**
477
- Resolution algorithm for importing ".js" files from the package's scope.
478
-
479
- [Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)
480
- */
481
- type?: 'module' | 'commonjs';
482
-
483
- /**
484
- The module ID that is the primary entry point to the program.
485
- */
486
- main?: string;
487
-
488
- /**
489
- Subpath exports to define entry points of the package.
490
-
491
- [Read more.](https://nodejs.org/api/packages.html#subpath-exports)
492
- */
493
- exports?: Exports;
494
-
495
- /**
496
- Subpath imports to define internal package import maps that only apply to import specifiers from within the package itself.
497
-
498
- [Read more.](https://nodejs.org/api/packages.html#subpath-imports)
499
- */
500
- imports?: Imports;
501
-
502
- /**
503
- The executable files that should be installed into the `PATH`.
504
- */
505
- bin?:
506
- | string
507
- | Partial<Record<string, string>>;
508
-
509
- /**
510
- Filenames to put in place for the `man` program to find.
511
- */
512
- man?: string | string[];
513
-
514
- /**
515
- Indicates the structure of the package.
516
- */
517
- directories?: DirectoryLocations;
518
-
519
- /**
520
- Location for the code repository.
521
- */
522
- repository?:
523
- | string
524
- | {
525
- type: string;
526
- url: string;
527
-
528
- /**
529
- Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
530
-
531
- [Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
532
- */
533
- directory?: string;
534
- };
535
-
536
- /**
537
- Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
538
- */
539
- scripts?: Scripts;
540
-
541
- /**
542
- Is used to set configuration parameters used in package scripts that persist across upgrades.
543
- */
544
- config?: Record<string, unknown>;
545
-
546
- /**
547
- The dependencies of the package.
548
- */
549
- dependencies?: Dependency;
550
-
551
- /**
552
- Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
553
- */
554
- devDependencies?: Dependency;
555
-
556
- /**
557
- Dependencies that are skipped if they fail to install.
558
- */
559
- optionalDependencies?: Dependency;
560
-
561
- /**
562
- Dependencies that will usually be required by the package user directly or via another dependency.
563
- */
564
- peerDependencies?: Dependency;
565
-
566
- /**
567
- Indicate peer dependencies that are optional.
568
- */
569
- peerDependenciesMeta?: Partial<Record<string, {optional: true}>>;
570
-
571
- /**
572
- Package names that are bundled when the package is published.
573
- */
574
- bundledDependencies?: string[];
575
-
576
- /**
577
- Alias of `bundledDependencies`.
578
- */
579
- bundleDependencies?: string[];
580
-
581
- /**
582
- Engines that this package runs on.
583
- */
584
- engines?: {
585
- [EngineName in 'npm' | 'node' | string]?: string;
586
- };
587
-
588
- /**
589
- @deprecated
590
- */
591
- engineStrict?: boolean;
592
-
593
- /**
594
- Operating systems the module runs on.
595
- */
596
- os?: Array<LiteralUnion<
597
- | 'aix'
598
- | 'darwin'
599
- | 'freebsd'
600
- | 'linux'
601
- | 'openbsd'
602
- | 'sunos'
603
- | 'win32'
604
- | '!aix'
605
- | '!darwin'
606
- | '!freebsd'
607
- | '!linux'
608
- | '!openbsd'
609
- | '!sunos'
610
- | '!win32',
611
- string
612
- >>;
613
-
614
- /**
615
- CPU architectures the module runs on.
616
- */
617
- cpu?: Array<LiteralUnion<
618
- | 'arm'
619
- | 'arm64'
620
- | 'ia32'
621
- | 'mips'
622
- | 'mipsel'
623
- | 'ppc'
624
- | 'ppc64'
625
- | 's390'
626
- | 's390x'
627
- | 'x32'
628
- | 'x64'
629
- | '!arm'
630
- | '!arm64'
631
- | '!ia32'
632
- | '!mips'
633
- | '!mipsel'
634
- | '!ppc'
635
- | '!ppc64'
636
- | '!s390'
637
- | '!s390x'
638
- | '!x32'
639
- | '!x64',
640
- string
641
- >>;
642
-
643
- /**
644
- If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
645
-
646
- @deprecated
647
- */
648
- preferGlobal?: boolean;
649
-
650
- /**
651
- If set to `true`, then npm will refuse to publish it.
652
- */
653
- private?: boolean;
654
-
655
- /**
656
- A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
657
- */
658
- publishConfig?: PublishConfig;
659
-
660
- /**
661
- Describes and notifies consumers of a package's monetary support information.
662
-
663
- [Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
664
- */
665
- funding?: string | {
666
- /**
667
- The type of funding.
668
- */
669
- type?: LiteralUnion<
670
- | 'github'
671
- | 'opencollective'
672
- | 'patreon'
673
- | 'individual'
674
- | 'foundation'
675
- | 'corporation',
676
- string
677
- >;
678
-
679
- /**
680
- The URL to the funding page.
681
- */
682
- url: string;
683
- };
684
- }
685
-
686
- export interface PublishConfig {
687
- /**
688
- Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).
689
- */
690
- [additionalProperties: string]: unknown;
691
-
692
- /**
693
- When publishing scoped packages, the access level defaults to restricted. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for access are public and restricted. Unscoped packages always have an access level of public.
694
- */
695
- access?: 'public' | 'restricted';
696
-
697
- /**
698
- The base URL of the npm registry.
699
-
700
- Default: `'https://registry.npmjs.org/'`
701
- */
702
- registry?: string;
703
-
704
- /**
705
- The tag to publish the package under.
706
-
707
- Default: `'latest'`
708
- */
709
- tag?: string;
710
- }
711
- }
712
-
713
- /**
714
- Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
715
-
716
- @category File
717
- */
718
- type PackageJson$1 =
719
- PackageJson$1.PackageJsonStandard &
720
- PackageJson$1.NonStandardEntryPoints &
721
- PackageJson$1.TypeScriptConfiguration &
722
- PackageJson$1.YarnConfiguration &
723
- PackageJson$1.JSPMConfiguration;
724
-
725
- declare type Options$2 = Parameters<typeof Cache__default>['0'];
726
- declare type FileSystemCache = ReturnType<typeof Cache__default>;
727
- declare function createFileSystemCache(options: Options$2): FileSystemCache;
728
-
729
- /**
730
- * ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
731
- */
732
- declare type BuilderName = 'webpack5' | '@storybook/builder-webpack5' | string;
733
- declare type RendererName = string;
734
- interface CoreConfig {
735
- builder?: BuilderName | {
736
- name: BuilderName;
737
- options?: Record<string, any>;
738
- };
739
- renderer?: RendererName;
740
- disableWebpackDefaults?: boolean;
741
- channelOptions?: Partial<Options$3>;
742
- /**
743
- * Disables the generation of project.json, a file containing Storybook metadata
744
- */
745
- disableProjectJson?: boolean;
746
- /**
747
- * Disables Storybook telemetry
748
- * @see https://storybook.js.org/telemetry
749
- */
750
- disableTelemetry?: boolean;
751
- /**
752
- * Enable crash reports to be sent to Storybook telemetry
753
- * @see https://storybook.js.org/telemetry
754
- */
755
- enableCrashReports?: boolean;
756
- /**
757
- * enable CORS headings to run document in a "secure context"
758
- * see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
759
- * This enables these headers in development-mode:
760
- * Cross-Origin-Opener-Policy: same-origin
761
- * Cross-Origin-Embedder-Policy: require-corp
762
- */
763
- crossOriginIsolated?: boolean;
764
- }
765
- interface DirectoryMapping {
766
- from: string;
767
- to: string;
768
- }
769
- interface Presets {
770
- apply(extension: 'typescript', config: TypescriptOptions, args?: Options$1): Promise<TypescriptOptions>;
771
- apply(extension: 'framework', config?: {}, args?: any): Promise<Preset>;
772
- apply(extension: 'babel', config?: {}, args?: any): Promise<TransformOptions>;
773
- apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
774
- apply(extension: 'stories', config?: [], args?: any): Promise<StoriesEntry[]>;
775
- apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
776
- apply(extension: 'refs', config?: [], args?: any): Promise<unknown>;
777
- apply(extension: 'core', config?: {}, args?: any): Promise<CoreConfig>;
778
- apply<T>(extension: string, config?: T, args?: unknown): Promise<T>;
779
- }
780
- interface LoadedPreset {
781
- name: string;
782
- preset: any;
783
- options: any;
784
- }
785
- declare type PresetConfig = string | {
786
- name: string;
787
- options?: unknown;
788
- };
789
- interface Ref {
790
- id: string;
791
- url: string;
792
- title: string;
793
- version: string;
794
- type?: string;
795
- disable?: boolean;
796
- }
797
- interface VersionCheck {
798
- success: boolean;
799
- data?: any;
800
- error?: any;
801
- time: number;
802
- }
803
- interface ReleaseNotesData {
804
- success: boolean;
805
- currentVersion: string;
806
- showOnFirstLaunch: boolean;
807
- }
808
- interface Stats {
809
- toJson: () => any;
810
- }
811
- interface BuilderResult {
812
- totalTime?: ReturnType<typeof process.hrtime>;
813
- stats?: Stats;
814
- }
815
- declare type PackageJson = PackageJson$1 & Record<string, any>;
816
- interface LoadOptions {
817
- packageJson: PackageJson;
818
- outputDir?: string;
819
- configDir?: string;
820
- ignorePreview?: boolean;
821
- extendServer?: (server: Server) => void;
822
- }
823
- interface CLIOptions {
824
- port?: number;
825
- ignorePreview?: boolean;
826
- previewUrl?: string;
827
- forceBuildPreview?: boolean;
828
- disableTelemetry?: boolean;
829
- enableCrashReports?: boolean;
830
- host?: string;
831
- /**
832
- * @deprecated Use 'staticDirs' Storybook Configuration option instead
833
- */
834
- staticDir?: string[];
835
- configDir?: string;
836
- https?: boolean;
837
- sslCa?: string[];
838
- sslCert?: string;
839
- sslKey?: string;
840
- smokeTest?: boolean;
841
- managerCache?: boolean;
842
- open?: boolean;
843
- ci?: boolean;
844
- loglevel?: string;
845
- quiet?: boolean;
846
- versionUpdates?: boolean;
847
- releaseNotes?: boolean;
848
- dll?: boolean;
849
- docs?: boolean;
850
- docsDll?: boolean;
851
- uiDll?: boolean;
852
- debugWebpack?: boolean;
853
- webpackStatsJson?: string | boolean;
854
- outputDir?: string;
855
- }
856
- interface BuilderOptions {
857
- configType?: 'DEVELOPMENT' | 'PRODUCTION';
858
- ignorePreview: boolean;
859
- cache: FileSystemCache;
860
- configDir: string;
861
- docsMode: boolean;
862
- features?: StorybookConfig['features'];
863
- versionCheck?: VersionCheck;
864
- releaseNotesData?: ReleaseNotesData;
865
- disableWebpackDefaults?: boolean;
866
- serverChannelUrl?: string;
867
- }
868
- interface StorybookConfigOptions {
869
- presets: Presets;
870
- presetsList?: LoadedPreset[];
871
- }
872
- declare type Options$1 = LoadOptions & StorybookConfigOptions & CLIOptions & BuilderOptions;
873
- interface Builder<Config, BuilderStats extends Stats = Stats> {
874
- getConfig: (options: Options$1) => Promise<Config>;
875
- start: (args: {
876
- options: Options$1;
877
- startTime: ReturnType<typeof process.hrtime>;
878
- router: Router;
879
- server: Server;
880
- }) => Promise<void | {
881
- stats?: BuilderStats;
882
- totalTime: ReturnType<typeof process.hrtime>;
883
- bail: (e?: Error) => Promise<void>;
884
- }>;
885
- build: (arg: {
886
- options: Options$1;
887
- startTime: ReturnType<typeof process.hrtime>;
888
- }) => Promise<void | BuilderStats>;
889
- bail: (e?: Error) => Promise<void>;
890
- corePresets?: string[];
891
- overridePresets?: string[];
892
- }
893
- interface IndexerOptions {
894
- makeTitle: (userTitle?: string) => string;
895
- }
896
- interface IndexedStory {
897
- id: string;
898
- name: string;
899
- parameters?: Parameters$1;
900
- }
901
- interface StoryIndex {
902
- meta: {
903
- title?: string;
904
- };
905
- stories: IndexedStory[];
906
- }
907
- interface StoryIndexer {
908
- test: RegExp;
909
- indexer: (fileName: string, options: IndexerOptions) => Promise<StoryIndex>;
910
- addDocsTemplate?: boolean;
911
- }
912
- /**
913
- * Options for TypeScript usage within Storybook.
914
- */
915
- interface TypescriptOptions {
916
- /**
917
- * Enables type checking within Storybook.
918
- *
919
- * @default `false`
920
- */
921
- check: boolean;
922
- /**
923
- * Disable parsing typescript files through babel.
924
- *
925
- * @default `false`
926
- */
927
- skipBabel: boolean;
928
- }
929
- interface StoriesSpecifier {
930
- /**
931
- * When auto-titling, what to prefix all generated titles with (default: '')
932
- */
933
- titlePrefix?: string;
934
- /**
935
- * Where to start looking for story files
936
- */
937
- directory: string;
938
- /**
939
- * What does the filename of a story file look like?
940
- * (a glob, relative to directory, no leading `./`)
941
- * If unset, we use `** / *.stories.@(mdx|tsx|ts|jsx|js)` (no spaces)
942
- */
943
- files?: string;
944
- }
945
- declare type StoriesEntry = string | StoriesSpecifier;
946
- declare type NormalizedStoriesSpecifier = Required<StoriesSpecifier> & {
947
- importPathMatcher: RegExp;
948
- };
949
- declare type Preset = string | {
950
- name: string;
951
- options?: any;
952
- };
953
- /**
954
- * An additional script that gets injected into the
955
- * preview or the manager,
956
- */
957
- declare type Entry = string;
958
- declare type StorybookRefs = Record<string, {
959
- title: string;
960
- url: string;
961
- } | {
962
- disable: boolean;
963
- }>;
964
- declare type DocsOptions = {
965
- /**
966
- * Should we generate docs entries at all under any circumstances? (i.e. can they be rendered)
967
- */
968
- enabled?: boolean;
969
- /**
970
- * What should we call the generated docs entries?
971
- */
972
- defaultName?: string;
973
- /**
974
- * Should we generate a docs entry per CSF file?
975
- */
976
- docsPage?: boolean;
977
- /**
978
- * Only show doc entries in the side bar (usually set with the `--docs` CLI flag)
979
- */
980
- docsMode?: boolean;
981
- };
982
- /**
983
- * The interface for Storybook configuration in `main.ts` files.
984
- */
985
- interface StorybookConfig {
986
- /**
987
- * Sets the addons you want to use with Storybook.
988
- *
989
- * @example `['@storybook/addon-essentials']` or `[{ name: '@storybook/addon-essentials', options: { backgrounds: false } }]`
990
- */
991
- addons?: Preset[];
992
- core?: CoreConfig;
993
- /**
994
- * Sets a list of directories of static files to be loaded by Storybook server
995
- *
996
- * @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
997
- */
998
- staticDirs?: (DirectoryMapping | string)[];
999
- logLevel?: string;
1000
- features?: {
1001
- /**
1002
- * Allows to disable deprecated implicit PostCSS loader. (will be removed in 7.0)
1003
- */
1004
- postcss?: boolean;
1005
- /**
1006
- * Build stories.json automatically on start/build
1007
- */
1008
- buildStoriesJson?: boolean;
1009
- /**
1010
- * Activate preview of CSF v3.0
1011
- *
1012
- * @deprecated This is always on now from 6.4 regardless of the setting
1013
- */
1014
- previewCsfV3?: boolean;
1015
- /**
1016
- * Activate on demand story store
1017
- */
1018
- storyStoreV7?: boolean;
1019
- /**
1020
- * Enable a set of planned breaking changes for SB7.0
1021
- */
1022
- breakingChangesV7?: boolean;
1023
- /**
1024
- * Enable the step debugger functionality in Addon-interactions.
1025
- */
1026
- interactionsDebugger?: boolean;
1027
- /**
1028
- * Use Storybook 7.0 babel config scheme
1029
- */
1030
- babelModeV7?: boolean;
1031
- /**
1032
- * Filter args with a "target" on the type from the render function (EXPERIMENTAL)
1033
- */
1034
- argTypeTargetsV7?: boolean;
1035
- /**
1036
- * Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title.
1037
- * Will be removed in 7.0.
1038
- */
1039
- warnOnLegacyHierarchySeparator?: boolean;
1040
- };
1041
- /**
1042
- * Tells Storybook where to find stories.
1043
- *
1044
- * @example `['./src/*.stories.@(j|t)sx?']`
1045
- */
1046
- stories: StoriesEntry[];
1047
- /**
1048
- * Framework, e.g. '@storybook/react', required in v7
1049
- */
1050
- framework?: Preset;
1051
- /**
1052
- * Controls how Storybook handles TypeScript files.
1053
- */
1054
- typescript?: Partial<TypescriptOptions>;
1055
- /**
1056
- * References external Storybooks
1057
- */
1058
- refs?: StorybookRefs | ((config: any, options: Options$1) => StorybookRefs);
1059
- /**
1060
- * Modify or return babel config.
1061
- */
1062
- babel?: (config: TransformOptions, options: Options$1) => TransformOptions | Promise<TransformOptions>;
1063
- /**
1064
- * Modify or return babel config.
1065
- */
1066
- babelDefault?: (config: TransformOptions, options: Options$1) => TransformOptions | Promise<TransformOptions>;
1067
- /**
1068
- * Add additional scripts to run in the preview a la `.storybook/preview.js`
1069
- *
1070
- * @deprecated use `previewAnnotations` or `/preview.js` file instead
1071
- */
1072
- config?: (entries: Entry[], options: Options$1) => Entry[];
1073
- /**
1074
- * Add additional scripts to run in the preview a la `.storybook/preview.js`
1075
- */
1076
- previewAnnotations?: (entries: Entry[], options: Options$1) => Entry[];
1077
- /**
1078
- * Process CSF files for the story index.
1079
- */
1080
- storyIndexers?: (indexers: StoryIndexer[], options: Options$1) => StoryIndexer[];
1081
- /**
1082
- * Docs related features in index generation
1083
- */
1084
- docs?: DocsOptions;
1085
- /**
1086
- * Programmatically modify the preview head/body HTML.
1087
- * The previewHead and previewBody functions accept a string,
1088
- * which is the existing head/body, and return a modified string.
1089
- */
1090
- previewHead?: (head: string, options: Options$1) => string;
1091
- previewBody?: (body: string, options: Options$1) => string;
1092
- }
1093
- declare type PresetProperty<K, TStorybookConfig = StorybookConfig> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
1094
- declare type PresetPropertyFn<K, TStorybookConfig = StorybookConfig, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options$1 & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
4
+ import { Router } from 'express';
1095
5
 
1096
6
  declare function filterPresetsConfig(presetsConfig: PresetConfig[]): PresetConfig[];
1097
7
  /**
@@ -1110,21 +20,7 @@ declare function filterPresetsConfig(presetsConfig: PresetConfig[]): PresetConfi
1110
20
  * - { name: '@storybook/addon-docs(/preset)?', options: { ... } }
1111
21
  * => { type: 'presets', item: { name: '@storybook/addon-docs/preset', options } }
1112
22
  */
1113
- interface ResolvedAddonPreset {
1114
- type: 'presets';
1115
- name: string;
1116
- }
1117
- interface ResolvedAddonVirtual {
1118
- type: 'virtual';
1119
- name: string;
1120
- managerEntries?: string[];
1121
- previewAnnotations?: string[];
1122
- presets?: (string | {
1123
- name: string;
1124
- options?: any;
1125
- })[];
1126
- }
1127
- declare const resolveAddonName: (configDir: string, name: string, options: any) => ResolvedAddonPreset | ResolvedAddonVirtual | undefined;
23
+ declare const resolveAddonName: (configDir: string, name: string, options: any) => CoreCommon_ResolvedAddonPreset | CoreCommon_ResolvedAddonVirtual | undefined;
1128
24
  declare function loadPreset(input: PresetConfig, level: number, storybookOptions: InterPresetOptions): Promise<LoadedPreset[]>;
1129
25
  declare type InterPresetOptions = Omit<CLIOptions & LoadOptions & BuilderOptions, 'frameworkPresets'>;
1130
26
  declare function getPresets(presets: PresetConfig[], storybookOptions: InterPresetOptions): Promise<Presets>;
@@ -1135,21 +31,13 @@ declare function loadAllPresets(options: CLIOptions & LoadOptions & BuilderOptio
1135
31
 
1136
32
  declare const cache: Cache.FileSystemCache;
1137
33
 
1138
- declare type OptionsEntry = {
1139
- name: string;
1140
- };
1141
- declare type AddonEntry = string | OptionsEntry;
1142
- declare type AddonInfo = {
1143
- name: string;
1144
- inEssentials: boolean;
1145
- };
1146
- interface Options {
1147
- before: AddonInfo;
1148
- after: AddonInfo;
34
+ interface Options$1 {
35
+ before: CoreCommon_AddonInfo;
36
+ after: CoreCommon_AddonInfo;
1149
37
  configFile: string;
1150
38
  getConfig: (path: string) => any;
1151
39
  }
1152
- declare const checkAddonOrder: ({ before, after, configFile, getConfig }: Options) => Promise<void>;
40
+ declare const checkAddonOrder: ({ before, after, configFile, getConfig }: Options$1) => Promise<void>;
1153
41
 
1154
42
  declare function loadEnvs(options?: {
1155
43
  production?: boolean;
@@ -1165,30 +53,19 @@ declare const findDistEsm: (cwd: string, relativePath: string) => string;
1165
53
  /**
1166
54
  * Framework can be a string or an object. This utility always returns the string name.
1167
55
  */
1168
- declare function getFrameworkName(options: Options$1): Promise<string>;
56
+ declare function getFrameworkName(options: Options$2): Promise<string>;
1169
57
 
1170
58
  /**
1171
59
  * Render is set as a string on core. It must be set by the framework
1172
60
  */
1173
- declare function getRendererName(options: Options$1): Promise<string>;
61
+ declare function getRendererName(options: Options$2): Promise<string>;
1174
62
 
1175
63
  declare function getStorybookConfiguration(storybookScript: string, shortName: string, longName: string): string | null;
1176
64
 
1177
- interface StorybookInfo {
1178
- version: string;
1179
- framework: string;
1180
- frameworkPackage: string;
1181
- renderer: string;
1182
- rendererPackage: string;
1183
- configDir?: string;
1184
- mainConfig?: string;
1185
- previewConfig?: string;
1186
- managerConfig?: string;
1187
- }
1188
- declare const getStorybookInfo: (packageJson: PackageJson) => StorybookInfo;
65
+ declare const getStorybookInfo: (packageJson: PackageJson) => CoreCommon_StorybookInfo;
1189
66
 
1190
- declare const getAutoRefs: (options: Options$1) => Promise<Record<string, Ref>>;
1191
- declare function getRefs(options: Options$1): Promise<Record<string, Ref>>;
67
+ declare const getAutoRefs: (options: Options$2) => Promise<Record<string, Ref>>;
68
+ declare function getRefs(options: Options$2): Promise<Record<string, Ref>>;
1192
69
 
1193
70
  declare function globToRegexp(glob: string): RegExp;
1194
71
 
@@ -1236,12 +113,12 @@ declare function logConfig(caption: unknown, config: unknown): void;
1236
113
  declare const getDirectoryFromWorkingDir: ({ configDir, workingDir, directory, }: NormalizeOptions & {
1237
114
  directory: string;
1238
115
  }) => string;
1239
- declare const normalizeStoriesEntry: (entry: StoriesEntry, { configDir, workingDir }: NormalizeOptions) => NormalizedStoriesSpecifier;
116
+ declare const normalizeStoriesEntry: (entry: CoreCommon_StoriesEntry, { configDir, workingDir }: NormalizeOptions) => CoreCommon_NormalizedStoriesSpecifier;
1240
117
  interface NormalizeOptions {
1241
118
  configDir: string;
1242
119
  workingDir: string;
1243
120
  }
1244
- declare const normalizeStories: (entries: StoriesEntry[], options: NormalizeOptions) => NormalizedStoriesSpecifier[];
121
+ declare const normalizeStories: (entries: CoreCommon_StoriesEntry[], options: NormalizeOptions) => CoreCommon_NormalizedStoriesSpecifier[];
1245
122
 
1246
123
  declare const getProjectRoot: () => string;
1247
124
  declare const nodePathsToArray: (nodePath: string) => string[];
@@ -1282,4 +159,8 @@ declare function validateConfigurationFiles(configDir: string): void;
1282
159
  */
1283
160
  declare function satisfies<A>(): <T extends A>(x: T) => T;
1284
161
 
1285
- export { AddonEntry, AddonInfo, Builder, BuilderName, BuilderOptions, BuilderResult, CLIOptions, CoreConfig, DocsOptions, Entry, IndexedStory, IndexerOptions, LoadOptions, LoadedPreset, NormalizedStoriesSpecifier, Options$1 as Options, OptionsEntry, PackageJson, Preset, PresetConfig, PresetProperty, PresetPropertyFn, Presets, Ref, ReleaseNotesData, RendererName, Stats, StoriesEntry, StoryIndex, StoryIndexer, StorybookConfig, StorybookConfigOptions, TypescriptOptions, VersionCheck, boost, cache, checkAddonOrder, createFileSystemCache, filterPresetsConfig, findDistEsm, getAutoRefs, getDirectoryFromWorkingDir, getFrameworkName, getInterpretedFile, getInterpretedFileWithExt, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getPreviewMainTemplate, getProjectRoot, getRefs, getRendererName, getStorybookConfiguration, getStorybookInfo, globToRegexp, handlebars, interopRequireDefault, interpolate, isPreservingSymlinks, loadAllPresets, loadCustomPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, readTemplate, resolveAddonName, resolvePathInStorybookCache, satisfies, serverRequire, serverResolve, stringifyEnvs, stringifyProcessEnvs, useProgressReporting, validateConfigurationFiles, validateFrameworkName };
162
+ declare type Options = Parameters<typeof Cache__default>['0'];
163
+ declare type FileSystemCache = ReturnType<typeof Cache__default>;
164
+ declare function createFileSystemCache(options: Options): FileSystemCache;
165
+
166
+ export { boost, cache, checkAddonOrder, createFileSystemCache, filterPresetsConfig, findDistEsm, getAutoRefs, getDirectoryFromWorkingDir, getFrameworkName, getInterpretedFile, getInterpretedFileWithExt, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getPreviewMainTemplate, getProjectRoot, getRefs, getRendererName, getStorybookConfiguration, getStorybookInfo, globToRegexp, handlebars, interopRequireDefault, interpolate, isPreservingSymlinks, loadAllPresets, loadCustomPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, readTemplate, resolveAddonName, resolvePathInStorybookCache, satisfies, serverRequire, serverResolve, stringifyEnvs, stringifyProcessEnvs, useProgressReporting, validateConfigurationFiles, validateFrameworkName };