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

watchpack

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watchpack - npm Package Compare versions

Comparing version 2.0.0-beta.14 to 2.0.0-beta.15

22

lib/reducePlan.js

@@ -55,3 +55,5 @@ /*

treeMap.set(parentPath, parent);
node.parent = parent;
} else {
node.parent = parent;
if (parent.children === undefined) {

@@ -72,8 +74,9 @@ parent.children = [node];

// Select node that helps reaching the limit most effectively without overmerging
const overLimit = limit - currentCount;
const overLimit = currentCount - limit;
let bestNode = undefined;
let bestCost = Infinity;
for (const node of treeMap.values()) {
if (node.entries <= 1 || !node.children) continue;
if (node.children.length <= 1) continue;
if (node.entries <= 1 || !node.children || !node.parent) continue;
if (node.children.length === 0) continue;
if (node.children.length === 1 && !node.value) continue;
// Try to select the node with has just a bit more entries than we need to reduce

@@ -113,7 +116,8 @@ // When just a bit more is over 30% over the limit,

const newPlan = new Map();
for (const node of treeMap.values()) {
if (!node.active) continue;
for (const rootNode of treeMap.values()) {
if (!rootNode.active) continue;
const map = new Map();
const queue = new Set([node]);
const queue = new Set([rootNode]);
for (const node of queue) {
if (node.active && node !== rootNode) continue;
if (node.value) {

@@ -129,8 +133,10 @@ if (Array.isArray(node.value)) {

if (node.children) {
for (const child of node.children) queue.add(child);
for (const child of node.children) {
queue.add(child);
}
}
}
newPlan.set(node.filePath, map);
newPlan.set(rootNode.filePath, map);
}
return newPlan;
};

@@ -19,2 +19,5 @@ /*

const recursiveWatcherLogging = !!process.env
.WATCHPACK_RECURSIVE_WATCHER_LOGGING;
let isBatch = false;

@@ -97,2 +100,9 @@ let watcherCount = 0;

if (!filename) {
if (recursiveWatcherLogging) {
process.stderr.write(
`[watchpack] dispatch ${type} event in recursive watcher (${
this.rootPath
}) to all watchers\n`
);
}
for (const w of this.mapWatcherToPath.keys()) {

@@ -104,2 +114,11 @@ w.emit("change", type);

const watchers = this.mapPathToWatchers.get(dir);
if (recursiveWatcherLogging) {
process.stderr.write(
`[watchpack] dispatch ${type} event in recursive watcher (${
this.rootPath
}) for '${filename}' to ${
watchers ? watchers.size : 0
} watchers\n`
);
}
if (watchers === undefined) return;

@@ -124,2 +143,7 @@ for (const w of watchers) {

watcherCount++;
if (recursiveWatcherLogging) {
process.stderr.write(
`[watchpack] created recursive watcher at ${rootPath}\n`
);
}
}

@@ -154,2 +178,7 @@

if (this.watcher) this.watcher.close();
if (recursiveWatcherLogging) {
process.stderr.write(
`[watchpack] closed recursive watcher at ${this.rootPath}\n`
);
}
}

@@ -156,0 +185,0 @@ }

{
"name": "watchpack",
"version": "2.0.0-beta.14",
"version": "2.0.0-beta.15",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib/watchpack.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