@schematics/angular 14.0.0-next.5 → 14.0.0-next.8
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/app-shell/index.js +6 -2
- package/app-shell/schema.d.ts +3 -3
- package/app-shell/schema.json +3 -3
- package/application/index.js +1 -4
- package/application/schema.d.ts +1 -1
- package/application/schema.json +1 -1
- package/collection.json +1 -1
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +0 -2
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +3 -3
- package/component/index.js +5 -1
- package/directive/index.js +5 -1
- package/e2e/e2e-long.md +1 -1
- package/e2e/index.js +6 -0
- package/e2e/schema.d.ts +1 -1
- package/e2e/schema.json +1 -1
- package/library/index.js +1 -4
- package/migrations/migration-collection.json +10 -0
- package/migrations/update-14/remove-default-project-option.d.ts +10 -0
- package/migrations/update-14/remove-default-project-option.js +17 -0
- package/migrations/update-14/replace-default-collection-option.d.ts +10 -0
- package/migrations/update-14/replace-default-collection-option.js +32 -0
- package/module/index.js +5 -1
- package/ng-new/index.js +1 -1
- package/package.json +3 -3
- package/pipe/index.js +5 -1
- package/service-worker/index.js +7 -3
- package/third_party/github.com/Microsoft/TypeScript/BUILD.bazel +7 -2
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +29 -16
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +4866 -3030
- package/universal/index.js +11 -2
- package/universal/schema.d.ts +1 -1
- package/universal/schema.json +1 -1
- package/utility/ast-utils.js +31 -27
- package/utility/find-module.js +4 -8
- package/utility/latest-versions/package.json +3 -3
- package/utility/ng-ast-utils.js +6 -2
- package/utility/test/index.js +5 -1
- package/utility/workspace-models.d.ts +8 -6
- package/workspace/files/README.md.template +1 -1
- package/workspace/files/package.json.template +1 -2
package/universal/index.js
CHANGED
|
@@ -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.
|
|
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");
|
|
@@ -194,7 +199,11 @@ function addDependencies() {
|
|
|
194
199
|
name: '@angular/platform-server',
|
|
195
200
|
};
|
|
196
201
|
(0, dependencies_1.addPackageJsonDependency)(host, platformServerDep);
|
|
197
|
-
|
|
202
|
+
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
203
|
+
type: dependencies_1.NodeDependencyType.Dev,
|
|
204
|
+
name: '@types/node',
|
|
205
|
+
version: latest_versions_1.latestVersions['@types/node'],
|
|
206
|
+
});
|
|
198
207
|
};
|
|
199
208
|
}
|
|
200
209
|
function default_1(options) {
|
package/universal/schema.d.ts
CHANGED
package/universal/schema.json
CHANGED
package/utility/ast-utils.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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 (
|
|
296
|
-
position =
|
|
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
|
-
|
|
301
|
-
position =
|
|
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 =
|
|
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 (
|
|
328
|
+
if (!ts.isPropertyAssignment(assignment) ||
|
|
329
|
+
!ts.isArrayLiteralExpression(assignment.initializer)) {
|
|
327
330
|
return [];
|
|
328
331
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
340
|
+
expresssion = elements[elements.length - 1];
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
expresssion = assignmentInit;
|
|
344
344
|
}
|
|
345
345
|
let toInsert;
|
|
346
|
-
let position =
|
|
347
|
-
if (
|
|
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 =
|
|
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) {
|
package/utility/find-module.js
CHANGED
|
@@ -38,11 +38,7 @@ function findModuleFromOptions(host, options) {
|
|
|
38
38
|
}
|
|
39
39
|
const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length);
|
|
40
40
|
for (const c of candidatesDirs) {
|
|
41
|
-
const candidateFiles = [
|
|
42
|
-
'',
|
|
43
|
-
`${moduleBaseName}.ts`,
|
|
44
|
-
`${moduleBaseName}${moduleExt}`,
|
|
45
|
-
].map((x) => (0, core_1.join)(c, x));
|
|
41
|
+
const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map((x) => (0, core_1.join)(c, x));
|
|
46
42
|
for (const sc of candidateFiles) {
|
|
47
43
|
if (host.exists(sc)) {
|
|
48
44
|
return (0, core_1.normalize)(sc);
|
|
@@ -68,7 +64,7 @@ function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingMo
|
|
|
68
64
|
return (0, core_1.join)(dir.path, filteredMatches[0]);
|
|
69
65
|
}
|
|
70
66
|
else if (filteredMatches.length > 1) {
|
|
71
|
-
throw new Error(
|
|
67
|
+
throw new Error(`More than one module matches. Use the '--skip-import' option to skip importing ` +
|
|
72
68
|
'the component into the closest module or use the module option to specify a module.');
|
|
73
69
|
}
|
|
74
70
|
dir = dir.parent;
|
|
@@ -76,8 +72,8 @@ function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingMo
|
|
|
76
72
|
const errorMsg = foundRoutingModule
|
|
77
73
|
? 'Could not find a non Routing NgModule.' +
|
|
78
74
|
`\nModules with suffix '${routingModuleExt}' are strictly reserved for routing.` +
|
|
79
|
-
|
|
80
|
-
:
|
|
75
|
+
`\nUse the '--skip-import' option to skip importing in NgModule.`
|
|
76
|
+
: `Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule.`;
|
|
81
77
|
throw new Error(errorMsg);
|
|
82
78
|
}
|
|
83
79
|
exports.findModule = findModule;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"comment": "This file is needed so that depedencies are synced by Renovate.",
|
|
4
4
|
"private": true,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@types/jasmine": "~
|
|
6
|
+
"@types/jasmine": "~4.0.0",
|
|
7
7
|
"@types/node": "^14.15.0",
|
|
8
8
|
"jasmine-core": "~4.0.0",
|
|
9
9
|
"karma-chrome-launcher": "~3.1.0",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"karma-jasmine-html-reporter": "~1.7.0",
|
|
12
12
|
"karma-jasmine": "~4.0.0",
|
|
13
13
|
"karma": "~6.3.0",
|
|
14
|
-
"ng-packagr": "^
|
|
14
|
+
"ng-packagr": "^14.0.0-next.2",
|
|
15
15
|
"rxjs": "~7.5.0",
|
|
16
16
|
"tslib": "^2.3.0",
|
|
17
|
-
"typescript": "~4.
|
|
17
|
+
"typescript": "~4.6.2",
|
|
18
18
|
"zone.js": "~0.11.4"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/utility/ng-ast-utils.js
CHANGED
|
@@ -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.
|
|
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];
|
|
@@ -68,7 +72,7 @@ function findBootstrapModulePath(host, mainPath) {
|
|
|
68
72
|
const bootstrapModule = bootstrapCall.arguments[0];
|
|
69
73
|
const mainBuffer = host.read(mainPath);
|
|
70
74
|
if (!mainBuffer) {
|
|
71
|
-
throw new schematics_1.SchematicsException(`Client
|
|
75
|
+
throw new schematics_1.SchematicsException(`Client application main file (${mainPath}) not found`);
|
|
72
76
|
}
|
|
73
77
|
const mainText = mainBuffer.toString('utf-8');
|
|
74
78
|
const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
|
package/utility/test/index.js
CHANGED
|
@@ -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.
|
|
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];
|
|
@@ -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 {};
|
|
@@ -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
|
|
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'] %>",
|