diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index ddd5a6209512dc..0820e08c439f40 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -237,6 +237,13 @@ Repository: git+https://github.com/ampproject/remapping.git --------------------------------------- +## @arr/every +License: MIT +By: Luke Edwards +Repository: lukeed/arr + +--------------------------------------- + ## @jridgewell/gen-mapping License: MIT By: Justin Ridgewell @@ -878,39 +885,6 @@ Repository: http://github.com/substack/node-commondir.git --------------------------------------- -## connect -License: MIT -By: TJ Holowaychuk, Douglas Christopher Wilson, Jonathan Ong, Tim Caswell -Repository: senchalabs/connect - -> (The MIT License) -> -> Copyright (c) 2010 Sencha Inc. -> Copyright (c) 2011 LearnBoost -> Copyright (c) 2011-2014 TJ Holowaychuk -> Copyright (c) 2015 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## convert-source-map License: MIT By: Thorsten Lorenz @@ -1134,65 +1108,6 @@ Repository: https://github.com/motdotla/dotenv-expand --------------------------------------- -## ee-first -License: MIT -By: Jonathan Ong, Douglas Christopher Wilson -Repository: jonathanong/ee-first - -> The MIT License (MIT) -> -> Copyright (c) 2014 Jonathan Ong me@jongleberry.com -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - ---------------------------------------- - -## encodeurl -License: MIT -By: Douglas Christopher Wilson -Repository: pillarjs/encodeurl - -> (The MIT License) -> -> Copyright (c) 2016 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## entities License: BSD-2-Clause By: Felix Boehm @@ -1414,36 +1329,6 @@ Repository: jonschlinkert/fill-range --------------------------------------- -## finalhandler -License: MIT -By: Douglas Christopher Wilson -Repository: pillarjs/finalhandler - -> (The MIT License) -> -> Copyright (c) 2014-2017 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## follow-redirects License: MIT By: Ruben Verborgh, Olivier Lalonde, James Talmage @@ -1994,6 +1879,35 @@ Repository: https://github.com/rich-harris/magic-string --------------------------------------- +## matchit +License: MIT +By: Luke Edwards +Repository: lukeed/matchit + +> The MIT License (MIT) +> +> Copyright (c) Luke Edwards (lukeed.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + ## merge2 License: MIT Repository: git@github.com:teambition/merge2.git @@ -2240,37 +2154,6 @@ Repository: sindresorhus/object-assign --------------------------------------- -## on-finished -License: MIT -By: Douglas Christopher Wilson, Jonathan Ong -Repository: jshttp/on-finished - -> (The MIT License) -> -> Copyright (c) 2013 Jonathan Ong -> Copyright (c) 2014 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## open License: MIT By: Sindre Sorhus @@ -2315,37 +2198,6 @@ Repository: git://github.com/inikulin/parse5.git --------------------------------------- -## parseurl -License: MIT -By: Douglas Christopher Wilson, Jonathan Ong -Repository: pillarjs/parseurl - -> (The MIT License) -> -> Copyright (c) 2014 Jonathan Ong -> Copyright (c) 2014-2017 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## path-key License: MIT By: Sindre Sorhus @@ -2521,6 +2373,13 @@ Repository: sindresorhus/pify --------------------------------------- +## polka +License: MIT +By: Luke Edwards +Repository: lukeed/polka + +--------------------------------------- + ## postcss-import License: MIT By: Maxime Thirouin @@ -3009,36 +2868,6 @@ Repository: lukeed/sirv --------------------------------------- -## statuses -License: MIT -By: Douglas Christopher Wilson, Jonathan Ong -Repository: jshttp/statuses - -> The MIT License (MIT) -> -> Copyright (c) 2014 Jonathan Ong -> Copyright (c) 2016 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - ---------------------------------------- - ## string-hash License: CC0-1.0 By: The Dark Sky Company @@ -3150,6 +2979,35 @@ Repository: lukeed/totalist --------------------------------------- +## trouter +License: MIT +By: Luke Edwards +Repository: lukeed/trouter + +> The MIT License (MIT) +> +> Copyright (c) Luke Edwards (lukeed.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + ## tsconfck License: MIT By: dominikg @@ -3232,36 +3090,6 @@ Repository: unjs/ufo --------------------------------------- -## unpipe -License: MIT -By: Douglas Christopher Wilson -Repository: stream-utils/unpipe - -> (The MIT License) -> -> Copyright (c) 2015 Douglas Christopher Wilson -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## util-deprecate License: MIT By: Nathan Rajlich @@ -3294,34 +3122,6 @@ Repository: git://github.com/TooTallNate/util-deprecate.git --------------------------------------- -## utils-merge -License: MIT -By: Jared Hanson -Repository: git://github.com/jaredhanson/utils-merge.git - -> The MIT License (MIT) -> -> Copyright (c) 2013-2017 Jared Hanson -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of -> this software and associated documentation files (the "Software"), to deal in -> the Software without restriction, including without limitation the rights to -> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -> the Software, and to permit persons to whom the Software is furnished to do so, -> subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## vary License: MIT By: Douglas Christopher Wilson diff --git a/packages/vite/package.json b/packages/vite/package.json index afa075a7a5451f..e095c137ba25fc 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -108,7 +108,7 @@ "artichokie": "^0.2.1", "cac": "^6.7.14", "chokidar": "^3.6.0", - "connect": "^3.7.0", + "polka": "^0.5.2", "convert-source-map": "^2.0.0", "cors": "^2.8.5", "cross-spawn": "^7.0.3", diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index 51a063ba800ccf..ee013f74490c2f 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -2,8 +2,8 @@ import fsp from 'node:fs/promises' import path from 'node:path' import type { OutgoingHttpHeaders as HttpServerHeaders } from 'node:http' import type { ServerOptions as HttpsServerOptions } from 'node:https' -import type { Connect } from 'dep-types/connect' import colors from 'picocolors' +import type { Polka } from 'dep-types/polka' import type { ProxyOptions } from './server/middlewares/proxy' import type { Logger } from './logger' import type { HttpServer } from './server' @@ -89,31 +89,26 @@ export type CorsOrigin = boolean | string | RegExp | (string | RegExp)[] export async function resolveHttpServer( { proxy }: CommonServerOptions, - app: Connect.Server, httpsOptions?: HttpsServerOptions, ): Promise { if (!httpsOptions) { const { createServer } = await import('node:http') - return createServer(app) + return createServer() } // #484 fallback to http1 when proxy is needed. if (proxy) { const { createServer } = await import('node:https') - return createServer(httpsOptions, app) + return createServer(httpsOptions) } else { const { createSecureServer } = await import('node:http2') - return createSecureServer( - { - // Manually increase the session memory to prevent 502 ENHANCE_YOUR_CALM - // errors on large numbers of requests - maxSessionMemory: 1000, - ...httpsOptions, - allowHTTP1: true, - }, - // @ts-expect-error TODO: is this correct? - app, - ) + return createSecureServer({ + // Manually increase the session memory to prevent 502 ENHANCE_YOUR_CALM + // errors on large numbers of requests + maxSessionMemory: 1000, + ...httpsOptions, + allowHTTP1: true, + }) } } @@ -140,6 +135,7 @@ async function readFileIfExists(value?: string | Buffer | any[]) { export async function httpServerStart( httpServer: HttpServer, + middlewares: Polka.Polka | undefined, serverOptions: { port: number strictPort: boolean | undefined @@ -167,6 +163,10 @@ export async function httpServerStart( httpServer.on('error', onError) + if (middlewares) { + httpServer.on('request', middlewares.handler) + } + httpServer.listen(port, host, () => { httpServer.removeListener('error', onError) resolve(port) diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index 3d17f8737379d6..442a2cce0860aa 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -168,7 +168,7 @@ export type { ResolverObject, Alias, } from 'dep-types/alias' -export type { Connect } from 'dep-types/connect' +export type { Polka } from 'dep-types/polka' export type { WebSocket, WebSocketAlias } from 'dep-types/ws' export type { HttpProxy } from 'dep-types/http-proxy' export type { diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index 38192abea7626d..2ca678f4356f63 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -2,8 +2,8 @@ import fs from 'node:fs' import path from 'node:path' import sirv from 'sirv' import compression from '@polka/compression' -import connect from 'connect' -import type { Connect } from 'dep-types/connect' +import polka from 'polka' +import type { Polka } from 'dep-types/polka' import corsMiddleware from 'cors' import { DEFAULT_PREVIEW_PORT } from './constants' import type { @@ -78,7 +78,7 @@ export interface PreviewServer { * * https://github.com/senchalabs/connect#use-middleware */ - middlewares: Connect.Server + middlewares: Polka.Polka /** * native Node http server instance */ @@ -132,12 +132,11 @@ export async function preview( ) } - const app = connect() as Connect.Server const httpServer = await resolveHttpServer( config.preview, - app, await resolveHttpsConfig(config.preview?.https), ) + const app = polka({ server: httpServer }) setClientErrorHandler(httpServer, config.logger) const options = config.preview @@ -242,7 +241,7 @@ export async function preview( const hostname = await resolveHostname(options.host) const port = options.port ?? DEFAULT_PREVIEW_PORT - await httpServerStart(httpServer, { + await httpServerStart(httpServer, app, { port, strictPort: options.strictPort, host: hostname.host, diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index b5e1d9c57e5f19..bc9555385ed2cc 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -6,12 +6,12 @@ import { get as httpsGet } from 'node:https' import type * as http from 'node:http' import { performance } from 'node:perf_hooks' import type { Http2SecureServer } from 'node:http2' -import connect from 'connect' +import polka from 'polka' import corsMiddleware from 'cors' import colors from 'picocolors' import chokidar from 'chokidar' import type { FSWatcher, WatchOptions } from 'dep-types/chokidar' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import launchEditorMiddleware from 'launch-editor-middleware' import type { SourceMap } from 'rollup' import picomatch from 'picomatch' @@ -236,7 +236,7 @@ export interface ViteDevServer { * * https://github.com/senchalabs/connect#use-middleware */ - middlewares: Connect.Server + middlewares: Polka.Polka /** * native Node http server instance * will be null in middleware mode @@ -460,10 +460,10 @@ export async function _createServer( emptyOutDir, ) - const middlewares = connect() as Connect.Server const httpServer = middlewareMode ? null - : await resolveHttpServer(serverConfig, middlewares, httpsOptions) + : await resolveHttpServer(serverConfig, httpsOptions) + const middlewares = polka({ server: httpServer }) as Polka.Polka const ws = createWebSocketServer(httpServer, config, httpsOptions) const hot = createHMRBroadcaster() @@ -920,7 +920,7 @@ export async function _createServer( } // error handler - middlewares.use(errorMiddleware(server, !!middlewareMode)) + middlewares.onError = errorMiddleware(server, !!middlewareMode) // httpServer.listen can be called multiple times // when port when using next port number @@ -978,6 +978,7 @@ async function startServer( } const options = server.config.server + const middlewares = server.middlewares const hostname = await resolveHostname(options.host) const configPort = inlinePort ?? options.port // When using non strict port for the dev server, the running port can be different from the config one. @@ -989,7 +990,7 @@ async function startServer( : configPort) ?? DEFAULT_DEV_PORT server._configServerPort = configPort - const serverPort = await httpServerStart(httpServer, { + const serverPort = await httpServerStart(httpServer, middlewares, { port, strictPort: options.strictPort, host: hostname.host, @@ -1151,7 +1152,7 @@ async function restartServer(server: ViteDevServer) { // Keep the same connect instance so app.use(vite.middlewares) works // after a restart in middlewareMode (.route is always '/') - middlewares.stack = newServer.middlewares.stack + middlewares.wares = newServer.middlewares.wares server.middlewares = middlewares // Rebind internal server variable so functions reference the user server diff --git a/packages/vite/src/node/server/middlewares/base.ts b/packages/vite/src/node/server/middlewares/base.ts index ed44b4c633a80b..18bd3de57c38e9 100644 --- a/packages/vite/src/node/server/middlewares/base.ts +++ b/packages/vite/src/node/server/middlewares/base.ts @@ -1,4 +1,4 @@ -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import { joinUrlSegments, stripBase } from '../../utils' import { cleanUrl, withTrailingSlash } from '../../../shared/utils' @@ -7,7 +7,7 @@ import { cleanUrl, withTrailingSlash } from '../../../shared/utils' export function baseMiddleware( rawBase: string, middlewareMode: boolean, -): Connect.NextHandleFunction { +): Polka.RequestHandler { // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` return function viteBaseMiddleware(req, res, next) { const url = req.url! diff --git a/packages/vite/src/node/server/middlewares/error.ts b/packages/vite/src/node/server/middlewares/error.ts index 9b99e1427524d1..3a74b2cfcb0443 100644 --- a/packages/vite/src/node/server/middlewares/error.ts +++ b/packages/vite/src/node/server/middlewares/error.ts @@ -1,7 +1,7 @@ import path from 'node:path' import colors from 'picocolors' import type { RollupError } from 'rollup' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import strip from 'strip-ansi' import type { ErrorPayload } from 'types/hmrPayload' import { pad } from '../../utils' @@ -62,7 +62,7 @@ export function logError(server: ViteDevServer, err: RollupError): void { export function errorMiddleware( server: ViteDevServer, allowNext = false, -): Connect.ErrorHandleFunction { +): Polka.ErrorHandler { // note the 4 args must be kept for connect to treat this as error middleware // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` return function viteErrorMiddleware(err: RollupError, _req, res, next) { @@ -104,5 +104,5 @@ export function errorMiddleware( `) } - } + } as Polka.ErrorHandler } diff --git a/packages/vite/src/node/server/middlewares/htmlFallback.ts b/packages/vite/src/node/server/middlewares/htmlFallback.ts index 0814b697f95d9a..423569c54bd145 100644 --- a/packages/vite/src/node/server/middlewares/htmlFallback.ts +++ b/packages/vite/src/node/server/middlewares/htmlFallback.ts @@ -1,5 +1,5 @@ import path from 'node:path' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import { createDebugger } from '../../utils' import type { FsUtils } from '../../fsUtils' import { commonFsUtils } from '../../fsUtils' @@ -11,7 +11,7 @@ export function htmlFallbackMiddleware( root: string, spaFallback: boolean, fsUtils: FsUtils = commonFsUtils, -): Connect.NextHandleFunction { +): Polka.RequestHandler { // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` return function viteHtmlFallbackMiddleware(req, res, next) { if ( diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index b5893dd072b972..f403e5cb29b212 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -2,7 +2,7 @@ import fsp from 'node:fs/promises' import path from 'node:path' import MagicString from 'magic-string' import type { SourceMapInput } from 'rollup' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import type { DefaultTreeAdapterMap, Token } from 'parse5' import type { IndexHtmlTransformHook } from '../../plugins/html' import { @@ -407,7 +407,7 @@ const devHtmlHook: IndexHtmlTransformHook = async ( export function indexHtmlMiddleware( root: string, server: ViteDevServer | PreviewServer, -): Connect.NextHandleFunction { +): Polka.RequestHandler { const isDev = isDevServer(server) const fsUtils = getFsUtils(server.config) diff --git a/packages/vite/src/node/server/middlewares/notFound.ts b/packages/vite/src/node/server/middlewares/notFound.ts index 4ecf6823dcaf89..d12590fb09ba3a 100644 --- a/packages/vite/src/node/server/middlewares/notFound.ts +++ b/packages/vite/src/node/server/middlewares/notFound.ts @@ -1,6 +1,6 @@ -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' -export function notFoundMiddleware(): Connect.NextHandleFunction { +export function notFoundMiddleware(): Polka.RequestHandler { // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` return function vite404Middleware(_, res) { res.statusCode = 404 diff --git a/packages/vite/src/node/server/middlewares/proxy.ts b/packages/vite/src/node/server/middlewares/proxy.ts index 17f6d7a235d583..c238ddbcc4ca92 100644 --- a/packages/vite/src/node/server/middlewares/proxy.ts +++ b/packages/vite/src/node/server/middlewares/proxy.ts @@ -1,7 +1,7 @@ import type * as http from 'node:http' import type * as net from 'node:net' import httpProxy from 'http-proxy' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import type { HttpProxy } from 'dep-types/http-proxy' import colors from 'picocolors' import { createDebugger } from '../../utils' @@ -71,7 +71,7 @@ export function proxyMiddleware( httpServer: HttpServer | null, options: NonNullable, config: ResolvedConfig, -): Connect.NextHandleFunction { +): Polka.RequestHandler { // lazy require only when proxy is used const proxies: Record = {} diff --git a/packages/vite/src/node/server/middlewares/static.ts b/packages/vite/src/node/server/middlewares/static.ts index d706b3fa926fee..458ca8855b83ad 100644 --- a/packages/vite/src/node/server/middlewares/static.ts +++ b/packages/vite/src/node/server/middlewares/static.ts @@ -2,7 +2,7 @@ import path from 'node:path' import type { OutgoingHttpHeaders, ServerResponse } from 'node:http' import type { Options } from 'sirv' import sirv from 'sirv' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import escapeHtml from 'escape-html' import type { ViteDevServer } from '../..' import { FS_PREFIX } from '../../constants' @@ -57,7 +57,7 @@ const sirvOptions = ({ export function servePublicMiddleware( server: ViteDevServer, publicFiles?: Set, -): Connect.NextHandleFunction { +): Polka.RequestHandler { const dir = server.config.publicDir const serve = sirv( dir, @@ -96,7 +96,7 @@ export function servePublicMiddleware( export function serveStaticMiddleware( server: ViteDevServer, -): Connect.NextHandleFunction { +): Polka.RequestHandler { const dir = server.config.root const serve = sirv( dir, @@ -165,7 +165,7 @@ export function serveStaticMiddleware( export function serveRawFsMiddleware( server: ViteDevServer, -): Connect.NextHandleFunction { +): Polka.RequestHandler { const serveFromRoot = sirv( '/', sirvOptions({ getHeaders: () => server.config.server.headers }), @@ -233,7 +233,7 @@ function ensureServingAccess( url: string, server: ViteDevServer, res: ServerResponse, - next: Connect.NextFunction, + next: Polka.Next, ): boolean { if (isFileServingAllowed(url, server)) { return true diff --git a/packages/vite/src/node/server/middlewares/time.ts b/packages/vite/src/node/server/middlewares/time.ts index 8d4b3e10c928a6..8ff274e293c129 100644 --- a/packages/vite/src/node/server/middlewares/time.ts +++ b/packages/vite/src/node/server/middlewares/time.ts @@ -1,10 +1,10 @@ import { performance } from 'node:perf_hooks' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import { createDebugger, prettifyUrl, timeFrom } from '../../utils' const logTime = createDebugger('vite:time') -export function timeMiddleware(root: string): Connect.NextHandleFunction { +export function timeMiddleware(root: string): Polka.RequestHandler { // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` return function viteTimeMiddleware(req, res, next) { const start = performance.now() diff --git a/packages/vite/src/node/server/middlewares/transform.ts b/packages/vite/src/node/server/middlewares/transform.ts index 12a440d4c10774..99d129601d3b40 100644 --- a/packages/vite/src/node/server/middlewares/transform.ts +++ b/packages/vite/src/node/server/middlewares/transform.ts @@ -1,6 +1,6 @@ import path from 'node:path' import fsp from 'node:fs/promises' -import type { Connect } from 'dep-types/connect' +import type { Polka } from 'dep-types/polka' import colors from 'picocolors' import type { ExistingRawSourceMap } from 'rollup' import type { ViteDevServer } from '..' @@ -45,7 +45,7 @@ const knownIgnoreList = new Set(['/', '/favicon.ico']) */ export function cachedTransformMiddleware( server: ViteDevServer, -): Connect.NextHandleFunction { +): Polka.RequestHandler { // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` return function viteCachedTransformMiddleware(req, res, next) { // check if we can return 304 early @@ -71,7 +71,7 @@ export function cachedTransformMiddleware( export function transformMiddleware( server: ViteDevServer, -): Connect.NextHandleFunction { +): Polka.RequestHandler { // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` // check if public dir is inside root dir diff --git a/packages/vite/src/types/connect.d.ts b/packages/vite/src/types/connect.d.ts deleted file mode 100644 index 9589d6a683119d..00000000000000 --- a/packages/vite/src/types/connect.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -// Inlined to avoid extra dependency -// MIT Licensed https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE - -// Type definitions for connect v3.4.0 -// Project: https://github.com/senchalabs/connect -// Definitions by: Maxime LUCE -// Evan Hahn -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -import * as http from 'node:http' - -export namespace Connect { - export type ServerHandle = HandleFunction | http.Server - - export class IncomingMessage extends http.IncomingMessage { - originalUrl?: http.IncomingMessage['url'] | undefined - } - - export type NextFunction = (err?: any) => void - - export type SimpleHandleFunction = ( - req: IncomingMessage, - res: http.ServerResponse, - ) => void - export type NextHandleFunction = ( - req: IncomingMessage, - res: http.ServerResponse, - next: NextFunction, - ) => void - export type ErrorHandleFunction = ( - err: any, - req: IncomingMessage, - res: http.ServerResponse, - next: NextFunction, - ) => void - export type HandleFunction = - | SimpleHandleFunction - | NextHandleFunction - | ErrorHandleFunction - - export interface ServerStackItem { - route: string - handle: ServerHandle - } - - export interface Server extends NodeJS.EventEmitter { - (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void - - route: string - stack: ServerStackItem[] - - /** - * Utilize the given middleware `handle` to the given `route`, - * defaulting to _/_. This "route" is the mount-point for the - * middleware, when given a value other than _/_ the middleware - * is only effective when that segment is present in the request's - * pathname. - * - * For example if we were to mount a function at _/admin_, it would - * be invoked on _/admin_, and _/admin/settings_, however it would - * not be invoked for _/_, or _/posts_. - */ - use(fn: NextHandleFunction): Server - use(fn: HandleFunction): Server - use(route: string, fn: NextHandleFunction): Server - use(route: string, fn: HandleFunction): Server - - /** - * Handle server requests, punting them down - * the middleware stack. - */ - handle( - req: http.IncomingMessage, - res: http.ServerResponse, - next: Function, - ): void - - /** - * Listen for connections. - * - * This method takes the same arguments - * as node's `http.Server#listen()`. - * - * HTTP and HTTPS: - * - * If you run your application both as HTTP - * and HTTPS you may wrap them individually, - * since your Connect "server" is really just - * a JavaScript `Function`. - * - * var connect = require('connect') - * , http = require('http') - * , https = require('https'); - * - * var app = connect(); - * - * http.createServer(app).listen(80); - * https.createServer(options, app).listen(443); - */ - listen( - port: number, - hostname?: string, - backlog?: number, - callback?: Function, - ): http.Server - listen(port: number, hostname?: string, callback?: Function): http.Server - listen(path: string, callback?: Function): http.Server - listen(handle: any, listeningListener?: Function): http.Server - } -} diff --git a/packages/vite/src/types/polka.d.ts b/packages/vite/src/types/polka.d.ts new file mode 100644 index 00000000000000..b6c12ab88e658e --- /dev/null +++ b/packages/vite/src/types/polka.d.ts @@ -0,0 +1,162 @@ +// Inlined to avoid extra dependency +/// + +import type { IncomingMessage, Server, ServerResponse } from 'node:http' +import type { Url } from 'node:url' +import type * as Trouter from './trouter' + +export declare namespace Polka { + export type ParamsDictionary = Record + + export type ErrorHandler = ( + err: unknown, + req: Request, + res: ServerResponse, + next: Next, + ) => void + export type RequestHandler = ( + req: Request, + res: ServerResponse, + next: Next, + ) => void + + /** + * Calls the next middleware function in the chain, or throws an error. + */ + type Next = (err?: string | Error) => void + + /** + * An `http.IncomingMessage`, extended by Polka + */ + interface Request extends IncomingMessage { + /** + * The originally-requested URL, including parent router segments. + */ + originalUrl: string + + /** + * The path portion of the requested URL. + */ + path: string + + /** + * The values of named parameters within your route pattern + */ + params: { + [key: string]: string + } + + /** + * The un-parsed querystring + */ + search: string | null + + /** + * The parsed querystring + */ + query: { + [key: string]: string | string[] + } + } + + /** + * An instance of the Polka router. + */ + interface Polka { + wares: RequestHandler[] + + onError: ErrorHandler + + /** + * Parses the `req.url` property of the given request. + */ + parse(req: Request): Url + + /** + * Attach middleware(s) and/or sub-application(s) to the server. + * These will execute before your routes' handlers. + */ + use(...handlers: RequestHandler[]): this + + /** + * Attach middleware(s) and/or sub-application(s) to the server. + * These will execute before your routes' handlers. + */ + use(pattern: string | RegExp, ...handlers: RequestHandler[] | Polka[]): this + + /** + * Boots (or creates) the underlying `http.Server` for the first time. + */ + listen(port?: number, hostname?: string): this + + /** + * Boots (or creates) the underlying `http.Server` for the first time. + * All arguments are passed to server.listen directly with no changes. + */ + listen(...args: unknown[]): this + + /** + * The main Polka `IncomingMessage` handler. + * It receives all requests and tries to match the incoming URL against known routes. + */ + handler(req: Request, res: ServerResponse, parsed?: Url): void + + /** + * The instantiated `server` Polka creates when `listen()` is called. + * `server` is only created if a server was not provided via `option.server` + * `server` will be undefined until polka.listen is invoked or if a server was provided. + */ + server?: Server | undefined + + find( + method: Trouter.HTTPMethod, + url: string, + ): Trouter.FindResult + + add( + method: Trouter.HTTPMethod, + pattern: string | RegExp, + ...handlers: RequestHandler[] + ): this + + all(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + get(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + head(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + patch(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + options(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + connect(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + delete(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + trace(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + post(pattern: string | RegExp, ...handlers: RequestHandler[]): this + + put(pattern: string | RegExp, ...handlers: RequestHandler[]): this + } + + /** + * Polka options + */ + interface Options { + /** + * The server instance to use when `polka.listen()` is called. + */ + server?: Server | undefined + + /** + * A catch-all error handler; executed whenever a middleware throws an error. + */ + onError?(err: Error, req: Request, res: ServerResponse, next: Next): void + + /** + * A handler when no route definitions were matched. + */ + onNoMatch?(req: Request, res: ServerResponse): void + } +} diff --git a/packages/vite/src/types/shims.d.ts b/packages/vite/src/types/shims.d.ts index 9f637b00e2b292..bab150b1e735e5 100644 --- a/packages/vite/src/types/shims.d.ts +++ b/packages/vite/src/types/shims.d.ts @@ -1,6 +1,6 @@ -declare module 'connect' { - const connect: () => any - export = connect +declare module 'polka' { + const polka: (opts: unknown) => any + export = polka } declare module 'cors' { diff --git a/packages/vite/src/types/trouter.d.ts b/packages/vite/src/types/trouter.d.ts new file mode 100644 index 00000000000000..7ee44266b33306 --- /dev/null +++ b/packages/vite/src/types/trouter.d.ts @@ -0,0 +1,68 @@ +export interface FindResult { + params: { [k: string]: string } + handlers: T[] +} + +export type HTTPMethod = + | 'ACL' + | 'BIND' + | 'CHECKOUT' + | 'CONNECT' + | 'COPY' + | 'DELETE' + | 'GET' + | 'HEAD' + | 'LINK' + | 'LOCK' + | 'M-SEARCH' + | 'MERGE' + | 'MKACTIVITY' + | 'MKCALENDAR' + | 'MKCOL' + | 'MOVE' + | 'NOTIFY' + | 'OPTIONS' + | 'PATCH' + | 'POST' + | 'PROPFIND' + | 'PROPPATCH' + | 'PURGE' + | 'PUT' + | 'REBIND' + | 'REPORT' + | 'SEARCH' + | 'SOURCE' + | 'SUBSCRIBE' + | 'TRACE' + | 'UNBIND' + | 'UNLINK' + | 'UNLOCK' + | 'UNSUBSCRIBE' + +export class Trouter { + use(pattern: string | RegExp, ...handlers: T[]): this + + find(method: HTTPMethod, url: string): FindResult + + add(method: HTTPMethod, pattern: string | RegExp, ...handlers: T[]): this + + all(pattern: string | RegExp, ...handlers: T[]): this + + get(pattern: string | RegExp, ...handlers: T[]): this + + head(pattern: string | RegExp, ...handlers: T[]): this + + patch(pattern: string | RegExp, ...handlers: T[]): this + + options(pattern: string | RegExp, ...handlers: T[]): this + + connect(pattern: string | RegExp, ...handlers: T[]): this + + delete(pattern: string | RegExp, ...handlers: T[]): this + + trace(pattern: string | RegExp, ...handlers: T[]): this + + post(pattern: string | RegExp, ...handlers: T[]): this + + put(pattern: string | RegExp, ...handlers: T[]): this +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8bef347be89f78..9585cc131c966a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -280,9 +280,6 @@ importers: chokidar: specifier: ^3.6.0 version: 3.6.0(patch_hash=bckcfsslxcffppz65mxcq6naau) - connect: - specifier: ^3.7.0 - version: 3.7.0 convert-source-map: specifier: ^2.0.0 version: 2.0.0 @@ -358,6 +355,9 @@ importers: picomatch: specifier: ^2.3.1 version: 2.3.1 + polka: + specifier: ^0.5.2 + version: 0.5.2 postcss-import: specifier: ^16.1.0 version: 16.1.0(postcss@8.4.39) @@ -1633,6 +1633,10 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} + '@arr/every@1.0.1': + resolution: {integrity: sha512-UQFQ6SgyJ6LX42W8rHCs8KVc0JS0tzVL9ct4XYedJukskYVWTo49tNiMEK9C2HTyarbNiT/RVIRSY82vH+6sTg==} + engines: {node: '>=4'} + '@babel/code-frame@7.24.7': resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} engines: {node: '>=6.9.0'} @@ -2793,6 +2797,9 @@ packages: resolution: {integrity: sha512-UlVkoSGRig87riHSn8QOxd2DzGhadRpNSj5Ukqj+Bt7WTE4Es+sE3ju3OYbe8SiV2OwA+8tDcSuHWUh5S3jCBQ==} engines: {node: '>=6'} + '@polka/url@0.5.0': + resolution: {integrity: sha512-oZLYFEAzUKyi3SKnXvj32ZCEGH6RDnao7COuCVhDydMS9NrCSVXhM79VaKyP5+Zc33m0QXEd2DN3UkU7OsHcfw==} + '@polka/url@1.0.0-next.24': resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==} @@ -3943,10 +3950,6 @@ packages: confbox@0.1.7: resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} - connect@3.7.0: - resolution: {integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==} - engines: {node: '>= 0.10.0'} - consola@3.2.3: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} engines: {node: ^14.18.0 || >=16.10.0} @@ -4447,10 +4450,6 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - finalhandler@1.1.2: - resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} - engines: {node: '>= 0.8'} - finalhandler@1.2.0: resolution: {integrity: sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==} engines: {node: '>= 0.8'} @@ -5091,6 +5090,10 @@ packages: markdown-table@3.0.3: resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==} + matchit@1.1.0: + resolution: {integrity: sha512-+nGYoOlfHmxe5BW5tE0EMJppXEwdSf8uBA1GTZC7Q77kbT35+VKLYJMzVNWCHSsga1ps1tPYFtFyvxvKzWVmMA==} + engines: {node: '>=6'} + mdast-util-find-and-replace@3.0.1: resolution: {integrity: sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==} @@ -5438,10 +5441,6 @@ packages: object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} - on-finished@2.3.0: - resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} - engines: {node: '>= 0.8'} - on-finished@2.4.1: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} engines: {node: '>= 0.8'} @@ -5589,6 +5588,9 @@ packages: engines: {node: '>=18'} hasBin: true + polka@0.5.2: + resolution: {integrity: sha512-FVg3vDmCqP80tOrs+OeNlgXYmFppTXdjD5E7I4ET1NjvtNmQrb1/mJibybKkb/d4NA7YWAr1ojxuhpL3FHqdlw==} + postcss-import@15.1.0: resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} engines: {node: '>=14.0.0'} @@ -6083,10 +6085,6 @@ packages: stacktracey@2.1.8: resolution: {integrity: sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==} - statuses@1.5.0: - resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} - engines: {node: '>= 0.6'} - statuses@2.0.1: resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} engines: {node: '>= 0.8'} @@ -6263,6 +6261,10 @@ packages: trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + trouter@2.0.1: + resolution: {integrity: sha512-kr8SKKw94OI+xTGOkfsvwZQ8mWoikZDd2n8XZHjJVZUARZT+4/VV6cacRS6CLsH9bNm+HFIPU1Zx4CnNnb4qlQ==} + engines: {node: '>=6'} + ts-api-utils@1.3.0: resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} engines: {node: '>=16'} @@ -6747,6 +6749,8 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 + '@arr/every@1.0.1': {} + '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 @@ -7892,6 +7896,8 @@ snapshots: '@polka/compression@1.0.0-next.25': {} + '@polka/url@0.5.0': {} + '@polka/url@1.0.0-next.24': {} '@rollup/plugin-alias@5.1.0(rollup@3.29.4)': @@ -9115,15 +9121,6 @@ snapshots: confbox@0.1.7: {} - connect@3.7.0: - dependencies: - debug: 2.6.9 - finalhandler: 1.1.2 - parseurl: 1.3.3 - utils-merge: 1.0.1 - transitivePeerDependencies: - - supports-color - consola@3.2.3: {} console-control-strings@1.1.0: {} @@ -9741,18 +9738,6 @@ snapshots: dependencies: to-regex-range: 5.0.1 - finalhandler@1.1.2: - dependencies: - debug: 2.6.9 - encodeurl: 1.0.2 - escape-html: 1.0.3 - on-finished: 2.3.0 - parseurl: 1.3.3 - statuses: 1.5.0 - unpipe: 1.0.0 - transitivePeerDependencies: - - supports-color - finalhandler@1.2.0: dependencies: debug: 2.6.9 @@ -10375,6 +10360,10 @@ snapshots: markdown-table@3.0.3: {} + matchit@1.1.0: + dependencies: + '@arr/every': 1.0.1 + mdast-util-find-and-replace@3.0.1: dependencies: '@types/mdast': 4.0.3 @@ -10838,10 +10827,6 @@ snapshots: object-inspect@1.12.3: {} - on-finished@2.3.0: - dependencies: - ee-first: 1.1.1 - on-finished@2.4.1: dependencies: ee-first: 1.1.1 @@ -10965,6 +10950,11 @@ snapshots: playwright-core@1.45.3: {} + polka@0.5.2: + dependencies: + '@polka/url': 0.5.0 + trouter: 2.0.1 + postcss-import@15.1.0(postcss@8.4.39): dependencies: postcss: 8.4.39 @@ -11536,8 +11526,6 @@ snapshots: as-table: 1.0.55 get-source: 2.0.12 - statuses@1.5.0: {} - statuses@2.0.1: {} std-env@3.7.0: {} @@ -11719,6 +11707,10 @@ snapshots: trim-lines@3.0.1: {} + trouter@2.0.1: + dependencies: + matchit: 1.1.0 + ts-api-utils@1.3.0(typescript@5.5.3): dependencies: typescript: 5.5.3