mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
perf: use native util.promisify instead of pify
https://nodejs.org/api/util.html#util_util_promisify_original
This commit is contained in:
parent
0ebc17454d
commit
5a07be6396
@ -1,8 +1,8 @@
|
||||
import { promisify } from 'util'
|
||||
import _ from 'lodash'
|
||||
import chokidar from 'chokidar'
|
||||
import fs, { remove, readFile, writeFile, mkdirp, existsSync } from 'fs-extra'
|
||||
import hash from 'hash-sum'
|
||||
import pify from 'pify'
|
||||
import webpack from 'webpack'
|
||||
import serialize from 'serialize-javascript'
|
||||
import { join, resolve, basename, extname, dirname } from 'path'
|
||||
@ -22,7 +22,7 @@ import { Options } from 'common'
|
||||
const debug = Debug('nuxt:build')
|
||||
debug.color = 2 // Force green color
|
||||
|
||||
const glob = pify(Glob)
|
||||
const glob = promisify(Glob)
|
||||
|
||||
export default class Builder {
|
||||
constructor(nuxt) {
|
||||
@ -519,7 +519,7 @@ export default class Builder {
|
||||
debug('Adding webpack middleware...')
|
||||
|
||||
// Create webpack dev middleware
|
||||
this.webpackDevMiddleware = pify(webpackDevMiddleware(compiler, Object.assign({
|
||||
this.webpackDevMiddleware = promisify(webpackDevMiddleware(compiler, Object.assign({
|
||||
publicPath: this.options.build.publicPath,
|
||||
stats: this.webpackStats,
|
||||
noInfo: true,
|
||||
@ -527,9 +527,9 @@ export default class Builder {
|
||||
watchOptions: this.options.watchers.webpack
|
||||
}, this.options.build.devMiddleware)))
|
||||
|
||||
this.webpackDevMiddleware.close = pify(this.webpackDevMiddleware.close)
|
||||
this.webpackDevMiddleware.close = promisify(this.webpackDevMiddleware.close)
|
||||
|
||||
this.webpackHotMiddleware = pify(webpackHotMiddleware(compiler, Object.assign({
|
||||
this.webpackHotMiddleware = promisify(webpackHotMiddleware(compiler, Object.assign({
|
||||
log: false,
|
||||
heartbeat: 10000
|
||||
}, this.options.build.hotMiddleware)))
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { promisify } from 'util'
|
||||
import test from 'ava'
|
||||
import { resolve, sep } from 'path'
|
||||
import rp from 'request-promise-native'
|
||||
import { Utils } from '../index.js'
|
||||
import pify from 'pify'
|
||||
import { exec, spawn } from 'child_process'
|
||||
|
||||
const execify = pify(exec, { multiArgs: true })
|
||||
const execify = promisify(exec, { multiArgs: true })
|
||||
const rootDir = resolve(__dirname, 'fixtures/basic')
|
||||
|
||||
const port = 4011
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { promisify } from 'util'
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import fs from 'fs'
|
||||
import pify from 'pify'
|
||||
import stdMocks from 'std-mocks'
|
||||
import { Nuxt, Builder } from '../index.js'
|
||||
|
||||
const readFile = pify(fs.readFile)
|
||||
const readFile = promisify(fs.readFile)
|
||||
const rootDir = resolve(__dirname, './fixtures/dll')
|
||||
const dllDir = resolve(rootDir, '.cache/client-dll')
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import fs from 'fs'
|
||||
import pify from 'pify'
|
||||
import { Nuxt, Builder } from '../index.js'
|
||||
import { promisify } from 'util'
|
||||
|
||||
const readFile = pify(fs.readFile)
|
||||
const readFile = promisify(fs.readFile)
|
||||
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const nuxt = new Nuxt({
|
||||
|
Loading…
Reference in New Issue
Block a user