UNPKG

2.61 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.dev/license
7 */
8import { JsonValue } from '../json';
9export interface WorkspaceDefinition {
10 readonly extensions: Record<string, JsonValue | undefined>;
11 readonly projects: ProjectDefinitionCollection;
12}
13export interface ProjectDefinition {
14 readonly extensions: Record<string, JsonValue | undefined>;
15 readonly targets: TargetDefinitionCollection;
16 root: string;
17 prefix?: string;
18 sourceRoot?: string;
19}
20export interface TargetDefinition {
21 options?: Record<string, JsonValue | undefined>;
22 configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>;
23 defaultConfiguration?: string;
24 builder: string;
25}
26export type DefinitionCollectionListener<V extends object> = (name: string, newValue: V | undefined, collection: DefinitionCollection<V>) => void;
27declare class DefinitionCollection<V extends object> implements ReadonlyMap<string, V> {
28 private _listener?;
29 private _map;
30 constructor(initial?: Record<string, V>, _listener?: DefinitionCollectionListener<V> | undefined);
31 delete(key: string): boolean;
32 set(key: string, value: V): this;
33 forEach<T>(callbackfn: (value: V, key: string, map: DefinitionCollection<V>) => void, thisArg?: T): void;
34 get(key: string): V | undefined;
35 has(key: string): boolean;
36 get size(): number;
37 [Symbol.iterator](): MapIterator<[string, V]>;
38 entries(): MapIterator<[string, V]>;
39 keys(): MapIterator<string>;
40 values(): MapIterator<V>;
41}
42export declare class ProjectDefinitionCollection extends DefinitionCollection<ProjectDefinition> {
43 constructor(initial?: Record<string, ProjectDefinition>, listener?: DefinitionCollectionListener<ProjectDefinition>);
44 add(definition: {
45 name: string;
46 root: string;
47 sourceRoot?: string;
48 prefix?: string;
49 targets?: Record<string, TargetDefinition | undefined>;
50 [key: string]: unknown;
51 }): ProjectDefinition;
52 set(name: string, value: ProjectDefinition): this;
53 private _validateName;
54}
55export declare class TargetDefinitionCollection extends DefinitionCollection<TargetDefinition> {
56 constructor(initial?: Record<string, TargetDefinition>, listener?: DefinitionCollectionListener<TargetDefinition>);
57 add(definition: {
58 name: string;
59 } & TargetDefinition): TargetDefinition;
60 set(name: string, value: TargetDefinition): this;
61 private _validateName;
62}
63export {};