Comparing version 0.5.3 to 0.5.4
@@ -10,5 +10,4 @@ export declare class TypingsInstaller { | ||
private filterTypingsToInstall; | ||
private loadNpm; | ||
private validateTypingsOnNpm; | ||
private doInstallTypingsFromNpm; | ||
} |
@@ -20,2 +20,3 @@ "use strict"; | ||
const _fs = require("fs"); | ||
const cp = require("child_process"); | ||
var fs; | ||
@@ -28,2 +29,7 @@ (function (fs) { | ||
})(fs || (fs = {})); | ||
var pcp; | ||
(function (pcp) { | ||
pcp.exec = util_1.promisify(cp.exec); | ||
})(pcp || (pcp = {})); | ||
const latest_version_1 = require("latest-version"); | ||
function stripComments(content) { | ||
@@ -96,3 +102,2 @@ const regexp = /("(?:[^\\"]*(?:\\.)?)*")|('(?:[^\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; | ||
} | ||
yield this.loadNpm(packageFile); | ||
yield this.doInstallTypingsFromNpm(yield this.validateTypingsOnNpm(typings)); | ||
@@ -126,3 +131,2 @@ this.handledTsConfig.add(key); | ||
} | ||
yield this.loadNpm(packageFile); | ||
yield this.doInstallTypingsFromNpm(yield this.validateTypingsOnNpm(typings)); | ||
@@ -193,18 +197,2 @@ this.handledPackages.add(packageFile); | ||
} | ||
loadNpm(packageFile) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const prefix = path.dirname(packageFile); | ||
let npm = yield Promise.resolve().then(() => require('npm')); | ||
yield new Promise((resolve, reject) => { | ||
npm.load({ json: true, save: false, 'save-dev': false, prefix: prefix, spin: false, loglevel: 'silent', 'progress': false, 'audit': false }, (error, config) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
else { | ||
resolve(config); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
validateTypingsOnNpm(typings) { | ||
@@ -216,13 +204,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const promises = []; | ||
let npm = yield Promise.resolve().then(() => require('npm')); | ||
for (let typing of typings) { | ||
try { | ||
promises.push(new Promise((resolve, _reject) => { | ||
npm.commands.view([typing], true, (error, _result) => { | ||
if (error) { | ||
resolve(undefined); | ||
} | ||
resolve(typing); | ||
}); | ||
})); | ||
promises.push(latest_version_1.default(typing).then(() => typing, (_error) => undefined)); | ||
} | ||
@@ -248,17 +228,5 @@ catch (error) { | ||
} | ||
let npm = yield Promise.resolve().then(() => require('npm')); | ||
return new Promise((resolve, reject) => { | ||
// NPM can't be made really silent. So we patch console.log while we are actually | ||
// updating. Will not affect outputting LSIF to stdout since we wait until the installer | ||
// is finished. | ||
const save = console.log; | ||
console.log = () => { }; | ||
npm.commands.install(typings, (error, result) => { | ||
console.log = save; | ||
if (error) { | ||
reject(error); | ||
} | ||
resolve(result); | ||
}); | ||
}); | ||
// Need to think about command length. Might be a limit. | ||
const command = `npm install --no-save ${typings.join(' ')}`; | ||
yield pcp.exec(command); | ||
}); | ||
@@ -265,0 +233,0 @@ } |
{ | ||
"name": "lsif-tsc", | ||
"description": "Tool to create an LSIF dump for TypeScript projects.", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"author": "Microsoft Corporation", | ||
@@ -22,4 +22,4 @@ "license": "MIT", | ||
"yargs": "16.2.0", | ||
"npm": "^7.5.2", | ||
"uuid": "^8.3.2", | ||
"latest-version": "5.1.0", | ||
"vscode-uri": "^3.0.2", | ||
@@ -26,0 +26,0 @@ "typescript": "https://github.com/dbaeumer/TypeScript/releases/download/4.1.3-lsif.1/typescript-4.1.3-lsif.1.tgz" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
495007
7144
1
+ Addedlatest-version@5.1.0
+ Added@sindresorhus/is@0.14.0(transitive)
+ Added@szmarczak/http-timer@1.1.2(transitive)
+ Addedcacheable-request@6.1.0(transitive)
+ Addedclone-response@1.0.3(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddefer-to-connect@1.1.3(transitive)
+ Addedduplexer3@0.1.5(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedget-stream@4.1.05.2.0(transitive)
+ Addedgot@9.6.0(transitive)
+ Addedhttp-cache-semantics@4.1.1(transitive)
+ Addedini@1.3.8(transitive)
+ Addedjson-buffer@3.0.0(transitive)
+ Addedkeyv@3.1.0(transitive)
+ Addedlatest-version@5.1.0(transitive)
+ Addedlowercase-keys@1.0.12.0.0(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addednormalize-url@4.5.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedp-cancelable@1.1.0(transitive)
+ Addedpackage-json@6.5.0(transitive)
+ Addedprepend-http@2.0.0(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedregistry-auth-token@4.2.2(transitive)
+ Addedregistry-url@5.1.0(transitive)
+ Addedresponselike@1.0.2(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedto-readable-stream@1.0.0(transitive)
+ Addedurl-parse-lax@3.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removednpm@^7.5.2
- Removednpm@7.24.2(transitive)