@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.
- package/README.md +20 -20
- package/app-shell/app-shell-long.md +2 -2
- package/app-shell/index.d.ts +7 -0
- package/app-shell/index.js +17 -19
- package/app-shell/schema.d.ts +4 -4
- package/app-shell/schema.json +2 -4
- package/application/index.d.ts +7 -0
- package/application/index.js +46 -47
- package/application/other-files/app.component.html.template +0 -11
- package/application/schema.json +15 -13
- package/class/index.d.ts +7 -0
- package/class/index.js +9 -9
- package/class/schema.json +1 -3
- package/collection.json +13 -13
- package/component/index.d.ts +7 -0
- package/component/index.js +23 -20
- package/component/schema.json +3 -10
- package/directive/index.d.ts +7 -0
- package/directive/index.js +13 -13
- package/directive/schema.json +1 -3
- package/e2e/e2e-long.md +1 -1
- package/e2e/index.d.ts +7 -0
- package/e2e/index.js +20 -8
- package/e2e/schema.json +1 -3
- package/enum/files/{__name@dasherize__.enum.ts.template → __name@dasherize____type__.ts.template} +0 -0
- package/enum/index.d.ts +7 -0
- package/enum/index.js +8 -7
- package/enum/schema.d.ts +4 -0
- package/enum/schema.json +5 -3
- package/guard/files/__name@dasherize__.guard.ts.template +1 -1
- package/guard/index.d.ts +7 -0
- package/guard/index.js +20 -12
- package/guard/schema.json +3 -12
- package/interceptor/index.d.ts +7 -0
- package/interceptor/index.js +4 -4
- package/interface/index.d.ts +7 -0
- package/interface/index.js +3 -3
- package/interface/schema.json +1 -3
- package/library/index.d.ts +7 -0
- package/library/index.js +4 -4
- package/library/library-long.md +1 -1
- package/migrations/update-10/add-deprecation-rule-tslint.d.ts +7 -0
- package/migrations/update-10/add-deprecation-rule-tslint.js +8 -1
- package/migrations/update-10/remove-es5-browser-support.d.ts +1 -1
- package/migrations/update-10/remove-es5-browser-support.js +5 -9
- package/migrations/update-10/remove-solution-style-tsconfig.d.ts +7 -0
- package/migrations/update-10/remove-solution-style-tsconfig.js +4 -3
- package/migrations/update-10/rename-browserslist-config.d.ts +7 -0
- package/migrations/update-10/rename-browserslist-config.js +3 -3
- package/migrations/update-10/update-angular-config.d.ts +1 -1
- package/migrations/update-10/update-angular-config.js +2 -2
- package/migrations/update-10/update-dependencies.d.ts +1 -1
- package/migrations/update-10/update-dependencies.js +7 -0
- package/migrations/update-10/update-libraries-tslib.d.ts +1 -1
- package/migrations/update-10/update-libraries-tslib.js +1 -1
- package/migrations/update-10/update-module-and-target-compiler-options.d.ts +7 -0
- package/migrations/update-10/update-module-and-target-compiler-options.js +11 -12
- package/migrations/update-10/update-tslint.d.ts +7 -0
- package/migrations/update-10/update-tslint.js +13 -8
- package/migrations/update-11/add-declaration-map-compiler-option.d.ts +1 -1
- package/migrations/update-11/add-declaration-map-compiler-option.js +1 -1
- package/migrations/update-11/replace-ng-packagr-builder.d.ts +1 -1
- package/migrations/update-11/replace-ng-packagr-builder.js +3 -3
- package/migrations/update-11/update-angular-config.d.ts +1 -1
- package/migrations/update-11/update-angular-config.js +3 -3
- package/migrations/update-11/update-dependencies.d.ts +1 -1
- package/migrations/update-11/update-dependencies.js +7 -0
- package/migrations/update-12/production-default-config.d.ts +1 -1
- package/migrations/update-12/production-default-config.js +4 -3
- package/migrations/update-12/remove-emit-decorator-metadata.d.ts +7 -0
- package/migrations/update-12/remove-emit-decorator-metadata.js +15 -3
- package/migrations/update-12/update-angular-config.d.ts +1 -1
- package/migrations/update-12/update-angular-config.js +6 -5
- package/migrations/update-12/update-lazy-module-paths.d.ts +1 -1
- package/migrations/update-12/update-lazy-module-paths.js +9 -4
- package/migrations/update-12/update-web-workers.d.ts +1 -1
- package/migrations/update-12/update-web-workers.js +7 -0
- package/migrations/update-12/update-zonejs.d.ts +7 -0
- package/migrations/update-12/update-zonejs.js +3 -4
- package/migrations/update-9/add-tslib.d.ts +1 -1
- package/migrations/update-9/add-tslib.js +8 -1
- package/migrations/update-9/index.d.ts +1 -1
- package/migrations/update-9/index.js +2 -2
- package/migrations/update-9/ivy-libraries.d.ts +1 -1
- package/migrations/update-9/ivy-libraries.js +2 -2
- package/migrations/update-9/ngsw-config.d.ts +1 -1
- package/migrations/update-9/ngsw-config.js +7 -0
- package/migrations/update-9/remove-tsickle.d.ts +1 -1
- package/migrations/update-9/remove-tsickle.js +7 -0
- package/migrations/update-9/schematic-options.d.ts +7 -0
- package/migrations/update-9/schematic-options.js +3 -3
- package/migrations/update-9/update-app-tsconfigs.d.ts +7 -0
- package/migrations/update-9/update-app-tsconfigs.js +3 -3
- package/migrations/update-9/update-dependencies.d.ts +1 -1
- package/migrations/update-9/update-dependencies.js +7 -0
- package/migrations/update-9/update-i18n.d.ts +7 -0
- package/migrations/update-9/update-i18n.js +9 -4
- package/migrations/update-9/update-server-main-file.d.ts +1 -1
- package/migrations/update-9/update-server-main-file.js +12 -5
- package/migrations/update-9/update-workspace-config.d.ts +7 -0
- package/migrations/update-9/update-workspace-config.js +7 -0
- package/migrations/update-9/utils.d.ts +7 -0
- package/migrations/update-9/utils.js +3 -3
- package/module/index.d.ts +7 -0
- package/module/index.js +14 -16
- package/module/schema.json +2 -4
- package/ng-new/index.d.ts +1 -1
- package/ng-new/index.js +3 -5
- package/package.json +4 -4
- package/pipe/index.d.ts +7 -0
- package/pipe/index.js +8 -8
- package/pipe/schema.json +1 -3
- package/resolver/index.d.ts +7 -0
- package/resolver/index.js +9 -11
- package/resolver/schema.json +1 -3
- package/service/index.d.ts +7 -0
- package/service/index.js +4 -4
- package/service-worker/index.d.ts +7 -0
- package/service-worker/index.js +2 -2
- package/service-worker/schema.d.ts +13 -13
- package/service-worker/schema.json +1 -3
- package/universal/index.d.ts +7 -0
- package/universal/index.js +15 -14
- package/universal/schema.d.ts +4 -4
- package/universal/schema.json +6 -5
- package/utility/ast-utils.d.ts +7 -0
- package/utility/ast-utils.js +40 -45
- package/utility/change.d.ts +1 -1
- package/utility/change.js +13 -4
- package/utility/dependencies.d.ts +1 -1
- package/utility/dependencies.js +7 -0
- package/utility/find-module.d.ts +1 -1
- package/utility/find-module.js +14 -14
- package/utility/json-file.d.ts +1 -1
- package/utility/json-file.js +2 -2
- package/utility/latest-versions.d.ts +1 -1
- package/utility/latest-versions.js +3 -3
- package/utility/lint-fix.d.ts +1 -1
- package/utility/lint-fix.js +4 -4
- package/utility/ng-ast-utils.d.ts +7 -0
- package/utility/ng-ast-utils.js +8 -7
- package/utility/parse-name.d.ts +1 -1
- package/utility/parse-name.js +3 -3
- package/utility/paths.d.ts +1 -1
- package/utility/paths.js +1 -1
- package/utility/project-targets.d.ts +1 -1
- package/utility/project-targets.js +1 -1
- package/utility/test/create-app-module.d.ts +1 -1
- package/utility/test/create-app-module.js +7 -0
- package/utility/test/get-file-content.d.ts +1 -1
- package/utility/test/get-file-content.js +7 -0
- package/utility/test/index.d.ts +1 -1
- package/utility/test/index.js +7 -7
- package/utility/validation.d.ts +7 -0
- package/utility/validation.js +5 -5
- package/utility/workspace-models.d.ts +3 -3
- package/utility/workspace-models.js +3 -3
- package/utility/workspace.d.ts +1 -1
- package/utility/workspace.js +3 -3
- package/web-worker/index.d.ts +7 -0
- package/web-worker/index.js +8 -6
- package/web-worker/schema.json +1 -4
- package/workspace/files/package.json.template +2 -5
- package/workspace/index.d.ts +7 -0
- package/workspace/index.js +3 -3
- package/workspace/schema.json +1 -4
package/component/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
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 =
|
|
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
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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([
|
package/component/schema.json
CHANGED
|
@@ -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
|
}
|
package/directive/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 DirectiveOptions } from './schema';
|
|
3
10
|
export default function (options: DirectiveOptions): Rule;
|
package/directive/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
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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),
|
package/directive/schema.json
CHANGED
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
|
|
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 =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
package/enum/files/{__name@dasherize__.enum.ts.template → __name@dasherize____type__.ts.template}
RENAMED
|
File without changes
|
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
|
|
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
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 %>
|
|
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
|
|
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
|
-
|
|
28
|
-
|
|
27
|
+
const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
|
|
28
|
+
const routerNamedImports = [...options.implements, 'UrlTree'];
|
|
29
29
|
if (options.implements.includes(schema_1.Implement.CanLoad)) {
|
|
30
|
-
|
|
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
|
}
|
package/interceptor/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 InterceptorOptions } from './schema';
|
|
3
10
|
export default function (options: InterceptorOptions): Rule;
|
package/interceptor/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
|
|
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),
|
package/interface/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 InterfaceOptions } from './schema';
|
|
3
10
|
export default function (options: InterfaceOptions): Rule;
|
package/interface/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
|
|
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 =
|
|
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,
|
package/interface/schema.json
CHANGED
package/library/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 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
|
|
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
|
}
|
package/library/library-long.md
CHANGED
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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]);
|