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.71.1 to 0.71.2

3

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

@@ -17,2 +17,3 @@ "main": "src/index.js",

"anymatch": "^3.0.3",
"debug": "^2.2.0",
"fb-watchman": "^2.0.0",

@@ -19,0 +20,0 @@ "graceful-fs": "^4.2.4",

@@ -75,7 +75,9 @@ "use strict";

async write(dataSnapshot) {
(0, _gracefulFs.writeFileSync)(
this._cachePath,
(0, _v.serialize)(dataSnapshot)
);
async write(dataSnapshot, { changed, removed }) {
if (changed.size > 0 || removed.size > 0) {
(0, _gracefulFs.writeFileSync)(
this._cachePath,
(0, _v.serialize)(dataSnapshot)
);
}
}

@@ -82,0 +84,0 @@ }

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

constructor(options) {
var _options$dependencyEx, _this$_options$perfLo;
var _options$dependencyEx, _options$watchmanDefe, _this$_options$perfLo;

@@ -317,2 +317,7 @@ if (options.perfLogger) {

watch: !!options.watch,
watchmanDeferStates:
(_options$watchmanDefe = options.watchmanDeferStates) !== null &&
_options$watchmanDefe !== void 0
? _options$watchmanDefe
: [],
};

@@ -376,2 +381,4 @@ this._console = options.console || global.console;

this._buildPromise = (async () => {
var _data$changedFiles, _data$removedFiles;
const data = await this._buildFileMap(); // Persist when we don't know if files changed (changedFiles undefined)

@@ -388,3 +395,2 @@ // or when we know a file was changed or deleted.

hasteMap = await this._buildHasteMap(data);
await this._persist(hasteMap);
} else {

@@ -394,2 +400,13 @@ hasteMap = data.hasteMap;

await this._persist(
hasteMap,
(_data$changedFiles = data.changedFiles) !== null &&
_data$changedFiles !== void 0
? _data$changedFiles
: new Map(),
(_data$removedFiles = data.removedFiles) !== null &&
_data$removedFiles !== void 0
? _data$removedFiles
: new Map()
);
const rootDir = this._options.rootDir;

@@ -826,3 +843,3 @@ const hasteFS = new _HasteFS.default({

async _persist(hasteMap) {
async _persist(hasteMap, changed, removed) {
var _this$_options$perfLo10, _this$_options$perfLo11;

@@ -835,3 +852,6 @@

const snapshot = (0, _deepCloneInternalData.default)(hasteMap);
await this._cacheManager.write(snapshot);
await this._cacheManager.write(snapshot, {
changed,
removed,
});
(_this$_options$perfLo11 = this._options.perfLogger) === null ||

@@ -975,2 +995,3 @@ _this$_options$perfLo11 === void 0

ignored: ignorePattern,
watchmanDeferStates: this._options.watchmanDeferStates,
});

@@ -977,0 +998,0 @@ return new Promise((resolve, reject) => {

@@ -39,2 +39,3 @@ /**

watcher.ignored = opts.ignored || false;
watcher.watchmanDeferStates = opts.watchmanDeferStates;

@@ -41,0 +42,0 @@ if (!Array.isArray(watcher.globs)) {

@@ -76,2 +76,4 @@ "use strict";

*/
const debug = require("debug")("Metro:WatchmanWatcher");
const CHANGE_EVENT = _common.default.CHANGE_EVENT;

@@ -173,2 +175,3 @@ const DELETE_EVENT = _common.default.DELETE_EVENT;

since: resp.clock,
defer: self.watchmanDeferStates,
}; // If the server has the wildmatch capability available it supports

@@ -243,2 +246,4 @@ // the recursive **/*.foo style match and we can offload our globs

WatchmanWatcher.prototype.handleChangeEvent = function (resp) {
var _this$watchmanDeferSt, _this$watchmanDeferSt2;
_assert.default.equal(

@@ -261,2 +266,26 @@ resp.subscription,

}
if (
((_this$watchmanDeferSt = this.watchmanDeferStates) !== null &&
_this$watchmanDeferSt !== void 0
? _this$watchmanDeferSt
: []
).includes(resp["state-enter"])
) {
debug(
`Watchman reports ${resp["state-enter"]} just started. Filesystem notifications are paused.`
);
}
if (
((_this$watchmanDeferSt2 = this.watchmanDeferStates) !== null &&
_this$watchmanDeferSt2 !== void 0
? _this$watchmanDeferSt2
: []
).includes(resp["state-leave"])
) {
debug(
`Watchman reports ${resp["state-leave"]} ended. Filesystem notifications resumed.`
);
}
};

@@ -263,0 +292,0 @@ /**

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