@schematics/angular 8.2.0-next.1 → 8.2.2

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.
@@ -22,9 +22,11 @@ export declare function insertImport(source: ts.SourceFile, fileToEdit: string,
22
22
  * @param node
23
23
  * @param kind
24
24
  * @param max The maximum number of items to return.
25
+ * @param recursive Continue looking for nodes of kind recursive until end
26
+ * the last child even when node of kind has been found.
25
27
  * @return all nodes of kind, or [] if none is found
26
28
  */
27
- export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind, max?: number): ts.Node[];
29
+ export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind, max?: number, recursive?: boolean): ts.Node[];
28
30
  /**
29
31
  * Get all the nodes from a source.
30
32
  * @param sourceFile The source file object.
@@ -74,9 +74,11 @@ exports.insertImport = insertImport;
74
74
  * @param node
75
75
  * @param kind
76
76
  * @param max The maximum number of items to return.
77
+ * @param recursive Continue looking for nodes of kind recursive until end
78
+ * the last child even when node of kind has been found.
77
79
  * @return all nodes of kind, or [] if none is found
78
80
  */
79
- function findNodes(node, kind, max = Infinity) {
81
+ function findNodes(node, kind, max = Infinity, recursive = false) {
80
82
  if (!node || max == 0) {
81
83
  return [];
82
84
  }
@@ -85,7 +87,7 @@ function findNodes(node, kind, max = Infinity) {
85
87
  arr.push(node);
86
88
  max--;
87
89
  }
88
- if (max > 0) {
90
+ if (max > 0 && (recursive || node.kind !== kind)) {
89
91
  for (const child of node.getChildren()) {
90
92
  findNodes(child, kind, max).forEach(node => {
91
93
  if (max > 0) {
@@ -119,7 +119,7 @@ export interface AppConfig {
119
119
  /**
120
120
  * The type of budget
121
121
  */
122
- type?: ('bundle' | 'initial' | 'allScript' | 'all' | 'anyScript' | 'any');
122
+ type?: ('bundle' | 'initial' | 'allScript' | 'all' | 'anyScript' | 'any' | 'anyComponentStyle');
123
123
  /**
124
124
  * The name of the bundle
125
125
  */
@@ -11,7 +11,7 @@ function appendPropertyInAstObject(recorder, node, propertyName, value, indent)
11
11
  recorder.insertRight(commaIndex, ',');
12
12
  index = end.offset;
13
13
  }
14
- const content = JSON.stringify(value, null, indent).replace(/\n/g, indentStr);
14
+ const content = _stringifyContent(value, indentStr);
15
15
  recorder.insertRight(index, (node.properties.length === 0 && indent ? '\n' : '')
16
16
  + ' '.repeat(indent)
17
17
  + `"${propertyName}":${indent ? ' ' : ''}${content}`
@@ -49,7 +49,7 @@ function insertPropertyInAstObjectInOrder(recorder, node, propertyName, value, i
49
49
  const insertIndex = insertAfterProp === null
50
50
  ? node.start.offset + 1
51
51
  : insertAfterProp.end.offset + 1;
52
- const content = JSON.stringify(value, null, indent).replace(/\n/g, indentStr);
52
+ const content = _stringifyContent(value, indentStr);
53
53
  recorder.insertRight(insertIndex, indentStr
54
54
  + `"${propertyName}":${indent ? ' ' : ''}${content}`
55
55
  + ',');
@@ -111,7 +111,7 @@ function appendValueInAstArray(recorder, node, value, indent = 4) {
111
111
  }
112
112
  recorder.insertRight(index, (node.elements.length === 0 && indent ? '\n' : '')
113
113
  + ' '.repeat(indent)
114
- + JSON.stringify(value, null, indent).replace(/\n/g, indentStr)
114
+ + _stringifyContent(value, indentStr)
115
115
  + indentStr.slice(0, -indent));
116
116
  }
117
117
  exports.appendValueInAstArray = appendValueInAstArray;
@@ -128,3 +128,21 @@ exports.findPropertyInAstObject = findPropertyInAstObject;
128
128
  function _buildIndent(count) {
129
129
  return count ? '\n' + ' '.repeat(count) : '';
130
130
  }
131
+ function _stringifyContent(value, indentStr) {
132
+ // TODO: Add snapshot tests
133
+ // The 'space' value is 2, because we want to add 2 additional
134
+ // indents from the 'key' node.
135
+ // If we use the indent provided we will have double indents:
136
+ // "budgets": [
137
+ // {
138
+ // "type": "initial",
139
+ // "maximumWarning": "2mb",
140
+ // "maximumError": "5mb"
141
+ // },
142
+ // {
143
+ // "type": "anyComponentStyle",
144
+ // 'maximumWarning": "5kb"
145
+ // }
146
+ // ]
147
+ return JSON.stringify(value, null, 2).replace(/\n/g, indentStr);
148
+ }
@@ -9,16 +9,16 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.latestVersions = {
11
11
  // These versions should be kept up to date with latest Angular peer dependencies.
12
- Angular: '~8.2.0-next.2',
12
+ Angular: '~8.2.0',
13
13
  RxJs: '~6.4.0',
14
14
  ZoneJs: '~0.9.1',
15
- TypeScript: '~3.4.3',
16
- TsLib: '^1.9.0',
15
+ TypeScript: '~3.5.3',
16
+ TsLib: '^1.10.0',
17
17
  // The versions below must be manually updated when making a new devkit release.
18
- DevkitBuildAngular: '~0.802.0-next.1',
19
- DevkitBuildNgPackagr: '~0.802.0-next.1',
20
- DevkitBuildWebpack: '~0.802.0-next.1',
21
- AngularPWA: '~0.802.0-next.1',
22
- tsickle: '^0.35.0',
23
- ngPackagr: '^5.1.0',
18
+ DevkitBuildAngular: '~0.802.2',
19
+ DevkitBuildNgPackagr: '~0.802.2',
20
+ DevkitBuildWebpack: '~0.802.2',
21
+ AngularPWA: '~0.802.2',
22
+ tsickle: '^0.36.0',
23
+ ngPackagr: '^5.3.0',
24
24
  };
@@ -33,8 +33,8 @@ export interface BrowserBuilderBaseOptions {
33
33
  index?: string;
34
34
  polyfills: string;
35
35
  assets?: (object | string)[];
36
- styles?: string[];
37
- scripts?: string[];
36
+ styles?: (object | string)[];
37
+ scripts?: (object | string)[];
38
38
  sourceMap?: boolean;
39
39
  }
40
40
  export interface BrowserBuilderOptions extends BrowserBuilderBaseOptions {
@@ -11,8 +11,8 @@
11
11
  /node_modules
12
12
 
13
13
  # profiling files
14
- chrome-profiler-events.json
15
- speed-measure-plugin.json
14
+ chrome-profiler-events*.json
15
+ speed-measure-plugin*.json
16
16
 
17
17
  # IDEs and editors
18
18
  /.idea