vite-plugin-storybook-nextjs 3.0.0 → 3.0.1
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 +33 -28
- package/dist/index.js +34 -29
- package/dist/mocks/storybook.global.cjs +15 -19
- package/dist/mocks/storybook.global.js +14 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ var constants_js = require('next/dist/shared/lib/constants.js');
|
|
|
25
25
|
var MagicString = require('magic-string');
|
|
26
26
|
var querystring = require('querystring');
|
|
27
27
|
var imageSize = require('image-size');
|
|
28
|
+
var posix = require('path/posix');
|
|
28
29
|
|
|
29
30
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
30
31
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -2703,15 +2704,38 @@ var vitePluginNextDynamic = () => ({
|
|
|
2703
2704
|
return null;
|
|
2704
2705
|
}
|
|
2705
2706
|
});
|
|
2706
|
-
|
|
2707
|
-
// src/utils.ts
|
|
2707
|
+
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
2708
2708
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
2709
2709
|
var isVitestEnv = process.env.VITEST === "true";
|
|
2710
2710
|
function getExecutionEnvironment(config) {
|
|
2711
2711
|
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
2712
2712
|
}
|
|
2713
|
-
var
|
|
2714
|
-
var
|
|
2713
|
+
var getNextjsVersion = () => require3(scopedResolve("next/package.json")).version;
|
|
2714
|
+
var scopedResolve = (id) => {
|
|
2715
|
+
let scopedModulePath;
|
|
2716
|
+
try {
|
|
2717
|
+
scopedModulePath = require3.resolve(id, { paths: [posix.resolve()] });
|
|
2718
|
+
} catch (e) {
|
|
2719
|
+
scopedModulePath = require3.resolve(id);
|
|
2720
|
+
}
|
|
2721
|
+
const idWithNativePathSep = id.replace(/\//g, posix.sep);
|
|
2722
|
+
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
2723
|
+
return scopedModulePath;
|
|
2724
|
+
}
|
|
2725
|
+
const moduleFolderStrPosition = scopedModulePath.lastIndexOf(idWithNativePathSep);
|
|
2726
|
+
const beginningOfMainScriptPath = moduleFolderStrPosition + id.length;
|
|
2727
|
+
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
2728
|
+
};
|
|
2729
|
+
var getNextjsMajorVersion = () => {
|
|
2730
|
+
try {
|
|
2731
|
+
const version = getNextjsVersion();
|
|
2732
|
+
return Number.parseInt(version.split(".")[0], 10);
|
|
2733
|
+
} catch (error) {
|
|
2734
|
+
return 16;
|
|
2735
|
+
}
|
|
2736
|
+
};
|
|
2737
|
+
var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
2738
|
+
var getEntryPoint = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2715
2739
|
var getAlias = (env) => ({
|
|
2716
2740
|
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
2717
2741
|
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
@@ -2723,7 +2747,7 @@ var excludeImporterPattern = /\.(css|scss|sass)$/;
|
|
|
2723
2747
|
var virtualImage = "virtual:next-image";
|
|
2724
2748
|
var virtualNextImage = "virtual:next/image";
|
|
2725
2749
|
var virtualNextLegacyImage = "virtual:next/legacy/image";
|
|
2726
|
-
var
|
|
2750
|
+
var require5 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
2727
2751
|
function vitePluginNextImage(nextConfigResolver) {
|
|
2728
2752
|
let isBrowser = !isVitestEnv;
|
|
2729
2753
|
return {
|
|
@@ -2761,12 +2785,12 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2761
2785
|
const aliasEnv = isBrowser ? "browser" : "node";
|
|
2762
2786
|
if (virtualNextImage === id) {
|
|
2763
2787
|
return (await fs3__default.default.promises.readFile(
|
|
2764
|
-
|
|
2788
|
+
require5.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
|
|
2765
2789
|
)).toString("utf-8");
|
|
2766
2790
|
}
|
|
2767
2791
|
if (virtualNextLegacyImage === id) {
|
|
2768
2792
|
return (await fs3__default.default.promises.readFile(
|
|
2769
|
-
|
|
2793
|
+
require5.resolve(
|
|
2770
2794
|
`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/legacy-image`
|
|
2771
2795
|
)
|
|
2772
2796
|
)).toString("utf-8");
|
|
@@ -2805,25 +2829,6 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2805
2829
|
|
|
2806
2830
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2807
2831
|
var import_semver = __toESM(require_semver2());
|
|
2808
|
-
var require5 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
2809
|
-
var getNextjsVersion = () => require5(scopedResolve("next/package.json")).version;
|
|
2810
|
-
var scopedResolve = (id) => {
|
|
2811
|
-
let scopedModulePath;
|
|
2812
|
-
try {
|
|
2813
|
-
scopedModulePath = require5.resolve(id, { paths: [path2.resolve()] });
|
|
2814
|
-
} catch (e) {
|
|
2815
|
-
scopedModulePath = require5.resolve(id);
|
|
2816
|
-
}
|
|
2817
|
-
const idWithNativePathSep = id.replace(/\//g, path2.sep);
|
|
2818
|
-
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
2819
|
-
return scopedModulePath;
|
|
2820
|
-
}
|
|
2821
|
-
const moduleFolderStrPosition = scopedModulePath.lastIndexOf(idWithNativePathSep);
|
|
2822
|
-
const beginningOfMainScriptPath = moduleFolderStrPosition + id.length;
|
|
2823
|
-
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
2824
|
-
};
|
|
2825
|
-
|
|
2826
|
-
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2827
2832
|
var require6 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
2828
2833
|
var getEntryPoint2 = (subPath, env) => require6.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2829
2834
|
var mapping = (env) => ({
|
|
@@ -2922,6 +2927,7 @@ function VitePlugin({
|
|
|
2922
2927
|
enforce: "pre",
|
|
2923
2928
|
async config(config, env) {
|
|
2924
2929
|
const phase = env.mode === "development" ? constants_js.PHASE_DEVELOPMENT_SERVER : env.mode === "test" ? constants_js.PHASE_TEST : constants_js.PHASE_PRODUCTION_BUILD;
|
|
2930
|
+
const isNext16orNewer = getNextjsMajorVersion() >= 16;
|
|
2925
2931
|
nextConfigResolver.resolve(await loadConfig(phase, resolvedDir));
|
|
2926
2932
|
const executionEnvironment = getExecutionEnvironment(config);
|
|
2927
2933
|
return {
|
|
@@ -2984,7 +2990,6 @@ function VitePlugin({
|
|
|
2984
2990
|
"next/dist/client/components/redirect-boundary",
|
|
2985
2991
|
"next/dist/client/head-manager",
|
|
2986
2992
|
"next/dist/client/components/is-next-router-error",
|
|
2987
|
-
"next/config",
|
|
2988
2993
|
"next/dist/shared/lib/segment",
|
|
2989
2994
|
"styled-jsx",
|
|
2990
2995
|
"styled-jsx/style",
|
|
@@ -2998,7 +3003,7 @@ function VitePlugin({
|
|
|
2998
3003
|
// Refer to this pnpm issue for more details:
|
|
2999
3004
|
// https://github.com/vitejs/vite/issues/16293
|
|
3000
3005
|
"next > styled-jsx/style"
|
|
3001
|
-
]
|
|
3006
|
+
].concat(!isNext16orNewer ? ["next/config"] : [])
|
|
3002
3007
|
},
|
|
3003
3008
|
test: {
|
|
3004
3009
|
alias: {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path2, { resolve, join
|
|
1
|
+
import path2, { resolve, join } from 'path';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
4
4
|
import fs3 from 'fs';
|
|
@@ -23,6 +23,7 @@ import { PHASE_DEVELOPMENT_SERVER, PHASE_TEST, PHASE_PRODUCTION_BUILD } from 'ne
|
|
|
23
23
|
import MagicString from 'magic-string';
|
|
24
24
|
import { decode } from 'querystring';
|
|
25
25
|
import { imageSize } from 'image-size';
|
|
26
|
+
import { resolve as resolve$1, sep } from 'path/posix';
|
|
26
27
|
|
|
27
28
|
var __create = Object.create;
|
|
28
29
|
var __defProp = Object.defineProperty;
|
|
@@ -2669,15 +2670,38 @@ var vitePluginNextDynamic = () => ({
|
|
|
2669
2670
|
return null;
|
|
2670
2671
|
}
|
|
2671
2672
|
});
|
|
2672
|
-
|
|
2673
|
-
// src/utils.ts
|
|
2673
|
+
var require3 = createRequire(import.meta.url);
|
|
2674
2674
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
2675
2675
|
var isVitestEnv = process.env.VITEST === "true";
|
|
2676
2676
|
function getExecutionEnvironment(config) {
|
|
2677
2677
|
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
2678
2678
|
}
|
|
2679
|
-
var
|
|
2680
|
-
var
|
|
2679
|
+
var getNextjsVersion = () => require3(scopedResolve("next/package.json")).version;
|
|
2680
|
+
var scopedResolve = (id) => {
|
|
2681
|
+
let scopedModulePath;
|
|
2682
|
+
try {
|
|
2683
|
+
scopedModulePath = require3.resolve(id, { paths: [resolve$1()] });
|
|
2684
|
+
} catch (e) {
|
|
2685
|
+
scopedModulePath = require3.resolve(id);
|
|
2686
|
+
}
|
|
2687
|
+
const idWithNativePathSep = id.replace(/\//g, sep);
|
|
2688
|
+
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
2689
|
+
return scopedModulePath;
|
|
2690
|
+
}
|
|
2691
|
+
const moduleFolderStrPosition = scopedModulePath.lastIndexOf(idWithNativePathSep);
|
|
2692
|
+
const beginningOfMainScriptPath = moduleFolderStrPosition + id.length;
|
|
2693
|
+
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
2694
|
+
};
|
|
2695
|
+
var getNextjsMajorVersion = () => {
|
|
2696
|
+
try {
|
|
2697
|
+
const version = getNextjsVersion();
|
|
2698
|
+
return Number.parseInt(version.split(".")[0], 10);
|
|
2699
|
+
} catch (error) {
|
|
2700
|
+
return 16;
|
|
2701
|
+
}
|
|
2702
|
+
};
|
|
2703
|
+
var require4 = createRequire(import.meta.url);
|
|
2704
|
+
var getEntryPoint = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2681
2705
|
var getAlias = (env) => ({
|
|
2682
2706
|
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
2683
2707
|
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
@@ -2689,7 +2713,7 @@ var excludeImporterPattern = /\.(css|scss|sass)$/;
|
|
|
2689
2713
|
var virtualImage = "virtual:next-image";
|
|
2690
2714
|
var virtualNextImage = "virtual:next/image";
|
|
2691
2715
|
var virtualNextLegacyImage = "virtual:next/legacy/image";
|
|
2692
|
-
var
|
|
2716
|
+
var require5 = createRequire(import.meta.url);
|
|
2693
2717
|
function vitePluginNextImage(nextConfigResolver) {
|
|
2694
2718
|
let isBrowser = !isVitestEnv;
|
|
2695
2719
|
return {
|
|
@@ -2727,12 +2751,12 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2727
2751
|
const aliasEnv = isBrowser ? "browser" : "node";
|
|
2728
2752
|
if (virtualNextImage === id) {
|
|
2729
2753
|
return (await fs3.promises.readFile(
|
|
2730
|
-
|
|
2754
|
+
require5.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
|
|
2731
2755
|
)).toString("utf-8");
|
|
2732
2756
|
}
|
|
2733
2757
|
if (virtualNextLegacyImage === id) {
|
|
2734
2758
|
return (await fs3.promises.readFile(
|
|
2735
|
-
|
|
2759
|
+
require5.resolve(
|
|
2736
2760
|
`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/legacy-image`
|
|
2737
2761
|
)
|
|
2738
2762
|
)).toString("utf-8");
|
|
@@ -2771,25 +2795,6 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2771
2795
|
|
|
2772
2796
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2773
2797
|
var import_semver = __toESM(require_semver2());
|
|
2774
|
-
var require5 = createRequire(import.meta.url);
|
|
2775
|
-
var getNextjsVersion = () => require5(scopedResolve("next/package.json")).version;
|
|
2776
|
-
var scopedResolve = (id) => {
|
|
2777
|
-
let scopedModulePath;
|
|
2778
|
-
try {
|
|
2779
|
-
scopedModulePath = require5.resolve(id, { paths: [resolve()] });
|
|
2780
|
-
} catch (e) {
|
|
2781
|
-
scopedModulePath = require5.resolve(id);
|
|
2782
|
-
}
|
|
2783
|
-
const idWithNativePathSep = id.replace(/\//g, sep);
|
|
2784
|
-
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
2785
|
-
return scopedModulePath;
|
|
2786
|
-
}
|
|
2787
|
-
const moduleFolderStrPosition = scopedModulePath.lastIndexOf(idWithNativePathSep);
|
|
2788
|
-
const beginningOfMainScriptPath = moduleFolderStrPosition + id.length;
|
|
2789
|
-
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
2790
|
-
};
|
|
2791
|
-
|
|
2792
|
-
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2793
2798
|
var require6 = createRequire(import.meta.url);
|
|
2794
2799
|
var getEntryPoint2 = (subPath, env) => require6.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2795
2800
|
var mapping = (env) => ({
|
|
@@ -2888,6 +2893,7 @@ function VitePlugin({
|
|
|
2888
2893
|
enforce: "pre",
|
|
2889
2894
|
async config(config, env) {
|
|
2890
2895
|
const phase = env.mode === "development" ? PHASE_DEVELOPMENT_SERVER : env.mode === "test" ? PHASE_TEST : PHASE_PRODUCTION_BUILD;
|
|
2896
|
+
const isNext16orNewer = getNextjsMajorVersion() >= 16;
|
|
2891
2897
|
nextConfigResolver.resolve(await loadConfig(phase, resolvedDir));
|
|
2892
2898
|
const executionEnvironment = getExecutionEnvironment(config);
|
|
2893
2899
|
return {
|
|
@@ -2950,7 +2956,6 @@ function VitePlugin({
|
|
|
2950
2956
|
"next/dist/client/components/redirect-boundary",
|
|
2951
2957
|
"next/dist/client/head-manager",
|
|
2952
2958
|
"next/dist/client/components/is-next-router-error",
|
|
2953
|
-
"next/config",
|
|
2954
2959
|
"next/dist/shared/lib/segment",
|
|
2955
2960
|
"styled-jsx",
|
|
2956
2961
|
"styled-jsx/style",
|
|
@@ -2964,7 +2969,7 @@ function VitePlugin({
|
|
|
2964
2969
|
// Refer to this pnpm issue for more details:
|
|
2965
2970
|
// https://github.com/vitejs/vite/issues/16293
|
|
2966
2971
|
"next > styled-jsx/style"
|
|
2967
|
-
]
|
|
2972
|
+
].concat(!isNext16orNewer ? ["next/config"] : [])
|
|
2968
2973
|
},
|
|
2969
2974
|
test: {
|
|
2970
2975
|
alias: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
4
|
var moduleAlias = require('module-alias');
|
|
5
|
-
var
|
|
5
|
+
var posix = require('path/posix');
|
|
6
6
|
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1919,31 +1919,18 @@ var require_semver2 = __commonJS({
|
|
|
1919
1919
|
};
|
|
1920
1920
|
}
|
|
1921
1921
|
});
|
|
1922
|
-
|
|
1923
|
-
// src/utils.ts
|
|
1922
|
+
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('storybook.global.cjs', document.baseURI).href)));
|
|
1924
1923
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
1925
1924
|
process.env.VITEST === "true";
|
|
1926
|
-
|
|
1927
|
-
// src/plugins/next-image/alias/index.tsx
|
|
1928
|
-
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('storybook.global.cjs', document.baseURI).href)));
|
|
1929
|
-
var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1930
|
-
var getAlias = (env) => ({
|
|
1931
|
-
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
1932
|
-
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
1933
|
-
});
|
|
1934
|
-
|
|
1935
|
-
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1936
|
-
var import_semver = __toESM(require_semver2());
|
|
1937
|
-
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('storybook.global.cjs', document.baseURI).href)));
|
|
1938
|
-
var getNextjsVersion = () => require3(scopedResolve("next/package.json")).version;
|
|
1925
|
+
var getNextjsVersion = () => require2(scopedResolve("next/package.json")).version;
|
|
1939
1926
|
var scopedResolve = (id) => {
|
|
1940
1927
|
let scopedModulePath;
|
|
1941
1928
|
try {
|
|
1942
|
-
scopedModulePath =
|
|
1929
|
+
scopedModulePath = require2.resolve(id, { paths: [posix.resolve()] });
|
|
1943
1930
|
} catch (e) {
|
|
1944
|
-
scopedModulePath =
|
|
1931
|
+
scopedModulePath = require2.resolve(id);
|
|
1945
1932
|
}
|
|
1946
|
-
const idWithNativePathSep = id.replace(/\//g,
|
|
1933
|
+
const idWithNativePathSep = id.replace(/\//g, posix.sep);
|
|
1947
1934
|
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
1948
1935
|
return scopedModulePath;
|
|
1949
1936
|
}
|
|
@@ -1952,7 +1939,16 @@ var scopedResolve = (id) => {
|
|
|
1952
1939
|
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
1953
1940
|
};
|
|
1954
1941
|
|
|
1942
|
+
// src/plugins/next-image/alias/index.tsx
|
|
1943
|
+
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('storybook.global.cjs', document.baseURI).href)));
|
|
1944
|
+
var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1945
|
+
var getAlias = (env) => ({
|
|
1946
|
+
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
1947
|
+
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
1948
|
+
});
|
|
1949
|
+
|
|
1955
1950
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1951
|
+
var import_semver = __toESM(require_semver2());
|
|
1956
1952
|
var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('storybook.global.cjs', document.baseURI).href)));
|
|
1957
1953
|
var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1958
1954
|
var mapping = (env) => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import moduleAlias from 'module-alias';
|
|
3
|
-
import { resolve, sep } from 'path';
|
|
3
|
+
import { resolve, sep } from 'path/posix';
|
|
4
4
|
|
|
5
5
|
var __create = Object.create;
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
@@ -1912,29 +1912,16 @@ var require_semver2 = __commonJS({
|
|
|
1912
1912
|
};
|
|
1913
1913
|
}
|
|
1914
1914
|
});
|
|
1915
|
-
|
|
1916
|
-
// src/utils.ts
|
|
1915
|
+
var require2 = createRequire(import.meta.url);
|
|
1917
1916
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
1918
1917
|
process.env.VITEST === "true";
|
|
1919
|
-
|
|
1920
|
-
// src/plugins/next-image/alias/index.tsx
|
|
1921
|
-
var require2 = createRequire(import.meta.url);
|
|
1922
|
-
var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1923
|
-
var getAlias = (env) => ({
|
|
1924
|
-
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
1925
|
-
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
1926
|
-
});
|
|
1927
|
-
|
|
1928
|
-
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1929
|
-
var import_semver = __toESM(require_semver2());
|
|
1930
|
-
var require3 = createRequire(import.meta.url);
|
|
1931
|
-
var getNextjsVersion = () => require3(scopedResolve("next/package.json")).version;
|
|
1918
|
+
var getNextjsVersion = () => require2(scopedResolve("next/package.json")).version;
|
|
1932
1919
|
var scopedResolve = (id) => {
|
|
1933
1920
|
let scopedModulePath;
|
|
1934
1921
|
try {
|
|
1935
|
-
scopedModulePath =
|
|
1922
|
+
scopedModulePath = require2.resolve(id, { paths: [resolve()] });
|
|
1936
1923
|
} catch (e) {
|
|
1937
|
-
scopedModulePath =
|
|
1924
|
+
scopedModulePath = require2.resolve(id);
|
|
1938
1925
|
}
|
|
1939
1926
|
const idWithNativePathSep = id.replace(/\//g, sep);
|
|
1940
1927
|
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
@@ -1945,7 +1932,16 @@ var scopedResolve = (id) => {
|
|
|
1945
1932
|
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
1946
1933
|
};
|
|
1947
1934
|
|
|
1935
|
+
// src/plugins/next-image/alias/index.tsx
|
|
1936
|
+
var require3 = createRequire(import.meta.url);
|
|
1937
|
+
var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1938
|
+
var getAlias = (env) => ({
|
|
1939
|
+
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
1940
|
+
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
1941
|
+
});
|
|
1942
|
+
|
|
1948
1943
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1944
|
+
var import_semver = __toESM(require_semver2());
|
|
1949
1945
|
var require4 = createRequire(import.meta.url);
|
|
1950
1946
|
var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1951
1947
|
var mapping = (env) => ({
|