Skip to content

Commit 0b5548d

Browse files
freakzlikecexbrayat
authored andcommitted
chore: Replace pretty by js-beautify
1 parent 76aa1d8 commit 0b5548d

File tree

4 files changed

+29
-68
lines changed

4 files changed

+29
-68
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"@rollup/plugin-node-resolve": "15.0.0",
2828
"@rollup/plugin-replace": "5.0.0",
2929
"@rollup/plugin-typescript": "9.0.1",
30+
"@types/js-beautify": "1.13.3",
3031
"@types/node": "18.0.6",
31-
"@types/pretty": "2.0.1",
3232
"@typescript-eslint/eslint-plugin": "5.40.1",
3333
"@typescript-eslint/parser": "5.40.1",
3434
"@vitejs/plugin-vue": "3.1.2",
@@ -43,11 +43,11 @@
4343
"eslint-config-prettier": "8.5.0",
4444
"eslint-plugin-prettier": "4.2.1",
4545
"husky": "8.0.1",
46+
"js-beautify": "1.14.6",
4647
"jsdom": "20.0.1",
4748
"jsdom-global": "3.0.2",
4849
"lint-staged": "13.0.3",
4950
"prettier": "2.7.1",
50-
"pretty": "2.0.0",
5151
"reflect-metadata": "0.1.13",
5252
"rollup": "3.2.3",
5353
"tslib": "2.4.0",

pnpm-lock.yaml

Lines changed: 15 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/baseWrapper.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { isElement } from './utils/isElement'
2929
import type { DOMWrapper } from './domWrapper'
3030
import { createDOMWrapper, createVueWrapper } from './wrapperFactory'
3131
import { stringifyNode } from './utils/stringifyNode'
32-
import pretty from 'pretty'
32+
import beautify from 'js-beautify'
3333

3434
export default abstract class BaseWrapper<ElementType extends Node>
3535
implements WrapperLike
@@ -216,9 +216,18 @@ export default abstract class BaseWrapper<ElementType extends Node>
216216
)
217217
}
218218
abstract setValue(value?: any): Promise<void>
219+
219220
html(): string {
220-
return this.getRootNodes()
221-
.map((node) => pretty(stringifyNode(node)))
221+
const stringNodes = this.getRootNodes().map((node) => stringifyNode(node))
222+
223+
return stringNodes
224+
.map((node) =>
225+
beautify.html(node, {
226+
unformatted: ['code', 'pre', 'em', 'strong', 'span'],
227+
indent_inner_html: true,
228+
indent_size: 2
229+
})
230+
)
222231
.join('\n')
223232
}
224233

src/vueWrapper.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
ComponentCustomProperties,
55
ComponentPublicInstance
66
} from 'vue'
7-
// @ts-ignore todo - No DefinitelyTyped package exists for this
8-
import pretty from 'pretty'
97

108
import { config } from './config'
119
import domEvents from './constants/dom-events'

0 commit comments

Comments
 (0)