@nuxt/utils
Advanced tools
Comparing version 2.11.0 to 2.12.0
/*! | ||
* @nuxt/utils v2.11.0 (c) 2016-2019 | ||
* @nuxt/utils v2.12.0 (c) 2016-2020 | ||
@@ -22,3 +22,2 @@ * - All the amazing contributors | ||
const UAParser = _interopDefault(require('ua-parser-js')); | ||
const semver = _interopDefault(require('semver')); | ||
@@ -596,3 +595,5 @@ const getContext = function getContext (req, res) { | ||
const getMainModule = () => require.main; | ||
const getMainModule = () => { | ||
return require.main || (module && module.main) || module | ||
}; | ||
@@ -1910,7 +1911,13 @@ /** Used to match property names within property paths. */ | ||
function clearRequireCache (id) { | ||
const entry = require.cache[id]; | ||
if (!entry || isExternalDependency(id)) { | ||
if (isExternalDependency(id)) { | ||
return | ||
} | ||
const entry = getRequireCacheItem(id); | ||
if (!entry) { | ||
delete require.cache[id]; | ||
return | ||
} | ||
if (entry.parent) { | ||
@@ -1928,7 +1935,13 @@ entry.parent.children = entry.parent.children.filter(e => e.id !== id); | ||
function scanRequireTree (id, files = new Set()) { | ||
const entry = require.cache[id]; | ||
if (!entry || isExternalDependency(id) || files.has(id)) { | ||
if (isExternalDependency(id) || files.has(id)) { | ||
return files | ||
} | ||
const entry = getRequireCacheItem(id); | ||
if (!entry) { | ||
files.add(id); | ||
return files | ||
} | ||
files.add(entry.id); | ||
@@ -1943,2 +1956,9 @@ | ||
function getRequireCacheItem (id) { | ||
try { | ||
return require.cache[id] | ||
} catch (e) { | ||
} | ||
} | ||
function tryRequire (id) { | ||
@@ -1969,8 +1989,18 @@ try { | ||
const modernBrowsers = Object.keys(ModernBrowsers) | ||
.reduce((allBrowsers, browser) => { | ||
allBrowsers[browser] = semver.coerce(ModernBrowsers[browser]); | ||
return allBrowsers | ||
}, {}); | ||
let semver; | ||
let __modernBrowsers; | ||
const getModernBrowsers = () => { | ||
if (__modernBrowsers) { | ||
return __modernBrowsers | ||
} | ||
__modernBrowsers = Object.keys(ModernBrowsers) | ||
.reduce((allBrowsers, browser) => { | ||
allBrowsers[browser] = semver.coerce(ModernBrowsers[browser]); | ||
return allBrowsers | ||
}, {}); | ||
return __modernBrowsers | ||
}; | ||
const isModernBrowser = (ua) => { | ||
@@ -1980,2 +2010,5 @@ if (!ua) { | ||
} | ||
if (!semver) { | ||
semver = require('semver'); | ||
} | ||
const { browser } = UAParser(ua); | ||
@@ -1986,2 +2019,3 @@ const browserVersion = semver.coerce(browser.version); | ||
} | ||
const modernBrowsers = getModernBrowsers(); | ||
return Boolean(modernBrowsers[browser.name] && semver.gte(browserVersion, modernBrowsers[browser.name])) | ||
@@ -2023,2 +2057,3 @@ }; | ||
exports.getPKG = getPKG; | ||
exports.getRequireCacheItem = getRequireCacheItem; | ||
exports.guardDir = guardDir; | ||
@@ -2025,0 +2060,0 @@ exports.isExternalDependency = isExternalDependency; |
{ | ||
"name": "@nuxt/utils", | ||
"version": "2.11.0", | ||
"version": "2.12.0", | ||
"repository": "nuxt/nuxt.js", | ||
"license": "MIT", | ||
"main": "dist/utils.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/utils.js", | ||
"dependencies": { | ||
"consola": "^2.11.1", | ||
"consola": "^2.11.3", | ||
"fs-extra": "^8.1.0", | ||
"hash-sum": "^2.0.0", | ||
"proper-lockfile": "^4.1.1", | ||
"semver": "^7.1.0", | ||
"serialize-javascript": "^2.1.2", | ||
"semver": "^7.1.3", | ||
"serialize-javascript": "^3.0.0", | ||
"signal-exit": "^3.0.2", | ||
"ua-parser-js": "^0.7.20" | ||
"ua-parser-js": "^0.7.21" | ||
}, | ||
@@ -20,0 +20,0 @@ "publishConfig": { |
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
53320
1802
+ Addedrandombytes@2.1.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedserialize-javascript@3.1.0(transitive)
- Removedserialize-javascript@2.1.2(transitive)
Updatedconsola@^2.11.3
Updatedsemver@^7.1.3
Updatedserialize-javascript@^3.0.0
Updatedua-parser-js@^0.7.21