@prozilla-os/shared 1.3.0 → 1.5.0
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/README.md +3 -3
- package/dist/chunks/index-PU_xBoDn.js +857 -0
- package/dist/chunks/index-PU_xBoDn.js.map +1 -0
- package/dist/chunks/object.utils-xiWGUq8N.js +15 -0
- package/dist/chunks/object.utils-xiWGUq8N.js.map +1 -0
- package/dist/logging.d.ts +711 -0
- package/dist/logging.js +17 -0
- package/dist/logging.js.map +1 -0
- package/dist/main.d.ts +785 -43
- package/dist/main.js +300 -674
- package/dist/main.js.map +1 -1
- package/dist/utils.d.ts +265 -0
- package/dist/utils.js +245 -0
- package/dist/utils.js.map +1 -0
- package/package.json +24 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-PU_xBoDn.js","sources":["../../src/constants/ansi.const.ts","../../src/features/logging/ansi.ts","../../src/features/logging/inspect.ts","../../src/features/logging/logger.ts"],"sourcesContent":["// Reference: https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b\n/**\n * ANSI escape codes.\n * \n * @see [ANSI escape code - Wikipedia](https://en.wikipedia.org/wiki/ANSI_escape_code).\n */\nexport const ANSI = {\n\t/**\n\t * Foreground colors.\n\t */\n\tfg: {\n\t\tblack: \"\\u001b[30m\",\n\t\tred: \"\\u001b[31m\",\n\t\tgreen: \"\\u001b[32m\",\n\t\tyellow: \"\\u001b[33m\",\n\t\tblue: \"\\u001b[34m\",\n\t\tmagenta: \"\\u001b[35m\",\n\t\tcyan: \"\\u001b[36m\",\n\t\twhite: \"\\u001b[37m\",\n\t},\n\t/**\n\t * Background colors.\n\t */\n\tbg: {\n\t\tblack: \"\\u001b[40m\",\n\t\tred: \"\\u001b[41m\",\n\t\tgreen: \"\\u001b[42m\",\n\t\tyellow: \"\\u001b[43m\",\n\t\tblue: \"\\u001b[44m\",\n\t\tmagenta: \"\\u001b[45m\",\n\t\tcyan: \"\\u001b[46m\",\n\t\twhite: \"\\u001b[47m\",\n\t},\n\t/**\n\t * Screen buffer and clearing controls.\n\t */\n\tscreen: {\n\t\tenterAltBuffer: \"\\u001b[?1049h\",\n\t\texitAltBuffer: \"\\u001b[?1049l\",\n\t\tclear: \"\\u001b[2J\",\n\t\tclearLine: \"\\u001b[2K\",\n\t\thome: \"\\u001b[H\",\n\t},\n\t/**\n\t * Cursor controls.\n\t */\n\tcursor: {\n\t\t/** Changes the position of the cursor. */\n\t\tposition: (row: number, column: number) => `\\x1b[${row};${column}H`,\n\t\thide: \"\\u001b[?25l\",\n\t\tshow: \"\\u001b[?25h\",\n\t\tsave: \"\\u001b[s\",\n\t\trestore: \"\\u001b[u\",\n\t},\n\t/**\n\t * Terminal input.\n\t */\n\tinput: {\n\t\t/** Move cursor up. */\n\t\tarrowUp: \"\\u001b[A\",\n\t\t/** Move cursor down. */\n\t\tarrowDown: \"\\u001b[B\",\n\t\t/** Move cursor right. */\n\t\tarrowRight: \"\\u001b[C\",\n\t\t/** Move cursor left. */\n\t\tarrowLeft: \"\\u001b[D\",\n\t\thorizontalTab: \"\\t\",\n\t\tlineFeed: \"\\n\",\n\t\tverticalTab: \"\\v\",\n\t\tformFeed: \"\\f\",\n\t\tcarriageReturn: \"\\r\",\n\t\tbackspace: \"\\b\",\n\t\tdelete: \"\\x7f\",\n\t\tescape: \"\\u001b\",\n\t\tpageUp: \"\\u001b[5~\",\n\t\tpageDown: \"\\u001b[6~\",\n\t\tctrlA: \"\\u0001\",\n\t\tctrlB: \"\\u0002\",\n\t\tctrlC: \"\\u0003\",\n\t\tctrlD: \"\\u0004\",\n\t\tctrlE: \"\\u0005\",\n\t\tctrlF: \"\\u0006\",\n\t\tctrlG: \"\\u0007\",\n\t\tctrlH: \"\\u0008\",\n\t\tctrlI: \"\\u0009\",\n\t\tctrlJ: \"\\u000a\",\n\t\tctrlK: \"\\u000b\",\n\t\tctrlL: \"\\u000c\",\n\t\tctrlM: \"\\u000d\",\n\t\tctrlN: \"\\u000e\",\n\t\tctrlO: \"\\u000f\",\n\t\tctrlP: \"\\u0010\",\n\t\tctrlQ: \"\\u0011\",\n\t\tctrlR: \"\\u0012\",\n\t\tctrlS: \"\\u0013\",\n\t\tctrlT: \"\\u0014\",\n\t\tctrlU: \"\\u0015\",\n\t\tctrlV: \"\\u0016\",\n\t\tctrlW: \"\\u0017\",\n\t\tctrlX: \"\\u0018\",\n\t\tctrlY: \"\\u0019\",\n\t\tctrlZ: \"\\u001a\",\n\t},\n\t/**\n\t * Decorations.\n\t */\n\tdecoration: {\n\t\tdim: \"\\u001b[2m\",\n\t\tbold: \"\\u001b[1m\",\n\t\titalic: \"\\u001b[3m\",\n\t\tunderline: \"\\u001b[4m\",\n\t\tblink: \"\\u001b[5m\",\n\t\tinvert: \"\\u001b[7m\",\n\t\tstrike: \"\\u001b[9m\",\n\t},\n\treset: \"\\u001b[0m\",\n} as const;","import { ANSI } from \"../../constants\";\n\n/**\n * Provides utility functions for wrapping text in ANSI escape codes.\n * \n * @see {@link ANSI}\n * @hideconstructor\n */\nexport class Ansi {\n\n\t/**\n\t * Makes text black using {@link ANSI.fg.black}.\n\t */\n\tstatic black(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.black);\n\t}\n\n\t/**\n\t * Makes text red using {@link ANSI.fg.red}.\n\t */\n\tstatic red(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.red);\n\t}\n\n\t/**\n\t * Makes text green using {@link ANSI.fg.green}.\n\t */\n\tstatic green(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.green);\n\t}\n\n\t/**\n\t * Makes text yellow using {@link ANSI.fg.yellow}.\n\t */\n\tstatic yellow(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.yellow);\n\t}\n\n\t/**\n\t * Makes text blue using {@link ANSI.fg.blue}.\n\t */\n\tstatic blue(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.blue);\n\t}\n\n\t/**\n\t * Makes text magenta using {@link ANSI.fg.magenta}.\n\t */\n\tstatic magenta(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.magenta);\n\t}\n\n\t/**\n\t * Makes text cyan using {@link ANSI.fg.cyan}.\n\t */\n\tstatic cyan(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.cyan);\n\t}\n\n\t/**\n\t * Makes text white using {@link ANSI.fg.white}.\n\t */\n\tstatic white(text: string) {\n\t\treturn Ansi.apply(text, ANSI.fg.white);\n\t}\n\n\t/**\n\t * Sets background to black using {@link ANSI.bg.black}.\n\t */\n\tstatic blackBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.black);\n\t}\n\n\t/**\n\t * Sets background to red using {@link ANSI.bg.red}.\n\t */\n\tstatic redBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.red);\n\t}\n\n\t/**\n\t * Sets background to green using {@link ANSI.bg.green}.\n\t */\n\tstatic greenBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.green);\n\t}\n\n\t/**\n\t * Sets background to yellow using {@link ANSI.bg.yellow}.\n\t */\n\tstatic yellowBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.yellow);\n\t}\n\n\t/**\n\t * Sets background to blue using {@link ANSI.bg.blue}.\n\t */\n\tstatic blueBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.blue);\n\t}\n\n\t/**\n\t * Sets background to magenta using {@link ANSI.bg.magenta}.\n\t */\n\tstatic magentaBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.magenta);\n\t}\n\n\t/**\n\t * Sets background to cyan using {@link ANSI.bg.cyan}.\n\t */\n\tstatic cyanBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.cyan);\n\t}\n\n\t/**\n\t * Sets background to white using {@link ANSI.bg.white}.\n\t */\n\tstatic whiteBackground(text: string) {\n\t\treturn Ansi.apply(text, ANSI.bg.white);\n\t}\n\n\t/**\n\t * Makes text bold using {@link ANSI.decoration.bold}.\n\t */\n\tstatic bold(text: string) {\n\t\treturn Ansi.apply(text, ANSI.decoration.bold);\n\t}\n\n\t/**\n\t * Makes text dim using {@link ANSI.decoration.dim}.\n\t */\n\tstatic dim(text: string) {\n\t\treturn Ansi.apply(text, ANSI.decoration.dim);\n\t}\n\n\t/**\n\t * Makes text italic using {@link ANSI.decoration.italic}.\n\t */\n\tstatic italic(text: string) {\n\t\treturn Ansi.apply(text, ANSI.decoration.italic);\n\t}\n\n\t/**\n\t * Underlines text using {@link ANSI.decoration.underline}.\n\t */\n\tstatic underline(text: string) {\n\t\treturn Ansi.apply(text, ANSI.decoration.underline);\n\t}\n\n\t/**\n\t * Inverts foreground and background colors using {@link ANSI.decoration.invert}.\n\t */\n\tstatic invert(text: string) {\n\t\treturn Ansi.apply(text, ANSI.decoration.invert);\n\t}\n\n\t/**\n\t * Makes text strike through using {@link ANSI.decoration.strike}.\n\t */\n\tstatic strike(text: string) {\n\t\treturn Ansi.apply(text, ANSI.decoration.strike);\n\t}\n\n\tstatic apply(text: string, code: string) {\n\t\ttext = text.replaceAll(ANSI.reset, ANSI.reset + code);\n\t\treturn code + text + ANSI.reset;\n\t}\n\n\t/**\n\t * Removes all ANSI escape sequences.\n\t */\n\tstatic strip(text: string) {\n\t\t// eslint-disable-next-line no-control-regex\n\t\treturn text.replace(/\\u001b\\[[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, \"\");\n\t}\n\n\t/**\n\t * Removes ANSI escape sequences for colors and background colors (SGR).\n\t */\n\tstatic stripColors(text: string) {\n\t\t// eslint-disable-next-line no-control-regex\n\t\treturn text.replace(/\\u001b\\[[0-9;]*m/g, \"\");\n\t}\n}","import { ANSI } from \"../../constants\";\nimport { Ansi } from \"./ansi\";\nimport { isObject, mergeDeep } from \"../_utils\";\n\nconst CONTEXT = Symbol(\"inspectionContext\");\nconst REACT_ELEMENT = Symbol.for(\"react.element\");\nconst REACT_FRAGMENT = Symbol.for(\"react.fragment\");\n\n/**\n * A plugin for the inspection utilities.\n * \n * Can be used to extend, override or configure the inspection process.\n * Hook methods are called at different stages of the process and can seamlessly interact with it.\n * \n * This is heavily inspired by [Vite's plugin API](https://vite.dev/guide/api-plugin) and follows a similar pattern.\n * \n * @see {@link inspect}\n */\nexport interface InspectionPlugin {\n\t/** The name of this plugin. */\n\tname: string,\n\t/**\n\t * A hook that configures the inspection options before any values are inspected.\n\t * @param options - The current inspection options.\n\t */\n\tconfig?: (options: ResolvedInspectionOptions) => void;\n\t/**\n\t * A hook that is called before a value is inspected.\n\t * @param input - The input value.\n\t * @param context - The inspection context.\n\t */\n\tfirst?: (input: unknown, context: ResolvedInspectionOptions) => string | undefined;\n\t/**\n\t * A hook that is called if a value could not be inspected.\n\t * @param input - The input value.\n\t * @param context - The inspection context.\n\t */\n\tfallback?: (input: unknown, context: ResolvedInspectionOptions) => string | undefined;\n\t// transform?: (input: string, context: ResolvedInspectionOptions & { value: unknown }) => string | undefined;\n}\n\n/**\n * Configuration options for the inspection utilities.\n * @see {@link inspect}\n */\nexport interface InspectionOptions {\n\t/**\n\t * The maximum depth for representations of container values (e.g., objects, arrays).\n\t * @default 2\n\t */\n\tdepth?: number;\n\t/**\n\t * The maximum number of array elements to represent before truncating.\n\t * @default 100\n\t */\n\tmaxArrayLength?: number;\n\t/**\n\t * The maximum amount of characters of a string to represent, before replacing the remainder with an ellipsis.\n\t * @default 80\n\t */\n\tmaxStringLength?: number;\n\t/**\n\t * The maximum line length before wrapping to a new line.\n\t * \n\t * This option is ignored when {@link compact} is set to `true`.\n\t * @default 60\n\t */\n\tbreakLength?: number;\n\t/**\n\t * `true` keeps container values on a single line when possible.\n\t * @default true\n\t */\n\tcompact?: boolean;\n\t/**\n\t * `true` enables the sorting of keys in object representations.\n\t * @default false\n\t */\n\tsortKeys?: boolean;\n\t/**\n\t * `true` uses single quotes instead of double quotes.\n\t * @default false\n\t */\n\tsingleQuotes?: boolean;\n\t/**\n\t * `true` places a space after every comma.\n\t * @default true\n\t */\n\tspaceAfterComma?: boolean;\n\t/**\n\t * Plugins to extend, override or configure the inspection process.\n\t */\n\tplugins?: InspectionPlugin[];\n\t/**\n\t * The {@link ANSI} color codes for different symbols.\n\t * \n\t * Set to `false` to disable ANSI colors.\n\t */\n\tcolors?: false | {\n\t\t/**\n\t\t * The color to apply to strings.\n\t\t * @default ANSI.fg.green\n\t\t */\n\t\tstring?: string | null;\n\t\t/**\n\t\t * The color to apply to numbers.\n\t\t * @default ANSI.fg.yellow\n\t\t */\n\t\tnumber?: string | null;\n\t\t/**\n\t\t * The color to apply to booleans.\n\t\t * @default ANSI.fg.yellow\n\t\t */\n\t\tboolean?: string | null;\n\t\t/**\n\t\t * The color to apply to `null` keywords.\n\t\t * @default ANSI.decoration.dim + ANSI.fg.yellow\n\t\t */\n\t\tnull?: string | null;\n\t\t/**\n\t\t * The color to apply to `undefined` keywords.\n\t\t * @default ANSI.decoration.dim + ANSI.fg.yellow\n\t\t */\n\t\tundefined?: string | null;\n\t\t/**\n\t\t * The color to apply to bigints.\n\t\t * @default ANSI.fg.yellow\n\t\t */\n\t\tbigint?: string | null;\n\t\t/**\n\t\t * The color to apply to symbols.\n\t\t * @default ANSI.fg.green\n\t\t */\n\t\tsymbol?: string | null;\n\t\t/**\n\t\t * The color to apply to functions.\n\t\t * @default ANSI.fg.blue\n\t\t */\n\t\tfunction?: string | null;\n\t\t/**\n\t\t * The color to apply to keys.\n\t\t * @default ANSI.fg.white\n\t\t */\n\t\tkey?: string | null;\n\t\t/**\n\t\t * The color to apply to dates.\n\t\t * @default ANSI.fg.magenta\n\t\t */\n\t\tdate?: string | null;\n\t\t/**\n\t\t * The color to apply to {@link RegExp}s.\n\t\t * @default ANSI.fg.cyan\n\t\t */\n\t\tregExp?: string | null;\n\t\t/**\n\t\t * The color to apply to errors.\n\t\t * @default ANSI.fg.red\n\t\t */\n\t\terror?: string | null;\n\t\t/**\n\t\t * The color to apply to HTML tags.\n\t\t * @default ANSI.fg.red\n\t\t */\n\t\thtmlTag?: string | null;\n\t\t/**\n\t\t * The color to apply to React components.\n\t\t * @default ANSI.fg.yellow\n\t\t */\n\t\treactComponent?: string | null;\n\t\t/**\n\t\t * The color to apply to delimiters.\n\t\t * @default ANSI.fg.cyan\n\t\t */\n\t\tdelimiter?: string | null;\n\t};\n}\n\n/**\n * The resolved inspection options combined with some utility functions for generating string representations.\n * \n * Used internally by the inspection utilities and {@link InspectionPlugin}s.\n * @see {@link inspect}\n */\nexport interface ResolvedInspectionOptions extends Required<InspectionOptions> {\n\t/**\n\t * Returns a formatted delimiter string.\n\t * @param delimiter - The raw delimiter.\n\t */\n\tdelimiter: (delimiter: string) => string;\n\t/** Returns a formatted separator string. */\n\tseparator: () => string;\n\t/**\n\t * Applies color to the given string, if {@link ResolvedInspectionOptions.colors} is `true`.\n\t * @param text - The raw text.\n\t * @param colorCode - The ANSI color code to apply.\n\t */\n\tcolor: (text: string, colorCode: string | undefined | null) => string;\n\t/**\n\t * Applies the appropriate formatting to the given token.\n\t * @param token - The raw token.\n\t * @param type - The type of token.\n\t */\n\ttoken: (token: string, type?: keyof Exclude<InspectionOptions[\"colors\"], false | undefined>) => string;\n\t/** Creates a new inspection context and increments the current depth. */\n\tfork: () => ResolvedInspectionOptions;\n}\n\ninterface InspectionContext extends ResolvedInspectionOptions {\n\t[CONTEXT]: true;\n\tcurrentDepth: number;\n\tseen: WeakSet<object>;\n\tfork: () => InspectionContext;\n}\n\nexport interface ReactElementLike {\n\ttype: unknown;\n\tprops?: unknown;\n\tkey?: string | null;\n}\n\nconst DEFAULT_OPTIONS: Required<InspectionOptions> = {\n\tdepth: 2,\n\tmaxArrayLength: 100,\n\tmaxStringLength: 80,\n\tbreakLength: 60,\n\tcompact: true,\n\tsortKeys: false,\n\tsingleQuotes: false,\n\tspaceAfterComma: true,\n\tplugins: [],\n\tcolors: {\n\t\tstring: ANSI.fg.green,\n\t\tnumber: ANSI.fg.yellow,\n\t\tboolean: ANSI.fg.yellow,\n\t\tnull: ANSI.decoration.dim + ANSI.fg.yellow,\n\t\tundefined: ANSI.decoration.dim + ANSI.fg.yellow,\n\t\tbigint: ANSI.fg.yellow,\n\t\tsymbol: ANSI.fg.green,\n\t\tfunction: ANSI.fg.blue,\n\t\tkey: ANSI.fg.white,\n\t\tdate: ANSI.fg.magenta,\n\t\tregExp: ANSI.fg.cyan,\n\t\terror: ANSI.fg.red,\n\t\thtmlTag: ANSI.fg.red,\n\t\treactComponent: ANSI.fg.yellow,\n\t\tdelimiter: ANSI.fg.cyan,\n\t},\n};\n\n/**\n * Generates a human-readable string representation of a value.\n * \n * This is intended for debugging purposes. \n * It is an alternative to {@link https://nodejs.org/api/util.html#utilinspectobject-options util.inspect}, that supports more customization of the output.\n * \n * @param value - The value to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n * @example\n * **Note:** The following examples omit the `options` parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set `colors` to `false`.\n * ```tsx\n * // Supports primitive values.\n * inspect(null) === \"null\"\n * inspect(\"example\") === \"\\\"example\\\"\"\n * \n * // Supports objects and arrays (and other containers).\n * inspect({ size: 2, values: [true, false] }) === \"{ size: 2, values: [true, false] }\"\n * \n * // Even supports React nodes.\n * inspect(<h1>Example</h1>) === \"<h1>Example</h1>\"\n * ```\n */\nexport function inspect(value: unknown, options?: InspectionOptions): string {\n\tconst context = resolveContext(value, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tif (value === null)\n\t\treturn context.token(\"null\", \"null\");\n\tif (value === undefined)\n\t\treturn context.token(\"undefined\", \"undefined\");\n\tif (typeof value === \"boolean\")\n\t\treturn context.token(String(value), \"boolean\");\n\tif (typeof value === \"number\") {\n\t\tlet string: string;\n\t\tif (Number.isNaN(value)) {\n\t\t\tstring = \"NaN\";\n\t\t} else if (!Number.isFinite(value)) {\n\t\t\tstring = value > 0 ? \"Infinity\" : \"-Infinity\";\n\t\t} else {\n\t\t\tstring = String(value);\n\t\t}\n\t\treturn context.token(string, \"number\");\n\t}\n\tif (typeof value === \"bigint\")\n\t\treturn context.token(value + \"n\", \"bigint\");\n\tif (typeof value === \"string\")\n\t\treturn inspectString(value, context);\n\tif (typeof value === \"symbol\")\n\t\treturn context.token(value.toString(), \"symbol\");\n\tif (typeof value === \"function\")\n\t\treturn inspectFunction(value, context);\n\tif (isReactElement(value))\n\t\treturn inspectReactElement(value, context);\n\tif (Array.isArray(value))\n\t\treturn inspectArray(value, context);\n\tif (value instanceof Date)\n\t\treturn context.token(value.toISOString(), \"date\");\n\tif (value instanceof RegExp)\n\t\treturn context.token(value.toString(), \"regExp\");\n\tif (value instanceof Error)\n\t\treturn inspectError(value, context);\n\tif (value instanceof Map)\n\t\treturn inspectMap(value, context);\n\tif (value instanceof Set)\n\t\treturn inspectSet(value, context);\n\tif (value instanceof Promise)\n\t\treturn context.token(\"Promise { <pending> }\", \"function\");\n\tif (isObject(value))\n\t\treturn inspectObject(value, context);\n\n\tfor (const plugin of context.plugins) {\n\t\tif (plugin.fallback) {\n\t\t\tconst result = plugin.fallback(value, context);\n\t\t\tif (result !== undefined)\n\t\t\t\treturn result;\n\t\t}\n\t}\n\n\treturn Object.prototype.toString.call(value);\n}\n\n/**\n * Returns a string representation of a function call, its arguments and its return value.\n * @param func - The function to inspect.\n * @param args - The arguments of the function call.\n * @param returnValue - The return value of the function call.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n */\nexport function inspectFunctionCall<A extends unknown[] = [], R = undefined>(func: (...args: A) => R, args: A, returnValue: R, options?: InspectionOptions): string {\n\tconst context = resolveContext(func, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst inspectedName = context.token(func.name || \"(anonymous)\", \"function\");\n\tconst inspectedArgs = args.map((arg) => inspect(arg, context.fork())).join(context.separator());\n\tconst inspectedReturnValue = inspect(returnValue, context.fork());\n\tconst arrow = context.colors ? Ansi.dim(\"→\") : \"→\";\n\treturn `${inspectedName}(${inspectedArgs}) ${arrow} ${inspectedReturnValue}`;\n}\n\n/**\n * Returns a string representation of a React element.\n * @param element - The React element to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n * @example\n * **Note:** The following example omits the `options` parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set `colors` to `false`.\n * ```tsx\n * inspect(<h1>Example</h1>) === \"<h1>Example</h1>\"\n * ```\n */\nexport function inspectReactElement(element: ReactElementLike, options?: InspectionOptions): string {\n\tconst context = resolveContext(element, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tlet name: string;\n\tlet isFragment = false;\n\tif (typeof element.type === \"string\") {\n\t\tname = context.token(element.type, \"htmlTag\");\n\t} else if (element.type === REACT_FRAGMENT) {\n\t\tname = \"\";\n\t\tisFragment = true;\n\t} else {\n\t\tif (isObject(element.type) || typeof element.type === \"function\") {\n\t\t\tlet componentName = element.type.name;\n\t\t\tif (\"displayName\" in element.type && element.type.displayName)\n\t\t\t\tcomponentName = element.type.displayName;\n\t\t\tname = String(componentName);\n\t\t} else {\n\t\t\tname = String(element.type);\n\t\t}\n\t\tname = context.token(name, \"reactComponent\");\n\t}\n\n\tconst props: string[] = [];\n\tlet children: string[] = [];\n\n\tif (element.props && isObject(element.props)) {\n\t\tconst keys = Object.keys(element.props);\n\t\tif (context.sortKeys)\n\t\t\tkeys.sort();\n\n\t\tfor (const key of keys) {\n\t\t\tconst value = element.props[key];\n\t\t\tif (key === \"children\") {\n\t\t\t\tconst childArray = Array.isArray(value) ? value : [value];\n\t\t\t\tchildren = childArray.map((child) => inspectReactElementChild(child, context));\n\t\t\t} else {\n\t\t\t\tprops.push(inspectReactElementProp(key, value, context));\n\t\t\t}\n\t\t}\n\t}\n\n\tconst open = context.delimiter(\"<\");\n\tconst close = context.delimiter(\">\");\n\tconst slash = context.delimiter(\"/\");\n\tconst inspectedProps = props.length ? \" \" + props.join(\" \") : \"\";\n\t\n\treturn children.length || isFragment\n\t\t? `${open}${name}${inspectedProps}${close}${children.join(\"\")}${open}${slash}${name}${close}`\n\t\t: `${open}${name}${inspectedProps}${slash}${close}`;\n}\n\nfunction inspectReactElementChild(child: unknown, context: InspectionContext) {\n\tif (child == null || typeof child === \"boolean\")\n\t\treturn \"\";\n\n\tif (typeof child === \"string\")\n\t\treturn child;\n\n\tif (typeof child === \"number\")\n\t\treturn child.toString();\n\n\treturn isReactElement(child) ? inspectReactElement(child, context.fork()) : \"\";\n}\n\nfunction inspectReactElementProp(key: string, value: unknown, context: InspectionContext) {\n\tconst coloredKey = context.token(key, \"key\");\n\treturn `${coloredKey}={${inspect(value, context.fork())}}`;\n}\n\n/**\n * Generates a literal string representation of a string.\n * @param string - The string to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n * @example\n * **Note:** The following examples omit or shorten the `options` parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set `colors` to `false`.\n * ```ts\n * inspect(\"Example\") === \"\\\"Example\\\"\"\n * inspect(\"Example\", { singleQuotes: true }) === \"'Example'\"\n * ```\n */\nexport function inspectString(string: string, options?: InspectionOptions): string {\n\tconst context = resolveContext(string, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst needsTruncation = string.length > context.maxStringLength;\n\tconst truncated = needsTruncation ? string.slice(0, context.maxStringLength) : string;\n\n\tlet escaped = JSON.stringify(truncated);\n\tif (context.singleQuotes)\n\t\tescaped = escaped.replace(/\\\\\"/g, \"\\\"\").replace(/'/g, \"\\\\'\");\n\n\tconst inner = context.token(escaped.slice(1, -1), \"string\");\n\tconst quote = context.delimiter(context.singleQuotes ? \"'\" : \"\\\"\");\n\tconst outer = quote + inner + quote;\n\treturn needsTruncation ? outer + context.token(\"...\", \"null\") : outer;\n}\n\n/**\n * Returns a string representation of a function.\n * @param func - The function to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport function inspectFunction(func: Function, options?: InspectionOptions): string {\n\tconst context = resolveContext(func, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst name = func.name || \"(anonymous)\";\n\treturn context.token(`[Function: ${name}]`, \"function\");\n}\n\n/**\n * Returns a string representation of an array.\n * @param array - The array to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n * @example\n * **Note:** The following examples omit or shorten the `options` parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set `colors` to `false`.\n * ```ts\n * inspect([1, 2, 3]) === \"[1, 2, 3]\"\n * inspect([1, 2, 3], { spaceAfterComma: false }) === \"[1,2,3]\"\n * ```\n */\nexport function inspectArray(array: unknown[], options?: InspectionOptions): string {\n\tconst context = resolveContext(array, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst guarded = guard(array, context, `[Array(${array.length})]`);\n\tif (guarded !== null)\n\t\treturn guarded;\n\n\tconst items: string[] = [];\n\tconst length = Math.min(array.length, context.maxArrayLength);\n\n\tfor (let i = 0; i < length; i++) {\n\t\titems.push(inspect(array[i], context.fork()));\n\t}\n\n\tif (array.length > context.maxArrayLength) {\n\t\tconst remaining = array.length - context.maxArrayLength;\n\t\titems.push(context.token(`... ${remaining} more item${remaining !== 1 ? \"s\" : \"\"}`, \"null\"));\n\t}\n\n\treturn formatInline(items, context, \"[\", \"]\");\n}\n\n/**\n * Returns a string representation of an object.\n * @param object - The object to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n * @example\n * **Note:** The following example omits the `options` parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set `colors` to `false`.\n * ```ts\n * inspect({ first: true, second: false }) === \"{ first: true, second: false }\"\n * ```\n */\nexport function inspectObject(object: Record<PropertyKey, unknown>, options?: InspectionOptions): string {\n\tconst context = resolveContext(object, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst guarded = guard(object, context, \"[Object]\");\n\tif (guarded !== null)\n\t\treturn guarded;\n\n\tlet keys = Object.keys(object);\n\tif (context.sortKeys)\n\t\tkeys = keys.sort();\n\n\tif (!keys.length)\n\t\treturn context.delimiter(\"{}\");\n\n\tconst entries = keys.map((key) => {\n\t\tconst inspectedKey = context.token(key, \"key\");\n\t\tconst inspectedValue = inspect(object[key], context.fork());\n\t\treturn `${inspectedKey}${context.delimiter(\":\")} ${inspectedValue}`;\n\t});\n\n\tconst head = context.delimiter(\"{\") + \" \";\n\tconst tail = \" \" + context.delimiter(\"}\");\n\treturn formatInline(entries, context, head, tail);\n}\n\n/**\n * Returns a string representation of a map.\n * @param map - The map to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n */\nexport function inspectMap(map: Map<unknown, unknown>, options?: InspectionOptions): string {\n\tconst context = resolveContext(map, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst guarded = guard(map, context, `Map(${map.size})`);\n\tif (guarded !== null)\n\t\treturn guarded;\n\n\tif (map.size === 0)\n\t\treturn \"Map(0) {}\";\n\n\tconst entries: string[] = [];\n\tfor (const [key, value] of map) {\n\t\tconst fork = context.fork();\n\t\tentries.push(`${inspect(key, fork)} => ${inspect(value, fork)}`);\n\t}\n\n\treturn formatInline(entries, context, `Map(${map.size}) { `, \" }\");\n}\n\n/**\n * Returns a string representation of a set.\n * @param set - The set to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n */\nexport function inspectSet(set: Set<unknown>, options?: InspectionOptions): string {\n\tconst context = resolveContext(set, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst guarded = guard(set, context, `Set(${set.size})`);\n\tif (guarded !== null)\n\t\treturn guarded;\n\n\tif (set.size === 0)\n\t\treturn \"Set(0) {}\";\n\n\tconst items: string[] = [];\n\tfor (const item of set) {\n\t\titems.push(inspect(item, context.fork()));\n\t}\n\n\treturn formatInline(items, context, `Set(${set.size}) { `, \" }\");\n}\n\n/**\n * Returns a string representation of an error.\n * @param error - The error to inspect.\n * @param options - Optional inspection options.\n * @returns The resulting string.\n */\nexport function inspectError(error: Error, options?: InspectionOptions): string {\n\tconst context = resolveContext(error, options);\n\tif (typeof context === \"string\")\n\t\treturn context;\n\n\tconst name = error.name || \"Error\";\n\treturn context.token(error.message ? `${name}: ${error.message}` : name, \"error\");\n}\n\n\nfunction guard(object: object, context: InspectionContext, label: string): string | null {\n\tif (context.seen.has(object))\n\t\treturn context.token(\"[Circular]\", \"null\");\n\tif (context.currentDepth > context.depth)\n\t\treturn context.token(label, \"null\");\n\tcontext.seen.add(object);\n\treturn null;\n}\n\nfunction formatInline(items: string[], context: InspectionContext, head: string, tail: string): string {\n\tconst inline = `${head}${items.join(context.separator())}${tail}`;\n\tif (!context.compact && Ansi.strip(inline).length > context.breakLength) {\n\t\tconst indent = \"\\t\".repeat(context.currentDepth + 1);\n\t\tconst closingIndent = \"\\t\".repeat(context.currentDepth);\n\t\tconst formattedHead = head.replace(/\\s+$/, \"\");\n\t\tconst formattedItems = items.map((item) => `${indent}${item}`).join(\",\\n\");\n\t\tconst formattedTail = tail.replace(/^\\s+/, \"\");\n\t\t\n\t\treturn `${formattedHead}\\n${formattedItems}\\n${closingIndent}${formattedTail}`;\n\t}\n\treturn inline;\n}\n\nfunction resolveContext(value: unknown, options?: InspectionOptions): string | InspectionContext {\n\tlet context: InspectionContext;\n\tif (options && isContext(options)) {\n\t\tcontext = options;\n\t} else {\n\t\tcontext = {\n\t\t\t// TODO: Fix mergeDeep so plugins and colors don't have to be duplicated here\n\t\t\t...options ? mergeDeep(DEFAULT_OPTIONS, { plugins: DEFAULT_OPTIONS.plugins, colors: DEFAULT_OPTIONS.colors, ...options }) : DEFAULT_OPTIONS,\n\t\t\t[CONTEXT]: true,\n\t\t\tcurrentDepth: 0,\n\t\t\tseen: new WeakSet(),\n\t\t\tcolor: (text, colorCode) => context.colors && colorCode ? Ansi.apply(text, colorCode) : text,\n\t\t\ttoken: (token, type) => type !== undefined && context.colors\n\t\t\t\t? context.color(token, context.colors[type])\n\t\t\t\t: token,\n\t\t\tdelimiter: (delimiter) => context.token(delimiter, \"delimiter\"),\n\t\t\tseparator: () => context.spaceAfterComma ? context.delimiter(\",\") + \" \" : context.delimiter(\",\"),\n\t\t\tfork: () => forkContext(context),\n\t\t};\n\n\t\tfor (const plugin of context.plugins) {\n\t\t\tif (plugin.config)\n\t\t\t\tplugin.config(context);\n\t\t}\n\t}\n\t\n\t// TODO: Add every value to the seen map and only run plugins once for every value\n\tfor (const plugin of context.plugins) {\n\t\tif (plugin.first) {\n\t\t\tconst result = plugin.first(value, context);\n\t\t\tif (result !== undefined)\n\t\t\t\treturn result;\n\t\t}\n\t}\n\n\treturn context;\n}\n\nfunction forkContext(context: InspectionContext): InspectionContext {\n\tconst newContext = { ...context, currentDepth: context.currentDepth + 1 };\n\tnewContext.fork = () => forkContext(newContext);\n\treturn newContext;\n}\n\nfunction isContext(options: InspectionOptions): options is InspectionContext {\n\treturn CONTEXT in options;\n}\n\nfunction isReactElement(value: unknown): value is ReactElementLike {\n\treturn isObject(value) && \"$$typeof\" in value && value.$$typeof === REACT_ELEMENT;\n}","import { Ansi } from \"./ansi\";\nimport { inspect, InspectionOptions } from \"./inspect\";\n\n/**\n * Applies a format to a string.\n * @param text - The text to format.\n * @returns The formatted text.\n */\nexport type Formatter = (text: string) => string;\n\nexport enum LogLevel {\n\tDebug,\n\tInfo,\n\tSuccess,\n\tWarning,\n\tError\n};\n\n/**\n * A simple wrapper for {@link console} that logs formatted text and supports log levels.\n */\nexport class Logger {\n\n\t/**\n\t * The minimum log level or an array of log levels to enable.\n\t * \n\t * `undefined` enables all log levels. An array enables all log levels in that array. A single level enables that log level and the ones above.\n\t * @default LogLevel.Debug\n\t */\n\tlevel?: LogLevel | LogLevel[];\n\n\t/**\n\t * The current level of indentation.\n\t * @default 0\n\t */\n\tindent: number = 0;\n\n\t/**\n\t * The string to use for indentation.\n\t * @default \"\\t\"\n\t */\n\tindentString?: string;\n\n\t/**\n\t * The function to use when highlighting text.\n\t * @default Ansi.cyan\n\t * @see {@link Ansi.cyan}\n\t */\n\thighlight: Formatter = Ansi.cyan;\n\n\t/**\n\t * The function to use when emphasizing text.\n\t * @default Ansi.bold\n\t * @see {@link Ansi.bold}\n\t */\n\temphasize: Formatter = Ansi.bold;\n\n\t/**\n\t * The prefixes to prepend to logs.\n\t * @default {\n\t[LogLevel.Info]: Ansi.cyan(\"[info]\"),\n\t[LogLevel.Success]: Ansi.green(\"[success]\"),\n\t[LogLevel.Warning]: Ansi.yellow(\"[warning]\"),\n\t[LogLevel.Error]: Ansi.red(\"[error]\"),\n}\n\t */\n\tprefix: {\n\t\t[key in LogLevel | \"global\"]?: string\n\t} = {};\n\n\t/**\n\t * The function to use to turn values into strings.\n\t * @see {@link createStringifier}\n\t * @default Logger.createStringifier(\"pretty\")\n\t */\n\tstringify: (value: unknown) => string = Logger.createStringifier(\"pretty\");\n\n\t#errorCount = 0;\n\t#warningCount = 0;\n\n\tget errorCount(): number {\n\t\treturn this.#errorCount;\n\t}\n\n\tset errorCount(value: number) {\n\t\tthis.#errorCount = value;\n\t}\n\n\tget warningCount(): number {\n\t\treturn this.#warningCount;\n\t}\n\n\tset warningCount(value: number) {\n\t\tthis.#warningCount = value;\n\t}\n\n\tconstructor(options?: {\n\t\t/** {@inheritDoc Logger.level}. */\n\t\tlevel?: Logger[\"level\"],\n\t\t/** \n\t\t * The prefix(es) to prepend to logs.\n\t\t * \n\t\t * Does not override default prefixes unless specified.\n\t\t*/\n\t\tprefix?: Logger[\"prefix\"] | string\n\t})\n\t/**\n\t * @param level - The minimum log level.\n\t */\n\tconstructor(level: LogLevel)\n\t/**\n\t * @param levels - The log levels to enable.\n\t */\n\tconstructor(levels: LogLevel[])\n\tconstructor(options?: LogLevel | LogLevel[] | { level?: Logger[\"level\"], prefix?: Logger[\"prefix\"] | string }) {\n\t\tthis.reset();\n\n\t\tif (options === undefined)\n\t\t\treturn;\n\n\t\tif (Array.isArray(options) || typeof options === \"number\") {\n\t\t\tthis.level = options;\n\t\t} else {\n\t\t\tif (options.level !== undefined)\n\t\t\t\tthis.level = options.level;\n\t\t\tif (options.prefix) {\n\t\t\t\tif (typeof options.prefix === \"string\") {\n\t\t\t\t\tthis.prefix.global = options.prefix;\n\t\t\t\t} else {\n\t\t\t\t\tthis.prefix = {\n\t\t\t\t\t\t...this.prefix,\n\t\t\t\t\t\t...options.prefix,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// ===== Modifying state =====\n\n\t/**\n\t * Resets all properties to their default values.\n\t */\n\treset(): this {\n\t\tthis.level = LogLevel.Debug;\n\n\t\tthis.indent = 0;\n\t\tthis.indentString = \"\\t\";\n\n\t\tthis.highlight = Ansi.cyan;\n\t\tthis.emphasize = Ansi.bold;\n\n\t\tthis.prefix = {\n\t\t\t[LogLevel.Info]: Ansi.cyan(\"[info]\"),\n\t\t\t[LogLevel.Success]: Ansi.green(\"[success]\"),\n\t\t\t[LogLevel.Warning]: Ansi.yellow(\"[warning]\"),\n\t\t\t[LogLevel.Error]: Ansi.red(\"[error]\"),\n\t\t};\n\n\t\tthis.#errorCount = 0;\n\t\tthis.#warningCount = 0;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Calls a function while the level of indentation is increased.\n\t * \n\t * Increases the level of indentation, then calls the function and finally restores the indentation.\n\t * @param callback - The function to call.\n\t * @param indentation - The amount of indentation to use.\n\t */\n\tindented(callback: (this: undefined) => void, indentation?: number): this\n\t/**\n\t * Logs every line while the level of indentation is increased.\n\t * \n\t * Increases the level of indentation, then logs every line and finally restores the indentation.\n\t * @param lines - The lines to log.\n\t * @param indentation - The amount of indentation to use.\n\t * @param level - The log level.\n\t */\n\tindented(lines: unknown[], indentation?: number, level?: LogLevel): this\n\t/**\n\t * Logs a message while the level of indentation is increased.\n\t * \n\t * Increases the level of indentation, then logs the message and finally restores the indentation.\n\t * @param message - The message to log.\n\t * @param indentation - The amount of indentation to use.\n\t * @param level - The log level.\n\t */\n\tindented(message: unknown, indentation?: number, level?: LogLevel): this\n\tindented(callbackOrMessage: unknown, indentation = 1, level?: LogLevel): this {\n\t\tif (level !== undefined && !this.isLevelEnabled(level))\n\t\t\treturn this;\n\n\t\t// Avoid side effects of negative indentation \n\t\tif (this.indent + indentation < 0)\n\t\t\tindentation = -this.indent;\n\n\t\tthis.tab(indentation);\n\t\tif (typeof callbackOrMessage === \"function\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\tcallbackOrMessage();\n\t\t} else if (Array.isArray(callbackOrMessage)) {\n\t\t\tthis.lines(callbackOrMessage, level);\n\t\t} else {\n\t\t\tthis.log(callbackOrMessage, level);\n\t\t}\n\t\tthis.shiftTab(indentation);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Increases the level of indentation.\n\t * @param amount - The amount to increase the level of indentation with.\n\t */\n\ttab(amount = 1): this {\n\t\tthis.indent += amount;\n\t\tif (this.indent < 0) this.indent = 0;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Decreases the level of indentation.\n\t * @param amount - The amount to decrease the level of indentation with.\n\t */\n\tshiftTab(amount = 1): this {\n\t\tthis.indent -= amount;\n\t\tif (this.indent < 0) this.indent = 0;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the prefix to prepend to all logs.\n\t * @param prefix - The prefix to use.\n\t */\n\tsetPrefix(prefix: string): this\n\t/**\n\t * Sets the prefixes to prepend to logs.\n\t * \n\t * Will override any existing prefixes.\n\t * @param prefixes - The prefixes to use.\n\t */\n\tsetPrefix(prefixes: Logger[\"prefix\"]): this\n\t/**\n\t * Sets the prefix to prepend to logs at a given log level.\n\t * @param level - The log level.\n\t * @param prefix - The prefix to use.\n\t */\n\tsetPrefix(level: LogLevel, prefix: string): this\n\tsetPrefix(prefixOrLevel: Logger[\"prefix\"] | string | LogLevel, prefix?: string): this {\n\t\tif (typeof prefixOrLevel === \"string\") {\n\t\t\tthis.prefix = {\n\t\t\t\tglobal: prefixOrLevel,\n\t\t\t};\n\t\t} else if (typeof prefixOrLevel === \"object\") {\n\t\t\tthis.prefix = prefixOrLevel;\t\t\t\n\t\t} else {\n\t\t\tthis.prefix[prefixOrLevel] = prefix;\n\t\t}\n\t\treturn this;\n\t}\n\n\t// ===== Logging status messages =====\n\n\t/**\n\t * Logs an info message about a URL being fetched.\n\t * @param url - The URL being fetched.\n\t */\n\tfetching(url: string): this {\n\t\treturn this.pending(`Fetching: ${this.highlight(url)}`);\n\t}\n\n\t/**\n\t * Logs an info message that implies a pending state.\n\t * @param message - The status message.\n\t */\n\tpending(message: string): this {\n\t\treturn this.info(Ansi.yellow(message));\n\t}\n\n\t/**\n\t * Logs an error message.\n\t * @param message - The error message or reason.\n\t * @param details - The details of the error message.\n\t */\n\terror(message: unknown, ...details: unknown[]): this {\n\t\tthis.#errorCount++;\n\t\tif (!this.isLevelEnabled(LogLevel.Error))\n\t\t\treturn this;\n\n\t\tif (typeof message === \"string\") {\n\t\t\tthis.statusMessage(Ansi.red(message), details, LogLevel.Error);\n\t\t} else {\n\t\t\tconsole.error(message, ...details);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Logs a warning message.\n\t * @param message - The warning message.\n\t * @param details - The details of the warning message.\n\t */\n\twarn(message: string, ...details: unknown[]): this {\n\t\tthis.#warningCount++;\n\t\treturn this.statusMessage(Ansi.yellow(message), details, LogLevel.Warning);\n\t}\n\n\t/**\n\t * Logs a success message.\n\t * @param message - The success message.\n\t * @param details - The details of the success message.\n\t */\n\tsuccess(message: string, ...details: unknown[]): this {\n\t\treturn this.statusMessage(Ansi.green(message), details, LogLevel.Success);\n\t}\n\n\t/**\n\t * Logs an info message.\n\t * @param message - The info message.\n\t * @param details - The details of the info message.\n\t */\n\tinfo(message: string, ...details: unknown[]): this {\n\t\treturn this.statusMessage(message, details, LogLevel.Info);\n\t}\n\n\t/**\n\t * Logs a status message.\n\t * @param message - The status message.\n\t * @param details - The details of the status message.\n\t * @param level - The log level.\n\t */\n\tstatusMessage(message: string, details: unknown[], level?: LogLevel): this {\n\t\tlet text = message;\n\n\t\t// Append details on new indented lines below message\n\t\tif (details.length) {\n\t\t\tconst detailsPrefix = this.indentString ? this.indentString.repeat(this.indent + 1) : \"\\t\";\n\t\t\ttext += \"\\n\" + details.map((detail) => detailsPrefix + this.stringify(detail)).join(\"\\n\");\n\t\t}\n\n\t\treturn this.text(text, level);\n\t}\n\n\t/**\n\t * Logs the amount of errors and warnings that have been logged since the previous call to this function or the creation of this logger.\n\t */\n\tsummary(): this {\n\t\tconst errorsText = `${this.#errorCount} error${this.#errorCount != 1 ? \"s\" : \"\"}`;\n\t\tconst warningsText = `${this.#warningCount} warning${this.#warningCount != 1 ? \"s\" : \"\"}`;\n\t\tlet message = `Found ${errorsText} and ${warningsText}`;\n\t\tif (this.#errorCount > 0) {\n\t\t\tmessage = Ansi.red(message);\n\t\t} else if (this.#warningCount > 0) {\n\t\t\tmessage = Ansi.yellow(message);\n\t\t} else {\n\t\t\tmessage = Ansi.green(message);\n\t\t}\n\t\tthis.text(message);\n\t\tthis.#errorCount = 0;\n\t\tthis.#warningCount = 0;\n\t\treturn this;\n\t}\n\n\t// ===== Logging text =====\n\n\t/**\n\t * Logs a labeled parameter.\n\t * \n\t * The value is emphasized using {@link emphasize}.\n\t * @param label - The label of the parameter.\n\t * @param value - The value of the parameter.\n\t * @param level - The log level.\n\t */\n\tparameter(label: string, value: unknown, level?: LogLevel): this {\n\t\treturn this.text(`${label}: ${this.emphasize(this.stringify(value))}`, level);\n\t}\n\n\t/**\n\t * Logs properties as a list of key-value pairs.\n\t * @param properties - The properties to log.\n\t * @param level - The log level.\n\t * @see {@link value()}\n\t */\n\tproperties(properties: Record<string, unknown>, level?: LogLevel): this {\n\t\tfor (const [key, value] of Object.entries(properties)) {\n\t\t\tthis.value(`- ${key}`, value, level);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Logs a labeled value.\n\t * \n\t * The value is highlighted using {@link highlight}.\n\t * @param label - The label of the value.\n\t * @param value - The value.\n\t * @param level - The log level.\n\t */\n\tvalue(label: string, value: unknown, level?: LogLevel): this {\n\t\treturn this.text(`${label}: ${this.highlight(this.stringify(value))}`, level);\n\t}\n\n\t/**\n\t * Logs emphasized text.\n\t * @param text - The text to log.\n\t * @param level - The log level.\n\t */\n\temphasized(text: string, level?: LogLevel): this {\n\t\treturn this.text(this.emphasize(text), level);\n\t}\n\n\t/**\n\t * Logs highlighted text.\n\t * @param text - The text to log.\n\t * @param level - The log level.\n\t */\n\thighlighted(text: string, level?: LogLevel): this {\n\t\treturn this.text(this.highlight(text), level);\n\t}\n\n\t/**\n\t * Logs each item on a new line.\n\t * @param lines - The items to log.\n\t * @param level - The log level.\n\t */\n\tlines(lines: unknown[], level?: LogLevel): this {\n\t\tlines.map(this.stringify.bind(this)).forEach((line) => this.text(line, level));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Logs a message.\n\t * @param message - The message to log.\n\t * @param level - The log level.\n\t */\n\tlog(message: unknown, level?: LogLevel): this {\n\t\treturn this.text(this.stringify(message), level);\n\t}\n\n\t/**\n\t * Logs text using this logger's format.\n\t * @param text - The text to log.\n\t * @param level - The log level.\n\t */\n\ttext(text: string, level: LogLevel = LogLevel.Debug): this {\n\t\tif (!this.isLevelEnabled(level))\n\t\t\treturn this;\n\n\t\tconst message = this.format(this.applyPrefix(text, level));\n\t\tswitch (level) {\n\t\t\tcase LogLevel.Info:\n\t\t\t\tconsole.info(message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel.Warning:\n\t\t\t\tconsole.warn(message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel.Error:\n\t\t\t\tconsole.error(message);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.log(message);\n\t\t\t\tbreak;\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Logs an newline character.\n\t */\n\tnewLine(): this {\n\t\tconsole.log();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Checks if the given log level is enabled.\n\t * @param level - The log level to check.\n\t */\n\tisLevelEnabled(level: LogLevel) {\n\t\tif (this.level === undefined)\n\t\t\treturn true;\n\n\t\treturn Array.isArray(this.level)\n\t\t\t? this.level.includes(level)\n\t\t\t: this.level <= level;\n\t}\n\n\t// ===== Formatting strings =====\n\n\t/**\n\t * Formats text using this logger's formatting properties.\n\t * @param text - The text to format.\n\t */\n\tformat(text: string) {\n\t\treturn this.indentString\n\t\t\t? this.applyPrefix(this.indentString.repeat(this.indent) + text)\n\t\t\t: this.applyPrefix(text);\n\t}\n\n\t/**\n\t * Prepends a prefix to text.\n\t * @param text - The text to apply the prefix to.\n\t * @param level - The log level.\n\t */\n\tapplyPrefix(text: string, level?: LogLevel) {\n\t\tconst prefix = level ? this.prefix[level] : this.prefix.global;\n\t\treturn prefix ? `${prefix} ${text}` : text;\n\t}\n\n\t/**\n\t * Creates a stringify function that uses the {@link String} constructor.\n\t * @param type - The type of stringify function to use.\n\t */\n\tstatic createStringifier(type?: \"basic\"): Logger[\"stringify\"]\n\t/**\n\t * Creates a stringify function that uses {@link inspect} for any non-string value.\n\t * @param type - The type of stringify function to use.\n\t * @param options - The options for {@link inspect}.\n\t */\n\tstatic createStringifier(type: \"pretty\", options?: InspectionOptions): Logger[\"stringify\"]\n\tstatic createStringifier(type: \"basic\" | \"pretty\" = \"basic\", options?: InspectionOptions): Logger[\"stringify\"] {\n\t\treturn type === \"basic\" ? String : (value) => typeof value === \"string\" ? value : inspect(value, options);\n\t}\n\n}"],"names":["ANSI","row","column","Ansi","text","code","CONTEXT","REACT_ELEMENT","REACT_FRAGMENT","DEFAULT_OPTIONS","inspect","value","options","context","resolveContext","string","inspectString","inspectFunction","isReactElement","inspectReactElement","inspectArray","inspectError","inspectMap","inspectSet","isObject","inspectObject","plugin","result","inspectFunctionCall","func","args","returnValue","inspectedName","inspectedArgs","arg","inspectedReturnValue","arrow","element","name","isFragment","componentName","props","children","keys","key","child","inspectReactElementChild","inspectReactElementProp","open","close","slash","inspectedProps","needsTruncation","truncated","escaped","inner","quote","outer","array","guarded","guard","items","length","i","remaining","formatInline","object","entries","inspectedKey","inspectedValue","head","tail","map","fork","set","item","error","label","inline","indent","closingIndent","formattedHead","formattedItems","formattedTail","isContext","mergeDeep","colorCode","token","type","delimiter","forkContext","newContext","LogLevel","Logger","#errorCount","#warningCount","callbackOrMessage","indentation","level","amount","prefixOrLevel","prefix","url","message","details","detailsPrefix","detail","errorsText","warningsText","properties","lines","line"],"mappings":";AAMO,MAAMA,IAAO;AAAA;AAAA;AAAA;AAAA,EAInB,IAAI;AAAA,IACH,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAKR,IAAI;AAAA,IACH,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAKR,QAAQ;AAAA,IACP,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAKP,QAAQ;AAAA;AAAA,IAEP,UAAU,CAACC,GAAaC,MAAmB,QAAQD,CAAG,IAAIC,CAAM;AAAA,IAChE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAKV,OAAO;AAAA;AAAA,IAEN,SAAS;AAAA;AAAA,IAET,WAAW;AAAA;AAAA,IAEX,YAAY;AAAA;AAAA,IAEZ,WAAW;AAAA,IACX,eAAe;AAAA,IACf,UAAU;AAAA;AAAA,IACV,aAAa;AAAA,IACb,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AA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 @@
|
|
|
1
|
+
function t(s) {
|
|
2
|
+
return s != null && typeof s == "object" && !Array.isArray(s);
|
|
3
|
+
}
|
|
4
|
+
function n(s, ...i) {
|
|
5
|
+
const e = { ...s };
|
|
6
|
+
for (const o of i)
|
|
7
|
+
for (const r in o)
|
|
8
|
+
t(e[r]) && t(o[r]) ? e[r] = n(e[r], o[r]) : Array.isArray(e[r]) && Array.isArray(o[r]) ? e[r] = e[r].concat(o[r]) : o[r] !== void 0 && (e[r] = o[r]);
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
t as i,
|
|
13
|
+
n as m
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=object.utils-xiWGUq8N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.utils-xiWGUq8N.js","sources":["../../src/features/_utils/object.utils.ts"],"sourcesContent":["/**\n * Determines whether {@link arg} is an object.\n */\nexport function isObject(arg: unknown): arg is Record<PropertyKey, unknown> {\n\treturn arg != null && typeof arg === \"object\" && !Array.isArray(arg);\n}\n\n/**\n * Merges the type of the target with one or more types of sources.\n * @typeParam Target - The target type to merge with.\n * @typeParam Sources - The source types to merge into the target type.\n */\nexport type Merge<Target, Sources extends unknown[]> = Sources extends []\n\t? Target\n\t: Sources extends [infer FirstSource, ...infer OtherSources]\n\t\t? Merge<MergeValues<Target, FirstSource>, OtherSources>\n\t\t: Sources extends (infer Source)[]\n\t\t\t? Target | MergeValues<Target, Source>\n\t\t\t: never;\n\n/**\n * Merges the types of two primitive values.\n */\nexport type MergePrimitive<Target, Source> = undefined extends Source\n\t? Exclude<Source, undefined> extends never\n\t\t? Target\n\t\t: Exclude<Source, undefined>\n\t: Source;\n\n/**\n * Merges the types of two values recursively.\n * \n * Delegates to {@link MergePrimitive}, {@link MergeObjects} or {@link MergeArrays} if the two values are primitives, objects or arrays respectively.\n */\nexport type MergeValues<Target, Source> = Target extends Record<PropertyKey, unknown>\n\t? Source extends Record<PropertyKey, unknown>\n\t\t? [Target, Source] extends [Source, Target]\n\t\t\t? Target\n\t\t\t: MergeObjects<Target, Source>\n\t\t: Source\n\t: Target extends unknown[]\n\t\t? Source extends unknown[]\n\t\t\t? MergeArrays<Target, Source>\n\t\t\t: Source\n\t\t: MergePrimitive<Target, Source>;\n\n/**\n * Merges the types of two objects recursively.\n * \n * Properties are merged using {@link MergeValues}.\n */\nexport type MergeObjects<Target extends Record<PropertyKey, unknown>, Source extends Record<PropertyKey, unknown>> = {\n\t[Key in keyof Target | keyof Source]: Key extends keyof Source\n\t\t? Key extends keyof Target\n\t\t\t? MergeValues<Target[Key], Source[Key]>\n\t\t\t: Source[Key]\n\t\t: Target[Key & keyof Target]\n};\n\n/**\n * Merges the types of two arrays by concatenating them.\n */\nexport type MergeArrays<Target extends unknown[], Source extends unknown[]> = [...Target, ...Source];\n\n/**\n * Recursively merges two or more objects.\n * \n * If a property is defined in two objects and the values are both objects, they are merged recursively, \n * if they are both arrays, they are concatenated, otherwise the value of the second object overrides the value of the first.\n * @param target - The target object to merge the other objects with.\n * @param sources - The objects to merge with the target object.\n * @returns The merged object.\n */\nexport function mergeDeep<Target extends Record<PropertyKey, unknown>, Sources extends Record<PropertyKey, unknown>[] = Target[]>(target: Target, ...sources: Sources): Merge<Target, Sources> {\n\tconst result: Record<PropertyKey, unknown> = { ...target };\n\t\n\tfor (const source of sources) {\n\t\tfor (const key in source) {\n\t\t\tif (isObject(result[key]) && isObject(source[key])) {\n\t\t\t\tresult[key] = mergeDeep(result[key], source[key]);\n\t\t\t} else if (Array.isArray(result[key]) && Array.isArray(source[key])) {\n\t\t\t\tresult[key] = result[key].concat(source[key]);\n\t\t\t} else if (source[key] !== undefined) {\n\t\t\t\tresult[key] = source[key];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result as Merge<Target, Sources>;\n}"],"names":["isObject","arg","mergeDeep","target","sources","result","source","key"],"mappings":"AAGO,SAASA,EAASC,GAAmD;AAC3E,SAAOA,KAAO,QAAQ,OAAOA,KAAQ,YAAY,CAAC,MAAM,QAAQA,CAAG;AACpE;AAoEO,SAASC,EAAkHC,MAAmBC,GAA0C;AAC9L,QAAMC,IAAuC,EAAE,GAAGF,EAAA;AAElD,aAAWG,KAAUF;AACpB,eAAWG,KAAOD;AACjB,MAAIN,EAASK,EAAOE,CAAG,CAAC,KAAKP,EAASM,EAAOC,CAAG,CAAC,IAChDF,EAAOE,CAAG,IAAIL,EAAUG,EAAOE,CAAG,GAAGD,EAAOC,CAAG,CAAC,IACtC,MAAM,QAAQF,EAAOE,CAAG,CAAC,KAAK,MAAM,QAAQD,EAAOC,CAAG,CAAC,IACjEF,EAAOE,CAAG,IAAIF,EAAOE,CAAG,EAAE,OAAOD,EAAOC,CAAG,CAAC,IAClCD,EAAOC,CAAG,MAAM,WAC1BF,EAAOE,CAAG,IAAID,EAAOC,CAAG;AAK3B,SAAOF;AACR;"}
|