MCPcopy Create free account
hub / github.com/vercel/vercel / updateBuildMatches

Method updateBuildMatches

packages/cli/src/util/dev/server.ts:486–566  ·  view source on GitHub ↗
(
    vercelConfig: VercelConfig,
    isInitial = false
  )

Source from the content-addressed store, hash-verified

484 }
485
486 async updateBuildMatches(
487 vercelConfig: VercelConfig,
488 isInitial = false
489 ): Promise<void> {
490 const fileList = this.resolveBuildFiles(this.files);
491 const matches = await getBuildMatches(
492 vercelConfig,
493 this.cwd,
494 this,
495 fileList
496 );
497 const sources = matches.map(m => m.src);
498
499 if (isInitial && fileList.length === 0) {
500 output.warn('There are no files inside your deployment.');
501 }
502
503 // Delete build matches that no longer exists
504 const ops: Promise<void>[] = [];
505 for (const src of this.buildMatches.keys()) {
506 if (!sources.includes(src)) {
507 output.debug(`Removing build match for "${src}"`);
508 const match = this.buildMatches.get(src);
509 if (match) {
510 ops.push(shutdownBuilder(match));
511 }
512 this.buildMatches.delete(src);
513 }
514 }
515 await Promise.all(ops);
516
517 // Add the new matches to the `buildMatches` map
518 const blockingBuilds: Promise<void>[] = [];
519 for (const match of matches) {
520 const currentMatch = this.buildMatches.get(match.src);
521 if (!buildMatchEquals(currentMatch, match)) {
522 output.debug(
523 `Adding build match for "${match.src}" with "${match.use}"`
524 );
525 this.buildMatches.set(match.src, match);
526 if (!isInitial && needsBlockingBuild(match)) {
527 const buildPromise = executeBuild(
528 vercelConfig,
529 this,
530 this.files,
531 match,
532 null,
533 false
534 );
535 blockingBuilds.push(buildPromise);
536 }
537 }
538 }
539
540 if (blockingBuilds.length > 0) {
541 output.debug(`Waiting for ${blockingBuilds.length} "blocking builds"`);
542 this.blockingBuildsPromise = Promise.all(blockingBuilds)
543 .then(() => {

Callers 3

_startMethod · 0.95
DevServerClass · 0.95

Calls 14

resolveBuildFilesMethod · 0.95
getBuildMatchesFunction · 0.90
shutdownBuilderFunction · 0.90
executeBuildFunction · 0.90
buildMatchEqualsFunction · 0.85
needsBlockingBuildFunction · 0.85
sortBuildersFunction · 0.85
debugMethod · 0.80
sortMethod · 0.80
getMethod · 0.65
pushMethod · 0.65
keysMethod · 0.45

Tested by

no test coverage detected