minista 3.1.11 → 3.1.12

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.
@@ -1,4 +1,5 @@
1
1
  import path from "node:path";
2
+ import { normalizePath } from "vite";
2
3
  import { flags } from "../config/system.js";
3
4
  import { cleanElement } from "../utility/element.js";
4
5
  import { getHtmlPath } from "../utility/path.js";
@@ -8,10 +9,12 @@ function getRelativePath({
8
9
  replaceTarget,
9
10
  assetPath
10
11
  }) {
11
- const pagePath = path.dirname(getHtmlPath(pathname));
12
+ const pagePath = path.dirname(getHtmlPath(pathname)).replace(/^[\\]+/, ".");
12
13
  let resolvedPath = assetPath.replace(/\n/, "").trim();
13
14
  if (!resolvedPath.includes(",") && resolvedPath.startsWith(replaceTarget)) {
14
- return path.relative(pagePath, path.join("./", resolvedPath));
15
+ return normalizePath(
16
+ path.relative(pagePath, resolvedPath.replace(/^[\/\\]+/, ""))
17
+ );
15
18
  }
16
19
  if (!resolvedPath.includes(",")) {
17
20
  return resolvedPath;
@@ -19,7 +22,9 @@ function getRelativePath({
19
22
  resolvedPath = resolvedPath.split(",").map((s) => s.trim()).map((s) => {
20
23
  let [url, density] = s.split(/\s+/);
21
24
  if (url.startsWith(replaceTarget)) {
22
- url = path.relative(pagePath, path.join("./", url));
25
+ url = normalizePath(
26
+ path.relative(pagePath, path.join("./", url).replace(/^[\/\\]+/, ""))
27
+ );
23
28
  }
24
29
  return `${url} ${density}`;
25
30
  }).join(", ");
@@ -55,7 +60,7 @@ function transformRelative({
55
60
  if (assetPath) {
56
61
  const relativePaths = getRelativePath({
57
62
  pathname,
58
- replaceTarget: path.join("/", outDir),
63
+ replaceTarget: normalizePath(path.join("/", outDir)),
59
64
  assetPath
60
65
  });
61
66
  el.setAttribute(attr, relativePaths);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minista",
3
3
  "description": "Static site generator with 100% static export from React and Vite",
4
- "version": "3.1.11",
4
+ "version": "3.1.12",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=14.15.0"