Comparing version 0.17.2 to 0.17.3
@@ -0,1 +1,5 @@ | ||
# v0.17.3 | ||
- Fix a race condition where we might over-zealously break a non-existent deadlock because we haven't noticed yet that a file has become available | ||
# v0.17.2 | ||
@@ -2,0 +6,0 @@ |
@@ -366,11 +366,4 @@ 'use strict'; | ||
} | ||
return new Watcher({ | ||
dir: path.resolve(dir), | ||
filter, | ||
read, | ||
enc, | ||
pre, | ||
watch, | ||
debounce, | ||
}); | ||
dir = path.resolve(dir); | ||
return new Watcher({ dir, filter, read, enc, pre, watch, debounce }); | ||
}, | ||
@@ -392,3 +385,3 @@ ); | ||
this[_waitingFor] = new Map(); | ||
// original paths -> { promise, resolve } objects for when awaited files become available | ||
// original paths -> { promise, resolve, paths } objects for when awaited files become available | ||
this[_whenFound] = new Map(); | ||
@@ -453,3 +446,2 @@ // array of [dependent, dependency] pairs, specifying changes to which files should trigger re-processing which other files | ||
} | ||
const waitingFor = this[_waitingFor]; | ||
const current$$1 = current(); | ||
@@ -463,17 +455,14 @@ path$$1 = this.resolve(path$$1); | ||
} | ||
if (this[_status] === _during && !this.files.has(path$$1)) { | ||
if (current$$1) { | ||
waitingFor.set(current$$1, (waitingFor.get(current$$1) || 0) + 1); | ||
} | ||
if (this[_status] === _during && !this.files.has(path$$1) && current$$1) { | ||
this[_waitingFor].set(current$$1, (this[_waitingFor].get(current$$1) || 0) + 1); | ||
if (this[_whenFound].has(path$$1)) { | ||
await this[_whenFound].get(path$$1).promise; | ||
const { promise, paths } = this[_whenFound].get(path$$1); | ||
paths.push(current$$1); | ||
await promise; | ||
} else { | ||
let resolve; | ||
let promise = new Promise(res => (resolve = res)); | ||
this[_whenFound].set(path$$1, { promise, resolve }); | ||
const promise = new Promise(res => (resolve = res)); | ||
this[_whenFound].set(path$$1, { promise, resolve, paths: [current$$1] }); | ||
await promise; | ||
} | ||
if (current$$1) { | ||
waitingFor.set(current$$1, waitingFor.get(current$$1) - 1); | ||
} | ||
} | ||
@@ -643,3 +632,7 @@ return this.files.get(path$$1); | ||
if (this[_whenFound].has(path$$1)) { | ||
this[_whenFound].get(path$$1).resolve(); | ||
const { resolve, paths } = this[_whenFound].get(path$$1); | ||
for (const path$$1 of paths) { | ||
this[_waitingFor].set(path$$1, this[_waitingFor].get(path$$1) - 1); | ||
} | ||
resolve(); | ||
this[_whenFound].delete(path$$1); | ||
@@ -646,0 +639,0 @@ } |
@@ -362,11 +362,4 @@ import { readdir, readFile, stat, watch } from 'fs'; | ||
} | ||
return new Watcher({ | ||
dir: resolve(dir), | ||
filter, | ||
read, | ||
enc, | ||
pre, | ||
watch: watch$$1, | ||
debounce, | ||
}); | ||
dir = resolve(dir); | ||
return new Watcher({ dir, filter, read, enc, pre, watch: watch$$1, debounce }); | ||
}, | ||
@@ -388,3 +381,3 @@ ); | ||
this[_waitingFor] = new Map(); | ||
// original paths -> { promise, resolve } objects for when awaited files become available | ||
// original paths -> { promise, resolve, paths } objects for when awaited files become available | ||
this[_whenFound] = new Map(); | ||
@@ -449,3 +442,2 @@ // array of [dependent, dependency] pairs, specifying changes to which files should trigger re-processing which other files | ||
} | ||
const waitingFor = this[_waitingFor]; | ||
const current$$1 = current(); | ||
@@ -459,17 +451,14 @@ path = this.resolve(path); | ||
} | ||
if (this[_status] === _during && !this.files.has(path)) { | ||
if (current$$1) { | ||
waitingFor.set(current$$1, (waitingFor.get(current$$1) || 0) + 1); | ||
} | ||
if (this[_status] === _during && !this.files.has(path) && current$$1) { | ||
this[_waitingFor].set(current$$1, (this[_waitingFor].get(current$$1) || 0) + 1); | ||
if (this[_whenFound].has(path)) { | ||
await this[_whenFound].get(path).promise; | ||
const { promise, paths } = this[_whenFound].get(path); | ||
paths.push(current$$1); | ||
await promise; | ||
} else { | ||
let resolve$$1; | ||
let promise = new Promise(res => (resolve$$1 = res)); | ||
this[_whenFound].set(path, { promise, resolve: resolve$$1 }); | ||
const promise = new Promise(res => (resolve$$1 = res)); | ||
this[_whenFound].set(path, { promise, resolve: resolve$$1, paths: [current$$1] }); | ||
await promise; | ||
} | ||
if (current$$1) { | ||
waitingFor.set(current$$1, waitingFor.get(current$$1) - 1); | ||
} | ||
} | ||
@@ -639,3 +628,7 @@ return this.files.get(path); | ||
if (this[_whenFound].has(path)) { | ||
this[_whenFound].get(path).resolve(); | ||
const { resolve: resolve$$1, paths } = this[_whenFound].get(path); | ||
for (const path of paths) { | ||
this[_waitingFor].set(path, this[_waitingFor].get(path) - 1); | ||
} | ||
resolve$$1(); | ||
this[_whenFound].delete(path); | ||
@@ -642,0 +635,0 @@ } |
{ | ||
"name": "defiler", | ||
"version": "0.17.2", | ||
"version": "0.17.3", | ||
"description": "A small, strange building block", | ||
@@ -17,3 +17,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=8.2" | ||
"node": "^8.2 || >=10.4" | ||
}, | ||
@@ -29,3 +29,3 @@ "repository": { | ||
}, | ||
"homepage": "https://cndtr.io/defiler", | ||
"homepage": "https://code.chor.date/defiler", | ||
"devDependencies": { | ||
@@ -35,4 +35,5 @@ "rollup": "*" | ||
"scripts": { | ||
"dev": "rollup -c -w", | ||
"build": "rollup -c" | ||
} | ||
} |
@@ -11,9 +11,5 @@ # Defiler: A small, strange building block. | ||
- [Node.js](https://nodejs.org/) 8.2+ | ||
- [Node.js](https://nodejs.org/) 8.2+ or 10.4+ (versions 10 through 10.3 have [a show-stopping bug](https://github.com/nodejs/node/issues/20274)) | ||
- Insanity | ||
## Compatibility note | ||
Pending [this issue](https://github.com/nodejs/node/issues/20274), this library will not work on Node 10. | ||
## Documentation | ||
@@ -24,3 +20,3 @@ | ||
- [changelog](CHANGELOG.md#readme) | ||
- [homepage](https://cndtr.io/defiler) | ||
- [homepage](https://code.chor.date/defiler) | ||
@@ -27,0 +23,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No website
QualityPackage does not have a website.
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
127795
1185
2
26