New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

turbowatch

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turbowatch - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

dist/watch.test.js

55

dist/subscribe.js

@@ -17,3 +17,4 @@ "use strict";

let first = true;
const handleSubscriptionEvent = async (event) => {
let eventQueue = [];
const handleSubscriptionEvent = async () => {
var _a;

@@ -24,19 +25,2 @@ if ((_a = trigger.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {

}
if (trigger.initialRun && first) {
log.trace('initial run...');
}
else if (event.files.length > 10) {
log.trace({
files: event.files.slice(0, 10).map((file) => {
return file.name;
}),
}, '%d files changed; showing first 10', event.files.length);
}
else {
log.trace({
files: event.files.map((file) => {
return file.name;
}),
}, '%d files changed', event.files.length);
}
let reportFirst = first;

@@ -83,2 +67,28 @@ if (first) {

}
// TODO remove duplicates
const event = {
files: eventQueue.map(({ path }) => {
return {
name: path,
};
}),
};
eventQueue = [];
if (trigger.initialRun && first) {
log.trace('initial run...');
}
else if (event.files.length > 10) {
log.trace({
files: event.files.slice(0, 10).map((file) => {
return file.name;
}),
}, '%d files changed; showing first 10', event.files.length);
}
else {
log.trace({
files: event.files.map((file) => {
return file.name;
}),
}, '%d files changed', event.files.length);
}
const taskId = (0, generateShortId_1.generateShortId)();

@@ -141,9 +151,4 @@ const taskPromise = (0, p_retry_1.default)((attempt) => {

trigger: async (events) => {
await handleSubscriptionEvent({
files: events.map((event) => {
return {
name: event.path,
};
}),
});
eventQueue.push(...events);
await handleSubscriptionEvent();
},

@@ -150,0 +155,0 @@ };

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

const watch = (configurationInput) => {
const { project, triggers, abortSignal: userAbortSignal, } = {
const { project, triggers, abortSignal: userAbortSignal, onReady, } = {
...configurationInput,

@@ -120,2 +120,5 @@ };

});
if (onReady) {
onReady();
}
});

@@ -122,0 +125,0 @@ for (const subscription of subscriptions) {

@@ -63,3 +63,3 @@ {

"types": "./src/index.ts",
"version": "2.0.7"
"version": "2.0.8"
}

@@ -8,3 +8,2 @@ import { createSpawn } from './createSpawn';

type Subscription,
type SubscriptionEvent,
type Trigger,

@@ -23,3 +22,5 @@ } from './types';

const handleSubscriptionEvent = async (event: SubscriptionEvent) => {
let eventQueue: ChokidarEvent[] = [];
const handleSubscriptionEvent = async () => {
if (trigger.abortSignal?.aborted) {

@@ -31,26 +32,2 @@ log.warn('ignoring event because Turbowatch is shutting down');

if (trigger.initialRun && first) {
log.trace('initial run...');
} else if (event.files.length > 10) {
log.trace(
{
files: event.files.slice(0, 10).map((file) => {
return file.name;
}),
},
'%d files changed; showing first 10',
event.files.length,
);
} else {
log.trace(
{
files: event.files.map((file) => {
return file.name;
}),
},
'%d files changed',
event.files.length,
);
}
let reportFirst = first;

@@ -111,2 +88,37 @@

// TODO remove duplicates
const event = {
files: eventQueue.map(({ path }) => {
return {
name: path,
};
}),
};
eventQueue = [];
if (trigger.initialRun && first) {
log.trace('initial run...');
} else if (event.files.length > 10) {
log.trace(
{
files: event.files.slice(0, 10).map((file) => {
return file.name;
}),
},
'%d files changed; showing first 10',
event.files.length,
);
} else {
log.trace(
{
files: event.files.map((file) => {
return file.name;
}),
},
'%d files changed',
event.files.length,
);
}
const taskId = generateShortId();

@@ -179,11 +191,7 @@

trigger: async (events: readonly ChokidarEvent[]) => {
await handleSubscriptionEvent({
files: events.map((event) => {
return {
name: event.path,
};
}),
});
eventQueue.push(...events);
await handleSubscriptionEvent();
},
};
};

@@ -134,2 +134,3 @@ // cspell:words idirname imatch iname wholename

readonly debounce?: Debounce;
readonly onReady?: () => void;
readonly project: string;

@@ -141,2 +142,3 @@ readonly triggers: readonly TriggerInput[];

readonly abortSignal?: AbortSignal;
readonly onReady?: () => void;
readonly project: string;

@@ -151,6 +153,2 @@ readonly triggers: readonly TriggerInput[];

export type SubscriptionEvent = {
files: Array<{ name: string }>;
};
/**

@@ -157,0 +155,0 @@ * @property queued Indicates that a follow action has been queued.

@@ -25,2 +25,3 @@ import { generateShortId } from './generateShortId';

abortSignal: userAbortSignal,
onReady,
}: Configuration = {

@@ -139,2 +140,6 @@ ...configurationInput,

});
if (onReady) {
onReady();
}
});

@@ -141,0 +146,0 @@

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