pax_global_header00006660000000000000000000000064142370037520014515gustar00rootroot0000000000000052 comment=6cf28fab38853335c077a2ad578fd174f4730682 filelist-1.0.4/000077500000000000000000000000001423700375200133325ustar00rootroot00000000000000filelist-1.0.4/.gitignore000066400000000000000000000000141423700375200153150ustar00rootroot00000000000000node_modulesfilelist-1.0.4/LICENSE000066400000000000000000000261361423700375200143470ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. filelist-1.0.4/README.md000066400000000000000000000041231423700375200146110ustar00rootroot00000000000000## FileList A FileList is a lazy-evaluated list of files. When given a list of glob patterns for possible files to be included in the file list, instead of searching the file structures to find the files, a FileList holds the pattern for latter use. This allows you to define a FileList to match any number of files, but only search out the actual files when then FileList itself is actually used. The key is that the first time an element of the FileList/Array is requested, the pending patterns are resolved into a real list of file names. ### Usage Add files to the list with the `include` method. You can add glob patterns, individual files, or RegExp objects. When the Array methods are invoked on the FileList, these items are resolved to an actual list of files. ```javascript var fl = new FileList(); fl.include('test/*.js'); fl.exclude('test/helpers.js'); ``` Use the `exclude` method to override inclusions. You can use this when your inclusions are too broad. ### Array methods FileList has lazy-evaluated versions of most of the array methods, including the following: * join * pop * push * concat * reverse * shift * unshift * slice * splice * sort * filter * forEach * some * every * map * indexOf * lastIndexOf * reduce * reduceRight When you call one of these methods, the items in the FileList will be resolved to the full list of files, and the method will be invoked on that result. ### Special `length` method `length`: FileList includes a length *method* (instead of a property) which returns the number of actual files in the list once it's been resolved. ### FileList-specific methods `include`: Add a filename/glob/regex to the list `exclude`: Override inclusions by excluding a filename/glob/regex `resolve`: Resolve the items in the FileList to the full list of files. This method is invoked automatically when one of the array methods is called. `toArray`: Immediately resolves the list of items, and returns an actual array of filepaths. `clearInclusions`: Clears any pending items -- must be used before resolving the list. `clearExclusions`: Clears the list of exclusions rules. filelist-1.0.4/index.d.ts000066400000000000000000000044541423700375200152420ustar00rootroot00000000000000// IncludeOptions definitions copied from minimatch (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/minimatch/index.d.ts) interface IncludeOptions { /** * Dump a ton of stuff to stderr. * * @default false */ debug?: boolean; /** * Do not expand {a,b} and {1..3} brace sets. * * @default false */ nobrace?: boolean; /** * Disable ** matching against multiple folder names. * * @default false */ noglobstar?: boolean; /** * Allow patterns to match filenames starting with a period, * even if the pattern does not explicitly have a period in that spot. * * @default false */ dot?: boolean; /** * Disable "extglob" style patterns like +(a|b). * * @default false */ noext?: boolean; /** * Perform a case-insensitive match. * * @default false */ nocase?: boolean; /** * When a match is not found by minimatch.match, * return a list containing the pattern itself if this option is set. * Otherwise, an empty list is returned if there are no matches. * * @default false */ nonull?: boolean; /** * If set, then patterns without slashes will be matched against * the basename of the path if it contains slashes. * * @default false */ matchBase?: boolean; /** * Suppress the behavior of treating # * at the start of a pattern as a comment. * * @default false */ nocomment?: boolean; /** * Suppress the behavior of treating a leading ! character as negation. * * @default false */ nonegate?: boolean; /** * Returns from negate expressions the same as if they were not negated. * (Ie, true on a hit, false on a miss.) * * @default false */ flipNegate?: boolean; } export class FileList { static clone(): FileList static verbose: boolean } export interface FileList extends Omit, "length"> { pendingAdd: string[] pending: boolean excludes: { pats: RegExp[], funcs: Function[], regex: null | RegExp } items: string[] toArray(): string[] include(...items: string[]): this include(...items: (IncludeOptions | string)[]): this exclude(...items: string[]): this shouldExclude(item: string): boolean resolve(): this clearInclusions(): this clearExclusions(): this length(): number }filelist-1.0.4/index.js000066400000000000000000000316611423700375200150060ustar00rootroot00000000000000/* * Jake JavaScript build tool * Copyright 2112 Matthew Eernisse (mde@fleegix.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var fs = require('fs') , path = require('path') , minimatch = require('minimatch') , escapeRegExpChars , merge , basedir , _readDir , readdirR , globSync; var hasOwnProperty = Object.prototype.hasOwnProperty; var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); }; /** @name escapeRegExpChars @function @return {String} A string of escaped characters @description Escapes regex control-characters in strings used to build regexes dynamically @param {String} string The string of chars to escape */ escapeRegExpChars = (function () { var specials = [ '^', '$', '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; var sRE = new RegExp('(\\' + specials.join('|\\') + ')', 'g'); return function (string) { var str = string || ''; str = String(str); return str.replace(sRE, '\\$1'); }; })(); /** @name merge @function @return {Object} Returns the merged object @description Merge merges `otherObject` into `object` and takes care of deep merging of objects @param {Object} object Object to merge into @param {Object} otherObject Object to read from */ merge = function (object, otherObject) { var obj = object || {} , otherObj = otherObject || {} , key, value; for (key in otherObj) { if (!hasOwn(otherObj, key)) { continue; } if (key === '__proto__' || key === 'constructor') { continue; } value = otherObj[key]; // Check if a value is an Object, if so recursively add it's key/values if (typeof value === 'object' && !(value instanceof Array)) { // Update value of object to the one from otherObj obj[key] = merge(obj[key], value); } // Value is anything other than an Object, so just add it else { obj[key] = value; } } return obj; }; /** Given a patern, return the base directory of it (ie. the folder that will contain all the files matching the path). eg. file.basedir('/test/**') => '/test/' Path ending by '/' are considerd as folder while other are considerd as files, eg.: file.basedir('/test/a/') => '/test/a' file.basedir('/test/a') => '/test' The returned path always end with a '/' so we have: file.basedir(file.basedir(x)) == file.basedir(x) */ basedir = function (pathParam) { var bd = '' , parts , part , pos = 0 , p = pathParam || ''; // If the path has a leading asterisk, basedir is the current dir if (p.indexOf('*') == 0 || p.indexOf('**') == 0) { return '.'; } // always consider .. at the end as a folder and not a filename if (/(?:^|\/|\\)\.\.$/.test(p.slice(-3))) { p += '/'; } parts = p.split(/\\|\//); for (var i = 0, l = parts.length - 1; i < l; i++) { part = parts[i]; if (part.indexOf('*') > -1 || part.indexOf('**') > -1) { break; } pos += part.length + 1; bd += part + p[pos - 1]; } if (!bd) { bd = '.'; } // Strip trailing slashes if (!(bd == '\\' || bd == '/')) { bd = bd.replace(/\\$|\/$/, ''); } return bd; }; // Return the contents of a given directory _readDir = function (dirPath) { var dir = path.normalize(dirPath) , paths = [] , ret = [dir] , msg; try { paths = fs.readdirSync(dir); } catch (e) { msg = 'Could not read path ' + dir + '\n'; if (e.stack) { msg += e.stack; } throw new Error(msg); } paths.forEach(function (p) { var curr = path.join(dir, p); var stat = fs.statSync(curr); if (stat.isDirectory()) { ret = ret.concat(_readDir(curr)); } else { ret.push(curr); } }); return ret; }; /** @name file#readdirR @function @return {Array} Returns the contents as an Array, can be configured via opts.format @description Reads the given directory returning it's contents @param {String} dir The directory to read @param {Object} opts Options to use @param {String} [opts.format] Set the format to return(Default: Array) */ readdirR = function (dir, opts) { var options = opts || {} , format = options.format || 'array' , ret; ret = _readDir(dir); return format == 'string' ? ret.join('\n') : ret; }; globSync = function (pat, opts) { var dirname = basedir(pat) , files , matches; try { files = readdirR(dirname).map(function(file){ return file.replace(/\\/g, '/'); }); } // Bail if path doesn't exist -- assume no files catch(e) { if (FileList.verbose) console.error(e.message); } if (files) { pat = path.normalize(pat); matches = minimatch.match(files, pat, opts || {}); } return matches || []; }; // Constants // --------------- // List of all the builtin Array methods we want to override var ARRAY_METHODS = Object.getOwnPropertyNames(Array.prototype) // Array methods that return a copy instead of affecting the original , SPECIAL_RETURN = { 'concat': true , 'slice': true , 'filter': true , 'map': true } // Default file-patterns we want to ignore , DEFAULT_IGNORE_PATTERNS = [ /(^|[\/\\])CVS([\/\\]|$)/ , /(^|[\/\\])\.svn([\/\\]|$)/ , /(^|[\/\\])\.git([\/\\]|$)/ , /\.bak$/ , /~$/ ] // Ignore core files , DEFAULT_IGNORE_FUNCS = [ function (name) { var isDir = false , stats; try { stats = fs.statSync(name); isDir = stats.isDirectory(); } catch(e) {} return (/(^|[\/\\])core$/).test(name) && !isDir; } ]; var FileList = function () { var self = this , wrap; // List of glob-patterns or specific filenames this.pendingAdd = []; // Switched to false after lazy-eval of files this.pending = true; // Used to calculate exclusions from the list of files this.excludes = { pats: DEFAULT_IGNORE_PATTERNS.slice() , funcs: DEFAULT_IGNORE_FUNCS.slice() , regex: null }; this.items = []; // Wrap the array methods with the delegates wrap = function (prop) { var arr; self[prop] = function () { if (self.pending) { self.resolve(); } if (typeof self.items[prop] == 'function') { // Special method that return a copy if (SPECIAL_RETURN[prop]) { arr = self.items[prop].apply(self.items, arguments); return FileList.clone(self, arr); } else { return self.items[prop].apply(self.items, arguments); } } else { return self.items[prop]; } }; }; for (var i = 0, ii = ARRAY_METHODS.length; i < ii; i++) { wrap(ARRAY_METHODS[i]); } // Include whatever files got passed to the constructor this.include.apply(this, arguments); // Fix constructor linkage this.constructor = FileList; }; FileList.prototype = new (function () { var globPattern = /[*?\[\{]/; var _addMatching = function (item) { var matches = globSync(item.path, item.options); this.items = this.items.concat(matches); } , _resolveAdd = function (item) { if (globPattern.test(item.path)) { _addMatching.call(this, item); } else { this.push(item.path); } } , _calculateExcludeRe = function () { var pats = this.excludes.pats , pat , excl = [] , matches = []; for (var i = 0, ii = pats.length; i < ii; i++) { pat = pats[i]; if (typeof pat == 'string') { // Glob, look up files if (/[*?]/.test(pat)) { matches = globSync(pat); matches = matches.map(function (m) { return escapeRegExpChars(m); }); excl = excl.concat(matches); } // String for regex else { excl.push(escapeRegExpChars(pat)); } } // Regex, grab the string-representation else if (pat instanceof RegExp) { excl.push(pat.toString().replace(/^\/|\/$/g, '')); } } if (excl.length) { this.excludes.regex = new RegExp('(' + excl.join(')|(') + ')'); } else { this.excludes.regex = /^$/; } } , _resolveExclude = function () { var self = this; _calculateExcludeRe.call(this); // No `reject` method, so use reverse-filter this.items = this.items.filter(function (name) { return !self.shouldExclude(name); }); }; /** * Includes file-patterns in the FileList. Should be called with one or more * pattern for finding file to include in the list. Arguments should be strings * for either a glob-pattern or a specific file-name, or an array of them */ this.include = function () { var args = Array.prototype.slice.call(arguments) , arg , includes = { items: [], options: {} }; for (var i = 0, ilen = args.length; i < ilen; i++) { arg = args[i]; if (typeof arg === 'object' && !Array.isArray(arg)) { merge(includes.options, arg); } else { includes.items = includes.items.concat(arg).filter(function (item) { return !!item; }); } } var items = includes.items.map(function(item) { return { path: item, options: includes.options }; }); this.pendingAdd = this.pendingAdd.concat(items); return this; }; /** * Indicates whether a particular file would be filtered out by the current * exclusion rules for this FileList. * @param {String} name The filename to check * @return {Boolean} Whether or not the file should be excluded */ this.shouldExclude = function (name) { if (!this.excludes.regex) { _calculateExcludeRe.call(this); } var excl = this.excludes; return excl.regex.test(name) || excl.funcs.some(function (f) { return !!f(name); }); }; /** * Excludes file-patterns from the FileList. Should be called with one or more * pattern for finding file to include in the list. Arguments can be: * 1. Strings for either a glob-pattern or a specific file-name * 2. Regular expression literals * 3. Functions to be run on the filename that return a true/false */ this.exclude = function () { var args = Array.isArray(arguments[0]) ? arguments[0] : arguments , arg; for (var i = 0, ii = args.length; i < ii; i++) { arg = args[i]; if (typeof arg == 'function' && !(arg instanceof RegExp)) { this.excludes.funcs.push(arg); } else { this.excludes.pats.push(arg); } } if (!this.pending) { _resolveExclude.call(this); } return this; }; /** * Populates the FileList from the include/exclude rules with a list of * actual files */ this.resolve = function () { var item , uniqueFunc = function (p, c) { if (p.indexOf(c) < 0) { p.push(c); } return p; }; if (this.pending) { this.pending = false; while ((item = this.pendingAdd.shift())) { _resolveAdd.call(this, item); } // Reduce to a unique list this.items = this.items.reduce(uniqueFunc, []); // Remove exclusions _resolveExclude.call(this); } return this; }; /** * Convert to a plain-jane array */ this.toArray = function () { // Call slice to ensure lazy-resolution before slicing items var ret = this.slice().items.slice(); return ret; }; /** * Clear any pending items -- only useful before * calling `resolve` */ this.clearInclusions = function () { this.pendingAdd = []; return this; }; /** * Clear any current exclusion rules */ this.clearExclusions = function () { this.excludes = { pats: [] , funcs: [] , regex: null }; return this; }; })(); // Static method, used to create copy returned by special // array methods FileList.clone = function (list, items) { var clone = new FileList(); if (items) { clone.items = items; } clone.pendingAdd = list.pendingAdd; clone.pending = list.pending; for (var p in list.excludes) { clone.excludes[p] = list.excludes[p]; } return clone; }; FileList.verbose = true exports.FileList = FileList; filelist-1.0.4/jakefile.js000066400000000000000000000003561423700375200154460ustar00rootroot00000000000000testTask('FileList', function () { this.testFiles.include('test/*.js'); }); publishTask('FileList', function () { this.packageFiles.include([ 'jakefile.js', 'README.md', 'package.json', 'index.js', 'index.d.ts' ]); }); filelist-1.0.4/package-lock.json000066400000000000000000000042451423700375200165530ustar00rootroot00000000000000{ "name": "filelist", "version": "1.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "filelist", "version": "1.0.2", "license": "Apache-2.0", "dependencies": { "minimatch": "^5.0.1" } }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { "node": ">=10" } } }, "dependencies": { "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "requires": { "balanced-match": "^1.0.0" } }, "minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", "requires": { "brace-expansion": "^2.0.1" } } } } filelist-1.0.4/package.json000066400000000000000000000011751423700375200156240ustar00rootroot00000000000000{ "name": "filelist", "version": "1.0.4", "description": "Lazy-evaluating list of files, based on globs or regex patterns", "main": "index.js", "types": "index.d.ts", "scripts": { "test": "jake test" }, "repository": { "type": "git", "url": "git://github.com/mde/filelist.git" }, "keywords": [ "file", "utility", "glob" ], "author": "Matthew Eernisse (http://fleegix.org)", "license": "Apache-2.0", "bugs": { "url": "https://github.com/mde/filelist/issues" }, "homepage": "https://github.com/mde/filelist", "dependencies": { "minimatch": "^5.0.1" } } filelist-1.0.4/test/000077500000000000000000000000001423700375200143115ustar00rootroot00000000000000filelist-1.0.4/test/filelist.js000066400000000000000000000025611423700375200164660ustar00rootroot00000000000000var FileList = require('../index').FileList , fs = require("fs") , assert = require("assert") , tests; tests = { 'beforeEach': function () { jake.mkdirP("./test/tmp/one/two/three"); jake.mkdirP("./test/tmp/one/exclude"); fs.writeFileSync("./test/tmp/one/two/three/file.txt", "hello"); fs.writeFileSync("./test/tmp/one/exclude/file.txt", "world"); fs.writeFileSync("./test/tmp/foo.json", "{}") fs.writeFileSync("./test/tmp/bar.JSON", "{}") } , 'afterEach': function () { jake.rmRf('./test/tmp/one', {silent: true}); } , 'after': function () { jake.rmRf('./test/tmp', {silent:true}); } , 'path separator can be used by exclude': function () { var fileList = new FileList(); fileList.include("test/tmp/one/**/*.txt"); assert.equal(fileList.toArray().length, 2); fileList.exclude("tmp/one/exclude"); assert.equal(fileList.toArray().length, 1); } , 'returns a list of unique file entries': function () { var fileList = new FileList(); fileList.include("test/tmp/one/**/*.txt"); fileList.include("test/tmp/one/two/three/file.txt"); assert.equal(fileList.toArray().length, 2); } , 'passing options to minimatch object': function () { var filelist = new FileList; filelist.include("test/tmp/*.json", { nocase: true }) assert.equal(filelist.toArray().length, 2) } }; module.exports = tests;