Socket
Socket
Sign inDemoInstall

metro-file-map

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-file-map - npm Package Compare versions

Comparing version 0.80.8 to 0.80.9

2

package.json
{
"name": "metro-file-map",
"version": "0.80.8",
"version": "0.80.9",
"description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -55,3 +55,11 @@ "use strict";

const debug = require("debug")("Metro:NodeCrawler");
function find(roots, extensions, ignore, includeSymlinks, rootDir, callback) {
function find(
roots,
extensions,
ignore,
includeSymlinks,
rootDir,
console,
callback
) {
const result = new Map();

@@ -70,39 +78,43 @@ let activeCalls = 0;

if (err) {
callback(result);
return;
}
entries.forEach((entry) => {
const file = path.join(directory, entry.name.toString());
if (ignore(file)) {
return;
}
if (entry.isSymbolicLink() && !includeSymlinks) {
return;
}
if (entry.isDirectory()) {
search(file);
return;
}
activeCalls++;
fs.lstat(file, (err, stat) => {
activeCalls--;
if (!err && stat) {
const ext = path.extname(file).substr(1);
if (stat.isSymbolicLink() || extensions.includes(ext)) {
result.set(pathUtils.absoluteToNormal(file), [
"",
stat.mtime.getTime(),
stat.size,
0,
"",
null,
stat.isSymbolicLink() ? 1 : 0,
]);
}
console.warn(
`Error "${
err.code ?? err.message
}" reading contents of "${directory}", skipping. Add this directory to your ignore list to exclude it.`
);
} else {
entries.forEach((entry) => {
const file = path.join(directory, entry.name.toString());
if (ignore(file)) {
return;
}
if (activeCalls === 0) {
callback(result);
if (entry.isSymbolicLink() && !includeSymlinks) {
return;
}
if (entry.isDirectory()) {
search(file);
return;
}
activeCalls++;
fs.lstat(file, (err, stat) => {
activeCalls--;
if (!err && stat) {
const ext = path.extname(file).substr(1);
if (stat.isSymbolicLink() || extensions.includes(ext)) {
result.set(pathUtils.absoluteToNormal(file), [
"",
stat.mtime.getTime(),
stat.size,
0,
"",
null,
stat.isSymbolicLink() ? 1 : 0,
]);
}
}
if (activeCalls === 0) {
callback(result);
}
});
});
});
}
if (activeCalls === 0) {

@@ -126,2 +138,3 @@ callback(result);

rootDir,
console,
callback

@@ -181,2 +194,3 @@ ) {

const {
console,
previousState,

@@ -211,7 +225,23 @@ extensions,

if (useNativeFind) {
findNative(roots, extensions, ignore, includeSymlinks, rootDir, callback);
findNative(
roots,
extensions,
ignore,
includeSymlinks,
rootDir,
console,
callback
);
} else {
find(roots, extensions, ignore, includeSymlinks, rootDir, callback);
find(
roots,
extensions,
ignore,
includeSymlinks,
rootDir,
console,
callback
);
}
});
};

@@ -89,2 +89,3 @@ "use strict";

computeSha1: options.computeSha1,
console: options.console,
includeSymlinks: options.enableSymlinks,

@@ -91,0 +92,0 @@ extensions: options.extensions,

@@ -10,3 +10,3 @@ "use strict";

static REGEXP =
/Recrawled this watch (\d+) times, most recently because:\n([^:]+)/;
/Recrawled this watch (\d+) times?, most recently because:\n([^:]+)/;
constructor(root, count) {

@@ -13,0 +13,0 @@ this.root = root;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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