@jsenv/filesystem
Advanced tools
Comparing version 4.7.5 to 4.8.0
{ | ||
"name": "@jsenv/filesystem", | ||
"version": "4.7.5", | ||
"version": "4.8.0", | ||
"license": "MIT", | ||
@@ -15,4 +15,3 @@ "repository": { | ||
"name": "dmail", | ||
"email": "dmaillard06@gmail.com", | ||
"url": "https://twitter.com/damienmaillard" | ||
"email": "dmaillard06@gmail.com" | ||
}, | ||
@@ -36,3 +35,3 @@ "type": "module", | ||
"dependencies": { | ||
"@jsenv/urls": "2.2.10", | ||
"@jsenv/urls": "2.2.11", | ||
"@jsenv/url-meta": "8.4.2", | ||
@@ -39,0 +38,0 @@ "@jsenv/abort": "4.3.0", |
@@ -68,3 +68,2 @@ import { Abort } from "@jsenv/abort"; | ||
if (!predicate(meta)) return; | ||
const relativeUrl = urlToRelativeUrl( | ||
@@ -71,0 +70,0 @@ directoryChildNodeUrl, |
@@ -13,3 +13,4 @@ import { URL_META } from "@jsenv/url-meta"; | ||
predicate, | ||
callback = () => {}, | ||
onDirectory = () => {}, | ||
onMatch = () => {}, | ||
}) => { | ||
@@ -24,2 +25,3 @@ const rootDirectoryUrl = assertAndNormalizeDirectoryUrl(directoryUrl); | ||
const directoryItems = readDirectorySync(directoryUrl); | ||
const matchingFileInfoArray = []; | ||
for (const directoryItem of directoryItems) { | ||
@@ -55,3 +57,3 @@ const directoryChildNodeUrl = `${directoryUrl}${directoryItem}`; | ||
} | ||
callback({ | ||
onDirectory({ | ||
url: subDirectoryUrl, | ||
@@ -83,7 +85,6 @@ relativeUrl: urlToRelativeUrl(subDirectoryUrl, rootDirectoryUrl), | ||
}); | ||
callback({ | ||
matchingFileInfoArray.push({ | ||
url: directoryChildNodeUrl, | ||
relativeUrl, | ||
stats: directoryChildNodeStats, | ||
isDirectory: false, | ||
}); | ||
@@ -93,2 +94,14 @@ continue; | ||
} | ||
let i = 0; | ||
while (i < matchingFileInfoArray.length) { | ||
const matchingFileInfo = matchingFileInfoArray[i]; | ||
onMatch(matchingFileInfo, { | ||
prev: i === 0 ? null : matchingFileInfoArray[i - 1], | ||
next: | ||
i === matchingFileInfoArray.length - 1 | ||
? null | ||
: matchingFileInfoArray[i + 1], | ||
}); | ||
i++; | ||
} | ||
}; | ||
@@ -95,0 +108,0 @@ visitDirectory(rootDirectoryUrl); |
@@ -83,2 +83,5 @@ // we might wanna expose the sync versions as follows: | ||
// replace | ||
export { replaceFileSync } from "./replace/replace_file_sync.js"; | ||
// lifecycle | ||
@@ -85,0 +88,0 @@ export { registerDirectoryLifecycle } from "./lifecycle/register_directory_lifecycle.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
133027
72
3871
+ Added@jsenv/humanize@1.2.4(transitive)
+ Added@jsenv/urls@2.2.11(transitive)
+ Addedansi-escapes@7.0.0(transitive)
+ Addedenvironment@1.1.0(transitive)
- Removed@jsenv/humanize@1.2.3(transitive)
- Removed@jsenv/urls@2.2.10(transitive)
Updated@jsenv/urls@2.2.11