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