@storybook/nextjs 10.6.0-alpha.0 → 10.6.0-alpha.1

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 (33) hide show
  1. package/dist/_node-chunks/{chunk-TQHLWCMC.js → chunk-3DSP33XS.js} +7 -7
  2. package/dist/_node-chunks/{chunk-3UJ5EMHA.js → chunk-6IXQZKEW.js} +6 -6
  3. package/dist/_node-chunks/{chunk-GFTGY7TM.js → chunk-R5XDZ3OD.js} +7 -7
  4. package/dist/_node-chunks/{configureNextFont-VOJZRRGT.js → configureNextFont-IQ7LDFD2.js} +6 -6
  5. package/dist/_node-chunks/{loader-S3TJ5ZR4.js → loader-EV2C2JXT.js} +8 -8
  6. package/dist/_node-chunks/{loader-JMRBGYYB.js → loader-HOQIBM4M.js} +8 -8
  7. package/dist/_node-chunks/{utils-N2OHZNTB.js → utils-V5ZO4OYP.js} +8 -8
  8. package/dist/_node-chunks/{webpack-2QGNRYZF.js → webpack-3BXPLN5K.js} +9 -9
  9. package/dist/_node-chunks/{webpack-QXDTKABP.js → webpack-BB6I7HFQ.js} +6 -6
  10. package/dist/_node-chunks/webpack-MWJV4C6H.js +23 -0
  11. package/dist/_node-chunks/{webpack-NNKSGDSE.js → webpack-MXPGKH4U.js} +6 -6
  12. package/dist/_node-chunks/{webpack-QZMHR2F6.js → webpack-OAMBWSBQ.js} +8 -8
  13. package/dist/_node-chunks/{webpack-7MZRSUXW.js → webpack-RYQPYYM2.js} +6 -6
  14. package/dist/_node-chunks/{webpack-6INILYT6.js → webpack-YD55Y2J7.js} +6 -6
  15. package/dist/_node-chunks/{webpack-FJEOC5HO.js → webpack-YHKJOVXC.js} +7 -7
  16. package/dist/chunk-BT78ae2q.d.ts +54 -0
  17. package/dist/chunk-Crpg_HiB.d.ts +310 -0
  18. package/dist/export-mocks/cache/index.d.ts +10 -319
  19. package/dist/export-mocks/headers/index.d.ts +31 -337
  20. package/dist/export-mocks/index.js +9 -9
  21. package/dist/export-mocks/link/index.d.ts +6 -314
  22. package/dist/export-mocks/navigation/index.d.ts +19 -33
  23. package/dist/export-mocks/router/index.d.ts +28 -37
  24. package/dist/font/webpack/loader/storybook-nextjs-font-loader.js +6 -6
  25. package/dist/index.d.ts +12 -62
  26. package/dist/index.js +7 -7
  27. package/dist/node/index.d.ts +4 -27
  28. package/dist/node/index.js +6 -6
  29. package/dist/preset.js +9 -9
  30. package/dist/preview.d.ts +12 -11
  31. package/dist/swc/next-swc-loader-patch.js +6 -6
  32. package/package.json +6 -6
  33. package/dist/_node-chunks/webpack-PKWTA7OE.js +0 -23
@@ -1,318 +1,10 @@
1
- import React from 'react';
2
-
3
- interface MockResultReturn<T> {
4
- type: "return";
5
- /**
6
- * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
7
- */
8
- value: T;
9
- }
10
- interface MockResultIncomplete {
11
- type: "incomplete";
12
- value: undefined;
13
- }
14
- interface MockResultThrow {
15
- type: "throw";
16
- /**
17
- * An error that was thrown during function execution.
18
- */
19
- value: any;
20
- }
21
- interface MockSettledResultFulfilled<T> {
22
- type: "fulfilled";
23
- value: T;
24
- }
25
- interface MockSettledResultRejected {
26
- type: "rejected";
27
- value: any;
28
- }
29
- type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
30
- type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;
31
- interface MockContext<T extends Procedure> {
32
- /**
33
- * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
34
- *
35
- * @see https://vitest.dev/api/mock#mock-calls
36
- * @example
37
- * const fn = vi.fn()
38
- *
39
- * fn('arg1', 'arg2')
40
- * fn('arg3')
41
- *
42
- * fn.mock.calls === [
43
- * ['arg1', 'arg2'], // first call
44
- * ['arg3'], // second call
45
- * ]
46
- */
47
- calls: Parameters<T>[];
48
- /**
49
- * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value.
50
- * @see https://vitest.dev/api/mock#mock-instances
51
- */
52
- instances: ReturnType<T>[];
53
- /**
54
- * An array of `this` values that were used during each call to the mock function.
55
- * @see https://vitest.dev/api/mock#mock-contexts
56
- */
57
- contexts: ThisParameterType<T>[];
58
- /**
59
- * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
60
- *
61
- * @see https://vitest.dev/api/mock#mock-invocationcallorder
62
- * @example
63
- * const fn1 = vi.fn()
64
- * const fn2 = vi.fn()
65
- *
66
- * fn1()
67
- * fn2()
68
- * fn1()
69
- *
70
- * fn1.mock.invocationCallOrder === [1, 3]
71
- * fn2.mock.invocationCallOrder === [2]
72
- */
73
- invocationCallOrder: number[];
74
- /**
75
- * This is an array containing all values that were `returned` from the function.
76
- *
77
- * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected.
78
- *
79
- * @see https://vitest.dev/api/mock#mock-results
80
- * @example
81
- * const fn = vi.fn()
82
- * .mockReturnValueOnce('result')
83
- * .mockImplementationOnce(() => { throw new Error('thrown error') })
84
- *
85
- * const result = fn()
86
- *
87
- * try {
88
- * fn()
89
- * }
90
- * catch {}
91
- *
92
- * fn.mock.results === [
93
- * {
94
- * type: 'return',
95
- * value: 'result',
96
- * },
97
- * {
98
- * type: 'throw',
99
- * value: Error,
100
- * },
101
- * ]
102
- */
103
- results: MockResult<ReturnType<T>>[];
104
- /**
105
- * An array containing all values that were `resolved` or `rejected` from the function.
106
- *
107
- * This array will be empty if the function was never resolved or rejected.
108
- *
109
- * @see https://vitest.dev/api/mock#mock-settledresults
110
- * @example
111
- * const fn = vi.fn().mockResolvedValueOnce('result')
112
- *
113
- * const result = fn()
114
- *
115
- * fn.mock.settledResults === []
116
- * fn.mock.results === [
117
- * {
118
- * type: 'return',
119
- * value: Promise<'result'>,
120
- * },
121
- * ]
122
- *
123
- * await result
124
- *
125
- * fn.mock.settledResults === [
126
- * {
127
- * type: 'fulfilled',
128
- * value: 'result',
129
- * },
130
- * ]
131
- */
132
- settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
133
- /**
134
- * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
135
- * @see https://vitest.dev/api/mock#mock-lastcall
136
- */
137
- lastCall: Parameters<T> | undefined;
138
- }
139
- type Procedure = (...args: any[]) => any;
140
- // pick a single function type from function overloads, unions, etc...
141
- type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
142
- /*
143
- cf. https://typescript-eslint.io/rules/method-signature-style/
144
-
145
- Typescript assignability is different between
146
- { foo: (f: T) => U } (this is "method-signature-style")
147
- and
148
- { foo(f: T): U }
149
-
150
- Jest uses the latter for `MockInstance.mockImplementation` etc... and it allows assignment such as:
151
- const boolFn: Jest.Mock<() => boolean> = jest.fn<() => true>(() => true)
152
- */
153
- /* eslint-disable ts/method-signature-style */
154
- interface MockInstance<T extends Procedure = Procedure> extends Disposable {
155
- /**
156
- * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
157
- * @see https://vitest.dev/api/mock#getmockname
158
- */
159
- getMockName(): string;
160
- /**
161
- * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
162
- * @see https://vitest.dev/api/mock#mockname
163
- */
164
- mockName(name: string): this;
165
- /**
166
- * Current context of the mock. It stores information about all invocation calls, instances, and results.
167
- */
168
- mock: MockContext<T>;
169
- /**
170
- * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions.
171
- *
172
- * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
173
- * @see https://vitest.dev/api/mock#mockclear
174
- */
175
- mockClear(): this;
176
- /**
177
- * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
178
- *
179
- * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
180
- * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
181
- *
182
- * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
183
- * @see https://vitest.dev/api/mock#mockreset
184
- */
185
- mockReset(): this;
186
- /**
187
- * Does what `mockReset` does and restores original descriptors of spied-on objects.
188
- *
189
- * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`.
190
- * @see https://vitest.dev/api/mock#mockrestore
191
- */
192
- mockRestore(): void;
193
- /**
194
- * Returns current permanent mock implementation if there is one.
195
- *
196
- * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
197
- *
198
- * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
199
- */
200
- getMockImplementation(): NormalizedProcedure<T> | undefined;
201
- /**
202
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
203
- * @see https://vitest.dev/api/mock#mockimplementation
204
- * @example
205
- * const increment = vi.fn().mockImplementation(count => count + 1);
206
- * expect(increment(3)).toBe(4);
207
- */
208
- mockImplementation(fn: NormalizedProcedure<T>): this;
209
- /**
210
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls.
211
- *
212
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
213
- * @see https://vitest.dev/api/mock#mockimplementationonce
214
- * @example
215
- * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
216
- * expect(fn(3)).toBe(4);
217
- * expect(fn(3)).toBe(3);
218
- */
219
- mockImplementationOnce(fn: NormalizedProcedure<T>): this;
220
- /**
221
- * Overrides the original mock implementation temporarily while the callback is being executed.
222
- *
223
- * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
224
- * @see https://vitest.dev/api/mock#withimplementation
225
- * @example
226
- * const myMockFn = vi.fn(() => 'original')
227
- *
228
- * myMockFn.withImplementation(() => 'temp', () => {
229
- * myMockFn() // 'temp'
230
- * })
231
- *
232
- * myMockFn() // 'original'
233
- */
234
- withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
235
- /**
236
- * Use this if you need to return the `this` context from the method without invoking the actual implementation.
237
- * @see https://vitest.dev/api/mock#mockreturnthis
238
- */
239
- mockReturnThis(): this;
240
- /**
241
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
242
- * @see https://vitest.dev/api/mock#mockreturnvalue
243
- * @example
244
- * const mock = vi.fn()
245
- * mock.mockReturnValue(42)
246
- * mock() // 42
247
- * mock.mockReturnValue(43)
248
- * mock() // 43
249
- */
250
- mockReturnValue(value: ReturnType<T>): this;
251
- /**
252
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
253
- *
254
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
255
- * @example
256
- * const myMockFn = vi
257
- * .fn()
258
- * .mockReturnValue('default')
259
- * .mockReturnValueOnce('first call')
260
- * .mockReturnValueOnce('second call')
261
- *
262
- * // 'first call', 'second call', 'default'
263
- * console.log(myMockFn(), myMockFn(), myMockFn())
264
- */
265
- mockReturnValueOnce(value: ReturnType<T>): this;
266
- /**
267
- * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function.
268
- * @example
269
- * const asyncMock = vi.fn().mockResolvedValue(42)
270
- * asyncMock() // Promise<42>
271
- */
272
- mockResolvedValue(value: Awaited<ReturnType<T>>): this;
273
- /**
274
- * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value.
275
- * @example
276
- * const myMockFn = vi
277
- * .fn()
278
- * .mockResolvedValue('default')
279
- * .mockResolvedValueOnce('first call')
280
- * .mockResolvedValueOnce('second call')
281
- *
282
- * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
283
- * console.log(myMockFn(), myMockFn(), myMockFn())
284
- */
285
- mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
286
- /**
287
- * Accepts an error that will be rejected when async function is called.
288
- * @example
289
- * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
290
- * await asyncMock() // throws Error<'Async error'>
291
- */
292
- mockRejectedValue(error: unknown): this;
293
- /**
294
- * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
295
- * @example
296
- * const asyncMock = vi
297
- * .fn()
298
- * .mockResolvedValueOnce('first call')
299
- * .mockRejectedValueOnce(new Error('Async error'))
300
- *
301
- * await asyncMock() // first call
302
- * await asyncMock() // throws Error<'Async error'>
303
- */
304
- mockRejectedValueOnce(error: unknown): this;
305
- }
306
- /* eslint-enable ts/method-signature-style */
307
- interface Mock<T extends Procedure = Procedure> extends MockInstance<T> {
308
- new (...args: Parameters<T>): ReturnType<T>;
309
- (...args: Parameters<T>): ReturnType<T>;
310
- }
1
+ import { t as Mock } from "../../chunk-Crpg_HiB.js";
2
+ import React from "react";
311
3
 
4
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/export-mocks/link/index.d.ts
312
5
  declare const MockLink: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
313
-
314
6
  declare const useLinkStatus: Mock<() => {
315
- pending: boolean;
7
+ pending: boolean;
316
8
  }>;
317
-
318
- export { MockLink as Link, MockLink as default, useLinkStatus };
9
+ //#endregion
10
+ export { MockLink as Link, MockLink as default, useLinkStatus };
@@ -1,30 +1,16 @@
1
- import * as actual from 'next/dist/client/components/navigation.js';
2
- export * from 'next/dist/client/components/navigation.js';
3
- import { Mock } from 'storybook/test';
1
+ import * as actual from "next/dist/client/components/navigation.js";
2
+ import { Mock } from "storybook/test";
3
+ export * from "next/dist/client/components/navigation.js";
4
4
 
5
- /**
6
- * Creates a next/navigation router API mock. Used internally.
7
- *
8
- * @ignore
9
- * @internal
10
- */
11
- declare const createNavigation: (overrides: any) => {
12
- push: Mock;
13
- replace: Mock;
14
- forward: Mock;
15
- back: Mock;
16
- prefetch: Mock;
17
- refresh: Mock;
18
- };
5
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/export-mocks/navigation/index.d.ts
19
6
  declare const getRouter: () => {
20
- push: Mock;
21
- replace: Mock;
22
- forward: Mock;
23
- back: Mock;
24
- prefetch: Mock;
25
- refresh: Mock;
7
+ push: Mock;
8
+ replace: Mock;
9
+ forward: Mock;
10
+ back: Mock;
11
+ prefetch: Mock;
12
+ refresh: Mock;
26
13
  };
27
-
28
14
  declare const redirect: Mock<(url: string, type?: actual.RedirectType) => never>;
29
15
  declare const permanentRedirect: Mock<(url: string, type?: actual.RedirectType) => never>;
30
16
  declare const useSearchParams: Mock<typeof actual.useSearchParams>;
@@ -32,18 +18,18 @@ declare const usePathname: Mock<typeof actual.usePathname>;
32
18
  declare const useSelectedLayoutSegment: Mock<typeof actual.useSelectedLayoutSegment>;
33
19
  declare const useSelectedLayoutSegments: Mock<typeof actual.useSelectedLayoutSegments>;
34
20
  declare const useRouter: Mock<() => {
35
- push: Mock;
36
- replace: Mock;
37
- forward: Mock;
38
- back: Mock;
39
- prefetch: Mock;
40
- refresh: Mock;
21
+ push: Mock;
22
+ replace: Mock;
23
+ forward: Mock;
24
+ back: Mock;
25
+ prefetch: Mock;
26
+ refresh: Mock;
41
27
  }>;
42
28
  declare const useServerInsertedHTML: Mock<typeof actual.useServerInsertedHTML>;
43
29
  declare const notFound: Mock<typeof actual.notFound>;
44
30
  interface Params {
45
- [key: string]: string | string[];
31
+ [key: string]: string | string[];
46
32
  }
47
33
  declare const useParams: Mock<() => Params>;
48
-
49
- export { createNavigation, getRouter, notFound, permanentRedirect, redirect, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
34
+ //#endregion
35
+ export { getRouter, notFound, permanentRedirect, redirect, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
@@ -1,43 +1,34 @@
1
- import * as originalRouter from 'next/dist/client/router.js';
2
- import originalRouter__default from 'next/dist/client/router.js';
3
- export * from 'next/dist/client/router.js';
4
- export { default } from 'next/dist/client/router.js';
5
- import { NextRouter } from 'next/router';
6
- import { Mock } from 'storybook/test';
1
+ import { Mock } from "storybook/test";
2
+ import * as originalRouter from "next/dist/client/router.js";
3
+ import singletonRouter from "next/dist/client/router.js";
4
+ export * from "next/dist/client/router.js";
7
5
 
8
- /**
9
- * Creates a next/router router API mock. Used internally.
10
- *
11
- * @ignore
12
- * @internal
13
- */
14
- declare const createRouter: (overrides: Partial<NextRouter>) => NextRouter;
6
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/export-mocks/router/index.d.ts
15
7
  declare const getRouter: () => {
16
- push: Mock;
17
- replace: Mock;
18
- reload: Mock;
19
- back: Mock;
20
- forward: Mock;
21
- prefetch: Mock;
22
- beforePopState: Mock;
23
- events: {
24
- on: Mock;
25
- off: Mock;
26
- emit: Mock;
27
- };
8
+ push: Mock;
9
+ replace: Mock;
10
+ reload: Mock;
11
+ back: Mock;
12
+ forward: Mock;
13
+ prefetch: Mock;
14
+ beforePopState: Mock;
15
+ events: {
16
+ on: Mock;
17
+ off: Mock;
18
+ emit: Mock;
19
+ };
28
20
  } & {
29
- route: string;
30
- asPath: string;
31
- basePath: string;
32
- pathname: string;
33
- query: {};
34
- isFallback: boolean;
35
- isLocaleDomain: boolean;
36
- isReady: boolean;
37
- isPreview: boolean;
21
+ route: string;
22
+ asPath: string;
23
+ basePath: string;
24
+ pathname: string;
25
+ query: {};
26
+ isFallback: boolean;
27
+ isLocaleDomain: boolean;
28
+ isReady: boolean;
29
+ isPreview: boolean;
38
30
  };
39
-
40
31
  declare const useRouter: Mock<typeof originalRouter.useRouter>;
41
32
  declare const withRouter: Mock<typeof originalRouter.withRouter>;
42
-
43
- export { createRouter, getRouter, useRouter, withRouter };
33
+ //#endregion
34
+ export { singletonRouter as default, getRouter, useRouter, withRouter };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ebtix0i4ewa from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ebtix0i4ewa from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ebtix0i4ewa from "node:module";
1
+ import CJS_COMPAT_NODE_URL_be528syk9c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_be528syk9c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_be528syk9c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ebtix0i4ewa.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ebtix0i4ewa.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ebtix0i4ewa.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_be528syk9c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_be528syk9c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_be528syk9c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/index.d.ts CHANGED
@@ -1,60 +1,10 @@
1
- import { PreviewAddon, InferTypes, AddonTypes } from 'storybook/internal/csf';
2
- import { CompatibleString, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, Args, StoryAnnotationsOrFn, ProjectAnnotations, ComposedStoryFn, Store_CSFExports, StoriesWithPartialProps } from 'storybook/internal/types';
3
- import { ReactRenderer, Meta, ReactTypes, ReactPreview } from '@storybook/react';
4
- export * from '@storybook/react';
5
- import { BuilderOptions, StorybookConfigWebpack, TypescriptOptions } from '@storybook/builder-webpack5';
6
- import { ReactOptions, StorybookConfig as StorybookConfig$1, TypescriptOptions as TypescriptOptions$1 } from '@storybook/preset-react-webpack';
7
- import * as NextImage from 'next/image';
8
- import { NextRouter } from 'next/router';
9
-
10
- type FrameworkName = CompatibleString<'@storybook/nextjs'>;
11
- type BuilderName = CompatibleString<'@storybook/builder-webpack5'>;
12
- type FrameworkOptions = ReactOptions & {
13
- nextConfigPath?: string;
14
- builder?: BuilderOptions;
15
- };
16
- type StorybookConfigFramework = {
17
- framework: FrameworkName | {
18
- name: FrameworkName;
19
- options: FrameworkOptions;
20
- };
21
- core?: StorybookConfig$1['core'] & {
22
- builder?: BuilderName | {
23
- name: BuilderName;
24
- options: BuilderOptions;
25
- };
26
- };
27
- typescript?: Partial<TypescriptOptions & TypescriptOptions$1> & StorybookConfig$1['typescript'];
28
- };
29
- /** The interface for Storybook configuration in `main.ts` files. */
30
- type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
31
- interface NextJsParameters {
32
- /**
33
- * Next.js framework configuration
34
- *
35
- * @see https://storybook.js.org/docs/get-started/frameworks/nextjs
36
- */
37
- nextjs?: {
38
- /**
39
- * Enable App Directory features If your story imports components that use next/navigation, you
40
- * need to set this parameter to true
41
- */
42
- appDirectory?: boolean;
43
- /**
44
- * Next.js navigation configuration when using `next/navigation`. Please note that it can only
45
- * be used in components/pages in the app directory.
46
- */
47
- navigation?: Partial<NextRouter>;
48
- /** Next.js router configuration */
49
- router?: Partial<NextRouter>;
50
- /** Next.js image props */
51
- image?: Partial<NextImage.ImageProps>;
52
- };
53
- }
54
- interface NextJsTypes {
55
- parameters: NextJsParameters;
56
- }
1
+ import { i as StorybookConfig, n as NextJsParameters, r as NextJsTypes, t as FrameworkOptions } from "./chunk-BT78ae2q.js";
2
+ import { AddonTypes, InferTypes, PreviewAddon } from "storybook/internal/csf";
3
+ import { Args, ComposedStoryFn, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, ProjectAnnotations, Store_CSFExports, StoriesWithPartialProps, StoryAnnotationsOrFn } from "storybook/internal/types";
4
+ import { Meta, ReactPreview, ReactRenderer, ReactTypes } from "@storybook/react";
5
+ export * from "@storybook/react";
57
6
 
7
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/portable-stories.d.ts
58
8
  /**
59
9
  * Function that sets the globalConfig of your storybook. The global config is the preview module of
60
10
  * your .storybook folder.
@@ -132,11 +82,11 @@ declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotations
132
82
  * this can be applied automatically if you use `setProjectAnnotations` in your setup files.
133
83
  */
134
84
  declare function composeStories<TModule extends Store_CSFExports<ReactRenderer, any>>(csfExports: TModule, projectAnnotations?: ProjectAnnotations<ReactRenderer>): Omit<StoriesWithPartialProps<ReactRenderer, TModule>, keyof Store_CSFExports>;
135
-
85
+ //#endregion
86
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/index.d.ts
136
87
  declare function definePreview<Addons extends PreviewAddon<never>[]>(preview: {
137
- addons?: Addons;
88
+ addons?: Addons;
138
89
  } & ProjectAnnotations<ReactTypes & NextJsTypes & InferTypes<Addons>>): NextPreview<InferTypes<Addons>>;
139
- interface NextPreview<T extends AddonTypes> extends ReactPreview<NextJsTypes & T> {
140
- }
141
-
142
- export { type FrameworkOptions, type NextJsParameters, type NextJsTypes, type NextPreview, type StorybookConfig, composeStories, composeStory, definePreview, setProjectAnnotations };
90
+ interface NextPreview<T extends AddonTypes> extends ReactPreview<NextJsTypes & T> {}
91
+ //#endregion
92
+ export { FrameworkOptions, NextJsParameters, NextJsTypes, NextPreview, StorybookConfig, composeStories, composeStory, definePreview, setProjectAnnotations };
package/dist/index.js CHANGED
@@ -6373,7 +6373,9 @@ var decorators = [
6373
6373
  return await new Promise((resolve) => {
6374
6374
  setTimeout(() => {
6375
6375
  resolve();
6376
- }, 0), jestFakeTimersAreEnabled() && jest.advanceTimersByTime(0);
6376
+ }, 0);
6377
+ let jestFakeTimers = getActiveJestFakeTimers(globalThis);
6378
+ jestFakeTimers && jestFakeTimers.advanceTimersByTime(0);
6377
6379
  }), result;
6378
6380
  } finally {
6379
6381
  setReactActEnvironment(previousActEnvironment);
@@ -6387,12 +6389,10 @@ var decorators = [
6387
6389
  } catch {
6388
6390
  }
6389
6391
  };
6390
- function jestFakeTimersAreEnabled() {
6391
- return typeof jest < "u" && jest !== null ? (
6392
- // legacy timers
6393
- setTimeout._isMockFunction === !0 || // modern timers
6394
- Object.prototype.hasOwnProperty.call(setTimeout, "clock")
6395
- ) : !1;
6392
+ function getActiveJestFakeTimers(g) {
6393
+ let jest = Reflect.get(g, "jest");
6394
+ return jest == null ? void 0 : /* legacy timers */ setTimeout._isMockFunction === !0 || // modern timers
6395
+ Object.prototype.hasOwnProperty.call(setTimeout, "clock") ? jest : void 0;
6396
6396
  }
6397
6397
 
6398
6398
  // ../../renderers/react/src/entry-preview-argtypes.ts
@@ -1,29 +1,6 @@
1
- import { CompatibleString } from 'storybook/internal/types';
2
- import { StorybookConfigWebpack, BuilderOptions, TypescriptOptions } from '@storybook/builder-webpack5';
3
- import { StorybookConfig as StorybookConfig$1, ReactOptions, TypescriptOptions as TypescriptOptions$1 } from '@storybook/preset-react-webpack';
4
-
5
- type FrameworkName = CompatibleString<'@storybook/nextjs'>;
6
- type BuilderName = CompatibleString<'@storybook/builder-webpack5'>;
7
- type FrameworkOptions = ReactOptions & {
8
- nextConfigPath?: string;
9
- builder?: BuilderOptions;
10
- };
11
- type StorybookConfigFramework = {
12
- framework: FrameworkName | {
13
- name: FrameworkName;
14
- options: FrameworkOptions;
15
- };
16
- core?: StorybookConfig$1['core'] & {
17
- builder?: BuilderName | {
18
- name: BuilderName;
19
- options: BuilderOptions;
20
- };
21
- };
22
- typescript?: Partial<TypescriptOptions & TypescriptOptions$1> & StorybookConfig$1['typescript'];
23
- };
24
- /** The interface for Storybook configuration in `main.ts` files. */
25
- type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
1
+ import { i as StorybookConfig } from "../chunk-BT78ae2q.js";
26
2
 
3
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/node/index.d.ts
27
4
  declare function defineMain(config: StorybookConfig): StorybookConfig;
28
-
29
- export { type StorybookConfig, defineMain };
5
+ //#endregion
6
+ export { type StorybookConfig, defineMain };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ebtix0i4ewa from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ebtix0i4ewa from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ebtix0i4ewa from "node:module";
1
+ import CJS_COMPAT_NODE_URL_be528syk9c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_be528syk9c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_be528syk9c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ebtix0i4ewa.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ebtix0i4ewa.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ebtix0i4ewa.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_be528syk9c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_be528syk9c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_be528syk9c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration