forked from enviPath/enviPy
Current Dev State
This commit is contained in:
224
static/js/ketcher2/node_modules/require-glob/README.md
generated
vendored
Normal file
224
static/js/ketcher2/node_modules/require-glob/README.md
generated
vendored
Normal file
@ -0,0 +1,224 @@
|
||||
# `require-glob`
|
||||
|
||||
[![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url] [![Build Status][travis-img]][travis-url] [![Coverage Status][coveralls-img]][coveralls-url] [![Chat][gitter-img]][gitter-url] [![Tip][amazon-img]][amazon-url]
|
||||
|
||||
Requires multiple modules using glob patterns and combines them into a nested object.
|
||||
|
||||
## Install
|
||||
|
||||
$ npm install --save require-glob
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
┣━ unicorn.js
|
||||
┣━ cake.js
|
||||
┗━ rainbow/
|
||||
┣━ red-orange.js
|
||||
┣━ _yellow_green.js
|
||||
┗━ BluePurple.js
|
||||
```
|
||||
|
||||
```js
|
||||
var requireGlob = require('require-glob');
|
||||
|
||||
requireGlob(['**/*.js', '!cake.js']).then(function (modules) {
|
||||
console.log(modules);
|
||||
// {
|
||||
// unicorn: [object Object],
|
||||
// rainbow: {
|
||||
// redOrange: [object Object],
|
||||
// _yellow_green: [object Object],
|
||||
// BluePurple: [object Object]
|
||||
// }
|
||||
// }
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### requireGlob(patterns [, options]): Promise
|
||||
|
||||
Returns a promise that resolves to an object containing the required contents of matching globbed files.
|
||||
|
||||
### requireGlob.sync(patterns [, options]): Object
|
||||
|
||||
Returns an object containing the required contents of matching globbed files.
|
||||
|
||||
#### patterns
|
||||
|
||||
Type: `{String|Array.<String>}`
|
||||
|
||||
One or more [`minimatch` glob patterns][minimatch] patterns. Supports negation.
|
||||
|
||||
[minimatch]: https://github.com/isaacs/minimatch#usage
|
||||
|
||||
#### options
|
||||
|
||||
Type: `{Object}` (optional)
|
||||
|
||||
This object is ultimately passed directly to [`node-glob`][glob] so check there for more options, in addition to those below.
|
||||
|
||||
[glob]: https://github.com/isaacs/node-glob#usage
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `{String}` (default: `__dirname`)
|
||||
|
||||
The current working directory in which to search. Defaults to the `__dirname` of the requiring module so relative paths work the same as Node.js's require.
|
||||
|
||||
##### base
|
||||
|
||||
Type: `{String}` (default: common non-glob parent)
|
||||
|
||||
Default is everything before the first glob starts in the first pattern (see [`glob-parent`][parent]).
|
||||
|
||||
_This option has no effect if you define your own `mapper` function._
|
||||
|
||||
[parent]: https://github.com/es128/glob-parent#usage
|
||||
|
||||
```js
|
||||
requireGlob(['./src/**', './lib/**'], { cwd: '/home/jdoe/my-module' });
|
||||
// base is: /home/jdoe/my-module/src
|
||||
|
||||
requireGlob('./{src,lib}/**', { cwd: '/home/jdoe/my-module' });
|
||||
// base is: /home/jdoe/my-module
|
||||
```
|
||||
|
||||
##### bustCache
|
||||
|
||||
Type: `{Boolean}` (default: `false`)
|
||||
|
||||
Whether to force the reload of modules by deleting them from the cache. Useful inside watch tasks.
|
||||
|
||||
_This option has no effect if you define your own `mapper` function._
|
||||
|
||||
##### mapper
|
||||
|
||||
Type: `{Function(options, filePath, i, filePaths) : Object}`
|
||||
|
||||
The [mapper][map] is reponsible for requiring the globbed modules. The default mapper returns an object containing path information and the result of requiring the module.
|
||||
|
||||
[map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
|
||||
|
||||
```js
|
||||
// file: /home/jdoe/my-module/index.js
|
||||
requireGlob('./src/**/*.js');
|
||||
|
||||
// the resulting list of files
|
||||
[
|
||||
'./src/unicorn.js',
|
||||
'./src/rainbow/red-orange.js',
|
||||
'./src/rainbow/_yellow_green.js',
|
||||
'./src/rainbow/BluePurple.js',
|
||||
]
|
||||
|
||||
// will be mapped to
|
||||
[
|
||||
{
|
||||
cwd: '/home/jdoe/my-module',
|
||||
base: '/home/jdoe/my-module/src',
|
||||
path: '/home/jdoe/my-module/src/unicorn.js',
|
||||
exports: require('./src/unicorn')
|
||||
},
|
||||
{
|
||||
cwd: '/home/jdoe/my-module',
|
||||
base: '/home/jdoe/my-module/src',
|
||||
path: '/home/jdoe/my-module/src/rainbow/red-orange.js',
|
||||
exports: require('./src/rainbow/red-orange')
|
||||
},
|
||||
{
|
||||
cwd: '/home/jdoe/my-module',
|
||||
base: '/home/jdoe/my-module/src',
|
||||
path: '/home/jdoe/my-module/src/rainbow/_yellow_green.js',
|
||||
exports: require('./src/rainbow/_yellow_green')
|
||||
},
|
||||
{
|
||||
cwd: '/home/jdoe/my-module',
|
||||
base: '/home/jdoe/my-module/src',
|
||||
path: '/home/jdoe/my-module/src/rainbow/BluePurple.js',
|
||||
exports: require('./src/rainbow/BluePurple')
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
##### reducer
|
||||
|
||||
Type: `{Function(options, result, fileObject, i, fileObjects): Object}`
|
||||
|
||||
The [reducer][reduce] is responsible for generating the final object structure. The default reducer expects an array as produced by the default mapper and turns it into a nested object. Path separators determine object nesting. Directory names and file names are converted to `camelCase`. File extensions are ignored.
|
||||
|
||||
[reduce]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
|
||||
|
||||
```js
|
||||
// mapper example is reduced to
|
||||
|
||||
{
|
||||
unicorn: require('./src/unicorn.js'),
|
||||
rainbow: {
|
||||
redOrange: require('./src/rainbow/red-orange.js'),
|
||||
_yellow_green: require('./src/rainbow/_yellow_green.js'),
|
||||
BluePurple: require('./src/rainbow/BluePurple.js'),
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### keygen
|
||||
|
||||
Type: `{Function(options, fileObj): String|Array.<String>}`
|
||||
|
||||
The default reducer uses this function to generate a unique key path for every module. The default keygen converts hyphenated and dot-separated sections of directory names and the file name to `camelCase`. File extensions are ignored. Path separators determine object nesting.
|
||||
|
||||
_This option has no effect if you define your own `reducer` function._
|
||||
|
||||
```js
|
||||
// given the mapped object
|
||||
{
|
||||
cwd: '/home/jdoe/my-module',
|
||||
base: '/home/jdoe/my-module/src',
|
||||
path: '/home/jdoe/my-module/src/fooBar/bar-baz/_bat.qux.js',
|
||||
exports: require('./src/fooBar/bar-baz/_bat.qux.js')
|
||||
}
|
||||
|
||||
// the keygen will produce
|
||||
[
|
||||
'fooBar',
|
||||
'barBaz',
|
||||
'_batQux'
|
||||
]
|
||||
|
||||
// which the reducer will use to construct
|
||||
{
|
||||
fooBar: {
|
||||
barBaz: {
|
||||
_batQux: require('./src/fooBar/bar-baz/_bat.qux.js')
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Contribute
|
||||
|
||||
Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.
|
||||
|
||||
### Test
|
||||
|
||||
$ npm test
|
||||
|
||||
----
|
||||
|
||||
© 2016 Shannon Moeller <me@shannonmoeller.com>
|
||||
|
||||
Licensed under [MIT](http://shannonmoeller.com/mit.txt)
|
||||
|
||||
[amazon-img]: https://img.shields.io/badge/amazon-tip_jar-yellow.svg?style=flat-square
|
||||
[amazon-url]: https://www.amazon.com/gp/registry/wishlist/1VQM9ID04YPC5?sort=universal-price
|
||||
[coveralls-img]: http://img.shields.io/coveralls/shannonmoeller/require-glob/master.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/shannonmoeller/require-glob
|
||||
[downloads-img]: http://img.shields.io/npm/dm/require-glob.svg?style=flat-square
|
||||
[gitter-img]: http://img.shields.io/badge/gitter-join_chat-1dce73.svg?style=flat-square
|
||||
[gitter-url]: https://gitter.im/shannonmoeller/shannonmoeller
|
||||
[npm-img]: http://img.shields.io/npm/v/require-glob.svg?style=flat-square
|
||||
[npm-url]: https://npmjs.org/package/require-glob
|
||||
[travis-img]: http://img.shields.io/travis/shannonmoeller/require-glob.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/shannonmoeller/require-glob
|
||||
15
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
15
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2015 Elan Shanker
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
109
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/README.md
generated
vendored
Normal file
109
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/README.md
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
glob-parent [](https://travis-ci.org/es128/glob-parent) [](https://coveralls.io/r/es128/glob-parent?branch=master)
|
||||
======
|
||||
Javascript module to extract the non-magic parent path from a glob string.
|
||||
|
||||
[](https://nodei.co/npm/glob-parent/)
|
||||
[](https://nodei.co/npm-dl/glob-parent/)
|
||||
|
||||
Usage
|
||||
-----
|
||||
```sh
|
||||
npm install glob-parent --save
|
||||
```
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
var globParent = require('glob-parent');
|
||||
|
||||
globParent('path/to/*.js'); // 'path/to'
|
||||
globParent('/root/path/to/*.js'); // '/root/path/to'
|
||||
globParent('/*.js'); // '/'
|
||||
globParent('*.js'); // '.'
|
||||
globParent('**/*.js'); // '.'
|
||||
globParent('path/{to,from}'); // 'path'
|
||||
globParent('path/!(to|from)'); // 'path'
|
||||
globParent('path/?(to|from)'); // 'path'
|
||||
globParent('path/+(to|from)'); // 'path'
|
||||
globParent('path/*(to|from)'); // 'path'
|
||||
globParent('path/@(to|from)'); // 'path'
|
||||
globParent('path/**/*'); // 'path'
|
||||
|
||||
// if provided a non-glob path, returns the nearest dir
|
||||
globParent('path/foo/bar.js'); // 'path/foo'
|
||||
globParent('path/foo/'); // 'path/foo'
|
||||
globParent('path/foo'); // 'path' (see issue #3 for details)
|
||||
```
|
||||
|
||||
## Escaping
|
||||
|
||||
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
|
||||
|
||||
- `?` (question mark)
|
||||
- `*` (star)
|
||||
- `|` (pipe)
|
||||
- `(` (opening parenthesis)
|
||||
- `)` (closing parenthesis)
|
||||
- `{` (opening curly brace)
|
||||
- `}` (closing curly brace)
|
||||
- `[` (opening bracket)
|
||||
- `]` (closing bracket)
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
globParent('foo/[bar]/') // 'foo'
|
||||
globParent('foo/\\[bar]/') // 'foo/[bar]'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
#### Braces & Brackets
|
||||
This library attempts a quick and imperfect method of determining which path
|
||||
parts have glob magic without fully parsing/lexing the pattern. There are some
|
||||
advanced use cases that can trip it up, such as nested braces where the outer
|
||||
pair is escaped and the inner one contains a path separator. If you find
|
||||
yourself in the unlikely circumstance of being affected by this or need to
|
||||
ensure higher-fidelity glob handling in your library, it is recommended that you
|
||||
pre-process your input with [expand-braces] and/or [expand-brackets].
|
||||
|
||||
#### Windows
|
||||
Backslashes are not valid path separators for globs. If a path with backslashes
|
||||
is provided anyway, for simple cases, glob-parent will replace the path
|
||||
separator for you and return the non-glob parent path (now with
|
||||
forward-slashes, which are still valid as Windows path separators).
|
||||
|
||||
This cannot be used in conjunction with escape characters.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)'
|
||||
|
||||
// GOOD
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)'
|
||||
```
|
||||
|
||||
If you are using escape characters for a pattern without path parts (i.e.
|
||||
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('foo \\[bar]') // 'foo '
|
||||
globParent('foo \\[bar]*') // 'foo '
|
||||
|
||||
// GOOD
|
||||
globParent('./foo \\[bar]') // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*') // '.'
|
||||
```
|
||||
|
||||
|
||||
Change Log
|
||||
----------
|
||||
[See release notes page on GitHub](https://github.com/es128/glob-parent/releases)
|
||||
|
||||
License
|
||||
-------
|
||||
[ISC](https://raw.github.com/es128/glob-parent/master/LICENSE)
|
||||
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
24
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/index.js
generated
vendored
Normal file
24
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/index.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var isglob = require('is-glob');
|
||||
var pathDirname = require('path-dirname');
|
||||
var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
module.exports = function globParent(str) {
|
||||
// flip windows path separators
|
||||
if (isWin32 && str.indexOf('/') < 0) str = str.split('\\').join('/');
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/';
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
// remove path parts that are globby
|
||||
do {str = pathDirname.posix(str)}
|
||||
while (isglob(str) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
|
||||
};
|
||||
70
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/package.json
generated
vendored
Normal file
70
static/js/ketcher2/node_modules/require-glob/node_modules/glob-parent/package.json
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "glob-parent@^3.0.0",
|
||||
"_id": "glob-parent@3.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
|
||||
"_location": "/require-glob/glob-parent",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "glob-parent@^3.0.0",
|
||||
"name": "glob-parent",
|
||||
"escapedName": "glob-parent",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/require-glob"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
|
||||
"_shasum": "9e6af6299d8d3bd2bd40430832bd113df906c5ae",
|
||||
"_spec": "glob-parent@^3.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/require-glob",
|
||||
"author": {
|
||||
"name": "Elan Shanker",
|
||||
"url": "https://github.com/es128"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/es128/glob-parent/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"is-glob": "^3.1.0",
|
||||
"path-dirname": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Strips glob magic from a string to provide the parent directory path",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "^0.3.5",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/es128/glob-parent",
|
||||
"keywords": [
|
||||
"glob",
|
||||
"parent",
|
||||
"strip",
|
||||
"path",
|
||||
"dirname",
|
||||
"directory",
|
||||
"base",
|
||||
"wildcard"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "glob-parent",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es128/glob-parent.git"
|
||||
},
|
||||
"scripts": {
|
||||
"ci-test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls",
|
||||
"test": "istanbul test node_modules/mocha/bin/_mocha"
|
||||
},
|
||||
"version": "3.1.0"
|
||||
}
|
||||
88
static/js/ketcher2/node_modules/require-glob/node_modules/globby/index.js
generated
vendored
Normal file
88
static/js/ketcher2/node_modules/require-glob/node_modules/globby/index.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
var Promise = require('pinkie-promise');
|
||||
var arrayUnion = require('array-union');
|
||||
var objectAssign = require('object-assign');
|
||||
var glob = require('glob');
|
||||
var pify = require('pify');
|
||||
|
||||
var globP = pify(glob, Promise).bind(glob);
|
||||
|
||||
function isNegative(pattern) {
|
||||
return pattern[0] === '!';
|
||||
}
|
||||
|
||||
function isString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
|
||||
function assertPatternsInput(patterns) {
|
||||
if (!patterns.every(isString)) {
|
||||
throw new TypeError('patterns must be a string or an array of strings');
|
||||
}
|
||||
}
|
||||
|
||||
function generateGlobTasks(patterns, opts) {
|
||||
patterns = [].concat(patterns);
|
||||
assertPatternsInput(patterns);
|
||||
|
||||
var globTasks = [];
|
||||
|
||||
opts = objectAssign({
|
||||
cache: Object.create(null),
|
||||
statCache: Object.create(null),
|
||||
realpathCache: Object.create(null),
|
||||
symlinks: Object.create(null),
|
||||
ignore: []
|
||||
}, opts);
|
||||
|
||||
patterns.forEach(function (pattern, i) {
|
||||
if (isNegative(pattern)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var ignore = patterns.slice(i).filter(isNegative).map(function (pattern) {
|
||||
return pattern.slice(1);
|
||||
});
|
||||
|
||||
globTasks.push({
|
||||
pattern: pattern,
|
||||
opts: objectAssign({}, opts, {
|
||||
ignore: opts.ignore.concat(ignore)
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
return globTasks;
|
||||
}
|
||||
|
||||
module.exports = function (patterns, opts) {
|
||||
var globTasks;
|
||||
|
||||
try {
|
||||
globTasks = generateGlobTasks(patterns, opts);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
return Promise.all(globTasks.map(function (task) {
|
||||
return globP(task.pattern, task.opts);
|
||||
})).then(function (paths) {
|
||||
return arrayUnion.apply(null, paths);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = function (patterns, opts) {
|
||||
var globTasks = generateGlobTasks(patterns, opts);
|
||||
|
||||
return globTasks.reduce(function (matches, task) {
|
||||
return arrayUnion(matches, glob.sync(task.pattern, task.opts));
|
||||
}, []);
|
||||
};
|
||||
|
||||
module.exports.generateGlobTasks = generateGlobTasks;
|
||||
|
||||
module.exports.hasMagic = function (patterns, opts) {
|
||||
return [].concat(patterns).some(function (pattern) {
|
||||
return glob.hasMagic(pattern, opts);
|
||||
});
|
||||
};
|
||||
21
static/js/ketcher2/node_modules/require-glob/node_modules/globby/license
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/require-glob/node_modules/globby/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
101
static/js/ketcher2/node_modules/require-glob/node_modules/globby/package.json
generated
vendored
Normal file
101
static/js/ketcher2/node_modules/require-glob/node_modules/globby/package.json
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"_from": "globby@^6.0.0",
|
||||
"_id": "globby@6.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
|
||||
"_location": "/require-glob/globby",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "globby@^6.0.0",
|
||||
"name": "globby",
|
||||
"escapedName": "globby",
|
||||
"rawSpec": "^6.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/require-glob"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
|
||||
"_shasum": "f5a6d70e8395e21c858fb0489d64df02424d506c",
|
||||
"_spec": "globby@^6.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/require-glob",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/globby/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"array-union": "^1.0.1",
|
||||
"glob": "^7.0.3",
|
||||
"object-assign": "^4.0.1",
|
||||
"pify": "^2.0.0",
|
||||
"pinkie-promise": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Extends `glob` with support for multiple patterns and exposes a Promise API",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"glob-stream": "github:gulpjs/glob-stream#master",
|
||||
"globby": "github:sindresorhus/globby#master",
|
||||
"matcha": "^0.7.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"xo": "^0.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/globby#readme",
|
||||
"keywords": [
|
||||
"all",
|
||||
"array",
|
||||
"directories",
|
||||
"dirs",
|
||||
"expand",
|
||||
"files",
|
||||
"filesystem",
|
||||
"filter",
|
||||
"find",
|
||||
"fnmatch",
|
||||
"folders",
|
||||
"fs",
|
||||
"glob",
|
||||
"globbing",
|
||||
"globs",
|
||||
"gulpfriendly",
|
||||
"match",
|
||||
"matcher",
|
||||
"minimatch",
|
||||
"multi",
|
||||
"multiple",
|
||||
"paths",
|
||||
"pattern",
|
||||
"patterns",
|
||||
"traverse",
|
||||
"util",
|
||||
"utility",
|
||||
"wildcard",
|
||||
"wildcards",
|
||||
"promise"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "globby",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/globby.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "npm update glob-stream && matcha bench.js",
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "6.1.0"
|
||||
}
|
||||
88
static/js/ketcher2/node_modules/require-glob/node_modules/globby/readme.md
generated
vendored
Normal file
88
static/js/ketcher2/node_modules/require-glob/node_modules/globby/readme.md
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
# globby [](https://travis-ci.org/sindresorhus/globby)
|
||||
|
||||
> Extends [glob](https://github.com/isaacs/node-glob) with support for multiple patterns and exposes a Promise API
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save globby
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
├── unicorn
|
||||
├── cake
|
||||
└── rainbow
|
||||
```
|
||||
|
||||
```js
|
||||
const globby = require('globby');
|
||||
|
||||
globby(['*', '!cake']).then(paths => {
|
||||
console.log(paths);
|
||||
//=> ['unicorn', 'rainbow']
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### globby(patterns, [options])
|
||||
|
||||
Returns a Promise for an array of matching paths.
|
||||
|
||||
### globby.sync(patterns, [options])
|
||||
|
||||
Returns an array of matching paths.
|
||||
|
||||
### globby.generateGlobTasks(patterns, [options])
|
||||
|
||||
Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages.
|
||||
|
||||
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
|
||||
|
||||
### globby.hasMagic(patterns, [options])
|
||||
|
||||
Returns a `boolean` of whether there are any special glob characters in the `patterns`.
|
||||
|
||||
Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set.
|
||||
|
||||
#### patterns
|
||||
|
||||
Type: `string` `Array`
|
||||
|
||||
See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
See the `node-glob` [options](https://github.com/isaacs/node-glob#options).
|
||||
|
||||
|
||||
## Globbing patterns
|
||||
|
||||
Just a quick overview.
|
||||
|
||||
- `*` matches any number of characters, but not `/`
|
||||
- `?` matches a single character, but not `/`
|
||||
- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
|
||||
- `{}` allows for a comma-separated list of "or" expressions
|
||||
- `!` at the beginning of a pattern will negate the match
|
||||
|
||||
[Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/master/test.js)
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem
|
||||
- [glob-stream](https://github.com/wearefractal/glob-stream) - Streaming alternative
|
||||
- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
21
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/LICENSE
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016, Jon Schlinkert
|
||||
|
||||
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.
|
||||
107
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/README.md
generated
vendored
Normal file
107
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/README.md
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
# is-extglob [](https://www.npmjs.com/package/is-extglob) [](https://npmjs.org/package/is-extglob) [](https://travis-ci.org/jonschlinkert/is-extglob)
|
||||
|
||||
> Returns true if a string has an extglob.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-extglob
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isExtglob = require('is-extglob');
|
||||
```
|
||||
|
||||
**True**
|
||||
|
||||
```js
|
||||
isExtglob('?(abc)');
|
||||
isExtglob('@(abc)');
|
||||
isExtglob('!(abc)');
|
||||
isExtglob('*(abc)');
|
||||
isExtglob('+(abc)');
|
||||
```
|
||||
|
||||
**False**
|
||||
|
||||
Escaped extglobs:
|
||||
|
||||
```js
|
||||
isExtglob('\\?(abc)');
|
||||
isExtglob('\\@(abc)');
|
||||
isExtglob('\\!(abc)');
|
||||
isExtglob('\\*(abc)');
|
||||
isExtglob('\\+(abc)');
|
||||
```
|
||||
|
||||
Everything else...
|
||||
|
||||
```js
|
||||
isExtglob('foo.js');
|
||||
isExtglob('!foo.js');
|
||||
isExtglob('*.js');
|
||||
isExtglob('**/abc.js');
|
||||
isExtglob('abc/*.js');
|
||||
isExtglob('abc/(aaa|bbb).js');
|
||||
isExtglob('abc/[a-z].js');
|
||||
isExtglob('abc/{a,b}.js');
|
||||
isExtglob('abc/?.js');
|
||||
isExtglob('abc.js');
|
||||
isExtglob('abc/def/ghi.js');
|
||||
```
|
||||
|
||||
## History
|
||||
|
||||
**v2.0**
|
||||
|
||||
Adds support for escaping. Escaped exglobs no longer return true.
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.")
|
||||
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
|
||||
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
|
||||
|
||||
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
||||
|
||||
```sh
|
||||
$ npm install -g verb verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm install -d && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._
|
||||
20
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/index.js
generated
vendored
Normal file
20
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
||||
*
|
||||
* Copyright (c) 2014-2016, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
module.exports = function isExtglob(str) {
|
||||
if (typeof str !== 'string' || str === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var match;
|
||||
while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
|
||||
if (match[2]) return true;
|
||||
str = str.slice(match.index + match[0].length);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
100
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/package.json
generated
vendored
Normal file
100
static/js/ketcher2/node_modules/require-glob/node_modules/is-extglob/package.json
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
{
|
||||
"_from": "is-extglob@^2.1.0",
|
||||
"_id": "is-extglob@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
|
||||
"_location": "/require-glob/is-extglob",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-extglob@^2.1.0",
|
||||
"name": "is-extglob",
|
||||
"escapedName": "is-extglob",
|
||||
"rawSpec": "^2.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/require-glob/is-glob"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
"_shasum": "a88c02535791f02ed37c76a1b9ea9773c833f8c2",
|
||||
"_spec": "is-extglob@^2.1.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/require-glob/node_modules/is-glob",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-extglob/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Returns true if a string has an extglob.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^0.1.10",
|
||||
"mocha": "^3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/is-extglob",
|
||||
"keywords": [
|
||||
"bash",
|
||||
"braces",
|
||||
"check",
|
||||
"exec",
|
||||
"expression",
|
||||
"extglob",
|
||||
"glob",
|
||||
"globbing",
|
||||
"globstar",
|
||||
"is",
|
||||
"match",
|
||||
"matches",
|
||||
"pattern",
|
||||
"regex",
|
||||
"regular",
|
||||
"string",
|
||||
"test"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "is-extglob",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/is-extglob.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"has-glob",
|
||||
"is-glob",
|
||||
"micromatch"
|
||||
]
|
||||
},
|
||||
"reflinks": [
|
||||
"verb",
|
||||
"verb-generate-readme"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "2.1.1"
|
||||
}
|
||||
21
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/LICENSE
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
142
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/README.md
generated
vendored
Normal file
142
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/README.md
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
# is-glob [](https://www.npmjs.com/package/is-glob) [](https://npmjs.org/package/is-glob) [](https://travis-ci.org/jonschlinkert/is-glob)
|
||||
|
||||
> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-glob
|
||||
```
|
||||
|
||||
You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob).
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isGlob = require('is-glob');
|
||||
```
|
||||
|
||||
**True**
|
||||
|
||||
Patterns that have glob characters or regex patterns will return `true`:
|
||||
|
||||
```js
|
||||
isGlob('!foo.js');
|
||||
isGlob('*.js');
|
||||
isGlob('**/abc.js');
|
||||
isGlob('abc/*.js');
|
||||
isGlob('abc/(aaa|bbb).js');
|
||||
isGlob('abc/[a-z].js');
|
||||
isGlob('abc/{a,b}.js');
|
||||
isGlob('abc/?.js');
|
||||
//=> true
|
||||
```
|
||||
|
||||
Extglobs
|
||||
|
||||
```js
|
||||
isGlob('abc/@(a).js');
|
||||
isGlob('abc/!(a).js');
|
||||
isGlob('abc/+(a).js');
|
||||
isGlob('abc/*(a).js');
|
||||
isGlob('abc/?(a).js');
|
||||
//=> true
|
||||
```
|
||||
|
||||
**False**
|
||||
|
||||
Escaped globs or extglobs return `false`:
|
||||
|
||||
```js
|
||||
isGlob('abc/\\@(a).js');
|
||||
isGlob('abc/\\!(a).js');
|
||||
isGlob('abc/\\+(a).js');
|
||||
isGlob('abc/\\*(a).js');
|
||||
isGlob('abc/\\?(a).js');
|
||||
isGlob('\\!foo.js');
|
||||
isGlob('\\*.js');
|
||||
isGlob('\\*\\*/abc.js');
|
||||
isGlob('abc/\\*.js');
|
||||
isGlob('abc/\\(aaa|bbb).js');
|
||||
isGlob('abc/\\[a-z].js');
|
||||
isGlob('abc/\\{a,b}.js');
|
||||
isGlob('abc/\\?.js');
|
||||
//=> false
|
||||
```
|
||||
|
||||
Patterns that do not have glob patterns return `false`:
|
||||
|
||||
```js
|
||||
isGlob('abc.js');
|
||||
isGlob('abc/def/ghi.js');
|
||||
isGlob('foo.js');
|
||||
isGlob('abc/@.js');
|
||||
isGlob('abc/+.js');
|
||||
isGlob();
|
||||
isGlob(null);
|
||||
//=> false
|
||||
```
|
||||
|
||||
Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)):
|
||||
|
||||
```js
|
||||
isGlob(['**/*.js']);
|
||||
isGlob(['foo.js']);
|
||||
//=> false
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
|
||||
* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/node-base/base) | [homepage](https://github.com/node-base/base "base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.")
|
||||
* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.")
|
||||
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor**<br/> |
|
||||
| --- | --- |
|
||||
| 40 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 1 | [tuvistavie](https://github.com/tuvistavie) |
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
|
||||
|
||||
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
||||
|
||||
```sh
|
||||
$ npm install -g verb verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm install -d && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT license](https://github.com/jonschlinkert/is-glob/blob/master/LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._
|
||||
25
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/index.js
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/index.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*!
|
||||
* is-glob <https://github.com/jonschlinkert/is-glob>
|
||||
*
|
||||
* Copyright (c) 2014-2016, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
var isExtglob = require('is-extglob');
|
||||
|
||||
module.exports = function isGlob(str) {
|
||||
if (typeof str !== 'string' || str === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isExtglob(str)) return true;
|
||||
|
||||
var regex = /(\\).|([*?]|\[.*\]|\{.*\}|\(.*\|.*\)|^!)/;
|
||||
var match;
|
||||
|
||||
while ((match = regex.exec(str))) {
|
||||
if (match[2]) return true;
|
||||
str = str.slice(match.index + match[0].length);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
119
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/package.json
generated
vendored
Normal file
119
static/js/ketcher2/node_modules/require-glob/node_modules/is-glob/package.json
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
{
|
||||
"_from": "is-glob@^3.1.0",
|
||||
"_id": "is-glob@3.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
|
||||
"_location": "/require-glob/is-glob",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-glob@^3.1.0",
|
||||
"name": "is-glob",
|
||||
"escapedName": "is-glob",
|
||||
"rawSpec": "^3.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/require-glob/glob-parent"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
|
||||
"_shasum": "7ba5ae24217804ac70707b96922567486cc3e84a",
|
||||
"_spec": "is-glob@^3.1.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/require-glob/node_modules/glob-parent",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-glob/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Daniel Perez",
|
||||
"email": "daniel@claudetech.com",
|
||||
"url": "http://tuvistavie.com"
|
||||
},
|
||||
{
|
||||
"name": "Jon Schlinkert",
|
||||
"email": "jon.schlinkert@sellside.com",
|
||||
"url": "http://twitter.com/jonschlinkert"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"is-extglob": "^2.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^0.1.10",
|
||||
"mocha": "^3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/is-glob",
|
||||
"keywords": [
|
||||
"bash",
|
||||
"braces",
|
||||
"check",
|
||||
"exec",
|
||||
"expression",
|
||||
"extglob",
|
||||
"glob",
|
||||
"globbing",
|
||||
"globstar",
|
||||
"is",
|
||||
"match",
|
||||
"matches",
|
||||
"pattern",
|
||||
"regex",
|
||||
"regular",
|
||||
"string",
|
||||
"test"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "is-glob",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/is-glob.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"layout": "default",
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"assemble",
|
||||
"base",
|
||||
"update",
|
||||
"verb"
|
||||
]
|
||||
},
|
||||
"reflinks": [
|
||||
"assemble",
|
||||
"bach",
|
||||
"base",
|
||||
"composer",
|
||||
"gulp",
|
||||
"has-glob",
|
||||
"is-valid-glob",
|
||||
"micromatch",
|
||||
"npm",
|
||||
"scaffold",
|
||||
"verb",
|
||||
"vinyl"
|
||||
]
|
||||
},
|
||||
"version": "3.1.0"
|
||||
}
|
||||
89
static/js/ketcher2/node_modules/require-glob/package.json
generated
vendored
Normal file
89
static/js/ketcher2/node_modules/require-glob/package.json
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"_from": "require-glob@^3.2.0",
|
||||
"_id": "require-glob@3.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-kL/iyO+0ufly65o/XlgIMuBPZNM=",
|
||||
"_location": "/require-glob",
|
||||
"_phantomChildren": {
|
||||
"array-union": "1.0.2",
|
||||
"glob": "7.1.2",
|
||||
"object-assign": "4.1.1",
|
||||
"path-dirname": "1.0.2",
|
||||
"pify": "2.3.0",
|
||||
"pinkie-promise": "2.0.1"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "require-glob@^3.2.0",
|
||||
"name": "require-glob",
|
||||
"escapedName": "require-glob",
|
||||
"rawSpec": "^3.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/handlebars-wax"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/require-glob/-/require-glob-3.2.0.tgz",
|
||||
"_shasum": "90bfe2c8efb4b9f972eb9a3f5e580832e04f64d3",
|
||||
"_spec": "require-glob@^3.2.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/handlebars-wax",
|
||||
"author": {
|
||||
"name": "Shannon Moeller",
|
||||
"email": "me@shannonmoeller.com",
|
||||
"url": "http://shannonmoeller.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shannonmoeller/require-glob/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"glob-parent": "^3.0.0",
|
||||
"globby": "^6.0.0",
|
||||
"parent-module": "^0.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Require multiple modules using glob patterns. Supports exclusions.",
|
||||
"devDependencies": {
|
||||
"ava": "^0.16.0",
|
||||
"coveralls": "^2.11.14",
|
||||
"nyc": "^8.3.0",
|
||||
"watch": "^0.19.2",
|
||||
"xo": "^0.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12"
|
||||
},
|
||||
"homepage": "https://github.com/shannonmoeller/require-glob",
|
||||
"keywords": [
|
||||
"dir",
|
||||
"directory",
|
||||
"directories",
|
||||
"file",
|
||||
"files",
|
||||
"glob",
|
||||
"globs",
|
||||
"map",
|
||||
"mapreduce",
|
||||
"multi",
|
||||
"multiple",
|
||||
"reduce",
|
||||
"require",
|
||||
"tree"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/require-glob.js",
|
||||
"name": "require-glob",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/shannonmoeller/require-glob.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coveralls": "nyc report -r text-lcov | coveralls",
|
||||
"pretest": "xo src/*.js test/*.js",
|
||||
"test": "nyc ava -v test/*.js",
|
||||
"watch": "watch 'npm test' src test -du"
|
||||
},
|
||||
"version": "3.2.0"
|
||||
}
|
||||
132
static/js/ketcher2/node_modules/require-glob/src/require-glob.js
generated
vendored
Normal file
132
static/js/ketcher2/node_modules/require-glob/src/require-glob.js
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var globParent = require('glob-parent');
|
||||
var globby = require('globby');
|
||||
var parentModule = require('parent-module');
|
||||
|
||||
var CAMELIZE_PATTERN = /[\.\-]+(.)/g;
|
||||
var SEPARATOR_PATTERN = /[\\\/]/;
|
||||
|
||||
// Utilities
|
||||
|
||||
function toCamelCase(value) {
|
||||
return value.replace(CAMELIZE_PATTERN, function (match, character) {
|
||||
return character.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
function toCombinedValues(a, b) {
|
||||
return a.concat(b);
|
||||
}
|
||||
|
||||
function toNestedObject(obj, key) {
|
||||
if (!obj[key]) {
|
||||
obj[key] = {};
|
||||
}
|
||||
|
||||
return obj[key];
|
||||
}
|
||||
|
||||
function toSplitPath(filePath) {
|
||||
return filePath.split(SEPARATOR_PATTERN);
|
||||
}
|
||||
|
||||
// Map Reduce
|
||||
|
||||
function mapper(options, filePath) {
|
||||
var cwd = options.cwd;
|
||||
var base = options.base;
|
||||
|
||||
filePath = require.resolve(path.resolve(cwd, filePath));
|
||||
|
||||
if (options.bustCache) {
|
||||
delete require.cache[filePath];
|
||||
}
|
||||
|
||||
return {
|
||||
cwd: cwd,
|
||||
base: base,
|
||||
path: filePath,
|
||||
exports: require(filePath)
|
||||
};
|
||||
}
|
||||
|
||||
function reducer(options, tree, fileObj) {
|
||||
if (!fileObj || !fileObj.path || !('exports' in fileObj)) {
|
||||
return tree;
|
||||
}
|
||||
|
||||
var keys = [].concat(options.keygen(fileObj));
|
||||
|
||||
if (!keys.length) {
|
||||
return tree;
|
||||
}
|
||||
|
||||
var lastKey = keys.pop();
|
||||
var obj = keys.reduce(toNestedObject, tree);
|
||||
|
||||
obj[lastKey] = fileObj.exports;
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
function keygen(options, fileObj) {
|
||||
var uniquePath = fileObj.path.replace(fileObj.base, '');
|
||||
var parsedPath = path.parse(uniquePath);
|
||||
|
||||
return [parsedPath.dir, parsedPath.name]
|
||||
.map(toSplitPath)
|
||||
.reduce(toCombinedValues)
|
||||
.map(toCamelCase)
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function mapReduce(options, filePaths) {
|
||||
return filePaths
|
||||
.map(options.mapper)
|
||||
.reduce(options.reducer, {});
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
function normalizeOptions(pattern, options) {
|
||||
pattern = [].concat(pattern || '');
|
||||
|
||||
options.base = options.base || path.resolve(options.cwd, globParent(pattern[0]));
|
||||
options.bustCache = options.bustCache || false;
|
||||
|
||||
options.mapper = (options.mapper || mapper).bind(null, options);
|
||||
options.reducer = (options.reducer || reducer).bind(null, options);
|
||||
options.keygen = (options.keygen || keygen).bind(null, options);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function requireGlob(pattern, options) {
|
||||
options = options || {};
|
||||
|
||||
// we have to do this outside of `normalizeOptions()`
|
||||
// for `parentModule()` to work properly
|
||||
options.cwd = options.cwd || path.dirname(parentModule());
|
||||
|
||||
options = normalizeOptions(pattern, options);
|
||||
|
||||
return globby(pattern, options)
|
||||
.then(mapReduce.bind(null, options));
|
||||
}
|
||||
|
||||
function requireGlobSync(pattern, options) {
|
||||
options = options || {};
|
||||
|
||||
// we have to do this outside of `normalizeOptions()`
|
||||
// for `parentModule()` to work properly
|
||||
options.cwd = options.cwd || path.dirname(parentModule());
|
||||
|
||||
options = normalizeOptions(pattern, options);
|
||||
|
||||
return mapReduce(options, globby.sync(pattern, options));
|
||||
}
|
||||
|
||||
module.exports = requireGlob;
|
||||
module.exports.sync = requireGlobSync;
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/a/a1.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/a/a1.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'a1';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/a/a2.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/a/a2.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'a2';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b1.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b1.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'b1';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b2.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b2.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'b2';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b_b-b/_b.b1.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b_b-b/_b.b1.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = '_b.b1';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b_b-b/b.b2.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/deep/b/b_b-b/b.b2.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'b.b2';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/random.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/random.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = Math.random();
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/a.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/a.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'a';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/b.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/b.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'b';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/c.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/c.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = 'c';
|
||||
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/d.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/require-glob/test/fixtures/shallow/d.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = { e: 'e' };
|
||||
232
static/js/ketcher2/node_modules/require-glob/test/require-glob.js
generated
vendored
Normal file
232
static/js/ketcher2/node_modules/require-glob/test/require-glob.js
generated
vendored
Normal file
@ -0,0 +1,232 @@
|
||||
import path from 'path';
|
||||
import test from 'ava';
|
||||
import requireGlob from '../src/require-glob';
|
||||
|
||||
test('should require nothing', async t => {
|
||||
const bogusA = await requireGlob('./fixtures/bogu*.js');
|
||||
const bogusB = requireGlob.sync('./fixtures/bogu*.js');
|
||||
|
||||
t.deepEqual(bogusA, {});
|
||||
t.deepEqual(bogusB, {});
|
||||
});
|
||||
|
||||
test('should require a module', async t => {
|
||||
const oneA = await requireGlob('./fixtures/rand*.js');
|
||||
const oneB = requireGlob.sync('./fixtures/rand*.js');
|
||||
|
||||
t.is(typeof oneA.random, 'number');
|
||||
t.is(typeof oneB.random, 'number');
|
||||
});
|
||||
|
||||
test('should require multiple modules', async t => {
|
||||
const shallowA = await requireGlob('./fixtures/shallow/**/*.js');
|
||||
const shallowB = requireGlob.sync('./fixtures/shallow/**/*.js');
|
||||
const expected = {
|
||||
a: 'a',
|
||||
b: 'b',
|
||||
c: 'c',
|
||||
d: {
|
||||
e: 'e'
|
||||
}
|
||||
};
|
||||
|
||||
t.deepEqual(shallowA, expected);
|
||||
t.deepEqual(shallowB, expected);
|
||||
});
|
||||
|
||||
test('should require nested modules', async t => {
|
||||
const deepA = await requireGlob('./fixtures/deep/**/*.js');
|
||||
const deepB = requireGlob.sync('./fixtures/deep/**/*.js');
|
||||
const expected = {
|
||||
a: {
|
||||
a1: 'a1',
|
||||
a2: 'a2'
|
||||
},
|
||||
b: {
|
||||
b_bB: { // eslint-disable-line camelcase
|
||||
_bB1: '_b.b1',
|
||||
bB2: 'b.b2'
|
||||
},
|
||||
b1: 'b1',
|
||||
b2: 'b2'
|
||||
}
|
||||
};
|
||||
|
||||
t.deepEqual(deepA, expected);
|
||||
t.deepEqual(deepB, expected);
|
||||
});
|
||||
|
||||
test('should require multiple patterns', async t => {
|
||||
const deep = await requireGlob([
|
||||
'./fixtures/{deep,shallow}/**/*.js',
|
||||
'!./**/a*'
|
||||
]);
|
||||
|
||||
const expected = {
|
||||
deep: {
|
||||
b: {
|
||||
b_bB: { // eslint-disable-line camelcase
|
||||
_bB1: '_b.b1',
|
||||
bB2: 'b.b2'
|
||||
},
|
||||
b1: 'b1',
|
||||
b2: 'b2'
|
||||
}
|
||||
},
|
||||
shallow: {
|
||||
b: 'b',
|
||||
c: 'c',
|
||||
d: {
|
||||
e: 'e'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
t.deepEqual(deep, expected);
|
||||
});
|
||||
|
||||
test('should use custom cwd', async t => {
|
||||
const deep = await requireGlob('./test/**/deep/**/*.js', {
|
||||
cwd: path.dirname(__dirname)
|
||||
});
|
||||
|
||||
const expected = {
|
||||
fixtures: {
|
||||
deep: {
|
||||
a: {
|
||||
a1: 'a1',
|
||||
a2: 'a2'
|
||||
},
|
||||
b: {
|
||||
b_bB: { // eslint-disable-line camelcase
|
||||
_bB1: '_b.b1',
|
||||
bB2: 'b.b2'
|
||||
},
|
||||
b1: 'b1',
|
||||
b2: 'b2'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
t.deepEqual(deep, expected);
|
||||
});
|
||||
|
||||
test('should use custom base', async t => {
|
||||
const deep = await requireGlob('./fixtures/deep/**/*.js', {
|
||||
base: path.join(__dirname, 'fixtures')
|
||||
});
|
||||
|
||||
const expected = {
|
||||
deep: {
|
||||
a: {
|
||||
a1: 'a1',
|
||||
a2: 'a2'
|
||||
},
|
||||
b: {
|
||||
b_bB: { // eslint-disable-line camelcase
|
||||
_bB1: '_b.b1',
|
||||
bB2: 'b.b2'
|
||||
},
|
||||
b1: 'b1',
|
||||
b2: 'b2'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
t.deepEqual(deep, expected);
|
||||
});
|
||||
|
||||
test('should bust cache', async t => {
|
||||
const a = await requireGlob('./fixtures/rand*.js');
|
||||
const b = await requireGlob('./fixtures/rand*.js');
|
||||
const c = await requireGlob('./fixtures/rand*.js', {bustCache: true});
|
||||
const d = await requireGlob('./fixtures/rand*.js', {bustCache: true});
|
||||
const e = await requireGlob('./fixtures/rand*.js');
|
||||
|
||||
t.is(a.random, b.random);
|
||||
t.not(b.random, c.random);
|
||||
t.not(c.random, d.random);
|
||||
t.is(d.random, e.random);
|
||||
});
|
||||
|
||||
test('should use custom mapper', async t => {
|
||||
const deep = requireGlob.sync('./fixtures/deep/**/*.js', {
|
||||
mapper: function (options, filePath, i) {
|
||||
switch (i) {
|
||||
// The reducer expects path and export values
|
||||
case 0:
|
||||
return null;
|
||||
|
||||
case 1:
|
||||
return {path: filePath};
|
||||
|
||||
case 2:
|
||||
return {exports: i};
|
||||
|
||||
// The reducer expects a path that results in a property name
|
||||
case 3:
|
||||
return {path: '/', exports: i};
|
||||
|
||||
// Like this
|
||||
default:
|
||||
return {
|
||||
path: path.basename(filePath).toUpperCase(),
|
||||
exports: i
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const expected = {
|
||||
B1: 4,
|
||||
B2: 5
|
||||
};
|
||||
|
||||
t.deepEqual(deep, expected);
|
||||
});
|
||||
|
||||
test('should use custom reducer', async t => {
|
||||
const deep = await requireGlob('./fixtures/deep/**/*.js', {
|
||||
reducer: function (options, tree, file) {
|
||||
// The tree is an object by default
|
||||
if (!Array.isArray(tree)) {
|
||||
tree = [];
|
||||
}
|
||||
|
||||
tree.push(file.exports);
|
||||
|
||||
return tree;
|
||||
}
|
||||
});
|
||||
|
||||
const expected = [
|
||||
'a1',
|
||||
'a2',
|
||||
'_b.b1',
|
||||
'b.b2',
|
||||
'b1',
|
||||
'b2'
|
||||
];
|
||||
|
||||
t.deepEqual(deep, expected);
|
||||
});
|
||||
|
||||
test('should use custom keygen', async t => {
|
||||
const deep = await requireGlob('./fixtures/deep/**/*.js', {
|
||||
keygen: function (options, file) {
|
||||
return file.path.replace(file.base + '/', '');
|
||||
}
|
||||
});
|
||||
|
||||
const expected = {
|
||||
'a/a1.js': 'a1',
|
||||
'a/a2.js': 'a2',
|
||||
'b/b_b-b/_b.b1.js': '_b.b1',
|
||||
'b/b_b-b/b.b2.js': 'b.b2',
|
||||
'b/b1.js': 'b1',
|
||||
'b/b2.js': 'b2'
|
||||
};
|
||||
|
||||
t.deepEqual(deep, expected);
|
||||
});
|
||||
Reference in New Issue
Block a user