@angular-devkit/core 8.3.0-rc.0 → 8.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ export interface TargetDefinition {
|
|
|
22
22
|
configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>;
|
|
23
23
|
builder: string;
|
|
24
24
|
}
|
|
25
|
-
export declare type DefinitionCollectionListener<V> = (name: string, action: 'add' | 'remove' | 'replace', newValue: V | undefined, oldValue: V | undefined) => void;
|
|
25
|
+
export declare type DefinitionCollectionListener<V extends object> = (name: string, action: 'add' | 'remove' | 'replace', newValue: V | undefined, oldValue: V | undefined, collection: DefinitionCollection<V>) => void;
|
|
26
26
|
declare class DefinitionCollection<V extends object> implements ReadonlyMap<string, V> {
|
|
27
27
|
private _listener?;
|
|
28
28
|
private _map;
|
|
@@ -9,7 +9,7 @@ class DefinitionCollection {
|
|
|
9
9
|
const value = this._map.get(key);
|
|
10
10
|
const result = this._map.delete(key);
|
|
11
11
|
if (result && value !== undefined && this._listener) {
|
|
12
|
-
this._listener(key, 'remove', undefined, value);
|
|
12
|
+
this._listener(key, 'remove', undefined, value, this);
|
|
13
13
|
}
|
|
14
14
|
return result;
|
|
15
15
|
}
|
|
@@ -17,7 +17,7 @@ class DefinitionCollection {
|
|
|
17
17
|
const existing = this.get(key);
|
|
18
18
|
this._map.set(key, value);
|
|
19
19
|
if (this._listener) {
|
|
20
|
-
this._listener(key, existing !== undefined ? 'replace' : 'add', value, existing);
|
|
20
|
+
this._listener(key, existing !== undefined ? 'replace' : 'add', value, existing, this);
|
|
21
21
|
}
|
|
22
22
|
return this;
|
|
23
23
|
}
|
|
@@ -155,11 +155,23 @@ function parseProject(projectName, projectNode, context) {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
let collectionListener;
|
|
158
|
-
if (context.trackChanges
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
if (context.trackChanges) {
|
|
159
|
+
if (targetsNode) {
|
|
160
|
+
const parentNode = targetsNode;
|
|
161
|
+
collectionListener = (name, action, newValue) => {
|
|
162
|
+
jsonMetadata.addChange(action, `/projects/${projectName}/targets/${utilities_1.escapeKey(name)}`, parentNode, newValue, 'target');
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
let added = false;
|
|
167
|
+
collectionListener = (_name, action, _new, _old, collection) => {
|
|
168
|
+
if (added || action !== 'add') {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
jsonMetadata.addChange('add', `/projects/${projectName}/targets`, projectNode, collection, 'targetcollection');
|
|
172
|
+
added = true;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
163
175
|
}
|
|
164
176
|
const base = {
|
|
165
177
|
targets: new definitions_1.TargetDefinitionCollection(targets, collectionListener),
|