@storybook/react-vite 7.2.1 → 7.2.2-alpha.0

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.
@@ -719,11 +719,17 @@ PackageJson$1.NonStandardEntryPoints &
719
719
  PackageJson$1.TypeScriptConfiguration &
720
720
  PackageJson$1.YarnConfiguration &
721
721
  PackageJson$1.JSPMConfiguration;
722
+
723
+ type StoryId = string;
724
+ type ComponentTitle = string;
725
+ type StoryName = string;
722
726
  type Tag = string;
723
727
  interface Parameters$1 {
724
728
  [name: string]: any;
725
729
  }
726
730
 
731
+ type ExportName = string;
732
+ type MetaId = string;
727
733
  interface StoriesSpecifier {
728
734
  /**
729
735
  * When auto-titling, what to prefix all generated titles with (default: '')
@@ -758,10 +764,83 @@ interface IndexedCSFFile {
758
764
  };
759
765
  stories: IndexedStory[];
760
766
  }
761
- interface StoryIndexer {
767
+ /**
768
+ * FIXME: This is a temporary type to allow us to deprecate the old indexer API.
769
+ * We should remove this type and the deprecated indexer API in 8.0.
770
+ */
771
+ type BaseIndexer = {
772
+ /**
773
+ * A regular expression that should match all files to be handled by this indexer
774
+ */
762
775
  test: RegExp;
776
+ };
777
+ /**
778
+ * An indexer describes which filenames it handles, and how to index each individual file - turning it into an entry in the index.
779
+ */
780
+ type Indexer = BaseIndexer & {
781
+ /**
782
+ * Indexes a file containing stories or docs.
783
+ * @param fileName The name of the file to index.
784
+ * @param options {@link IndexerOptions} for indexing the file.
785
+ * @returns A promise that resolves to an array of {@link IndexInput} objects.
786
+ */
787
+ index: (fileName: string, options: IndexerOptions) => Promise<IndexInput[]>;
788
+ /**
789
+ * @soonDeprecated Use {@link index} instead
790
+ */
791
+ indexer?: never;
792
+ };
793
+ type DeprecatedIndexer = BaseIndexer & {
763
794
  indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
764
- }
795
+ index?: never;
796
+ };
797
+ /**
798
+ * @soonDeprecated Use {@link Indexer} instead
799
+ */
800
+ type StoryIndexer = Indexer | DeprecatedIndexer;
801
+ /**
802
+ * The base input for indexing a story or docs entry.
803
+ */
804
+ type BaseIndexInput = {
805
+ /** The file to import from e.g. the story file. */
806
+ importPath: Path;
807
+ /** The name of the export to import. */
808
+ exportName: ExportName;
809
+ /** The name of the entry, auto-generated from {@link exportName} if unspecified. */
810
+ name?: StoryName;
811
+ /** The location in the sidebar, auto-generated from {@link importPath} if unspecified. */
812
+ title?: ComponentTitle;
813
+ /**
814
+ * The custom id optionally set at `meta.id` if it needs to differ from the id generated via {@link title}.
815
+ * If unspecified, the meta id will be auto-generated from {@link title}.
816
+ * If specified, the meta in the CSF file _must_ have a matching id set at `meta.id`, to be correctly matched.
817
+ */
818
+ metaId?: MetaId;
819
+ /** Tags for filtering entries in Storybook and its tools. */
820
+ tags?: Tag[];
821
+ /**
822
+ * The id of the entry, auto-generated from {@link title}/{@link metaId} and {@link exportName} if unspecified.
823
+ * If specified, the story in the CSF file _must_ have a matching id set at `parameters.__id`, to be correctly matched.
824
+ * Only use this if you need to override the auto-generated id.
825
+ */
826
+ __id?: StoryId;
827
+ };
828
+ /**
829
+ * The input for indexing a story entry.
830
+ */
831
+ type StoryIndexInput = BaseIndexInput & {
832
+ type: 'story';
833
+ };
834
+ /**
835
+ * The input for indexing a docs entry.
836
+ */
837
+ type DocsIndexInput = BaseIndexInput & {
838
+ type: 'docs';
839
+ /** Paths to story files that must be pre-loaded for this docs entry. */
840
+ storiesImports?: Path[];
841
+ };
842
+ type IndexInput = StoryIndexInput | DocsIndexInput;
843
+ type Path = string;
765
844
 
766
845
  interface Options$1 {
767
846
  allowRegExp: boolean;
@@ -1037,8 +1116,13 @@ interface StorybookConfig$1 {
1037
1116
  previewAnnotations?: PresetValue<Entry[]>;
1038
1117
  /**
1039
1118
  * Process CSF files for the story index.
1119
+ * @soonDeprecated use {@link experimental_indexers} instead
1040
1120
  */
1041
1121
  storyIndexers?: PresetValue<StoryIndexer[]>;
1122
+ /**
1123
+ * Process CSF files for the story index.
1124
+ */
1125
+ experimental_indexers?: PresetValue<Indexer[]>;
1042
1126
  /**
1043
1127
  * Docs related features in index generation
1044
1128
  */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { F as FrameworkOptions, S as StorybookConfig } from './index-9a8692a1.js';
1
+ export { F as FrameworkOptions, S as StorybookConfig } from './index-be37cf18.js';
2
2
  import 'file-system-cache';
3
3
  import '@babel/core';
4
4
  import 'http';
package/dist/preset.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PresetProperty, S as StorybookConfig } from './index-9a8692a1.js';
1
+ import { P as PresetProperty, S as StorybookConfig } from './index-be37cf18.js';
2
2
  import 'file-system-cache';
3
3
  import '@babel/core';
4
4
  import 'http';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-vite",
3
- "version": "7.2.1",
3
+ "version": "7.2.2-alpha.0",
4
4
  "description": "Storybook for React and Vite: Develop React components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -49,8 +49,8 @@
49
49
  "dependencies": {
50
50
  "@joshwooding/vite-plugin-react-docgen-typescript": "0.2.1",
51
51
  "@rollup/pluginutils": "^5.0.2",
52
- "@storybook/builder-vite": "7.2.1",
53
- "@storybook/react": "7.2.1",
52
+ "@storybook/builder-vite": "7.2.2-alpha.0",
53
+ "@storybook/react": "7.2.2-alpha.0",
54
54
  "@vitejs/plugin-react": "^3.0.1",
55
55
  "ast-types": "^0.14.2",
56
56
  "magic-string": "^0.30.0",