vite-plugin-storybook-nextjs 1.1.2--canary.31.ce898c2.0 → 2.0.0--canary.33.a61ad85.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.
- package/dist/index.cjs +1961 -44
- package/dist/index.js +1958 -41
- package/dist/mocks/storybook.global.cjs +1945 -29
- package/dist/mocks/storybook.global.d.cts +1 -2
- package/dist/mocks/storybook.global.d.ts +1 -2
- package/dist/mocks/storybook.global.js +1944 -27
- package/dist/plugins/next-image/alias/next-image.d.cts +17 -17
- package/dist/plugins/next-image/alias/next-image.d.ts +17 -17
- package/dist/plugins/next-mocks/alias/cache/index.cjs +8 -2
- package/dist/plugins/next-mocks/alias/cache/index.d.cts +5 -1
- package/dist/plugins/next-mocks/alias/cache/index.d.ts +5 -1
- package/dist/plugins/next-mocks/alias/cache/index.js +2 -2
- package/dist/plugins/next-mocks/alias/headers/cookies.cjs +8 -8
- package/dist/plugins/next-mocks/alias/headers/cookies.js +7 -7
- package/dist/plugins/next-mocks/alias/headers/headers.cjs +1 -1
- package/dist/plugins/next-mocks/alias/headers/headers.js +1 -1
- package/dist/plugins/next-mocks/alias/headers/index.cjs +12 -8
- package/dist/plugins/next-mocks/alias/headers/index.d.cts +3 -2
- package/dist/plugins/next-mocks/alias/headers/index.d.ts +3 -2
- package/dist/plugins/next-mocks/alias/headers/index.js +8 -7
- package/dist/plugins/next-mocks/alias/navigation/index.cjs +1 -1
- package/dist/plugins/next-mocks/alias/navigation/index.d.cts +1 -1
- package/dist/plugins/next-mocks/alias/navigation/index.d.ts +1 -1
- package/dist/plugins/next-mocks/alias/navigation/index.js +1 -1
- package/dist/plugins/next-mocks/alias/router/index.cjs +1 -1
- package/dist/plugins/next-mocks/alias/router/index.d.cts +3 -4
- package/dist/plugins/next-mocks/alias/router/index.d.ts +3 -4
- package/dist/plugins/next-mocks/alias/router/index.js +1 -1
- package/dist/plugins/next-mocks/compatibility/draft-mode.compat.cjs +10 -0
- package/dist/plugins/next-mocks/compatibility/draft-mode.compat.d.cts +1 -0
- package/dist/plugins/next-mocks/compatibility/draft-mode.compat.d.ts +1 -0
- package/dist/plugins/next-mocks/compatibility/draft-mode.compat.js +1 -0
- package/package.json +13 -12
|
@@ -2,26 +2,26 @@ import * as next_dist_shared_lib_get_img_props from 'next/dist/shared/lib/get-im
|
|
|
2
2
|
import * as _NextImage from 'next/image';
|
|
3
3
|
import React__default from 'next/dist/compiled/react';
|
|
4
4
|
|
|
5
|
-
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "
|
|
5
|
+
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "alt" | "width" | "height" | "loading"> & {
|
|
6
6
|
src: string | next_dist_shared_lib_get_img_props.StaticImport;
|
|
7
7
|
alt: string;
|
|
8
|
-
width?: number | `${number}
|
|
9
|
-
height?: number | `${number}
|
|
10
|
-
fill?: boolean
|
|
11
|
-
loader?: _NextImage.ImageLoader
|
|
12
|
-
quality?: number | `${number}
|
|
13
|
-
priority?: boolean
|
|
8
|
+
width?: number | `${number}`;
|
|
9
|
+
height?: number | `${number}`;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
loader?: _NextImage.ImageLoader;
|
|
12
|
+
quality?: number | `${number}`;
|
|
13
|
+
priority?: boolean;
|
|
14
14
|
loading?: "lazy" | "eager" | undefined;
|
|
15
|
-
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue
|
|
16
|
-
blurDataURL?: string
|
|
17
|
-
unoptimized?: boolean
|
|
18
|
-
overrideSrc?: string
|
|
19
|
-
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete
|
|
20
|
-
layout?: string
|
|
21
|
-
objectFit?: string
|
|
22
|
-
objectPosition?: string
|
|
23
|
-
lazyBoundary?: string
|
|
24
|
-
lazyRoot?: string
|
|
15
|
+
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue;
|
|
16
|
+
blurDataURL?: string;
|
|
17
|
+
unoptimized?: boolean;
|
|
18
|
+
overrideSrc?: string;
|
|
19
|
+
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete;
|
|
20
|
+
layout?: string;
|
|
21
|
+
objectFit?: string;
|
|
22
|
+
objectPosition?: string;
|
|
23
|
+
lazyBoundary?: string;
|
|
24
|
+
lazyRoot?: string;
|
|
25
25
|
} & React__default.RefAttributes<HTMLImageElement>>;
|
|
26
26
|
declare const getImageProps: (props: _NextImage.ImageProps) => {
|
|
27
27
|
props: next_dist_shared_lib_get_img_props.ImgProps;
|
|
@@ -2,26 +2,26 @@ import * as next_dist_shared_lib_get_img_props from 'next/dist/shared/lib/get-im
|
|
|
2
2
|
import * as _NextImage from 'next/image';
|
|
3
3
|
import React__default from 'next/dist/compiled/react';
|
|
4
4
|
|
|
5
|
-
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "
|
|
5
|
+
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "alt" | "width" | "height" | "loading"> & {
|
|
6
6
|
src: string | next_dist_shared_lib_get_img_props.StaticImport;
|
|
7
7
|
alt: string;
|
|
8
|
-
width?: number | `${number}
|
|
9
|
-
height?: number | `${number}
|
|
10
|
-
fill?: boolean
|
|
11
|
-
loader?: _NextImage.ImageLoader
|
|
12
|
-
quality?: number | `${number}
|
|
13
|
-
priority?: boolean
|
|
8
|
+
width?: number | `${number}`;
|
|
9
|
+
height?: number | `${number}`;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
loader?: _NextImage.ImageLoader;
|
|
12
|
+
quality?: number | `${number}`;
|
|
13
|
+
priority?: boolean;
|
|
14
14
|
loading?: "lazy" | "eager" | undefined;
|
|
15
|
-
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue
|
|
16
|
-
blurDataURL?: string
|
|
17
|
-
unoptimized?: boolean
|
|
18
|
-
overrideSrc?: string
|
|
19
|
-
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete
|
|
20
|
-
layout?: string
|
|
21
|
-
objectFit?: string
|
|
22
|
-
objectPosition?: string
|
|
23
|
-
lazyBoundary?: string
|
|
24
|
-
lazyRoot?: string
|
|
15
|
+
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue;
|
|
16
|
+
blurDataURL?: string;
|
|
17
|
+
unoptimized?: boolean;
|
|
18
|
+
overrideSrc?: string;
|
|
19
|
+
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete;
|
|
20
|
+
layout?: string;
|
|
21
|
+
objectFit?: string;
|
|
22
|
+
objectPosition?: string;
|
|
23
|
+
lazyBoundary?: string;
|
|
24
|
+
lazyRoot?: string;
|
|
25
25
|
} & React__default.RefAttributes<HTMLImageElement>>;
|
|
26
26
|
declare const getImageProps: (props: _NextImage.ImageProps) => {
|
|
27
27
|
props: next_dist_shared_lib_get_img_props.ImgProps;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var test = require('storybook/test');
|
|
4
6
|
|
|
5
7
|
// src/plugins/next-mocks/alias/cache/index.ts
|
|
6
8
|
var revalidatePath = test.fn().mockName(
|
|
@@ -21,4 +23,8 @@ var cacheExports = {
|
|
|
21
23
|
};
|
|
22
24
|
var cache_default = cacheExports;
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
exports.default = cache_default;
|
|
27
|
+
exports.revalidatePath = revalidatePath;
|
|
28
|
+
exports.revalidateTag = revalidateTag;
|
|
29
|
+
exports.unstable_cache = unstable_cache;
|
|
30
|
+
exports.unstable_noStore = unstable_noStore;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Mock } from 'vitest';
|
|
2
2
|
|
|
3
3
|
type Procedure = (...args: any[]) => any;
|
|
4
|
+
declare const revalidatePath: Mock<Procedure>;
|
|
5
|
+
declare const revalidateTag: Mock<Procedure>;
|
|
6
|
+
declare const unstable_cache: Mock<Procedure>;
|
|
7
|
+
declare const unstable_noStore: Mock<Procedure>;
|
|
4
8
|
declare const cacheExports: {
|
|
5
9
|
unstable_cache: Mock<Procedure>;
|
|
6
10
|
revalidateTag: Mock<Procedure>;
|
|
@@ -8,4 +12,4 @@ declare const cacheExports: {
|
|
|
8
12
|
unstable_noStore: Mock<Procedure>;
|
|
9
13
|
};
|
|
10
14
|
|
|
11
|
-
export { cacheExports as default };
|
|
15
|
+
export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Mock } from 'vitest';
|
|
2
2
|
|
|
3
3
|
type Procedure = (...args: any[]) => any;
|
|
4
|
+
declare const revalidatePath: Mock<Procedure>;
|
|
5
|
+
declare const revalidateTag: Mock<Procedure>;
|
|
6
|
+
declare const unstable_cache: Mock<Procedure>;
|
|
7
|
+
declare const unstable_noStore: Mock<Procedure>;
|
|
4
8
|
declare const cacheExports: {
|
|
5
9
|
unstable_cache: Mock<Procedure>;
|
|
6
10
|
revalidateTag: Mock<Procedure>;
|
|
@@ -8,4 +12,4 @@ declare const cacheExports: {
|
|
|
8
12
|
unstable_noStore: Mock<Procedure>;
|
|
9
13
|
};
|
|
10
14
|
|
|
11
|
-
export { cacheExports as default };
|
|
15
|
+
export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fn } from '
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
2
|
|
|
3
3
|
// src/plugins/next-mocks/alias/cache/index.ts
|
|
4
4
|
var revalidatePath = fn().mockName(
|
|
@@ -19,4 +19,4 @@ var cacheExports = {
|
|
|
19
19
|
};
|
|
20
20
|
var cache_default = cacheExports;
|
|
21
21
|
|
|
22
|
-
export { cache_default as default };
|
|
22
|
+
export { cache_default as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var test = require('@storybook/test');
|
|
4
3
|
var index_js = require('next/dist/compiled/@edge-runtime/cookies/index.js');
|
|
5
|
-
var
|
|
4
|
+
var test = require('storybook/test');
|
|
5
|
+
var draftMode = require('next/dist/server/request/draft-mode');
|
|
6
|
+
var headers2 = require('next/dist/server/request/headers');
|
|
6
7
|
var headers_js = require('next/dist/server/web/spec-extension/adapters/headers.js');
|
|
7
8
|
|
|
8
9
|
function _interopNamespace(e) {
|
|
@@ -23,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
23
24
|
return Object.freeze(n);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
var
|
|
27
|
+
var headers2__namespace = /*#__PURE__*/_interopNamespace(headers2);
|
|
27
28
|
|
|
28
29
|
// src/plugins/next-mocks/alias/headers/cookies.ts
|
|
29
30
|
var HeadersAdapterMock = class extends headers_js.HeadersAdapter {
|
|
@@ -64,11 +65,10 @@ var headers = () => {
|
|
|
64
65
|
headers.mockRestore = () => {
|
|
65
66
|
headersAdapterMock = new HeadersAdapterMock();
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
);
|
|
68
|
+
test.fn(
|
|
69
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
70
|
+
draftMode.draftMode ?? headers2__namespace.draftMode
|
|
71
|
+
).mockName("draftMode");
|
|
72
72
|
|
|
73
73
|
// src/plugins/next-mocks/alias/headers/cookies.ts
|
|
74
74
|
var RequestCookiesMock = class extends index_js.RequestCookies {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { fn } from '@storybook/test';
|
|
2
1
|
import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
3
|
-
import
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
import { draftMode } from 'next/dist/server/request/draft-mode';
|
|
4
|
+
import * as headers2 from 'next/dist/server/request/headers';
|
|
4
5
|
import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
5
6
|
|
|
6
7
|
// src/plugins/next-mocks/alias/headers/cookies.ts
|
|
@@ -42,11 +43,10 @@ var headers = () => {
|
|
|
42
43
|
headers.mockRestore = () => {
|
|
43
44
|
headersAdapterMock = new HeadersAdapterMock();
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
46
|
+
fn(
|
|
47
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
48
|
+
draftMode ?? headers2.draftMode
|
|
49
|
+
).mockName("draftMode");
|
|
50
50
|
|
|
51
51
|
// src/plugins/next-mocks/alias/headers/cookies.ts
|
|
52
52
|
var RequestCookiesMock = class extends RequestCookies {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var draftMode = require('next/dist/server/request/draft-mode');
|
|
4
|
+
var headers2 = require('next/dist/server/request/headers');
|
|
5
|
+
var test = require('storybook/test');
|
|
5
6
|
var headers_js = require('next/dist/server/web/spec-extension/adapters/headers.js');
|
|
6
7
|
var index_js = require('next/dist/compiled/@edge-runtime/cookies/index.js');
|
|
7
8
|
|
|
@@ -23,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
23
24
|
return Object.freeze(n);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
var
|
|
27
|
+
var headers2__namespace = /*#__PURE__*/_interopNamespace(headers2);
|
|
27
28
|
|
|
28
29
|
// src/plugins/next-mocks/alias/headers/index.ts
|
|
29
30
|
var HeadersAdapterMock = class extends headers_js.HeadersAdapter {
|
|
@@ -91,12 +92,15 @@ cookies.mockRestore = () => {
|
|
|
91
92
|
headers.mockRestore();
|
|
92
93
|
requestCookiesMock = new RequestCookiesMock(headers());
|
|
93
94
|
};
|
|
95
|
+
var draftMode2 = test.fn(
|
|
96
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
97
|
+
draftMode.draftMode ?? headers2__namespace.draftMode
|
|
98
|
+
).mockName("draftMode");
|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
+
Object.defineProperty(exports, "UnsafeUnwrappedHeaders", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return headers2.UnsafeUnwrappedHeaders; }
|
|
103
|
+
});
|
|
100
104
|
exports.cookies = cookies;
|
|
101
105
|
exports.draftMode = draftMode2;
|
|
102
106
|
exports.headers = headers;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { draftMode as draftMode$1 } from 'next/dist/server/request/draft-mode';
|
|
2
2
|
import { Mock } from 'vitest';
|
|
3
3
|
export { headers } from './headers.cjs';
|
|
4
4
|
export { cookies } from './cookies.cjs';
|
|
5
|
+
export { UnsafeUnwrappedHeaders } from 'next/dist/server/request/headers';
|
|
5
6
|
import 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
6
7
|
import 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
7
8
|
|
|
8
|
-
declare const draftMode: Mock<() =>
|
|
9
|
+
declare const draftMode: Mock<() => ReturnType<typeof draftMode$1>>;
|
|
9
10
|
|
|
10
11
|
export { draftMode };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { draftMode as draftMode$1 } from 'next/dist/server/request/draft-mode';
|
|
2
2
|
import { Mock } from 'vitest';
|
|
3
3
|
export { headers } from './headers.js';
|
|
4
4
|
export { cookies } from './cookies.js';
|
|
5
|
+
export { UnsafeUnwrappedHeaders } from 'next/dist/server/request/headers';
|
|
5
6
|
import 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
6
7
|
import 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
7
8
|
|
|
8
|
-
declare const draftMode: Mock<() =>
|
|
9
|
+
declare const draftMode: Mock<() => ReturnType<typeof draftMode$1>>;
|
|
9
10
|
|
|
10
11
|
export { draftMode };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
1
|
+
import { draftMode } from 'next/dist/server/request/draft-mode';
|
|
2
|
+
import * as headers2 from 'next/dist/server/request/headers';
|
|
3
|
+
export { UnsafeUnwrappedHeaders } from 'next/dist/server/request/headers';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
3
5
|
import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
4
6
|
import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
5
7
|
|
|
@@ -69,10 +71,9 @@ cookies.mockRestore = () => {
|
|
|
69
71
|
headers.mockRestore();
|
|
70
72
|
requestCookiesMock = new RequestCookiesMock(headers());
|
|
71
73
|
};
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
74
|
+
var draftMode2 = fn(
|
|
75
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
76
|
+
draftMode ?? headers2.draftMode
|
|
77
|
+
).mockName("draftMode");
|
|
77
78
|
|
|
78
79
|
export { cookies, draftMode2 as draftMode, headers };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var test = require('@storybook/test');
|
|
4
3
|
var actual = require('next/dist/client/components/navigation.js');
|
|
5
4
|
var redirectStatusCode_js = require('next/dist/client/components/redirect-status-code.js');
|
|
6
5
|
var redirect_js = require('next/dist/client/components/redirect.js');
|
|
7
6
|
var previewErrors = require('storybook/internal/preview-errors');
|
|
7
|
+
var test = require('storybook/test');
|
|
8
8
|
|
|
9
9
|
function _interopNamespace(e) {
|
|
10
10
|
if (e && e.__esModule) return e;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Mock } from '@storybook/test';
|
|
2
1
|
import * as actual from 'next/dist/client/components/navigation.js';
|
|
3
2
|
export * from 'next/dist/client/components/navigation.js';
|
|
4
3
|
import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
|
4
|
+
import { Mock } from 'storybook/test';
|
|
5
5
|
|
|
6
6
|
declare const createNavigation: (overrides?: Record<string, (...params: unknown[]) => unknown>) => {
|
|
7
7
|
push: Mock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Mock } from '@storybook/test';
|
|
2
1
|
import * as actual from 'next/dist/client/components/navigation.js';
|
|
3
2
|
export * from 'next/dist/client/components/navigation.js';
|
|
4
3
|
import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
|
4
|
+
import { Mock } from 'storybook/test';
|
|
5
5
|
|
|
6
6
|
declare const createNavigation: (overrides?: Record<string, (...params: unknown[]) => unknown>) => {
|
|
7
7
|
push: Mock;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { fn } from '@storybook/test';
|
|
2
1
|
import * as actual from 'next/dist/client/components/navigation.js';
|
|
3
2
|
export * from 'next/dist/client/components/navigation.js';
|
|
4
3
|
import { RedirectStatusCode } from 'next/dist/client/components/redirect-status-code.js';
|
|
5
4
|
import { getRedirectError } from 'next/dist/client/components/redirect.js';
|
|
6
5
|
import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
|
|
6
|
+
import { fn } from 'storybook/test';
|
|
7
7
|
|
|
8
8
|
// src/plugins/next-mocks/alias/navigation/index.ts
|
|
9
9
|
var navigationAPI;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var test = require('@storybook/test');
|
|
6
5
|
var singletonRouter = require('next/dist/client/router.js');
|
|
7
6
|
var previewErrors = require('storybook/internal/preview-errors');
|
|
7
|
+
var test = require('storybook/test');
|
|
8
8
|
var router = require('next/dist/client/router');
|
|
9
9
|
|
|
10
10
|
function _interopNamespace(e) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Mock } from '@storybook/test';
|
|
2
1
|
import { NextComponentType, NextPageContext } from 'next';
|
|
3
|
-
import
|
|
4
|
-
import originalRouter__default from 'next/dist/client/router.js';
|
|
2
|
+
import singletonRouter from 'next/dist/client/router.js';
|
|
5
3
|
export { default } from 'next/dist/client/router.js';
|
|
6
4
|
import { WithRouterProps, ExcludeRouterProps } from 'next/dist/client/with-router';
|
|
7
5
|
import { NextRouter } from 'next/router.js';
|
|
8
6
|
import { ComponentType } from 'react';
|
|
7
|
+
import { Mock } from 'storybook/test';
|
|
9
8
|
export * from 'next/dist/client/router';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -13,7 +12,7 @@ export * from 'next/dist/client/router';
|
|
|
13
12
|
* @ignore
|
|
14
13
|
* @internal
|
|
15
14
|
* */
|
|
16
|
-
declare const createRouter: (overrides: Partial<NextRouter>) =>
|
|
15
|
+
declare const createRouter: (overrides: Partial<NextRouter>) => NextRouter;
|
|
17
16
|
declare const getRouter: () => {
|
|
18
17
|
push: Mock;
|
|
19
18
|
replace: Mock;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Mock } from '@storybook/test';
|
|
2
1
|
import { NextComponentType, NextPageContext } from 'next';
|
|
3
|
-
import
|
|
4
|
-
import originalRouter__default from 'next/dist/client/router.js';
|
|
2
|
+
import singletonRouter from 'next/dist/client/router.js';
|
|
5
3
|
export { default } from 'next/dist/client/router.js';
|
|
6
4
|
import { WithRouterProps, ExcludeRouterProps } from 'next/dist/client/with-router';
|
|
7
5
|
import { NextRouter } from 'next/router.js';
|
|
8
6
|
import { ComponentType } from 'react';
|
|
7
|
+
import { Mock } from 'storybook/test';
|
|
9
8
|
export * from 'next/dist/client/router';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -13,7 +12,7 @@ export * from 'next/dist/client/router';
|
|
|
13
12
|
* @ignore
|
|
14
13
|
* @internal
|
|
15
14
|
* */
|
|
16
|
-
declare const createRouter: (overrides: Partial<NextRouter>) =>
|
|
15
|
+
declare const createRouter: (overrides: Partial<NextRouter>) => NextRouter;
|
|
17
16
|
declare const getRouter: () => {
|
|
18
17
|
push: Mock;
|
|
19
18
|
replace: Mock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { fn } from '@storybook/test';
|
|
2
1
|
import * as singletonRouter from 'next/dist/client/router.js';
|
|
3
2
|
import singletonRouter__default from 'next/dist/client/router.js';
|
|
4
3
|
import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
5
|
export * from 'next/dist/client/router';
|
|
6
6
|
|
|
7
7
|
// src/plugins/next-mocks/alias/router/index.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { draftMode } from 'next/dist/client/components/headers';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { draftMode } from 'next/dist/client/components/headers';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { draftMode } from 'next/dist/client/components/headers';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-storybook-nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0--canary.33.a61ad85.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite-plugin",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"./browser/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.js",
|
|
40
40
|
"./browser/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.js",
|
|
41
41
|
"./browser/mocks/image-context": "./dist/plugins/next-image/alias/image-context.js",
|
|
42
|
+
"./browser/mocks/draft-mode.compat": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.js",
|
|
42
43
|
"./node/mocks/cache": "./dist/plugins/next-mocks/alias/cache/index.cjs",
|
|
43
44
|
"./node/mocks/navigation": "./dist/plugins/next-mocks/alias/navigation/index.cjs",
|
|
44
45
|
"./node/mocks/headers": "./dist/plugins/next-mocks/alias/headers/index.cjs",
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
"./node/mocks/image": "./dist/plugins/next-image/alias/next-image.cjs",
|
|
49
50
|
"./node/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.cjs",
|
|
50
51
|
"./node/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.cjs",
|
|
51
|
-
"./node/mocks/image-context": "./dist/plugins/next-image/alias/image-context.cjs"
|
|
52
|
+
"./node/mocks/image-context": "./dist/plugins/next-image/alias/image-context.cjs",
|
|
53
|
+
"./node/mocks/draft-mode.compat": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.cjs"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
56
|
"prepublishOnly": "pnpm build",
|
|
@@ -59,21 +61,21 @@
|
|
|
59
61
|
"release": "auto shipit"
|
|
60
62
|
},
|
|
61
63
|
"peerDependencies": {
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"vite": "^5.0.0"
|
|
64
|
+
"next": "^14.1.0 || ^15.0.0",
|
|
65
|
+
"storybook": "^9.0.0-0",
|
|
66
|
+
"vite": "^5.0.0 || ^6.0.0"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"@biomejs/biome": "1.8.1",
|
|
69
|
-
"@storybook/test": "^8.3.0",
|
|
70
70
|
"@types/node": "^18",
|
|
71
71
|
"@types/react": "^18",
|
|
72
|
+
"@types/semver": "^7.5.8",
|
|
72
73
|
"auto": "^11.2.0",
|
|
73
74
|
"lefthook": "^1.6.16",
|
|
74
|
-
"next": "^
|
|
75
|
-
"react": "
|
|
75
|
+
"next": "^15.0.3",
|
|
76
|
+
"react": "19.0.0-rc-66855b96-20241106",
|
|
76
77
|
"rollup": "^4.18.0",
|
|
78
|
+
"semver": "^7.6.3",
|
|
77
79
|
"sharp": "^0.33.4",
|
|
78
80
|
"storybook": "^8.3.0",
|
|
79
81
|
"tsup": "^8.1.0",
|
|
@@ -83,12 +85,11 @@
|
|
|
83
85
|
},
|
|
84
86
|
"packageManager": "pnpm@9.4.0",
|
|
85
87
|
"dependencies": {
|
|
86
|
-
"@next/env": "^
|
|
88
|
+
"@next/env": "^15.0.3",
|
|
87
89
|
"image-size": "^1.1.1",
|
|
88
90
|
"magic-string": "^0.30.11",
|
|
89
91
|
"module-alias": "^2.2.3",
|
|
90
|
-
"ts-dedent": "^2.2.0"
|
|
91
|
-
"styled-jsx": "^5.1.6"
|
|
92
|
+
"ts-dedent": "^2.2.0"
|
|
92
93
|
},
|
|
93
94
|
"optionalDependencies": {
|
|
94
95
|
"sharp": "^0.33.4"
|