From 07e1126508ba231b868b98c217a77e767a6b7d7d Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 5 Apr 2021 21:08:53 +0200 Subject: [PATCH] chore(nitro): fix types --- packages/nitro/package.json | 2 + packages/nitro/src/server/dev.ts | 4 +- packages/nitro/src/server/middleware.ts | 4 +- yarn.lock | 50 +++++++++++++++++-------- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/packages/nitro/package.json b/packages/nitro/package.json index 8a27bef2e3..fe96317a86 100644 --- a/packages/nitro/package.json +++ b/packages/nitro/package.json @@ -85,8 +85,10 @@ "vue-server-renderer": "^2.6.12" }, "devDependencies": { + "@types/chokidar": "^2.1.3", "@types/debounce": "^1.2.0", "@types/fs-extra": "^9.0.10", + "@types/globby": "^9.1.0", "@types/http-proxy": "^1.17.5", "@types/node-fetch": "^2.5.9", "@types/serve-static": "^1.13.9" diff --git a/packages/nitro/src/server/dev.ts b/packages/nitro/src/server/dev.ts index 053102f253..3f7a8aeb19 100644 --- a/packages/nitro/src/server/dev.ts +++ b/packages/nitro/src/server/dev.ts @@ -11,7 +11,6 @@ import servePlaceholder from 'serve-placeholder' import serveStatic from 'serve-static' import { resolve } from 'upath' import type { NitroContext } from '../context' -import type { ServerMiddleware } from './middleware' export function createDevServer (nitroContext: NitroContext) { // Worker @@ -119,6 +118,7 @@ export function createDevServer (nitroContext: NitroContext) { return { reload, listen: _listen, + app, close, watch, setLegacyMiddleware: legacyMiddleware.set, @@ -127,7 +127,7 @@ export function createDevServer (nitroContext: NitroContext) { } interface DynamicMiddleware { - set: (input: Middleware | ServerMiddleware[]) => void + set: (input: Middleware) => void middleware: Middleware } diff --git a/packages/nitro/src/server/middleware.ts b/packages/nitro/src/server/middleware.ts index 18adec1fc3..dcf70c93ec 100644 --- a/packages/nitro/src/server/middleware.ts +++ b/packages/nitro/src/server/middleware.ts @@ -12,11 +12,11 @@ export interface ServerMiddleware { */ path?: string - handle?: Middleware + handle?: Middleware | string /** * @deprecated use handle */ - handler?: Middleware + handler?: Middleware | string lazy?: boolean // Default is true promisify?: boolean // Default is true diff --git a/yarn.lock b/yarn.lock index 21724552c4..47ef121292 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1788,8 +1788,10 @@ __metadata: "@rollup/plugin-replace": ^2.4.2 "@rollup/plugin-virtual": ^2.0.3 "@rollup/pluginutils": ^4.1.0 + "@types/chokidar": ^2.1.3 "@types/debounce": ^1.2.0 "@types/fs-extra": ^9.0.10 + "@types/globby": ^9.1.0 "@types/http-proxy": ^1.17.5 "@types/node-fetch": ^2.5.9 "@types/serve-static": ^1.13.9 @@ -2274,6 +2276,15 @@ __metadata: languageName: node 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:*": version: 3.4.34 resolution: "@types/connect@npm:3.4.34" @@ -2343,6 +2354,15 @@ __metadata: languageName: node 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": version: 4.1.5 resolution: "@types/graceful-fs@npm:4.1.5" @@ -4302,7 +4322,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.5.1": +"chokidar@npm:*, chokidar@npm:^3.5.1": version: 3.5.1 resolution: "chokidar@npm:3.5.1" dependencies: @@ -7139,6 +7159,20 @@ __metadata: languageName: node 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": version: 11.0.2 resolution: "globby@npm:11.0.2" @@ -7153,20 +7187,6 @@ __metadata: languageName: node 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": version: 4.2.6 resolution: "graceful-fs@npm:4.2.6"