@storybook/html-webpack5 0.0.0-pr-23611-sha-3be4580c → 0.0.0-pr-23626-sha-e84041f2

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 (2) hide show
  1. package/dist/preset.d.ts +65 -1
  2. package/package.json +5 -5
package/dist/preset.d.ts CHANGED
@@ -765,11 +765,16 @@ PackageJson$1.NonStandardEntryPoints &
765
765
  PackageJson$1.TypeScriptConfiguration &
766
766
  PackageJson$1.YarnConfiguration &
767
767
  PackageJson$1.JSPMConfiguration;
768
+
769
+ type StoryId = string;
770
+ type ComponentTitle = string;
771
+ type StoryName = string;
768
772
  type Tag = string;
769
773
  interface Parameters {
770
774
  [name: string]: any;
771
775
  }
772
776
 
777
+ type ExportKey = string;
773
778
  interface StoriesSpecifier {
774
779
  /**
775
780
  * When auto-titling, what to prefix all generated titles with (default: '')
@@ -803,10 +808,64 @@ interface IndexedCSFFile {
803
808
  };
804
809
  stories: IndexedStory[];
805
810
  }
806
- interface StoryIndexer {
811
+ /**
812
+ * FIXME: This is a temporary type to allow us to deprecate the old indexer API.
813
+ * We should remove this type and the deprecated indexer API in 8.0.
814
+ */
815
+ type BaseIndexer = {
816
+ /**
817
+ * A regular expression that should match all files to be handled by this indexer
818
+ */
807
819
  test: RegExp;
820
+ };
821
+ /**
822
+ * An indexer describes which filenames it handles, and how to index each individual file - turning it into an entry in the index.
823
+ */
824
+ type Indexer = BaseIndexer & {
825
+ /**
826
+ * Indexes a file containing stories or docs.
827
+ * @param fileName The name of the file to index.
828
+ * @param options {@link IndexerOptions} for indexing the file.
829
+ * @returns A promise that resolves to an array of {@link IndexInput} objects.
830
+ */
831
+ index: (fileName: string, options: IndexerOptions) => Promise<IndexInput[]>;
832
+ /**
833
+ * @deprecated Use {@link index} instead
834
+ */
835
+ indexer?: never;
836
+ };
837
+ type DeprecatedIndexer = BaseIndexer & {
808
838
  indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
839
+ index?: never;
840
+ };
841
+ /**
842
+ * @deprecated Use {@link Indexer} instead
843
+ */
844
+ type StoryIndexer = Indexer | DeprecatedIndexer;
845
+ interface BaseIndexInput {
846
+ /** the file to import from e.g. the story file */
847
+ importPath: Path;
848
+ /** the key to import from the file e.g. the story export for this entry */
849
+ key: ExportKey;
850
+ /** the location in the sidebar, auto-generated from {@link importPath} if unspecified */
851
+ title?: ComponentTitle;
852
+ /** the name of the story, auto-generated from {@link key} if unspecified */
853
+ name?: StoryName;
854
+ /** the unique story ID, auto-generated from {@link title} and {@link name} if unspecified */
855
+ id?: StoryId;
856
+ /** tags for filtering entries in Storybook and its tools */
857
+ tags?: Tag[];
809
858
  }
859
+ type StoryIndexInput = BaseIndexInput & {
860
+ type: 'story';
861
+ };
862
+ type DocsIndexInput = BaseIndexInput & {
863
+ type: 'docs';
864
+ /** paths to story files that must be pre-loaded for this docs entry */
865
+ storiesImports?: Path[];
866
+ };
867
+ type IndexInput = StoryIndexInput | DocsIndexInput;
868
+ type Path = string;
810
869
 
811
870
  interface Options$1 {
812
871
  allowRegExp: boolean;
@@ -1081,8 +1140,13 @@ interface StorybookConfig {
1081
1140
  previewAnnotations?: PresetValue<Entry[]>;
1082
1141
  /**
1083
1142
  * Process CSF files for the story index.
1143
+ * @deprecated use {@link indexers} instead
1084
1144
  */
1085
1145
  storyIndexers?: PresetValue<StoryIndexer[]>;
1146
+ /**
1147
+ * Process CSF files for the story index.
1148
+ */
1149
+ indexers?: PresetValue<Indexer[]>;
1086
1150
  /**
1087
1151
  * Docs related features in index generation
1088
1152
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/html-webpack5",
3
- "version": "0.0.0-pr-23611-sha-3be4580c",
3
+ "version": "0.0.0-pr-23626-sha-e84041f2",
4
4
  "description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -47,11 +47,11 @@
47
47
  "prep": "../../../scripts/prepare/bundle.ts"
48
48
  },
49
49
  "dependencies": {
50
- "@storybook/builder-webpack5": "0.0.0-pr-23611-sha-3be4580c",
51
- "@storybook/core-common": "0.0.0-pr-23611-sha-3be4580c",
50
+ "@storybook/builder-webpack5": "0.0.0-pr-23626-sha-e84041f2",
51
+ "@storybook/core-common": "0.0.0-pr-23626-sha-e84041f2",
52
52
  "@storybook/global": "^5.0.0",
53
- "@storybook/html": "0.0.0-pr-23611-sha-3be4580c",
54
- "@storybook/preset-html-webpack": "0.0.0-pr-23611-sha-3be4580c",
53
+ "@storybook/html": "0.0.0-pr-23626-sha-e84041f2",
54
+ "@storybook/preset-html-webpack": "0.0.0-pr-23626-sha-e84041f2",
55
55
  "@types/node": "^16.0.0"
56
56
  },
57
57
  "devDependencies": {