@storybook/html-webpack5 0.0.0-pr-22285-sha-d07bfc52 → 0.0.0-pr-23626-sha-0d5a537f

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
@@ -720,11 +720,16 @@ PackageJson$1.NonStandardEntryPoints &
720
720
  PackageJson$1.TypeScriptConfiguration &
721
721
  PackageJson$1.YarnConfiguration &
722
722
  PackageJson$1.JSPMConfiguration;
723
+
724
+ type StoryId = string;
725
+ type ComponentTitle = string;
726
+ type StoryName = string;
723
727
  type Tag = string;
724
728
  interface Parameters {
725
729
  [name: string]: any;
726
730
  }
727
731
 
732
+ type ExportKey = string;
728
733
  interface StoriesSpecifier {
729
734
  /**
730
735
  * When auto-titling, what to prefix all generated titles with (default: '')
@@ -758,10 +763,64 @@ interface IndexedCSFFile {
758
763
  };
759
764
  stories: IndexedStory[];
760
765
  }
761
- 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
+ */
762
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
+ * @deprecated Use {@link index} instead
789
+ */
790
+ indexer?: never;
791
+ };
792
+ type DeprecatedIndexer = BaseIndexer & {
763
793
  indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
794
+ index?: never;
795
+ };
796
+ /**
797
+ * @deprecated Use {@link Indexer} instead
798
+ */
799
+ type StoryIndexer = Indexer | DeprecatedIndexer;
800
+ interface BaseIndexInput {
801
+ /** the file to import from e.g. the story file */
802
+ importPath: Path;
803
+ /** the key to import from the file e.g. the story export for this entry */
804
+ key: ExportKey;
805
+ /** the location in the sidebar, auto-generated from {@link importPath} if unspecified */
806
+ title?: ComponentTitle;
807
+ /** the name of the story, auto-generated from {@link key} if unspecified */
808
+ name?: StoryName;
809
+ /** the unique story ID, auto-generated from {@link title} and {@link name} if unspecified */
810
+ id?: StoryId;
811
+ /** tags for filtering entries in Storybook and its tools */
812
+ tags?: Tag[];
764
813
  }
814
+ type StoryIndexInput = BaseIndexInput & {
815
+ type: 'story';
816
+ };
817
+ type DocsIndexInput = BaseIndexInput & {
818
+ type: 'docs';
819
+ /** paths to story files that must be pre-loaded for this docs entry */
820
+ storiesImports?: Path[];
821
+ };
822
+ type IndexInput = StoryIndexInput | DocsIndexInput;
823
+ type Path = string;
765
824
 
766
825
  interface Options$1 {
767
826
  allowRegExp: boolean;
@@ -1037,8 +1096,13 @@ interface StorybookConfig {
1037
1096
  previewAnnotations?: PresetValue<Entry[]>;
1038
1097
  /**
1039
1098
  * Process CSF files for the story index.
1099
+ * @deprecated use {@link indexers} instead
1040
1100
  */
1041
1101
  storyIndexers?: PresetValue<StoryIndexer[]>;
1102
+ /**
1103
+ * Process CSF files for the story index.
1104
+ */
1105
+ indexers?: PresetValue<Indexer[]>;
1042
1106
  /**
1043
1107
  * Docs related features in index generation
1044
1108
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/html-webpack5",
3
- "version": "0.0.0-pr-22285-sha-d07bfc52",
3
+ "version": "0.0.0-pr-23626-sha-0d5a537f",
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-22285-sha-d07bfc52",
51
- "@storybook/core-common": "0.0.0-pr-22285-sha-d07bfc52",
50
+ "@storybook/builder-webpack5": "0.0.0-pr-23626-sha-0d5a537f",
51
+ "@storybook/core-common": "0.0.0-pr-23626-sha-0d5a537f",
52
52
  "@storybook/global": "^5.0.0",
53
- "@storybook/html": "0.0.0-pr-22285-sha-d07bfc52",
54
- "@storybook/preset-html-webpack": "0.0.0-pr-22285-sha-d07bfc52",
53
+ "@storybook/html": "0.0.0-pr-23626-sha-0d5a537f",
54
+ "@storybook/preset-html-webpack": "0.0.0-pr-23626-sha-0d5a537f",
55
55
  "@types/node": "^16.0.0"
56
56
  },
57
57
  "devDependencies": {