@deepcode/tsc
Advanced tools
Comparing version 2.0.16 to 2.0.17
@@ -0,1 +1,4 @@ | ||
## [2.0.17] - 2020-12-29 | ||
- Bug fixing | ||
## [2.0.16] - 2020-12-17 | ||
@@ -2,0 +5,0 @@ - Performance improvement and stability on events 'file changed' |
@@ -149,14 +149,33 @@ "use strict"; | ||
// Create remote bundle | ||
const remoteBundle = await bundles_1.remoteBundleFactory(baseURL, sessionToken, bundleFiles, [], baseDir, null, maxPayload); | ||
const remoteBundle = bundleFiles.length | ||
? await bundles_1.remoteBundleFactory(baseURL, sessionToken, bundleFiles, [], baseDir, null, maxPayload) | ||
: null; | ||
// Analyze bundle | ||
let analysisData; | ||
if (remoteBundle === null) { | ||
throw new Error('File list is empty'); | ||
analysisData = { | ||
analysisResults: { | ||
files: {}, | ||
suggestions: {}, | ||
timing: { | ||
analysis: 0, | ||
fetchingCode: 0, | ||
queue: 0, | ||
}, | ||
coverage: [], | ||
}, | ||
analysisURL: '', | ||
bundleId: '', | ||
}; | ||
} | ||
const analysisData = await analyzeBundle({ | ||
baseURL, | ||
sessionToken, | ||
includeLint, | ||
severity, | ||
bundleId: remoteBundle.bundleId, | ||
}); | ||
analysisData.analysisResults.files = normalizeResultFiles(analysisData.analysisResults.files, baseDir); | ||
else { | ||
analysisData = await analyzeBundle({ | ||
baseURL, | ||
sessionToken, | ||
includeLint, | ||
severity, | ||
bundleId: remoteBundle.bundleId, | ||
}); | ||
analysisData.analysisResults.files = normalizeResultFiles(analysisData.analysisResults.files, baseDir); | ||
} | ||
// Create bundle instance to handle extensions | ||
@@ -163,0 +182,0 @@ return { |
@@ -116,3 +116,3 @@ "use strict"; | ||
if (remoteBundle.missingFiles.length) { | ||
throw new Error(`Failed to upload files --> ${JSON.stringify(remoteBundle.missingFiles)}`.slice(0, 399)); | ||
throw new Error(`Failed to upload # files: ${remoteBundle.missingFiles.length}`); | ||
} | ||
@@ -119,0 +119,0 @@ } |
import * as flatCache from 'flat-cache'; | ||
import { ISupportedFiles, IFileInfo } from './interfaces/files.interface'; | ||
export declare function notEmpty<T>(value: T | null | undefined): value is T; | ||
export declare function parseFileIgnores(path: string): string[]; | ||
@@ -15,5 +16,5 @@ export declare function getGlobPatterns(supportedFiles: ISupportedFiles): string[]; | ||
}>; | ||
export declare function getFileInfo(filePath: string, baseDir: string, withContent?: boolean, cache?: flatCache.Cache | null): Promise<IFileInfo>; | ||
export declare function getFileInfo(filePath: string, baseDir: string, withContent?: boolean, cache?: flatCache.Cache | null): Promise<IFileInfo | null>; | ||
export declare function resolveBundleFiles(baseDir: string, bundleMissingFiles: string[]): Promise<IFileInfo[]>; | ||
export declare function resolveBundleFilePath(baseDir: string, bundleFilePath: string): string; | ||
export declare function composeFilePayloads(files: IFileInfo[], bucketSize?: number): Generator<IFileInfo[]>; |
@@ -25,3 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.composeFilePayloads = exports.resolveBundleFilePath = exports.resolveBundleFiles = exports.getFileInfo = exports.prepareExtendingBundle = exports.collectBundleFiles = exports.determineBaseDir = exports.collectIgnoreRules = exports.getGlobPatterns = exports.parseFileIgnores = void 0; | ||
exports.composeFilePayloads = exports.resolveBundleFilePath = exports.resolveBundleFiles = exports.getFileInfo = exports.prepareExtendingBundle = exports.collectBundleFiles = exports.determineBaseDir = exports.collectIgnoreRules = exports.getGlobPatterns = exports.parseFileIgnores = exports.notEmpty = void 0; | ||
const nodePath = __importStar(require("path")); | ||
@@ -37,3 +37,25 @@ const fs = __importStar(require("fs")); | ||
const isWindows = nodePath.sep === '\\'; | ||
const lStat = util_1.default.promisify(fs.lstat); | ||
const asyncLStat = util_1.default.promisify(fs.lstat); | ||
const lStat = async (path) => { | ||
let fileStats = null; | ||
try { | ||
// eslint-disable-next-line no-await-in-loop | ||
fileStats = await asyncLStat(path); | ||
} | ||
catch (err) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'EACCES' || err.code === 'EPERM') { | ||
console.log(`${path} is not accessible. Please check permissions and adjust .dcignore file to not even test this file`); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'ENOENT') { | ||
console.log(`no such file or directory: ${path}`); | ||
} | ||
} | ||
return fileStats; | ||
}; | ||
function notEmpty(value) { | ||
return value !== null && value !== undefined; | ||
} | ||
exports.notEmpty = notEmpty; | ||
const microMatchOptions = { basename: true, dot: true, posixSlashes: true }; | ||
@@ -64,3 +86,3 @@ const fgOptions = { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'EACCES') { | ||
if (err.code === 'EACCES' || err.code === 'EPERM') { | ||
console.log(`${path} is not accessible. Please check permissions and adjust .dcignore file to not even test this file`); | ||
@@ -89,3 +111,3 @@ } | ||
// Check if symlink and exclude if requested | ||
if ((fileStats.isSymbolicLink() && !symlinksEnabled) || fileStats.isFile()) | ||
if (!fileStats || (fileStats.isSymbolicLink() && !symlinksEnabled) || fileStats.isFile()) | ||
return []; | ||
@@ -145,3 +167,3 @@ // Find ignore files inside this directory | ||
// Check if symlink and exclude if requested | ||
if (fileStats.isSymbolicLink() && !symlinksEnabled) | ||
if (!fileStats || (fileStats.isSymbolicLink() && !symlinksEnabled)) | ||
continue; | ||
@@ -161,3 +183,3 @@ if (fileStats.isFile() && fileStats.size <= maxFileSize) { | ||
const fileInfo = await getFileInfo(filePath.toString(), baseDir, false, cache); | ||
if (fileInfo.size <= maxFileSize) { | ||
if (fileInfo && fileInfo.size <= maxFileSize) { | ||
yield fileInfo; | ||
@@ -172,3 +194,3 @@ } | ||
const fileInfo = await getFileInfo(filePath.toString(), baseDir, false, cache); | ||
if (fileInfo.size <= maxFileSize) { | ||
if (fileInfo && fileInfo.size <= maxFileSize) { | ||
yield fileInfo; | ||
@@ -214,3 +236,3 @@ } | ||
if (foundFiles.size) { | ||
bundleFiles = await Promise.all([...foundFiles].map(async (p) => getFileInfo(p, baseDir, false, cache))); | ||
bundleFiles = (await Promise.all([...foundFiles].map((p) => getFileInfo(p, baseDir, false, cache)))).filter(notEmpty); | ||
} | ||
@@ -231,2 +253,5 @@ } | ||
const fileStats = await lStat(filePath); | ||
if (fileStats === null) { | ||
return fileStats; | ||
} | ||
const bundlePath = getBundleFilePath(filePath, baseDir); | ||
@@ -261,3 +286,3 @@ const calcHash = (content) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'EACCES') { | ||
if (err.code === 'EACCES' || err.code === 'EPERM') { | ||
console.log(`${filePath} is not accessible. Please check permissions and adjust .dcignore file to not even test this file`); | ||
@@ -283,3 +308,3 @@ } | ||
}); | ||
const res = await Promise.all(tasks); | ||
const res = (await Promise.all(tasks)).filter(notEmpty); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
@@ -286,0 +311,0 @@ cache.save(true); |
{ | ||
"name": "@deepcode/tsc", | ||
"version": "2.0.16", | ||
"version": "2.0.17", | ||
"description": "Typescript consumer of Deepcode public API", | ||
@@ -59,3 +59,3 @@ "main": "dist/index.js", | ||
"@deepcode/dcignore": "^1.0.2", | ||
"axios": "^0.21.0", | ||
"axios": "^0.21.1", | ||
"lodash": "^4.17.19", | ||
@@ -62,0 +62,0 @@ "ignore": "^5.1.8", |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
125222
1786
0
Updatedaxios@^0.21.1