1 | /// <reference types="node" />
|
2 | import FileRef from './file-ref';
|
3 | import FileFsRef from './file-fs-ref';
|
4 | export interface Env {
|
5 | [name: string]: string | undefined;
|
6 | }
|
7 | export interface File {
|
8 | type: string;
|
9 | mode: number;
|
10 | contentType?: string;
|
11 | toStream: () => NodeJS.ReadableStream;
|
12 | /**
|
13 | * The absolute path to the file in the filesystem
|
14 | */
|
15 | fsPath?: string;
|
16 | }
|
17 | export interface Files {
|
18 | [filePath: string]: File;
|
19 | }
|
20 | export interface Config {
|
21 | [key: string]: string | string[] | boolean | number | {
|
22 | [key: string]: string;
|
23 | } | BuilderFunctions | undefined;
|
24 | maxLambdaSize?: string;
|
25 | includeFiles?: string | string[];
|
26 | excludeFiles?: string | string[];
|
27 | bundle?: boolean;
|
28 | ldsflags?: string;
|
29 | helpers?: boolean;
|
30 | rust?: string;
|
31 | debug?: boolean;
|
32 | zeroConfig?: boolean;
|
33 | import?: {
|
34 | [key: string]: string;
|
35 | };
|
36 | functions?: BuilderFunctions;
|
37 | outputDirectory?: string;
|
38 | installCommand?: string;
|
39 | buildCommand?: string;
|
40 | devCommand?: string;
|
41 | framework?: string;
|
42 | nodeVersion?: string;
|
43 | }
|
44 | export interface Meta {
|
45 | isDev?: boolean;
|
46 | devCacheDir?: string;
|
47 | skipDownload?: boolean;
|
48 | requestPath?: string | null;
|
49 | filesChanged?: string[];
|
50 | filesRemoved?: string[];
|
51 | env?: Env;
|
52 | buildEnv?: Env;
|
53 | }
|
54 | export interface AnalyzeOptions {
|
55 | /**
|
56 | * All source files of the project
|
57 | */
|
58 | files: {
|
59 | [filePath: string]: FileRef;
|
60 | };
|
61 | /**
|
62 | * Name of entrypoint file for this particular build job. Value
|
63 | * `files[entrypoint]` is guaranteed to exist and be a valid File reference.
|
64 | * `entrypoint` is always a discrete file and never a glob, since globs are
|
65 | * expanded into separate builds at deployment time.
|
66 | */
|
67 | entrypoint: string;
|
68 | /**
|
69 | * A writable temporary directory where you are encouraged to perform your
|
70 | * build process. This directory will be populated with the restored cache.
|
71 | */
|
72 | workPath: string;
|
73 | /**
|
74 | * An arbitrary object passed by the user in the build definition defined
|
75 | * in `vercel.json`.
|
76 | */
|
77 | config: Config;
|
78 | }
|
79 | export interface BuildOptions {
|
80 | /**
|
81 | * All source files of the project
|
82 | */
|
83 | files: Files;
|
84 | /**
|
85 | * Name of entrypoint file for this particular build job. Value
|
86 | * `files[entrypoint]` is guaranteed to exist and be a valid File reference.
|
87 | * `entrypoint` is always a discrete file and never a glob, since globs are
|
88 | * expanded into separate builds at deployment time.
|
89 | */
|
90 | entrypoint: string;
|
91 | /**
|
92 | * A writable temporary directory where you are encouraged to perform your
|
93 | * build process. This directory will be populated with the restored cache.
|
94 | */
|
95 | workPath: string;
|
96 | /**
|
97 | * The "Root Directory" is assigned to the `workPath` so the `repoRootPath`
|
98 | * is the Git Repository Root. This is only relevant for Monorepos.
|
99 | * See https://vercel.com/blog/monorepos
|
100 | */
|
101 | repoRootPath?: string;
|
102 | /**
|
103 | * An arbitrary object passed by the user in the build definition defined
|
104 | * in `vercel.json`.
|
105 | */
|
106 | config: Config;
|
107 | /**
|
108 | * Metadata related to the invoker of the builder, used by `vercel dev`.
|
109 | * Builders may use the properties on this object to change behavior based
|
110 | * on the build environment.
|
111 | */
|
112 | meta?: Meta;
|
113 | }
|
114 | export interface PrepareCacheOptions {
|
115 | /**
|
116 | * All source files of the project
|
117 | */
|
118 | files: Files;
|
119 | /**
|
120 | * Name of entrypoint file for this particular build job. Value
|
121 | * `files[entrypoint]` is guaranteed to exist and be a valid File reference.
|
122 | * `entrypoint` is always a discrete file and never a glob, since globs are
|
123 | * expanded into separate builds at deployment time.
|
124 | */
|
125 | entrypoint: string;
|
126 | /**
|
127 | * A writable temporary directory where you are encouraged to perform your
|
128 | * build process.
|
129 | */
|
130 | workPath: string;
|
131 | /**
|
132 | * A writable temporary directory where you can build a cache to use for
|
133 | * the next run.
|
134 | */
|
135 | cachePath: string;
|
136 | /**
|
137 | * An arbitrary object passed by the user in the build definition defined
|
138 | * in `vercel.json`.
|
139 | */
|
140 | config: Config;
|
141 | }
|
142 | export interface ShouldServeOptions {
|
143 | /**
|
144 | * A path string from a request.
|
145 | */
|
146 | requestPath: string;
|
147 | /**
|
148 | * Name of entrypoint file for this particular build job. Value
|
149 | * `files[entrypoint]` is guaranteed to exist and be a valid File reference.
|
150 | * `entrypoint` is always a discrete file and never a glob, since globs are
|
151 | * expanded into separate builds at deployment time.
|
152 | */
|
153 | entrypoint: string;
|
154 | /**
|
155 | * All source files of the project
|
156 | */
|
157 | files: {
|
158 | [path: string]: FileFsRef;
|
159 | };
|
160 | /**
|
161 | * A writable temporary directory where you are encouraged to perform your
|
162 | * build process. This directory will be populated with the restored cache.
|
163 | */
|
164 | workPath: string;
|
165 | /**
|
166 | * An arbitrary object passed by the user in the build definition defined
|
167 | * in `vercel.json`.
|
168 | */
|
169 | config: Config;
|
170 | }
|
171 | /**
|
172 | * `startDevServer()` is given the same parameters as `build()`.
|
173 | */
|
174 | export declare type StartDevServerOptions = BuildOptions;
|
175 | export interface StartDevServerSuccess {
|
176 | /**
|
177 | * Port number where the dev server can be connected to, assumed to be running
|
178 | * on `localhost`.
|
179 | */
|
180 | port: number;
|
181 | /**
|
182 | * Process ID number of the dev server. Useful for the `vercel dev` server to
|
183 | * shut down the dev server once an HTTP request has been fulfilled.
|
184 | */
|
185 | pid: number;
|
186 | }
|
187 | /**
|
188 | * `startDevServer()` may return `null` to opt-out of spawning a dev server for
|
189 | * a given `entrypoint`.
|
190 | */
|
191 | export declare type StartDevServerResult = StartDevServerSuccess | null;
|
192 | /**
|
193 | * Credit to Iain Reid, MIT license.
|
194 | * Source: https://gist.github.com/iainreid820/5c1cc527fe6b5b7dba41fec7fe54bf6e
|
195 | */
|
196 | export declare namespace PackageJson {
|
197 | /**
|
198 | * An author or contributor
|
199 | */
|
200 | interface Author {
|
201 | name: string;
|
202 | email?: string;
|
203 | homepage?: string;
|
204 | }
|
205 | /**
|
206 | * A map of exposed bin commands
|
207 | */
|
208 | interface BinMap {
|
209 | [commandName: string]: string;
|
210 | }
|
211 | /**
|
212 | * A bugs link
|
213 | */
|
214 | interface Bugs {
|
215 | email: string;
|
216 | url: string;
|
217 | }
|
218 | interface Config {
|
219 | name?: string;
|
220 | config?: unknown;
|
221 | }
|
222 | /**
|
223 | * A map of dependencies
|
224 | */
|
225 | interface DependencyMap {
|
226 | [dependencyName: string]: string;
|
227 | }
|
228 | /**
|
229 | * CommonJS package structure
|
230 | */
|
231 | interface Directories {
|
232 | lib?: string;
|
233 | bin?: string;
|
234 | man?: string;
|
235 | doc?: string;
|
236 | example?: string;
|
237 | }
|
238 | interface Engines {
|
239 | node?: string;
|
240 | npm?: string;
|
241 | }
|
242 | interface PublishConfig {
|
243 | registry?: string;
|
244 | }
|
245 | /**
|
246 | * A project repository
|
247 | */
|
248 | interface Repository {
|
249 | type: string;
|
250 | url: string;
|
251 | }
|
252 | interface ScriptsMap {
|
253 | [scriptName: string]: string;
|
254 | }
|
255 | }
|
256 | export interface PackageJson {
|
257 | readonly name?: string;
|
258 | readonly version?: string;
|
259 | readonly description?: string;
|
260 | readonly keywords?: string[];
|
261 | readonly homepage?: string;
|
262 | readonly bugs?: string | PackageJson.Bugs;
|
263 | readonly license?: string;
|
264 | readonly author?: string | PackageJson.Author;
|
265 | readonly contributors?: string[] | PackageJson.Author[];
|
266 | readonly files?: string[];
|
267 | readonly main?: string;
|
268 | readonly bin?: string | PackageJson.BinMap;
|
269 | readonly man?: string | string[];
|
270 | readonly directories?: PackageJson.Directories;
|
271 | readonly repository?: string | PackageJson.Repository;
|
272 | readonly scripts?: PackageJson.ScriptsMap;
|
273 | readonly config?: PackageJson.Config;
|
274 | readonly dependencies?: PackageJson.DependencyMap;
|
275 | readonly devDependencies?: PackageJson.DependencyMap;
|
276 | readonly peerDependencies?: PackageJson.DependencyMap;
|
277 | readonly optionalDependencies?: PackageJson.DependencyMap;
|
278 | readonly bundledDependencies?: string[];
|
279 | readonly engines?: PackageJson.Engines;
|
280 | readonly os?: string[];
|
281 | readonly cpu?: string[];
|
282 | readonly preferGlobal?: boolean;
|
283 | readonly private?: boolean;
|
284 | readonly publishConfig?: PackageJson.PublishConfig;
|
285 | }
|
286 | export interface NodeVersion {
|
287 | major: number;
|
288 | range: string;
|
289 | runtime: string;
|
290 | discontinueDate?: Date;
|
291 | }
|
292 | export interface Builder {
|
293 | use: string;
|
294 | src?: string;
|
295 | config?: Config;
|
296 | }
|
297 | export interface BuilderFunctions {
|
298 | [key: string]: {
|
299 | memory?: number;
|
300 | maxDuration?: number;
|
301 | runtime?: string;
|
302 | includeFiles?: string;
|
303 | excludeFiles?: string;
|
304 | };
|
305 | }
|