@angular/cli 12.1.0-next.3 → 12.1.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/commands/analytics-impl.d.ts +1 -1
- package/commands/config-impl.d.ts +1 -1
- package/commands/doc-impl.js +25 -3
- package/commands/e2e-impl.d.ts +1 -1
- package/commands/e2e-impl.js +1 -0
- package/commands/new-impl.js +2 -2
- package/commands/update-impl.js +24 -4
- package/commands/version-impl.js +20 -1
- package/lib/config/schema.json +8 -6
- package/lib/config/workspace-schema.d.ts +18 -5
- package/lib/config/workspace-schema.js +20 -8
- package/lib/init.js +29 -33
- package/models/analytics-collector.js +27 -5
- package/models/analytics.js +27 -4
- package/models/architect-command.d.ts +1 -1
- package/models/architect-command.js +2 -1
- package/models/command-runner.js +20 -1
- package/models/schematic-command.js +21 -2
- package/models/schematic-engine-host.js +10 -6
- package/package.json +17 -18
- package/src/commands/update/schematic/index.js +24 -5
- package/utilities/color.js +20 -1
- package/utilities/config.js +22 -3
- package/utilities/find-up.js +20 -1
- package/utilities/install-package.js +2 -5
- package/{src/commands/update/schematic → utilities}/package-json.d.ts +0 -0
- package/{src/commands/update/schematic → utilities}/package-json.js +0 -0
- package/utilities/package-metadata.d.ts +26 -9
- package/utilities/package-metadata.js +88 -30
- package/utilities/package-tree.js +21 -2
- package/utilities/project.js +22 -3
- package/utilities/prompt.js +20 -1
- package/utilities/spinner.js +5 -2
- package/src/commands/update/schematic/npm-package-json.d.ts +0 -24
- package/src/commands/update/schematic/npm-package-json.js +0 -9
- package/src/commands/update/schematic/npm.d.ts +0 -22
- package/src/commands/update/schematic/npm.js +0 -140
|
@@ -6,13 +6,32 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.SchematicCommand = exports.UnknownCollectionError = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
31
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
32
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
14
|
-
const inquirer = require("inquirer");
|
|
15
|
-
const systemPath = require("path");
|
|
33
|
+
const inquirer = __importStar(require("inquirer"));
|
|
34
|
+
const systemPath = __importStar(require("path"));
|
|
16
35
|
const color_1 = require("../utilities/color");
|
|
17
36
|
const config_1 = require("../utilities/config");
|
|
18
37
|
const json_schema_1 = require("../utilities/json-schema");
|
|
@@ -6,6 +6,9 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
var _a;
|
|
10
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
14
|
exports.SchematicEngineHost = void 0;
|
|
@@ -13,6 +16,7 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
13
16
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
14
17
|
const fs_1 = require("fs");
|
|
15
18
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
19
|
+
const module_1 = __importDefault(require("module"));
|
|
16
20
|
const path_1 = require("path");
|
|
17
21
|
const vm_1 = require("vm");
|
|
18
22
|
/**
|
|
@@ -33,14 +37,17 @@ function shouldWrapSchematic(schematicFile) {
|
|
|
33
37
|
return true;
|
|
34
38
|
}
|
|
35
39
|
}
|
|
40
|
+
const normalizedSchematicFile = schematicFile.replace(/\\/g, '/');
|
|
36
41
|
// Never wrap the internal update schematic when executed directly
|
|
37
42
|
// It communicates with the update command via `global`
|
|
38
|
-
|
|
43
|
+
// But we still want to redirect schematics located in `@angular/cli/node_modules`.
|
|
44
|
+
if (normalizedSchematicFile.includes('node_modules/@angular/cli/') &&
|
|
45
|
+
!normalizedSchematicFile.includes('node_modules/@angular/cli/node_modules/')) {
|
|
39
46
|
return false;
|
|
40
47
|
}
|
|
41
48
|
// Default is only first-party Angular schematic packages
|
|
42
49
|
// Angular schematics are safe to use in the wrapped VM context
|
|
43
|
-
return
|
|
50
|
+
return /\/node_modules\/@(?:angular|schematics|nguniversal)\//.test(normalizedSchematicFile);
|
|
44
51
|
}
|
|
45
52
|
class SchematicEngineHost extends tools_1.NodeModulesEngineHost {
|
|
46
53
|
_resolveReferenceString(refString, parentPath) {
|
|
@@ -94,10 +101,7 @@ const legacyModules = {
|
|
|
94
101
|
* @param exportName An optional name of a specific export to return. Otherwise, return all exports.
|
|
95
102
|
*/
|
|
96
103
|
function wrap(schematicFile, schematicDirectory, moduleCache, exportName) {
|
|
97
|
-
const
|
|
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);
|
|
104
|
+
const scopedRequire = module_1.default.createRequire(schematicFile);
|
|
101
105
|
const customRequire = function (id) {
|
|
102
106
|
if (legacyModules[id]) {
|
|
103
107
|
// 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.1.0
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,23 +28,22 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/angular/angular-cli",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@angular-devkit/architect": "0.1201.0
|
|
32
|
-
"@angular-devkit/core": "12.1.0
|
|
33
|
-
"@angular-devkit/schematics": "12.1.0
|
|
34
|
-
"@schematics/angular": "12.1.0
|
|
31
|
+
"@angular-devkit/architect": "0.1201.0",
|
|
32
|
+
"@angular-devkit/core": "12.1.0",
|
|
33
|
+
"@angular-devkit/schematics": "12.1.0",
|
|
34
|
+
"@schematics/angular": "12.1.0",
|
|
35
35
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
36
|
"ansi-colors": "4.1.1",
|
|
37
37
|
"debug": "4.3.1",
|
|
38
38
|
"ini": "2.0.0",
|
|
39
|
-
"inquirer": "8.
|
|
39
|
+
"inquirer": "8.1.1",
|
|
40
40
|
"jsonc-parser": "3.0.0",
|
|
41
|
-
"npm-package-arg": "8.1.
|
|
41
|
+
"npm-package-arg": "8.1.5",
|
|
42
42
|
"npm-pick-manifest": "6.1.1",
|
|
43
|
-
"open": "8.
|
|
44
|
-
"ora": "5.4.
|
|
45
|
-
"pacote": "11.3.
|
|
43
|
+
"open": "8.2.1",
|
|
44
|
+
"ora": "5.4.1",
|
|
45
|
+
"pacote": "11.3.4",
|
|
46
46
|
"resolve": "1.20.0",
|
|
47
|
-
"rimraf": "3.0.2",
|
|
48
47
|
"semver": "7.3.5",
|
|
49
48
|
"symbol-observable": "4.0.0",
|
|
50
49
|
"uuid": "8.3.2"
|
|
@@ -52,16 +51,16 @@
|
|
|
52
51
|
"ng-update": {
|
|
53
52
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
54
53
|
"packageGroup": {
|
|
55
|
-
"@angular/cli": "12.1.0
|
|
56
|
-
"@angular-devkit/architect": "0.1201.0
|
|
57
|
-
"@angular-devkit/build-angular": "12.1.0
|
|
58
|
-
"@angular-devkit/build-webpack": "0.1201.0
|
|
59
|
-
"@angular-devkit/core": "12.1.0
|
|
60
|
-
"@angular-devkit/schematics": "12.1.0
|
|
54
|
+
"@angular/cli": "12.1.0",
|
|
55
|
+
"@angular-devkit/architect": "0.1201.0",
|
|
56
|
+
"@angular-devkit/build-angular": "12.1.0",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1201.0",
|
|
58
|
+
"@angular-devkit/core": "12.1.0",
|
|
59
|
+
"@angular-devkit/schematics": "12.1.0"
|
|
61
60
|
}
|
|
62
61
|
},
|
|
63
62
|
"engines": {
|
|
64
|
-
"node": "^12.14.1 ||
|
|
63
|
+
"node": "^12.14.1 || >=14.0.0",
|
|
65
64
|
"npm": "^6.11.0 || ^7.5.6",
|
|
66
65
|
"yarn": ">= 1.13.0"
|
|
67
66
|
}
|
|
@@ -6,13 +6,32 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.angularMajorCompatGuarantee = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
31
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
const npa = require("npm-package-arg");
|
|
14
|
-
const semver = require("semver");
|
|
15
|
-
const
|
|
32
|
+
const npa = __importStar(require("npm-package-arg"));
|
|
33
|
+
const semver = __importStar(require("semver"));
|
|
34
|
+
const package_metadata_1 = require("../../../../utilities/package-metadata");
|
|
16
35
|
// Angular guarantees that a major is compatible with its following major (so packages that depend
|
|
17
36
|
// on Angular 5 are also compatible with Angular 6). This is, in code, represented by verifying
|
|
18
37
|
// that all other packages that have a peer dependency of `"@angular/core": "^5.0.0"` actually
|
|
@@ -604,8 +623,8 @@ function default_1(options) {
|
|
|
604
623
|
const packages = _buildPackageList(options, npmDeps, logger);
|
|
605
624
|
// Grab all package.json from the npm repository. This requires a lot of HTTP calls so we
|
|
606
625
|
// try to parallelize as many as possible.
|
|
607
|
-
const allPackageMetadata = await Promise.all(Array.from(npmDeps.keys()).map((depName) =>
|
|
608
|
-
|
|
626
|
+
const allPackageMetadata = await Promise.all(Array.from(npmDeps.keys()).map((depName) => package_metadata_1.getNpmPackageJson(depName, logger, {
|
|
627
|
+
registry: options.registry,
|
|
609
628
|
usingYarn,
|
|
610
629
|
verbose: options.verbose,
|
|
611
630
|
})));
|
package/utilities/color.js
CHANGED
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.colors = exports.removeColor = void 0;
|
|
11
|
-
const ansiColors = require("ansi-colors");
|
|
30
|
+
const ansiColors = __importStar(require("ansi-colors"));
|
|
12
31
|
const tty_1 = require("tty");
|
|
13
32
|
const supportsColor = process.stdout instanceof tty_1.WriteStream && process.stdout.getColorDepth() > 1;
|
|
14
33
|
function removeColor(text) {
|
package/utilities/config.js
CHANGED
|
@@ -6,12 +6,31 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.isWarningEnabled = exports.getSchematicDefaults = exports.migrateLegacyGlobalConfig = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
31
|
const fs_1 = require("fs");
|
|
13
|
-
const os = require("os");
|
|
14
|
-
const path = require("path");
|
|
32
|
+
const os = __importStar(require("os"));
|
|
33
|
+
const path = __importStar(require("path"));
|
|
15
34
|
const find_up_1 = require("./find-up");
|
|
16
35
|
const json_file_1 = require("./json-file");
|
|
17
36
|
function isJsonObject(value) {
|
|
@@ -178,7 +197,7 @@ function getWorkspaceRaw(level = 'local') {
|
|
|
178
197
|
exports.getWorkspaceRaw = getWorkspaceRaw;
|
|
179
198
|
async function validateWorkspace(data) {
|
|
180
199
|
const schema = json_file_1.readAndParseJson(path.join(__dirname, '../lib/config/schema.json'));
|
|
181
|
-
const { formats } = await Promise.resolve().then(() => require('@angular-devkit/schematics'));
|
|
200
|
+
const { formats } = await Promise.resolve().then(() => __importStar(require('@angular-devkit/schematics')));
|
|
182
201
|
const registry = new core_1.json.schema.CoreSchemaRegistry(formats.standardFormats);
|
|
183
202
|
const validator = await registry.compile(schema).toPromise();
|
|
184
203
|
const { success, errors } = await validator(data).toPromise();
|
package/utilities/find-up.js
CHANGED
|
@@ -6,10 +6,29 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.findUp = void 0;
|
|
11
30
|
const fs_1 = require("fs");
|
|
12
|
-
const path = require("path");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
13
32
|
function findUp(names, from) {
|
|
14
33
|
if (!Array.isArray(names)) {
|
|
15
34
|
names = [names];
|
|
@@ -12,7 +12,6 @@ const child_process_1 = require("child_process");
|
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
const os_1 = require("os");
|
|
14
14
|
const path_1 = require("path");
|
|
15
|
-
const rimraf = require("rimraf");
|
|
16
15
|
const workspace_schema_1 = require("../lib/config/workspace-schema");
|
|
17
16
|
const spinner_1 = require("./spinner");
|
|
18
17
|
async function installAllPackages(packageManager = workspace_schema_1.PackageManager.Npm, extraArgs = [], cwd = process.cwd()) {
|
|
@@ -89,7 +88,7 @@ async function installTempPackage(packageName, packageManager = workspace_schema
|
|
|
89
88
|
// clean up temp directory on process exit
|
|
90
89
|
process.on('exit', () => {
|
|
91
90
|
try {
|
|
92
|
-
|
|
91
|
+
fs_1.rmdirSync(tempPath, { recursive: true, maxRetries: 3 });
|
|
93
92
|
}
|
|
94
93
|
catch { }
|
|
95
94
|
});
|
|
@@ -148,10 +147,8 @@ async function runTempPackageBin(packageName, packageManager = workspace_schema_
|
|
|
148
147
|
if (!binPath) {
|
|
149
148
|
throw new Error(`Cannot locate bin for temporary package: ${packageNameNoVersion}.`);
|
|
150
149
|
}
|
|
151
|
-
const
|
|
152
|
-
const { status, error } = child_process_1.spawnSync('node', argv, {
|
|
150
|
+
const { status, error } = child_process_1.spawnSync(process.execPath, [binPath, ...args], {
|
|
153
151
|
stdio: 'inherit',
|
|
154
|
-
shell: true,
|
|
155
152
|
env: {
|
|
156
153
|
...process.env,
|
|
157
154
|
NG_DISABLE_VERSION_CHECK: 'true',
|
|
File without changes
|
|
File without changes
|
|
@@ -6,8 +6,22 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { logging } from '@angular-devkit/core';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { JsonSchemaForNpmPackageJsonFiles } from './package-json';
|
|
10
|
+
export interface NpmRepositoryPackageJson {
|
|
11
|
+
name: string;
|
|
12
|
+
requestedName: string;
|
|
13
|
+
description: string;
|
|
14
|
+
'dist-tags': {
|
|
15
|
+
[name: string]: string;
|
|
16
|
+
};
|
|
17
|
+
versions: {
|
|
18
|
+
[version: string]: JsonSchemaForNpmPackageJsonFiles;
|
|
19
|
+
};
|
|
20
|
+
time: {
|
|
21
|
+
modified: string;
|
|
22
|
+
created: string;
|
|
23
|
+
[version: string]: string;
|
|
24
|
+
};
|
|
11
25
|
}
|
|
12
26
|
export declare type NgAddSaveDepedency = 'dependencies' | 'devDependencies' | boolean;
|
|
13
27
|
export interface PackageIdentifier {
|
|
@@ -25,18 +39,16 @@ export interface PackageManifest {
|
|
|
25
39
|
license?: string;
|
|
26
40
|
private?: boolean;
|
|
27
41
|
deprecated?: boolean;
|
|
28
|
-
dependencies:
|
|
29
|
-
devDependencies:
|
|
30
|
-
peerDependencies:
|
|
31
|
-
optionalDependencies:
|
|
42
|
+
dependencies: Record<string, string>;
|
|
43
|
+
devDependencies: Record<string, string>;
|
|
44
|
+
peerDependencies: Record<string, string>;
|
|
45
|
+
optionalDependencies: Record<string, string>;
|
|
32
46
|
'ng-add'?: {
|
|
33
47
|
save?: NgAddSaveDepedency;
|
|
34
48
|
};
|
|
35
49
|
'ng-update'?: {
|
|
36
50
|
migrations: string;
|
|
37
|
-
packageGroup:
|
|
38
|
-
[name: string]: string;
|
|
39
|
-
};
|
|
51
|
+
packageGroup: Record<string, string>;
|
|
40
52
|
};
|
|
41
53
|
}
|
|
42
54
|
export interface PackageMetadata {
|
|
@@ -57,3 +69,8 @@ export declare function fetchPackageManifest(name: string, logger: logging.Logge
|
|
|
57
69
|
usingYarn?: boolean;
|
|
58
70
|
verbose?: boolean;
|
|
59
71
|
}): Promise<PackageManifest>;
|
|
72
|
+
export declare function getNpmPackageJson(packageName: string, logger: logging.LoggerApi, options?: {
|
|
73
|
+
registry?: string;
|
|
74
|
+
usingYarn?: boolean;
|
|
75
|
+
verbose?: boolean;
|
|
76
|
+
}): Promise<Partial<NpmRepositoryPackageJson>>;
|
|
@@ -6,14 +6,34 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.fetchPackageManifest = exports.fetchPackageMetadata = void 0;
|
|
29
|
+
exports.getNpmPackageJson = exports.fetchPackageManifest = exports.fetchPackageMetadata = void 0;
|
|
11
30
|
const fs_1 = require("fs");
|
|
12
31
|
const os_1 = require("os");
|
|
13
|
-
const path = require("path");
|
|
32
|
+
const path = __importStar(require("path"));
|
|
14
33
|
const lockfile = require('@yarnpkg/lockfile');
|
|
15
34
|
const ini = require('ini');
|
|
16
35
|
const pacote = require('pacote');
|
|
36
|
+
const npmPackageJsonCache = new Map();
|
|
17
37
|
let npmrc;
|
|
18
38
|
function ensureNpmrc(logger, usingYarn, verbose) {
|
|
19
39
|
if (!npmrc) {
|
|
@@ -30,6 +50,7 @@ function ensureNpmrc(logger, usingYarn, verbose) {
|
|
|
30
50
|
}
|
|
31
51
|
}
|
|
32
52
|
function readOptions(logger, yarn = false, showPotentials = false) {
|
|
53
|
+
var _a;
|
|
33
54
|
const cwd = process.cwd();
|
|
34
55
|
const baseFilename = yarn ? 'yarnrc' : 'npmrc';
|
|
35
56
|
const dotFilename = '.' + baseFilename;
|
|
@@ -48,9 +69,11 @@ function readOptions(logger, yarn = false, showPotentials = false) {
|
|
|
48
69
|
(!yarn && process.env.NPM_CONFIG_USERCONFIG) || path.join(os_1.homedir(), dotFilename),
|
|
49
70
|
];
|
|
50
71
|
const projectConfigLocations = [path.join(cwd, dotFilename)];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
if (yarn) {
|
|
73
|
+
const root = path.parse(cwd).root;
|
|
74
|
+
for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
|
|
75
|
+
projectConfigLocations.unshift(path.join(curDir, dotFilename));
|
|
76
|
+
}
|
|
54
77
|
}
|
|
55
78
|
if (showPotentials) {
|
|
56
79
|
logger.info(`Locating potential ${baseFilename} files:`);
|
|
@@ -66,27 +89,45 @@ function readOptions(logger, yarn = false, showPotentials = false) {
|
|
|
66
89
|
// See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f7af2e02c8a22bcaf9e850/index.js#L99-L126
|
|
67
90
|
const rcConfig = yarn ? lockfile.parse(data) : ini.parse(data);
|
|
68
91
|
for (const [key, value] of Object.entries(rcConfig)) {
|
|
92
|
+
let substitutedValue = value;
|
|
93
|
+
// Substitute any environment variable references.
|
|
94
|
+
if (typeof value === 'string') {
|
|
95
|
+
substitutedValue = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');
|
|
96
|
+
}
|
|
69
97
|
switch (key) {
|
|
98
|
+
// Unless auth options are scope with the registry url it appears that npm-registry-fetch ignores them,
|
|
99
|
+
// even though they are documented.
|
|
100
|
+
// https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/README.md
|
|
101
|
+
// https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/auth.js#L45-L91
|
|
102
|
+
case '_authToken':
|
|
103
|
+
case 'token':
|
|
104
|
+
case 'username':
|
|
105
|
+
case 'password':
|
|
106
|
+
case '_auth':
|
|
107
|
+
case 'auth':
|
|
108
|
+
(_a = options['forceAuth']) !== null && _a !== void 0 ? _a : (options['forceAuth'] = {});
|
|
109
|
+
options['forceAuth'][key] = substitutedValue;
|
|
110
|
+
break;
|
|
70
111
|
case 'noproxy':
|
|
71
112
|
case 'no-proxy':
|
|
72
|
-
options['noProxy'] =
|
|
113
|
+
options['noProxy'] = substitutedValue;
|
|
73
114
|
break;
|
|
74
115
|
case 'maxsockets':
|
|
75
|
-
options['maxSockets'] =
|
|
116
|
+
options['maxSockets'] = substitutedValue;
|
|
76
117
|
break;
|
|
77
118
|
case 'https-proxy':
|
|
78
119
|
case 'proxy':
|
|
79
|
-
options['proxy'] =
|
|
120
|
+
options['proxy'] = substitutedValue;
|
|
80
121
|
break;
|
|
81
122
|
case 'strict-ssl':
|
|
82
|
-
options['strictSSL'] =
|
|
123
|
+
options['strictSSL'] = substitutedValue;
|
|
83
124
|
break;
|
|
84
125
|
case 'local-address':
|
|
85
|
-
options['localAddress'] =
|
|
126
|
+
options['localAddress'] = substitutedValue;
|
|
86
127
|
break;
|
|
87
128
|
case 'cafile':
|
|
88
|
-
if (typeof
|
|
89
|
-
const cafile = path.resolve(path.dirname(location),
|
|
129
|
+
if (typeof substitutedValue === 'string') {
|
|
130
|
+
const cafile = path.resolve(path.dirname(location), substitutedValue);
|
|
90
131
|
try {
|
|
91
132
|
options['ca'] = fs_1.readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
|
|
92
133
|
}
|
|
@@ -94,21 +135,11 @@ function readOptions(logger, yarn = false, showPotentials = false) {
|
|
|
94
135
|
}
|
|
95
136
|
break;
|
|
96
137
|
default:
|
|
97
|
-
options[key] =
|
|
138
|
+
options[key] = substitutedValue;
|
|
98
139
|
break;
|
|
99
140
|
}
|
|
100
141
|
}
|
|
101
142
|
}
|
|
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
143
|
}
|
|
113
144
|
return options;
|
|
114
145
|
}
|
|
@@ -162,13 +193,8 @@ async function fetchPackageMetadata(name, logger, options) {
|
|
|
162
193
|
return metadata;
|
|
163
194
|
}
|
|
164
195
|
exports.fetchPackageMetadata = fetchPackageMetadata;
|
|
165
|
-
async function fetchPackageManifest(name, logger, options) {
|
|
166
|
-
const { usingYarn, verbose, registry } =
|
|
167
|
-
registry: undefined,
|
|
168
|
-
usingYarn: false,
|
|
169
|
-
verbose: false,
|
|
170
|
-
...options,
|
|
171
|
-
};
|
|
196
|
+
async function fetchPackageManifest(name, logger, options = {}) {
|
|
197
|
+
const { usingYarn = false, verbose = false, registry } = options;
|
|
172
198
|
ensureNpmrc(logger, usingYarn, verbose);
|
|
173
199
|
const response = await pacote.manifest(name, {
|
|
174
200
|
fullMetadata: true,
|
|
@@ -178,3 +204,35 @@ async function fetchPackageManifest(name, logger, options) {
|
|
|
178
204
|
return normalizeManifest(response);
|
|
179
205
|
}
|
|
180
206
|
exports.fetchPackageManifest = fetchPackageManifest;
|
|
207
|
+
function getNpmPackageJson(packageName, logger, options = {}) {
|
|
208
|
+
const cachedResponse = npmPackageJsonCache.get(packageName);
|
|
209
|
+
if (cachedResponse) {
|
|
210
|
+
return cachedResponse;
|
|
211
|
+
}
|
|
212
|
+
const { usingYarn = false, verbose = false, registry } = options;
|
|
213
|
+
if (!npmrc) {
|
|
214
|
+
try {
|
|
215
|
+
npmrc = readOptions(logger, false, verbose);
|
|
216
|
+
}
|
|
217
|
+
catch { }
|
|
218
|
+
if (usingYarn) {
|
|
219
|
+
try {
|
|
220
|
+
npmrc = { ...npmrc, ...readOptions(logger, true, verbose) };
|
|
221
|
+
}
|
|
222
|
+
catch { }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const resultPromise = pacote.packument(packageName, {
|
|
226
|
+
fullMetadata: true,
|
|
227
|
+
...npmrc,
|
|
228
|
+
...(registry ? { registry } : {}),
|
|
229
|
+
});
|
|
230
|
+
// TODO: find some way to test this
|
|
231
|
+
const response = resultPromise.catch((err) => {
|
|
232
|
+
logger.warn(err.message || err);
|
|
233
|
+
return { requestedName: packageName };
|
|
234
|
+
});
|
|
235
|
+
npmPackageJsonCache.set(packageName, response);
|
|
236
|
+
return response;
|
|
237
|
+
}
|
|
238
|
+
exports.getNpmPackageJson = getNpmPackageJson;
|
|
@@ -6,11 +6,30 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.getProjectDependencies = exports.findPackageJson = exports.readPackageJson = void 0;
|
|
11
|
-
const fs = require("fs");
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
12
31
|
const path_1 = require("path");
|
|
13
|
-
const resolve = require("resolve");
|
|
32
|
+
const resolve = __importStar(require("resolve"));
|
|
14
33
|
function getAllDependencies(pkg) {
|
|
15
34
|
return new Set([
|
|
16
35
|
...Object.entries(pkg.dependencies || []),
|
package/utilities/project.js
CHANGED
|
@@ -6,12 +6,31 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.findWorkspaceFile = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const fs = require("fs");
|
|
13
|
-
const os = require("os");
|
|
14
|
-
const path = require("path");
|
|
31
|
+
const fs = __importStar(require("fs"));
|
|
32
|
+
const os = __importStar(require("os"));
|
|
33
|
+
const path = __importStar(require("path"));
|
|
15
34
|
const find_up_1 = require("./find-up");
|
|
16
35
|
function findWorkspaceFile(currentDirectory = process.cwd()) {
|
|
17
36
|
const possibleConfigFiles = [
|