Skip to content

Commit 89e0697

Browse files
authored
feat: syntax highlight inspect output (#3844)
1 parent 0d7908b commit 89e0697

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

packages/@vue/cli-service/lib/commands/inspect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = (api, options) => {
1717
const chalk = require('chalk')
1818
const { get } = require('@vue/cli-shared-utils')
1919
const { toString } = require('webpack-chain')
20+
const { highlight } = require('cli-highlight')
2021
const config = api.resolveWebpackConfig()
2122
const { _: paths, verbose } = args
2223

@@ -48,7 +49,7 @@ module.exports = (api, options) => {
4849
}
4950

5051
const output = toString(res, { verbose })
51-
console.log(output)
52+
console.log(highlight(output, { language: 'js' }))
5253

5354
// Log explanation for Nameless Rules
5455
if (hasUnnamedRule) {

packages/@vue/cli-service/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"cache-loader": "^2.0.1",
3939
"case-sensitive-paths-webpack-plugin": "^2.2.0",
4040
"chalk": "^2.4.2",
41+
"cli-highlight": "^2.1.0",
4142
"clipboardy": "^2.0.0",
4243
"cliui": "^5.0.0",
4344
"copy-webpack-plugin": "^4.6.0",

yarn.lock

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4234,6 +4234,17 @@ cli-highlight@^1.2.3:
42344234
parse5 "^3.0.3"
42354235
yargs "^10.0.3"
42364236

4237+
cli-highlight@^2.1.0:
4238+
version "2.1.0"
4239+
resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.0.tgz#1e2e6770b6c3d72c4c7d4e5ea27c496f82ec2c67"
4240+
integrity sha512-DxaFAFBGRaB+xueXP7jlJC5f867gZUZXz74RaxeZ9juEZM2Sm/s6ilzpz0uxKiT+Mj6TzHlibtXfG/dK5bSwDA==
4241+
dependencies:
4242+
chalk "^2.3.0"
4243+
highlight.js "^9.6.0"
4244+
mz "^2.4.0"
4245+
parse5 "^4.0.0"
4246+
yargs "^11.0.0"
4247+
42374248
cli-spinners@^0.1.2:
42384249
version "0.1.2"
42394250
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c"
@@ -12555,7 +12566,7 @@ parse-url@^5.0.0:
1255512566
parse-path "^4.0.0"
1255612567
protocols "^1.4.0"
1255712568

12558-
12569+
[email protected], parse5@^4.0.0:
1255912570
version "4.0.0"
1256012571
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
1256112572
integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==

0 commit comments

Comments
 (0)