vite-plugin-storybook-nextjs 2.0.8 → 2.1.0--canary.62.ddf2350.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 +8 -1
- package/dist/index.js +8 -1
- package/dist/mocks/storybook.global.cjs +8 -0
- package/dist/mocks/storybook.global.js +8 -0
- package/dist/plugins/next-image/alias/next-image.d.cts +1 -0
- package/dist/plugins/next-image/alias/next-image.d.ts +1 -0
- package/dist/plugins/next-mocks/alias/cache/index.cjs +6 -0
- 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 +5 -1
- package/dist/plugins/next-mocks/alias/headers/cookies.cjs +2 -0
- package/dist/plugins/next-mocks/alias/headers/cookies.js +2 -0
- package/dist/plugins/next-mocks/alias/headers/index.cjs +2 -4
- package/dist/plugins/next-mocks/alias/headers/index.d.cts +0 -1
- package/dist/plugins/next-mocks/alias/headers/index.d.ts +0 -1
- package/dist/plugins/next-mocks/alias/headers/index.js +2 -1
- package/dist/plugins/next-mocks/alias/safe-stable-stringify/index.cjs +12 -0
- package/dist/plugins/next-mocks/alias/safe-stable-stringify/index.d.cts +11 -0
- package/dist/plugins/next-mocks/alias/safe-stable-stringify/index.d.ts +11 -0
- package/dist/plugins/next-mocks/alias/safe-stable-stringify/index.js +10 -0
- package/package.json +10 -7
package/dist/index.cjs
CHANGED
|
@@ -2563,7 +2563,6 @@ var getVitestSWCTransformConfig = ({
|
|
|
2563
2563
|
type: isEsmProject && !useCjsModules ? "es6" : "commonjs"
|
|
2564
2564
|
},
|
|
2565
2565
|
disableNextSsg: !isPageFile,
|
|
2566
|
-
disablePageConfig: true,
|
|
2567
2566
|
isPageFile,
|
|
2568
2567
|
pagesDir: nextDirectories.pagesDir,
|
|
2569
2568
|
appDir: nextDirectories.appDir,
|
|
@@ -2860,6 +2859,14 @@ var getAlias2 = (env) => ({
|
|
|
2860
2859
|
"@opentelemetry/api": require7.resolve(
|
|
2861
2860
|
"next/dist/compiled/@opentelemetry/api"
|
|
2862
2861
|
),
|
|
2862
|
+
"next/dist/compiled/safe-stable-stringify": getEntryPoint3(
|
|
2863
|
+
"safe-stable-stringify",
|
|
2864
|
+
env
|
|
2865
|
+
),
|
|
2866
|
+
"next/dist/compiled/safe-stable-stringify/index.js": getEntryPoint3(
|
|
2867
|
+
"safe-stable-stringify",
|
|
2868
|
+
env
|
|
2869
|
+
),
|
|
2863
2870
|
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
2864
2871
|
...getCompatibilityAliases(env)
|
|
2865
2872
|
});
|
package/dist/index.js
CHANGED
|
@@ -2529,7 +2529,6 @@ var getVitestSWCTransformConfig = ({
|
|
|
2529
2529
|
type: isEsmProject && !useCjsModules ? "es6" : "commonjs"
|
|
2530
2530
|
},
|
|
2531
2531
|
disableNextSsg: !isPageFile,
|
|
2532
|
-
disablePageConfig: true,
|
|
2533
2532
|
isPageFile,
|
|
2534
2533
|
pagesDir: nextDirectories.pagesDir,
|
|
2535
2534
|
appDir: nextDirectories.appDir,
|
|
@@ -2826,6 +2825,14 @@ var getAlias2 = (env) => ({
|
|
|
2826
2825
|
"@opentelemetry/api": require7.resolve(
|
|
2827
2826
|
"next/dist/compiled/@opentelemetry/api"
|
|
2828
2827
|
),
|
|
2828
|
+
"next/dist/compiled/safe-stable-stringify": getEntryPoint3(
|
|
2829
|
+
"safe-stable-stringify",
|
|
2830
|
+
env
|
|
2831
|
+
),
|
|
2832
|
+
"next/dist/compiled/safe-stable-stringify/index.js": getEntryPoint3(
|
|
2833
|
+
"safe-stable-stringify",
|
|
2834
|
+
env
|
|
2835
|
+
),
|
|
2829
2836
|
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
2830
2837
|
...getCompatibilityAliases(env)
|
|
2831
2838
|
});
|
|
@@ -1988,6 +1988,14 @@ var getAlias2 = (env) => ({
|
|
|
1988
1988
|
"@opentelemetry/api": require5.resolve(
|
|
1989
1989
|
"next/dist/compiled/@opentelemetry/api"
|
|
1990
1990
|
),
|
|
1991
|
+
"next/dist/compiled/safe-stable-stringify": getEntryPoint3(
|
|
1992
|
+
"safe-stable-stringify",
|
|
1993
|
+
env
|
|
1994
|
+
),
|
|
1995
|
+
"next/dist/compiled/safe-stable-stringify/index.js": getEntryPoint3(
|
|
1996
|
+
"safe-stable-stringify",
|
|
1997
|
+
env
|
|
1998
|
+
),
|
|
1991
1999
|
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
1992
2000
|
...getCompatibilityAliases(env)
|
|
1993
2001
|
});
|
|
@@ -1981,6 +1981,14 @@ var getAlias2 = (env) => ({
|
|
|
1981
1981
|
"@opentelemetry/api": require5.resolve(
|
|
1982
1982
|
"next/dist/compiled/@opentelemetry/api"
|
|
1983
1983
|
),
|
|
1984
|
+
"next/dist/compiled/safe-stable-stringify": getEntryPoint3(
|
|
1985
|
+
"safe-stable-stringify",
|
|
1986
|
+
env
|
|
1987
|
+
),
|
|
1988
|
+
"next/dist/compiled/safe-stable-stringify/index.js": getEntryPoint3(
|
|
1989
|
+
"safe-stable-stringify",
|
|
1990
|
+
env
|
|
1991
|
+
),
|
|
1984
1992
|
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
1985
1993
|
...getCompatibilityAliases(env)
|
|
1986
1994
|
});
|
|
@@ -10,6 +10,7 @@ declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<Rea
|
|
|
10
10
|
fill?: boolean;
|
|
11
11
|
loader?: _NextImage.ImageLoader;
|
|
12
12
|
quality?: number | `${number}`;
|
|
13
|
+
preload?: boolean;
|
|
13
14
|
priority?: boolean;
|
|
14
15
|
loading?: "lazy" | "eager" | undefined;
|
|
15
16
|
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue;
|
|
@@ -10,6 +10,7 @@ declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<Rea
|
|
|
10
10
|
fill?: boolean;
|
|
11
11
|
loader?: _NextImage.ImageLoader;
|
|
12
12
|
quality?: number | `${number}`;
|
|
13
|
+
preload?: boolean;
|
|
13
14
|
priority?: boolean;
|
|
14
15
|
loading?: "lazy" | "eager" | undefined;
|
|
15
16
|
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue;
|
|
@@ -11,20 +11,26 @@ var revalidatePath = test.fn().mockName(
|
|
|
11
11
|
var revalidateTag = test.fn().mockName(
|
|
12
12
|
"next/cache::revalidateTag"
|
|
13
13
|
);
|
|
14
|
+
var updateTag = test.fn().mockName("next/cache::updateTag");
|
|
14
15
|
var unstable_cache = test.fn().mockName("next/cache::unstable_cache").mockImplementation((cb) => cb);
|
|
15
16
|
var unstable_noStore = test.fn().mockName(
|
|
16
17
|
"next/cache::unstable_noStore"
|
|
17
18
|
);
|
|
19
|
+
var refresh = test.fn().mockName("next/cache::refresh");
|
|
18
20
|
var cacheExports = {
|
|
19
21
|
unstable_cache,
|
|
20
22
|
revalidateTag,
|
|
21
23
|
revalidatePath,
|
|
24
|
+
updateTag,
|
|
25
|
+
refresh,
|
|
22
26
|
unstable_noStore
|
|
23
27
|
};
|
|
24
28
|
var cache_default = cacheExports;
|
|
25
29
|
|
|
26
30
|
exports.default = cache_default;
|
|
31
|
+
exports.refresh = refresh;
|
|
27
32
|
exports.revalidatePath = revalidatePath;
|
|
28
33
|
exports.revalidateTag = revalidateTag;
|
|
29
34
|
exports.unstable_cache = unstable_cache;
|
|
30
35
|
exports.unstable_noStore = unstable_noStore;
|
|
36
|
+
exports.updateTag = updateTag;
|
|
@@ -3,13 +3,17 @@ import { Mock } from 'vitest';
|
|
|
3
3
|
type Procedure = (...args: any[]) => any;
|
|
4
4
|
declare const revalidatePath: Mock<Procedure>;
|
|
5
5
|
declare const revalidateTag: Mock<Procedure>;
|
|
6
|
+
declare const updateTag: Mock<Procedure>;
|
|
6
7
|
declare const unstable_cache: Mock<Procedure>;
|
|
7
8
|
declare const unstable_noStore: Mock<Procedure>;
|
|
9
|
+
declare const refresh: Mock<Procedure>;
|
|
8
10
|
declare const cacheExports: {
|
|
9
11
|
unstable_cache: Mock<Procedure>;
|
|
10
12
|
revalidateTag: Mock<Procedure>;
|
|
11
13
|
revalidatePath: Mock<Procedure>;
|
|
14
|
+
updateTag: Mock<Procedure>;
|
|
15
|
+
refresh: Mock<Procedure>;
|
|
12
16
|
unstable_noStore: Mock<Procedure>;
|
|
13
17
|
};
|
|
14
18
|
|
|
15
|
-
export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
19
|
+
export { cacheExports as default, refresh, revalidatePath, revalidateTag, unstable_cache, unstable_noStore, updateTag };
|
|
@@ -3,13 +3,17 @@ import { Mock } from 'vitest';
|
|
|
3
3
|
type Procedure = (...args: any[]) => any;
|
|
4
4
|
declare const revalidatePath: Mock<Procedure>;
|
|
5
5
|
declare const revalidateTag: Mock<Procedure>;
|
|
6
|
+
declare const updateTag: Mock<Procedure>;
|
|
6
7
|
declare const unstable_cache: Mock<Procedure>;
|
|
7
8
|
declare const unstable_noStore: Mock<Procedure>;
|
|
9
|
+
declare const refresh: Mock<Procedure>;
|
|
8
10
|
declare const cacheExports: {
|
|
9
11
|
unstable_cache: Mock<Procedure>;
|
|
10
12
|
revalidateTag: Mock<Procedure>;
|
|
11
13
|
revalidatePath: Mock<Procedure>;
|
|
14
|
+
updateTag: Mock<Procedure>;
|
|
15
|
+
refresh: Mock<Procedure>;
|
|
12
16
|
unstable_noStore: Mock<Procedure>;
|
|
13
17
|
};
|
|
14
18
|
|
|
15
|
-
export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
19
|
+
export { cacheExports as default, refresh, revalidatePath, revalidateTag, unstable_cache, unstable_noStore, updateTag };
|
|
@@ -7,16 +7,20 @@ var revalidatePath = fn().mockName(
|
|
|
7
7
|
var revalidateTag = fn().mockName(
|
|
8
8
|
"next/cache::revalidateTag"
|
|
9
9
|
);
|
|
10
|
+
var updateTag = fn().mockName("next/cache::updateTag");
|
|
10
11
|
var unstable_cache = fn().mockName("next/cache::unstable_cache").mockImplementation((cb) => cb);
|
|
11
12
|
var unstable_noStore = fn().mockName(
|
|
12
13
|
"next/cache::unstable_noStore"
|
|
13
14
|
);
|
|
15
|
+
var refresh = fn().mockName("next/cache::refresh");
|
|
14
16
|
var cacheExports = {
|
|
15
17
|
unstable_cache,
|
|
16
18
|
revalidateTag,
|
|
17
19
|
revalidatePath,
|
|
20
|
+
updateTag,
|
|
21
|
+
refresh,
|
|
18
22
|
unstable_noStore
|
|
19
23
|
};
|
|
20
24
|
var cache_default = cacheExports;
|
|
21
25
|
|
|
22
|
-
export { cache_default as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
26
|
+
export { cache_default as default, refresh, revalidatePath, revalidateTag, unstable_cache, unstable_noStore, updateTag };
|
|
@@ -65,6 +65,8 @@ var headers = () => {
|
|
|
65
65
|
headers.mockRestore = () => {
|
|
66
66
|
headersAdapterMock = new HeadersAdapterMock();
|
|
67
67
|
};
|
|
68
|
+
|
|
69
|
+
// src/plugins/next-mocks/alias/headers/index.ts
|
|
68
70
|
test.fn(
|
|
69
71
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
70
72
|
draftMode.draftMode ?? headers2__namespace.draftMode
|
|
@@ -43,6 +43,8 @@ var headers = () => {
|
|
|
43
43
|
headers.mockRestore = () => {
|
|
44
44
|
headersAdapterMock = new HeadersAdapterMock();
|
|
45
45
|
};
|
|
46
|
+
|
|
47
|
+
// src/plugins/next-mocks/alias/headers/index.ts
|
|
46
48
|
fn(
|
|
47
49
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
48
50
|
draftMode ?? headers2.draftMode
|
|
@@ -92,15 +92,13 @@ cookies.mockRestore = () => {
|
|
|
92
92
|
headers.mockRestore();
|
|
93
93
|
requestCookiesMock = new RequestCookiesMock(headers());
|
|
94
94
|
};
|
|
95
|
+
|
|
96
|
+
// src/plugins/next-mocks/alias/headers/index.ts
|
|
95
97
|
var draftMode2 = test.fn(
|
|
96
98
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
97
99
|
draftMode.draftMode ?? headers2__namespace.draftMode
|
|
98
100
|
).mockName("draftMode");
|
|
99
101
|
|
|
100
|
-
Object.defineProperty(exports, "UnsafeUnwrappedHeaders", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function () { return headers2.UnsafeUnwrappedHeaders; }
|
|
103
|
-
});
|
|
104
102
|
exports.cookies = cookies;
|
|
105
103
|
exports.draftMode = draftMode2;
|
|
106
104
|
exports.headers = headers;
|
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
import 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
7
6
|
import 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
8
7
|
|
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
import 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
7
6
|
import 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
8
7
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { draftMode } from 'next/dist/server/request/draft-mode';
|
|
2
2
|
import * as headers2 from 'next/dist/server/request/headers';
|
|
3
|
-
export { UnsafeUnwrappedHeaders } from 'next/dist/server/request/headers';
|
|
4
3
|
import { fn } from 'storybook/test';
|
|
5
4
|
import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
|
|
6
5
|
import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
|
|
@@ -71,6 +70,8 @@ cookies.mockRestore = () => {
|
|
|
71
70
|
headers.mockRestore();
|
|
72
71
|
requestCookiesMock = new RequestCookiesMock(headers());
|
|
73
72
|
};
|
|
73
|
+
|
|
74
|
+
// src/plugins/next-mocks/alias/headers/index.ts
|
|
74
75
|
var draftMode2 = fn(
|
|
75
76
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
76
77
|
draftMode ?? headers2.draftMode
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a replacement for next/dist/compiled/safe-stable-stringify
|
|
3
|
+
*
|
|
4
|
+
* Because it is CJS and needs access to __dirname, which causes Storybook to break.
|
|
5
|
+
*
|
|
6
|
+
* Original file can be found here:
|
|
7
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/compiled/safe-stable-stringify/index.js
|
|
8
|
+
*/
|
|
9
|
+
declare function safeStableStringify(value: unknown): string;
|
|
10
|
+
|
|
11
|
+
export { safeStableStringify as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a replacement for next/dist/compiled/safe-stable-stringify
|
|
3
|
+
*
|
|
4
|
+
* Because it is CJS and needs access to __dirname, which causes Storybook to break.
|
|
5
|
+
*
|
|
6
|
+
* Original file can be found here:
|
|
7
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/compiled/safe-stable-stringify/index.js
|
|
8
|
+
*/
|
|
9
|
+
declare function safeStableStringify(value: unknown): string;
|
|
10
|
+
|
|
11
|
+
export { safeStableStringify as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-storybook-nextjs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0--canary.62.ddf2350.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite-plugin",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"default": "./dist/index.cjs"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
"./browser/mocks/safe-stable-stringify": "./dist/plugins/next-mocks/alias/safe-stable-stringify/index.js",
|
|
32
33
|
"./browser/mocks/cache": "./dist/plugins/next-mocks/alias/cache/index.js",
|
|
33
34
|
"./browser/mocks/navigation": "./dist/plugins/next-mocks/alias/navigation/index.js",
|
|
34
35
|
"./browser/mocks/headers": "./dist/plugins/next-mocks/alias/headers/index.js",
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
"./node/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.cjs",
|
|
51
52
|
"./node/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.cjs",
|
|
52
53
|
"./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"
|
|
54
|
+
"./node/mocks/draft-mode.compat": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.cjs",
|
|
55
|
+
"./node/mocks/safe-stable-stringify": "./dist/plugins/next-mocks/alias/safe-stable-stringify/index.cjs"
|
|
54
56
|
},
|
|
55
57
|
"scripts": {
|
|
56
58
|
"prepublishOnly": "pnpm build",
|
|
@@ -61,8 +63,8 @@
|
|
|
61
63
|
"release": "auto shipit"
|
|
62
64
|
},
|
|
63
65
|
"peerDependencies": {
|
|
64
|
-
"next": "^14.1.0 || ^15.0.0",
|
|
65
|
-
"storybook": "^0.0.0-0 || ^9.0.0 || ^
|
|
66
|
+
"next": "^14.1.0 || ^15.0.0 || ^16.0.0",
|
|
67
|
+
"storybook": "^0.0.0-0 || ^9.0.0 || ^10.0.0 || ^10.0.0-0",
|
|
66
68
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
67
69
|
},
|
|
68
70
|
"devDependencies": {
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
"@types/semver": "^7.5.8",
|
|
73
75
|
"auto": "^11.2.0",
|
|
74
76
|
"lefthook": "^1.6.16",
|
|
75
|
-
"next": "^
|
|
77
|
+
"next": "^16.0.0",
|
|
76
78
|
"react": "19.1.0",
|
|
77
79
|
"rollup": "^4.18.0",
|
|
78
80
|
"semver": "^7.6.3",
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
},
|
|
85
87
|
"packageManager": "pnpm@9.4.0",
|
|
86
88
|
"dependencies": {
|
|
87
|
-
"@next/env": "^
|
|
89
|
+
"@next/env": "^16.0.0",
|
|
88
90
|
"image-size": "^2.0.0",
|
|
89
91
|
"magic-string": "^0.30.11",
|
|
90
92
|
"module-alias": "^2.2.3",
|
|
@@ -96,7 +98,8 @@
|
|
|
96
98
|
},
|
|
97
99
|
"pnpm": {
|
|
98
100
|
"overrides": {
|
|
99
|
-
"vite-plugin-storybook-nextjs": "workspace:*"
|
|
101
|
+
"vite-plugin-storybook-nextjs": "workspace:*",
|
|
102
|
+
"next": "^16.0.0"
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
}
|