Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "hlx-util", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A library to preserve functions commonly used in hlxjs project", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
22
utils.js
@@ -96,2 +96,5 @@ const {URL} = require('url'); | ||
obj.hash = ''; | ||
if (obj.hostname && base && !obj.pathname.startsWith(obj.hostname, 1)) { | ||
obj.pathname = path.join('/', obj.hostname, obj.pathname); | ||
} | ||
} | ||
@@ -122,15 +125,10 @@ return obj; | ||
const obj = buildUrlObj(uri, parentUri); | ||
if (!obj) { | ||
localPath = buildAbsolutePath(uri, parentUri, inputDir, outputDir); | ||
print(`\tFrom relative path to localPath: ${localPath}`); | ||
return removeQueryString(localPath); | ||
if (obj) { | ||
localPath = buildAbsolutePath(obj.pathname, '/', inputDir, outputDir); | ||
print(`\tFrom absolute url to localPath: ${localPath}`); | ||
return localPath; | ||
} | ||
const parentObj = buildUrlObj(parentUri); | ||
let basePath = `${obj.hostname}/.`; | ||
if (!parentUri || (obj.protocol === parentObj.protocol && obj.hostname === parentObj.hostname)) { | ||
basePath = '/.'; | ||
} | ||
localPath = buildAbsolutePath(obj.pathname, basePath, inputDir, outputDir); | ||
print(`\tFrom absolute url to localPath: ${localPath}`); | ||
return localPath; | ||
localPath = buildAbsolutePath(uri, parentUri, inputDir, outputDir); | ||
print(`\tFrom relative path to localPath: ${localPath}`); | ||
return removeQueryString(localPath); | ||
} | ||
@@ -137,0 +135,0 @@ |
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
gl-util |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6225
146
1