broccoli-kitchen-sink-helpers
Advanced tools
Comparing version 0.2.9 to 0.3.0
# master | ||
# 0.3.0 | ||
* In keysForTree, require top-level directory (or file) to exist | ||
# 0.2.9 | ||
@@ -4,0 +8,0 @@ |
43
index.js
@@ -32,19 +32,7 @@ var fs = require('fs') | ||
try { | ||
stats = fs.statSync(fullPath) | ||
} catch (err) { | ||
if (!keysForTreeWarningPrinted) { | ||
console.warn('Warning: failed to stat ' + fullPath) | ||
keysForTreeWarningPrinted = true | ||
} | ||
// fullPath has probably ceased to exist. Leave `stats` undefined and | ||
// proceed hashing. | ||
} | ||
stats = fs.statSync(fullPath) | ||
var childKeys = [] | ||
if (stats) { | ||
statKeys = ['stats', stats.mode] | ||
} else { | ||
statKeys = ['stat failed'] | ||
} | ||
if (stats && stats.isDirectory()) { | ||
statKeys = ['stats', stats.mode] | ||
if (stats.isDirectory()) { | ||
var fileIdentity = stats.dev + '\x00' + stats.ino | ||
@@ -62,12 +50,25 @@ var entries | ||
for (var i = 0; i < entries.length; i++) { | ||
var keys = keysForTree( | ||
path.join(fullPath, entries[i]), | ||
path.join(relativePath, entries[i]) | ||
) | ||
var keys | ||
try { | ||
keys = keysForTree( | ||
path.join(fullPath, entries[i]), | ||
path.join(relativePath, entries[i]) | ||
) | ||
} catch (err) { | ||
if (!keysForTreeWarningPrinted) { | ||
console.warn('Warning: failed to stat ' + path.join(fullPath, entries[i])) | ||
keysForTreeWarningPrinted = true | ||
} | ||
// The child has probably ceased to exist since we called | ||
// `readdirSync`, or it is a broken symlink. | ||
keys = ['missing'] | ||
} | ||
childKeys = childKeys.concat(keys) | ||
} | ||
} | ||
} else if (stats && stats.isFile()) { | ||
} else if (stats.isFile()) { | ||
statKeys.push(stats.mtime.getTime()) | ||
statKeys.push(stats.size) | ||
} else { | ||
throw new Error(fullPath + ': Unexpected file type') | ||
} | ||
@@ -74,0 +75,0 @@ |
{ | ||
"name": "broccoli-kitchen-sink-helpers", | ||
"description": "Collection of helpers that need to be extracted into separate packages", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"author": "Jo Liss <joliss42@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
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
10627
6