diff --git a/package-lock.json b/package-lock.json index c96c7250..5ced9810 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "faker": "^5.5.3", "jimp": "^0.16.1", "js-yaml": "^4.1.0", - "linguist-js": "^1.9.1", + "linguist-js": "^2.0.0", "marked": "^3.0.0", "memory-cache": "^0.2.0", "minimatch": "^3.0.4", @@ -6382,9 +6382,9 @@ } }, "node_modules/linguist-js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/linguist-js/-/linguist-js-1.9.1.tgz", - "integrity": "sha512-UMSJU7EOKqkAcRQydt+QCSrTFnHJxbRysb/h8Vx6hzkjpmnWBebzsqsWPgMUUdQSKOpaNDcs0fAg9cEjghCG9Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/linguist-js/-/linguist-js-2.0.0.tgz", + "integrity": "sha512-DPEhkPd1fMIiNedUuSJy9rZiLAXt9mbaMVYa7Daoe5U7+4aZgMsZI7sQJh3PdT+ETRsdbVZ8UK2wNsoeE/smhw==", "dependencies": { "binary-extensions": "^2.2.0", "cross-fetch": "^3.1.4", @@ -9041,9 +9041,9 @@ } }, "node_modules/tar": { - "version": "6.1.7", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.7.tgz", - "integrity": "sha512-PBoRkOJU0X3lejJ8GaRCsobjXTgFofRDSPdSUhRSdlwJfifRlQBwGXitDItdGFu0/h0XDMCkig0RN1iT7DBxhA==", + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", "devOptional": true, "dependencies": { "chownr": "^2.0.0", @@ -14968,9 +14968,9 @@ } }, "linguist-js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/linguist-js/-/linguist-js-1.9.1.tgz", - "integrity": "sha512-UMSJU7EOKqkAcRQydt+QCSrTFnHJxbRysb/h8Vx6hzkjpmnWBebzsqsWPgMUUdQSKOpaNDcs0fAg9cEjghCG9Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/linguist-js/-/linguist-js-2.0.0.tgz", + "integrity": "sha512-DPEhkPd1fMIiNedUuSJy9rZiLAXt9mbaMVYa7Daoe5U7+4aZgMsZI7sQJh3PdT+ETRsdbVZ8UK2wNsoeE/smhw==", "requires": { "binary-extensions": "^2.2.0", "commander": "^8.1.0", @@ -17056,9 +17056,9 @@ } }, "tar": { - "version": "6.1.7", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.7.tgz", - "integrity": "sha512-PBoRkOJU0X3lejJ8GaRCsobjXTgFofRDSPdSUhRSdlwJfifRlQBwGXitDItdGFu0/h0XDMCkig0RN1iT7DBxhA==", + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", "devOptional": true, "requires": { "chownr": "^2.0.0", diff --git a/package.json b/package.json index 19028510..f0cae71a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "faker": "^5.5.3", "jimp": "^0.16.1", "js-yaml": "^4.1.0", - "linguist-js": "^1.9.1", + "linguist-js": "^2.0.0", "marked": "^3.0.0", "memory-cache": "^0.2.0", "minimatch": "^3.0.4", diff --git a/source/plugins/languages/analyzers.mjs b/source/plugins/languages/analyzers.mjs index 6b711917..23f73669 100644 --- a/source/plugins/languages/analyzers.mjs +++ b/source/plugins/languages/analyzers.mjs @@ -141,8 +141,8 @@ export async function recent({login, data, imports, rest, account}, {skipped = [ async function analyze({login, imports, data}, {results, path, categories = ["programming", "markup"]}) { //Gather language data console.debug(`metrics/compute/${login}/plugins > languages > indepth > running linguist`) - const {results:files, languages:languageResults} = await linguist(path) - Object.assign(results.colors, Object.fromEntries(Object.entries(languageResults.all).map(([lang, {color}]) => [lang, color]))) + const {files:{results:files}, languages:{results:languageResults}} = await linguist(path) + Object.assign(results.colors, Object.fromEntries(Object.entries(languageResults).map(([lang, {color}]) => [lang, color]))) //Processing diff const per_page = 1 @@ -168,9 +168,7 @@ async function analyze({login, imports, data}, {results, path, categories = ["pr //File marker if (/^[+]{3}\sb[/](?[\s\S]+)$/.test(line)) { file = `${path}/${line.match(/^[+]{3}\sb[/](?[\s\S]+)$/)?.groups?.file}`.replace(/\\/g, "/") - lang = files[file] ?? null - if (["data", "markup", "programming", "prose"].map(type => categories.includes(type) && lang in languageResults[type]).filter(type => type).length === 0) - lang = null + lang = categories.includes(languageResults[lang].type) && files[file] || null edited.add(file) return }