@deepcode/tsc
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -0,1 +1,5 @@ | ||
## [2.0.12] - 2020-10-27 | ||
- Error-tolerant handling of issues with file access permissions | ||
- Additional handling of "socket hangup" network issue | ||
## [2.0.8-2.0.10] - 2020-10-27 | ||
@@ -2,0 +6,0 @@ - Bug fixing |
@@ -15,2 +15,3 @@ "use strict"; | ||
const analysis_result_interface_1 = require("./interfaces/analysis-result.interface"); | ||
const sleep = (duration) => new Promise(resolve => setTimeout(resolve, duration)); | ||
async function pollAnalysis({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, }) { | ||
@@ -20,3 +21,3 @@ let analysisResponse; | ||
emitter_1.default.analyseProgress({ | ||
status: http_1.AnalysisStatus.fetching, | ||
status: http_1.AnalysisStatus.waiting, | ||
progress: 0, | ||
@@ -39,3 +40,4 @@ }); | ||
analysisData = analysisResponse.value; | ||
if (analysisData.status === http_1.AnalysisStatus.fetching || | ||
if (analysisData.status === http_1.AnalysisStatus.waiting || | ||
analysisData.status === http_1.AnalysisStatus.fetching || | ||
analysisData.status === http_1.AnalysisStatus.analyzing || | ||
@@ -55,2 +57,3 @@ analysisData.status === http_1.AnalysisStatus.dcDone) { | ||
} | ||
await sleep(500); | ||
} | ||
@@ -138,3 +141,3 @@ } | ||
if (!files.length && !removedFiles.length) { | ||
return null; // nothing to extend, just return previous bundle | ||
return null; // nothing to extend, just return null | ||
} | ||
@@ -144,3 +147,5 @@ // Extend remote bundle | ||
if (remoteBundle === null) { | ||
throw new Error('File list is empty'); | ||
// File list is empty | ||
// nothing to extend, just return null | ||
return null; | ||
} | ||
@@ -147,0 +152,0 @@ const analysisData = await analyzeBundle({ |
@@ -7,2 +7,3 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const { NODE_ENV } = process.env; | ||
const axios_ = axios_1.default.create({ | ||
@@ -14,19 +15,21 @@ responseType: 'json', | ||
}); | ||
axios_.interceptors.request.use((config) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const { method, url, data } = config; | ||
console.log(`=> HTTP ${method === null || method === void 0 ? void 0 : method.toUpperCase()} ${url} ${data ? JSON.stringify(data) : ''}`.slice(0, 399)); | ||
return config; | ||
}, (error) => { | ||
console.error(`Request error --> ${error.message}`); | ||
throw error; | ||
}); | ||
axios_.interceptors.response.use((response) => { | ||
console.log(`<= Response: ${response.status} ${JSON.stringify(response.data)}`.slice(0, 399)); | ||
return response; | ||
}, (error) => { | ||
console.warn(`Response error --> ${error.message}`); | ||
throw error; | ||
}); | ||
if (NODE_ENV !== 'test') { | ||
axios_.interceptors.request.use((config) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const { method, url, data } = config; | ||
console.log(`=> HTTP ${method === null || method === void 0 ? void 0 : method.toUpperCase()} ${url} ${data ? JSON.stringify(data) : ''}`.slice(0, 399)); | ||
return config; | ||
}, (error) => { | ||
console.error(`Request error --> ${error.message}`); | ||
throw error; | ||
}); | ||
axios_.interceptors.response.use((response) => { | ||
console.log(`<= Response: ${response.status} ${JSON.stringify(response.data)}`.slice(0, 399)); | ||
return response; | ||
}, (error) => { | ||
console.warn(`Response error --> ${error.message}`); | ||
throw error; | ||
}); | ||
} | ||
exports.default = axios_; | ||
//# sourceMappingURL=axios.js.map |
@@ -43,2 +43,3 @@ "use strict"; | ||
onlyFiles: true, | ||
suppressErrors: true, | ||
}; | ||
@@ -51,18 +52,23 @@ function filterSupportedFiles(files, supportedFiles) { | ||
function parseFileIgnores(path) { | ||
let rules = []; | ||
const dirname = nodePath.dirname(path); | ||
const f = fs.readFileSync(path, { encoding: 'utf8' }); | ||
const rules = f | ||
.split('\n') | ||
.map(l => l.trim().replace(/\/$/, '')) // Remove white spaces and trim slashes | ||
.filter(l => !!l && !l.startsWith('#')); | ||
const results = []; | ||
for (const rule of rules) { | ||
try { | ||
const f = fs.readFileSync(path, { encoding: 'utf8' }); | ||
rules = f | ||
.split('\n') | ||
.map(l => l.trim().replace(/\/$/, '')) // Remove white spaces and trim slashes | ||
.filter(l => !!l && !l.startsWith('#')); | ||
} | ||
catch (err) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'EACCES') { | ||
console.log(`${path} is not accessible. Please check permissions and adjust .dcignore file to not even test this file`); | ||
} | ||
} | ||
return rules.map(rule => { | ||
if (rule.startsWith('/') || rule.startsWith('**')) { | ||
results.push(nodePath.posix.join(dirname, rule)); | ||
return nodePath.posix.join(dirname, rule); | ||
} | ||
else { | ||
results.push(nodePath.posix.join(dirname, '**', rule)); | ||
} | ||
} | ||
return results; | ||
return nodePath.posix.join(dirname, '**', rule); | ||
}); | ||
} | ||
@@ -243,6 +249,14 @@ exports.parseFileIgnores = parseFileIgnores; | ||
if (!fileHash) { | ||
fileContent = fs.readFileSync(filePath, { encoding: 'utf8' }); | ||
fileHash = calcHash(fileContent); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
cache === null || cache === void 0 ? void 0 : cache.setKey(filePath, [fileStats.size, fileStats.mtimeMs, fileHash]); | ||
try { | ||
fileContent = fs.readFileSync(filePath, { encoding: 'utf8' }); | ||
fileHash = calcHash(fileContent); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
cache === null || cache === void 0 ? void 0 : cache.setKey(filePath, [fileStats.size, fileStats.mtimeMs, fileHash]); | ||
} | ||
catch (err) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'EACCES') { | ||
console.log(`${filePath} is not accessible. Please check permissions and adjust .dcignore file to not even test this file`); | ||
} | ||
} | ||
} | ||
@@ -249,0 +263,0 @@ return { |
@@ -73,2 +73,3 @@ import { AxiosError } from 'axios'; | ||
export declare enum AnalysisStatus { | ||
waiting = "WAITING", | ||
fetching = "FETCHING", | ||
@@ -81,3 +82,3 @@ analyzing = "ANALYZING", | ||
export declare type AnalysisResponseProgress = { | ||
readonly status: AnalysisStatus.fetching | AnalysisStatus.analyzing | AnalysisStatus.dcDone; | ||
readonly status: AnalysisStatus.waiting | AnalysisStatus.fetching | AnalysisStatus.analyzing | AnalysisStatus.dcDone; | ||
readonly progress: number; | ||
@@ -84,0 +85,0 @@ }; |
@@ -21,2 +21,6 @@ "use strict"; | ||
} | ||
if (errno === 'ECONNRESET') { | ||
// set connectionRefused item | ||
return constants_1.ErrorCodes.connectionRefused; | ||
} | ||
if (code === 'ENOTFOUND') { | ||
@@ -252,2 +256,3 @@ return constants_1.ErrorCodes.dnsNotFound; | ||
(function (AnalysisStatus) { | ||
AnalysisStatus["waiting"] = "WAITING"; | ||
AnalysisStatus["fetching"] = "FETCHING"; | ||
@@ -254,0 +259,0 @@ AnalysisStatus["analyzing"] = "ANALYZING"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSarif = void 0; | ||
exports.getSarif = (analysisResults) => { | ||
const getSarif = (analysisResults) => { | ||
const { tool, suggestions } = getTools(analysisResults, getSuggestions(analysisResults)); | ||
@@ -18,2 +18,3 @@ const results = getResults(suggestions); | ||
}; | ||
exports.getSarif = getSarif; | ||
const getSuggestions = (analysisResults) => { | ||
@@ -20,0 +21,0 @@ const suggestions = {}; |
{ | ||
"name": "@deepcode/tsc", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"description": "Typescript consumer of Deepcode public API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
117678
1662
2