-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(@angular/build): provide structured application builder resu…
…lt types The application builder now provides structured output types to its internal consumers. The architect builders themselves and the programmatic API is not changed. These output result types allow for the development server to receive additional information regarding the build and update the active browser appropriately. This functionality is not yet implemented but the additional result types provide the base infrastructure to enable future features. The result types also allow for reduced complexity inside other builders such as i18n extraction and the browser compatibility builder. The usage is not yet fully optimized and will be refined in future changes.
- Loading branch information
Showing
18 changed files
with
368 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/angular/build/src/builders/application/results.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.dev/license | ||
*/ | ||
|
||
import { BuildOutputFileType } from '../../tools/esbuild/bundler-context'; | ||
|
||
export enum ResultKind { | ||
Failure, | ||
Full, | ||
Incremental, | ||
ComponentUpdate, | ||
} | ||
|
||
export type Result = FailureResult | FullResult | IncrementalResult | ComponentUpdateResult; | ||
|
||
export interface BaseResult { | ||
kind: ResultKind; | ||
warnings?: ResultMessage[]; | ||
duration?: number; | ||
detail?: Record<string, unknown>; | ||
} | ||
|
||
export interface FailureResult extends BaseResult { | ||
kind: ResultKind.Failure; | ||
errors: ResultMessage[]; | ||
} | ||
|
||
export interface FullResult extends BaseResult { | ||
kind: ResultKind.Full; | ||
files: Record<string, ResultFile>; | ||
} | ||
|
||
export interface IncrementalResult extends BaseResult { | ||
kind: ResultKind.Incremental; | ||
added: string[]; | ||
removed: string[]; | ||
modified: string[]; | ||
files: Record<string, ResultFile>; | ||
} | ||
|
||
export type ResultFile = DiskFile | MemoryFile; | ||
|
||
export interface BaseResultFile { | ||
origin: 'memory' | 'disk'; | ||
type: BuildOutputFileType; | ||
} | ||
|
||
export interface DiskFile extends BaseResultFile { | ||
origin: 'disk'; | ||
inputPath: string; | ||
} | ||
|
||
export interface MemoryFile extends BaseResultFile { | ||
origin: 'memory'; | ||
hash: string; | ||
contents: Uint8Array; | ||
} | ||
|
||
export interface ResultMessage { | ||
text: string; | ||
location?: { file: string; line: number; column: number } | null; | ||
notes?: { text: string }[]; | ||
} | ||
|
||
export interface ComponentUpdateResult extends BaseResult { | ||
kind: ResultKind.ComponentUpdate; | ||
id: string; | ||
type: 'style' | 'template'; | ||
content: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.