vite-plugin-storybook-nextjs 3.0.1--canary.0d58c8c.0 → 4.0.0--canary.66.c37ebb8.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.
@@ -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,12 @@
1
+ 'use strict';
2
+
3
+ // src/plugins/next-mocks/alias/safe-stable-stringify/index.ts
4
+ function safeStableStringify(value) {
5
+ try {
6
+ return JSON.stringify(value);
7
+ } catch {
8
+ return String(value);
9
+ }
10
+ }
11
+
12
+ module.exports = safeStableStringify;
@@ -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 };
@@ -0,0 +1,10 @@
1
+ // src/plugins/next-mocks/alias/safe-stable-stringify/index.ts
2
+ function safeStableStringify(value) {
3
+ try {
4
+ return JSON.stringify(value);
5
+ } catch {
6
+ return String(value);
7
+ }
8
+ }
9
+
10
+ export { safeStableStringify as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "3.0.1--canary.0d58c8c.0",
3
+ "version": "4.0.0--canary.66.c37ebb8.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 || ^9.1.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,8 +74,8 @@
72
74
  "@types/semver": "^7.5.8",
73
75
  "auto": "^11.2.0",
74
76
  "lefthook": "^1.6.16",
75
- "next": "^15.4.0-canary.87",
76
- "react": "19.1.0",
77
+ "next": "16.0.0",
78
+ "react": "19.2.0",
77
79
  "rollup": "^4.18.0",
78
80
  "semver": "^7.6.3",
79
81
  "storybook": "^9.0.0",
@@ -84,7 +86,7 @@
84
86
  },
85
87
  "packageManager": "pnpm@9.4.0",
86
88
  "dependencies": {
87
- "@next/env": "^15.0.3",
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
  }