summaryrefslogtreecommitdiffstats
path: root/node_modules/globule
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/globule
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/globule')
-rw-r--r--node_modules/globule/LICENSE22
-rw-r--r--node_modules/globule/README.md131
-rw-r--r--node_modules/globule/lib/globule.js192
-rw-r--r--node_modules/globule/package.json75
4 files changed, 420 insertions, 0 deletions
diff --git a/node_modules/globule/LICENSE b/node_modules/globule/LICENSE
new file mode 100644
index 0000000..5c0695e
--- /dev/null
+++ b/node_modules/globule/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2018 "Cowboy" Ben Alman
+
+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.
diff --git a/node_modules/globule/README.md b/node_modules/globule/README.md
new file mode 100644
index 0000000..fe87e3b
--- /dev/null
+++ b/node_modules/globule/README.md
@@ -0,0 +1,131 @@
+# globule [![Build Status: Linux](https://travis-ci.org/cowboy/node-globule.svg?branch=master)](https://travis-ci.org/cowboy/node-globule) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/i9fnc38q952r9nc0/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/node-globule/branch/master)
+
+An easy-to-use wildcard globbing library.
+
+## Getting Started
+Install the module with: `npm install globule`
+
+```javascript
+var globule = require('globule');
+var filepaths = globule.find('**/*.js');
+```
+
+## Documentation
+
+### globule.find
+Returns a unique array of all file or directory paths that match the given globbing pattern(s). This method accepts either comma separated globbing patterns or an array of globbing patterns. Paths matching patterns that begin with `!` will be excluded from the returned array. Patterns are processed in order, so inclusion and exclusion order is significant. Patterns may be specified as function arguments or as a `src` property of the options object.
+
+```js
+globule.find(patterns [, patterns [, ...]] [, options])
+globule.find({src: patterns, /* other options */})
+```
+
+The `options` object supports all [glob][] library options, along with a few extras. These are the most commonly used:
+
+* `src` This property may be used instead of specifying patterns as function arguments.
+* `filter` Either a valid [fs.Stats method name](http://nodejs.org/docs/latest/api/fs.html#fs_class_fs_stats) or a function that will be passed the matched `src` filepath and `options` object as arguments. This function should return a `Boolean` value.
+* `nonull` Retain globbing patterns in result set even if they fail to match files.
+* `matchBase` Patterns without slashes will match just the basename part. Eg. this makes `*.js` work like `**/*.js`.
+* `srcBase` Patterns will be matched relative to the specified path instead of the current working directory. This is a synonym for `cwd`.
+* `prefixBase` Any specified `srcBase` will be prefixed to all returned filepaths.
+
+[glob]: https://github.com/isaacs/node-glob
+
+### globule.match
+Match one or more globbing patterns against one or more file paths. Returns a uniqued array of all file paths that match any of the specified globbing patterns. Both the `patterns` and `filepaths` arguments can be a single string or array of strings. Paths matching patterns that begin with `!` will be excluded from the returned array. Patterns are processed in order, so inclusion and exclusion order is significant.
+
+```js
+globule.match(patterns, filepaths [, options])
+```
+
+### globule.isMatch
+This method contains the same signature and logic as the `globule.match` method, but returns `true` if any files were matched, otherwise `false`.
+
+```js
+globule.isMatch(patterns, filepaths [, options])
+```
+
+### globule.mapping
+Given a set of source file paths, returns an array of src-dest file mapping objects. Both src and dest paths may be renamed, depending on the options specified. Patterns may be specified as function arguments or as a `src` property of the options object.
+
+```js
+globule.mapping(filepaths [, filepaths [, ...]] [, options])
+globule.mapping({src: filepaths, /* other options */})
+```
+
+In addition to the options the `globule.find` method supports, the options object also supports these properties:
+
+* `srcBase` The directory from which patterns are matched. Any string specified as `srcBase` is effectively stripped from the beginning of all matched paths.
+* `destBase` The specified path is prefixed to all `dest` filepaths.
+* `ext` Remove anything after (and including) the first `.` in the destination path, then append this value.
+* `extDot` Change the behavior of `ext`, `"first"` and `"last"` will remove anything after the first or last `.` in the destination filename, respectively. Defaults to `"first"`.
+* `flatten` Remove the path component from all matched src files. The src file path is still joined to the specified destBase.
+* `rename` If specified, this function will be responsible for returning the final `dest` filepath. By default, it flattens paths (if specified), changes extensions (if specified) and joins the matched path to the `destBase`.
+
+### globule.findMapping
+This method is a convenience wrapper around the `globule.find` and `globule.mapping` methods.
+
+```js
+globule.findMapping(patterns [, options])
+```
+
+
+## Examples
+
+Given the files `foo/a.js` and `foo/b.js`:
+
+### srcBase and destBase
+
+```js
+globule.find("foo/*.js")
+// ["foo/a.js", "foo/b.js"]
+
+globule.find("*.js", {srcBase: "foo"})
+// ["a.js", "b.js"]
+
+globule.find({src: "*.js", srcBase: "foo", prefixBase: true})
+// ["foo/a.js", "foo/b.js"]
+```
+
+```js
+globule.findMapping("foo/*.js")
+// [{src: ["foo/a.js"], dest: "foo/a.js"}, {src: ["foo/b.js"], dest: "foo/b.js"}]
+
+globule.findMapping("foo/*.js", {destBase: "bar"})
+// [{src: ["foo/a.js"], dest: "bar/foo/a.js"}, {src: ["foo/b.js"], dest: "bar/foo/b.js"}]
+
+globule.findMapping({src: "*.js", srcBase: "foo", destBase: "bar"})
+// [{src: ["foo/a.js"], dest: "bar/a.js"}, {src: ["foo/b.js"], dest: "bar/b.js"}]
+```
+
+```js
+globule.mapping(["foo/a.js", "foo/b.js"])
+// [{src: ["foo/a.js"], dest: "foo/a.js"}, {src: ["foo/b.js"], dest: "foo/b.js"}]
+
+globule.mapping(["foo/a.js", "foo/b.js"], {destBase: "bar"})
+// [{src: ["foo/a.js"], dest: "bar/foo/a.js"}, {src: ["foo/b.js"], dest: "bar/foo/b.js"}]
+
+globule.mapping("foo/a.js", "foo/b.js", {destBase: "bar"})
+// [{src: ["foo/a.js"], dest: "bar/foo/a.js"}, {src: ["foo/b.js"], dest: "bar/foo/b.js"}]
+
+globule.mapping(["a.js", "b.js"], {srcBase: "foo", destBase: "bar"})
+// [{src: ["foo/a.js"], dest: "bar/a.js"}, {src: ["foo/b.js"], dest: "bar/b.js"}]
+
+globule.mapping({src: ["a.js", "b.js"], srcBase: "foo", destBase: "bar"})
+// [{src: ["foo/a.js"], dest: "bar/a.js"}, {src: ["foo/b.js"], dest: "bar/b.js"}]
+```
+
+## Contributing
+In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
+
+## Release History
+2018-05-29 - v1.2.1 - Update dependencies, lodash@4.17.10 to avoid errant security warnings.
+2017-06-10 - v1.2.0 - Update dependencies, lodash@4.17.
+2016-10-23 - v1.1.0 - Update dependencies, lodash@4.16, glob@7.1.
+2016-04-14 - v1.0.0 - Update dependencies, lodash@4.9, glob@7.0, minimatch@3.0. Paths are unix-style with prefixBase enabled.
+2014-01-07 - v0.2.0 - Updated dependencies. Added `src` option. Improved exclusion speed significantly.
+2013-04-11 - v0.1.0 - Initial release.
+
+## License
+Copyright (c) 2018 "Cowboy" Ben Alman
+Licensed under the MIT license.
diff --git a/node_modules/globule/lib/globule.js b/node_modules/globule/lib/globule.js
new file mode 100644
index 0000000..2efe361
--- /dev/null
+++ b/node_modules/globule/lib/globule.js
@@ -0,0 +1,192 @@
+/*
+ * globule
+ * https://github.com/cowboy/node-globule
+ *
+ * Copyright (c) 2018 "Cowboy" Ben Alman
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+var fs = require('fs');
+var path = require('path');
+
+var _ = require('lodash');
+var glob = require('glob');
+var minimatch = require('minimatch');
+
+// The module.
+var globule = exports;
+
+// Process specified wildcard glob patterns or filenames against a
+// callback, excluding and uniquing files in the result set.
+function processPatterns(patterns, options, fn) {
+ var result = [];
+ _.each(patterns, function(pattern) {
+ // The first character is not ! (inclusion). Add all matching filepaths
+ // to the result set.
+ if (pattern.indexOf('!') !== 0) {
+ result = _.union(result, fn(pattern));
+ return;
+ }
+ // The first character is ! (exclusion). Remove any filepaths from the
+ // result set that match this pattern, sans leading !.
+ var filterFn = minimatch.filter(pattern.slice(1), options);
+ result = _.filter(result, function(filepath) {
+ return !filterFn(filepath);
+ });
+ });
+ return result;
+}
+
+// Normalize paths to be unix-style.
+var pathSeparatorRe = /[\/\\]/g;
+function normalizePath(path) {
+ return path.replace(pathSeparatorRe, '/');
+}
+
+// Match a filepath or filepaths against one or more wildcard patterns. Returns
+// all matching filepaths. This behaves just like minimatch.match, but supports
+// any number of patterns.
+globule.match = function(patterns, filepaths, options) {
+ // Return empty set if either patterns or filepaths was omitted.
+ if (patterns == null || filepaths == null) { return []; }
+ // Normalize patterns and filepaths to flattened arrays.
+ patterns = _.isArray(patterns) ? _.flattenDeep(patterns) : [patterns];
+ filepaths = _.isArray(filepaths) ? _.flattenDeep(filepaths) : [filepaths];
+ // Return empty set if there are no patterns or filepaths.
+ if (patterns.length === 0 || filepaths.length === 0) { return []; }
+ // Return all matching filepaths.
+ return processPatterns(patterns, options, function(pattern) {
+ return minimatch.match(filepaths, pattern, options || {});
+ });
+};
+
+// Match a filepath or filepaths against one or more wildcard patterns. Returns
+// true if any of the patterns match.
+globule.isMatch = function() {
+ return globule.match.apply(null, arguments).length > 0;
+};
+
+// Return an array of all file paths that match the given wildcard patterns.
+globule.find = function() {
+ var args = _.toArray(arguments);
+ // If the last argument is an options object, remove it from args.
+ var options = _.isPlainObject(args[args.length - 1]) ? args.pop() : {};
+ // If options.src was specified, use it. Otherwise, use all non-options
+ // arguments. Flatten nested arrays.
+ var patterns;
+ if (options.src) {
+ patterns = _.isArray(options.src) ? _.flattenDeep(options.src) : [options.src];
+ } else {
+ patterns = _.flattenDeep(args);
+ }
+ // Return empty set if there are no patterns.
+ if (patterns.length === 0) { return []; }
+ var srcBase = options.srcBase || options.cwd;
+ // Create glob-specific options object.
+ var globOptions = _.extend({}, options);
+ if (srcBase) {
+ globOptions.cwd = srcBase;
+ }
+ // Get all matching filepaths.
+ var matches = processPatterns(patterns, options, function(pattern) {
+ return glob.sync(pattern, globOptions);
+ });
+ // If srcBase and prefixBase were specified, prefix srcBase to matched paths.
+ if (srcBase && options.prefixBase) {
+ matches = matches.map(function(filepath) {
+ return normalizePath(path.join(srcBase, filepath));
+ });
+ }
+ // Filter result set?
+ if (options.filter) {
+ matches = matches.filter(function(filepath) {
+ // If srcBase was specified but prefixBase was NOT, prefix srcBase
+ // temporarily, for filtering.
+ if (srcBase && !options.prefixBase) {
+ filepath = normalizePath(path.join(srcBase, filepath));
+ }
+ try {
+ if (_.isFunction(options.filter)) {
+ return options.filter(filepath, options);
+ } else {
+ // If the file is of the right type and exists, this should work.
+ return fs.statSync(filepath)[options.filter]();
+ }
+ } catch(err) {
+ // Otherwise, it's probably not the right type.
+ return false;
+ }
+ });
+ }
+ return matches;
+};
+
+var extDotRe = {
+ first: /(\.[^\/]*)?$/,
+ last: /(\.[^\/\.]*)?$/,
+};
+function rename(dest, options) {
+ // Flatten path?
+ if (options.flatten) {
+ dest = path.basename(dest);
+ }
+ // Change the extension?
+ if (options.ext) {
+ dest = dest.replace(extDotRe[options.extDot], options.ext);
+ }
+ // Join dest and destBase?
+ if (options.destBase) {
+ dest = path.join(options.destBase, dest);
+ }
+ return dest;
+}
+
+// Build a mapping of src-dest filepaths from the given set of filepaths.
+globule.mapping = function(filepaths, options) {
+ // Return empty set if filepaths was omitted.
+ if (filepaths == null) { return []; }
+ options = _.defaults({}, options, {
+ extDot: 'first',
+ rename: rename,
+ });
+ var files = [];
+ var fileByDest = {};
+ // Find all files matching pattern, using passed-in options.
+ filepaths.forEach(function(src) {
+ // Generate destination filename.
+ var dest = options.rename(src, options);
+ // Prepend srcBase to all src paths.
+ if (options.srcBase) {
+ src = path.join(options.srcBase, src);
+ }
+ // Normalize filepaths to be unix-style.
+ dest = normalizePath(dest);
+ src = normalizePath(src);
+ // Map correct src path to dest path.
+ if (fileByDest[dest]) {
+ // If dest already exists, push this src onto that dest's src array.
+ fileByDest[dest].src.push(src);
+ } else {
+ // Otherwise create a new src-dest file mapping object.
+ files.push({
+ src: [src],
+ dest: dest,
+ });
+ // And store a reference for later use.
+ fileByDest[dest] = files[files.length - 1];
+ }
+ });
+ return files;
+};
+
+// Return a mapping of src-dest filepaths from files matching the given
+// wildcard patterns.
+globule.findMapping = function() {
+ var args = _.toArray(arguments);
+ // If the last argument is an options object, remove it from args.
+ var options = _.isPlainObject(args[args.length - 1]) ? args.pop() : {};
+ // Generate mapping from found filepaths.
+ return globule.mapping(globule.find(args, options), options);
+};
diff --git a/node_modules/globule/package.json b/node_modules/globule/package.json
new file mode 100644
index 0000000..3910645
--- /dev/null
+++ b/node_modules/globule/package.json
@@ -0,0 +1,75 @@
+{
+ "_from": "globule@^1.0.0",
+ "_id": "globule@1.3.2",
+ "_inBundle": false,
+ "_integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==",
+ "_location": "/globule",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "globule@^1.0.0",
+ "name": "globule",
+ "escapedName": "globule",
+ "rawSpec": "^1.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.0"
+ },
+ "_requiredBy": [
+ "/gaze"
+ ],
+ "_resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz",
+ "_shasum": "d8bdd9e9e4eef8f96e245999a5dee7eb5d8529c4",
+ "_spec": "globule@^1.0.0",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/gaze",
+ "author": {
+ "name": "\"Cowboy\" Ben Alman",
+ "url": "http://benalman.com/"
+ },
+ "bugs": {
+ "url": "https://github.com/cowboy/node-globule/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "glob": "~7.1.1",
+ "lodash": "~4.17.10",
+ "minimatch": "~3.0.2"
+ },
+ "deprecated": false,
+ "description": "An easy-to-use wildcard globbing library.",
+ "devDependencies": {
+ "grunt": "^1.0.2",
+ "grunt-contrib-jshint": "^1.0.0",
+ "grunt-contrib-nodeunit": "^2.0.0",
+ "grunt-contrib-watch": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "files": [
+ "lib"
+ ],
+ "homepage": "https://github.com/cowboy/node-globule",
+ "keywords": [
+ "glob",
+ "file",
+ "match",
+ "mapping",
+ "expand",
+ "wildcard",
+ "pattern",
+ "sync",
+ "awesome"
+ ],
+ "license": "MIT",
+ "main": "lib/globule",
+ "name": "globule",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/cowboy/node-globule.git"
+ },
+ "scripts": {
+ "test": "grunt"
+ },
+ "version": "1.3.2"
+}