@snyk/code-client
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -71,3 +71,5 @@ "use strict"; | ||
} | ||
const results = await (0, p_map_1.default)(tasks, async (task) => await uploadFileChunks(task), { concurrency: constants_1.UPLOAD_CONCURRENCY }); | ||
const results = await (0, p_map_1.default)(tasks, async (task) => await uploadFileChunks(task), { | ||
concurrency: constants_1.UPLOAD_CONCURRENCY, | ||
}); | ||
// Returning false if at least one result is false | ||
@@ -144,3 +146,3 @@ return results.every(r => !!r); | ||
const baseDir = (0, files_1.determineBaseDir)(options.paths); | ||
const [supportedFiles, excludesFromIgnoreFiles, excludesFromDotSnyk] = await Promise.all([ | ||
const [supportedFiles, fileIgnores] = await Promise.all([ | ||
// Fetch supporte files to save network traffic | ||
@@ -150,6 +152,3 @@ getSupportedFiles(options.baseURL, options.source), | ||
(0, files_1.collectIgnoreRules)(options.paths, options.symlinksEnabled, options.defaultFileIgnores), | ||
// Get exclusions from .snyk file | ||
(0, files_1.parseDotSnykExcludes)(`${baseDir}/${constants_1.DOTSNYK_FILENAME}`), | ||
]); | ||
const fileIgnores = [...excludesFromIgnoreFiles, ...excludesFromDotSnyk]; | ||
emitter_1.default.scanFilesProgress(0); | ||
@@ -156,0 +155,0 @@ const bundleFiles = []; |
@@ -20,3 +20,3 @@ "use strict"; | ||
exports.IGNORES_DEFAULT = [`**/${exports.GIT_FILENAME}/**`]; | ||
exports.IGNORE_FILES_NAMES = [exports.GITIGNORE_FILENAME, exports.DCIGNORE_FILENAME]; | ||
exports.IGNORE_FILES_NAMES = [exports.GITIGNORE_FILENAME, exports.DCIGNORE_FILENAME, exports.DOTSNYK_FILENAME]; | ||
exports.DCIGNORE_DRAFTS = { | ||
@@ -23,0 +23,0 @@ custom: dcignore_1.CustomDCIgnore, |
@@ -32,2 +32,1 @@ import { Cache } from './cache'; | ||
export declare function isMatch(filePath: string, rules: string[]): boolean; | ||
export declare function parseDotSnykExcludes(pathToDotSnykFile: string): string[]; |
@@ -25,3 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseDotSnykExcludes = exports.isMatch = exports.composeFilePayloads = exports.resolveBundleFilePath = exports.resolveBundleFiles = exports.getFileInfo = exports.prepareExtendingBundle = exports.collectBundleFiles = exports.determineBaseDir = exports.collectIgnoreRules = exports.getGlobPatterns = exports.parseFileIgnores = exports.notEmpty = void 0; | ||
exports.isMatch = 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")); | ||
@@ -119,2 +119,8 @@ const fs = __importStar(require("fs")); | ||
const f = fs.readFileSync(path, { encoding: 'utf8' }); | ||
if (path.includes(constants_1.DOTSNYK_FILENAME)) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const parsed = (0, yaml_1.parse)(f); | ||
const concatIgnorePath = (p) => `${nodePath.dirname(path)}/${p}`; | ||
return [...parsed.exclude.code.map(concatIgnorePath), ...parsed.exclude.global.map(concatIgnorePath)]; | ||
} | ||
rules = f | ||
@@ -399,19 +405,2 @@ .split('\n') | ||
exports.isMatch = isMatch; | ||
function parseDotSnykExcludes(pathToDotSnykFile) { | ||
try { | ||
const dotSnykFile = fs.readFileSync(pathToDotSnykFile, 'utf-8'); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const parsed = (0, yaml_1.parse)(dotSnykFile); | ||
const concatIgnorePath = (path) => `${nodePath.dirname(pathToDotSnykFile)}/${path}`; | ||
return [...parsed.exclude.code.map(concatIgnorePath), ...parsed.exclude.global.map(concatIgnorePath)]; | ||
} | ||
catch (err) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.code === 'EACCES' || err.code === 'EPERM') { | ||
console.info(`${pathToDotSnykFile} is not accessible.`); | ||
} | ||
return []; | ||
} | ||
} | ||
exports.parseDotSnykExcludes = parseDotSnykExcludes; | ||
//# sourceMappingURL=files.js.map |
@@ -84,3 +84,3 @@ { | ||
}, | ||
"version": "4.2.2" | ||
"version": "4.2.3" | ||
} |
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
124003
1714