buddy
Advanced tools
Comparing version 6.13.6 to 6.13.7
@@ -354,24 +354,21 @@ 'use strict'; | ||
return workflow.reduce( | ||
(tasks, task) => { | ||
if (task.includes(':')) { | ||
const conditions = task.split(':'); | ||
return workflow.reduce((tasks, task) => { | ||
if (task.includes(':')) { | ||
const conditions = task.split(':'); | ||
task = conditions.pop(); | ||
const passed = conditions.every(condition => { | ||
const negative = condition.charAt(0) == '!'; | ||
task = conditions.pop(); | ||
const passed = conditions.every(condition => { | ||
const negative = condition.charAt(0) == '!'; | ||
condition = negative ? condition.slice(1) : condition; | ||
const test = condition in buildOptions ? buildOptions[condition] : this[condition]; | ||
condition = negative ? condition.slice(1) : condition; | ||
const test = condition in buildOptions ? buildOptions[condition] : this[condition]; | ||
return negative ? !test : test; | ||
}); | ||
return negative ? !test : test; | ||
}); | ||
if (!passed) return tasks; | ||
} | ||
tasks.push(task); | ||
return tasks; | ||
}, | ||
[] | ||
); | ||
if (!passed) return tasks; | ||
} | ||
tasks.push(task); | ||
return tasks; | ||
}, []); | ||
} | ||
@@ -468,2 +465,13 @@ | ||
/** | ||
* Hash 'content' | ||
* @param {Boolean} forWrite | ||
* @returns {String} | ||
*/ | ||
hashContent(forWrite = false) { | ||
return forWrite | ||
? md5([this, ...this.getAllDependencies()].map(file => file.content).join('')) | ||
: md5(this.content || this.fileContent); | ||
} | ||
/** | ||
* Read and store file contents | ||
@@ -486,3 +494,3 @@ * @param {Object} buildOptions | ||
this.fileContent = this.readFileContent(); | ||
this.hash = md5(this.fileContent); | ||
this.hash = this.hashContent(false); | ||
@@ -577,5 +585,3 @@ debug(`load: ${strong(this.relpath)}`, 4); | ||
this.writeDate = Date.now(); | ||
// TODO: add header | ||
// Hash based on content + dependencies | ||
this.writeHash = md5([this.content, ...this.getAllDependencies().map(file => file.content)].join('')); | ||
this.writeHash = this.hashContent(true); | ||
@@ -582,0 +588,0 @@ // Generate unique path |
@@ -170,2 +170,25 @@ 'use strict'; | ||
/** | ||
* Hash 'content' | ||
* @param {Boolean} forWrite | ||
* @returns {String} | ||
*/ | ||
hashContent(forWrite = false) { | ||
return forWrite | ||
? md5( | ||
// TODO: add header | ||
[this, ...this.getAllDependencies()] | ||
.reduce((contents, file) => { | ||
contents.push(file.content); | ||
// Include hashes of dynamic builds which are not yet inlined | ||
if (file.dynamicDependencyReferences.length > 0) { | ||
contents.push(...file.dynamicDependencyReferences.map(ref => ref.file.writeHash)); | ||
} | ||
return contents; | ||
}, []) | ||
.join('') | ||
) | ||
: md5(this.content || this.fileContent); | ||
} | ||
/** | ||
* Read and store file contents | ||
@@ -172,0 +195,0 @@ * @param {Object} buildOptions |
{ | ||
"name": "buddy", | ||
"description": "A fast, simple build tool for web projects.", | ||
"version": "6.13.6", | ||
"version": "6.13.7", | ||
"author": "popeindustries <alex@pope-industries.com>", | ||
@@ -18,3 +18,3 @@ "keywords": [ | ||
"dependencies": { | ||
"async": "2.4.1", | ||
"async": "2.5.0", | ||
"autoprefixer": "7.1.1", | ||
@@ -36,7 +36,7 @@ "babel-core": "6.25.0", | ||
"portscanner": "2.1.1", | ||
"postcss": "6.0.2", | ||
"postcss": "6.0.3", | ||
"pretty-bytes": "4.0.2", | ||
"recur-fs": "2.2.4", | ||
"source-map": "0.5.6", | ||
"uglify-js": "3.0.18" | ||
"uglify-js": "3.0.20" | ||
}, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
243657
6148
+ Addedasync@2.5.0(transitive)
+ Addedcaniuse-db@1.0.30001612(transitive)
+ Addedcaniuse-lite@1.0.30001612(transitive)
+ Addedhas-flag@2.0.0(transitive)
+ Addedpostcss@6.0.3(transitive)
+ Addedsupports-color@4.5.0(transitive)
+ Addeduglify-js@3.0.20(transitive)
- Removedasync@2.4.1(transitive)
- Removedcaniuse-db@1.0.30001613(transitive)
- Removedcaniuse-lite@1.0.30001613(transitive)
- Removedpostcss@6.0.2(transitive)
- Removeduglify-js@3.0.18(transitive)
Updatedasync@2.5.0
Updatedpostcss@6.0.3
Updateduglify-js@3.0.20