vite-plugin-storybook-nextjs 1.1.0--canary.27.65f1124.0 → 1.1.0--canary.27.ea73e5f.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 +48 -43
- package/dist/index.js +48 -43
- package/dist/mocks/storybook.global.cjs +34 -29
- package/dist/mocks/storybook.global.js +34 -29
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -2794,59 +2794,64 @@ var scopedResolve = (id) => {
|
|
|
2794
2794
|
};
|
|
2795
2795
|
|
|
2796
2796
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2797
|
-
var
|
|
2797
|
+
var require6 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
2798
|
+
var getEntryPoint2 = (subPath, env) => require6.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2799
|
+
var mapping = (env) => ({
|
|
2798
2800
|
"<15.0.0": {
|
|
2799
2801
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
2800
2802
|
// this path only exists from Next 15 onwards
|
|
2801
|
-
"next/dist/server/request/draft-mode":
|
|
2803
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
2804
|
+
"draft-mode.compat",
|
|
2805
|
+
env
|
|
2806
|
+
)
|
|
2802
2807
|
}
|
|
2803
|
-
};
|
|
2804
|
-
var getCompatibilityAliases = () => {
|
|
2808
|
+
});
|
|
2809
|
+
var getCompatibilityAliases = (env) => {
|
|
2805
2810
|
const version = getNextjsVersion();
|
|
2806
2811
|
const result = {};
|
|
2807
2812
|
Object.keys(mapping).forEach((key) => {
|
|
2808
2813
|
if (import_semver.default.intersects(version, key)) {
|
|
2809
|
-
Object.assign(result, mapping[key]);
|
|
2814
|
+
Object.assign(result, mapping(env)[key]);
|
|
2810
2815
|
}
|
|
2811
2816
|
});
|
|
2812
2817
|
return result;
|
|
2813
2818
|
};
|
|
2814
2819
|
|
|
2815
2820
|
// src/plugins/next-mocks/plugin.ts
|
|
2816
|
-
var
|
|
2817
|
-
var
|
|
2821
|
+
var require7 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
2822
|
+
var getEntryPoint3 = (subPath, env) => require7.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2818
2823
|
var getAlias2 = (env) => ({
|
|
2819
|
-
"next/headers":
|
|
2820
|
-
"@storybook/nextjs/headers.mock":
|
|
2821
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
2822
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
2824
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
2825
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
2826
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
2827
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
2823
2828
|
"headers",
|
|
2824
2829
|
env
|
|
2825
2830
|
),
|
|
2826
|
-
"next/navigation":
|
|
2827
|
-
"@storybook/nextjs/navigation.mock":
|
|
2828
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
2829
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
2831
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
2832
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
2833
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
2834
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
2830
2835
|
"navigation",
|
|
2831
2836
|
env
|
|
2832
2837
|
),
|
|
2833
|
-
"next/router":
|
|
2834
|
-
"@storybook/nextjs/router.mock":
|
|
2835
|
-
"@storybook/nextjs-vite/router.mock":
|
|
2836
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
2838
|
+
"next/router": getEntryPoint3("router", env),
|
|
2839
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
2840
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
2841
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
2837
2842
|
"router",
|
|
2838
2843
|
env
|
|
2839
2844
|
),
|
|
2840
|
-
"next/cache":
|
|
2841
|
-
"@storybook/nextjs/cache.mock":
|
|
2842
|
-
"@storybook/nextjs-vite/cache.mock":
|
|
2843
|
-
"@storybook/experimental-nextjs-vite/cache.mock":
|
|
2844
|
-
"server-only":
|
|
2845
|
-
"@opentelemetry/api":
|
|
2845
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
2846
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
2847
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2848
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2849
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
2850
|
+
"@opentelemetry/api": require7.resolve(
|
|
2846
2851
|
"next/dist/compiled/@opentelemetry/api"
|
|
2847
2852
|
),
|
|
2848
|
-
"next/dynamic":
|
|
2849
|
-
...getCompatibilityAliases()
|
|
2853
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
2854
|
+
...getCompatibilityAliases(env)
|
|
2850
2855
|
});
|
|
2851
2856
|
var vitePluginNextMocks = () => ({
|
|
2852
2857
|
name: "vite-plugin-next-mocks",
|
|
@@ -2861,7 +2866,7 @@ var vitePluginNextMocks = () => ({
|
|
|
2861
2866
|
});
|
|
2862
2867
|
|
|
2863
2868
|
// src/index.ts
|
|
2864
|
-
var
|
|
2869
|
+
var require8 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
2865
2870
|
var loadConfig = (
|
|
2866
2871
|
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
2867
2872
|
nextServerConfig__default.default.default || nextServerConfig__default.default
|
|
@@ -2883,33 +2888,33 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2883
2888
|
alias: [
|
|
2884
2889
|
{
|
|
2885
2890
|
find: /^react$/,
|
|
2886
|
-
replacement:
|
|
2891
|
+
replacement: require8.resolve("next/dist/compiled/react")
|
|
2887
2892
|
},
|
|
2888
2893
|
{
|
|
2889
2894
|
find: /^react-dom$/,
|
|
2890
|
-
replacement:
|
|
2895
|
+
replacement: require8.resolve("next/dist/compiled/react-dom")
|
|
2891
2896
|
},
|
|
2892
2897
|
{
|
|
2893
2898
|
find: /^react-dom\/server$/,
|
|
2894
|
-
replacement:
|
|
2899
|
+
replacement: require8.resolve(
|
|
2895
2900
|
"next/dist/compiled/react-dom/server.browser.js"
|
|
2896
2901
|
)
|
|
2897
2902
|
},
|
|
2898
2903
|
{
|
|
2899
2904
|
find: /^react-dom\/test-utils$/,
|
|
2900
|
-
replacement:
|
|
2905
|
+
replacement: require8.resolve(
|
|
2901
2906
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2902
2907
|
)
|
|
2903
2908
|
},
|
|
2904
2909
|
{
|
|
2905
2910
|
find: /^react-dom\/client$/,
|
|
2906
|
-
replacement:
|
|
2911
|
+
replacement: require8.resolve(
|
|
2907
2912
|
"next/dist/compiled/react-dom/client.js"
|
|
2908
2913
|
)
|
|
2909
2914
|
},
|
|
2910
2915
|
{
|
|
2911
2916
|
find: /^react-dom\/cjs\/react-dom\.development\.js$/,
|
|
2912
|
-
replacement:
|
|
2917
|
+
replacement: require8.resolve(
|
|
2913
2918
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2914
2919
|
)
|
|
2915
2920
|
}
|
|
@@ -2929,26 +2934,26 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2929
2934
|
},
|
|
2930
2935
|
test: {
|
|
2931
2936
|
alias: {
|
|
2932
|
-
"react/jsx-dev-runtime":
|
|
2937
|
+
"react/jsx-dev-runtime": require8.resolve(
|
|
2933
2938
|
"next/dist/compiled/react/jsx-dev-runtime.js"
|
|
2934
2939
|
),
|
|
2935
|
-
"react/jsx-runtime":
|
|
2940
|
+
"react/jsx-runtime": require8.resolve(
|
|
2936
2941
|
"next/dist/compiled/react/jsx-runtime.js"
|
|
2937
2942
|
),
|
|
2938
|
-
react:
|
|
2939
|
-
"react-dom/server":
|
|
2943
|
+
react: require8.resolve("next/dist/compiled/react"),
|
|
2944
|
+
"react-dom/server": require8.resolve(
|
|
2940
2945
|
executionEnvironment === "node" ? "next/dist/compiled/react-dom/server.js" : "next/dist/compiled/react-dom/server.browser.js"
|
|
2941
2946
|
),
|
|
2942
|
-
"react-dom/test-utils":
|
|
2947
|
+
"react-dom/test-utils": require8.resolve(
|
|
2943
2948
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2944
2949
|
),
|
|
2945
|
-
"react-dom/cjs/react-dom.development.js":
|
|
2950
|
+
"react-dom/cjs/react-dom.development.js": require8.resolve(
|
|
2946
2951
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2947
2952
|
),
|
|
2948
|
-
"react-dom/client":
|
|
2953
|
+
"react-dom/client": require8.resolve(
|
|
2949
2954
|
"next/dist/compiled/react-dom/client.js"
|
|
2950
2955
|
),
|
|
2951
|
-
"react-dom":
|
|
2956
|
+
"react-dom": require8.resolve("next/dist/compiled/react-dom")
|
|
2952
2957
|
}
|
|
2953
2958
|
}
|
|
2954
2959
|
};
|
|
@@ -2956,7 +2961,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2956
2961
|
configResolved(config) {
|
|
2957
2962
|
if (isVitestEnv && !config.test?.browser?.enabled) {
|
|
2958
2963
|
config.test.setupFiles = [
|
|
2959
|
-
|
|
2964
|
+
require8.resolve("./mocks/storybook.global.js"),
|
|
2960
2965
|
...config.test?.setupFiles ?? []
|
|
2961
2966
|
];
|
|
2962
2967
|
}
|
package/dist/index.js
CHANGED
|
@@ -2760,59 +2760,64 @@ var scopedResolve = (id) => {
|
|
|
2760
2760
|
};
|
|
2761
2761
|
|
|
2762
2762
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2763
|
-
var
|
|
2763
|
+
var require6 = createRequire(import.meta.url);
|
|
2764
|
+
var getEntryPoint2 = (subPath, env) => require6.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2765
|
+
var mapping = (env) => ({
|
|
2764
2766
|
"<15.0.0": {
|
|
2765
2767
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
2766
2768
|
// this path only exists from Next 15 onwards
|
|
2767
|
-
"next/dist/server/request/draft-mode":
|
|
2769
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
2770
|
+
"draft-mode.compat",
|
|
2771
|
+
env
|
|
2772
|
+
)
|
|
2768
2773
|
}
|
|
2769
|
-
};
|
|
2770
|
-
var getCompatibilityAliases = () => {
|
|
2774
|
+
});
|
|
2775
|
+
var getCompatibilityAliases = (env) => {
|
|
2771
2776
|
const version = getNextjsVersion();
|
|
2772
2777
|
const result = {};
|
|
2773
2778
|
Object.keys(mapping).forEach((key) => {
|
|
2774
2779
|
if (import_semver.default.intersects(version, key)) {
|
|
2775
|
-
Object.assign(result, mapping[key]);
|
|
2780
|
+
Object.assign(result, mapping(env)[key]);
|
|
2776
2781
|
}
|
|
2777
2782
|
});
|
|
2778
2783
|
return result;
|
|
2779
2784
|
};
|
|
2780
2785
|
|
|
2781
2786
|
// src/plugins/next-mocks/plugin.ts
|
|
2782
|
-
var
|
|
2783
|
-
var
|
|
2787
|
+
var require7 = createRequire(import.meta.url);
|
|
2788
|
+
var getEntryPoint3 = (subPath, env) => require7.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2784
2789
|
var getAlias2 = (env) => ({
|
|
2785
|
-
"next/headers":
|
|
2786
|
-
"@storybook/nextjs/headers.mock":
|
|
2787
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
2788
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
2790
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
2791
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
2792
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
2793
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
2789
2794
|
"headers",
|
|
2790
2795
|
env
|
|
2791
2796
|
),
|
|
2792
|
-
"next/navigation":
|
|
2793
|
-
"@storybook/nextjs/navigation.mock":
|
|
2794
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
2795
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
2797
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
2798
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
2799
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
2800
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
2796
2801
|
"navigation",
|
|
2797
2802
|
env
|
|
2798
2803
|
),
|
|
2799
|
-
"next/router":
|
|
2800
|
-
"@storybook/nextjs/router.mock":
|
|
2801
|
-
"@storybook/nextjs-vite/router.mock":
|
|
2802
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
2804
|
+
"next/router": getEntryPoint3("router", env),
|
|
2805
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
2806
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
2807
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
2803
2808
|
"router",
|
|
2804
2809
|
env
|
|
2805
2810
|
),
|
|
2806
|
-
"next/cache":
|
|
2807
|
-
"@storybook/nextjs/cache.mock":
|
|
2808
|
-
"@storybook/nextjs-vite/cache.mock":
|
|
2809
|
-
"@storybook/experimental-nextjs-vite/cache.mock":
|
|
2810
|
-
"server-only":
|
|
2811
|
-
"@opentelemetry/api":
|
|
2811
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
2812
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
2813
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2814
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2815
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
2816
|
+
"@opentelemetry/api": require7.resolve(
|
|
2812
2817
|
"next/dist/compiled/@opentelemetry/api"
|
|
2813
2818
|
),
|
|
2814
|
-
"next/dynamic":
|
|
2815
|
-
...getCompatibilityAliases()
|
|
2819
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
2820
|
+
...getCompatibilityAliases(env)
|
|
2816
2821
|
});
|
|
2817
2822
|
var vitePluginNextMocks = () => ({
|
|
2818
2823
|
name: "vite-plugin-next-mocks",
|
|
@@ -2827,7 +2832,7 @@ var vitePluginNextMocks = () => ({
|
|
|
2827
2832
|
});
|
|
2828
2833
|
|
|
2829
2834
|
// src/index.ts
|
|
2830
|
-
var
|
|
2835
|
+
var require8 = createRequire(import.meta.url);
|
|
2831
2836
|
var loadConfig = (
|
|
2832
2837
|
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
2833
2838
|
nextServerConfig.default || nextServerConfig
|
|
@@ -2849,33 +2854,33 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2849
2854
|
alias: [
|
|
2850
2855
|
{
|
|
2851
2856
|
find: /^react$/,
|
|
2852
|
-
replacement:
|
|
2857
|
+
replacement: require8.resolve("next/dist/compiled/react")
|
|
2853
2858
|
},
|
|
2854
2859
|
{
|
|
2855
2860
|
find: /^react-dom$/,
|
|
2856
|
-
replacement:
|
|
2861
|
+
replacement: require8.resolve("next/dist/compiled/react-dom")
|
|
2857
2862
|
},
|
|
2858
2863
|
{
|
|
2859
2864
|
find: /^react-dom\/server$/,
|
|
2860
|
-
replacement:
|
|
2865
|
+
replacement: require8.resolve(
|
|
2861
2866
|
"next/dist/compiled/react-dom/server.browser.js"
|
|
2862
2867
|
)
|
|
2863
2868
|
},
|
|
2864
2869
|
{
|
|
2865
2870
|
find: /^react-dom\/test-utils$/,
|
|
2866
|
-
replacement:
|
|
2871
|
+
replacement: require8.resolve(
|
|
2867
2872
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2868
2873
|
)
|
|
2869
2874
|
},
|
|
2870
2875
|
{
|
|
2871
2876
|
find: /^react-dom\/client$/,
|
|
2872
|
-
replacement:
|
|
2877
|
+
replacement: require8.resolve(
|
|
2873
2878
|
"next/dist/compiled/react-dom/client.js"
|
|
2874
2879
|
)
|
|
2875
2880
|
},
|
|
2876
2881
|
{
|
|
2877
2882
|
find: /^react-dom\/cjs\/react-dom\.development\.js$/,
|
|
2878
|
-
replacement:
|
|
2883
|
+
replacement: require8.resolve(
|
|
2879
2884
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2880
2885
|
)
|
|
2881
2886
|
}
|
|
@@ -2895,26 +2900,26 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2895
2900
|
},
|
|
2896
2901
|
test: {
|
|
2897
2902
|
alias: {
|
|
2898
|
-
"react/jsx-dev-runtime":
|
|
2903
|
+
"react/jsx-dev-runtime": require8.resolve(
|
|
2899
2904
|
"next/dist/compiled/react/jsx-dev-runtime.js"
|
|
2900
2905
|
),
|
|
2901
|
-
"react/jsx-runtime":
|
|
2906
|
+
"react/jsx-runtime": require8.resolve(
|
|
2902
2907
|
"next/dist/compiled/react/jsx-runtime.js"
|
|
2903
2908
|
),
|
|
2904
|
-
react:
|
|
2905
|
-
"react-dom/server":
|
|
2909
|
+
react: require8.resolve("next/dist/compiled/react"),
|
|
2910
|
+
"react-dom/server": require8.resolve(
|
|
2906
2911
|
executionEnvironment === "node" ? "next/dist/compiled/react-dom/server.js" : "next/dist/compiled/react-dom/server.browser.js"
|
|
2907
2912
|
),
|
|
2908
|
-
"react-dom/test-utils":
|
|
2913
|
+
"react-dom/test-utils": require8.resolve(
|
|
2909
2914
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2910
2915
|
),
|
|
2911
|
-
"react-dom/cjs/react-dom.development.js":
|
|
2916
|
+
"react-dom/cjs/react-dom.development.js": require8.resolve(
|
|
2912
2917
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2913
2918
|
),
|
|
2914
|
-
"react-dom/client":
|
|
2919
|
+
"react-dom/client": require8.resolve(
|
|
2915
2920
|
"next/dist/compiled/react-dom/client.js"
|
|
2916
2921
|
),
|
|
2917
|
-
"react-dom":
|
|
2922
|
+
"react-dom": require8.resolve("next/dist/compiled/react-dom")
|
|
2918
2923
|
}
|
|
2919
2924
|
}
|
|
2920
2925
|
};
|
|
@@ -2922,7 +2927,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2922
2927
|
configResolved(config) {
|
|
2923
2928
|
if (isVitestEnv && !config.test?.browser?.enabled) {
|
|
2924
2929
|
config.test.setupFiles = [
|
|
2925
|
-
|
|
2930
|
+
require8.resolve("./mocks/storybook.global.js"),
|
|
2926
2931
|
...config.test?.setupFiles ?? []
|
|
2927
2932
|
];
|
|
2928
2933
|
}
|
|
@@ -1910,67 +1910,72 @@ var scopedResolve = (id) => {
|
|
|
1910
1910
|
};
|
|
1911
1911
|
|
|
1912
1912
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1913
|
-
var
|
|
1913
|
+
var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
1914
|
+
var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1915
|
+
var mapping = (env) => ({
|
|
1914
1916
|
"<15.0.0": {
|
|
1915
1917
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
1916
1918
|
// this path only exists from Next 15 onwards
|
|
1917
|
-
"next/dist/server/request/draft-mode":
|
|
1919
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
1920
|
+
"draft-mode.compat",
|
|
1921
|
+
env
|
|
1922
|
+
)
|
|
1918
1923
|
}
|
|
1919
|
-
};
|
|
1920
|
-
var getCompatibilityAliases = () => {
|
|
1924
|
+
});
|
|
1925
|
+
var getCompatibilityAliases = (env) => {
|
|
1921
1926
|
const version = getNextjsVersion();
|
|
1922
1927
|
const result = {};
|
|
1923
1928
|
Object.keys(mapping).forEach((key) => {
|
|
1924
1929
|
if (import_semver.default.intersects(version, key)) {
|
|
1925
|
-
Object.assign(result, mapping[key]);
|
|
1930
|
+
Object.assign(result, mapping(env)[key]);
|
|
1926
1931
|
}
|
|
1927
1932
|
});
|
|
1928
1933
|
return result;
|
|
1929
1934
|
};
|
|
1930
1935
|
|
|
1931
1936
|
// src/plugins/next-mocks/plugin.ts
|
|
1932
|
-
var
|
|
1933
|
-
var
|
|
1937
|
+
var require5 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
1938
|
+
var getEntryPoint3 = (subPath, env) => require5.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1934
1939
|
var getAlias2 = (env) => ({
|
|
1935
|
-
"next/headers":
|
|
1936
|
-
"@storybook/nextjs/headers.mock":
|
|
1937
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
1938
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
1940
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
1941
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
1942
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
1943
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
1939
1944
|
"headers",
|
|
1940
1945
|
env
|
|
1941
1946
|
),
|
|
1942
|
-
"next/navigation":
|
|
1943
|
-
"@storybook/nextjs/navigation.mock":
|
|
1944
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
1945
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
1947
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
1948
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
1949
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
1950
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
1946
1951
|
"navigation",
|
|
1947
1952
|
env
|
|
1948
1953
|
),
|
|
1949
|
-
"next/router":
|
|
1950
|
-
"@storybook/nextjs/router.mock":
|
|
1951
|
-
"@storybook/nextjs-vite/router.mock":
|
|
1952
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
1954
|
+
"next/router": getEntryPoint3("router", env),
|
|
1955
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
1956
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
1957
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
1953
1958
|
"router",
|
|
1954
1959
|
env
|
|
1955
1960
|
),
|
|
1956
|
-
"next/cache":
|
|
1957
|
-
"@storybook/nextjs/cache.mock":
|
|
1958
|
-
"@storybook/nextjs-vite/cache.mock":
|
|
1959
|
-
"@storybook/experimental-nextjs-vite/cache.mock":
|
|
1960
|
-
"server-only":
|
|
1961
|
-
"@opentelemetry/api":
|
|
1961
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
1962
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
1963
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1964
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1965
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
1966
|
+
"@opentelemetry/api": require5.resolve(
|
|
1962
1967
|
"next/dist/compiled/@opentelemetry/api"
|
|
1963
1968
|
),
|
|
1964
|
-
"next/dynamic":
|
|
1965
|
-
...getCompatibilityAliases()
|
|
1969
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
1970
|
+
...getCompatibilityAliases(env)
|
|
1966
1971
|
});
|
|
1967
1972
|
|
|
1968
1973
|
// src/mocks/storybook.global.ts
|
|
1969
|
-
var
|
|
1974
|
+
var require6 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
1970
1975
|
moduleAlias__default.default.addAliases({
|
|
1971
1976
|
react: "next/dist/compiled/react",
|
|
1972
1977
|
"react-dom/server": "next/dist/compiled/react-dom/server.js",
|
|
1973
|
-
"react-dom/test-utils":
|
|
1978
|
+
"react-dom/test-utils": require6.resolve(
|
|
1974
1979
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
1975
1980
|
),
|
|
1976
1981
|
"react-dom": "next/dist/compiled/react-dom",
|
|
@@ -1903,67 +1903,72 @@ var scopedResolve = (id) => {
|
|
|
1903
1903
|
};
|
|
1904
1904
|
|
|
1905
1905
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1906
|
-
var
|
|
1906
|
+
var require4 = createRequire(import.meta.url);
|
|
1907
|
+
var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1908
|
+
var mapping = (env) => ({
|
|
1907
1909
|
"<15.0.0": {
|
|
1908
1910
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
1909
1911
|
// this path only exists from Next 15 onwards
|
|
1910
|
-
"next/dist/server/request/draft-mode":
|
|
1912
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
1913
|
+
"draft-mode.compat",
|
|
1914
|
+
env
|
|
1915
|
+
)
|
|
1911
1916
|
}
|
|
1912
|
-
};
|
|
1913
|
-
var getCompatibilityAliases = () => {
|
|
1917
|
+
});
|
|
1918
|
+
var getCompatibilityAliases = (env) => {
|
|
1914
1919
|
const version = getNextjsVersion();
|
|
1915
1920
|
const result = {};
|
|
1916
1921
|
Object.keys(mapping).forEach((key) => {
|
|
1917
1922
|
if (import_semver.default.intersects(version, key)) {
|
|
1918
|
-
Object.assign(result, mapping[key]);
|
|
1923
|
+
Object.assign(result, mapping(env)[key]);
|
|
1919
1924
|
}
|
|
1920
1925
|
});
|
|
1921
1926
|
return result;
|
|
1922
1927
|
};
|
|
1923
1928
|
|
|
1924
1929
|
// src/plugins/next-mocks/plugin.ts
|
|
1925
|
-
var
|
|
1926
|
-
var
|
|
1930
|
+
var require5 = createRequire(import.meta.url);
|
|
1931
|
+
var getEntryPoint3 = (subPath, env) => require5.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1927
1932
|
var getAlias2 = (env) => ({
|
|
1928
|
-
"next/headers":
|
|
1929
|
-
"@storybook/nextjs/headers.mock":
|
|
1930
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
1931
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
1933
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
1934
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
1935
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
1936
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
1932
1937
|
"headers",
|
|
1933
1938
|
env
|
|
1934
1939
|
),
|
|
1935
|
-
"next/navigation":
|
|
1936
|
-
"@storybook/nextjs/navigation.mock":
|
|
1937
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
1938
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
1940
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
1941
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
1942
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
1943
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
1939
1944
|
"navigation",
|
|
1940
1945
|
env
|
|
1941
1946
|
),
|
|
1942
|
-
"next/router":
|
|
1943
|
-
"@storybook/nextjs/router.mock":
|
|
1944
|
-
"@storybook/nextjs-vite/router.mock":
|
|
1945
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
1947
|
+
"next/router": getEntryPoint3("router", env),
|
|
1948
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
1949
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
1950
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
1946
1951
|
"router",
|
|
1947
1952
|
env
|
|
1948
1953
|
),
|
|
1949
|
-
"next/cache":
|
|
1950
|
-
"@storybook/nextjs/cache.mock":
|
|
1951
|
-
"@storybook/nextjs-vite/cache.mock":
|
|
1952
|
-
"@storybook/experimental-nextjs-vite/cache.mock":
|
|
1953
|
-
"server-only":
|
|
1954
|
-
"@opentelemetry/api":
|
|
1954
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
1955
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
1956
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1957
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1958
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
1959
|
+
"@opentelemetry/api": require5.resolve(
|
|
1955
1960
|
"next/dist/compiled/@opentelemetry/api"
|
|
1956
1961
|
),
|
|
1957
|
-
"next/dynamic":
|
|
1958
|
-
...getCompatibilityAliases()
|
|
1962
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
1963
|
+
...getCompatibilityAliases(env)
|
|
1959
1964
|
});
|
|
1960
1965
|
|
|
1961
1966
|
// src/mocks/storybook.global.ts
|
|
1962
|
-
var
|
|
1967
|
+
var require6 = createRequire(import.meta.url);
|
|
1963
1968
|
moduleAlias.addAliases({
|
|
1964
1969
|
react: "next/dist/compiled/react",
|
|
1965
1970
|
"react-dom/server": "next/dist/compiled/react-dom/server.js",
|
|
1966
|
-
"react-dom/test-utils":
|
|
1971
|
+
"react-dom/test-utils": require6.resolve(
|
|
1967
1972
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
1968
1973
|
),
|
|
1969
1974
|
"react-dom": "next/dist/compiled/react-dom",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-storybook-nextjs",
|
|
3
|
-
"version": "1.1.0--canary.27.
|
|
3
|
+
"version": "1.1.0--canary.27.ea73e5f.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite-plugin",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"./browser/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.js",
|
|
40
40
|
"./browser/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.js",
|
|
41
41
|
"./browser/mocks/image-context": "./dist/plugins/next-image/alias/image-context.js",
|
|
42
|
+
"./browser/mocks/draft-mode": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.js",
|
|
42
43
|
"./node/mocks/cache": "./dist/plugins/next-mocks/alias/cache/index.cjs",
|
|
43
44
|
"./node/mocks/navigation": "./dist/plugins/next-mocks/alias/navigation/index.cjs",
|
|
44
45
|
"./node/mocks/headers": "./dist/plugins/next-mocks/alias/headers/index.cjs",
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
"./node/mocks/image": "./dist/plugins/next-image/alias/next-image.cjs",
|
|
49
50
|
"./node/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.cjs",
|
|
50
51
|
"./node/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.cjs",
|
|
51
|
-
"./node/mocks/image-context": "./dist/plugins/next-image/alias/image-context.cjs"
|
|
52
|
+
"./node/mocks/image-context": "./dist/plugins/next-image/alias/image-context.cjs",
|
|
53
|
+
"./node/mocks/draft-mode": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.cjs"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
56
|
"prepublishOnly": "pnpm build",
|