Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

linguist-js

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linguist-js - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

14

dist/helpers/walk-tree.js

@@ -8,22 +8,20 @@ "use strict";

const path_1 = __importDefault(require("path"));
const glob_to_regexp_1 = __importDefault(require("glob-to-regexp"));
const allFiles = new Set();
const allFolders = new Set();
/** Generate list of files in a directory. */
function walk(folder, ignoredGlobs = []) {
const ignored = ignoredGlobs.map(glob => (0, glob_to_regexp_1.default)(glob, { extended: true }));
function walk(folder, ignored = []) {
if (Array.isArray(folder)) {
for (const path of folder)
walk(path, ignoredGlobs);
walk(path, ignored);
}
else {
allFolders.add(folder.replace(/\\/g, '/'));
const files = fs_1.default.readdirSync(folder);
for (const file of files) {
if (ignored.some(pattern => pattern.test(file)))
const path = path_1.default.resolve(folder, file).replace(/\\/g, '/');
if (ignored.some(pattern => pattern.test(path)))
continue;
const path = path_1.default.resolve(folder, file);
allFolders.add(folder.replace(/\\/g, '/'));
if (fs_1.default.lstatSync(path).isDirectory()) {
allFolders.add(path.replace(/\\/g, '/'));
walk(path);
walk(path, ignored);
continue;

@@ -30,0 +28,0 @@ }

@@ -36,5 +36,5 @@ "use strict";

const ignoredFiles = [
'.git',
opts.keepVendored ? vendorData.map(path => (0, convert_pcre_1.default)(path).source) : [],
(_b = (_a = opts.ignore) === null || _a === void 0 ? void 0 : _a.map(path => (0, glob_to_regexp_1.default)('*' + path + '*', { extended: true }).source)) !== null && _b !== void 0 ? _b : [],
/\/\.git\//,
opts.keepVendored ? [] : vendorData.map(path => (0, convert_pcre_1.default)(path)),
(_b = (_a = opts.ignore) === null || _a === void 0 ? void 0 : _a.map(path => (0, glob_to_regexp_1.default)('*' + path + '*', { extended: true }))) !== null && _b !== void 0 ? _b : [],
].flat();

@@ -41,0 +41,0 @@ let { files, folders } = (0, walk_tree_1.default)(input !== null && input !== void 0 ? input : '.', ignoredFiles);

{
"name": "linguist-js",
"version": "1.8.1",
"version": "1.8.2",
"description": "Analyse languages used in a folder. Powered by GitHub Linguist, although it doesn't need to be installed.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc