0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

15
web/node_modules/recursive-readdir/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,15 @@
language: node_js
node_js:
- "node"
- "6"
- "5"
- "4"
- "4.4"
- "4.3"
- "4.2"
- "4.1"
- "4.0"
- "iojs"
- "0.12"
- "0.11"
- "0.10"

24
web/node_modules/recursive-readdir/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,24 @@
v2.1.0 - Mon, 19 Sep 2016 21:55:22 GMT
--------------------------------------
-
v2.0.0 - Wed, 06 Apr 2016 04:31:02 GMT
--------------------------------------
-
v1.3.0 - Wed, 14 Oct 2015 14:35:55 GMT
--------------------------------------
- [45abf8fde380d7b1f5dc0e798d435ed50b834d9c](../../commit/45abf8fde380d7b1f5dc0e798d435ed50b834d9c) [added] added custom matcher function to determine whether to ignore a file
- [eebc91c67abce413d6213e8f389ba4e0d32ffb63](../../commit/eebc91c67abce413d6213e8f389ba4e0d32ffb63) [fixed] allow ignoring directories
v1.2.1 - Wed, 14 Jan 2015 16:49:55 GMT
--------------------------------------
-

21
web/node_modules/recursive-readdir/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

69
web/node_modules/recursive-readdir/README.md generated vendored Normal file
View file

@ -0,0 +1,69 @@
# recursive-readdir
[![Build Status](https://travis-ci.org/jergason/recursive-readdir.svg?branch=master)](https://travis-ci.org/jergason/recursive-readdir)
Recursively list all files in a directory and its subdirectories. It does not list the directories themselves.
Because it uses fs.readdir, which calls [readdir](http://linux.die.net/man/3/readdir) under the hood
on OS X and Linux, the order of files inside directories is [not guaranteed](http://stackoverflow.com/questions/8977441/does-readdir-guarantee-an-order).
## Installation
npm install recursive-readdir
## Usage
```javascript
var recursive = require("recursive-readdir");
recursive("some/path", function (err, files) {
// `files` is an array of file paths
console.log(files);
});
```
It can also take a list of files to ignore.
```javascript
var recursive = require("recursive-readdir");
// ignore files named "foo.cs" or files that end in ".html".
recursive("some/path", ["foo.cs", "*.html"], function (err, files) {
console.log(files);
});
```
You can also pass functions which are called to determine whether or not to
ignore a file:
```javascript
var recursive = require("recursive-readdir");
function ignoreFunc(file, stats) {
// `file` is the path to the file, and `stats` is an `fs.Stats`
// object returned from `fs.lstat()`.
return stats.isDirectory() && path.basename(file) == "test";
}
// Ignore files named "foo.cs" and descendants of directories named test
recursive("some/path", ["foo.cs", ignoreFunc], function (err, files) {
console.log(files);
});
```
## Promises
You can omit the callback and return a promise instead.
```javascript
readdir("some/path").then(
function(files) {
console.log("files are", files);
},
function(error) {
console.error("something exploded", error);
}
);
```
The ignore strings support Glob syntax via
[minimatch](https://github.com/isaacs/minimatch).

96
web/node_modules/recursive-readdir/index.js generated vendored Normal file
View file

@ -0,0 +1,96 @@
var fs = require("fs");
var p = require("path");
var minimatch = require("minimatch");
function patternMatcher(pattern) {
return function(path, stats) {
var minimatcher = new minimatch.Minimatch(pattern, { matchBase: true });
return (!minimatcher.negate || stats.isFile()) && minimatcher.match(path);
};
}
function toMatcherFunction(ignoreEntry) {
if (typeof ignoreEntry == "function") {
return ignoreEntry;
} else {
return patternMatcher(ignoreEntry);
}
}
function readdir(path, ignores, callback) {
if (typeof ignores == "function") {
callback = ignores;
ignores = [];
}
if (!callback) {
return new Promise(function(resolve, reject) {
readdir(path, ignores || [], function(err, data) {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
ignores = ignores.map(toMatcherFunction);
var list = [];
fs.readdir(path, function(err, files) {
if (err) {
return callback(err);
}
var pending = files.length;
if (!pending) {
// we are done, woop woop
return callback(null, list);
}
files.forEach(function(file) {
var filePath = p.join(path, file);
fs.stat(filePath, function(_err, stats) {
if (_err) {
return callback(_err);
}
if (
ignores.some(function(matcher) {
return matcher(filePath, stats);
})
) {
pending -= 1;
if (!pending) {
return callback(null, list);
}
return null;
}
if (stats.isDirectory()) {
readdir(filePath, ignores, function(__err, res) {
if (__err) {
return callback(__err);
}
list = list.concat(res);
pending -= 1;
if (!pending) {
return callback(null, list);
}
});
} else {
list.push(filePath);
pending -= 1;
if (!pending) {
return callback(null, list);
}
}
});
});
});
}
module.exports = readdir;

28
web/node_modules/recursive-readdir/package.json generated vendored Normal file
View file

@ -0,0 +1,28 @@
{
"author": "Jamison Dance <jergason@gmail.com> (http://jamisondance.com/)",
"name": "recursive-readdir",
"description": "Get an array of all files in a directory and subdirectories.",
"license": "MIT",
"version": "2.2.2",
"repository": {
"type": "git",
"url": "git://github.com/jergason/recursive-readdir.git"
},
"main": "./index.js",
"scripts": {
"test": "mocha test/"
},
"keywords": [
"directory",
"lister"
],
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"minimatch": "3.0.4"
},
"devDependencies": {
"mocha": "1.14.0"
}
}

View file

@ -0,0 +1,401 @@
/* eslint-env mocha */
var assert = require("assert");
var p = require("path");
var readdir = require("../index");
function getAbsolutePath(file) {
return p.join(__dirname, file);
}
function getAbsolutePaths(files) {
return files.map(getAbsolutePath);
}
describe("readdir", function() {
it("correctly lists all files in nested directories", function(done) {
var expectedFiles = getAbsolutePaths([
"/testdir/a/a",
"/testdir/a/beans",
"/testdir/b/123",
"/testdir/b/b/hurp-durp",
"/testdir/c.txt",
"/testdir/d.txt"
]);
readdir(p.join(__dirname, "testdir"), function(err, list) {
assert.ifError(err);
assert.deepEqual(list.sort(), expectedFiles.sort());
done();
});
});
it("ignores the files listed in the ignores array", function(done) {
var notExpectedFiles = getAbsolutePaths([
"/testdir/d.txt",
"/testdir/a/beans"
]);
readdir(p.join(__dirname, "testdir"), ["d.txt", "beans"], function(
err,
list
) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
notExpectedFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
});
});
it("ignores the directories listed in the ignores array", function(done) {
var notExpectedFiles = getAbsolutePaths([
"/testdir/a/a",
"/testdir/a/beans"
]);
readdir(p.join(__dirname, "testdir"), ["**/testdir/a"], function(
err,
list
) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
notExpectedFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
});
});
it("ignores symlinked files and directories listed in the ignores array", function(
done
) {
var notExpectedFiles = getAbsolutePaths([
"/testsymlinks/testdir/linkeddir/hi.docx",
"/testsymlinks/testdir/linkedfile.wmf"
]);
readdir(
p.join(__dirname, "testsymlinks/testdir"),
["linkeddir", "linkedfile.wmf"],
function(err, list) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
notExpectedFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
}
);
});
it("supports ignoring files with just basename globbing", function(done) {
var notExpectedFiles = getAbsolutePaths([
"/testdir/d.txt",
"/testdir/a/beans"
]);
readdir(p.join(__dirname, "testdir"), ["*.txt", "beans"], function(
err,
list
) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
notExpectedFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
});
});
it("supports ignoring files with the globstar syntax", function(done) {
var notExpectedFiles = getAbsolutePaths([
"/testdir/d.txt",
"/testdir/a/beans"
]);
var ignores = ["**/*.txt", "**/a/beans"];
readdir(p.join(__dirname, "testdir"), ignores, function(err, list) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
notExpectedFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
});
});
context("when there is a function in the ignores array", function() {
it("passes each file and directory path to the function", function(done) {
var expectedPaths = getAbsolutePaths([
"/testdir/a",
"/testdir/a/a",
"/testdir/a/beans",
"/testdir/b",
"/testdir/b/123",
"/testdir/b/b",
"/testdir/b/b/hurp-durp",
"/testdir/c.txt",
"/testdir/d.txt"
]);
var paths = [];
function ignoreFunction(path) {
paths.push(path);
return false;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
assert.deepEqual(paths.sort(), expectedPaths.sort());
done();
});
});
it("passes the stat object of each file to the function as its second argument", function(
done
) {
var paths = {};
function ignoreFunction(path, stats) {
paths[path] = stats;
return false;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
assert(paths[getAbsolutePath("/testdir/a")].isDirectory());
assert(paths[getAbsolutePath("/testdir/c.txt")].isFile());
done();
});
});
it("ignores files that the function returns true for", function(done) {
var ignoredFiles = getAbsolutePaths([
"/testdir/d.txt",
"/testdir/a/beans"
]);
function ignoreFunction(path) {
return ignoredFiles.indexOf(path) != -1;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
ignoredFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
});
});
it("does not ignore files that the function returns false for", function(
done
) {
var notIgnoredFiles = getAbsolutePaths([
"/testdir/d.txt",
"/testdir/a/beans"
]);
function ignoreFunction(path) {
return notIgnoredFiles.indexOf(path) == -1;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
notIgnoredFiles.forEach(function(file) {
assert.notEqual(
notIgnoredFiles.indexOf(file),
-1,
'Incorrectly ignored file "' + file + '".'
);
});
done();
});
});
it("ignores directories that the function returns true for", function(
done
) {
var ignoredDirectory = getAbsolutePath("/testdir/a");
var ignoredFiles = getAbsolutePaths(["/testdir/a/a", "/testdir/a/beans"]);
function ignoreFunction(path) {
return ignoredDirectory == path;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
list.forEach(function(file) {
assert.equal(
ignoredFiles.indexOf(file),
-1,
'Failed to ignore file "' + file + '".'
);
});
done();
});
});
it("does not ignore directories that the function returns false for", function(
done
) {
var ignoredDirectory = getAbsolutePath("/testdir/a");
var notIgnoredFiles = getAbsolutePaths([
"/testdir/b/123",
"/testdir/b/b/hurp-durp"
]);
function ignoreFunction(path) {
return ignoredDirectory == path;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
notIgnoredFiles.forEach(function(file) {
assert.notEqual(
notIgnoredFiles.indexOf(file),
-1,
'Incorrectly ignored file "' + file + '".'
);
});
done();
});
});
it("does not descend into directories that the function returns true for", function(
done
) {
var ignoredDirectory = getAbsolutePath("/testdir/a");
var ignoredFiles = getAbsolutePaths(["/testdir/a/a", "/testdir/a/beans"]);
var paths = [];
function ignoreFunction(path) {
paths.push(path);
return ignoredDirectory == path;
}
readdir(p.join(__dirname, "testdir"), [ignoreFunction], function(
err,
list
) {
assert.ifError(err);
paths.forEach(function(file) {
assert.equal(
ignoredFiles.indexOf(file),
-1,
'Transversed file in ignored directory "' + file + '".'
);
});
done();
});
});
});
it("works when there are no files to report except ignored files", function(
done
) {
readdir(p.join(__dirname, "testdirBeta"), ["*"], function(err, list) {
assert.ifError(err);
assert.equal(list.length, 0, "expect to report 0 files");
done();
});
});
it("works when negated ignore list is given", function(done) {
var expectedFiles = getAbsolutePaths(["/testdirBeta/ignore.txt"]);
readdir(p.join(__dirname, "testdirBeta"), ["!*.txt"], function(err, list) {
assert.ifError(err);
assert.deepEqual(
list.sort(),
expectedFiles,
"Failed to find expected files."
);
done();
});
});
it("traverses directory and file symbolic links", function(done) {
var expectedFiles = getAbsolutePaths([
"/testsymlinks/testdir/linkeddir/hi.docx",
"/testsymlinks/testdir/linkedfile.wmf"
]);
readdir(p.join(__dirname, "testsymlinks", "testdir"), function(err, list) {
assert.ifError(err);
assert.deepEqual(
list.sort(),
expectedFiles,
"Failed to find expected files."
);
done();
});
});
if (!global.Promise) {
console.log("Native Promise not supported - skipping tests");
} else {
it("works with promises", function(done) {
var expectedFiles = getAbsolutePaths([
"/testdir/a/a",
"/testdir/a/beans",
"/testdir/b/123",
"/testdir/b/b/hurp-durp",
"/testdir/c.txt",
"/testdir/d.txt"
]);
readdir(p.join(__dirname, "testdir"))
.then(function(list) {
assert.deepEqual(list.sort(), expectedFiles.sort());
done();
})
.catch(done);
});
it("correctly ignores when using promises", function(done) {
var expectedFiles = getAbsolutePaths([
"/testdir/a/a",
"/testdir/a/beans",
"/testdir/b/123",
"/testdir/b/b/hurp-durp"
]);
readdir(p.join(__dirname, "testdir"), ["*.txt"])
.then(function(list) {
assert.deepEqual(list.sort(), expectedFiles.sort());
done();
})
.catch(done);
});
}
});

0
web/node_modules/recursive-readdir/test/testdir/a/a generated vendored Normal file
View file

View file

View file

View file

View file

View file

View file

View file

View file