vite-plugin-storybook-nextjs 2.0.2--canary.41.5d54947.0 → 2.0.3--canary.73dddc3.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
@@ -2870,7 +2870,10 @@ var loadConfig = (
2870
2870
  // biome-ignore lint/suspicious/noExplicitAny: CJS support
2871
2871
  nextServerConfig__default.default.default || nextServerConfig__default.default
2872
2872
  );
2873
- function VitePlugin({ dir = process.cwd() } = {}) {
2873
+ function VitePlugin({
2874
+ dir = process.cwd(),
2875
+ forceAliasInTest = process.env.STORYBOOK_FORCE_ALIAS_IN_TEST === "true"
2876
+ } = {}) {
2874
2877
  const resolvedDir = path2.resolve(dir);
2875
2878
  const nextConfigResolver = Promise.withResolvers();
2876
2879
  return [
@@ -2883,7 +2886,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
2883
2886
  nextConfigResolver.resolve(await loadConfig(phase, resolvedDir));
2884
2887
  const executionEnvironment = getExecutionEnvironment(config);
2885
2888
  return {
2886
- ...!isVitestEnv && {
2889
+ ...(forceAliasInTest || !isVitestEnv) && {
2887
2890
  resolve: {
2888
2891
  alias: [
2889
2892
  {
package/dist/index.d.cts CHANGED
@@ -6,7 +6,12 @@ type VitePluginOptions = {
6
6
  * @default process.cwd()
7
7
  */
8
8
  dir?: string;
9
+ /**
10
+ * Force alias in test environment
11
+ * @default false
12
+ */
13
+ forceAliasInTest?: boolean;
9
14
  };
10
- declare function VitePlugin({ dir }?: VitePluginOptions): Plugin[];
15
+ declare function VitePlugin({ dir, forceAliasInTest, }?: VitePluginOptions): Plugin[];
11
16
 
12
17
  export { VitePlugin as default };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,12 @@ type VitePluginOptions = {
6
6
  * @default process.cwd()
7
7
  */
8
8
  dir?: string;
9
+ /**
10
+ * Force alias in test environment
11
+ * @default false
12
+ */
13
+ forceAliasInTest?: boolean;
9
14
  };
10
- declare function VitePlugin({ dir }?: VitePluginOptions): Plugin[];
15
+ declare function VitePlugin({ dir, forceAliasInTest, }?: VitePluginOptions): Plugin[];
11
16
 
12
17
  export { VitePlugin as default };
package/dist/index.js CHANGED
@@ -2836,7 +2836,10 @@ var loadConfig = (
2836
2836
  // biome-ignore lint/suspicious/noExplicitAny: CJS support
2837
2837
  nextServerConfig.default || nextServerConfig
2838
2838
  );
2839
- function VitePlugin({ dir = process.cwd() } = {}) {
2839
+ function VitePlugin({
2840
+ dir = process.cwd(),
2841
+ forceAliasInTest = process.env.STORYBOOK_FORCE_ALIAS_IN_TEST === "true"
2842
+ } = {}) {
2840
2843
  const resolvedDir = resolve(dir);
2841
2844
  const nextConfigResolver = Promise.withResolvers();
2842
2845
  return [
@@ -2849,7 +2852,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
2849
2852
  nextConfigResolver.resolve(await loadConfig(phase, resolvedDir));
2850
2853
  const executionEnvironment = getExecutionEnvironment(config);
2851
2854
  return {
2852
- ...!isVitestEnv && {
2855
+ ...(forceAliasInTest || !isVitestEnv) && {
2853
2856
  resolve: {
2854
2857
  alias: [
2855
2858
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "2.0.2--canary.41.5d54947.0",
3
+ "version": "2.0.3--canary.73dddc3.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",