site-config-stack 1.0.4 → 1.0.6

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 CHANGED
@@ -63,11 +63,12 @@ function resolveSitePath(pathOrUrl, options) {
63
63
  return path === "/" ? ufo.withTrailingSlash(resolvedUrl) : fixSlashes(options.trailingSlash, resolvedUrl);
64
64
  }
65
65
  function fixSlashes(trailingSlash, pathOrUrl) {
66
- const parsed = ufo.parseURL(pathOrUrl);
67
- const isFileUrl = parsed.pathname.includes(".");
66
+ const $url = ufo.parseURL(pathOrUrl);
67
+ const isFileUrl = $url.pathname.includes(".");
68
68
  if (isFileUrl)
69
69
  return pathOrUrl;
70
- return trailingSlash ? ufo.withTrailingSlash(pathOrUrl) : ufo.withoutTrailingSlash(pathOrUrl);
70
+ const fixedPath = trailingSlash ? ufo.withTrailingSlash($url.pathname) : ufo.withoutTrailingSlash($url.pathname);
71
+ return `${$url.protocol ? `${$url.protocol}//` : ""}${$url.host || ""}${fixedPath}${$url.search || ""}${$url.hash || ""}`;
71
72
  }
72
73
 
73
74
  exports.createSiteConfigStack = createSiteConfigStack;
package/dist/index.mjs CHANGED
@@ -61,11 +61,12 @@ function resolveSitePath(pathOrUrl, options) {
61
61
  return path === "/" ? withTrailingSlash(resolvedUrl) : fixSlashes(options.trailingSlash, resolvedUrl);
62
62
  }
63
63
  function fixSlashes(trailingSlash, pathOrUrl) {
64
- const parsed = parseURL(pathOrUrl);
65
- const isFileUrl = parsed.pathname.includes(".");
64
+ const $url = parseURL(pathOrUrl);
65
+ const isFileUrl = $url.pathname.includes(".");
66
66
  if (isFileUrl)
67
67
  return pathOrUrl;
68
- return trailingSlash ? withTrailingSlash(pathOrUrl) : withoutTrailingSlash(pathOrUrl);
68
+ const fixedPath = trailingSlash ? withTrailingSlash($url.pathname) : withoutTrailingSlash($url.pathname);
69
+ return `${$url.protocol ? `${$url.protocol}//` : ""}${$url.host || ""}${fixedPath}${$url.search || ""}${$url.hash || ""}`;
69
70
  }
70
71
 
71
72
  export { createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "site-config-stack",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "Shared site configuration utilities.",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -27,7 +27,7 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@nuxt/kit": "^3.6.2",
30
+ "@nuxt/kit": "^3.6.3",
31
31
  "defu": "^6.1.2",
32
32
  "pkg-types": "^1.0.3",
33
33
  "ufo": "^1.1.2"