Upgrade linguist dependency
This version changes how it counts python heredoc. All heredoc is counted as code.
This commit is contained in:
parent
a44b61d961
commit
b29bf7b05a
32 changed files with 410 additions and 339 deletions
43
node_modules/github-linguist/dist/directory.js
generated
vendored
43
node_modules/github-linguist/dist/directory.js
generated
vendored
|
|
@ -7,7 +7,6 @@ exports.LocDir = void 0;
|
|||
const globby_1 = __importDefault(require("globby"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const file_1 = require("./file");
|
||||
const languages_1 = require("./languages");
|
||||
|
|
@ -26,16 +25,16 @@ const defaultExclude = [
|
|||
'**/*.snap',
|
||||
// java
|
||||
'**/target',
|
||||
"**/*.class",
|
||||
"**/*.o",
|
||||
"**/bin",
|
||||
"**/*.map",
|
||||
'**/*.class',
|
||||
'**/*.o',
|
||||
'**/bin',
|
||||
'**/*.map',
|
||||
// python
|
||||
"**/*.pyc",
|
||||
"**/*.pyo",
|
||||
'**/*.pyc',
|
||||
'**/*.pyo',
|
||||
// other
|
||||
"**/*.dil",
|
||||
"**/*.ra",
|
||||
'**/*.dil',
|
||||
'**/*.ra',
|
||||
// images
|
||||
'**/*.png',
|
||||
'**/*.jpg',
|
||||
|
|
@ -97,6 +96,12 @@ const defaultExclude = [
|
|||
'**/*.tbz',
|
||||
'**/*.tgz',
|
||||
];
|
||||
function ensureArray(arr, dfault) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr) ? arr : [arr];
|
||||
}
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
|
|
@ -136,12 +141,12 @@ class LocDir {
|
|||
// that end in .ts because the globstar indicates 0 or more directory paths.
|
||||
this.exclude = ensureArray(options.exclude)
|
||||
.concat(defaultExclude)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
.map((item) => (item.endsWith('**') ? item : `${item}/**`));
|
||||
// remove all leading './' since this messes up globstar matches in the
|
||||
// excludes.
|
||||
this.include = ensureArray(options.include, '**')
|
||||
.map(item => item.startsWith('./') ? item.substring(2) : item)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
.map((item) => (item.startsWith('./') ? item.substring(2) : item))
|
||||
.map((item) => (item.endsWith('**') ? item : `${item}/**`));
|
||||
this.cwd = options.cwd || process.cwd();
|
||||
this.analysisLanguages = options.analysisLanguages;
|
||||
}
|
||||
|
|
@ -152,13 +157,14 @@ class LocDir {
|
|||
const paths = await globby_1.default(this.include, {
|
||||
cwd: this.cwd,
|
||||
ignore: this.exclude,
|
||||
nodir: true
|
||||
nodir: true,
|
||||
});
|
||||
const files = [];
|
||||
const info = { ...defaultInfo };
|
||||
let languages = {};
|
||||
// We _could_ use Promise.all to count the files in parallel, but that
|
||||
// would lead to out of memory errors when there are many files.
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const pathItem of paths) {
|
||||
const fullPath = slash2_1.default(path_1.default.join(this.cwd, pathItem));
|
||||
if (!pathItem ||
|
||||
|
|
@ -195,16 +201,9 @@ class LocDir {
|
|||
* and this language is not one of them.
|
||||
*/
|
||||
ignoreLanguage(pathItem) {
|
||||
return this.analysisLanguages && !this.analysisLanguages.includes(this.allLanguages.getType(pathItem));
|
||||
return (this.analysisLanguages &&
|
||||
!this.analysisLanguages.includes(this.allLanguages.getType(pathItem)));
|
||||
}
|
||||
}
|
||||
exports.LocDir = LocDir;
|
||||
function ensureArray(arr, dfault) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr)
|
||||
? arr
|
||||
: [arr];
|
||||
}
|
||||
//# sourceMappingURL=directory.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue