vite-plugin-storybook-nextjs 1.1.0--canary.27.65f1124.0 → 1.1.0--canary.27.7fdad3b.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 +58 -47
- package/dist/index.js +54 -43
- package/dist/mocks/storybook.global.cjs +42 -31
- package/dist/mocks/storybook.global.js +40 -29
- package/dist/plugins/next-image/alias/next-image.d.cts +17 -17
- package/dist/plugins/next-image/alias/next-image.d.ts +17 -17
- package/dist/plugins/next-mocks/alias/headers/cookies.cjs +1 -1
- package/dist/plugins/next-mocks/alias/headers/cookies.js +1 -1
- package/dist/plugins/next-mocks/alias/router/index.d.cts +2 -3
- package/dist/plugins/next-mocks/alias/router/index.d.ts +2 -3
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -413,6 +413,8 @@ var require_semver = __commonJS({
|
|
|
413
413
|
this.inc("patch", identifier, identifierBase);
|
|
414
414
|
this.inc("pre", identifier, identifierBase);
|
|
415
415
|
break;
|
|
416
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
417
|
+
// prepatch.
|
|
416
418
|
case "prerelease":
|
|
417
419
|
if (this.prerelease.length === 0) {
|
|
418
420
|
this.inc("patch", identifier, identifierBase);
|
|
@@ -440,6 +442,8 @@ var require_semver = __commonJS({
|
|
|
440
442
|
}
|
|
441
443
|
this.prerelease = [];
|
|
442
444
|
break;
|
|
445
|
+
// This probably shouldn't be used publicly.
|
|
446
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
443
447
|
case "pre": {
|
|
444
448
|
const base = Number(identifierBase) ? 1 : 0;
|
|
445
449
|
if (!identifier && identifierBase === false) {
|
|
@@ -1483,6 +1487,7 @@ var require_min_version = __commonJS({
|
|
|
1483
1487
|
compver.prerelease.push(0);
|
|
1484
1488
|
}
|
|
1485
1489
|
compver.raw = compver.format();
|
|
1490
|
+
/* fallthrough */
|
|
1486
1491
|
case "":
|
|
1487
1492
|
case ">=":
|
|
1488
1493
|
if (!setMin || gt(compver, setMin)) {
|
|
@@ -1492,6 +1497,7 @@ var require_min_version = __commonJS({
|
|
|
1492
1497
|
case "<":
|
|
1493
1498
|
case "<=":
|
|
1494
1499
|
break;
|
|
1500
|
+
/* istanbul ignore next */
|
|
1495
1501
|
default:
|
|
1496
1502
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1497
1503
|
}
|
|
@@ -2356,7 +2362,7 @@ function getEmotionOptions(emotionConfig, development) {
|
|
|
2356
2362
|
}
|
|
2357
2363
|
|
|
2358
2364
|
// src/utils/swc/options.ts
|
|
2359
|
-
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('
|
|
2365
|
+
var require2 = 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)));
|
|
2360
2366
|
var regeneratorRuntimePath = require2.resolve(
|
|
2361
2367
|
"next/dist/compiled/regenerator-runtime"
|
|
2362
2368
|
);
|
|
@@ -2656,7 +2662,7 @@ var isVitestEnv = process.env.VITEST === "true";
|
|
|
2656
2662
|
function getExecutionEnvironment(config) {
|
|
2657
2663
|
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
2658
2664
|
}
|
|
2659
|
-
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('
|
|
2665
|
+
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)));
|
|
2660
2666
|
var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2661
2667
|
var getAlias = (env) => ({
|
|
2662
2668
|
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
@@ -2670,7 +2676,7 @@ var virtualImage = "virtual:next-image";
|
|
|
2670
2676
|
var virtualNextImage = "virtual:next/image";
|
|
2671
2677
|
var virtualNextLegacyImage = "virtual:next/legacy/image";
|
|
2672
2678
|
var sharp;
|
|
2673
|
-
var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('
|
|
2679
|
+
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)));
|
|
2674
2680
|
try {
|
|
2675
2681
|
sharp = require4("sharp");
|
|
2676
2682
|
if (sharp && sharp.concurrency() > 1) {
|
|
@@ -2775,7 +2781,7 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2775
2781
|
|
|
2776
2782
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2777
2783
|
var import_semver = __toESM(require_semver2());
|
|
2778
|
-
var require5 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('
|
|
2784
|
+
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)));
|
|
2779
2785
|
var getNextjsVersion = () => require5(scopedResolve("next/package.json")).version;
|
|
2780
2786
|
var scopedResolve = (id) => {
|
|
2781
2787
|
let scopedModulePath;
|
|
@@ -2794,59 +2800,64 @@ var scopedResolve = (id) => {
|
|
|
2794
2800
|
};
|
|
2795
2801
|
|
|
2796
2802
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2797
|
-
var
|
|
2803
|
+
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)));
|
|
2804
|
+
var getEntryPoint2 = (subPath, env) => require6.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2805
|
+
var mapping = (env) => ({
|
|
2798
2806
|
"<15.0.0": {
|
|
2799
2807
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
2800
2808
|
// this path only exists from Next 15 onwards
|
|
2801
|
-
"next/dist/server/request/draft-mode":
|
|
2809
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
2810
|
+
"draft-mode.compat",
|
|
2811
|
+
env
|
|
2812
|
+
)
|
|
2802
2813
|
}
|
|
2803
|
-
};
|
|
2804
|
-
var getCompatibilityAliases = () => {
|
|
2814
|
+
});
|
|
2815
|
+
var getCompatibilityAliases = (env) => {
|
|
2805
2816
|
const version = getNextjsVersion();
|
|
2806
2817
|
const result = {};
|
|
2807
2818
|
Object.keys(mapping).forEach((key) => {
|
|
2808
2819
|
if (import_semver.default.intersects(version, key)) {
|
|
2809
|
-
Object.assign(result, mapping[key]);
|
|
2820
|
+
Object.assign(result, mapping(env)[key]);
|
|
2810
2821
|
}
|
|
2811
2822
|
});
|
|
2812
2823
|
return result;
|
|
2813
2824
|
};
|
|
2814
2825
|
|
|
2815
2826
|
// src/plugins/next-mocks/plugin.ts
|
|
2816
|
-
var
|
|
2817
|
-
var
|
|
2827
|
+
var require7 = 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
|
+
var getEntryPoint3 = (subPath, env) => require7.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2818
2829
|
var getAlias2 = (env) => ({
|
|
2819
|
-
"next/headers":
|
|
2820
|
-
"@storybook/nextjs/headers.mock":
|
|
2821
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
2822
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
2830
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
2831
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
2832
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
2833
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
2823
2834
|
"headers",
|
|
2824
2835
|
env
|
|
2825
2836
|
),
|
|
2826
|
-
"next/navigation":
|
|
2827
|
-
"@storybook/nextjs/navigation.mock":
|
|
2828
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
2829
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
2837
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
2838
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
2839
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
2840
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
2830
2841
|
"navigation",
|
|
2831
2842
|
env
|
|
2832
2843
|
),
|
|
2833
|
-
"next/router":
|
|
2834
|
-
"@storybook/nextjs/router.mock":
|
|
2835
|
-
"@storybook/nextjs-vite/router.mock":
|
|
2836
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
2844
|
+
"next/router": getEntryPoint3("router", env),
|
|
2845
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
2846
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
2847
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
2837
2848
|
"router",
|
|
2838
2849
|
env
|
|
2839
2850
|
),
|
|
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":
|
|
2851
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
2852
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
2853
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2854
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2855
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
2856
|
+
"@opentelemetry/api": require7.resolve(
|
|
2846
2857
|
"next/dist/compiled/@opentelemetry/api"
|
|
2847
2858
|
),
|
|
2848
|
-
"next/dynamic":
|
|
2849
|
-
...getCompatibilityAliases()
|
|
2859
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
2860
|
+
...getCompatibilityAliases(env)
|
|
2850
2861
|
});
|
|
2851
2862
|
var vitePluginNextMocks = () => ({
|
|
2852
2863
|
name: "vite-plugin-next-mocks",
|
|
@@ -2861,7 +2872,7 @@ var vitePluginNextMocks = () => ({
|
|
|
2861
2872
|
});
|
|
2862
2873
|
|
|
2863
2874
|
// src/index.ts
|
|
2864
|
-
var
|
|
2875
|
+
var require8 = 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)));
|
|
2865
2876
|
var loadConfig = (
|
|
2866
2877
|
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
2867
2878
|
nextServerConfig__default.default.default || nextServerConfig__default.default
|
|
@@ -2883,33 +2894,33 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2883
2894
|
alias: [
|
|
2884
2895
|
{
|
|
2885
2896
|
find: /^react$/,
|
|
2886
|
-
replacement:
|
|
2897
|
+
replacement: require8.resolve("next/dist/compiled/react")
|
|
2887
2898
|
},
|
|
2888
2899
|
{
|
|
2889
2900
|
find: /^react-dom$/,
|
|
2890
|
-
replacement:
|
|
2901
|
+
replacement: require8.resolve("next/dist/compiled/react-dom")
|
|
2891
2902
|
},
|
|
2892
2903
|
{
|
|
2893
2904
|
find: /^react-dom\/server$/,
|
|
2894
|
-
replacement:
|
|
2905
|
+
replacement: require8.resolve(
|
|
2895
2906
|
"next/dist/compiled/react-dom/server.browser.js"
|
|
2896
2907
|
)
|
|
2897
2908
|
},
|
|
2898
2909
|
{
|
|
2899
2910
|
find: /^react-dom\/test-utils$/,
|
|
2900
|
-
replacement:
|
|
2911
|
+
replacement: require8.resolve(
|
|
2901
2912
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2902
2913
|
)
|
|
2903
2914
|
},
|
|
2904
2915
|
{
|
|
2905
2916
|
find: /^react-dom\/client$/,
|
|
2906
|
-
replacement:
|
|
2917
|
+
replacement: require8.resolve(
|
|
2907
2918
|
"next/dist/compiled/react-dom/client.js"
|
|
2908
2919
|
)
|
|
2909
2920
|
},
|
|
2910
2921
|
{
|
|
2911
2922
|
find: /^react-dom\/cjs\/react-dom\.development\.js$/,
|
|
2912
|
-
replacement:
|
|
2923
|
+
replacement: require8.resolve(
|
|
2913
2924
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2914
2925
|
)
|
|
2915
2926
|
}
|
|
@@ -2929,26 +2940,26 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2929
2940
|
},
|
|
2930
2941
|
test: {
|
|
2931
2942
|
alias: {
|
|
2932
|
-
"react/jsx-dev-runtime":
|
|
2943
|
+
"react/jsx-dev-runtime": require8.resolve(
|
|
2933
2944
|
"next/dist/compiled/react/jsx-dev-runtime.js"
|
|
2934
2945
|
),
|
|
2935
|
-
"react/jsx-runtime":
|
|
2946
|
+
"react/jsx-runtime": require8.resolve(
|
|
2936
2947
|
"next/dist/compiled/react/jsx-runtime.js"
|
|
2937
2948
|
),
|
|
2938
|
-
react:
|
|
2939
|
-
"react-dom/server":
|
|
2949
|
+
react: require8.resolve("next/dist/compiled/react"),
|
|
2950
|
+
"react-dom/server": require8.resolve(
|
|
2940
2951
|
executionEnvironment === "node" ? "next/dist/compiled/react-dom/server.js" : "next/dist/compiled/react-dom/server.browser.js"
|
|
2941
2952
|
),
|
|
2942
|
-
"react-dom/test-utils":
|
|
2953
|
+
"react-dom/test-utils": require8.resolve(
|
|
2943
2954
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2944
2955
|
),
|
|
2945
|
-
"react-dom/cjs/react-dom.development.js":
|
|
2956
|
+
"react-dom/cjs/react-dom.development.js": require8.resolve(
|
|
2946
2957
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2947
2958
|
),
|
|
2948
|
-
"react-dom/client":
|
|
2959
|
+
"react-dom/client": require8.resolve(
|
|
2949
2960
|
"next/dist/compiled/react-dom/client.js"
|
|
2950
2961
|
),
|
|
2951
|
-
"react-dom":
|
|
2962
|
+
"react-dom": require8.resolve("next/dist/compiled/react-dom")
|
|
2952
2963
|
}
|
|
2953
2964
|
}
|
|
2954
2965
|
};
|
|
@@ -2956,7 +2967,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2956
2967
|
configResolved(config) {
|
|
2957
2968
|
if (isVitestEnv && !config.test?.browser?.enabled) {
|
|
2958
2969
|
config.test.setupFiles = [
|
|
2959
|
-
|
|
2970
|
+
require8.resolve("./mocks/storybook.global.js"),
|
|
2960
2971
|
...config.test?.setupFiles ?? []
|
|
2961
2972
|
];
|
|
2962
2973
|
}
|
package/dist/index.js
CHANGED
|
@@ -379,6 +379,8 @@ var require_semver = __commonJS({
|
|
|
379
379
|
this.inc("patch", identifier, identifierBase);
|
|
380
380
|
this.inc("pre", identifier, identifierBase);
|
|
381
381
|
break;
|
|
382
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
383
|
+
// prepatch.
|
|
382
384
|
case "prerelease":
|
|
383
385
|
if (this.prerelease.length === 0) {
|
|
384
386
|
this.inc("patch", identifier, identifierBase);
|
|
@@ -406,6 +408,8 @@ var require_semver = __commonJS({
|
|
|
406
408
|
}
|
|
407
409
|
this.prerelease = [];
|
|
408
410
|
break;
|
|
411
|
+
// This probably shouldn't be used publicly.
|
|
412
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
409
413
|
case "pre": {
|
|
410
414
|
const base = Number(identifierBase) ? 1 : 0;
|
|
411
415
|
if (!identifier && identifierBase === false) {
|
|
@@ -1449,6 +1453,7 @@ var require_min_version = __commonJS({
|
|
|
1449
1453
|
compver.prerelease.push(0);
|
|
1450
1454
|
}
|
|
1451
1455
|
compver.raw = compver.format();
|
|
1456
|
+
/* fallthrough */
|
|
1452
1457
|
case "":
|
|
1453
1458
|
case ">=":
|
|
1454
1459
|
if (!setMin || gt(compver, setMin)) {
|
|
@@ -1458,6 +1463,7 @@ var require_min_version = __commonJS({
|
|
|
1458
1463
|
case "<":
|
|
1459
1464
|
case "<=":
|
|
1460
1465
|
break;
|
|
1466
|
+
/* istanbul ignore next */
|
|
1461
1467
|
default:
|
|
1462
1468
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1463
1469
|
}
|
|
@@ -2760,59 +2766,64 @@ var scopedResolve = (id) => {
|
|
|
2760
2766
|
};
|
|
2761
2767
|
|
|
2762
2768
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
2763
|
-
var
|
|
2769
|
+
var require6 = createRequire(import.meta.url);
|
|
2770
|
+
var getEntryPoint2 = (subPath, env) => require6.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2771
|
+
var mapping = (env) => ({
|
|
2764
2772
|
"<15.0.0": {
|
|
2765
2773
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
2766
2774
|
// this path only exists from Next 15 onwards
|
|
2767
|
-
"next/dist/server/request/draft-mode":
|
|
2775
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
2776
|
+
"draft-mode.compat",
|
|
2777
|
+
env
|
|
2778
|
+
)
|
|
2768
2779
|
}
|
|
2769
|
-
};
|
|
2770
|
-
var getCompatibilityAliases = () => {
|
|
2780
|
+
});
|
|
2781
|
+
var getCompatibilityAliases = (env) => {
|
|
2771
2782
|
const version = getNextjsVersion();
|
|
2772
2783
|
const result = {};
|
|
2773
2784
|
Object.keys(mapping).forEach((key) => {
|
|
2774
2785
|
if (import_semver.default.intersects(version, key)) {
|
|
2775
|
-
Object.assign(result, mapping[key]);
|
|
2786
|
+
Object.assign(result, mapping(env)[key]);
|
|
2776
2787
|
}
|
|
2777
2788
|
});
|
|
2778
2789
|
return result;
|
|
2779
2790
|
};
|
|
2780
2791
|
|
|
2781
2792
|
// src/plugins/next-mocks/plugin.ts
|
|
2782
|
-
var
|
|
2783
|
-
var
|
|
2793
|
+
var require7 = createRequire(import.meta.url);
|
|
2794
|
+
var getEntryPoint3 = (subPath, env) => require7.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
2784
2795
|
var getAlias2 = (env) => ({
|
|
2785
|
-
"next/headers":
|
|
2786
|
-
"@storybook/nextjs/headers.mock":
|
|
2787
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
2788
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
2796
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
2797
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
2798
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
2799
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
2789
2800
|
"headers",
|
|
2790
2801
|
env
|
|
2791
2802
|
),
|
|
2792
|
-
"next/navigation":
|
|
2793
|
-
"@storybook/nextjs/navigation.mock":
|
|
2794
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
2795
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
2803
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
2804
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
2805
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
2806
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
2796
2807
|
"navigation",
|
|
2797
2808
|
env
|
|
2798
2809
|
),
|
|
2799
|
-
"next/router":
|
|
2800
|
-
"@storybook/nextjs/router.mock":
|
|
2801
|
-
"@storybook/nextjs-vite/router.mock":
|
|
2802
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
2810
|
+
"next/router": getEntryPoint3("router", env),
|
|
2811
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
2812
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
2813
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
2803
2814
|
"router",
|
|
2804
2815
|
env
|
|
2805
2816
|
),
|
|
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":
|
|
2817
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
2818
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
2819
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2820
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
2821
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
2822
|
+
"@opentelemetry/api": require7.resolve(
|
|
2812
2823
|
"next/dist/compiled/@opentelemetry/api"
|
|
2813
2824
|
),
|
|
2814
|
-
"next/dynamic":
|
|
2815
|
-
...getCompatibilityAliases()
|
|
2825
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
2826
|
+
...getCompatibilityAliases(env)
|
|
2816
2827
|
});
|
|
2817
2828
|
var vitePluginNextMocks = () => ({
|
|
2818
2829
|
name: "vite-plugin-next-mocks",
|
|
@@ -2827,7 +2838,7 @@ var vitePluginNextMocks = () => ({
|
|
|
2827
2838
|
});
|
|
2828
2839
|
|
|
2829
2840
|
// src/index.ts
|
|
2830
|
-
var
|
|
2841
|
+
var require8 = createRequire(import.meta.url);
|
|
2831
2842
|
var loadConfig = (
|
|
2832
2843
|
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
2833
2844
|
nextServerConfig.default || nextServerConfig
|
|
@@ -2849,33 +2860,33 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2849
2860
|
alias: [
|
|
2850
2861
|
{
|
|
2851
2862
|
find: /^react$/,
|
|
2852
|
-
replacement:
|
|
2863
|
+
replacement: require8.resolve("next/dist/compiled/react")
|
|
2853
2864
|
},
|
|
2854
2865
|
{
|
|
2855
2866
|
find: /^react-dom$/,
|
|
2856
|
-
replacement:
|
|
2867
|
+
replacement: require8.resolve("next/dist/compiled/react-dom")
|
|
2857
2868
|
},
|
|
2858
2869
|
{
|
|
2859
2870
|
find: /^react-dom\/server$/,
|
|
2860
|
-
replacement:
|
|
2871
|
+
replacement: require8.resolve(
|
|
2861
2872
|
"next/dist/compiled/react-dom/server.browser.js"
|
|
2862
2873
|
)
|
|
2863
2874
|
},
|
|
2864
2875
|
{
|
|
2865
2876
|
find: /^react-dom\/test-utils$/,
|
|
2866
|
-
replacement:
|
|
2877
|
+
replacement: require8.resolve(
|
|
2867
2878
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2868
2879
|
)
|
|
2869
2880
|
},
|
|
2870
2881
|
{
|
|
2871
2882
|
find: /^react-dom\/client$/,
|
|
2872
|
-
replacement:
|
|
2883
|
+
replacement: require8.resolve(
|
|
2873
2884
|
"next/dist/compiled/react-dom/client.js"
|
|
2874
2885
|
)
|
|
2875
2886
|
},
|
|
2876
2887
|
{
|
|
2877
2888
|
find: /^react-dom\/cjs\/react-dom\.development\.js$/,
|
|
2878
|
-
replacement:
|
|
2889
|
+
replacement: require8.resolve(
|
|
2879
2890
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2880
2891
|
)
|
|
2881
2892
|
}
|
|
@@ -2895,26 +2906,26 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2895
2906
|
},
|
|
2896
2907
|
test: {
|
|
2897
2908
|
alias: {
|
|
2898
|
-
"react/jsx-dev-runtime":
|
|
2909
|
+
"react/jsx-dev-runtime": require8.resolve(
|
|
2899
2910
|
"next/dist/compiled/react/jsx-dev-runtime.js"
|
|
2900
2911
|
),
|
|
2901
|
-
"react/jsx-runtime":
|
|
2912
|
+
"react/jsx-runtime": require8.resolve(
|
|
2902
2913
|
"next/dist/compiled/react/jsx-runtime.js"
|
|
2903
2914
|
),
|
|
2904
|
-
react:
|
|
2905
|
-
"react-dom/server":
|
|
2915
|
+
react: require8.resolve("next/dist/compiled/react"),
|
|
2916
|
+
"react-dom/server": require8.resolve(
|
|
2906
2917
|
executionEnvironment === "node" ? "next/dist/compiled/react-dom/server.js" : "next/dist/compiled/react-dom/server.browser.js"
|
|
2907
2918
|
),
|
|
2908
|
-
"react-dom/test-utils":
|
|
2919
|
+
"react-dom/test-utils": require8.resolve(
|
|
2909
2920
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
2910
2921
|
),
|
|
2911
|
-
"react-dom/cjs/react-dom.development.js":
|
|
2922
|
+
"react-dom/cjs/react-dom.development.js": require8.resolve(
|
|
2912
2923
|
"next/dist/compiled/react-dom/cjs/react-dom.development.js"
|
|
2913
2924
|
),
|
|
2914
|
-
"react-dom/client":
|
|
2925
|
+
"react-dom/client": require8.resolve(
|
|
2915
2926
|
"next/dist/compiled/react-dom/client.js"
|
|
2916
2927
|
),
|
|
2917
|
-
"react-dom":
|
|
2928
|
+
"react-dom": require8.resolve("next/dist/compiled/react-dom")
|
|
2918
2929
|
}
|
|
2919
2930
|
}
|
|
2920
2931
|
};
|
|
@@ -2922,7 +2933,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
|
|
|
2922
2933
|
configResolved(config) {
|
|
2923
2934
|
if (isVitestEnv && !config.test?.browser?.enabled) {
|
|
2924
2935
|
config.test.setupFiles = [
|
|
2925
|
-
|
|
2936
|
+
require8.resolve("./mocks/storybook.global.js"),
|
|
2926
2937
|
...config.test?.setupFiles ?? []
|
|
2927
2938
|
];
|
|
2928
2939
|
}
|
|
@@ -363,6 +363,8 @@ var require_semver = __commonJS({
|
|
|
363
363
|
this.inc("patch", identifier, identifierBase);
|
|
364
364
|
this.inc("pre", identifier, identifierBase);
|
|
365
365
|
break;
|
|
366
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
367
|
+
// prepatch.
|
|
366
368
|
case "prerelease":
|
|
367
369
|
if (this.prerelease.length === 0) {
|
|
368
370
|
this.inc("patch", identifier, identifierBase);
|
|
@@ -390,6 +392,8 @@ var require_semver = __commonJS({
|
|
|
390
392
|
}
|
|
391
393
|
this.prerelease = [];
|
|
392
394
|
break;
|
|
395
|
+
// This probably shouldn't be used publicly.
|
|
396
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
393
397
|
case "pre": {
|
|
394
398
|
const base = Number(identifierBase) ? 1 : 0;
|
|
395
399
|
if (!identifier && identifierBase === false) {
|
|
@@ -1433,6 +1437,7 @@ var require_min_version = __commonJS({
|
|
|
1433
1437
|
compver.prerelease.push(0);
|
|
1434
1438
|
}
|
|
1435
1439
|
compver.raw = compver.format();
|
|
1440
|
+
/* fallthrough */
|
|
1436
1441
|
case "":
|
|
1437
1442
|
case ">=":
|
|
1438
1443
|
if (!setMin || gt(compver, setMin)) {
|
|
@@ -1442,6 +1447,7 @@ var require_min_version = __commonJS({
|
|
|
1442
1447
|
case "<":
|
|
1443
1448
|
case "<=":
|
|
1444
1449
|
break;
|
|
1450
|
+
/* istanbul ignore next */
|
|
1445
1451
|
default:
|
|
1446
1452
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1447
1453
|
}
|
|
@@ -1882,7 +1888,7 @@ var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
|
1882
1888
|
process.env.VITEST === "true";
|
|
1883
1889
|
|
|
1884
1890
|
// src/plugins/next-image/alias/index.tsx
|
|
1885
|
-
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('
|
|
1891
|
+
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)));
|
|
1886
1892
|
var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1887
1893
|
var getAlias = (env) => ({
|
|
1888
1894
|
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
@@ -1891,7 +1897,7 @@ var getAlias = (env) => ({
|
|
|
1891
1897
|
|
|
1892
1898
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1893
1899
|
var import_semver = __toESM(require_semver2());
|
|
1894
|
-
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('
|
|
1900
|
+
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)));
|
|
1895
1901
|
var getNextjsVersion = () => require3(scopedResolve("next/package.json")).version;
|
|
1896
1902
|
var scopedResolve = (id) => {
|
|
1897
1903
|
let scopedModulePath;
|
|
@@ -1910,67 +1916,72 @@ var scopedResolve = (id) => {
|
|
|
1910
1916
|
};
|
|
1911
1917
|
|
|
1912
1918
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1913
|
-
var
|
|
1919
|
+
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)));
|
|
1920
|
+
var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1921
|
+
var mapping = (env) => ({
|
|
1914
1922
|
"<15.0.0": {
|
|
1915
1923
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
1916
1924
|
// this path only exists from Next 15 onwards
|
|
1917
|
-
"next/dist/server/request/draft-mode":
|
|
1925
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
1926
|
+
"draft-mode.compat",
|
|
1927
|
+
env
|
|
1928
|
+
)
|
|
1918
1929
|
}
|
|
1919
|
-
};
|
|
1920
|
-
var getCompatibilityAliases = () => {
|
|
1930
|
+
});
|
|
1931
|
+
var getCompatibilityAliases = (env) => {
|
|
1921
1932
|
const version = getNextjsVersion();
|
|
1922
1933
|
const result = {};
|
|
1923
1934
|
Object.keys(mapping).forEach((key) => {
|
|
1924
1935
|
if (import_semver.default.intersects(version, key)) {
|
|
1925
|
-
Object.assign(result, mapping[key]);
|
|
1936
|
+
Object.assign(result, mapping(env)[key]);
|
|
1926
1937
|
}
|
|
1927
1938
|
});
|
|
1928
1939
|
return result;
|
|
1929
1940
|
};
|
|
1930
1941
|
|
|
1931
1942
|
// src/plugins/next-mocks/plugin.ts
|
|
1932
|
-
var
|
|
1933
|
-
var
|
|
1943
|
+
var require5 = 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 getEntryPoint3 = (subPath, env) => require5.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1934
1945
|
var getAlias2 = (env) => ({
|
|
1935
|
-
"next/headers":
|
|
1936
|
-
"@storybook/nextjs/headers.mock":
|
|
1937
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
1938
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
1946
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
1947
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
1948
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
1949
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
1939
1950
|
"headers",
|
|
1940
1951
|
env
|
|
1941
1952
|
),
|
|
1942
|
-
"next/navigation":
|
|
1943
|
-
"@storybook/nextjs/navigation.mock":
|
|
1944
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
1945
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
1953
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
1954
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
1955
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
1956
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
1946
1957
|
"navigation",
|
|
1947
1958
|
env
|
|
1948
1959
|
),
|
|
1949
|
-
"next/router":
|
|
1950
|
-
"@storybook/nextjs/router.mock":
|
|
1951
|
-
"@storybook/nextjs-vite/router.mock":
|
|
1952
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
1960
|
+
"next/router": getEntryPoint3("router", env),
|
|
1961
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
1962
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
1963
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
1953
1964
|
"router",
|
|
1954
1965
|
env
|
|
1955
1966
|
),
|
|
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":
|
|
1967
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
1968
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
1969
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1970
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1971
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
1972
|
+
"@opentelemetry/api": require5.resolve(
|
|
1962
1973
|
"next/dist/compiled/@opentelemetry/api"
|
|
1963
1974
|
),
|
|
1964
|
-
"next/dynamic":
|
|
1965
|
-
...getCompatibilityAliases()
|
|
1975
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
1976
|
+
...getCompatibilityAliases(env)
|
|
1966
1977
|
});
|
|
1967
1978
|
|
|
1968
1979
|
// src/mocks/storybook.global.ts
|
|
1969
|
-
var
|
|
1980
|
+
var require6 = 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)));
|
|
1970
1981
|
moduleAlias__default.default.addAliases({
|
|
1971
1982
|
react: "next/dist/compiled/react",
|
|
1972
1983
|
"react-dom/server": "next/dist/compiled/react-dom/server.js",
|
|
1973
|
-
"react-dom/test-utils":
|
|
1984
|
+
"react-dom/test-utils": require6.resolve(
|
|
1974
1985
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
1975
1986
|
),
|
|
1976
1987
|
"react-dom": "next/dist/compiled/react-dom",
|
|
@@ -356,6 +356,8 @@ var require_semver = __commonJS({
|
|
|
356
356
|
this.inc("patch", identifier, identifierBase);
|
|
357
357
|
this.inc("pre", identifier, identifierBase);
|
|
358
358
|
break;
|
|
359
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
360
|
+
// prepatch.
|
|
359
361
|
case "prerelease":
|
|
360
362
|
if (this.prerelease.length === 0) {
|
|
361
363
|
this.inc("patch", identifier, identifierBase);
|
|
@@ -383,6 +385,8 @@ var require_semver = __commonJS({
|
|
|
383
385
|
}
|
|
384
386
|
this.prerelease = [];
|
|
385
387
|
break;
|
|
388
|
+
// This probably shouldn't be used publicly.
|
|
389
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
386
390
|
case "pre": {
|
|
387
391
|
const base = Number(identifierBase) ? 1 : 0;
|
|
388
392
|
if (!identifier && identifierBase === false) {
|
|
@@ -1426,6 +1430,7 @@ var require_min_version = __commonJS({
|
|
|
1426
1430
|
compver.prerelease.push(0);
|
|
1427
1431
|
}
|
|
1428
1432
|
compver.raw = compver.format();
|
|
1433
|
+
/* fallthrough */
|
|
1429
1434
|
case "":
|
|
1430
1435
|
case ">=":
|
|
1431
1436
|
if (!setMin || gt(compver, setMin)) {
|
|
@@ -1435,6 +1440,7 @@ var require_min_version = __commonJS({
|
|
|
1435
1440
|
case "<":
|
|
1436
1441
|
case "<=":
|
|
1437
1442
|
break;
|
|
1443
|
+
/* istanbul ignore next */
|
|
1438
1444
|
default:
|
|
1439
1445
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1440
1446
|
}
|
|
@@ -1903,67 +1909,72 @@ var scopedResolve = (id) => {
|
|
|
1903
1909
|
};
|
|
1904
1910
|
|
|
1905
1911
|
// src/plugins/next-mocks/compatibility/compatibility-map.ts
|
|
1906
|
-
var
|
|
1912
|
+
var require4 = createRequire(import.meta.url);
|
|
1913
|
+
var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1914
|
+
var mapping = (env) => ({
|
|
1907
1915
|
"<15.0.0": {
|
|
1908
1916
|
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
1909
1917
|
// this path only exists from Next 15 onwards
|
|
1910
|
-
"next/dist/server/request/draft-mode":
|
|
1918
|
+
"next/dist/server/request/draft-mode": getEntryPoint2(
|
|
1919
|
+
"draft-mode.compat",
|
|
1920
|
+
env
|
|
1921
|
+
)
|
|
1911
1922
|
}
|
|
1912
|
-
};
|
|
1913
|
-
var getCompatibilityAliases = () => {
|
|
1923
|
+
});
|
|
1924
|
+
var getCompatibilityAliases = (env) => {
|
|
1914
1925
|
const version = getNextjsVersion();
|
|
1915
1926
|
const result = {};
|
|
1916
1927
|
Object.keys(mapping).forEach((key) => {
|
|
1917
1928
|
if (import_semver.default.intersects(version, key)) {
|
|
1918
|
-
Object.assign(result, mapping[key]);
|
|
1929
|
+
Object.assign(result, mapping(env)[key]);
|
|
1919
1930
|
}
|
|
1920
1931
|
});
|
|
1921
1932
|
return result;
|
|
1922
1933
|
};
|
|
1923
1934
|
|
|
1924
1935
|
// src/plugins/next-mocks/plugin.ts
|
|
1925
|
-
var
|
|
1926
|
-
var
|
|
1936
|
+
var require5 = createRequire(import.meta.url);
|
|
1937
|
+
var getEntryPoint3 = (subPath, env) => require5.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
1927
1938
|
var getAlias2 = (env) => ({
|
|
1928
|
-
"next/headers":
|
|
1929
|
-
"@storybook/nextjs/headers.mock":
|
|
1930
|
-
"@storybook/nextjs-vite/headers.mock":
|
|
1931
|
-
"@storybook/experimental-nextjs-vite/headers.mock":
|
|
1939
|
+
"next/headers": getEntryPoint3("headers", env),
|
|
1940
|
+
"@storybook/nextjs/headers.mock": getEntryPoint3("headers", env),
|
|
1941
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint3("headers", env),
|
|
1942
|
+
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint3(
|
|
1932
1943
|
"headers",
|
|
1933
1944
|
env
|
|
1934
1945
|
),
|
|
1935
|
-
"next/navigation":
|
|
1936
|
-
"@storybook/nextjs/navigation.mock":
|
|
1937
|
-
"@storybook/nextjs-vite/navigation.mock":
|
|
1938
|
-
"@storybook/experimental-nextjs-vite/navigation.mock":
|
|
1946
|
+
"next/navigation": getEntryPoint3("navigation", env),
|
|
1947
|
+
"@storybook/nextjs/navigation.mock": getEntryPoint3("navigation", env),
|
|
1948
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint3("navigation", env),
|
|
1949
|
+
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint3(
|
|
1939
1950
|
"navigation",
|
|
1940
1951
|
env
|
|
1941
1952
|
),
|
|
1942
|
-
"next/router":
|
|
1943
|
-
"@storybook/nextjs/router.mock":
|
|
1944
|
-
"@storybook/nextjs-vite/router.mock":
|
|
1945
|
-
"@storybook/experimental-nextjs-vite/router.mock":
|
|
1953
|
+
"next/router": getEntryPoint3("router", env),
|
|
1954
|
+
"@storybook/nextjs/router.mock": getEntryPoint3("router", env),
|
|
1955
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint3("router", env),
|
|
1956
|
+
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint3(
|
|
1946
1957
|
"router",
|
|
1947
1958
|
env
|
|
1948
1959
|
),
|
|
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":
|
|
1960
|
+
"next/cache": getEntryPoint3("cache", env),
|
|
1961
|
+
"@storybook/nextjs/cache.mock": getEntryPoint3("cache", env),
|
|
1962
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1963
|
+
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint3("cache", env),
|
|
1964
|
+
"server-only": getEntryPoint3("server-only", env),
|
|
1965
|
+
"@opentelemetry/api": require5.resolve(
|
|
1955
1966
|
"next/dist/compiled/@opentelemetry/api"
|
|
1956
1967
|
),
|
|
1957
|
-
"next/dynamic":
|
|
1958
|
-
...getCompatibilityAliases()
|
|
1968
|
+
"next/dynamic": getEntryPoint3("dynamic", env),
|
|
1969
|
+
...getCompatibilityAliases(env)
|
|
1959
1970
|
});
|
|
1960
1971
|
|
|
1961
1972
|
// src/mocks/storybook.global.ts
|
|
1962
|
-
var
|
|
1973
|
+
var require6 = createRequire(import.meta.url);
|
|
1963
1974
|
moduleAlias.addAliases({
|
|
1964
1975
|
react: "next/dist/compiled/react",
|
|
1965
1976
|
"react-dom/server": "next/dist/compiled/react-dom/server.js",
|
|
1966
|
-
"react-dom/test-utils":
|
|
1977
|
+
"react-dom/test-utils": require6.resolve(
|
|
1967
1978
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
1968
1979
|
),
|
|
1969
1980
|
"react-dom": "next/dist/compiled/react-dom",
|
|
@@ -2,26 +2,26 @@ 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>, "
|
|
5
|
+
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "alt" | "width" | "height" | "loading"> & {
|
|
6
6
|
src: string | next_dist_shared_lib_get_img_props.StaticImport;
|
|
7
7
|
alt: string;
|
|
8
|
-
width?: number | `${number}
|
|
9
|
-
height?: number | `${number}
|
|
10
|
-
fill?: boolean
|
|
11
|
-
loader?: _NextImage.ImageLoader
|
|
12
|
-
quality?: number | `${number}
|
|
13
|
-
priority?: boolean
|
|
8
|
+
width?: number | `${number}`;
|
|
9
|
+
height?: number | `${number}`;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
loader?: _NextImage.ImageLoader;
|
|
12
|
+
quality?: number | `${number}`;
|
|
13
|
+
priority?: boolean;
|
|
14
14
|
loading?: "lazy" | "eager" | undefined;
|
|
15
|
-
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue
|
|
16
|
-
blurDataURL?: string
|
|
17
|
-
unoptimized?: boolean
|
|
18
|
-
overrideSrc?: string
|
|
19
|
-
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete
|
|
20
|
-
layout?: string
|
|
21
|
-
objectFit?: string
|
|
22
|
-
objectPosition?: string
|
|
23
|
-
lazyBoundary?: string
|
|
24
|
-
lazyRoot?: string
|
|
15
|
+
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue;
|
|
16
|
+
blurDataURL?: string;
|
|
17
|
+
unoptimized?: boolean;
|
|
18
|
+
overrideSrc?: string;
|
|
19
|
+
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete;
|
|
20
|
+
layout?: string;
|
|
21
|
+
objectFit?: string;
|
|
22
|
+
objectPosition?: string;
|
|
23
|
+
lazyBoundary?: string;
|
|
24
|
+
lazyRoot?: string;
|
|
25
25
|
} & React__default.RefAttributes<HTMLImageElement>>;
|
|
26
26
|
declare const getImageProps: (props: _NextImage.ImageProps) => {
|
|
27
27
|
props: next_dist_shared_lib_get_img_props.ImgProps;
|
|
@@ -2,26 +2,26 @@ 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>, "
|
|
5
|
+
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "alt" | "width" | "height" | "loading"> & {
|
|
6
6
|
src: string | next_dist_shared_lib_get_img_props.StaticImport;
|
|
7
7
|
alt: string;
|
|
8
|
-
width?: number | `${number}
|
|
9
|
-
height?: number | `${number}
|
|
10
|
-
fill?: boolean
|
|
11
|
-
loader?: _NextImage.ImageLoader
|
|
12
|
-
quality?: number | `${number}
|
|
13
|
-
priority?: boolean
|
|
8
|
+
width?: number | `${number}`;
|
|
9
|
+
height?: number | `${number}`;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
loader?: _NextImage.ImageLoader;
|
|
12
|
+
quality?: number | `${number}`;
|
|
13
|
+
priority?: boolean;
|
|
14
14
|
loading?: "lazy" | "eager" | undefined;
|
|
15
|
-
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue
|
|
16
|
-
blurDataURL?: string
|
|
17
|
-
unoptimized?: boolean
|
|
18
|
-
overrideSrc?: string
|
|
19
|
-
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete
|
|
20
|
-
layout?: string
|
|
21
|
-
objectFit?: string
|
|
22
|
-
objectPosition?: string
|
|
23
|
-
lazyBoundary?: string
|
|
24
|
-
lazyRoot?: string
|
|
15
|
+
placeholder?: next_dist_shared_lib_get_img_props.PlaceholderValue;
|
|
16
|
+
blurDataURL?: string;
|
|
17
|
+
unoptimized?: boolean;
|
|
18
|
+
overrideSrc?: string;
|
|
19
|
+
onLoadingComplete?: next_dist_shared_lib_get_img_props.OnLoadingComplete;
|
|
20
|
+
layout?: string;
|
|
21
|
+
objectFit?: string;
|
|
22
|
+
objectPosition?: string;
|
|
23
|
+
lazyBoundary?: string;
|
|
24
|
+
lazyRoot?: string;
|
|
25
25
|
} & React__default.RefAttributes<HTMLImageElement>>;
|
|
26
26
|
declare const getImageProps: (props: _NextImage.ImageProps) => {
|
|
27
27
|
props: next_dist_shared_lib_get_img_props.ImgProps;
|
|
@@ -42,7 +42,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
42
42
|
}
|
|
43
43
|
return to;
|
|
44
44
|
};
|
|
45
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget
|
|
45
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
46
46
|
|
|
47
47
|
// src/plugins/next-mocks/alias/headers/index.ts
|
|
48
48
|
var headers_exports = {};
|
|
@@ -20,7 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget
|
|
23
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
24
24
|
|
|
25
25
|
// src/plugins/next-mocks/alias/headers/index.ts
|
|
26
26
|
var headers_exports = {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Mock } from '@storybook/test';
|
|
2
2
|
import { NextComponentType, NextPageContext } from 'next';
|
|
3
|
-
import
|
|
4
|
-
import originalRouter__default from 'next/dist/client/router.js';
|
|
3
|
+
import singletonRouter from 'next/dist/client/router.js';
|
|
5
4
|
export { default } from 'next/dist/client/router.js';
|
|
6
5
|
import { WithRouterProps, ExcludeRouterProps } from 'next/dist/client/with-router';
|
|
7
6
|
import { NextRouter } from 'next/router.js';
|
|
@@ -13,7 +12,7 @@ export * from 'next/dist/client/router';
|
|
|
13
12
|
* @ignore
|
|
14
13
|
* @internal
|
|
15
14
|
* */
|
|
16
|
-
declare const createRouter: (overrides: Partial<NextRouter>) =>
|
|
15
|
+
declare const createRouter: (overrides: Partial<NextRouter>) => NextRouter;
|
|
17
16
|
declare const getRouter: () => {
|
|
18
17
|
push: Mock;
|
|
19
18
|
replace: Mock;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Mock } from '@storybook/test';
|
|
2
2
|
import { NextComponentType, NextPageContext } from 'next';
|
|
3
|
-
import
|
|
4
|
-
import originalRouter__default from 'next/dist/client/router.js';
|
|
3
|
+
import singletonRouter from 'next/dist/client/router.js';
|
|
5
4
|
export { default } from 'next/dist/client/router.js';
|
|
6
5
|
import { WithRouterProps, ExcludeRouterProps } from 'next/dist/client/with-router';
|
|
7
6
|
import { NextRouter } from 'next/router.js';
|
|
@@ -13,7 +12,7 @@ export * from 'next/dist/client/router';
|
|
|
13
12
|
* @ignore
|
|
14
13
|
* @internal
|
|
15
14
|
* */
|
|
16
|
-
declare const createRouter: (overrides: Partial<NextRouter>) =>
|
|
15
|
+
declare const createRouter: (overrides: Partial<NextRouter>) => NextRouter;
|
|
17
16
|
declare const getRouter: () => {
|
|
18
17
|
push: Mock;
|
|
19
18
|
replace: Mock;
|
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.7fdad3b.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",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"auto": "^11.2.0",
|
|
74
76
|
"lefthook": "^1.6.16",
|
|
75
77
|
"next": "^15.0.3",
|
|
76
|
-
"react": "
|
|
78
|
+
"react": "19.0.0-rc-66855b96-20241106",
|
|
77
79
|
"rollup": "^4.18.0",
|
|
78
80
|
"semver": "^7.6.3",
|
|
79
81
|
"sharp": "^0.33.4",
|