@storybook/nextjs 7.6.0 → 8.0.0-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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { a as Addon_StoryContext } from '../index.d-f57a7eb0.js';
2
+ import { a as Addon_StoryContext } from '../index.d-ce26244c.js';
3
3
  import 'file-system-cache';
4
4
  import '@babel/core';
5
5
  import 'http';
@@ -2908,9 +2908,13 @@ interface Presets {
2908
2908
  apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
2909
2909
  apply(extension: 'stories', config?: [], args?: any): Promise<StoriesEntry[]>;
2910
2910
  apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
2911
- apply(extension: 'refs', config?: [], args?: any): Promise<unknown>;
2912
- apply(extension: 'core', config?: {}, args?: any): Promise<CoreConfig>;
2913
- apply(extension: 'build', config?: {}, args?: any): Promise<StorybookConfig['build']>;
2911
+ apply(extension: 'refs', config?: [], args?: any): Promise<StorybookConfigRaw['refs']>;
2912
+ apply(extension: 'core', config?: StorybookConfigRaw['core'], args?: any): Promise<NonNullable<StorybookConfigRaw['core']>>;
2913
+ apply(extension: 'docs', config?: StorybookConfigRaw['docs'], args?: any): Promise<NonNullable<StorybookConfigRaw['docs']>>;
2914
+ apply(extension: 'features', config?: StorybookConfigRaw['features'], args?: any): Promise<NonNullable<StorybookConfigRaw['features']>>;
2915
+ apply(extension: 'typescript', config?: StorybookConfigRaw['typescript'], args?: any): Promise<NonNullable<StorybookConfigRaw['typescript']>>;
2916
+ apply(extension: 'build', config?: StorybookConfigRaw['build'], args?: any): Promise<NonNullable<StorybookConfigRaw['build']>>;
2917
+ apply(extension: 'staticDirs', config?: StorybookConfigRaw['staticDirs'], args?: any): Promise<StorybookConfigRaw['staticDirs']>;
2914
2918
  apply<T>(extension: string, config?: T, args?: unknown): Promise<T>;
2915
2919
  }
2916
2920
  interface LoadedPreset {
@@ -2970,7 +2974,7 @@ interface BuilderOptions {
2970
2974
  cache?: FileSystemCache;
2971
2975
  configDir: string;
2972
2976
  docsMode?: boolean;
2973
- features?: StorybookConfig['features'];
2977
+ features?: StorybookConfigRaw['features'];
2974
2978
  versionCheck?: VersionCheck;
2975
2979
  disableWebpackDefaults?: boolean;
2976
2980
  serverChannelUrl?: string;
@@ -3076,9 +3080,10 @@ interface TestBuildConfig {
3076
3080
  test?: TestBuildFlags;
3077
3081
  }
3078
3082
  /**
3079
- * The interface for Storybook configuration in `main.ts` files.
3083
+ * The interface for Storybook configuration used internally in presets
3084
+ * The difference is that these values are the raw values, AKA, not wrapped with `PresetValue<>`
3080
3085
  */
3081
- interface StorybookConfig {
3086
+ interface StorybookConfigRaw {
3082
3087
  /**
3083
3088
  * Sets the addons you want to use with Storybook.
3084
3089
  *
@@ -3086,11 +3091,6 @@ interface StorybookConfig {
3086
3091
  */
3087
3092
  addons?: Preset[];
3088
3093
  core?: CoreConfig;
3089
- /**
3090
- * Sets a list of directories of static files to be loaded by Storybook server
3091
- *
3092
- * @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
3093
- */
3094
3094
  staticDirs?: (DirectoryMapping | string)[];
3095
3095
  logLevel?: string;
3096
3096
  features?: {
@@ -3132,88 +3132,26 @@ interface StorybookConfig {
3132
3132
  disallowImplicitActionsInRenderV8?: boolean;
3133
3133
  };
3134
3134
  build?: TestBuildConfig;
3135
- /**
3136
- * Tells Storybook where to find stories.
3137
- *
3138
- * @example `['./src/*.stories.@(j|t)sx?']`
3139
- */
3140
3135
  stories: StoriesEntry[];
3141
- /**
3142
- * Framework, e.g. '@storybook/react-vite', required in v7
3143
- */
3144
3136
  framework?: Preset;
3145
- /**
3146
- * Controls how Storybook handles TypeScript files.
3147
- */
3148
3137
  typescript?: Partial<TypescriptOptions>;
3149
- /**
3150
- * References external Storybooks
3151
- */
3152
- refs?: PresetValue<CoreCommon_StorybookRefs>;
3153
- /**
3154
- * Modify or return babel config.
3155
- */
3156
- babel?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
3157
- /**
3158
- * Modify or return swc config.
3159
- */
3160
- swc?: (config: Options$2, options: Options) => Options$2 | Promise<Options$2>;
3161
- /**
3162
- * Modify or return env config.
3163
- */
3164
- env?: PresetValue<Record<string, string>>;
3165
- /**
3166
- * Modify or return babel config.
3167
- */
3168
- babelDefault?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
3169
- /**
3170
- * Add additional scripts to run in the preview a la `.storybook/preview.js`
3171
- *
3172
- * @deprecated use `previewAnnotations` or `/preview.js` file instead
3173
- */
3174
- config?: PresetValue<Entry[]>;
3175
- /**
3176
- * Add additional scripts to run in the preview a la `.storybook/preview.js`
3177
- */
3178
- previewAnnotations?: PresetValue<Entry[]>;
3179
- /**
3180
- * Process CSF files for the story index.
3181
- * @deprecated use {@link experimental_indexers} instead
3182
- */
3183
- storyIndexers?: PresetValue<StoryIndexer[]>;
3184
- /**
3185
- * Process CSF files for the story index.
3186
- */
3187
- experimental_indexers?: PresetValue<Indexer[]>;
3188
- /**
3189
- * Docs related features in index generation
3190
- */
3138
+ refs?: CoreCommon_StorybookRefs;
3139
+ babel?: TransformOptions;
3140
+ swc?: Options$2;
3141
+ env?: Record<string, string>;
3142
+ babelDefault?: TransformOptions;
3143
+ config?: Entry[];
3144
+ previewAnnotations?: Entry[];
3145
+ storyIndexers?: StoryIndexer[];
3146
+ experimental_indexers?: Indexer[];
3191
3147
  docs?: DocsOptions;
3192
- /**
3193
- * Programmatically modify the preview head/body HTML.
3194
- * The previewHead and previewBody functions accept a string,
3195
- * which is the existing head/body, and return a modified string.
3196
- */
3197
- previewHead?: PresetValue<string>;
3198
- previewBody?: PresetValue<string>;
3199
- /**
3200
- * Programmatically override the preview's main page template.
3201
- * This should return a reference to a file containing an `.ejs` template
3202
- * that will be interpolated with environment variables.
3203
- *
3204
- * @example '.storybook/index.ejs'
3205
- */
3148
+ previewHead?: string;
3149
+ previewBody?: string;
3206
3150
  previewMainTemplate?: string;
3207
- /**
3208
- * Programmatically modify the preview head/body HTML.
3209
- * The managerHead function accept a string,
3210
- * which is the existing head content, and return a modified string.
3211
- */
3212
- managerHead?: PresetValue<string>;
3151
+ managerHead?: string;
3213
3152
  }
3214
- type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
3215
- type PresetProperty<K, TStorybookConfig = StorybookConfig> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
3216
- type PresetPropertyFn<K, TStorybookConfig = StorybookConfig, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
3153
+ type PresetProperty<K, TStorybookConfig = StorybookConfigRaw> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
3154
+ type PresetPropertyFn<K, TStorybookConfig = StorybookConfigRaw, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
3217
3155
  type Addon_StoryContext<TRenderer extends Renderer = Renderer> = StoryContext<TRenderer>;
3218
3156
  type Addon_ReturnTypeFramework<ReturnType> = {
3219
3157
  component: any;
@@ -3223,4 +3161,4 @@ type Addon_ReturnTypeFramework<ReturnType> = {
3223
3161
  type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
3224
3162
  type Path = string;
3225
3163
 
3226
- export { Addon_DecoratorFunction as A, Options as O, PresetProperty as P, Addon_StoryContext as a };
3164
+ export { Addon_DecoratorFunction as A, PresetProperty as P, Addon_StoryContext as a };
package/dist/preset.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { P as PresetProperty, O as Options } from './index.d-f57a7eb0.js';
2
- import { TransformOptions } from '@babel/core';
1
+ import { P as PresetProperty } from './index.d-ce26244c.js';
3
2
  import { StorybookConfig } from './index.js';
4
3
  import 'file-system-cache';
4
+ import '@babel/core';
5
5
  import 'http';
6
6
  import '@storybook/preset-react-webpack';
7
7
  import '@storybook/builder-webpack5';
8
8
 
9
- declare const addons: PresetProperty<'addons', StorybookConfig>;
10
- declare const frameworkOptions: (_: never, options: Options) => Promise<StorybookConfig['framework']>;
11
- declare const core: PresetProperty<'core', StorybookConfig>;
12
- declare const previewAnnotations: StorybookConfig['previewAnnotations'];
13
- declare const babel: (baseConfig: TransformOptions) => Promise<TransformOptions>;
9
+ declare const addons: PresetProperty<'addons'>;
10
+ declare const frameworkOptions: PresetProperty<'framework'>;
11
+ declare const core: PresetProperty<'core'>;
12
+ declare const previewAnnotations: PresetProperty<'previewAnnotations'>;
13
+ declare const babel: PresetProperty<'babel'>;
14
14
  declare const webpackFinal: StorybookConfig['webpackFinal'];
15
15
 
16
16
  export { addons, babel, core, frameworkOptions, previewAnnotations, webpackFinal };
package/dist/preview.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Addon_DecoratorFunction } from './index.d-f57a7eb0.js';
1
+ import { A as Addon_DecoratorFunction } from './index.d-ce26244c.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/nextjs",
3
- "version": "7.6.0",
3
+ "version": "8.0.0-alpha.0",
4
4
  "description": "Storybook for Next.js",
5
5
  "keywords": [
6
6
  "storybook",
@@ -88,14 +88,14 @@
88
88
  "@babel/preset-react": "^7.22.15",
89
89
  "@babel/preset-typescript": "^7.23.2",
90
90
  "@babel/runtime": "^7.23.2",
91
- "@storybook/addon-actions": "7.6.0",
92
- "@storybook/builder-webpack5": "7.6.0",
93
- "@storybook/core-common": "7.6.0",
94
- "@storybook/core-events": "7.6.0",
95
- "@storybook/node-logger": "7.6.0",
96
- "@storybook/preset-react-webpack": "7.6.0",
97
- "@storybook/preview-api": "7.6.0",
98
- "@storybook/react": "7.6.0",
91
+ "@storybook/addon-actions": "8.0.0-alpha.0",
92
+ "@storybook/builder-webpack5": "8.0.0-alpha.0",
93
+ "@storybook/core-common": "8.0.0-alpha.0",
94
+ "@storybook/core-events": "8.0.0-alpha.0",
95
+ "@storybook/node-logger": "8.0.0-alpha.0",
96
+ "@storybook/preset-react-webpack": "8.0.0-alpha.0",
97
+ "@storybook/preview-api": "8.0.0-alpha.0",
98
+ "@storybook/react": "8.0.0-alpha.0",
99
99
  "@types/node": "^18.0.0",
100
100
  "css-loader": "^6.7.3",
101
101
  "find-up": "^5.0.0",
@@ -123,7 +123,7 @@
123
123
  "@types/babel__preset-env": "^7",
124
124
  "@types/loader-utils": "^2.0.5",
125
125
  "next": "^14.0.2",
126
- "typescript": "^4.9.3",
126
+ "typescript": "^5.3.2",
127
127
  "webpack": "^5.65.0"
128
128
  },
129
129
  "peerDependencies": {