minista 3.1.8 → 3.1.10
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/cli/build.js +6 -3
- package/dist/config/vite.js +14 -10
- package/dist/generate/sprite.js +3 -2
- package/dist/transform/entry.js +4 -1
- package/dist/transform/icon.js +2 -1
- package/package.json +1 -1
package/dist/cli/build.js
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
defineConfig as defineViteConfig,
|
|
6
6
|
mergeConfig as mergeViteConfig,
|
|
7
7
|
build as viteBuild,
|
|
8
|
-
createLogger
|
|
8
|
+
createLogger,
|
|
9
|
+
normalizePath
|
|
9
10
|
} from "vite";
|
|
10
11
|
import { parse as parseHtml } from "node-html-parser";
|
|
11
12
|
import { resolveConfig } from "../config/index.js";
|
|
@@ -210,8 +211,10 @@ async function build(inlineConfig = {}) {
|
|
|
210
211
|
cssNameBugFix = Object.fromEntries(
|
|
211
212
|
Object.entries(assetEntries).map((item) => {
|
|
212
213
|
return [
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
normalizePath(
|
|
215
|
+
path.join(assets.outDir, path.parse(item[1]).name + ".css")
|
|
216
|
+
),
|
|
217
|
+
normalizePath(path.join(assets.outDir, item[0] + ".css"))
|
|
215
218
|
];
|
|
216
219
|
})
|
|
217
220
|
);
|
package/dist/config/vite.js
CHANGED
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
defineConfig as defineViteConfig,
|
|
5
5
|
mergeConfig as mergeViteConfig,
|
|
6
6
|
searchForWorkspaceRoot,
|
|
7
|
-
createLogger
|
|
7
|
+
createLogger,
|
|
8
|
+
normalizePath
|
|
8
9
|
} from "vite";
|
|
9
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
11
|
const __dirname = path.dirname(__filename);
|
|
@@ -12,20 +13,23 @@ function resolveViteAssetFileNames(chunkInfo, mainConfig) {
|
|
|
12
13
|
const filePath = chunkInfo.name || "";
|
|
13
14
|
const fileExt = path.extname(filePath);
|
|
14
15
|
if (fileExt.match(/\.(jpg|jpeg|gif|png|webp|svg)/)) {
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
return normalizePath(
|
|
17
|
+
path.join(
|
|
18
|
+
mainConfig.assets.images.outDir,
|
|
19
|
+
mainConfig.assets.images.outName + ".[ext]"
|
|
20
|
+
)
|
|
18
21
|
);
|
|
19
22
|
}
|
|
20
23
|
if (fileExt.match(/\.(woff|woff2|eot|ttf|otf)/)) {
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
return normalizePath(
|
|
25
|
+
path.join(
|
|
26
|
+
mainConfig.assets.fonts.outDir,
|
|
27
|
+
mainConfig.assets.fonts.outName + ".[ext]"
|
|
28
|
+
)
|
|
24
29
|
);
|
|
25
30
|
}
|
|
26
|
-
return
|
|
27
|
-
mainConfig.assets.outDir,
|
|
28
|
-
mainConfig.assets.outName + ".[ext]"
|
|
31
|
+
return normalizePath(
|
|
32
|
+
path.join(mainConfig.assets.outDir, mainConfig.assets.outName + ".[ext]")
|
|
29
33
|
);
|
|
30
34
|
}
|
|
31
35
|
async function resolveViteConfig(mainConfig, subConfig) {
|
package/dist/generate/sprite.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import fg from "fast-glob";
|
|
4
|
+
import { normalizePath } from "vite";
|
|
4
5
|
import { logger } from "../cli/logger.js";
|
|
5
6
|
import { transformSprite } from "../transform/sprite.js";
|
|
6
7
|
import { getSpace } from "../utility/space.js";
|
|
@@ -12,7 +13,7 @@ async function generateTempSprite({
|
|
|
12
13
|
const { resolvedRoot } = config.sub;
|
|
13
14
|
const options = config.main.assets.icons.svgstoreOptions;
|
|
14
15
|
const filePath = fileName.replace(resolvedRoot, "");
|
|
15
|
-
const svgFiles = await fg(path.join(srcDir, "**/*.svg"));
|
|
16
|
+
const svgFiles = await fg(normalizePath(path.join(srcDir, "**/*.svg")));
|
|
16
17
|
if (!svgFiles.length) {
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
@@ -41,7 +42,7 @@ async function generateSprites({
|
|
|
41
42
|
createArray.map(async (item) => {
|
|
42
43
|
const srcDir = item[0];
|
|
43
44
|
const fileName = item[1];
|
|
44
|
-
const svgFiles = await fg(path.join(srcDir, "**/*.svg"));
|
|
45
|
+
const svgFiles = await fg(normalizePath(path.join(srcDir, "**/*.svg")));
|
|
45
46
|
if (!svgFiles.length) {
|
|
46
47
|
return;
|
|
47
48
|
}
|
package/dist/transform/entry.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
+
import { normalizePath } from "vite";
|
|
3
4
|
import { flags } from "../config/system.js";
|
|
4
5
|
import { getElements, cleanElement } from "../utility/element.js";
|
|
5
6
|
import { getUniquePaths } from "../utility/path.js";
|
|
@@ -59,7 +60,9 @@ async function transformEntries({
|
|
|
59
60
|
const name = item.name ? item.name : path.parse(src).name;
|
|
60
61
|
const outDir = assets.outDir;
|
|
61
62
|
const outName = assets.outName.replace(/\[name\]/, name);
|
|
62
|
-
const assetPath =
|
|
63
|
+
const assetPath = normalizePath(
|
|
64
|
+
path.join(resolvedBase, outDir, `${outName}.${outExt}`)
|
|
65
|
+
);
|
|
63
66
|
isScript ? scriptEntries[name] = src : linkEntries[name] = src;
|
|
64
67
|
if (isScript && item.type) {
|
|
65
68
|
item.type === "false" ? el.removeAttribute("type") : el.setAttribute("type", item.type);
|
package/dist/transform/icon.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
+
import { normalizePath } from "vite";
|
|
3
4
|
import { syncTempSprite } from "../server/sprite.js";
|
|
4
5
|
import { getElements, cleanElement } from "../utility/element.js";
|
|
5
6
|
import { getUniquePaths } from "../utility/path.js";
|
|
@@ -62,7 +63,7 @@ async function transformIcons({
|
|
|
62
63
|
const { el, srcDir, iconId } = item;
|
|
63
64
|
const fileName = cacheData[srcDir];
|
|
64
65
|
const hrefOptions = command === "serve" ? { remove: resolvedRoot } : { add: resolvedBase };
|
|
65
|
-
const href = getIconHref(fileName, iconId, hrefOptions);
|
|
66
|
+
const href = normalizePath(getIconHref(fileName, iconId, hrefOptions));
|
|
66
67
|
el.setAttribute("href", href);
|
|
67
68
|
cleanElement(el, cleanAttributes);
|
|
68
69
|
return;
|