minista 3.1.7 → 3.1.8
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/config/sub.js +1 -4
- package/dist/transform/image.js +5 -4
- package/package.json +1 -1
package/dist/config/sub.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { normalizePath } from "vite";
|
|
3
2
|
import { resolveEntry } from "./entry.js";
|
|
4
3
|
import { resolveAlias } from "./alias.js";
|
|
5
4
|
import { resolveBase } from "../utility/base.js";
|
|
6
5
|
import { getNodeModulesPath } from "../utility/path.js";
|
|
7
6
|
async function resolveSubConfig(mainConfig) {
|
|
8
|
-
const resolvedRoot =
|
|
9
|
-
mainConfig.root ? path.resolve(mainConfig.root) : process.cwd()
|
|
10
|
-
);
|
|
7
|
+
const resolvedRoot = mainConfig.root ? path.resolve(mainConfig.root) : process.cwd();
|
|
11
8
|
const resolvedBase = resolveBase(mainConfig.base);
|
|
12
9
|
const configEntry = mainConfig.assets.entry;
|
|
13
10
|
const viteConfigEntry = mainConfig.vite.build?.rollupOptions?.input || "";
|
package/dist/transform/image.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import { lookup } from "mime-types";
|
|
4
4
|
import imageSize from "image-size";
|
|
5
|
+
import { normalizePath } from "vite";
|
|
5
6
|
import { resolveImageOptimize } from "../config/image.js";
|
|
6
7
|
import { generateImageCache, generateTempImage } from "../generate/image.js";
|
|
7
8
|
import { getElements, cleanElement } from "../utility/element.js";
|
|
@@ -198,7 +199,7 @@ async function transformImages({
|
|
|
198
199
|
el.setAttribute("sizes", view.sizes);
|
|
199
200
|
if (command === "serve") {
|
|
200
201
|
let fileName = entry.fileName;
|
|
201
|
-
let filePath = fileName.replace(resolvedRoot, "");
|
|
202
|
+
let filePath = normalizePath(fileName.replace(resolvedRoot, ""));
|
|
202
203
|
if (view.aspectHeight !== entry.aspectHeight) {
|
|
203
204
|
let width = 1;
|
|
204
205
|
let height = 1;
|
|
@@ -208,7 +209,7 @@ async function transformImages({
|
|
|
208
209
|
height = height > entry.height ? entry.height : height;
|
|
209
210
|
const tempFileName = `${name}-${width}x${height}.${ext}`;
|
|
210
211
|
fileName = path.join(cacheDir, tempFileName);
|
|
211
|
-
filePath = fileName.replace(resolvedRoot, "");
|
|
212
|
+
filePath = normalizePath(fileName.replace(resolvedRoot, ""));
|
|
212
213
|
if (!await fs.pathExists(fileName)) {
|
|
213
214
|
const createImage = {
|
|
214
215
|
input: entry.fileName,
|
|
@@ -253,7 +254,7 @@ async function transformImages({
|
|
|
253
254
|
let fileName = `${name}-${width}x${height}.${outFormat}`;
|
|
254
255
|
fileName = path.join(outDir, fileName);
|
|
255
256
|
createImages && (createImages[fileName] = createImage);
|
|
256
|
-
const filePath = path.join(resolvedBase, fileName);
|
|
257
|
+
const filePath = normalizePath(path.join(resolvedBase, fileName));
|
|
257
258
|
src = filePath;
|
|
258
259
|
return `${filePath} ${width}w`;
|
|
259
260
|
});
|
|
@@ -275,7 +276,7 @@ async function transformImages({
|
|
|
275
276
|
let fileName = `${name}-${width}x${height}.${outFormat}`;
|
|
276
277
|
fileName = path.join(outDir, fileName);
|
|
277
278
|
createImages && (createImages[fileName] = createImage);
|
|
278
|
-
const filePath = path.join(resolvedBase, fileName);
|
|
279
|
+
const filePath = normalizePath(path.join(resolvedBase, fileName));
|
|
279
280
|
index === 0 && (src = filePath);
|
|
280
281
|
return `${filePath} ${scale}x`;
|
|
281
282
|
});
|