@storybook/preact-vite 7.2.2 → 7.3.0-alpha.0

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