Comparing version 0.6.2 to 0.7.0
@@ -0,1 +1,5 @@ | ||
# v0.7.0 | ||
- Change several APIs to use objects as named parameters - see docs | ||
# v0.6.2 | ||
@@ -2,0 +6,0 @@ |
@@ -5,3 +5,5 @@ 'use strict'; | ||
var EventEmitter = require('events'); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var EventEmitter = _interopDefault(require('events')); | ||
var fs = require('fs'); | ||
@@ -226,3 +228,3 @@ var path = require('path'); | ||
this._files.set(path$$1, file); | ||
this.emit('file', path$$1, file); | ||
this.emit('file', { defiler: this, path: path$$1, file }); | ||
} | ||
@@ -262,3 +264,3 @@ | ||
this._files.delete(path$$1); | ||
this.emit('deleted', path$$1); | ||
this.emit('deleted', { defiler: this, path: path$$1 }); | ||
} else { | ||
@@ -287,3 +289,3 @@ await this._processPhysicalFile(absolutePath, rootPath, read); | ||
this._origFiles.set(path$$1, origFile); | ||
this.emit('origFile', path$$1, origFile); | ||
this.emit('origFile', { defiler: this, file: origFile }); | ||
await this._processFile(origFile); | ||
@@ -296,3 +298,3 @@ } | ||
this._files.set(origFile.path, file); | ||
this.emit('file', origFile.path, file); | ||
this.emit('file', { defiler: this, path: origFile.path, file }); | ||
} | ||
@@ -304,10 +306,13 @@ | ||
for (let { transform, if: if_ } of this._transforms) { | ||
if (!if_ || (await if_.call(this, file))) { | ||
await transform.call(this, file, dependency => | ||
this.get(dependency, path$$1) | ||
); | ||
if (!if_ || (await if_({ defiler: this, path: path$$1, file }))) { | ||
await transform({ | ||
defiler: this, | ||
path: path$$1, | ||
file, | ||
get: dependency => this.get(dependency, path$$1), | ||
}); | ||
} | ||
} | ||
} catch (err) { | ||
this.emit('error', path$$1, file, err); | ||
} catch (error) { | ||
this.emit('error', { defiler: this, path: path$$1, file, error }); | ||
} | ||
@@ -320,15 +325,17 @@ } | ||
file = new File(path$$1); | ||
await this._customGenerators | ||
.get(path$$1) | ||
.call(this, file, dependency => this.get(dependency, path$$1)); | ||
await this._customGenerators.get(path$$1)({ | ||
defiler: this, | ||
file, | ||
get: dependency => this.get(dependency, path$$1), | ||
}); | ||
await this.addFile(file); | ||
} catch (err) { | ||
this.emit('error', path$$1, file, err); | ||
} catch (error) { | ||
this.emit('error', { defiler: this, path: path$$1, file, error }); | ||
} | ||
} | ||
_processDependents(origPath) { | ||
_processDependents({ path: path$$1 }) { | ||
let dependents = new Set(); | ||
for (let [dependent, dependencies] of this._dependents.entries()) { | ||
if (dependencies.has(origPath)) { | ||
if (dependencies.has(path$$1)) { | ||
dependents.add(dependent); | ||
@@ -335,0 +342,0 @@ this._dependents.delete(dependent); |
@@ -221,3 +221,3 @@ import EventEmitter from 'events'; | ||
this._files.set(path$$1, file); | ||
this.emit('file', path$$1, file); | ||
this.emit('file', { defiler: this, path: path$$1, file }); | ||
} | ||
@@ -257,3 +257,3 @@ | ||
this._files.delete(path$$1); | ||
this.emit('deleted', path$$1); | ||
this.emit('deleted', { defiler: this, path: path$$1 }); | ||
} else { | ||
@@ -282,3 +282,3 @@ await this._processPhysicalFile(absolutePath, rootPath, read); | ||
this._origFiles.set(path$$1, origFile); | ||
this.emit('origFile', path$$1, origFile); | ||
this.emit('origFile', { defiler: this, file: origFile }); | ||
await this._processFile(origFile); | ||
@@ -291,3 +291,3 @@ } | ||
this._files.set(origFile.path, file); | ||
this.emit('file', origFile.path, file); | ||
this.emit('file', { defiler: this, path: origFile.path, file }); | ||
} | ||
@@ -299,10 +299,13 @@ | ||
for (let { transform, if: if_ } of this._transforms) { | ||
if (!if_ || (await if_.call(this, file))) { | ||
await transform.call(this, file, dependency => | ||
this.get(dependency, path$$1) | ||
); | ||
if (!if_ || (await if_({ defiler: this, path: path$$1, file }))) { | ||
await transform({ | ||
defiler: this, | ||
path: path$$1, | ||
file, | ||
get: dependency => this.get(dependency, path$$1), | ||
}); | ||
} | ||
} | ||
} catch (err) { | ||
this.emit('error', path$$1, file, err); | ||
} catch (error) { | ||
this.emit('error', { defiler: this, path: path$$1, file, error }); | ||
} | ||
@@ -315,15 +318,17 @@ } | ||
file = new File(path$$1); | ||
await this._customGenerators | ||
.get(path$$1) | ||
.call(this, file, dependency => this.get(dependency, path$$1)); | ||
await this._customGenerators.get(path$$1)({ | ||
defiler: this, | ||
file, | ||
get: dependency => this.get(dependency, path$$1), | ||
}); | ||
await this.addFile(file); | ||
} catch (err) { | ||
this.emit('error', path$$1, file, err); | ||
} catch (error) { | ||
this.emit('error', { defiler: this, path: path$$1, file, error }); | ||
} | ||
} | ||
_processDependents(origPath) { | ||
_processDependents({ path: path$$1 }) { | ||
let dependents = new Set(); | ||
for (let [dependent, dependencies] of this._dependents.entries()) { | ||
if (dependencies.has(origPath)) { | ||
if (dependencies.has(path$$1)) { | ||
dependents.add(dependent); | ||
@@ -330,0 +335,0 @@ this._dependents.delete(dependent); |
{ | ||
"name": "defiler", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "A small, strange building block", | ||
@@ -11,10 +11,8 @@ "main": "./dist/index.cjs.js", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"lint": "eslint src", | ||
"format": "prettier --write --use-tabs --no-semi --single-quote --trailing-comma es5 \"src/**/*.js\" rollup.config.js" | ||
"build": "rollup -c" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.6.0", | ||
"prettier": "^1.6.1", | ||
"rollup": "^0.49.2" | ||
"eslint": "^4.14.0", | ||
"prettier": "^1.9.2", | ||
"rollup": "^0.53.1" | ||
}, | ||
@@ -21,0 +19,0 @@ "engines": { |
@@ -37,5 +37,5 @@ # Defiler | ||
- [api](https://github.com/Conduitry/defiler/blob/master/API.md#readme) | ||
- [changelog](https://github.com/Conduitry/defiler/blob/master/CHANGELOG.md#readme) | ||
- [todo](https://github.com/Conduitry/defiler/blob/master/TODO.md#readme) | ||
- [usage](USAGE.md#readme) | ||
- [api](API.md#readme) | ||
- [changelog](CHANGELOG.md#readme) | ||
- [homepage](https://cndtr.io/defiler/) | ||
@@ -47,2 +47,2 @@ | ||
- [MIT](https://github.com/Conduitry/defiler/blob/master/LICENSE) | ||
- [MIT](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
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
57508
584