@angular/cli 12.0.1 → 12.0.5

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.
@@ -1690,7 +1690,7 @@
1690
1690
  "type": "object",
1691
1691
  "properties": {
1692
1692
  "includePaths": {
1693
- "description": "Paths to include. Paths will be resolved to project root.",
1693
+ "description": "Paths to include. Paths will be resolved to workspace root.",
1694
1694
  "type": "array",
1695
1695
  "items": {
1696
1696
  "type": "string"
@@ -2471,7 +2471,7 @@
2471
2471
  "type": "object",
2472
2472
  "properties": {
2473
2473
  "includePaths": {
2474
- "description": "Paths to include. Paths will be resolved to project root.",
2474
+ "description": "Paths to include. Paths will be resolved to workspace root.",
2475
2475
  "type": "array",
2476
2476
  "items": {
2477
2477
  "type": "string"
@@ -2746,7 +2746,7 @@
2746
2746
  "type": "object",
2747
2747
  "properties": {
2748
2748
  "includePaths": {
2749
- "description": "Paths to include. Paths will be resolved to project root.",
2749
+ "description": "Paths to include. Paths will be resolved to workspace root.",
2750
2750
  "type": "array",
2751
2751
  "items": {
2752
2752
  "type": "string"
@@ -185,6 +185,7 @@ class ArchitectCommand extends command_1.Command {
185
185
  return success ? 0 : 1;
186
186
  }
187
187
  async runArchitectTarget(options) {
188
+ var _a;
188
189
  const extra = options['--'] || [];
189
190
  try {
190
191
  const targetSpec = this._makeTargetSpecifier(options);
@@ -206,7 +207,7 @@ class ArchitectCommand extends command_1.Command {
206
207
  const newErrors = [];
207
208
  for (const schemaError of e.errors) {
208
209
  if (schemaError.keyword === 'additionalProperties') {
209
- const unknownProperty = schemaError.params.additionalProperty;
210
+ const unknownProperty = (_a = schemaError.params) === null || _a === void 0 ? void 0 : _a.additionalProperty;
210
211
  if (unknownProperty in options) {
211
212
  const dashes = unknownProperty.length === 1 ? '-' : '--';
212
213
  this.logger.fatal(`Unknown option: '${dashes}${unknownProperty}'`);
@@ -33,14 +33,17 @@ function shouldWrapSchematic(schematicFile) {
33
33
  return true;
34
34
  }
35
35
  }
36
+ const normalizedSchematicFile = schematicFile.replace(/\\/g, '/');
36
37
  // Never wrap the internal update schematic when executed directly
37
38
  // It communicates with the update command via `global`
38
- if (/[\/\\]node_modules[\/\\]@angular[\/\\]cli[\/\\]/.test(schematicFile)) {
39
+ // But we still want to redirect schematics located in `@angular/cli/node_modules`.
40
+ if (normalizedSchematicFile.includes('node_modules/@angular/cli/') &&
41
+ !normalizedSchematicFile.includes('node_modules/@angular/cli/node_modules/')) {
39
42
  return false;
40
43
  }
41
44
  // Default is only first-party Angular schematic packages
42
45
  // Angular schematics are safe to use in the wrapped VM context
43
- return /[\/\\]node_modules[\/\\]@(?:angular|schematics|nguniversal)[\/\\]/.test(schematicFile);
46
+ return /\/node_modules\/@(?:angular|schematics|nguniversal)\//.test(normalizedSchematicFile);
44
47
  }
45
48
  class SchematicEngineHost extends tools_1.NodeModulesEngineHost {
46
49
  _resolveReferenceString(refString, parentPath) {
@@ -94,10 +97,8 @@ const legacyModules = {
94
97
  * @param exportName An optional name of a specific export to return. Otherwise, return all exports.
95
98
  */
96
99
  function wrap(schematicFile, schematicDirectory, moduleCache, exportName) {
97
- const { createRequire, createRequireFromPath } = require('module');
98
- // Node.js 10.x does not support `createRequire` so fallback to `createRequireFromPath`
99
- // `createRequireFromPath` is deprecated in 12+ and can be removed once 10.x support is removed
100
- const scopedRequire = (createRequire === null || createRequire === void 0 ? void 0 : createRequire(schematicFile)) || createRequireFromPath(schematicFile);
100
+ const { createRequire } = require('module');
101
+ const scopedRequire = createRequire(schematicFile);
101
102
  const customRequire = function (id) {
102
103
  if (legacyModules[id]) {
103
104
  // Provide compatibility modules for older versions of @angular/cdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "12.0.1",
3
+ "version": "12.0.5",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.1200.1",
32
- "@angular-devkit/core": "12.0.1",
33
- "@angular-devkit/schematics": "12.0.1",
34
- "@schematics/angular": "12.0.1",
31
+ "@angular-devkit/architect": "0.1200.5",
32
+ "@angular-devkit/core": "12.0.5",
33
+ "@angular-devkit/schematics": "12.0.5",
34
+ "@schematics/angular": "12.0.5",
35
35
  "@yarnpkg/lockfile": "1.1.0",
36
36
  "ansi-colors": "4.1.1",
37
37
  "debug": "4.3.1",
@@ -52,16 +52,16 @@
52
52
  "ng-update": {
53
53
  "migrations": "@schematics/angular/migrations/migration-collection.json",
54
54
  "packageGroup": {
55
- "@angular/cli": "12.0.1",
56
- "@angular-devkit/architect": "0.1200.1",
57
- "@angular-devkit/build-angular": "12.0.1",
58
- "@angular-devkit/build-webpack": "0.1200.1",
59
- "@angular-devkit/core": "12.0.1",
60
- "@angular-devkit/schematics": "12.0.1"
55
+ "@angular/cli": "12.0.5",
56
+ "@angular-devkit/architect": "0.1200.5",
57
+ "@angular-devkit/build-angular": "12.0.5",
58
+ "@angular-devkit/build-webpack": "0.1200.5",
59
+ "@angular-devkit/core": "12.0.5",
60
+ "@angular-devkit/schematics": "12.0.5"
61
61
  }
62
62
  },
63
63
  "engines": {
64
- "node": "^12.14.1 || ^14.0.0",
64
+ "node": "^12.14.1 || >=14.0.0",
65
65
  "npm": "^6.11.0 || ^7.5.6",
66
66
  "yarn": ">= 1.13.0"
67
67
  }
@@ -17,6 +17,7 @@ const pacote = require('pacote');
17
17
  const npmPackageJsonCache = new Map();
18
18
  let npmrc;
19
19
  function readOptions(logger, yarn = false, showPotentials = false) {
20
+ var _a;
20
21
  const cwd = process.cwd();
21
22
  const baseFilename = yarn ? 'yarnrc' : 'npmrc';
22
23
  const dotFilename = '.' + baseFilename;
@@ -31,8 +32,8 @@ function readOptions(logger, yarn = false, showPotentials = false) {
31
32
  }
32
33
  }
33
34
  const defaultConfigLocations = [
34
- path.join(globalPrefix, 'etc', baseFilename),
35
- path.join(os_1.homedir(), dotFilename),
35
+ (!yarn && process.env.NPM_CONFIG_GLOBALCONFIG) || path.join(globalPrefix, 'etc', baseFilename),
36
+ (!yarn && process.env.NPM_CONFIG_USERCONFIG) || path.join(os_1.homedir(), dotFilename),
36
37
  ];
37
38
  const projectConfigLocations = [path.join(cwd, dotFilename)];
38
39
  const root = path.parse(cwd).root;
@@ -53,27 +54,45 @@ function readOptions(logger, yarn = false, showPotentials = false) {
53
54
  // See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f7af2e02c8a22bcaf9e850/index.js#L99-L126
54
55
  const rcConfig = yarn ? lockfile.parse(data) : ini.parse(data);
55
56
  for (const [key, value] of Object.entries(rcConfig)) {
57
+ let substitutedValue = value;
58
+ // Substitute any environment variable references.
59
+ if (typeof value === 'string') {
60
+ substitutedValue = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');
61
+ }
56
62
  switch (key) {
63
+ // Unless auth options are scope with the registry url it appears that npm-registry-fetch ignores them,
64
+ // even though they are documented.
65
+ // https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/README.md
66
+ // https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/auth.js#L45-L91
67
+ case '_authToken':
68
+ case 'token':
69
+ case 'username':
70
+ case 'password':
71
+ case '_auth':
72
+ case 'auth':
73
+ (_a = options['forceAuth']) !== null && _a !== void 0 ? _a : (options['forceAuth'] = {});
74
+ options['forceAuth'][key] = substitutedValue;
75
+ break;
57
76
  case 'noproxy':
58
77
  case 'no-proxy':
59
- options['noProxy'] = value;
78
+ options['noProxy'] = substitutedValue;
60
79
  break;
61
80
  case 'maxsockets':
62
- options['maxSockets'] = value;
81
+ options['maxSockets'] = substitutedValue;
63
82
  break;
64
83
  case 'https-proxy':
65
84
  case 'proxy':
66
- options['proxy'] = value;
85
+ options['proxy'] = substitutedValue;
67
86
  break;
68
87
  case 'strict-ssl':
69
- options['strictSSL'] = value;
88
+ options['strictSSL'] = substitutedValue;
70
89
  break;
71
90
  case 'local-address':
72
- options['localAddress'] = value;
91
+ options['localAddress'] = substitutedValue;
73
92
  break;
74
93
  case 'cafile':
75
- if (typeof value === 'string') {
76
- const cafile = path.resolve(path.dirname(location), value);
94
+ if (typeof substitutedValue === 'string') {
95
+ const cafile = path.resolve(path.dirname(location), substitutedValue);
77
96
  try {
78
97
  options['ca'] = fs_1.readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
79
98
  }
@@ -81,21 +100,11 @@ function readOptions(logger, yarn = false, showPotentials = false) {
81
100
  }
82
101
  break;
83
102
  default:
84
- options[key] = value;
103
+ options[key] = substitutedValue;
85
104
  break;
86
105
  }
87
106
  }
88
107
  }
89
- else if (showPotentials) {
90
- logger.info(`Trying '${location}'...not found.`);
91
- }
92
- }
93
- // Substitute any environment variable references
94
- for (const key in options) {
95
- const value = options[key];
96
- if (typeof value === 'string') {
97
- options[key] = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');
98
- }
99
108
  }
100
109
  return options;
101
110
  }
@@ -148,10 +148,8 @@ async function runTempPackageBin(packageName, packageManager = workspace_schema_
148
148
  if (!binPath) {
149
149
  throw new Error(`Cannot locate bin for temporary package: ${packageNameNoVersion}.`);
150
150
  }
151
- const argv = [binPath, ...args];
152
- const { status, error } = child_process_1.spawnSync('node', argv, {
151
+ const { status, error } = child_process_1.spawnSync(process.execPath, [binPath, ...args], {
153
152
  stdio: 'inherit',
154
- shell: true,
155
153
  env: {
156
154
  ...process.env,
157
155
  NG_DISABLE_VERSION_CHECK: 'true',
@@ -30,6 +30,7 @@ function ensureNpmrc(logger, usingYarn, verbose) {
30
30
  }
31
31
  }
32
32
  function readOptions(logger, yarn = false, showPotentials = false) {
33
+ var _a;
33
34
  const cwd = process.cwd();
34
35
  const baseFilename = yarn ? 'yarnrc' : 'npmrc';
35
36
  const dotFilename = '.' + baseFilename;
@@ -66,27 +67,45 @@ function readOptions(logger, yarn = false, showPotentials = false) {
66
67
  // See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f7af2e02c8a22bcaf9e850/index.js#L99-L126
67
68
  const rcConfig = yarn ? lockfile.parse(data) : ini.parse(data);
68
69
  for (const [key, value] of Object.entries(rcConfig)) {
70
+ let substitutedValue = value;
71
+ // Substitute any environment variable references.
72
+ if (typeof value === 'string') {
73
+ substitutedValue = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');
74
+ }
69
75
  switch (key) {
76
+ // Unless auth options are scope with the registry url it appears that npm-registry-fetch ignores them,
77
+ // even though they are documented.
78
+ // https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/README.md
79
+ // https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/auth.js#L45-L91
80
+ case '_authToken':
81
+ case 'token':
82
+ case 'username':
83
+ case 'password':
84
+ case '_auth':
85
+ case 'auth':
86
+ (_a = options['forceAuth']) !== null && _a !== void 0 ? _a : (options['forceAuth'] = {});
87
+ options['forceAuth'][key] = substitutedValue;
88
+ break;
70
89
  case 'noproxy':
71
90
  case 'no-proxy':
72
- options['noProxy'] = value;
91
+ options['noProxy'] = substitutedValue;
73
92
  break;
74
93
  case 'maxsockets':
75
- options['maxSockets'] = value;
94
+ options['maxSockets'] = substitutedValue;
76
95
  break;
77
96
  case 'https-proxy':
78
97
  case 'proxy':
79
- options['proxy'] = value;
98
+ options['proxy'] = substitutedValue;
80
99
  break;
81
100
  case 'strict-ssl':
82
- options['strictSSL'] = value;
101
+ options['strictSSL'] = substitutedValue;
83
102
  break;
84
103
  case 'local-address':
85
- options['localAddress'] = value;
104
+ options['localAddress'] = substitutedValue;
86
105
  break;
87
106
  case 'cafile':
88
- if (typeof value === 'string') {
89
- const cafile = path.resolve(path.dirname(location), value);
107
+ if (typeof substitutedValue === 'string') {
108
+ const cafile = path.resolve(path.dirname(location), substitutedValue);
90
109
  try {
91
110
  options['ca'] = fs_1.readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
92
111
  }
@@ -94,21 +113,11 @@ function readOptions(logger, yarn = false, showPotentials = false) {
94
113
  }
95
114
  break;
96
115
  default:
97
- options[key] = value;
116
+ options[key] = substitutedValue;
98
117
  break;
99
118
  }
100
119
  }
101
120
  }
102
- else if (showPotentials) {
103
- logger.info(`Trying '${location}'...not found.`);
104
- }
105
- }
106
- // Substitute any environment variable references
107
- for (const key in options) {
108
- const value = options[key];
109
- if (typeof value === 'string') {
110
- options[key] = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');
111
- }
112
121
  }
113
122
  return options;
114
123
  }