Socket
Socket
Sign inDemoInstall

fast-glob

Package Overview
Dependencies
17
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.0.3

1

out/providers/filters/error.d.ts

@@ -7,2 +7,3 @@ import Settings from '../../settings';

getFilter(): ErrorFilterFunction;
private _isNonFatalError;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils = require("../../utils/index");
class ErrorFilter {

@@ -8,5 +9,8 @@ constructor(_settings) {

getFilter() {
return () => this._settings.suppressErrors;
return (error) => this._isNonFatalError(error);
}
_isNonFatalError(error) {
return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
}
}
exports.default = ErrorFilter;

13

out/providers/transformers/entry.js

@@ -12,15 +12,16 @@ "use strict";

_transform(entry) {
let filepath = entry.path;
if (this._settings.absolute) {
entry.path = utils.path.makeAbsolute(this._settings.cwd, entry.path);
entry.path = utils.path.unixify(entry.path);
filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
filepath = utils.path.unixify(filepath);
}
if (this._settings.markDirectories && entry.dirent.isDirectory()) {
entry.path += '/';
filepath += '/';
}
if (this._settings.objectMode) {
return entry;
if (!this._settings.objectMode) {
return filepath;
}
return entry.path;
return Object.assign({}, entry, { path: filepath });
}
}
exports.default = EntryTransformer;

@@ -14,9 +14,3 @@ "use strict";

dynamic(root, options) {
const walk = this._walkStream(root, options);
walk.once('error', (error) => {
if (this._isFatalError(error)) {
walk.emit('error', error);
}
});
return walk;
return this._walkStream(root, options);
}

@@ -27,3 +21,3 @@ static(patterns, options) {

stream._write = (index, _enc, done) => {
return this._getEntry(filepaths[index], patterns[index])
return this._getEntry(filepaths[index], patterns[index], options)
.then((entry) => {

@@ -45,10 +39,10 @@ if (entry !== null && options.entryFilter(entry)) {

}
_getEntry(filepath, pattern) {
_getEntry(filepath, pattern, options) {
return this._getStat(filepath)
.then((stats) => this._makeEntry(stats, pattern))
.catch((error) => {
if (this._isFatalError(error)) {
throw error;
if (options.errorFilter(error)) {
return null;
}
return null;
throw error;
});

@@ -55,0 +49,0 @@ }

@@ -13,11 +13,3 @@ "use strict";

dynamic(root, options) {
try {
return this._walkSync(root, options);
}
catch (error) {
if (this._isFatalError(error)) {
throw error;
}
return [];
}
return this._walkSync(root, options);
}

@@ -28,3 +20,3 @@ static(patterns, options) {

const filepath = this._getFullEntryPath(pattern);
const entry = this._getEntry(filepath, pattern);
const entry = this._getEntry(filepath, pattern, options);
if (entry === null || !options.entryFilter(entry)) {

@@ -37,3 +29,3 @@ continue;

}
_getEntry(filepath, pattern) {
_getEntry(filepath, pattern, options) {
try {

@@ -44,6 +36,6 @@ const stats = this._getStat(filepath);

catch (error) {
if (this._isFatalError(error)) {
throw error;
if (options.errorFilter(error)) {
return null;
}
return null;
throw error;
}

@@ -50,0 +42,0 @@ }

@@ -12,2 +12,3 @@ /// <reference types="node" />

entryFilter: EntryFilterFunction;
errorFilter: ErrorFilterFunction;
fs: FileSystemAdapter;

@@ -14,0 +15,0 @@ stats: boolean;

{
"name": "fast-glob",
"version": "3.0.2",
"version": "3.0.3",
"description": "It's a very fast and efficient glob library for Node.js",

@@ -40,3 +40,3 @@ "license": "MIT",

"execa": "^1.0.0",
"fast-glob": "^2.2.0",
"fast-glob": "^3.0.2",
"glob": "^7.1.4",

@@ -66,2 +66,5 @@ "minimist": "^1.2.0",

"smoke": "mocha \"out/**/*.smoke.js\" -s 0",
"smoke:sync": "mocha \"out/**/*.smoke.js\" -s 0 --grep \"\\(sync\\)\"",
"smoke:async": "mocha \"out/**/*.smoke.js\" -s 0 --grep \"\\(async\\)\"",
"smoke:stream": "mocha \"out/**/*.smoke.js\" -s 0 --grep \"\\(stream\\)\"",
"build": "npm run clean && npm run compile && npm run lint && npm test",

@@ -73,9 +76,9 @@ "watch": "npm run clean && npm run compile -- --sourceMap --watch",

"bench-sync": "npm run bench-sync-flatten && npm run bench-sync-deep",
"bench-async-flatten": "node ./out/benchmark --type async --pattern \"*\"",
"bench-async-deep": "node ./out/benchmark --type async --pattern \"**\"",
"bench-stream-flatten": "node ./out/benchmark --type stream --pattern \"*\"",
"bench-stream-deep": "node ./out/benchmark --type stream --pattern \"**\"",
"bench-sync-flatten": "node ./out/benchmark --type sync --pattern \"*\"",
"bench-sync-deep": "node ./out/benchmark --type sync --pattern \"**\""
"bench-async-flatten": "node ./out/benchmark --mode async --pattern \"*\"",
"bench-async-deep": "node ./out/benchmark --mode async --pattern \"**\"",
"bench-stream-flatten": "node ./out/benchmark --mode stream --pattern \"*\"",
"bench-stream-deep": "node ./out/benchmark --mode stream --pattern \"**\"",
"bench-sync-flatten": "node ./out/benchmark --mode sync --pattern \"*\"",
"bench-sync-deep": "node ./out/benchmark --mode sync --pattern \"**\""
}
}

@@ -179,3 +179,3 @@ # fast-glob

const stream = fg.sync(['.editorconfig', '**/index.js'], { dot: true });
const stream = fg.stream(['.editorconfig', '**/index.js'], { dot: true });

@@ -182,0 +182,0 @@ for await (const entry of stream) {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc