fast-glob
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -20,4 +20,2 @@ /// <reference types="node" /> | ||
getStat(filepath: string): Promise<fs.Stats>; | ||
lstat(filepath: string): Promise<fs.Stats>; | ||
stat(filepath: string): Promise<fs.Stats>; | ||
} |
@@ -13,4 +13,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fs = require("fs"); | ||
var stream = require("stream"); | ||
var fsStat = require("@nodelib/fs.stat"); | ||
var fs_1 = require("./fs"); | ||
@@ -58,27 +58,6 @@ var FileSystemStream = /** @class */ (function (_super) { | ||
FileSystemStream.prototype.getStat = function (filepath) { | ||
var _this = this; | ||
return this.lstat(filepath) | ||
.then(function (lstat) { | ||
if (!lstat.isSymbolicLink()) { | ||
return lstat; | ||
} | ||
return _this.stat(filepath).catch(function () { return lstat; }); | ||
}) | ||
.then(function (stat) { | ||
stat.isSymbolicLink = function () { return true; }; | ||
return stat; | ||
}); | ||
return fsStat.stat(filepath, { throwErrorOnBrokenSymlinks: false }); | ||
}; | ||
FileSystemStream.prototype.lstat = function (filepath) { | ||
return new Promise(function (resolve, reject) { | ||
fs.lstat(filepath, function (err, stats) { return err ? reject(err) : resolve(stats); }); | ||
}); | ||
}; | ||
FileSystemStream.prototype.stat = function (filepath) { | ||
return new Promise(function (resolve, reject) { | ||
fs.stat(filepath, function (err, stats) { return err ? reject(err) : resolve(stats); }); | ||
}); | ||
}; | ||
return FileSystemStream; | ||
}(fs_1.default)); | ||
exports.default = FileSystemStream; |
@@ -20,4 +20,2 @@ /// <reference types="node" /> | ||
getStat(filepath: string): fs.Stats; | ||
lstat(filepath: string): fs.Stats; | ||
stat(filepath: string): fs.Stats; | ||
} |
@@ -13,3 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fs = require("fs"); | ||
var fsStat = require("@nodelib/fs.stat"); | ||
var fs_1 = require("./fs"); | ||
@@ -53,23 +53,6 @@ var FileSystemSync = /** @class */ (function (_super) { | ||
FileSystemSync.prototype.getStat = function (filepath) { | ||
var lstat = this.lstat(filepath); | ||
if (!lstat.isSymbolicLink()) { | ||
return lstat; | ||
} | ||
try { | ||
var stat = this.stat(filepath); | ||
stat.isSymbolicLink = function () { return true; }; | ||
return stat; | ||
} | ||
catch (_a) { | ||
return lstat; | ||
} | ||
return fsStat.statSync(filepath, { throwErrorOnBrokenSymlinks: false }); | ||
}; | ||
FileSystemSync.prototype.lstat = function (filepath) { | ||
return fs.lstatSync(filepath); | ||
}; | ||
FileSystemSync.prototype.stat = function (filepath) { | ||
return fs.statSync(filepath); | ||
}; | ||
return FileSystemSync; | ||
}(fs_1.default)); | ||
exports.default = FileSystemSync; |
@@ -23,3 +23,3 @@ import { Pattern, PatternsGroup } from '../types/patterns'; | ||
/** | ||
* Retrun only negative patterns. | ||
* Return only negative patterns. | ||
*/ | ||
@@ -36,4 +36,8 @@ export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[]; | ||
/** | ||
* Returns those negative patterns whose base paths includes positive base path. | ||
*/ | ||
export declare function findLocalNegativePatterns(positiveBase: string, negative: PatternsGroup): Pattern[]; | ||
/** | ||
* Create a task for positive and negative patterns. | ||
*/ | ||
export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): ITask; |
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -42,3 +62,3 @@ var patternUtils = require("../utils/pattern"); | ||
/** | ||
* Retrun only negative patterns. | ||
* Return only negative patterns. | ||
*/ | ||
@@ -73,3 +93,3 @@ function getNegativePatternsAsPositive(patterns, ignore) { | ||
return Object.keys(positive).map(function (base) { | ||
var localNegative = base in negative ? negative[base] : []; | ||
var localNegative = findLocalNegativePatterns(base, negative); | ||
var fullNegative = localNegative.concat(globalNegative); | ||
@@ -81,2 +101,14 @@ return convertPatternGroupToTask(base, positive[base], fullNegative, dynamic); | ||
/** | ||
* Returns those negative patterns whose base paths includes positive base path. | ||
*/ | ||
function findLocalNegativePatterns(positiveBase, negative) { | ||
return Object.keys(negative).reduce(function (collection, base) { | ||
if (base.startsWith(positiveBase)) { | ||
collection.push.apply(collection, __spread(negative[base])); | ||
} | ||
return collection; | ||
}, []); | ||
} | ||
exports.findLocalNegativePatterns = findLocalNegativePatterns; | ||
/** | ||
* Create a task for positive and negative patterns. | ||
@@ -83,0 +115,0 @@ */ |
@@ -57,3 +57,3 @@ "use strict"; | ||
function isNegativePattern(pattern) { | ||
return pattern.startsWith('!'); | ||
return pattern.startsWith('!') && pattern[1] !== '('; | ||
} | ||
@@ -60,0 +60,0 @@ exports.isNegativePattern = isNegativePattern; |
{ | ||
"name": "fast-glob", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Is a faster `node-glob` alternative", | ||
@@ -55,2 +55,3 @@ "license": "MIT", | ||
"@mrmlnc/readdir-enhanced": "^2.2.1", | ||
"@nodelib/fs.stat": "^1.0.1", | ||
"glob-parent": "^3.1.0", | ||
@@ -57,0 +58,0 @@ "is-glob": "^4.0.0", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
68259
6
1577
+ Added@nodelib/fs.stat@^1.0.1
+ Added@nodelib/fs.stat@1.1.3(transitive)