Comparing version 0.15.0 to 0.15.1
@@ -0,1 +1,5 @@ | ||
# v0.15.1 | ||
- Fix dependency tracking | ||
# v0.15.0 | ||
@@ -2,0 +6,0 @@ |
@@ -218,3 +218,3 @@ 'use strict'; | ||
// prettier-ignore | ||
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _cur, _newProxy, _processDependents, _markFound } = symbols; | ||
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _parent, _newProxy, _processDependents, _markFound } = symbols; | ||
@@ -267,3 +267,3 @@ class Defiler extends EventEmitter { | ||
this[_whenFound] = new Map(); // original paths -> { promise, resolve } objects for when awaited files become available | ||
this[_cur] = { root: null, parent: null }; // (set via proxy) root: the current root dependent, for use in _deps; parent: the current immediate dependent, for use in _waitingFor and the resolver | ||
this[_parent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver | ||
this[_deps] = []; // array of [dependent, dependency] pairs, specifying changes to which files should trigger re-processing which other files | ||
@@ -312,8 +312,8 @@ this[_queue$1] = []; // queue of pending Watcher events to handle | ||
if (Array.isArray(path$$1)) return Promise.all(path$$1.map(path$$1 => this.get(path$$1))) | ||
let { [_cur]: cur, [_waitingFor]: waitingFor } = this; | ||
if (this[_resolver] && typeof cur.parent === 'string') path$$1 = this[_resolver](cur.parent, path$$1); | ||
let { [_parent]: parent, [_waitingFor]: waitingFor } = this; | ||
if (this[_resolver] && typeof parent === 'string') path$$1 = this[_resolver](parent, path$$1); | ||
if (typeof path$$1 !== 'string') throw new TypeError('defiler.get: path must be a string') | ||
if (cur.root) this[_deps].push([cur.root, path$$1]); | ||
if (parent) this[_deps].push([parent, path$$1]); | ||
if (!this[_status] && !this.files.has(path$$1)) { | ||
if (cur.parent) waitingFor.set(cur.parent, (waitingFor.get(cur.parent) || 0) + 1); | ||
if (parent) waitingFor.set(parent, (waitingFor.get(parent) || 0) + 1); | ||
if (!this[_whenFound].has(path$$1)) { | ||
@@ -324,3 +324,3 @@ let resolve; | ||
await this[_whenFound].get(path$$1).promise; | ||
if (cur.parent) waitingFor.set(cur.parent, waitingFor.get(cur.parent) - 1); | ||
if (parent) waitingFor.set(parent, waitingFor.get(parent) - 1); | ||
} | ||
@@ -334,4 +334,4 @@ return this.files.get(path$$1) | ||
if (typeof file !== 'object') throw new TypeError('defiler.add: file must be an object') | ||
if (this[_resolver] && typeof this[_cur].parent === 'string') { | ||
file.path = this[_resolver](this[_cur].parent, file.path); | ||
if (this[_resolver] && typeof this[_parent] === 'string') { | ||
file.path = this[_resolver](this[_parent], file.path); | ||
} | ||
@@ -440,6 +440,5 @@ this[_processFile](file); | ||
// create a defiler Proxy for the given path, always overriding _cur.parent and only overriding _cur.root if it is not yet set | ||
// create a defiler Proxy for the given path or generator symbol | ||
[_newProxy](path$$1) { | ||
let cur = { root: this[_cur].root || path$$1, parent: path$$1 }; | ||
return new Proxy(this, { get: (_, key) => (key === _cur ? cur : this[key]) }) | ||
return new Proxy(this, { get: (_, key) => (key === _parent ? path$$1 : this[key]) }) | ||
} | ||
@@ -446,0 +445,0 @@ |
@@ -214,3 +214,3 @@ import { readdir, readFile, stat, watch } from 'fs'; | ||
// prettier-ignore | ||
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _cur, _newProxy, _processDependents, _markFound } = symbols; | ||
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _parent, _newProxy, _processDependents, _markFound } = symbols; | ||
@@ -263,3 +263,3 @@ class Defiler extends EventEmitter { | ||
this[_whenFound] = new Map(); // original paths -> { promise, resolve } objects for when awaited files become available | ||
this[_cur] = { root: null, parent: null }; // (set via proxy) root: the current root dependent, for use in _deps; parent: the current immediate dependent, for use in _waitingFor and the resolver | ||
this[_parent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver | ||
this[_deps] = []; // array of [dependent, dependency] pairs, specifying changes to which files should trigger re-processing which other files | ||
@@ -308,8 +308,8 @@ this[_queue$1] = []; // queue of pending Watcher events to handle | ||
if (Array.isArray(path)) return Promise.all(path.map(path => this.get(path))) | ||
let { [_cur]: cur, [_waitingFor]: waitingFor } = this; | ||
if (this[_resolver] && typeof cur.parent === 'string') path = this[_resolver](cur.parent, path); | ||
let { [_parent]: parent, [_waitingFor]: waitingFor } = this; | ||
if (this[_resolver] && typeof parent === 'string') path = this[_resolver](parent, path); | ||
if (typeof path !== 'string') throw new TypeError('defiler.get: path must be a string') | ||
if (cur.root) this[_deps].push([cur.root, path]); | ||
if (parent) this[_deps].push([parent, path]); | ||
if (!this[_status] && !this.files.has(path)) { | ||
if (cur.parent) waitingFor.set(cur.parent, (waitingFor.get(cur.parent) || 0) + 1); | ||
if (parent) waitingFor.set(parent, (waitingFor.get(parent) || 0) + 1); | ||
if (!this[_whenFound].has(path)) { | ||
@@ -320,3 +320,3 @@ let resolve$$1; | ||
await this[_whenFound].get(path).promise; | ||
if (cur.parent) waitingFor.set(cur.parent, waitingFor.get(cur.parent) - 1); | ||
if (parent) waitingFor.set(parent, waitingFor.get(parent) - 1); | ||
} | ||
@@ -330,4 +330,4 @@ return this.files.get(path) | ||
if (typeof file !== 'object') throw new TypeError('defiler.add: file must be an object') | ||
if (this[_resolver] && typeof this[_cur].parent === 'string') { | ||
file.path = this[_resolver](this[_cur].parent, file.path); | ||
if (this[_resolver] && typeof this[_parent] === 'string') { | ||
file.path = this[_resolver](this[_parent], file.path); | ||
} | ||
@@ -436,6 +436,5 @@ this[_processFile](file); | ||
// create a defiler Proxy for the given path, always overriding _cur.parent and only overriding _cur.root if it is not yet set | ||
// create a defiler Proxy for the given path or generator symbol | ||
[_newProxy](path) { | ||
let cur = { root: this[_cur].root || path, parent: path }; | ||
return new Proxy(this, { get: (_, key) => (key === _cur ? cur : this[key]) }) | ||
return new Proxy(this, { get: (_, key) => (key === _parent ? path : this[key]) }) | ||
} | ||
@@ -442,0 +441,0 @@ |
{ | ||
"name": "defiler", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"description": "A small, strange building block", | ||
@@ -5,0 +5,0 @@ "keywords": ["build", "framework", "async", "watch"], |
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
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
112316
817