@storybook/nextjs-vite 10.4.0 → 10.5.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.
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,7 +14,7 @@ import {
14
14
  __esm,
15
15
  __require,
16
16
  __toESM
17
- } from "./chunk-N2ZQYJOB.js";
17
+ } from "./chunk-P2WUXZRS.js";
18
18
 
19
19
  // ../../../node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs
20
20
  import r from "node:path";
@@ -4595,7 +4595,7 @@ var import_esbuild, Pt, f2, Ne2, Ie2, Yt, Me2, $e2, Ue2, me2, ae2, ee2, nn2, rn,
4595
4595
  f2(Be2, "u");
4596
4596
  f2(D, "o");
4597
4597
  typeof WebAssembly < "u" && (async () => {
4598
- let { parse: s4, init: e5 } = await import("./lexer-DQCqS3nf-M52HFDOS.js");
4598
+ let { parse: s4, init: e5 } = await import("./lexer-DQCqS3nf-CP3JE5PM.js");
4599
4599
  await e5, Se2 = s4;
4600
4600
  })();
4601
4601
  Pe2 = f2((s4, e5) => Se2 ? Se2(s4, e5) : fn(s4, e5), "parseEsm"), gn = f2((s4) => {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
12
12
  import {
13
13
  __commonJS,
14
14
  __require
15
- } from "./chunk-N2ZQYJOB.js";
15
+ } from "./chunk-P2WUXZRS.js";
16
16
 
17
17
  // ../../../node_modules/yaml/dist/nodes/identity.js
18
18
  var require_identity = __commonJS({
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,7 +14,7 @@ import {
14
14
  __esm,
15
15
  __require,
16
16
  __toESM
17
- } from "./chunk-N2ZQYJOB.js";
17
+ } from "./chunk-P2WUXZRS.js";
18
18
 
19
19
  // ../../../node_modules/jiti/dist/jiti.cjs
20
20
  var require_jiti = __commonJS({
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __esm
14
- } from "./chunk-N2ZQYJOB.js";
14
+ } from "./chunk-P2WUXZRS.js";
15
15
 
16
16
  // ../../../node_modules/tsx/dist/lexer-DQCqS3nf.mjs
17
17
  function F(A, E = "@") {
@@ -0,0 +1,318 @@
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
+ }
311
+
312
+ declare const MockLink: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
313
+
314
+ declare const useLinkStatus: Mock<() => {
315
+ pending: boolean;
316
+ }>;
317
+
318
+ export { MockLink as Link, MockLink as default, useLinkStatus };
@@ -0,0 +1,44 @@
1
+ import "../../_browser-chunks/chunk-SL3VIQZ3.js";
2
+
3
+ // src/export-mocks/link/index.tsx
4
+ import React from "react";
5
+ import { fn } from "storybook/test";
6
+ var linkAction = fn().mockName("next/link::Link"), MockLink = React.forwardRef(function({
7
+ href,
8
+ as: _as,
9
+ replace,
10
+ scroll,
11
+ shallow,
12
+ prefetch,
13
+ passHref,
14
+ legacyBehavior,
15
+ locale,
16
+ onClick,
17
+ children,
18
+ ...rest
19
+ }, ref) {
20
+ let hrefString = typeof href == "object" ? `${href.pathname || ""}${href.query ? "?" + new URLSearchParams(href.query).toString() : ""}${href.hash || ""}` : href, handleClick = (e) => {
21
+ e.preventDefault(), onClick?.(e), linkAction(hrefString, { replace, scroll, shallow, prefetch, locale });
22
+ };
23
+ if (legacyBehavior) {
24
+ let child = React.Children.only(children), childProps = {
25
+ ref,
26
+ onClick: (e) => {
27
+ e.preventDefault(), child.props && typeof child.props.onClick == "function" && child.props.onClick(e), linkAction(hrefString, { replace, scroll, shallow, prefetch, locale });
28
+ },
29
+ ...rest
30
+ };
31
+ return (passHref || child.type === "a" && !("href" in (child.props || {}))) && (childProps.href = hrefString), React.cloneElement(child, childProps);
32
+ }
33
+ return React.createElement("a", { ref, href: hrefString, onClick: handleClick, ...rest }, children);
34
+ });
35
+ MockLink.displayName = "NextLink";
36
+ var link_default = MockLink;
37
+ var useLinkStatus = fn(() => ({ pending: !1 })).mockName(
38
+ "next/link::useLinkStatus"
39
+ );
40
+ export {
41
+ MockLink as Link,
42
+ link_default as default,
43
+ useLinkStatus
44
+ };
@@ -1,15 +1,15 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import "../_node-chunks/chunk-N2ZQYJOB.js";
12
+ import "../_node-chunks/chunk-P2WUXZRS.js";
13
13
 
14
14
  // src/node/index.ts
15
15
  function defineMain(config) {
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __require,
15
15
  __toESM
16
- } from "./_node-chunks/chunk-N2ZQYJOB.js";
16
+ } from "./_node-chunks/chunk-P2WUXZRS.js";
17
17
 
18
18
  // ../../../node_modules/semver/internal/constants.js
19
19
  var require_constants = __commonJS({
@@ -1469,7 +1469,7 @@ var require_req = __commonJS({
1469
1469
  }
1470
1470
  if (tsx === void 0)
1471
1471
  try {
1472
- tsx = await import("./_node-chunks/api-3O43SDCH.js");
1472
+ tsx = await import("./_node-chunks/api-OP3Z3DZZ.js");
1473
1473
  } catch (error) {
1474
1474
  importError.push(error);
1475
1475
  }
@@ -1479,7 +1479,7 @@ var require_req = __commonJS({
1479
1479
  }
1480
1480
  if (jiti === void 0)
1481
1481
  try {
1482
- jiti = (await import("./_node-chunks/jiti-627O3YXZ.js")).default;
1482
+ jiti = (await import("./_node-chunks/jiti-6ZGIPH2Y.js")).default;
1483
1483
  } catch (error) {
1484
1484
  importError.push(error);
1485
1485
  }
@@ -1596,7 +1596,7 @@ var require_src2 = __commonJS({
1596
1596
  async function yamlLoader(_, content) {
1597
1597
  if (!yaml)
1598
1598
  try {
1599
- yaml = await import("./_node-chunks/dist-BQZBF3SS.js");
1599
+ yaml = await import("./_node-chunks/dist-Y5ZBN6UD.js");
1600
1600
  } catch (e) {
1601
1601
  throw new Error(
1602
1602
  `'yaml' is required for the YAML configuration files. Make sure it is installed
@@ -1954,6 +1954,7 @@ var require3 = createRequire3(import.meta.url), vitePluginStorybookNextjs = requ
1954
1954
  ], nextjsVersion = getNextjsVersion();
1955
1955
  return import_semver.default.gte(nextjsVersion, "16.0.0") || annotations.push(fileURLToPath2(import.meta.resolve("@storybook/nextjs-vite/config/preview"))), annotations;
1956
1956
  }, optimizeViteDeps = [
1957
+ "@storybook/nextjs-vite/link.mock",
1957
1958
  "@storybook/nextjs-vite/navigation.mock",
1958
1959
  "@storybook/nextjs-vite/router.mock",
1959
1960
  "@storybook/nextjs-vite > styled-jsx",
@@ -1,15 +1,15 @@
1
- import CJS_COMPAT_NODE_URL_4i9px6m6pje from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4i9px6m6pje from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4i9px6m6pje from "node:module";
1
+ import CJS_COMPAT_NODE_URL_zd6vpdb5fwr from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_zd6vpdb5fwr from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_4i9px6m6pje.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4i9px6m6pje.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4i9px6m6pje.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_zd6vpdb5fwr.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_zd6vpdb5fwr.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_zd6vpdb5fwr.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import "../_node-chunks/chunk-N2ZQYJOB.js";
12
+ import "../_node-chunks/chunk-P2WUXZRS.js";
13
13
 
14
14
  // src/vite-plugin/index.ts
15
15
  import { createRequire } from "node:module";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/nextjs-vite",
3
- "version": "10.4.0",
3
+ "version": "10.5.0-alpha.1",
4
4
  "description": "Storybook for Next.js and Vite: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -43,6 +43,11 @@
43
43
  "code": "./src/export-mocks/headers/index.ts",
44
44
  "default": "./dist/export-mocks/headers/index.js"
45
45
  },
46
+ "./link.mock": {
47
+ "types": "./dist/export-mocks/link/index.d.ts",
48
+ "code": "./src/export-mocks/link/index.tsx",
49
+ "default": "./dist/export-mocks/link/index.js"
50
+ },
46
51
  "./navigation.mock": {
47
52
  "types": "./dist/export-mocks/navigation/index.d.ts",
48
53
  "code": "./src/export-mocks/navigation/index.ts",
@@ -83,9 +88,9 @@
83
88
  "!src/**/*"
84
89
  ],
85
90
  "dependencies": {
86
- "@storybook/builder-vite": "10.4.0",
87
- "@storybook/react": "10.4.0",
88
- "@storybook/react-vite": "10.4.0",
91
+ "@storybook/builder-vite": "10.5.0-alpha.1",
92
+ "@storybook/react": "10.5.0-alpha.1",
93
+ "@storybook/react-vite": "10.5.0-alpha.1",
89
94
  "styled-jsx": "5.1.6",
90
95
  "vite-plugin-storybook-nextjs": "^3.2.4"
91
96
  },
@@ -103,7 +108,7 @@
103
108
  "next": "^14.1.0 || ^15.0.0 || ^16.0.0",
104
109
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
105
110
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
106
- "storybook": "^10.4.0",
111
+ "storybook": "^10.5.0-alpha.1",
107
112
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
108
113
  },
109
114
  "peerDependenciesMeta": {