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

@travetto/base

Package Overview
Dependencies
Maintainers
1
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/base - npm Package Compare versions

Comparing version 0.0.64 to 0.0.65

2

package.json

@@ -19,3 +19,3 @@ {

"scripts": {},
"version": "0.0.64"
"version": "0.0.65"
}

@@ -108,4 +108,4 @@ import * as path from 'path';

export function bulkRequire<T = any>(handlers: Handler[]): T[] {
return bulkFindSync(handlers)
export function bulkRequire<T = any>(handlers: Handler[], cwd?: string): T[] {
return bulkFindSync(handlers, cwd)
.filter(x => !x.stats.isDirectory()) // Skip folders

@@ -112,0 +112,0 @@ .map(x => require(x.file))

@@ -22,2 +22,5 @@ import * as util from 'util';

private cached = new Map<string, (string | symbol)[]>();
private pendingWatched: Entry[] = [];
private pending = true;
private suppress = false;

@@ -42,7 +45,5 @@ private options: Options;

setImmediate(() => {
this.watch({
file: this.options.cwd,
stats: fs.lstatSync(this.options.cwd)
});
this.pendingWatched.push({
file: this.options.cwd,
stats: fs.lstatSync(this.options.cwd)
});

@@ -53,5 +54,5 @@ }

if (err.code === 'EMFILE') {
this.emit('error', new Error('EMFILE: Too many opened files.'));
this._emit('error', new Error('EMFILE: Too many opened files.'));
}
this.emit('error', err);
this._emit('error', err);
}

@@ -72,3 +73,3 @@

setImmediate(() => {
this.emit('end');
this._emit('end');
this.removeAllListeners();

@@ -85,3 +86,7 @@ });

if (!this.watched.has(entry.file)) {
this.watch(entry);
if (this.pending) {
this.pendingWatched.push(entry);
} else {
this.watch(entry);
}
}

@@ -91,2 +96,12 @@ }

run(listenInitial = true) {
this.pending = false
if (this.pendingWatched.length) {
this.suppress = !listenInitial;
this.pendingWatched.map(x => this.watch(x));
this.pendingWatched = [];
setImmediate(() => this.suppress = false);
}
}
watch(entry: Entry) {

@@ -114,3 +129,3 @@ if (this.watched.has(entry.file)) {

} else {
return this.emit('error', err);
return this._emit('error', err);
}

@@ -134,4 +149,4 @@ }

if (!child.stats.isDirectory()) {
this.emit('removed', child);
this.emit('all', { event: 'removed', entry: child })
this._emit('removed', child);
this._emit('all', { event: 'removed', entry: child })
}

@@ -157,4 +172,4 @@ }

if (!sub.stats.isDirectory()) {
this.emit('added', sub);
this.emit('all', { event: 'added', entry: sub })
this._emit('added', sub);
this._emit('all', { event: 'added', entry: sub })
}

@@ -166,2 +181,8 @@ }

private _emit(type: string, payload?: any) {
if (!this.suppress) {
this.emit(type, payload);
}
}
private watchDirectory(entry: Entry) {

@@ -204,4 +225,4 @@ if (!entry.stats.isDirectory()) {

if (fs.existsSync(entry.file)) {
this.emit('changed', entry);
this.emit('all', { event: 'changed', entry })
this._emit('changed', entry);
this._emit('all', { event: 'changed', entry })
}

@@ -208,0 +229,0 @@ });

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