Comparing version 1.8.1 to 1.8.2
{ | ||
"name": "esmock", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "readmeFilename": "README.md", |
@@ -18,7 +18,15 @@ import fs from 'fs'; | ||
// https://url.spec.whatwg.org/, eg, file:///C:/demo file://root/linux/path | ||
const pathAddProtocol = (pathFull, protocol) => ( | ||
(protocol || (resolvewith.iscoremodule(pathFull) ? 'node:' : 'file:///')) | ||
+ pathFull.replace(/^\//, '')); | ||
const FILE_PROTOCOL = 'file:///'; | ||
// https://url.spec.whatwg.org/, eg, file:///C:/demo file:///root/linux/path | ||
const pathAddProtocol = (pathFull, protocol) => { | ||
if (!protocol) | ||
protocol = !resolvewith.iscoremodule(pathFull) ? FILE_PROTOCOL : 'node:'; | ||
if (protocol.includes(FILE_PROTOCOL)) | ||
pathFull = fs.realpathSync.native(pathFull); | ||
if (process.platform === 'win32') | ||
pathFull = pathFull.split(path.sep).join(path.posix.sep); | ||
return `${protocol}${pathFull.replace(/^\//, '')}`; | ||
} | ||
const esmockModuleMergeDefault = (defaultLive, defaultMock, merged) => { | ||
@@ -169,3 +177,3 @@ const defaultLiveIsObj = isObj(defaultLive); | ||
const esmockKeyLong = pathAddProtocol(pathModuleFull, 'file:///') + '?' | ||
const esmockKeyLong = pathAddProtocol(pathModuleFull, FILE_PROTOCOL) + '?' | ||
+ 'key=:esmockKey?esmockGlobals=:esmockGlobals#esmockModuleKeys=:moduleKeys' | ||
@@ -178,3 +186,3 @@ .replace(/:esmockKey/, esmockKey) | ||
return pathAddProtocol(pathModuleFull, 'file:///') + `?esmk=${esmockKey}`; | ||
return pathAddProtocol(pathModuleFull, FILE_PROTOCOL) + `?esmk=${esmockKey}`; | ||
}; | ||
@@ -181,0 +189,0 @@ |
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
20957
322