@schematics/angular 17.1.0-next.3 → 17.1.0-rc.1
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/application/files/common-files/src/app/app.component.html.template +4 -4
- package/application/index.js +1 -0
- package/package.json +3 -3
- package/server/index.js +13 -16
- package/ssr/index.js +7 -2
- package/utility/ast-utils.js +10 -8
- package/utility/eol.d.ts +8 -0
- package/utility/eol.js +23 -0
- package/utility/json-file.d.ts +1 -0
- package/utility/json-file.js +4 -0
- package/utility/latest-versions/package.json +2 -2
- package/utility/latest-versions.js +2 -2
|
@@ -286,15 +286,15 @@
|
|
|
286
286
|
rel="noopener"
|
|
287
287
|
>
|
|
288
288
|
<svg
|
|
289
|
-
width="
|
|
290
|
-
height="
|
|
291
|
-
viewBox="0 0
|
|
289
|
+
width="24"
|
|
290
|
+
height="24"
|
|
291
|
+
viewBox="0 0 24 24"
|
|
292
292
|
fill="none"
|
|
293
293
|
xmlns="http://www.w3.org/2000/svg"
|
|
294
294
|
alt="Twitter"
|
|
295
295
|
>
|
|
296
296
|
<path
|
|
297
|
-
d="
|
|
297
|
+
d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
|
|
298
298
|
/>
|
|
299
299
|
</svg>
|
|
300
300
|
</a>
|
package/application/index.js
CHANGED
|
@@ -77,6 +77,7 @@ function default_1(options) {
|
|
|
77
77
|
options.ssr
|
|
78
78
|
? (0, schematics_1.schematic)('ssr', {
|
|
79
79
|
project: options.name,
|
|
80
|
+
skipInstall: true,
|
|
80
81
|
})
|
|
81
82
|
: (0, schematics_1.noop)(),
|
|
82
83
|
options.skipPackageJson ? (0, schematics_1.noop)() : addDependenciesToPackageJson(options),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematics/angular",
|
|
3
|
-
"version": "17.1.0-
|
|
3
|
+
"version": "17.1.0-rc.1",
|
|
4
4
|
"description": "Schematics specific to Angular",
|
|
5
5
|
"homepage": "https://github.com/angular/angular-cli",
|
|
6
6
|
"keywords": [
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"schematics": "./collection.json",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@angular-devkit/core": "17.1.0-
|
|
27
|
-
"@angular-devkit/schematics": "17.1.0-
|
|
26
|
+
"@angular-devkit/core": "17.1.0-rc.1",
|
|
27
|
+
"@angular-devkit/schematics": "17.1.0-rc.1",
|
|
28
28
|
"jsonc-parser": "3.2.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
package/server/index.js
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
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
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
13
12
|
const node_path_1 = require("node:path");
|
|
14
13
|
const utility_1 = require("../utility");
|
|
15
14
|
const dependencies_1 = require("../utility/dependencies");
|
|
@@ -103,22 +102,23 @@ function updateTsConfigFile(tsConfigPath) {
|
|
|
103
102
|
json.modify(typePath, [...types]);
|
|
104
103
|
};
|
|
105
104
|
}
|
|
106
|
-
function addDependencies() {
|
|
105
|
+
function addDependencies(skipInstall) {
|
|
107
106
|
return (host) => {
|
|
108
107
|
const coreDep = (0, dependencies_1.getPackageJsonDependency)(host, '@angular/core');
|
|
109
108
|
if (coreDep === null) {
|
|
110
109
|
throw new schematics_1.SchematicsException('Could not find version.');
|
|
111
110
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
const install = skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto;
|
|
112
|
+
return (0, schematics_1.chain)([
|
|
113
|
+
(0, utility_1.addDependency)('@angular/platform-server', coreDep.version, {
|
|
114
|
+
type: utility_1.DependencyType.Default,
|
|
115
|
+
install,
|
|
116
|
+
}),
|
|
117
|
+
(0, utility_1.addDependency)('@types/node', latest_versions_1.latestVersions['@types/node'], {
|
|
118
|
+
type: utility_1.DependencyType.Dev,
|
|
119
|
+
install,
|
|
120
|
+
}),
|
|
121
|
+
]);
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
function default_1(options) {
|
|
@@ -138,9 +138,6 @@ function default_1(options) {
|
|
|
138
138
|
// Server has already been added.
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
if (!options.skipInstall) {
|
|
142
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
143
|
-
}
|
|
144
141
|
const clientBuildOptions = clientBuildTarget.options;
|
|
145
142
|
const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project);
|
|
146
143
|
const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint);
|
|
@@ -175,7 +172,7 @@ function default_1(options) {
|
|
|
175
172
|
])),
|
|
176
173
|
updateConfigFileBrowserBuilder(options, tsConfigDirectory),
|
|
177
174
|
]),
|
|
178
|
-
addDependencies(),
|
|
175
|
+
addDependencies(options.skipInstall),
|
|
179
176
|
(0, utility_1.addRootProvider)(options.project, ({ code, external }) => code `${external('provideClientHydration', '@angular/platform-browser')}()`),
|
|
180
177
|
]);
|
|
181
178
|
};
|
package/ssr/index.js
CHANGED
|
@@ -221,21 +221,26 @@ function updateWebpackBuilderServerTsConfigRule(options) {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
|
-
function addDependencies(isUsingApplicationBuilder) {
|
|
224
|
+
function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
225
|
+
const install = skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto;
|
|
225
226
|
const rules = [
|
|
226
227
|
(0, utility_1.addDependency)('@angular/ssr', latest_versions_1.latestVersions.AngularSSR, {
|
|
227
228
|
type: utility_1.DependencyType.Default,
|
|
229
|
+
install,
|
|
228
230
|
}),
|
|
229
231
|
(0, utility_1.addDependency)('express', latest_versions_1.latestVersions['express'], {
|
|
230
232
|
type: utility_1.DependencyType.Default,
|
|
233
|
+
install,
|
|
231
234
|
}),
|
|
232
235
|
(0, utility_1.addDependency)('@types/express', latest_versions_1.latestVersions['@types/express'], {
|
|
233
236
|
type: utility_1.DependencyType.Dev,
|
|
237
|
+
install,
|
|
234
238
|
}),
|
|
235
239
|
];
|
|
236
240
|
if (!isUsingApplicationBuilder) {
|
|
237
241
|
rules.push((0, utility_1.addDependency)('browser-sync', latest_versions_1.latestVersions['browser-sync'], {
|
|
238
242
|
type: utility_1.DependencyType.Dev,
|
|
243
|
+
install,
|
|
239
244
|
}));
|
|
240
245
|
}
|
|
241
246
|
return (0, schematics_1.chain)(rules);
|
|
@@ -289,7 +294,7 @@ function default_1(options) {
|
|
|
289
294
|
]),
|
|
290
295
|
addServerFile(options, isStandalone),
|
|
291
296
|
addScriptsRule(options, isUsingApplicationBuilder),
|
|
292
|
-
addDependencies(isUsingApplicationBuilder),
|
|
297
|
+
addDependencies(options, isUsingApplicationBuilder),
|
|
293
298
|
]);
|
|
294
299
|
};
|
|
295
300
|
}
|
package/utility/ast-utils.js
CHANGED
|
@@ -34,6 +34,7 @@ exports.hasTopLevelIdentifier = exports.addRouteDeclarationToModule = exports.ge
|
|
|
34
34
|
const core_1 = require("@angular-devkit/core");
|
|
35
35
|
const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
36
36
|
const change_1 = require("./change");
|
|
37
|
+
const eol_1 = require("./eol");
|
|
37
38
|
/**
|
|
38
39
|
* Add Import `import { symbolName } from fileName` if the import doesn't exit
|
|
39
40
|
* already. Assumes fileToEdit can be resolved and accessed.
|
|
@@ -81,11 +82,12 @@ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = fals
|
|
|
81
82
|
}
|
|
82
83
|
const open = isDefault ? '' : '{ ';
|
|
83
84
|
const close = isDefault ? '' : ' }';
|
|
85
|
+
const eol = (0, eol_1.getEOL)(rootNode.getText());
|
|
84
86
|
// if there are no imports or 'use strict' statement, insert import at beginning of file
|
|
85
87
|
const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;
|
|
86
|
-
const separator = insertAtBeginning ? '' :
|
|
88
|
+
const separator = insertAtBeginning ? '' : `;${eol}`;
|
|
87
89
|
const toInsert = `${separator}import ${open}${importExpression}${close}` +
|
|
88
|
-
` from '${fileName}'${insertAtBeginning ?
|
|
90
|
+
` from '${fileName}'${insertAtBeginning ? `;${eol}` : ''}`;
|
|
89
91
|
return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
|
|
90
92
|
}
|
|
91
93
|
exports.insertImport = insertImport;
|
|
@@ -324,7 +326,7 @@ function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbol
|
|
|
324
326
|
!ts.isArrayLiteralExpression(assignment.initializer)) {
|
|
325
327
|
return [];
|
|
326
328
|
}
|
|
327
|
-
let
|
|
329
|
+
let expression;
|
|
328
330
|
const assignmentInit = assignment.initializer;
|
|
329
331
|
const elements = assignmentInit.elements;
|
|
330
332
|
if (elements.length) {
|
|
@@ -332,21 +334,21 @@ function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbol
|
|
|
332
334
|
if (symbolsArray.includes(core_1.tags.oneLine `${symbolName}`)) {
|
|
333
335
|
return [];
|
|
334
336
|
}
|
|
335
|
-
|
|
337
|
+
expression = elements[elements.length - 1];
|
|
336
338
|
}
|
|
337
339
|
else {
|
|
338
|
-
|
|
340
|
+
expression = assignmentInit;
|
|
339
341
|
}
|
|
340
342
|
let toInsert;
|
|
341
|
-
let position =
|
|
342
|
-
if (ts.isArrayLiteralExpression(
|
|
343
|
+
let position = expression.getEnd();
|
|
344
|
+
if (ts.isArrayLiteralExpression(expression)) {
|
|
343
345
|
// We found the field but it's empty. Insert it just before the `]`.
|
|
344
346
|
position--;
|
|
345
347
|
toInsert = `\n${core_1.tags.indentBy(4) `${symbolName}`}\n `;
|
|
346
348
|
}
|
|
347
349
|
else {
|
|
348
350
|
// Get the indentation of the last element, if any.
|
|
349
|
-
const text =
|
|
351
|
+
const text = expression.getFullText(source);
|
|
350
352
|
const matches = text.match(/^(\r?\n)(\s*)/);
|
|
351
353
|
if (matches) {
|
|
352
354
|
toInsert = `,${matches[1]}${core_1.tags.indentBy(matches[2].length) `${symbolName}`}`;
|
package/utility/eol.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/
|
|
8
|
+
export declare function getEOL(content: string): string;
|
package/utility/eol.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getEOL = void 0;
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
const CRLF = '\r\n';
|
|
13
|
+
const LF = '\n';
|
|
14
|
+
function getEOL(content) {
|
|
15
|
+
const newlines = content.match(/(?:\r?\n)/g);
|
|
16
|
+
if (newlines?.length) {
|
|
17
|
+
const crlf = newlines.filter((l) => l === CRLF).length;
|
|
18
|
+
const lf = newlines.length - crlf;
|
|
19
|
+
return crlf > lf ? CRLF : LF;
|
|
20
|
+
}
|
|
21
|
+
return node_os_1.EOL;
|
|
22
|
+
}
|
|
23
|
+
exports.getEOL = getEOL;
|
package/utility/json-file.d.ts
CHANGED
package/utility/json-file.js
CHANGED
|
@@ -9,15 +9,18 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.JSONFile = void 0;
|
|
11
11
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
12
|
+
const eol_1 = require("./eol");
|
|
12
13
|
/** @private */
|
|
13
14
|
class JSONFile {
|
|
14
15
|
host;
|
|
15
16
|
path;
|
|
16
17
|
content;
|
|
18
|
+
eol;
|
|
17
19
|
constructor(host, path) {
|
|
18
20
|
this.host = host;
|
|
19
21
|
this.path = path;
|
|
20
22
|
this.content = this.host.readText(this.path);
|
|
23
|
+
this.eol = (0, eol_1.getEOL)(this.content);
|
|
21
24
|
}
|
|
22
25
|
_jsonAst;
|
|
23
26
|
get JsonAst() {
|
|
@@ -55,6 +58,7 @@ class JSONFile {
|
|
|
55
58
|
const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
|
|
56
59
|
getInsertionIndex,
|
|
57
60
|
formattingOptions: {
|
|
61
|
+
eol: this.eol,
|
|
58
62
|
insertSpaces: true,
|
|
59
63
|
tabSize: 2,
|
|
60
64
|
},
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"@types/express": "^4.17.17",
|
|
7
7
|
"@types/jasmine": "~5.1.0",
|
|
8
8
|
"@types/node": "^18.18.0",
|
|
9
|
-
"browser-sync": "^
|
|
9
|
+
"browser-sync": "^3.0.0",
|
|
10
10
|
"express": "^4.18.2",
|
|
11
11
|
"jasmine-core": "~5.1.0",
|
|
12
12
|
"jasmine-spec-reporter": "~7.0.0",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"tslib": "^2.3.0",
|
|
22
22
|
"ts-node": "~10.9.0",
|
|
23
23
|
"typescript": "~5.3.2",
|
|
24
|
-
"zone.js": "~0.14.
|
|
24
|
+
"zone.js": "~0.14.3"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -14,6 +14,6 @@ exports.latestVersions = {
|
|
|
14
14
|
...require('./latest-versions/package.json')['dependencies'],
|
|
15
15
|
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
|
|
16
16
|
Angular: '^17.1.0-next.0',
|
|
17
|
-
DevkitBuildAngular: '^17.1.0-
|
|
18
|
-
AngularSSR: '^17.1.0-
|
|
17
|
+
DevkitBuildAngular: '^17.1.0-rc.1',
|
|
18
|
+
AngularSSR: '^17.1.0-rc.1',
|
|
19
19
|
};
|