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

@egym/mwa-logger

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@egym/mwa-logger - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

dist/mwa-logger/cjs/types/config/config.d.ts

43

dist/mwa-logger/cjs/index.js

@@ -5,11 +5,20 @@ 'use strict';

let config = {
initialized: false,
};
function setConfig(newConfig) {
config = Object.assign(Object.assign({}, config), newConfig);
}
function getConfig() {
return config;
}
let messages = [];
let listeners = [];
const appendAndEmitMessage = (newMessage) => {
messages = [
...messages,
newMessage,
];
console.debug(newMessage);
emitChange();
if (getConfig().initialized || newMessage.type === 'wsod') {
messages = [...messages, newMessage];
console.debug(newMessage);
emitChange();
}
};

@@ -24,3 +33,3 @@ const logHttpRequest = (method, url, requestId, payload) => appendAndEmitMessage({

direction: 'request',
data: payload
data: payload,
});

@@ -35,3 +44,3 @@ const logHttpResponse = (method, url, requestId, response) => appendAndEmitMessage({

direction: 'response',
data: response
data: response,
});

@@ -43,3 +52,3 @@ const logDebug = (text, data) => appendAndEmitMessage({

text,
data
data,
});

@@ -52,3 +61,3 @@ const logPortalsRequest = (topic, data) => appendAndEmitMessage({

data,
direction: 'request'
direction: 'request',
});

@@ -61,3 +70,3 @@ const logPortalsResponse = (topic, data) => appendAndEmitMessage({

data,
direction: 'response'
direction: 'response',
});

@@ -81,3 +90,3 @@ const logWebWitals = (metric) => appendAndEmitMessage({

return () => {
listeners = listeners.filter(l => l !== listener);
listeners = listeners.filter((l) => l !== listener);
};

@@ -567,7 +576,10 @@ };

const EgymMwaDevtools = ({ position, wrapperStyle, buttonStyle, ciConfig }) => {
const EgymMwaDevtools = ({ enabled, position, wrapperStyle, buttonStyle, ciConfig }) => {
const messages = React.useSyncExternalStore(subscribe, getSnapshot);
const [open, setOpen] = React.useState(false);
const [positionStyles, setPositionStyles] = React.useState(null);
const isEnabled = typeof enabled === 'boolean' ? enabled : true;
React.useEffect(() => {
if (!isEnabled)
return;
// adding timeout to make sure css variable accessible in the MWA

@@ -583,2 +595,7 @@ setTimeout(() => {

}, [ciConfig]);
React.useEffect(() => {
if (!isEnabled)
return;
setConfig({ initialized: true });
}, []);
const contentWidth = React.useMemo(() => {

@@ -585,0 +602,0 @@ if (!positionStyles)

import { CSSProperties, FC } from 'react';
import { CIConfig } from '../types';
type Props = {
enabled?: boolean;
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';

@@ -5,0 +6,0 @@ wrapperStyle?: CSSProperties;

@@ -1,4 +0,4 @@

export { logHttpRequest, logHttpResponse, logDebug, logPortalsRequest, logPortalsResponse, logWebWitals } from './messages';
export { ErrorBoundary } from './ErrorBoundary';
export { default as EgymMwaDevtools } from './EgymMwaDevtools';
export { logHttpRequest, logHttpResponse, logDebug, logPortalsRequest, logPortalsResponse, logWebWitals, } from "./messages";
export { ErrorBoundary } from "./ErrorBoundary";
export { default as EgymMwaDevtools } from "./EgymMwaDevtools";
export { CIConfig } from './types';
import React, { useState, useCallback, useMemo, useSyncExternalStore, useEffect } from 'react';
let config = {
initialized: false,
};
function setConfig(newConfig) {
config = Object.assign(Object.assign({}, config), newConfig);
}
function getConfig() {
return config;
}
let messages = [];
let listeners = [];
const appendAndEmitMessage = (newMessage) => {
messages = [
...messages,
newMessage,
];
console.debug(newMessage);
emitChange();
if (getConfig().initialized || newMessage.type === 'wsod') {
messages = [...messages, newMessage];
console.debug(newMessage);
emitChange();
}
};

@@ -21,3 +30,3 @@ const logHttpRequest = (method, url, requestId, payload) => appendAndEmitMessage({

direction: 'request',
data: payload
data: payload,
});

@@ -32,3 +41,3 @@ const logHttpResponse = (method, url, requestId, response) => appendAndEmitMessage({

direction: 'response',
data: response
data: response,
});

@@ -40,3 +49,3 @@ const logDebug = (text, data) => appendAndEmitMessage({

text,
data
data,
});

@@ -49,3 +58,3 @@ const logPortalsRequest = (topic, data) => appendAndEmitMessage({

data,
direction: 'request'
direction: 'request',
});

@@ -58,3 +67,3 @@ const logPortalsResponse = (topic, data) => appendAndEmitMessage({

data,
direction: 'response'
direction: 'response',
});

@@ -78,3 +87,3 @@ const logWebWitals = (metric) => appendAndEmitMessage({

return () => {
listeners = listeners.filter(l => l !== listener);
listeners = listeners.filter((l) => l !== listener);
};

@@ -564,7 +573,10 @@ };

const EgymMwaDevtools = ({ position, wrapperStyle, buttonStyle, ciConfig }) => {
const EgymMwaDevtools = ({ enabled, position, wrapperStyle, buttonStyle, ciConfig }) => {
const messages = useSyncExternalStore(subscribe, getSnapshot);
const [open, setOpen] = useState(false);
const [positionStyles, setPositionStyles] = useState(null);
const isEnabled = typeof enabled === 'boolean' ? enabled : true;
useEffect(() => {
if (!isEnabled)
return;
// adding timeout to make sure css variable accessible in the MWA

@@ -580,2 +592,7 @@ setTimeout(() => {

}, [ciConfig]);
useEffect(() => {
if (!isEnabled)
return;
setConfig({ initialized: true });
}, []);
const contentWidth = useMemo(() => {

@@ -582,0 +599,0 @@ if (!positionStyles)

import { CSSProperties, FC } from 'react';
import { CIConfig } from '../types';
type Props = {
enabled?: boolean;
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';

@@ -5,0 +6,0 @@ wrapperStyle?: CSSProperties;

@@ -1,4 +0,4 @@

export { logHttpRequest, logHttpResponse, logDebug, logPortalsRequest, logPortalsResponse, logWebWitals } from './messages';
export { ErrorBoundary } from './ErrorBoundary';
export { default as EgymMwaDevtools } from './EgymMwaDevtools';
export { logHttpRequest, logHttpResponse, logDebug, logPortalsRequest, logPortalsResponse, logWebWitals, } from "./messages";
export { ErrorBoundary } from "./ErrorBoundary";
export { default as EgymMwaDevtools } from "./EgymMwaDevtools";
export { CIConfig } from './types';

@@ -74,2 +74,3 @@ import { Metric } from 'web-vitals';

type Props = {
enabled?: boolean;
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';

@@ -76,0 +77,0 @@ wrapperStyle?: CSSProperties;

{
"name": "@egym/mwa-logger",
"version": "0.2.7",
"version": "0.2.8",
"description": "",

@@ -5,0 +5,0 @@ "author": "EGYM",

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