@angular-devkit/core 12.0.0-rc.0 → 12.0.0

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.
Files changed (162) hide show
  1. package/README.md +36 -34
  2. package/node/_golden-api.d.ts +1 -1
  3. package/node/_golden-api.js +1 -1
  4. package/node/cli-logger.d.ts +7 -0
  5. package/node/cli-logger.js +4 -6
  6. package/node/experimental/index.d.ts +2 -2
  7. package/node/experimental/index.js +3 -3
  8. package/node/experimental/jobs/index.d.ts +1 -1
  9. package/node/experimental/jobs/index.js +7 -7
  10. package/node/experimental/jobs/job-registry.d.ts +1 -1
  11. package/node/experimental/jobs/job-registry.js +4 -4
  12. package/node/fs.d.ts +7 -0
  13. package/node/fs.js +3 -3
  14. package/node/host.d.ts +2 -2
  15. package/node/host.js +31 -33
  16. package/node/index.d.ts +2 -2
  17. package/node/index.js +1 -1
  18. package/node/testing/index.d.ts +2 -2
  19. package/node/testing/index.js +8 -5
  20. package/package.json +3 -3
  21. package/src/_golden-api.d.ts +1 -1
  22. package/src/_golden-api.js +1 -1
  23. package/src/analytics/api.d.ts +1 -1
  24. package/src/analytics/api.js +7 -0
  25. package/src/analytics/forwarder.d.ts +1 -1
  26. package/src/analytics/forwarder.js +7 -0
  27. package/src/analytics/index.d.ts +1 -1
  28. package/src/analytics/index.js +7 -7
  29. package/src/analytics/logging.d.ts +1 -1
  30. package/src/analytics/logging.js +7 -0
  31. package/src/analytics/multi.d.ts +1 -1
  32. package/src/analytics/multi.js +6 -6
  33. package/src/analytics/noop.d.ts +1 -1
  34. package/src/analytics/noop.js +10 -1
  35. package/src/exception/exception.d.ts +1 -1
  36. package/src/exception/exception.js +25 -9
  37. package/src/exception/index.d.ts +1 -1
  38. package/src/exception/index.js +1 -1
  39. package/src/experimental/jobs/README.md +133 -112
  40. package/src/experimental/jobs/api.d.ts +1 -1
  41. package/src/experimental/jobs/api.js +8 -3
  42. package/src/experimental/jobs/architecture.md +43 -38
  43. package/src/experimental/jobs/create-job-handler.d.ts +1 -2
  44. package/src/experimental/jobs/create-job-handler.js +17 -14
  45. package/src/experimental/jobs/dispatcher.d.ts +1 -2
  46. package/src/experimental/jobs/dispatcher.js +7 -0
  47. package/src/experimental/jobs/exception.d.ts +1 -1
  48. package/src/experimental/jobs/exception.js +3 -3
  49. package/src/experimental/jobs/fallback-registry.d.ts +1 -1
  50. package/src/experimental/jobs/fallback-registry.js +4 -4
  51. package/src/experimental/jobs/index.d.ts +1 -1
  52. package/src/experimental/jobs/index.js +7 -7
  53. package/src/experimental/jobs/simple-registry.d.ts +1 -1
  54. package/src/experimental/jobs/simple-registry.js +6 -4
  55. package/src/experimental/jobs/simple-scheduler.d.ts +1 -1
  56. package/src/experimental/jobs/simple-scheduler.js +38 -29
  57. package/src/experimental/jobs/strategy.d.ts +7 -0
  58. package/src/experimental/jobs/strategy.js +10 -9
  59. package/src/experimental.d.ts +2 -2
  60. package/src/experimental.js +3 -3
  61. package/src/index.d.ts +2 -2
  62. package/src/index.js +7 -7
  63. package/src/json/index.d.ts +2 -2
  64. package/src/json/index.js +9 -9
  65. package/src/json/interface.d.ts +1 -1
  66. package/src/json/interface.js +7 -0
  67. package/src/json/parser.d.ts +1 -1
  68. package/src/json/parser.js +39 -22
  69. package/src/json/schema/index.d.ts +2 -2
  70. package/src/json/schema/index.js +9 -9
  71. package/src/json/schema/interface.d.ts +1 -1
  72. package/src/json/schema/interface.js +7 -0
  73. package/src/json/schema/pointer.d.ts +1 -1
  74. package/src/json/schema/pointer.js +17 -5
  75. package/src/json/schema/registry.d.ts +1 -1
  76. package/src/json/schema/registry.js +28 -47
  77. package/src/json/schema/schema.d.ts +1 -1
  78. package/src/json/schema/schema.js +3 -3
  79. package/src/json/schema/transforms.d.ts +1 -1
  80. package/src/json/schema/transforms.js +14 -13
  81. package/src/json/schema/utility.d.ts +7 -0
  82. package/src/json/schema/utility.js +7 -7
  83. package/src/json/schema/visitor.d.ts +1 -1
  84. package/src/json/schema/visitor.js +8 -7
  85. package/src/logger/indent.d.ts +7 -0
  86. package/src/logger/indent.js +5 -5
  87. package/src/logger/index.d.ts +1 -1
  88. package/src/logger/index.js +7 -7
  89. package/src/logger/level.d.ts +1 -1
  90. package/src/logger/level.js +7 -0
  91. package/src/logger/logger.d.ts +1 -1
  92. package/src/logger/logger.js +13 -6
  93. package/src/logger/null-logger.d.ts +7 -0
  94. package/src/logger/null-logger.js +3 -3
  95. package/src/logger/transform-logger.d.ts +1 -1
  96. package/src/logger/transform-logger.js +7 -0
  97. package/src/utils/array.d.ts +1 -1
  98. package/src/utils/array.js +2 -2
  99. package/src/utils/index.d.ts +1 -1
  100. package/src/utils/index.js +7 -7
  101. package/src/utils/lang.d.ts +1 -1
  102. package/src/utils/lang.js +3 -3
  103. package/src/utils/literals.d.ts +1 -1
  104. package/src/utils/literals.js +15 -8
  105. package/src/utils/object.d.ts +1 -1
  106. package/src/utils/object.js +3 -3
  107. package/src/utils/partially-ordered-set.d.ts +2 -2
  108. package/src/utils/partially-ordered-set.js +12 -8
  109. package/src/utils/priority-queue.d.ts +1 -1
  110. package/src/utils/priority-queue.js +2 -2
  111. package/src/utils/strings.d.ts +7 -0
  112. package/src/utils/strings.js +12 -9
  113. package/src/utils/template.d.ts +1 -1
  114. package/src/utils/template.js +24 -30
  115. package/src/virtual-fs/host/alias.d.ts +1 -1
  116. package/src/virtual-fs/host/alias.js +7 -5
  117. package/src/virtual-fs/host/buffer.d.ts +1 -1
  118. package/src/virtual-fs/host/buffer.js +7 -0
  119. package/src/virtual-fs/host/create.d.ts +7 -0
  120. package/src/virtual-fs/host/create.js +3 -3
  121. package/src/virtual-fs/host/empty.d.ts +1 -1
  122. package/src/virtual-fs/host/empty.js +3 -3
  123. package/src/virtual-fs/host/index.d.ts +1 -1
  124. package/src/virtual-fs/host/index.js +1 -1
  125. package/src/virtual-fs/host/interface.d.ts +1 -1
  126. package/src/virtual-fs/host/interface.js +7 -0
  127. package/src/virtual-fs/host/memory.d.ts +1 -1
  128. package/src/virtual-fs/host/memory.js +32 -20
  129. package/src/virtual-fs/host/pattern.d.ts +1 -1
  130. package/src/virtual-fs/host/pattern.js +17 -8
  131. package/src/virtual-fs/host/record.d.ts +1 -1
  132. package/src/virtual-fs/host/record.js +45 -28
  133. package/src/virtual-fs/host/resolver.d.ts +1 -1
  134. package/src/virtual-fs/host/resolver.js +10 -1
  135. package/src/virtual-fs/host/safe.d.ts +1 -1
  136. package/src/virtual-fs/host/safe.js +3 -3
  137. package/src/virtual-fs/host/scoped.d.ts +1 -1
  138. package/src/virtual-fs/host/scoped.js +3 -3
  139. package/src/virtual-fs/host/sync.d.ts +1 -1
  140. package/src/virtual-fs/host/sync.js +12 -3
  141. package/src/virtual-fs/host/test.d.ts +1 -1
  142. package/src/virtual-fs/host/test.js +11 -2
  143. package/src/virtual-fs/index.d.ts +2 -2
  144. package/src/virtual-fs/index.js +8 -8
  145. package/src/virtual-fs/path.d.ts +1 -1
  146. package/src/virtual-fs/path.js +17 -8
  147. package/src/workspace/core.d.ts +7 -0
  148. package/src/workspace/core.js +3 -3
  149. package/src/workspace/definitions.d.ts +1 -1
  150. package/src/workspace/definitions.js +7 -0
  151. package/src/workspace/host.d.ts +1 -1
  152. package/src/workspace/host.js +3 -3
  153. package/src/workspace/index.d.ts +1 -1
  154. package/src/workspace/index.js +7 -7
  155. package/src/workspace/json/metadata.d.ts +1 -1
  156. package/src/workspace/json/metadata.js +8 -1
  157. package/src/workspace/json/reader.d.ts +7 -0
  158. package/src/workspace/json/reader.js +4 -4
  159. package/src/workspace/json/utilities.d.ts +1 -1
  160. package/src/workspace/json/utilities.js +12 -5
  161. package/src/workspace/json/writer.d.ts +7 -0
  162. package/src/workspace/json/writer.js +4 -4
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Core
2
+
2
3
  > Shared utilities for Angular DevKit.
3
4
 
4
5
  # Exception
@@ -8,6 +9,7 @@
8
9
  ## Schema
9
10
 
10
11
  ### SchemaValidatorResult
12
+
11
13
  ```
12
14
  export interface SchemaValidatorResult {
13
15
  success: boolean;
@@ -62,33 +64,33 @@ export class CoreSchemaRegistry implements SchemaRegistry {
62
64
 
63
65
  The `workspaces` namespace provides an API for interacting with the workspace file formats.
64
66
  It provides an abstraction of the underlying storage format of the workspace and provides
65
- support for both reading and writing. Currently, the only supported format is the JSON-based
66
- format used by the Angular CLI. For this format, the API provides internal change tracking of values which
67
- enables fine-grained updates to the underlying storage of the workspace. This allows for the
67
+ support for both reading and writing. Currently, the only supported format is the JSON-based
68
+ format used by the Angular CLI. For this format, the API provides internal change tracking of values which
69
+ enables fine-grained updates to the underlying storage of the workspace. This allows for the
68
70
  retention of existing formatting and comments.
69
71
 
70
- A workspace is defined via the following object model. Definition collection objects are specialized
72
+ A workspace is defined via the following object model. Definition collection objects are specialized
71
73
  Javascript `Map` objects with an additional `add` method to simplify addition and provide more localized
72
74
  error checking of the newly added values.
73
75
 
74
76
  ```ts
75
77
  export interface WorkspaceDefinition {
76
- readonly extensions: Record<string, JsonValue | undefined>;
77
- readonly projects: ProjectDefinitionCollection;
78
+ readonly extensions: Record<string, JsonValue | undefined>;
79
+ readonly projects: ProjectDefinitionCollection;
78
80
  }
79
81
 
80
82
  export interface ProjectDefinition {
81
- readonly extensions: Record<string, JsonValue | undefined>;
82
- readonly targets: TargetDefinitionCollection;
83
- root: string;
84
- prefix?: string;
85
- sourceRoot?: string;
83
+ readonly extensions: Record<string, JsonValue | undefined>;
84
+ readonly targets: TargetDefinitionCollection;
85
+ root: string;
86
+ prefix?: string;
87
+ sourceRoot?: string;
86
88
  }
87
89
 
88
90
  export interface TargetDefinition {
89
- options?: Record<string, JsonValue | undefined>;
90
- configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>;
91
- builder: string;
91
+ options?: Record<string, JsonValue | undefined>;
92
+ configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>;
93
+ builder: string;
92
94
  }
93
95
  ```
94
96
 
@@ -106,7 +108,7 @@ export function readWorkspace(
106
108
  path: string,
107
109
  host: WorkspaceHost,
108
110
  format?: WorkspaceFormat,
109
- ): Promise<{ workspace: WorkspaceDefinition; }>;
111
+ ): Promise<{ workspace: WorkspaceDefinition }>;
110
112
  ```
111
113
 
112
114
  ```ts
@@ -118,16 +120,16 @@ export function writeWorkspace(
118
120
  ): Promise<void>;
119
121
  ```
120
122
 
121
- A `WorkspaceHost` abstracts the underlying data access methods from the functions. It provides
122
- methods to read, write, and analyze paths. A utility function is provided to create
123
+ A `WorkspaceHost` abstracts the underlying data access methods from the functions. It provides
124
+ methods to read, write, and analyze paths. A utility function is provided to create
123
125
  an instance of a `WorkspaceHost` from the Angular DevKit's virtual filesystem host abstraction.
124
126
 
125
127
  ```ts
126
128
  export interface WorkspaceHost {
127
- readFile(path: string): Promise<string>;
128
- writeFile(path: string, data: string): Promise<void>;
129
- isDirectory(path: string): Promise<boolean>;
130
- isFile(path: string): Promise<boolean>;
129
+ readFile(path: string): Promise<string>;
130
+ writeFile(path: string, data: string): Promise<void>;
131
+ isDirectory(path: string): Promise<boolean>;
132
+ isFile(path: string): Promise<boolean>;
131
133
  }
132
134
 
133
135
  export function createWorkspaceHost(host: virtualFs.Host): WorkspaceHost;
@@ -143,23 +145,23 @@ import { NodeJsSyncHost } from '@angular-devkit/core/node';
143
145
  import { workspaces } from '@angular-devkit/core';
144
146
 
145
147
  async function demonstrate() {
146
- const host = workspaces.createWorkspaceHost(new NodeJsSyncHost());
147
- const { workspace } = await workspaces.readWorkspace('path/to/workspace/directory/', host);
148
+ const host = workspaces.createWorkspaceHost(new NodeJsSyncHost());
149
+ const { workspace } = await workspaces.readWorkspace('path/to/workspace/directory/', host);
148
150
 
149
- const project = workspace.projects.get('my-app');
150
- if (!project) {
151
- throw new Error('my-app does not exist');
152
- }
151
+ const project = workspace.projects.get('my-app');
152
+ if (!project) {
153
+ throw new Error('my-app does not exist');
154
+ }
153
155
 
154
- const buildTarget = project.targets.get('build');
155
- if (!buildTarget) {
156
- throw new Error('build target does not exist');
157
- }
156
+ const buildTarget = project.targets.get('build');
157
+ if (!buildTarget) {
158
+ throw new Error('build target does not exist');
159
+ }
158
160
 
159
- buildTarget.options.optimization = true;
161
+ buildTarget.options.optimization = true;
160
162
 
161
- await workspaces.writeWorkspace(workspace, host);
163
+ await workspaces.writeWorkspace(workspace, host);
162
164
  }
163
165
 
164
166
  demonstrate();
165
- ```
167
+ ```
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
@@ -1,3 +1,10 @@
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.io/license
7
+ */
1
8
  /// <reference types="node" />
2
9
  import { logging } from '../src';
3
10
  export interface ProcessOutput {
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createConsoleLogger = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.createConsoleLogger = void 0;
11
11
  const operators_1 = require("rxjs/operators");
12
12
  const src_1 = require("../src");
13
13
  /**
@@ -15,9 +15,7 @@ const src_1 = require("../src");
15
15
  */
16
16
  function createConsoleLogger(verbose = false, stdout = process.stdout, stderr = process.stderr, colors) {
17
17
  const logger = new src_1.logging.IndentLogger('cling');
18
- logger
19
- .pipe(operators_1.filter(entry => entry.level !== 'debug' || verbose))
20
- .subscribe(entry => {
18
+ logger.pipe(operators_1.filter((entry) => entry.level !== 'debug' || verbose)).subscribe((entry) => {
21
19
  const color = colors && colors[entry.level];
22
20
  let output = stdout;
23
21
  switch (entry.level) {
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import * as jobs from './jobs';
9
- export { jobs, };
9
+ export { jobs };
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jobs = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.jobs = void 0;
11
11
  const jobs = require("./jobs");
12
12
  exports.jobs = jobs;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
10
  if (k2 === undefined) k2 = k;
4
11
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -10,11 +17,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
17
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
18
  };
12
19
  Object.defineProperty(exports, "__esModule", { value: true });
13
- /**
14
- * @license
15
- * Copyright Google Inc. All Rights Reserved.
16
- *
17
- * Use of this source code is governed by an MIT-style license that can be
18
- * found in the LICENSE file at https://angular.io/license
19
- */
20
20
  __exportStar(require("./job-registry"), exports);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeModuleJobRegistry = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NodeModuleJobRegistry = void 0;
11
11
  const rxjs_1 = require("rxjs");
12
12
  const src_1 = require("../../../src");
13
13
  class NodeModuleJobRegistry {
@@ -40,7 +40,7 @@ class NodeModuleJobRegistry {
40
40
  return rxjs_1.of(null);
41
41
  }
42
42
  function _getValue(...fields) {
43
- return fields.find(x => src_1.schema.isJsonSchema(x)) || true;
43
+ return fields.find((x) => src_1.schema.isJsonSchema(x)) || true;
44
44
  }
45
45
  const argument = _getValue(pkg.argument, handler.argument);
46
46
  const input = _getValue(pkg.input, handler.input);
package/node/fs.d.ts CHANGED
@@ -1,3 +1,10 @@
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.io/license
7
+ */
1
8
  /** @deprecated Since v11.0, unused by the Angular tooling */
2
9
  export declare function isFile(filePath: string): boolean;
3
10
  /** @deprecated Since v11.0, unused by the Angular tooling */
package/node/fs.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDirectory = exports.isFile = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.isDirectory = exports.isFile = void 0;
11
11
  const fs_1 = require("fs");
12
12
  /** @deprecated Since v11.0, unused by the Angular tooling */
13
13
  function isFile(filePath) {
package/node/host.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
5
4
  *
6
5
  * Use of this source code is governed by an MIT-style license that can be
7
6
  * found in the LICENSE file at https://angular.io/license
8
7
  */
8
+ /// <reference types="node" />
9
9
  import { Stats } from 'fs';
10
10
  import { Observable } from 'rxjs';
11
11
  import { Path, PathFragment, virtualFs } from '../src';
package/node/host.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeJsSyncHost = exports.NodeJsAsyncHost = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NodeJsSyncHost = exports.NodeJsAsyncHost = void 0;
11
11
  const fs_1 = require("fs");
12
12
  const path_1 = require("path");
13
13
  const rxjs_1 = require("rxjs");
@@ -29,7 +29,7 @@ let FSWatcher;
29
29
  function loadFSWatcher() {
30
30
  if (!FSWatcher) {
31
31
  try {
32
- // tslint:disable-next-line:no-implicit-dependencies
32
+ // eslint-disable-next-line import/no-extraneous-dependencies
33
33
  FSWatcher = require('chokidar').FSWatcher;
34
34
  }
35
35
  catch (e) {
@@ -50,18 +50,16 @@ class NodeJsAsyncHost {
50
50
  return { synchronous: false };
51
51
  }
52
52
  write(path, content) {
53
- return rxjs_1.from(fs_1.promises.mkdir(src_1.getSystemPath(src_1.dirname(path)), { recursive: true }))
54
- .pipe(operators_1.mergeMap(() => fs_1.promises.writeFile(src_1.getSystemPath(path), content)));
53
+ return rxjs_1.from(fs_1.promises.mkdir(src_1.getSystemPath(src_1.dirname(path)), { recursive: true })).pipe(operators_1.mergeMap(() => fs_1.promises.writeFile(src_1.getSystemPath(path), content)));
55
54
  }
56
55
  read(path) {
57
- return rxjs_1.from(fs_1.promises.readFile(src_1.getSystemPath(path)))
58
- .pipe(operators_1.map(buffer => new Uint8Array(buffer).buffer));
56
+ return rxjs_1.from(fs_1.promises.readFile(src_1.getSystemPath(path))).pipe(operators_1.map((buffer) => new Uint8Array(buffer).buffer));
59
57
  }
60
58
  delete(path) {
61
59
  return this.isDirectory(path).pipe(operators_1.mergeMap(async (isDirectory) => {
62
60
  if (isDirectory) {
63
61
  const recursiveDelete = async (dirPath) => {
64
- for (const fragment of (await fs_1.promises.readdir(dirPath))) {
62
+ for (const fragment of await fs_1.promises.readdir(dirPath)) {
65
63
  const sysPath = path_1.join(dirPath, fragment);
66
64
  const stats = await fs_1.promises.stat(sysPath);
67
65
  if (stats.isDirectory()) {
@@ -84,16 +82,16 @@ class NodeJsAsyncHost {
84
82
  return rxjs_1.from(fs_1.promises.rename(src_1.getSystemPath(from), src_1.getSystemPath(to)));
85
83
  }
86
84
  list(path) {
87
- return rxjs_1.from(fs_1.promises.readdir(src_1.getSystemPath(path))).pipe(operators_1.map((names) => names.map(name => src_1.fragment(name))));
85
+ return rxjs_1.from(fs_1.promises.readdir(src_1.getSystemPath(path))).pipe(operators_1.map((names) => names.map((name) => src_1.fragment(name))));
88
86
  }
89
87
  exists(path) {
90
88
  return rxjs_1.from(exists(path));
91
89
  }
92
90
  isDirectory(path) {
93
- return this.stat(path).pipe(operators_1.map(stat => stat.isDirectory()));
91
+ return this.stat(path).pipe(operators_1.map((stat) => stat.isDirectory()));
94
92
  }
95
93
  isFile(path) {
96
- return this.stat(path).pipe(operators_1.map(stat => stat.isFile()));
94
+ return this.stat(path).pipe(operators_1.map((stat) => stat.isFile()));
97
95
  }
98
96
  // Some hosts may not support stat.
99
97
  stat(path) {
@@ -101,25 +99,25 @@ class NodeJsAsyncHost {
101
99
  }
102
100
  // Some hosts may not support watching.
103
101
  watch(path, _options) {
104
- return new rxjs_1.Observable(obs => {
102
+ return new rxjs_1.Observable((obs) => {
105
103
  loadFSWatcher();
106
104
  const watcher = new FSWatcher({ persistent: true }).add(src_1.getSystemPath(path));
107
105
  watcher
108
- .on('change', path => {
106
+ .on('change', (path) => {
109
107
  obs.next({
110
108
  path: src_1.normalize(path),
111
109
  time: new Date(),
112
110
  type: 0 /* Changed */,
113
111
  });
114
112
  })
115
- .on('add', path => {
113
+ .on('add', (path) => {
116
114
  obs.next({
117
115
  path: src_1.normalize(path),
118
116
  time: new Date(),
119
117
  type: 1 /* Created */,
120
118
  });
121
119
  })
122
- .on('unlink', path => {
120
+ .on('unlink', (path) => {
123
121
  obs.next({
124
122
  path: src_1.normalize(path),
125
123
  time: new Date(),
@@ -139,7 +137,7 @@ class NodeJsSyncHost {
139
137
  return { synchronous: true };
140
138
  }
141
139
  write(path, content) {
142
- return new rxjs_1.Observable(obs => {
140
+ return new rxjs_1.Observable((obs) => {
143
141
  fs_1.mkdirSync(src_1.getSystemPath(src_1.dirname(path)), { recursive: true });
144
142
  fs_1.writeFileSync(src_1.getSystemPath(path), new Uint8Array(content));
145
143
  obs.next();
@@ -147,21 +145,21 @@ class NodeJsSyncHost {
147
145
  });
148
146
  }
149
147
  read(path) {
150
- return new rxjs_1.Observable(obs => {
148
+ return new rxjs_1.Observable((obs) => {
151
149
  const buffer = fs_1.readFileSync(src_1.getSystemPath(path));
152
150
  obs.next(new Uint8Array(buffer).buffer);
153
151
  obs.complete();
154
152
  });
155
153
  }
156
154
  delete(path) {
157
- return this.isDirectory(path).pipe(operators_1.concatMap(isDir => {
155
+ return this.isDirectory(path).pipe(operators_1.concatMap((isDir) => {
158
156
  if (isDir) {
159
157
  const dirPaths = fs_1.readdirSync(src_1.getSystemPath(path));
160
158
  const rmDirComplete = new rxjs_1.Observable((obs) => {
161
159
  fs_1.rmdirSync(src_1.getSystemPath(path));
162
160
  obs.complete();
163
161
  });
164
- return rxjs_1.concat(...dirPaths.map(name => this.delete(src_1.join(path, name))), rmDirComplete);
162
+ return rxjs_1.concat(...dirPaths.map((name) => this.delete(src_1.join(path, name))), rmDirComplete);
165
163
  }
166
164
  else {
167
165
  try {
@@ -175,7 +173,7 @@ class NodeJsSyncHost {
175
173
  }));
176
174
  }
177
175
  rename(from, to) {
178
- return new rxjs_1.Observable(obs => {
176
+ return new rxjs_1.Observable((obs) => {
179
177
  const toSystemPath = src_1.getSystemPath(to);
180
178
  fs_1.mkdirSync(path_1.dirname(toSystemPath), { recursive: true });
181
179
  fs_1.renameSync(src_1.getSystemPath(from), toSystemPath);
@@ -184,55 +182,55 @@ class NodeJsSyncHost {
184
182
  });
185
183
  }
186
184
  list(path) {
187
- return new rxjs_1.Observable(obs => {
185
+ return new rxjs_1.Observable((obs) => {
188
186
  const names = fs_1.readdirSync(src_1.getSystemPath(path));
189
- obs.next(names.map(name => src_1.fragment(name)));
187
+ obs.next(names.map((name) => src_1.fragment(name)));
190
188
  obs.complete();
191
189
  });
192
190
  }
193
191
  exists(path) {
194
- return new rxjs_1.Observable(obs => {
192
+ return new rxjs_1.Observable((obs) => {
195
193
  obs.next(fs_1.existsSync(src_1.getSystemPath(path)));
196
194
  obs.complete();
197
195
  });
198
196
  }
199
197
  isDirectory(path) {
200
- // tslint:disable-next-line:no-non-null-assertion
201
- return this.stat(path).pipe(operators_1.map(stat => stat.isDirectory()));
198
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
199
+ return this.stat(path).pipe(operators_1.map((stat) => stat.isDirectory()));
202
200
  }
203
201
  isFile(path) {
204
- // tslint:disable-next-line:no-non-null-assertion
205
- return this.stat(path).pipe(operators_1.map(stat => stat.isFile()));
202
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
203
+ return this.stat(path).pipe(operators_1.map((stat) => stat.isFile()));
206
204
  }
207
205
  // Some hosts may not support stat.
208
206
  stat(path) {
209
- return new rxjs_1.Observable(obs => {
207
+ return new rxjs_1.Observable((obs) => {
210
208
  obs.next(fs_1.statSync(src_1.getSystemPath(path)));
211
209
  obs.complete();
212
210
  });
213
211
  }
214
212
  // Some hosts may not support watching.
215
213
  watch(path, _options) {
216
- return new rxjs_1.Observable(obs => {
214
+ return new rxjs_1.Observable((obs) => {
217
215
  const opts = { persistent: false };
218
216
  loadFSWatcher();
219
217
  const watcher = new FSWatcher(opts).add(src_1.getSystemPath(path));
220
218
  watcher
221
- .on('change', path => {
219
+ .on('change', (path) => {
222
220
  obs.next({
223
221
  path: src_1.normalize(path),
224
222
  time: new Date(),
225
223
  type: 0 /* Changed */,
226
224
  });
227
225
  })
228
- .on('add', path => {
226
+ .on('add', (path) => {
229
227
  obs.next({
230
228
  path: src_1.normalize(path),
231
229
  time: new Date(),
232
230
  type: 1 /* Created */,
233
231
  });
234
232
  })
235
- .on('unlink', path => {
233
+ .on('unlink', (path) => {
236
234
  obs.next({
237
235
  path: src_1.normalize(path),
238
236
  time: new Date(),
package/node/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -9,4 +9,4 @@ import * as experimental from './experimental/jobs/job-registry';
9
9
  import * as fs from './fs';
10
10
  export * from './cli-logger';
11
11
  export * from './host';
12
- export { experimental, fs, };
12
+ export { experimental, fs };
package/node/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
@@ -1,11 +1,11 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
5
4
  *
6
5
  * Use of this source code is governed by an MIT-style license that can be
7
6
  * found in the LICENSE file at https://angular.io/license
8
7
  */
8
+ /// <reference types="node" />
9
9
  import * as fs from 'fs';
10
10
  import { Path, virtualFs } from '../../src';
11
11
  /**
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TempScopedNodeJsSyncHost = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.TempScopedNodeJsSyncHost = void 0;
11
11
  const fs = require("fs");
12
12
  const os = require("os");
13
13
  const path = require("path");
@@ -26,7 +26,8 @@ class TempScopedNodeJsSyncHost extends src_1.virtualFs.ScopedHost {
26
26
  get files() {
27
27
  const sync = this.sync;
28
28
  function _visit(p) {
29
- return sync.list(p)
29
+ return sync
30
+ .list(p)
30
31
  .map((fragment) => src_1.join(p, fragment))
31
32
  .reduce((files, path) => {
32
33
  if (sync.isDirectory(path)) {
@@ -39,7 +40,9 @@ class TempScopedNodeJsSyncHost extends src_1.virtualFs.ScopedHost {
39
40
  }
40
41
  return _visit(src_1.normalize('/'));
41
42
  }
42
- get root() { return this._root; }
43
+ get root() {
44
+ return this._root;
45
+ }
43
46
  get sync() {
44
47
  if (!this._sync) {
45
48
  this._sync = new src_1.virtualFs.SyncDelegateHost(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-devkit/core",
3
- "version": "12.0.0-rc.0",
3
+ "version": "12.0.0",
4
4
  "description": "Angular DevKit - Core Utility Library",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "core"
14
14
  ],
15
15
  "dependencies": {
16
- "ajv": "8.1.0",
16
+ "ajv": "8.2.0",
17
17
  "ajv-formats": "2.0.2",
18
18
  "fast-json-stable-stringify": "2.1.0",
19
19
  "magic-string": "0.25.7",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/angular/angular-cli.git"
26
26
  },
27
27
  "engines": {
28
- "node": ">= 12.13.0",
28
+ "node": "^12.14.1 || ^14.0.0",
29
29
  "npm": "^6.11.0 || ^7.5.6",
30
30
  "yarn": ">= 1.13.0"
31
31
  },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license