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.29 to 2.0.0-alpha.30

111

CHANGELOG.md

@@ -6,5 +6,8 @@ # Change Log

# [2.0.0-alpha.30](https://github.com/ulixee/hero/compare/v2.0.0-alpha.29...v2.0.0-alpha.30) (2024-10-11)
**Note:** Version bump only for package @ulixee/commons
# [2.0.0-alpha.29](https://github.com/ulixee/shared/compare/v2.0.0-alpha.28...v2.0.0-alpha.29) (2024-07-16)
### Bug Fixes

@@ -16,6 +19,2 @@

# [2.0.0-alpha.28](https://github.com/ulixee/shared/compare/v2.0.0-alpha.27...v2.0.0-alpha.28) (2024-03-11)

@@ -25,6 +24,2 @@

# [2.0.0-alpha.27](https://github.com/ulixee/shared/compare/v2.0.0-alpha.26...v2.0.0-alpha.27) (2024-03-01)

@@ -34,9 +29,4 @@

# [2.0.0-alpha.26](https://github.com/ulixee/shared/compare/v2.0.0-alpha.25...v2.0.0-alpha.26) (2024-02-02)
### Features

@@ -46,6 +36,2 @@

# [2.0.0-alpha.25](https://github.com/ulixee/shared/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2023-09-28)

@@ -55,6 +41,2 @@

# [2.0.0-alpha.24](https://github.com/ulixee/shared/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2023-08-09)

@@ -64,9 +46,4 @@

# [2.0.0-alpha.23](https://github.com/ulixee/shared/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2023-07-07)
### Features

@@ -76,9 +53,4 @@

# [2.0.0-alpha.22](https://github.com/ulixee/shared/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2023-06-12)
### Bug Fixes

@@ -92,3 +64,2 @@

### Features

@@ -102,6 +73,2 @@

# [2.0.0-alpha.21](https://github.com/ulixee/shared/compare/v2.0.0-alpha.20...v2.0.0-alpha.21) (2023-04-24)

@@ -111,9 +78,4 @@

# [2.0.0-alpha.20](https://github.com/ulixee/shared/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2023-04-19)
### Bug Fixes

@@ -127,9 +89,4 @@

# [2.0.0-alpha.19](https://github.com/ulixee/shared/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2023-02-25)
### Bug Fixes

@@ -146,3 +103,2 @@

### Features

@@ -154,9 +110,4 @@

# [2.0.0-alpha.18](https://github.com/ulixee/shared/compare/v2.0.0-alpha.17...v2.0.0-alpha.18) (2023-01-17)
### Bug Fixes

@@ -166,3 +117,2 @@

### Features

@@ -174,9 +124,4 @@

# [2.0.0-alpha.17](https://github.com/ulixee/shared/compare/v2.0.0-alpha.16...v2.0.0-alpha.17) (2022-12-15)
### Features

@@ -186,9 +131,4 @@

# [2.0.0-alpha.16](https://github.com/ulixee/shared/compare/v2.0.0-alpha.15...v2.0.0-alpha.16) (2022-12-05)
### Features

@@ -198,9 +138,4 @@

# [2.0.0-alpha.15](https://github.com/ulixee/shared/compare/v2.0.0-alpha.14...v2.0.0-alpha.15) (2022-11-17)
### Features

@@ -210,9 +145,4 @@

# [2.0.0-alpha.14](https://github.com/ulixee/shared/compare/v2.0.0-alpha.13...v2.0.0-alpha.14) (2022-11-02)
### Features

@@ -222,9 +152,4 @@

# [2.0.0-alpha.13](https://github.com/ulixee/shared/compare/v2.0.0-alpha.12...v2.0.0-alpha.13) (2022-10-31)
### Bug Fixes

@@ -235,3 +160,2 @@

### Features

@@ -241,9 +165,4 @@

# [2.0.0-alpha.12](https://github.com/ulixee/shared/compare/v2.0.0-alpha.11...v2.0.0-alpha.12) (2022-10-03)
### Bug Fixes

@@ -255,9 +174,4 @@

# [2.0.0-alpha.11](https://github.com/ulixee/shared/compare/v2.0.0-alpha.10...v2.0.0-alpha.11) (2022-08-31)
### Features

@@ -267,6 +181,2 @@

# [2.0.0-alpha.10](https://github.com/ulixee/shared/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2022-08-16)

@@ -276,9 +186,4 @@

# [2.0.0-alpha.9](https://github.com/ulixee/shared/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2022-08-16)
### Features

@@ -291,6 +196,2 @@

# [2.0.0-alpha.8](https://github.com/ulixee/commons/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2022-07-14)

@@ -300,8 +201,4 @@

# 2.0.0-alpha.7 (2022-07-13)
**Note:** Version bump only for package @ulixee/commons

@@ -1,2 +0,1 @@

/// <reference types="node" />
export default interface IResolvablePromise<T = any> extends PromiseLike<T> {

@@ -3,0 +2,0 @@ isResolved: boolean;

1

interfaces/ITypedEventEmitter.d.ts

@@ -13,2 +13,3 @@ import IRegisteredEventListener from './IRegisteredEventListener';

addEventEmitter<K extends keyof T & (string | symbol)>(emitter: ITypedEventEmitter<T>, eventTypes: K[]): IRegisteredEventListener[];
setMaxListeners(n: number): this;
}
declare const sameSiteContext: readonly ["none", "strict", "lax"];
type SameSiteContext = typeof sameSiteContext[number];
type SameSiteContext = (typeof sameSiteContext)[number];
export declare function isSameSiteContext(type: string): boolean;
export default SameSiteContext;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSameSiteContext = void 0;
exports.isSameSiteContext = isSameSiteContext;
const sameSiteContext = ['none', 'strict', 'lax'];

@@ -8,3 +8,2 @@ function isSameSiteContext(type) {

}
exports.isSameSiteContext = isSameSiteContext;
//# sourceMappingURL=SameSiteContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = addGlobalInstance;
function addGlobalInstance(...constructors) {

@@ -18,3 +19,2 @@ for (const constructor of constructors) {

}
exports.default = addGlobalInstance;
//# sourceMappingURL=addGlobalInstance.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.last = exports.first = exports.all = exports.length = exports.debounce = void 0;
exports.debounce = debounce;
exports.length = length;
exports.all = all;
exports.first = first;
exports.last = last;
function debounce(func, wait, maxWait) {

@@ -22,3 +26,2 @@ let timeout;

}
exports.debounce = debounce;
function length(source) {

@@ -32,3 +35,2 @@ return (async () => {

}
exports.length = length;
function all(source) {

@@ -42,3 +44,2 @@ return (async () => {

}
exports.all = all;
function first(source) {

@@ -51,3 +52,2 @@ return (async () => {

}
exports.first = first;
function last(source) {

@@ -61,3 +61,2 @@ return (async () => {

}
exports.last = last;
//# sourceMappingURL=asyncUtils.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
export declare function concatAsBuffer(...items: (string | number | Buffer)[]): Buffer;

@@ -3,0 +2,0 @@ export declare function bufferToBigInt(buffer: Buffer): bigint;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decompressBuffer = exports.decodeBuffer = exports.encodeBuffer = exports.bufferReplacer = exports.xor = exports.bufferToBigInt = exports.concatAsBuffer = void 0;
exports.concatAsBuffer = concatAsBuffer;
exports.bufferToBigInt = bufferToBigInt;
exports.xor = xor;
exports.bufferReplacer = bufferReplacer;
exports.encodeBuffer = encodeBuffer;
exports.decodeBuffer = decodeBuffer;
exports.decompressBuffer = decompressBuffer;
const bech32_1 = require("bech32");

@@ -21,7 +27,5 @@ const util_1 = require("util");

}
exports.concatAsBuffer = concatAsBuffer;
function bufferToBigInt(buffer) {
return BigInt(`0x${buffer.toString('hex')}`);
}
exports.bufferToBigInt = bufferToBigInt;
function xor(a, b) {

@@ -37,3 +41,2 @@ if (a.length !== b.length) {

}
exports.xor = xor;
function bufferReplacer(key, value) {

@@ -45,3 +48,2 @@ if (value && Buffer.isBuffer(value)) {

}
exports.bufferReplacer = bufferReplacer;
function encodeBuffer(digest, prefix) {

@@ -51,3 +53,2 @@ const words = bech32_1.bech32m.toWords(digest);

}
exports.encodeBuffer = encodeBuffer;
function decodeBuffer(encoded, expectedPrefix) {

@@ -60,3 +61,2 @@ const { prefix, words } = bech32_1.bech32m.decode(encoded, 256);

}
exports.decodeBuffer = decodeBuffer;
function decompressBuffer(buffer, encoding) {

@@ -87,3 +87,2 @@ if (!buffer || !encoding)

}
exports.decompressBuffer = decompressBuffer;
//# sourceMappingURL=bufferUtils.js.map

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

export declare function getDirname(dirnameOrUrl: string): string;
export declare function getSourcedir(dirnameOrUrl: string, buildDir?: string): string | null;
export declare function getClosestPackageJson(path: string): any | undefined;
export declare function getDataDirectory(): string;

@@ -2,0 +5,0 @@ export declare function cleanHomeDir(str: string): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findProjectPathAsync = exports.findProjectPathSync = exports.cleanHomeDir = exports.getDataDirectory = void 0;
exports.getDirname = getDirname;
exports.getSourcedir = getSourcedir;
exports.getClosestPackageJson = getClosestPackageJson;
exports.getDataDirectory = getDataDirectory;
exports.cleanHomeDir = cleanHomeDir;
exports.findProjectPathSync = findProjectPathSync;
exports.findProjectPathAsync = findProjectPathAsync;
const Fs = require("fs");
const os = require("os");
const Path = require("path");
const url_1 = require("url");
const envUtils_1 = require("./envUtils");
const fileUtils_1 = require("./fileUtils");
function getDirname(dirnameOrUrl) {
if (typeof dirnameOrUrl === 'string') {
// handle file:// urls like import.meta.url
if (dirnameOrUrl.startsWith('file://')) {
const filename = (0, url_1.fileURLToPath)(dirnameOrUrl);
return Path.dirname(filename);
}
return dirnameOrUrl;
}
throw new Error('Invalid argument passed to getDirname');
}
function getSourcedir(dirnameOrUrl, buildDir = 'build') {
const dirname = getDirname(dirnameOrUrl);
let rootBuildDir = dirname;
while (!rootBuildDir.endsWith(`${Path.sep}${buildDir}`)) {
rootBuildDir = Path.dirname(rootBuildDir);
if (!rootBuildDir || rootBuildDir === Path.sep) {
return null;
}
}
const relativePath = Path.relative(rootBuildDir, dirname);
return Path.join(buildDir, '..', relativePath);
}
function getClosestPackageJson(path) {
while (!Fs.existsSync(Path.join(path, 'package.json'))) {
const next = Path.dirname(path);
if (next === path || !next) {
return null;
}
path = next;
}
return JSON.parse(Fs.readFileSync(Path.join(path, 'package.json'), 'utf8'));
}
function getDataDirectory() {
if (process.env.ULX_DATA_DIR) {
return (0, envUtils_1.parseEnvPath)(process.env.ULX_DATA_DIR);
if (process.env.NODE_ENV === 'test' && process.env.ULX_DATA_DIR) {
const envPath = (0, envUtils_1.parseEnvPath)(process.env.ULX_DATA_DIR);
if (envPath)
return envPath;
}

@@ -24,3 +66,2 @@ if (process.platform === 'linux') {

}
exports.getDataDirectory = getDataDirectory;
const homeDirReplace = new RegExp(os.homedir(), 'g');

@@ -30,3 +71,2 @@ function cleanHomeDir(str) {

}
exports.cleanHomeDir = cleanHomeDir;
function findProjectPathSync(startingDirectory) {

@@ -44,3 +84,2 @@ let last;

}
exports.findProjectPathSync = findProjectPathSync;
async function findProjectPathAsync(startingDirectory) {

@@ -58,3 +97,2 @@ let last;

}
exports.findProjectPathAsync = findProjectPathAsync;
//# sourceMappingURL=dirUtils.js.map

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

/// <reference types="node" />
import * as http from 'http';
export default function downloadFile(url: string, destinationPath: string, progressCallback?: (downloadedBytes: number, totalBytes: number) => void): Promise<void>;
export declare function httpGet(url: string, response: (x: http.IncomingMessage) => void): http.ClientRequest;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.httpGet = void 0;
exports.default = downloadFile;
exports.httpGet = httpGet;
const http = require("http");

@@ -38,3 +39,2 @@ const https_proxy_agent_1 = require("https-proxy-agent");

}
exports.default = downloadFile;
function httpGet(url, response) {

@@ -54,3 +54,2 @@ const options = getRequestOptionsWithProxy(url);

}
exports.httpGet = httpGet;
function getRequestOptionsWithProxy(url) {

@@ -71,3 +70,3 @@ const urlParsed = (0, url_1.parse)(url);

}
options.agent = new https_proxy_agent_1.HttpsProxyAgent(proxyURL.href);
options.agent = new https_proxy_agent_1.HttpsProxyAgent(proxyURL);
options.rejectUnauthorized = false;

@@ -74,0 +73,0 @@ }

@@ -8,4 +8,4 @@ /**

export declare function parseEnvInt(envvar: string): number | null;
export declare function parseEnvPath(envvar: string, relativeTo?: string): string;
export declare function parseEnvPath(envvar: string, relativeTo?: string): string | undefined;
export declare function parseEnvBool(envvar: string): boolean | undefined;
export declare function parseEnvBigint(envvar: string): bigint | null;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseEnvBigint = exports.parseEnvBool = exports.parseEnvPath = exports.parseEnvInt = exports.parseEnvList = exports.applyEnvironmentVariables = exports.loadEnv = void 0;
exports.loadEnv = loadEnv;
exports.applyEnvironmentVariables = applyEnvironmentVariables;
exports.parseEnvList = parseEnvList;
exports.parseEnvInt = parseEnvInt;
exports.parseEnvPath = parseEnvPath;
exports.parseEnvBool = parseEnvBool;
exports.parseEnvBigint = parseEnvBigint;
const Fs = require("fs");

@@ -12,2 +18,4 @@ const Os = require("os");

function loadEnv(baseDir, overwriteSetValues = false) {
if (baseDir.endsWith('dist'))
baseDir = Path.resolve(baseDir, '..');
const envName = process.env.NODE_ENV?.toLowerCase() ?? 'development';

@@ -30,3 +38,2 @@ const env = {};

}
exports.loadEnv = loadEnv;
// NOTE: imported from dotenv

@@ -41,2 +48,4 @@ function applyEnvironmentVariables(path, env) {

while ((match = LineRegex.exec(lines))) {
if (!match)
continue;
// eslint-disable-next-line prefer-const

@@ -60,3 +69,2 @@ let [, key, value] = match;

}
exports.applyEnvironmentVariables = applyEnvironmentVariables;
function parseEnvList(envvar) {

@@ -67,3 +75,2 @@ if (!envvar)

}
exports.parseEnvList = parseEnvList;
function parseEnvInt(envvar) {

@@ -74,3 +81,2 @@ if (!envvar)

}
exports.parseEnvInt = parseEnvInt;
function parseEnvPath(envvar, relativeTo) {

@@ -89,3 +95,2 @@ if (!envvar)

}
exports.parseEnvPath = parseEnvPath;
function parseEnvBool(envvar) {

@@ -100,3 +105,2 @@ if (envvar === null || envvar === undefined)

}
exports.parseEnvBool = parseEnvBool;
function parseEnvBigint(envvar) {

@@ -112,3 +116,2 @@ if (!envvar)

}
exports.parseEnvBigint = parseEnvBigint;
//# sourceMappingURL=envUtils.js.map
export declare function existsAsync(path: string): Promise<boolean>;
export declare function copyDir(fromDir: string, toDir: string): Promise<void>;
export declare function readFileAsJson<T>(path: string): Promise<T>;
export declare function readFileAsJson<T>(path: string): Promise<T | null>;
export declare function safeOverwriteFile(path: string, body: any): Promise<void>;
export declare function cleanHomeDir(str: string): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanHomeDir = exports.safeOverwriteFile = exports.readFileAsJson = exports.copyDir = exports.existsAsync = void 0;
exports.existsAsync = existsAsync;
exports.copyDir = copyDir;
exports.readFileAsJson = readFileAsJson;
exports.safeOverwriteFile = safeOverwriteFile;
exports.cleanHomeDir = cleanHomeDir;
const fs_1 = require("fs");
const Os = require("os");
const crypto = require("crypto");
const TypeSerializer_1 = require("./TypeSerializer");
async function existsAsync(path) {

@@ -16,3 +21,2 @@ try {

}
exports.existsAsync = existsAsync;
async function copyDir(fromDir, toDir) {

@@ -28,3 +32,2 @@ await fs_1.promises.mkdir(toDir, { recursive: true });

}
exports.copyDir = copyDir;
async function readFileAsJson(path) {

@@ -34,5 +37,4 @@ const buffer = await fs_1.promises.readFile(path, 'utf8').catch(() => null);

return null;
return JSON.parse(buffer);
return TypeSerializer_1.default.parse(buffer);
}
exports.readFileAsJson = readFileAsJson;
// Nodejs doesn't guarantee it will complete writing to the file if multiple processes are writing and/or the process shuts down.

@@ -50,3 +52,2 @@ async function safeOverwriteFile(path, body) {

}
exports.safeOverwriteFile = safeOverwriteFile;
const homeDirReplace = new RegExp(Os.homedir(), 'g');

@@ -56,3 +57,2 @@ function cleanHomeDir(str) {

}
exports.cleanHomeDir = cleanHomeDir;
//# sourceMappingURL=fileUtils.js.map

@@ -1,3 +0,2 @@

/// <reference types="node" />
import { URL } from 'url';
export declare function getProxyForUrl(url: string): URL;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getProxyForUrl = void 0;
exports.getProxyForUrl = getProxyForUrl;
const url_1 = require("url");

@@ -36,3 +36,2 @@ // logic from https://github.com/Rob--W/proxy-from-env

}
exports.getProxyForUrl = getProxyForUrl;
function shouldProxy(hostname, port) {

@@ -39,0 +38,0 @@ const NO_PROXY = (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase();

@@ -1,2 +0,1 @@

/// <reference types="node" />
export declare const hashMessagePrefix = "\u0018Ulixee Signed Message:\n";

@@ -3,0 +2,0 @@ export declare function sha256(data: Buffer | string): Buffer;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hashObject = exports.sortedJsonStringify = exports.sha256 = exports.hashMessagePrefix = void 0;
exports.hashMessagePrefix = void 0;
exports.sha256 = sha256;
exports.sortedJsonStringify = sortedJsonStringify;
exports.hashObject = hashObject;
const crypto_1 = require("crypto");

@@ -10,3 +13,2 @@ const TypeSerializer_1 = require("./TypeSerializer");

}
exports.sha256 = sha256;
function sortedJsonStringify(obj, ignoreProperties = []) {

@@ -21,3 +23,2 @@ if (!obj) {

}
exports.sortedJsonStringify = sortedJsonStringify;
function hashObject(obj, options) {

@@ -31,3 +32,2 @@ // sort keys for consistent hash

}
exports.hashObject = hashObject;
//# sourceMappingURL=hashUtils.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createIpcSocketPath = void 0;
exports.createIpcSocketPath = createIpcSocketPath;
const os = require("os");

@@ -11,3 +11,2 @@ function createIpcSocketPath(name) {

}
exports.createIpcSocketPath = createIpcSocketPath;
//# sourceMappingURL=IpcUtils.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import ILog, { ILogData } from '../interfaces/ILog';

@@ -47,3 +46,2 @@ declare global {

declare class LogEvents {
private static subscriptions;
static unsubscribe(subscriptionId: number): void;

@@ -70,2 +68,2 @@ static subscribe(onLogFn: (log: ILogEntry) => any): number;

}
export declare function registerNamespaceMapping(onNamespaceFn: (namespace: string, active: RegExp[], skip: RegExp[]) => void): void;
export declare function registerNamespaceMapping(filter?: string): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerNamespaceMapping = exports.injectLogger = exports.hasBeenLoggedSymbol = exports.loggerSessionIdNames = exports.LogEvents = exports.Log = exports.translateToPrintable = void 0;
exports.hasBeenLoggedSymbol = exports.loggerSessionIdNames = exports.LogEvents = exports.Log = void 0;
exports.translateToPrintable = translateToPrintable;
exports.default = logger;
exports.injectLogger = injectLogger;
exports.registerNamespaceMapping = registerNamespaceMapping;
// eslint-disable-next-line max-classes-per-file

@@ -180,3 +184,2 @@ const util_1 = require("util");

}
exports.translateToPrintable = translateToPrintable;
const logLevels = { stats: 0, info: 1, warn: 2, error: 3 };

@@ -198,3 +201,2 @@ if (!global.UlixeeLogCreator) {

}
exports.default = logger;
global.UlxLoggerSessionIdNames ??= new Map();

@@ -206,15 +208,16 @@ global.UlxSubscriptions ??= new Map();

static unsubscribe(subscriptionId) {
LogEvents.subscriptions.delete(subscriptionId);
global.UlxSubscriptions.delete(subscriptionId);
}
static subscribe(onLogFn) {
const id = LogEvents.subscriptions.size + 1;
LogEvents.subscriptions[id] = onLogFn;
const id = global.UlxSubscriptions.size + 1;
global.UlxSubscriptions.set(id, onLogFn);
return id;
}
static broadcast(entry) {
LogEvents.subscriptions.forEach(x => x(entry));
for (const sub of global.UlxSubscriptions.values()) {
sub(entry);
}
}
}
exports.LogEvents = LogEvents;
LogEvents.subscriptions = global.UlxSubscriptions;
global.UlixeeLogInstances ??= { Log, LogEvents };

@@ -224,3 +227,2 @@ function injectLogger(builder) {

}
exports.injectLogger = injectLogger;
const moduleNamesByPath = {};

@@ -240,9 +242,51 @@ function extractPathFromModule(module) {

/// LOG FILTERING //////////////////////////////////////////////////////////////////////////////////////////////////////
function registerNamespaceMapping(onNamespaceFn) {
loadNamespaces(process.env.DEBUG);
function registerNamespaceMapping(filter = process.env.DEBUG) {
if (logFilters.envValue === filter)
return;
logFilters.envValue = filter;
filter ??= '';
const { active, skip } = logFilters;
active.length = 0;
skip.length = 0;
logFilters.namespaces.active.clear();
logFilters.namespaces.inactive.clear();
logFilters.enabledNamesCache = {};
const split = filter.split(/[\s,]+/).map(x => x.trim());
for (const part of split) {
if (!part)
continue;
if (part[0] === '-') {
logFilters.namespaces.inactive.add(part.slice(1));
}
else {
logFilters.namespaces.active.add(part);
if (part === 'ulx*' || part === 'ulx:*')
logFilters.namespaces.active.add('*');
}
}
for (const ns of logFilters.namespaces.active) {
onNamespaceFn(ns, logFilters.active, logFilters.skip);
if (ns.includes('ulx:*') || ns.includes('ulx*') || ns === '*') {
active.push(/.*/);
}
else if (ns === 'ulx') {
active.push(/hero[/-].*/, /agent\/.*/, /plugins\/.*/, /net\/.*/, /cloud\/.*/, /datastore[/-].*/, /broker\/.*/);
skip.push(/desktop[/-]?.*/, /DevtoolsSessionLogger/);
}
else if (ns.includes('ulx:desktop')) {
active.push(/desktop[/-]?.*/);
}
else if (ns.includes('ulx:mitm')) {
active.push(/agent[/-]mitm.*/);
}
else if (ns.includes('ulx:devtools')) {
active.push(/DevtoolsSessionLogger/);
}
else if (ns.includes('hero')) {
active.push(/^hero[/-].*/, /net\/.*/);
}
else if (ns.includes('datastore')) {
active.push(/^datastore[/-].*/, /net\/.*/);
}
}
}
exports.registerNamespaceMapping = registerNamespaceMapping;
function isEnabled(modulePath) {

@@ -253,2 +297,3 @@ if (process.env.ULX_DEBUG === '1' ||

return true;
registerNamespaceMapping(process.env.DEBUG);
if (modulePath in logFilters.enabledNamesCache)

@@ -273,45 +318,2 @@ return logFilters.enabledNamesCache[modulePath];

}
function loadNamespaces(namespaces) {
if (logFilters.envValue === namespaces)
return;
namespaces ??= '';
logFilters.envValue = namespaces;
const split = namespaces.split(/[\s,]+/).map(x => x.trim());
for (const part of split) {
if (!part)
continue;
if (part[0] === '-') {
logFilters.namespaces.inactive.add(part.slice(1));
}
else {
logFilters.namespaces.active.add(part);
if (part === 'ulx*' || part === 'ulx:*')
logFilters.namespaces.active.add('*');
}
}
}
registerNamespaceMapping((ns, active, skip) => {
if (ns.includes('ulx:*') || ns.includes('ulx*') || ns === '*') {
active.push(/.*/);
}
else if (ns === 'ulx') {
active.push(/hero[/-].*/, /agent\/.*/, /plugins\/.*/, /net\/.*/, /cloud\/.*/, /datastore[/-].*/, /broker\/.*/, /mainchain[/-].*/, /sidechain[/-].*/, /ramps[/-].*/);
skip.push(/desktop[/-]?.*/, /DevtoolsSessionLogger/);
}
else if (ns.includes('ulx:desktop')) {
active.push(/desktop[/-]?.*/);
}
else if (ns.includes('ulx:mitm')) {
active.push(/agent[/-]mitm.*/);
}
else if (ns.includes('ulx:devtools')) {
active.push(/DevtoolsSessionLogger/);
}
else if (ns.includes('hero')) {
active.push(/^hero[/-].*/, /net\/.*/);
}
else if (ns.includes('datastore')) {
active.push(/^datastore[/-].*/, /net\/.*/);
}
});
//# sourceMappingURL=Logger.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pick = exports.omit = exports.filterUndefined = void 0;
exports.filterUndefined = filterUndefined;
exports.omit = omit;
exports.pick = pick;
function filterUndefined(object, omitKeys) {

@@ -16,3 +18,2 @@ if (!object)

}
exports.filterUndefined = filterUndefined;
function omit(object, keys) {

@@ -28,3 +29,2 @@ object = Object(object);

}
exports.omit = omit;
function pick(object, keys) {

@@ -40,3 +40,2 @@ object = Object(object);

}
exports.pick = pick;
//# sourceMappingURL=objectUtils.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import IResolvablePromise from '../interfaces/IResolvablePromise';

@@ -3,0 +2,0 @@ export default class Resolvable<T = any> implements IResolvablePromise<T>, PromiseLike<T> {

@@ -1,2 +0,1 @@

/// <reference types="node" />
type ShutdownSignal = NodeJS.Signals | 'exit';

@@ -3,0 +2,0 @@ export default class ShutdownHandler {

@@ -1,2 +0,1 @@

/// <reference types="node" />
import type { Database as SqliteDatabase, Statement } from 'better-sqlite3';

@@ -3,0 +2,0 @@ type SqliteTypes = 'INTEGER' | 'TEXT' | 'BLOB' | 'DATETIME';

@@ -1,2 +0,1 @@

/// <reference types="node" />
export default class Timer {

@@ -3,0 +2,0 @@ readonly timeoutMillis: number;

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { EventEmitter } from 'events';

@@ -3,0 +2,0 @@ import ITypedEventEmitter from '../interfaces/ITypedEventEmitter';

@@ -104,4 +104,6 @@ "use strict";

off(eventType, listenerFn) {
// if we're adding an error logger, we can remove the default logger
if (eventType === 'error' && listenerFn !== this.defaultErrorLogger) {
// if we're removing an error logger, we should add back the default logger
if (eventType === 'error' &&
listenerFn !== this.defaultErrorLogger &&
super.listenerCount(eventType) === 1) {
super.on('error', this.defaultErrorLogger);

@@ -108,0 +110,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifiedTypeSerializerClass = exports.registerSerializableErrorType = void 0;
exports.stringifiedTypeSerializerClass = void 0;
exports.registerSerializableErrorType = registerSerializableErrorType;
const Types = {

@@ -161,3 +162,5 @@ number: 'number',

if (value instanceof ArrayBuffer) {
const binary = Array.from(new Uint8Array(value)).map(byte => String.fromCharCode(byte)).join('');
const binary = Array.from(new Uint8Array(value))
.map(byte => String.fromCharCode(byte))
.join('');
return {

@@ -246,4 +249,3 @@ __type: Types.ArrayBuffer64,

}
exports.registerSerializableErrorType = registerSerializableErrorType;
exports.stringifiedTypeSerializerClass = `const Types = ${JSON.stringify(Types)};\n${TypeSerializer.toString()}`;
//# sourceMappingURL=TypeSerializer.js.map

@@ -5,2 +5,3 @@ import IResolvablePromise from '../interfaces/IResolvablePromise';

export declare function isPortInUse(port: number | string): Promise<boolean>;
export declare function isPortInUseOnHost(port: number | string, host?: string): Promise<boolean>;
export declare function escapeUnescapedChar(str: string, char: string): string;

@@ -7,0 +8,0 @@ export declare function pickRandom<T>(array: T[]): T;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPromise = exports.bindFunctions = exports.getPrototypeHierarchy = exports.getObjectFunctionProperties = exports.pickRandom = exports.escapeUnescapedChar = exports.isPortInUse = exports.toUrl = exports.assert = void 0;
exports.assert = assert;
exports.toUrl = toUrl;
exports.isPortInUse = isPortInUse;
exports.isPortInUseOnHost = isPortInUseOnHost;
exports.escapeUnescapedChar = escapeUnescapedChar;
exports.pickRandom = pickRandom;
exports.getObjectFunctionProperties = getObjectFunctionProperties;
exports.getPrototypeHierarchy = getPrototypeHierarchy;
exports.bindFunctions = bindFunctions;
exports.createPromise = createPromise;
const net = require("net");

@@ -17,3 +26,2 @@ const Resolvable_1 = require("./Resolvable");

}
exports.assert = assert;
function toUrl(hostOrUrlFragment, defaultProtocol = 'ws:') {

@@ -28,4 +36,8 @@ if (!hostOrUrlFragment)

}
exports.toUrl = toUrl;
function isPortInUse(port) {
async function isPortInUse(port) {
if (await isPortInUseOnHost(port, 'localhost'))
return true;
return await isPortInUseOnHost(port, '::');
}
function isPortInUseOnHost(port, host = 'localhost') {
return new Promise((resolve, reject) => {

@@ -51,6 +63,5 @@ const server = net.createServer();

};
server.listen(Number(port));
server.listen(Number(port), host);
});
}
exports.isPortInUse = isPortInUse;
function escapeUnescapedChar(str, char) {

@@ -66,3 +77,2 @@ let i = str.indexOf(char);

}
exports.escapeUnescapedChar = escapeUnescapedChar;
function isClass(func) {

@@ -85,3 +95,2 @@ // Class constructor is also a function

}
exports.pickRandom = pickRandom;
const prototypeFunctionMap = new WeakMap();

@@ -111,3 +120,2 @@ function getObjectFunctionProperties(object) {

}
exports.getObjectFunctionProperties = getObjectFunctionProperties;
const prototypeHierarchyCache = new WeakMap();

@@ -132,3 +140,2 @@ function getPrototypeHierarchy(self) {

}
exports.getPrototypeHierarchy = getPrototypeHierarchy;
function bindFunctions(self) {

@@ -143,7 +150,5 @@ const hierarchy = getPrototypeHierarchy(self);

}
exports.bindFunctions = bindFunctions;
function createPromise(timeoutMillis, timeoutMessage) {
return new Resolvable_1.default(timeoutMillis, timeoutMessage);
}
exports.createPromise = createPromise;
//# sourceMappingURL=utils.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nextVersion = exports.isSemverSatisfied = void 0;
exports.isSemverSatisfied = isSemverSatisfied;
exports.nextVersion = nextVersion;
const semver = require("semver");

@@ -8,7 +9,5 @@ function isSemverSatisfied(version, isSatisfiedByVersion) {

}
exports.isSemverSatisfied = isSemverSatisfied;
function nextVersion(version) {
return semver.inc(version, 'patch');
}
exports.nextVersion = nextVersion;
//# sourceMappingURL=VersionUtils.js.map
{
"name": "@ulixee/commons",
"version": "2.0.0-alpha.29",
"version": "2.0.0-alpha.30",
"description": "Common utilities for Ulixee",
"homepage": "https://ulixee.org",
"repository": "git@github.com:ulixee/hero.git",
"bugs": {
"url": "https://github.com/ulixee/hero/issues"
},
"license": "MIT",
"author": "Data Liberation Foundation",
"engines": {
"node": ">=18.0.0"
"node": ">=18"
},

@@ -16,6 +22,6 @@ "publishConfig": {

"devtools-protocol": "^0.0.1137505",
"https-proxy-agent": "^5.0.0",
"https-proxy-agent": "^7.0.5",
"semver": "^7.3.7"
},
"gitHead": "4fcb78bc7fe83c6c074b92bed59b8c6cbaa4fe2f"
}
"gitHead": "c0688088d53394357cd3bdf70bcb086ca1c3b6be"
}

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

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

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

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

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

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