From a300e2e824365ffc3074c3a455e8c5cbeb7c45f3 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 12 Apr 2023 20:13:14 +0300 Subject: [PATCH] Rewritten in typescript --- .eslintrc.json | 36 +-- .gitignore | 3 +- README.md | 1 + index.js | 4 - index.ts | 4 + package.json | 13 +- src/{Defaults.js => Defaults.ts} | 4 +- src/{LoggerClient.js => LoggerClient.ts} | 58 +++-- src/MasterLogger.js | 180 --------------- src/MasterLogger.ts | 227 ++++++++++++++++++ src/Types.ts | 14 ++ test/otherProcess.js | 3 +- test/test.js | 6 +- tsconfig.json | 109 +++++++++ yarn.lock | 281 ++++++++++++++++++++++- 15 files changed, 710 insertions(+), 233 deletions(-) delete mode 100644 index.js create mode 100644 index.ts rename src/{Defaults.js => Defaults.ts} (94%) rename src/{LoggerClient.js => LoggerClient.ts} (50%) delete mode 100644 src/MasterLogger.js create mode 100644 src/MasterLogger.ts create mode 100644 src/Types.ts create mode 100644 tsconfig.json diff --git a/.eslintrc.json b/.eslintrc.json index 815f350..52f270c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,11 +3,13 @@ "es6": true, "node": true }, - "extends": "eslint:recommended", + "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended" ], "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" }, + "parser": "@typescript-eslint/parser", + "plugins": [ "@typescript-eslint" ], "parserOptions": { "ecmaVersion": 2022, "sourceType": "module" @@ -15,15 +17,15 @@ "rules": { "accessor-pairs": "warn", "array-callback-return": "warn", - "array-bracket-newline": ["warn", "consistent"], - "array-bracket-spacing": ["warn", "always", { "objectsInArrays": false, "arraysInArrays": false }], + "array-bracket-newline": [ "warn", "consistent" ], + "array-bracket-spacing": [ "warn", "always", { "objectsInArrays": false, "arraysInArrays": false }], "arrow-spacing": "warn", "block-scoped-var": "warn", - "block-spacing": ["warn", "always"], - "brace-style": ["warn", "1tbs"], + "block-spacing": [ "warn", "always" ], + "brace-style": [ "warn", "1tbs" ], "callback-return": "warn", "camelcase": "warn", - "comma-dangle": ["warn", "only-multiline"], + "comma-dangle": [ "warn", "only-multiline" ], "comma-spacing": [ "warn", { @@ -66,12 +68,12 @@ "implicit-arrow-linebreak": "warn", "indent": "warn", "init-declarations": "warn", - "jsx-quotes": ["warn", "prefer-single"], - "key-spacing": ["warn", { "beforeColon": false, "afterColon": true }], - "keyword-spacing": ["warn", { "after": true, "before": true }], + "jsx-quotes": [ "warn", "prefer-single" ], + "key-spacing": [ "warn", { "beforeColon": false, "afterColon": true }], + "keyword-spacing": [ "warn", { "after": true, "before": true }], "linebreak-style": [ "error", - "windows" + "unix" ], "lines-around-comment": "warn", "lines-around-directive": "warn", @@ -136,7 +138,7 @@ "no-sequences": "warn", "no-setter-return": "warn", "no-spaced-func": "warn", - "no-shadow": "error", + "@typescript-eslint/no-shadow": "error", "no-tabs": "warn", "no-template-curly-in-string": "error", "no-throw-literal": "warn", @@ -155,18 +157,18 @@ "no-var": "warn", "no-void": "warn", "no-whitespace-before-property": "error", - "nonblock-statement-body-position": ["warn", "below"], + "nonblock-statement-body-position": [ "warn", "below" ], "object-curly-spacing": [ "warn", "always" ], - "object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }], + "object-property-newline": [ "warn", { "allowAllPropertiesOnSameLine": true }], "object-shorthand": "warn", "one-var-declaration-per-line": "warn", "operator-assignment": "warn", - "operator-linebreak": ["warn", "before"], + "operator-linebreak": [ "warn", "before" ], "padding-line-between-statements": "warn", - "padded-blocks": ["warn", { "switches": "never" }, { "allowSingleLineBlocks": true }], + "padded-blocks": [ "warn", { "switches": "never" }, { "allowSingleLineBlocks": true }], "prefer-arrow-callback": "warn", "prefer-const": "warn", "prefer-destructuring": "warn", @@ -187,12 +189,12 @@ "last" ], "space-before-blocks": "warn", - "space-before-function-paren":["error", "always"], + "space-before-function-paren": [ "error", "always" ], "space-in-parens": [ "warn", "never" ], - "spaced-comment": ["warn", "always"], + "spaced-comment": [ "warn", "always" ], "strict": "warn", "switch-colon-spacing": "warn", "symbol-description": "warn", diff --git a/.gitignore b/.gitignore index 4363a92..85f32da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -logs \ No newline at end of file +logs +build \ No newline at end of file diff --git a/README.md b/README.md index 4da960a..d5e0484 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ The child processes are expected to be attached with the attach() method found i guard: '_logger', // Message guard, e.g this property has to be true in the IPC message for the logger to read it loglevel: false, // On the master logger this determines whether the output is written to console (i.e. will always be written to file), on the client this determines whether it is sent to the master at all customTypes: [], // Log types, defaults are 'error', 'warn', 'info', 'debug', 'status'. Each one of these has an associated shorthand function, the custom ones will receive one too, e.g. adding 'access' to the custom types will add a logger.access() function + /////// MASTER EXCLUSIVE customStreams: [], // File streams, by default there are streams for error and default customTypeMapping: {}, // This maps a type to a stream, e.g. adding "warn": "error" will pipe any warnings to the error log file diff --git a/index.js b/index.js deleted file mode 100644 index ddfa392..0000000 --- a/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - MasterLogger: require('./src/MasterLogger'), - LoggerClient: require('./src/LoggerClient'), -}; \ No newline at end of file diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..3dd9f40 --- /dev/null +++ b/index.ts @@ -0,0 +1,4 @@ +import MasterLogger from "./src/MasterLogger.js"; +import LoggerClient from './src/LoggerClient.js'; + +export { MasterLogger, LoggerClient }; \ No newline at end of file diff --git a/package.json b/package.json index 6268d9f..bd1c9ac 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,21 @@ "name": "@navy.gif/logger", "version": "1.2.6", "description": "Logging thing", - "main": "index.js", + "main": "build/index.js", "author": "Navy.gif", "license": "MIT", "private": false, + "type": "module", "files": [ "src" ], "devDependencies": { - "eslint": "^8.26.0" + "@types/chalk": "^2.2.0", + "@types/node": "^18.15.11", + "@typescript-eslint/eslint-plugin": "^5.58.0", + "@typescript-eslint/parser": "^5.58.0", + "eslint": "^8.26.0", + "typescript": "^5.0.4" }, "dependencies": { "@navy.gif/discord-webhook": "^1.0.0", @@ -18,6 +24,7 @@ "moment": "^2.29.4" }, "scripts": { - "test": "node test/test.js" + "test": "node test/test.js", + "build": "tsc" } } diff --git a/src/Defaults.js b/src/Defaults.ts similarity index 94% rename from src/Defaults.js rename to src/Defaults.ts index 9b0c94e..563182a 100644 --- a/src/Defaults.js +++ b/src/Defaults.ts @@ -1,4 +1,4 @@ -const ColourCodes = { +const ColourCodes: {[key: string]: number} = { error: 0xe88388, warn: 0xf9d472, info: 0x76a9d8, @@ -6,7 +6,7 @@ const ColourCodes = { status: 0x72d4d7 }; -module.exports = { +export default { Types: [ 'error', 'warn', diff --git a/src/LoggerClient.js b/src/LoggerClient.ts similarity index 50% rename from src/LoggerClient.js rename to src/LoggerClient.ts index ec0e1c9..f3c00f5 100644 --- a/src/LoggerClient.js +++ b/src/LoggerClient.ts @@ -1,28 +1,48 @@ -const { inspect } = require('node:util'); -const Defaults = require('./Defaults'); +// const { inspect } = require('node:util'); +// const Defaults = require('./Defaults'); +import Defaults from "./Defaults.js"; +import { inspect } from "node:util"; +import { WriteOptions } from "./Types.js"; + +type ClientOptions = { + name?: string, + guard?: string, + logLevel?: number, + customTypes?: string[], + logLevelMapping?: { + [key: string]: number + } +} + +type TransportOptions = { + type: string +} + class LoggerClient { static MaxChars = 0; - #_guard = null; - #_logLevel = null; - #_logLevelMapping = null; + #_guard: string; + #_logLevel: number; + #_logLevelMapping: {[key: string]: number}; + #_name: string; + #types: string[]; - constructor (opts = Defaults.ClientOptions) { + constructor (opts: ClientOptions = Defaults.ClientOptions) { - this.name = opts.name || opts.constructor.name; - if (this.name === 'Object') - this.name = 'unknown'; - this.name = this.name.toUpperCase(); + this.#_name = opts.name || opts.constructor.name; + if (this.#_name === 'Object') + this.#_name = 'unknown'; + this.#_name = this.#_name.toUpperCase(); - if (this.name.length > LoggerClient.MaxChars) - LoggerClient.MaxChars = this.name.length; + if (this.#_name.length > LoggerClient.MaxChars) + LoggerClient.MaxChars = this.#_name.length; const { customTypes = [] } = opts; - this.types = [ ...customTypes, ...Defaults.Types ]; - for (const type of this.types) { + this.#types = [ ...customTypes, ...Defaults.Types ]; + for (const type of this.#types) { Object.defineProperty(this, type, { - value: (msg, o) => this.transport(msg, { ...o, type }) + value: (msg: string, o: WriteOptions) => this.transport(msg, { ...o, type }) }); } @@ -49,15 +69,15 @@ class LoggerClient { throw new Error(`Invalid log level type, expected string or number, got ${typeof level}`); } - transport (message, opts) { + transport (message: string, opts: TransportOptions) { if (this.#_logLevelMapping[opts.type] < this.#_logLevel) return; if (typeof message !== 'string') message = inspect(message); - const spacer = ' '.repeat(LoggerClient.MaxChars - this.name.length); - const header = `${`[${this.name.substring(0, LoggerClient.MaxChars)}]${spacer}`} `; + const spacer = ' '.repeat(LoggerClient.MaxChars - this.#_name.length); + const header = `${`[${this.#_name.substring(0, LoggerClient.MaxChars)}]${spacer}`} `; // eslint-disable-next-line no-console if (!process.send || !process.connected) @@ -70,4 +90,4 @@ class LoggerClient { } -module.exports = LoggerClient; \ No newline at end of file +export default LoggerClient; \ No newline at end of file diff --git a/src/MasterLogger.js b/src/MasterLogger.js deleted file mode 100644 index f04c167..0000000 --- a/src/MasterLogger.js +++ /dev/null @@ -1,180 +0,0 @@ -// 3rd party -const chalk = require('chalk'); -const moment = require('moment'); -// native -const path = require('node:path'); -const fs = require('node:fs'); -const { inspect } = require('node:util'); - -// const DiscordWebhook = require('@navy.gif/discord-webhook'); -const Defaults = require('./Defaults'); - -const DAY = 1000 * 60 * 60 * 24; - -class MasterLogger { - - #_guard = null; - #_logLevel = null; - #_logLevelMapping = null; - #_broadcastLevel = null; - #webhook = null; - - constructor (config = Defaults.MasterOptions) { - - const { - directory, customTypes, customStreams, customTypeMapping, - customColors, guard, fileRotationFreq, logLevel, logLevelMapping, - webhook, broadcastLevel - } = { ...Defaults.MasterOptions, ...config }; - - this.directory = path.resolve(directory); - if (!fs.existsSync(this.directory)) - fs.mkdirSync(this.directory, { recursive: true }); - this.#_broadcastLevel = broadcastLevel; - this.#_logLevel = logLevel; - this.#_logLevelMapping = { ...Defaults.MasterOptions.logLevelMapping, ...logLevelMapping }; - this.#_guard = guard; - - this.types = [ ...customTypes, ...Defaults.Types ]; - for (const type of this.types) { - Object.defineProperty(this, type, { - value: (msg, opts) => this.write(type, msg, opts) - }); - } - this.colours = { ...Defaults.Colours, ...customColors }; - - this.colourFuncs = Object.entries(this.colours).reduce((prev, [ type, colour ]) => { - if (typeof colour === 'number') - colour = `#${colour.toString(16)}`; - else if (typeof colour !== 'string') - throw new Error('Expecting colours to be either an integer, a hex string or one of the chalk compatible colour names'); - - if ((/#[A-Fa-f0-9]+/u).test(colour)) - prev[type] = { func: chalk.hex(colour), int: parseInt(colour.replace('#', ''), 16) }; - else - prev[type] = { func: chalk[colour], int: Defaults.ColourCodes[type] || Defaults.ColourCodes.info }; - - return prev; - }, {}); - - this.streamTypes = [ ...customStreams, 'error', 'default' ]; - this.streamTypeMapping = { ...Defaults.TypeStream, ...customTypeMapping }; - this.writeStreams = this.streamTypes.reduce((acc, type) => { - acc[type] = this.loadFile(type); - return acc; - }, {}); - - // Startup day, used to keep track of file rotation - this.rotationFreq = fileRotationFreq * DAY; - this.startDay = Math.floor(Date.now() / this.rotationFreq) * this.rotationFreq; - this.rotateTO = setTimeout(this.rotateLogFiles.bind(this), this.startDay + this.rotationFreq - Date.now()); - - if (webhook && webhook.url) - import('@navy.gif/discord-webhook').then(({ default: DiscordWebhook }) => { - this.#webhook = new DiscordWebhook({ url: webhook.url }); - this.#webhook.fetch(); - }); - - } - - get logLevel () { - return this.#_logLevel; - } - - get logLevels () { - return Object.keys(this.#_logLevelMapping); - } - - setLogLevel (level = 'info') { - if (typeof level === 'number') - this.#_logLevel = level; - else if (typeof level === 'string') - this.#_logLevel = this.#_logLevelMapping[level.toLowerCase()]; - else - throw new Error(`Invalid log level type, expected string or number, got ${typeof level}`); - } - - attach (shard) { - shard.on('message', (msg) => { - if (!msg[this.#_guard]) - return; - const { message, type, header, broadcast } = msg; - this[type](message, { subheader: header, shard, broadcast }); - }); - } - - write (type = 'info', text, { subheader = '', shard = null, broadcast = false } = {}) { - - type = type.toLowerCase(); - let colour = this.colourFuncs[type]; - if (!colour) - colour = this.colourCodes.info; - - if (typeof text !== 'string') - text = inspect(text); - - const header = `[${this.date}] [${this._shard(shard)}]`; - const maxChars = Math.max(...this.types.map(t => t.length)); - const spacer = ' '.repeat(maxChars - type.length); - - if (this.#_logLevelMapping[type] >= this.#_logLevel) - console.log(`${colour.func(type)}${spacer} ${colour.func(header)}: ${chalk.bold(subheader)}${text}`); // eslint-disable-line no-console - - if (broadcast || this.#_broadcastLevel <= this.#_logLevelMapping[type] && this.#webhook) - this.#webhook.send({ - embeds: [{ - title: `[__${type.toUpperCase()}__] ${this._shard(shard)}`, - description: `**${subheader}**\n${text}`, - color: colour.int - }] - }); - - const streamType = this.streamTypeMapping[type] || 'default'; - if (this.writeStreams[streamType]) - this.writeStreams[streamType].write(`\n${type}${spacer} ${header}: ${subheader}${text}`); - else - console.log(`${chalk.red(`[LOGGER] Missing file stream for ${streamType}`)}`); // eslint-disable-line no-console - - } - - rotateLogFiles () { - const streams = Object.keys(this.writeStreams); - for (const type of streams) { - this.writeStreams[type].write('\nRotating log file'); - this.writeStreams[type].end(); - this.writeStreams[type] = this.loadFile(type); - } - const nextTime = Math.floor(Date.now() / this.rotationFreq) * this.rotationFreq + this.rotationFreq; - this.rotateTO = setTimeout(this.rotateLogFiles.bind(this), nextTime - Date.now()); - } - - loadFile (type, date = Date.now()) { - if (!type) - throw new Error('Missing file type'); - - const fileName = `${moment(date).format('YYYY-MM-DD')}-${type}.log`; - const filePath = path.join(this.directory, fileName); - - if (!fs.existsSync(filePath)) - fs.writeFileSync(filePath, ''); - - return fs.createWriteStream(filePath, { flags: 'a' }); - - } - - _shard (shard) { - if (!shard) - return 'controller'; - let id = '??'; - if ('id' in shard) - id = `${shard.id < 10 ? `0${shard.id}` : shard.id}`; - return `shard-${id}`; - } - - get date () { - return moment().format('YYYY-MM-DD HH:mm:ss'); - } - -} - -module.exports = MasterLogger; \ No newline at end of file diff --git a/src/MasterLogger.ts b/src/MasterLogger.ts new file mode 100644 index 0000000..2602fb1 --- /dev/null +++ b/src/MasterLogger.ts @@ -0,0 +1,227 @@ +// 3rd party +import chalk from 'chalk'; +import moment from 'moment'; + +// Native +import path from 'node:path'; +import fs from 'node:fs'; +import { inspect } from 'node:util'; + +// Own +import DiscordWebhook from '@navy.gif/discord-webhook'; +import Defaults from './Defaults.js'; +import { Shard, WriteOptions } from './Types.js'; + +const DAY = 1000 * 60 * 60 * 24; + +type IPCMessage = { + [key: string]: string | object + _guard: string + type: string +} + +type FuncsType = { + [key: string]: { + func: (...strings: string[]) => string, + int: number + } +} + +type WriteStreams = { + [key:string]: fs.WriteStream +} + +class MasterLogger { + + #_guard: string; + #_logLevel: number; + #_logLevelMapping: {[key: string]: number}; + #_broadcastLevel: number; + + #webhook?: DiscordWebhook; + #types: string[]; + #directory: string; + #colours: { [key: string]: string }; + #colourFuncs: FuncsType; + #streamTypes: string[]; + #streamTypeMapping: {[key: string]: string}; + #writeStreams: WriteStreams; + #rotationFreq: number; + #startDay: number; + #rotateTO: NodeJS.Timeout; + + constructor (config = Defaults.MasterOptions) { + + const { + directory, customTypes, customStreams, customTypeMapping, + customColors, guard, fileRotationFreq, logLevel, logLevelMapping, + webhook, broadcastLevel + } = { ...Defaults.MasterOptions, ...config }; + + this.#directory = path.resolve(directory); + if (!fs.existsSync(this.#directory)) + fs.mkdirSync(this.#directory, { recursive: true }); + this.#_broadcastLevel = broadcastLevel; + this.#_logLevel = logLevel; + this.#_logLevelMapping = { ...Defaults.MasterOptions.logLevelMapping, ...logLevelMapping }; + this.#_guard = guard; + + this.#types = [ ...customTypes, ...Defaults.Types ]; + for (const type of this.#types) { + Object.defineProperty(this, type, { + value: (msg: string, opts: WriteOptions) => this.write(type, msg, opts) + }); + } + this.#colours = { ...Defaults.Colours, ...customColors }; + + this.#colourFuncs = Object.entries(this.#colours).reduce((prev: FuncsType, [ type, colour ]: (string | number)[]) => { + if (typeof colour === 'number') + colour = `#${colour.toString(16)}`; + else if (typeof colour !== 'string') + throw new Error('Expecting colours to be either an integer, a hex string or one of the chalk compatible colour names'); + + if ((/#[A-Fa-f0-9]+/u).test(colour)) + prev[type] = { func: chalk.hex(colour), int: parseInt(colour.replace('#', ''), 16) }; + else + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + prev[type] = { func: chalk[colour], int: Defaults.ColourCodes[type as string] || Defaults.ColourCodes.info }; + + return prev; + }, {} as FuncsType); + + this.#streamTypes = [ ...customStreams, 'error', 'default' ]; + this.#streamTypeMapping = { ...Defaults.TypeStream, ...customTypeMapping }; + this.#writeStreams = this.#streamTypes.reduce((acc, type) => { + acc[type] = this.loadFile(type); + return acc; + }, {} as WriteStreams); + + // Startup day, used to keep track of file rotation + this.#rotationFreq = fileRotationFreq * DAY; + this.#startDay = Math.floor(Date.now() / this.#rotationFreq) * this.#rotationFreq; + this.#rotateTO = setTimeout(this.rotateLogFiles.bind(this), this.#startDay + this.#rotationFreq - Date.now()); + + if (webhook && webhook.url) { + this.#webhook = new DiscordWebhook({ url: webhook.url }); + this.#webhook.fetch(); + } + + } + + get guard () { + return this.#_guard; + } + + get logLevel () { + return this.#_logLevel; + } + + get logLevels () { + return Object.keys(this.#_logLevelMapping); + } + + setLogLevel (level: string | number = 'info') { + if (typeof level === 'number') + this.#_logLevel = level; + else if (typeof level === 'string') + this.#_logLevel = this.#_logLevelMapping[level.toLowerCase()]; + else + throw new Error(`Invalid log level type, expected string or number, got ${typeof level}`); + } + + setBroadcastLevel (level: string | number) { + if (!level) + throw new Error('Missing level'); + if (typeof level === 'number') + this.#_broadcastLevel = level; + else if (typeof level === 'string') + this.#_broadcastLevel = this.#_logLevelMapping[level.toLowerCase()]; + } + + attach (shard: Shard) { + shard.on('message', (msg: IPCMessage) => { + if (!msg[this.#_guard]) + return; + const { message, type, header, broadcast } = msg; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + this[type](message, { subheader: header, shard, broadcast }); + }); + } + + write (type = 'info', text: string, { subheader = '', shard, broadcast = false }: WriteOptions = {}) { + + type = type.toLowerCase(); + let colour = this.#colourFuncs[type]; + if (!colour) + colour = this.#colourFuncs.info; + + if (typeof text !== 'string') + text = inspect(text); + + const header = `[${this.date}] [${this._shard(shard)}]`; + const maxChars = Math.max(...this.#types.map(t => t.length)); + const spacer = ' '.repeat(maxChars - type.length); + + if (this.#_logLevelMapping[type] >= this.#_logLevel) + console.log(`${colour.func(type)}${spacer} ${colour.func(header)}: ${chalk.bold(subheader)}${text}`); // eslint-disable-line no-console + + if ((broadcast || this.#_broadcastLevel <= this.#_logLevelMapping[type]) && this.#webhook) + this.#webhook.send({ + embeds: [{ + title: `[__${type.toUpperCase()}__] ${this._shard(shard)}`, + description: `**${subheader}**\n${text}`, + color: colour.int + }] + }); + + const streamType = this.#streamTypeMapping[type] || 'default'; + if (this.#writeStreams[streamType]) + this.#writeStreams[streamType].write(`\n${type}${spacer} ${header}: ${subheader}${text}`); + else + console.log(`${chalk.red(`[LOGGER] Missing file stream for ${streamType}`)}`); // eslint-disable-line no-console + + } + + rotateLogFiles () { + const streams = Object.keys(this.#writeStreams); + for (const type of streams) { + this.#writeStreams[type].write('\nRotating log file'); + this.#writeStreams[type].end(); + this.#writeStreams[type] = this.loadFile(type); + } + const nextTime = Math.floor(Date.now() / this.#rotationFreq) * this.#rotationFreq + this.#rotationFreq; + this.#rotateTO = setTimeout(this.rotateLogFiles.bind(this), nextTime - Date.now()); + } + + loadFile (type: string, date = Date.now()) { + if (!type) + throw new Error('Missing file type'); + + const fileName = `${moment(date).format('YYYY-MM-DD')}-${type}.log`; + const filePath = path.join(this.#directory, fileName); + + if (!fs.existsSync(filePath)) + fs.writeFileSync(filePath, ''); + + return fs.createWriteStream(filePath, { flags: 'a' }); + + } + + _shard (shard?: Shard) { + if (!shard) + return 'controller'; + let id = '??'; + if ('id' in shard) + id = `${shard.id < 10 ? `0${shard.id}` : shard.id}`; + return `shard-${id}`; + } + + get date () { + return moment().format('YYYY-MM-DD HH:mm:ss'); + } + +} + +export default MasterLogger; \ No newline at end of file diff --git a/src/Types.ts b/src/Types.ts new file mode 100644 index 0000000..35de323 --- /dev/null +++ b/src/Types.ts @@ -0,0 +1,14 @@ +import EventEmitter from "node:events"; + +type Shard = { + id: number +} & EventEmitter; + +type WriteOptions = { + subheader?: string, + shard?: Shard, + broadcast?: boolean +} + + +export { WriteOptions, Shard }; \ No newline at end of file diff --git a/test/otherProcess.js b/test/otherProcess.js index b47504c..bc9ebf5 100644 --- a/test/otherProcess.js +++ b/test/otherProcess.js @@ -1,4 +1,5 @@ -const { LoggerClient } = require('../'); +// const { LoggerClient } = require('../'); +import { LoggerClient } from "../build/index.js"; const logger = new LoggerClient({ customTypes: [ 'access' ], diff --git a/test/test.js b/test/test.js index a27c685..4e4ce22 100644 --- a/test/test.js +++ b/test/test.js @@ -1,6 +1,8 @@ /* eslint-disable no-console */ -const { MasterLogger } = require('../'); -const ChildProcess = require('node:child_process'); +// const { MasterLogger } = require('../build'); +// const ChildProcess = require('node:child_process'); +import { MasterLogger } from "../build/index.js"; +import ChildProcess from "node:child_process"; const spawn = (child) => { return new Promise((resolve) => { diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..acfd72c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "ES2022", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./build", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } + } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 53c2b6b..54fd2f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,18 @@ # yarn lockfile v1 +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.corgi.wtf/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.0" + resolved "https://registry.corgi.wtf/@eslint-community/regexpp/-/regexpp-4.5.0.tgz#f6f729b02feee2c749f57e334b7a1b5f40a81724" + integrity sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ== + "@eslint/eslintrc@^1.3.3": version "1.3.3" resolved "https://registry.corgi.wtf/@eslint%2feslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" @@ -51,12 +63,12 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" resolved "https://registry.corgi.wtf/@nodelib%2ffs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.8": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.corgi.wtf/@nodelib%2ffs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -64,6 +76,112 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@types/chalk@^2.2.0": + version "2.2.0" + resolved "https://registry.corgi.wtf/@types/chalk/-/chalk-2.2.0.tgz#b7f6e446f4511029ee8e3f43075fb5b73fbaa0ba" + integrity sha512-1zzPV9FDe1I/WHhRkf9SNgqtRJWZqrBWgu7JGveuHmmyR9CnAPCie2N/x+iHrgnpYBIcCJWHBoMRv2TRWktsvw== + dependencies: + chalk "*" + +"@types/json-schema@^7.0.9": + version "7.0.11" + resolved "https://registry.corgi.wtf/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + +"@types/node@^18.15.11": + version "18.15.11" + resolved "https://registry.corgi.wtf/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f" + integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q== + +"@types/semver@^7.3.12": + version "7.3.13" + resolved "https://registry.corgi.wtf/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" + integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + +"@typescript-eslint/eslint-plugin@^5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.58.0.tgz#b1d4b0ad20243269d020ef9bbb036a40b0849829" + integrity sha512-vxHvLhH0qgBd3/tW6/VccptSfc8FxPQIkmNTVLWcCOVqSBvqpnKkBTYrhcGlXfSnd78azwe+PsjYFj0X34/njA== + dependencies: + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.58.0" + "@typescript-eslint/type-utils" "5.58.0" + "@typescript-eslint/utils" "5.58.0" + debug "^4.3.4" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/parser/-/parser-5.58.0.tgz#2ac4464cf48bef2e3234cb178ede5af352dddbc6" + integrity sha512-ixaM3gRtlfrKzP8N6lRhBbjTow1t6ztfBvQNGuRM8qH1bjFFXIJ35XY+FC0RRBKn3C6cT+7VW1y8tNm7DwPHDQ== + dependencies: + "@typescript-eslint/scope-manager" "5.58.0" + "@typescript-eslint/types" "5.58.0" + "@typescript-eslint/typescript-estree" "5.58.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/scope-manager/-/scope-manager-5.58.0.tgz#5e023a48352afc6a87be6ce3c8e763bc9e2f0bc8" + integrity sha512-b+w8ypN5CFvrXWQb9Ow9T4/6LC2MikNf1viLkYTiTbkQl46CnR69w7lajz1icW0TBsYmlpg+mRzFJ4LEJ8X9NA== + dependencies: + "@typescript-eslint/types" "5.58.0" + "@typescript-eslint/visitor-keys" "5.58.0" + +"@typescript-eslint/type-utils@5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/type-utils/-/type-utils-5.58.0.tgz#f7d5b3971483d4015a470d8a9e5b8a7d10066e52" + integrity sha512-FF5vP/SKAFJ+LmR9PENql7fQVVgGDOS+dq3j+cKl9iW/9VuZC/8CFmzIP0DLKXfWKpRHawJiG70rVH+xZZbp8w== + dependencies: + "@typescript-eslint/typescript-estree" "5.58.0" + "@typescript-eslint/utils" "5.58.0" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/types/-/types-5.58.0.tgz#54c490b8522c18986004df7674c644ffe2ed77d8" + integrity sha512-JYV4eITHPzVQMnHZcYJXl2ZloC7thuUHrcUmxtzvItyKPvQ50kb9QXBkgNAt90OYMqwaodQh2kHutWZl1fc+1g== + +"@typescript-eslint/typescript-estree@5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/typescript-estree/-/typescript-estree-5.58.0.tgz#4966e6ff57eaf6e0fce2586497edc097e2ab3e61" + integrity sha512-cRACvGTodA+UxnYM2uwA2KCwRL7VAzo45syNysqlMyNyjw0Z35Icc9ihPJZjIYuA5bXJYiJ2YGUB59BqlOZT1Q== + dependencies: + "@typescript-eslint/types" "5.58.0" + "@typescript-eslint/visitor-keys" "5.58.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/utils/-/utils-5.58.0.tgz#430d7c95f23ec457b05be5520c1700a0dfd559d5" + integrity sha512-gAmLOTFXMXOC+zP1fsqm3VceKSBQJNzV385Ok3+yzlavNHZoedajjS4UyS21gabJYcobuigQPs/z71A9MdJFqQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.58.0" + "@typescript-eslint/types" "5.58.0" + "@typescript-eslint/typescript-estree" "5.58.0" + eslint-scope "^5.1.1" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.58.0": + version "5.58.0" + resolved "https://registry.corgi.wtf/@typescript-eslint/visitor-keys/-/visitor-keys-5.58.0.tgz#eb9de3a61d2331829e6761ce7fd13061781168b4" + integrity sha512-/fBraTlPj0jwdyTwLyrRTxv/3lnU2H96pNTVM6z3esTWLtA5MZ9ghSMJ7Rb+TtUAdtEw9EyJzJ0EydIMKxQ9gA== + dependencies: + "@typescript-eslint/types" "5.58.0" + eslint-visitor-keys "^3.3.0" + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.corgi.wtf/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -101,6 +219,11 @@ argparse@^2.0.1: resolved "https://registry.corgi.wtf/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.corgi.wtf/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.corgi.wtf/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -114,11 +237,23 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.corgi.wtf/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.corgi.wtf/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== +chalk@*: + version "5.2.0" + resolved "https://registry.corgi.wtf/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" + integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== + chalk@^4.0.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.corgi.wtf/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -158,7 +293,7 @@ data-uri-to-buffer@^4.0.0: resolved "https://registry.corgi.wtf/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== -debug@^4.1.1, debug@^4.3.2: +debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.corgi.wtf/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -170,6 +305,13 @@ deep-is@^0.1.3: resolved "https://registry.corgi.wtf/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.corgi.wtf/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@^3.0.0: version "3.0.0" resolved "https://registry.corgi.wtf/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -182,6 +324,14 @@ escape-string-regexp@^4.0.0: resolved "https://registry.corgi.wtf/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.corgi.wtf/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + eslint-scope@^7.1.1: version "7.1.1" resolved "https://registry.corgi.wtf/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" @@ -275,6 +425,11 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.corgi.wtf/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.corgi.wtf/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" @@ -290,6 +445,17 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.corgi.wtf/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-glob@^3.2.9: + version "3.2.12" + resolved "https://registry.corgi.wtf/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.corgi.wtf/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -322,6 +488,13 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.corgi.wtf/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + find-up@^5.0.0: version "5.0.0" resolved "https://registry.corgi.wtf/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" @@ -355,6 +528,13 @@ fs.realpath@^1.0.0: resolved "https://registry.corgi.wtf/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.corgi.wtf/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.corgi.wtf/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" @@ -381,6 +561,18 @@ globals@^13.15.0: dependencies: type-fest "^0.20.2" +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.corgi.wtf/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + grapheme-splitter@^1.0.4: version "1.0.4" resolved "https://registry.corgi.wtf/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" @@ -427,13 +619,18 @@ is-extglob@^2.1.1: resolved "https://registry.corgi.wtf/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== -is-glob@^4.0.0, is-glob@^4.0.3: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" resolved "https://registry.corgi.wtf/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.corgi.wtf/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-path-inside@^3.0.3: version "3.0.3" resolved "https://registry.corgi.wtf/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" @@ -486,6 +683,26 @@ lodash.merge@^4.6.2: resolved "https://registry.corgi.wtf/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.corgi.wtf/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.corgi.wtf/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.corgi.wtf/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.corgi.wtf/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -503,6 +720,11 @@ ms@2.1.2: resolved "https://registry.corgi.wtf/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.corgi.wtf/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.corgi.wtf/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -577,6 +799,16 @@ path-key@^3.1.0: resolved "https://registry.corgi.wtf/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.corgi.wtf/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.corgi.wtf/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.corgi.wtf/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -621,6 +853,13 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +semver@^7.3.7: + version "7.4.0" + resolved "https://registry.corgi.wtf/semver/-/semver-7.4.0.tgz#8481c92feffc531ab1e012a8ffc15bdd3a0f4318" + integrity sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw== + dependencies: + lru-cache "^6.0.0" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.corgi.wtf/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -633,6 +872,11 @@ shebang-regex@^3.0.0: resolved "https://registry.corgi.wtf/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.corgi.wtf/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.corgi.wtf/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -657,6 +901,25 @@ text-table@^0.2.0: resolved "https://registry.corgi.wtf/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.corgi.wtf/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.corgi.wtf/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.corgi.wtf/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.corgi.wtf/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -669,6 +932,11 @@ type-fest@^0.20.2: resolved "https://registry.corgi.wtf/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== +typescript@^5.0.4: + version "5.0.4" + resolved "https://registry.corgi.wtf/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.corgi.wtf/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -698,6 +966,11 @@ wrappy@1: resolved "https://registry.corgi.wtf/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.corgi.wtf/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.corgi.wtf/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"