Home / File/ connect.d.ts — vite Source File

connect.d.ts — vite Source File

Architecture documentation for connect.d.ts, a typescript file in the vite codebase. 1 imports, 0 dependents.

File typescript HMRClient HotRuntime 1 imports 2 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  01fc3a27_ea00_ccfb_3951_3ab12f017e8d["connect.d.ts"]
  946bdba3_227b_3fc0_1b4c_ddbdb281f454["node:http"]
  01fc3a27_ea00_ccfb_3951_3ab12f017e8d --> 946bdba3_227b_3fc0_1b4c_ddbdb281f454
  style 01fc3a27_ea00_ccfb_3951_3ab12f017e8d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// 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 <https://github.com/SomaticIT>
//                 Evan Hahn <https://github.com/EvanHahn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />
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
  }
}

Domain

Subdomains

Functions

Classes

Dependencies

  • node:http

Frequently Asked Questions

What does connect.d.ts do?
connect.d.ts is a source file in the vite codebase, written in typescript. It belongs to the HMRClient domain, HotRuntime subdomain.
What functions are defined in connect.d.ts?
connect.d.ts defines 2 function(s): err, req.
What does connect.d.ts depend on?
connect.d.ts imports 1 module(s): node:http.
Where is connect.d.ts in the architecture?
connect.d.ts is located at packages/vite/src/types/connect.d.ts (domain: HMRClient, subdomain: HotRuntime, directory: packages/vite/src/types).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free