vite-plugin-storybook-nextjs 1.0.12--canary.d4880e6.0 → 1.0.12--canary.23.a4630d6.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.
Files changed (30) hide show
  1. package/README.md +2 -3
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.js +2 -2
  4. package/dist/plugins/next-mocks/alias/cache/index.cjs +10 -10
  5. package/dist/plugins/next-mocks/alias/cache/index.d.cts +7 -10
  6. package/dist/plugins/next-mocks/alias/cache/index.d.ts +7 -10
  7. package/dist/plugins/next-mocks/alias/cache/index.js +10 -4
  8. package/dist/plugins/next-mocks/alias/dynamic/index.d.cts +5 -5
  9. package/dist/plugins/next-mocks/alias/dynamic/index.d.ts +5 -5
  10. package/dist/plugins/next-mocks/alias/headers/cookies.cjs +30 -22
  11. package/dist/plugins/next-mocks/alias/headers/cookies.d.cts +8 -9
  12. package/dist/plugins/next-mocks/alias/headers/cookies.d.ts +8 -9
  13. package/dist/plugins/next-mocks/alias/headers/cookies.js +30 -22
  14. package/dist/plugins/next-mocks/alias/headers/headers.cjs +21 -15
  15. package/dist/plugins/next-mocks/alias/headers/headers.d.cts +10 -10
  16. package/dist/plugins/next-mocks/alias/headers/headers.d.ts +10 -10
  17. package/dist/plugins/next-mocks/alias/headers/headers.js +21 -15
  18. package/dist/plugins/next-mocks/alias/headers/index.cjs +30 -22
  19. package/dist/plugins/next-mocks/alias/headers/index.d.cts +3 -4
  20. package/dist/plugins/next-mocks/alias/headers/index.d.ts +3 -4
  21. package/dist/plugins/next-mocks/alias/headers/index.js +30 -22
  22. package/dist/plugins/next-mocks/alias/navigation/index.cjs +14 -14
  23. package/dist/plugins/next-mocks/alias/navigation/index.d.cts +11 -12
  24. package/dist/plugins/next-mocks/alias/navigation/index.d.ts +11 -12
  25. package/dist/plugins/next-mocks/alias/navigation/index.js +14 -14
  26. package/dist/plugins/next-mocks/alias/router/index.cjs +4 -6
  27. package/dist/plugins/next-mocks/alias/router/index.d.cts +5 -5
  28. package/dist/plugins/next-mocks/alias/router/index.d.ts +5 -5
  29. package/dist/plugins/next-mocks/alias/router/index.js +4 -6
  30. package/package.json +5 -5
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  This is a Vite plugin that allows you to use Next.js features in Vite. It is the basis for `@storybook/experimental-nextjs-vite` and should be used when running portable stories in Vitest.
4
4
 
5
5
  ## Features
6
-
7
6
  - **Next.js Integration**: Seamlessly integrate Next.js features into your Vite project.
8
7
  - **Storybook Compatibility**: Acts as the foundation for [the `@storybook/experimental-nextjs-vite` framework](https://storybook.js.org/docs/get-started/frameworks/nextjs#with-vite), enabling you to use Storybook with Next.js in a Vite environment.
9
8
  - **Portable Stories**: Ideal for running portable stories in Vitest, ensuring your components are tested in an environment that closely mirrors production.
@@ -116,12 +115,12 @@ When testing components that rely on Next.js Server Actions, you need to ensure
116
115
 
117
116
  ```ts
118
117
  // vitest.config.ts
119
- import { defineConfig } from "vite";
118
+ import { defineConfig } from "vitest/config";
120
119
  import nextjs from "vite-plugin-storybook-nextjs";
121
120
 
122
121
  export default defineConfig({
123
122
  plugins: [nextjs()],
124
- vitest: {
123
+ test: {
125
124
  environment: "jsdom", // 👈 Add this
126
125
  },
127
126
  });
package/dist/index.cjs CHANGED
@@ -975,11 +975,11 @@ function VitePlugin({ dir = process.cwd() } = {}) {
975
975
  alias: [
976
976
  {
977
977
  find: /^react$/,
978
- replacement: "next/dist/compiled/react"
978
+ replacement: require6.resolve("next/dist/compiled/react")
979
979
  },
980
980
  {
981
981
  find: /^react-dom$/,
982
- replacement: "next/dist/compiled/react-dom"
982
+ replacement: require6.resolve("next/dist/compiled/react-dom")
983
983
  },
984
984
  {
985
985
  find: /^react-dom\/server$/,
package/dist/index.js CHANGED
@@ -941,11 +941,11 @@ function VitePlugin({ dir = process.cwd() } = {}) {
941
941
  alias: [
942
942
  {
943
943
  find: /^react$/,
944
- replacement: "next/dist/compiled/react"
944
+ replacement: require6.resolve("next/dist/compiled/react")
945
945
  },
946
946
  {
947
947
  find: /^react-dom$/,
948
- replacement: "next/dist/compiled/react-dom"
948
+ replacement: require6.resolve("next/dist/compiled/react-dom")
949
949
  },
950
950
  {
951
951
  find: /^react-dom\/server$/,
@@ -1,14 +1,18 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var test = require('@storybook/test');
6
4
 
7
5
  // src/plugins/next-mocks/alias/cache/index.ts
8
- var revalidatePath = test.fn().mockName("next/cache::revalidatePath");
9
- var revalidateTag = test.fn().mockName("next/cache::revalidateTag");
6
+ var revalidatePath = test.fn().mockName(
7
+ "next/cache::revalidatePath"
8
+ );
9
+ var revalidateTag = test.fn().mockName(
10
+ "next/cache::revalidateTag"
11
+ );
10
12
  var unstable_cache = test.fn().mockName("next/cache::unstable_cache").mockImplementation((cb) => cb);
11
- var unstable_noStore = test.fn().mockName("next/cache::unstable_noStore");
13
+ var unstable_noStore = test.fn().mockName(
14
+ "next/cache::unstable_noStore"
15
+ );
12
16
  var cacheExports = {
13
17
  unstable_cache,
14
18
  revalidateTag,
@@ -17,8 +21,4 @@ var cacheExports = {
17
21
  };
18
22
  var cache_default = cacheExports;
19
23
 
20
- exports.default = cache_default;
21
- exports.revalidatePath = revalidatePath;
22
- exports.revalidateTag = revalidateTag;
23
- exports.unstable_cache = unstable_cache;
24
- exports.unstable_noStore = unstable_noStore;
24
+ module.exports = cache_default;
@@ -1,14 +1,11 @@
1
- import * as _storybook_test from '@storybook/test';
1
+ import { Mock } from 'vitest';
2
2
 
3
- declare const revalidatePath: _storybook_test.Mock<any, any>;
4
- declare const revalidateTag: _storybook_test.Mock<any, any>;
5
- declare const unstable_cache: _storybook_test.Mock<any, any>;
6
- declare const unstable_noStore: _storybook_test.Mock<any, any>;
3
+ type Procedure = (...args: any[]) => any;
7
4
  declare const cacheExports: {
8
- unstable_cache: _storybook_test.Mock<any, any>;
9
- revalidateTag: _storybook_test.Mock<any, any>;
10
- revalidatePath: _storybook_test.Mock<any, any>;
11
- unstable_noStore: _storybook_test.Mock<any, any>;
5
+ unstable_cache: Mock<Procedure>;
6
+ revalidateTag: Mock<Procedure>;
7
+ revalidatePath: Mock<Procedure>;
8
+ unstable_noStore: Mock<Procedure>;
12
9
  };
13
10
 
14
- export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
11
+ export { cacheExports as default };
@@ -1,14 +1,11 @@
1
- import * as _storybook_test from '@storybook/test';
1
+ import { Mock } from 'vitest';
2
2
 
3
- declare const revalidatePath: _storybook_test.Mock<any, any>;
4
- declare const revalidateTag: _storybook_test.Mock<any, any>;
5
- declare const unstable_cache: _storybook_test.Mock<any, any>;
6
- declare const unstable_noStore: _storybook_test.Mock<any, any>;
3
+ type Procedure = (...args: any[]) => any;
7
4
  declare const cacheExports: {
8
- unstable_cache: _storybook_test.Mock<any, any>;
9
- revalidateTag: _storybook_test.Mock<any, any>;
10
- revalidatePath: _storybook_test.Mock<any, any>;
11
- unstable_noStore: _storybook_test.Mock<any, any>;
5
+ unstable_cache: Mock<Procedure>;
6
+ revalidateTag: Mock<Procedure>;
7
+ revalidatePath: Mock<Procedure>;
8
+ unstable_noStore: Mock<Procedure>;
12
9
  };
13
10
 
14
- export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
11
+ export { cacheExports as default };
@@ -1,10 +1,16 @@
1
1
  import { fn } from '@storybook/test';
2
2
 
3
3
  // src/plugins/next-mocks/alias/cache/index.ts
4
- var revalidatePath = fn().mockName("next/cache::revalidatePath");
5
- var revalidateTag = fn().mockName("next/cache::revalidateTag");
4
+ var revalidatePath = fn().mockName(
5
+ "next/cache::revalidatePath"
6
+ );
7
+ var revalidateTag = fn().mockName(
8
+ "next/cache::revalidateTag"
9
+ );
6
10
  var unstable_cache = fn().mockName("next/cache::unstable_cache").mockImplementation((cb) => cb);
7
- var unstable_noStore = fn().mockName("next/cache::unstable_noStore");
11
+ var unstable_noStore = fn().mockName(
12
+ "next/cache::unstable_noStore"
13
+ );
8
14
  var cacheExports = {
9
15
  unstable_cache,
10
16
  revalidateTag,
@@ -13,4 +19,4 @@ var cacheExports = {
13
19
  };
14
20
  var cache_default = cacheExports;
15
21
 
16
- export { cache_default as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
22
+ export { cache_default as default };
@@ -1,9 +1,9 @@
1
- import React__default, { JSX } from 'react';
1
+ import React, { JSX } from 'react';
2
2
 
3
3
  type ComponentModule<P = Record<string, unknown>> = {
4
- default: React__default.ComponentType<P>;
4
+ default: React.ComponentType<P>;
5
5
  };
6
- declare type LoaderComponent<P = Record<string, unknown>> = Promise<React__default.ComponentType<P> | ComponentModule<P>>;
6
+ declare type LoaderComponent<P = Record<string, unknown>> = Promise<React.ComponentType<P> | ComponentModule<P>>;
7
7
  declare type Loader<P = Record<string, unknown>> = (() => LoaderComponent<P>) | LoaderComponent<P>;
8
8
  type LoaderMap = {
9
9
  [module: string]: () => Loader<unknown>;
@@ -25,13 +25,13 @@ type DynamicOptions<P = Record<string, unknown>> = LoadableGeneratedOptions & {
25
25
  loadableGenerated?: LoadableGeneratedOptions;
26
26
  ssr?: boolean;
27
27
  };
28
- declare function noSSR<P = Record<string, unknown>>(): React__default.ComponentType<P>;
28
+ declare function noSSR<P = Record<string, unknown>>(): React.ComponentType<P>;
29
29
  /**
30
30
  * This function lets you dynamically import a component.
31
31
  * It uses [React.lazy()](https://react.dev/reference/react/lazy) with [Suspense](https://react.dev/reference/react/Suspense) under the hood.
32
32
  *
33
33
  * Read more: [Next.js Docs: `next/dynamic`](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic)
34
34
  */
35
- declare function dynamic<P = Record<string, unknown>>(dynamicOptions: DynamicOptions<P> | Loader<P>, options?: DynamicOptions<P>): React__default.ComponentType<P>;
35
+ declare function dynamic<P = Record<string, unknown>>(dynamicOptions: DynamicOptions<P> | Loader<P>, options?: DynamicOptions<P>): React.ComponentType<P>;
36
36
 
37
37
  export { type LoaderComponent, dynamic as default, noSSR };
@@ -1,9 +1,9 @@
1
- import React__default, { JSX } from 'react';
1
+ import React, { JSX } from 'react';
2
2
 
3
3
  type ComponentModule<P = Record<string, unknown>> = {
4
- default: React__default.ComponentType<P>;
4
+ default: React.ComponentType<P>;
5
5
  };
6
- declare type LoaderComponent<P = Record<string, unknown>> = Promise<React__default.ComponentType<P> | ComponentModule<P>>;
6
+ declare type LoaderComponent<P = Record<string, unknown>> = Promise<React.ComponentType<P> | ComponentModule<P>>;
7
7
  declare type Loader<P = Record<string, unknown>> = (() => LoaderComponent<P>) | LoaderComponent<P>;
8
8
  type LoaderMap = {
9
9
  [module: string]: () => Loader<unknown>;
@@ -25,13 +25,13 @@ type DynamicOptions<P = Record<string, unknown>> = LoadableGeneratedOptions & {
25
25
  loadableGenerated?: LoadableGeneratedOptions;
26
26
  ssr?: boolean;
27
27
  };
28
- declare function noSSR<P = Record<string, unknown>>(): React__default.ComponentType<P>;
28
+ declare function noSSR<P = Record<string, unknown>>(): React.ComponentType<P>;
29
29
  /**
30
30
  * This function lets you dynamically import a component.
31
31
  * It uses [React.lazy()](https://react.dev/reference/react/lazy) with [Suspense](https://react.dev/reference/react/Suspense) under the hood.
32
32
  *
33
33
  * Read more: [Next.js Docs: `next/dynamic`](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic)
34
34
  */
35
- declare function dynamic<P = Record<string, unknown>>(dynamicOptions: DynamicOptions<P> | Loader<P>, options?: DynamicOptions<P>): React__default.ComponentType<P>;
35
+ declare function dynamic<P = Record<string, unknown>>(dynamicOptions: DynamicOptions<P> | Loader<P>, options?: DynamicOptions<P>): React.ComponentType<P>;
36
36
 
37
37
  export { type LoaderComponent, dynamic as default, noSSR };
@@ -29,25 +29,31 @@ var originalHeaders__namespace = /*#__PURE__*/_interopNamespace(originalHeaders)
29
29
  var HeadersAdapterMock = class extends headers_js.HeadersAdapter {
30
30
  constructor() {
31
31
  super({});
32
- this.append = test.fn(super.append.bind(this)).mockName(
33
- "next/headers::headers().append"
34
- );
32
+ this.append = test.fn(
33
+ super.append.bind(this)
34
+ ).mockName("next/headers::headers().append");
35
35
  this.delete = test.fn(super.delete.bind(this)).mockName(
36
36
  "next/headers::headers().delete"
37
37
  );
38
- this.get = test.fn(super.get.bind(this)).mockName("next/headers::headers().get");
39
- this.has = test.fn(super.has.bind(this)).mockName("next/headers::headers().has");
40
- this.set = test.fn(super.set.bind(this)).mockName("next/headers::headers().set");
41
- this.forEach = test.fn(super.forEach.bind(this)).mockName(
42
- "next/headers::headers().forEach"
43
- );
44
- this.entries = test.fn(super.entries.bind(this)).mockName(
45
- "next/headers::headers().entries"
46
- );
47
- this.keys = test.fn(super.keys.bind(this)).mockName("next/headers::headers().keys");
48
- this.values = test.fn(super.values.bind(this)).mockName(
49
- "next/headers::headers().values"
38
+ this.get = test.fn(
39
+ super.get.bind(this)
40
+ ).mockName("next/headers::headers().get");
41
+ this.has = test.fn(super.has.bind(this)).mockName(
42
+ "next/headers::headers().has"
50
43
  );
44
+ this.set = test.fn(
45
+ super.set.bind(this)
46
+ ).mockName("next/headers::headers().set");
47
+ this.forEach = test.fn(super.forEach.bind(this)).mockName("next/headers::headers().forEach");
48
+ this.entries = test.fn(
49
+ super.entries.bind(this)
50
+ ).mockName("next/headers::headers().entries");
51
+ this.keys = test.fn(
52
+ super.keys.bind(this)
53
+ ).mockName("next/headers::headers().keys");
54
+ this.values = test.fn(
55
+ super.values.bind(this)
56
+ ).mockName("next/headers::headers().values");
51
57
  }
52
58
  };
53
59
  var headersAdapterMock;
@@ -60,21 +66,23 @@ headers.mockRestore = () => {
60
66
  };
61
67
 
62
68
  // src/plugins/next-mocks/alias/headers/index.ts
63
- test.fn(originalHeaders__namespace.draftMode).mockName("draftMode");
69
+ test.fn(originalHeaders__namespace.draftMode).mockName(
70
+ "draftMode"
71
+ );
64
72
 
65
73
  // src/plugins/next-mocks/alias/headers/cookies.ts
66
74
  var RequestCookiesMock = class extends index_js.RequestCookies {
67
75
  constructor() {
68
76
  super(...arguments);
69
77
  this.get = test.fn(super.get.bind(this)).mockName("next/headers::cookies().get");
70
- this.getAll = test.fn(super.getAll.bind(this)).mockName(
71
- "next/headers::cookies().getAll"
78
+ this.getAll = test.fn(super.getAll.bind(this)).mockName("next/headers::cookies().getAll");
79
+ this.has = test.fn(super.has.bind(this)).mockName(
80
+ "next/headers::cookies().has"
72
81
  );
73
- this.has = test.fn(super.has.bind(this)).mockName("next/headers::cookies().has");
74
82
  this.set = test.fn(super.set.bind(this)).mockName("next/headers::cookies().set");
75
- this.delete = test.fn(super.delete.bind(this)).mockName(
76
- "next/headers::cookies().delete"
77
- );
83
+ this.delete = test.fn(
84
+ super.delete.bind(this)
85
+ ).mockName("next/headers::cookies().delete");
78
86
  }
79
87
  };
80
88
  var requestCookiesMock;
@@ -1,14 +1,13 @@
1
- import * as _storybook_test from '@storybook/test';
2
- import * as next_dist_compiled__edge_runtime_cookies from 'next/dist/compiled/@edge-runtime/cookies';
3
- import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
1
+ import { RequestCookies, RequestCookie } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
2
+ import { Mock } from 'vitest';
4
3
 
5
4
  declare class RequestCookiesMock extends RequestCookies {
6
- get: _storybook_test.Mock<[name: string] | [next_dist_compiled__edge_runtime_cookies.RequestCookie], next_dist_compiled__edge_runtime_cookies.RequestCookie | undefined>;
7
- getAll: _storybook_test.Mock<[next_dist_compiled__edge_runtime_cookies.RequestCookie] | [name: string] | [], next_dist_compiled__edge_runtime_cookies.RequestCookie[]>;
8
- has: _storybook_test.Mock<[name: string], boolean>;
9
- set: _storybook_test.Mock<[key: string, value: string] | [options: next_dist_compiled__edge_runtime_cookies.RequestCookie], this>;
10
- delete: _storybook_test.Mock<[names: string | string[]], boolean | boolean[]>;
5
+ get: Mock<(...args: [name: string] | [RequestCookie]) => RequestCookie | undefined>;
6
+ getAll: Mock<(...args: [name: string] | [RequestCookie] | []) => RequestCookie[]>;
7
+ has: Mock<(name: string) => boolean>;
8
+ set: Mock<(...args: [key: string, value: string] | [options: RequestCookie]) => this>;
9
+ delete: Mock<(names: string | string[]) => boolean | boolean[]>;
11
10
  }
12
- declare const cookies: _storybook_test.Mock<[], RequestCookiesMock>;
11
+ declare const cookies: Mock<() => RequestCookiesMock>;
13
12
 
14
13
  export { cookies };
@@ -1,14 +1,13 @@
1
- import * as _storybook_test from '@storybook/test';
2
- import * as next_dist_compiled__edge_runtime_cookies from 'next/dist/compiled/@edge-runtime/cookies';
3
- import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
1
+ import { RequestCookies, RequestCookie } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
2
+ import { Mock } from 'vitest';
4
3
 
5
4
  declare class RequestCookiesMock extends RequestCookies {
6
- get: _storybook_test.Mock<[name: string] | [next_dist_compiled__edge_runtime_cookies.RequestCookie], next_dist_compiled__edge_runtime_cookies.RequestCookie | undefined>;
7
- getAll: _storybook_test.Mock<[next_dist_compiled__edge_runtime_cookies.RequestCookie] | [name: string] | [], next_dist_compiled__edge_runtime_cookies.RequestCookie[]>;
8
- has: _storybook_test.Mock<[name: string], boolean>;
9
- set: _storybook_test.Mock<[key: string, value: string] | [options: next_dist_compiled__edge_runtime_cookies.RequestCookie], this>;
10
- delete: _storybook_test.Mock<[names: string | string[]], boolean | boolean[]>;
5
+ get: Mock<(...args: [name: string] | [RequestCookie]) => RequestCookie | undefined>;
6
+ getAll: Mock<(...args: [name: string] | [RequestCookie] | []) => RequestCookie[]>;
7
+ has: Mock<(name: string) => boolean>;
8
+ set: Mock<(...args: [key: string, value: string] | [options: RequestCookie]) => this>;
9
+ delete: Mock<(names: string | string[]) => boolean | boolean[]>;
11
10
  }
12
- declare const cookies: _storybook_test.Mock<[], RequestCookiesMock>;
11
+ declare const cookies: Mock<() => RequestCookiesMock>;
13
12
 
14
13
  export { cookies };
@@ -7,25 +7,31 @@ import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/hea
7
7
  var HeadersAdapterMock = class extends HeadersAdapter {
8
8
  constructor() {
9
9
  super({});
10
- this.append = fn(super.append.bind(this)).mockName(
11
- "next/headers::headers().append"
12
- );
10
+ this.append = fn(
11
+ super.append.bind(this)
12
+ ).mockName("next/headers::headers().append");
13
13
  this.delete = fn(super.delete.bind(this)).mockName(
14
14
  "next/headers::headers().delete"
15
15
  );
16
- this.get = fn(super.get.bind(this)).mockName("next/headers::headers().get");
17
- this.has = fn(super.has.bind(this)).mockName("next/headers::headers().has");
18
- this.set = fn(super.set.bind(this)).mockName("next/headers::headers().set");
19
- this.forEach = fn(super.forEach.bind(this)).mockName(
20
- "next/headers::headers().forEach"
21
- );
22
- this.entries = fn(super.entries.bind(this)).mockName(
23
- "next/headers::headers().entries"
24
- );
25
- this.keys = fn(super.keys.bind(this)).mockName("next/headers::headers().keys");
26
- this.values = fn(super.values.bind(this)).mockName(
27
- "next/headers::headers().values"
16
+ this.get = fn(
17
+ super.get.bind(this)
18
+ ).mockName("next/headers::headers().get");
19
+ this.has = fn(super.has.bind(this)).mockName(
20
+ "next/headers::headers().has"
28
21
  );
22
+ this.set = fn(
23
+ super.set.bind(this)
24
+ ).mockName("next/headers::headers().set");
25
+ this.forEach = fn(super.forEach.bind(this)).mockName("next/headers::headers().forEach");
26
+ this.entries = fn(
27
+ super.entries.bind(this)
28
+ ).mockName("next/headers::headers().entries");
29
+ this.keys = fn(
30
+ super.keys.bind(this)
31
+ ).mockName("next/headers::headers().keys");
32
+ this.values = fn(
33
+ super.values.bind(this)
34
+ ).mockName("next/headers::headers().values");
29
35
  }
30
36
  };
31
37
  var headersAdapterMock;
@@ -38,21 +44,23 @@ headers.mockRestore = () => {
38
44
  };
39
45
 
40
46
  // src/plugins/next-mocks/alias/headers/index.ts
41
- fn(originalHeaders.draftMode).mockName("draftMode");
47
+ fn(originalHeaders.draftMode).mockName(
48
+ "draftMode"
49
+ );
42
50
 
43
51
  // src/plugins/next-mocks/alias/headers/cookies.ts
44
52
  var RequestCookiesMock = class extends RequestCookies {
45
53
  constructor() {
46
54
  super(...arguments);
47
55
  this.get = fn(super.get.bind(this)).mockName("next/headers::cookies().get");
48
- this.getAll = fn(super.getAll.bind(this)).mockName(
49
- "next/headers::cookies().getAll"
56
+ this.getAll = fn(super.getAll.bind(this)).mockName("next/headers::cookies().getAll");
57
+ this.has = fn(super.has.bind(this)).mockName(
58
+ "next/headers::cookies().has"
50
59
  );
51
- this.has = fn(super.has.bind(this)).mockName("next/headers::cookies().has");
52
60
  this.set = fn(super.set.bind(this)).mockName("next/headers::cookies().set");
53
- this.delete = fn(super.delete.bind(this)).mockName(
54
- "next/headers::cookies().delete"
55
- );
61
+ this.delete = fn(
62
+ super.delete.bind(this)
63
+ ).mockName("next/headers::cookies().delete");
56
64
  }
57
65
  };
58
66
  var requestCookiesMock;
@@ -7,25 +7,31 @@ var headers_js = require('next/dist/server/web/spec-extension/adapters/headers.j
7
7
  var HeadersAdapterMock = class extends headers_js.HeadersAdapter {
8
8
  constructor() {
9
9
  super({});
10
- this.append = test.fn(super.append.bind(this)).mockName(
11
- "next/headers::headers().append"
12
- );
10
+ this.append = test.fn(
11
+ super.append.bind(this)
12
+ ).mockName("next/headers::headers().append");
13
13
  this.delete = test.fn(super.delete.bind(this)).mockName(
14
14
  "next/headers::headers().delete"
15
15
  );
16
- this.get = test.fn(super.get.bind(this)).mockName("next/headers::headers().get");
17
- this.has = test.fn(super.has.bind(this)).mockName("next/headers::headers().has");
18
- this.set = test.fn(super.set.bind(this)).mockName("next/headers::headers().set");
19
- this.forEach = test.fn(super.forEach.bind(this)).mockName(
20
- "next/headers::headers().forEach"
21
- );
22
- this.entries = test.fn(super.entries.bind(this)).mockName(
23
- "next/headers::headers().entries"
24
- );
25
- this.keys = test.fn(super.keys.bind(this)).mockName("next/headers::headers().keys");
26
- this.values = test.fn(super.values.bind(this)).mockName(
27
- "next/headers::headers().values"
16
+ this.get = test.fn(
17
+ super.get.bind(this)
18
+ ).mockName("next/headers::headers().get");
19
+ this.has = test.fn(super.has.bind(this)).mockName(
20
+ "next/headers::headers().has"
28
21
  );
22
+ this.set = test.fn(
23
+ super.set.bind(this)
24
+ ).mockName("next/headers::headers().set");
25
+ this.forEach = test.fn(super.forEach.bind(this)).mockName("next/headers::headers().forEach");
26
+ this.entries = test.fn(
27
+ super.entries.bind(this)
28
+ ).mockName("next/headers::headers().entries");
29
+ this.keys = test.fn(
30
+ super.keys.bind(this)
31
+ ).mockName("next/headers::headers().keys");
32
+ this.values = test.fn(
33
+ super.values.bind(this)
34
+ ).mockName("next/headers::headers().values");
29
35
  }
30
36
  };
31
37
  var headersAdapterMock;
@@ -1,17 +1,17 @@
1
- import * as _storybook_test from '@storybook/test';
2
1
  import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
2
+ import { Mock } from 'vitest';
3
3
 
4
4
  declare class HeadersAdapterMock extends HeadersAdapter {
5
5
  constructor();
6
- append: _storybook_test.Mock<[name: string, value: string], void>;
7
- delete: _storybook_test.Mock<[name: string], void>;
8
- get: _storybook_test.Mock<[name: string], string | null>;
9
- has: _storybook_test.Mock<[name: string], boolean>;
10
- set: _storybook_test.Mock<[name: string, value: string], void>;
11
- forEach: _storybook_test.Mock<[callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any], void>;
12
- entries: _storybook_test.Mock<[], IterableIterator<[string, string]>>;
13
- keys: _storybook_test.Mock<[], IterableIterator<string>>;
14
- values: _storybook_test.Mock<[], IterableIterator<string>>;
6
+ append: Mock<(name: string, value: string) => void>;
7
+ delete: Mock<(name: string) => void>;
8
+ get: Mock<(name: string) => string | null>;
9
+ has: Mock<(name: string) => boolean>;
10
+ set: Mock<(name: string, value: string) => void>;
11
+ forEach: Mock<(callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any) => void>;
12
+ entries: Mock<() => IterableIterator<[string, string]>>;
13
+ keys: Mock<() => IterableIterator<string>>;
14
+ values: Mock<() => IterableIterator<string>>;
15
15
  }
16
16
  declare const headers: {
17
17
  (): HeadersAdapterMock;
@@ -1,17 +1,17 @@
1
- import * as _storybook_test from '@storybook/test';
2
1
  import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
2
+ import { Mock } from 'vitest';
3
3
 
4
4
  declare class HeadersAdapterMock extends HeadersAdapter {
5
5
  constructor();
6
- append: _storybook_test.Mock<[name: string, value: string], void>;
7
- delete: _storybook_test.Mock<[name: string], void>;
8
- get: _storybook_test.Mock<[name: string], string | null>;
9
- has: _storybook_test.Mock<[name: string], boolean>;
10
- set: _storybook_test.Mock<[name: string, value: string], void>;
11
- forEach: _storybook_test.Mock<[callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any], void>;
12
- entries: _storybook_test.Mock<[], IterableIterator<[string, string]>>;
13
- keys: _storybook_test.Mock<[], IterableIterator<string>>;
14
- values: _storybook_test.Mock<[], IterableIterator<string>>;
6
+ append: Mock<(name: string, value: string) => void>;
7
+ delete: Mock<(name: string) => void>;
8
+ get: Mock<(name: string) => string | null>;
9
+ has: Mock<(name: string) => boolean>;
10
+ set: Mock<(name: string, value: string) => void>;
11
+ forEach: Mock<(callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any) => void>;
12
+ entries: Mock<() => IterableIterator<[string, string]>>;
13
+ keys: Mock<() => IterableIterator<string>>;
14
+ values: Mock<() => IterableIterator<string>>;
15
15
  }
16
16
  declare const headers: {
17
17
  (): HeadersAdapterMock;
@@ -5,25 +5,31 @@ import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/hea
5
5
  var HeadersAdapterMock = class extends HeadersAdapter {
6
6
  constructor() {
7
7
  super({});
8
- this.append = fn(super.append.bind(this)).mockName(
9
- "next/headers::headers().append"
10
- );
8
+ this.append = fn(
9
+ super.append.bind(this)
10
+ ).mockName("next/headers::headers().append");
11
11
  this.delete = fn(super.delete.bind(this)).mockName(
12
12
  "next/headers::headers().delete"
13
13
  );
14
- this.get = fn(super.get.bind(this)).mockName("next/headers::headers().get");
15
- this.has = fn(super.has.bind(this)).mockName("next/headers::headers().has");
16
- this.set = fn(super.set.bind(this)).mockName("next/headers::headers().set");
17
- this.forEach = fn(super.forEach.bind(this)).mockName(
18
- "next/headers::headers().forEach"
19
- );
20
- this.entries = fn(super.entries.bind(this)).mockName(
21
- "next/headers::headers().entries"
22
- );
23
- this.keys = fn(super.keys.bind(this)).mockName("next/headers::headers().keys");
24
- this.values = fn(super.values.bind(this)).mockName(
25
- "next/headers::headers().values"
14
+ this.get = fn(
15
+ super.get.bind(this)
16
+ ).mockName("next/headers::headers().get");
17
+ this.has = fn(super.has.bind(this)).mockName(
18
+ "next/headers::headers().has"
26
19
  );
20
+ this.set = fn(
21
+ super.set.bind(this)
22
+ ).mockName("next/headers::headers().set");
23
+ this.forEach = fn(super.forEach.bind(this)).mockName("next/headers::headers().forEach");
24
+ this.entries = fn(
25
+ super.entries.bind(this)
26
+ ).mockName("next/headers::headers().entries");
27
+ this.keys = fn(
28
+ super.keys.bind(this)
29
+ ).mockName("next/headers::headers().keys");
30
+ this.values = fn(
31
+ super.values.bind(this)
32
+ ).mockName("next/headers::headers().values");
27
33
  }
28
34
  };
29
35
  var headersAdapterMock;
@@ -29,25 +29,31 @@ var originalHeaders__namespace = /*#__PURE__*/_interopNamespace(originalHeaders)
29
29
  var HeadersAdapterMock = class extends headers_js.HeadersAdapter {
30
30
  constructor() {
31
31
  super({});
32
- this.append = test.fn(super.append.bind(this)).mockName(
33
- "next/headers::headers().append"
34
- );
32
+ this.append = test.fn(
33
+ super.append.bind(this)
34
+ ).mockName("next/headers::headers().append");
35
35
  this.delete = test.fn(super.delete.bind(this)).mockName(
36
36
  "next/headers::headers().delete"
37
37
  );
38
- this.get = test.fn(super.get.bind(this)).mockName("next/headers::headers().get");
39
- this.has = test.fn(super.has.bind(this)).mockName("next/headers::headers().has");
40
- this.set = test.fn(super.set.bind(this)).mockName("next/headers::headers().set");
41
- this.forEach = test.fn(super.forEach.bind(this)).mockName(
42
- "next/headers::headers().forEach"
43
- );
44
- this.entries = test.fn(super.entries.bind(this)).mockName(
45
- "next/headers::headers().entries"
46
- );
47
- this.keys = test.fn(super.keys.bind(this)).mockName("next/headers::headers().keys");
48
- this.values = test.fn(super.values.bind(this)).mockName(
49
- "next/headers::headers().values"
38
+ this.get = test.fn(
39
+ super.get.bind(this)
40
+ ).mockName("next/headers::headers().get");
41
+ this.has = test.fn(super.has.bind(this)).mockName(
42
+ "next/headers::headers().has"
50
43
  );
44
+ this.set = test.fn(
45
+ super.set.bind(this)
46
+ ).mockName("next/headers::headers().set");
47
+ this.forEach = test.fn(super.forEach.bind(this)).mockName("next/headers::headers().forEach");
48
+ this.entries = test.fn(
49
+ super.entries.bind(this)
50
+ ).mockName("next/headers::headers().entries");
51
+ this.keys = test.fn(
52
+ super.keys.bind(this)
53
+ ).mockName("next/headers::headers().keys");
54
+ this.values = test.fn(
55
+ super.values.bind(this)
56
+ ).mockName("next/headers::headers().values");
51
57
  }
52
58
  };
53
59
  var headersAdapterMock;
@@ -62,14 +68,14 @@ var RequestCookiesMock = class extends index_js.RequestCookies {
62
68
  constructor() {
63
69
  super(...arguments);
64
70
  this.get = test.fn(super.get.bind(this)).mockName("next/headers::cookies().get");
65
- this.getAll = test.fn(super.getAll.bind(this)).mockName(
66
- "next/headers::cookies().getAll"
71
+ this.getAll = test.fn(super.getAll.bind(this)).mockName("next/headers::cookies().getAll");
72
+ this.has = test.fn(super.has.bind(this)).mockName(
73
+ "next/headers::cookies().has"
67
74
  );
68
- this.has = test.fn(super.has.bind(this)).mockName("next/headers::cookies().has");
69
75
  this.set = test.fn(super.set.bind(this)).mockName("next/headers::cookies().set");
70
- this.delete = test.fn(super.delete.bind(this)).mockName(
71
- "next/headers::cookies().delete"
72
- );
76
+ this.delete = test.fn(
77
+ super.delete.bind(this)
78
+ ).mockName("next/headers::cookies().delete");
73
79
  }
74
80
  };
75
81
  var requestCookiesMock;
@@ -87,7 +93,9 @@ cookies.mockRestore = () => {
87
93
  };
88
94
 
89
95
  // src/plugins/next-mocks/alias/headers/index.ts
90
- var draftMode2 = test.fn(originalHeaders__namespace.draftMode).mockName("draftMode");
96
+ var draftMode2 = test.fn(originalHeaders__namespace.draftMode).mockName(
97
+ "draftMode"
98
+ );
91
99
 
92
100
  exports.cookies = cookies;
93
101
  exports.draftMode = draftMode2;
@@ -1,11 +1,10 @@
1
- import * as _storybook_test from '@storybook/test';
2
- import * as next_dist_client_components_draft_mode from 'next/dist/client/components/draft-mode';
1
+ import { DraftMode } from 'next/dist/client/components/draft-mode';
2
+ import { Mock } from 'vitest';
3
3
  export { headers } from './headers.cjs';
4
4
  export { cookies } from './cookies.cjs';
5
5
  import 'next/dist/server/web/spec-extension/adapters/headers.js';
6
- import 'next/dist/compiled/@edge-runtime/cookies';
7
6
  import 'next/dist/compiled/@edge-runtime/cookies/index.js';
8
7
 
9
- declare const draftMode: _storybook_test.Mock<[], next_dist_client_components_draft_mode.DraftMode>;
8
+ declare const draftMode: Mock<() => DraftMode>;
10
9
 
11
10
  export { draftMode };
@@ -1,11 +1,10 @@
1
- import * as _storybook_test from '@storybook/test';
2
- import * as next_dist_client_components_draft_mode from 'next/dist/client/components/draft-mode';
1
+ import { DraftMode } from 'next/dist/client/components/draft-mode';
2
+ import { Mock } from 'vitest';
3
3
  export { headers } from './headers.js';
4
4
  export { cookies } from './cookies.js';
5
5
  import 'next/dist/server/web/spec-extension/adapters/headers.js';
6
- import 'next/dist/compiled/@edge-runtime/cookies';
7
6
  import 'next/dist/compiled/@edge-runtime/cookies/index.js';
8
7
 
9
- declare const draftMode: _storybook_test.Mock<[], next_dist_client_components_draft_mode.DraftMode>;
8
+ declare const draftMode: Mock<() => DraftMode>;
10
9
 
11
10
  export { draftMode };
@@ -7,25 +7,31 @@ import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.j
7
7
  var HeadersAdapterMock = class extends HeadersAdapter {
8
8
  constructor() {
9
9
  super({});
10
- this.append = fn(super.append.bind(this)).mockName(
11
- "next/headers::headers().append"
12
- );
10
+ this.append = fn(
11
+ super.append.bind(this)
12
+ ).mockName("next/headers::headers().append");
13
13
  this.delete = fn(super.delete.bind(this)).mockName(
14
14
  "next/headers::headers().delete"
15
15
  );
16
- this.get = fn(super.get.bind(this)).mockName("next/headers::headers().get");
17
- this.has = fn(super.has.bind(this)).mockName("next/headers::headers().has");
18
- this.set = fn(super.set.bind(this)).mockName("next/headers::headers().set");
19
- this.forEach = fn(super.forEach.bind(this)).mockName(
20
- "next/headers::headers().forEach"
21
- );
22
- this.entries = fn(super.entries.bind(this)).mockName(
23
- "next/headers::headers().entries"
24
- );
25
- this.keys = fn(super.keys.bind(this)).mockName("next/headers::headers().keys");
26
- this.values = fn(super.values.bind(this)).mockName(
27
- "next/headers::headers().values"
16
+ this.get = fn(
17
+ super.get.bind(this)
18
+ ).mockName("next/headers::headers().get");
19
+ this.has = fn(super.has.bind(this)).mockName(
20
+ "next/headers::headers().has"
28
21
  );
22
+ this.set = fn(
23
+ super.set.bind(this)
24
+ ).mockName("next/headers::headers().set");
25
+ this.forEach = fn(super.forEach.bind(this)).mockName("next/headers::headers().forEach");
26
+ this.entries = fn(
27
+ super.entries.bind(this)
28
+ ).mockName("next/headers::headers().entries");
29
+ this.keys = fn(
30
+ super.keys.bind(this)
31
+ ).mockName("next/headers::headers().keys");
32
+ this.values = fn(
33
+ super.values.bind(this)
34
+ ).mockName("next/headers::headers().values");
29
35
  }
30
36
  };
31
37
  var headersAdapterMock;
@@ -40,14 +46,14 @@ var RequestCookiesMock = class extends RequestCookies {
40
46
  constructor() {
41
47
  super(...arguments);
42
48
  this.get = fn(super.get.bind(this)).mockName("next/headers::cookies().get");
43
- this.getAll = fn(super.getAll.bind(this)).mockName(
44
- "next/headers::cookies().getAll"
49
+ this.getAll = fn(super.getAll.bind(this)).mockName("next/headers::cookies().getAll");
50
+ this.has = fn(super.has.bind(this)).mockName(
51
+ "next/headers::cookies().has"
45
52
  );
46
- this.has = fn(super.has.bind(this)).mockName("next/headers::cookies().has");
47
53
  this.set = fn(super.set.bind(this)).mockName("next/headers::cookies().set");
48
- this.delete = fn(super.delete.bind(this)).mockName(
49
- "next/headers::cookies().delete"
50
- );
54
+ this.delete = fn(
55
+ super.delete.bind(this)
56
+ ).mockName("next/headers::cookies().delete");
51
57
  }
52
58
  };
53
59
  var requestCookiesMock;
@@ -65,6 +71,8 @@ cookies.mockRestore = () => {
65
71
  };
66
72
 
67
73
  // src/plugins/next-mocks/alias/headers/index.ts
68
- var draftMode2 = fn(originalHeaders.draftMode).mockName("draftMode");
74
+ var draftMode2 = fn(originalHeaders.draftMode).mockName(
75
+ "draftMode"
76
+ );
69
77
 
70
78
  export { cookies, draftMode2 as draftMode, headers };
@@ -67,30 +67,30 @@ var permanentRedirect = test.fn(
67
67
  throw redirect_js.getRedirectError(url, type, redirectStatusCode_js.RedirectStatusCode.SeeOther);
68
68
  }
69
69
  ).mockName("next/navigation::permanentRedirect");
70
- var useSearchParams2 = test.fn(actual__namespace.useSearchParams).mockName(
71
- "next/navigation::useSearchParams"
72
- );
70
+ var useSearchParams2 = test.fn(
71
+ actual__namespace.useSearchParams
72
+ ).mockName("next/navigation::useSearchParams");
73
73
  var usePathname2 = test.fn(actual__namespace.usePathname).mockName(
74
74
  "next/navigation::usePathname"
75
75
  );
76
- var useSelectedLayoutSegment2 = test.fn(
77
- actual__namespace.useSelectedLayoutSegment
78
- ).mockName("next/navigation::useSelectedLayoutSegment");
79
- var useSelectedLayoutSegments2 = test.fn(
80
- actual__namespace.useSelectedLayoutSegments
81
- ).mockName("next/navigation::useSelectedLayoutSegments");
82
- var useRouter2 = test.fn(actual__namespace.useRouter).mockName(
83
- "next/navigation::useRouter"
76
+ var useSelectedLayoutSegment2 = test.fn(actual__namespace.useSelectedLayoutSegment).mockName(
77
+ "next/navigation::useSelectedLayoutSegment"
78
+ );
79
+ var useSelectedLayoutSegments2 = test.fn(actual__namespace.useSelectedLayoutSegments).mockName(
80
+ "next/navigation::useSelectedLayoutSegments"
84
81
  );
82
+ var useRouter2 = test.fn(
83
+ actual__namespace.useRouter
84
+ ).mockName("next/navigation::useRouter");
85
85
  var useServerInsertedHTML2 = test.fn(actual__namespace.useServerInsertedHTML).mockName(
86
86
  "next/navigation::useServerInsertedHTML"
87
87
  );
88
88
  var notFound2 = test.fn(actual__namespace.notFound).mockName(
89
89
  "next/navigation::notFound"
90
90
  );
91
- var useParams2 = test.fn(actual__namespace.useParams).mockName(
92
- "next/navigation::useParams"
93
- );
91
+ var useParams2 = test.fn(
92
+ actual__namespace.useParams
93
+ ).mockName("next/navigation::useParams");
94
94
 
95
95
  exports.createNavigation = createNavigation;
96
96
  exports.getRouter = getRouter;
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
- import * as next_dist_shared_lib_app_router_context_shared_runtime from 'next/dist/shared/lib/app-router-context.shared-runtime';
3
1
  import { Mock } from '@storybook/test';
4
2
  import * as actual from 'next/dist/client/components/navigation.js';
5
3
  export * from 'next/dist/client/components/navigation.js';
4
+ import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
6
5
 
7
6
  declare const createNavigation: (overrides?: Record<string, (...params: unknown[]) => unknown>) => {
8
7
  push: Mock;
@@ -21,18 +20,18 @@ declare const getRouter: () => {
21
20
  refresh: Mock;
22
21
  };
23
22
 
24
- declare const redirect: Mock<[url: string, type?: actual.RedirectType | undefined], never>;
25
- declare const permanentRedirect: Mock<[url: string, type?: actual.RedirectType | undefined], never>;
26
- declare const useSearchParams: Mock<[], actual.ReadonlyURLSearchParams>;
27
- declare const usePathname: Mock<[], string>;
28
- declare const useSelectedLayoutSegment: Mock<[parallelRouteKey?: string | undefined], string | null>;
29
- declare const useSelectedLayoutSegments: Mock<[parallelRouteKey?: string | undefined], string[]>;
30
- declare const useRouter: Mock<[], next_dist_shared_lib_app_router_context_shared_runtime.AppRouterInstance>;
31
- declare const useServerInsertedHTML: Mock<[callback: () => React.ReactNode], void>;
32
- declare const notFound: Mock<[], never>;
23
+ declare const redirect: Mock<(url: string, type?: actual.RedirectType) => never>;
24
+ declare const permanentRedirect: Mock<(url: string, type?: actual.RedirectType) => never>;
25
+ declare const useSearchParams: Mock<() => actual.ReadonlyURLSearchParams>;
26
+ declare const usePathname: Mock<() => string>;
27
+ declare const useSelectedLayoutSegment: Mock<(parallelRouteKey?: string) => string | null>;
28
+ declare const useSelectedLayoutSegments: Mock<(parallelRouteKey?: string) => string[]>;
29
+ declare const useRouter: Mock<() => AppRouterInstance>;
30
+ declare const useServerInsertedHTML: Mock<(callback: () => React.ReactNode) => void>;
31
+ declare const notFound: Mock<() => never>;
33
32
  interface Params {
34
33
  [key: string]: string | string[];
35
34
  }
36
- declare const useParams: Mock<[], Params>;
35
+ declare const useParams: Mock<() => Params>;
37
36
 
38
37
  export { createNavigation, getRouter, notFound, permanentRedirect, redirect, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
- import * as next_dist_shared_lib_app_router_context_shared_runtime from 'next/dist/shared/lib/app-router-context.shared-runtime';
3
1
  import { Mock } from '@storybook/test';
4
2
  import * as actual from 'next/dist/client/components/navigation.js';
5
3
  export * from 'next/dist/client/components/navigation.js';
4
+ import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
6
5
 
7
6
  declare const createNavigation: (overrides?: Record<string, (...params: unknown[]) => unknown>) => {
8
7
  push: Mock;
@@ -21,18 +20,18 @@ declare const getRouter: () => {
21
20
  refresh: Mock;
22
21
  };
23
22
 
24
- declare const redirect: Mock<[url: string, type?: actual.RedirectType | undefined], never>;
25
- declare const permanentRedirect: Mock<[url: string, type?: actual.RedirectType | undefined], never>;
26
- declare const useSearchParams: Mock<[], actual.ReadonlyURLSearchParams>;
27
- declare const usePathname: Mock<[], string>;
28
- declare const useSelectedLayoutSegment: Mock<[parallelRouteKey?: string | undefined], string | null>;
29
- declare const useSelectedLayoutSegments: Mock<[parallelRouteKey?: string | undefined], string[]>;
30
- declare const useRouter: Mock<[], next_dist_shared_lib_app_router_context_shared_runtime.AppRouterInstance>;
31
- declare const useServerInsertedHTML: Mock<[callback: () => React.ReactNode], void>;
32
- declare const notFound: Mock<[], never>;
23
+ declare const redirect: Mock<(url: string, type?: actual.RedirectType) => never>;
24
+ declare const permanentRedirect: Mock<(url: string, type?: actual.RedirectType) => never>;
25
+ declare const useSearchParams: Mock<() => actual.ReadonlyURLSearchParams>;
26
+ declare const usePathname: Mock<() => string>;
27
+ declare const useSelectedLayoutSegment: Mock<(parallelRouteKey?: string) => string | null>;
28
+ declare const useSelectedLayoutSegments: Mock<(parallelRouteKey?: string) => string[]>;
29
+ declare const useRouter: Mock<() => AppRouterInstance>;
30
+ declare const useServerInsertedHTML: Mock<(callback: () => React.ReactNode) => void>;
31
+ declare const notFound: Mock<() => never>;
33
32
  interface Params {
34
33
  [key: string]: string | string[];
35
34
  }
36
- declare const useParams: Mock<[], Params>;
35
+ declare const useParams: Mock<() => Params>;
37
36
 
38
37
  export { createNavigation, getRouter, notFound, permanentRedirect, redirect, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
@@ -46,29 +46,29 @@ var permanentRedirect = fn(
46
46
  throw getRedirectError(url, type, RedirectStatusCode.SeeOther);
47
47
  }
48
48
  ).mockName("next/navigation::permanentRedirect");
49
- var useSearchParams2 = fn(actual.useSearchParams).mockName(
50
- "next/navigation::useSearchParams"
51
- );
49
+ var useSearchParams2 = fn(
50
+ actual.useSearchParams
51
+ ).mockName("next/navigation::useSearchParams");
52
52
  var usePathname2 = fn(actual.usePathname).mockName(
53
53
  "next/navigation::usePathname"
54
54
  );
55
- var useSelectedLayoutSegment2 = fn(
56
- actual.useSelectedLayoutSegment
57
- ).mockName("next/navigation::useSelectedLayoutSegment");
58
- var useSelectedLayoutSegments2 = fn(
59
- actual.useSelectedLayoutSegments
60
- ).mockName("next/navigation::useSelectedLayoutSegments");
61
- var useRouter2 = fn(actual.useRouter).mockName(
62
- "next/navigation::useRouter"
55
+ var useSelectedLayoutSegment2 = fn(actual.useSelectedLayoutSegment).mockName(
56
+ "next/navigation::useSelectedLayoutSegment"
57
+ );
58
+ var useSelectedLayoutSegments2 = fn(actual.useSelectedLayoutSegments).mockName(
59
+ "next/navigation::useSelectedLayoutSegments"
63
60
  );
61
+ var useRouter2 = fn(
62
+ actual.useRouter
63
+ ).mockName("next/navigation::useRouter");
64
64
  var useServerInsertedHTML2 = fn(actual.useServerInsertedHTML).mockName(
65
65
  "next/navigation::useServerInsertedHTML"
66
66
  );
67
67
  var notFound2 = fn(actual.notFound).mockName(
68
68
  "next/navigation::notFound"
69
69
  );
70
- var useParams2 = fn(actual.useParams).mockName(
71
- "next/navigation::useParams"
72
- );
70
+ var useParams2 = fn(
71
+ actual.useParams
72
+ ).mockName("next/navigation::useParams");
73
73
 
74
74
  export { createNavigation, getRouter, notFound2 as notFound, permanentRedirect, redirect, useParams2 as useParams, usePathname2 as usePathname, useRouter2 as useRouter, useSearchParams2 as useSearchParams, useSelectedLayoutSegment2 as useSelectedLayoutSegment, useSelectedLayoutSegments2 as useSelectedLayoutSegments, useServerInsertedHTML2 as useServerInsertedHTML };
@@ -121,12 +121,10 @@ var getRouter = () => {
121
121
  return routerAPI;
122
122
  };
123
123
  var router_default = singletonRouter__namespace.default;
124
- var useRouter2 = test.fn(singletonRouter__namespace.useRouter).mockName(
125
- "next/router::useRouter"
126
- );
127
- var withRouter2 = test.fn(singletonRouter__namespace.withRouter).mockName(
128
- "next/router::withRouter"
129
- );
124
+ var useRouter2 = test.fn(
125
+ singletonRouter__namespace.useRouter
126
+ ).mockName("next/router::useRouter");
127
+ var withRouter2 = test.fn(singletonRouter__namespace.withRouter).mockName("next/router::withRouter");
130
128
 
131
129
  exports.createRouter = createRouter;
132
130
  exports.default = router_default;
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- import * as next_dist_client_with_router from 'next/dist/client/with-router';
3
- import * as next_types from 'next/types';
4
1
  import { Mock } from '@storybook/test';
2
+ import { NextComponentType, NextPageContext } from 'next';
5
3
  import * as originalRouter from 'next/dist/client/router.js';
6
4
  import originalRouter__default from 'next/dist/client/router.js';
7
5
  export { default } from 'next/dist/client/router.js';
6
+ import { WithRouterProps, ExcludeRouterProps } from 'next/dist/client/with-router';
8
7
  import { NextRouter } from 'next/router.js';
8
+ import { ComponentType } from 'react';
9
9
  export * from 'next/dist/client/router';
10
10
 
11
11
  /**
@@ -39,7 +39,7 @@ declare const getRouter: () => {
39
39
  isPreview: boolean;
40
40
  };
41
41
 
42
- declare const useRouter: Mock<[], originalRouter.NextRouter>;
43
- declare const withRouter: Mock<[ComposedComponent: next_types.NextComponentType<next_types.NextPageContext, any, next_dist_client_with_router.WithRouterProps>], React.ComponentType<next_dist_client_with_router.ExcludeRouterProps<next_dist_client_with_router.WithRouterProps>>>;
42
+ declare const useRouter: Mock<() => NextRouter>;
43
+ declare const withRouter: Mock<(ComposedComponent: NextComponentType<NextPageContext, any, WithRouterProps>) => ComponentType<ExcludeRouterProps<WithRouterProps>>>;
44
44
 
45
45
  export { createRouter, getRouter, useRouter, withRouter };
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- import * as next_dist_client_with_router from 'next/dist/client/with-router';
3
- import * as next_types from 'next/types';
4
1
  import { Mock } from '@storybook/test';
2
+ import { NextComponentType, NextPageContext } from 'next';
5
3
  import * as originalRouter from 'next/dist/client/router.js';
6
4
  import originalRouter__default from 'next/dist/client/router.js';
7
5
  export { default } from 'next/dist/client/router.js';
6
+ import { WithRouterProps, ExcludeRouterProps } from 'next/dist/client/with-router';
8
7
  import { NextRouter } from 'next/router.js';
8
+ import { ComponentType } from 'react';
9
9
  export * from 'next/dist/client/router';
10
10
 
11
11
  /**
@@ -39,7 +39,7 @@ declare const getRouter: () => {
39
39
  isPreview: boolean;
40
40
  };
41
41
 
42
- declare const useRouter: Mock<[], originalRouter.NextRouter>;
43
- declare const withRouter: Mock<[ComposedComponent: next_types.NextComponentType<next_types.NextPageContext, any, next_dist_client_with_router.WithRouterProps>], React.ComponentType<next_dist_client_with_router.ExcludeRouterProps<next_dist_client_with_router.WithRouterProps>>>;
42
+ declare const useRouter: Mock<() => NextRouter>;
43
+ declare const withRouter: Mock<(ComposedComponent: NextComponentType<NextPageContext, any, WithRouterProps>) => ComponentType<ExcludeRouterProps<WithRouterProps>>>;
44
44
 
45
45
  export { createRouter, getRouter, useRouter, withRouter };
@@ -98,11 +98,9 @@ var getRouter = () => {
98
98
  return routerAPI;
99
99
  };
100
100
  var router_default = singletonRouter__default;
101
- var useRouter2 = fn(singletonRouter.useRouter).mockName(
102
- "next/router::useRouter"
103
- );
104
- var withRouter2 = fn(singletonRouter.withRouter).mockName(
105
- "next/router::withRouter"
106
- );
101
+ var useRouter2 = fn(
102
+ singletonRouter.useRouter
103
+ ).mockName("next/router::useRouter");
104
+ var withRouter2 = fn(singletonRouter.withRouter).mockName("next/router::withRouter");
107
105
 
108
106
  export { createRouter, router_default as default, getRouter, useRouter2 as useRouter, withRouter2 as withRouter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "1.0.12--canary.d4880e6.0",
3
+ "version": "1.0.12--canary.23.a4630d6.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",
@@ -59,14 +59,14 @@
59
59
  "release": "auto shipit"
60
60
  },
61
61
  "peerDependencies": {
62
- "@storybook/test": "^8.3.0-alpha.3",
62
+ "@storybook/test": "^8.3.0",
63
63
  "next": "^14.1.0",
64
- "storybook": "^8.3.0-alpha.3",
64
+ "storybook": "^8.3.0",
65
65
  "vite": "^5.0.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@biomejs/biome": "1.8.1",
69
- "@storybook/test": "8.3.0-alpha.3",
69
+ "@storybook/test": "^8.3.0",
70
70
  "@types/node": "^18",
71
71
  "@types/react": "^18",
72
72
  "auto": "^11.2.0",
@@ -75,7 +75,7 @@
75
75
  "react": "^18",
76
76
  "rollup": "^4.18.0",
77
77
  "sharp": "^0.33.4",
78
- "storybook": "8.3.0-alpha.3",
78
+ "storybook": "^8.3.0",
79
79
  "tsup": "^8.1.0",
80
80
  "typescript": "^5.0.0",
81
81
  "vite": "^5.0.0",