mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +00:00
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.
5 lines
116 B
TypeScript
5 lines
116 B
TypeScript
import _treeKill from 'tree-kill';
|
|
import { promisify } from 'util';
|
|
|
|
export const treeKill = promisify(_treeKill);
|