Files
vercel/packages/now-cli/src/util/tree-kill.ts
Nathan Rajlich 6fd1b50924 [now dev] Add support for proxying to builder-specific dev servers (#4089)
This is an extension to the Runtime API, where a runtime can optionally define a `startDevServer()` function which is responsible for spawning a single-serve dev server for an individual HTTP request (the dev server is booted up upon receiving an HTTP request, and gets shut down by `now dev` after the HTTP request is completed). For runtimes that define this function, the `build()` function will never be executed, which avoids a lot of unnecessary processing for a dev environment.

Some things this accomplishes:

 * Retains the proper stack trace for errors.
 * Ensures that if a source code file is changed, and then an HTTP request is sent, it's guaranteed to be using the latest code (no file watching, or re-compilations).
 * Avoids creating a Lambda zip file (just to immediately unpack it for dev).
 * Avoids `@zeit/fun` completely, which loses some "correctness" (i.e. function is not frozen in between requests).
 * Backwards compatible with older Now CLIs - versions that don't know about `startDevServer()` will just invoke `build()`, and there's no version change required in the Runtime.
2020-04-17 20:55:44 +00:00

5 lines
116 B
TypeScript

import _treeKill from 'tree-kill';
import { promisify } from 'util';
export const treeKill = promisify(_treeKill);