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
139
node_modules/github-linguist/dist/languages.js
generated
vendored
139
node_modules/github-linguist/dist/languages.js
generated
vendored
|
|
@ -1,9 +1,11 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Languages = void 0;
|
||||
const languages_json_1 = __importDefault(require("language-map/languages.json"));
|
||||
const utils_1 = require("./utils");
|
||||
// tslint:disable-next-line
|
||||
const languageMap = require('language-map');
|
||||
/**
|
||||
* The extension map can contain multiple languages with the same extension,
|
||||
* but we only want a single one. For the moment, these clashes are resolved
|
||||
|
|
@ -12,7 +14,70 @@ const languageMap = require('language-map');
|
|||
* where the extension is ambiguous. The ordering of the list matters and
|
||||
* languages earlier on will get a higher priority when resolving clashes.
|
||||
*/
|
||||
const importantLanguages = ["javascript", "typescript", "ruby", "python", "java", "c", "c++", "c#", "rust", "scala", "perl", "go"];
|
||||
const importantLanguages = [
|
||||
'javascript',
|
||||
'typescript',
|
||||
'ruby',
|
||||
'python',
|
||||
'java',
|
||||
'c',
|
||||
'c++',
|
||||
'c#',
|
||||
'rust',
|
||||
'scala',
|
||||
'perl',
|
||||
'go',
|
||||
];
|
||||
const ALL_REGEXES = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//,
|
||||
},
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
},
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/,
|
||||
},
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/,
|
||||
},
|
||||
};
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
|
|
@ -39,8 +104,8 @@ class Languages {
|
|||
writable: true,
|
||||
value: () => {
|
||||
const extensions = {};
|
||||
Object.keys(languageMap).forEach((language) => {
|
||||
const languageMode = languageMap[language];
|
||||
Object.keys(languages_json_1.default).forEach((language) => {
|
||||
const languageMode = languages_json_1.default[language];
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension) => {
|
||||
const lowerCaseExtension = extension.toLowerCase();
|
||||
|
|
@ -61,7 +126,7 @@ class Languages {
|
|||
}
|
||||
});
|
||||
});
|
||||
return Object.assign({}, extensions, utils_1.ExtensionJustify);
|
||||
return { ...extensions, ...utils_1.ExtensionJustify };
|
||||
}
|
||||
});
|
||||
this.extensionMap = this.loadExtensionMap();
|
||||
|
|
@ -102,66 +167,4 @@ class Languages {
|
|||
}
|
||||
}
|
||||
exports.Languages = Languages;
|
||||
const ALL_REGEXES = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//
|
||||
},
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// matches when """ starts a line. This is not right, since
|
||||
// a multiline string is not always a comment, but for the
|
||||
// sake of simplicity, we will do that here.
|
||||
multiLineCommentOpen: /"""/,
|
||||
// matches when """ starts a line
|
||||
multiLineCommentOpenStart: /^"""/,
|
||||
// matches when """ exists in a line
|
||||
multiLineCommentClose: /"""/,
|
||||
// matches when """ ends a line
|
||||
multiLineCommentCloseEnd: /"""$/,
|
||||
// matches """ ... """
|
||||
multiLineCommentOpenAndClose: /""".*"""/
|
||||
},
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/
|
||||
},
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=languages.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue