Skip to content

Commit

Permalink
fix: use poppinss/colors as styleText is not widely supported
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 21, 2024
1 parent 9b18e6a commit 2a491ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/dumper/dumper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

import { styleText } from 'node:util'
import useColors from '@poppinss/colors'
import { dump as consoleDump } from '@poppinss/dumper/console'
import type { HTMLDumpConfig } from '@poppinss/dumper/html/types'
import type { ConsoleDumpConfig } from '@poppinss/dumper/console/types'
Expand All @@ -16,6 +16,8 @@ import { createScript, createStyleSheet, dump } from '@poppinss/dumper/html'
import type { Application } from '../app.js'
import { E_DUMP_DIE_EXCEPTION } from './errors.js'

const colors = useColors.ansi()

const DUMP_TITLE_STYLES = `
.adonisjs-dump-header {
font-family: JetBrains Mono, monaspace argon, Menlo, Monaco, Consolas, monospace;
Expand Down Expand Up @@ -215,7 +217,7 @@ export class Dumper {
/**
* Styled heading with background color and bold text
*/
const heading = styleText('bgRed', styleText('bold', `${title}${whiteSpace}${link}`))
const heading = colors.bgRed().bold(`${title}${whiteSpace}${link}`)

return `${heading}\n${consoleDump(value, this.#consoleConfig)}`
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"@adonisjs/repl": "^4.0.1",
"@antfu/install-pkg": "^0.4.1",
"@paralleldrive/cuid2": "^2.2.2",
"@poppinss/colors": "^4.1.3",
"@poppinss/dumper": "^0.4.1",
"@poppinss/macroable": "^1.0.3",
"@poppinss/utils": "^6.8.3",
Expand Down

0 comments on commit 2a491ec

Please sign in to comment.