convoker 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/color/index.d.mts +2 -2
- package/dist/color/index.mjs +2 -2
- package/dist/{color-DiZvJ0Fc.mjs → color-s-N9yh90.mjs} +2 -65
- package/dist/color-s-N9yh90.mjs.map +1 -0
- package/dist/command/index.d.mts +4 -4
- package/dist/command/index.mjs +7 -6
- package/dist/{command-8P8qXJ2o.mjs → command-C9QIG--8.mjs} +145 -9
- package/dist/command-C9QIG--8.mjs.map +1 -0
- package/dist/{index-BYLskLxk.d.mts → index-C0cH9MIP.d.mts} +4 -4
- package/dist/{index-ClhbwSD8.d.mts → index-C6iJZTo3.d.mts} +2 -2
- package/dist/index-CCQ6jz54.d.mts +58 -0
- package/dist/{index-Cnx4H4D-.d.mts → index-OUlP1L9o.d.mts} +3 -3
- package/dist/index.d.mts +62 -7
- package/dist/index.mjs +8 -91
- package/dist/input/index.d.mts +2 -2
- package/dist/input/index.mjs +2 -2
- package/dist/{input-XUsy1LCQ.mjs → input-li13L1uf.mjs} +2 -2
- package/dist/{input-XUsy1LCQ.mjs.map → input-li13L1uf.mjs.map} +1 -1
- package/dist/prompt/index.d.mts +4 -4
- package/dist/prompt/index.mjs +5 -4
- package/dist/prompt/raw.d.mts +1 -1
- package/dist/prompt/raw.mjs +1 -1
- package/dist/{prompt-a5Ix_Hyc.mjs → prompt-OXGrAkDf.mjs} +4 -4
- package/dist/{prompt-a5Ix_Hyc.mjs.map → prompt-OXGrAkDf.mjs.map} +1 -1
- package/dist/{raw-cqTp2vds.d.mts → raw-BqvlveTU.d.mts} +1 -1
- package/dist/{raw-DEtZFeMv.mjs → raw-DVT5lw11.mjs} +1 -1
- package/dist/{raw-DEtZFeMv.mjs.map → raw-DVT5lw11.mjs.map} +1 -1
- package/dist/{standard-schema-DXS-QnwX.d.mts → standard-schema-D1sStgzy.d.mts} +1 -1
- package/dist/{standard-schema-DTuaYJjO.mjs → standard-schema-WhGEzW0C.mjs} +1 -1
- package/dist/{standard-schema-DTuaYJjO.mjs.map → standard-schema-WhGEzW0C.mjs.map} +1 -1
- package/dist/theme-Chg3mOhZ.mjs +68 -0
- package/dist/theme-Chg3mOhZ.mjs.map +1 -0
- package/dist/theme-EERPMtQU.d.mts +115 -0
- package/dist/theme.d.mts +2 -0
- package/dist/theme.mjs +4 -0
- package/package.json +5 -1
- package/dist/color-DiZvJ0Fc.mjs.map +0 -1
- package/dist/command-8P8qXJ2o.mjs.map +0 -1
- package/dist/index-BtbthYjp.d.mts +0 -168
- package/dist/index.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-DiZvJ0Fc.mjs","names":["result: any","DEFAULT_THEME: Theme"],"sources":["../src/utils.ts","../src/color/index.ts"],"sourcesContent":["/**\n * Deep `Partial<T>`.\n */\nexport type DeepPartial<T> = {\n [P in keyof T]?: DeepPartial<T[P]>;\n};\n\n/**\n * All TypeScript primitive types.\n */\ntype Primitive = string | number | boolean | symbol | null | undefined | bigint;\n\n/**\n * A plain TypeScript object.\n */\ntype PlainObject = Record<string | number | symbol, unknown>;\n\n/**\n * Merges two objects deeply.\n */\nexport type DeepMerge<T, U> = U extends Primitive\n ? T\n : T extends Primitive\n ? T\n : U extends readonly (infer TItem)[]\n ? T extends readonly (infer UItem)[]\n ? Array<DeepMerge<TItem, UItem>>\n : T\n : U extends PlainObject\n ? T extends PlainObject\n ? {\n [K in keyof U | keyof T]: K extends keyof T\n ? K extends keyof U\n ? DeepMerge<U[K], T[K]>\n : T[K]\n : K extends keyof U\n ? U[K]\n : never;\n }\n : T\n : T;\n\n/**\n * Checks if a value is a plain object.\n * @param value The value to check.\n * @returns If the value is a plain object.\n */\nfunction isPlainObject(value: any): value is Record<string, any> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n Object.getPrototypeOf(value) === Object.prototype\n );\n}\n\n/**\n * Merges two objects deeply.\n * @param source The source object.\n * @param target The target object.\n * @returns The merged objects.\n */\nexport function merge<T, U>(source: T, target: U): DeepMerge<T, U> {\n if (Array.isArray(source) && Array.isArray(target)) {\n // Replace arrays\n return target as any;\n }\n\n if (isPlainObject(source) && isPlainObject(target)) {\n const result: any = {};\n const keys = new Set([...Object.keys(source), ...Object.keys(target)]);\n keys.forEach((key) => {\n const sourceVal = (source as any)[key];\n const targetVal = (target as any)[key];\n\n if (sourceVal !== undefined && targetVal !== undefined) {\n result[key] = merge(sourceVal, targetVal);\n } else if (targetVal !== undefined) {\n result[key] = targetVal;\n } else {\n result[key] = sourceVal;\n }\n });\n return result;\n }\n\n // For class instances or primitives, always use target\n return target as any;\n}\n","import { merge, type DeepPartial } from \"@/utils\";\n\n/**\n * Detects if the runtime supports colored output.\n * @returns If the runtime supports colored output.\n */\nfunction detectColorSupport() {\n // If running in a browser-like environment, return false\n if (typeof window !== \"undefined\" && typeof window.document !== \"undefined\") {\n return false;\n }\n\n const env = typeof process !== \"undefined\" ? (process.env ?? {}) : {};\n\n // Force-disable colors if NO_COLOR is set\n if (\"NO_COLOR\" in env) return false;\n\n // Force-enable if FORCE_COLOR is set\n if (\"FORCE_COLOR\" in env) return true;\n\n // Check for CI systems that support color\n if (\"CI\" in env) {\n if (\n [\n \"TRAVIS\",\n \"CIRCLECI\",\n \"APPVEYOR\",\n \"GITLAB_CI\",\n \"GITHUB_ACTIONS\",\n \"BUILDKITE\",\n \"DRONE\",\n ].some((k) => k in env) ||\n env.CI_NAME === \"codeship\"\n ) {\n return true;\n }\n return false;\n }\n\n const term = env.TERM || \"\";\n const colorterm = env.COLORTERM || \"\";\n\n if (colorterm.length > 0) return true;\n if (term === \"dumb\") return false;\n\n return /(color|ansi|cygwin|xterm|vt100)/i.test(term);\n}\n\n/**\n * If the runtime supports color.\n */\nexport const supportsColor = detectColorSupport();\n\n/**\n * Creates a function that wraps a string in ANSI codes.\n * @param open The opening ANSI code.\n * @param close The closing ANSI code.\n * @returns A function that wraps the string in ANSI codes.\n */\nexport function createAnsiColor(\n open: number,\n close: number,\n): (input: any) => string {\n const openCode = `\\u001b[${open}m`;\n const closeCode = `\\u001b[${close}m`;\n\n if (!supportsColor) return (input) => input + \"\";\n\n return (input) => {\n if (!input) return openCode + closeCode;\n\n const str = input + \"\";\n // replace any existing close codes with reopen\n const replaced = str.replace(\n new RegExp(`\\u001b\\\\[${close}m`, \"g\"),\n closeCode + openCode,\n );\n return openCode + replaced + closeCode;\n };\n}\n\nexport const reset = createAnsiColor(0, 0);\nexport const bold = createAnsiColor(1, 22);\nexport const dim = createAnsiColor(2, 22);\nexport const italic = createAnsiColor(3, 23);\nexport const underline = createAnsiColor(4, 24);\nexport const overline = createAnsiColor(53, 55);\nexport const inverse = createAnsiColor(7, 27);\nexport const hidden = createAnsiColor(8, 28);\nexport const strikethrough = createAnsiColor(9, 29);\n\nexport const black = createAnsiColor(30, 39);\nexport const red = createAnsiColor(31, 39);\nexport const green = createAnsiColor(32, 39);\nexport const yellow = createAnsiColor(33, 39);\nexport const blue = createAnsiColor(34, 39);\nexport const magenta = createAnsiColor(35, 39);\nexport const cyan = createAnsiColor(36, 39);\nexport const white = createAnsiColor(37, 39);\nexport const gray = createAnsiColor(90, 39);\n\nexport const bgBlack = createAnsiColor(40, 49);\nexport const bgRed = createAnsiColor(41, 49);\nexport const bgGreen = createAnsiColor(42, 49);\nexport const bgYellow = createAnsiColor(43, 49);\nexport const bgBlue = createAnsiColor(44, 49);\nexport const bgMagenta = createAnsiColor(45, 49);\nexport const bgCyan = createAnsiColor(46, 49);\nexport const bgWhite = createAnsiColor(47, 49);\nexport const bgGray = createAnsiColor(100, 49);\n\nexport const redBright = createAnsiColor(91, 39);\nexport const greenBright = createAnsiColor(92, 39);\nexport const yellowBright = createAnsiColor(93, 39);\nexport const blueBright = createAnsiColor(94, 39);\nexport const magentaBright = createAnsiColor(95, 39);\nexport const cyanBright = createAnsiColor(96, 39);\nexport const whiteBright = createAnsiColor(97, 39);\n\nexport const bgRedBright = createAnsiColor(101, 49);\nexport const bgGreenBright = createAnsiColor(102, 49);\nexport const bgYellowBright = createAnsiColor(103, 49);\nexport const bgBlueBright = createAnsiColor(104, 49);\nexport const bgMagentaBright = createAnsiColor(105, 49);\nexport const bgCyanBright = createAnsiColor(106, 49);\nexport const bgWhiteBright = createAnsiColor(107, 49);\n\n/**\n * A theme.\n */\nexport interface Theme {\n /**\n * Wraps a string in a background ANSI code.\n * @param a The string to wrap.\n */\n background?(a: string): string;\n /**\n * Wraps a string in a foreground ANSI code.\n * @param a The string to wrap.\n */\n foreground?(a: string): string;\n /**\n * Wraps a string in a primary ANSI code.\n * @param a The string to wrap.\n */\n primary(a: string): string;\n /**\n * Wraps a string in a secondary ANSI code.\n * @param a The string to wrap.\n */\n secondary(a: string): string;\n /**\n * Wraps a string in a accent ANSI code.\n * @param a The string to wrap.\n */\n accent?(a: string): string;\n\n /**\n * Wraps a string in a success ANSI code.\n * @param a The string to wrap.\n */\n success(a: string): string;\n /**\n * Wraps a string in a warning ANSI code.\n * @param a The string to wrap.\n */\n warning(a: string): string;\n /**\n * Wraps a string in a error ANSI code.\n * @param a The string to wrap.\n */\n error(a: string): string;\n /**\n * Wraps a string in a info ANSI code.\n * @param a The string to wrap.\n */\n info?(a: string): string;\n\n /**\n * Set of symbols for logging.\n */\n symbols?: {\n /**\n * Success message symbol.\n */\n success: string;\n /**\n * Error message symbol.\n */\n error: string;\n /**\n * Fatal error message symbol.\n */\n fatal: string;\n /**\n * Warning message symbol.\n */\n warning: string;\n /**\n * Information message symbol.\n */\n info?: string;\n };\n\n /**\n * Optional styles.\n */\n styles?: {\n /**\n * Wraps a string in a bold ANSI code.\n * @param a The string to wrap.\n */\n bold?(a: string): string;\n /**\n * Wraps a string in an italic ANSI code.\n * @param a The string to wrap.\n */\n italic?(a: string): string;\n /**\n * Wraps a string in an underline ANSI code.\n * @param a The string to wrap.\n */\n underline?(a: string): string;\n };\n}\n\n/**\n * The default theme.\n */\nexport const DEFAULT_THEME: Theme = {\n primary: cyan,\n secondary: gray,\n\n success: green,\n warning: yellow,\n error: red,\n\n symbols: {\n success: \"✔\",\n error: \"✖\",\n fatal: \"✖\",\n warning: \"⚠\",\n },\n\n styles: {\n bold: bold,\n italic: italic,\n underline: underline,\n },\n};\n\n/**\n * Defines a theme.\n * @param theme The (partial) theme.\n * @returns The theme, merged with the default theme.\n */\nexport function defineTheme(theme: DeepPartial<Theme>): Theme {\n return merge(DEFAULT_THEME, theme);\n}\n"],"mappings":";;;;;;;;AA+CA,SAAS,cAAc,OAA0C;AAC/D,QACE,UAAU,QACV,OAAO,UAAU,YACjB,OAAO,eAAe,MAAM,KAAK,OAAO;;;;;;;;AAU5C,SAAgB,MAAY,QAAW,QAA4B;AACjE,KAAI,MAAM,QAAQ,OAAO,IAAI,MAAM,QAAQ,OAAO,CAEhD,QAAO;AAGT,KAAI,cAAc,OAAO,IAAI,cAAc,OAAO,EAAE;EAClD,MAAMA,SAAc,EAAE;AAEtB,EADa,IAAI,IAAI,CAAC,GAAG,OAAO,KAAK,OAAO,EAAE,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CACjE,SAAS,QAAQ;GACpB,MAAM,YAAa,OAAe;GAClC,MAAM,YAAa,OAAe;AAElC,OAAI,cAAc,UAAa,cAAc,OAC3C,QAAO,OAAO,MAAM,WAAW,UAAU;YAChC,cAAc,OACvB,QAAO,OAAO;OAEd,QAAO,OAAO;IAEhB;AACF,SAAO;;AAIT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChFT,SAAS,qBAAqB;AAE5B,KAAI,OAAO,WAAW,eAAe,OAAO,OAAO,aAAa,YAC9D,QAAO;CAGT,MAAM,MAAM,OAAO,YAAY,cAAe,QAAQ,OAAO,EAAE,GAAI,EAAE;AAGrE,KAAI,cAAc,IAAK,QAAO;AAG9B,KAAI,iBAAiB,IAAK,QAAO;AAGjC,KAAI,QAAQ,KAAK;AACf,MACE;GACE;GACA;GAC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
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-8P8qXJ2o.mjs","names":["command","command: Command<any>","input: Record<string, unknown>","args: string[]","opts: Record<string, string>","errors: ConvokerError[]","usedValue: string | undefined","rawValue: string | string[] | undefined","names: string[]","cmd: Command<any> | undefined","nonCliErrors: Error[]","middlewares: MiddlewareFn<any>[]","current: Command<any> | undefined"],"sources":["../src/command/error.ts","../src/command/index.ts"],"sourcesContent":["import { Positional, Option } from \"@/input\";\nimport { Command } from \".\";\n\n/**\n * A Convoker-related error. These are usually handled by default.\n */\nexport class ConvokerError extends Error {\n /**\n * The command this error happened on.\n */\n command: Command<any>;\n\n /**\n * Creates a new Convoker error.\n * @param message The message.\n * @param command The command.\n */\n constructor(message: string, command: Command<any>) {\n super(message);\n this.command = command;\n }\n\n /**\n * Prints the error's message.\n */\n print() {\n console.error(this.message);\n }\n}\n\n/**\n * When the user asks for help.\n */\nexport class HelpAskedError extends ConvokerError {\n /**\n * Creates a new help asked error.\n * @param command The command.\n */\n constructor(command: Command<any>) {\n super(\"user asked for help!\", command);\n }\n}\n\n/**\n * When you pass too many arguments.\n */\nexport class TooManyArgumentsError extends ConvokerError {\n /**\n * Creates a new too many arguments error.\n * @param command The command.\n */\n constructor(command: Command<any>) {\n super(\"too many arguments!\", command);\n }\n}\n\n/**\n * When you pass an unknown option, when unknown options aren't allowed.\n */\nexport class UnknownOptionError extends ConvokerError {\n /**\n * The option key.\n */\n key: string;\n\n /**\n * Creates a new unknown option error.\n * @param command The command.\n * @param key The key.\n */\n constructor(command: Command<any>, key: string) {\n super(`unknown option: ${key}!`, command);\n this.key = key;\n }\n}\n\n/**\n * When a required option is missing.\n */\nexport class MissingRequiredOptionError extends ConvokerError {\n /**\n * The option key.\n */\n key: string;\n /**\n * The option entry.\n */\n entry: Option<any, any, any>;\n\n /**\n * Creates a new missing required option error.\n * @param command The command.\n * @param key The key.\n * @param entry The entry.\n */\n constructor(\n command: Command<any>,\n key: string,\n entry: Option<any, any, any>,\n ) {\n super(`missing required option: ${key}!`, command);\n this.key = key;\n this.entry = entry;\n }\n}\n\nexport class MissingRequiredArgumentError extends ConvokerError {\n /**\n * The argument key.\n */\n key: string;\n /**\n * The argument entry.\n */\n entry: Positional<any, any, any>;\n\n /**\n * Creates a new missing required argument error.\n * @param command The command.\n * @param key The key.\n * @param entry The entry.\n */\n constructor(\n command: Command<any>,\n key: string,\n entry: Positional<any, any, any>,\n ) {\n super(`missing required positional argument: ${key}!`, command);\n this.key = key;\n this.entry = entry;\n }\n}\n","import process from \"node:process\";\n\nimport { gray, cyan, bold, type Theme } from \"@/color\";\nimport { setTheme as setPromptTheme } from \"@/prompt\";\nimport {\n ConvokerError,\n HelpAskedError,\n MissingRequiredArgumentError,\n MissingRequiredOptionError,\n TooManyArgumentsError,\n UnknownOptionError,\n} from \"./error\";\nimport {\n convert,\n Option,\n Positional,\n type InferInput,\n type Input,\n} from \"@/input\";\n\n/**\n * What the command is an alias for.\n */\nexport interface CommandAlias<T extends Input = Input> {\n /**\n * A pointer to the command.\n */\n command: Command<T>;\n /**\n * The name of the command this is an alias for.\n */\n alias?: string;\n}\n\n/**\n * The result of the `Command.parse` function.\n */\nexport interface ParseResult<T extends Input> {\n /**\n * A pointer to the command to run.\n */\n command: Command<T>;\n /**\n * The input to pass into the command.\n */\n input: InferInput<T>;\n /**\n * Errors collected during parsing.\n */\n errors: ConvokerError[];\n /**\n * If this should result in displaying the version of the command.\n */\n isVersion: boolean;\n /**\n * If this should result in displaying a help screen.\n */\n isHelp: boolean;\n}\n\n/**\n * Command action function.\n */\nexport type ActionFn<T extends Input> = (\n input: InferInput<T>,\n) => any | Promise<any>;\n\n/**\n * Command middleware function.\n */\nexport type MiddlewareFn<T extends Input = Input> = (\n input: InferInput<T>,\n next: () => Promise<any>,\n) => any | Promise<any>;\n\n/**\n * Command error handler.\n */\nexport type ErrorFn<T extends Input> = (\n command: Command<T>,\n errors: Error[],\n input: Partial<InferInput<T>>,\n) => void | Promise<void>;\n\n/**\n * Builder for commands.\n */\nexport type Builder = (c: Command<any>) => Command<any> | void;\n\n/**\n * An input map entry.\n */\ninterface MapEntry {\n /**\n * The key of the map entry.\n */\n key: string;\n /**\n * The value of the map entry.\n */\n value: Option<any, any, any> | Positional<any, any, any>;\n}\n\n/**\n * A command.\n */\nexport class Command<T extends Input = Input> {\n /**\n * The names (aliases) of this command.\n */\n $names: string[];\n /**\n * The description of this command.\n */\n $description: string | undefined;\n /**\n * The theme of this command\n */\n $theme: Theme | undefined;\n /**\n * The version of this command.\n */\n $version: string | undefined;\n /**\n * The children of this command.\n */\n $children: Map<string, CommandAlias> = new Map();\n /**\n * The parent of this command.\n */\n $parent: Command<any> | undefined;\n /**\n * If this command allows unknown options.\n */\n $allowUnknownOptions: boolean = false;\n /**\n * If you should be able to surpass the amount of positional arguments defined in the input.\n */\n $allowSurpassArgLimit: boolean = false;\n /**\n * The input this command takes.\n */\n $input: T = {} as T;\n /**\n * The action function of this command.\n */\n $fn: ActionFn<T> | undefined = undefined;\n /**\n * The middlewares associated with this command.\n */\n $middlewares: MiddlewareFn<T>[] = [];\n /**\n * The error handler of this command.\n */\n $errorFn: ErrorFn<T> | undefined = undefined;\n\n /**\n * Creates a new command.\n * @param names The names (aliases).\n * @param desc The description.\n * @param version The version.\n */\n constructor(names: string | string[], desc?: string, version?: string) {\n this.$names = Array.isArray(names) ? names : [names];\n this.$description = desc;\n this.$version = version;\n }\n\n /**\n * Adds a set of aliases to this command.\n * @param aliases The aliases to add.\n * @returns this\n */\n alias(...aliases: string[]): this {\n this.$names.push(...aliases);\n this.$parent?.add(this);\n return this;\n }\n\n /**\n * Adds a description to this command.\n * @param desc The description.\n * @returns this\n */\n description(desc: string): this {\n this.$description = desc;\n return this;\n }\n\n /**\n * Adds a version to this command.\n * @param version The version.\n * @returns this\n */\n version(version: string): this {\n this.$version = version;\n return this;\n }\n\n /**\n * Sets the input for this command.\n * @param version The input.\n * @returns this\n */\n input<TInput extends Input>(input: TInput): Command<TInput> {\n this.$input = input as any;\n return this as any;\n }\n\n /**\n * Adds a chain of middlewares.\n * @param fns The middlewares to use.\n * @returns this\n */\n use(...fns: MiddlewareFn<T>[]): this {\n this.$middlewares.push(...fns);\n return this;\n }\n\n /**\n * Sets the action function for this command.\n * @param fn The action.\n * @returns this\n */\n action(fn: ActionFn<T>): this {\n this.$fn = fn;\n return this;\n }\n\n /**\n * Sets the error function for this command.\n * @param fn The error handler.\n * @returns this\n */\n error(fn: ErrorFn<T>): this {\n this.$errorFn = fn;\n return this;\n }\n\n /**\n * Adds existing commands to this.\n * @param commands The commands.\n * @returns this\n */\n add(...commands: Command<any>[]): this {\n for (const command of commands) {\n command.$parent = this;\n const alias = { command, alias: command.$names[0] };\n for (let i = 0; i < command.$names.length; i++) {\n if (i === 0) this.$children.set(command.$names[i], { command });\n this.$children.set(command.$names[i], alias);\n }\n }\n return this;\n }\n\n /**\n * Creates a new subcommand and adds it.\n * @param names The aliases of the subcommand.\n * @param builder A builder to create the command.\n */\n subCommand(names: string | string[], builder: Builder): this;\n /**\n * Creates a new subcommand and adds it.\n * @param names The aliases of the subcommand.\n * @param desc The description of the subcommand.\n * @param version The version of the subcommand.\n */\n subCommand(\n names: string | string[],\n desc?: string,\n version?: string,\n ): Command<any>;\n\n subCommand(\n names: string | string[],\n descOrBuilder?: Builder | string,\n version?: string,\n ): Command<any> {\n if (typeof descOrBuilder === \"function\") {\n const command = new Command(names);\n descOrBuilder(command);\n this.add(command);\n return this;\n }\n\n const command = new Command(names, descOrBuilder, version);\n this.add(command);\n return command;\n }\n\n /**\n * Allows unknown options.\n * @returns this\n */\n allowUnknownOptions(): this {\n this.$allowUnknownOptions = true;\n return this;\n }\n\n /**\n * Parses a set of command-line arguments.\n * @param argv The arguments to parse.\n * @returns A parse result.\n */\n async parse(argv: string[]): Promise<ParseResult<T>> {\n // eslint-disable-next-line -- alias to this is necessary to go through the tree\n let command: Command<any> = this;\n let found = false;\n const input: Record<string, unknown> = {};\n\n const args: string[] = [];\n const opts: Record<string, string> = {};\n\n const errors: ConvokerError[] = [];\n const map = command.buildInputMap();\n\n function getOption(key: string, isSpecial?: boolean) {\n const entry = map.get(key);\n if (!entry) {\n if (!command.$allowUnknownOptions && !isSpecial)\n errors.push(new UnknownOptionError(command, key));\n return null;\n }\n return entry.value as Option<any, any, any>;\n }\n\n function setOption(\n key: string,\n option: Option<any, any, any>,\n value?: string,\n ) {\n if (option.$kind === \"boolean\") {\n opts[key] = \"true\";\n } else if (value !== undefined) {\n opts[key] = value;\n }\n }\n\n let isVersion = false;\n let isHelp = false;\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg.startsWith(\"--\")) {\n // --long[=value] or --long [value]\n const [key, value] = arg.slice(2).split(\"=\");\n\n let isSpecial = false;\n if (key === \"help\") {\n isHelp = true;\n isSpecial = true;\n } else if (key === \"version\") {\n isVersion = true;\n isSpecial = true;\n }\n\n const option = getOption(key, isSpecial);\n if (option) {\n if (value === undefined)\n setOption(\n key,\n option,\n option.$kind === \"boolean\" ? undefined : argv[++i],\n );\n else setOption(key, option, value);\n }\n } else if (arg.startsWith(\"-\")) {\n // -abc or -k[=value] or -k [value]\n const [shortKeys, value] = arg.slice(1).split(\"=\");\n const chars = shortKeys.split(\"\");\n let usedValue: string | undefined = value;\n\n for (const char of chars) {\n let isSpecial = false;\n if (char === \"h\") {\n isHelp = true;\n isSpecial = true;\n } else if (char === \"V\") {\n isVersion = true;\n isSpecial = true;\n }\n\n const option = getOption(char, isSpecial);\n if (!option) continue;\n\n if (option.$kind !== \"boolean\" && usedValue === undefined) {\n usedValue = argv[++i];\n }\n setOption(char, option, usedValue);\n usedValue = undefined; // only first consumes\n }\n } else {\n // positional\n if (command.$children.has(arg) && !found) {\n command = command.$children.get(arg)!.command;\n if (command.$theme) {\n setPromptTheme(command.$theme);\n }\n } else {\n found = true;\n args.push(arg);\n }\n }\n }\n\n // Apply user values, defaults, or enforce required\n let index = 0;\n for (const key in command.$input) {\n const entry = command.$input[key];\n let rawValue: string | string[] | undefined;\n\n if (entry instanceof Positional) {\n if (entry.$list) {\n rawValue = args.slice(index);\n index = args.length;\n if (\n !command.$allowSurpassArgLimit &&\n rawValue.length === 0 &&\n entry.$required\n ) {\n errors.push(new MissingRequiredArgumentError(command, key, entry));\n }\n } else {\n rawValue = args[index++];\n if (rawValue === undefined && entry.$required) {\n errors.push(new MissingRequiredArgumentError(command, key, entry));\n }\n }\n } else {\n for (const name of entry.$names) {\n if (opts[name] !== undefined) {\n rawValue = entry.$list\n ? opts[name].split(entry.$separator ?? \",\")\n : opts[name];\n break;\n }\n }\n }\n\n if (rawValue !== undefined) {\n input[key] = await convert(entry.$kind, rawValue);\n } else if (entry.$default !== undefined) {\n input[key] = entry.$default;\n } else if (entry.$required) {\n if (entry instanceof Option) {\n errors.push(new MissingRequiredOptionError(command, key, entry));\n } else {\n errors.push(new MissingRequiredArgumentError(command, key, entry));\n }\n }\n }\n\n // Check for too many arguments\n const remainingArgs = args.slice(index);\n if (!command.$allowSurpassArgLimit && remainingArgs.length > 0) {\n errors.push(new TooManyArgumentsError(command));\n }\n\n return {\n input: input as InferInput<T>,\n command,\n errors,\n isVersion,\n isHelp,\n };\n }\n\n private buildInputMap(\n ignoreParentMap?: boolean,\n ): Map<string | number, MapEntry> {\n const map = new Map<string | number, MapEntry>();\n\n let i = 0;\n for (const key in this.$input) {\n const value = this.$input[key];\n if (value instanceof Positional) {\n map.set(i++, { value, key });\n } else {\n for (const name of value.$names) {\n map.set(name, { value, key });\n }\n }\n }\n\n if (!ignoreParentMap) {\n for (const [key, entry] of this.$parent?.buildInputMap() ?? []) {\n map.set(key, entry);\n }\n }\n\n for (const [, { command }] of this.$children) {\n for (const [key, entry] of command.buildInputMap(true)) {\n map.set(key, entry);\n }\n }\n\n return map;\n }\n\n /**\n * Allows surpassing the amount of arguments specified.\n * @returns this\n */\n allowSurpassArgLimit(): this {\n this.$allowSurpassArgLimit = true;\n return this;\n }\n\n /**\n * Gets the full command path (name including parents).\n * @returns The full command path.\n */\n fullCommandPath(): string {\n const names: string[] = [];\n // eslint-disable-next-line -- necessary for traversing up the tree\n let cmd: Command<any> | undefined = this;\n while (cmd) {\n names.unshift(cmd.$names[0]);\n cmd = cmd.$parent;\n }\n return names.join(\" \");\n }\n\n /**\n * The default error screen.\n * @param errors The errors.\n */\n defaultErrorScreen(errors: Error[]) {\n let printHelpScreen = false;\n const nonCliErrors: Error[] = [];\n\n for (const error of errors) {\n if (error instanceof ConvokerError) {\n if (!(error instanceof HelpAskedError)) error.print();\n printHelpScreen = true;\n } else {\n nonCliErrors.push(error);\n }\n }\n\n if (nonCliErrors.length) throw nonCliErrors[0];\n\n if (!printHelpScreen) return;\n const pad = (s: string, len: number) => s.padEnd(len, \" \");\n\n console.log(\n `${bold(\"usage:\")} ${cyan(this.fullCommandPath())} ${gray(\"[options] [arguments]\")}`,\n );\n if (this.$description) {\n console.log(`${this.$description}`);\n }\n\n if (this.$version) {\n console.log(`${bold(\"version\")} ${this.$version}`);\n }\n\n // OPTIONS\n const opts = Object.entries(this.$input)\n .filter(([, entry]) => entry instanceof Option)\n .map(([key, entry]) => ({ key, entry: entry as Option<any, any, any> }));\n\n if (opts.length > 0) {\n console.log(bold(\"options:\"));\n const longest = Math.max(\n ...opts.map(({ entry }) => entry.$names.join(\", \").length),\n );\n for (const { entry } of opts) {\n const names = entry.$names\n .map((n) => (n.length === 1 ? `-${n}` : `--${n}`))\n .join(\", \");\n const line = ` ${cyan(pad(names, longest + 4))}${gray(entry.$description ?? \"\")}`;\n console.log(line);\n }\n }\n\n // POSITIONALS\n const positionals = Object.entries(this.$input)\n .filter(([, entry]) => entry instanceof Positional)\n .map(([key, entry]) => ({\n key,\n entry: entry as Positional<any, any, any>,\n }));\n\n if (positionals.length > 0) {\n console.log(bold(\"arguments:\"));\n const longest = Math.max(...positionals.map(({ key }) => key.length));\n for (const { key, entry } of positionals) {\n const name = entry.$required ? `<${key}>` : `[${key}]`;\n const line = ` ${cyan(pad(name, longest + 4))}${gray(entry.$description ?? \"\")}`;\n console.log(line);\n }\n }\n\n // SUBCOMMANDS\n if (this.$children.size > 0) {\n console.log(bold(\"sub commands:\"));\n const deduped = Array.from(\n new Map(\n [...this.$children.values()].map((a) => [\n a.command.$names[0],\n a.command,\n ]),\n ).values(),\n );\n\n const longest = Math.max(...deduped.map((c) => c.$names[0].length));\n for (const cmd of deduped) {\n const line = ` ${cyan(pad(cmd.$names[0], longest + 4))}${gray(cmd.$description) ?? \"\"}`;\n console.log(line);\n }\n console.log();\n console.log(\n `run '${cyan(`${this.fullCommandPath()} <command> --help`)}' for more info on a command.`,\n );\n }\n }\n\n /**\n * Handles a set of errors.\n * @param errors The errors to handle.\n * @param input The parsed input, if possible.\n * @returns this\n */\n async handleErrors(\n errors: Error[],\n input?: Partial<InferInput<T>>,\n ): Promise<this> {\n // eslint-disable-next-line -- necessary for traversing up the tree\n let command: Command<any> = this;\n while (!command.$errorFn && command.$parent) {\n command = command.$parent;\n }\n\n if (command.$errorFn) {\n await command.$errorFn(command, errors, input ?? {});\n } else {\n this.defaultErrorScreen(errors);\n }\n return this;\n }\n\n /**\n * Runs a command.\n * @param argv The arguments to run the command with. Defaults to your runtime's `argv` equivalent.\n * @returns this\n */\n async run(argv?: string[]): Promise<this> {\n const result = await this.parse(argv ?? process.argv.slice(2));\n if (result.isHelp) {\n result.command.handleErrors([new HelpAskedError(result.command)]);\n return this;\n } else if (result.isVersion) {\n console.log(\n `${result.command.fullCommandPath()} version ${result.command.$version}`,\n );\n return this;\n }\n\n try {\n if (result.errors.length > 0) {\n await result.command.handleErrors(result.errors, result.input);\n } else if (!result.command.$fn) {\n await result.command.handleErrors(\n [new HelpAskedError(result.command), ...result.errors],\n result.input,\n );\n } else {\n const middlewares = collectMiddlewares(result.command);\n if (middlewares.length > 0) {\n const runner = compose(middlewares);\n // finalNext calls the command action with the same input\n await runner(result.input, async () => {\n await result.command.$fn?.(result.input);\n });\n } else {\n await result.command.$fn(result.input);\n }\n }\n } catch (e) {\n if (!(e instanceof Error)) {\n console.warn(\n \"[convoker] an error that is not instance of `Error` was thrown. this may cause undefined behavior.\",\n );\n }\n await result.command.handleErrors([e as Error]);\n }\n return this;\n }\n}\n\nfunction collectMiddlewares(cmd: Command<any>) {\n const middlewares: MiddlewareFn<any>[] = [];\n let current: Command<any> | undefined = cmd;\n while (current) {\n if (current.$middlewares.length) {\n middlewares.unshift(...current.$middlewares);\n }\n current = current.$parent;\n }\n return middlewares;\n}\n\nfunction compose(mws: MiddlewareFn<any>[]) {\n return (input: InferInput<any>, finalNext?: () => Promise<any>) => {\n let index = -1;\n const dispatch = (i: number): Promise<any> => {\n if (i <= index)\n return Promise.reject(new Error(\"next() called multiple times\"));\n index = i;\n const fn = mws[i];\n if (!fn) {\n // when middlewares exhausted call finalNext if provided\n return finalNext ? finalNext() : Promise.resolve();\n }\n try {\n return Promise.resolve(fn(input, () => dispatch(i + 1)));\n } catch (err) {\n return Promise.reject(err);\n }\n };\n return dispatch(0);\n };\n}\n\nexport * from \"./error\";\n"],"mappings":";;;;;;;;;AAMA,IAAa,gBAAb,cAAmC,MAAM;;;;;;CAWvC,YAAY,SAAiB,SAAuB;AAClD,QAAM,QAAQ;AACd,OAAK,UAAU;;;;;CAMjB,QAAQ;AACN,UAAQ,MAAM,KAAK,QAAQ;;;;;;AAO/B,IAAa,iBAAb,cAAoC,cAAc;;;;;CAKhD,YAAY,SAAuB;AACjC,QAAM,wBAAwB,QAAQ;;;;;;AAO1C,IAAa,wBAAb,cAA2C,cAAc;;;;;CAKvD,YAAY,SAAuB;AACjC,QAAM,uBAAuB,QAAQ;;;;;;AAOzC,IAAa,qBAAb,cAAwC,cAAc;;;;;;CAWpD,YAAY,SAAuB,KAAa;AAC9C,QAAM,mBAAmB,IAAI,IAAI,QAAQ;AACzC,OAAK,MAAM;;;;;;AAOf,IAAa,6BAAb,cAAgD,cAAc;;;;;;;CAgB5D,YACE,SACA,KACA,OACA;AACA,QAAM,4BAA4B,IAAI,IA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,IAAI,QAAQ;EACZ,MAAM,YAAY,MAA4B;AAC5C,OAAI,KAAK,MACP,QAAO,QAAQ,uBAAO,IAAI,MAAM,+BAA+B,CAAC;AAClE,WAAQ;GACR,MAAM,KAAK,IAAI;AACf,OAAI,CAAC,GAEH,QAAO,YAAY,WAAW,GAAG,QAAQ,SAAS;AAEpD,OAAI;AACF,WAAO,QAAQ,QAAQ,GAAG,aAAa,SAAS,IAAI,EAAE,CAAC,CAAC;YACjD,KAAK;AACZ,WAAO,QAAQ,OAAO,IAAI;;;AAG9B,SAAO,SAAS,EAAE"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
//#region src/utils.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Deep `Partial<T>`.
|
|
4
|
-
*/
|
|
5
|
-
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
|
6
|
-
declare namespace index_d_exports {
|
|
7
|
-
export { DEFAULT_THEME, Theme, bgBlack, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blue, blueBright, bold, createAnsiColor, cyan, cyanBright, defineTheme, dim, gray, green, greenBright, hidden, inverse, italic, magenta, magentaBright, overline, red, redBright, reset, strikethrough, supportsColor, underline, white, whiteBright, yellow, yellowBright };
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* If the runtime supports color.
|
|
11
|
-
*/
|
|
12
|
-
declare const supportsColor: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a function that wraps a string in ANSI codes.
|
|
15
|
-
* @param open The opening ANSI code.
|
|
16
|
-
* @param close The closing ANSI code.
|
|
17
|
-
* @returns A function that wraps the string in ANSI codes.
|
|
18
|
-
*/
|
|
19
|
-
declare function createAnsiColor(open: number, close: number): (input: any) => string;
|
|
20
|
-
declare const reset: (input: any) => string;
|
|
21
|
-
declare const bold: (input: any) => string;
|
|
22
|
-
declare const dim: (input: any) => string;
|
|
23
|
-
declare const italic: (input: any) => string;
|
|
24
|
-
declare const underline: (input: any) => string;
|
|
25
|
-
declare const overline: (input: any) => string;
|
|
26
|
-
declare const inverse: (input: any) => string;
|
|
27
|
-
declare const hidden: (input: any) => string;
|
|
28
|
-
declare const strikethrough: (input: any) => string;
|
|
29
|
-
declare const black: (input: any) => string;
|
|
30
|
-
declare const red: (input: any) => string;
|
|
31
|
-
declare const green: (input: any) => string;
|
|
32
|
-
declare const yellow: (input: any) => string;
|
|
33
|
-
declare const blue: (input: any) => string;
|
|
34
|
-
declare const magenta: (input: any) => string;
|
|
35
|
-
declare const cyan: (input: any) => string;
|
|
36
|
-
declare const white: (input: any) => string;
|
|
37
|
-
declare const gray: (input: any) => string;
|
|
38
|
-
declare const bgBlack: (input: any) => string;
|
|
39
|
-
declare const bgRed: (input: any) => string;
|
|
40
|
-
declare const bgGreen: (input: any) => string;
|
|
41
|
-
declare const bgYellow: (input: any) => string;
|
|
42
|
-
declare const bgBlue: (input: any) => string;
|
|
43
|
-
declare const bgMagenta: (input: any) => string;
|
|
44
|
-
declare const bgCyan: (input: any) => string;
|
|
45
|
-
declare const bgWhite: (input: any) => string;
|
|
46
|
-
declare const bgGray: (input: any) => string;
|
|
47
|
-
declare const redBright: (input: any) => string;
|
|
48
|
-
declare const greenBright: (input: any) => string;
|
|
49
|
-
declare const yellowBright: (input: any) => string;
|
|
50
|
-
declare const blueBright: (input: any) => string;
|
|
51
|
-
declare const magentaBright: (input: any) => string;
|
|
52
|
-
declare const cyanBright: (input: any) => string;
|
|
53
|
-
declare const whiteBright: (input: any) => string;
|
|
54
|
-
declare const bgRedBright: (input: any) => string;
|
|
55
|
-
declare const bgGreenBright: (input: any) => string;
|
|
56
|
-
declare const bgYellowBright: (input: any) => string;
|
|
57
|
-
declare const bgBlueBright: (input: any) => string;
|
|
58
|
-
declare const bgMagentaBright: (input: any) => string;
|
|
59
|
-
declare const bgCyanBright: (input: any) => string;
|
|
60
|
-
declare const bgWhiteBright: (input: any) => string;
|
|
61
|
-
/**
|
|
62
|
-
* A theme.
|
|
63
|
-
*/
|
|
64
|
-
interface Theme {
|
|
65
|
-
/**
|
|
66
|
-
* Wraps a string in a background ANSI code.
|
|
67
|
-
* @param a The string to wrap.
|
|
68
|
-
*/
|
|
69
|
-
background?(a: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* Wraps a string in a foreground ANSI code.
|
|
72
|
-
* @param a The string to wrap.
|
|
73
|
-
*/
|
|
74
|
-
foreground?(a: string): string;
|
|
75
|
-
/**
|
|
76
|
-
* Wraps a string in a primary ANSI code.
|
|
77
|
-
* @param a The string to wrap.
|
|
78
|
-
*/
|
|
79
|
-
primary(a: string): string;
|
|
80
|
-
/**
|
|
81
|
-
* Wraps a string in a secondary ANSI code.
|
|
82
|
-
* @param a The string to wrap.
|
|
83
|
-
*/
|
|
84
|
-
secondary(a: string): string;
|
|
85
|
-
/**
|
|
86
|
-
* Wraps a string in a accent ANSI code.
|
|
87
|
-
* @param a The string to wrap.
|
|
88
|
-
*/
|
|
89
|
-
accent?(a: string): string;
|
|
90
|
-
/**
|
|
91
|
-
* Wraps a string in a success ANSI code.
|
|
92
|
-
* @param a The string to wrap.
|
|
93
|
-
*/
|
|
94
|
-
success(a: string): string;
|
|
95
|
-
/**
|
|
96
|
-
* Wraps a string in a warning ANSI code.
|
|
97
|
-
* @param a The string to wrap.
|
|
98
|
-
*/
|
|
99
|
-
warning(a: string): string;
|
|
100
|
-
/**
|
|
101
|
-
* Wraps a string in a error ANSI code.
|
|
102
|
-
* @param a The string to wrap.
|
|
103
|
-
*/
|
|
104
|
-
error(a: string): string;
|
|
105
|
-
/**
|
|
106
|
-
* Wraps a string in a info ANSI code.
|
|
107
|
-
* @param a The string to wrap.
|
|
108
|
-
*/
|
|
109
|
-
info?(a: string): string;
|
|
110
|
-
/**
|
|
111
|
-
* Set of symbols for logging.
|
|
112
|
-
*/
|
|
113
|
-
symbols?: {
|
|
114
|
-
/**
|
|
115
|
-
* Success message symbol.
|
|
116
|
-
*/
|
|
117
|
-
success: string;
|
|
118
|
-
/**
|
|
119
|
-
* Error message symbol.
|
|
120
|
-
*/
|
|
121
|
-
error: string;
|
|
122
|
-
/**
|
|
123
|
-
* Fatal error message symbol.
|
|
124
|
-
*/
|
|
125
|
-
fatal: string;
|
|
126
|
-
/**
|
|
127
|
-
* Warning message symbol.
|
|
128
|
-
*/
|
|
129
|
-
warning: string;
|
|
130
|
-
/**
|
|
131
|
-
* Information message symbol.
|
|
132
|
-
*/
|
|
133
|
-
info?: string;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Optional styles.
|
|
137
|
-
*/
|
|
138
|
-
styles?: {
|
|
139
|
-
/**
|
|
140
|
-
* Wraps a string in a bold ANSI code.
|
|
141
|
-
* @param a The string to wrap.
|
|
142
|
-
*/
|
|
143
|
-
bold?(a: string): string;
|
|
144
|
-
/**
|
|
145
|
-
* Wraps a string in an italic ANSI code.
|
|
146
|
-
* @param a The string to wrap.
|
|
147
|
-
*/
|
|
148
|
-
italic?(a: string): string;
|
|
149
|
-
/**
|
|
150
|
-
* Wraps a string in an underline ANSI code.
|
|
151
|
-
* @param a The string to wrap.
|
|
152
|
-
*/
|
|
153
|
-
underline?(a: string): string;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* The default theme.
|
|
158
|
-
*/
|
|
159
|
-
declare const DEFAULT_THEME: Theme;
|
|
160
|
-
/**
|
|
161
|
-
* Defines a theme.
|
|
162
|
-
* @param theme The (partial) theme.
|
|
163
|
-
* @returns The theme, merged with the default theme.
|
|
164
|
-
*/
|
|
165
|
-
declare function defineTheme(theme: DeepPartial<Theme>): Theme;
|
|
166
|
-
//#endregion
|
|
167
|
-
export { greenBright as A, reset as B, createAnsiColor as C, dim as D, defineTheme as E, magenta as F, whiteBright as G, supportsColor as H, magentaBright as I, DeepPartial as J, yellow as K, overline as L, index_d_exports as M, inverse as N, gray as O, italic as P, red as R, bold as S, cyanBright as T, underline as U, strikethrough as V, white as W, bgYellow as _, bgBlueBright as a, blue as b, bgGray as c, bgMagenta as d, bgMagentaBright as f, bgWhiteBright as g, bgWhite as h, bgBlue as i, hidden as j, green as k, bgGreen as l, bgRedBright as m, Theme as n, bgCyan as o, bgRed as p, yellowBright as q, bgBlack as r, bgCyanBright as s, DEFAULT_THEME as t, bgGreenBright as u, bgYellowBright as v, cyan as w, blueBright as x, black as y, redBright as z };
|
|
168
|
-
//# sourceMappingURL=index-BtbthYjp.d.mts.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["th: Theme","DEFAULT_CONFIG: Config","config: Config"],"sources":["../src/log/error.ts","../src/log/index.ts"],"sourcesContent":["export class WriteError extends Error {\n constructor(streamName: string) {\n super(`Could not write to \\`${streamName}\\`.`);\n }\n}\n","import Stream from \"node:stream\";\nimport process from \"node:process\";\nimport { DEFAULT_THEME, type Theme } from \"@/color\";\nimport { DeepPartial, merge } from \"@/utils\";\nimport { WriteError } from \"./error\";\n\nlet th: Theme = DEFAULT_THEME;\n\nexport function setTheme(theme: Theme) {\n th = theme;\n}\n\nexport interface Config {\n format: \"text\" | \"json\";\n stdout: Stream.Writable;\n stderr: Stream.Writable;\n jsonSpace: number;\n}\n\nexport const DEFAULT_CONFIG: Config = {\n format: \"text\",\n stderr: process.stderr,\n stdout: process.stdout,\n jsonSpace: 2,\n};\n\nlet config: Config = DEFAULT_CONFIG;\n\nexport function setConfig({\n theme,\n ...cfg\n}: DeepPartial<Config> & { theme?: Theme }) {\n config = merge(DEFAULT_CONFIG, cfg);\n th = theme ?? th;\n}\n\nexport function trace(...msgs: any[]) {\n const str = format(msgs, \"TRACE\");\n if (!config.stdout.write(str)) {\n throw new WriteError(\"stdout\");\n }\n}\n\nexport function info(...msgs: any[]) {\n const str = format(msgs, \"INFO\");\n if (!config.stdout.write(str)) {\n throw new WriteError(\"stdout\");\n }\n}\n\nexport function warn(...msgs: any[]) {\n const str = format(msgs, \"WARN\");\n if (!config.stderr.write(th.warning(str))) {\n throw new WriteError(\"stderr\");\n }\n}\n\nexport function error(...msgs: any[]) {\n const str = format(msgs, \"ERROR\");\n if (!config.stderr.write(str)) {\n throw new WriteError(\"stderr\");\n }\n}\n\nexport function fatal(...msgs: any[]) {\n const str = format(msgs, \"FATAL\");\n if (!config.stderr.write(str)) {\n throw new WriteError(\"stderr\");\n }\n\n process.exit(-1);\n}\n\nexport * from \"./error\";\n\nfunction format(msgs: any[], level: string): string {\n const timestamp = new Date().toISOString();\n const msg = msgs\n .map((m) =>\n typeof m === \"string\" ? m : JSON.stringify(m, null, config.jsonSpace),\n )\n .join(\" \");\n switch (config.format) {\n case \"json\":\n return colorize(\n JSON.stringify({ timestamp, level, message: msg }) + \"\\n\",\n level,\n );\n case \"text\":\n default:\n return colorize(\n `[${timestamp}] [${(th.symbols as any)[level] ?? level}] ${msg}\\n`,\n level,\n );\n }\n}\n\nfunction colorize(str: string, level: string) {\n switch (level) {\n case \"TRACE\":\n return th.secondary(str);\n case \"WARN\":\n return th.warning(str);\n case \"ERROR\":\n return th.error(str);\n case \"FATAL\":\n return th.styles?.bold ? th.styles.bold(th.error(str)) : th.error(str);\n case \"INFO\":\n default:\n return th.info?.(str) ?? str;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAa,aAAb,cAAgC,MAAM;CACpC,YAAY,YAAoB;AAC9B,QAAM,wBAAwB,WAAW,KAAK;;;;;;;;;;;;;;;;;ACIlD,IAAIA,KAAY;AAEhB,SAAgB,SAAS,OAAc;AACrC,MAAK;;AAUP,MAAaC,iBAAyB;CACpC,QAAQ;CACR,QAAQ,QAAQ;CAChB,QAAQ,QAAQ;CAChB,WAAW;CACZ;AAED,IAAIC,SAAiB;AAErB,SAAgB,UAAU,EACxB,MACA,GAAG,OACuC;AAC1C,UAAS,MAAM,gBAAgB,IAAI;AACnC,MAAK,SAAS;;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