Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jsenv/filesystem

Package Overview
Dependencies
Maintainers
0
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/filesystem - npm Package Compare versions

Comparing version 4.7.5 to 4.8.0

src/replace/replace_file_sync.js

7

package.json
{
"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";

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc