chore(nitro): fix types

This commit is contained in:
Pooya Parsa 2021-04-05 21:08:53 +02:00
parent 2db79adfb8
commit 07e1126508
4 changed files with 41 additions and 19 deletions

View File

@ -85,8 +85,10 @@
"vue-server-renderer": "^2.6.12" "vue-server-renderer": "^2.6.12"
}, },
"devDependencies": { "devDependencies": {
"@types/chokidar": "^2.1.3",
"@types/debounce": "^1.2.0", "@types/debounce": "^1.2.0",
"@types/fs-extra": "^9.0.10", "@types/fs-extra": "^9.0.10",
"@types/globby": "^9.1.0",
"@types/http-proxy": "^1.17.5", "@types/http-proxy": "^1.17.5",
"@types/node-fetch": "^2.5.9", "@types/node-fetch": "^2.5.9",
"@types/serve-static": "^1.13.9" "@types/serve-static": "^1.13.9"

View File

@ -11,7 +11,6 @@ import servePlaceholder from 'serve-placeholder'
import serveStatic from 'serve-static' import serveStatic from 'serve-static'
import { resolve } from 'upath' import { resolve } from 'upath'
import type { NitroContext } from '../context' import type { NitroContext } from '../context'
import type { ServerMiddleware } from './middleware'
export function createDevServer (nitroContext: NitroContext) { export function createDevServer (nitroContext: NitroContext) {
// Worker // Worker
@ -119,6 +118,7 @@ export function createDevServer (nitroContext: NitroContext) {
return { return {
reload, reload,
listen: _listen, listen: _listen,
app,
close, close,
watch, watch,
setLegacyMiddleware: legacyMiddleware.set, setLegacyMiddleware: legacyMiddleware.set,
@ -127,7 +127,7 @@ export function createDevServer (nitroContext: NitroContext) {
} }
interface DynamicMiddleware { interface DynamicMiddleware {
set: (input: Middleware | ServerMiddleware[]) => void set: (input: Middleware) => void
middleware: Middleware middleware: Middleware
} }

View File

@ -12,11 +12,11 @@ export interface ServerMiddleware {
*/ */
path?: string path?: string
handle?: Middleware handle?: Middleware | string
/** /**
* @deprecated use handle * @deprecated use handle
*/ */
handler?: Middleware handler?: Middleware | string
lazy?: boolean // Default is true lazy?: boolean // Default is true
promisify?: boolean // Default is true promisify?: boolean // Default is true

View File

@ -1788,8 +1788,10 @@ __metadata:
"@rollup/plugin-replace": ^2.4.2 "@rollup/plugin-replace": ^2.4.2
"@rollup/plugin-virtual": ^2.0.3 "@rollup/plugin-virtual": ^2.0.3
"@rollup/pluginutils": ^4.1.0 "@rollup/pluginutils": ^4.1.0
"@types/chokidar": ^2.1.3
"@types/debounce": ^1.2.0 "@types/debounce": ^1.2.0
"@types/fs-extra": ^9.0.10 "@types/fs-extra": ^9.0.10
"@types/globby": ^9.1.0
"@types/http-proxy": ^1.17.5 "@types/http-proxy": ^1.17.5
"@types/node-fetch": ^2.5.9 "@types/node-fetch": ^2.5.9
"@types/serve-static": ^1.13.9 "@types/serve-static": ^1.13.9
@ -2274,6 +2276,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/chokidar@npm:^2.1.3":
version: 2.1.3
resolution: "@types/chokidar@npm:2.1.3"
dependencies:
chokidar: "*"
checksum: efefdf7b57586234d4a1583ebd725a2ad4ec9d8be3b4c29ad581e2dccbfee08922dbbc9516aca55d6242390ff9b174f3e0333253094693317132a96a3cb2e2b6
languageName: node
linkType: hard
"@types/connect@npm:*": "@types/connect@npm:*":
version: 3.4.34 version: 3.4.34
resolution: "@types/connect@npm:3.4.34" resolution: "@types/connect@npm:3.4.34"
@ -2343,6 +2354,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/globby@npm:^9.1.0":
version: 9.1.0
resolution: "@types/globby@npm:9.1.0"
dependencies:
globby: "*"
checksum: 9dd2abb72f7fe61a84e322f7d5a25640862ccd776a38f770b58e4a07040d9d8123ddfd2f28672bda6d137b66ec26ac41d9ec739bf41cc85a3e662218609cd363
languageName: node
linkType: hard
"@types/graceful-fs@npm:^4.1.2": "@types/graceful-fs@npm:^4.1.2":
version: 4.1.5 version: 4.1.5
resolution: "@types/graceful-fs@npm:4.1.5" resolution: "@types/graceful-fs@npm:4.1.5"
@ -4302,7 +4322,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"chokidar@npm:^3.5.1": "chokidar@npm:*, chokidar@npm:^3.5.1":
version: 3.5.1 version: 3.5.1
resolution: "chokidar@npm:3.5.1" resolution: "chokidar@npm:3.5.1"
dependencies: dependencies:
@ -7139,6 +7159,20 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"globby@npm:*, globby@npm:^11.0.3":
version: 11.0.3
resolution: "globby@npm:11.0.3"
dependencies:
array-union: ^2.1.0
dir-glob: ^3.0.1
fast-glob: ^3.1.1
ignore: ^5.1.4
merge2: ^1.3.0
slash: ^3.0.0
checksum: f17da0f869918656ec8c16c15ad100f025fbd13e4c157286cf340811eb1355a7d06dde77be1685a7a051970ec6abeff96a9b2a1a97525f84bc94fbd518c1d1db
languageName: node
linkType: hard
"globby@npm:^11.0.1, globby@npm:^11.0.2": "globby@npm:^11.0.1, globby@npm:^11.0.2":
version: 11.0.2 version: 11.0.2
resolution: "globby@npm:11.0.2" resolution: "globby@npm:11.0.2"
@ -7153,20 +7187,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"globby@npm:^11.0.3":
version: 11.0.3
resolution: "globby@npm:11.0.3"
dependencies:
array-union: ^2.1.0
dir-glob: ^3.0.1
fast-glob: ^3.1.1
ignore: ^5.1.4
merge2: ^1.3.0
slash: ^3.0.0
checksum: f17da0f869918656ec8c16c15ad100f025fbd13e4c157286cf340811eb1355a7d06dde77be1685a7a051970ec6abeff96a9b2a1a97525f84bc94fbd518c1d1db
languageName: node
linkType: hard
"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6": "graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6":
version: 4.2.6 version: 4.2.6
resolution: "graceful-fs@npm:4.2.6" resolution: "graceful-fs@npm:4.2.6"