vite-plugin-storybook-nextjs 1.0.2 → 1.0.4

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
@@ -17,6 +17,7 @@ var validateLocalFontFunctionCall_js = require('next/dist/compiled/@next/font/di
17
17
  var tsDedent = require('ts-dedent');
18
18
  var loadJsConfig = require('next/dist/build/load-jsconfig.js');
19
19
  var findPagesDir_js = require('next/dist/lib/find-pages-dir.js');
20
+ var vite = require('vite');
20
21
  var utils_js = require('next/dist/build/utils.js');
21
22
  var options_js = require('next/dist/build/swc/options.js');
22
23
  var loadConfig = require('next/dist/server/config.js');
@@ -39,12 +40,7 @@ var loadConfig__default = /*#__PURE__*/_interopDefault(loadConfig);
39
40
  var MagicString__default = /*#__PURE__*/_interopDefault(MagicString);
40
41
  var imageSizeOf__default = /*#__PURE__*/_interopDefault(imageSizeOf);
41
42
 
42
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
43
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
44
- }) : x)(function(x) {
45
- if (typeof require !== "undefined") return require.apply(this, arguments);
46
- throw Error('Dynamic require of "' + x + '" is not supported');
47
- });
43
+ // src/index.ts
48
44
  var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
49
45
  async function loadEnvironmentConfig(dir, dev) {
50
46
  return env.loadEnvConfig(dir, dev, Log__default.default);
@@ -654,7 +650,7 @@ var getVitestSWCTransformConfig = ({
654
650
  var isDefined = (value) => value !== void 0;
655
651
 
656
652
  // src/plugins/next-swc/plugin.ts
657
- var excluded = /[\\/](cache[\\/][^\\/]+\.zip[\\/]node_modules|virtual:)[\\/]/g;
653
+ var excluded = /[\\/]((cache[\\/][^\\/]+\.zip[\\/])|virtual:)[\\/]/;
658
654
  var included = /\.((c|m)?(j|t)sx?)$/;
659
655
  function vitePluginNextSwc(rootDir, nextConfigResolver) {
660
656
  let loadedJSConfig;
@@ -662,6 +658,7 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
662
658
  let isServerEnvironment;
663
659
  let isDev;
664
660
  let isEsmProject;
661
+ const filter = vite.createFilter(included, excluded);
665
662
  const resolvedDir = path.resolve(rootDir);
666
663
  return {
667
664
  name: "vite-plugin-storybook-nextjs-swc",
@@ -695,24 +692,25 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
695
692
  };
696
693
  },
697
694
  async transform(code, id) {
698
- if (!excluded.test(id) && included.test(id)) {
699
- const inputSourceMap = this.getCombinedSourcemap();
700
- const output = await index_js.transform(
701
- code,
702
- getVitestSWCTransformConfig({
703
- filename: id,
704
- inputSourceMap,
705
- isServerEnvironment,
706
- loadedJSConfig,
707
- nextConfig: await nextConfigResolver.promise,
708
- nextDirectories,
709
- rootDir,
710
- isDev,
711
- isEsmProject
712
- })
713
- );
714
- return output;
695
+ if (id.includes("/node_modules/") || !filter(id)) {
696
+ return;
715
697
  }
698
+ const inputSourceMap = this.getCombinedSourcemap();
699
+ const output = await index_js.transform(
700
+ code,
701
+ getVitestSWCTransformConfig({
702
+ filename: id,
703
+ inputSourceMap,
704
+ isServerEnvironment,
705
+ loadedJSConfig,
706
+ nextConfig: await nextConfigResolver.promise,
707
+ nextDirectories,
708
+ rootDir,
709
+ isDev,
710
+ isEsmProject
711
+ })
712
+ );
713
+ return output;
716
714
  }
717
715
  };
718
716
  }
@@ -755,9 +753,8 @@ var vitePluginNextDynamic = () => ({
755
753
  // src/utils.ts
756
754
  var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
757
755
  var isVitestEnv = process.env.VITEST === "true";
758
-
759
- // src/plugins/next-image/alias/index.tsx
760
- var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
756
+ var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
757
+ var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
761
758
  var getAlias = (env) => ({
762
759
  "sb-original/default-loader": getEntryPoint("image-default-loader", env),
763
760
  "sb-original/image-context": getEntryPoint("image-context", env)
@@ -770,9 +767,9 @@ var virtualImage = "virtual:next-image";
770
767
  var virtualNextImage = "virtual:next/image";
771
768
  var virtualNextLegacyImage = "virtual:next/legacy/image";
772
769
  var sharp;
773
- var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
770
+ var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
774
771
  try {
775
- sharp = require3("sharp");
772
+ sharp = require4("sharp");
776
773
  if (sharp && sharp.concurrency() > 1) {
777
774
  const divisor = process.env.NODE_ENV === "development" ? 4 : 2;
778
775
  sharp.concurrency(Math.floor(Math.max(os.cpus().length / divisor, 1)));
@@ -819,12 +816,12 @@ function vitePluginNextImage(nextConfigResolver) {
819
816
  const aliasEnv = isBrowser ? "browser" : "node";
820
817
  if (virtualNextImage === id) {
821
818
  return (await fs3__default.default.promises.readFile(
822
- require3.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
819
+ require4.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
823
820
  )).toString("utf-8");
824
821
  }
825
822
  if (virtualNextLegacyImage === id) {
826
823
  return (await fs3__default.default.promises.readFile(
827
- require3.resolve(
824
+ require4.resolve(
828
825
  `${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/legacy-image`
829
826
  )
830
827
  )).toString("utf-8");
@@ -872,8 +869,8 @@ function vitePluginNextImage(nextConfigResolver) {
872
869
  }
873
870
  };
874
871
  }
875
- var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
876
- var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
872
+ var require5 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
873
+ var getEntryPoint2 = (subPath, env) => require5.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
877
874
  var getAlias2 = (env) => ({
878
875
  "next/headers": getEntryPoint2("headers", env),
879
876
  "@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
@@ -901,7 +898,7 @@ var getAlias2 = (env) => ({
901
898
  "@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
902
899
  "@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint2("cache", env),
903
900
  "server-only": getEntryPoint2("server-only", env),
904
- "@opentelemetry/api": require4.resolve(
901
+ "@opentelemetry/api": require5.resolve(
905
902
  "next/dist/compiled/@opentelemetry/api"
906
903
  ),
907
904
  "next/dynamic": getEntryPoint2("dynamic", env)
@@ -919,7 +916,7 @@ var vitePluginNextMocks = () => ({
919
916
  });
920
917
 
921
918
  // src/index.ts
922
- var require5 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
919
+ var require6 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
923
920
  function VitePlugin({ dir = process.cwd() } = {}) {
924
921
  const resolvedDir = path.resolve(dir);
925
922
  const nextConfigResolver = Promise.withResolvers();
@@ -941,23 +938,23 @@ function VitePlugin({ dir = process.cwd() } = {}) {
941
938
  },
942
939
  test: {
943
940
  alias: {
944
- "react/jsx-dev-runtime": require5.resolve(
941
+ "react/jsx-dev-runtime": require6.resolve(
945
942
  "next/dist/compiled/react/jsx-dev-runtime.js"
946
943
  ),
947
- "react/jsx-runtime": require5.resolve(
944
+ "react/jsx-runtime": require6.resolve(
948
945
  "next/dist/compiled/react/jsx-runtime.js"
949
946
  ),
950
- react: require5.resolve("next/dist/compiled/react"),
951
- "react-dom/test-utils": require5.resolve(
947
+ react: require6.resolve("next/dist/compiled/react"),
948
+ "react-dom/test-utils": require6.resolve(
952
949
  "next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
953
950
  ),
954
- "react-dom/cjs/react-dom.development.js": require5.resolve(
951
+ "react-dom/cjs/react-dom.development.js": require6.resolve(
955
952
  "next/dist/compiled/react-dom/cjs/react-dom.development.js"
956
953
  ),
957
- "react-dom/client": require5.resolve(
954
+ "react-dom/client": require6.resolve(
958
955
  "next/dist/compiled/react-dom/client.js"
959
956
  ),
960
- "react-dom": require5.resolve("next/dist/compiled/react-dom")
957
+ "react-dom": require6.resolve("next/dist/compiled/react-dom")
961
958
  }
962
959
  }
963
960
  };
@@ -965,7 +962,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
965
962
  configResolved(config) {
966
963
  if (!config.test?.browser?.enabled) {
967
964
  config.test.setupFiles = [
968
- require5.resolve("./mocks/storybook.global.js"),
965
+ require6.resolve("./mocks/storybook.global.js"),
969
966
  ...config.test?.setupFiles ?? []
970
967
  ];
971
968
  }
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ import { validateLocalFontFunctionCall } from 'next/dist/compiled/@next/font/dis
15
15
  import { dedent } from 'ts-dedent';
16
16
  import loadJsConfig from 'next/dist/build/load-jsconfig.js';
17
17
  import { findPagesDir } from 'next/dist/lib/find-pages-dir.js';
18
+ import { createFilter } from 'vite';
18
19
  import { getSupportedBrowsers } from 'next/dist/build/utils.js';
19
20
  import { getParserOptions } from 'next/dist/build/swc/options.js';
20
21
  import loadConfig from 'next/dist/server/config.js';
@@ -24,12 +25,7 @@ import { cpus } from 'node:os';
24
25
  import { decode } from 'node:querystring';
25
26
  import imageSizeOf from 'image-size';
26
27
 
27
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
28
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
29
- }) : x)(function(x) {
30
- if (typeof require !== "undefined") return require.apply(this, arguments);
31
- throw Error('Dynamic require of "' + x + '" is not supported');
32
- });
28
+ // src/index.ts
33
29
  var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
34
30
  async function loadEnvironmentConfig(dir, dev) {
35
31
  return loadEnvConfig(dir, dev, Log);
@@ -639,7 +635,7 @@ var getVitestSWCTransformConfig = ({
639
635
  var isDefined = (value) => value !== void 0;
640
636
 
641
637
  // src/plugins/next-swc/plugin.ts
642
- var excluded = /[\\/](cache[\\/][^\\/]+\.zip[\\/]node_modules|virtual:)[\\/]/g;
638
+ var excluded = /[\\/]((cache[\\/][^\\/]+\.zip[\\/])|virtual:)[\\/]/;
643
639
  var included = /\.((c|m)?(j|t)sx?)$/;
644
640
  function vitePluginNextSwc(rootDir, nextConfigResolver) {
645
641
  let loadedJSConfig;
@@ -647,6 +643,7 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
647
643
  let isServerEnvironment;
648
644
  let isDev;
649
645
  let isEsmProject;
646
+ const filter = createFilter(included, excluded);
650
647
  const resolvedDir = resolve(rootDir);
651
648
  return {
652
649
  name: "vite-plugin-storybook-nextjs-swc",
@@ -680,24 +677,25 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
680
677
  };
681
678
  },
682
679
  async transform(code, id) {
683
- if (!excluded.test(id) && included.test(id)) {
684
- const inputSourceMap = this.getCombinedSourcemap();
685
- const output = await transform(
686
- code,
687
- getVitestSWCTransformConfig({
688
- filename: id,
689
- inputSourceMap,
690
- isServerEnvironment,
691
- loadedJSConfig,
692
- nextConfig: await nextConfigResolver.promise,
693
- nextDirectories,
694
- rootDir,
695
- isDev,
696
- isEsmProject
697
- })
698
- );
699
- return output;
680
+ if (id.includes("/node_modules/") || !filter(id)) {
681
+ return;
700
682
  }
683
+ const inputSourceMap = this.getCombinedSourcemap();
684
+ const output = await transform(
685
+ code,
686
+ getVitestSWCTransformConfig({
687
+ filename: id,
688
+ inputSourceMap,
689
+ isServerEnvironment,
690
+ loadedJSConfig,
691
+ nextConfig: await nextConfigResolver.promise,
692
+ nextDirectories,
693
+ rootDir,
694
+ isDev,
695
+ isEsmProject
696
+ })
697
+ );
698
+ return output;
701
699
  }
702
700
  };
703
701
  }
@@ -740,9 +738,8 @@ var vitePluginNextDynamic = () => ({
740
738
  // src/utils.ts
741
739
  var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
742
740
  var isVitestEnv = process.env.VITEST === "true";
743
-
744
- // src/plugins/next-image/alias/index.tsx
745
- var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
741
+ var require3 = createRequire(import.meta.url);
742
+ var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
746
743
  var getAlias = (env) => ({
747
744
  "sb-original/default-loader": getEntryPoint("image-default-loader", env),
748
745
  "sb-original/image-context": getEntryPoint("image-context", env)
@@ -755,9 +752,9 @@ var virtualImage = "virtual:next-image";
755
752
  var virtualNextImage = "virtual:next/image";
756
753
  var virtualNextLegacyImage = "virtual:next/legacy/image";
757
754
  var sharp;
758
- var require3 = createRequire(import.meta.url);
755
+ var require4 = createRequire(import.meta.url);
759
756
  try {
760
- sharp = require3("sharp");
757
+ sharp = require4("sharp");
761
758
  if (sharp && sharp.concurrency() > 1) {
762
759
  const divisor = process.env.NODE_ENV === "development" ? 4 : 2;
763
760
  sharp.concurrency(Math.floor(Math.max(cpus().length / divisor, 1)));
@@ -804,12 +801,12 @@ function vitePluginNextImage(nextConfigResolver) {
804
801
  const aliasEnv = isBrowser ? "browser" : "node";
805
802
  if (virtualNextImage === id) {
806
803
  return (await fs3.promises.readFile(
807
- require3.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
804
+ require4.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
808
805
  )).toString("utf-8");
809
806
  }
810
807
  if (virtualNextLegacyImage === id) {
811
808
  return (await fs3.promises.readFile(
812
- require3.resolve(
809
+ require4.resolve(
813
810
  `${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/legacy-image`
814
811
  )
815
812
  )).toString("utf-8");
@@ -857,8 +854,8 @@ function vitePluginNextImage(nextConfigResolver) {
857
854
  }
858
855
  };
859
856
  }
860
- var require4 = createRequire(import.meta.url);
861
- var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
857
+ var require5 = createRequire(import.meta.url);
858
+ var getEntryPoint2 = (subPath, env) => require5.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
862
859
  var getAlias2 = (env) => ({
863
860
  "next/headers": getEntryPoint2("headers", env),
864
861
  "@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
@@ -886,7 +883,7 @@ var getAlias2 = (env) => ({
886
883
  "@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
887
884
  "@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint2("cache", env),
888
885
  "server-only": getEntryPoint2("server-only", env),
889
- "@opentelemetry/api": require4.resolve(
886
+ "@opentelemetry/api": require5.resolve(
890
887
  "next/dist/compiled/@opentelemetry/api"
891
888
  ),
892
889
  "next/dynamic": getEntryPoint2("dynamic", env)
@@ -904,7 +901,7 @@ var vitePluginNextMocks = () => ({
904
901
  });
905
902
 
906
903
  // src/index.ts
907
- var require5 = createRequire(import.meta.url);
904
+ var require6 = createRequire(import.meta.url);
908
905
  function VitePlugin({ dir = process.cwd() } = {}) {
909
906
  const resolvedDir = resolve(dir);
910
907
  const nextConfigResolver = Promise.withResolvers();
@@ -926,23 +923,23 @@ function VitePlugin({ dir = process.cwd() } = {}) {
926
923
  },
927
924
  test: {
928
925
  alias: {
929
- "react/jsx-dev-runtime": require5.resolve(
926
+ "react/jsx-dev-runtime": require6.resolve(
930
927
  "next/dist/compiled/react/jsx-dev-runtime.js"
931
928
  ),
932
- "react/jsx-runtime": require5.resolve(
929
+ "react/jsx-runtime": require6.resolve(
933
930
  "next/dist/compiled/react/jsx-runtime.js"
934
931
  ),
935
- react: require5.resolve("next/dist/compiled/react"),
936
- "react-dom/test-utils": require5.resolve(
932
+ react: require6.resolve("next/dist/compiled/react"),
933
+ "react-dom/test-utils": require6.resolve(
937
934
  "next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
938
935
  ),
939
- "react-dom/cjs/react-dom.development.js": require5.resolve(
936
+ "react-dom/cjs/react-dom.development.js": require6.resolve(
940
937
  "next/dist/compiled/react-dom/cjs/react-dom.development.js"
941
938
  ),
942
- "react-dom/client": require5.resolve(
939
+ "react-dom/client": require6.resolve(
943
940
  "next/dist/compiled/react-dom/client.js"
944
941
  ),
945
- "react-dom": require5.resolve("next/dist/compiled/react-dom")
942
+ "react-dom": require6.resolve("next/dist/compiled/react-dom")
946
943
  }
947
944
  }
948
945
  };
@@ -950,7 +947,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
950
947
  configResolved(config) {
951
948
  if (!config.test?.browser?.enabled) {
952
949
  config.test.setupFiles = [
953
- require5.resolve("./mocks/storybook.global.js"),
950
+ require6.resolve("./mocks/storybook.global.js"),
954
951
  ...config.test?.setupFiles ?? []
955
952
  ];
956
953
  }
@@ -8,25 +8,21 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var moduleAlias__default = /*#__PURE__*/_interopDefault(moduleAlias);
10
10
 
11
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
12
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
13
- }) : x)(function(x) {
14
- if (typeof require !== "undefined") return require.apply(this, arguments);
15
- throw Error('Dynamic require of "' + x + '" is not supported');
16
- });
11
+ // src/mocks/storybook.global.ts
17
12
 
18
13
  // src/utils.ts
19
14
  var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
20
15
  process.env.VITEST === "true";
21
16
 
22
17
  // src/plugins/next-image/alias/index.tsx
23
- var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
18
+ var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
19
+ var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
24
20
  var getAlias = (env) => ({
25
21
  "sb-original/default-loader": getEntryPoint("image-default-loader", env),
26
22
  "sb-original/image-context": getEntryPoint("image-context", env)
27
23
  });
28
- var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
29
- var getEntryPoint2 = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
24
+ var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
25
+ var getEntryPoint2 = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
30
26
  var getAlias2 = (env) => ({
31
27
  "next/headers": getEntryPoint2("headers", env),
32
28
  "@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
@@ -54,17 +50,17 @@ var getAlias2 = (env) => ({
54
50
  "@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
55
51
  "@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint2("cache", env),
56
52
  "server-only": getEntryPoint2("server-only", env),
57
- "@opentelemetry/api": require2.resolve(
53
+ "@opentelemetry/api": require3.resolve(
58
54
  "next/dist/compiled/@opentelemetry/api"
59
55
  ),
60
56
  "next/dynamic": getEntryPoint2("dynamic", env)
61
57
  });
62
58
 
63
59
  // src/mocks/storybook.global.ts
64
- var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
60
+ var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
65
61
  moduleAlias__default.default.addAliases({
66
62
  react: "next/dist/compiled/react",
67
- "react-dom/test-utils": require3.resolve(
63
+ "react-dom/test-utils": require4.resolve(
68
64
  "next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
69
65
  ),
70
66
  "react-dom": "next/dist/compiled/react-dom",
@@ -1,25 +1,21 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import moduleAlias from 'module-alias';
3
3
 
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
4
+ // src/mocks/storybook.global.ts
10
5
 
11
6
  // src/utils.ts
12
7
  var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
13
8
  process.env.VITEST === "true";
14
9
 
15
10
  // src/plugins/next-image/alias/index.tsx
16
- var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
11
+ var require2 = createRequire(import.meta.url);
12
+ var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
17
13
  var getAlias = (env) => ({
18
14
  "sb-original/default-loader": getEntryPoint("image-default-loader", env),
19
15
  "sb-original/image-context": getEntryPoint("image-context", env)
20
16
  });
21
- var require2 = createRequire(import.meta.url);
22
- var getEntryPoint2 = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
17
+ var require3 = createRequire(import.meta.url);
18
+ var getEntryPoint2 = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
23
19
  var getAlias2 = (env) => ({
24
20
  "next/headers": getEntryPoint2("headers", env),
25
21
  "@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
@@ -47,17 +43,17 @@ var getAlias2 = (env) => ({
47
43
  "@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
48
44
  "@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint2("cache", env),
49
45
  "server-only": getEntryPoint2("server-only", env),
50
- "@opentelemetry/api": require2.resolve(
46
+ "@opentelemetry/api": require3.resolve(
51
47
  "next/dist/compiled/@opentelemetry/api"
52
48
  ),
53
49
  "next/dynamic": getEntryPoint2("dynamic", env)
54
50
  });
55
51
 
56
52
  // src/mocks/storybook.global.ts
57
- var require3 = createRequire(import.meta.url);
53
+ var require4 = createRequire(import.meta.url);
58
54
  moduleAlias.addAliases({
59
55
  react: "next/dist/compiled/react",
60
- "react-dom/test-utils": require3.resolve(
56
+ "react-dom/test-utils": require4.resolve(
61
57
  "next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
62
58
  ),
63
59
  "react-dom": "next/dist/compiled/react-dom",
@@ -2,7 +2,7 @@ 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" | "alt" | "width" | "height" | "loading"> & {
5
+ declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "height" | "width" | "loading" | "ref" | "alt" | "src" | "srcSet"> & {
6
6
  src: string | next_dist_shared_lib_get_img_props.StaticImport;
7
7
  alt: string;
8
8
  width?: number | `${number}` | undefined;
@@ -2,7 +2,7 @@ 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" | "alt" | "width" | "height" | "loading"> & {
5
+ declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "height" | "width" | "loading" | "ref" | "alt" | "src" | "srcSet"> & {
6
6
  src: string | next_dist_shared_lib_get_img_props.StaticImport;
7
7
  alt: string;
8
8
  width?: number | `${number}` | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",