vite-plugin-storybook-nextjs 1.0.10--canary.16.940d8d2.0 → 1.0.11--canary.17.30fa28e.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 CHANGED
@@ -972,10 +972,40 @@ function VitePlugin({ dir = process.cwd() } = {}) {
972
972
  return {
973
973
  ...!isVitestEnv && {
974
974
  resolve: {
975
- alias: {
976
- react: "next/dist/compiled/react",
977
- "react-dom": "next/dist/compiled/react-dom"
978
- }
975
+ alias: [
976
+ {
977
+ find: /^react$/,
978
+ replacement: "next/dist/compiled/react"
979
+ },
980
+ {
981
+ find: /^react-dom$/,
982
+ replacement: "next/dist/compiled/react-dom"
983
+ },
984
+ {
985
+ find: /^react-dom\/server$/,
986
+ replacement: require6.resolve(
987
+ "next/dist/compiled/react-dom/server.browser.js"
988
+ )
989
+ },
990
+ {
991
+ find: /^react-dom\/test-utils$/,
992
+ replacement: require6.resolve(
993
+ "next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
994
+ )
995
+ },
996
+ {
997
+ find: /^react-dom\/client$/,
998
+ replacement: require6.resolve(
999
+ "next/dist/compiled/react-dom/client.js"
1000
+ )
1001
+ },
1002
+ {
1003
+ find: /^react-dom\/cjs\/react-dom\.development\.js$/,
1004
+ replacement: require6.resolve(
1005
+ "next/dist/compiled/react-dom/cjs/react-dom.development.js"
1006
+ )
1007
+ }
1008
+ ]
979
1009
  }
980
1010
  },
981
1011
  test: {
@@ -1005,7 +1035,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
1005
1035
  };
1006
1036
  },
1007
1037
  configResolved(config) {
1008
- if (!config.test?.browser?.enabled) {
1038
+ if (isVitestEnv && !config.test?.browser?.enabled) {
1009
1039
  config.test.setupFiles = [
1010
1040
  require6.resolve("./mocks/storybook.global.js"),
1011
1041
  ...config.test?.setupFiles ?? []
package/dist/index.js CHANGED
@@ -938,10 +938,40 @@ function VitePlugin({ dir = process.cwd() } = {}) {
938
938
  return {
939
939
  ...!isVitestEnv && {
940
940
  resolve: {
941
- alias: {
942
- react: "next/dist/compiled/react",
943
- "react-dom": "next/dist/compiled/react-dom"
944
- }
941
+ alias: [
942
+ {
943
+ find: /^react$/,
944
+ replacement: "next/dist/compiled/react"
945
+ },
946
+ {
947
+ find: /^react-dom$/,
948
+ replacement: "next/dist/compiled/react-dom"
949
+ },
950
+ {
951
+ find: /^react-dom\/server$/,
952
+ replacement: require6.resolve(
953
+ "next/dist/compiled/react-dom/server.browser.js"
954
+ )
955
+ },
956
+ {
957
+ find: /^react-dom\/test-utils$/,
958
+ replacement: require6.resolve(
959
+ "next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
960
+ )
961
+ },
962
+ {
963
+ find: /^react-dom\/client$/,
964
+ replacement: require6.resolve(
965
+ "next/dist/compiled/react-dom/client.js"
966
+ )
967
+ },
968
+ {
969
+ find: /^react-dom\/cjs\/react-dom\.development\.js$/,
970
+ replacement: require6.resolve(
971
+ "next/dist/compiled/react-dom/cjs/react-dom.development.js"
972
+ )
973
+ }
974
+ ]
945
975
  }
946
976
  },
947
977
  test: {
@@ -971,7 +1001,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
971
1001
  };
972
1002
  },
973
1003
  configResolved(config) {
974
- if (!config.test?.browser?.enabled) {
1004
+ if (isVitestEnv && !config.test?.browser?.enabled) {
975
1005
  config.test.setupFiles = [
976
1006
  require6.resolve("./mocks/storybook.global.js"),
977
1007
  ...config.test?.setupFiles ?? []
@@ -1,14 +1,14 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
 
3
- declare const revalidatePath: vitest.Mock<any, any>;
4
- declare const revalidateTag: vitest.Mock<any, any>;
5
- declare const unstable_cache: vitest.Mock<any, any>;
6
- declare const unstable_noStore: vitest.Mock<any, any>;
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>;
7
7
  declare const cacheExports: {
8
- unstable_cache: vitest.Mock<any, any>;
9
- revalidateTag: vitest.Mock<any, any>;
10
- revalidatePath: vitest.Mock<any, any>;
11
- unstable_noStore: vitest.Mock<any, any>;
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>;
12
12
  };
13
13
 
14
14
  export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
@@ -1,14 +1,14 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
 
3
- declare const revalidatePath: vitest.Mock<any, any>;
4
- declare const revalidateTag: vitest.Mock<any, any>;
5
- declare const unstable_cache: vitest.Mock<any, any>;
6
- declare const unstable_noStore: vitest.Mock<any, any>;
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>;
7
7
  declare const cacheExports: {
8
- unstable_cache: vitest.Mock<any, any>;
9
- revalidateTag: vitest.Mock<any, any>;
10
- revalidatePath: vitest.Mock<any, any>;
11
- unstable_noStore: vitest.Mock<any, any>;
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>;
12
12
  };
13
13
 
14
14
  export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
@@ -1,14 +1,14 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
  import * as next_dist_compiled__edge_runtime_cookies from 'next/dist/compiled/@edge-runtime/cookies';
3
3
  import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
4
4
 
5
5
  declare class RequestCookiesMock extends RequestCookies {
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[]>;
8
- has: vitest.Mock<[name: string], boolean>;
9
- set: vitest.Mock<[key: string, value: string] | [options: next_dist_compiled__edge_runtime_cookies.RequestCookie], this>;
10
- delete: vitest.Mock<[names: string | string[]], boolean | boolean[]>;
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[]>;
11
11
  }
12
- declare const cookies: vitest.Mock<[], RequestCookiesMock>;
12
+ declare const cookies: _storybook_test.Mock<[], RequestCookiesMock>;
13
13
 
14
14
  export { cookies };
@@ -1,14 +1,14 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
  import * as next_dist_compiled__edge_runtime_cookies from 'next/dist/compiled/@edge-runtime/cookies';
3
3
  import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies/index.js';
4
4
 
5
5
  declare class RequestCookiesMock extends RequestCookies {
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[]>;
8
- has: vitest.Mock<[name: string], boolean>;
9
- set: vitest.Mock<[key: string, value: string] | [options: next_dist_compiled__edge_runtime_cookies.RequestCookie], this>;
10
- delete: vitest.Mock<[names: string | string[]], boolean | boolean[]>;
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[]>;
11
11
  }
12
- declare const cookies: vitest.Mock<[], RequestCookiesMock>;
12
+ declare const cookies: _storybook_test.Mock<[], RequestCookiesMock>;
13
13
 
14
14
  export { cookies };
@@ -1,17 +1,17 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
  import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
3
3
 
4
4
  declare class HeadersAdapterMock extends HeadersAdapter {
5
5
  constructor();
6
- append: vitest.Mock<[name: string, value: string], void>;
7
- delete: vitest.Mock<[name: string], void>;
8
- get: vitest.Mock<[name: string], string | null>;
9
- has: vitest.Mock<[name: string], boolean>;
10
- set: vitest.Mock<[name: string, value: string], void>;
11
- forEach: vitest.Mock<[callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any], void>;
12
- entries: vitest.Mock<[], IterableIterator<[string, string]>>;
13
- keys: vitest.Mock<[], IterableIterator<string>>;
14
- values: vitest.Mock<[], IterableIterator<string>>;
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>>;
15
15
  }
16
16
  declare const headers: {
17
17
  (): HeadersAdapterMock;
@@ -1,17 +1,17 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
  import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
3
3
 
4
4
  declare class HeadersAdapterMock extends HeadersAdapter {
5
5
  constructor();
6
- append: vitest.Mock<[name: string, value: string], void>;
7
- delete: vitest.Mock<[name: string], void>;
8
- get: vitest.Mock<[name: string], string | null>;
9
- has: vitest.Mock<[name: string], boolean>;
10
- set: vitest.Mock<[name: string, value: string], void>;
11
- forEach: vitest.Mock<[callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any], void>;
12
- entries: vitest.Mock<[], IterableIterator<[string, string]>>;
13
- keys: vitest.Mock<[], IterableIterator<string>>;
14
- values: vitest.Mock<[], IterableIterator<string>>;
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>>;
15
15
  }
16
16
  declare const headers: {
17
17
  (): HeadersAdapterMock;
@@ -1,4 +1,4 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
  import * as next_dist_client_components_draft_mode from 'next/dist/client/components/draft-mode';
3
3
  export { headers } from './headers.cjs';
4
4
  export { cookies } from './cookies.cjs';
@@ -6,6 +6,6 @@ import 'next/dist/server/web/spec-extension/adapters/headers.js';
6
6
  import 'next/dist/compiled/@edge-runtime/cookies';
7
7
  import 'next/dist/compiled/@edge-runtime/cookies/index.js';
8
8
 
9
- declare const draftMode: vitest.Mock<[], next_dist_client_components_draft_mode.DraftMode>;
9
+ declare const draftMode: _storybook_test.Mock<[], next_dist_client_components_draft_mode.DraftMode>;
10
10
 
11
11
  export { draftMode };
@@ -1,4 +1,4 @@
1
- import * as vitest from 'vitest';
1
+ import * as _storybook_test from '@storybook/test';
2
2
  import * as next_dist_client_components_draft_mode from 'next/dist/client/components/draft-mode';
3
3
  export { headers } from './headers.js';
4
4
  export { cookies } from './cookies.js';
@@ -6,6 +6,6 @@ import 'next/dist/server/web/spec-extension/adapters/headers.js';
6
6
  import 'next/dist/compiled/@edge-runtime/cookies';
7
7
  import 'next/dist/compiled/@edge-runtime/cookies/index.js';
8
8
 
9
- declare const draftMode: vitest.Mock<[], next_dist_client_components_draft_mode.DraftMode>;
9
+ declare const draftMode: _storybook_test.Mock<[], next_dist_client_components_draft_mode.DraftMode>;
10
10
 
11
11
  export { draftMode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "1.0.10--canary.16.940d8d2.0",
3
+ "version": "1.0.11--canary.17.30fa28e.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",
@@ -79,7 +79,7 @@
79
79
  "tsup": "^8.1.0",
80
80
  "typescript": "^5.0.0",
81
81
  "vite": "^5.0.0",
82
- "vitest": "^1.6.0"
82
+ "vitest": "^2.0.5"
83
83
  },
84
84
  "packageManager": "pnpm@9.4.0",
85
85
  "dependencies": {
@@ -94,5 +94,10 @@
94
94
  },
95
95
  "publishConfig": {
96
96
  "access": "public"
97
+ },
98
+ "pnpm": {
99
+ "overrides": {
100
+ "vite-plugin-storybook-nextjs": "workspace:*"
101
+ }
97
102
  }
98
103
  }