@schematics/angular 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 (166) hide show
  1. package/README.md +20 -20
  2. package/app-shell/app-shell-long.md +2 -2
  3. package/app-shell/index.d.ts +7 -0
  4. package/app-shell/index.js +17 -19
  5. package/app-shell/schema.d.ts +4 -4
  6. package/app-shell/schema.json +2 -4
  7. package/application/index.d.ts +7 -0
  8. package/application/index.js +46 -47
  9. package/application/other-files/app.component.html.template +0 -11
  10. package/application/schema.json +15 -13
  11. package/class/index.d.ts +7 -0
  12. package/class/index.js +9 -9
  13. package/class/schema.json +1 -3
  14. package/collection.json +13 -13
  15. package/component/index.d.ts +7 -0
  16. package/component/index.js +23 -20
  17. package/component/schema.json +3 -10
  18. package/directive/index.d.ts +7 -0
  19. package/directive/index.js +13 -13
  20. package/directive/schema.json +1 -3
  21. package/e2e/e2e-long.md +1 -1
  22. package/e2e/index.d.ts +7 -0
  23. package/e2e/index.js +20 -8
  24. package/e2e/schema.json +1 -3
  25. package/enum/files/{__name@dasherize__.enum.ts.template → __name@dasherize____type__.ts.template} +0 -0
  26. package/enum/index.d.ts +7 -0
  27. package/enum/index.js +8 -7
  28. package/enum/schema.d.ts +4 -0
  29. package/enum/schema.json +5 -3
  30. package/guard/files/__name@dasherize__.guard.ts.template +1 -1
  31. package/guard/index.d.ts +7 -0
  32. package/guard/index.js +20 -12
  33. package/guard/schema.json +3 -12
  34. package/interceptor/index.d.ts +7 -0
  35. package/interceptor/index.js +4 -4
  36. package/interface/index.d.ts +7 -0
  37. package/interface/index.js +3 -3
  38. package/interface/schema.json +1 -3
  39. package/library/index.d.ts +7 -0
  40. package/library/index.js +4 -4
  41. package/library/library-long.md +1 -1
  42. package/migrations/update-10/add-deprecation-rule-tslint.d.ts +7 -0
  43. package/migrations/update-10/add-deprecation-rule-tslint.js +8 -1
  44. package/migrations/update-10/remove-es5-browser-support.d.ts +1 -1
  45. package/migrations/update-10/remove-es5-browser-support.js +5 -9
  46. package/migrations/update-10/remove-solution-style-tsconfig.d.ts +7 -0
  47. package/migrations/update-10/remove-solution-style-tsconfig.js +4 -3
  48. package/migrations/update-10/rename-browserslist-config.d.ts +7 -0
  49. package/migrations/update-10/rename-browserslist-config.js +3 -3
  50. package/migrations/update-10/update-angular-config.d.ts +1 -1
  51. package/migrations/update-10/update-angular-config.js +2 -2
  52. package/migrations/update-10/update-dependencies.d.ts +1 -1
  53. package/migrations/update-10/update-dependencies.js +7 -0
  54. package/migrations/update-10/update-libraries-tslib.d.ts +1 -1
  55. package/migrations/update-10/update-libraries-tslib.js +1 -1
  56. package/migrations/update-10/update-module-and-target-compiler-options.d.ts +7 -0
  57. package/migrations/update-10/update-module-and-target-compiler-options.js +11 -12
  58. package/migrations/update-10/update-tslint.d.ts +7 -0
  59. package/migrations/update-10/update-tslint.js +13 -8
  60. package/migrations/update-11/add-declaration-map-compiler-option.d.ts +1 -1
  61. package/migrations/update-11/add-declaration-map-compiler-option.js +1 -1
  62. package/migrations/update-11/replace-ng-packagr-builder.d.ts +1 -1
  63. package/migrations/update-11/replace-ng-packagr-builder.js +3 -3
  64. package/migrations/update-11/update-angular-config.d.ts +1 -1
  65. package/migrations/update-11/update-angular-config.js +3 -3
  66. package/migrations/update-11/update-dependencies.d.ts +1 -1
  67. package/migrations/update-11/update-dependencies.js +7 -0
  68. package/migrations/update-12/production-default-config.d.ts +1 -1
  69. package/migrations/update-12/production-default-config.js +4 -3
  70. package/migrations/update-12/remove-emit-decorator-metadata.d.ts +7 -0
  71. package/migrations/update-12/remove-emit-decorator-metadata.js +15 -3
  72. package/migrations/update-12/update-angular-config.d.ts +1 -1
  73. package/migrations/update-12/update-angular-config.js +6 -5
  74. package/migrations/update-12/update-lazy-module-paths.d.ts +1 -1
  75. package/migrations/update-12/update-lazy-module-paths.js +9 -4
  76. package/migrations/update-12/update-web-workers.d.ts +1 -1
  77. package/migrations/update-12/update-web-workers.js +7 -0
  78. package/migrations/update-12/update-zonejs.d.ts +7 -0
  79. package/migrations/update-12/update-zonejs.js +3 -4
  80. package/migrations/update-9/add-tslib.d.ts +1 -1
  81. package/migrations/update-9/add-tslib.js +8 -1
  82. package/migrations/update-9/index.d.ts +1 -1
  83. package/migrations/update-9/index.js +2 -2
  84. package/migrations/update-9/ivy-libraries.d.ts +1 -1
  85. package/migrations/update-9/ivy-libraries.js +2 -2
  86. package/migrations/update-9/ngsw-config.d.ts +1 -1
  87. package/migrations/update-9/ngsw-config.js +7 -0
  88. package/migrations/update-9/remove-tsickle.d.ts +1 -1
  89. package/migrations/update-9/remove-tsickle.js +7 -0
  90. package/migrations/update-9/schematic-options.d.ts +7 -0
  91. package/migrations/update-9/schematic-options.js +3 -3
  92. package/migrations/update-9/update-app-tsconfigs.d.ts +7 -0
  93. package/migrations/update-9/update-app-tsconfigs.js +3 -3
  94. package/migrations/update-9/update-dependencies.d.ts +1 -1
  95. package/migrations/update-9/update-dependencies.js +7 -0
  96. package/migrations/update-9/update-i18n.d.ts +7 -0
  97. package/migrations/update-9/update-i18n.js +9 -4
  98. package/migrations/update-9/update-server-main-file.d.ts +1 -1
  99. package/migrations/update-9/update-server-main-file.js +12 -5
  100. package/migrations/update-9/update-workspace-config.d.ts +7 -0
  101. package/migrations/update-9/update-workspace-config.js +7 -0
  102. package/migrations/update-9/utils.d.ts +7 -0
  103. package/migrations/update-9/utils.js +3 -3
  104. package/module/index.d.ts +7 -0
  105. package/module/index.js +14 -16
  106. package/module/schema.json +2 -4
  107. package/ng-new/index.d.ts +1 -1
  108. package/ng-new/index.js +3 -5
  109. package/package.json +4 -4
  110. package/pipe/index.d.ts +7 -0
  111. package/pipe/index.js +8 -8
  112. package/pipe/schema.json +1 -3
  113. package/resolver/index.d.ts +7 -0
  114. package/resolver/index.js +9 -11
  115. package/resolver/schema.json +1 -3
  116. package/service/index.d.ts +7 -0
  117. package/service/index.js +4 -4
  118. package/service-worker/index.d.ts +7 -0
  119. package/service-worker/index.js +2 -2
  120. package/service-worker/schema.d.ts +13 -13
  121. package/service-worker/schema.json +1 -3
  122. package/universal/index.d.ts +7 -0
  123. package/universal/index.js +15 -14
  124. package/universal/schema.d.ts +4 -4
  125. package/universal/schema.json +6 -5
  126. package/utility/ast-utils.d.ts +7 -0
  127. package/utility/ast-utils.js +40 -45
  128. package/utility/change.d.ts +1 -1
  129. package/utility/change.js +13 -4
  130. package/utility/dependencies.d.ts +1 -1
  131. package/utility/dependencies.js +7 -0
  132. package/utility/find-module.d.ts +1 -1
  133. package/utility/find-module.js +14 -14
  134. package/utility/json-file.d.ts +1 -1
  135. package/utility/json-file.js +2 -2
  136. package/utility/latest-versions.d.ts +1 -1
  137. package/utility/latest-versions.js +3 -3
  138. package/utility/lint-fix.d.ts +1 -1
  139. package/utility/lint-fix.js +4 -4
  140. package/utility/ng-ast-utils.d.ts +7 -0
  141. package/utility/ng-ast-utils.js +8 -7
  142. package/utility/parse-name.d.ts +1 -1
  143. package/utility/parse-name.js +3 -3
  144. package/utility/paths.d.ts +1 -1
  145. package/utility/paths.js +1 -1
  146. package/utility/project-targets.d.ts +1 -1
  147. package/utility/project-targets.js +1 -1
  148. package/utility/test/create-app-module.d.ts +1 -1
  149. package/utility/test/create-app-module.js +7 -0
  150. package/utility/test/get-file-content.d.ts +1 -1
  151. package/utility/test/get-file-content.js +7 -0
  152. package/utility/test/index.d.ts +1 -1
  153. package/utility/test/index.js +7 -7
  154. package/utility/validation.d.ts +7 -0
  155. package/utility/validation.js +5 -5
  156. package/utility/workspace-models.d.ts +3 -3
  157. package/utility/workspace-models.js +3 -3
  158. package/utility/workspace.d.ts +1 -1
  159. package/utility/workspace.js +3 -3
  160. package/web-worker/index.d.ts +7 -0
  161. package/web-worker/index.js +8 -6
  162. package/web-worker/schema.json +1 -4
  163. package/workspace/files/package.json.template +2 -5
  164. package/workspace/index.d.ts +7 -0
  165. package/workspace/index.js +3 -3
  166. package/workspace/schema.json +1 -4
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * @license
5
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
6
5
  *
7
6
  * Use of this source code is governed by an MIT-style license that can be
8
7
  * found in the LICENSE file at https://angular.io/license
9
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const ts = require("../third_party/github.com/Microsoft/TypeScript/lib/typescript");
@@ -33,11 +33,11 @@ function addDeclarationToNgModule(options) {
33
33
  options.type = options.type != null ? options.type : 'Component';
34
34
  const modulePath = options.module;
35
35
  const source = readIntoSourceFile(host, modulePath);
36
- const componentPath = `/${options.path}/`
37
- + (options.flat ? '' : core_1.strings.dasherize(options.name) + '/')
38
- + core_1.strings.dasherize(options.name)
39
- + (options.type ? '.' : '')
40
- + core_1.strings.dasherize(options.type);
36
+ const componentPath = `/${options.path}/` +
37
+ (options.flat ? '' : core_1.strings.dasherize(options.name) + '/') +
38
+ core_1.strings.dasherize(options.name) +
39
+ (options.type ? '.' : '') +
40
+ core_1.strings.dasherize(options.type);
41
41
  const relativePath = find_module_1.buildRelativePath(modulePath, componentPath);
42
42
  const classifiedName = core_1.strings.classify(options.name) + core_1.strings.classify(options.type);
43
43
  const declarationChanges = ast_utils_1.addDeclarationToModule(source, modulePath, classifiedName, relativePath);
@@ -84,26 +84,29 @@ function default_1(options) {
84
84
  const parsedPath = parse_name_1.parseName(options.path, options.name);
85
85
  options.name = parsedPath.name;
86
86
  options.path = parsedPath.path;
87
- options.selector = options.selector || buildSelector(options, project && project.prefix || '');
87
+ options.selector =
88
+ options.selector || buildSelector(options, (project && project.prefix) || '');
88
89
  validation_1.validateName(options.name);
89
90
  validation_1.validateHtmlSelector(options.selector);
90
91
  const templateSource = schematics_1.apply(schematics_1.url('./files'), [
91
- options.skipTests ? schematics_1.filter(path => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
92
- options.inlineStyle ? schematics_1.filter(path => !path.endsWith('.__style__.template')) : schematics_1.noop(),
93
- options.inlineTemplate ? schematics_1.filter(path => !path.endsWith('.html.template')) : schematics_1.noop(),
92
+ options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
93
+ options.inlineStyle ? schematics_1.filter((path) => !path.endsWith('.__style__.template')) : schematics_1.noop(),
94
+ options.inlineTemplate ? schematics_1.filter((path) => !path.endsWith('.html.template')) : schematics_1.noop(),
94
95
  schematics_1.applyTemplates({
95
96
  ...core_1.strings,
96
- 'if-flat': (s) => options.flat ? '' : s,
97
+ 'if-flat': (s) => (options.flat ? '' : s),
97
98
  ...options,
98
99
  }),
99
- !options.type ? schematics_1.forEach((file => {
100
- return file.path.includes('..')
101
- ? {
102
- content: file.content,
103
- path: file.path.replace('..', '.'),
104
- }
105
- : file;
106
- })) : schematics_1.noop(),
100
+ !options.type
101
+ ? schematics_1.forEach(((file) => {
102
+ return file.path.includes('..')
103
+ ? {
104
+ content: file.content,
105
+ path: file.path.replace('..', '.'),
106
+ }
107
+ : file;
108
+ }))
109
+ : schematics_1.noop(),
107
110
  schematics_1.move(parsedPath.path),
108
111
  ]);
109
112
  return schematics_1.chain([
@@ -80,12 +80,7 @@
80
80
  "description": "The file extension or preprocessor to use for style files.",
81
81
  "type": "string",
82
82
  "default": "css",
83
- "enum": [
84
- "css",
85
- "scss",
86
- "sass",
87
- "less"
88
- ],
83
+ "enum": ["css", "scss", "sass", "less"],
89
84
  "x-user-analytics": 5
90
85
  },
91
86
  "type": {
@@ -120,7 +115,7 @@
120
115
  "default": false,
121
116
  "description": "Specifies if the component should have a selector or not."
122
117
  },
123
- "module": {
118
+ "module": {
124
119
  "type": "string",
125
120
  "description": "The declaring NgModule.",
126
121
  "alias": "m"
@@ -138,7 +133,5 @@
138
133
  "x-deprecated": "Use \"ng lint --fix\" directly instead."
139
134
  }
140
135
  },
141
- "required": [
142
- "name"
143
- ]
136
+ "required": ["name"]
144
137
  }
@@ -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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as DirectiveOptions } from './schema';
3
10
  export default function (options: DirectiveOptions): Rule;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
- * @license
5
- * Copyright Google Inc. All Rights Reserved.
6
- *
7
- * Use of this source code is governed by an MIT-style license that can be
8
- * found in the LICENSE file at https://angular.io/license
9
- */
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
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const ts = require("../third_party/github.com/Microsoft/TypeScript/lib/typescript");
@@ -29,10 +29,10 @@ function addDeclarationToNgModule(options) {
29
29
  }
30
30
  const sourceText = text.toString('utf-8');
31
31
  const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
32
- const directivePath = `/${options.path}/`
33
- + (options.flat ? '' : core_1.strings.dasherize(options.name) + '/')
34
- + core_1.strings.dasherize(options.name)
35
- + '.directive';
32
+ const directivePath = `/${options.path}/` +
33
+ (options.flat ? '' : core_1.strings.dasherize(options.name) + '/') +
34
+ core_1.strings.dasherize(options.name) +
35
+ '.directive';
36
36
  const relativePath = find_module_1.buildRelativePath(modulePath, directivePath);
37
37
  const classifiedName = core_1.strings.classify(`${options.name}Directive`);
38
38
  const declarationChanges = ast_utils_1.addDeclarationToModule(source, modulePath, classifiedName, relativePath);
@@ -90,10 +90,10 @@ function default_1(options) {
90
90
  options.selector = options.selector || buildSelector(options, project.prefix || '');
91
91
  validation_1.validateHtmlSelector(options.selector);
92
92
  const templateSource = schematics_1.apply(schematics_1.url('./files'), [
93
- options.skipTests ? schematics_1.filter(path => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
93
+ options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
94
94
  schematics_1.applyTemplates({
95
95
  ...core_1.strings,
96
- 'if-flat': (s) => options.flat ? '' : s,
96
+ 'if-flat': (s) => (options.flat ? '' : s),
97
97
  ...options,
98
98
  }),
99
99
  schematics_1.move(parsedPath.path),
@@ -82,7 +82,5 @@
82
82
  "x-deprecated": "Use \"ng lint --fix\" directly instead."
83
83
  }
84
84
  },
85
- "required": [
86
- "name"
87
- ]
85
+ "required": ["name"]
88
86
  }
package/e2e/e2e-long.md CHANGED
@@ -1,2 +1,2 @@
1
1
  The e2e tests are created in a separate app in the `projects` folder of the workspace,
2
- next to the project being tested.
2
+ next to the project being tested.
package/e2e/index.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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as E2eOptions } from './schema';
3
10
  export default function (options: E2eOptions): Rule;
package/e2e/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * @license
5
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
6
5
  *
7
6
  * Use of this source code is governed by an MIT-style license that can be
8
7
  * found in the LICENSE file at https://angular.io/license
9
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const dependencies_1 = require("../utility/dependencies");
@@ -15,7 +15,7 @@ const paths_1 = require("../utility/paths");
15
15
  const workspace_1 = require("../utility/workspace");
16
16
  const workspace_models_1 = require("../utility/workspace-models");
17
17
  function addScriptsToPackageJson() {
18
- return host => {
18
+ return (host) => {
19
19
  const pkgJson = new json_file_1.JSONFile(host, 'package.json');
20
20
  const e2eScriptPath = ['scripts', 'e2e'];
21
21
  if (!pkgJson.get(e2eScriptPath)) {
@@ -58,11 +58,23 @@ function default_1(options) {
58
58
  }),
59
59
  schematics_1.move(root),
60
60
  ])),
61
- host => dependencies_1.addPackageJsonDependency(host, {
62
- type: dependencies_1.NodeDependencyType.Dev,
63
- name: 'protractor',
64
- version: '~7.0.0',
65
- }),
61
+ (host) => [
62
+ {
63
+ type: dependencies_1.NodeDependencyType.Dev,
64
+ name: 'protractor',
65
+ version: '~7.0.0',
66
+ },
67
+ {
68
+ type: dependencies_1.NodeDependencyType.Dev,
69
+ name: 'jasmine-spec-reporter',
70
+ version: '~7.0.0',
71
+ },
72
+ {
73
+ type: dependencies_1.NodeDependencyType.Dev,
74
+ name: 'ts-node',
75
+ version: '~9.1.1',
76
+ },
77
+ ].forEach((dep) => dependencies_1.addPackageJsonDependency(host, dep)),
66
78
  addScriptsToPackageJson(),
67
79
  ]);
68
80
  };
package/e2e/schema.json CHANGED
@@ -17,7 +17,5 @@
17
17
  "type": "string"
18
18
  }
19
19
  },
20
- "required": [
21
- "relatedAppName"
22
- ]
20
+ "required": ["relatedAppName"]
23
21
  }
package/enum/index.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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as EnumOptions } from './schema';
3
10
  export default function (options: EnumOptions): Rule;
package/enum/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
- * @license
5
- * Copyright Google Inc. All Rights Reserved.
6
- *
7
- * Use of this source code is governed by an MIT-style license that can be
8
- * found in the LICENSE file at https://angular.io/license
9
- */
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
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const lint_fix_1 = require("../utility/lint-fix");
@@ -20,6 +20,7 @@ function default_1(options) {
20
20
  const parsedPath = parse_name_1.parseName(options.path, options.name);
21
21
  options.name = parsedPath.name;
22
22
  options.path = parsedPath.path;
23
+ options.type = options.type ? `.${options.type}` : '';
23
24
  const templateSource = schematics_1.apply(schematics_1.url('./files'), [
24
25
  schematics_1.applyTemplates({
25
26
  ...core_1.strings,
package/enum/schema.d.ts CHANGED
@@ -20,4 +20,8 @@ export interface Schema {
20
20
  * project for the workspace.
21
21
  */
22
22
  project?: string;
23
+ /**
24
+ * Adds a developer-defined type to the filename, in the format "name.type.ts".
25
+ */
26
+ type?: string;
23
27
  }
package/enum/schema.json CHANGED
@@ -28,6 +28,10 @@
28
28
  "$source": "projectName"
29
29
  }
30
30
  },
31
+ "type": {
32
+ "type": "string",
33
+ "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"."
34
+ },
31
35
  "lintFix": {
32
36
  "type": "boolean",
33
37
  "description": "Apply lint fixes after generating the enum.",
@@ -35,7 +39,5 @@
35
39
  "x-deprecated": "Use \"ng lint --fix\" directly instead."
36
40
  }
37
41
  },
38
- "required": [
39
- "name"
40
- ]
42
+ "required": ["name"]
41
43
  }
@@ -1,5 +1,5 @@
1
1
  import { Injectable } from '@angular/core';
2
- import { <%= implementationImports %>ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree } from '@angular/router';
2
+ import { <%= implementationImports %> } from '@angular/router';
3
3
  import { Observable } from 'rxjs';
4
4
 
5
5
  @Injectable({
package/guard/index.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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as GuardOptions } from './schema';
3
10
  export default function (options: GuardOptions): Rule;
package/guard/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
- * @license
5
- * Copyright Google Inc. All Rights Reserved.
6
- *
7
- * Use of this source code is governed by an MIT-style license that can be
8
- * found in the LICENSE file at https://angular.io/license
9
- */
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
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const lint_fix_1 = require("../utility/lint-fix");
@@ -22,18 +22,26 @@ function default_1(options) {
22
22
  throw new schematics_1.SchematicsException('Option "implements" is required.');
23
23
  }
24
24
  const implementations = options.implements
25
- .map(implement => implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement)
25
+ .map((implement) => (implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement))
26
26
  .join(', ');
27
- let implementationImports = `${options.implements.join(', ')}, `;
28
- // As long as we aren't in IE... ;)
27
+ const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
28
+ const routerNamedImports = [...options.implements, 'UrlTree'];
29
29
  if (options.implements.includes(schema_1.Implement.CanLoad)) {
30
- implementationImports = `${implementationImports}Route, UrlSegment, `;
30
+ routerNamedImports.push('Route', 'UrlSegment');
31
+ if (options.implements.length > 1) {
32
+ routerNamedImports.push(...commonRouterNameImports);
33
+ }
34
+ }
35
+ else {
36
+ routerNamedImports.push(...commonRouterNameImports);
31
37
  }
38
+ routerNamedImports.sort();
39
+ const implementationImports = routerNamedImports.join(', ');
32
40
  const parsedPath = parse_name_1.parseName(options.path, options.name);
33
41
  options.name = parsedPath.name;
34
42
  options.path = parsedPath.path;
35
43
  const templateSource = schematics_1.apply(schematics_1.url('./files'), [
36
- options.skipTests ? schematics_1.filter(path => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
44
+ options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
37
45
  schematics_1.applyTemplates({
38
46
  implementations,
39
47
  implementationImports,
package/guard/schema.json CHANGED
@@ -51,21 +51,12 @@
51
51
  "uniqueItems": true,
52
52
  "minItems": 1,
53
53
  "items": {
54
- "enum": [
55
- "CanActivate",
56
- "CanActivateChild",
57
- "CanDeactivate",
58
- "CanLoad"
59
- ],
54
+ "enum": ["CanActivate", "CanActivateChild", "CanDeactivate", "CanLoad"],
60
55
  "type": "string"
61
56
  },
62
- "default": [
63
- "CanActivate"
64
- ],
57
+ "default": ["CanActivate"],
65
58
  "x-prompt": "Which interfaces would you like to implement?"
66
59
  }
67
60
  },
68
- "required": [
69
- "name"
70
- ]
61
+ "required": ["name"]
71
62
  }
@@ -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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as InterceptorOptions } from './schema';
3
10
  export default function (options: InterceptorOptions): Rule;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * @license
5
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
6
5
  *
7
6
  * Use of this source code is governed by an MIT-style license that can be
8
7
  * found in the LICENSE file at https://angular.io/license
9
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const lint_fix_1 = require("../utility/lint-fix");
@@ -21,10 +21,10 @@ function default_1(options) {
21
21
  options.name = parsedPath.name;
22
22
  options.path = parsedPath.path;
23
23
  const templateSource = schematics_1.apply(schematics_1.url('./files'), [
24
- options.skipTests ? schematics_1.filter(path => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
24
+ options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
25
25
  schematics_1.applyTemplates({
26
26
  ...core_1.strings,
27
- 'if-flat': (s) => options.flat ? '' : s,
27
+ 'if-flat': (s) => (options.flat ? '' : s),
28
28
  ...options,
29
29
  }),
30
30
  schematics_1.move(parsedPath.path),
@@ -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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as InterfaceOptions } from './schema';
3
10
  export default function (options: InterfaceOptions): Rule;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * @license
5
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
6
5
  *
7
6
  * Use of this source code is governed by an MIT-style license that can be
8
7
  * found in the LICENSE file at https://angular.io/license
9
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const lint_fix_1 = require("../utility/lint-fix");
@@ -21,7 +21,7 @@ function default_1(options) {
21
21
  options.name = parsedPath.name;
22
22
  options.path = parsedPath.path;
23
23
  options.prefix = options.prefix ? options.prefix : '';
24
- options.type = !!options.type ? `.${options.type}` : '';
24
+ options.type = options.type ? `.${options.type}` : '';
25
25
  const templateSource = schematics_1.apply(schematics_1.url('./files'), [
26
26
  schematics_1.applyTemplates({
27
27
  ...core_1.strings,
@@ -48,7 +48,5 @@
48
48
  "x-deprecated": "Use \"ng lint --fix\" directly instead."
49
49
  }
50
50
  },
51
- "required": [
52
- "name"
53
- ]
51
+ "required": ["name"]
54
52
  }
@@ -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
  import { Rule } from '@angular-devkit/schematics';
2
9
  import { Schema as LibraryOptions } from './schema';
3
10
  export default function (options: LibraryOptions): Rule;
package/library/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * @license
5
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
6
5
  *
7
6
  * Use of this source code is governed by an MIT-style license that can be
8
7
  * found in the LICENSE file at https://angular.io/license
9
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const tasks_1 = require("@angular-devkit/schematics/tasks");
@@ -57,12 +57,12 @@ function addDependenciesToPackageJson() {
57
57
  name: 'typescript',
58
58
  version: latest_versions_1.latestVersions.TypeScript,
59
59
  },
60
- ].forEach(dependency => dependencies_1.addPackageJsonDependency(host, dependency));
60
+ ].forEach((dependency) => dependencies_1.addPackageJsonDependency(host, dependency));
61
61
  return host;
62
62
  };
63
63
  }
64
64
  function addLibToWorkspaceFile(options, projectRoot, projectName) {
65
- return workspace_1.updateWorkspace(workspace => {
65
+ return workspace_1.updateWorkspace((workspace) => {
66
66
  if (workspace.projects.size === 0) {
67
67
  workspace.extensions.defaultProject = projectName;
68
68
  }
@@ -2,4 +2,4 @@ A library is a type of project that does not run independently.
2
2
  The library skeleton created by this command is placed by default in the `/projects` folder, and has `type` of "library".
3
3
 
4
4
  You can build a new library using the `ng build` command, run unit tests for it using the `ng test` command,
5
- and lint it using the `ng lint` command.
5
+ and lint it using the `ng lint` command.
@@ -1,2 +1,9 @@
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
  import { Rule } from '@angular-devkit/schematics';
2
9
  export default function (): Rule;
@@ -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
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  const dependencies_1 = require("../../utility/dependencies");
4
11
  const json_file_1 = require("../../utility/json-file");
@@ -23,7 +30,7 @@ function default_1() {
23
30
  json = new json_file_1.JSONFile(tree, TSLINT_CONFIG_PATH);
24
31
  }
25
32
  catch {
26
- const config = ['tslint.js', 'tslint.yaml'].find(c => tree.exists(c));
33
+ const config = ['tslint.js', 'tslint.yaml'].find((c) => tree.exists(c));
27
34
  if (config) {
28
35
  logger.warn(`Expected a JSON configuration file but found "${config}".`);
29
36
  }
@@ -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
@@ -69,21 +69,17 @@ async function isES5SupportNeeded(projectRoot) {
69
69
  // n: feature is unavailable
70
70
  // a: feature is partially supported
71
71
  // x: feature is prefixed
72
- const criteria = [
73
- 'y',
74
- 'a',
75
- ];
72
+ const criteria = ['y', 'a'];
76
73
  try {
77
- // tslint:disable-next-line:no-implicit-dependencies
74
+ // eslint-disable-next-line import/no-extraneous-dependencies
78
75
  const browserslist = await Promise.resolve().then(() => require('browserslist'));
79
76
  const supportedBrowsers = browserslist(undefined, {
80
77
  path: core_1.getSystemPath(projectRoot),
81
78
  });
82
- // tslint:disable-next-line:no-implicit-dependencies
79
+ // eslint-disable-next-line import/no-extraneous-dependencies
83
80
  const { feature, features } = await Promise.resolve().then(() => require('caniuse-lite'));
84
81
  const data = feature(features['es6-module']);
85
- return supportedBrowsers
86
- .some(browser => {
82
+ return supportedBrowsers.some((browser) => {
87
83
  const [agentId, version] = browser.split(' ');
88
84
  const browserData = data.stats[agentId];
89
85
  const featureStatus = (browserData && browserData[version]);