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

@ulixee/commons

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ulixee/commons - npm Package Compare versions

Comparing version 2.0.0-alpha.11 to 2.0.0-alpha.12

4

interfaces/ILog.d.ts

@@ -9,3 +9,5 @@ export default interface ILog extends IBoundLog<ILogData> {

warn<T extends Base>(action: string, data?: T): number;
error<T extends Base>(action: string, data?: T): number;
error<T extends Base>(action: string, data?: T | {
error: Error;
}): number;
createChild(module: any, boundData?: any): IBoundLog;

@@ -12,0 +14,0 @@ }

/**
* Will load env files with this precedence (.env.defaults, .env.<NODE_ENV>, .env)
*/
export declare function loadEnv(baseDir: string): void;
export declare function loadEnv(baseDir: string, overwriteSetValues?: boolean): void;
export declare function applyEnvironmentVariables(path: string, env: Record<string, string>): void;
export declare function parseEnvList(envvar: string): string[];
export declare function parseEnvInt(envvar: string): number | null;
export declare function parseEnvPath(envvar: string, relativeTo?: string): string;
export declare function parseEnvBool(envvar: string): boolean;
export declare function parseEnvBigint(envvar: string): bigint | null;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseEnvBigint = exports.parseEnvInt = exports.parseEnvList = exports.applyEnvironmentVariables = exports.loadEnv = void 0;
exports.parseEnvBigint = exports.parseEnvBool = exports.parseEnvPath = exports.parseEnvInt = exports.parseEnvList = exports.applyEnvironmentVariables = exports.loadEnv = void 0;
const Fs = require("fs");
const Path = require("path");
const Os = require("os");
/**
* Will load env files with this precedence (.env.defaults, .env.<NODE_ENV>, .env)
*/
function loadEnv(baseDir) {
function loadEnv(baseDir, overwriteSetValues = false) {
const envName = process.env.NODE_ENV?.toLowerCase() ?? 'development';

@@ -20,4 +21,5 @@ const env = {};

for (const [key, value] of Object.entries(env)) {
if (!process.env[key])
process.env[key] = value;
if (process.env[key] && !overwriteSetValues)
continue;
process.env[key] = value;
}

@@ -66,5 +68,26 @@ }

exports.parseEnvInt = parseEnvInt;
function parseEnvPath(envvar, relativeTo) {
if (!envvar)
return null;
if (envvar?.startsWith('~'))
envvar = Path.join(Os.homedir(), envvar.slice(1));
if (Path.isAbsolute(envvar))
return envvar;
return Path.resolve(relativeTo ?? process.cwd(), envvar);
}
exports.parseEnvPath = parseEnvPath;
function parseEnvBool(envvar) {
if (envvar === '1' || envvar?.toLowerCase() === 'true' || envvar?.toLowerCase() === 'yes')
return true;
return false;
}
exports.parseEnvBool = parseEnvBool;
function parseEnvBigint(envvar) {
if (!envvar)
return null;
if (envvar.includes('e')) {
const [number, exp] = envvar.split('e');
const decimal = Number(`1${exp}`);
return BigInt(number) * BigInt(decimal);
}
return BigInt(envvar);

@@ -71,0 +94,0 @@ }

@@ -13,3 +13,5 @@ /// <reference types="node" />

warn(action: string, data?: ILogData): number;
error(action: string, data?: ILogData): number;
error(action: string, data?: ILogData | {
error: Error;
}): number;
createChild(module: any, boundContext?: any): ILog;

@@ -16,0 +18,0 @@ flush(): void;

@@ -146,2 +146,7 @@ "use strict";

}
if (key === 'error' && value) {
result.error = new Error(value.message);
Object.assign(result.error, value);
continue;
}
const printable = translateValueToPrintable(value);

@@ -194,2 +199,3 @@ if (printable === null || printable === undefined)

.replace(/^(.*)[/\\]ulixee[/\\](.+)$/, '$2')
.replace(/^(.*)[/\\]payments[/\\](.+)$/, '$2')
.replace(/^(.*)[/\\]@ulixee[/\\](.+)$/, '$2')

@@ -266,3 +272,3 @@ .replace(/^(.*)[/\\]commons[/\\](.+)$/, '$2')

if (ns.includes('ulx:*') || ns.includes('ulx*')) {
active.push(/^apps[/-]chromealive*/, /hero[/-].*/, /net\/.*/, /databox[/-].*/);
active.push(/^apps[/-]chromealive*/, /hero[/-].*/, /net\/.*/, /databox[/-].*/, /mainchain[/-].*/, /sidechain[/-].*/, /ramps[/-].*/);
}

@@ -269,0 +275,0 @@ else if (ns.includes('hero')) {

@@ -20,2 +20,5 @@ "use strict";

static install() {
// ts-node does it's own translations
if (process.execArgv?.includes('ts-node'))
return;
if (!Error[Symbol.for('source-map-support')]) {

@@ -121,3 +124,3 @@ Error[Symbol.for('source-map-support')] = true;

const filename = frame.getFileName() || frame.getScriptNameOrSourceURL();
if (filename) {
if (filename && !filename.endsWith('.ts')) {
const position = this.getOriginalSourcePosition({

@@ -124,0 +127,0 @@ filename,

@@ -15,3 +15,3 @@ export default class TypeSerializer {

}): unknown;
private static replacer;
private static typeReplacer;
private static reviver;

@@ -18,0 +18,0 @@ }

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

return object;
const replaced = this.replacer(null, object);
const replaced = this.typeReplacer(null, object, { sortKeys: options?.sortKeys });
if (replaced !== object || (typeof replaced === 'object' && '__type' in replaced)) {

@@ -65,3 +65,3 @@ return replaced;

if (Array.isArray(object)) {
return object.map(x => this.replace(x));
return object.map(x => this.replace(x, options));
}

@@ -77,3 +77,3 @@ const keys = Object.keys(object);

}
response[key] = this.replace(object[key]);
response[key] = this.replace(object[key], options);
}

@@ -84,3 +84,3 @@ return response;

}
static replacer(_, value) {
static typeReplacer(_, value, options) {
if (value === null || value === undefined)

@@ -113,9 +113,13 @@ return value;

const { name, message, stack, ...data } = value;
return { __type: Types.Error, value: { name, message, stack, ...data } };
const extras = this.replace(data, options);
return { __type: Types.Error, value: { name, message, stack, ...extras } };
}
if (value instanceof Map) {
return { __type: Types.Map, value: [...value.entries()] };
return {
__type: Types.Map,
value: [...value.entries()].map(x => this.replace(x, options)),
};
}
if (value instanceof Set) {
return { __type: Types.Set, value: [...value] };
return { __type: Types.Set, value: [...value].map(x => this.replace(x, options)) };
}

@@ -200,8 +204,11 @@ if (this.isNodejs) {

return new RegExp(value[0], value[1]);
if (type === Types.Map)
if (type === Types.Map) {
return new Map(value);
if (type === Types.Set)
}
if (type === Types.Set) {
return new Set(value);
}
if (type === Types.Error) {
const { name, message, stack, ...data } = value;
const extras = this.revive(data);
let Constructor = this.errorTypes && this.errorTypes.get(name);

@@ -219,3 +226,3 @@ if (!Constructor) {

e.name = name;
Object.assign(e, data);
Object.assign(e, extras);
if (stack) {

@@ -222,0 +229,0 @@ e.stack = `${stack}\n${`------${stackMarker}`.padEnd(50, '-')}\n${startStack}`;

{
"name": "@ulixee/commons",
"version": "2.0.0-alpha.11",
"version": "2.0.0-alpha.12",
"description": "Common utilities for Ulixee",

@@ -19,3 +19,3 @@ "license": "MIT",

},
"gitHead": "64ca2766fa3d206479dc8bfb3e887e8b133ee8b5"
"gitHead": "f4dcca3a1da1cba8dcc791a853647d60af5c02bd"
}

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

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