snyk 1.1160.0 → 1.1161.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/95.index.js
CHANGED
|
@@ -11118,11 +11118,14 @@ async function getSupportedFiles(baseURL, source, requestId, languages) {
|
|
|
11118
11118
|
const supportedFilesFromApi = resp.value;
|
|
11119
11119
|
//Given supported languages from 'registy'
|
|
11120
11120
|
if (languages) {
|
|
11121
|
-
const supportedFiles = {
|
|
11122
|
-
|
|
11123
|
-
|
|
11121
|
+
const supportedFiles = {
|
|
11122
|
+
configFiles: supportedFilesFromApi.configFiles,
|
|
11123
|
+
extensions: languages,
|
|
11124
|
+
};
|
|
11124
11125
|
//For verification only
|
|
11125
|
-
|
|
11126
|
+
// Make sure we compare file extensions between results from `registry` and `deeproxy` without case sensitivity to avoid missing some of supported extensions.
|
|
11127
|
+
const userSupportedExtensions = supportedFilesFromApi.extensions.map(e => e.toLowerCase());
|
|
11128
|
+
supportedFiles.extensions = supportedFiles.extensions.filter(langExtension => userSupportedExtensions.includes(langExtension.toLowerCase()));
|
|
11126
11129
|
emitter_1.emitter.supportedFilesLoaded(supportedFiles);
|
|
11127
11130
|
return supportedFiles;
|
|
11128
11131
|
}
|
|
@@ -11543,11 +11546,37 @@ function parseFileIgnores(path) {
|
|
|
11543
11546
|
exports.parseFileIgnores = parseFileIgnores;
|
|
11544
11547
|
function getGlobPatterns(supportedFiles) {
|
|
11545
11548
|
return [
|
|
11546
|
-
...supportedFiles.extensions.map(e =>
|
|
11549
|
+
...supportedFiles.extensions.map(e => `${generateAllCaseGlobPattern(e)}`),
|
|
11547
11550
|
...supportedFiles.configFiles.filter(e => !constants_1.EXCLUDED_NAMES.includes(e)),
|
|
11548
11551
|
];
|
|
11549
11552
|
}
|
|
11550
11553
|
exports.getGlobPatterns = getGlobPatterns;
|
|
11554
|
+
// Generates glob patterns for case-insensitive file extension matching.
|
|
11555
|
+
// E.g. *.[jJ][sS] for matching .js files without case-sensitivity.
|
|
11556
|
+
function generateAllCaseGlobPattern(fileExtension) {
|
|
11557
|
+
const chars = Array.from(fileExtension);
|
|
11558
|
+
if (!chars.length) {
|
|
11559
|
+
console.log('Invalid file extension pattern: file extension is empty.');
|
|
11560
|
+
return '';
|
|
11561
|
+
}
|
|
11562
|
+
if (chars[0] != '.') {
|
|
11563
|
+
console.log("Invalid file extension pattern: missing '.' in the beginning of the file extension. Some files may not be included in the analysis.");
|
|
11564
|
+
return '';
|
|
11565
|
+
}
|
|
11566
|
+
const caseInsensitivePatterns = chars.reduce((pattern, extensionChar, i) => {
|
|
11567
|
+
if (i == 0) {
|
|
11568
|
+
// first char should always be '.', no need to generate multiple cases for file extension character
|
|
11569
|
+
return ['*.'];
|
|
11570
|
+
}
|
|
11571
|
+
if (extensionChar.toLowerCase() == extensionChar.toUpperCase()) {
|
|
11572
|
+
// Char doesn't have case variant, return as-is.
|
|
11573
|
+
return pattern.concat(extensionChar);
|
|
11574
|
+
}
|
|
11575
|
+
const globCharPattern = `[${extensionChar.toLowerCase()}${extensionChar.toUpperCase()}]`;
|
|
11576
|
+
return pattern.concat(globCharPattern);
|
|
11577
|
+
}, []);
|
|
11578
|
+
return caseInsensitivePatterns.join('');
|
|
11579
|
+
}
|
|
11551
11580
|
async function collectIgnoreRules(dirs, symlinksEnabled = false, fileIgnores = constants_1.IGNORES_DEFAULT) {
|
|
11552
11581
|
const tasks = dirs.map(async (folder) => {
|
|
11553
11582
|
const fileStats = await lStat(folder);
|