site-config-stack 3.1.6 → 3.1.7
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 +2 -1
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ function validateSiteConfigStack(stack) {
|
|
|
26
26
|
const val = resolved.url;
|
|
27
27
|
const context = resolved._context?.url || "unknown";
|
|
28
28
|
const url = ufo.parseURL(val);
|
|
29
|
+
const { hostname } = ufo.parseHost(url.host);
|
|
29
30
|
if (!url.host)
|
|
30
31
|
errors.push(`url "${val}" from ${context} is not absolute`);
|
|
31
32
|
else if (url.pathname && url.pathname !== "/")
|
|
@@ -34,7 +35,7 @@ function validateSiteConfigStack(stack) {
|
|
|
34
35
|
errors.push(`url "${val}" from ${context} should not contain a hash`);
|
|
35
36
|
else if (Object.keys(ufo.getQuery(val)).length > 0)
|
|
36
37
|
errors.push(`url "${val}" from ${context} should not contain a query`);
|
|
37
|
-
else if (
|
|
38
|
+
else if (hostname === "localhost" && resolved.env !== "development")
|
|
38
39
|
errors.push(`url "${val}" from ${context} should not be localhost`);
|
|
39
40
|
}
|
|
40
41
|
return errors;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasProtocol, withHttps, parseURL, getQuery } from 'ufo';
|
|
1
|
+
import { hasProtocol, withHttps, parseURL, parseHost, getQuery } from 'ufo';
|
|
2
2
|
import { toValue } from 'vue';
|
|
3
3
|
|
|
4
4
|
function normalizeSiteConfig(config) {
|
|
@@ -24,6 +24,7 @@ function validateSiteConfigStack(stack) {
|
|
|
24
24
|
const val = resolved.url;
|
|
25
25
|
const context = resolved._context?.url || "unknown";
|
|
26
26
|
const url = parseURL(val);
|
|
27
|
+
const { hostname } = parseHost(url.host);
|
|
27
28
|
if (!url.host)
|
|
28
29
|
errors.push(`url "${val}" from ${context} is not absolute`);
|
|
29
30
|
else if (url.pathname && url.pathname !== "/")
|
|
@@ -32,7 +33,7 @@ function validateSiteConfigStack(stack) {
|
|
|
32
33
|
errors.push(`url "${val}" from ${context} should not contain a hash`);
|
|
33
34
|
else if (Object.keys(getQuery(val)).length > 0)
|
|
34
35
|
errors.push(`url "${val}" from ${context} should not contain a query`);
|
|
35
|
-
else if (
|
|
36
|
+
else if (hostname === "localhost" && resolved.env !== "development")
|
|
36
37
|
errors.push(`url "${val}" from ${context} should not be localhost`);
|
|
37
38
|
}
|
|
38
39
|
return errors;
|