vite-plugin-storybook-nextjs 3.0.1 → 3.0.3--canary.ca2a5b0.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 +4 -4
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,9 +23,9 @@ var options_js = require('next/dist/build/swc/options.js');
|
|
|
23
23
|
var nextServerConfig = require('next/dist/server/config.js');
|
|
24
24
|
var constants_js = require('next/dist/shared/lib/constants.js');
|
|
25
25
|
var MagicString = require('magic-string');
|
|
26
|
+
var posix = require('path/posix');
|
|
26
27
|
var querystring = require('querystring');
|
|
27
28
|
var imageSize = require('image-size');
|
|
28
|
-
var posix = require('path/posix');
|
|
29
29
|
|
|
30
30
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
31
31
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -2770,8 +2770,8 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2770
2770
|
}
|
|
2771
2771
|
if (includePattern2.test(source) && !excludeImporterPattern.test(importer ?? "") && !importer?.startsWith(virtualImage)) {
|
|
2772
2772
|
const isAbsolute = path2__default.default.isAbsolute(id);
|
|
2773
|
-
const imagePath = importer ? isAbsolute ? source :
|
|
2774
|
-
return `${virtualImage}
|
|
2773
|
+
const imagePath = importer ? isAbsolute ? source : posix.join(path2__default.default.dirname(importer), source) : source;
|
|
2774
|
+
return `${virtualImage}?${querystring.encode({ imagePath })}`;
|
|
2775
2775
|
}
|
|
2776
2776
|
if (id === "next/image" && importer !== virtualNextImage) {
|
|
2777
2777
|
return virtualNextImage;
|
|
@@ -2818,7 +2818,7 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2818
2818
|
};
|
|
2819
2819
|
`;
|
|
2820
2820
|
} catch (err) {
|
|
2821
|
-
console.error(`Could not read
|
|
2821
|
+
console.error(`Could not read image file ${imagePath}:`, err);
|
|
2822
2822
|
return void 0;
|
|
2823
2823
|
}
|
|
2824
2824
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path2, { resolve, join } from 'path';
|
|
1
|
+
import path2, { resolve, join as join$1 } from 'path';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
4
4
|
import fs3 from 'fs';
|
|
@@ -21,9 +21,9 @@ import { getParserOptions } from 'next/dist/build/swc/options.js';
|
|
|
21
21
|
import nextServerConfig from 'next/dist/server/config.js';
|
|
22
22
|
import { PHASE_DEVELOPMENT_SERVER, PHASE_TEST, PHASE_PRODUCTION_BUILD } from 'next/dist/shared/lib/constants.js';
|
|
23
23
|
import MagicString from 'magic-string';
|
|
24
|
-
import {
|
|
24
|
+
import { join, resolve as resolve$1, sep } from 'path/posix';
|
|
25
|
+
import { decode, encode } from 'querystring';
|
|
25
26
|
import { imageSize } from 'image-size';
|
|
26
|
-
import { resolve as resolve$1, sep } from 'path/posix';
|
|
27
27
|
|
|
28
28
|
var __create = Object.create;
|
|
29
29
|
var __defProp = Object.defineProperty;
|
|
@@ -1956,7 +1956,7 @@ async function loadClosestPackageJson(dir, attempts = 1) {
|
|
|
1956
1956
|
const mainPath = attempts === 1 ? ["."] : new Array(attempts).fill("..");
|
|
1957
1957
|
try {
|
|
1958
1958
|
const file = await fs3.promises.readFile(
|
|
1959
|
-
join(dir, ...mainPath, "package.json"),
|
|
1959
|
+
join$1(dir, ...mainPath, "package.json"),
|
|
1960
1960
|
"utf8"
|
|
1961
1961
|
);
|
|
1962
1962
|
return JSON.parse(file);
|
|
@@ -2736,8 +2736,8 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2736
2736
|
}
|
|
2737
2737
|
if (includePattern2.test(source) && !excludeImporterPattern.test(importer ?? "") && !importer?.startsWith(virtualImage)) {
|
|
2738
2738
|
const isAbsolute = path2.isAbsolute(id);
|
|
2739
|
-
const imagePath = importer ? isAbsolute ? source :
|
|
2740
|
-
return `${virtualImage}
|
|
2739
|
+
const imagePath = importer ? isAbsolute ? source : join(path2.dirname(importer), source) : source;
|
|
2740
|
+
return `${virtualImage}?${encode({ imagePath })}`;
|
|
2741
2741
|
}
|
|
2742
2742
|
if (id === "next/image" && importer !== virtualNextImage) {
|
|
2743
2743
|
return virtualNextImage;
|
|
@@ -2784,7 +2784,7 @@ function vitePluginNextImage(nextConfigResolver) {
|
|
|
2784
2784
|
};
|
|
2785
2785
|
`;
|
|
2786
2786
|
} catch (err) {
|
|
2787
|
-
console.error(`Could not read
|
|
2787
|
+
console.error(`Could not read image file ${imagePath}:`, err);
|
|
2788
2788
|
return void 0;
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|