mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
refactor: use p-debounce
everywhere (#977)
This commit is contained in:
parent
74829784c1
commit
1fbfdefe70
@ -34,7 +34,6 @@
|
||||
"chokidar": "^3.5.2",
|
||||
"connect": "^3.7.0",
|
||||
"consola": "^2.15.3",
|
||||
"debounce": "^1.2.1",
|
||||
"defu": "^5.0.0",
|
||||
"destr": "^1.1.0",
|
||||
"dot-prop": "^6.0.1",
|
||||
@ -73,7 +72,6 @@
|
||||
"vue-server-renderer": "^2.6.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/debounce": "^1.2.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/http-proxy": "^1.17.7",
|
||||
"@types/node-fetch": "^3.0.2",
|
||||
|
@ -4,7 +4,7 @@ import { IncomingMessage, ServerResponse } from 'http'
|
||||
import { promises as fsp } from 'fs'
|
||||
import { loading as loadingTemplate } from '@nuxt/design'
|
||||
import chokidar, { FSWatcher } from 'chokidar'
|
||||
import debounce from 'debounce'
|
||||
import debounce from 'p-debounce'
|
||||
import { promisifyHandle, createApp, Middleware, useBase } from 'h3'
|
||||
import httpProxy from 'http-proxy'
|
||||
import { listen, Listener, ListenOptions } from 'listhen'
|
||||
@ -104,7 +104,7 @@ export function createDevServer (nitroContext: NitroContext) {
|
||||
let watcher: FSWatcher
|
||||
function watch () {
|
||||
if (watcher) { return }
|
||||
const dReload = debounce(() => reload().catch(console.warn), 200, true)
|
||||
const dReload = debounce(() => reload().catch(console.warn), 200, { before: true })
|
||||
watcher = chokidar.watch([
|
||||
resolve(nitroContext.output.serverDir, pattern),
|
||||
resolve(nitroContext._nuxt.buildDir, 'dist/server', pattern)
|
||||
|
@ -26,14 +26,12 @@
|
||||
"@nuxt/design": "0.1.3",
|
||||
"@nuxt/kit": "3.0.0",
|
||||
"@types/clear": "^0",
|
||||
"@types/debounce-promise": "^3",
|
||||
"@types/mri": "^1.1.1",
|
||||
"chokidar": "^3.5.2",
|
||||
"clear": "^0.1.0",
|
||||
"clipboardy": "^2.3.0",
|
||||
"colorette": "^2.0.16",
|
||||
"consola": "^2.15.3",
|
||||
"debounce-promise": "^3.1.2",
|
||||
"deep-object-diff": "^1.1.0",
|
||||
"degit": "^2.8.4",
|
||||
"destr": "^1.1.0",
|
||||
@ -42,6 +40,7 @@
|
||||
"listhen": "^0.2.4",
|
||||
"mlly": "^0.2.6",
|
||||
"mri": "^1.2.0",
|
||||
"p-debounce": "^4.0.0",
|
||||
"pathe": "^0.2.0",
|
||||
"scule": "^0.2.1",
|
||||
"superb": "^4.0.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { resolve, relative } from 'pathe'
|
||||
import chokidar from 'chokidar'
|
||||
import debounce from 'debounce-promise'
|
||||
import debounce from 'p-debounce'
|
||||
import type { Nuxt } from '@nuxt/kit'
|
||||
import consola from 'consola'
|
||||
import { createServer, createLoadingHandler } from '../utils/server'
|
||||
|
@ -13,7 +13,6 @@
|
||||
"prepack": "unbuild"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/debounce": "^1.2.1",
|
||||
"unbuild": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -22,7 +21,6 @@
|
||||
"@vitejs/plugin-vue-jsx": "^1.2.0",
|
||||
"chokidar": "^3.5.2",
|
||||
"consola": "^2.15.3",
|
||||
"debounce": "^1.2.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"magic-string": "^0.25.7",
|
||||
"p-debounce": "^4.0.0",
|
||||
|
35
yarn.lock
35
yarn.lock
@ -2635,7 +2635,6 @@ __metadata:
|
||||
"@rollup/plugin-virtual": ^2.0.3
|
||||
"@rollup/plugin-wasm": ^5.1.2
|
||||
"@rollup/pluginutils": ^4.1.1
|
||||
"@types/debounce": ^1.2.1
|
||||
"@types/fs-extra": ^9.0.13
|
||||
"@types/http-proxy": ^1.17.7
|
||||
"@types/jsdom": ^16.2.13
|
||||
@ -2647,7 +2646,6 @@ __metadata:
|
||||
chokidar: ^3.5.2
|
||||
connect: ^3.7.0
|
||||
consola: ^2.15.3
|
||||
debounce: ^1.2.1
|
||||
defu: ^5.0.0
|
||||
destr: ^1.1.0
|
||||
dot-prop: ^6.0.1
|
||||
@ -2795,12 +2793,10 @@ __metadata:
|
||||
resolution: "@nuxt/vite-builder@workspace:packages/vite"
|
||||
dependencies:
|
||||
"@nuxt/kit": 3.0.0
|
||||
"@types/debounce": ^1.2.1
|
||||
"@vitejs/plugin-vue": ^1.9.3
|
||||
"@vitejs/plugin-vue-jsx": ^1.2.0
|
||||
chokidar: ^3.5.2
|
||||
consola: ^2.15.3
|
||||
debounce: ^1.2.1
|
||||
fs-extra: ^10.0.0
|
||||
magic-string: ^0.25.7
|
||||
p-debounce: ^4.0.0
|
||||
@ -3358,20 +3354,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/debounce-promise@npm:^3":
|
||||
version: 3.1.4
|
||||
resolution: "@types/debounce-promise@npm:3.1.4"
|
||||
checksum: 8de5ec0eade0483569f01ffb8e5b59be3a295a577893c75abb8b5dcdcbde204ee8029edf874096f7105a4cdb46b0321de57b05ce730aa675ea20318d465fc9d7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/debounce@npm:^1.2.1":
|
||||
version: 1.2.1
|
||||
resolution: "@types/debounce@npm:1.2.1"
|
||||
checksum: bea6d414acefbee50adfe87cee10f8a855d033e4778567ab03bdc3cb2648b6bf9237ca53f4ee76fe4be75f77f86d4688411499626fe409bc870f53631d24231f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/eslint-scope@npm:^3.7.0":
|
||||
version: 3.7.1
|
||||
resolution: "@types/eslint-scope@npm:3.7.1"
|
||||
@ -7855,20 +7837,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"debounce-promise@npm:^3.1.2":
|
||||
version: 3.1.2
|
||||
resolution: "debounce-promise@npm:3.1.2"
|
||||
checksum: 29bac4524c423cc852319d7455363909ea3d933a3b9e3eb1149d963cffc34c475fe37219d0bafc61af566500b5d663cba579bbad7ee4023bef06f8394ed900ad
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"debounce@npm:^1.2.1":
|
||||
version: 1.2.1
|
||||
resolution: "debounce@npm:1.2.1"
|
||||
checksum: 682a89506d9e54fb109526f4da255c5546102fbb8e3ae75eef3b04effaf5d4853756aee97475cd4650641869794e44f410eeb20ace2b18ea592287ab2038519e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"debug@npm:2.6.9, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.8, debug@npm:^2.6.9":
|
||||
version: 2.6.9
|
||||
resolution: "debug@npm:2.6.9"
|
||||
@ -13694,14 +13662,12 @@ fsevents@~2.3.2:
|
||||
"@nuxt/design": 0.1.3
|
||||
"@nuxt/kit": 3.0.0
|
||||
"@types/clear": ^0
|
||||
"@types/debounce-promise": ^3
|
||||
"@types/mri": ^1.1.1
|
||||
chokidar: ^3.5.2
|
||||
clear: ^0.1.0
|
||||
clipboardy: ^2.3.0
|
||||
colorette: ^2.0.16
|
||||
consola: ^2.15.3
|
||||
debounce-promise: ^3.1.2
|
||||
deep-object-diff: ^1.1.0
|
||||
degit: ^2.8.4
|
||||
destr: ^1.1.0
|
||||
@ -13711,6 +13677,7 @@ fsevents@~2.3.2:
|
||||
listhen: ^0.2.4
|
||||
mlly: ^0.2.6
|
||||
mri: ^1.2.0
|
||||
p-debounce: ^4.0.0
|
||||
pathe: ^0.2.0
|
||||
scule: ^0.2.1
|
||||
superb: ^4.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user