vite-plugin-storybook-nextjs 0.0.4--canary.fb0538a.0 → 0.0.4

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.
@@ -4,7 +4,7 @@ import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies';
4
4
 
5
5
  declare class RequestCookiesMock extends RequestCookies {
6
6
  get: vitest.Mock<[name: string] | [next_dist_compiled__edge_runtime_cookies.RequestCookie], next_dist_compiled__edge_runtime_cookies.RequestCookie | undefined>;
7
- getAll: vitest.Mock<[next_dist_compiled__edge_runtime_cookies.RequestCookie] | [name: string] | [], next_dist_compiled__edge_runtime_cookies.RequestCookie[]>;
7
+ getAll: vitest.Mock<[] | [next_dist_compiled__edge_runtime_cookies.RequestCookie] | [name: string], next_dist_compiled__edge_runtime_cookies.RequestCookie[]>;
8
8
  has: vitest.Mock<[name: string], boolean>;
9
9
  set: vitest.Mock<[key: string, value: string] | [options: next_dist_compiled__edge_runtime_cookies.RequestCookie], this>;
10
10
  delete: vitest.Mock<[names: string | string[]], boolean | boolean[]>;
@@ -12,6 +12,14 @@ declare const createNavigation: (overrides?: Record<string, (...params: unknown[
12
12
  prefetch: Mock;
13
13
  refresh: Mock;
14
14
  };
15
+ declare const getRouter: () => {
16
+ push: Mock;
17
+ replace: Mock;
18
+ forward: Mock;
19
+ back: Mock;
20
+ prefetch: Mock;
21
+ refresh: Mock;
22
+ };
15
23
 
16
24
  declare const redirect: Mock<[url: string, type?: actual.RedirectType | undefined], never>;
17
25
  declare const permanentRedirect: Mock<[url: string, type?: actual.RedirectType | undefined], never>;
@@ -27,4 +35,4 @@ interface Params {
27
35
  }
28
36
  declare const useParams: Mock<[], Params>;
29
37
 
30
- export { createNavigation, notFound, permanentRedirect, redirect, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
38
+ export { createNavigation, getRouter, notFound, permanentRedirect, redirect, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
@@ -3,6 +3,7 @@ import * as actual from 'next/dist/client/components/navigation';
3
3
  export * from 'next/dist/client/components/navigation';
4
4
  import { getRedirectError } from 'next/dist/client/components/redirect';
5
5
  import { RedirectStatusCode } from 'next/dist/client/components/redirect-status-code';
6
+ import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
6
7
 
7
8
  // src/plugins/next-mocks/alias/navigation/index.ts
8
9
  var navigationAPI;
@@ -27,6 +28,14 @@ var createNavigation = (overrides) => {
27
28
  navigationAPI = navigationActions;
28
29
  return navigationAPI;
29
30
  };
31
+ var getRouter = () => {
32
+ if (!navigationAPI) {
33
+ throw new NextjsRouterMocksNotAvailable({
34
+ importType: "next/navigation"
35
+ });
36
+ }
37
+ return navigationAPI;
38
+ };
30
39
  var redirect = fn(
31
40
  (url, type = actual.RedirectType.push) => {
32
41
  throw getRedirectError(url, type, RedirectStatusCode.SeeOther);
@@ -62,4 +71,4 @@ var useParams2 = fn(actual.useParams).mockName(
62
71
  "next/navigation::useParams"
63
72
  );
64
73
 
65
- export { createNavigation, 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "0.0.4--canary.fb0538a.0",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",