@@ -76,7 +76,7 @@ var ts;
7676 // If changing the text in this section, be sure to test `configureNightly` too.
7777 ts.versionMajorMinor = "3.4";
7878 /** The version of the TypeScript compiler release */
79- ts.version = ts.versionMajorMinor + ".4 ";
79+ ts.version = ts.versionMajorMinor + ".5 ";
8080})(ts || (ts = {}));
8181(function (ts) {
8282 /* @internal */
@@ -94845,6 +94845,11 @@ var ts;
9484594845 * typingsInstaller will run the command with `${npmLocation} install ...`.
9484694846 */
9484794847 Arguments.NpmLocation = "--npmLocation";
94848+ /**
94849+ * Flag indicating that the typings installer should try to validate the default npm location.
94850+ * If the default npm is not found when this flag is enabled, fallback to `npm install`
94851+ */
94852+ Arguments.ValidateDefaultNpmLocation = "--validateDefaultNpmLocation";
9484894853 })(Arguments = server.Arguments || (server.Arguments = {}));
9484994854 function hasArgument(argumentName) {
9485094855 return ts.sys.args.indexOf(argumentName) >= 0;
@@ -95663,13 +95668,17 @@ var ts;
9566395668 }
9566495669 return FileLog;
9566595670 }());
95666- function getDefaultNPMLocation(processName) {
95671+ function getDefaultNPMLocation(processName, validateDefaultNpmLocation, host ) {
9566795672 if (path.basename(processName).indexOf("node") === 0) {
95668- return "\"" + path.join(path.dirname(process.argv[0]), "npm") + "\"";
95669- }
95670- else {
95671- return "npm";
95673+ var npmPath = path.join(path.dirname(process.argv[0]), "npm");
95674+ if (!validateDefaultNpmLocation) {
95675+ return npmPath;
95676+ }
95677+ if (host.fileExists(npmPath)) {
95678+ return "\"" + npmPath + "\"";
95679+ }
9567295680 }
95681+ return "npm";
9567395682 }
9567495683 function loadTypesRegistryFile(typesRegistryFilePath, host, log) {
9567595684 if (!host.fileExists(typesRegistryFilePath)) {
@@ -95695,15 +95704,16 @@ var ts;
9569595704 }
9569695705 var NodeTypingsInstaller = (function (_super) {
9569795706 __extends(NodeTypingsInstaller, _super);
95698- function NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, throttleLimit, log) {
95707+ function NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, validateDefaultNpmLocation, throttleLimit, log) {
9569995708 var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, typingSafeListLocation ? ts.toPath(typingSafeListLocation, "", ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)) : ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), typesMapLocation ? ts.toPath(typesMapLocation, "", ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)) : ts.toPath("typesMap.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log) || this;
95700- _this.npmPath = npmLocation !== undefined ? npmLocation : getDefaultNPMLocation(process.argv[0]);
95709+ _this.npmPath = npmLocation !== undefined ? npmLocation : getDefaultNPMLocation(process.argv[0], validateDefaultNpmLocation, _this.installTypingHost );
9570195710 if (ts.stringContains(_this.npmPath, " ") && _this.npmPath[0] !== "\"") {
9570295711 _this.npmPath = "\"" + _this.npmPath + "\"";
9570395712 }
9570495713 if (_this.log.isEnabled()) {
9570595714 _this.log.writeLine("Process id: " + process.pid);
9570695715 _this.log.writeLine("NPM location: " + _this.npmPath + " (explicit '" + server.Arguments.NpmLocation + "' " + (npmLocation === undefined ? "not " : "") + " provided)");
95716+ _this.log.writeLine("validateDefaultNpmLocation: " + validateDefaultNpmLocation);
9570795717 }
9570895718 (_this.nodeExecSync = require("child_process").execSync);
9570995719 _this.ensurePackageDirectoryExists(globalTypingsCacheLocation);
@@ -95830,6 +95840,7 @@ var ts;
9583095840 var typingSafeListLocation = server.findArgument(server.Arguments.TypingSafeListLocation);
9583195841 var typesMapLocation = server.findArgument(server.Arguments.TypesMapLocation);
9583295842 var npmLocation = server.findArgument(server.Arguments.NpmLocation);
95843+ var validateDefaultNpmLocation = server.hasArgument(server.Arguments.ValidateDefaultNpmLocation);
9583395844 var log = new FileLog(logFilePath);
9583495845 if (log.isEnabled()) {
9583595846 process.on("uncaughtException", function (e) {
@@ -95842,7 +95853,7 @@ var ts;
9584295853 }
9584395854 process.exit(0);
9584495855 });
95845- var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, 5, log);
95856+ var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, validateDefaultNpmLocation, 5, log);
9584695857 installer.listen();
9584795858 function indent(newline, str) {
9584895859 return newline + " " + str.replace(/\r?\n/, newline + " ");
0 commit comments