[
  {
    "path": ".editorconfig",
    "content": "# editorconfig.org\nroot = true\n\n[*]\nindent_size = 2\nindent_style = space\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".github/codecov.yml",
    "content": "coverage:\n  status:\n    project:\n      default:\n        threshold: 5%\n"
  },
  {
    "path": ".github/workflows/autofix.yml",
    "content": "name: autofix.ci # needed to securely identify the workflow\n\non:\n  pull_request:\n  push:\n    branches: [\"main\"]\n\npermissions:\n  contents: read\n\njobs:\n  autofix:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - run: npm i -fg corepack && corepack enable\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n          cache: \"pnpm\"\n      - run: pnpm install\n      - name: Fix lint issues\n        run: pnpm run lint:fix\n      - uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8\n        with:\n          commit-message: \"chore: apply automated updates\"\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: ci\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  ci:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - run: npm i -fg corepack && corepack enable\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n          cache: \"pnpm\"\n      - run: pnpm install\n      - run: pnpm lint\n      - run: pnpm build\n      - run: pnpm vitest --coverage\n      - uses: codecov/codecov-action@v5\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\n*.log*\ndist\ncoverage\n"
  },
  {
    "path": ".prettierrc",
    "content": "{}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n\n## v3.4.2\n\n[compare changes](https://github.com/unjs/consola/compare/v3.4.1...v3.4.2)\n\n### 🩹 Fixes\n\n- Export tree utils ([#349](https://github.com/unjs/consola/pull/349))\n- Calculate box width with the title width ([#362](https://github.com/unjs/consola/pull/362))\n\n### 🏡 Chore\n\n- Cleanup unused deps ([#361](https://github.com/unjs/consola/pull/361))\n- Update deps ([1e5f846](https://github.com/unjs/consola/commit/1e5f846))\n\n### ❤️ Contributors\n\n- Kricsleo ([@kricsleo](https://github.com/kricsleo))\n- Scott Humphries ([@sscotth](https://github.com/sscotth))\n- Pooya Parsa ([@pi0](https://github.com/pi0))\n\n## v3.4.1\n\n[compare changes](https://github.com/unjs/consola/compare/v3.4.0...v3.4.1)\n\n### 🩹 Fixes\n\n- Remove all message lines from stack ([#356](https://github.com/unjs/consola/pull/356))\n\n### 🏡 Chore\n\n- Update ci ([#353](https://github.com/unjs/consola/pull/353))\n- Update deps ([da26f10](https://github.com/unjs/consola/commit/da26f10))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](https://github.com/pi0))\n- Nozomu Ikuta ([@nozomuikuta](https://github.com/nozomuikuta))\n\n## v3.4.0\n\n[compare changes](https://github.com/unjs/consola/compare/v3.3.3...v3.4.0)\n\n### 🚀 Enhancements\n\n- Use upstream `@clack/prompts` ([#332](https://github.com/unjs/consola/pull/332))\n\n### 🩹 Fixes\n\n- Calculate box width without escape sequence chars ([#336](https://github.com/unjs/consola/pull/336))\n\n### 💅 Refactors\n\n- Keep prompt styles (cont. #332) ([#332](https://github.com/unjs/consola/issues/332))\n\n### 📦 Build\n\n- Update exports for node16 typescript resolution ([#331](https://github.com/unjs/consola/pull/331))\n\n### 🏡 Chore\n\n- Update deps ([9193d63](https://github.com/unjs/consola/commit/9193d63))\n- Apply automated updates ([fc8b9b9](https://github.com/unjs/consola/commit/fc8b9b9))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- Yongqi <yongqi14@qq.com>\n\n## v3.3.3\n\n[compare changes](https://github.com/unjs/consola/compare/v3.3.2...v3.3.3)\n\n### 📦 Build\n\n- Revert \"build: update exports for `node16` typescript resolution\" ([2065136](https://github.com/unjs/consola/commit/2065136))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.3.2\n\n[compare changes](https://github.com/unjs/consola/compare/v3.3.1...v3.3.2)\n\n### 📦 Build\n\n- Patch `string-width` for node 14 support ([421c663](https://github.com/unjs/consola/commit/421c663))\n- Update exports for `node16` typescript resolution ([18bc852](https://github.com/unjs/consola/commit/18bc852))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.3.1\n\n[compare changes](https://github.com/unjs/consola/compare/v3.3.0...v3.3.1)\n\n### 🩹 Fixes\n\n- **fancy:** Fallback when`Intl` is unavailable ([#326](https://github.com/unjs/consola/pull/326))\n\n### ❤️ Contributors\n\n- Red Huang <redhuang@synology.com>\n\n## v3.3.0\n\n[compare changes](https://github.com/unjs/consola/compare/v3.2.3...v3.3.0)\n\n### 🚀 Enhancements\n\n- **utils:** `formatTree` utility ([#223](https://github.com/unjs/consola/pull/223))\n- Export prompt option types ([#301](https://github.com/unjs/consola/pull/301))\n- Support report error `cause` ([#308](https://github.com/unjs/consola/pull/308))\n- **prompt:** Configurable cancel strategy ([#325](https://github.com/unjs/consola/pull/325))\n- **formatTree:** Support max depth ([#267](https://github.com/unjs/consola/pull/267))\n\n### 🩹 Fixes\n\n- Use `initial` in `select` and `multiselect` prompts ([#232](https://github.com/unjs/consola/pull/232))\n- Make box title color same as border ([#236](https://github.com/unjs/consola/pull/236))\n\n### 📖 Documentation\n\n- Update screenshot ([205d9c8](https://github.com/unjs/consola/commit/205d9c8))\n- Add vitest ([#182](https://github.com/unjs/consola/pull/182))\n- Add note about raw method ([#271](https://github.com/unjs/consola/pull/271))\n- Add jsdocs for utils functions ([#286](https://github.com/unjs/consola/pull/286))\n- Add jsdocs for top-level functions ([#288](https://github.com/unjs/consola/pull/288))\n\n### 📦 Build\n\n- Fix subpath types ([#265](https://github.com/unjs/consola/pull/265))\n- Add `require` condition for browser builds ([#243](https://github.com/unjs/consola/pull/243))\n\n### 🌊 Types\n\n- Fix prompt with `select` type return value type ([#238](https://github.com/unjs/consola/pull/238))\n\n### 🏡 Chore\n\n- Update dependencies ([68b36c7](https://github.com/unjs/consola/commit/68b36c7))\n- Update dependencies ([dff1ef8](https://github.com/unjs/consola/commit/dff1ef8))\n- Update eslint to v9 ([238d677](https://github.com/unjs/consola/commit/238d677))\n- Lint ([985a786](https://github.com/unjs/consola/commit/985a786))\n- Update pnpm to v9 ([61adfbe](https://github.com/unjs/consola/commit/61adfbe))\n- Update ci scripts ([9545b65](https://github.com/unjs/consola/commit/9545b65))\n- Apply automated updates ([df0e555](https://github.com/unjs/consola/commit/df0e555))\n- Update dependencies ([e851525](https://github.com/unjs/consola/commit/e851525))\n- Fix lint issues ([8238844](https://github.com/unjs/consola/commit/8238844))\n- Update deps ([093d966](https://github.com/unjs/consola/commit/093d966))\n- Lint ([64cd547](https://github.com/unjs/consola/commit/64cd547))\n- Update clack/core ([e2aa5c9](https://github.com/unjs/consola/commit/e2aa5c9))\n\n### 🎨 Styles\n\n- Format repo ([899173f](https://github.com/unjs/consola/commit/899173f))\n\n### 🤖 CI\n\n- Use conventional commit for autofix ([#217](https://github.com/unjs/consola/pull/217))\n\n### ❤️ Contributors\n\n- Guo ([@Plumbiu](http://github.com/Plumbiu))\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- Kongmoumou ([@kongmoumou](http://github.com/kongmoumou))\n- Max ([@onmax](http://github.com/onmax))\n- Michel EDIGHOFFER <edimitchel@gmail.com>\n- Sébastien Chopin ([@atinux](http://github.com/atinux))\n- Estéban <e.soubiran25@gmail.com>\n- Nozomu Ikuta ([@nozomuikuta](http://github.com/nozomuikuta))\n- Maxim Molochkov ([@klaseca](http://github.com/klaseca))\n- Xjccc ([@xjccc](http://github.com/xjccc))\n- Gangan ([@shinGangan](http://github.com/shinGangan))\n- Daniel Roe ([@danielroe](http://github.com/danielroe))\n\n## v3.2.3\n\n[compare changes](https://github.com/unjs/consola/compare/v3.2.2...v3.2.3)\n\n\n### 🩹 Fixes\n\n  - **types:** Partial style options for `box` ([#210](https://github.com/unjs/consola/pull/210))\n  - **types:** Add backward compatible declarations ([e46733b](https://github.com/unjs/consola/commit/e46733b))\n\n### 🏡 Chore\n\n  - Remove extra `await` in `spinner` example ([#211](https://github.com/unjs/consola/pull/211))\n  - Add autofix ci ([b3aa049](https://github.com/unjs/consola/commit/b3aa049))\n  - Update prettier ([9a4b67e](https://github.com/unjs/consola/commit/9a4b67e))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- Alexander Topalo <topaloalexander@gmail.com>\n- Estéban ([@Barbapapazes](http://github.com/Barbapapazes))\n\n## v3.2.2\n\n[compare changes](https://github.com/unjs/consola/compare/v3.2.1...v3.2.2)\n\n\n### 🩹 Fixes\n\n  - **fancy:** Add node 14 compatibility ([#204](https://github.com/unjs/consola/pull/204))\n\n### 📦 Build\n\n  - **pkg:** Add supported engines field ([#179](https://github.com/unjs/consola/pull/179))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.2.1\n\n[compare changes](https://github.com/unjs/consola/compare/v3.2.0...v3.2.1)\n\n\n### 🩹 Fixes\n\n  - **box:** Fix preset naming for `singleThick` ([#201](https://github.com/unjs/consola/pull/201))\n  - **fancy:** Style underscore with surrounding spaces ([#203](https://github.com/unjs/consola/pull/203))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- Christian Preston ([@cpreston321](http://github.com/cpreston321))\n\n## v3.2.0\n\n[compare changes](https://github.com/unjs/consola/compare/v3.1.0...v3.2.0)\n\n\n### 🚀 Enhancements\n\n  - **fancy:** Support underlining ([#191](https://github.com/unjs/consola/pull/191))\n  - `consola.box` ([#193](https://github.com/unjs/consola/pull/193))\n  - `consola/utils` subpath export ([#199](https://github.com/unjs/consola/pull/199))\n  - Color utils ([#200](https://github.com/unjs/consola/pull/200))\n\n### 🩹 Fixes\n\n  - Inherit mocks ([#183](https://github.com/unjs/consola/pull/183))\n  - Correct and improve return types for single and multi select prompts ([#197](https://github.com/unjs/consola/pull/197))\n  - Preserve tag casing ([#190](https://github.com/unjs/consola/pull/190))\n\n### 🏡 Chore\n\n  - Update prompt example ([#196](https://github.com/unjs/consola/pull/196))\n  - Lint code ([d424218](https://github.com/unjs/consola/commit/d424218))\n  - Update dependencies ([dabb705](https://github.com/unjs/consola/commit/dabb705))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- Christian Preston ([@cpreston321](http://github.com/cpreston321))\n- Leex ([@jsonleex](http://github.com/jsonleex))\n- Inesh Bose \n- Damian Głowala\n\n## v3.1.0\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.2...v3.1.0)\n\n\n### 🚀 Enhancements\n\n  - Support `fancy` option for `createConsola` and improve docs ([#177](https://github.com/unjs/consola/pull/177))\n  - `/basic`, `/core` and `/browser` subpath exports ([#178](https://github.com/unjs/consola/pull/178))\n\n### 🏡 Chore\n\n  - Add json example ([943992d](https://github.com/unjs/consola/commit/943992d))\n  - Update the docs ([a952bc2](https://github.com/unjs/consola/commit/a952bc2))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.0.2\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.1...v3.0.2)\n\n\n### 🩹 Fixes\n\n  - **`mockTypes`:** Mock on `options.typs` ([f9d86b6](https://github.com/unjs/consola/commit/f9d86b6))\n  - Type `.raw` for types ([dfb976f](https://github.com/unjs/consola/commit/dfb976f))\n\n### 💅 Refactors\n\n  - Use individual named exports of reporters ([57bb579](https://github.com/unjs/consola/commit/57bb579))\n\n### 🏡 Chore\n\n  - Add `codecov.yml` ([1f50123](https://github.com/unjs/consola/commit/1f50123))\n  - Update readme ([5a4708d](https://github.com/unjs/consola/commit/5a4708d))\n  - Fix mock example ([4dadfb3](https://github.com/unjs/consola/commit/4dadfb3))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.0.1\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.0...v3.0.1)\n\n\n### 🩹 Fixes\n\n  - **utils:** Use default `stream.write` for workers support ([#173](https://github.com/unjs/consola/pull/173))\n  - Wrap `options.stdout` and `options.stderr` for wrapStd ([ab59db6](https://github.com/unjs/consola/commit/ab59db6))\n\n### 💅 Refactors\n\n  - **fancy:** More minimal badges when width cannot be determined ([ad24029](https://github.com/unjs/consola/commit/ad24029))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.0.0\n\n[compare changes](https://github.com/unjs/consola/compare/v2.15.2...v3.0.0)\n\n\n### 🚀 Enhancements\n\n  - Default `logLevel` to 1 in test environments ([#134](https://github.com/unjs/consola/pull/134))\n  - Support literal for logLevels ([#133](https://github.com/unjs/consola/pull/133))\n  - Expose `createConsola` and named exports ([ef6e5e5](https://github.com/unjs/consola/commit/ef6e5e5))\n  - `consola.prompt` util ([#170](https://github.com/unjs/consola/pull/170))\n  - `consola.fail` log level ([#153](https://github.com/unjs/consola/pull/153))\n  - Pass `formatOptions` and other options to reporters ([d77286a](https://github.com/unjs/consola/commit/d77286a))\n  - Show stack trace with `consola.trace` ([#151](https://github.com/unjs/consola/pull/151))\n\n### 🔥 Performance\n\n  - Switch from chalk to colorette ([271b4db](https://github.com/unjs/consola/commit/271b4db))\n  - Remove `dayjs` dependency ([d6a3776](https://github.com/unjs/consola/commit/d6a3776))\n\n### 🩹 Fixes\n\n  - Add `.raw` to mocked functions ([987dadc](https://github.com/unjs/consola/commit/987dadc))\n  - Type consola instance with built-in type functions ([1a4b893](https://github.com/unjs/consola/commit/1a4b893))\n  - Default value for color format utils ([ec9be78](https://github.com/unjs/consola/commit/ec9be78))\n  - **fancy:** Show time and tag on right when width cannot be determined ([#128](https://github.com/unjs/consola/pull/128))\n  - Pass level from `CONSOLA_LEVEL` to the `defaults` ([#129](https://github.com/unjs/consola/pull/129))\n  - **consola:** Type defaults overrides generic defaults ([d3d3c05](https://github.com/unjs/consola/commit/d3d3c05))\n  - **fancy:** Improve colors ([99c2a4f](https://github.com/unjs/consola/commit/99c2a4f))\n  - **promp:** Options is optional ([817626f](https://github.com/unjs/consola/commit/817626f))\n\n### 💅 Refactors\n\n  - ⚠️  Rewrite consola with typescript ([4479d2f](https://github.com/unjs/consola/commit/4479d2f))\n  - Rename `global` to `globalThis` ([bd03098](https://github.com/unjs/consola/commit/bd03098))\n  - **utils:** Rename `global` to `globalThis` ([8c3ef77](https://github.com/unjs/consola/commit/8c3ef77))\n  - Strict typechecks ([63bbd56](https://github.com/unjs/consola/commit/63bbd56))\n  - Remove `globalThis` caching ([4e7b909](https://github.com/unjs/consola/commit/4e7b909))\n  - Drop `json` and `winston` reporters ([5af0e99](https://github.com/unjs/consola/commit/5af0e99))\n  - Move all options to `consola.options` without duplication ([2d31ef4](https://github.com/unjs/consola/commit/2d31ef4))\n  - Move spam logic into `_lastLog` object ([cabd04f](https://github.com/unjs/consola/commit/cabd04f))\n  - Remove global `async` option ([edd1bb9](https://github.com/unjs/consola/commit/edd1bb9))\n  - **types:** Merge `LogTypeLiteral` and `logtype` types to `LogType` ([da1bc73](https://github.com/unjs/consola/commit/da1bc73))\n  - ⚠️  Move log levels and types to constants ([514f5b3](https://github.com/unjs/consola/commit/514f5b3))\n  - Use `index.node.ts` for main build ([b92d23b](https://github.com/unjs/consola/commit/b92d23b))\n  - Improve types  and exports ([b380d21](https://github.com/unjs/consola/commit/b380d21))\n  - Improve fancy reporter ([bc90db8](https://github.com/unjs/consola/commit/bc90db8))\n  - Revert back to `dist/index.*` for bw compatibility ([98e300f](https://github.com/unjs/consola/commit/98e300f))\n  - **fancy:** Better start color and icon ([5a01d53](https://github.com/unjs/consola/commit/5a01d53))\n\n### 📖 Documentation\n\n  - Fix links to the source files ([#172](https://github.com/unjs/consola/pull/172))\n\n### 📦 Build\n\n  - Use backward compatible cjs wrapper for default export ([e2e6aa6](https://github.com/unjs/consola/commit/e2e6aa6))\n\n### 🏡 Chore\n\n  - **release:** 2.15.3 ([c99ff6c](https://github.com/unjs/consola/commit/c99ff6c))\n  - Make example/index.js working ([#110](https://github.com/unjs/consola/pull/110))\n  - Add LICENSE ([#121](https://github.com/unjs/consola/pull/121))\n  - **npm:** Update repository to unjs orgnization ([#125](https://github.com/unjs/consola/pull/125))\n  - Add prerelease script ([cfaba5e](https://github.com/unjs/consola/commit/cfaba5e))\n  - Hide rollup warn ([5c3b7f1](https://github.com/unjs/consola/commit/5c3b7f1))\n  - Ignore coverage ([da557ac](https://github.com/unjs/consola/commit/da557ac))\n  - Update examples ([e07e3ab](https://github.com/unjs/consola/commit/e07e3ab))\n  - **release:** V3.0.0-1 ([c24ae27](https://github.com/unjs/consola/commit/c24ae27))\n  - Rename dist-tag to 3.x ([3e8f1e0](https://github.com/unjs/consola/commit/3e8f1e0))\n  - Update readme ([85bbe3a](https://github.com/unjs/consola/commit/85bbe3a))\n  - Update badges ([cf7c6e5](https://github.com/unjs/consola/commit/cf7c6e5))\n  - Update badges ([566ff68](https://github.com/unjs/consola/commit/566ff68))\n  - **release:** V3.0.0-2 ([4a01304](https://github.com/unjs/consola/commit/4a01304))\n  - Update shared exports ([8fc0fdd](https://github.com/unjs/consola/commit/8fc0fdd))\n  - **release:** V3.0.0-3 ([6253fb0](https://github.com/unjs/consola/commit/6253fb0))\n  - Fix import in examples ([c4fff18](https://github.com/unjs/consola/commit/c4fff18))\n  - **release:** V3.0.0-4 ([474f82f](https://github.com/unjs/consola/commit/474f82f))\n  - **release:** V3.0.0-5 ([ad20f89](https://github.com/unjs/consola/commit/ad20f89))\n  - Add example for readme ([2bb5813](https://github.com/unjs/consola/commit/2bb5813))\n  - Update readme ([0568e61](https://github.com/unjs/consola/commit/0568e61))\n  - Update readme ([6a5fb0c](https://github.com/unjs/consola/commit/6a5fb0c))\n  - Lint changelog ([11ba5be](https://github.com/unjs/consola/commit/11ba5be))\n  - Update package.json ([f698f88](https://github.com/unjs/consola/commit/f698f88))\n  - Remove browser cjs ([a5db8db](https://github.com/unjs/consola/commit/a5db8db))\n  - Update release script to normal ([2634c71](https://github.com/unjs/consola/commit/2634c71))\n\n### ✅ Tests\n\n  - Update test ([64fa81d](https://github.com/unjs/consola/commit/64fa81d))\n\n### 🎨 Styles\n\n  - Prefer object spread instead of `Object.assign` ([c03268a](https://github.com/unjs/consola/commit/c03268a))\n\n#### ⚠️  Breaking Changes\n\n  - ⚠️  Rewrite consola with typescript ([4479d2f](https://github.com/unjs/consola/commit/4479d2f))\n  - ⚠️  Move log levels and types to constants ([514f5b3](https://github.com/unjs/consola/commit/514f5b3))\n\n### ❤️  Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- With-heart ([@with-heart](http://github.com/with-heart))\n- Anthony Fu <anthonyfu117@hotmail.com>\n- Xin Du (Clark) <clark.duxin@gmail.com>\n- Sébastien Chopin <seb@nuxtjs.com>\n- Thomas K ([@ThomasKoscheck](http://github.com/ThomasKoscheck))\n\n## v3.0.0-5\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.0-4...v3.0.0-5)\n\n### 🩹 Fixes\n\n- **fancy:** Improve colors ([99c2a4f](https://github.com/unjs/consola/commit/99c2a4f))\n\n### 💅 Refactors\n\n- **fancy:** Better start color and icon ([5a01d53](https://github.com/unjs/consola/commit/5a01d53))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.0.0-4\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.0-3...v3.0.0-4)\n\n### 🚀 Enhancements\n\n- `consola.fail` log level ([#153](https://github.com/unjs/consola/pull/153))\n- Pass `formatOptions` and other options to reporters ([d77286a](https://github.com/unjs/consola/commit/d77286a))\n- Show stack trace with `consola.trace` ([#151](https://github.com/unjs/consola/pull/151))\n\n### 🩹 Fixes\n\n- Type consola instance with built-in type functions ([1a4b893](https://github.com/unjs/consola/commit/1a4b893))\n- Default value for color format utils ([ec9be78](https://github.com/unjs/consola/commit/ec9be78))\n- **fancy:** Show time and tag on right when width cannot be determined ([#128](https://github.com/unjs/consola/pull/128))\n- Pass level from `CONSOLA_LEVEL` to the `defaults` ([#129](https://github.com/unjs/consola/pull/129))\n- **consola:** Type defaults overrides generic defaults ([d3d3c05](https://github.com/unjs/consola/commit/d3d3c05))\n\n### 💅 Refactors\n\n- Drop `json` and `winston` reporters ([5af0e99](https://github.com/unjs/consola/commit/5af0e99))\n- Move all options to `consola.options` without duplication ([2d31ef4](https://github.com/unjs/consola/commit/2d31ef4))\n- Move spam logic into `_lastLog` object ([cabd04f](https://github.com/unjs/consola/commit/cabd04f))\n- Remove global `async` option ([edd1bb9](https://github.com/unjs/consola/commit/edd1bb9))\n- **types:** Merge `LogTypeLiteral` and `logtype` types to `LogType` ([da1bc73](https://github.com/unjs/consola/commit/da1bc73))\n- ⚠️ Move log levels and types to constants ([514f5b3](https://github.com/unjs/consola/commit/514f5b3))\n- Use `index.node.ts` for main build ([b92d23b](https://github.com/unjs/consola/commit/b92d23b))\n- Improve types and exports ([b380d21](https://github.com/unjs/consola/commit/b380d21))\n- Improve fancy reporter ([bc90db8](https://github.com/unjs/consola/commit/bc90db8))\n- Revert back to `dist/index.*` for bw compatibility ([98e300f](https://github.com/unjs/consola/commit/98e300f))\n\n### 📖 Documentation\n\n- Fix links to the source files ([#172](https://github.com/unjs/consola/pull/172))\n\n### 🏡 Chore\n\n- Fix import in examples ([c4fff18](https://github.com/unjs/consola/commit/c4fff18))\n\n### ✅ Tests\n\n- Update test ([64fa81d](https://github.com/unjs/consola/commit/64fa81d))\n\n### 🎨 Styles\n\n- Prefer object spread instead of `Object.assign` ([c03268a](https://github.com/unjs/consola/commit/c03268a))\n\n#### ⚠️ Breaking Changes\n\n- ⚠️ Move log levels and types to constants ([514f5b3](https://github.com/unjs/consola/commit/514f5b3))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- With-heart ([@with-heart](http://github.com/with-heart))\n\n## v3.0.0-3\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.0-2...v3.0.0-3)\n\n### 💅 Refactors\n\n- Remove `globalThis` caching ([4e7b909](https://github.com/unjs/consola/commit/4e7b909))\n\n### 📦 Build\n\n- Use backward compatible cjs wrapper for default export ([e2e6aa6](https://github.com/unjs/consola/commit/e2e6aa6))\n\n### 🏡 Chore\n\n- Update shared exports ([8fc0fdd](https://github.com/unjs/consola/commit/8fc0fdd))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.0.0-2\n\n[compare changes](https://github.com/unjs/consola/compare/v3.0.0-1...v3.0.0-2)\n\n### 🚀 Enhancements\n\n- `consola.prompt` util ([#170](https://github.com/unjs/consola/pull/170))\n\n### 🏡 Chore\n\n- Rename dist-tag to 3.x ([3e8f1e0](https://github.com/unjs/consola/commit/3e8f1e0))\n- Update readme ([85bbe3a](https://github.com/unjs/consola/commit/85bbe3a))\n- Update badges ([cf7c6e5](https://github.com/unjs/consola/commit/cf7c6e5))\n- Update badges ([566ff68](https://github.com/unjs/consola/commit/566ff68))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n\n## v3.0.0-1\n\n[compare changes](https://github.com/unjs/consola/compare/v2.15.3...v3.0.0-1)\n\n>\n\n### 🚀 Enhancements\n\n- Default `logLevel` to 1 in test environments ([#134](https://github.com/unjs/consola/pull/134))\n- Support literal for logLevels ([#133](https://github.com/unjs/consola/pull/133))\n- Expose `createConsola` and named exports ([ef6e5e5](https://github.com/unjs/consola/commit/ef6e5e5))\n\n### 🔥 Performance\n\n- Switch from chalk to colorette ([271b4db](https://github.com/unjs/consola/commit/271b4db))\n- Remove `dayjs` dependency ([d6a3776](https://github.com/unjs/consola/commit/d6a3776))\n\n### 💅 Refactors\n\n- ⚠️ Rewrite consola with typescript ([4479d2f](https://github.com/unjs/consola/commit/4479d2f))\n- Rename `global` to `globalThis` ([bd03098](https://github.com/unjs/consola/commit/bd03098))\n- **utils:** Rename `global` to `globalThis` ([8c3ef77](https://github.com/unjs/consola/commit/8c3ef77))\n- Strict typechecks ([63bbd56](https://github.com/unjs/consola/commit/63bbd56))\n\n### 🏡 Chore\n\n- Make example/index.js working ([#110](https://github.com/unjs/consola/pull/110))\n- Add LICENSE ([#121](https://github.com/unjs/consola/pull/121))\n- **npm:** Update repository to unjs orgnization ([#125](https://github.com/unjs/consola/pull/125))\n- Add prerelease script ([cfaba5e](https://github.com/unjs/consola/commit/cfaba5e))\n- Hide rollup warn ([5c3b7f1](https://github.com/unjs/consola/commit/5c3b7f1))\n- Ignore coverage ([da557ac](https://github.com/unjs/consola/commit/da557ac))\n- Update examples ([e07e3ab](https://github.com/unjs/consola/commit/e07e3ab))\n\n#### ⚠️ Breaking Changes\n\n- ⚠️ Rewrite consola with typescript ([4479d2f](https://github.com/unjs/consola/commit/4479d2f))\n\n### ❤️ Contributors\n\n- Pooya Parsa ([@pi0](http://github.com/pi0))\n- Anthony Fu <anthonyfu117@hotmail.com>\n- Xin Du (Clark) <clark.duxin@gmail.com>\n- Sébastien Chopin <seb@nuxtjs.com>\n- Thomas K ([@ThomasKoscheck](http://github.com/ThomasKoscheck))\n\n### [2.15.3](https://github.com/unjs/consola/compare/v2.15.2...v2.15.3) (2021-02-07)\n\n### Bug Fixes\n\n- add `.raw` to mocked functions ([987dadc](https://github.com/unjs/consola/commit/987dadcc81a82698051ade2384ae2f0fc12d8aef))\n\n### [2.15.2](https://github.com/unjs/consola/compare/v2.15.1...v2.15.2) (2021-02-03)\n\n### Bug Fixes\n\n- add isRaw flag only for wrapped calls ([23b1184](https://github.com/unjs/consola/commit/23b1184e2897f5d33943bec7180fb2427402d400)), closes [unjs/unjs.js#8752](https://github.com/unjs/unjs.js/issues/8752)\n\n### [2.15.1](https://github.com/unjs/consola/compare/v2.15.0...v2.15.1) (2021-02-02)\n\n### Bug Fixes\n\n- skip logObj check for wrapped calls (fixes [#109](https://github.com/unjs/consola/issues/109)) ([091a244](https://github.com/unjs/consola/commit/091a24423bb9c28b7371e7af849b15c7e39747fa))\n\n## [2.15.0](https://github.com/unjs/consola/compare/v2.14.0...v2.15.0) (2020-08-05)\n\n### Features\n\n- **types:** use union type for `ConsolaLogObject.type` ([#100](https://github.com/unjs/consola/issues/100)) ([a6eba53](https://github.com/unjs/consola/commit/a6eba532381bcec9c84ac5600ac668aca87c8487))\n- support `formatOptions.date` to optionally hide date ([#101](https://github.com/unjs/consola/issues/101)) ([6bf733f](https://github.com/unjs/consola/commit/6bf733f2b9a5320584bdd0de7de08f4341c74335))\n\n## [2.14.0](https://github.com/unjs/consola/compare/v2.13.0...v2.14.0) (2020-06-26)\n\n### Features\n\n- improve spam throttle ([5314eee](https://github.com/unjs/consola/commit/5314eeebb4b564408a4ab14cb457bdbd426f6124))\n\n## [2.13.0](https://github.com/unjs/consola/compare/v2.12.2...v2.13.0) (2020-06-12)\n\n### Features\n\n- remove level boundary check ([8972d47](https://github.com/unjs/consola/commit/8972d478c93690fafb909f49d9d0edbcb67bddae))\n\n### Bug Fixes\n\n- **types:** fix silent/verbose levels ([7ab0a65](https://github.com/unjs/consola/commit/7ab0a65f383d9dd1b68a18ee439bf19468a57885))\n\n### [2.12.2](https://github.com/unjs/consola/compare/v2.12.1...v2.12.2) (2020-05-26)\n\n### Bug Fixes\n\n- silent log level does not work ([#98](https://github.com/unjs/consola/issues/98)) ([6a4a79c](https://github.com/unjs/consola/commit/6a4a79c24b8db902b078ad92a6ee7a33880ed26c))\n\n### [2.12.1](https://github.com/unjs/consola/compare/v2.12.0...v2.12.1) (2020-05-07)\n\n### Bug Fixes\n\n- new LogLevel enum is not exported properly [#95](https://github.com/unjs/consola/issues/95) ([#96](https://github.com/unjs/consola/issues/96)) ([fafbec2](https://github.com/unjs/consola/commit/fafbec2b1bc75912eea5d0618a27b982738d6cda))\n\n## [2.12.0](https://github.com/unjs/consola/compare/v2.11.3...v2.12.0) (2020-05-07)\n\n### Features\n\n- **types:** add missing typescript definitions for reporters ([#94](https://github.com/unjs/consola/issues/94)) ([4a08ef0](https://github.com/unjs/consola/commit/4a08ef02bc48ddc887f2b91713520eda50793a27))\n\n### [2.11.3](https://github.com/unjs/consola/compare/v2.11.2...v2.11.3) (2019-12-31)\n\n### Bug Fixes\n\n- **typescript:** remove cjs export (fixes [#88](https://github.com/unjs/consola/issues/88)) ([0d9ab1b](https://github.com/unjs/consola/commit/0d9ab1bba8645853c721069c57527764ed708869))\n\n### [2.11.2](https://github.com/unjs/consola/compare/v2.11.1...v2.11.2) (2019-12-27)\n\n### Bug Fixes\n\n- **types:** `const consola = require('consola')` type is wrong ([#80](https://github.com/unjs/consola/issues/80)) ([5c22d8c](https://github.com/unjs/consola/commit/5c22d8cd4624e3bbd7294b9eba09f131ed786332))\n- throttle expiration ([#81](https://github.com/unjs/consola/issues/81)) ([940474d](https://github.com/unjs/consola/commit/940474d3b64a4969acdec04290734e700920c19f)), closes [#68](https://github.com/unjs/consola/issues/68)\n\n### [2.11.1](https://github.com/unjs/consola/compare/v2.11.0...v2.11.1) (2019-12-17)\n\n### Bug Fixes\n\n- **consola:** use `options.stderr` ([#77](https://github.com/unjs/consola/issues/77)) ([774c673](https://github.com/unjs/consola/commit/774c6739e794665bc5e2c40aa84921b7f2a26387))\n\n## [2.11.0](https://github.com/unjs/consola/compare/v2.10.0...v2.11.0) (2019-11-10)\n\n### Features\n\n- **browser:** add support of formatted strings ([#66](https://github.com/unjs/consola/issues/66)) ([920f313](https://github.com/unjs/consola/commit/920f313dba322c34ccd1b2f08afba59122c3b8e7))\n\n### Bug Fixes\n\n- typecheck type and tag before normalize ([1984deb](https://github.com/unjs/consola/commit/1984deb0a5214a3aa82dab972ec76af20ba14d1b))\n- **types:** reporter in remove methods are optional ([#70](https://github.com/unjs/consola/issues/70)) ([a17cdb1](https://github.com/unjs/consola/commit/a17cdb1a423e41076c58692130955d5a9f5e36ba))\n\n### [2.10.1](https://github.com/unjs/consola/compare/v2.10.0...v2.10.1) (2019-08-05)\n\n## [2.10.0](https://github.com/unjs/consola/compare/v2.9.0...v2.10.0) (2019-08-05)\n\n### Bug Fixes\n\n- add missing typescript declaration for level, stdout and stderr ([#58](https://github.com/unjs/consola/issues/58)) ([a149dbb](https://github.com/unjs/consola/commit/a149dbb))\n\n### Features\n\n- improve typescript type definitions ([#57](https://github.com/unjs/consola/issues/57)) ([80eefd8](https://github.com/unjs/consola/commit/80eefd8))\n\n## [2.9.0](https://github.com/unjs/consola/compare/v2.8.0...v2.9.0) (2019-06-18)\n\n### Features\n\n- count spam log ([197a6b3](https://github.com/unjs/consola/commit/197a6b3))\n\n## [2.8.0](https://github.com/unjs/consola/compare/v2.7.1...v2.8.0) (2019-06-18)\n\n### Features\n\n- spam preventation ([7da806b](https://github.com/unjs/consola/commit/7da806b))\n\n### [2.7.1](https://github.com/unjs/consola/compare/v2.7.0...v2.7.1) (2019-05-26)\n\n### Bug Fixes\n\n- **browser:** hide `:` with tag and normal log ([8250d5a](https://github.com/unjs/consola/commit/8250d5a))\n\n## [2.7.0](https://github.com/unjs/consola/compare/v2.6.2...v2.7.0) (2019-05-26)\n\n### Bug Fixes\n\n- correctly calculate line width when using grave accent ([bad52bd](https://github.com/unjs/consola/commit/bad52bd))\n\n### Features\n\n- always hide right side on width < 80 ([07d8246](https://github.com/unjs/consola/commit/07d8246))\n- improve basic logs ([ea6ce59](https://github.com/unjs/consola/commit/ea6ce59))\n- **browser:** fancier logs ([b64f337](https://github.com/unjs/consola/commit/b64f337))\n- hide time from basic logger as it is commonly used in CI environments ([68c3bae](https://github.com/unjs/consola/commit/68c3bae))\n- smart hide time and tag when there is no space ([00a375f](https://github.com/unjs/consola/commit/00a375f))\n\n### [2.6.2](https://github.com/unjs/consola/compare/v2.6.1...v2.6.2) (2019-05-15)\n\n### Bug Fixes\n\n- transpile browser dist to ES5 ([1f81eea](https://github.com/unjs/consola/commit/1f81eea)), closes [unjs/unjs.js#5743](https://github.com/unjs/consola/issues/5743)\n\n### [2.6.1](https://github.com/unjs/consola/compare/v2.6.0...v2.6.1) (2019-05-08)\n\n### Bug Fixes\n\n- **browser:** use `console.warn` when possible ([#49](https://github.com/unjs/consola/issues/49)) ([e386ede](https://github.com/unjs/consola/commit/e386ede))\n\n# [2.6.0](https://github.com/unjs/consola/compare/v2.5.8...v2.6.0) (2019-04-12)\n\n### Features\n\n- expose constructor and reporters ([3a8f662](https://github.com/unjs/consola/commit/3a8f662))\n\n## [2.5.8](https://github.com/unjs/consola/compare/v2.5.7...v2.5.8) (2019-03-29)\n\n### Bug Fixes\n\n- **types:** allow passing extra arguments ([#46](https://github.com/unjs/consola/issues/46)) ([d29fc46](https://github.com/unjs/consola/commit/d29fc46))\n\n## [2.5.7](https://github.com/unjs/consola/compare/v2.5.6...v2.5.7) (2019-03-19)\n\n### Bug Fixes\n\n- **formatting:** fix formatting when multiple back-quotes ([#44](https://github.com/unjs/consola/issues/44)) ([669a12e](https://github.com/unjs/consola/commit/669a12e))\n\n## [2.5.6](https://github.com/unjs/consola/compare/v2.5.5...v2.5.6) (2019-02-25)\n\n### Bug Fixes\n\n- **ts:** revert export consola ts declarations ([#43](https://github.com/unjs/consola/issues/43)) ([6bd4f85](https://github.com/unjs/consola/commit/6bd4f85))\n\n<a name=\"2.4.1\"></a>\n\n## [2.4.1](https://github.com/unjs/consola/compare/v2.4.0...v2.4.1) (2019-02-12)\n\n### Bug Fixes\n\n- **ts:** set type \"any\" ([#40](https://github.com/unjs/consola/issues/40)) ([ea9d551](https://github.com/unjs/consola/commit/ea9d551))\n\n<a name=\"2.4.0\"></a>\n\n# [2.4.0](https://github.com/unjs/consola/compare/v2.3.2...v2.4.0) (2019-02-05)\n\n### Bug Fixes\n\n- **esm:** fix esm compatibility ([8ddecc3](https://github.com/unjs/consola/commit/8ddecc3))\n- **consola:** return `this` in setReporters ([544a887](https://github.com/unjs/consola/commit/544a887))\n- **types:** set message type to \"any\" ([#39](https://github.com/unjs/consola/issues/39)) ([ff97b09](https://github.com/unjs/consola/commit/ff97b09)), closes [#38](https://github.com/unjs/consola/issues/38)\n\n### Features\n\n- **types:** update types ([d0d7455](https://github.com/unjs/consola/commit/d0d7455))\n\n<a name=\"2.3.2\"></a>\n\n## [2.3.2](https://github.com/unjs/consola/compare/v2.3.1...v2.3.2) (2019-01-06)\n\n### Bug Fixes\n\n- **types:** add some of the missing types ([#35](https://github.com/unjs/consola/issues/35)) ([5e3e69b](https://github.com/unjs/consola/commit/5e3e69b))\n- ignore winston dep in webpack ([#37](https://github.com/unjs/consola/issues/37)) ([e534a28](https://github.com/unjs/consola/commit/e534a28))\n\n<a name=\"2.3.1\"></a>\n\n## [2.3.1](https://github.com/unjs/consola/compare/v2.3.0...v2.3.1) (2019-01-02)\n\n### Bug Fixes\n\n- bypass webpack for lazy required version of winston ([500b509](https://github.com/unjs/consola/commit/500b509))\n\n<a name=\"2.3.0\"></a>\n\n# [2.3.0](https://github.com/unjs/consola/compare/v2.2.6...v2.3.0) (2018-11-19)\n\n### Bug Fixes\n\n- **isLogObj:** handle non-standard error objects ([8748c81](https://github.com/unjs/consola/commit/8748c81))\n\n### Features\n\n- browser reporter improvements ([591d0b4](https://github.com/unjs/consola/commit/591d0b4)), closes [#31](https://github.com/unjs/consola/issues/31)\n- **fancy:** look like jest traces ([ecae238](https://github.com/unjs/consola/commit/ecae238))\n\n<a name=\"2.2.6\"></a>\n\n## [2.2.6](https://github.com/unjs/consola/compare/v2.2.5...v2.2.6) (2018-11-14)\n\n### Bug Fixes\n\n- **json-reporter:** add a default value to the constructor ([#33](https://github.com/unjs/consola/issues/33)) ([c59db36](https://github.com/unjs/consola/commit/c59db36))\n\n<a name=\"2.2.5\"></a>\n\n## [2.2.5](https://github.com/unjs/consola/compare/v2.2.4...v2.2.5) (2018-11-14)\n\n### Bug Fixes\n\n- expose typescript typings ([f0398ed](https://github.com/unjs/consola/commit/f0398ed))\n\n<a name=\"2.2.4\"></a>\n\n## [2.2.4](https://github.com/unjs/consola/compare/v2.2.3...v2.2.4) (2018-11-08)\n\n### Bug Fixes\n\n- use basic reporter only for ci and test environments ([33220e4](https://github.com/unjs/consola/commit/33220e4))\n\n<a name=\"2.2.3\"></a>\n\n## [2.2.3](https://github.com/unjs/consola/compare/v2.2.2...v2.2.3) (2018-11-07)\n\n### Bug Fixes\n\n- **fancy:** honor logObj.icon ([d56fa38](https://github.com/unjs/consola/commit/d56fa38))\n\n<a name=\"2.2.2\"></a>\n\n## [2.2.2](https://github.com/unjs/consola/compare/v2.2.1...v2.2.2) (2018-11-04)\n\n### Bug Fixes\n\n- update std-env to 2.1.1 ([32a9c67](https://github.com/unjs/consola/commit/32a9c67))\n\n<a name=\"2.2.1\"></a>\n\n## [2.2.1](https://github.com/unjs/consola/compare/v2.2.0...v2.2.1) (2018-11-04)\n\n### Bug Fixes\n\n- remove file:// from error stack traces ([ff24b69](https://github.com/unjs/consola/commit/ff24b69))\n\n<a name=\"2.2.0\"></a>\n\n# [2.2.0](https://github.com/unjs/consola/compare/v2.1.1...v2.2.0) (2018-11-04)\n\n### Bug Fixes\n\n- correctly handle falsy values ([367fb19](https://github.com/unjs/consola/commit/367fb19))\n\n### Features\n\n- support formatOptions. resolves [#29](https://github.com/unjs/consola/issues/29). ([7ed640f](https://github.com/unjs/consola/commit/7ed640f))\n\n<a name=\"2.1.1\"></a>\n\n## [2.1.1](https://github.com/unjs/consola/compare/v2.1.0...v2.1.1) (2018-11-03)\n\n### Bug Fixes\n\n- add legacy ready and start levels for more backward compatibility ([f54b5c2](https://github.com/unjs/consola/commit/f54b5c2))\n\n<a name=\"2.1.0\"></a>\n\n# [2.1.0](https://github.com/unjs/consola/compare/v2.0.9...v2.1.0) (2018-11-03)\n\n### Features\n\n- add aliases ([cbea7bd](https://github.com/unjs/consola/commit/cbea7bd))\n- mockTypes for easy mocking ([a332890](https://github.com/unjs/consola/commit/a332890))\n\n<a name=\"2.0.9\"></a>\n\n## [2.0.9](https://github.com/unjs/consola/compare/v2.0.8...v2.0.9) (2018-11-03)\n\n<a name=\"2.0.8\"></a>\n\n## [2.0.8](https://github.com/unjs/consola/compare/v2.0.7...v2.0.8) (2018-11-03)\n\n<a name=\"2.0.7\"></a>\n\n## [2.0.7](https://github.com/unjs/consola/compare/v2.0.6...v2.0.7) (2018-11-02)\n\n### Bug Fixes\n\n- always use computed values for stdout/stderr ([f91abc0](https://github.com/unjs/consola/commit/f91abc0))\n\n<a name=\"2.0.6\"></a>\n\n## [2.0.6](https://github.com/unjs/consola/compare/v2.0.5...v2.0.6) (2018-11-02)\n\n<a name=\"2.0.5\"></a>\n\n## [2.0.5](https://github.com/unjs/consola/compare/v2.0.4...v2.0.5) (2018-11-02)\n\n<a name=\"2.0.4\"></a>\n\n## [2.0.4](https://github.com/unjs/consola/compare/v2.0.3...v2.0.4) (2018-11-02)\n\n### Bug Fixes\n\n- **fancy:** remove extra icons ([b66fde0](https://github.com/unjs/consola/commit/b66fde0))\n\n<a name=\"2.0.3\"></a>\n\n## [2.0.3](https://github.com/unjs/consola/compare/v2.0.2...v2.0.3) (2018-11-02)\n\n### Bug Fixes\n\n- **pkg:** exclude src from package ([4b1fb7d](https://github.com/unjs/consola/commit/4b1fb7d))\n- use live console.\\_stdout bindings for default stream ([d9573c3](https://github.com/unjs/consola/commit/d9573c3))\n\n<a name=\"2.0.2\"></a>\n\n## [2.0.2](https://github.com/unjs/consola/compare/v2.0.1...v2.0.2) (2018-11-02)\n\n### Bug Fixes\n\n- **error:** always strip first line from stack ([3afa9aa](https://github.com/unjs/consola/commit/3afa9aa))\n\n<a name=\"2.0.1\"></a>\n\n## [2.0.1](https://github.com/unjs/consola/compare/v2.0.0...v2.0.1) (2018-11-02)\n\n### Bug Fixes\n\n- **fancy:** use proper color for log paths ([7c75283](https://github.com/unjs/consola/commit/7c75283))\n\n<a name=\"2.0.0\"></a>\n\n# [2.0.0](https://github.com/unjs/consola/compare/v2.0.0-2...v2.0.0) (2018-11-02)\n\n<a name=\"2.0.0-2\"></a>\n\n# [2.0.0-2](https://github.com/unjs/consola/compare/v2.0.0-1...v2.0.0-2) (2018-11-02)\n\n### Bug Fixes\n\n- add methods for legacy support ([4bdd034](https://github.com/unjs/consola/commit/4bdd034))\n- preserve additional new lines ([340a001](https://github.com/unjs/consola/commit/340a001))\n- update std-env to 2.1.0 ([2dc2a50](https://github.com/unjs/consola/commit/2dc2a50))\n\n### Features\n\n- support badge with fancy ([38600fe](https://github.com/unjs/consola/commit/38600fe))\n\n<a name=\"2.0.0-1\"></a>\n\n# [2.0.0-1](https://github.com/unjs/consola/compare/v2.0.0-0...v2.0.0-1) (2018-10-31)\n\n<a name=\"2.0.0-0\"></a>\n\n# [2.0.0-0](https://github.com/unjs/consola/compare/v1.4.4...v2.0.0-0) (2018-10-31)\n\n### Bug Fixes\n\n- add schmance.js ([2929648](https://github.com/unjs/consola/commit/2929648))\n- **docs:** update readme ([#22](https://github.com/unjs/consola/issues/22)) ([e75f2a0](https://github.com/unjs/consola/commit/e75f2a0))\n- add default/undefined color for browser ([39584d2](https://github.com/unjs/consola/commit/39584d2))\n- add missing parseStack import ([da53dee](https://github.com/unjs/consola/commit/da53dee))\n- also copy symbols in assignGlobalReference ([b0eefb5](https://github.com/unjs/consola/commit/b0eefb5))\n- don't return this when calling log functions ([f07e056](https://github.com/unjs/consola/commit/f07e056))\n- fix badge display ([e036eed](https://github.com/unjs/consola/commit/e036eed))\n- fix main field ([4b56e48](https://github.com/unjs/consola/commit/4b56e48))\n- fix typos ([45e2f99](https://github.com/unjs/consola/commit/45e2f99))\n- handle null value of obj for assignToLogObj ([d2402af](https://github.com/unjs/consola/commit/d2402af))\n- improve browser packaging ([4d8c8d0](https://github.com/unjs/consola/commit/4d8c8d0))\n- lint ([f909761](https://github.com/unjs/consola/commit/f909761))\n- lint ([d976620](https://github.com/unjs/consola/commit/d976620))\n- only one color ending parameter is enough ([d213634](https://github.com/unjs/consola/commit/d213634))\n- readme: icon string length is digit ([31f1894](https://github.com/unjs/consola/commit/31f1894))\n- remove name assignment ([8d59075](https://github.com/unjs/consola/commit/8d59075))\n- remove pushes for better readability ([418d84a](https://github.com/unjs/consola/commit/418d84a))\n- rename private fields ([244fe5c](https://github.com/unjs/consola/commit/244fe5c))\n- rename require test file ([cfc8f9e](https://github.com/unjs/consola/commit/cfc8f9e))\n- return earlier on not displaying levels ([cfdcf04](https://github.com/unjs/consola/commit/cfdcf04))\n- support Error as logObject ([134ff54](https://github.com/unjs/consola/commit/134ff54))\n- text color comment ([9336fbc](https://github.com/unjs/consola/commit/9336fbc))\n- update demo ([3842e0e](https://github.com/unjs/consola/commit/3842e0e))\n- use symbols for private property access ([8e6343c](https://github.com/unjs/consola/commit/8e6343c))\n\n### Code Refactoring\n\n- additionalStyle ~> additionalColor ([3f808e9](https://github.com/unjs/consola/commit/3f808e9))\n\n### Features\n\n- add **VERSION** to consola prototype ([982c8ca](https://github.com/unjs/consola/commit/982c8ca))\n- add assignGlobalConsola helper ([1af28f7](https://github.com/unjs/consola/commit/1af28f7))\n- add getter/setter for level ([7af5ed5](https://github.com/unjs/consola/commit/7af5ed5))\n- add global.consola ([4da784d](https://github.com/unjs/consola/commit/4da784d))\n- add shmancy reporter ([dc6121a](https://github.com/unjs/consola/commit/dc6121a))\n- add symbols to browser ([30cd4f0](https://github.com/unjs/consola/commit/30cd4f0))\n- add sync/async write ([8525525](https://github.com/unjs/consola/commit/8525525))\n- add typescript typings ([#24](https://github.com/unjs/consola/issues/24)) ([0853a6f](https://github.com/unjs/consola/commit/0853a6f))\n- align basic and fancy reporter tags ([38a4729](https://github.com/unjs/consola/commit/38a4729))\n- better stack formater ([f5acb3c](https://github.com/unjs/consola/commit/f5acb3c))\n- detect version changes and throw a warning ([73bdd1a](https://github.com/unjs/consola/commit/73bdd1a))\n- improve packaging and exports ([90da862](https://github.com/unjs/consola/commit/90da862))\n- improve packaging for browser support ([47af1df](https://github.com/unjs/consola/commit/47af1df))\n- initial works for v2.0.0 ([455b6f9](https://github.com/unjs/consola/commit/455b6f9))\n- log formatting using printf ([2afb025](https://github.com/unjs/consola/commit/2afb025))\n- no more side effects ([c015c31](https://github.com/unjs/consola/commit/c015c31))\n- pause/resume ([f217cc1](https://github.com/unjs/consola/commit/f217cc1))\n- return new consola instance with consola.create ([4ae3614](https://github.com/unjs/consola/commit/4ae3614))\n- rework \\_createLogFn with better argument handling ([2d4af39](https://github.com/unjs/consola/commit/2d4af39))\n- scope inheritance support ([#23](https://github.com/unjs/consola/issues/23)) ([0070c54](https://github.com/unjs/consola/commit/0070c54))\n- **fancy/basic:** support logObj.stack field ([aa2216f](https://github.com/unjs/consola/commit/aa2216f))\n- setReporters, withDefaults and withTag ([912446f](https://github.com/unjs/consola/commit/912446f))\n- showType option ([ed294e4](https://github.com/unjs/consola/commit/ed294e4))\n- style browser reporter ([d39684d](https://github.com/unjs/consola/commit/d39684d))\n- support all chalk colors ([2cec678](https://github.com/unjs/consola/commit/2cec678)), closes [#20](https://github.com/unjs/consola/issues/20)\n- wrapConsole ([3962a1f](https://github.com/unjs/consola/commit/3962a1f))\n- wrapStd ([f8bfbeb](https://github.com/unjs/consola/commit/f8bfbeb))\n- write error and warns to process.stderr by default ([6565254](https://github.com/unjs/consola/commit/6565254))\n\n### Performance Improvements\n\n- **basic:** refactor getWriteMethod ([c52db69](https://github.com/unjs/consola/commit/c52db69))\n- remove all DEPRECATED helpers for less bundle size ([fe39d37](https://github.com/unjs/consola/commit/fe39d37))\n\n### BREAKING CHANGES\n\n- Use new additionalColor prop\n- lot's of internals had been changed.\n- Behavior may be changed in some conditions\n\n<a name=\"1.4.4\"></a>\n\n## [1.4.4](https://github.com/unjs/consola/compare/v1.4.3...v1.4.4) (2018-10-13)\n\n### Bug Fixes\n\n- add global.consola ([558cae5](https://github.com/unjs/consola/commit/558cae5))\n\n<a name=\"1.4.3\"></a>\n\n## [1.4.3](https://github.com/unjs/consola/compare/v1.4.2...v1.4.3) (2018-08-18)\n\n### Bug Fixes\n\n- use more compatible string to clear the console ([82ce410](https://github.com/unjs/consola/commit/82ce410))\n\n<a name=\"1.4.2\"></a>\n\n## [1.4.2](https://github.com/unjs/consola/compare/v1.4.1...v1.4.2) (2018-08-12)\n\n### Bug Fixes\n\n- cannot set level as 0 in options ([4c1ecce](https://github.com/unjs/consola/commit/4c1ecce))\n\n<a name=\"1.4.1\"></a>\n\n## [1.4.1](https://github.com/unjs/consola/compare/v1.4.0...v1.4.1) (2018-05-27)\n\n### Bug Fixes\n\n- **fancy:** logObj.type ([418be28](https://github.com/unjs/consola/commit/418be28))\n\n<a name=\"1.4.0\"></a>\n\n# [1.4.0](https://github.com/unjs/consola/compare/v1.3.0...v1.4.0) (2018-05-27)\n\n### Features\n\n- support custom additional style ([#18](https://github.com/unjs/consola/issues/18)) ([7a750bf](https://github.com/unjs/consola/commit/7a750bf))\n- **fancy:** support icon field ([0123bed](https://github.com/unjs/consola/commit/0123bed))\n\n<a name=\"1.3.0\"></a>\n\n# [1.3.0](https://github.com/unjs/consola/compare/v1.2.0...v1.3.0) (2018-04-15)\n\n### Bug Fixes\n\n- **reporters/fancy:** extra space for additional ([efeab44](https://github.com/unjs/consola/commit/efeab44))\n- prevent duplicate consola instances when different versions used by packages ([0bce262](https://github.com/unjs/consola/commit/0bce262))\n\n### Features\n\n- support extra log arguments ([8b6d3d2](https://github.com/unjs/consola/commit/8b6d3d2))\n\n<a name=\"1.2.0\"></a>\n\n# [1.2.0](https://github.com/unjs/consola/compare/v1.1.4...v1.2.0) (2018-04-02)\n\n### Features\n\n- **basic:** support additional field ([b50cad8](https://github.com/unjs/consola/commit/b50cad8))\n- improve packaging ([158e8ef](https://github.com/unjs/consola/commit/158e8ef))\n\n### Performance Improvements\n\n- require needed lodash methods only ([91065e4](https://github.com/unjs/consola/commit/91065e4))\n\n<a name=\"1.1.4\"></a>\n\n## [1.1.4](https://github.com/unjs/consola/compare/v1.1.3...v1.1.4) (2018-03-31)\n\n### Bug Fixes\n\n- **package:** add chalk to dependencies ([3f738e9](https://github.com/unjs/consola/commit/3f738e9))\n\n<a name=\"1.1.3\"></a>\n\n## [1.1.3](https://github.com/unjs/consola/compare/v1.1.2...v1.1.3) (2018-03-31)\n\n### Bug Fixes\n\n- only include dist and src in package ([8b477ec](https://github.com/unjs/consola/commit/8b477ec))\n\n<a name=\"1.1.2\"></a>\n\n## [1.1.2](https://github.com/unjs/consola/compare/v1.1.1...v1.1.2) (2018-03-31)\n\n### Bug Fixes\n\n- handle null and undefined calls ([1f98bb1](https://github.com/unjs/consola/commit/1f98bb1))\n\n<a name=\"1.1.1\"></a>\n\n## [1.1.1](https://github.com/unjs/consola/compare/v1.1.0...v1.1.1) (2018-03-31)\n\n### Bug Fixes\n\n- add prepublish script ([8dd8700](https://github.com/unjs/consola/commit/8dd8700))\n\n<a name=\"1.1.0\"></a>\n\n# [1.1.0](https://github.com/unjs/consola/compare/v1.0.0...v1.1.0) (2018-03-31)\n\n### Features\n\n- rewrite FancyReporter without ora ([73c1ddc](https://github.com/unjs/consola/commit/73c1ddc))\n\n<a name=\"1.0.0\"></a>\n\n# [1.0.0](https://github.com/unjs/consola/compare/v0.1.0...v1.0.0) (2018-03-31)\n\n<a name=\"0.1.0\"></a>\n\n# 0.1.0 (2018-03-31)\n\n### Features\n\n- add log type for console compability ([96a8162](https://github.com/unjs/consola/commit/96a8162))\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) Pooya Parsa <pooya@pi0.io>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n---\n\nPrompt support is based on https://github.com/bombshell-dev/clack\n\nMIT License\n\nCopyright (c) Nate Moore\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n\n---\n\nColor support is based on https://github.com/jorgebucaran/colorette\n\nCopyright © Jorge Bucaran <https://jorgebucaran.com>\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n"
  },
  {
    "path": "README.md",
    "content": "# 🐨 Consola\n\n> Elegant Console Wrapper\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n\n<!-- [![Codecov][codecov-src]][codecov-href] -->\n\n## Why Consola?\n\n👌&nbsp; Easy to use<br>\n💅&nbsp; Fancy output with fallback for minimal environments<br>\n🔌&nbsp; Pluggable reporters<br>\n💻&nbsp; Consistent command line interface (CLI) experience<br>\n🏷&nbsp; Tag support<br>\n🚏&nbsp; Redirect `console` and `stdout/stderr` to consola and easily restore redirect.<br>\n🌐&nbsp; Browser support<br>\n⏯&nbsp; Pause/Resume support<br>\n👻&nbsp; Mocking support<br>\n👮‍♂️&nbsp; Spam prevention by throttling logs<br>\n❯&nbsp; Interactive prompt support powered by [`clack`](https://github.com/natemoo-re/clack)<br>\n\n## Installation\n\nUsing npm:\n\n```bash\nnpm i consola\n```\n\nUsing yarn:\n\n```bash\nyarn add consola\n```\n\nUsing pnpm:\n\n```bash\npnpm i consola\n```\n\n## Getting Started\n\n```js\n// ESM\nimport { consola, createConsola } from \"consola\";\n\n// CommonJS\nconst { consola, createConsola } = require(\"consola\");\n\nconsola.info(\"Using consola 3.0.0\");\nconsola.start(\"Building project...\");\nconsola.warn(\"A new version of consola is available: 3.0.1\");\nconsola.success(\"Project built!\");\nconsola.error(new Error(\"This is an example error. Everything is fine!\"));\nconsola.box(\"I am a simple box\");\nawait consola.prompt(\"Deploy to the production?\", {\n  type: \"confirm\",\n});\n```\n\nWill display in the terminal:\n\n![consola-screenshot](https://github.com/unjs/consola/assets/904724/0e511ee6-2543-43ab-9eda-152f07134d94)\n\nYou can use smaller core builds without fancy reporter to save 80% of the bundle size:\n\n```ts\nimport { consola, createConsola } from \"consola/basic\";\nimport { consola, createConsola } from \"consola/browser\";\nimport { createConsola } from \"consola/core\";\n```\n\n## Consola Methods\n\n#### `<type>(logObject)` `<type>(args...)`\n\nLog to all reporters.\n\nExample: `consola.info('Message')`\n\n#### `await prompt(message, { type, cancel })`\n\nShow an input prompt. Type can either of `text`, `confirm`, `select` or `multiselect`.\n\nIf prompt is canceled by user (with Ctrol+C), default value will be resolved by default. This strategy can be configured by setting `{ cancel: \"...\" }` option:\n\n- `\"default\"` - Resolve the promise with the `default` value or `initial` value.\n- `\"undefined`\" - Resolve the promise with `undefined`.\n- `\"null\"` - Resolve the promise with `null`.\n- `\"symbol\"` - Resolve the promise with a symbol `Symbol.for(\"cancel\")`.\n- `\"reject\"` - Reject the promise with an error.\n\nSee [examples/prompt.ts](./examples/prompt.ts) for usage examples.\n\n#### `addReporter(reporter)`\n\n- Aliases: `add`\n\nRegister a custom reporter instance.\n\n#### `removeReporter(reporter?)`\n\n- Aliases: `remove`, `clear`\n\nRemove a registered reporter.\n\nIf no arguments are passed all reporters will be removed.\n\n#### `setReporters(reporter|reporter[])`\n\nReplace all reporters.\n\n#### `create(options)`\n\nCreate a new `Consola` instance and inherit all parent options for defaults.\n\n#### `withDefaults(defaults)`\n\nCreate a new `Consola` instance with provided defaults\n\n#### `withTag(tag)`\n\n- Aliases: `withScope`\n\nCreate a new `Consola` instance with that tag.\n\n#### `wrapConsole()` `restoreConsole()`\n\nGlobally redirect all `console.log`, etc calls to consola handlers.\n\n#### `wrapStd()` `restoreStd()`\n\nGlobally redirect all stdout/stderr outputs to consola.\n\n#### `wrapAll()` `restoreAll()`\n\nWrap both, std and console.\n\nconsole uses std in the underlying so calling `wrapStd` redirects console too.\nBenefit of this function is that things like `console.info` will be correctly redirected to the corresponding type.\n\n#### `pauseLogs()` `resumeLogs()`\n\n- Aliases: `pause`/`resume`\n\n**Globally** pause and resume logs.\n\nConsola will enqueue all logs when paused and then sends them to the reported when resumed.\n\n#### `mockTypes`\n\n- Aliases: `mock`\n\nMock all types. Useful for using with tests.\n\nThe first argument passed to `mockTypes` should be a callback function accepting `(typeName, type)` and returning the mocked value:\n\n```js\n// Jest\nconsola.mockTypes((typeName, type) => jest.fn());\n// Vitest\nconsola.mockTypes((typeName, type) => vi.fn());\n```\n\nPlease note that with the example above, everything is mocked independently for each type. If you need one mocked fn create it outside:\n\n```js\n// Jest\nconst fn = jest.fn();\n// Vitest\nconst fn = vi.fn();\nconsola.mockTypes(() => fn);\n```\n\nIf callback function returns a _falsy_ value, that type won't be mocked.\n\nFor example if you just need to mock `consola.fatal`:\n\n```js\n// Jest\nconsola.mockTypes((typeName) => typeName === \"fatal\" && jest.fn());\n// Vitest\nconsola.mockTypes((typeName) => typeName === \"fatal\" && vi.fn());\n```\n\n**NOTE:** Any instance of consola that inherits the mocked instance, will apply provided callback again.\nThis way, mocking works for `withTag` scoped loggers without need to extra efforts.\n\n## Custom Reporters\n\nConsola ships with 3 built-in reporters out of the box. A fancy colored reporter by default and fallsback to a basic reporter if running in a testing or CI environment detected using [unjs/std-env](https://github.com/unjs/std-env) and a basic browser reporter.\n\nYou can create a new reporter object that implements `{ log(logObject): () => { } }` interface.\n\n**Example:** Simple JSON reporter\n\n```ts\nimport { createConsola } from \"consola\";\n\nconst consola = createConsola({\n  reporters: [\n    {\n      log: (logObj) => {\n        console.log(JSON.stringify(logObj));\n      },\n    },\n  ],\n});\n\n// Prints {\"date\":\"2023-04-18T12:43:38.693Z\",\"args\":[\"foo bar\"],\"type\":\"log\",\"level\":2,\"tag\":\"\"}\nconsola.log(\"foo bar\");\n```\n\n**Example:** Exit on fatal errors\n\n```ts\nimport { consola } from 'consola';\n\nconsola.addReporter({\n  log(logObj) {\n    if(logObj.type === 'fatal') {\n      process.exit(1)\n    }\n  }\n})\n\n// Will exit on this line.\nconsola.fatal(\"fatal error\");\n```\n\n## Log Level\n\nConsola only shows logs with configured log level or below. (Default is `3`)\n\nAvailable log levels:\n\n- `0`: Fatal and Error\n- `1`: Warnings\n- `2`: Normal logs\n- `3`: Informational logs, success, fail, ready, start, ...\n- `4`: Debug logs\n- `5`: Trace logs\n- `-999`: Silent\n- `+999`: Verbose logs\n\nYou can set the log level by either:\n\n- Passing `level` option to `createConsola`\n- Setting `consola.level` on instance\n- Using the `CONSOLA_LEVEL` environment variable (not supported for browser and core builds).\n\n## Log Types\n\nLog types are exposed as `consola.[type](...)` and each is a preset of styles and log level.\n\nA list of all available built-in types is [available here](./src/constants.ts).\n\n## Creating a new instance\n\nConsola has a global instance and is recommended to use everywhere.\nIn case more control is needed, create a new instance.\n\n```js\nimport { createConsola } from \"consola\";\n\nconst logger = createConsola({\n  // level: 4,\n  // fancy: true | false\n  // formatOptions: {\n  //     columns: 80,\n  //     colors: false,\n  //     compact: false,\n  //     date: false,\n  // },\n});\n```\n\n## Integrations\n\n### With jest or vitest\n\n```js\ndescribe(\"your-consola-mock-test\", () => {\n  beforeAll(() => {\n    // Redirect std and console to consola too\n    // Calling this once is sufficient\n    consola.wrapAll();\n  });\n\n  beforeEach(() => {\n    // Re-mock consola before each test call to remove\n    // calls from before\n    // Jest\n    consola.mockTypes(() => jest.fn());\n    // Vitest\n    consola.mockTypes(() => vi.fn());\n  });\n\n  test(\"your test\", async () => {\n    // Some code here\n\n    // Let's retrieve all messages of `consola.log`\n    // Get the mock and map all calls to their first argument\n    const consolaMessages = consola.log.mock.calls.map((c) => c[0]);\n    expect(consolaMessages).toContain(\"your message\");\n  });\n});\n```\n\n### With jsdom\n\n```js\n{\n  new jsdom.VirtualConsole().sendTo(consola);\n}\n```\n\n## Console Utils\n\n```ts\n// ESM\nimport {\n  stripAnsi,\n  centerAlign,\n  rightAlign,\n  leftAlign,\n  align,\n  box,\n  colors,\n  getColor,\n  colorize,\n} from \"consola/utils\";\n\n// CommonJS\nconst { stripAnsi } = require(\"consola/utils\");\n```\n\n## Raw logging methods\n\nObjects sent to the reporter could lead to unexpected output when object is close to internal object structure containing either `message` or `args` props. To enforce the object to be interpreted as pure object, you can use the `raw` method chained to any log type.\n\n**Example:**\n\n```js\n// Prints \"hello\"\nconsola.log({ message: \"hello\" });\n\n// Prints \"{ message: 'hello' }\"\nconsola.log.raw({ message: \"hello\" });\n```\n\n## License\n\nMIT\n\n<!-- Badges -->\n\n[npm-version-src]: https://img.shields.io/npm/v/consola?style=flat&colorA=18181B&colorB=F0DB4F\n[npm-version-href]: https://npmjs.com/package/consola\n[npm-downloads-src]: https://img.shields.io/npm/dm/consola?style=flat&colorA=18181B&colorB=F0DB4F\n[npm-downloads-href]: https://npmjs.com/package/consola\n[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/consola/main?style=flat&colorA=18181B&colorB=F0DB4F\n[codecov-href]: https://codecov.io/gh/unjs/consola\n[bundle-src]: https://img.shields.io/bundlephobia/min/consola?style=flat&colorA=18181B&colorB=F0DB4F\n[bundle-href]: https://bundlephobia.com/result?p=consola\n"
  },
  {
    "path": "basic.d.ts",
    "content": "export * from \"./dist/basic\";\n"
  },
  {
    "path": "browser.d.ts",
    "content": "export * from \"./dist/browser\";\n"
  },
  {
    "path": "build.config.ts",
    "content": "import { defineBuildConfig } from \"unbuild\";\n\nexport default defineBuildConfig({\n  rollup: {\n    inlineDependencies: true,\n  },\n  hooks: {\n    \"rollup:options\"(_, options) {\n      for (const output of options.output as any[]) {\n        // @ts-ignore\n        output.exports = \"named\";\n      }\n\n      // Prompts theme\n      // https://github.com/bombshell-dev/clack/issues/36\n      options.plugins.push({\n        name: \"@clack/prompts\",\n        transform(code, id) {\n          if (id.endsWith(\"@clack/prompts/dist/index.mjs\")) {\n            const replaces = [\n              [\"}  $\", \"} $\"],\n              [String.raw`\"\\u25C6\",\"*\"`, '\"❯\", \">\"'],\n              [String.raw`\"\\u25A0\",\"x\"`, '\"■\", \"x\"'],\n              [String.raw`\"\\u25B2\",\"x\"`, '\"▲\", \"x\"'],\n              [String.raw`\"\\u25C7\",\"o\"`, '\"✔\", \"√\"'],\n              [String.raw`\"\\u250C\",\"T\"`, '\"\"'],\n              [String.raw`\"\\u2502\",\"|\"`, '\"\"'],\n              [String.raw`\"\\u2514\",\"\\u2014\"`, '\"\"'],\n            ] as const;\n            for (const [from, to] of replaces) {\n              code = code.replaceAll(from, to);\n            }\n            return code;\n          }\n        },\n      });\n\n      // Node.js 14 support\n      // https://github.com/unjs/consola/issues/204\n      options.plugins.push({\n        name: \"icu-compat\",\n        transform(code, id) {\n          if (id.endsWith(\"string-width/index.js\")) {\n            return code.replace(\n              \"const segmenter = new Intl.Segmenter();\",\n              \"const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split('') };\",\n            );\n          }\n        },\n      });\n    },\n  },\n});\n"
  },
  {
    "path": "core.d.ts",
    "content": "export * from \"./dist/core\";\n"
  },
  {
    "path": "eslint.config.mjs",
    "content": "import unjs from \"eslint-config-unjs\";\n\n// https://github.com/unjs/eslint-config\nexport default unjs({\n  ignores: [],\n  rules: {\n    \"no-undef\": 0,\n    \"unicorn/prefer-module\": 0,\n    \"unicorn/prefer-top-level-await\": 0,\n    \"unicorn/no-null\": 0,\n    \"@typescript-eslint/no-unused-vars\": 0,\n    \"unicorn/expiring-todo-comments\": 0,\n  },\n  markdown: {\n    rules: {\n      'unicorn/no-process-exit': 0,\n    }\n  }\n});\n"
  },
  {
    "path": "examples/basic.ts",
    "content": "import { reporterDemo } from \"./utils\";\n\nreporterDemo({\n  fancy: false,\n});\n"
  },
  {
    "path": "examples/box.ts",
    "content": "import { consola } from \"./utils\";\nimport { colors } from \"../src/utils\";\n\nfunction main() {\n  consola.box(`I am the default banner`);\n\n  consola.box(\n    `${colors.red(\"I\")} ${colors.yellowBright(\"am\")} ${colors.yellow(\"the\")} ${colors.green(\"rainbow\")} ${colors.blue(\"banner\")}`,\n  );\n\n  consola.box({\n    title: \"longer title\",\n    message: \"short msg\",\n  });\n\n  consola.box({\n    title: \"Box with options\",\n    message: `I am a banner with different options`,\n    style: {\n      padding: 1,\n      borderColor: \"magenta\",\n      borderStyle: \"double-single-rounded\",\n    },\n  });\n\n  consola.box({\n    title: \"Update available for `consola`\",\n    message: `\\`v1.0.2\\` → \\`v2.0.0\\`\\n\\nRun \\`npm install -g consola\\` to update`,\n    style: {\n      padding: 2,\n      borderColor: \"yellow\",\n      borderStyle: \"rounded\",\n    },\n  });\n}\n\nmain();\n"
  },
  {
    "path": "examples/error.ts",
    "content": "import { consola } from \"./utils\";\n\nconst error = new Error(\"This is an error\\nWith second line\\nAnd another\", {\n  cause: new Error(\"This is the cause\", {\n    cause: new Error(\"This is the cause of the cause\"),\n  }),\n});\n\nconsole.error(error);\n\nconsole.log(\"\\n\");\n\nconsola.error(error);\n"
  },
  {
    "path": "examples/fancy.ts",
    "content": "import { reporterDemo } from \"./utils\";\n\nreporterDemo({\n  fancy: true,\n});\n"
  },
  {
    "path": "examples/index.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>Consola</title>\n  </head>\n  <body>\n    Open developer tools to see the magic!\n    <script type=\"module\">\n      import consola from \"../src/browser.js\";\n      consola.level = 5;\n\n      consola.wrapAll();\n\n      for (let type of Object.keys(consola.options.types).sort()) {\n        consola[type](\"Open developer tools to see the magic!\");\n      }\n\n      consola.withTag(\"customTag\").info(\"Im from custom world!\");\n      consola.withTag(\"customTag\").log(\"Im from custom world!\");\n\n      consola.error(new Error(\"Whoo Haha\"));\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/index.legacy.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>Consola</title>\n  </head>\n  <body>\n    Open developer tools to see the magic!\n    <script src=\"../dist/consola.browser.js\"></script>\n    <script>\n      consola.level = 5;\n\n      consola.wrapAll();\n\n      for (let type of Object.keys(consola.options.types).sort()) {\n        consola[type](\"Open developer tools to see the magic!\");\n      }\n\n      consola.withTag(\"customTag\").info(\"Im from custom world!\");\n\n      consola.error(new Error(\"Whoo Haha\"));\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/json.ts",
    "content": "import { createConsola } from \"consola\";\n\nconst consola = createConsola({\n  reporters: [\n    {\n      log: (logObj) => {\n        console.log(JSON.stringify(logObj));\n      },\n    },\n  ],\n});\n\nconsola.log(\"foo bar\");\n"
  },
  {
    "path": "examples/mock.ts",
    "content": "import { consola } from \"./utils\";\n\nfunction mockFn(type) {\n  if (type === \"info\") {\n    return function () {\n      this.log(\"(mocked fn with info tag)\");\n    };\n  }\n}\n\nconsola.info(\"before\");\n\nconsola.mockTypes(mockFn);\n\nconst tagged = consola.withTag(\"newTag\");\n\nconsola.log(\"log is not mocked!\");\n\nconsola.info(\"Dont see me\");\ntagged.info(\"Dont see me too\");\n"
  },
  {
    "path": "examples/no-width.ts",
    "content": "import { createConsola } from \"../src\";\n\nfunction main() {\n  const consola = createConsola({\n    formatOptions: { columns: 0 },\n  });\n  consola.info(\"Foobar\");\n  const scoped = consola.withTag(\"test\");\n  scoped.success(\"Foobar\");\n}\n\nmain();\n"
  },
  {
    "path": "examples/pause.ts",
    "content": "import { consola } from \"./utils\";\n\nconst c1 = consola.withTag(\"foo\");\nconst c2 = consola.withTag(\"bar\");\n\nconsola.log(\"before pause\");\n\nc2.pause();\n\nc1.log(\"C1 is ready\");\nc2.log(\"C2 is ready\");\n\nsetTimeout(() => {\n  consola.resume();\n  consola.log(\"Yo!\");\n}, 1000);\n"
  },
  {
    "path": "examples/prompt.mjs",
    "content": "#!/usr/bin/env node\n\nimport { consola } from \"../dist/index.mjs\";\n\nconst name = await consola.prompt(\"What is your name?\", {\n  placeholder: \"Not sure\",\n  initial: \"java\",\n  cancel: \"undefined\",\n});\n\nif (!name) {\n  process.exit(1);\n}\n\nconst confirmed = await consola.prompt(\"Do you want to continue?\", {\n  type: \"confirm\",\n  cancel: \"undefined\",\n});\n\nif (!confirmed) {\n  process.exit(1);\n}\n\nconst projectType = await consola.prompt(\"Pick a project type.\", {\n  type: \"select\",\n  options: [\n    \"JavaScript\",\n    \"TypeScript\",\n    { label: \"CoffeeScript\", value: \"CoffeeScript\", hint: \"oh no\" },\n  ],\n  cancel: \"undefined\",\n  initial: \"TypeScript\",\n});\n\nif (!projectType) {\n  process.exit(1);\n}\n\nconst tools = await consola.prompt(\"Select additional tools.\", {\n  type: \"multiselect\",\n  required: false,\n  options: [\n    { value: \"eslint\", label: \"ESLint\", hint: \"recommended\" },\n    { value: \"prettier\", label: \"Prettier\" },\n    { value: \"gh-action\", label: \"GitHub Action\" },\n  ],\n  cancel: \"undefined\",\n  initial: [\"eslint\", \"prettier\"],\n});\n\nif (!tools) {\n  process.exit(1);\n}\n\nconsola.start(\"Creating project...\");\nawait new Promise((resolve) => setTimeout(resolve, 1000));\nconsola.success(\"Project created!\");\n"
  },
  {
    "path": "examples/prompt.ts",
    "content": "import { consola } from \"./utils\";\n\nasync function main() {\n  const name = await consola.prompt(\"What is your name?\", {\n    placeholder: \"Not sure\",\n    initial: \"java\",\n  });\n\n  const confirmed = await consola.prompt(\"Do you want to continue?\", {\n    type: \"confirm\",\n  });\n\n  const projectType = await consola.prompt(\"Pick a project type.\", {\n    type: \"select\",\n    options: [\n      \"JavaScript\",\n      \"TypeScript\",\n      { label: \"CoffeeScript\", value: \"CoffeeScript\", hint: \"oh no\" },\n    ],\n    initial: \"TypeScript\",\n  });\n\n  const tools = await consola.prompt(\"Select additional tools.\", {\n    type: \"multiselect\",\n    required: false,\n    options: [\n      { value: \"eslint\", label: \"ESLint\", hint: \"recommended\" },\n      { value: \"prettier\", label: \"Prettier\" },\n      { value: \"gh-action\", label: \"GitHub Action\" },\n    ],\n    initial: [\"eslint\", \"prettier\"],\n  });\n\n  consola.start(\"Creating project...\");\n  await new Promise((resolve) => setTimeout(resolve, 1000));\n  consola.success(\"Project created!\");\n}\n\nmain();\n"
  },
  {
    "path": "examples/raw.ts",
    "content": "import { consola } from \"./utils\";\n\nconsola.log('consola.log({ message: \"hello\" })');\n// Prints \"hello\"\nconsola.log({ message: \"hello\" });\n\nconsola.log('consola.log.raw({ message: \"hello\" })');\n// Prints \"{ message: 'hello' }\"\nconsola.log.raw({ message: \"hello\" });\n"
  },
  {
    "path": "examples/sample.ts",
    "content": "import { consola } from \"../src\";\n\nasync function main() {\n  consola.warn(\"A new version of consola is available: 3.0.1\");\n  consola.error(new Error(\"This is an example error. Everything is fine!\"));\n  consola.info(\"Using consola 3.0.0\");\n  consola.start(\"Building project...\");\n  consola.success(\"Project built!\");\n  await consola.prompt(\"Deploy to the production?\", {\n    type: \"confirm\",\n  });\n}\n\nmain();\n"
  },
  {
    "path": "examples/spam.ts",
    "content": "import { consola } from \"./utils\";\n\nfunction waitFor(ms) {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function spam({ count, delay }) {\n  for (let i = 0; i < count; i++) {\n    await waitFor(delay);\n    consola.log(`Spam (Count: ${count} Delay: ${delay} ms)`);\n  }\n}\n\n(async () => {\n  await spam({ count: 2, delay: 10 });\n  await spam({ count: 20, delay: 10 });\n  await spam({ count: 20, delay: 0 });\n  await spam({ count: 80, delay: 10 });\n})();\n"
  },
  {
    "path": "examples/special.ts",
    "content": "import { consola } from \"./utils\";\n\nconsola.error({\n  message: \"Foobar\",\n});\n\nconsola.log({\n  AAA: \"BBB\",\n});\n\n// consola.log(consola)\n\nconsola.log(\"%d\", 12);\n\nconsola.error({ type: \"CSSError\", message: \"Use scss\" });\n\nconsola.error(undefined, null, false, true, Number.NaN);\n\nconsola.log(\"We can `monospace` keyword using grave accent charachter!\");\n\nconsola.log(\n  \"We can also _underline_ words but not_this or this should_not_be_underlined!\",\n);\n\n// Nonstandard error\nconst { message, stack } = new Error(\"Custom Error!\");\nconsola.error({ message, stack });\n\n// Circular object\nconst a = { foo: 1, bar: undefined as any };\na.bar = a;\nconsola.log(a);\n\n// Multiline\nconsola.log(\"`Hello` the `JS`\\n`World` and `Beyond`!\");\n"
  },
  {
    "path": "examples/spinner.ts",
    "content": "import { consola } from \"./utils\";\n\nasync function main() {\n  consola.start(\"Creating project...\");\n  await new Promise((resolve) => setTimeout(resolve, 1000));\n  consola.success(\"Project created!\");\n}\n\nmain();\n"
  },
  {
    "path": "examples/tree.ts",
    "content": "import { TreeItem, formatTree } from \"../src/utils/tree\";\nimport { consola } from \"./utils\";\n\nfunction main() {\n  const keywords = [\n    \"console\",\n    \"logger\",\n    \"reporter\",\n    \"elegant\",\n    \"cli\",\n    \"universal\",\n    \"unified\",\n    \"prompt\",\n    \"clack\",\n    \"format\",\n    \"error\",\n    \"stacktrace\",\n  ];\n\n  consola.log(formatTree(keywords));\n\n  consola.log(\n    formatTree(keywords, {\n      color: \"cyan\",\n      prefix: \"  |  \",\n    }),\n  );\n\n  consola.log(\n    formatTree(\n      [\n        {\n          text: \"consola\",\n          color: \"green\",\n        },\n        {\n          text: \"logger\",\n        },\n      ].map(\n        (item) =>\n          ({\n            text: ` ${item.text}`,\n            color: item.color,\n          }) as TreeItem,\n      ),\n      {\n        color: \"gray\",\n      },\n    ),\n  );\n\n  // Deep tree\n  consola.log(\n    formatTree([\n      {\n        text: \"format\",\n        color: \"red\",\n      },\n      {\n        text: \"consola\",\n        color: \"yellow\",\n        children: [\n          {\n            text: \"logger\",\n            color: \"green\",\n            children: [\n              {\n                text: \"reporter\",\n                color: \"cyan\",\n              },\n              {\n                text: \"test\",\n                color: \"magenta\",\n                children: [\"nice tree\"],\n              },\n            ],\n          },\n          {\n            text: \"reporter\",\n            color: \"bold\",\n          },\n          \"test\",\n        ],\n      },\n    ]),\n  );\n\n  // Deep tree with max depth\n  consola.log(\n    formatTree(\n      [\n        {\n          text: \"format\",\n          color: \"red\",\n        },\n        {\n          text: \"consola\",\n          color: \"yellow\",\n          children: [\n            {\n              text: \"logger\",\n              color: \"green\",\n              children: [\n                {\n                  text: \"reporter\",\n                  color: \"cyan\",\n                },\n                {\n                  text: \"test\",\n                  color: \"magenta\",\n                  children: [\"nice tree\"],\n                },\n              ],\n            },\n            {\n              text: \"reporter\",\n              color: \"bold\",\n            },\n            \"test\",\n          ],\n        },\n      ],\n      {\n        maxDepth: 2,\n      },\n    ),\n  );\n\n  // Indicate the ellipsis\n  consola.log(\n    formatTree(\n      [\n        {\n          text: \"format\",\n          color: \"red\",\n        },\n        {\n          text: \"consola\",\n          color: \"yellow\",\n          children: [\n            {\n              text: \"logger\",\n              color: \"green\",\n              children: [\n                {\n                  text: \"reporter\",\n                  color: \"cyan\",\n                },\n                {\n                  text: \"test\",\n                  color: \"magenta\",\n                  children: [\"nice tree\"],\n                },\n              ],\n            },\n            {\n              text: \"reporter\",\n              color: \"bold\",\n            },\n            \"test\",\n          ],\n        },\n      ],\n      {\n        maxDepth: 2,\n        ellipsis: \"---\",\n      },\n    ),\n  );\n}\n\nmain();\n"
  },
  {
    "path": "examples/utils/index.ts",
    "content": "import { ConsolaOptions, createConsola } from \"../../src\";\nimport { randomSentence } from \"./sentence\";\n\nexport function reporterDemo(\n  opts: Partial<ConsolaOptions & { fancy: boolean }>,\n) {\n  const consola = createConsola({\n    ...opts,\n  });\n\n  for (const type of Object.keys(consola.options.types).sort()) {\n    consola[type](randomSentence());\n  }\n\n  consola.info(\"JSON\", {\n    name: \"Cat\",\n    color: \"#454545\",\n  });\n\n  consola.error(new Error(randomSentence()));\n\n  const tagged = consola.withTag(\"unjs\").withTag(\"router\");\n\n  for (const type of Object.keys(consola.options.types).sort()) {\n    tagged[type](randomSentence());\n  }\n}\n\nexport const consola = createConsola();\n"
  },
  {
    "path": "examples/utils/sentence.ts",
    "content": "import Sentencer from \"sentencer\";\n\nconst sentenceTemplates = [\n  \"the {{ noun }} is {{ a_noun }}\",\n  \"{{ a_noun }} is {{ an_adjective }} {{ noun }}\",\n  \"the first {{ adjective }} {{ noun }} is, in its own way, {{ a_noun }}\",\n  \"their {{ noun }} was, in this moment, {{ an_adjective }} {{ noun }}\",\n  \"{{ a_noun }} is {{ a_noun }} from the right perspective\",\n  \"the literature would have us believe that {{ an_adjective }} {{ noun }} is not but {{ a_noun }}\",\n  \"{{ an_adjective }} {{ noun }} is {{ a_noun }} of the mind\",\n  \"the {{ adjective }} {{ noun }} reveals itself as {{ an_adjective }} {{ noun }} to those who look\",\n  \"authors often misinterpret the {{ noun }} as {{ an_adjective }} {{ noun }}, when in actuality it feels more like {{ an_adjective}} {{ noun }}\",\n  \"we can assume that any instance of {{ a_noun }} can be construed as {{ an_adjective }} {{ noun }}\",\n  \"they were lost without the {{ adjective }} {{ noun }} that composed their {{ noun }}\",\n  \"the {{ adjective }} {{ noun }} comes from {{ an_adjective }} {{ noun }}\",\n  \"{{ a_noun }} can hardly be considered {{ an_adjective }} {{ noun }} without also being {{ a_noun }}\",\n  \"few can name {{ an_adjective }} {{ noun }} that isn't {{ an_adjective }} {{ noun }}\",\n  \"some posit the {{ adjective }} {{ noun }} to be less than {{ adjective }}\",\n  \"{{ a_noun }} of the {{ noun }} is assumed to be {{ an_adjective }} {{ noun }}\",\n  \"{{ a_noun }} sees {{ a_noun }} as {{ an_adjective }} {{ noun }}\",\n  \"the {{ noun }} of {{ a_noun }} becomes {{ an_adjective }} {{ noun }}\",\n  \"{{ a_noun }} is {{ a_noun }}'s {{ noun }}\",\n  \"{{ a_noun }} is the {{ noun }} of {{ a_noun }}\",\n  \"{{ an_adjective }} {{ noun }}'s {{ noun }} comes with it the thought that the {{ adjective }} {{ noun }} is {{ a_noun }}\",\n  \"{{ nouns }} are {{ adjective }} {{ nouns }}\",\n  \"{{ adjective }} {{ nouns }} show us how {{ nouns }} can be {{ nouns }}\",\n  \"before {{ nouns }}, {{ nouns }} were only {{ nouns }}\",\n  \"those {{ nouns }} are nothing more than {{ nouns }}\",\n  \"some {{ adjective }} {{ nouns }} are thought of simply as {{ nouns }}\",\n  \"one cannot separate {{ nouns }} from {{ adjective }} {{ nouns }}\",\n  \"the {{ nouns }} could be said to resemble {{ adjective }} {{ nouns }}\",\n  \"{{ an_adjective }} {{ noun }} without {{ nouns }} is truly a {{ noun }} of {{ adjective }} {{ nouns }}\",\n];\n\nexport function randomSentence() {\n  const t =\n    sentenceTemplates[\n      Math.round(Math.random() * (sentenceTemplates.length - 1))\n    ];\n  return Sentencer.make(t);\n}\n"
  },
  {
    "path": "examples/wrap-all.ts",
    "content": "import { consola } from \"./utils\";\n\nfunction foo() {\n  console.info(\"console foo\");\n  process.stderr.write(\"called from stderr\\n\");\n}\n\nconsola.wrapAll();\nfoo();\nconsola.restoreAll();\nfoo();\n"
  },
  {
    "path": "examples/wrap-console.ts",
    "content": "import { consola } from \"./utils\";\n\nfunction foo() {\n  console.info(\"foo\");\n  console.warn(\"foo warn\");\n}\n\nfunction _trace() {\n  console.trace(\"foobar\");\n}\nfunction trace() {\n  _trace();\n}\n\nfoo();\nconsola.wrapConsole();\nfoo();\ntrace();\nconsola.restoreConsole();\nfoo();\ntrace();\n"
  },
  {
    "path": "examples/wrap-std.ts",
    "content": "import { consola } from \"./utils\";\n\nfunction foo() {\n  console.info(\"console foo\");\n  process.stdout.write(\"called from stdout foo\\n\");\n  process.stderr.write(\"called from stderr foo\\n\");\n}\n\nconsola.wrapStd();\nfoo();\nconsola.restoreStd();\nfoo();\n"
  },
  {
    "path": "lib/index.cjs",
    "content": "// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst lib = require(\"../dist/index.cjs\");\n\nmodule.exports = lib.consola;\n\nfor (const key in lib) {\n  if (!(key in module.exports)) {\n    module.exports[key] = lib[key];\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"consola\",\n  \"version\": \"3.4.2\",\n  \"description\": \"Elegant Console Wrapper\",\n  \"keywords\": [\n    \"console\",\n    \"logger\",\n    \"reporter\",\n    \"elegant\",\n    \"cli\",\n    \"universal\",\n    \"unified\",\n    \"prompt\",\n    \"clack\",\n    \"format\",\n    \"error\",\n    \"stacktrace\"\n  ],\n  \"repository\": \"unjs/consola\",\n  \"license\": \"MIT\",\n  \"type\": \"module\",\n  \"exports\": {\n    \".\": {\n      \"node\": {\n        \"import\": {\n          \"types\": \"./dist/index.d.mts\",\n          \"default\": \"./dist/index.mjs\"\n        },\n        \"require\": {\n          \"types\": \"./dist/index.d.cts\",\n          \"default\": \"./lib/index.cjs\"\n        }\n      },\n      \"default\": {\n        \"import\": {\n          \"types\": \"./dist/browser.d.mts\",\n          \"default\": \"./dist/browser.mjs\"\n        },\n        \"require\": {\n          \"types\": \"./dist/browser.d.cts\",\n          \"default\": \"./dist/browser.cjs\"\n        }\n      }\n    },\n    \"./browser\": {\n      \"import\": {\n        \"types\": \"./dist/browser.d.mts\",\n        \"default\": \"./dist/browser.mjs\"\n      },\n      \"require\": {\n        \"types\": \"./dist/browser.d.cts\",\n        \"default\": \"./dist/browser.cjs\"\n      }\n    },\n    \"./basic\": {\n      \"node\": {\n        \"import\": {\n          \"types\": \"./dist/basic.d.mts\",\n          \"default\": \"./dist/basic.mjs\"\n        },\n        \"require\": {\n          \"types\": \"./dist/basic.d.cts\",\n          \"default\": \"./dist/basic.cjs\"\n        }\n      },\n      \"default\": {\n        \"import\": {\n          \"types\": \"./dist/browser.d.mts\",\n          \"default\": \"./dist/browser.mjs\"\n        },\n        \"require\": {\n          \"types\": \"./dist/browser.d.cts\",\n          \"default\": \"./dist/browser.cjs\"\n        }\n      }\n    },\n    \"./core\": {\n      \"import\": {\n        \"types\": \"./dist/core.d.mts\",\n        \"default\": \"./dist/core.mjs\"\n      },\n      \"require\": {\n        \"types\": \"./dist/core.d.cts\",\n        \"default\": \"./dist/core.cjs\"\n      }\n    },\n    \"./utils\": {\n      \"import\": {\n        \"types\": \"./dist/utils.d.mts\",\n        \"default\": \"./dist/utils.mjs\"\n      },\n      \"require\": {\n        \"types\": \"./dist/utils.d.cts\",\n        \"default\": \"./dist/utils.cjs\"\n      }\n    }\n  },\n  \"main\": \"./lib/index.cjs\",\n  \"module\": \"./dist/index.mjs\",\n  \"browser\": \"./dist/browser.mjs\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\",\n    \"lib\",\n    \"*.d.ts\"\n  ],\n  \"scripts\": {\n    \"build\": \"unbuild\",\n    \"dev\": \"vitest\",\n    \"lint\": \"eslint . && prettier -c src examples test\",\n    \"lint:fix\": \"eslint . --fix && prettier -w src examples test\",\n    \"release\": \"pnpm test && pnpm build && changelogen --release --push && npm publish\",\n    \"test\": \"pnpm lint && pnpm vitest run --coverage\"\n  },\n  \"devDependencies\": {\n    \"@clack/prompts\": \"^0.10.0\",\n    \"@types/node\": \"^22.13.10\",\n    \"@vitest/coverage-v8\": \"^3.0.9\",\n    \"changelogen\": \"^0.6.1\",\n    \"defu\": \"^6.1.4\",\n    \"eslint\": \"^9.22.0\",\n    \"eslint-config-unjs\": \"^0.4.2\",\n    \"is-unicode-supported\": \"^2.1.0\",\n    \"prettier\": \"^3.5.3\",\n    \"sentencer\": \"^0.2.1\",\n    \"std-env\": \"^3.8.1\",\n    \"string-width\": \"^7.2.0\",\n    \"typescript\": \"^5.8.2\",\n    \"unbuild\": \"^3.5.0\",\n    \"vitest\": \"^3.0.9\"\n  },\n  \"engines\": {\n    \"node\": \"^14.18.0 || >=16.10.0\"\n  },\n  \"packageManager\": \"pnpm@10.6.3\"\n}\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"extends\": [\"github>unjs/renovate-config\"]\n}\n"
  },
  {
    "path": "src/basic.ts",
    "content": "import { LogLevels, LogLevel } from \"./constants\";\nimport type { ConsolaOptions } from \"./types\";\nimport { BasicReporter } from \"./reporters/basic\";\nimport { ConsolaInstance, createConsola as _createConsola } from \"./consola\";\n\nexport * from \"./shared\";\n\n/**\n * Factory function to create a new Consola instance\n *\n * @param {Partial<ConsolaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link ConsolaOptions}.\n * @returns {ConsolaInstance} A new Consola instance configured with the given options.\n */\nexport function createConsola(\n  options: Partial<ConsolaOptions & { fancy: boolean }> = {},\n): ConsolaInstance {\n  // Log level\n  let level: LogLevel = LogLevels.info;\n  if (process.env.CONSOLA_LEVEL) {\n    level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;\n  }\n\n  // Create new consola instance\n  const consola = _createConsola({\n    level,\n    defaults: { level },\n    stdout: process.stdout,\n    stderr: process.stderr,\n    reporters: options.reporters || [new BasicReporter()],\n    ...options,\n  });\n\n  return consola;\n}\n\n/**\n * Creates and exports a standard instance of Consola with the default configuration.\n * This instance can be used directly for logging throughout the application.\n *\n * @type {ConsolaInstance} consola - The default instance of Consola.\n */\nexport const consola = createConsola();\n\nexport default consola;\n"
  },
  {
    "path": "src/browser.ts",
    "content": "import { BrowserReporter } from \"./reporters/browser\";\nimport { createConsola as _createConsola } from \"./consola\";\nimport type { ConsolaOptions } from \"./types\";\n\nexport * from \"./shared\";\n\n/**\n * Creates a new Consola instance configured specifically for browser environments.\n * This function sets up default reporters and a prompt method tailored to the browser's dialogue APIs.\n *\n * @param {Partial<ConsolaOptions>} [options={}] - Optional configuration options.\n * The options can override the default reporter and prompt behaviour. See {@link ConsolaOptions}.\n * @returns {ConsolaInstance} A new Consola instance optimised for use in browser environments.\n */\nexport function createConsola(options: Partial<ConsolaOptions> = {}) {\n  const consola = _createConsola({\n    reporters: options.reporters || [new BrowserReporter({})],\n    prompt(message, options = {}) {\n      if (options.type === \"confirm\") {\n        return Promise.resolve(confirm(message) as any);\n      }\n      return Promise.resolve(prompt(message));\n    },\n    ...options,\n  });\n  return consola;\n}\n\n/**\n * A standard Consola instance created with browser-specific configurations.\n * This instance can be used throughout a browser-based project.\n *\n * @type {ConsolaInstance} consola - The default browser-configured Consola instance.\n */\nexport const consola = createConsola();\n\nexport default consola;\n"
  },
  {
    "path": "src/consola.ts",
    "content": "import { defu } from \"defu\";\nimport { LogTypes, LogType, LogLevel } from \"./constants\";\nimport { isLogObj } from \"./utils/log\";\nimport type {\n  ConsolaReporter,\n  InputLogObject,\n  LogObject,\n  ConsolaOptions,\n} from \"./types\";\nimport type { PromptOptions } from \"./prompt\";\n\nlet paused = false;\nconst queue: any[] = [];\n\n/**\n * Consola class for logging management with support for pause/resume, mocking and customisable reporting.\n * Provides flexible logging capabilities including level-based logging, custom reporters and integration options.\n *\n * @class Consola\n */\nexport class Consola {\n  options: ConsolaOptions;\n\n  _lastLog: {\n    serialized?: string;\n    object?: LogObject;\n    count?: number;\n    time?: Date;\n    timeout?: ReturnType<typeof setTimeout>;\n  };\n\n  _mockFn?: ConsolaOptions[\"mockFn\"];\n\n  /**\n   * Creates an instance of Consola with specified options or defaults.\n   *\n   * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.\n   */\n  constructor(options: Partial<ConsolaOptions> = {}) {\n    // Options\n    const types = options.types || LogTypes;\n    this.options = defu(\n      <ConsolaOptions>{\n        ...options,\n        defaults: { ...options.defaults },\n        level: _normalizeLogLevel(options.level, types),\n        reporters: [...(options.reporters || [])],\n      },\n      <Partial<ConsolaOptions>>{\n        types: LogTypes,\n        throttle: 1000,\n        throttleMin: 5,\n        formatOptions: {\n          date: true,\n          colors: false,\n          compact: true,\n        },\n      },\n    );\n\n    // Create logger functions for current instance\n    for (const type in types) {\n      const defaults: InputLogObject = {\n        type: type as LogType,\n        ...this.options.defaults,\n        ...types[type as LogType],\n      };\n      // @ts-expect-error\n      (this as unknown as ConsolaInstance)[type as LogType] =\n        this._wrapLogFn(defaults);\n      // @ts-expect-error\n      (this as unknown as ConsolaInstance)[type].raw = this._wrapLogFn(\n        defaults,\n        true,\n      );\n    }\n\n    // Use _mockFn if is set\n    if (this.options.mockFn) {\n      this.mockTypes();\n    }\n\n    // Track of last log\n    this._lastLog = {};\n  }\n\n  /**\n   * Gets the current log level of the Consola instance.\n   *\n   * @returns {number} The current log level.\n   */\n  get level() {\n    return this.options.level;\n  }\n\n  /**\n   * Sets the minimum log level that will be output by the instance.\n   *\n   * @param {number} level - The new log level to set.\n   */\n  set level(level) {\n    this.options.level = _normalizeLogLevel(\n      level,\n      this.options.types,\n      this.options.level,\n    );\n  }\n\n  /**\n   * Displays a prompt to the user and returns the response.\n   * Throw an error if `prompt` is not supported by the current configuration.\n   *\n   * @template T\n   * @param {string} message - The message to display in the prompt.\n   * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.\n   * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.\n   */\n  prompt<T extends PromptOptions>(message: string, opts?: T) {\n    if (!this.options.prompt) {\n      throw new Error(\"prompt is not supported!\");\n    }\n    return this.options.prompt<any, any, T>(message, opts);\n  }\n\n  /**\n   * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.\n   *\n   * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.\n   * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n   */\n  create(options: Partial<ConsolaOptions>): ConsolaInstance {\n    const instance = new Consola({\n      ...this.options,\n      ...options,\n    }) as ConsolaInstance;\n\n    if (this._mockFn) {\n      instance.mockTypes(this._mockFn);\n    }\n\n    return instance;\n  }\n\n  /**\n   * Creates a new Consola instance with the specified default log object properties.\n   *\n   * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.\n   * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n   */\n  withDefaults(defaults: InputLogObject): ConsolaInstance {\n    return this.create({\n      ...this.options,\n      defaults: {\n        ...this.options.defaults,\n        ...defaults,\n      },\n    });\n  }\n\n  /**\n   * Creates a new Consola instance with a specified tag, which will be included in every log.\n   *\n   * @param {string} tag - The tag to include in each log of the new instance.\n   * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n   */\n  withTag(tag: string): ConsolaInstance {\n    return this.withDefaults({\n      tag: this.options.defaults.tag\n        ? this.options.defaults.tag + \":\" + tag\n        : tag,\n    });\n  }\n\n  /**\n   * Adds a custom reporter to the Consola instance.\n   * Reporters will be called for each log message, depending on their implementation and log level.\n   *\n   * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.\n   * @returns {Consola} The current Consola instance.\n   */\n  addReporter(reporter: ConsolaReporter) {\n    this.options.reporters.push(reporter);\n    return this;\n  }\n\n  /**\n   * Removes a custom reporter from the Consola instance.\n   * If no reporter is specified, all reporters will be removed.\n   *\n   * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.\n   * @returns {Consola} The current Consola instance.\n   */\n  removeReporter(reporter: ConsolaReporter) {\n    if (reporter) {\n      const i = this.options.reporters.indexOf(reporter);\n      if (i !== -1) {\n        return this.options.reporters.splice(i, 1);\n      }\n    } else {\n      this.options.reporters.splice(0);\n    }\n    return this;\n  }\n\n  /**\n   * Replaces all reporters of the Consola instance with the specified array of reporters.\n   *\n   * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.\n   * @returns {Consola} The current Consola instance.\n   */\n  setReporters(reporters: ConsolaReporter[]) {\n    this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];\n    return this;\n  }\n\n  wrapAll() {\n    this.wrapConsole();\n    this.wrapStd();\n  }\n\n  restoreAll() {\n    this.restoreConsole();\n    this.restoreStd();\n  }\n\n  /**\n   * Overrides console methods with Consola logging methods for consistent logging.\n   */\n  wrapConsole() {\n    for (const type in this.options.types) {\n      // Backup original value\n      if (!(console as any)[\"__\" + type]) {\n        (console as any)[\"__\" + type] = (console as any)[type];\n      }\n      // Override\n      (console as any)[type] = (this as unknown as ConsolaInstance)[\n        type as LogType\n      ].raw;\n    }\n  }\n\n  /**\n   * Restores the original console methods, removing Consola overrides.\n   */\n  restoreConsole() {\n    for (const type in this.options.types) {\n      // Restore if backup is available\n      if ((console as any)[\"__\" + type]) {\n        (console as any)[type] = (console as any)[\"__\" + type];\n        delete (console as any)[\"__\" + type];\n      }\n    }\n  }\n\n  /**\n   * Overrides standard output and error streams to redirect them through Consola.\n   */\n  wrapStd() {\n    this._wrapStream(this.options.stdout, \"log\");\n    this._wrapStream(this.options.stderr, \"log\");\n  }\n\n  _wrapStream(stream: NodeJS.WriteStream | undefined, type: LogType) {\n    if (!stream) {\n      return;\n    }\n\n    // Backup original value\n    if (!(stream as any).__write) {\n      (stream as any).__write = stream.write;\n    }\n\n    // Override\n    (stream as any).write = (data: any) => {\n      (this as unknown as ConsolaInstance)[type].raw(String(data).trim());\n    };\n  }\n\n  /**\n   * Restores the original standard output and error streams, removing the Consola redirection.\n   */\n  restoreStd() {\n    this._restoreStream(this.options.stdout);\n    this._restoreStream(this.options.stderr);\n  }\n\n  _restoreStream(stream?: NodeJS.WriteStream) {\n    if (!stream) {\n      return;\n    }\n\n    if ((stream as any).__write) {\n      stream.write = (stream as any).__write;\n      delete (stream as any).__write;\n    }\n  }\n\n  /**\n   * Pauses logging, queues incoming logs until resumed.\n   */\n  pauseLogs() {\n    paused = true;\n  }\n\n  /**\n   * Resumes logging, processing any queued logs.\n   */\n  resumeLogs() {\n    paused = false;\n\n    // Process queue\n    const _queue = queue.splice(0);\n    for (const item of _queue) {\n      item[0]._logFn(item[1], item[2]);\n    }\n  }\n\n  /**\n   * Replaces logging methods with mocks if a mock function is provided.\n   *\n   * @param {ConsolaOptions[\"mockFn\"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions[\"mockFn\"]}.\n   */\n  mockTypes(mockFn?: ConsolaOptions[\"mockFn\"]) {\n    const _mockFn = mockFn || this.options.mockFn;\n\n    this._mockFn = _mockFn;\n\n    if (typeof _mockFn !== \"function\") {\n      return;\n    }\n\n    for (const type in this.options.types) {\n      // @ts-expect-error\n      (this as unknown as ConsolaInstance)[type as LogType] =\n        _mockFn(type as LogType, this.options.types[type as LogType]) ||\n        (this as unknown as ConsolaInstance)[type as LogType];\n      (this as unknown as ConsolaInstance)[type as LogType].raw = (\n        this as unknown as ConsolaInstance\n      )[type as LogType];\n    }\n  }\n\n  _wrapLogFn(defaults: InputLogObject, isRaw?: boolean) {\n    return (...args: any[]) => {\n      if (paused) {\n        queue.push([this, defaults, args, isRaw]);\n        return;\n      }\n      return this._logFn(defaults, args, isRaw);\n    };\n  }\n\n  _logFn(defaults: InputLogObject, args: any[], isRaw?: boolean) {\n    if (((defaults.level as number) || 0) > this.level) {\n      return false;\n    }\n\n    // Construct a new log object\n    const logObj: Partial<LogObject> = {\n      date: new Date(),\n      args: [],\n      ...defaults,\n      level: _normalizeLogLevel(defaults.level, this.options.types),\n    };\n\n    // Consume arguments\n    if (!isRaw && args.length === 1 && isLogObj(args[0])) {\n      Object.assign(logObj, args[0]);\n    } else {\n      logObj.args = [...args];\n    }\n\n    // Aliases\n    if (logObj.message) {\n      logObj.args!.unshift(logObj.message);\n      delete logObj.message;\n    }\n    if (logObj.additional) {\n      if (!Array.isArray(logObj.additional)) {\n        logObj.additional = logObj.additional.split(\"\\n\");\n      }\n\n      logObj.args!.push(\"\\n\" + logObj.additional.join(\"\\n\"));\n      delete logObj.additional;\n    }\n\n    // Normalize type to lowercase\n    logObj.type = (\n      typeof logObj.type === \"string\" ? logObj.type.toLowerCase() : \"log\"\n    ) as LogType;\n    logObj.tag = typeof logObj.tag === \"string\" ? logObj.tag : \"\";\n\n    // Resolve log\n    /**\n     * @param newLog false if the throttle expired and\n     *  we don't want to log a duplicate\n     */\n    const resolveLog = (newLog = false) => {\n      const repeated = (this._lastLog.count || 0) - this.options.throttleMin;\n      if (this._lastLog.object && repeated > 0) {\n        const args = [...this._lastLog.object.args];\n        if (repeated > 1) {\n          args.push(`(repeated ${repeated} times)`);\n        }\n        this._log({ ...this._lastLog.object, args });\n        this._lastLog.count = 1;\n      }\n\n      // Log\n      if (newLog) {\n        this._lastLog.object = logObj as LogObject;\n        this._log(logObj as LogObject);\n      }\n    };\n\n    // Throttle\n    clearTimeout(this._lastLog.timeout);\n    const diffTime =\n      this._lastLog.time && logObj.date\n        ? logObj.date.getTime() - this._lastLog.time.getTime()\n        : 0;\n    this._lastLog.time = logObj.date;\n    if (diffTime < this.options.throttle) {\n      try {\n        const serializedLog = JSON.stringify([\n          logObj.type,\n          logObj.tag,\n          logObj.args,\n        ]);\n        const isSameLog = this._lastLog.serialized === serializedLog;\n        this._lastLog.serialized = serializedLog;\n        if (isSameLog) {\n          this._lastLog.count = (this._lastLog.count || 0) + 1;\n          if (this._lastLog.count > this.options.throttleMin) {\n            // Auto-resolve when throttle is timed out\n            this._lastLog.timeout = setTimeout(\n              resolveLog,\n              this.options.throttle,\n            );\n            return; // SPAM!\n          }\n        }\n      } catch {\n        // Circular References\n      }\n    }\n\n    resolveLog(true);\n  }\n\n  _log(logObj: LogObject) {\n    for (const reporter of this.options.reporters) {\n      reporter.log(logObj, {\n        options: this.options,\n      });\n    }\n  }\n}\n\nfunction _normalizeLogLevel(\n  input: LogLevel | LogType | undefined,\n  types: any = {},\n  defaultLevel = 3,\n) {\n  if (input === undefined) {\n    return defaultLevel;\n  }\n  if (typeof input === \"number\") {\n    return input;\n  }\n  if (types[input] && types[input].level !== undefined) {\n    return types[input].level;\n  }\n  return defaultLevel;\n}\n\nexport interface LogFn {\n  (message: InputLogObject | any, ...args: any[]): void;\n  raw: (...args: any[]) => void;\n}\nexport type ConsolaInstance = Consola & Record<LogType, LogFn>;\n\n// Legacy support\n// @ts-expect-error\nConsola.prototype.add = Consola.prototype.addReporter;\n// @ts-expect-error\nConsola.prototype.remove = Consola.prototype.removeReporter;\n// @ts-expect-error\nConsola.prototype.clear = Consola.prototype.removeReporter;\n// @ts-expect-error\nConsola.prototype.withScope = Consola.prototype.withTag;\n// @ts-expect-error\nConsola.prototype.mock = Consola.prototype.mockTypes;\n// @ts-expect-error\nConsola.prototype.pause = Consola.prototype.pauseLogs;\n// @ts-expect-error\nConsola.prototype.resume = Consola.prototype.resumeLogs;\n\n/**\n * Utility for creating a new Consola instance with optional configuration.\n *\n * @param {Partial<ConsolaOptions>} [options={}] - Optional configuration options for the new Consola instance. See {@link ConsolaOptions}.\n * @returns {ConsolaInstance} A new instance of Consola. See {@link ConsolaInstance}.\n */\nexport function createConsola(\n  options: Partial<ConsolaOptions> = {},\n): ConsolaInstance {\n  return new Consola(options) as ConsolaInstance;\n}\n"
  },
  {
    "path": "src/constants.ts",
    "content": "import { LogObject } from \"./types\";\n\n/**\n * Defines the level of logs as specific numbers or special number types.\n *\n * @type {0 | 1 | 2 | 3 | 4 | 5 | (number & {})} LogLevel - Represents the log level.\n * @default 0 - Represents the default log level.\n */\nexport type LogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});\n\n/**\n * A mapping of `LogType` to its corresponding numeric log level.\n *\n * @type {Record<LogType, number>} LogLevels - key-value pairs of log types to their numeric levels. See {@link LogType}.\n */\nexport const LogLevels: Record<LogType, number> = {\n  silent: Number.NEGATIVE_INFINITY,\n\n  fatal: 0,\n  error: 0,\n\n  warn: 1,\n\n  log: 2,\n  info: 3,\n\n  success: 3,\n  fail: 3,\n  ready: 3,\n  start: 3,\n  box: 3,\n\n  debug: 4,\n\n  trace: 5,\n\n  verbose: Number.POSITIVE_INFINITY,\n};\n\n/**\n * Lists the types of log messages supported by the system.\n *\n * @type {\"silent\" | \"fatal\" | \"error\" | \"warn\" | \"log\" | \"info\" | \"success\" | \"fail\" | \"ready\" | \"start\" | \"box\" | \"debug\" | \"trace\" | \"verbose\"} LogType - Represents the specific type of log message.\n */\nexport type LogType =\n  // 0\n  | \"silent\"\n  | \"fatal\"\n  | \"error\"\n  // 1\n  | \"warn\"\n  // 2\n  | \"log\"\n  // 3\n  | \"info\"\n  | \"success\"\n  | \"fail\"\n  | \"ready\"\n  | \"start\"\n  | \"box\"\n  // Verbose\n  | \"debug\"\n  | \"trace\"\n  | \"verbose\";\n\n/**\n * Maps `LogType` to a `Partial<LogObject>`, primarily defining the log level.\n *\n * @type {Record<LogType, Partial<LogObject>>} LogTypes - key-value pairs of log types to partial log objects, specifying log levels. See {@link LogType} and {@link LogObject}.\n */\nexport const LogTypes: Record<LogType, Partial<LogObject>> = {\n  // Silent\n  silent: {\n    level: -1,\n  },\n\n  // Level 0\n  fatal: {\n    level: LogLevels.fatal,\n  },\n  error: {\n    level: LogLevels.error,\n  },\n\n  // Level 1\n  warn: {\n    level: LogLevels.warn,\n  },\n\n  // Level 2\n  log: {\n    level: LogLevels.log,\n  },\n\n  // Level 3\n  info: {\n    level: LogLevels.info,\n  },\n  success: {\n    level: LogLevels.success,\n  },\n  fail: {\n    level: LogLevels.fail,\n  },\n  ready: {\n    level: LogLevels.info,\n  },\n  start: {\n    level: LogLevels.info,\n  },\n  box: {\n    level: LogLevels.info,\n  },\n\n  // Level 4\n  debug: {\n    level: LogLevels.debug,\n  },\n\n  // Level 5\n  trace: {\n    level: LogLevels.trace,\n  },\n\n  // Verbose\n  verbose: {\n    level: LogLevels.verbose,\n  },\n};\n"
  },
  {
    "path": "src/core.ts",
    "content": "export { createConsola } from \"./consola\";\nexport * from \"./shared\";\n"
  },
  {
    "path": "src/index.ts",
    "content": "import { isDebug, isTest, isCI } from \"std-env\";\nimport { LogLevels, LogLevel } from \"./constants\";\nimport type { ConsolaOptions } from \"./types\";\nimport { BasicReporter } from \"./reporters/basic\";\nimport { FancyReporter } from \"./reporters/fancy\";\nimport { ConsolaInstance, createConsola as _createConsola } from \"./consola\";\n\nexport * from \"./shared\";\n\n/**\n * Factory function to create a new Consola instance tailored for use in different environments.\n * It automatically adjusts logging levels based on environment variables and execution context.\n *\n * @param {Partial<ConsolaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link ConsolaOptions}.\n * @returns {ConsolaInstance} A new Consola instance with configurations based on the given options and the execution environment.\n */\nexport function createConsola(\n  options: Partial<ConsolaOptions & { fancy: boolean }> = {},\n): ConsolaInstance {\n  // Log level\n  let level = _getDefaultLogLevel();\n  if (process.env.CONSOLA_LEVEL) {\n    level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;\n  }\n\n  // Create new consola instance\n  const consola = _createConsola({\n    level: level as LogLevel,\n    defaults: { level },\n    stdout: process.stdout,\n    stderr: process.stderr,\n    prompt: (...args) => import(\"./prompt\").then((m) => m.prompt(...args)),\n    reporters: options.reporters || [\n      (options.fancy ?? !(isCI || isTest))\n        ? new FancyReporter()\n        : new BasicReporter(),\n    ],\n    ...options,\n  });\n\n  return consola;\n}\n\nfunction _getDefaultLogLevel() {\n  if (isDebug) {\n    return LogLevels.debug;\n  }\n  if (isTest) {\n    return LogLevels.warn;\n  }\n  return LogLevels.info;\n}\n\n/**\n * A default instance of Consola, created and configured for immediate use.\n * This instance is configured based on the execution environment and the options provided.\n *\n * @type {ConsolaInstance} consola - The default Consola instance, ready to use.\n */\nexport const consola = createConsola();\n\nexport default consola;\n"
  },
  {
    "path": "src/prompt.ts",
    "content": "import { text, confirm, select, multiselect } from \"@clack/prompts\";\n\ntype SelectOption = {\n  label: string;\n  value: string;\n  hint?: string;\n};\n\nexport const kCancel = Symbol.for(\"cancel\");\n\nexport type PromptCommonOptions = {\n  /**\n   * Specify how to handle a cancelled prompt (e.g. by pressing Ctrl+C).\n   *\n   * Default strategy is `\"default\"`.\n   *\n   * - `\"default\"` - Resolve the promise with the `default` value or `initial` value.\n   * - `\"undefined`\" - Resolve the promise with `undefined`.\n   * - `\"null\"` - Resolve the promise with `null`.\n   * - `\"symbol\"` - Resolve the promise with a symbol `Symbol.for(\"cancel\")`.\n   * - `\"reject\"`  - Reject the promise with an error.\n   */\n  cancel?: \"reject\" | \"default\" | \"undefined\" | \"null\" | \"symbol\";\n};\n\nexport type TextPromptOptions = PromptCommonOptions & {\n  /**\n   * Specifies the prompt type as text.\n   * @optional\n   * @default \"text\"\n   */\n  type?: \"text\";\n\n  /**\n   * The default text value.\n   * @optional\n   */\n  default?: string;\n\n  /**\n   * A placeholder text displayed in the prompt.\n   * @optional\n   */\n  placeholder?: string;\n\n  /**\n   * The initial text value.\n   * @optional\n   */\n  initial?: string;\n};\n\nexport type ConfirmPromptOptions = PromptCommonOptions & {\n  /**\n   * Specifies the prompt type as confirm.\n   */\n  type: \"confirm\";\n\n  /**\n   * The initial value for the confirm prompt.\n   * @optional\n   */\n  initial?: boolean;\n};\n\nexport type SelectPromptOptions = PromptCommonOptions & {\n  /**\n   * Specifies the prompt type as select.\n   */\n  type: \"select\";\n\n  /**\n   * The initial value for the select prompt.\n   * @optional\n   */\n  initial?: string;\n\n  /**\n   * The options to select from. See {@link SelectOption}.\n   */\n  options: (string | SelectOption)[];\n};\n\nexport type MultiSelectOptions = PromptCommonOptions & {\n  /**\n   * Specifies the prompt type as multiselect.\n   */\n  type: \"multiselect\";\n\n  /**\n   * The options to select from. See {@link SelectOption}.\n   */\n  initial?: string[];\n\n  /**\n   * The options to select from. See {@link SelectOption}.\n   */\n  options: (string | SelectOption)[];\n\n  /**\n   * Whether the prompt requires at least one selection.\n   */\n  required?: boolean;\n};\n\n/**\n * Defines a combined type for all prompt options.\n */\nexport type PromptOptions =\n  | TextPromptOptions\n  | ConfirmPromptOptions\n  | SelectPromptOptions\n  | MultiSelectOptions;\n\ntype inferPromptReturnType<T extends PromptOptions> =\n  T extends TextPromptOptions\n    ? string\n    : T extends ConfirmPromptOptions\n      ? boolean\n      : T extends SelectPromptOptions\n        ? T[\"options\"][number] extends SelectOption\n          ? T[\"options\"][number][\"value\"]\n          : T[\"options\"][number]\n        : T extends MultiSelectOptions\n          ? T[\"options\"]\n          : unknown;\n\ntype inferPromptCancalReturnType<T extends PromptOptions> = T extends {\n  cancel: \"reject\";\n}\n  ? never\n  : T extends { cancel: \"default\" }\n    ? inferPromptReturnType<T>\n    : T extends { cancel: \"undefined\" }\n      ? undefined\n      : T extends { cancel: \"null\" }\n        ? null\n        : T extends { cancel: \"symbol\" }\n          ? typeof kCancel\n          : inferPromptReturnType<T> /* default */;\n\n/**\n * Asynchronously prompts the user for input based on specified options.\n * Supports text, confirm, select and multi-select prompts.\n *\n * @param {string} message - The message to display in the prompt.\n * @param {PromptOptions} [opts={}] - The prompt options. See {@link PromptOptions}.\n * @returns {Promise<inferPromptReturnType<T>>} - A promise that resolves with the user's response, the type of which is inferred from the options. See {@link inferPromptReturnType}.\n */\nexport async function prompt<\n  _ = any,\n  __ = any,\n  T extends PromptOptions = TextPromptOptions,\n>(\n  message: string,\n  opts: PromptOptions = {},\n): Promise<inferPromptReturnType<T> | inferPromptCancalReturnType<T>> {\n  const handleCancel = (value: unknown) => {\n    if (\n      typeof value !== \"symbol\" ||\n      value.toString() !== \"Symbol(clack:cancel)\"\n    ) {\n      return value;\n    }\n\n    switch (opts.cancel) {\n      case \"reject\": {\n        const error = new Error(\"Prompt cancelled.\");\n        error.name = \"ConsolaPromptCancelledError\";\n        if (Error.captureStackTrace) {\n          Error.captureStackTrace(error, prompt);\n        }\n        throw error;\n      }\n      case \"undefined\": {\n        return undefined;\n      }\n      case \"null\": {\n        return null;\n      }\n      case \"symbol\": {\n        return kCancel;\n      }\n      default:\n      case \"default\": {\n        return (opts as TextPromptOptions).default ?? opts.initial;\n      }\n    }\n  };\n\n  if (!opts.type || opts.type === \"text\") {\n    return (await text({\n      message,\n      defaultValue: opts.default,\n      placeholder: opts.placeholder,\n      initialValue: opts.initial as string,\n    }).then(handleCancel)) as any;\n  }\n\n  if (opts.type === \"confirm\") {\n    return (await confirm({\n      message,\n      initialValue: opts.initial,\n    }).then(handleCancel)) as any;\n  }\n\n  if (opts.type === \"select\") {\n    return (await select({\n      message,\n      options: opts.options.map((o) =>\n        typeof o === \"string\" ? { value: o, label: o } : o,\n      ),\n      initialValue: opts.initial,\n    }).then(handleCancel)) as any;\n  }\n\n  if (opts.type === \"multiselect\") {\n    return (await multiselect({\n      message,\n      options: opts.options.map((o) =>\n        typeof o === \"string\" ? { value: o, label: o } : o,\n      ),\n      required: opts.required,\n      initialValues: opts.initial,\n    }).then(handleCancel)) as any;\n  }\n\n  throw new Error(`Unknown prompt type: ${opts.type}`);\n}\n"
  },
  {
    "path": "src/reporters/basic.ts",
    "content": "import { formatWithOptions } from \"node:util\";\nimport type {\n  LogObject,\n  ConsolaReporter,\n  FormatOptions,\n  ConsolaOptions,\n} from \"../types\";\nimport { parseStack } from \"../utils/error\";\nimport { writeStream } from \"../utils/stream\";\n\nconst bracket = (x: string) => (x ? `[${x}]` : \"\");\n\nexport class BasicReporter implements ConsolaReporter {\n  formatStack(stack: string, message: string, opts: FormatOptions) {\n    const indent = \"  \".repeat((opts?.errorLevel || 0) + 1);\n    return indent + parseStack(stack, message).join(`\\n${indent}`);\n  }\n\n  formatError(err: any, opts: FormatOptions): string {\n    const message = err.message ?? formatWithOptions(opts, err);\n    const stack = err.stack ? this.formatStack(err.stack, message, opts) : \"\";\n\n    const level = opts?.errorLevel || 0;\n    const causedPrefix = level > 0 ? `${\"  \".repeat(level)}[cause]: ` : \"\";\n    const causedError = err.cause\n      ? \"\\n\\n\" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 })\n      : \"\";\n\n    return causedPrefix + message + \"\\n\" + stack + causedError;\n  }\n\n  formatArgs(args: any[], opts: FormatOptions) {\n    const _args = args.map((arg) => {\n      if (arg && typeof arg.stack === \"string\") {\n        return this.formatError(arg, opts);\n      }\n      return arg;\n    });\n\n    // Only supported with Node >= 10\n    // https://nodejs.org/api/util.html#util_util_inspect_object_options\n    return formatWithOptions(opts, ..._args);\n  }\n\n  formatDate(date: Date, opts: FormatOptions) {\n    return opts.date ? date.toLocaleTimeString() : \"\";\n  }\n\n  filterAndJoin(arr: any[]) {\n    return arr.filter(Boolean).join(\" \");\n  }\n\n  formatLogObj(logObj: LogObject, opts: FormatOptions) {\n    const message = this.formatArgs(logObj.args, opts);\n\n    if (logObj.type === \"box\") {\n      return (\n        \"\\n\" +\n        [\n          bracket(logObj.tag),\n          logObj.title && logObj.title,\n          ...message.split(\"\\n\"),\n        ]\n          .filter(Boolean)\n          .map((l) => \" > \" + l)\n          .join(\"\\n\") +\n        \"\\n\"\n      );\n    }\n\n    return this.filterAndJoin([\n      bracket(logObj.type),\n      bracket(logObj.tag),\n      message,\n    ]);\n  }\n\n  log(logObj: LogObject, ctx: { options: ConsolaOptions }) {\n    const line = this.formatLogObj(logObj, {\n      columns: (ctx.options.stdout as any).columns || 0,\n      ...ctx.options.formatOptions,\n    });\n\n    return writeStream(\n      line + \"\\n\",\n      logObj.level < 2\n        ? ctx.options.stderr || process.stderr\n        : ctx.options.stdout || process.stdout,\n    );\n  }\n}\n"
  },
  {
    "path": "src/reporters/browser.ts",
    "content": "import { LogObject } from \"../types\";\n\nexport class BrowserReporter {\n  options: any;\n  defaultColor: string;\n  levelColorMap: Record<number, string>;\n  typeColorMap: Record<string, string>;\n\n  constructor(options: any) {\n    this.options = { ...options };\n\n    this.defaultColor = \"#7f8c8d\"; // Gray\n    this.levelColorMap = {\n      0: \"#c0392b\", // Red\n      1: \"#f39c12\", // Yellow\n      3: \"#00BCD4\", // Cyan\n    };\n    this.typeColorMap = {\n      success: \"#2ecc71\", // Green\n    };\n  }\n\n  _getLogFn(level: number) {\n    if (level < 1) {\n      return (console as any).__error || console.error;\n    }\n    if (level === 1) {\n      return (console as any).__warn || console.warn;\n    }\n    return (console as any).__log || console.log;\n  }\n\n  log(logObj: LogObject) {\n    const consoleLogFn = this._getLogFn(logObj.level);\n\n    // Type\n    const type = logObj.type === \"log\" ? \"\" : logObj.type;\n\n    // Tag\n    const tag = logObj.tag || \"\";\n\n    // Styles\n    const color =\n      this.typeColorMap[logObj.type] ||\n      this.levelColorMap[logObj.level] ||\n      this.defaultColor;\n    const style = `\n      background: ${color};\n      border-radius: 0.5em;\n      color: white;\n      font-weight: bold;\n      padding: 2px 0.5em;\n    `;\n\n    const badge = `%c${[tag, type].filter(Boolean).join(\":\")}`;\n\n    // Log to the console\n    if (typeof logObj.args[0] === \"string\") {\n      consoleLogFn(\n        `${badge}%c ${logObj.args[0]}`,\n        style,\n        // Empty string as style resets to default console style\n        \"\",\n        ...logObj.args.slice(1),\n      );\n    } else {\n      consoleLogFn(badge, style, ...logObj.args);\n    }\n  }\n}\n"
  },
  {
    "path": "src/reporters/fancy.ts",
    "content": "import _stringWidth from \"string-width\";\nimport isUnicodeSupported from \"is-unicode-supported\";\nimport { colors } from \"../utils/color\";\nimport { parseStack } from \"../utils/error\";\nimport { FormatOptions, LogObject } from \"../types\";\nimport { LogLevel, LogType } from \"../constants\";\nimport { BoxOpts, box } from \"../utils/box\";\nimport { stripAnsi } from \"../utils\";\nimport { BasicReporter } from \"./basic\";\n\nexport const TYPE_COLOR_MAP: { [k in LogType]?: string } = {\n  info: \"cyan\",\n  fail: \"red\",\n  success: \"green\",\n  ready: \"green\",\n  start: \"magenta\",\n};\n\nexport const LEVEL_COLOR_MAP: { [k in LogLevel]?: string } = {\n  0: \"red\",\n  1: \"yellow\",\n};\n\nconst unicode = isUnicodeSupported();\nconst s = (c: string, fallback: string) => (unicode ? c : fallback);\nconst TYPE_ICONS: { [k in LogType]?: string } = {\n  error: s(\"✖\", \"×\"),\n  fatal: s(\"✖\", \"×\"),\n  ready: s(\"✔\", \"√\"),\n  warn: s(\"⚠\", \"‼\"),\n  info: s(\"ℹ\", \"i\"),\n  success: s(\"✔\", \"√\"),\n  debug: s(\"⚙\", \"D\"),\n  trace: s(\"→\", \"→\"),\n  fail: s(\"✖\", \"×\"),\n  start: s(\"◐\", \"o\"),\n  log: \"\",\n};\n\nfunction stringWidth(str: string) {\n  // https://github.com/unjs/consola/issues/204\n  const hasICU = typeof Intl === \"object\";\n  if (!hasICU || !Intl.Segmenter) {\n    return stripAnsi(str).length;\n  }\n  return _stringWidth(str);\n}\n\nexport class FancyReporter extends BasicReporter {\n  formatStack(stack: string, message: string, opts?: FormatOptions) {\n    const indent = \"  \".repeat((opts?.errorLevel || 0) + 1);\n    return (\n      `\\n${indent}` +\n      parseStack(stack, message)\n        .map(\n          (line) =>\n            \"  \" +\n            line\n              .replace(/^at +/, (m) => colors.gray(m))\n              .replace(/\\((.+)\\)/, (_, m) => `(${colors.cyan(m)})`),\n        )\n        .join(`\\n${indent}`)\n    );\n  }\n\n  formatType(logObj: LogObject, isBadge: boolean, opts: FormatOptions) {\n    const typeColor =\n      (TYPE_COLOR_MAP as any)[logObj.type] ||\n      (LEVEL_COLOR_MAP as any)[logObj.level] ||\n      \"gray\";\n\n    if (isBadge) {\n      return getBgColor(typeColor)(\n        colors.black(` ${logObj.type.toUpperCase()} `),\n      );\n    }\n\n    const _type =\n      typeof (TYPE_ICONS as any)[logObj.type] === \"string\"\n        ? (TYPE_ICONS as any)[logObj.type]\n        : (logObj as any).icon || logObj.type;\n\n    return _type ? getColor(typeColor)(_type) : \"\";\n  }\n\n  formatLogObj(logObj: LogObject, opts: FormatOptions) {\n    const [message, ...additional] = this.formatArgs(logObj.args, opts).split(\n      \"\\n\",\n    );\n\n    if (logObj.type === \"box\") {\n      return box(\n        characterFormat(\n          message + (additional.length > 0 ? \"\\n\" + additional.join(\"\\n\") : \"\"),\n        ),\n        {\n          title: logObj.title\n            ? characterFormat(logObj.title as string)\n            : undefined,\n          style: logObj.style as BoxOpts[\"style\"],\n        },\n      );\n    }\n\n    const date = this.formatDate(logObj.date, opts);\n    const coloredDate = date && colors.gray(date);\n\n    const isBadge = (logObj.badge as boolean) ?? logObj.level < 2;\n    const type = this.formatType(logObj, isBadge, opts);\n\n    const tag = logObj.tag ? colors.gray(logObj.tag) : \"\";\n\n    let line;\n    const left = this.filterAndJoin([type, characterFormat(message)]);\n    const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);\n    const space =\n      (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;\n\n    line =\n      space > 0 && (opts.columns || 0) >= 80\n        ? left + \" \".repeat(space) + right\n        : (right ? `${colors.gray(`[${right}]`)} ` : \"\") + left;\n\n    line += characterFormat(\n      additional.length > 0 ? \"\\n\" + additional.join(\"\\n\") : \"\",\n    );\n\n    if (logObj.type === \"trace\") {\n      const _err = new Error(\"Trace: \" + logObj.message);\n      line += this.formatStack(_err.stack || \"\", _err.message);\n    }\n\n    return isBadge ? \"\\n\" + line + \"\\n\" : line;\n  }\n}\n\nfunction characterFormat(str: string) {\n  return (\n    str\n      // highlight backticks\n      .replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m))\n      // underline underscores\n      .replace(/\\s+_([^_]+)_\\s+/gm, (_, m) => ` ${colors.underline(m)} `)\n  );\n}\n\nfunction getColor(color = \"white\") {\n  return (colors as any)[color] || colors.white;\n}\n\nfunction getBgColor(color = \"bgWhite\") {\n  return (\n    (colors as any)[`bg${color[0].toUpperCase()}${color.slice(1)}`] ||\n    colors.bgWhite\n  );\n}\n"
  },
  {
    "path": "src/shared.ts",
    "content": "export { LogLevels, LogTypes } from \"./constants\";\nexport { Consola } from \"./consola\";\n\nexport type * from \"./types\";\nexport type { ConsolaInstance } from \"./consola\";\nexport type { LogLevel, LogType } from \"./constants\";\nexport type {\n  PromptOptions,\n  ConfirmPromptOptions,\n  MultiSelectOptions,\n  SelectPromptOptions,\n  TextPromptOptions,\n} from \"./prompt\";\n"
  },
  {
    "path": "src/types.ts",
    "content": "import type { LogLevel, LogType } from \"./constants\";\n\nexport interface ConsolaOptions {\n  /**\n   * An array of ConsolaReporter instances used to handle and output log messages.\n   */\n  reporters: ConsolaReporter[];\n\n  /**\n   * A record mapping LogType to InputLogObject, defining the log configuration for each log type.\n   * See {@link LogType} and {@link InputLogObject}.\n   */\n  types: Record<LogType, InputLogObject>;\n\n  /**\n   * The minimum log level to output. See {@link LogLevel}.\n   */\n  level: LogLevel;\n\n  /**\n   * Default properties applied to all log messages unless overridden. See {@link InputLogObject}.\n   */\n  defaults: InputLogObject;\n\n  /**\n   * The maximum number of times a log message can be repeated within a given timeframe.\n   */\n  throttle: number;\n\n  /**\n   * The minimum time in milliseconds that must elapse before a throttled log message can be logged again.\n   */\n  throttleMin: number;\n\n  /**\n   * The Node.js writable stream for standard output. See {@link NodeJS.WriteStream}.\n   * @optional\n   */\n  stdout?: NodeJS.WriteStream;\n\n  /**\n   * The Node.js writeable stream for standard error output. See {@link NodeJS.WriteStream}.\n   * @optional\n   */\n  stderr?: NodeJS.WriteStream;\n\n  /**\n   * A function that allows you to mock log messages for testing purposes.\n   * @optional\n   */\n  mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;\n\n  /**\n   * Custom prompt function to use. It can be undefined.\n   * @optional\n   */\n  prompt?: typeof import(\"./prompt\").prompt | undefined;\n\n  /**\n   * Configuration options for formatting log messages. See {@link FormatOptions}.\n   */\n  formatOptions: FormatOptions;\n}\n\n/**\n * @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors\n */\nexport interface FormatOptions {\n  /**\n   * The maximum number of columns to output, affects formatting.\n   * @optional\n   */\n  columns?: number;\n\n  /**\n   * Whether to include timestamp information in log messages.\n   * @optional\n   */\n  date?: boolean;\n\n  /**\n   * Whether to use colors in the output.\n   * @optional\n   */\n  colors?: boolean;\n\n  /**\n   * Specifies whether or not the output should be compact. Accepts a boolean or numeric level of compactness.\n   * @optional\n   */\n  compact?: boolean | number;\n\n  /**\n   * Error cause level.\n   */\n  errorLevel?: number;\n\n  /**\n   * Allows additional custom formatting options.\n   */\n  [key: string]: unknown;\n}\n\nexport interface InputLogObject {\n  /**\n   * The logging level of the message. See {@link LogLevel}.\n   * @optional\n   */\n  level?: LogLevel;\n\n  /**\n   * A string tag to categorise or identify the log message.\n   * @optional\n   */\n  tag?: string;\n\n  /**\n   * The type of log message, which affects how it's processed and displayed. See {@link LogType}.\n   * @optional\n   */\n  type?: LogType;\n\n  /**\n   * The main log message text.\n   * @optional\n   */\n  message?: string;\n\n  /**\n   * Additional text or texts to be logged with the message.\n   * @optional\n   */\n  additional?: string | string[];\n\n  /**\n   * Additional arguments to be logged with the message.\n   * @optional\n   */\n  args?: any[];\n\n  /**\n   * The date and time when the log message was created.\n   * @optional\n   */\n  date?: Date;\n}\n\nexport interface LogObject extends InputLogObject {\n  /**\n   * The logging level of the message, overridden if required. See {@link LogLevel}.\n   */\n  level: LogLevel;\n\n  /**\n   * The type of log message, overridden if required. See {@link LogType}.\n   */\n  type: LogType;\n\n  /**\n   * A string tag to categorise or identify the log message, overridden if necessary.\n   */\n  tag: string;\n\n  /**\n   * Additional arguments to be logged with the message, overridden if necessary.\n   */\n  args: any[];\n\n  /**\n   * The date and time the log message was created, overridden if necessary.\n   */\n  date: Date;\n\n  /**\n   * Allows additional custom properties to be set on the log object.\n   */\n  [key: string]: unknown;\n}\n\nexport interface ConsolaReporter {\n  /**\n   * Defines how a log message is processed and displayed by this reporter.\n   * @param logObj The LogObject containing the log information to process. See {@link LogObject}.\n   * @param ctx An object containing context information such as options. See {@link ConsolaOptions}.\n   */\n  log: (\n    logObj: LogObject,\n    ctx: {\n      options: ConsolaOptions;\n    },\n  ) => void;\n}\n"
  },
  {
    "path": "src/utils/box.ts",
    "content": "import { getColor } from \"./color\";\nimport { stripAnsi } from \"./string\";\n\nexport type BoxBorderStyle = {\n  /**\n   * Top left corner\n   * @example `┌`\n   * @example `╔`\n   * @example `╓`\n   */\n  tl: string;\n  /**\n   * Top right corner\n   * @example `┐`\n   * @example `╗`\n   * @example `╖`\n   */\n  tr: string;\n  /**\n   * Bottom left corner\n   * @example `└`\n   * @example `╚`\n   * @example `╙`\n   */\n  bl: string;\n  /**\n   * Bottom right corner\n   * @example `┘`\n   * @example `╝`\n   * @example `╜`\n   */\n  br: string;\n  /**\n   * Horizontal line\n   * @example `─`\n   * @example `═`\n   * @example `─`\n   */\n  h: string;\n  /**\n   * Vertical line\n   * @example `│`\n   * @example `║`\n   * @example `║`\n   */\n  v: string;\n};\n\nconst boxStylePresets: Record<string, BoxBorderStyle> = {\n  solid: {\n    tl: \"┌\",\n    tr: \"┐\",\n    bl: \"└\",\n    br: \"┘\",\n    h: \"─\",\n    v: \"│\",\n  },\n  double: {\n    tl: \"╔\",\n    tr: \"╗\",\n    bl: \"╚\",\n    br: \"╝\",\n    h: \"═\",\n    v: \"║\",\n  },\n  doubleSingle: {\n    tl: \"╓\",\n    tr: \"╖\",\n    bl: \"╙\",\n    br: \"╜\",\n    h: \"─\",\n    v: \"║\",\n  },\n  doubleSingleRounded: {\n    tl: \"╭\",\n    tr: \"╮\",\n    bl: \"╰\",\n    br: \"╯\",\n    h: \"─\",\n    v: \"║\",\n  },\n  singleThick: {\n    tl: \"┏\",\n    tr: \"┓\",\n    bl: \"┗\",\n    br: \"┛\",\n    h: \"━\",\n    v: \"┃\",\n  },\n  singleDouble: {\n    tl: \"╒\",\n    tr: \"╕\",\n    bl: \"╘\",\n    br: \"╛\",\n    h: \"═\",\n    v: \"│\",\n  },\n  singleDoubleRounded: {\n    tl: \"╭\",\n    tr: \"╮\",\n    bl: \"╰\",\n    br: \"╯\",\n    h: \"═\",\n    v: \"│\",\n  },\n  rounded: {\n    tl: \"╭\",\n    tr: \"╮\",\n    bl: \"╰\",\n    br: \"╯\",\n    h: \"─\",\n    v: \"│\",\n  },\n};\n\nexport type BoxStyle = {\n  /**\n   * The border color\n   * @default 'white'\n   */\n  borderColor:\n    | \"black\"\n    | \"red\"\n    | \"green\"\n    | \"yellow\"\n    | \"blue\"\n    | \"magenta\"\n    | \"cyan\"\n    | \"white\"\n    | \"gray\"\n    | \"blackBright\"\n    | \"redBright\"\n    | \"greenBright\"\n    | \"yellowBright\"\n    | \"blueBright\"\n    | \"magentaBright\"\n    | \"cyanBright\"\n    | \"whiteBright\";\n\n  /**\n   * The border style\n   * @default 'solid'\n   * @example 'single-double-rounded'\n   * @example\n   * ```ts\n   * {\n   *   tl: '┌',\n   *   tr: '┐',\n   *   bl: '└',\n   *   br: '┘',\n   *   h: '─',\n   *   v: '│',\n   * }\n   * ```\n   */\n  borderStyle: BoxBorderStyle | keyof typeof boxStylePresets;\n\n  /**\n   * The vertical alignment of the text\n   * @default 'center'\n   */\n  valign: \"top\" | \"center\" | \"bottom\";\n\n  /**\n   * The padding of the box\n   * @default 2\n   */\n  padding: number;\n\n  /**\n   * The left margin of the box\n   * @default 1\n   */\n  marginLeft: number;\n\n  /**\n   * The top margin of the box\n   * @default 1\n   */\n  marginTop: number;\n\n  /**\n   * The top margin of the box\n   * @default 1\n   */\n  marginBottom: number;\n};\n\n/**\n * The border options of the box\n */\nexport type BoxOpts = {\n  /**\n   * Title that will be displayed on top of the box\n   * @example 'Hello World'\n   * @example 'Hello {name}'\n   */\n  title?: string;\n\n  style?: Partial<BoxStyle>;\n};\n\n/**\n * The default style applied to a box if no custom style is specified. See {@link BoxStyle}.\n */\nconst defaultStyle: BoxStyle = {\n  borderColor: \"white\",\n  borderStyle: \"rounded\",\n  valign: \"center\",\n  padding: 2,\n  marginLeft: 1,\n  marginTop: 1,\n  marginBottom: 1,\n};\n\n/**\n * Creates a styled box with text content, customisable via options.\n * @param {string} text - The text to display in the box.\n * @param {BoxOpts} [_opts={}] - Optional settings for the appearance and behaviour of the box. See {@link BoxOpts}.\n * @returns {string} The formatted box as a string, ready for printing or logging.\n */\nexport function box(text: string, _opts: BoxOpts = {}) {\n  const opts = {\n    ..._opts,\n    style: {\n      ...defaultStyle,\n      ..._opts.style,\n    },\n  };\n\n  // Split the text into lines\n  const textLines = text.split(\"\\n\");\n\n  // Create the box\n  const boxLines = [];\n\n  // Get the characters for the box and colorize\n  const _color = getColor(opts.style.borderColor);\n  const borderStyle = {\n    ...(typeof opts.style.borderStyle === \"string\"\n      ? boxStylePresets[\n          opts.style.borderStyle as keyof typeof boxStylePresets\n        ] || boxStylePresets.solid\n      : opts.style.borderStyle),\n  };\n  if (_color) {\n    for (const key in borderStyle) {\n      borderStyle[key as keyof typeof borderStyle] = _color(\n        borderStyle[key as keyof typeof borderStyle],\n      );\n    }\n  }\n\n  // Calculate the width and height of the box\n  const paddingOffset =\n    opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;\n  const height = textLines.length + paddingOffset;\n  const width =\n    Math.max(\n      ...textLines.map((line) => stripAnsi(line).length),\n      opts.title ? stripAnsi(opts.title).length : 0,\n    ) + paddingOffset;\n  const widthOffset = width + paddingOffset;\n\n  const leftSpace =\n    opts.style.marginLeft > 0 ? \" \".repeat(opts.style.marginLeft) : \"\";\n\n  // Top line\n  if (opts.style.marginTop > 0) {\n    boxLines.push(\"\".repeat(opts.style.marginTop));\n  }\n  // Include the title if it exists with borders\n  if (opts.title) {\n    const title = _color ? _color(opts.title) : opts.title;\n    const left = borderStyle.h.repeat(\n      Math.floor((width - stripAnsi(opts.title).length) / 2),\n    );\n    const right = borderStyle.h.repeat(\n      width -\n        stripAnsi(opts.title).length -\n        stripAnsi(left).length +\n        paddingOffset,\n    );\n    boxLines.push(\n      `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`,\n    );\n  } else {\n    boxLines.push(\n      `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${\n        borderStyle.tr\n      }`,\n    );\n  }\n\n  // Middle lines\n  const valignOffset =\n    opts.style.valign === \"center\"\n      ? Math.floor((height - textLines.length) / 2)\n      : opts.style.valign === \"top\" // eslint-disable-line unicorn/no-nested-ternary\n        ? height - textLines.length - paddingOffset\n        : height - textLines.length;\n\n  for (let i = 0; i < height; i++) {\n    if (i < valignOffset || i >= valignOffset + textLines.length) {\n      // Empty line\n      boxLines.push(\n        `${leftSpace}${borderStyle.v}${\" \".repeat(widthOffset)}${\n          borderStyle.v\n        }`,\n      );\n    } else {\n      // Text line\n      const line = textLines[i - valignOffset];\n      const left = \" \".repeat(paddingOffset);\n      const right = \" \".repeat(width - stripAnsi(line).length);\n      boxLines.push(\n        `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`,\n      );\n    }\n  }\n\n  // Bottom line\n  boxLines.push(\n    `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${\n      borderStyle.br\n    }`,\n  );\n  if (opts.style.marginBottom > 0) {\n    boxLines.push(\"\".repeat(opts.style.marginBottom));\n  }\n\n  return boxLines.join(\"\\n\");\n}\n"
  },
  {
    "path": "src/utils/color.ts",
    "content": "/**\n * Based on https://github.com/jorgebucaran/colorette\n * Read LICENSE file for more information\n * https://github.com/jorgebucaran/colorette/blob/20fc196d07d0f87c61e0256eadd7831c79b24108/index.js\n */\n\nimport * as tty from \"node:tty\";\n\n// TODO: Migrate to std-env\nconst {\n  env = {},\n  argv = [],\n  platform = \"\",\n} = typeof process === \"undefined\" ? {} : process;\nconst isDisabled = \"NO_COLOR\" in env || argv.includes(\"--no-color\");\nconst isForced = \"FORCE_COLOR\" in env || argv.includes(\"--color\");\nconst isWindows = platform === \"win32\";\nconst isDumbTerminal = env.TERM === \"dumb\";\nconst isCompatibleTerminal =\n  tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;\nconst isCI =\n  \"CI\" in env &&\n  (\"GITHUB_ACTIONS\" in env || \"GITLAB_CI\" in env || \"CIRCLECI\" in env);\n\n/**\n * Determines support for terminal colours based on the environment and capabilities of the terminal.\n * @type {boolean} isColorSupported - Indicates whether colour support is enabled in the terminal.\n */\nconst isColorSupported =\n  !isDisabled &&\n  (isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);\n\nfunction replaceClose(\n  index: number,\n  string: string,\n  close: string,\n  replace: string,\n  head = string.slice(0, Math.max(0, index)) + replace,\n  tail = string.slice(Math.max(0, index + close.length)),\n  next = tail.indexOf(close),\n): string {\n  return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));\n}\n\nfunction clearBleed(\n  index: number,\n  string: string,\n  open: string,\n  close: string,\n  replace: string,\n) {\n  return index < 0\n    ? open + string + close\n    : open + replaceClose(index, string, close, replace) + close;\n}\n\nfunction filterEmpty(\n  open: string,\n  close: string,\n  replace = open,\n  at = open.length + 1,\n) {\n  return (string: string) =>\n    string || !(string === \"\" || string === undefined)\n      ? clearBleed(\n          (\"\" + string).indexOf(close, at),\n          string,\n          open,\n          close,\n          replace,\n        )\n      : \"\";\n}\n\nfunction init(open: number, close: number, replace?: string) {\n  return filterEmpty(`\\u001B[${open}m`, `\\u001B[${close}m`, replace);\n}\n\nconst colorDefs = {\n  reset: init(0, 0),\n  bold: init(1, 22, \"\\u001B[22m\\u001B[1m\"),\n  dim: init(2, 22, \"\\u001B[22m\\u001B[2m\"),\n  italic: init(3, 23),\n  underline: init(4, 24),\n  inverse: init(7, 27),\n  hidden: init(8, 28),\n  strikethrough: init(9, 29),\n  black: init(30, 39),\n  red: init(31, 39),\n  green: init(32, 39),\n  yellow: init(33, 39),\n  blue: init(34, 39),\n  magenta: init(35, 39),\n  cyan: init(36, 39),\n  white: init(37, 39),\n  gray: init(90, 39),\n  bgBlack: init(40, 49),\n  bgRed: init(41, 49),\n  bgGreen: init(42, 49),\n  bgYellow: init(43, 49),\n  bgBlue: init(44, 49),\n  bgMagenta: init(45, 49),\n  bgCyan: init(46, 49),\n  bgWhite: init(47, 49),\n  blackBright: init(90, 39),\n  redBright: init(91, 39),\n  greenBright: init(92, 39),\n  yellowBright: init(93, 39),\n  blueBright: init(94, 39),\n  magentaBright: init(95, 39),\n  cyanBright: init(96, 39),\n  whiteBright: init(97, 39),\n  bgBlackBright: init(100, 49),\n  bgRedBright: init(101, 49),\n  bgGreenBright: init(102, 49),\n  bgYellowBright: init(103, 49),\n  bgBlueBright: init(104, 49),\n  bgMagentaBright: init(105, 49),\n  bgCyanBright: init(106, 49),\n  bgWhiteBright: init(107, 49),\n};\n\nexport type ColorName = keyof typeof colorDefs;\nexport type ColorFunction = (text: string | number) => string;\n\n/**\n * Creates an object that maps colour names to their respective colour functions,\n * based on whether or not colour support is enabled.\n * @param {boolean} [useColor=isColorSupported] - Specifies whether to use colour functions or fallback to plain strings.\n * @returns {Record<ColorName, ColorFunction>} An object where keys are colour names and values are functions to apply those colours. See {@link ColorFunction}.\n */\nfunction createColors(useColor = isColorSupported) {\n  return useColor\n    ? colorDefs\n    : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));\n}\n\n/**\n * An object containing functions for colouring text. Each function corresponds to a terminal colour. See {@link ColorName} for available colours.\n */\nexport const colors = createColors() as Record<ColorName, ColorFunction>;\n\n/**\n * Gets a colour function by name, with an option for a fallback colour if the requested colour is not found.\n * @param {ColorName} color - The name of the colour function to get. See {@link ColorName}.\n * @param {ColorName} [fallback=\"reset\"] - The name of the fallback colour function if the requested colour is not found. See {@link ColorName}.\n * @returns {ColorFunction} The colour function that corresponds to the requested colour, or the fallback colour function. See {@link ColorFunction}.\n */\nexport function getColor(\n  color: ColorName,\n  fallback: ColorName = \"reset\",\n): ColorFunction {\n  return colors[color] || colors[fallback];\n}\n\n/**\n * Applies a specified colour to a given text string or number.\n * @param {ColorName} color - The colour to apply. See {@link ColorName}.\n * @param {string | number} text - The text to colour.\n * @returns {string} The coloured text.\n */\nexport function colorize(color: ColorName, text: string | number): string {\n  return getColor(color)(text);\n}\n"
  },
  {
    "path": "src/utils/error.ts",
    "content": "import { sep } from \"node:path\";\n\n/**\n * Parses a stack trace string and normalises its paths by removing the current working directory and the \"file://\" protocol.\n * @param {string} stack - The stack trace string.\n * @returns {string[]} An array of stack trace lines with normalised paths.\n */\nexport function parseStack(stack: string, message: string) {\n  const cwd = process.cwd() + sep;\n\n  const lines = stack\n    .split(\"\\n\")\n    .splice(message.split(\"\\n\").length)\n    .map((l) => l.trim().replace(\"file://\", \"\").replace(cwd, \"\"));\n\n  return lines;\n}\n"
  },
  {
    "path": "src/utils/format.ts",
    "content": "import { vsprintf } from \"printj\";\n\n// Predefined rules for replacing format arguments\nconst FORMAT_ARGS = [\n  [\"additional\", 5],\n  [\"message\", 4],\n  [\"type\", 2],\n  [\"date\", 1],\n  [\"tag\", 3],\n]; // .sort((a, b) => b[0].length - a[0].length)\n\n// Caches compiled format strings for reuse\nconst _compileCache: any = {};\n// process.on('beforeExit', () => { console.log(_compileCache) })\n\n/**\n * Compiles a format string by replacing placeholders with appropriate position indices.\n * Caches compiled formats for efficiency.\n * @param {string} format - The format string containing the placeholders to replace.\n * @returns {string} The compiled format string with placeholders replaced by positional indices.\n */\nexport function compileFormat(format: string) {\n  if (_compileCache[format]) {\n    return _compileCache[format];\n  }\n\n  let _format = format;\n  for (const arg of FORMAT_ARGS) {\n    _format = _format.replace(\n      new RegExp(\"([%-])\" + arg[0], \"g\"),\n      \"$1\" + arg[1],\n    );\n  }\n\n  _compileCache[format] = _format;\n  return _format;\n}\n\n/**\n * Formats a string according to a custom format, using vsprintf for string formatting.\n * @param {string} format - The custom format string.\n * @param {any[]} argv - The arguments to format into the string.\n * @returns {string} The formatted string.\n */\nexport function formatString(format: string, argv: any) {\n  return vsprintf(compileFormat(format), argv);\n}\n"
  },
  {
    "path": "src/utils/log.ts",
    "content": "/**\n * Checks if the given argument is a simple JavaScript object.\n * @param {any} obj - The object to test.\n * @returns {boolean} `true` if the argument is a plain object, otherwise `false`.\n */\nexport function isPlainObject(obj: any) {\n  return Object.prototype.toString.call(obj) === \"[object Object]\";\n}\n\n/**\n * Determines whether the given argument is a protocol object. A log object must be a simple object and\n * must contain either a 'message' or 'args' field, but not a 'stack' field.\n * @param {any} arg - The argument to check.\n * @returns {boolean} `true` if the argument is a log object according to the specified criteria, otherwise `false`.\n */\nexport function isLogObj(arg: any) {\n  // Should be plain object\n  if (!isPlainObject(arg)) {\n    return false;\n  }\n\n  // Should contains either 'message' or 'args' field\n  if (!arg.message && !arg.args) {\n    return false;\n  }\n\n  // Handle non-standard error objects\n  if (arg.stack) {\n    return false;\n  }\n\n  return true;\n}\n"
  },
  {
    "path": "src/utils/stream.ts",
    "content": "/**\n * Writes data to a specified NodeJS writable stream. This function supports streams that have a custom\n * `__write' method, and will fall back to the default `write' method if `__write' is not present.\n *\n * @param {any} data - The data to write to the stream. This can be a string, a buffer, or any data type\n * supported by the stream's `write' or `__write' method.\n * @param {NodeJS.WriteStream} stream - The writable stream to write the data to. This stream\n * must implement the `write' method, and can optionally implement a custom `__write' method.\n * @returns {boolean} `true` if the data has been completely processed by the write operation,\n * indicating that further writes can be performed immediately. Returns `false` if the data is\n * buffered by the stream, indicating that the `drain` event should be waited for before writing\n * more data.\n */\nexport function writeStream(data: any, stream: NodeJS.WriteStream) {\n  const write = (stream as any).__write || stream.write;\n  return write.call(stream, data);\n}\n"
  },
  {
    "path": "src/utils/string.ts",
    "content": "const ansiRegex = [\n  String.raw`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)`,\n  String.raw`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`,\n].join(\"|\");\n\n/**\n * Removes ANSI escape codes from a given string. This is particularly useful for\n * processing text that contains formatting codes, such as colours or styles, so that the\n * the raw text without any visual formatting.\n *\n * @param {string} text - The text string from which to strip the ANSI escape codes.\n * @returns {string} The text without ANSI escape codes.\n */\nexport function stripAnsi(text: string) {\n  return text.replace(new RegExp(ansiRegex, \"g\"), \"\");\n}\n\n/**\n * Centers a string within a specified total width, padding it with spaces or another specified character.\n * If the string is longer than the total width, it is returned as is.\n *\n * @param {string} str - The string to centre.\n * @param {number} len - The total width in which to centre the string.\n * @param {string} [space=\" \"] - The character to use for padding. Defaults to a space.\n * @returns {string} The centred string.\n */\nexport function centerAlign(str: string, len: number, space = \" \") {\n  const free = len - str.length;\n  if (free <= 0) {\n    return str;\n  }\n  const freeLeft = Math.floor(free / 2);\n  let _str = \"\";\n  for (let i = 0; i < len; i++) {\n    _str +=\n      i < freeLeft || i >= freeLeft + str.length ? space : str[i - freeLeft];\n  }\n  return _str;\n}\n\n/**\n * Right-justifies a string within a given total width, padding it with whitespace or another specified character.\n * If the string is longer than the total width, it is returned as is.\n *\n * @param {string} str - The string to right-justify.\n * @param {number} len - The total width to align the string.\n * @param {string} [space=\" \"] - The character to use for padding. Defaults to a space.\n * @returns {string} The right-justified string.\n */\nexport function rightAlign(str: string, len: number, space = \" \") {\n  const free = len - str.length;\n  if (free <= 0) {\n    return str;\n  }\n  let _str = \"\";\n  for (let i = 0; i < len; i++) {\n    _str += i < free ? space : str[i - free];\n  }\n  return _str;\n}\n\n/**\n * Left-aligns a string within a given total width, padding it with whitespace or another specified character on the right.\n * If the string is longer than the total width, it is returned as is.\n *\n * @param {string} str - The string to align left.\n * @param {number} len - The total width to align the string.\n * @param {string} [space=\" \"] - The character to use for padding. Defaults to a space.\n * @returns {string} The left-justified string.\n */\nexport function leftAlign(str: string, len: number, space = \" \") {\n  let _str = \"\";\n  for (let i = 0; i < len; i++) {\n    _str += i < str.length ? str[i] : space;\n  }\n  return _str;\n}\n\n/**\n * Aligns a string (left, right, or centre) within a given total width, padding it with spaces or another specified character.\n * If the string is longer than the total width, it is returned as is. This function acts as a wrapper for individual alignment functions.\n *\n * @param {\"left\" | \"right\" | \"centre\"} alignment - The desired alignment of the string.\n * @param {string} str - The string to align.\n * @param {number} len - The total width in which to align the string.\n * @param {string} [space=\" \"] - The character to use for padding. Defaults to a space.\n * @returns {string} The aligned string, according to the given alignment.\n */\nexport function align(\n  alignment: \"left\" | \"right\" | \"center\",\n  str: string,\n  len: number,\n  space = \" \",\n) {\n  switch (alignment) {\n    case \"left\": {\n      return leftAlign(str, len, space);\n    }\n    case \"right\": {\n      return rightAlign(str, len, space);\n    }\n    case \"center\": {\n      return centerAlign(str, len, space);\n    }\n    default: {\n      return str;\n    }\n  }\n}\n"
  },
  {
    "path": "src/utils/tree.ts",
    "content": "import { type ColorName, colorize } from \"./color\";\n\nexport type TreeItemObject = {\n  /**\n   * Text of the item\n   */\n  text: string;\n\n  /**\n   * Children of the item\n   */\n  children?: TreeItem[];\n\n  /**\n   * Color of the item\n   */\n  color?: ColorName;\n};\n\nexport type TreeItem = string | TreeItemObject;\n\nexport type TreeOptions = {\n  /**\n   * Color of the tree\n   */\n  color?: ColorName;\n\n  /**\n   * Prefix of the tree\n   *\n   * @default \"  \"\n   */\n  prefix?: string;\n\n  /**\n   * The max depth of tree\n   */\n  maxDepth?: number;\n\n  /**\n   * Ellipsis of the tree\n   *\n   * @default \"...\"\n   */\n  ellipsis?: string;\n};\n\n/**\n * Formats a hierarchical list of items into a string representing a tree structure.\n * Each item in the tree can be a simple string or an object defining the text of the item,\n * optional children, and colour. The tree structure can be customised with options\n * Specify the overall colour and the prefix used for indentation and tree lines.\n *\n * @param {TreeItem[]} items - An array of items to include in the tree. Each item can be\n * either a string or an object with `text', `children' and `colour' properties.\n * @param {TreeOptions} [options] - Optional settings to customise the appearance of the tree, including\n * the colour of the tree text and the prefix for branches. See {@link TreeOptions}.\n * @returns {string} The formatted tree as a string, ready for printing to the console or elsewhere.\n */\nexport function formatTree(items: TreeItem[], options?: TreeOptions): string {\n  options = {\n    prefix: \"  \",\n    ellipsis: \"...\",\n    ...options,\n  };\n\n  const tree = _buildTree(items, options).join(\"\");\n  if (options && options.color) {\n    return colorize(options.color, tree);\n  }\n\n  return tree;\n}\n\nfunction _buildTree(items: TreeItem[], options?: TreeOptions): string[] {\n  const chunks: string[] = [];\n  const total = items.length - 1;\n  for (let i = 0; i <= total; i++) {\n    const item = items[i];\n    const isItemString = typeof item === \"string\";\n    const isLimit = options?.maxDepth != null && options.maxDepth <= 0;\n    if (isLimit) {\n      const ellipsis = `${options.prefix}${options.ellipsis}\\n`;\n      return [\n        isItemString\n          ? ellipsis\n          :\n            (item.color\n            ? colorize(item.color, ellipsis)\n            : ellipsis), // prettier-ignore\n      ];\n    }\n    const isLast = i === total;\n    const prefix = isLast ? `${options?.prefix}└─` : `${options?.prefix}├─`;\n    if (isItemString) {\n      chunks.push(`${prefix}${item}\\n`);\n    } else {\n      const log = `${prefix}${item.text}\\n`;\n      chunks.push(item.color ? colorize(item.color, log) : log);\n\n      if (item.children) {\n        const _tree = _buildTree(item.children, {\n          ...options,\n          maxDepth:\n            options?.maxDepth == null ? undefined : options.maxDepth - 1,\n          prefix: `${options?.prefix}${isLast ? \"  \" : \"│  \"}`,\n        });\n        chunks.push(..._tree);\n      }\n    }\n  }\n\n  return chunks;\n}\n"
  },
  {
    "path": "src/utils.ts",
    "content": "export * from \"./utils/box\";\nexport * from \"./utils/color\";\nexport {\n  stripAnsi,\n  centerAlign,\n  rightAlign,\n  leftAlign,\n  align,\n} from \"./utils/string\";\nexport {\n  type TreeItemObject,\n  type TreeItem,\n  type TreeOptions,\n  formatTree,\n} from \"./utils/tree\";\n"
  },
  {
    "path": "test/consola.test.ts",
    "content": "import { describe, test, expect } from \"vitest\";\nimport { ConsolaReporter, LogLevels, LogObject, createConsola } from \"../src\";\n\ndescribe(\"consola\", () => {\n  test(\"can set level\", () => {\n    const consola = createConsola();\n    expect(consola.level).toBe(1);\n\n    for (let i = 0; i <= 5; i++) {\n      consola.level = i;\n      expect(consola.level).toBe(i);\n    }\n  });\n\n  test(\"silent log level does't print logs\", async () => {\n    const logs: LogObject[] = [];\n    const TestReporter: ConsolaReporter = {\n      log(logObj) {\n        logs.push(logObj);\n      },\n    };\n\n    const consola = createConsola({\n      throttle: 100,\n      level: LogLevels.silent,\n      reporters: [TestReporter],\n    });\n\n    for (let i = 0; i < 10; i++) {\n      consola.log(\"SPAM\");\n    }\n\n    await wait(200);\n    expect(logs.length).toBe(0);\n  });\n\n  test(\"can see spams without ending log\", async () => {\n    const logs: LogObject[] = [];\n    const TestReporter: ConsolaReporter = {\n      log(logObj) {\n        logs.push(logObj);\n      },\n    };\n\n    const consola = createConsola({\n      throttle: 100,\n      level: LogLevels.info,\n      reporters: [TestReporter],\n    });\n    for (let i = 0; i < 10; i++) {\n      consola.log(\"SPAM\");\n    }\n    await wait(300);\n    expect(logs.length).toBe(7);\n    // 6 + Last one indicating it repeated 4\n\n    expect(logs.at(-1)!.args).toEqual([\"SPAM\", \"(repeated 4 times)\"]);\n  });\n});\n\nfunction wait(delay) {\n  return new Promise((resolve) => {\n    setTimeout(resolve, delay);\n  });\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Node\",\n    \"esModuleInterop\": true,\n    \"strict\": true,\n    \"types\": [\"vitest/globals\", \"node\"]\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "utils.d.ts",
    "content": "export * from \"./dist/utils\";\n"
  }
]