@nuxt/utils
Advanced tools
Comparing version 2.5.1 to 2.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.6.0](https://github.com/nuxt/nuxt.js/compare/v2.5.1...v2.6.0) (2019-04-04) | ||
### Bug Fixes | ||
* **cli:** catch all possible errors thrown from proper-filelock ([#5347](https://github.com/nuxt/nuxt.js/issues/5347)) ([39bbe46](https://github.com/nuxt/nuxt.js/commit/39bbe46)) | ||
## [2.5.1](https://github.com/nuxt/nuxt.js/compare/v2.5.0...v2.5.1) (2019-03-21) | ||
@@ -8,0 +19,0 @@ |
/*! | ||
* @nuxt/utils v2.5.1 (c) 2016-2019 | ||
* @nuxt/utils v2.6.0 (c) 2016-2019 | ||
@@ -115,12 +115,29 @@ * - All the amazing contributors | ||
const locked = await properlock.check(lockPath); | ||
if (locked) { | ||
consola.fatal(`A lock with id '${id}' already exists on ${dir}`); | ||
try { | ||
const locked = await properlock.check(lockPath); | ||
if (locked) { | ||
consola.fatal(`A lock with id '${id}' already exists on ${dir}`); | ||
} | ||
} catch (e) { | ||
consola.debug(`Check for an existing lock with id '${id}' on ${dir} failed`, e); | ||
} | ||
options = getLockOptions(options); | ||
const release = await properlock.lock(lockPath, options); | ||
let lockWasCompromised = false; | ||
let release; | ||
try { | ||
options = getLockOptions(options); | ||
const onCompromised = options.onCompromised; | ||
options.onCompromised = (err) => { | ||
onCompromised(err); | ||
lockWasCompromised = true; | ||
}; | ||
release = await properlock.lock(lockPath, options); | ||
} catch (e) {} | ||
if (!release) { | ||
consola.warn(`Unable to get a lock with id '${id}' on ${dir} (but will continue)`); | ||
return false | ||
} | ||
@@ -140,9 +157,28 @@ | ||
return async function lockRelease() { | ||
await release(); | ||
await fs.remove(lockPath); | ||
lockPaths.delete(lockPath); | ||
try { | ||
await fs.remove(lockPath); | ||
lockPaths.delete(lockPath); | ||
// release as last so the lockPath is still removed | ||
// when it fails on a compromised lock | ||
await release(); | ||
} catch (e) { | ||
if (!lockWasCompromised || !e.message.includes('already released')) { | ||
consola.debug(e); | ||
return | ||
} | ||
// proper-lockfile doesnt remove lockDir when lock is compromised | ||
// removing it here could cause the 'other' process to throw an error | ||
// as well, but in our case its much more likely the lock was | ||
// compromised due to mtime update timeouts | ||
const lockDir = `${lockPath}.lock`; | ||
if (await fs.exists(lockDir)) { | ||
await fs.remove(lockDir); | ||
} | ||
} | ||
} | ||
} | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
@@ -149,0 +185,0 @@ /** Detect free variable `global` from Node.js. */ |
{ | ||
"name": "@nuxt/utils", | ||
"version": "2.5.1", | ||
"version": "2.6.0", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -11,6 +11,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"consola": "^2.5.7", | ||
"consola": "^2.5.8", | ||
"fs-extra": "^7.0.1", | ||
"hash-sum": "^1.0.2", | ||
"proper-lockfile": "^4.1.0", | ||
"proper-lockfile": "^4.1.1", | ||
"serialize-javascript": "^1.6.1", | ||
@@ -17,0 +17,0 @@ "signal-exit": "^3.0.2" |
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
50870
1644
Updatedconsola@^2.5.8
Updatedproper-lockfile@^4.1.1