[cli][node] Re-apply @TooTallNate's vc dev updates (#4254)

This reverts commit 099bc6dbf6 (#4231).
This commit is contained in:
Nathan Rajlich
2020-05-12 13:58:05 -07:00
committed by GitHub
parent 69b62b8101
commit 97eeddb6ac
31 changed files with 828 additions and 825 deletions

View File

@@ -1,5 +1,10 @@
import { basename, extname, join } from 'path';
import { BuilderParams, BuildResult, ShouldServeParams } from './types';
import {
FileFsRef,
BuildOptions,
ShouldServeOptions,
} from '@vercel/build-utils';
import { BuildResult } from './types';
export const version = 2;
@@ -7,7 +12,7 @@ export function build({
files,
entrypoint,
config,
}: BuilderParams): BuildResult {
}: BuildOptions): BuildResult {
let path = entrypoint;
const outputDir = config.zeroConfig ? config.outputDirectory : '';
const outputMatch = outputDir + '/';
@@ -16,7 +21,7 @@ export function build({
path = path.slice(outputMatch.length);
}
const output = {
[path]: files[entrypoint],
[path]: files[entrypoint] as FileFsRef,
};
const watch = [path];
@@ -28,7 +33,7 @@ export function shouldServe({
files,
requestPath,
config = {},
}: ShouldServeParams) {
}: ShouldServeOptions) {
let outputPrefix = '';
const outputDir = config.zeroConfig ? config.outputDirectory : '';
const outputMatch = outputDir + '/';