progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
159
assets_old/node_modules/glob-all/README.md
generated
vendored
Normal file
159
assets_old/node_modules/glob-all/README.md
generated
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
# glob-all
|
||||
|
||||
Provides a similar API to [glob](https://github.com/isaacs/node-glob), however instead of a single pattern, you may also use arrays of patterns.
|
||||
|
||||
[](https://www.npmjs.com/package/glob-all) [](https://www.npmjs.com/package/glob-all) [](https://circleci.com/gh/jpillora/node-glob-all)
|
||||
|
||||
### Install
|
||||
|
||||
```
|
||||
npm install --save glob-all
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Given files:
|
||||
```
|
||||
files
|
||||
├── a.txt
|
||||
├── b.txt
|
||||
├── c.txt
|
||||
└── x
|
||||
├── y.txt
|
||||
└── z.txt
|
||||
```
|
||||
|
||||
We can:
|
||||
``` js
|
||||
var glob = require('glob-all');
|
||||
|
||||
var files = glob.sync([
|
||||
'files/**', //include all files/
|
||||
'!files/x/**', //then, exclude files/x/
|
||||
'files/x/z.txt' //then, reinclude files/x/z.txt
|
||||
]);
|
||||
|
||||
console.log(files);
|
||||
```
|
||||
|
||||
Resulting in:
|
||||
```
|
||||
[ 'files',
|
||||
'files/a.txt',
|
||||
'files/b.txt',
|
||||
'files/c.txt',
|
||||
'files/x/z.txt' ]
|
||||
```
|
||||
|
||||
### CLI Usage
|
||||
|
||||
`npm install -g glob-all`
|
||||
|
||||
List all JavaScript files in `example/`
|
||||
|
||||
```
|
||||
$ glob-all 'example/**/*.js'
|
||||
example/async.js
|
||||
example/events.js
|
||||
example/order.js
|
||||
example/perf.js
|
||||
example/sync.js
|
||||
```
|
||||
|
||||
Or list all JavaScript files but ignore 3rd-party modules:
|
||||
|
||||
```
|
||||
$ glob-all '**/*.js' '!node_modules/**/*'
|
||||
```
|
||||
|
||||
### API
|
||||
|
||||
* Async - `glob(patterns[, options], callback)`
|
||||
* Returns a `GlobAll` instance which emits:
|
||||
* `match`
|
||||
* `error`
|
||||
* `end`
|
||||
|
||||
* Sync - `glob.sync(patterns[, options])`
|
||||
* Returns `[String]` or `null`
|
||||
|
||||
See [node-glob](https://github.com/isaacs/node-glob)
|
||||
|
||||
### Notes
|
||||
|
||||
#### Exclude Pattern
|
||||
|
||||
Since [node-glob](https://github.com/isaacs/node-glob) only allows one pattern, there is no such thing as an exclude pattern (like in Grunt and Gulp). However, in `node-glob-all` we allow exclusion of the results of an entire pattern by prefixing the pattern with `!`.
|
||||
|
||||
[node-glob](https://github.com/isaacs/node-glob) exclusions (`!` inside the pattern) to exclude a portion of the path will still work as expected.
|
||||
|
||||
#### File Order
|
||||
|
||||
If a file occurs in more than once in the set, the one with the **more precise pattern** will be used and the other will be thrown away. So, if you'd like a file be in a certain position, you could do:
|
||||
|
||||
``` js
|
||||
var glob = require('glob-all');
|
||||
|
||||
var files = glob.sync([
|
||||
'files/x/y.txt',
|
||||
'files/**'
|
||||
]);
|
||||
|
||||
console.log(files);
|
||||
```
|
||||
|
||||
Which will bring `files/x/y.txt` to the top:
|
||||
|
||||
```
|
||||
[ 'files/x/y.txt',
|
||||
'files',
|
||||
'files/a.txt',
|
||||
'files/b.txt',
|
||||
'files/c.txt',
|
||||
'files/x',
|
||||
'files/x/z.txt' ]
|
||||
```
|
||||
|
||||
#### Filtering out directories
|
||||
|
||||
You can use the `mark` option to mark directories with a `/`, then you can:
|
||||
``` js
|
||||
files.filter(function(f) { return !/\/$/.test(f); });
|
||||
```
|
||||
|
||||
#### Performance
|
||||
|
||||
Internally, `glob-all` uses the `statCache` option to prevent repeat lookups across multiple patterns.
|
||||
|
||||
#### Todo
|
||||
|
||||
* Implement `abort()`
|
||||
* Add tests
|
||||
|
||||
#### Contributing
|
||||
|
||||
* edit `glob-all.js`
|
||||
* `npm test`
|
||||
|
||||
#### MIT License
|
||||
|
||||
Copyright © 2014 Jaime Pillora <dev@jpillora.com>
|
||||
|
||||
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.
|
18
assets_old/node_modules/glob-all/bin/glob-all
generated
vendored
Executable file
18
assets_old/node_modules/glob-all/bin/glob-all
generated
vendored
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Find files that match one or more patterns
|
||||
*/
|
||||
|
||||
var glob = require('..');
|
||||
var argv = require('yargs')
|
||||
.usage('Usage: $0 [pattern1..patternN]')
|
||||
.demand(1)
|
||||
.argv;
|
||||
|
||||
var patterns = argv._;
|
||||
if (patterns.length === 1) { patterns = patterns[0].split('\n'); }
|
||||
|
||||
glob.sync(patterns).forEach(function (file) {
|
||||
process.stdout.write(file + '\n');
|
||||
});
|
11
assets_old/node_modules/glob-all/example/async.js
generated
vendored
Normal file
11
assets_old/node_modules/glob-all/example/async.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
var glob = require('../');
|
||||
|
||||
glob([
|
||||
'files/**',
|
||||
'!files/x/**',
|
||||
'files/x/z.txt'
|
||||
], {
|
||||
mark: true
|
||||
}, function(err, files) {
|
||||
console.log(err || files);
|
||||
});
|
17
assets_old/node_modules/glob-all/example/events.js
generated
vendored
Normal file
17
assets_old/node_modules/glob-all/example/events.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
var glob = require('../');
|
||||
|
||||
var g = glob([
|
||||
'files/**',
|
||||
'!files/x/**',
|
||||
'files/x/z.txt'
|
||||
], function(err, files) {
|
||||
console.log(err || files);
|
||||
});
|
||||
|
||||
g.on('match', function(f) {
|
||||
console.log('glob match: %s', f);
|
||||
});
|
||||
|
||||
g.on('end', function() {
|
||||
console.log('globbing complete');
|
||||
});
|
1
assets_old/node_modules/glob-all/example/files/a.txt
generated
vendored
Normal file
1
assets_old/node_modules/glob-all/example/files/a.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
a.txt
|
1
assets_old/node_modules/glob-all/example/files/b.txt
generated
vendored
Normal file
1
assets_old/node_modules/glob-all/example/files/b.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
a.txt
|
1
assets_old/node_modules/glob-all/example/files/c.txt
generated
vendored
Normal file
1
assets_old/node_modules/glob-all/example/files/c.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
a.txt
|
1
assets_old/node_modules/glob-all/example/files/x/y.txt
generated
vendored
Normal file
1
assets_old/node_modules/glob-all/example/files/x/y.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
y.txt
|
1
assets_old/node_modules/glob-all/example/files/x/z.txt
generated
vendored
Normal file
1
assets_old/node_modules/glob-all/example/files/x/z.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
y.txt
|
10
assets_old/node_modules/glob-all/example/order.js
generated
vendored
Normal file
10
assets_old/node_modules/glob-all/example/order.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
var glob = require('../');
|
||||
|
||||
var files = glob.sync([
|
||||
'files/x/y.txt',
|
||||
'files/**'
|
||||
]);
|
||||
|
||||
console.log(files);
|
||||
|
||||
|
11
assets_old/node_modules/glob-all/example/perf.js
generated
vendored
Normal file
11
assets_old/node_modules/glob-all/example/perf.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
var glob = require('../');
|
||||
|
||||
var t = Date.now();
|
||||
glob([
|
||||
'**',
|
||||
'!**/*.js'
|
||||
], {
|
||||
cwd: '/Users/jpillora/Code/Node/', /* folder with many files */
|
||||
}, function(err, files) {
|
||||
console.log('found %s files in %sms', files.length, Date.now()-t);
|
||||
});
|
11
assets_old/node_modules/glob-all/example/sync.js
generated
vendored
Normal file
11
assets_old/node_modules/glob-all/example/sync.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
var glob = require('../');
|
||||
|
||||
var files = glob.sync([
|
||||
'files/**',
|
||||
'!files/x/**',
|
||||
'files/x/z.txt'
|
||||
]);
|
||||
|
||||
console.log(files);
|
||||
|
||||
|
195
assets_old/node_modules/glob-all/glob-all.js
generated
vendored
Normal file
195
assets_old/node_modules/glob-all/glob-all.js
generated
vendored
Normal file
|
@ -0,0 +1,195 @@
|
|||
var util = require("util");
|
||||
var Glob = require("glob").Glob;
|
||||
var EventEmitter = require("events").EventEmitter;
|
||||
|
||||
// helper class to store and compare glob results
|
||||
function File(pattern1, patternId1, path1, fileId1) {
|
||||
this.pattern = pattern1;
|
||||
this.patternId = patternId1;
|
||||
this.path = path1;
|
||||
this.fileId = fileId1;
|
||||
this.include = true;
|
||||
while (this.pattern.charAt(0) === "!") {
|
||||
this.include = !this.include;
|
||||
this.pattern = this.pattern.substr(1);
|
||||
}
|
||||
}
|
||||
|
||||
File.prototype.stars = /((\/\*\*)?\/\*)?\.(\w+)$/;
|
||||
|
||||
// strip stars and compare pattern length
|
||||
// longest length wins
|
||||
File.prototype.compare = function(other) {
|
||||
var p1 = this.pattern.replace(this.stars, "");
|
||||
var p2 = other.pattern.replace(this.stars, "");
|
||||
if (p1.length > p2.length) {
|
||||
return this;
|
||||
} else {
|
||||
return other;
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.toString = function() {
|
||||
return this.path + " (" + this.patternId + ": " + this.fileId + ": " + this.pattern + ")";
|
||||
};
|
||||
|
||||
// using standard node inheritance
|
||||
util.inherits(GlobAll, EventEmitter);
|
||||
|
||||
// allows the use arrays with "node-glob"
|
||||
// interatively combines the resulting arrays
|
||||
// api is exactly the same
|
||||
function GlobAll(sync, patterns, opts, callback) {
|
||||
if (opts == null) {
|
||||
opts = {};
|
||||
}
|
||||
EventEmitter.call(this);
|
||||
// init array
|
||||
if (typeof patterns === "string") {
|
||||
patterns = [patterns];
|
||||
}
|
||||
if (!(patterns instanceof Array)) {
|
||||
return (typeof callback === "function") ? callback("Invalid input") : null;
|
||||
}
|
||||
// use copy of array
|
||||
this.patterns = patterns.slice();
|
||||
// no opts provided
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
// allow sync+nocallback or async+callback
|
||||
if (sync !== (typeof callback !== "function")) {
|
||||
throw new Error("should" + (sync ? " not" : "") + " have callback");
|
||||
}
|
||||
// all globs share the same stat cache
|
||||
this.statCache = opts.statCache = opts.statCache || {};
|
||||
opts.sync = sync;
|
||||
this.opts = opts;
|
||||
this.set = {};
|
||||
this.results = null;
|
||||
this.globs = [];
|
||||
this.callback = callback;
|
||||
// bound functions
|
||||
this.globbedOne = this.globbedOne.bind(this);
|
||||
}
|
||||
|
||||
GlobAll.prototype.run = function() {
|
||||
this.globNext();
|
||||
return this.results;
|
||||
};
|
||||
|
||||
GlobAll.prototype.globNext = function() {
|
||||
var g, pattern, include = true;
|
||||
if (this.patterns.length === 0) {
|
||||
return this.globbedAll();
|
||||
}
|
||||
pattern = this.patterns[0]; // peek!
|
||||
// check whether this is an exclude pattern and
|
||||
// strip the leading ! if it is
|
||||
if (pattern.charAt(0) === "!") {
|
||||
include = false;
|
||||
pattern = pattern.substr(1);
|
||||
}
|
||||
// run
|
||||
if (this.opts.sync) {
|
||||
// sync - callback straight away
|
||||
g = new Glob(pattern, this.opts);
|
||||
this.globs.push(g);
|
||||
this.globbedOne(null, include, g.found);
|
||||
} else {
|
||||
// async
|
||||
var self = this;
|
||||
g = new Glob(pattern, this.opts, function(err, files) {
|
||||
self.globbedOne(err, include, files);
|
||||
});
|
||||
this.globs.push(g);
|
||||
}
|
||||
};
|
||||
|
||||
// collect results
|
||||
GlobAll.prototype.globbedOne = function(err, include, files) {
|
||||
// handle callback error early
|
||||
if (err) {
|
||||
if (!this.callback) {
|
||||
this.emit("error", err);
|
||||
}
|
||||
this.removeAllListeners();
|
||||
if (this.callback) {
|
||||
this.callback(err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var patternId = this.patterns.length;
|
||||
var pattern = this.patterns.shift();
|
||||
// insert each into the results set
|
||||
for (var fileId = 0; fileId < files.length; fileId++) {
|
||||
// convert to file instance
|
||||
var path = files[fileId];
|
||||
var f = new File(pattern, patternId, path, fileId);
|
||||
var existing = this.set[path];
|
||||
// new item
|
||||
if (!existing) {
|
||||
if (include) {
|
||||
this.set[path] = f;
|
||||
this.emit("match", path);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// compare or delete
|
||||
if (include) {
|
||||
this.set[path] = f.compare(existing);
|
||||
} else {
|
||||
delete this.set[path];
|
||||
}
|
||||
}
|
||||
// run next
|
||||
this.globNext();
|
||||
};
|
||||
|
||||
GlobAll.prototype.globbedAll = function() {
|
||||
// map result set into an array
|
||||
var files = [];
|
||||
for (var k in this.set) {
|
||||
files.push(this.set[k]);
|
||||
}
|
||||
// sort files by index
|
||||
files.sort(function(a, b) {
|
||||
if (a.patternId < b.patternId) {
|
||||
return 1;
|
||||
}
|
||||
if (a.patternId > b.patternId) {
|
||||
return -1;
|
||||
}
|
||||
if (a.fileId >= b.fileId) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
// finally, convert back into a path string
|
||||
this.results = files.map(function(f) {
|
||||
return f.path;
|
||||
});
|
||||
this.emit("end");
|
||||
this.removeAllListeners();
|
||||
// return string paths
|
||||
if (!this.opts.sync) {
|
||||
this.callback(null, this.results);
|
||||
}
|
||||
return this.results;
|
||||
};
|
||||
|
||||
// expose
|
||||
var globAll = function(array, opts, callback) {
|
||||
var g = new GlobAll(false, array, opts, callback);
|
||||
g.run(); //async, so results are empty
|
||||
return g;
|
||||
};
|
||||
|
||||
// sync is actually the same function :)
|
||||
globAll.sync = function(array, opts) {
|
||||
return new GlobAll(true, array, opts).run();
|
||||
};
|
||||
|
||||
module.exports = globAll;
|
33
assets_old/node_modules/glob-all/package.json
generated
vendored
Normal file
33
assets_old/node_modules/glob-all/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "glob-all",
|
||||
"version": "3.2.1",
|
||||
"description": "Provide multiple patterns to node-glob",
|
||||
"main": "glob-all.js",
|
||||
"bin": {
|
||||
"glob-all": "./bin/glob-all"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jpillora/node-glob-all.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": "^7.1.2",
|
||||
"yargs": "^15.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^4.9.0"
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"multi",
|
||||
"all",
|
||||
"manifest",
|
||||
"generation",
|
||||
"file"
|
||||
],
|
||||
"author": "Jaime Pillora",
|
||||
"license": "MIT"
|
||||
}
|
37
assets_old/node_modules/glob-all/test/test.js
generated
vendored
Normal file
37
assets_old/node_modules/glob-all/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
var test = require('tape');
|
||||
var glob = require('../');
|
||||
|
||||
process.chdir('example/');
|
||||
|
||||
test('basic', function (t) {
|
||||
//set total
|
||||
t.plan(2);
|
||||
//1
|
||||
glob([
|
||||
'files/**',
|
||||
'!files/x/**',
|
||||
'files/x/z.txt'
|
||||
], {
|
||||
mark: true
|
||||
}, function(err, files) {
|
||||
t.deepEqual(files, [ 'files/',
|
||||
'files/a.txt',
|
||||
'files/b.txt',
|
||||
'files/c.txt',
|
||||
'files/x/z.txt'
|
||||
]);
|
||||
});
|
||||
//2
|
||||
var files = glob.sync([
|
||||
'files/**',
|
||||
'!files/x/**',
|
||||
'files/x/z.txt'
|
||||
]);
|
||||
t.deepEqual(files, [
|
||||
'files',
|
||||
'files/a.txt',
|
||||
'files/b.txt',
|
||||
'files/c.txt',
|
||||
'files/x/z.txt'
|
||||
]);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue