@storybook/nextjs 10.5.2 → 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 (32) hide show
  1. package/dist/_node-chunks/{chunk-HCWN45RG.js → chunk-3DSP33XS.js} +7 -7
  2. package/dist/_node-chunks/{chunk-ZWDGVEF6.js → chunk-6IXQZKEW.js} +6 -6
  3. package/dist/_node-chunks/{chunk-ZIWU74T4.js → chunk-R5XDZ3OD.js} +7 -7
  4. package/dist/_node-chunks/{configureNextFont-3JCF4ESQ.js → configureNextFont-IQ7LDFD2.js} +6 -6
  5. package/dist/_node-chunks/{loader-TPX2TKPP.js → loader-EV2C2JXT.js} +8 -8
  6. package/dist/_node-chunks/{loader-SGQ5CJNK.js → loader-HOQIBM4M.js} +8 -8
  7. package/dist/_node-chunks/{utils-32MKEQOE.js → utils-V5ZO4OYP.js} +8 -8
  8. package/dist/_node-chunks/{webpack-NFLAIZAJ.js → webpack-3BXPLN5K.js} +9 -9
  9. package/dist/_node-chunks/{webpack-UC23T2DK.js → webpack-BB6I7HFQ.js} +6 -6
  10. package/dist/_node-chunks/{webpack-C3UBOSLW.js → webpack-MWJV4C6H.js} +8 -8
  11. package/dist/_node-chunks/{webpack-MFXPHHPA.js → webpack-MXPGKH4U.js} +6 -6
  12. package/dist/_node-chunks/{webpack-APAF5EWV.js → webpack-OAMBWSBQ.js} +8 -8
  13. package/dist/_node-chunks/{webpack-UPLY3RFO.js → webpack-RYQPYYM2.js} +6 -6
  14. package/dist/_node-chunks/{webpack-O2DTJYVE.js → webpack-YD55Y2J7.js} +6 -6
  15. package/dist/_node-chunks/{webpack-HW5ZT4MM.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
@@ -0,0 +1,310 @@
1
+ //#region node_modules/@vitest/spy/dist/index.d.ts
2
+ interface MockResultReturn<T> {
3
+ type: "return";
4
+ /**
5
+ * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
6
+ */
7
+ value: T;
8
+ }
9
+ interface MockResultIncomplete {
10
+ type: "incomplete";
11
+ value: undefined;
12
+ }
13
+ interface MockResultThrow {
14
+ type: "throw";
15
+ /**
16
+ * An error that was thrown during function execution.
17
+ */
18
+ value: any;
19
+ }
20
+ interface MockSettledResultFulfilled<T> {
21
+ type: "fulfilled";
22
+ value: T;
23
+ }
24
+ interface MockSettledResultRejected {
25
+ type: "rejected";
26
+ value: any;
27
+ }
28
+ type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
29
+ type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;
30
+ interface MockContext<T extends Procedure> {
31
+ /**
32
+ * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
33
+ *
34
+ * @see https://vitest.dev/api/mock#mock-calls
35
+ * @example
36
+ * const fn = vi.fn()
37
+ *
38
+ * fn('arg1', 'arg2')
39
+ * fn('arg3')
40
+ *
41
+ * fn.mock.calls === [
42
+ * ['arg1', 'arg2'], // first call
43
+ * ['arg3'], // second call
44
+ * ]
45
+ */
46
+ calls: Parameters<T>[];
47
+ /**
48
+ * 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.
49
+ * @see https://vitest.dev/api/mock#mock-instances
50
+ */
51
+ instances: ReturnType<T>[];
52
+ /**
53
+ * An array of `this` values that were used during each call to the mock function.
54
+ * @see https://vitest.dev/api/mock#mock-contexts
55
+ */
56
+ contexts: ThisParameterType<T>[];
57
+ /**
58
+ * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
59
+ *
60
+ * @see https://vitest.dev/api/mock#mock-invocationcallorder
61
+ * @example
62
+ * const fn1 = vi.fn()
63
+ * const fn2 = vi.fn()
64
+ *
65
+ * fn1()
66
+ * fn2()
67
+ * fn1()
68
+ *
69
+ * fn1.mock.invocationCallOrder === [1, 3]
70
+ * fn2.mock.invocationCallOrder === [2]
71
+ */
72
+ invocationCallOrder: number[];
73
+ /**
74
+ * This is an array containing all values that were `returned` from the function.
75
+ *
76
+ * 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.
77
+ *
78
+ * @see https://vitest.dev/api/mock#mock-results
79
+ * @example
80
+ * const fn = vi.fn()
81
+ * .mockReturnValueOnce('result')
82
+ * .mockImplementationOnce(() => { throw new Error('thrown error') })
83
+ *
84
+ * const result = fn()
85
+ *
86
+ * try {
87
+ * fn()
88
+ * }
89
+ * catch {}
90
+ *
91
+ * fn.mock.results === [
92
+ * {
93
+ * type: 'return',
94
+ * value: 'result',
95
+ * },
96
+ * {
97
+ * type: 'throw',
98
+ * value: Error,
99
+ * },
100
+ * ]
101
+ */
102
+ results: MockResult<ReturnType<T>>[];
103
+ /**
104
+ * An array containing all values that were `resolved` or `rejected` from the function.
105
+ *
106
+ * This array will be empty if the function was never resolved or rejected.
107
+ *
108
+ * @see https://vitest.dev/api/mock#mock-settledresults
109
+ * @example
110
+ * const fn = vi.fn().mockResolvedValueOnce('result')
111
+ *
112
+ * const result = fn()
113
+ *
114
+ * fn.mock.settledResults === []
115
+ * fn.mock.results === [
116
+ * {
117
+ * type: 'return',
118
+ * value: Promise<'result'>,
119
+ * },
120
+ * ]
121
+ *
122
+ * await result
123
+ *
124
+ * fn.mock.settledResults === [
125
+ * {
126
+ * type: 'fulfilled',
127
+ * value: 'result',
128
+ * },
129
+ * ]
130
+ */
131
+ settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
132
+ /**
133
+ * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
134
+ * @see https://vitest.dev/api/mock#mock-lastcall
135
+ */
136
+ lastCall: Parameters<T> | undefined;
137
+ }
138
+ type Procedure = (...args: any[]) => any; // pick a single function type from function overloads, unions, etc...
139
+ type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
140
+ /*
141
+ cf. https://typescript-eslint.io/rules/method-signature-style/
142
+
143
+ Typescript assignability is different between
144
+ { foo: (f: T) => U } (this is "method-signature-style")
145
+ and
146
+ { foo(f: T): U }
147
+
148
+ Jest uses the latter for `MockInstance.mockImplementation` etc... and it allows assignment such as:
149
+ const boolFn: Jest.Mock<() => boolean> = jest.fn<() => true>(() => true)
150
+ */
151
+ /* eslint-disable ts/method-signature-style */
152
+ interface MockInstance<T extends Procedure = Procedure> extends Disposable {
153
+ /**
154
+ * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
155
+ * @see https://vitest.dev/api/mock#getmockname
156
+ */
157
+ getMockName(): string;
158
+ /**
159
+ * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
160
+ * @see https://vitest.dev/api/mock#mockname
161
+ */
162
+ mockName(name: string): this;
163
+ /**
164
+ * Current context of the mock. It stores information about all invocation calls, instances, and results.
165
+ */
166
+ mock: MockContext<T>;
167
+ /**
168
+ * 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.
169
+ *
170
+ * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
171
+ * @see https://vitest.dev/api/mock#mockclear
172
+ */
173
+ mockClear(): this;
174
+ /**
175
+ * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
176
+ *
177
+ * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
178
+ * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
179
+ *
180
+ * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
181
+ * @see https://vitest.dev/api/mock#mockreset
182
+ */
183
+ mockReset(): this;
184
+ /**
185
+ * Does what `mockReset` does and restores original descriptors of spied-on objects.
186
+ *
187
+ * 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`.
188
+ * @see https://vitest.dev/api/mock#mockrestore
189
+ */
190
+ mockRestore(): void;
191
+ /**
192
+ * Returns current permanent mock implementation if there is one.
193
+ *
194
+ * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
195
+ *
196
+ * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
197
+ */
198
+ getMockImplementation(): NormalizedProcedure<T> | undefined;
199
+ /**
200
+ * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
201
+ * @see https://vitest.dev/api/mock#mockimplementation
202
+ * @example
203
+ * const increment = vi.fn().mockImplementation(count => count + 1);
204
+ * expect(increment(3)).toBe(4);
205
+ */
206
+ mockImplementation(fn: NormalizedProcedure<T>): this;
207
+ /**
208
+ * 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.
209
+ *
210
+ * 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.
211
+ * @see https://vitest.dev/api/mock#mockimplementationonce
212
+ * @example
213
+ * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
214
+ * expect(fn(3)).toBe(4);
215
+ * expect(fn(3)).toBe(3);
216
+ */
217
+ mockImplementationOnce(fn: NormalizedProcedure<T>): this;
218
+ /**
219
+ * Overrides the original mock implementation temporarily while the callback is being executed.
220
+ *
221
+ * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
222
+ * @see https://vitest.dev/api/mock#withimplementation
223
+ * @example
224
+ * const myMockFn = vi.fn(() => 'original')
225
+ *
226
+ * myMockFn.withImplementation(() => 'temp', () => {
227
+ * myMockFn() // 'temp'
228
+ * })
229
+ *
230
+ * myMockFn() // 'original'
231
+ */
232
+ withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
233
+ /**
234
+ * Use this if you need to return the `this` context from the method without invoking the actual implementation.
235
+ * @see https://vitest.dev/api/mock#mockreturnthis
236
+ */
237
+ mockReturnThis(): this;
238
+ /**
239
+ * 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.
240
+ * @see https://vitest.dev/api/mock#mockreturnvalue
241
+ * @example
242
+ * const mock = vi.fn()
243
+ * mock.mockReturnValue(42)
244
+ * mock() // 42
245
+ * mock.mockReturnValue(43)
246
+ * mock() // 43
247
+ */
248
+ mockReturnValue(value: ReturnType<T>): this;
249
+ /**
250
+ * 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.
251
+ *
252
+ * 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.
253
+ * @example
254
+ * const myMockFn = vi
255
+ * .fn()
256
+ * .mockReturnValue('default')
257
+ * .mockReturnValueOnce('first call')
258
+ * .mockReturnValueOnce('second call')
259
+ *
260
+ * // 'first call', 'second call', 'default'
261
+ * console.log(myMockFn(), myMockFn(), myMockFn())
262
+ */
263
+ mockReturnValueOnce(value: ReturnType<T>): this;
264
+ /**
265
+ * 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.
266
+ * @example
267
+ * const asyncMock = vi.fn().mockResolvedValue(42)
268
+ * asyncMock() // Promise<42>
269
+ */
270
+ mockResolvedValue(value: Awaited<ReturnType<T>>): this;
271
+ /**
272
+ * 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.
273
+ * @example
274
+ * const myMockFn = vi
275
+ * .fn()
276
+ * .mockResolvedValue('default')
277
+ * .mockResolvedValueOnce('first call')
278
+ * .mockResolvedValueOnce('second call')
279
+ *
280
+ * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
281
+ * console.log(myMockFn(), myMockFn(), myMockFn())
282
+ */
283
+ mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
284
+ /**
285
+ * Accepts an error that will be rejected when async function is called.
286
+ * @example
287
+ * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
288
+ * await asyncMock() // throws Error<'Async error'>
289
+ */
290
+ mockRejectedValue(error: unknown): this;
291
+ /**
292
+ * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
293
+ * @example
294
+ * const asyncMock = vi
295
+ * .fn()
296
+ * .mockResolvedValueOnce('first call')
297
+ * .mockRejectedValueOnce(new Error('Async error'))
298
+ *
299
+ * await asyncMock() // first call
300
+ * await asyncMock() // throws Error<'Async error'>
301
+ */
302
+ mockRejectedValueOnce(error: unknown): this;
303
+ }
304
+ /* eslint-enable ts/method-signature-style */
305
+ interface Mock<T extends Procedure = Procedure> extends MockInstance<T> {
306
+ new (...args: Parameters<T>): ReturnType<T>;
307
+ (...args: Parameters<T>): ReturnType<T>;
308
+ }
309
+ //#endregion
310
+ export { Mock as t };
@@ -1,324 +1,15 @@
1
- import { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
2
- export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
3
- import { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
4
- export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
5
-
6
- interface MockResultReturn<T> {
7
- type: "return";
8
- /**
9
- * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
10
- */
11
- value: T;
12
- }
13
- interface MockResultIncomplete {
14
- type: "incomplete";
15
- value: undefined;
16
- }
17
- interface MockResultThrow {
18
- type: "throw";
19
- /**
20
- * An error that was thrown during function execution.
21
- */
22
- value: any;
23
- }
24
- interface MockSettledResultFulfilled<T> {
25
- type: "fulfilled";
26
- value: T;
27
- }
28
- interface MockSettledResultRejected {
29
- type: "rejected";
30
- value: any;
31
- }
32
- type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
33
- type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;
34
- interface MockContext<T extends Procedure> {
35
- /**
36
- * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
37
- *
38
- * @see https://vitest.dev/api/mock#mock-calls
39
- * @example
40
- * const fn = vi.fn()
41
- *
42
- * fn('arg1', 'arg2')
43
- * fn('arg3')
44
- *
45
- * fn.mock.calls === [
46
- * ['arg1', 'arg2'], // first call
47
- * ['arg3'], // second call
48
- * ]
49
- */
50
- calls: Parameters<T>[];
51
- /**
52
- * 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.
53
- * @see https://vitest.dev/api/mock#mock-instances
54
- */
55
- instances: ReturnType<T>[];
56
- /**
57
- * An array of `this` values that were used during each call to the mock function.
58
- * @see https://vitest.dev/api/mock#mock-contexts
59
- */
60
- contexts: ThisParameterType<T>[];
61
- /**
62
- * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
63
- *
64
- * @see https://vitest.dev/api/mock#mock-invocationcallorder
65
- * @example
66
- * const fn1 = vi.fn()
67
- * const fn2 = vi.fn()
68
- *
69
- * fn1()
70
- * fn2()
71
- * fn1()
72
- *
73
- * fn1.mock.invocationCallOrder === [1, 3]
74
- * fn2.mock.invocationCallOrder === [2]
75
- */
76
- invocationCallOrder: number[];
77
- /**
78
- * This is an array containing all values that were `returned` from the function.
79
- *
80
- * 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.
81
- *
82
- * @see https://vitest.dev/api/mock#mock-results
83
- * @example
84
- * const fn = vi.fn()
85
- * .mockReturnValueOnce('result')
86
- * .mockImplementationOnce(() => { throw new Error('thrown error') })
87
- *
88
- * const result = fn()
89
- *
90
- * try {
91
- * fn()
92
- * }
93
- * catch {}
94
- *
95
- * fn.mock.results === [
96
- * {
97
- * type: 'return',
98
- * value: 'result',
99
- * },
100
- * {
101
- * type: 'throw',
102
- * value: Error,
103
- * },
104
- * ]
105
- */
106
- results: MockResult<ReturnType<T>>[];
107
- /**
108
- * An array containing all values that were `resolved` or `rejected` from the function.
109
- *
110
- * This array will be empty if the function was never resolved or rejected.
111
- *
112
- * @see https://vitest.dev/api/mock#mock-settledresults
113
- * @example
114
- * const fn = vi.fn().mockResolvedValueOnce('result')
115
- *
116
- * const result = fn()
117
- *
118
- * fn.mock.settledResults === []
119
- * fn.mock.results === [
120
- * {
121
- * type: 'return',
122
- * value: Promise<'result'>,
123
- * },
124
- * ]
125
- *
126
- * await result
127
- *
128
- * fn.mock.settledResults === [
129
- * {
130
- * type: 'fulfilled',
131
- * value: 'result',
132
- * },
133
- * ]
134
- */
135
- settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
136
- /**
137
- * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
138
- * @see https://vitest.dev/api/mock#mock-lastcall
139
- */
140
- lastCall: Parameters<T> | undefined;
141
- }
142
- type Procedure = (...args: any[]) => any;
143
- // pick a single function type from function overloads, unions, etc...
144
- type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
145
- /*
146
- cf. https://typescript-eslint.io/rules/method-signature-style/
147
-
148
- Typescript assignability is different between
149
- { foo: (f: T) => U } (this is "method-signature-style")
150
- and
151
- { foo(f: T): U }
152
-
153
- Jest uses the latter for `MockInstance.mockImplementation` etc... and it allows assignment such as:
154
- const boolFn: Jest.Mock<() => boolean> = jest.fn<() => true>(() => true)
155
- */
156
- /* eslint-disable ts/method-signature-style */
157
- interface MockInstance<T extends Procedure = Procedure> extends Disposable {
158
- /**
159
- * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
160
- * @see https://vitest.dev/api/mock#getmockname
161
- */
162
- getMockName(): string;
163
- /**
164
- * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
165
- * @see https://vitest.dev/api/mock#mockname
166
- */
167
- mockName(name: string): this;
168
- /**
169
- * Current context of the mock. It stores information about all invocation calls, instances, and results.
170
- */
171
- mock: MockContext<T>;
172
- /**
173
- * 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.
174
- *
175
- * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
176
- * @see https://vitest.dev/api/mock#mockclear
177
- */
178
- mockClear(): this;
179
- /**
180
- * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
181
- *
182
- * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
183
- * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
184
- *
185
- * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
186
- * @see https://vitest.dev/api/mock#mockreset
187
- */
188
- mockReset(): this;
189
- /**
190
- * Does what `mockReset` does and restores original descriptors of spied-on objects.
191
- *
192
- * 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`.
193
- * @see https://vitest.dev/api/mock#mockrestore
194
- */
195
- mockRestore(): void;
196
- /**
197
- * Returns current permanent mock implementation if there is one.
198
- *
199
- * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
200
- *
201
- * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
202
- */
203
- getMockImplementation(): NormalizedProcedure<T> | undefined;
204
- /**
205
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
206
- * @see https://vitest.dev/api/mock#mockimplementation
207
- * @example
208
- * const increment = vi.fn().mockImplementation(count => count + 1);
209
- * expect(increment(3)).toBe(4);
210
- */
211
- mockImplementation(fn: NormalizedProcedure<T>): this;
212
- /**
213
- * 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.
214
- *
215
- * 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.
216
- * @see https://vitest.dev/api/mock#mockimplementationonce
217
- * @example
218
- * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
219
- * expect(fn(3)).toBe(4);
220
- * expect(fn(3)).toBe(3);
221
- */
222
- mockImplementationOnce(fn: NormalizedProcedure<T>): this;
223
- /**
224
- * Overrides the original mock implementation temporarily while the callback is being executed.
225
- *
226
- * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
227
- * @see https://vitest.dev/api/mock#withimplementation
228
- * @example
229
- * const myMockFn = vi.fn(() => 'original')
230
- *
231
- * myMockFn.withImplementation(() => 'temp', () => {
232
- * myMockFn() // 'temp'
233
- * })
234
- *
235
- * myMockFn() // 'original'
236
- */
237
- withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
238
- /**
239
- * Use this if you need to return the `this` context from the method without invoking the actual implementation.
240
- * @see https://vitest.dev/api/mock#mockreturnthis
241
- */
242
- mockReturnThis(): this;
243
- /**
244
- * 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.
245
- * @see https://vitest.dev/api/mock#mockreturnvalue
246
- * @example
247
- * const mock = vi.fn()
248
- * mock.mockReturnValue(42)
249
- * mock() // 42
250
- * mock.mockReturnValue(43)
251
- * mock() // 43
252
- */
253
- mockReturnValue(value: ReturnType<T>): this;
254
- /**
255
- * 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.
256
- *
257
- * 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.
258
- * @example
259
- * const myMockFn = vi
260
- * .fn()
261
- * .mockReturnValue('default')
262
- * .mockReturnValueOnce('first call')
263
- * .mockReturnValueOnce('second call')
264
- *
265
- * // 'first call', 'second call', 'default'
266
- * console.log(myMockFn(), myMockFn(), myMockFn())
267
- */
268
- mockReturnValueOnce(value: ReturnType<T>): this;
269
- /**
270
- * 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.
271
- * @example
272
- * const asyncMock = vi.fn().mockResolvedValue(42)
273
- * asyncMock() // Promise<42>
274
- */
275
- mockResolvedValue(value: Awaited<ReturnType<T>>): this;
276
- /**
277
- * 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.
278
- * @example
279
- * const myMockFn = vi
280
- * .fn()
281
- * .mockResolvedValue('default')
282
- * .mockResolvedValueOnce('first call')
283
- * .mockResolvedValueOnce('second call')
284
- *
285
- * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
286
- * console.log(myMockFn(), myMockFn(), myMockFn())
287
- */
288
- mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
289
- /**
290
- * Accepts an error that will be rejected when async function is called.
291
- * @example
292
- * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
293
- * await asyncMock() // throws Error<'Async error'>
294
- */
295
- mockRejectedValue(error: unknown): this;
296
- /**
297
- * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
298
- * @example
299
- * const asyncMock = vi
300
- * .fn()
301
- * .mockResolvedValueOnce('first call')
302
- * .mockRejectedValueOnce(new Error('Async error'))
303
- *
304
- * await asyncMock() // first call
305
- * await asyncMock() // throws Error<'Async error'>
306
- */
307
- mockRejectedValueOnce(error: unknown): this;
308
- }
309
- /* eslint-enable ts/method-signature-style */
310
- interface Mock<T extends Procedure = Procedure> extends MockInstance<T> {
311
- new (...args: Parameters<T>): ReturnType<T>;
312
- (...args: Parameters<T>): ReturnType<T>;
313
- }
1
+ import { t as Mock } from "../../chunk-Crpg_HiB.js";
2
+ import { unstable_cache } from "next/dist/server/web/spec-extension/unstable-cache.js";
3
+ import { unstable_noStore } from "next/dist/server/web/spec-extension/unstable-no-store.js";
314
4
 
5
+ //#region code/frameworks/nextjs/.dts-emit/code/frameworks/nextjs/src/export-mocks/cache/index.d.ts
315
6
  declare const revalidatePath: Mock<(...args: any[]) => any>;
316
7
  declare const revalidateTag: Mock<(...args: any[]) => any>;
317
8
  declare const cacheExports: {
318
- unstable_cache: typeof unstable_cache;
319
- revalidateTag: Mock<(...args: any[]) => any>;
320
- revalidatePath: Mock<(...args: any[]) => any>;
321
- unstable_noStore: typeof unstable_noStore;
9
+ unstable_cache: typeof unstable_cache;
10
+ revalidateTag: Mock<(...args: any[]) => any>;
11
+ revalidatePath: Mock<(...args: any[]) => any>;
12
+ unstable_noStore: typeof unstable_noStore;
322
13
  };
323
-
324
- export { cacheExports as default, revalidatePath, revalidateTag };
14
+ //#endregion
15
+ export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };