vite-plugin-storybook-nextjs 0.0.13--canary.8.c64d6ac.0 → 0.0.14
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 +19 -8
- package/dist/index.js +19 -8
- package/dist/mocks/storybook.global.cjs +18 -28
- package/dist/mocks/storybook.global.js +18 -25
- package/dist/plugins/next-image/alias/next-image.d.cts +1 -1
- package/dist/plugins/next-image/alias/next-image.d.ts +1 -1
- package/dist/plugins/next-mocks/alias/cache/index.cjs +6 -12
- package/dist/plugins/next-mocks/alias/cache/index.d.cts +5 -7
- package/dist/plugins/next-mocks/alias/cache/index.d.ts +5 -7
- package/dist/plugins/next-mocks/alias/cache/index.js +3 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var fs3 = require('fs');
|
|
|
7
7
|
var env = require('@next/env');
|
|
8
8
|
var Log = require('next/dist/build/output/log.js');
|
|
9
9
|
var index_js = require('next/dist/build/swc/index.js');
|
|
10
|
-
var constants_js = require('next/dist/shared/lib/constants.js');
|
|
11
10
|
var fs2 = require('fs/promises');
|
|
12
11
|
var fetchCssFromGoogleFonts_js = require('next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js');
|
|
13
12
|
var getFontAxes_js = require('next/dist/compiled/@next/font/dist/google/get-font-axes.js');
|
|
@@ -21,6 +20,7 @@ var findPagesDir_js = require('next/dist/lib/find-pages-dir.js');
|
|
|
21
20
|
var utils_js = require('next/dist/build/utils.js');
|
|
22
21
|
var options_js = require('next/dist/build/swc/options.js');
|
|
23
22
|
var loadConfig = require('next/dist/server/config.js');
|
|
23
|
+
var constants_js = require('next/dist/shared/lib/constants.js');
|
|
24
24
|
var os = require('os');
|
|
25
25
|
var querystring = require('querystring');
|
|
26
26
|
var imageSizeOf = require('image-size');
|
|
@@ -37,7 +37,12 @@ var loadJsConfig__default = /*#__PURE__*/_interopDefault(loadJsConfig);
|
|
|
37
37
|
var loadConfig__default = /*#__PURE__*/_interopDefault(loadConfig);
|
|
38
38
|
var imageSizeOf__default = /*#__PURE__*/_interopDefault(imageSizeOf);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
41
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
42
|
+
}) : x)(function(x) {
|
|
43
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
44
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
45
|
+
});
|
|
41
46
|
var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
|
|
42
47
|
async function loadEnvironmentConfig(dir, dev) {
|
|
43
48
|
return env.loadEnvConfig(dir, dev, Log__default.default);
|
|
@@ -727,6 +732,13 @@ if (typeof Promise.withResolvers === "undefined") {
|
|
|
727
732
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
728
733
|
var isVitestEnv = process.env.VITEST === "true";
|
|
729
734
|
|
|
735
|
+
// src/plugins/next-image/alias/index.tsx
|
|
736
|
+
var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
737
|
+
var getAlias = (env) => ({
|
|
738
|
+
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
739
|
+
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
740
|
+
});
|
|
741
|
+
|
|
730
742
|
// src/plugins/next-image/plugin.ts
|
|
731
743
|
var includePattern2 = /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/;
|
|
732
744
|
var excludeImporterPattern = /\.(css|scss|sass)$/;
|
|
@@ -746,11 +758,6 @@ try {
|
|
|
746
758
|
"You have to install sharp in order to use image optimization features in Next.js. AVIF support is also disabled."
|
|
747
759
|
);
|
|
748
760
|
}
|
|
749
|
-
var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
750
|
-
var getAlias = (env) => ({
|
|
751
|
-
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
752
|
-
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
753
|
-
});
|
|
754
761
|
function vitePluginNextImage(nextConfigResolver) {
|
|
755
762
|
let isBrowser = !isVitestEnv;
|
|
756
763
|
return {
|
|
@@ -846,15 +853,19 @@ var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/$
|
|
|
846
853
|
var getAlias2 = (env) => ({
|
|
847
854
|
"next/headers": getEntryPoint2("headers", env),
|
|
848
855
|
"@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
|
|
856
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint2("headers", env),
|
|
849
857
|
"next/navigation": getEntryPoint2("navigation", env),
|
|
850
858
|
"@storybook/nextjs/navigation.mock": getEntryPoint2("navigation", env),
|
|
859
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint2("navigation", env),
|
|
851
860
|
"next/router": getEntryPoint2("router", env),
|
|
852
861
|
"@storybook/nextjs/router.mock": getEntryPoint2("router", env),
|
|
862
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint2("router", env),
|
|
853
863
|
"next/cache": getEntryPoint2("cache", env),
|
|
854
864
|
"@storybook/nextjs/cache.mock": getEntryPoint2("cache", env),
|
|
865
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
|
|
855
866
|
"server-only": getEntryPoint2("server-only", env),
|
|
856
867
|
"@opentelemetry/api": require4.resolve(
|
|
857
|
-
"next/dist/compiled/@opentelemetry/api
|
|
868
|
+
"next/dist/compiled/@opentelemetry/api"
|
|
858
869
|
)
|
|
859
870
|
});
|
|
860
871
|
var vitePluginNextMocks = () => ({
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import fs3 from 'node:fs';
|
|
|
5
5
|
import { loadEnvConfig } from '@next/env';
|
|
6
6
|
import Log from 'next/dist/build/output/log.js';
|
|
7
7
|
import { transform, loadBindings, lockfilePatchPromise } from 'next/dist/build/swc/index.js';
|
|
8
|
-
import { PHASE_DEVELOPMENT_SERVER, PHASE_TEST, PHASE_PRODUCTION_BUILD } from 'next/dist/shared/lib/constants.js';
|
|
9
8
|
import fs2 from 'node:fs/promises';
|
|
10
9
|
import { fetchCSSFromGoogleFonts } from 'next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js';
|
|
11
10
|
import { getFontAxes } from 'next/dist/compiled/@next/font/dist/google/get-font-axes.js';
|
|
@@ -19,11 +18,17 @@ import { findPagesDir } from 'next/dist/lib/find-pages-dir.js';
|
|
|
19
18
|
import { getSupportedBrowsers } from 'next/dist/build/utils.js';
|
|
20
19
|
import { getParserOptions } from 'next/dist/build/swc/options.js';
|
|
21
20
|
import loadConfig from 'next/dist/server/config.js';
|
|
21
|
+
import { PHASE_DEVELOPMENT_SERVER, PHASE_TEST, PHASE_PRODUCTION_BUILD } from 'next/dist/shared/lib/constants.js';
|
|
22
22
|
import { cpus } from 'node:os';
|
|
23
23
|
import { decode } from 'node:querystring';
|
|
24
24
|
import imageSizeOf from 'image-size';
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
27
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
28
|
+
}) : x)(function(x) {
|
|
29
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
30
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
31
|
+
});
|
|
27
32
|
var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
|
|
28
33
|
async function loadEnvironmentConfig(dir, dev) {
|
|
29
34
|
return loadEnvConfig(dir, dev, Log);
|
|
@@ -713,6 +718,13 @@ if (typeof Promise.withResolvers === "undefined") {
|
|
|
713
718
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
714
719
|
var isVitestEnv = process.env.VITEST === "true";
|
|
715
720
|
|
|
721
|
+
// src/plugins/next-image/alias/index.tsx
|
|
722
|
+
var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
723
|
+
var getAlias = (env) => ({
|
|
724
|
+
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
725
|
+
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
726
|
+
});
|
|
727
|
+
|
|
716
728
|
// src/plugins/next-image/plugin.ts
|
|
717
729
|
var includePattern2 = /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/;
|
|
718
730
|
var excludeImporterPattern = /\.(css|scss|sass)$/;
|
|
@@ -732,11 +744,6 @@ try {
|
|
|
732
744
|
"You have to install sharp in order to use image optimization features in Next.js. AVIF support is also disabled."
|
|
733
745
|
);
|
|
734
746
|
}
|
|
735
|
-
var getEntryPoint = (subPath, env) => require3.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
736
|
-
var getAlias = (env) => ({
|
|
737
|
-
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
738
|
-
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
739
|
-
});
|
|
740
747
|
function vitePluginNextImage(nextConfigResolver) {
|
|
741
748
|
let isBrowser = !isVitestEnv;
|
|
742
749
|
return {
|
|
@@ -832,15 +839,19 @@ var getEntryPoint2 = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/$
|
|
|
832
839
|
var getAlias2 = (env) => ({
|
|
833
840
|
"next/headers": getEntryPoint2("headers", env),
|
|
834
841
|
"@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
|
|
842
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint2("headers", env),
|
|
835
843
|
"next/navigation": getEntryPoint2("navigation", env),
|
|
836
844
|
"@storybook/nextjs/navigation.mock": getEntryPoint2("navigation", env),
|
|
845
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint2("navigation", env),
|
|
837
846
|
"next/router": getEntryPoint2("router", env),
|
|
838
847
|
"@storybook/nextjs/router.mock": getEntryPoint2("router", env),
|
|
848
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint2("router", env),
|
|
839
849
|
"next/cache": getEntryPoint2("cache", env),
|
|
840
850
|
"@storybook/nextjs/cache.mock": getEntryPoint2("cache", env),
|
|
851
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
|
|
841
852
|
"server-only": getEntryPoint2("server-only", env),
|
|
842
853
|
"@opentelemetry/api": require4.resolve(
|
|
843
|
-
"next/dist/compiled/@opentelemetry/api
|
|
854
|
+
"next/dist/compiled/@opentelemetry/api"
|
|
844
855
|
)
|
|
845
856
|
});
|
|
846
857
|
var vitePluginNextMocks = () => ({
|
|
@@ -2,65 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
4
|
var moduleAlias = require('module-alias');
|
|
5
|
-
require('fs');
|
|
6
|
-
var os = require('os');
|
|
7
|
-
require('path');
|
|
8
|
-
require('querystring');
|
|
9
|
-
require('image-size');
|
|
10
|
-
require('ts-dedent');
|
|
11
5
|
|
|
12
6
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
8
|
|
|
15
9
|
var moduleAlias__default = /*#__PURE__*/_interopDefault(moduleAlias);
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
12
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
13
|
+
}) : x)(function(x) {
|
|
14
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
15
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
|
+
});
|
|
18
17
|
|
|
19
18
|
// src/utils.ts
|
|
20
19
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
21
20
|
process.env.VITEST === "true";
|
|
22
21
|
|
|
23
|
-
// src/plugins/next-image/
|
|
24
|
-
var
|
|
25
|
-
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
26
|
-
try {
|
|
27
|
-
sharp = require2("sharp");
|
|
28
|
-
if (sharp && sharp.concurrency() > 1) {
|
|
29
|
-
const divisor = process.env.NODE_ENV === "development" ? 4 : 2;
|
|
30
|
-
sharp.concurrency(Math.floor(Math.max(os.cpus().length / divisor, 1)));
|
|
31
|
-
}
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.warn(
|
|
34
|
-
"You have to install sharp in order to use image optimization features in Next.js. AVIF support is also disabled."
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
22
|
+
// src/plugins/next-image/alias/index.tsx
|
|
23
|
+
var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
38
24
|
var getAlias = (env) => ({
|
|
39
25
|
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
40
26
|
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
41
27
|
});
|
|
42
|
-
var
|
|
43
|
-
var getEntryPoint2 = (subPath, env) =>
|
|
28
|
+
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
29
|
+
var getEntryPoint2 = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
44
30
|
var getAlias2 = (env) => ({
|
|
45
31
|
"next/headers": getEntryPoint2("headers", env),
|
|
46
32
|
"@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
|
|
33
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint2("headers", env),
|
|
47
34
|
"next/navigation": getEntryPoint2("navigation", env),
|
|
48
35
|
"@storybook/nextjs/navigation.mock": getEntryPoint2("navigation", env),
|
|
36
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint2("navigation", env),
|
|
49
37
|
"next/router": getEntryPoint2("router", env),
|
|
50
38
|
"@storybook/nextjs/router.mock": getEntryPoint2("router", env),
|
|
39
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint2("router", env),
|
|
51
40
|
"next/cache": getEntryPoint2("cache", env),
|
|
52
41
|
"@storybook/nextjs/cache.mock": getEntryPoint2("cache", env),
|
|
42
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
|
|
53
43
|
"server-only": getEntryPoint2("server-only", env),
|
|
54
|
-
"@opentelemetry/api":
|
|
55
|
-
"next/dist/compiled/@opentelemetry/api
|
|
44
|
+
"@opentelemetry/api": require2.resolve(
|
|
45
|
+
"next/dist/compiled/@opentelemetry/api"
|
|
56
46
|
)
|
|
57
47
|
});
|
|
58
48
|
|
|
59
49
|
// src/mocks/storybook.global.ts
|
|
60
|
-
var
|
|
50
|
+
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
|
|
61
51
|
moduleAlias__default.default.addAliases({
|
|
62
52
|
react: "next/dist/compiled/react",
|
|
63
|
-
"react-dom/test-utils":
|
|
53
|
+
"react-dom/test-utils": require3.resolve(
|
|
64
54
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
65
55
|
),
|
|
66
56
|
"react-dom": "next/dist/compiled/react-dom",
|
|
@@ -1,56 +1,49 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import moduleAlias from 'module-alias';
|
|
3
|
-
import { cpus } from 'node:os';
|
|
4
|
-
import 'image-size';
|
|
5
|
-
import 'ts-dedent';
|
|
6
3
|
|
|
7
|
-
|
|
4
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
+
}) : x)(function(x) {
|
|
7
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
+
});
|
|
8
10
|
|
|
9
11
|
// src/utils.ts
|
|
10
12
|
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
11
13
|
process.env.VITEST === "true";
|
|
12
14
|
|
|
13
|
-
// src/plugins/next-image/
|
|
14
|
-
var
|
|
15
|
-
var require2 = createRequire(import.meta.url);
|
|
16
|
-
try {
|
|
17
|
-
sharp = require2("sharp");
|
|
18
|
-
if (sharp && sharp.concurrency() > 1) {
|
|
19
|
-
const divisor = process.env.NODE_ENV === "development" ? 4 : 2;
|
|
20
|
-
sharp.concurrency(Math.floor(Math.max(cpus().length / divisor, 1)));
|
|
21
|
-
}
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.warn(
|
|
24
|
-
"You have to install sharp in order to use image optimization features in Next.js. AVIF support is also disabled."
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
var getEntryPoint = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
15
|
+
// src/plugins/next-image/alias/index.tsx
|
|
16
|
+
var getEntryPoint = (subPath, env) => __require.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
28
17
|
var getAlias = (env) => ({
|
|
29
18
|
"sb-original/default-loader": getEntryPoint("image-default-loader", env),
|
|
30
19
|
"sb-original/image-context": getEntryPoint("image-context", env)
|
|
31
20
|
});
|
|
32
|
-
var
|
|
33
|
-
var getEntryPoint2 = (subPath, env) =>
|
|
21
|
+
var require2 = createRequire(import.meta.url);
|
|
22
|
+
var getEntryPoint2 = (subPath, env) => require2.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
34
23
|
var getAlias2 = (env) => ({
|
|
35
24
|
"next/headers": getEntryPoint2("headers", env),
|
|
36
25
|
"@storybook/nextjs/headers.mock": getEntryPoint2("headers", env),
|
|
26
|
+
"@storybook/nextjs-vite/headers.mock": getEntryPoint2("headers", env),
|
|
37
27
|
"next/navigation": getEntryPoint2("navigation", env),
|
|
38
28
|
"@storybook/nextjs/navigation.mock": getEntryPoint2("navigation", env),
|
|
29
|
+
"@storybook/nextjs-vite/navigation.mock": getEntryPoint2("navigation", env),
|
|
39
30
|
"next/router": getEntryPoint2("router", env),
|
|
40
31
|
"@storybook/nextjs/router.mock": getEntryPoint2("router", env),
|
|
32
|
+
"@storybook/nextjs-vite/router.mock": getEntryPoint2("router", env),
|
|
41
33
|
"next/cache": getEntryPoint2("cache", env),
|
|
42
34
|
"@storybook/nextjs/cache.mock": getEntryPoint2("cache", env),
|
|
35
|
+
"@storybook/nextjs-vite/cache.mock": getEntryPoint2("cache", env),
|
|
43
36
|
"server-only": getEntryPoint2("server-only", env),
|
|
44
|
-
"@opentelemetry/api":
|
|
45
|
-
"next/dist/compiled/@opentelemetry/api
|
|
37
|
+
"@opentelemetry/api": require2.resolve(
|
|
38
|
+
"next/dist/compiled/@opentelemetry/api"
|
|
46
39
|
)
|
|
47
40
|
});
|
|
48
41
|
|
|
49
42
|
// src/mocks/storybook.global.ts
|
|
50
|
-
var
|
|
43
|
+
var require3 = createRequire(import.meta.url);
|
|
51
44
|
moduleAlias.addAliases({
|
|
52
45
|
react: "next/dist/compiled/react",
|
|
53
|
-
"react-dom/test-utils":
|
|
46
|
+
"react-dom/test-utils": require3.resolve(
|
|
54
47
|
"next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"
|
|
55
48
|
),
|
|
56
49
|
"react-dom": "next/dist/compiled/react-dom",
|
|
@@ -2,7 +2,7 @@ import * as next_dist_shared_lib_get_img_props from 'next/dist/shared/lib/get-im
|
|
|
2
2
|
import * as _NextImage from 'next/image';
|
|
3
3
|
import React__default from 'next/dist/compiled/react';
|
|
4
4
|
|
|
5
|
-
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "
|
|
5
|
+
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "width" | "height" | "loading" | "alt"> & {
|
|
6
6
|
src: string | next_dist_shared_lib_get_img_props.StaticImport;
|
|
7
7
|
alt: string;
|
|
8
8
|
width?: number | `${number}` | undefined;
|
|
@@ -2,7 +2,7 @@ import * as next_dist_shared_lib_get_img_props from 'next/dist/shared/lib/get-im
|
|
|
2
2
|
import * as _NextImage from 'next/image';
|
|
3
3
|
import React__default from 'next/dist/compiled/react';
|
|
4
4
|
|
|
5
|
-
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "
|
|
5
|
+
declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "width" | "height" | "loading" | "alt"> & {
|
|
6
6
|
src: string | next_dist_shared_lib_get_img_props.StaticImport;
|
|
7
7
|
alt: string;
|
|
8
8
|
width?: number | `${number}` | undefined;
|
|
@@ -3,28 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var test = require('@storybook/test');
|
|
6
|
-
var unstableCache_js = require('next/dist/server/web/spec-extension/unstable-cache.js');
|
|
7
|
-
var unstableNoStore_js = require('next/dist/server/web/spec-extension/unstable-no-store.js');
|
|
8
6
|
|
|
9
7
|
// src/plugins/next-mocks/alias/cache/index.ts
|
|
10
8
|
var revalidatePath = test.fn().mockName("next/cache::revalidatePath");
|
|
11
9
|
var revalidateTag = test.fn().mockName("next/cache::revalidateTag");
|
|
10
|
+
var unstable_cache = test.fn().mockName("next/cache::unstable_cache").mockImplementation((cb) => cb);
|
|
11
|
+
var unstable_noStore = test.fn().mockName("next/cache::unstable_noStore");
|
|
12
12
|
var cacheExports = {
|
|
13
|
-
unstable_cache
|
|
13
|
+
unstable_cache,
|
|
14
14
|
revalidateTag,
|
|
15
15
|
revalidatePath,
|
|
16
|
-
unstable_noStore
|
|
16
|
+
unstable_noStore
|
|
17
17
|
};
|
|
18
18
|
var cache_default = cacheExports;
|
|
19
19
|
|
|
20
|
-
Object.defineProperty(exports, "unstable_cache", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return unstableCache_js.unstable_cache; }
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "unstable_noStore", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return unstableNoStore_js.unstable_noStore; }
|
|
27
|
-
});
|
|
28
20
|
exports.default = cache_default;
|
|
29
21
|
exports.revalidatePath = revalidatePath;
|
|
30
22
|
exports.revalidateTag = revalidateTag;
|
|
23
|
+
exports.unstable_cache = unstable_cache;
|
|
24
|
+
exports.unstable_noStore = unstable_noStore;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as vitest from 'vitest';
|
|
2
|
-
import { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
|
|
3
|
-
export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
|
|
4
|
-
import { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
|
|
5
|
-
export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
|
|
6
2
|
|
|
7
3
|
declare const revalidatePath: vitest.Mock<any, any>;
|
|
8
4
|
declare const revalidateTag: vitest.Mock<any, any>;
|
|
5
|
+
declare const unstable_cache: vitest.Mock<any, any>;
|
|
6
|
+
declare const unstable_noStore: vitest.Mock<any, any>;
|
|
9
7
|
declare const cacheExports: {
|
|
10
|
-
unstable_cache:
|
|
8
|
+
unstable_cache: vitest.Mock<any, any>;
|
|
11
9
|
revalidateTag: vitest.Mock<any, any>;
|
|
12
10
|
revalidatePath: vitest.Mock<any, any>;
|
|
13
|
-
unstable_noStore:
|
|
11
|
+
unstable_noStore: vitest.Mock<any, any>;
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
export { cacheExports as default, revalidatePath, revalidateTag };
|
|
14
|
+
export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as vitest from 'vitest';
|
|
2
|
-
import { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
|
|
3
|
-
export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
|
|
4
|
-
import { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
|
|
5
|
-
export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
|
|
6
2
|
|
|
7
3
|
declare const revalidatePath: vitest.Mock<any, any>;
|
|
8
4
|
declare const revalidateTag: vitest.Mock<any, any>;
|
|
5
|
+
declare const unstable_cache: vitest.Mock<any, any>;
|
|
6
|
+
declare const unstable_noStore: vitest.Mock<any, any>;
|
|
9
7
|
declare const cacheExports: {
|
|
10
|
-
unstable_cache:
|
|
8
|
+
unstable_cache: vitest.Mock<any, any>;
|
|
11
9
|
revalidateTag: vitest.Mock<any, any>;
|
|
12
10
|
revalidatePath: vitest.Mock<any, any>;
|
|
13
|
-
unstable_noStore:
|
|
11
|
+
unstable_noStore: vitest.Mock<any, any>;
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
export { cacheExports as default, revalidatePath, revalidateTag };
|
|
14
|
+
export { cacheExports as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { fn } from '@storybook/test';
|
|
2
|
-
import { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
|
|
3
|
-
export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
|
|
4
|
-
import { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
|
|
5
|
-
export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
|
|
6
2
|
|
|
7
3
|
// src/plugins/next-mocks/alias/cache/index.ts
|
|
8
4
|
var revalidatePath = fn().mockName("next/cache::revalidatePath");
|
|
9
5
|
var revalidateTag = fn().mockName("next/cache::revalidateTag");
|
|
6
|
+
var unstable_cache = fn().mockName("next/cache::unstable_cache").mockImplementation((cb) => cb);
|
|
7
|
+
var unstable_noStore = fn().mockName("next/cache::unstable_noStore");
|
|
10
8
|
var cacheExports = {
|
|
11
9
|
unstable_cache,
|
|
12
10
|
revalidateTag,
|
|
@@ -15,4 +13,4 @@ var cacheExports = {
|
|
|
15
13
|
};
|
|
16
14
|
var cache_default = cacheExports;
|
|
17
15
|
|
|
18
|
-
export { cache_default as default, revalidatePath, revalidateTag };
|
|
16
|
+
export { cache_default as default, revalidatePath, revalidateTag, unstable_cache, unstable_noStore };
|