Add the github-linguist package
This commit only adds a single package and all of its transitive dependencies. The github-linguist package will be used for counting lines of code as a baseline for databases we are analyzing.
This commit is contained in:
parent
896b4ff181
commit
c4a84a93d4
152 changed files with 17057 additions and 24 deletions
2
node_modules/github-linguist/dist/cli.d.ts
generated
vendored
Normal file
2
node_modules/github-linguist/dist/cli.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
export {};
|
||||
57
node_modules/github-linguist/dist/cli.js
generated
vendored
Executable file
57
node_modules/github-linguist/dist/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const commander_1 = __importDefault(require("commander"));
|
||||
const directory_1 = require("./directory");
|
||||
const file_1 = require("./file");
|
||||
const utils_1 = require("./utils");
|
||||
commander_1.default
|
||||
.version(utils_1.getVersion(), '-v')
|
||||
.command('file <path>')
|
||||
.description('count lines of code in a file')
|
||||
.action(async (pathPattern) => {
|
||||
try {
|
||||
const info = await (new file_1.LocFile(pathPattern).getFileInfo());
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk_1.default.cyan(`
|
||||
path: \t\t${pathPattern}
|
||||
language: \t${info.languages}
|
||||
total lines: \t${String(info.lines.total)}
|
||||
code lines: \t${String(info.lines.code)}
|
||||
comment lines: \t${String(info.lines.comment)}
|
||||
`));
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
console.error(e.stacl);
|
||||
}
|
||||
});
|
||||
const formatInfo = (info, languages) => `
|
||||
\ttotal lines: \t${String(info.total)}
|
||||
\tcode lines: \t${String(info.code)}
|
||||
\tcomment lines: \t${String(info.comment)}
|
||||
\t--------------------${Object.keys(languages)
|
||||
.map((key) => {
|
||||
const languageInfo = languages[key];
|
||||
return `\n\t${key.padEnd(10)} \t file count:${String(languageInfo.sum)} \ttotal:${String(languageInfo.total)} \tcomment:${String(languageInfo.comment)} \tcode:${String(languageInfo.code)}`;
|
||||
})
|
||||
.join('')}`;
|
||||
commander_1.default.arguments('<cmd> [env]').action(async (cmd) => {
|
||||
try {
|
||||
const { info, languages } = await (new directory_1.LocDir({
|
||||
include: cmd
|
||||
}).loadInfo());
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk_1.default.cyan(formatInfo(info, languages)));
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
console.error(e.stacl);
|
||||
}
|
||||
});
|
||||
commander_1.default.parse(process.argv);
|
||||
//# sourceMappingURL=cli.js.map
|
||||
1
node_modules/github-linguist/dist/cli.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/cli.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,0DAAgC;AAKhC,2CAAqC;AACrC,iCAA2C;AAC3C,mCAAqC;AAErC,mBAAO;KACJ,OAAO,CAAC,kBAAU,EAAE,EAAE,IAAI,CAAC;KAC3B,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;IAC5B,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,cAAO,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5D,sCAAsC;QACtC,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,IAAI,CAAC;oBACC,WAAW;sBACT,IAAI,CAAC,SAAS;yBACX,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;wBACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;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CAAC,CAAC;KACtD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC,CAAC,CAAC;AAEH,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
||||
28
node_modules/github-linguist/dist/directory.d.ts
generated
vendored
Normal file
28
node_modules/github-linguist/dist/directory.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { LineInfo } from './file';
|
||||
export interface LocDirOptions {
|
||||
cwd?: string;
|
||||
include?: string[] | string;
|
||||
exclude?: string[] | string;
|
||||
}
|
||||
export interface LocResult {
|
||||
files: string[];
|
||||
info: LineInfo;
|
||||
languages: {
|
||||
[key: string]: LineInfo & {
|
||||
sum: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
export declare class LocDir {
|
||||
private cwd;
|
||||
private include;
|
||||
private exclude;
|
||||
constructor(options: LocDirOptions);
|
||||
/**
|
||||
* Calculate directory info.
|
||||
*/
|
||||
loadInfo(): Promise<LocResult>;
|
||||
}
|
||||
116
node_modules/github-linguist/dist/directory.js
generated
vendored
Normal file
116
node_modules/github-linguist/dist/directory.js
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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 defaultInfo = {
|
||||
total: 0,
|
||||
code: 0,
|
||||
comment: 0,
|
||||
};
|
||||
const defaultExclude = [
|
||||
// javascript
|
||||
'**/*.map',
|
||||
'**/yarn**',
|
||||
'**/.github',
|
||||
'**/node_modules/**',
|
||||
'**/dist/**',
|
||||
'**/*.snap',
|
||||
// java
|
||||
'**/target'
|
||||
];
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
class LocDir {
|
||||
constructor(options) {
|
||||
Object.defineProperty(this, "cwd", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "include", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "exclude", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
// ensure all excludes are globstar. Note that '**/*.ts/**' matches files
|
||||
// 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}/**`);
|
||||
// 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}/**`);
|
||||
this.cwd = options.cwd || process.cwd();
|
||||
}
|
||||
/**
|
||||
* Calculate directory info.
|
||||
*/
|
||||
async loadInfo() {
|
||||
const paths = await globby_1.default(this.include, {
|
||||
cwd: this.cwd,
|
||||
ignore: this.exclude,
|
||||
nodir: true
|
||||
});
|
||||
const files = [];
|
||||
const info = { ...defaultInfo };
|
||||
let languages = {};
|
||||
await Promise.all(paths.map(async (pathItem) => {
|
||||
const fullPath = slash2_1.default(path_1.default.join(this.cwd, pathItem));
|
||||
if (!pathItem ||
|
||||
!(await fs_extra_1.default.pathExists(fullPath)) ||
|
||||
(await fs_extra_1.default.stat(fullPath)).isDirectory()) {
|
||||
return;
|
||||
}
|
||||
const file = new file_1.LocFile(fullPath);
|
||||
const fileLineInfo = await file.getFileInfo();
|
||||
const { lines } = fileLineInfo;
|
||||
info.total += lines.total;
|
||||
info.code += lines.code;
|
||||
info.comment += lines.comment;
|
||||
const language = { ...languages[fileLineInfo.languages] };
|
||||
language.code = lines.code + (language.code || 0);
|
||||
language.sum = (language.sum || 0) + 1;
|
||||
language.comment = lines.comment + (language.comment || 0);
|
||||
language.total = lines.total + (language.total || 0);
|
||||
languages = {
|
||||
...languages,
|
||||
[fileLineInfo.languages]: language,
|
||||
};
|
||||
files.push(fullPath);
|
||||
}));
|
||||
return {
|
||||
files,
|
||||
info,
|
||||
languages,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.LocDir = LocDir;
|
||||
function ensureArray(arr, dfault) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr)
|
||||
? arr
|
||||
: [arr];
|
||||
}
|
||||
//# sourceMappingURL=directory.js.map
|
||||
1
node_modules/github-linguist/dist/directory.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/directory.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,wDAA0B;AAC1B,gDAAwB;AACxB,aAAa;AACb,oDAA2B;AAE3B,iCAA2C;AAE3C,MAAM,WAAW,GAAa;IAC5B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;CACX,CAAC;AAkBF,MAAM,cAAc,GAAG;IACrB,aAAa;IACb,UAAU;IACV,WAAW;IACX,YAAY;IACZ,oBAAoB;IACpB,YAAY;IACZ,WAAW;IAEX,OAAO;IACP,WAAW;CACZ,CAAC;AAEF;;GAEG;AACH,MAAa,MAAM;IAKjB,YAAY,OA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AG,SAAS;gBACZ,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,QAAQ;aACnC,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,KAAK;YACL,IAAI;YACJ,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAvED,wBAuEC;AAED,SAAS,WAAW,CAAC,GAAuB,EAAE,MAAe;IAC3D,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/B;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACvB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACZ,CAAC"}
|
||||
37
node_modules/github-linguist/dist/file.d.ts
generated
vendored
Normal file
37
node_modules/github-linguist/dist/file.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* detect file info
|
||||
*/
|
||||
export interface LineInfo {
|
||||
total: number;
|
||||
code: number;
|
||||
comment: number;
|
||||
}
|
||||
export interface FileInfo {
|
||||
name: string;
|
||||
languages: string;
|
||||
size: number;
|
||||
lines: LineInfo;
|
||||
}
|
||||
/**
|
||||
* Collect language info for a single file
|
||||
*/
|
||||
export declare class LocFile {
|
||||
private debug;
|
||||
path: string;
|
||||
private rawPath;
|
||||
private language;
|
||||
/**
|
||||
* Creates an instance of LocFile.
|
||||
*/
|
||||
constructor(rawPath: string, debug?: boolean);
|
||||
/**
|
||||
* get file type through a path
|
||||
*/
|
||||
private getType;
|
||||
private filterData;
|
||||
/**
|
||||
* Get file info when LocFile init
|
||||
*/
|
||||
getFileInfo(data?: string): Promise<FileInfo>;
|
||||
getFileInfoByContent(name: string, data: string): FileInfo;
|
||||
}
|
||||
198
node_modules/github-linguist/dist/file.js
generated
vendored
Normal file
198
node_modules/github-linguist/dist/file.js
generated
vendored
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
"use strict";
|
||||
/**
|
||||
* detect file info
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LocFile = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const Path = __importStar(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const languages_1 = require("./languages");
|
||||
const DefaultLine = {
|
||||
total: 0,
|
||||
code: 0,
|
||||
comment: 0,
|
||||
};
|
||||
const DefaultFileInfo = {
|
||||
name: '',
|
||||
languages: '',
|
||||
size: 0,
|
||||
lines: DefaultLine,
|
||||
};
|
||||
/**
|
||||
* Collect language info for a single file
|
||||
*/
|
||||
class LocFile {
|
||||
/**
|
||||
* Creates an instance of LocFile.
|
||||
*/
|
||||
constructor(rawPath, debug = false) {
|
||||
Object.defineProperty(this, "debug", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: debug
|
||||
});
|
||||
Object.defineProperty(this, "path", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "rawPath", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "language", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: new languages_1.Languages()
|
||||
});
|
||||
Object.defineProperty(this, "filterData", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: (data, regexes) => {
|
||||
const lines = data.split(/\n/);
|
||||
let commentLength = 0;
|
||||
let codeLength = lines.length;
|
||||
const total = codeLength;
|
||||
let inMultiLineComment = false;
|
||||
lines.forEach((line) => {
|
||||
let lineType = 'code';
|
||||
line = line.trim();
|
||||
if (inMultiLineComment) {
|
||||
let noCode = true;
|
||||
if (regexes.multiLineCommentClose.test(line)) {
|
||||
// line contains the end of a multi-line comment
|
||||
inMultiLineComment = false;
|
||||
if (!regexes.multiLineCommentCloseEnd.test(line)) {
|
||||
// the multiline comment does not end this line.
|
||||
// there is real code on it.
|
||||
noCode = false;
|
||||
}
|
||||
}
|
||||
if (noCode) {
|
||||
lineType = 'comm';
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
}
|
||||
}
|
||||
else if (line) {
|
||||
// non-empty line
|
||||
if (regexes.multiLineCommentOpen.test(line)) {
|
||||
// line contains the start of a multi-line comment
|
||||
// might contain some real code, but we'll let that slide
|
||||
if (!regexes.multiLineCommentOpenAndClose.test(line)) {
|
||||
// comment is not also closed on this line
|
||||
inMultiLineComment = true;
|
||||
}
|
||||
if (regexes.multiLineCommentOpenStart.test(line)) {
|
||||
// The comment starts the line. There is no other code on this line
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
}
|
||||
else if (regexes.singleLineComment.test(line)) {
|
||||
// line contains only a single line comment
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// empty line
|
||||
codeLength -= 1;
|
||||
lineType = 'empt';
|
||||
}
|
||||
if (this.debug) {
|
||||
console.log(lineType, line);
|
||||
}
|
||||
});
|
||||
return {
|
||||
...DefaultLine,
|
||||
total,
|
||||
code: codeLength,
|
||||
comment: commentLength,
|
||||
};
|
||||
}
|
||||
});
|
||||
this.path = slash2_1.default(rawPath);
|
||||
this.rawPath = rawPath;
|
||||
}
|
||||
/**
|
||||
* get file type through a path
|
||||
*/
|
||||
getType(path) {
|
||||
const fileExtension = `.${path.split('.').pop()}`;
|
||||
return this.language.extensionMap[fileExtension] || '';
|
||||
}
|
||||
/**
|
||||
* Get file info when LocFile init
|
||||
*/
|
||||
async getFileInfo(data) {
|
||||
if (!(await fs.pathExists(this.rawPath))) {
|
||||
throw new Error(`Error: file ${this.rawPath} does not exist.`);
|
||||
}
|
||||
let newData = data;
|
||||
const info = Object.assign({}, DefaultFileInfo);
|
||||
const name = this.path.split(Path.sep).pop() || '';
|
||||
try {
|
||||
const stat = await fs.stat(this.path);
|
||||
if (!stat.isFile()) {
|
||||
return info;
|
||||
}
|
||||
newData = data || await fs.readFile(this.path, 'utf-8');
|
||||
info.name = name;
|
||||
info.size = (stat && stat.size) || 0;
|
||||
info.languages = this.getType(this.path);
|
||||
if (!info.languages) {
|
||||
return info;
|
||||
}
|
||||
if (newData) {
|
||||
const regexes = this.language.getRegexes(info.languages);
|
||||
info.lines = this.filterData(newData, regexes);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('read file failed.');
|
||||
}
|
||||
return info;
|
||||
}
|
||||
getFileInfoByContent(name, data) {
|
||||
const info = Object.assign({}, DefaultFileInfo);
|
||||
info.name = name;
|
||||
info.languages = this.getType(name);
|
||||
info.lines = this.filterData(data, this.language.getRegexes(info.languages));
|
||||
return info;
|
||||
}
|
||||
}
|
||||
exports.LocFile = LocFile;
|
||||
//# sourceMappingURL=file.js.map
|
||||
1
node_modules/github-linguist/dist/file.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/file.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,2CAA6B;AAC7B,aAAa;AACb,oDAA2B;AAE3B,2CAAiD;AAejD,MAAM,WAAW,GAAa;IAC5B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,MAAM,eAAe,GAAa;IAChC,IAAI,EAAE,EAAE;IACR,SAAS,EAAE,EAAE;IACb,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF;;GAEG;AACH,MAAa,OAAO;IAMlB;;OAEG;IACH,YAAY,OAAe,EAAU,QAAQ,KAAK;;;;;mBAAb;;QARrC;;;;;WAAoB;QACpB;;;;;WAAwB;QAExB;;;;mBAAmB,IAAI,qBAAS,EAAE;WAAC;QAkBnC;;;;mBAAqB,CAAC,IAAY,EAAE,OAAgB,EAAY,EAAE;gBAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC/B,IAAI,aAAa,GAAG,CAAC,CAAC;gBACtB,IAAI,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;gBAC9B,MAAM,KAAK,GAAG,UAAU,CAAC;gBAEzB,IAAI,kBAAkB,GAAG,KAAK,CAAC;gBAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBAErB,IAAI,QAAQ,GAAG,MAAM,CAAC;oBACtB,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;oBAEnB,IAAI,kBAAkB,EAAE;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AAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YACD,IAAI,OAAO,EAAE;gBACX,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;aAChD;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;SACtC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,oBAAoB,CAAC,IAAY,EAAE,IAAY;QACpD,MAAM,IAAI,GAAa,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1ID,0BA0IC"}
|
||||
5
node_modules/github-linguist/dist/index.d.ts
generated
vendored
Normal file
5
node_modules/github-linguist/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { LocResult } from './directory';
|
||||
export { LocDir, LocDirOptions } from './directory';
|
||||
export { LocFile, LineInfo } from './file';
|
||||
declare const loc: (fileOrDir: string) => Promise<LocResult>;
|
||||
export default loc;
|
||||
31
node_modules/github-linguist/dist/index.js
generated
vendored
Normal file
31
node_modules/github-linguist/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const directory_1 = require("./directory");
|
||||
const file_1 = require("./file");
|
||||
var directory_2 = require("./directory");
|
||||
Object.defineProperty(exports, "LocDir", { enumerable: true, get: function () { return directory_2.LocDir; } });
|
||||
var file_2 = require("./file");
|
||||
Object.defineProperty(exports, "LocFile", { enumerable: true, get: function () { return file_2.LocFile; } });
|
||||
const loc = async (fileOrDir) => {
|
||||
const stat = await fs_extra_1.default.stat(slash2_1.default(fileOrDir));
|
||||
if (stat.isFile()) {
|
||||
const locFile = new file_1.LocFile(slash2_1.default(fileOrDir));
|
||||
const info = await locFile.getFileInfo();
|
||||
const filePath = locFile.path;
|
||||
return {
|
||||
info: info.lines,
|
||||
files: [filePath],
|
||||
languages: { [info.languages]: { ...info.lines, sum: 1 } },
|
||||
};
|
||||
}
|
||||
const locDir = new directory_1.LocDir({ cwd: slash2_1.default(fileOrDir) });
|
||||
return locDir.loadInfo();
|
||||
};
|
||||
exports.default = loc;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/github-linguist/dist/index.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,aAAa;AACb,oDAA2B;AAC3B,wDAA0B;AAE1B,2CAAgD;AAChD,iCAAiC;AAEjC,yCAAoD;AAA3C,mGAAA,MAAM,OAAA;AACf,+BAA2C;AAAlC,+FAAA,OAAO,OAAA;AAEhB,MAAM,GAAG,GAAG,KAAK,EACf,SAAiB,EACG,EAAE;IACtB,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,gBAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7C,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,IAAI,cAAO,CAAC,gBAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;QACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;QAC9B,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;SAC3D,CAAC;KACH;IACD,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,EAAE,GAAG,EAAE,gBAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
||||
43
node_modules/github-linguist/dist/languages.d.ts
generated
vendored
Normal file
43
node_modules/github-linguist/dist/languages.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
export interface DetectorOptions {
|
||||
}
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
* @export
|
||||
* @class LanguageDetector
|
||||
*/
|
||||
export declare class Languages {
|
||||
extensionMap: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/**
|
||||
* Creates an instance of Detector.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* load language before detecting
|
||||
*/
|
||||
private loadExtensionMap;
|
||||
/**
|
||||
* Retrieve the regular expressions for a given language.
|
||||
* This is incomplete, but covers most of the languages we
|
||||
* see in the wild.
|
||||
*
|
||||
* @param language the language to retrieve regexes for
|
||||
*/
|
||||
getRegexes(language: string): Regexes;
|
||||
/**
|
||||
* return extension map
|
||||
*/
|
||||
getExtensionMap(): {
|
||||
[key: string]: string;
|
||||
};
|
||||
}
|
||||
export interface Regexes {
|
||||
singleLineComment: RegExp;
|
||||
multiLineCommentOpen: RegExp;
|
||||
multiLineCommentOpenStart: RegExp;
|
||||
multiLineCommentClose: RegExp;
|
||||
multiLineCommentCloseEnd: RegExp;
|
||||
multiLineCommentOpenAndClose: RegExp;
|
||||
}
|
||||
136
node_modules/github-linguist/dist/languages.js
generated
vendored
Normal file
136
node_modules/github-linguist/dist/languages.js
generated
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Languages = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
// tslint:disable-next-line
|
||||
const languageMap = require('language-map');
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
* @export
|
||||
* @class LanguageDetector
|
||||
*/
|
||||
class Languages {
|
||||
/**
|
||||
* Creates an instance of Detector.
|
||||
*/
|
||||
constructor() {
|
||||
Object.defineProperty(this, "extensionMap", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: {}
|
||||
});
|
||||
/**
|
||||
* load language before detecting
|
||||
*/
|
||||
Object.defineProperty(this, "loadExtensionMap", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: () => {
|
||||
const extensions = {};
|
||||
Object.keys(languageMap).forEach((language) => {
|
||||
const languageMode = languageMap[language];
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension) => {
|
||||
extensions[extension.toLowerCase()] = language.toLowerCase();
|
||||
});
|
||||
});
|
||||
return Object.assign({}, extensions, utils_1.ExtensionJustify);
|
||||
}
|
||||
});
|
||||
this.extensionMap = this.loadExtensionMap();
|
||||
}
|
||||
/**
|
||||
* Retrieve the regular expressions for a given language.
|
||||
* This is incomplete, but covers most of the languages we
|
||||
* see in the wild.
|
||||
*
|
||||
* @param language the language to retrieve regexes for
|
||||
*/
|
||||
getRegexes(language) {
|
||||
switch (language) {
|
||||
case 'html':
|
||||
case 'xml':
|
||||
return ALL_REGEXES.html;
|
||||
case 'ruby':
|
||||
return ALL_REGEXES.ruby;
|
||||
case 'python':
|
||||
return ALL_REGEXES.python;
|
||||
default:
|
||||
// not exact, but likely the best guess for any other unspecified language.
|
||||
return ALL_REGEXES.c;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* return extension map
|
||||
*/
|
||||
getExtensionMap() {
|
||||
return this.extensionMap;
|
||||
}
|
||||
}
|
||||
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
|
||||
1
node_modules/github-linguist/dist/languages.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/languages.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAE3C,2BAA2B;AAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAU5C;;;;;GAKG;AACH,MAAa,SAAS;IAKpB;;OAEG;IACH;QAPA;;;;mBAEI,EAAE;WAAC;QASP;;WAEG;QACH;;;;mBAA2B,GAAG,EAAE;gB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AAE,OAAO;QAElC,gCAAgC;QAChC,qBAAqB,EAAE,MAAM;QAE7B,8BAA8B;QAC9B,wBAAwB,EAAE,OAAO;QAEjC,oBAAoB;QACpB,4BAA4B,EAAE,YAAY;KAC3C;IAED,MAAM,EAAE;QACN,+CAA+C;QAC/C,iBAAiB,EAAE,IAAI;QAEvB,2DAA2D;QAC3D,0DAA0D;QAC1D,4CAA4C;QAC5C,oBAAoB,EAAE,KAAK;QAE3B,iCAAiC;QACjC,yBAAyB,EAAE,MAAM;QAEjC,oCAAoC;QACpC,qBAAqB,EAAE,KAAK;QAE5B,+BAA+B;QAC/B,wBAAwB,EAAE,MAAM;QAEhC,sBAAsB;QACtB,4BAA4B,EAAE,UAAU;KACzC;IAED,IAAI,EAAE;QACJ,+CAA+C;QAC/C,iBAAiB,EAAE,IAAI;QAEvB,uDAAuD;QACvD,qBAAqB;QAErB,oCAAoC;QACpC,oBAAoB,EAAE,SAAS;QAE/B,oCAAoC;QACpC,yBAAyB,EAAE,SAAS;QAEpC,gCAAgC;QAChC,qBAAqB,EAAE,OAAO;QAE9B,gCAAgC;QAChC,wBAAwB,EAAE,QAAQ;QAElC,uBAAuB;QACvB,4BAA4B,EAAE,MAAM;KACrC;IAED,IAAI,EAAE;QACJ,kCAAkC;QAClC,iBAAiB,EAAE,MAAM;QAEzB,oCAAoC;QACpC,oBAAoB,EAAE,MAAM;QAE5B,oCAAoC;QACpC,yBAAyB,EAAE,OAAO;QAElC,gCAAgC;QAChC,qBAAqB,EAAE,KAAK;QAE5B,gCAAgC;QAChC,wBAAwB,EAAE,MAAM;QAEhC,uBAAuB;QACvB,4BAA4B,EAAE,WAAW;KAC1C;CACF,CAAC"}
|
||||
13
node_modules/github-linguist/dist/utils.d.ts
generated
vendored
Normal file
13
node_modules/github-linguist/dist/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Get package version.
|
||||
*
|
||||
* @export getVersion
|
||||
* @returns {string}
|
||||
*/
|
||||
export declare function getVersion(): string;
|
||||
export declare const ExtensionJustify: {
|
||||
'.ts': string;
|
||||
'.jsx': string;
|
||||
'.js': string;
|
||||
'.tsx': string;
|
||||
};
|
||||
29
node_modules/github-linguist/dist/utils.js
generated
vendored
Normal file
29
node_modules/github-linguist/dist/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExtensionJustify = exports.getVersion = void 0;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const packagePath = slash2_1.default(path_1.default.join(__dirname, '../', 'package.json'));
|
||||
/**
|
||||
* Get package version.
|
||||
*
|
||||
* @export getVersion
|
||||
* @returns {string}
|
||||
*/
|
||||
function getVersion() {
|
||||
const packageInfo = JSON.parse(fs_1.default.readFileSync(packagePath, 'utf8'));
|
||||
return (packageInfo && packageInfo.version) || 'invalid version!';
|
||||
}
|
||||
exports.getVersion = getVersion;
|
||||
exports.ExtensionJustify = {
|
||||
'.ts': 'typescript',
|
||||
'.jsx': 'javascript',
|
||||
'.js': 'javascript',
|
||||
'.tsx': 'typescript',
|
||||
};
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/github-linguist/dist/utils.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/utils.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,aAAa;AACb,oDAA2B;AAE3B,MAAM,WAAW,GAAG,gBAAK,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,SAAgB,UAAU;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAErE,OAAO,CAAC,WAAW,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC;AACpE,CAAC;AAJD,gCAIC;AAEY,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;CACrB,CAAC"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue