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

nighthouse

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nighthouse - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

15

out/common/lighthouse.js

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

const requestId = await this.sendRequest('STREAM', path, payload);
yield* this.receiveStreaming(requestId);
try {
this.logger.debug(() => `Starting stream from ${JSON.stringify(path)}...`);
yield* this.receiveStreaming(requestId);
}
finally {
this.logger.debug(() => `Stopping stream from ${JSON.stringify(path)}...`);
await this.sendRequest('STOP', path, {});
}
}

@@ -116,2 +123,3 @@ /** Sends a request. */

}
this.logger.debug(() => `Sending ${JSON.stringify(message)}`);
const raw = this.coder.encode(message);

@@ -147,5 +155,6 @@ await this.transport.send(raw);

// faster than we clients can process them.
const nextPromises = [];
try {
const nextPromises = [];
const pushPromise = () => {
this.logger.trace(`Pushing promise for next response to request ${id}`);
const deferred = new deferred_1.Deferred();

@@ -165,3 +174,3 @@ this.responseHandlers.set(id, deferred);

finally {
this.logger.trace(`Deleting stream handler for ${id}`);
this.logger.trace(`Deleting stream handler for request ${id}`);
this.responseHandlers.delete(id);

@@ -168,0 +177,0 @@ }

18

out/common/log.d.ts

@@ -12,3 +12,3 @@ /** A log message severity. */

/** Logs the given message at the given level. */
log(level: LogLevel, msg: string): void;
log(level: LogLevel, msg: string | (() => string)): void;
}

@@ -23,3 +23,3 @@ /** A simple logger that swallows the messages and does nothing. */

constructor(prefix?: string);
log(level: LogLevel, msg: string): void;
log(level: LogLevel, msg: string | (() => string)): void;
private formatLevel;

@@ -32,3 +32,3 @@ }

constructor(level: LogLevel, handler: LogHandler);
log(level: LogLevel, msg: string): void;
log(level: LogLevel, msg: string | (() => string)): void;
}

@@ -40,13 +40,13 @@ /** A wrapper around a log handler with some convenience methods. */

/** Logs the given message at the given level. */
log(level: LogLevel, msg: string): void;
log(level: LogLevel, msg: string | (() => string)): void;
/** Logs the given message at the trace level. */
trace(msg: string): void;
trace(msg: string | (() => string)): void;
/** Logs the given message at the debug level. */
debug(msg: string): void;
debug(msg: string | (() => string)): void;
/** Logs the given message at the info level. */
info(msg: string): void;
info(msg: string | (() => string)): void;
/** Logs the given message at the warning level. */
warning(msg: string): void;
warning(msg: string | (() => string)): void;
/** Logs the given message at the error level. */
error(msg: string): void;
error(msg: string | (() => string)): void;
}

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

log(level, msg) {
const formatted = `${this.prefix}[${this.formatLevel(level)}] ${msg}`;
const msgString = typeof msg === 'function' ? msg() : msg;
const formatted = `${this.prefix}[${this.formatLevel(level)}] ${msgString}`;
if (level >= LogLevel.Error) {

@@ -29,0 +30,0 @@ console.error(formatted);

{
"name": "nighthouse",
"version": "2.1.3",
"version": "2.1.4",
"description": "Lightweight Project Lighthouse client for JavaScript",

@@ -5,0 +5,0 @@ "workspaces": [

@@ -112,3 +112,9 @@ import { Transport } from "./transport";

const requestId = await this.sendRequest('STREAM', path, payload);
yield* this.receiveStreaming(requestId);
try {
this.logger.debug(() => `Starting stream from ${JSON.stringify(path)}...`);
yield* this.receiveStreaming(requestId);
} finally {
this.logger.debug(() => `Stopping stream from ${JSON.stringify(path)}...`);
await this.sendRequest('STOP', path, {});
}
}

@@ -136,2 +142,3 @@

}
this.logger.debug(() => `Sending ${JSON.stringify(message)}`);
const raw = this.coder.encode(message);

@@ -171,6 +178,7 @@ await this.transport.send(raw);

const nextPromises: Promise<ServerMessage<unknown>>[] = [];
try {
const nextPromises = [];
const pushPromise = () => {
this.logger.trace(`Pushing promise for next response to request ${id}`);
const deferred = new Deferred<ServerMessage<unknown>>();

@@ -191,3 +199,3 @@ this.responseHandlers.set(id, deferred);

} finally {
this.logger.trace(`Deleting stream handler for ${id}`);
this.logger.trace(`Deleting stream handler for request ${id}`);
this.responseHandlers.delete(id);

@@ -194,0 +202,0 @@ }

@@ -13,3 +13,3 @@ /** A log message severity. */

/** Logs the given message at the given level. */
log(level: LogLevel, msg: string): void;
log(level: LogLevel, msg: string | (() => string)): void;
}

@@ -28,4 +28,5 @@

log(level: LogLevel, msg: string): void {
const formatted = `${this.prefix}[${this.formatLevel(level)}] ${msg}`;
log(level: LogLevel, msg: string | (() => string)): void {
const msgString = typeof msg === 'function' ? msg() : msg;
const formatted = `${this.prefix}[${this.formatLevel(level)}] ${msgString}`;
if (level >= LogLevel.Error) {

@@ -56,3 +57,3 @@ console.error(formatted);

log(level: LogLevel, msg: string): void {
log(level: LogLevel, msg: string | (() => string)): void {
if (level >= this.level) {

@@ -69,3 +70,3 @@ this.handler.log(level, msg);

/** Logs the given message at the given level. */
log(level: LogLevel, msg: string): void {
log(level: LogLevel, msg: string | (() => string)): void {
this.handler.log(level, msg);

@@ -75,3 +76,3 @@ }

/** Logs the given message at the trace level. */
trace(msg: string): void {
trace(msg: string | (() => string)): void {
this.log(LogLevel.Trace, msg);

@@ -81,3 +82,3 @@ }

/** Logs the given message at the debug level. */
debug(msg: string): void {
debug(msg: string | (() => string)): void {
this.log(LogLevel.Debug, msg);

@@ -87,3 +88,3 @@ }

/** Logs the given message at the info level. */
info(msg: string): void {
info(msg: string | (() => string)): void {
this.log(LogLevel.Info, msg);

@@ -93,3 +94,3 @@ }

/** Logs the given message at the warning level. */
warning(msg: string): void {
warning(msg: string | (() => string)): void {
this.log(LogLevel.Warning, msg);

@@ -99,5 +100,5 @@ }

/** Logs the given message at the error level. */
error(msg: string): void {
error(msg: string | (() => string)): void {
this.log(LogLevel.Error, msg);
}
}

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