diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-13 21:34:48 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-13 21:34:48 -0800 |
| commit | 76cb9c2a39d477a64824a985ade40507e3bbade1 (patch) | |
| tree | 41e997aa9c6f538d3a136af61dae9424db2005a9 /vanilla/node_modules/obug | |
| parent | 819a39a21ac992b1393244a4c283bbb125208c69 (diff) | |
| download | neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.gz neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.bz2 neko-76cb9c2a39d477a64824a985ade40507e3bbade1.zip | |
feat(vanilla): add testing infrastructure and tests (NK-wjnczv)
Diffstat (limited to 'vanilla/node_modules/obug')
| -rw-r--r-- | vanilla/node_modules/obug/LICENSE | 23 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/README.md | 106 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/browser.d.ts | 11 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/browser.js | 140 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/browser.min.js | 1 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/core.d.ts | 47 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/core.js | 120 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/node.d.ts | 11 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/dist/node.js | 151 | ||||
| -rw-r--r-- | vanilla/node_modules/obug/package.json | 68 |
10 files changed, 678 insertions, 0 deletions
diff --git a/vanilla/node_modules/obug/LICENSE b/vanilla/node_modules/obug/LICENSE new file mode 100644 index 0000000..12eb148 --- /dev/null +++ b/vanilla/node_modules/obug/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz) +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vanilla/node_modules/obug/README.md b/vanilla/node_modules/obug/README.md new file mode 100644 index 0000000..e0bfb9a --- /dev/null +++ b/vanilla/node_modules/obug/README.md @@ -0,0 +1,106 @@ +# obug + +[![npm version][npm-version-src]][npm-version-href] +[![npm downloads][npm-downloads-src]][npm-downloads-href] +[![Unit Test][unit-test-src]][unit-test-href] + +A lightweight JavaScript debugging utility, forked from [debug](https://www.npmjs.com/package/debug), featuring TypeScript and ESM support. + +> [!NOTE] +> obug v1 retains most of the compatibility with [debug](https://github.com/debug-js/debug), but drops support for older browsers and Node.js, making it a drop-in replacement. +> +> obug v2 refactors some API imports and usage for better support of ESM and TypeScript, easier customization, and an even smaller package size. + +## Key Differences from `debug` + +- ✨ Minimal footprint + - 7.7 kB package size + - 1.4 KB minified + gzipped for browsers +- 📦 Zero dependencies +- 📝 Full TypeScript support +- 🚀 Native ESM compatibility +- 🌐 Optimized for modern runtimes + - ES2015+ browsers + - Modern Node.js versions +- 🎨 Customizable formatting + +## Installation + +```bash +npm install obug +``` + +## Usage + +```ts +import { createDebug, disable, enable, enabled, namespaces } from 'obug' + +// Get the currently enabled namespaces +console.log(namespaces()) + +const debug = createDebug('my-namespace', { + // All options are optional + + useColors: true, // false, true, undefined for auto-detect + color: 2, // custom color + // custom formatArgs + formatArgs(args) {}, + formatters: {}, + // Node.js only + inspectOpts: {}, + + // custom log + log: console.log, +}) + +debug('This is a debug message') +console.log( + debug.namespace, // 'my-namespace' + debug.enabled, // Check if enabled + debug.useColors, // true + debug.color, // 2 + debug.formatArgs, // custom formatArgs + debug.formatters, // {} + debug.inspectOpts, // {} + debug.log, // implemented log function +) + +// Create a sub-namespace, and it will inherit options from the parent debugger +const sub = debug.extend('sub-namespace') +sub('This is a sub-namespace debug message') +console.log(sub.namespace) // 'my-namespace:sub-namespace' +``` + +## Original Authors + +As obug is a fork of debug with significant modifications, we would like to acknowledge the original authors: + +- TJ Holowaychuk +- Nathan Rajlich +- Andrew Rhyne +- Josh Junon + +## Sponsors + +<p align="center"> + <a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg"> + <img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/> + </a> +</p> + +## License + +[MIT](./LICENSE) License © 2025-PRESENT [Kevin Deng](https://github.com/sxzz) + +[The MIT License](./LICENSE) Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +[The MIT License](./LICENSE) Copyright (c) 2018-2021 Josh Junon + +<!-- Badges --> + +[npm-version-src]: https://img.shields.io/npm/v/obug.svg +[npm-version-href]: https://npmjs.com/package/obug +[npm-downloads-src]: https://img.shields.io/npm/dm/obug +[npm-downloads-href]: https://www.npmcharts.com/compare/obug?interval=30 +[unit-test-src]: https://github.com/sxzz/obug/actions/workflows/unit-test.yml/badge.svg +[unit-test-href]: https://github.com/sxzz/obug/actions/workflows/unit-test.yml diff --git a/vanilla/node_modules/obug/dist/browser.d.ts b/vanilla/node_modules/obug/dist/browser.d.ts new file mode 100644 index 0000000..d0c8970 --- /dev/null +++ b/vanilla/node_modules/obug/dist/browser.d.ts @@ -0,0 +1,11 @@ +import { a as Debugger, i as DebugOptions, n as enabled, o as Formatters, r as namespaces, s as InspectOptions, t as disable } from "./core.js"; + +//#region src/browser.d.ts +declare function createDebug(namespace: string, options?: DebugOptions): Debugger; +/** +* Enables a debug mode by namespaces. This can include modes +* separated by a colon and wildcards. +*/ +declare function enable(namespaces: string): void; +//#endregion +export { DebugOptions, Debugger, Formatters, InspectOptions, createDebug, disable, enable, enabled, namespaces };
\ No newline at end of file diff --git a/vanilla/node_modules/obug/dist/browser.js b/vanilla/node_modules/obug/dist/browser.js new file mode 100644 index 0000000..414ff7d --- /dev/null +++ b/vanilla/node_modules/obug/dist/browser.js @@ -0,0 +1,140 @@ +import { a as namespaces, i as enabled, n as disable, o as humanize, r as enable$1, s as selectColor, t as createDebug$1 } from "./core.js"; +const colors = [ + "#0000CC", + "#0000FF", + "#0033CC", + "#0033FF", + "#0066CC", + "#0066FF", + "#0099CC", + "#0099FF", + "#00CC00", + "#00CC33", + "#00CC66", + "#00CC99", + "#00CCCC", + "#00CCFF", + "#3300CC", + "#3300FF", + "#3333CC", + "#3333FF", + "#3366CC", + "#3366FF", + "#3399CC", + "#3399FF", + "#33CC00", + "#33CC33", + "#33CC66", + "#33CC99", + "#33CCCC", + "#33CCFF", + "#6600CC", + "#6600FF", + "#6633CC", + "#6633FF", + "#66CC00", + "#66CC33", + "#9900CC", + "#9900FF", + "#9933CC", + "#9933FF", + "#99CC00", + "#99CC33", + "#CC0000", + "#CC0033", + "#CC0066", + "#CC0099", + "#CC00CC", + "#CC00FF", + "#CC3300", + "#CC3333", + "#CC3366", + "#CC3399", + "#CC33CC", + "#CC33FF", + "#CC6600", + "#CC6633", + "#CC9900", + "#CC9933", + "#CCCC00", + "#CCCC33", + "#FF0000", + "#FF0033", + "#FF0066", + "#FF0099", + "#FF00CC", + "#FF00FF", + "#FF3300", + "#FF3333", + "#FF3366", + "#FF3399", + "#FF33CC", + "#FF33FF", + "#FF6600", + "#FF6633", + "#FF9900", + "#FF9933", + "#FFCC00", + "#FFCC33" +]; +function formatArgs(diff, args) { + const { useColors } = this; + args[0] = `${(useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ")}+${this.humanize(diff)}`; + if (!useColors) return; + const c = `color: ${this.color}`; + args.splice(1, 0, c, "color: inherit"); + let index = 0; + let lastC = 0; + args[0].replace(/%[a-z%]/gi, (match) => { + if (match === "%%") return; + index++; + if (match === "%c") lastC = index; + }); + args.splice(lastC, 0, c); +} +const log = console.debug || console.log || (() => {}); +const storage = localstorage(); +const defaultOptions = { + useColors: true, + formatArgs, + formatters: { j(v) { + try { + return JSON.stringify(v); + } catch (error) { + return `[UnexpectedJSONParseError]: ${error.message}`; + } + } }, + inspectOpts: {}, + humanize, + log +}; +function createDebug(namespace, options) { + var _ref; + const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace); + return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options)); +} +function localstorage() { + try { + return localStorage; + } catch (_unused) {} +} +function load() { + let r; + try { + r = storage.getItem("debug") || storage.getItem("DEBUG"); + } catch (_unused2) {} + if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG; + return r || ""; +} +function save(namespaces$1) { + try { + if (namespaces$1) storage.setItem("debug", namespaces$1); + else storage.removeItem("debug"); + } catch (_unused3) {} +} +function enable(namespaces$1) { + save(namespaces$1); + enable$1(namespaces$1); +} +enable$1(load()); +export { createDebug, disable, enable, enabled, namespaces }; diff --git a/vanilla/node_modules/obug/dist/browser.min.js b/vanilla/node_modules/obug/dist/browser.min.js new file mode 100644 index 0000000..443a768 --- /dev/null +++ b/vanilla/node_modules/obug/dist/browser.min.js @@ -0,0 +1 @@ +function e(e){return e instanceof Error?e.stack||e.message:e}function t(e,t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e[Math.abs(n)%e.length]}function n(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function r(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}let i=``;function a(){return i}function o(t,n){let r,a,s,c,l=(...t)=>{if(!l.enabled)return;let i=Date.now(),a=i-(r||i);r=i,t[0]=e(t[0]),typeof t[0]!=`string`&&t.unshift(`%O`);let o=0;t[0]=t[0].replace(/%([a-z%])/gi,(e,r)=>{if(e===`%%`)return`%`;o++;let i=n.formatters[r];if(typeof i==`function`){let n=t[o];e=i.call(l,n),t.splice(o,1),o--}return e}),n.formatArgs.call(l,a,t),l.log(...t)};return l.extend=function(e,t=`:`){return o(this.namespace+t+e,{useColors:this.useColors,color:this.color,formatArgs:this.formatArgs,formatters:this.formatters,inspectOpts:this.inspectOpts,log:this.log,humanize:this.humanize})},Object.assign(l,n),l.namespace=t,Object.defineProperty(l,`enabled`,{enumerable:!0,configurable:!1,get:()=>a==null?(s!==i&&(s=i,c=d(t)),c):a,set:e=>{a=e}}),l}let s=[],c=[];function l(e){i=e,s=[],c=[];let t=i.trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?c.push(e.slice(1)):s.push(e)}function u(){let e=[...s,...c.map(e=>`-${e}`)].join(`,`);return l(``),e}function d(e){for(let t of c)if(n(e,t))return!1;for(let t of s)if(n(e,t))return!0;return!1}const f=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function p(e,t){let{useColors:n}=this;if(t[0]=`${(n?`%c`:``)+this.namespace+(n?` %c`:` `)+t[0]+(n?`%c `:` `)}+${this.humanize(e)}`,!n)return;let r=`color: ${this.color}`;t.splice(1,0,r,`color: inherit`);let i=0,a=0;t[0].replace(/%[a-z%]/gi,e=>{e!==`%%`&&(i++,e===`%c`&&(a=i))}),t.splice(a,0,r)}const m=console.debug||console.log||(()=>{}),h=v(),g={useColors:!0,formatArgs:p,formatters:{j(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: ${e.message}`}}},inspectOpts:{},humanize:r,log:m};function _(e,n){var r;let i=(r=n&&n.color)==null?t(f,e):r;return o(e,Object.assign(g,{color:i},n))}function v(){try{return localStorage}catch(e){}}function y(){let e;try{e=h.getItem(`debug`)||h.getItem(`DEBUG`)}catch(e){}return!e&&typeof process<`u`&&`env`in process&&(e=process.env.DEBUG),e||``}function b(e){try{e?h.setItem(`debug`,e):h.removeItem(`debug`)}catch(e){}}function x(e){b(e),l(e)}l(y());export{_ as createDebug,u as disable,x as enable,d as enabled,a as namespaces};
\ No newline at end of file diff --git a/vanilla/node_modules/obug/dist/core.d.ts b/vanilla/node_modules/obug/dist/core.d.ts new file mode 100644 index 0000000..61f80ae --- /dev/null +++ b/vanilla/node_modules/obug/dist/core.d.ts @@ -0,0 +1,47 @@ +import { InspectOptions } from "node:util"; + +//#region src/types.d.ts +interface InspectOptions$1 extends InspectOptions { + hideDate?: boolean; +} +/** +* Map of special "%n" handling functions, for the debug "format" argument. +* +* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". +*/ +interface Formatters { + [formatter: string]: (this: Debugger, v: any) => string; +} +interface Debugger extends Required<DebugOptions> { + (formatter: any, ...args: any[]): void; + namespace: string; + enabled: boolean; + extend: (namespace: string, delimiter?: string) => Debugger; +} +interface DebugOptions { + useColors?: boolean; + color?: string | number; + formatArgs?: (this: Debugger, diff: number, args: [string, ...any[]]) => void; + formatters?: Formatters; + /** Node.js only */ + inspectOpts?: InspectOptions$1; + /** Humanize a duration in milliseconds */ + humanize?: (value: number) => string; + log?: (this: Debugger, ...args: any[]) => void; +} +//#endregion +//#region src/core.d.ts +/** +* Returns a string of the currently enabled debug namespaces. +*/ +declare function namespaces(): string; +/** +* Disable debug output. +*/ +declare function disable(): string; +/** +* Returns true if the given mode name is enabled, false otherwise. +*/ +declare function enabled(name: string): boolean; +//#endregion +export { Debugger as a, DebugOptions as i, enabled as n, Formatters as o, namespaces as r, InspectOptions$1 as s, disable as t };
\ No newline at end of file diff --git a/vanilla/node_modules/obug/dist/core.js b/vanilla/node_modules/obug/dist/core.js new file mode 100644 index 0000000..db2abcd --- /dev/null +++ b/vanilla/node_modules/obug/dist/core.js @@ -0,0 +1,120 @@ +function coerce(value) { + if (value instanceof Error) return value.stack || value.message; + return value; +} +function selectColor(colors, namespace) { + let hash = 0; + for (let i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; + } + return colors[Math.abs(hash) % colors.length]; +} +function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; + } else { + searchIndex++; + templateIndex++; + } + else if (starIndex !== -1) { + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else return false; + while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++; + return templateIndex === template.length; +} +function humanize(value) { + if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`; + return `${value}ms`; +} +let globalNamespaces = ""; +function namespaces() { + return globalNamespaces; +} +function createDebug(namespace, options) { + let prevTime; + let enableOverride; + let namespacesCache; + let enabledCache; + const debug = (...args) => { + if (!debug.enabled) return; + const curr = Date.now(); + const diff = curr - (prevTime || curr); + prevTime = curr; + args[0] = coerce(args[0]); + if (typeof args[0] !== "string") args.unshift("%O"); + let index = 0; + args[0] = args[0].replace(/%([a-z%])/gi, (match, format) => { + if (match === "%%") return "%"; + index++; + const formatter = options.formatters[format]; + if (typeof formatter === "function") { + const value = args[index]; + match = formatter.call(debug, value); + args.splice(index, 1); + index--; + } + return match; + }); + options.formatArgs.call(debug, diff, args); + debug.log(...args); + }; + debug.extend = function(namespace$1, delimiter = ":") { + return createDebug(this.namespace + delimiter + namespace$1, { + useColors: this.useColors, + color: this.color, + formatArgs: this.formatArgs, + formatters: this.formatters, + inspectOpts: this.inspectOpts, + log: this.log, + humanize: this.humanize + }); + }; + Object.assign(debug, options); + debug.namespace = namespace; + Object.defineProperty(debug, "enabled", { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride != null) return enableOverride; + if (namespacesCache !== globalNamespaces) { + namespacesCache = globalNamespaces; + enabledCache = enabled(namespace); + } + return enabledCache; + }, + set: (v) => { + enableOverride = v; + } + }); + return debug; +} +let names = []; +let skips = []; +function enable(namespaces$1) { + globalNamespaces = namespaces$1; + names = []; + skips = []; + const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean); + for (const ns of split) if (ns[0] === "-") skips.push(ns.slice(1)); + else names.push(ns); +} +function disable() { + const namespaces$1 = [...names, ...skips.map((namespace) => `-${namespace}`)].join(","); + enable(""); + return namespaces$1; +} +function enabled(name) { + for (const skip of skips) if (matchesTemplate(name, skip)) return false; + for (const ns of names) if (matchesTemplate(name, ns)) return true; + return false; +} +export { namespaces as a, enabled as i, disable as n, humanize as o, enable as r, selectColor as s, createDebug as t }; diff --git a/vanilla/node_modules/obug/dist/node.d.ts b/vanilla/node_modules/obug/dist/node.d.ts new file mode 100644 index 0000000..2d674e5 --- /dev/null +++ b/vanilla/node_modules/obug/dist/node.d.ts @@ -0,0 +1,11 @@ +import { a as Debugger, i as DebugOptions, n as enabled, o as Formatters, r as namespaces, s as InspectOptions, t as disable } from "./core.js"; + +//#region src/node.d.ts +declare function createDebug(namespace: string, options?: DebugOptions): Debugger; +/** +* Enables a debug mode by namespaces. This can include modes +* separated by a colon and wildcards. +*/ +declare function enable(namespaces: string): void; +//#endregion +export { DebugOptions, Debugger, Formatters, InspectOptions, createDebug, disable, enable, enabled, namespaces };
\ No newline at end of file diff --git a/vanilla/node_modules/obug/dist/node.js b/vanilla/node_modules/obug/dist/node.js new file mode 100644 index 0000000..4ad74a1 --- /dev/null +++ b/vanilla/node_modules/obug/dist/node.js @@ -0,0 +1,151 @@ +import { a as namespaces, i as enabled, n as disable, o as humanize, r as enable$1, s as selectColor, t as createDebug$1 } from "./core.js"; +import { isatty } from "node:tty"; +import { formatWithOptions, inspect } from "node:util"; +const colors = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 +] : [ + 6, + 2, + 3, + 4, + 5, + 1 +]; +const inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => { + const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase()); + let value = process.env[key]; + const lowerCase = typeof value === "string" && value.toLowerCase(); + if (value === "null") value = null; + else if (lowerCase === "yes" || lowerCase === "on" || lowerCase === "true" || lowerCase === "enabled") value = true; + else if (lowerCase === "no" || lowerCase === "off" || lowerCase === "false" || lowerCase === "disabled") value = false; + else value = Number(value); + obj[prop] = value; + return obj; +}, {}); +function useColors() { + return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd); +} +function getDate() { + if (inspectOpts.hideDate) return ""; + return `${(/* @__PURE__ */ new Date()).toISOString()} `; +} +function formatArgs(diff, args) { + const { namespace: name, useColors: useColors$1 } = this; + if (useColors$1) { + const c = this.color; + const colorCode = `\u001B[3${c < 8 ? c : `8;5;${c}`}`; + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + args[0] = prefix + args[0].split("\n").join(`\n${prefix}`); + args.push(`${colorCode}m+${this.humanize(diff)}\u001B[0m`); + } else args[0] = `${getDate()}${name} ${args[0]}`; +} +function log(...args) { + process.stderr.write(`${formatWithOptions(this.inspectOpts, ...args)}\n`); +} +const defaultOptions = { + useColors: useColors(), + formatArgs, + formatters: { + o(v) { + this.inspectOpts.colors = this.useColors; + return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" "); + }, + O(v) { + this.inspectOpts.colors = this.useColors; + return inspect(v, this.inspectOpts); + } + }, + inspectOpts, + log, + humanize +}; +function createDebug(namespace, options) { + var _ref; + const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace); + return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options)); +} +function save(namespaces$1) { + if (namespaces$1) process.env.DEBUG = namespaces$1; + else delete process.env.DEBUG; +} +function enable(namespaces$1) { + save(namespaces$1); + enable$1(namespaces$1); +} +enable$1(process.env.DEBUG || ""); +export { createDebug, disable, enable, enabled, namespaces }; diff --git a/vanilla/node_modules/obug/package.json b/vanilla/node_modules/obug/package.json new file mode 100644 index 0000000..651d753 --- /dev/null +++ b/vanilla/node_modules/obug/package.json @@ -0,0 +1,68 @@ +{ + "name": "obug", + "version": "2.1.1", + "description": "A lightweight JavaScript debugging utility, forked from debug, featuring TypeScript and ESM support.", + "type": "module", + "license": "MIT", + "homepage": "https://github.com/sxzz/obug#readme", + "bugs": { + "url": "https://github.com/sxzz/obug/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sxzz/obug.git" + }, + "author": "Kevin Deng <sxzz@sxzz.moe>", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "files": [ + "dist" + ], + "main": "./dist/node.js", + "module": "./dist/node.js", + "types": "./dist/browser.d.ts", + "exports": { + ".": { + "browser": "./dist/browser.js", + "default": "./dist/node.js" + }, + "./package.json": "./package.json" + }, + "unpkg": "./dist/browser.min.js", + "jsdelivr": "./dist/browser.min.js", + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@sxzz/eslint-config": "^7.3.0", + "@sxzz/prettier-config": "^2.2.5", + "@types/debug": "^4.1.12", + "@types/node": "^24.10.1", + "@vitest/browser-playwright": "^4.0.10", + "@vitest/coverage-v8": "^4.0.10", + "bumpp": "^10.3.1", + "debug": "^4.4.3", + "eslint": "^9.39.1", + "playwright": "^1.56.1", + "prettier": "^3.6.2", + "tsdown": "^0.16.5", + "typescript": "^5.9.3", + "vite": "^7.2.2", + "vitest": "^4.0.10" + }, + "prettier": "@sxzz/prettier-config", + "scripts": { + "lint": "eslint --cache .", + "lint:fix": "pnpm run lint --fix", + "build": "tsdown", + "dev": "tsdown --watch", + "test": "vitest", + "test:coverage": "vitest --project node --coverage", + "play": "vite playground", + "typecheck": "tsc --noEmit", + "format": "prettier --cache --write .", + "release": "bumpp" + } +}
\ No newline at end of file |
