Comparing version 2.2.6 to 2.2.7
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -18,6 +18,5 @@ "use strict"; | ||
FileSystem.prototype.makeEntry = function (stat, pattern) { | ||
return Object.assign(stat, { | ||
path: pattern, | ||
depth: pattern.split('/').length | ||
}); | ||
stat.path = pattern; | ||
stat.depth = pattern.split('/').length; | ||
return stat; | ||
}; | ||
@@ -24,0 +23,0 @@ return FileSystem; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { EntryItem } from '../types/entries'; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function prepare(options) { | ||
var opts = Object.assign({ | ||
cwd: process.cwd(), | ||
deep: true, | ||
ignore: [], | ||
dot: false, | ||
stats: false, | ||
onlyFiles: true, | ||
onlyDirectories: false, | ||
followSymlinkedDirectories: true, | ||
unique: true, | ||
markDirectories: false, | ||
absolute: false, | ||
nobrace: false, | ||
brace: true, | ||
noglobstar: false, | ||
globstar: true, | ||
noext: false, | ||
extension: true, | ||
nocase: false, | ||
case: true, | ||
matchBase: false, | ||
transform: null | ||
}, options); | ||
var opts = __assign({ cwd: process.cwd(), deep: true, ignore: [], dot: false, stats: false, onlyFiles: true, onlyDirectories: false, followSymlinkedDirectories: true, unique: true, markDirectories: false, absolute: false, nobrace: false, brace: true, noglobstar: false, globstar: true, noext: false, extension: true, nocase: false, case: true, matchBase: false, transform: null }, options); | ||
if (opts.onlyDirectories) { | ||
@@ -28,0 +17,0 @@ opts.onlyFiles = false; |
@@ -0,0 +0,0 @@ import { Pattern, PatternsGroup } from '../types/patterns'; |
@@ -12,4 +12,8 @@ "use strict"; | ||
var negativePatterns = getNegativePatternsAsPositive(unixPatterns, unixIgnore); | ||
var staticPatterns = positivePatterns.filter(patternUtils.isStaticPattern); | ||
var dynamicPatterns = positivePatterns.filter(patternUtils.isDynamicPattern); | ||
/** | ||
* When the `case` option is disabled, all patterns must be marked as dynamic, because we cannot check filepath | ||
* directly (without read directory). | ||
*/ | ||
var staticPatterns = !options.case ? [] : positivePatterns.filter(patternUtils.isStaticPattern); | ||
var dynamicPatterns = !options.case ? positivePatterns : positivePatterns.filter(patternUtils.isDynamicPattern); | ||
var staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); | ||
@@ -82,7 +86,7 @@ var dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); | ||
dynamic: dynamic, | ||
patterns: [].concat(positive, negative.map(patternUtils.convertToNegativePattern)), | ||
positive: positive, | ||
negative: negative | ||
negative: negative, | ||
patterns: [].concat(positive, negative.map(patternUtils.convertToNegativePattern)) | ||
}; | ||
} | ||
exports.convertPatternGroupToTask = convertPatternGroupToTask; |
@@ -0,0 +0,0 @@ import micromatch = require('micromatch'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -5,3 +5,3 @@ import micromatch = require('micromatch'); | ||
import { Pattern } from '../../types/patterns'; | ||
export default class DeepFilter { | ||
export default class EntryFilter { | ||
private readonly options; | ||
@@ -8,0 +8,0 @@ private readonly micromatchOptions; |
@@ -5,4 +5,4 @@ "use strict"; | ||
var patternUtils = require("../../utils/pattern"); | ||
var DeepFilter = /** @class */ (function () { | ||
function DeepFilter(options, micromatchOptions) { | ||
var EntryFilter = /** @class */ (function () { | ||
function EntryFilter(options, micromatchOptions) { | ||
this.options = options; | ||
@@ -15,3 +15,3 @@ this.micromatchOptions = micromatchOptions; | ||
*/ | ||
DeepFilter.prototype.getFilter = function (positive, negative) { | ||
EntryFilter.prototype.getFilter = function (positive, negative) { | ||
var _this = this; | ||
@@ -25,3 +25,3 @@ var positiveRe = patternUtils.convertPatternsToRe(positive, this.micromatchOptions); | ||
*/ | ||
DeepFilter.prototype.filter = function (entry, positiveRe, negativeRe) { | ||
EntryFilter.prototype.filter = function (entry, positiveRe, negativeRe) { | ||
// Exclude duplicate results | ||
@@ -46,3 +46,3 @@ if (this.options.unique) { | ||
*/ | ||
DeepFilter.prototype.isDuplicateEntry = function (entry) { | ||
EntryFilter.prototype.isDuplicateEntry = function (entry) { | ||
return this.index.has(entry.path); | ||
@@ -53,3 +53,3 @@ }; | ||
*/ | ||
DeepFilter.prototype.createIndexRecord = function (entry) { | ||
EntryFilter.prototype.createIndexRecord = function (entry) { | ||
this.index.set(entry.path, undefined); | ||
@@ -60,3 +60,3 @@ }; | ||
*/ | ||
DeepFilter.prototype.onlyFileFilter = function (entry) { | ||
EntryFilter.prototype.onlyFileFilter = function (entry) { | ||
return this.options.onlyFiles && !entry.isFile(); | ||
@@ -67,3 +67,3 @@ }; | ||
*/ | ||
DeepFilter.prototype.onlyDirectoryFilter = function (entry) { | ||
EntryFilter.prototype.onlyDirectoryFilter = function (entry) { | ||
return this.options.onlyDirectories && !entry.isDirectory(); | ||
@@ -74,3 +74,3 @@ }; | ||
*/ | ||
DeepFilter.prototype.isSkippedByAbsoluteNegativePatterns = function (entry, negativeRe) { | ||
EntryFilter.prototype.isSkippedByAbsoluteNegativePatterns = function (entry, negativeRe) { | ||
if (!this.options.absolute) { | ||
@@ -88,7 +88,7 @@ return false; | ||
*/ | ||
DeepFilter.prototype.isMatchToPatterns = function (filepath, patternsRe) { | ||
EntryFilter.prototype.isMatchToPatterns = function (filepath, patternsRe) { | ||
return patternUtils.matchAny(filepath, patternsRe) || patternUtils.matchAny(filepath + '/', patternsRe); | ||
}; | ||
return DeepFilter; | ||
return EntryFilter; | ||
}()); | ||
exports.default = DeepFilter; | ||
exports.default = EntryFilter; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import * as readdir from '@mrmlnc/readdir-enhanced'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -48,3 +48,3 @@ "use strict"; | ||
Reader.prototype.transform = function (entry) { | ||
if (this.options.absolute && !path.isAbsolute(entry.path)) { | ||
if (this.options.absolute) { | ||
entry.path = pathUtil.makeAbsolute(this.options.cwd, entry.path); | ||
@@ -51,0 +51,0 @@ } |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
export declare type Pattern = string; | ||
export declare type PatternRe = RegExp; | ||
export declare type PatternsGroup = Record<string, Pattern[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -22,8 +22,4 @@ "use strict"; | ||
function makeAbsolute(cwd, filepath) { | ||
if (path.isAbsolute(filepath)) { | ||
return normalize(filepath); | ||
} | ||
var fullpath = path.resolve(cwd, filepath); | ||
return normalize(fullpath); | ||
return normalize(path.resolve(cwd, filepath)); | ||
} | ||
exports.makeAbsolute = makeAbsolute; |
@@ -0,0 +0,0 @@ import micromatch = require('micromatch'); |
@@ -19,3 +19,3 @@ "use strict"; | ||
function isDynamicPattern(pattern) { | ||
return isGlob(pattern); | ||
return isGlob(pattern, { strict: false }); | ||
} | ||
@@ -22,0 +22,0 @@ exports.isDynamicPattern = isDynamicPattern; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "fast-glob", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "Is a faster `node-glob` alternative", | ||
@@ -36,3 +36,3 @@ "license": "MIT", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^10.12.0", | ||
"@types/node": "^11.13.5", | ||
"@types/rimraf": "^2.0.2", | ||
@@ -51,4 +51,4 @@ "bash-glob": "^2.0.0", | ||
"tiny-glob": "^0.2.3", | ||
"tslint": "^5.11.0", | ||
"tslint-config-mrmlnc": "^1.0.0", | ||
"tslint": "^5.12.0", | ||
"tslint-config-mrmlnc": "^2.0.1", | ||
"typescript": "^3.1.3" | ||
@@ -70,4 +70,4 @@ }, | ||
"smoke": "mocha \"out/**/*.smoke.js\" -s 0", | ||
"build": "npm run clean && npm run lint && npm run compile && npm test", | ||
"watch": "npm run clean && npm run lint & npm run compile -- --sourceMap --watch", | ||
"build": "npm run clean && npm run compile && npm run lint && npm test", | ||
"watch": "npm run clean && npm run compile -- --sourceMap --watch", | ||
"bench-async-1": "node ./out/benchmark --depth 1", | ||
@@ -74,0 +74,0 @@ "bench-async-5": "node ./out/benchmark --depth 5", |
@@ -66,4 +66,12 @@ # :rocket: fast-glob | ||
Returns a `Promise<Array>` of matching entries. | ||
Returns a `Promise` with an array of matching [entries](#entry). | ||
### fg.sync(patterns, [options]) | ||
Returns an array of matching [entries](#entry). | ||
### fg.stream(patterns, [options]) | ||
Returns a [`ReadableStream`](https://nodejs.org/api/stream.html#stream_readable_streams) when the `data` event will be emitted with [`Entry`](#entry). | ||
#### patterns | ||
@@ -81,10 +89,2 @@ | ||
### fg.sync(patterns, [options]) | ||
Returns a `Array` of matching entries. | ||
### fg.stream(patterns, [options]) | ||
Returns a [`ReadableStream`](https://nodejs.org/api/stream.html#stream_readable_streams). | ||
### fg.generateTasks(patterns, [options]) | ||
@@ -119,2 +119,6 @@ | ||
## Entry | ||
The entry which can be a `string` if the [`stats`](#stats) option is disabled, otherwise `fs.Stats` with two additional `path` and `depth` properties. | ||
## Options | ||
@@ -175,6 +179,6 @@ | ||
* Type: `number|boolean` | ||
* Type: `boolean` | ||
* Default: `false` | ||
Return `fs.Stats` with `path` property instead of file path. | ||
Return `fs.Stats` with two additional `path` and `depth` properties instead of a `string`. | ||
@@ -272,4 +276,10 @@ #### onlyFiles | ||
Disable a case-insensitive regex for matching files. | ||
Disable a [case-sensitive](https://en.wikipedia.org/wiki/Case_sensitivity) mode for matching files. | ||
##### Examples | ||
* File System: `test/file.md`, `test/File.md` | ||
* Case-sensitive for `test/file.*` pattern (`false`): `test/file.md` | ||
* Case-insensitive for `test/file.*` pattern (`true`): `test/file.md`, `test/File.md` | ||
#### case | ||
@@ -343,2 +353,11 @@ | ||
## How to use UNC path? | ||
You cannot use UNC paths as patterns (due to syntax), but you can use them as `cwd` directory. | ||
```ts | ||
fg.sync('*', { cwd: '\\\\?\\C:\\Python27' /* or //?/C:/Python27 */ }); | ||
fg.sync('Python27/*', { cwd: '\\\\?\\C:\\' /* or //?/C:/ */ }); | ||
``` | ||
## Compatible with `node-glob`? | ||
@@ -345,0 +364,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126476
77
3102
409