@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.
@@ -286,15 +286,15 @@
286
286
  rel="noopener"
287
287
  >
288
288
  <svg
289
- width="25"
290
- height="20"
291
- viewBox="0 0 25 20"
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="M8.04524 20C17.3335 20 22.4138 12.3047 22.4138 5.63144C22.4138 5.41287 22.4138 5.19529 22.399 4.97869C23.3874 4.26381 24.2405 3.37867 24.9185 2.3647C23.9969 2.77329 23.0192 3.04112 22.018 3.15923C23.0723 2.52818 23.8613 1.53552 24.2382 0.366057C23.2469 0.954335 22.1624 1.36889 21.0315 1.59182C20.2701 0.782212 19.2631 0.246107 18.1663 0.0664704C17.0695 -0.113166 15.9441 0.0736804 14.9642 0.598096C13.9843 1.12251 13.2046 1.95526 12.7457 2.96748C12.2868 3.9797 12.1742 5.11495 12.4255 6.19756C10.4178 6.09685 8.45366 5.57507 6.66064 4.66609C4.86763 3.75712 3.28579 2.48127 2.01781 0.921344C1.37203 2.03306 1.17424 3.34911 1.46472 4.60154C1.75519 5.85397 2.51208 6.9486 3.58128 7.66257C2.77759 7.63903 1.9914 7.42221 1.28924 7.03049V7.09449C1.28956 8.26041 1.69316 9.39034 2.4316 10.2926C3.17003 11.1949 4.19783 11.8139 5.34067 12.0448C4.59721 12.2476 3.81715 12.2772 3.06045 12.1315C3.38327 13.1348 4.01156 14.0122 4.85746 14.641C5.70337 15.2698 6.72461 15.6185 7.77842 15.6384C6.73139 16.4614 5.53237 17.0699 4.24995 17.4291C2.96753 17.7882 1.62687 17.891 0.304688 17.7316C2.61411 19.2136 5.30121 19.9997 8.04524 19.9961"
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>
@@ -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-next.3",
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-next.3",
27
- "@angular-devkit/schematics": "17.1.0-next.3",
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 platformServerDep = {
113
- ...coreDep,
114
- name: '@angular/platform-server',
115
- };
116
- (0, dependencies_1.addPackageJsonDependency)(host, platformServerDep);
117
- (0, dependencies_1.addPackageJsonDependency)(host, {
118
- type: dependencies_1.NodeDependencyType.Dev,
119
- name: '@types/node',
120
- version: latest_versions_1.latestVersions['@types/node'],
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
  }
@@ -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 ? '' : ';\n';
88
+ const separator = insertAtBeginning ? '' : `;${eol}`;
87
89
  const toInsert = `${separator}import ${open}${importExpression}${close}` +
88
- ` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`;
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 expresssion;
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
- expresssion = elements[elements.length - 1];
337
+ expression = elements[elements.length - 1];
336
338
  }
337
339
  else {
338
- expresssion = assignmentInit;
340
+ expression = assignmentInit;
339
341
  }
340
342
  let toInsert;
341
- let position = expresssion.getEnd();
342
- if (ts.isArrayLiteralExpression(expresssion)) {
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 = expresssion.getFullText(source);
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}`}`;
@@ -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;
@@ -14,6 +14,7 @@ export declare class JSONFile {
14
14
  private readonly host;
15
15
  private readonly path;
16
16
  content: string;
17
+ private eol;
17
18
  constructor(host: Tree, path: string);
18
19
  private _jsonAst;
19
20
  private get JsonAst();
@@ -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": "^2.29.3",
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.2"
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-next.3',
18
- AngularSSR: '^17.1.0-next.3',
17
+ DevkitBuildAngular: '^17.1.0-rc.1',
18
+ AngularSSR: '^17.1.0-rc.1',
19
19
  };