mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
remove pretty-error
https://github.com/standard-things/esm/wiki/improved-errors
This commit is contained in:
parent
189c928a6d
commit
f20ad95b2b
@ -3,7 +3,7 @@ import { resolve, join, dirname, sep } from 'path'
|
|||||||
import { minify } from 'html-minifier'
|
import { minify } from 'html-minifier'
|
||||||
import Chalk from 'chalk'
|
import Chalk from 'chalk'
|
||||||
import { copy, remove, writeFile, mkdirp, removeSync, existsSync } from 'fs-extra'
|
import { copy, remove, writeFile, mkdirp, removeSync, existsSync } from 'fs-extra'
|
||||||
import { isUrl, promisifyRoute, waitFor, flatRoutes, pe, printWarn, createSpinner } from '../common/utils'
|
import { isUrl, promisifyRoute, waitFor, flatRoutes, printWarn, createSpinner } from '../common/utils'
|
||||||
|
|
||||||
export default class Generator {
|
export default class Generator {
|
||||||
constructor(nuxt, builder) {
|
constructor(nuxt, builder) {
|
||||||
@ -122,12 +122,12 @@ export default class Generator {
|
|||||||
const color = isHandled ? 'yellow' : 'red'
|
const color = isHandled ? 'yellow' : 'red'
|
||||||
|
|
||||||
let line =
|
let line =
|
||||||
Chalk.black[bgColor](' GENERATE ERR ') + Chalk[color](` ${route}\n\n`)
|
Chalk.black[bgColor](' GEN ERR ') + Chalk[color](` ${route}\n\n`)
|
||||||
|
|
||||||
if (isHandled) {
|
if (isHandled) {
|
||||||
line += Chalk.grey(JSON.stringify(error, undefined, 2) + '\n')
|
line += Chalk.grey(JSON.stringify(error, undefined, 2) + '\n')
|
||||||
} else {
|
} else {
|
||||||
line += Chalk.grey(pe.render(error))
|
line += Chalk.grey(error.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
return line
|
return line
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import { resolve, relative, sep } from 'path'
|
import { resolve, relative, sep } from 'path'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import PrettyError from 'pretty-error'
|
|
||||||
import Chalk from 'chalk'
|
import Chalk from 'chalk'
|
||||||
import ORA from 'ora'
|
import ORA from 'ora'
|
||||||
|
|
||||||
export const pe = new PrettyError()
|
|
||||||
|
|
||||||
export const printWarn = function (msg, from) {
|
export const printWarn = function (msg, from) {
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
const fromStr = from ? Chalk.yellow(` ${from}\n\n`) : ' '
|
const fromStr = from ? Chalk.yellow(` ${from}\n\n`) : ' '
|
||||||
@ -13,7 +10,7 @@ export const printWarn = function (msg, from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const renderError = function (_error, from) {
|
export const renderError = function (_error, from) {
|
||||||
const errStr = pe.render(_error)
|
const errStr = _error.toString()
|
||||||
const fromStr = from ? Chalk.red(` ${from}`) : ''
|
const fromStr = from ? Chalk.red(` ${from}`) : ''
|
||||||
return '\n' + Chalk.bgRed.black(' ERROR ') + fromStr + '\n\n' + errStr
|
return '\n' + Chalk.bgRed.black(' ERROR ') + fromStr + '\n\n' + errStr
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@
|
|||||||
"postcss-import-resolver": "^1.1.0",
|
"postcss-import-resolver": "^1.1.0",
|
||||||
"postcss-loader": "^2.1.0",
|
"postcss-loader": "^2.1.0",
|
||||||
"postcss-url": "^7.3.0",
|
"postcss-url": "^7.3.0",
|
||||||
"pretty-error": "^2.1.1",
|
|
||||||
"semver": "^5.5.0",
|
"semver": "^5.5.0",
|
||||||
"serialize-javascript": "^1.4.0",
|
"serialize-javascript": "^1.4.0",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
|
@ -19,7 +19,7 @@ const startDir = resolve(rootDir, 'start')
|
|||||||
const packageJSON = readJSONSync(resolve(rootDir, 'package.json'))
|
const packageJSON = readJSONSync(resolve(rootDir, 'package.json'))
|
||||||
|
|
||||||
// Required and Excluded packages for start
|
// Required and Excluded packages for start
|
||||||
let requires = ['source-map-support', 'pretty-error', 'minimist']
|
let requires = ['minimist']
|
||||||
|
|
||||||
const excludes = ['path', 'fs', 'http', 'module'].concat(
|
const excludes = ['path', 'fs', 'http', 'module'].concat(
|
||||||
Object.keys(packageJSON.devDependencies)
|
Object.keys(packageJSON.devDependencies)
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"source-map-support": "^0.5.0",
|
"source-map-support": "^0.5.0",
|
||||||
"pretty-error": "^2.1.1",
|
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"debug": "^3.1.0",
|
"debug": "^3.1.0",
|
||||||
|
@ -6070,7 +6070,7 @@ pretty-bytes@^4.0.2:
|
|||||||
version "4.0.2"
|
version "4.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||||
|
|
||||||
pretty-error@^2.0.2, pretty-error@^2.1.1:
|
pretty-error@^2.0.2:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user