@schematics/angular 14.0.0-next.1 → 14.0.0-next.12

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 (58) hide show
  1. package/app-shell/index.js +10 -10
  2. package/app-shell/schema.d.ts +3 -3
  3. package/app-shell/schema.json +3 -3
  4. package/application/index.js +4 -7
  5. package/application/schema.d.ts +1 -1
  6. package/application/schema.json +1 -1
  7. package/class/schema.json +1 -2
  8. package/collection.json +1 -4
  9. package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +1 -3
  10. package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +5 -4
  11. package/component/index.js +14 -15
  12. package/component/schema.d.ts +4 -0
  13. package/component/schema.json +6 -0
  14. package/directive/files/__name@dasherize@if-flat__/__name@dasherize__.directive.ts.template +2 -1
  15. package/directive/index.js +14 -19
  16. package/directive/schema.d.ts +4 -0
  17. package/directive/schema.json +6 -0
  18. package/e2e/e2e-long.md +1 -1
  19. package/e2e/index.js +7 -1
  20. package/e2e/schema.d.ts +1 -1
  21. package/e2e/schema.json +1 -1
  22. package/interface/schema.json +0 -1
  23. package/library/index.js +3 -6
  24. package/migrations/migration-collection.json +10 -0
  25. package/migrations/update-14/remove-default-project-option.d.ts +10 -0
  26. package/migrations/update-14/remove-default-project-option.js +17 -0
  27. package/migrations/update-14/replace-default-collection-option.d.ts +10 -0
  28. package/migrations/update-14/replace-default-collection-option.js +32 -0
  29. package/module/index.js +13 -17
  30. package/ng-new/index.js +1 -1
  31. package/package.json +4 -4
  32. package/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template +2 -1
  33. package/pipe/index.js +13 -18
  34. package/pipe/schema.d.ts +4 -0
  35. package/pipe/schema.json +6 -0
  36. package/service-worker/index.js +8 -8
  37. package/third_party/github.com/Microsoft/TypeScript/BUILD.bazel +7 -2
  38. package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +29 -16
  39. package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +4866 -3030
  40. package/universal/index.js +14 -9
  41. package/universal/schema.d.ts +1 -1
  42. package/universal/schema.json +1 -1
  43. package/utility/ast-utils.js +31 -27
  44. package/utility/find-module.d.ts +1 -0
  45. package/utility/find-module.js +5 -10
  46. package/utility/generate-from-files.js +2 -3
  47. package/utility/json-file.js +1 -7
  48. package/utility/latest-versions/package.json +7 -7
  49. package/utility/ng-ast-utils.js +7 -11
  50. package/utility/parse-name.js +0 -1
  51. package/utility/test/index.js +5 -1
  52. package/utility/validation.js +1 -3
  53. package/utility/workspace-models.d.ts +8 -6
  54. package/utility/workspace.js +1 -5
  55. package/web-worker/index.js +2 -2
  56. package/workspace/files/README.md.template +1 -1
  57. package/workspace/files/package.json.template +1 -2
  58. package/workspace/index.js +1 -2
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -33,6 +37,7 @@ const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/
33
37
  const ast_utils_1 = require("../utility/ast-utils");
34
38
  const change_1 = require("../utility/change");
35
39
  const dependencies_1 = require("../utility/dependencies");
40
+ const latest_versions_1 = require("../utility/latest-versions");
36
41
  const ng_ast_utils_1 = require("../utility/ng-ast-utils");
37
42
  const paths_1 = require("../utility/paths");
38
43
  const project_targets_1 = require("../utility/project-targets");
@@ -91,11 +96,7 @@ function updateConfigFile(options, tsConfigDirectory) {
91
96
  });
92
97
  }
93
98
  function findBrowserModuleImport(host, modulePath) {
94
- const moduleBuffer = host.read(modulePath);
95
- if (!moduleBuffer) {
96
- throw new schematics_1.SchematicsException(`Module file (${modulePath}) not found`);
97
- }
98
- const moduleFileText = moduleBuffer.toString('utf-8');
99
+ const moduleFileText = host.readText(modulePath);
99
100
  const source = ts.createSourceFile(modulePath, moduleFileText, ts.ScriptTarget.Latest, true);
100
101
  const decoratorMetadata = (0, ast_utils_1.getDecoratorMetadata)(source, 'NgModule', '@angular/core')[0];
101
102
  const browserModuleNode = (0, ast_utils_1.findNode)(decoratorMetadata, ts.SyntaxKind.Identifier, 'BrowserModule');
@@ -194,7 +195,11 @@ function addDependencies() {
194
195
  name: '@angular/platform-server',
195
196
  };
196
197
  (0, dependencies_1.addPackageJsonDependency)(host, platformServerDep);
197
- return host;
198
+ (0, dependencies_1.addPackageJsonDependency)(host, {
199
+ type: dependencies_1.NodeDependencyType.Dev,
200
+ name: '@types/node',
201
+ version: latest_versions_1.latestVersions['@types/node'],
202
+ });
198
203
  };
199
204
  }
200
205
  function default_1(options) {
@@ -221,7 +226,7 @@ function default_1(options) {
221
226
  }
222
227
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files/src'), [
223
228
  (0, schematics_1.applyTemplates)({
224
- ...core_1.strings,
229
+ ...schematics_1.strings,
225
230
  ...options,
226
231
  stripTsExtension: (s) => s.replace(/\.ts$/, ''),
227
232
  hasLocalizePackage: !!(0, dependencies_1.getPackageJsonDependency)(host, '@angular/localize'),
@@ -230,7 +235,7 @@ function default_1(options) {
230
235
  ]);
231
236
  const rootSource = (0, schematics_1.apply)((0, schematics_1.url)('./files/root'), [
232
237
  (0, schematics_1.applyTemplates)({
233
- ...core_1.strings,
238
+ ...schematics_1.strings,
234
239
  ...options,
235
240
  stripTsExtension: (s) => s.replace(/\.ts$/, ''),
236
241
  tsConfigExtends,
@@ -7,7 +7,7 @@ export interface Schema {
7
7
  */
8
8
  appDir?: string;
9
9
  /**
10
- * The app identifier to use for transition.
10
+ * The application identifier to use for transition.
11
11
  */
12
12
  appId?: string;
13
13
  /**
@@ -16,7 +16,7 @@
16
16
  "appId": {
17
17
  "type": "string",
18
18
  "format": "html-selector",
19
- "description": "The app identifier to use for transition.",
19
+ "description": "The application identifier to use for transition.",
20
20
  "default": "serverApp"
21
21
  },
22
22
  "main": {
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -140,7 +144,6 @@ function getSourceNodes(sourceFile) {
140
144
  exports.getSourceNodes = getSourceNodes;
141
145
  function findNode(node, kind, text) {
142
146
  if (node.kind === kind && node.getText() === text) {
143
- // throw new Error(node.getText());
144
147
  return node;
145
148
  }
146
149
  let foundNode = null;
@@ -280,27 +283,26 @@ function getMetadataField(node, metadataField) {
280
283
  exports.getMetadataField = getMetadataField;
281
284
  function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbolName, importPath = null) {
282
285
  const nodes = getDecoratorMetadata(source, 'NgModule', '@angular/core');
283
- let node = nodes[0]; // eslint-disable-line @typescript-eslint/no-explicit-any
286
+ const node = nodes[0];
284
287
  // Find the decorator declaration.
285
- if (!node) {
288
+ if (!node || !ts.isObjectLiteralExpression(node)) {
286
289
  return [];
287
290
  }
288
291
  // Get all the children property assignment of object literals.
289
292
  const matchingProperties = getMetadataField(node, metadataField);
290
293
  if (matchingProperties.length == 0) {
291
294
  // We haven't found the field in the metadata declaration. Insert a new field.
292
- const expr = node;
293
295
  let position;
294
296
  let toInsert;
295
- if (expr.properties.length == 0) {
296
- position = expr.getEnd() - 1;
297
+ if (node.properties.length == 0) {
298
+ position = node.getEnd() - 1;
297
299
  toInsert = `\n ${metadataField}: [\n${core_1.tags.indentBy(4) `${symbolName}`}\n ]\n`;
298
300
  }
299
301
  else {
300
- node = expr.properties[expr.properties.length - 1];
301
- position = node.getEnd();
302
+ const childNode = node.properties[node.properties.length - 1];
303
+ position = childNode.getEnd();
302
304
  // Get the indentation of the last element, if any.
303
- const text = node.getFullText(source);
305
+ const text = childNode.getFullText(source);
304
306
  const matches = text.match(/^(\r?\n)(\s*)/);
305
307
  if (matches) {
306
308
  toInsert =
@@ -323,35 +325,33 @@ function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbol
323
325
  }
324
326
  const assignment = matchingProperties[0];
325
327
  // If it's not an array, nothing we can do really.
326
- if (assignment.initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression) {
328
+ if (!ts.isPropertyAssignment(assignment) ||
329
+ !ts.isArrayLiteralExpression(assignment.initializer)) {
327
330
  return [];
328
331
  }
329
- const arrLiteral = assignment.initializer;
330
- if (arrLiteral.elements.length == 0) {
331
- // Forward the property.
332
- node = arrLiteral;
333
- }
334
- else {
335
- node = arrLiteral.elements;
336
- }
337
- if (Array.isArray(node)) {
338
- const nodeArray = node;
339
- const symbolsArray = nodeArray.map((node) => core_1.tags.oneLine `${node.getText()}`);
332
+ let expresssion;
333
+ const assignmentInit = assignment.initializer;
334
+ const elements = assignmentInit.elements;
335
+ if (elements.length) {
336
+ const symbolsArray = elements.map((node) => core_1.tags.oneLine `${node.getText()}`);
340
337
  if (symbolsArray.includes(core_1.tags.oneLine `${symbolName}`)) {
341
338
  return [];
342
339
  }
343
- node = node[node.length - 1];
340
+ expresssion = elements[elements.length - 1];
341
+ }
342
+ else {
343
+ expresssion = assignmentInit;
344
344
  }
345
345
  let toInsert;
346
- let position = node.getEnd();
347
- if (node.kind == ts.SyntaxKind.ArrayLiteralExpression) {
346
+ let position = expresssion.getEnd();
347
+ if (ts.isArrayLiteralExpression(expresssion)) {
348
348
  // We found the field but it's empty. Insert it just before the `]`.
349
349
  position--;
350
350
  toInsert = `\n${core_1.tags.indentBy(4) `${symbolName}`}\n `;
351
351
  }
352
352
  else {
353
353
  // Get the indentation of the last element, if any.
354
- const text = node.getFullText(source);
354
+ const text = expresssion.getFullText(source);
355
355
  const matches = text.match(/^(\r?\n)(\s*)/);
356
356
  if (matches) {
357
357
  toInsert = `,${matches[1]}${core_1.tags.indentBy(matches[2].length) `${symbolName}`}`;
@@ -466,6 +466,9 @@ exports.getEnvironmentExportName = getEnvironmentExportName;
466
466
  function getRouterModuleDeclaration(source) {
467
467
  const result = getDecoratorMetadata(source, 'NgModule', '@angular/core');
468
468
  const node = result[0];
469
+ if (!node || !ts.isObjectLiteralExpression(node)) {
470
+ return undefined;
471
+ }
469
472
  const matchingProperties = getMetadataField(node, 'imports');
470
473
  if (!matchingProperties) {
471
474
  return;
@@ -486,7 +489,8 @@ exports.getRouterModuleDeclaration = getRouterModuleDeclaration;
486
489
  function addRouteDeclarationToModule(source, fileToAdd, routeLiteral) {
487
490
  const routerModuleExpr = getRouterModuleDeclaration(source);
488
491
  if (!routerModuleExpr) {
489
- throw new Error(`Couldn't find a route declaration in ${fileToAdd}.`);
492
+ throw new Error(`Couldn't find a route declaration in ${fileToAdd}.\n` +
493
+ `Use the '--module' option to specify a different routing module.`);
490
494
  }
491
495
  const scopeConfigMethodArgs = routerModuleExpr.arguments;
492
496
  if (!scopeConfigMethodArgs.length) {
@@ -15,6 +15,7 @@ export interface ModuleOptions {
15
15
  skipImport?: boolean;
16
16
  moduleExt?: string;
17
17
  routingModuleExt?: string;
18
+ standalone?: boolean;
18
19
  }
19
20
  export declare const MODULE_EXT = ".module.ts";
20
21
  export declare const ROUTING_MODULE_EXT = "-routing.module.ts";
@@ -15,8 +15,7 @@ exports.ROUTING_MODULE_EXT = '-routing.module.ts';
15
15
  * Find the module referred by a set of options passed to the schematics.
16
16
  */
17
17
  function findModuleFromOptions(host, options) {
18
- // eslint-disable-next-line no-prototype-builtins
19
- if (options.hasOwnProperty('skipImport') && options.skipImport) {
18
+ if (options.standalone || options.skipImport) {
20
19
  return undefined;
21
20
  }
22
21
  const moduleExt = options.moduleExt || exports.MODULE_EXT;
@@ -38,11 +37,7 @@ function findModuleFromOptions(host, options) {
38
37
  }
39
38
  const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length);
40
39
  for (const c of candidatesDirs) {
41
- const candidateFiles = [
42
- '',
43
- `${moduleBaseName}.ts`,
44
- `${moduleBaseName}${moduleExt}`,
45
- ].map((x) => (0, core_1.join)(c, x));
40
+ const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map((x) => (0, core_1.join)(c, x));
46
41
  for (const sc of candidateFiles) {
47
42
  if (host.exists(sc)) {
48
43
  return (0, core_1.normalize)(sc);
@@ -68,7 +63,7 @@ function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingMo
68
63
  return (0, core_1.join)(dir.path, filteredMatches[0]);
69
64
  }
70
65
  else if (filteredMatches.length > 1) {
71
- throw new Error('More than one module matches. Use the skip-import option to skip importing ' +
66
+ throw new Error(`More than one module matches. Use the '--skip-import' option to skip importing ` +
72
67
  'the component into the closest module or use the module option to specify a module.');
73
68
  }
74
69
  dir = dir.parent;
@@ -76,8 +71,8 @@ function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingMo
76
71
  const errorMsg = foundRoutingModule
77
72
  ? 'Could not find a non Routing NgModule.' +
78
73
  `\nModules with suffix '${routingModuleExt}' are strictly reserved for routing.` +
79
- '\nUse the skip-import option to skip importing in NgModule.'
80
- : 'Could not find an NgModule. Use the skip-import option to skip importing in NgModule.';
74
+ `\nUse the '--skip-import' option to skip importing in NgModule.`
75
+ : `Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule.`;
81
76
  throw new Error(errorMsg);
82
77
  }
83
78
  exports.findModule = findModule;
@@ -8,7 +8,6 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.generateFromFiles = void 0;
11
- const core_1 = require("@angular-devkit/core");
12
11
  const schematics_1 = require("@angular-devkit/schematics");
13
12
  const parse_name_1 = require("./parse-name");
14
13
  const workspace_1 = require("./workspace");
@@ -24,11 +23,11 @@ function generateFromFiles(options, extraTemplateValues = {}) {
24
23
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
25
24
  options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
26
25
  (0, schematics_1.applyTemplates)({
27
- ...core_1.strings,
26
+ ...schematics_1.strings,
28
27
  ...options,
29
28
  ...extraTemplateValues,
30
29
  }),
31
- (0, schematics_1.move)(parsedPath.path + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name))),
30
+ (0, schematics_1.move)(parsedPath.path + (options.flat ? '' : '/' + schematics_1.strings.dasherize(options.name))),
32
31
  ]);
33
32
  return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
34
33
  };
@@ -14,13 +14,7 @@ class JSONFile {
14
14
  constructor(host, path) {
15
15
  this.host = host;
16
16
  this.path = path;
17
- const buffer = this.host.read(this.path);
18
- if (buffer) {
19
- this.content = buffer.toString();
20
- }
21
- else {
22
- throw new Error(`Could not read '${path}'.`);
23
- }
17
+ this.content = this.host.readText(this.path);
24
18
  }
25
19
  get JsonAst() {
26
20
  if (this._jsonAst) {
@@ -3,18 +3,18 @@
3
3
  "comment": "This file is needed so that depedencies are synced by Renovate.",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@types/jasmine": "~3.10.0",
7
- "@types/node": "^12.11.1",
8
- "jasmine-core": "~4.0.0",
6
+ "@types/jasmine": "~4.0.0",
7
+ "@types/node": "^14.15.0",
8
+ "jasmine-core": "~4.1.0",
9
9
  "karma-chrome-launcher": "~3.1.0",
10
- "karma-coverage": "~2.1.0",
10
+ "karma-coverage": "~2.2.0",
11
11
  "karma-jasmine-html-reporter": "~1.7.0",
12
- "karma-jasmine": "~4.0.0",
12
+ "karma-jasmine": "~5.0.0",
13
13
  "karma": "~6.3.0",
14
- "ng-packagr": "^13.0.0",
14
+ "ng-packagr": "^14.0.0-next.2",
15
15
  "rxjs": "~7.5.0",
16
16
  "tslib": "^2.3.0",
17
- "typescript": "~4.5.2",
17
+ "typescript": "~4.6.2",
18
18
  "zone.js": "~0.11.4"
19
19
  }
20
20
  }
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -33,11 +37,7 @@ const path_1 = require("path");
33
37
  const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
34
38
  const ast_utils_1 = require("../utility/ast-utils");
35
39
  function findBootstrapModuleCall(host, mainPath) {
36
- const mainBuffer = host.read(mainPath);
37
- if (!mainBuffer) {
38
- throw new schematics_1.SchematicsException(`Main file (${mainPath}) not found`);
39
- }
40
- const mainText = mainBuffer.toString('utf-8');
40
+ const mainText = host.readText(mainPath);
41
41
  const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
42
42
  const allNodes = (0, ast_utils_1.getSourceNodes)(source);
43
43
  let bootstrapCall = null;
@@ -66,11 +66,7 @@ function findBootstrapModulePath(host, mainPath) {
66
66
  throw new schematics_1.SchematicsException('Bootstrap call not found');
67
67
  }
68
68
  const bootstrapModule = bootstrapCall.arguments[0];
69
- const mainBuffer = host.read(mainPath);
70
- if (!mainBuffer) {
71
- throw new schematics_1.SchematicsException(`Client app main file (${mainPath}) not found`);
72
- }
73
- const mainText = mainBuffer.toString('utf-8');
69
+ const mainText = host.readText(mainPath);
74
70
  const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
75
71
  const allNodes = (0, ast_utils_1.getSourceNodes)(source);
76
72
  const bootstrapModuleRelativePath = allNodes
@@ -8,7 +8,6 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.parseName = void 0;
11
- // import { relative, Path } from "../../../angular_devkit/core/src/virtual-fs";
12
11
  const core_1 = require("@angular-devkit/core");
13
12
  function parseName(path, name) {
14
13
  const nameWithoutPath = (0, core_1.basename)((0, core_1.normalize)(name));
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -8,15 +8,13 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.validateHtmlSelector = exports.htmlSelectorRe = void 0;
11
- const core_1 = require("@angular-devkit/core");
12
11
  const schematics_1 = require("@angular-devkit/schematics");
13
12
  // Must start with a letter, and must contain only alphanumeric characters or dashes.
14
13
  // When adding a dash the segment after the dash must also start with a letter.
15
14
  exports.htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*(:?-[a-zA-Z][.0-9a-zA-Z]*)*$/;
16
15
  function validateHtmlSelector(selector) {
17
16
  if (selector && !exports.htmlSelectorRe.test(selector)) {
18
- throw new schematics_1.SchematicsException(core_1.tags.oneLine `Selector (${selector})
19
- is invalid.`);
17
+ throw new schematics_1.SchematicsException(`Selector (${selector}) is invalid.`);
20
18
  }
21
19
  }
22
20
  exports.validateHtmlSelector = validateHtmlSelector;
@@ -110,12 +110,15 @@ export declare type TestBuilderTarget = BuilderTarget<Builders.Karma, TestBuilde
110
110
  export declare type ServeBuilderTarget = BuilderTarget<Builders.DevServer, ServeBuilderOptions>;
111
111
  export declare type ExtractI18nBuilderTarget = BuilderTarget<Builders.ExtractI18n, ExtractI18nOptions>;
112
112
  export declare type E2EBuilderTarget = BuilderTarget<Builders.Protractor, E2EOptions>;
113
+ interface WorkspaceCLISchema {
114
+ warnings?: Record<string, boolean>;
115
+ schematicCollections?: string[];
116
+ defaultCollection?: string;
117
+ }
113
118
  export interface WorkspaceSchema {
114
119
  version: 1;
115
120
  defaultProject?: string;
116
- cli?: {
117
- warnings?: Record<string, boolean>;
118
- };
121
+ cli?: WorkspaceCLISchema;
119
122
  projects: {
120
123
  [key: string]: WorkspaceProject<ProjectType.Application | ProjectType.Library>;
121
124
  };
@@ -128,9 +131,7 @@ export interface WorkspaceProject<TProjectType extends ProjectType = ProjectType
128
131
  root: string;
129
132
  sourceRoot: string;
130
133
  prefix: string;
131
- cli?: {
132
- warnings?: Record<string, boolean>;
133
- };
134
+ cli?: WorkspaceCLISchema;
134
135
  /**
135
136
  * Tool options.
136
137
  */
@@ -150,3 +151,4 @@ export interface WorkspaceTargets<TProjectType extends ProjectType = ProjectType
150
151
  'extract-i18n'?: ExtractI18nBuilderTarget;
151
152
  [key: string]: any;
152
153
  }
154
+ export {};
@@ -14,11 +14,7 @@ const workspace_models_1 = require("./workspace-models");
14
14
  function createHost(tree) {
15
15
  return {
16
16
  async readFile(path) {
17
- const data = tree.read(path);
18
- if (!data) {
19
- throw new Error('File not found.');
20
- }
21
- return core_1.virtualFs.fileBufferToString(data);
17
+ return tree.readText(path);
22
18
  },
23
19
  async writeFile(path, data) {
24
20
  return tree.overwrite(path, data);
@@ -46,7 +46,7 @@ function addSnippet(options) {
46
46
  }
47
47
  `;
48
48
  // Append the worker creation snippet.
49
- const originalContent = host.read(siblingModulePath);
49
+ const originalContent = host.readText(siblingModulePath);
50
50
  host.overwrite(siblingModulePath, originalContent + '\n' + workerCreationSnippet);
51
51
  return host;
52
52
  };
@@ -72,7 +72,7 @@ function default_1(options) {
72
72
  options.name = parsedPath.name;
73
73
  options.path = parsedPath.path;
74
74
  const templateSourceWorkerCode = (0, schematics_1.apply)((0, schematics_1.url)('./files/worker'), [
75
- (0, schematics_1.applyTemplates)({ ...options, ...core_1.strings }),
75
+ (0, schematics_1.applyTemplates)({ ...options, ...schematics_1.strings }),
76
76
  (0, schematics_1.move)(parsedPath.path),
77
77
  ]);
78
78
  const root = project.root || '';
@@ -4,7 +4,7 @@ This project was generated with [Angular CLI](https://github.com/angular/angular
4
4
 
5
5
  ## Development server
6
6
 
7
- Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
7
+ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8
8
 
9
9
  ## Code scaffolding
10
10
 
@@ -25,8 +25,7 @@
25
25
  "devDependencies": {
26
26
  "@angular/cli": "<%= '~' + version %>",
27
27
  "@angular/compiler-cli": "<%= latestVersions.Angular %>",<% if (!minimal) { %>
28
- "@types/jasmine": "<%= latestVersions['@types/jasmine'] %>",<% } %>
29
- "@types/node": "<%= latestVersions['@types/node'] %>",<% if (!minimal) { %>
28
+ "@types/jasmine": "<%= latestVersions['@types/jasmine'] %>",
30
29
  "jasmine-core": "<%= latestVersions['jasmine-core'] %>",
31
30
  "karma": "<%= latestVersions['karma'] %>",
32
31
  "karma-chrome-launcher": "<%= latestVersions['karma-chrome-launcher'] %>",
@@ -7,14 +7,13 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
10
  const schematics_1 = require("@angular-devkit/schematics");
12
11
  const latest_versions_1 = require("../utility/latest-versions");
13
12
  function default_1(options) {
14
13
  return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
15
14
  options.minimal ? (0, schematics_1.filter)((path) => !path.endsWith('editorconfig.template')) : (0, schematics_1.noop)(),
16
15
  (0, schematics_1.applyTemplates)({
17
- utils: core_1.strings,
16
+ utils: schematics_1.strings,
18
17
  ...options,
19
18
  'dot': '.',
20
19
  latestVersions: latest_versions_1.latestVersions,