forked from enviPath/enviPy
Current Dev State
This commit is contained in:
19
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/LICENSE.BSD
generated
vendored
Normal file
19
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/LICENSE.BSD
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
27
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/LICENSE.source-map
generated
vendored
Normal file
27
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/LICENSE.source-map
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the Mozilla Foundation nor the names of project
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
116
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/README.md
generated
vendored
Normal file
116
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/README.md
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
## Escodegen
|
||||
[](http://badge.fury.io/js/escodegen)
|
||||
[](http://travis-ci.org/estools/escodegen)
|
||||
[](https://david-dm.org/estools/escodegen)
|
||||
[](https://david-dm.org/estools/escodegen#info=devDependencies)
|
||||
|
||||
Escodegen ([escodegen](http://github.com/estools/escodegen)) is an
|
||||
[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
|
||||
(also popularly known as [JavaScript](http://en.wikipedia.org/wiki/JavaScript))
|
||||
code generator from [Mozilla's Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)
|
||||
AST. See the [online generator](https://estools.github.io/escodegen/demo/index.html)
|
||||
for a demo.
|
||||
|
||||
|
||||
### Install
|
||||
|
||||
Escodegen can be used in a web browser:
|
||||
|
||||
<script src="escodegen.browser.js"></script>
|
||||
|
||||
escodegen.browser.js can be found in tagged revisions on GitHub.
|
||||
|
||||
Or in a Node.js application via npm:
|
||||
|
||||
npm install escodegen
|
||||
|
||||
### Usage
|
||||
|
||||
A simple example: the program
|
||||
|
||||
escodegen.generate({
|
||||
type: 'BinaryExpression',
|
||||
operator: '+',
|
||||
left: { type: 'Literal', value: 40 },
|
||||
right: { type: 'Literal', value: 2 }
|
||||
});
|
||||
|
||||
produces the string `'40 + 2'`.
|
||||
|
||||
See the [API page](https://github.com/estools/escodegen/wiki/API) for
|
||||
options. To run the tests, execute `npm test` in the root directory.
|
||||
|
||||
### Building browser bundle / minified browser bundle
|
||||
|
||||
At first, execute `npm install` to install the all dev dependencies.
|
||||
After that,
|
||||
|
||||
npm run-script build
|
||||
|
||||
will generate `escodegen.browser.js`, which can be used in browser environments.
|
||||
|
||||
And,
|
||||
|
||||
npm run-script build-min
|
||||
|
||||
will generate the minified file `escodegen.browser.min.js`.
|
||||
|
||||
### License
|
||||
|
||||
#### Escodegen
|
||||
|
||||
Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#### source-map
|
||||
|
||||
SourceNodeMocks has a limited interface of mozilla/source-map SourceNode implementations.
|
||||
|
||||
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the Mozilla Foundation nor the names of project
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
77
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/bin/escodegen.js
generated
vendored
Executable file
77
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/bin/escodegen.js
generated
vendored
Executable file
@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint sloppy:true node:true */
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
root = path.join(path.dirname(fs.realpathSync(__filename)), '..'),
|
||||
esprima = require('esprima'),
|
||||
escodegen = require(root),
|
||||
optionator = require('optionator')({
|
||||
prepend: 'Usage: escodegen [options] file...',
|
||||
options: [
|
||||
{
|
||||
option: 'config',
|
||||
alias: 'c',
|
||||
type: 'String',
|
||||
description: 'configuration json for escodegen'
|
||||
}
|
||||
]
|
||||
}),
|
||||
args = optionator.parse(process.argv),
|
||||
files = args._,
|
||||
options,
|
||||
esprimaOptions = {
|
||||
raw: true,
|
||||
tokens: true,
|
||||
range: true,
|
||||
comment: true
|
||||
};
|
||||
|
||||
if (files.length === 0) {
|
||||
console.log(optionator.generateHelp());
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (args.config) {
|
||||
try {
|
||||
options = JSON.parse(fs.readFileSync(args.config, 'utf-8'));
|
||||
} catch (err) {
|
||||
console.error('Error parsing config: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
files.forEach(function (filename) {
|
||||
var content = fs.readFileSync(filename, 'utf-8'),
|
||||
syntax = esprima.parse(content, esprimaOptions);
|
||||
|
||||
if (options.comment) {
|
||||
escodegen.attachComments(syntax, syntax.comments, syntax.tokens);
|
||||
}
|
||||
|
||||
console.log(escodegen.generate(syntax, options));
|
||||
});
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
64
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/bin/esgenerate.js
generated
vendored
Executable file
64
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/bin/esgenerate.js
generated
vendored
Executable file
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint sloppy:true node:true */
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
root = path.join(path.dirname(fs.realpathSync(__filename)), '..'),
|
||||
escodegen = require(root),
|
||||
optionator = require('optionator')({
|
||||
prepend: 'Usage: esgenerate [options] file.json ...',
|
||||
options: [
|
||||
{
|
||||
option: 'config',
|
||||
alias: 'c',
|
||||
type: 'String',
|
||||
description: 'configuration json for escodegen'
|
||||
}
|
||||
]
|
||||
}),
|
||||
args = optionator.parse(process.argv),
|
||||
files = args._,
|
||||
options;
|
||||
|
||||
if (files.length === 0) {
|
||||
console.log(optionator.generateHelp());
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (args.config) {
|
||||
try {
|
||||
options = JSON.parse(fs.readFileSync(args.config, 'utf-8'))
|
||||
} catch (err) {
|
||||
console.error('Error parsing config: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
files.forEach(function (filename) {
|
||||
var content = fs.readFileSync(filename, 'utf-8');
|
||||
console.log(escodegen.generate(JSON.parse(content), options));
|
||||
});
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
2607
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/escodegen.js
generated
vendored
Normal file
2607
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/escodegen.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
91
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/package.json
generated
vendored
Normal file
91
static/js/ketcher2/node_modules/istanbul/node_modules/escodegen/package.json
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"_from": "escodegen@1.8.x",
|
||||
"_id": "escodegen@1.8.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=",
|
||||
"_location": "/istanbul/escodegen",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "escodegen@1.8.x",
|
||||
"name": "escodegen",
|
||||
"escapedName": "escodegen",
|
||||
"rawSpec": "1.8.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.8.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz",
|
||||
"_shasum": "5a5b53af4693110bebb0867aa3430dd3b70a1018",
|
||||
"_spec": "escodegen@1.8.x",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul",
|
||||
"bin": {
|
||||
"esgenerate": "./bin/esgenerate.js",
|
||||
"escodegen": "./bin/escodegen.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/estools/escodegen/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"esprima": "^2.7.1",
|
||||
"estraverse": "^1.9.1",
|
||||
"esutils": "^2.0.2",
|
||||
"optionator": "^0.8.1",
|
||||
"source-map": "~0.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "ECMAScript code generator",
|
||||
"devDependencies": {
|
||||
"acorn": "^2.7.0",
|
||||
"bluebird": "^2.3.11",
|
||||
"bower-registry-client": "^0.2.1",
|
||||
"chai": "^1.10.0",
|
||||
"commonjs-everywhere": "^0.9.7",
|
||||
"gulp": "^3.8.10",
|
||||
"gulp-eslint": "^0.2.0",
|
||||
"gulp-mocha": "^2.0.0",
|
||||
"semver": "^5.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE.BSD",
|
||||
"LICENSE.source-map",
|
||||
"README.md",
|
||||
"bin",
|
||||
"escodegen.js",
|
||||
"package.json"
|
||||
],
|
||||
"homepage": "http://github.com/estools/escodegen",
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "escodegen.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"url": "http://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"name": "escodegen",
|
||||
"optionalDependencies": {
|
||||
"source-map": "~0.2.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/estools/escodegen.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "cjsify -a path: tools/entry-point.js > escodegen.browser.js",
|
||||
"build-min": "cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js",
|
||||
"lint": "gulp lint",
|
||||
"release": "node tools/release.js",
|
||||
"test": "gulp travis",
|
||||
"unit-test": "gulp test"
|
||||
},
|
||||
"version": "1.8.1"
|
||||
}
|
||||
174
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/ChangeLog
generated
vendored
Normal file
174
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/ChangeLog
generated
vendored
Normal file
@ -0,0 +1,174 @@
|
||||
2016-08-23: Version 2.7.3
|
||||
|
||||
* Fix tokenizer confusion with a comment (issue 1493, 1516)
|
||||
|
||||
2016-02-02: Version 2.7.2
|
||||
|
||||
* Fix out-of-bound error location in an invalid string literal (issue 1457)
|
||||
* Fix shorthand object destructuring defaults in variable declarations (issue 1459)
|
||||
|
||||
2015-12-10: Version 2.7.1
|
||||
|
||||
* Do not allow trailing comma in a variable declaration (issue 1360)
|
||||
* Fix assignment to `let` in non-strict mode (issue 1376)
|
||||
* Fix missing delegate property in YieldExpression (issue 1407)
|
||||
|
||||
2015-10-22: Version 2.7.0
|
||||
|
||||
* Fix the handling of semicolon in a break statement (issue 1044)
|
||||
* Run the test suite with major web browsers (issue 1259, 1317)
|
||||
* Allow `let` as an identifier in non-strict mode (issue 1289)
|
||||
* Attach orphaned comments as `innerComments` (issue 1328)
|
||||
* Add the support for token delegator (issue 1332)
|
||||
|
||||
2015-09-01: Version 2.6.0
|
||||
|
||||
* Properly allow or prohibit `let` in a binding identifier/pattern (issue 1048, 1098)
|
||||
* Add sourceType field for Program node (issue 1159)
|
||||
* Ensure that strict mode reserved word binding throw an error (issue 1171)
|
||||
* Run the test suite with Node.js and IE 11 on Windows (issue 1294)
|
||||
* Allow binding pattern with no initializer in a for statement (issue 1301)
|
||||
|
||||
2015-07-31: Version 2.5.0
|
||||
|
||||
* Run the test suite in a browser environment (issue 1004)
|
||||
* Ensure a comma between imported default binding and named imports (issue 1046)
|
||||
* Distinguish `yield` as a keyword vs an identifier (issue 1186)
|
||||
* Support ES6 meta property `new.target` (issue 1203)
|
||||
* Fix the syntax node for yield with expression (issue 1223)
|
||||
* Fix the check of duplicated proto in property names (issue 1225)
|
||||
* Fix ES6 Unicode escape in identifier name (issue 1229)
|
||||
* Support ES6 IdentifierStart and IdentifierPart (issue 1232)
|
||||
* Treat await as a reserved word when parsing as a module (issue 1234)
|
||||
* Recognize identifier characters from Unicode SMP (issue 1244)
|
||||
* Ensure that export and import can be followed by a comma (issue 1250)
|
||||
* Fix yield operator precedence (issue 1262)
|
||||
|
||||
2015-07-01: Version 2.4.1
|
||||
|
||||
* Fix some cases of comment attachment (issue 1071, 1175)
|
||||
* Fix the handling of destructuring in function arguments (issue 1193)
|
||||
* Fix invalid ranges in assignment expression (issue 1201)
|
||||
|
||||
2015-06-26: Version 2.4.0
|
||||
|
||||
* Support ES6 for-of iteration (issue 1047)
|
||||
* Support ES6 spread arguments (issue 1169)
|
||||
* Minimize npm payload (issue 1191)
|
||||
|
||||
2015-06-16: Version 2.3.0
|
||||
|
||||
* Support ES6 generator (issue 1033)
|
||||
* Improve parsing of regular expressions with `u` flag (issue 1179)
|
||||
|
||||
2015-04-17: Version 2.2.0
|
||||
|
||||
* Support ES6 import and export declarations (issue 1000)
|
||||
* Fix line terminator before arrow not recognized as error (issue 1009)
|
||||
* Support ES6 destructuring (issue 1045)
|
||||
* Support ES6 template literal (issue 1074)
|
||||
* Fix the handling of invalid/incomplete string escape sequences (issue 1106)
|
||||
* Fix ES3 static member access restriction (issue 1120)
|
||||
* Support for `super` in ES6 class (issue 1147)
|
||||
|
||||
2015-03-09: Version 2.1.0
|
||||
|
||||
* Support ES6 class (issue 1001)
|
||||
* Support ES6 rest parameter (issue 1011)
|
||||
* Expand the location of property getter, setter, and methods (issue 1029)
|
||||
* Enable TryStatement transition to a single handler (issue 1031)
|
||||
* Support ES6 computed property name (issue 1037)
|
||||
* Tolerate unclosed block comment (issue 1041)
|
||||
* Support ES6 lexical declaration (issue 1065)
|
||||
|
||||
2015-02-06: Version 2.0.0
|
||||
|
||||
* Support ES6 arrow function (issue 517)
|
||||
* Support ES6 Unicode code point escape (issue 521)
|
||||
* Improve the speed and accuracy of comment attachment (issue 522)
|
||||
* Support ES6 default parameter (issue 519)
|
||||
* Support ES6 regular expression flags (issue 557)
|
||||
* Fix scanning of implicit octal literals (issue 565)
|
||||
* Fix the handling of automatic semicolon insertion (issue 574)
|
||||
* Support ES6 method definition (issue 620)
|
||||
* Support ES6 octal integer literal (issue 621)
|
||||
* Support ES6 binary integer literal (issue 622)
|
||||
* Support ES6 object literal property value shorthand (issue 624)
|
||||
|
||||
2015-03-03: Version 1.2.5
|
||||
|
||||
* Fix scanning of implicit octal literals (issue 565)
|
||||
|
||||
2015-02-05: Version 1.2.4
|
||||
|
||||
* Fix parsing of LeftHandSideExpression in ForInStatement (issue 560)
|
||||
* Fix the handling of automatic semicolon insertion (issue 574)
|
||||
|
||||
2015-01-18: Version 1.2.3
|
||||
|
||||
* Fix division by this (issue 616)
|
||||
|
||||
2014-05-18: Version 1.2.2
|
||||
|
||||
* Fix duplicated tokens when collecting comments (issue 537)
|
||||
|
||||
2014-05-04: Version 1.2.1
|
||||
|
||||
* Ensure that Program node may still have leading comments (issue 536)
|
||||
|
||||
2014-04-29: Version 1.2.0
|
||||
|
||||
* Fix semicolon handling for expression statement (issue 462, 533)
|
||||
* Disallow escaped characters in regular expression flags (issue 503)
|
||||
* Performance improvement for location tracking (issue 520)
|
||||
* Improve the speed of comment attachment (issue 522)
|
||||
|
||||
2014-03-26: Version 1.1.1
|
||||
|
||||
* Fix token handling of forward slash after an array literal (issue 512)
|
||||
|
||||
2014-03-23: Version 1.1.0
|
||||
|
||||
* Optionally attach comments to the owning syntax nodes (issue 197)
|
||||
* Simplify binary parsing with stack-based shift reduce (issue 352)
|
||||
* Always include the raw source of literals (issue 376)
|
||||
* Add optional input source information (issue 386)
|
||||
* Tokenizer API for pure lexical scanning (issue 398)
|
||||
* Improve the web site and its online demos (issue 337, 400, 404)
|
||||
* Performance improvement for location tracking (issue 417, 424)
|
||||
* Support HTML comment syntax (issue 451)
|
||||
* Drop support for legacy browsers (issue 474)
|
||||
|
||||
2013-08-27: Version 1.0.4
|
||||
|
||||
* Minimize the payload for packages (issue 362)
|
||||
* Fix missing cases on an empty switch statement (issue 436)
|
||||
* Support escaped ] in regexp literal character classes (issue 442)
|
||||
* Tolerate invalid left-hand side expression (issue 130)
|
||||
|
||||
2013-05-17: Version 1.0.3
|
||||
|
||||
* Variable declaration needs at least one declarator (issue 391)
|
||||
* Fix benchmark's variance unit conversion (issue 397)
|
||||
* IE < 9: \v should be treated as vertical tab (issue 405)
|
||||
* Unary expressions should always have prefix: true (issue 418)
|
||||
* Catch clause should only accept an identifier (issue 423)
|
||||
* Tolerate setters without parameter (issue 426)
|
||||
|
||||
2012-11-02: Version 1.0.2
|
||||
|
||||
Improvement:
|
||||
|
||||
* Fix esvalidate JUnit output upon a syntax error (issue 374)
|
||||
|
||||
2012-10-28: Version 1.0.1
|
||||
|
||||
Improvements:
|
||||
|
||||
* esvalidate understands shebang in a Unix shell script (issue 361)
|
||||
* esvalidate treats fatal parsing failure as an error (issue 361)
|
||||
* Reduce Node.js package via .npmignore (issue 362)
|
||||
|
||||
2012-10-22: Version 1.0.0
|
||||
|
||||
Initial release.
|
||||
21
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/LICENSE.BSD
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/LICENSE.BSD
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
27
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/README.md
generated
vendored
Normal file
27
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/README.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
[](https://www.npmjs.com/package/esprima)
|
||||
[](https://www.npmjs.com/package/esprima)
|
||||
[](https://travis-ci.org/jquery/esprima)
|
||||
[](https://codecov.io/github/jquery/esprima)
|
||||
|
||||
**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,
|
||||
standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
|
||||
parser written in ECMAScript (also popularly known as
|
||||
[JavaScript](https://en.wikipedia.org/wiki/JavaScript)).
|
||||
Esprima is created and maintained by [Ariya Hidayat](https://twitter.com/ariyahidayat),
|
||||
with the help of [many contributors](https://github.com/jquery/esprima/contributors).
|
||||
|
||||
### Features
|
||||
|
||||
- Full support for ECMAScript 6 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))
|
||||
- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/spec.md) as standardized by [ESTree project](https://github.com/estree/estree)
|
||||
- Optional tracking of syntax node location (index-based and line-column)
|
||||
- [Heavily tested](http://esprima.org/test/ci.html) (~1250 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://codecov.io/github/jquery/esprima))
|
||||
|
||||
Esprima serves as a **building block** for some JavaScript
|
||||
language tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html)
|
||||
to [editor autocompletion](http://esprima.org/demo/autocomplete.html).
|
||||
|
||||
Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as
|
||||
[Rhino](http://www.mozilla.org/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima).
|
||||
|
||||
For more information, check the web site [esprima.org](http://esprima.org).
|
||||
126
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/bin/esparse.js
generated
vendored
Executable file
126
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/bin/esparse.js
generated
vendored
Executable file
@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint sloppy:true node:true rhino:true */
|
||||
|
||||
var fs, esprima, fname, content, options, syntax;
|
||||
|
||||
if (typeof require === 'function') {
|
||||
fs = require('fs');
|
||||
esprima = require('esprima');
|
||||
} else if (typeof load === 'function') {
|
||||
try {
|
||||
load('esprima.js');
|
||||
} catch (e) {
|
||||
load('../esprima.js');
|
||||
}
|
||||
}
|
||||
|
||||
// Shims to Node.js objects when running under Rhino.
|
||||
if (typeof console === 'undefined' && typeof process === 'undefined') {
|
||||
console = { log: print };
|
||||
fs = { readFileSync: readFile };
|
||||
process = { argv: arguments, exit: quit };
|
||||
process.argv.unshift('esparse.js');
|
||||
process.argv.unshift('rhino');
|
||||
}
|
||||
|
||||
function showUsage() {
|
||||
console.log('Usage:');
|
||||
console.log(' esparse [options] file.js');
|
||||
console.log();
|
||||
console.log('Available options:');
|
||||
console.log();
|
||||
console.log(' --comment Gather all line and block comments in an array');
|
||||
console.log(' --loc Include line-column location info for each syntax node');
|
||||
console.log(' --range Include index-based range for each syntax node');
|
||||
console.log(' --raw Display the raw value of literals');
|
||||
console.log(' --tokens List all tokens in an array');
|
||||
console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)');
|
||||
console.log(' -v, --version Shows program version');
|
||||
console.log();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (process.argv.length <= 2) {
|
||||
showUsage();
|
||||
}
|
||||
|
||||
options = {};
|
||||
|
||||
process.argv.splice(2).forEach(function (entry) {
|
||||
|
||||
if (entry === '-h' || entry === '--help') {
|
||||
showUsage();
|
||||
} else if (entry === '-v' || entry === '--version') {
|
||||
console.log('ECMAScript Parser (using Esprima version', esprima.version, ')');
|
||||
console.log();
|
||||
process.exit(0);
|
||||
} else if (entry === '--comment') {
|
||||
options.comment = true;
|
||||
} else if (entry === '--loc') {
|
||||
options.loc = true;
|
||||
} else if (entry === '--range') {
|
||||
options.range = true;
|
||||
} else if (entry === '--raw') {
|
||||
options.raw = true;
|
||||
} else if (entry === '--tokens') {
|
||||
options.tokens = true;
|
||||
} else if (entry === '--tolerant') {
|
||||
options.tolerant = true;
|
||||
} else if (entry.slice(0, 2) === '--') {
|
||||
console.log('Error: unknown option ' + entry + '.');
|
||||
process.exit(1);
|
||||
} else if (typeof fname === 'string') {
|
||||
console.log('Error: more than one input file.');
|
||||
process.exit(1);
|
||||
} else {
|
||||
fname = entry;
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof fname !== 'string') {
|
||||
console.log('Error: no input file.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Special handling for regular expression literal since we need to
|
||||
// convert it to a string literal, otherwise it will be decoded
|
||||
// as object "{}" and the regular expression would be lost.
|
||||
function adjustRegexLiteral(key, value) {
|
||||
if (key === 'value' && value instanceof RegExp) {
|
||||
value = value.toString();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
try {
|
||||
content = fs.readFileSync(fname, 'utf-8');
|
||||
syntax = esprima.parse(content, options);
|
||||
console.log(JSON.stringify(syntax, adjustRegexLiteral, 4));
|
||||
} catch (e) {
|
||||
console.log('Error: ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
199
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/bin/esvalidate.js
generated
vendored
Executable file
199
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/bin/esvalidate.js
generated
vendored
Executable file
@ -0,0 +1,199 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint sloppy:true plusplus:true node:true rhino:true */
|
||||
/*global phantom:true */
|
||||
|
||||
var fs, system, esprima, options, fnames, count;
|
||||
|
||||
if (typeof esprima === 'undefined') {
|
||||
// PhantomJS can only require() relative files
|
||||
if (typeof phantom === 'object') {
|
||||
fs = require('fs');
|
||||
system = require('system');
|
||||
esprima = require('./esprima');
|
||||
} else if (typeof require === 'function') {
|
||||
fs = require('fs');
|
||||
esprima = require('esprima');
|
||||
} else if (typeof load === 'function') {
|
||||
try {
|
||||
load('esprima.js');
|
||||
} catch (e) {
|
||||
load('../esprima.js');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shims to Node.js objects when running under PhantomJS 1.7+.
|
||||
if (typeof phantom === 'object') {
|
||||
fs.readFileSync = fs.read;
|
||||
process = {
|
||||
argv: [].slice.call(system.args),
|
||||
exit: phantom.exit
|
||||
};
|
||||
process.argv.unshift('phantomjs');
|
||||
}
|
||||
|
||||
// Shims to Node.js objects when running under Rhino.
|
||||
if (typeof console === 'undefined' && typeof process === 'undefined') {
|
||||
console = { log: print };
|
||||
fs = { readFileSync: readFile };
|
||||
process = { argv: arguments, exit: quit };
|
||||
process.argv.unshift('esvalidate.js');
|
||||
process.argv.unshift('rhino');
|
||||
}
|
||||
|
||||
function showUsage() {
|
||||
console.log('Usage:');
|
||||
console.log(' esvalidate [options] file.js');
|
||||
console.log();
|
||||
console.log('Available options:');
|
||||
console.log();
|
||||
console.log(' --format=type Set the report format, plain (default) or junit');
|
||||
console.log(' -v, --version Print program version');
|
||||
console.log();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (process.argv.length <= 2) {
|
||||
showUsage();
|
||||
}
|
||||
|
||||
options = {
|
||||
format: 'plain'
|
||||
};
|
||||
|
||||
fnames = [];
|
||||
|
||||
process.argv.splice(2).forEach(function (entry) {
|
||||
|
||||
if (entry === '-h' || entry === '--help') {
|
||||
showUsage();
|
||||
} else if (entry === '-v' || entry === '--version') {
|
||||
console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
|
||||
console.log();
|
||||
process.exit(0);
|
||||
} else if (entry.slice(0, 9) === '--format=') {
|
||||
options.format = entry.slice(9);
|
||||
if (options.format !== 'plain' && options.format !== 'junit') {
|
||||
console.log('Error: unknown report format ' + options.format + '.');
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (entry.slice(0, 2) === '--') {
|
||||
console.log('Error: unknown option ' + entry + '.');
|
||||
process.exit(1);
|
||||
} else {
|
||||
fnames.push(entry);
|
||||
}
|
||||
});
|
||||
|
||||
if (fnames.length === 0) {
|
||||
console.log('Error: no input file.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (options.format === 'junit') {
|
||||
console.log('<?xml version="1.0" encoding="UTF-8"?>');
|
||||
console.log('<testsuites>');
|
||||
}
|
||||
|
||||
count = 0;
|
||||
fnames.forEach(function (fname) {
|
||||
var content, timestamp, syntax, name;
|
||||
try {
|
||||
content = fs.readFileSync(fname, 'utf-8');
|
||||
|
||||
if (content[0] === '#' && content[1] === '!') {
|
||||
content = '//' + content.substr(2, content.length);
|
||||
}
|
||||
|
||||
timestamp = Date.now();
|
||||
syntax = esprima.parse(content, { tolerant: true });
|
||||
|
||||
if (options.format === 'junit') {
|
||||
|
||||
name = fname;
|
||||
if (name.lastIndexOf('/') >= 0) {
|
||||
name = name.slice(name.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
console.log('<testsuite name="' + fname + '" errors="0" ' +
|
||||
' failures="' + syntax.errors.length + '" ' +
|
||||
' tests="' + syntax.errors.length + '" ' +
|
||||
' time="' + Math.round((Date.now() - timestamp) / 1000) +
|
||||
'">');
|
||||
|
||||
syntax.errors.forEach(function (error) {
|
||||
var msg = error.message;
|
||||
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
|
||||
console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
|
||||
' time="0">');
|
||||
console.log(' <error type="SyntaxError" message="' + error.message + '">' +
|
||||
error.message + '(' + name + ':' + error.lineNumber + ')' +
|
||||
'</error>');
|
||||
console.log(' </testcase>');
|
||||
});
|
||||
|
||||
console.log('</testsuite>');
|
||||
|
||||
} else if (options.format === 'plain') {
|
||||
|
||||
syntax.errors.forEach(function (error) {
|
||||
var msg = error.message;
|
||||
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
|
||||
msg = fname + ':' + error.lineNumber + ': ' + msg;
|
||||
console.log(msg);
|
||||
++count;
|
||||
});
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
++count;
|
||||
if (options.format === 'junit') {
|
||||
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
|
||||
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
|
||||
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
|
||||
console.log(' <error type="ParseError" message="' + e.message + '">' +
|
||||
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
|
||||
')</error>');
|
||||
console.log(' </testcase>');
|
||||
console.log('</testsuite>');
|
||||
} else {
|
||||
console.log('Error: ' + e.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (options.format === 'junit') {
|
||||
console.log('</testsuites>');
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (count === 0 && typeof phantom === 'object') {
|
||||
process.exit(0);
|
||||
}
|
||||
5740
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/esprima.js
generated
vendored
Normal file
5740
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/esprima.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
125
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/package.json
generated
vendored
Normal file
125
static/js/ketcher2/node_modules/istanbul/node_modules/esprima/package.json
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
{
|
||||
"_from": "esprima@2.7.x",
|
||||
"_id": "esprima@2.7.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=",
|
||||
"_location": "/istanbul/esprima",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "esprima@2.7.x",
|
||||
"name": "esprima",
|
||||
"escapedName": "esprima",
|
||||
"rawSpec": "2.7.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.7.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul",
|
||||
"/istanbul/escodegen"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
|
||||
"_shasum": "96e3b70d5779f6ad49cd032673d1c312767ba581",
|
||||
"_spec": "esprima@2.7.x",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul",
|
||||
"author": {
|
||||
"name": "Ariya Hidayat",
|
||||
"email": "ariya.hidayat@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"esparse": "./bin/esparse.js",
|
||||
"esvalidate": "./bin/esvalidate.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jquery/esprima/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "ECMAScript parsing infrastructure for multipurpose analysis",
|
||||
"devDependencies": {
|
||||
"codecov.io": "~0.1.6",
|
||||
"escomplex-js": "1.2.0",
|
||||
"eslint": "~1.7.2",
|
||||
"everything.js": "~1.0.3",
|
||||
"glob": "^5.0.15",
|
||||
"istanbul": "~0.4.0",
|
||||
"jscs": "~2.3.5",
|
||||
"json-diff": "~0.3.1",
|
||||
"karma": "^0.13.11",
|
||||
"karma-chrome-launcher": "^0.2.1",
|
||||
"karma-detect-browsers": "^2.0.2",
|
||||
"karma-firefox-launcher": "^0.1.6",
|
||||
"karma-ie-launcher": "^0.2.0",
|
||||
"karma-mocha": "^0.2.0",
|
||||
"karma-safari-launcher": "^0.1.1",
|
||||
"karma-sauce-launcher": "^0.2.14",
|
||||
"lodash": "^3.10.0",
|
||||
"mocha": "^2.3.3",
|
||||
"node-tick-processor": "~0.0.2",
|
||||
"regenerate": "~1.2.1",
|
||||
"temp": "~0.8.3",
|
||||
"unicode-7.0.0": "~0.1.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"unit-tests.js",
|
||||
"esprima.js"
|
||||
],
|
||||
"homepage": "http://esprima.org",
|
||||
"keywords": [
|
||||
"ast",
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"parser",
|
||||
"syntax"
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "esprima.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Ariya Hidayat",
|
||||
"email": "ariya.hidayat@gmail.com",
|
||||
"url": "http://ariya.ofilabs.com"
|
||||
}
|
||||
],
|
||||
"name": "esprima",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jquery/esprima.git"
|
||||
},
|
||||
"scripts": {
|
||||
"all-tests": "npm run generate-fixtures && npm run unit-tests && npm run grammar-tests && npm run regression-tests",
|
||||
"analyze-coverage": "istanbul cover test/unit-tests.js",
|
||||
"appveyor": "npm run all-tests && npm run browser-tests && npm run dynamic-analysis",
|
||||
"benchmark": "node test/benchmarks.js",
|
||||
"benchmark-quick": "node test/benchmarks.js quick",
|
||||
"browser-tests": "npm run generate-fixtures && cd test && karma start --single-run",
|
||||
"check-coverage": "istanbul check-coverage --statement 100 --branch 100 --function 100",
|
||||
"check-version": "node test/check-version.js",
|
||||
"circleci": "npm test && npm run codecov && npm run downstream",
|
||||
"codecov": "istanbul report cobertura && codecov < ./coverage/cobertura-coverage.xml",
|
||||
"complexity": "node test/check-complexity.js",
|
||||
"downstream": "node test/downstream.js",
|
||||
"droneio": "npm test && npm run saucelabs-evergreen && npm run saucelabs-ie && npm run saucelabs-safari",
|
||||
"dynamic-analysis": "npm run analyze-coverage && npm run check-coverage",
|
||||
"eslint": "node node_modules/eslint/bin/eslint.js -c .lintrc esprima.js",
|
||||
"generate-fixtures": "node tools/generate-fixtures.js",
|
||||
"generate-regex": "node tools/generate-identifier-regex.js",
|
||||
"grammar-tests": "node test/grammar-tests.js",
|
||||
"jscs": "jscs -p crockford esprima.js && jscs -p crockford test/*.js",
|
||||
"profile": "node --prof test/profile.js && mv isolate*.log v8.log && node-tick-processor",
|
||||
"regression-tests": "node test/regression-tests.js",
|
||||
"saucelabs-evergreen": "cd test && karma start saucelabs-evergreen.conf.js",
|
||||
"saucelabs-ie": "cd test && karma start saucelabs-ie.conf.js",
|
||||
"saucelabs-safari": "cd test && karma start saucelabs-safari.conf.js",
|
||||
"static-analysis": "npm run check-version && npm run jscs && npm run eslint && npm run complexity",
|
||||
"test": "npm run all-tests && npm run static-analysis && npm run dynamic-analysis",
|
||||
"travis": "npm test",
|
||||
"unit-tests": "node test/unit-tests.js"
|
||||
},
|
||||
"version": "2.7.3"
|
||||
}
|
||||
25
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/LICENSE.md
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
(MIT License)
|
||||
|
||||
Copyright (c) 2013 [Ramesh Nair](http://www.hiddentao.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.
|
||||
|
||||
104
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/README.md
generated
vendored
Normal file
104
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/README.md
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
# fast-levenshtein - Levenshtein algorithm in Javascript
|
||||
|
||||
[](http://travis-ci.org/hiddentao/fast-levenshtein)
|
||||
[](https://badge.fury.io/js/fast-levenshtein)
|
||||
[](https://www.npmjs.com/package/fast-levenshtein)
|
||||
[](https://twitter.com/hiddentao)
|
||||
|
||||
An efficient Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with locale-specific collator support.
|
||||
|
||||
## Features
|
||||
|
||||
* Works in node.js and in the browser.
|
||||
* Better performance than other implementations by not needing to store the whole matrix ([more info](http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm)).
|
||||
* Locale-sensitive string comparisions if needed.
|
||||
* Comprehensive test suite and performance benchmark.
|
||||
* Small: <1 KB minified and gzipped
|
||||
|
||||
## Installation
|
||||
|
||||
### node.js
|
||||
|
||||
Install using [npm](http://npmjs.org/):
|
||||
|
||||
```bash
|
||||
$ npm install fast-levenshtein
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
Using bower:
|
||||
|
||||
```bash
|
||||
$ bower install fast-levenshtein
|
||||
```
|
||||
|
||||
If you are not using any module loader system then the API will then be accessible via the `window.Levenshtein` object.
|
||||
|
||||
## Examples
|
||||
|
||||
**Default usage**
|
||||
|
||||
```javascript
|
||||
var levenshtein = require('fast-levenshtein');
|
||||
|
||||
var distance = levenshtein.get('back', 'book'); // 2
|
||||
var distance = levenshtein.get('我愛你', '我叫你'); // 1
|
||||
```
|
||||
|
||||
**Locale-sensitive string comparisons**
|
||||
|
||||
It supports using [Intl.Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) for locale-sensitive string comparisons:
|
||||
|
||||
```javascript
|
||||
var levenshtein = require('fast-levenshtein');
|
||||
|
||||
levenshtein.get('mikailovitch', 'Mikhaïlovitch', { useCollator: true});
|
||||
// 1
|
||||
```
|
||||
|
||||
## Building and Testing
|
||||
|
||||
To build the code and run the tests:
|
||||
|
||||
```bash
|
||||
$ npm install -g grunt-cli
|
||||
$ npm install
|
||||
$ npm run build
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
_Thanks to [Titus Wormer](https://github.com/wooorm) for [encouraging me](https://github.com/hiddentao/fast-levenshtein/issues/1) to do this._
|
||||
|
||||
Benchmarked against other node.js levenshtein distance modules (on Macbook Air 2012, Core i7, 8GB RAM):
|
||||
|
||||
```bash
|
||||
Running suite Implementation comparison [benchmark/speed.js]...
|
||||
>> levenshtein-edit-distance x 234 ops/sec ±3.02% (73 runs sampled)
|
||||
>> levenshtein-component x 422 ops/sec ±4.38% (83 runs sampled)
|
||||
>> levenshtein-deltas x 283 ops/sec ±3.83% (78 runs sampled)
|
||||
>> natural x 255 ops/sec ±0.76% (88 runs sampled)
|
||||
>> levenshtein x 180 ops/sec ±3.55% (86 runs sampled)
|
||||
>> fast-levenshtein x 1,792 ops/sec ±2.72% (95 runs sampled)
|
||||
Benchmark done.
|
||||
Fastest test is fast-levenshtein at 4.2x faster than levenshtein-component
|
||||
```
|
||||
|
||||
You can run this benchmark yourself by doing:
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm run build
|
||||
$ npm run benchmark
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
If you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes.
|
||||
|
||||
See [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details.
|
||||
|
||||
## License
|
||||
|
||||
MIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md)
|
||||
136
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/levenshtein.js
generated
vendored
Normal file
136
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/levenshtein.js
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var collator;
|
||||
try {
|
||||
collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
||||
} catch (err){
|
||||
console.log("Collator could not be initialized and wouldn't be used");
|
||||
}
|
||||
// arrays to re-use
|
||||
var prevRow = [],
|
||||
str2Char = [];
|
||||
|
||||
/**
|
||||
* Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance.
|
||||
*/
|
||||
var Levenshtein = {
|
||||
/**
|
||||
* Calculate levenshtein distance of the two strings.
|
||||
*
|
||||
* @param str1 String the first string.
|
||||
* @param str2 String the second string.
|
||||
* @param [options] Additional options.
|
||||
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
||||
* @return Integer the levenshtein distance (0 and above).
|
||||
*/
|
||||
get: function(str1, str2, options) {
|
||||
var useCollator = (options && collator && options.useCollator);
|
||||
|
||||
var str1Len = str1.length,
|
||||
str2Len = str2.length;
|
||||
|
||||
// base cases
|
||||
if (str1Len === 0) return str2Len;
|
||||
if (str2Len === 0) return str1Len;
|
||||
|
||||
// two rows
|
||||
var curCol, nextCol, i, j, tmp;
|
||||
|
||||
// initialise previous row
|
||||
for (i=0; i<str2Len; ++i) {
|
||||
prevRow[i] = i;
|
||||
str2Char[i] = str2.charCodeAt(i);
|
||||
}
|
||||
prevRow[str2Len] = str2Len;
|
||||
|
||||
var strCmp;
|
||||
if (useCollator) {
|
||||
// calculate current row distance from previous row using collator
|
||||
for (i = 0; i < str1Len; ++i) {
|
||||
nextCol = i + 1;
|
||||
|
||||
for (j = 0; j < str2Len; ++j) {
|
||||
curCol = nextCol;
|
||||
|
||||
// substution
|
||||
strCmp = 0 === collator.compare(str1.charAt(i), String.fromCharCode(str2Char[j]));
|
||||
|
||||
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
||||
|
||||
// insertion
|
||||
tmp = curCol + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
// deletion
|
||||
tmp = prevRow[j + 1] + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
|
||||
// copy current col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = curCol;
|
||||
}
|
||||
|
||||
// copy last col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = nextCol;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// calculate current row distance from previous row without collator
|
||||
for (i = 0; i < str1Len; ++i) {
|
||||
nextCol = i + 1;
|
||||
|
||||
for (j = 0; j < str2Len; ++j) {
|
||||
curCol = nextCol;
|
||||
|
||||
// substution
|
||||
strCmp = str1.charCodeAt(i) === str2Char[j];
|
||||
|
||||
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
||||
|
||||
// insertion
|
||||
tmp = curCol + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
// deletion
|
||||
tmp = prevRow[j + 1] + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
|
||||
// copy current col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = curCol;
|
||||
}
|
||||
|
||||
// copy last col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = nextCol;
|
||||
}
|
||||
}
|
||||
return nextCol;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// amd
|
||||
if (typeof define !== "undefined" && define !== null && define.amd) {
|
||||
define(function() {
|
||||
return Levenshtein;
|
||||
});
|
||||
}
|
||||
// commonjs
|
||||
else if (typeof module !== "undefined" && module !== null && typeof exports !== "undefined" && module.exports === exports) {
|
||||
module.exports = Levenshtein;
|
||||
}
|
||||
// web worker
|
||||
else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') {
|
||||
self.Levenshtein = Levenshtein;
|
||||
}
|
||||
// browser main thread
|
||||
else if (typeof window !== "undefined" && window !== null) {
|
||||
window.Levenshtein = Levenshtein;
|
||||
}
|
||||
}());
|
||||
|
||||
72
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/package.json
generated
vendored
Normal file
72
static/js/ketcher2/node_modules/istanbul/node_modules/fast-levenshtein/package.json
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"_from": "fast-levenshtein@~2.0.4",
|
||||
"_id": "fast-levenshtein@2.0.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
|
||||
"_location": "/istanbul/fast-levenshtein",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "fast-levenshtein@~2.0.4",
|
||||
"name": "fast-levenshtein",
|
||||
"escapedName": "fast-levenshtein",
|
||||
"rawSpec": "~2.0.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~2.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul/optionator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"_shasum": "3d8a5c66883a16a30ca8643e851f19baa7797917",
|
||||
"_spec": "fast-levenshtein@~2.0.4",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul/node_modules/optionator",
|
||||
"author": {
|
||||
"name": "Ramesh Nair",
|
||||
"email": "ram@hiddentao.com",
|
||||
"url": "http://www.hiddentao.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/hiddentao/fast-levenshtein/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Efficient implementation of Levenshtein algorithm with locale-specific collator support.",
|
||||
"devDependencies": {
|
||||
"chai": "~1.5.0",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-benchmark": "~0.2.0",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-jshint": "~0.4.3",
|
||||
"grunt-contrib-uglify": "~0.2.0",
|
||||
"grunt-mocha-test": "~0.2.2",
|
||||
"grunt-npm-install": "~0.1.0",
|
||||
"load-grunt-tasks": "~0.6.0",
|
||||
"lodash": "^4.0.1",
|
||||
"mocha": "~1.9.0"
|
||||
},
|
||||
"files": [
|
||||
"levenshtein.js"
|
||||
],
|
||||
"homepage": "https://github.com/hiddentao/fast-levenshtein#readme",
|
||||
"keywords": [
|
||||
"levenshtein",
|
||||
"distance",
|
||||
"string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "levenshtein.js",
|
||||
"name": "fast-levenshtein",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/hiddentao/fast-levenshtein.git"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "grunt benchmark",
|
||||
"build": "grunt build",
|
||||
"prepublish": "npm run build",
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "2.0.6"
|
||||
}
|
||||
15
static/js/ketcher2/node_modules/istanbul/node_modules/glob/LICENSE
generated
vendored
Normal file
15
static/js/ketcher2/node_modules/istanbul/node_modules/glob/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
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.
|
||||
377
static/js/ketcher2/node_modules/istanbul/node_modules/glob/README.md
generated
vendored
Normal file
377
static/js/ketcher2/node_modules/istanbul/node_modules/glob/README.md
generated
vendored
Normal file
@ -0,0 +1,377 @@
|
||||
[](https://travis-ci.org/isaacs/node-glob/) [](https://david-dm.org/isaacs/node-glob) [](https://david-dm.org/isaacs/node-glob#info=devDependencies) [](https://david-dm.org/isaacs/node-glob#info=optionalDependencies)
|
||||
|
||||
# Glob
|
||||
|
||||
Match files using the patterns the shell uses, like stars and stuff.
|
||||
|
||||
This is a glob implementation in JavaScript. It uses the `minimatch`
|
||||
library to do its matching.
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var glob = require("glob")
|
||||
|
||||
// options is optional
|
||||
glob("**/*.js", options, function (er, files) {
|
||||
// files is an array of filenames.
|
||||
// If the `nonull` option is set, and nothing
|
||||
// was found, then files is ["**/*.js"]
|
||||
// er is an error object or null.
|
||||
})
|
||||
```
|
||||
|
||||
## Glob Primer
|
||||
|
||||
"Globs" are the patterns you type when you do stuff like `ls *.js` on
|
||||
the command line, or put `build/*` in a `.gitignore` file.
|
||||
|
||||
Before parsing the path part patterns, braced sections are expanded
|
||||
into a set. Braced sections start with `{` and end with `}`, with any
|
||||
number of comma-delimited sections within. Braced sections may contain
|
||||
slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
|
||||
|
||||
The following characters have special magic meaning when used in a
|
||||
path portion:
|
||||
|
||||
* `*` Matches 0 or more characters in a single path portion
|
||||
* `?` Matches 1 character
|
||||
* `[...]` Matches a range of characters, similar to a RegExp range.
|
||||
If the first character of the range is `!` or `^` then it matches
|
||||
any character not in the range.
|
||||
* `!(pattern|pattern|pattern)` Matches anything that does not match
|
||||
any of the patterns provided.
|
||||
* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
|
||||
patterns provided.
|
||||
* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
|
||||
patterns provided.
|
||||
* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
|
||||
* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
|
||||
provided
|
||||
* `**` If a "globstar" is alone in a path portion, then it matches
|
||||
zero or more directories and subdirectories searching for matches.
|
||||
It does not crawl symlinked directories.
|
||||
|
||||
### Dots
|
||||
|
||||
If a file or directory path portion has a `.` as the first character,
|
||||
then it will not match any glob pattern unless that pattern's
|
||||
corresponding path part also has a `.` as its first character.
|
||||
|
||||
For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
|
||||
However the pattern `a/*/c` would not, because `*` does not start with
|
||||
a dot character.
|
||||
|
||||
You can make glob treat dots as normal characters by setting
|
||||
`dot:true` in the options.
|
||||
|
||||
### Basename Matching
|
||||
|
||||
If you set `matchBase:true` in the options, and the pattern has no
|
||||
slashes in it, then it will seek for any file anywhere in the tree
|
||||
with a matching basename. For example, `*.js` would match
|
||||
`test/simple/basic.js`.
|
||||
|
||||
### Negation
|
||||
|
||||
The intent for negation would be for a pattern starting with `!` to
|
||||
match everything that *doesn't* match the supplied pattern. However,
|
||||
the implementation is weird, and for the time being, this should be
|
||||
avoided. The behavior is deprecated in version 5, and will be removed
|
||||
entirely in version 6.
|
||||
|
||||
### Empty Sets
|
||||
|
||||
If no matching files are found, then an empty array is returned. This
|
||||
differs from the shell, where the pattern itself is returned. For
|
||||
example:
|
||||
|
||||
$ echo a*s*d*f
|
||||
a*s*d*f
|
||||
|
||||
To get the bash-style behavior, set the `nonull:true` in the options.
|
||||
|
||||
### See Also:
|
||||
|
||||
* `man sh`
|
||||
* `man bash` (Search for "Pattern Matching")
|
||||
* `man 3 fnmatch`
|
||||
* `man 5 gitignore`
|
||||
* [minimatch documentation](https://github.com/isaacs/minimatch)
|
||||
|
||||
## glob.hasMagic(pattern, [options])
|
||||
|
||||
Returns `true` if there are any special characters in the pattern, and
|
||||
`false` otherwise.
|
||||
|
||||
Note that the options affect the results. If `noext:true` is set in
|
||||
the options object, 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 in the
|
||||
options.
|
||||
|
||||
## glob(pattern, [options], cb)
|
||||
|
||||
* `pattern` {String} Pattern to be matched
|
||||
* `options` {Object}
|
||||
* `cb` {Function}
|
||||
* `err` {Error | null}
|
||||
* `matches` {Array<String>} filenames found matching the pattern
|
||||
|
||||
Perform an asynchronous glob search.
|
||||
|
||||
## glob.sync(pattern, [options])
|
||||
|
||||
* `pattern` {String} Pattern to be matched
|
||||
* `options` {Object}
|
||||
* return: {Array<String>} filenames found matching the pattern
|
||||
|
||||
Perform a synchronous glob search.
|
||||
|
||||
## Class: glob.Glob
|
||||
|
||||
Create a Glob object by instantiating the `glob.Glob` class.
|
||||
|
||||
```javascript
|
||||
var Glob = require("glob").Glob
|
||||
var mg = new Glob(pattern, options, cb)
|
||||
```
|
||||
|
||||
It's an EventEmitter, and starts walking the filesystem to find matches
|
||||
immediately.
|
||||
|
||||
### new glob.Glob(pattern, [options], [cb])
|
||||
|
||||
* `pattern` {String} pattern to search for
|
||||
* `options` {Object}
|
||||
* `cb` {Function} Called when an error occurs, or matches are found
|
||||
* `err` {Error | null}
|
||||
* `matches` {Array<String>} filenames found matching the pattern
|
||||
|
||||
Note that if the `sync` flag is set in the options, then matches will
|
||||
be immediately available on the `g.found` member.
|
||||
|
||||
### Properties
|
||||
|
||||
* `minimatch` The minimatch object that the glob uses.
|
||||
* `options` The options object passed in.
|
||||
* `aborted` Boolean which is set to true when calling `abort()`. There
|
||||
is no way at this time to continue a glob search after aborting, but
|
||||
you can re-use the statCache to avoid having to duplicate syscalls.
|
||||
* `cache` Convenience object. Each field has the following possible
|
||||
values:
|
||||
* `false` - Path does not exist
|
||||
* `true` - Path exists
|
||||
* `'DIR'` - Path exists, and is not a directory
|
||||
* `'FILE'` - Path exists, and is a directory
|
||||
* `[file, entries, ...]` - Path exists, is a directory, and the
|
||||
array value is the results of `fs.readdir`
|
||||
* `statCache` Cache of `fs.stat` results, to prevent statting the same
|
||||
path multiple times.
|
||||
* `symlinks` A record of which paths are symbolic links, which is
|
||||
relevant in resolving `**` patterns.
|
||||
* `realpathCache` An optional object which is passed to `fs.realpath`
|
||||
to minimize unnecessary syscalls. It is stored on the instantiated
|
||||
Glob object, and may be re-used.
|
||||
|
||||
### Events
|
||||
|
||||
* `end` When the matching is finished, this is emitted with all the
|
||||
matches found. If the `nonull` option is set, and no match was found,
|
||||
then the `matches` list contains the original pattern. The matches
|
||||
are sorted, unless the `nosort` flag is set.
|
||||
* `match` Every time a match is found, this is emitted with the matched.
|
||||
* `error` Emitted when an unexpected error is encountered, or whenever
|
||||
any fs error occurs if `options.strict` is set.
|
||||
* `abort` When `abort()` is called, this event is raised.
|
||||
|
||||
### Methods
|
||||
|
||||
* `pause` Temporarily stop the search
|
||||
* `resume` Resume the search
|
||||
* `abort` Stop the search forever
|
||||
|
||||
### Options
|
||||
|
||||
All the options that can be passed to Minimatch can also be passed to
|
||||
Glob to change pattern matching behavior. Also, some have been added,
|
||||
or have glob-specific ramifications.
|
||||
|
||||
All options are false by default, unless otherwise noted.
|
||||
|
||||
All options are added to the Glob object, as well.
|
||||
|
||||
If you are running many `glob` operations, you can pass a Glob object
|
||||
as the `options` argument to a subsequent operation to shortcut some
|
||||
`stat` and `readdir` calls. At the very least, you may pass in shared
|
||||
`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
|
||||
parallel glob operations will be sped up by sharing information about
|
||||
the filesystem.
|
||||
|
||||
* `cwd` The current working directory in which to search. Defaults
|
||||
to `process.cwd()`.
|
||||
* `root` The place where patterns starting with `/` will be mounted
|
||||
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
|
||||
systems, and `C:\` or some such on Windows.)
|
||||
* `dot` Include `.dot` files in normal matches and `globstar` matches.
|
||||
Note that an explicit dot in a portion of the pattern will always
|
||||
match dot files.
|
||||
* `nomount` By default, a pattern starting with a forward-slash will be
|
||||
"mounted" onto the root setting, so that a valid filesystem path is
|
||||
returned. Set this flag to disable that behavior.
|
||||
* `mark` Add a `/` character to directory matches. Note that this
|
||||
requires additional stat calls.
|
||||
* `nosort` Don't sort the results.
|
||||
* `stat` Set to true to stat *all* results. This reduces performance
|
||||
somewhat, and is completely unnecessary, unless `readdir` is presumed
|
||||
to be an untrustworthy indicator of file existence.
|
||||
* `silent` When an unusual error is encountered when attempting to
|
||||
read a directory, a warning will be printed to stderr. Set the
|
||||
`silent` option to true to suppress these warnings.
|
||||
* `strict` When an unusual error is encountered when attempting to
|
||||
read a directory, the process will just continue on in search of
|
||||
other matches. Set the `strict` option to raise an error in these
|
||||
cases.
|
||||
* `cache` See `cache` property above. Pass in a previously generated
|
||||
cache object to save some fs calls.
|
||||
* `statCache` A cache of results of filesystem information, to prevent
|
||||
unnecessary stat calls. While it should not normally be necessary
|
||||
to set this, you may pass the statCache from one glob() call to the
|
||||
options object of another, if you know that the filesystem will not
|
||||
change between calls. (See "Race Conditions" below.)
|
||||
* `symlinks` A cache of known symbolic links. You may pass in a
|
||||
previously generated `symlinks` object to save `lstat` calls when
|
||||
resolving `**` matches.
|
||||
* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
|
||||
* `nounique` In some cases, brace-expanded patterns can result in the
|
||||
same file showing up multiple times in the result set. By default,
|
||||
this implementation prevents duplicates in the result set. Set this
|
||||
flag to disable that behavior.
|
||||
* `nonull` Set to never return an empty set, instead returning a set
|
||||
containing the pattern itself. This is the default in glob(3).
|
||||
* `debug` Set to enable debug logging in minimatch and glob.
|
||||
* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
|
||||
* `noglobstar` Do not match `**` against multiple filenames. (Ie,
|
||||
treat it as a normal `*` instead.)
|
||||
* `noext` Do not match `+(a|b)` "extglob" patterns.
|
||||
* `nocase` Perform a case-insensitive match. Note: on
|
||||
case-insensitive filesystems, non-magic patterns will match by
|
||||
default, since `stat` and `readdir` will not raise errors.
|
||||
* `matchBase` Perform a basename-only match if the pattern does not
|
||||
contain any slash characters. That is, `*.js` would be treated as
|
||||
equivalent to `**/*.js`, matching all js files in all directories.
|
||||
* `nodir` Do not match directories, only files. (Note: to match
|
||||
*only* directories, simply put a `/` at the end of the pattern.)
|
||||
* `ignore` Add a pattern or an array of patterns to exclude matches.
|
||||
* `follow` Follow symlinked directories when expanding `**` patterns.
|
||||
Note that this can result in a lot of duplicate references in the
|
||||
presence of cyclic links.
|
||||
* `realpath` Set to true to call `fs.realpath` on all of the results.
|
||||
In the case of a symlink that cannot be resolved, the full absolute
|
||||
path to the matched entry is returned (though it will usually be a
|
||||
broken symlink)
|
||||
* `nonegate` Suppress deprecated `negate` behavior. (See below.)
|
||||
Default=true
|
||||
* `nocomment` Suppress deprecated `comment` behavior. (See below.)
|
||||
Default=true
|
||||
|
||||
## Comparisons to other fnmatch/glob implementations
|
||||
|
||||
While strict compliance with the existing standards is a worthwhile
|
||||
goal, some discrepancies exist between node-glob and other
|
||||
implementations, and are intentional.
|
||||
|
||||
The double-star character `**` is supported by default, unless the
|
||||
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||
and bash 4.3, where `**` only has special significance if it is the only
|
||||
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||
`a/**b` will not.
|
||||
|
||||
Note that symlinked directories are not crawled as part of a `**`,
|
||||
though their contents may match against subsequent portions of the
|
||||
pattern. This prevents infinite loops and duplicates and the like.
|
||||
|
||||
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||
then glob returns the pattern as-provided, rather than
|
||||
interpreting the character escapes. For example,
|
||||
`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||
that it does not resolve escaped pattern characters.
|
||||
|
||||
If brace expansion is not disabled, then it is performed before any
|
||||
other interpretation of the glob pattern. Thus, a pattern like
|
||||
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||
checked for validity. Since those two are valid, matching proceeds.
|
||||
|
||||
### Comments and Negation
|
||||
|
||||
**Note**: In version 5 of this module, negation and comments are
|
||||
**disabled** by default. You can explicitly set `nonegate:false` or
|
||||
`nocomment:false` to re-enable them. They are going away entirely in
|
||||
version 6.
|
||||
|
||||
The intent for negation would be for a pattern starting with `!` to
|
||||
match everything that *doesn't* match the supplied pattern. However,
|
||||
the implementation is weird. It is better to use the `ignore` option
|
||||
to set a pattern or set of patterns to exclude from matches. If you
|
||||
want the "everything except *x*" type of behavior, you can use `**` as
|
||||
the main pattern, and set an `ignore` for the things to exclude.
|
||||
|
||||
The comments feature is added in minimatch, primarily to more easily
|
||||
support use cases like ignore files, where a `#` at the start of a
|
||||
line makes the pattern "empty". However, in the context of a
|
||||
straightforward filesystem globber, "comments" don't make much sense.
|
||||
|
||||
## Windows
|
||||
|
||||
**Please only use forward-slashes in glob expressions.**
|
||||
|
||||
Though windows uses either `/` or `\` as its path separator, only `/`
|
||||
characters are used by this glob implementation. You must use
|
||||
forward-slashes **only** in glob expressions. Back-slashes will always
|
||||
be interpreted as escape characters, not path separators.
|
||||
|
||||
Results from absolute patterns such as `/foo/*` are mounted onto the
|
||||
root setting using `path.join`. On windows, this will by default result
|
||||
in `/foo/*` matching `C:\foo\bar.txt`.
|
||||
|
||||
## Race Conditions
|
||||
|
||||
Glob searching, by its very nature, is susceptible to race conditions,
|
||||
since it relies on directory walking and such.
|
||||
|
||||
As a result, it is possible that a file that exists when glob looks for
|
||||
it may have been deleted or modified by the time it returns the result.
|
||||
|
||||
As part of its internal implementation, this program caches all stat
|
||||
and readdir calls that it makes, in order to cut down on system
|
||||
overhead. However, this also makes it even more susceptible to races,
|
||||
especially if the cache or statCache objects are reused between glob
|
||||
calls.
|
||||
|
||||
Users are thus advised not to use a glob result as a guarantee of
|
||||
filesystem state in the face of rapid changes. For the vast majority
|
||||
of operations, this is never a problem.
|
||||
|
||||
## Contributing
|
||||
|
||||
Any change to behavior (including bugfixes) must come with a test.
|
||||
|
||||
Patches that fail tests or reduce performance will be rejected.
|
||||
|
||||
```
|
||||
# to run tests
|
||||
npm test
|
||||
|
||||
# to re-generate test fixtures
|
||||
npm run test-regen
|
||||
|
||||
# to benchmark against bash/zsh
|
||||
npm run bench
|
||||
|
||||
# to profile javascript
|
||||
npm run prof
|
||||
```
|
||||
245
static/js/ketcher2/node_modules/istanbul/node_modules/glob/common.js
generated
vendored
Normal file
245
static/js/ketcher2/node_modules/istanbul/node_modules/glob/common.js
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
exports.alphasort = alphasort
|
||||
exports.alphasorti = alphasorti
|
||||
exports.setopts = setopts
|
||||
exports.ownProp = ownProp
|
||||
exports.makeAbs = makeAbs
|
||||
exports.finish = finish
|
||||
exports.mark = mark
|
||||
exports.isIgnored = isIgnored
|
||||
exports.childrenIgnored = childrenIgnored
|
||||
|
||||
function ownProp (obj, field) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, field)
|
||||
}
|
||||
|
||||
var path = require("path")
|
||||
var minimatch = require("minimatch")
|
||||
var isAbsolute = require("path-is-absolute")
|
||||
var Minimatch = minimatch.Minimatch
|
||||
|
||||
function alphasorti (a, b) {
|
||||
return a.toLowerCase().localeCompare(b.toLowerCase())
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a.localeCompare(b)
|
||||
}
|
||||
|
||||
function setupIgnores (self, options) {
|
||||
self.ignore = options.ignore || []
|
||||
|
||||
if (!Array.isArray(self.ignore))
|
||||
self.ignore = [self.ignore]
|
||||
|
||||
if (self.ignore.length) {
|
||||
self.ignore = self.ignore.map(ignoreMap)
|
||||
}
|
||||
}
|
||||
|
||||
function ignoreMap (pattern) {
|
||||
var gmatcher = null
|
||||
if (pattern.slice(-3) === '/**') {
|
||||
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
|
||||
gmatcher = new Minimatch(gpattern)
|
||||
}
|
||||
|
||||
return {
|
||||
matcher: new Minimatch(pattern),
|
||||
gmatcher: gmatcher
|
||||
}
|
||||
}
|
||||
|
||||
function setopts (self, pattern, options) {
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
// base-matching: just use globstar for that.
|
||||
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
||||
if (options.noglobstar) {
|
||||
throw new Error("base matching requires globstar")
|
||||
}
|
||||
pattern = "**/" + pattern
|
||||
}
|
||||
|
||||
self.silent = !!options.silent
|
||||
self.pattern = pattern
|
||||
self.strict = options.strict !== false
|
||||
self.realpath = !!options.realpath
|
||||
self.realpathCache = options.realpathCache || Object.create(null)
|
||||
self.follow = !!options.follow
|
||||
self.dot = !!options.dot
|
||||
self.mark = !!options.mark
|
||||
self.nodir = !!options.nodir
|
||||
if (self.nodir)
|
||||
self.mark = true
|
||||
self.sync = !!options.sync
|
||||
self.nounique = !!options.nounique
|
||||
self.nonull = !!options.nonull
|
||||
self.nosort = !!options.nosort
|
||||
self.nocase = !!options.nocase
|
||||
self.stat = !!options.stat
|
||||
self.noprocess = !!options.noprocess
|
||||
|
||||
self.maxLength = options.maxLength || Infinity
|
||||
self.cache = options.cache || Object.create(null)
|
||||
self.statCache = options.statCache || Object.create(null)
|
||||
self.symlinks = options.symlinks || Object.create(null)
|
||||
|
||||
setupIgnores(self, options)
|
||||
|
||||
self.changedCwd = false
|
||||
var cwd = process.cwd()
|
||||
if (!ownProp(options, "cwd"))
|
||||
self.cwd = cwd
|
||||
else {
|
||||
self.cwd = options.cwd
|
||||
self.changedCwd = path.resolve(options.cwd) !== cwd
|
||||
}
|
||||
|
||||
self.root = options.root || path.resolve(self.cwd, "/")
|
||||
self.root = path.resolve(self.root)
|
||||
if (process.platform === "win32")
|
||||
self.root = self.root.replace(/\\/g, "/")
|
||||
|
||||
self.nomount = !!options.nomount
|
||||
|
||||
// disable comments and negation unless the user explicitly
|
||||
// passes in false as the option.
|
||||
options.nonegate = options.nonegate === false ? false : true
|
||||
options.nocomment = options.nocomment === false ? false : true
|
||||
deprecationWarning(options)
|
||||
|
||||
self.minimatch = new Minimatch(pattern, options)
|
||||
self.options = self.minimatch.options
|
||||
}
|
||||
|
||||
// TODO(isaacs): remove entirely in v6
|
||||
// exported to reset in tests
|
||||
exports.deprecationWarned
|
||||
function deprecationWarning(options) {
|
||||
if (!options.nonegate || !options.nocomment) {
|
||||
if (process.noDeprecation !== true && !exports.deprecationWarned) {
|
||||
var msg = 'glob WARNING: comments and negation will be disabled in v6'
|
||||
if (process.throwDeprecation)
|
||||
throw new Error(msg)
|
||||
else if (process.traceDeprecation)
|
||||
console.trace(msg)
|
||||
else
|
||||
console.error(msg)
|
||||
|
||||
exports.deprecationWarned = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function finish (self) {
|
||||
var nou = self.nounique
|
||||
var all = nou ? [] : Object.create(null)
|
||||
|
||||
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
||||
var matches = self.matches[i]
|
||||
if (!matches || Object.keys(matches).length === 0) {
|
||||
if (self.nonull) {
|
||||
// do like the shell, and spit out the literal glob
|
||||
var literal = self.minimatch.globSet[i]
|
||||
if (nou)
|
||||
all.push(literal)
|
||||
else
|
||||
all[literal] = true
|
||||
}
|
||||
} else {
|
||||
// had matches
|
||||
var m = Object.keys(matches)
|
||||
if (nou)
|
||||
all.push.apply(all, m)
|
||||
else
|
||||
m.forEach(function (m) {
|
||||
all[m] = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!nou)
|
||||
all = Object.keys(all)
|
||||
|
||||
if (!self.nosort)
|
||||
all = all.sort(self.nocase ? alphasorti : alphasort)
|
||||
|
||||
// at *some* point we statted all of these
|
||||
if (self.mark) {
|
||||
for (var i = 0; i < all.length; i++) {
|
||||
all[i] = self._mark(all[i])
|
||||
}
|
||||
if (self.nodir) {
|
||||
all = all.filter(function (e) {
|
||||
return !(/\/$/.test(e))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (self.ignore.length)
|
||||
all = all.filter(function(m) {
|
||||
return !isIgnored(self, m)
|
||||
})
|
||||
|
||||
self.found = all
|
||||
}
|
||||
|
||||
function mark (self, p) {
|
||||
var abs = makeAbs(self, p)
|
||||
var c = self.cache[abs]
|
||||
var m = p
|
||||
if (c) {
|
||||
var isDir = c === 'DIR' || Array.isArray(c)
|
||||
var slash = p.slice(-1) === '/'
|
||||
|
||||
if (isDir && !slash)
|
||||
m += '/'
|
||||
else if (!isDir && slash)
|
||||
m = m.slice(0, -1)
|
||||
|
||||
if (m !== p) {
|
||||
var mabs = makeAbs(self, m)
|
||||
self.statCache[mabs] = self.statCache[abs]
|
||||
self.cache[mabs] = self.cache[abs]
|
||||
}
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// lotta situps...
|
||||
function makeAbs (self, f) {
|
||||
var abs = f
|
||||
if (f.charAt(0) === '/') {
|
||||
abs = path.join(self.root, f)
|
||||
} else if (isAbsolute(f) || f === '') {
|
||||
abs = f
|
||||
} else if (self.changedCwd) {
|
||||
abs = path.resolve(self.cwd, f)
|
||||
} else {
|
||||
abs = path.resolve(f)
|
||||
}
|
||||
return abs
|
||||
}
|
||||
|
||||
|
||||
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
||||
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
||||
function isIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
|
||||
function childrenIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
752
static/js/ketcher2/node_modules/istanbul/node_modules/glob/glob.js
generated
vendored
Normal file
752
static/js/ketcher2/node_modules/istanbul/node_modules/glob/glob.js
generated
vendored
Normal file
@ -0,0 +1,752 @@
|
||||
// Approach:
|
||||
//
|
||||
// 1. Get the minimatch set
|
||||
// 2. For each pattern in the set, PROCESS(pattern, false)
|
||||
// 3. Store matches per-set, then uniq them
|
||||
//
|
||||
// PROCESS(pattern, inGlobStar)
|
||||
// Get the first [n] items from pattern that are all strings
|
||||
// Join these together. This is PREFIX.
|
||||
// If there is no more remaining, then stat(PREFIX) and
|
||||
// add to matches if it succeeds. END.
|
||||
//
|
||||
// If inGlobStar and PREFIX is symlink and points to dir
|
||||
// set ENTRIES = []
|
||||
// else readdir(PREFIX) as ENTRIES
|
||||
// If fail, END
|
||||
//
|
||||
// with ENTRIES
|
||||
// If pattern[n] is GLOBSTAR
|
||||
// // handle the case where the globstar match is empty
|
||||
// // by pruning it out, and testing the resulting pattern
|
||||
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
|
||||
// // handle other cases.
|
||||
// for ENTRY in ENTRIES (not dotfiles)
|
||||
// // attach globstar + tail onto the entry
|
||||
// // Mark that this entry is a globstar match
|
||||
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
||||
//
|
||||
// else // not globstar
|
||||
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
||||
// Test ENTRY against pattern[n]
|
||||
// If fails, continue
|
||||
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
||||
//
|
||||
// Caveat:
|
||||
// Cache all stats and readdirs results to minimize syscall. Since all
|
||||
// we ever care about is existence and directory-ness, we can just keep
|
||||
// `true` for files, and [children,...] for directories, or `false` for
|
||||
// things that don't exist.
|
||||
|
||||
module.exports = glob
|
||||
|
||||
var fs = require('fs')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var inherits = require('inherits')
|
||||
var EE = require('events').EventEmitter
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var globSync = require('./sync.js')
|
||||
var common = require('./common.js')
|
||||
var alphasort = common.alphasort
|
||||
var alphasorti = common.alphasorti
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var inflight = require('inflight')
|
||||
var util = require('util')
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
var isIgnored = common.isIgnored
|
||||
|
||||
var once = require('once')
|
||||
|
||||
function glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') cb = options, options = {}
|
||||
if (!options) options = {}
|
||||
|
||||
if (options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return globSync(pattern, options)
|
||||
}
|
||||
|
||||
return new Glob(pattern, options, cb)
|
||||
}
|
||||
|
||||
glob.sync = globSync
|
||||
var GlobSync = glob.GlobSync = globSync.GlobSync
|
||||
|
||||
// old api surface
|
||||
glob.glob = glob
|
||||
|
||||
glob.hasMagic = function (pattern, options_) {
|
||||
var options = util._extend({}, options_)
|
||||
options.noprocess = true
|
||||
|
||||
var g = new Glob(pattern, options)
|
||||
var set = g.minimatch.set
|
||||
if (set.length > 1)
|
||||
return true
|
||||
|
||||
for (var j = 0; j < set[0].length; j++) {
|
||||
if (typeof set[0][j] !== 'string')
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
glob.Glob = Glob
|
||||
inherits(Glob, EE)
|
||||
function Glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = null
|
||||
}
|
||||
|
||||
if (options && options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return new GlobSync(pattern, options)
|
||||
}
|
||||
|
||||
if (!(this instanceof Glob))
|
||||
return new Glob(pattern, options, cb)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
this._didRealPath = false
|
||||
|
||||
// process each pattern in the minimatch set
|
||||
var n = this.minimatch.set.length
|
||||
|
||||
// The matches are stored as {<filename>: true,...} so that
|
||||
// duplicates are automagically pruned.
|
||||
// Later, we do an Object.keys() on these.
|
||||
// Keep them as a list so we can fill in when nonull is set.
|
||||
this.matches = new Array(n)
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
cb = once(cb)
|
||||
this.on('error', cb)
|
||||
this.on('end', function (matches) {
|
||||
cb(null, matches)
|
||||
})
|
||||
}
|
||||
|
||||
var self = this
|
||||
var n = this.minimatch.set.length
|
||||
this._processing = 0
|
||||
this.matches = new Array(n)
|
||||
|
||||
this._emitQueue = []
|
||||
this._processQueue = []
|
||||
this.paused = false
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
if (n === 0)
|
||||
return done()
|
||||
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false, done)
|
||||
}
|
||||
|
||||
function done () {
|
||||
--self._processing
|
||||
if (self._processing <= 0)
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._finish = function () {
|
||||
assert(this instanceof Glob)
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (this.realpath && !this._didRealpath)
|
||||
return this._realpath()
|
||||
|
||||
common.finish(this)
|
||||
this.emit('end', this.found)
|
||||
}
|
||||
|
||||
Glob.prototype._realpath = function () {
|
||||
if (this._didRealpath)
|
||||
return
|
||||
|
||||
this._didRealpath = true
|
||||
|
||||
var n = this.matches.length
|
||||
if (n === 0)
|
||||
return this._finish()
|
||||
|
||||
var self = this
|
||||
for (var i = 0; i < this.matches.length; i++)
|
||||
this._realpathSet(i, next)
|
||||
|
||||
function next () {
|
||||
if (--n === 0)
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._realpathSet = function (index, cb) {
|
||||
var matchset = this.matches[index]
|
||||
if (!matchset)
|
||||
return cb()
|
||||
|
||||
var found = Object.keys(matchset)
|
||||
var self = this
|
||||
var n = found.length
|
||||
|
||||
if (n === 0)
|
||||
return cb()
|
||||
|
||||
var set = this.matches[index] = Object.create(null)
|
||||
found.forEach(function (p, i) {
|
||||
// If there's a problem with the stat, then it means that
|
||||
// one or more of the links in the realpath couldn't be
|
||||
// resolved. just return the abs value in that case.
|
||||
p = self._makeAbs(p)
|
||||
fs.realpath(p, self.realpathCache, function (er, real) {
|
||||
if (!er)
|
||||
set[real] = true
|
||||
else if (er.syscall === 'stat')
|
||||
set[p] = true
|
||||
else
|
||||
self.emit('error', er) // srsly wtf right here
|
||||
|
||||
if (--n === 0) {
|
||||
self.matches[index] = set
|
||||
cb()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
Glob.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
|
||||
Glob.prototype.abort = function () {
|
||||
this.aborted = true
|
||||
this.emit('abort')
|
||||
}
|
||||
|
||||
Glob.prototype.pause = function () {
|
||||
if (!this.paused) {
|
||||
this.paused = true
|
||||
this.emit('pause')
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype.resume = function () {
|
||||
if (this.paused) {
|
||||
this.emit('resume')
|
||||
this.paused = false
|
||||
if (this._emitQueue.length) {
|
||||
var eq = this._emitQueue.slice(0)
|
||||
this._emitQueue.length = 0
|
||||
for (var i = 0; i < eq.length; i ++) {
|
||||
var e = eq[i]
|
||||
this._emitMatch(e[0], e[1])
|
||||
}
|
||||
}
|
||||
if (this._processQueue.length) {
|
||||
var pq = this._processQueue.slice(0)
|
||||
this._processQueue.length = 0
|
||||
for (var i = 0; i < pq.length; i ++) {
|
||||
var p = pq[i]
|
||||
this._processing--
|
||||
this._process(p[0], p[1], p[2], p[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
||||
assert(this instanceof Glob)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
this._processing++
|
||||
if (this.paused) {
|
||||
this._processQueue.push([pattern, index, inGlobStar, cb])
|
||||
return
|
||||
}
|
||||
|
||||
//console.error('PROCESS %d', this._processing, pattern)
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === 'string') {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// see if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
this._processSimple(pattern.join('/'), index, cb)
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||
// or 'relative' like '../baz'
|
||||
prefix = pattern.slice(0, n).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip _processing
|
||||
if (childrenIgnored(this, read))
|
||||
return cb()
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return cb()
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this._emitMatch(index, e)
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return cb()
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
this._process([e].concat(remain), index, inGlobStar, cb)
|
||||
}
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._emitMatch = function (index, e) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (isIgnored(this, e))
|
||||
return
|
||||
|
||||
if (this.paused) {
|
||||
this._emitQueue.push([index, e])
|
||||
return
|
||||
}
|
||||
|
||||
var abs = this._makeAbs(e)
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[abs]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
this.matches[index][e] = true
|
||||
|
||||
var st = this.statCache[abs]
|
||||
if (st)
|
||||
this.emit('stat', e, st)
|
||||
|
||||
this.emit('match', e)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false, cb)
|
||||
|
||||
var lstatkey = 'lstat\0' + abs
|
||||
var self = this
|
||||
var lstatcb = inflight(lstatkey, lstatcb_)
|
||||
|
||||
if (lstatcb)
|
||||
fs.lstat(abs, lstatcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (er)
|
||||
return cb()
|
||||
|
||||
var isSym = lstat.isSymbolicLink()
|
||||
self.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && !lstat.isDirectory()) {
|
||||
self.cache[abs] = 'FILE'
|
||||
cb()
|
||||
} else
|
||||
self._readdir(abs, false, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
|
||||
if (!cb)
|
||||
return
|
||||
|
||||
//console.error('RD %j %j', +inGlobStar, abs)
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs, cb)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return cb()
|
||||
|
||||
if (Array.isArray(c))
|
||||
return cb(null, c)
|
||||
}
|
||||
|
||||
var self = this
|
||||
fs.readdir(abs, readdirCb(this, abs, cb))
|
||||
}
|
||||
|
||||
function readdirCb (self, abs, cb) {
|
||||
return function (er, entries) {
|
||||
if (er)
|
||||
self._readdirError(abs, er, cb)
|
||||
else
|
||||
self._readdirEntries(abs, entries, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
return cb(null, entries)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirError = function (f, er, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
this.cache[this._makeAbs(f)] = 'FILE'
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict) {
|
||||
this.emit('error', er)
|
||||
// If the error is handled, then we abort
|
||||
// if not, we threw out of here
|
||||
this.abort()
|
||||
}
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
|
||||
return cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
//console.error('pgs2', prefix, remain[0], entries)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false, cb)
|
||||
|
||||
var isSym = this.symlinks[abs]
|
||||
var len = entries.length
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return cb()
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true, cb)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true, cb)
|
||||
}
|
||||
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processSimple = function (prefix, index, cb) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var self = this
|
||||
this._stat(prefix, function (er, exists) {
|
||||
self._processSimple2(prefix, index, er, exists, cb)
|
||||
})
|
||||
}
|
||||
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
||||
|
||||
//console.error('ps2', prefix, exists)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return cb()
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this._emitMatch(index, prefix)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
Glob.prototype._stat = function (f, cb) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return cb()
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return cb(null, c)
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (stat !== undefined) {
|
||||
if (stat === false)
|
||||
return cb(null, stat)
|
||||
else {
|
||||
var type = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
if (needDir && type === 'FILE')
|
||||
return cb()
|
||||
else
|
||||
return cb(null, type, stat)
|
||||
}
|
||||
}
|
||||
|
||||
var self = this
|
||||
var statcb = inflight('stat\0' + abs, lstatcb_)
|
||||
if (statcb)
|
||||
fs.lstat(abs, statcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
// If it's a symlink, then treat it as the target, unless
|
||||
// the target does not exist, then treat it as a file.
|
||||
return fs.stat(abs, function (er, stat) {
|
||||
if (er)
|
||||
self._stat2(f, abs, null, lstat, cb)
|
||||
else
|
||||
self._stat2(f, abs, er, stat, cb)
|
||||
})
|
||||
} else {
|
||||
self._stat2(f, abs, er, lstat, cb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
||||
if (er) {
|
||||
this.statCache[abs] = false
|
||||
return cb()
|
||||
}
|
||||
|
||||
var needDir = f.slice(-1) === '/'
|
||||
this.statCache[abs] = stat
|
||||
|
||||
if (abs.slice(-1) === '/' && !stat.isDirectory())
|
||||
return cb(null, false, stat)
|
||||
|
||||
var c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c !== 'DIR')
|
||||
return cb()
|
||||
|
||||
return cb(null, c, stat)
|
||||
}
|
||||
75
static/js/ketcher2/node_modules/istanbul/node_modules/glob/package.json
generated
vendored
Normal file
75
static/js/ketcher2/node_modules/istanbul/node_modules/glob/package.json
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "glob@^5.0.15",
|
||||
"_id": "glob@5.0.15",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=",
|
||||
"_location": "/istanbul/glob",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "glob@^5.0.15",
|
||||
"name": "glob",
|
||||
"escapedName": "glob",
|
||||
"rawSpec": "^5.0.15",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.15"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
|
||||
"_shasum": "1bc936b9e02f4a603fcc222ecf7633d30b8b93b1",
|
||||
"_spec": "glob@^5.0.15",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-glob/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "2 || 3",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "a little globber",
|
||||
"devDependencies": {
|
||||
"mkdirp": "0",
|
||||
"rimraf": "^2.2.8",
|
||||
"tap": "^1.1.4",
|
||||
"tick": "0.0.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"files": [
|
||||
"glob.js",
|
||||
"sync.js",
|
||||
"common.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/node-glob#readme",
|
||||
"license": "ISC",
|
||||
"main": "glob.js",
|
||||
"name": "glob",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-glob.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "bash benchmark.sh",
|
||||
"benchclean": "node benchclean.js",
|
||||
"prepublish": "npm run benchclean",
|
||||
"prof": "bash prof.sh && cat profile.txt",
|
||||
"profclean": "rm -f v8.log profile.txt",
|
||||
"test": "tap test/*.js --cov",
|
||||
"test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js"
|
||||
},
|
||||
"version": "5.0.15"
|
||||
}
|
||||
460
static/js/ketcher2/node_modules/istanbul/node_modules/glob/sync.js
generated
vendored
Normal file
460
static/js/ketcher2/node_modules/istanbul/node_modules/glob/sync.js
generated
vendored
Normal file
@ -0,0 +1,460 @@
|
||||
module.exports = globSync
|
||||
globSync.GlobSync = GlobSync
|
||||
|
||||
var fs = require('fs')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var Glob = require('./glob.js').Glob
|
||||
var util = require('util')
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var common = require('./common.js')
|
||||
var alphasort = common.alphasort
|
||||
var alphasorti = common.alphasorti
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
|
||||
function globSync (pattern, options) {
|
||||
if (typeof options === 'function' || arguments.length === 3)
|
||||
throw new TypeError('callback provided to sync glob\n'+
|
||||
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||
|
||||
return new GlobSync(pattern, options).found
|
||||
}
|
||||
|
||||
function GlobSync (pattern, options) {
|
||||
if (!pattern)
|
||||
throw new Error('must provide pattern')
|
||||
|
||||
if (typeof options === 'function' || arguments.length === 3)
|
||||
throw new TypeError('callback provided to sync glob\n'+
|
||||
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||
|
||||
if (!(this instanceof GlobSync))
|
||||
return new GlobSync(pattern, options)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
var n = this.minimatch.set.length
|
||||
this.matches = new Array(n)
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false)
|
||||
}
|
||||
this._finish()
|
||||
}
|
||||
|
||||
GlobSync.prototype._finish = function () {
|
||||
assert(this instanceof GlobSync)
|
||||
if (this.realpath) {
|
||||
var self = this
|
||||
this.matches.forEach(function (matchset, index) {
|
||||
var set = self.matches[index] = Object.create(null)
|
||||
for (var p in matchset) {
|
||||
try {
|
||||
p = self._makeAbs(p)
|
||||
var real = fs.realpathSync(p, self.realpathCache)
|
||||
set[real] = true
|
||||
} catch (er) {
|
||||
if (er.syscall === 'stat')
|
||||
set[self._makeAbs(p)] = true
|
||||
else
|
||||
throw er
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
common.finish(this)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
||||
assert(this instanceof GlobSync)
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === 'string') {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// See if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
this._processSimple(pattern.join('/'), index)
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||
// or 'relative' like '../baz'
|
||||
prefix = pattern.slice(0, n).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip processing
|
||||
if (childrenIgnored(this, read))
|
||||
return
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||
var entries = this._readdir(abs, inGlobStar)
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return
|
||||
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix.slice(-1) !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this.matches[index][e] = true
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix)
|
||||
newPattern = [prefix, e]
|
||||
else
|
||||
newPattern = [e]
|
||||
this._process(newPattern.concat(remain), index, inGlobStar)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._emitMatch = function (index, e) {
|
||||
var abs = this._makeAbs(e)
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[this._makeAbs(e)]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
this.matches[index][e] = true
|
||||
if (this.stat)
|
||||
this._stat(e)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false)
|
||||
|
||||
var entries
|
||||
var lstat
|
||||
var stat
|
||||
try {
|
||||
lstat = fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
// lstat failed, doesn't exist
|
||||
return null
|
||||
}
|
||||
|
||||
var isSym = lstat.isSymbolicLink()
|
||||
this.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && !lstat.isDirectory())
|
||||
this.cache[abs] = 'FILE'
|
||||
else
|
||||
entries = this._readdir(abs, false)
|
||||
|
||||
return entries
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
||||
var entries
|
||||
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return null
|
||||
|
||||
if (Array.isArray(c))
|
||||
return c
|
||||
}
|
||||
|
||||
try {
|
||||
return this._readdirEntries(abs, fs.readdirSync(abs))
|
||||
} catch (er) {
|
||||
this._readdirError(abs, er)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
|
||||
// mark and cache dir-ness
|
||||
return entries
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdirError = function (f, er) {
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
this.cache[this._makeAbs(f)] = 'FILE'
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict)
|
||||
throw er
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||
|
||||
var entries = this._readdir(abs, inGlobStar)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false)
|
||||
|
||||
var len = entries.length
|
||||
var isSym = this.symlinks[abs]
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true)
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._processSimple = function (prefix, index) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var exists = this._stat(prefix)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this.matches[index][prefix] = true
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
GlobSync.prototype._stat = function (f) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return false
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return false
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (!stat) {
|
||||
var lstat
|
||||
try {
|
||||
lstat = fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (lstat.isSymbolicLink()) {
|
||||
try {
|
||||
stat = fs.statSync(abs)
|
||||
} catch (er) {
|
||||
stat = lstat
|
||||
}
|
||||
} else {
|
||||
stat = lstat
|
||||
}
|
||||
}
|
||||
|
||||
this.statCache[abs] = stat
|
||||
|
||||
var c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c !== 'DIR')
|
||||
return false
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
GlobSync.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
GlobSync.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
22
static/js/ketcher2/node_modules/istanbul/node_modules/levn/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/istanbul/node_modules/levn/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) George Zahariev
|
||||
|
||||
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.
|
||||
196
static/js/ketcher2/node_modules/istanbul/node_modules/levn/README.md
generated
vendored
Normal file
196
static/js/ketcher2/node_modules/istanbul/node_modules/levn/README.md
generated
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
# levn [](https://travis-ci.org/gkz/levn) <a name="levn" />
|
||||
__Light ECMAScript (JavaScript) Value Notation__
|
||||
Levn is a library which allows you to parse a string into a JavaScript value based on an expected type. It is meant for short amounts of human entered data (eg. config files, command line arguments).
|
||||
|
||||
Levn aims to concisely describe JavaScript values in text, and allow for the extraction and validation of those values. Levn uses [type-check](https://github.com/gkz/type-check) for its type format, and to validate the results. MIT license. Version 0.3.0.
|
||||
|
||||
__How is this different than JSON?__ levn is meant to be written by humans only, is (due to the previous point) much more concise, can be validated against supplied types, has regex and date literals, and can easily be extended with custom types. On the other hand, it is probably slower and thus less efficient at transporting large amounts of data, which is fine since this is not its purpose.
|
||||
|
||||
npm install levn
|
||||
|
||||
For updates on levn, [follow me on twitter](https://twitter.com/gkzahariev).
|
||||
|
||||
|
||||
## Quick Examples
|
||||
|
||||
```js
|
||||
var parse = require('levn').parse;
|
||||
parse('Number', '2'); // 2
|
||||
parse('String', '2'); // '2'
|
||||
parse('String', 'levn'); // 'levn'
|
||||
parse('String', 'a b'); // 'a b'
|
||||
parse('Boolean', 'true'); // true
|
||||
|
||||
parse('Date', '#2011-11-11#'); // (Date object)
|
||||
parse('Date', '2011-11-11'); // (Date object)
|
||||
parse('RegExp', '/[a-z]/gi'); // /[a-z]/gi
|
||||
parse('RegExp', 're'); // /re/
|
||||
parse('Int', '2'); // 2
|
||||
|
||||
parse('Number | String', 'str'); // 'str'
|
||||
parse('Number | String', '2'); // 2
|
||||
|
||||
parse('[Number]', '[1,2,3]'); // [1,2,3]
|
||||
parse('(String, Boolean)', '(hi, false)'); // ['hi', false]
|
||||
parse('{a: String, b: Number}', '{a: str, b: 2}'); // {a: 'str', b: 2}
|
||||
|
||||
// at the top level, you can ommit surrounding delimiters
|
||||
parse('[Number]', '1,2,3'); // [1,2,3]
|
||||
parse('(String, Boolean)', 'hi, false'); // ['hi', false]
|
||||
parse('{a: String, b: Number}', 'a: str, b: 2'); // {a: 'str', b: 2}
|
||||
|
||||
// wildcard - auto choose type
|
||||
parse('*', '[hi,(null,[42]),{k: true}]'); // ['hi', [null, [42]], {k: true}]
|
||||
```
|
||||
## Usage
|
||||
|
||||
`require('levn');` returns an object that exposes three properties. `VERSION` is the current version of the library as a string. `parse` and `parsedTypeParse` are functions.
|
||||
|
||||
```js
|
||||
// parse(type, input, options);
|
||||
parse('[Number]', '1,2,3'); // [1, 2, 3]
|
||||
|
||||
// parsedTypeParse(parsedType, input, options);
|
||||
var parsedType = require('type-check').parseType('[Number]');
|
||||
parsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3]
|
||||
```
|
||||
|
||||
### parse(type, input, options)
|
||||
|
||||
`parse` casts the string `input` into a JavaScript value according to the specified `type` in the [type format](https://github.com/gkz/type-check#type-format) (and taking account the optional `options`) and returns the resulting JavaScript value.
|
||||
|
||||
##### arguments
|
||||
* type - `String` - the type written in the [type format](https://github.com/gkz/type-check#type-format) which to check against
|
||||
* input - `String` - the value written in the [levn format](#levn-format)
|
||||
* options - `Maybe Object` - an optional parameter specifying additional [options](#options)
|
||||
|
||||
##### returns
|
||||
`*` - the resulting JavaScript value
|
||||
|
||||
##### example
|
||||
```js
|
||||
parse('[Number]', '1,2,3'); // [1, 2, 3]
|
||||
```
|
||||
|
||||
### parsedTypeParse(parsedType, input, options)
|
||||
|
||||
`parsedTypeParse` casts the string `input` into a JavaScript value according to the specified `type` which has already been parsed (and taking account the optional `options`) and returns the resulting JavaScript value. You can parse a type using the [type-check](https://github.com/gkz/type-check) library's `parseType` function.
|
||||
|
||||
##### arguments
|
||||
* type - `Object` - the type in the parsed type format which to check against
|
||||
* input - `String` - the value written in the [levn format](#levn-format)
|
||||
* options - `Maybe Object` - an optional parameter specifying additional [options](#options)
|
||||
|
||||
##### returns
|
||||
`*` - the resulting JavaScript value
|
||||
|
||||
##### example
|
||||
```js
|
||||
var parsedType = require('type-check').parseType('[Number]');
|
||||
parsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3]
|
||||
```
|
||||
|
||||
## Levn Format
|
||||
|
||||
Levn can use the type information you provide to choose the appropriate value to produce from the input. For the same input, it will choose a different output value depending on the type provided. For example, `parse('Number', '2')` will produce the number `2`, but `parse('String', '2')` will produce the string `"2"`.
|
||||
|
||||
If you do not provide type information, and simply use `*`, levn will parse the input according the unambiguous "explicit" mode, which we will now detail - you can also set the `explicit` option to true manually in the [options](#options).
|
||||
|
||||
* `"string"`, `'string'` are parsed as a String, eg. `"a msg"` is `"a msg"`
|
||||
* `#date#` is parsed as a Date, eg. `#2011-11-11#` is `new Date('2011-11-11')`
|
||||
* `/regexp/flags` is parsed as a RegExp, eg. `/re/gi` is `/re/gi`
|
||||
* `undefined`, `null`, `NaN`, `true`, and `false` are all their JavaScript equivalents
|
||||
* `[element1, element2, etc]` is an Array, and the casting procedure is recursively applied to each element. Eg. `[1,2,3]` is `[1,2,3]`.
|
||||
* `(element1, element2, etc)` is an tuple, and the casting procedure is recursively applied to each element. Eg. `(1, a)` is `(1, a)` (is `[1, 'a']`).
|
||||
* `{key1: val1, key2: val2, ...}` is an Object, and the casting procedure is recursively applied to each property. Eg. `{a: 1, b: 2}` is `{a: 1, b: 2}`.
|
||||
* Any test which does not fall under the above, and which does not contain special characters (`[``]``(``)``{``}``:``,`) is a string, eg. `$12- blah` is `"$12- blah"`.
|
||||
|
||||
If you do provide type information, you can make your input more concise as the program already has some information about what it expects. Please see the [type format](https://github.com/gkz/type-check#type-format) section of [type-check](https://github.com/gkz/type-check) for more information about how to specify types. There are some rules about what levn can do with the information:
|
||||
|
||||
* If a String is expected, and only a String, all characters of the input (including any special ones) will become part of the output. Eg. `[({})]` is `"[({})]"`, and `"hi"` is `'"hi"'`.
|
||||
* If a Date is expected, the surrounding `#` can be omitted from date literals. Eg. `2011-11-11` is `new Date('2011-11-11')`.
|
||||
* If a RegExp is expected, no flags need to be specified, and the regex is not using any of the special characters,the opening and closing `/` can be omitted - this will have the affect of setting the source of the regex to the input. Eg. `regex` is `/regex/`.
|
||||
* If an Array is expected, and it is the root node (at the top level), the opening `[` and closing `]` can be omitted. Eg. `1,2,3` is `[1,2,3]`.
|
||||
* If a tuple is expected, and it is the root node (at the top level), the opening `(` and closing `)` can be omitted. Eg. `1, a` is `(1, a)` (is `[1, 'a']`).
|
||||
* If an Object is expected, and it is the root node (at the top level), the opening `{` and closing `}` can be omitted. Eg `a: 1, b: 2` is `{a: 1, b: 2}`.
|
||||
|
||||
If you list multiple types (eg. `Number | String`), it will first attempt to cast to the first type and then validate - if the validation fails it will move on to the next type and so forth, left to right. You must be careful as some types will succeed with any input, such as String. Thus put String at the end of your list. In non-explicit mode, Date and RegExp will succeed with a large variety of input - also be careful with these and list them near the end if not last in your list.
|
||||
|
||||
Whitespace between special characters and elements is inconsequential.
|
||||
|
||||
## Options
|
||||
|
||||
Options is an object. It is an optional parameter to the `parse` and `parsedTypeParse` functions.
|
||||
|
||||
### Explicit
|
||||
|
||||
A `Boolean`. By default it is `false`.
|
||||
|
||||
__Example:__
|
||||
|
||||
```js
|
||||
parse('RegExp', 're', {explicit: false}); // /re/
|
||||
parse('RegExp', 're', {explicit: true}); // Error: ... does not type check...
|
||||
parse('RegExp | String', 're', {explicit: true}); // 're'
|
||||
```
|
||||
|
||||
`explicit` sets whether to be in explicit mode or not. Using `*` automatically activates explicit mode. For more information, read the [levn format](#levn-format) section.
|
||||
|
||||
### customTypes
|
||||
|
||||
An `Object`. Empty `{}` by default.
|
||||
|
||||
__Example:__
|
||||
|
||||
```js
|
||||
var options = {
|
||||
customTypes: {
|
||||
Even: {
|
||||
typeOf: 'Number',
|
||||
validate: function (x) {
|
||||
return x % 2 === 0;
|
||||
},
|
||||
cast: function (x) {
|
||||
return {type: 'Just', value: parseInt(x)};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parse('Even', '2', options); // 2
|
||||
parse('Even', '3', options); // Error: Value: "3" does not type check...
|
||||
```
|
||||
|
||||
__Another Example:__
|
||||
```js
|
||||
function Person(name, age){
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
var options = {
|
||||
customTypes: {
|
||||
Person: {
|
||||
typeOf: 'Object',
|
||||
validate: function (x) {
|
||||
x instanceof Person;
|
||||
},
|
||||
cast: function (value, options, typesCast) {
|
||||
var name, age;
|
||||
if ({}.toString.call(value).slice(8, -1) !== 'Object') {
|
||||
return {type: 'Nothing'};
|
||||
}
|
||||
name = typesCast(value.name, [{type: 'String'}], options);
|
||||
age = typesCast(value.age, [{type: 'Numger'}], options);
|
||||
return {type: 'Just', value: new Person(name, age)};
|
||||
}
|
||||
}
|
||||
}
|
||||
parse('Person', '{name: Laura, age: 25}', options); // Person {name: 'Laura', age: 25}
|
||||
```
|
||||
|
||||
`customTypes` is an object whose keys are the name of the types, and whose values are an object with three properties, `typeOf`, `validate`, and `cast`. For more information about `typeOf` and `validate`, please see the [custom types](https://github.com/gkz/type-check#custom-types) section of type-check.
|
||||
|
||||
`cast` is a function which receives three arguments, the value under question, options, and the typesCast function. In `cast`, attempt to cast the value into the specified type. If you are successful, return an object in the format `{type: 'Just', value: CAST-VALUE}`, if you know it won't work, return `{type: 'Nothing'}`. You can use the `typesCast` function to cast any child values. Remember to pass `options` to it. In your function you can also check for `options.explicit` and act accordingly.
|
||||
|
||||
## Technical About
|
||||
|
||||
`levn` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [type-check](https://github.com/gkz/type-check) to both parse types and validate values. It also uses the [prelude.ls](http://preludels.com/) library.
|
||||
298
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/cast.js
generated
vendored
Normal file
298
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/cast.js
generated
vendored
Normal file
@ -0,0 +1,298 @@
|
||||
// Generated by LiveScript 1.4.0
|
||||
(function(){
|
||||
var parsedTypeCheck, types, toString$ = {}.toString;
|
||||
parsedTypeCheck = require('type-check').parsedTypeCheck;
|
||||
types = {
|
||||
'*': function(value, options){
|
||||
switch (toString$.call(value).slice(8, -1)) {
|
||||
case 'Array':
|
||||
return typeCast(value, {
|
||||
type: 'Array'
|
||||
}, options);
|
||||
case 'Object':
|
||||
return typeCast(value, {
|
||||
type: 'Object'
|
||||
}, options);
|
||||
default:
|
||||
return {
|
||||
type: 'Just',
|
||||
value: typesCast(value, [
|
||||
{
|
||||
type: 'Undefined'
|
||||
}, {
|
||||
type: 'Null'
|
||||
}, {
|
||||
type: 'NaN'
|
||||
}, {
|
||||
type: 'Boolean'
|
||||
}, {
|
||||
type: 'Number'
|
||||
}, {
|
||||
type: 'Date'
|
||||
}, {
|
||||
type: 'RegExp'
|
||||
}, {
|
||||
type: 'Array'
|
||||
}, {
|
||||
type: 'Object'
|
||||
}, {
|
||||
type: 'String'
|
||||
}
|
||||
], (options.explicit = true, options))
|
||||
};
|
||||
}
|
||||
},
|
||||
Undefined: function(it){
|
||||
if (it === 'undefined' || it === void 8) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: void 8
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
Null: function(it){
|
||||
if (it === 'null') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: null
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
NaN: function(it){
|
||||
if (it === 'NaN') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: NaN
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
Boolean: function(it){
|
||||
if (it === 'true') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: true
|
||||
};
|
||||
} else if (it === 'false') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: false
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
Number: function(it){
|
||||
return {
|
||||
type: 'Just',
|
||||
value: +it
|
||||
};
|
||||
},
|
||||
Int: function(it){
|
||||
return {
|
||||
type: 'Just',
|
||||
value: +it
|
||||
};
|
||||
},
|
||||
Float: function(it){
|
||||
return {
|
||||
type: 'Just',
|
||||
value: +it
|
||||
};
|
||||
},
|
||||
Date: function(value, options){
|
||||
var that;
|
||||
if (that = /^\#([\s\S]*)\#$/.exec(value)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new Date(+that[1] || that[1])
|
||||
};
|
||||
} else if (options.explicit) {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new Date(+value || value)
|
||||
};
|
||||
}
|
||||
},
|
||||
RegExp: function(value, options){
|
||||
var that;
|
||||
if (that = /^\/([\s\S]*)\/([gimy]*)$/.exec(value)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new RegExp(that[1], that[2])
|
||||
};
|
||||
} else if (options.explicit) {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new RegExp(value)
|
||||
};
|
||||
}
|
||||
},
|
||||
Array: function(value, options){
|
||||
return castArray(value, {
|
||||
of: [{
|
||||
type: '*'
|
||||
}]
|
||||
}, options);
|
||||
},
|
||||
Object: function(value, options){
|
||||
return castFields(value, {
|
||||
of: {}
|
||||
}, options);
|
||||
},
|
||||
String: function(it){
|
||||
var that;
|
||||
if (toString$.call(it).slice(8, -1) !== 'String') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
if (that = it.match(/^'([\s\S]*)'$/)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: that[1].replace(/\\'/g, "'")
|
||||
};
|
||||
} else if (that = it.match(/^"([\s\S]*)"$/)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: that[1].replace(/\\"/g, '"')
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: it
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function castArray(node, type, options){
|
||||
var typeOf, element;
|
||||
if (toString$.call(node).slice(8, -1) !== 'Array') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
typeOf = type.of;
|
||||
return {
|
||||
type: 'Just',
|
||||
value: (function(){
|
||||
var i$, ref$, len$, results$ = [];
|
||||
for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) {
|
||||
element = ref$[i$];
|
||||
results$.push(typesCast(element, typeOf, options));
|
||||
}
|
||||
return results$;
|
||||
}())
|
||||
};
|
||||
}
|
||||
function castTuple(node, type, options){
|
||||
var result, i, i$, ref$, len$, types, cast;
|
||||
if (toString$.call(node).slice(8, -1) !== 'Array') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
result = [];
|
||||
i = 0;
|
||||
for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) {
|
||||
types = ref$[i$];
|
||||
cast = typesCast(node[i], types, options);
|
||||
if (toString$.call(cast).slice(8, -1) !== 'Undefined') {
|
||||
result.push(cast);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (node.length <= i) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: result
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
}
|
||||
function castFields(node, type, options){
|
||||
var typeOf, key, value;
|
||||
if (toString$.call(node).slice(8, -1) !== 'Object') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
typeOf = type.of;
|
||||
return {
|
||||
type: 'Just',
|
||||
value: (function(){
|
||||
var ref$, resultObj$ = {};
|
||||
for (key in ref$ = node) {
|
||||
value = ref$[key];
|
||||
resultObj$[typesCast(key, [{
|
||||
type: 'String'
|
||||
}], options)] = typesCast(value, typeOf[key] || [{
|
||||
type: '*'
|
||||
}], options);
|
||||
}
|
||||
return resultObj$;
|
||||
}())
|
||||
};
|
||||
}
|
||||
function typeCast(node, typeObj, options){
|
||||
var type, structure, castFunc, ref$;
|
||||
type = typeObj.type, structure = typeObj.structure;
|
||||
if (type) {
|
||||
castFunc = ((ref$ = options.customTypes[type]) != null ? ref$.cast : void 8) || types[type];
|
||||
if (!castFunc) {
|
||||
throw new Error("Type not defined: " + type + ".");
|
||||
}
|
||||
return castFunc(node, options, typesCast);
|
||||
} else {
|
||||
switch (structure) {
|
||||
case 'array':
|
||||
return castArray(node, typeObj, options);
|
||||
case 'tuple':
|
||||
return castTuple(node, typeObj, options);
|
||||
case 'fields':
|
||||
return castFields(node, typeObj, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
function typesCast(node, types, options){
|
||||
var i$, len$, type, ref$, valueType, value;
|
||||
for (i$ = 0, len$ = types.length; i$ < len$; ++i$) {
|
||||
type = types[i$];
|
||||
ref$ = typeCast(node, type, options), valueType = ref$.type, value = ref$.value;
|
||||
if (valueType === 'Nothing') {
|
||||
continue;
|
||||
}
|
||||
if (parsedTypeCheck([type], value, {
|
||||
customTypes: options.customTypes
|
||||
})) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
throw new Error("Value " + JSON.stringify(node) + " does not type check against " + JSON.stringify(types) + ".");
|
||||
}
|
||||
module.exports = typesCast;
|
||||
}).call(this);
|
||||
285
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/coerce.js
generated
vendored
Normal file
285
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/coerce.js
generated
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
// Generated by LiveScript 1.2.0
|
||||
(function(){
|
||||
var parsedTypeCheck, types, toString$ = {}.toString;
|
||||
parsedTypeCheck = require('type-check').parsedTypeCheck;
|
||||
types = {
|
||||
'*': function(it){
|
||||
switch (toString$.call(it).slice(8, -1)) {
|
||||
case 'Array':
|
||||
return coerceType(it, {
|
||||
type: 'Array'
|
||||
});
|
||||
case 'Object':
|
||||
return coerceType(it, {
|
||||
type: 'Object'
|
||||
});
|
||||
default:
|
||||
return {
|
||||
type: 'Just',
|
||||
value: coerceTypes(it, [
|
||||
{
|
||||
type: 'Undefined'
|
||||
}, {
|
||||
type: 'Null'
|
||||
}, {
|
||||
type: 'NaN'
|
||||
}, {
|
||||
type: 'Boolean'
|
||||
}, {
|
||||
type: 'Number'
|
||||
}, {
|
||||
type: 'Date'
|
||||
}, {
|
||||
type: 'RegExp'
|
||||
}, {
|
||||
type: 'Array'
|
||||
}, {
|
||||
type: 'Object'
|
||||
}, {
|
||||
type: 'String'
|
||||
}
|
||||
], {
|
||||
explicit: true
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
Undefined: function(it){
|
||||
if (it === 'undefined' || it === void 8) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: void 8
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
Null: function(it){
|
||||
if (it === 'null') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: null
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
NaN: function(it){
|
||||
if (it === 'NaN') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: NaN
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
Boolean: function(it){
|
||||
if (it === 'true') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: true
|
||||
};
|
||||
} else if (it === 'false') {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: false
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
},
|
||||
Number: function(it){
|
||||
return {
|
||||
type: 'Just',
|
||||
value: +it
|
||||
};
|
||||
},
|
||||
Int: function(it){
|
||||
return {
|
||||
type: 'Just',
|
||||
value: parseInt(it)
|
||||
};
|
||||
},
|
||||
Float: function(it){
|
||||
return {
|
||||
type: 'Just',
|
||||
value: parseFloat(it)
|
||||
};
|
||||
},
|
||||
Date: function(value, options){
|
||||
var that;
|
||||
if (that = /^\#(.*)\#$/.exec(value)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new Date(+that[1] || that[1])
|
||||
};
|
||||
} else if (options.explicit) {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new Date(+value || value)
|
||||
};
|
||||
}
|
||||
},
|
||||
RegExp: function(value, options){
|
||||
var that;
|
||||
if (that = /^\/(.*)\/([gimy]*)$/.exec(value)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new RegExp(that[1], that[2])
|
||||
};
|
||||
} else if (options.explicit) {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: new RegExp(value)
|
||||
};
|
||||
}
|
||||
},
|
||||
Array: function(it){
|
||||
return coerceArray(it, {
|
||||
of: [{
|
||||
type: '*'
|
||||
}]
|
||||
});
|
||||
},
|
||||
Object: function(it){
|
||||
return coerceFields(it, {
|
||||
of: {}
|
||||
});
|
||||
},
|
||||
String: function(it){
|
||||
var that;
|
||||
if (toString$.call(it).slice(8, -1) !== 'String') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
if (that = it.match(/^'(.*)'$/)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: that[1]
|
||||
};
|
||||
} else if (that = it.match(/^"(.*)"$/)) {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: that[1]
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'Just',
|
||||
value: it
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function coerceArray(node, type){
|
||||
var typeOf, element;
|
||||
if (toString$.call(node).slice(8, -1) !== 'Array') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
typeOf = type.of;
|
||||
return {
|
||||
type: 'Just',
|
||||
value: (function(){
|
||||
var i$, ref$, len$, results$ = [];
|
||||
for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) {
|
||||
element = ref$[i$];
|
||||
results$.push(coerceTypes(element, typeOf));
|
||||
}
|
||||
return results$;
|
||||
}())
|
||||
};
|
||||
}
|
||||
function coerceTuple(node, type){
|
||||
var result, i$, ref$, len$, i, types, that;
|
||||
if (toString$.call(node).slice(8, -1) !== 'Array') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
result = [];
|
||||
for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) {
|
||||
i = i$;
|
||||
types = ref$[i$];
|
||||
if (that = coerceTypes(node[i], types)) {
|
||||
result.push(that);
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'Just',
|
||||
value: result
|
||||
};
|
||||
}
|
||||
function coerceFields(node, type){
|
||||
var typeOf, key, value;
|
||||
if (toString$.call(node).slice(8, -1) !== 'Object') {
|
||||
return {
|
||||
type: 'Nothing'
|
||||
};
|
||||
}
|
||||
typeOf = type.of;
|
||||
return {
|
||||
type: 'Just',
|
||||
value: (function(){
|
||||
var ref$, results$ = {};
|
||||
for (key in ref$ = node) {
|
||||
value = ref$[key];
|
||||
results$[key] = coerceTypes(value, typeOf[key] || [{
|
||||
type: '*'
|
||||
}]);
|
||||
}
|
||||
return results$;
|
||||
}())
|
||||
};
|
||||
}
|
||||
function coerceType(node, typeObj, options){
|
||||
var type, structure, coerceFunc;
|
||||
type = typeObj.type, structure = typeObj.structure;
|
||||
if (type) {
|
||||
coerceFunc = types[type];
|
||||
return coerceFunc(node, options);
|
||||
} else {
|
||||
switch (structure) {
|
||||
case 'array':
|
||||
return coerceArray(node, typeObj);
|
||||
case 'tuple':
|
||||
return coerceTuple(node, typeObj);
|
||||
case 'fields':
|
||||
return coerceFields(node, typeObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
function coerceTypes(node, types, options){
|
||||
var i$, len$, type, ref$, valueType, value;
|
||||
for (i$ = 0, len$ = types.length; i$ < len$; ++i$) {
|
||||
type = types[i$];
|
||||
ref$ = coerceType(node, type, options), valueType = ref$.type, value = ref$.value;
|
||||
if (valueType === 'Nothing') {
|
||||
continue;
|
||||
}
|
||||
if (parsedTypeCheck([type], value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
throw new Error("Value " + JSON.stringify(node) + " does not type check against " + JSON.stringify(types) + ".");
|
||||
}
|
||||
module.exports = coerceTypes;
|
||||
}).call(this);
|
||||
22
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/index.js
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Generated by LiveScript 1.4.0
|
||||
(function(){
|
||||
var parseString, cast, parseType, VERSION, parsedTypeParse, parse;
|
||||
parseString = require('./parse-string');
|
||||
cast = require('./cast');
|
||||
parseType = require('type-check').parseType;
|
||||
VERSION = '0.3.0';
|
||||
parsedTypeParse = function(parsedType, string, options){
|
||||
options == null && (options = {});
|
||||
options.explicit == null && (options.explicit = false);
|
||||
options.customTypes == null && (options.customTypes = {});
|
||||
return cast(parseString(parsedType, string, options), parsedType, options);
|
||||
};
|
||||
parse = function(type, string, options){
|
||||
return parsedTypeParse(parseType(type), string, options);
|
||||
};
|
||||
module.exports = {
|
||||
VERSION: VERSION,
|
||||
parse: parse,
|
||||
parsedTypeParse: parsedTypeParse
|
||||
};
|
||||
}).call(this);
|
||||
113
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/parse-string.js
generated
vendored
Normal file
113
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/parse-string.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
// Generated by LiveScript 1.4.0
|
||||
(function(){
|
||||
var reject, special, tokenRegex;
|
||||
reject = require('prelude-ls').reject;
|
||||
function consumeOp(tokens, op){
|
||||
if (tokens[0] === op) {
|
||||
return tokens.shift();
|
||||
} else {
|
||||
throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + ".");
|
||||
}
|
||||
}
|
||||
function maybeConsumeOp(tokens, op){
|
||||
if (tokens[0] === op) {
|
||||
return tokens.shift();
|
||||
}
|
||||
}
|
||||
function consumeList(tokens, arg$, hasDelimiters){
|
||||
var open, close, result, untilTest;
|
||||
open = arg$[0], close = arg$[1];
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, open);
|
||||
}
|
||||
result = [];
|
||||
untilTest = "," + (hasDelimiters ? close : '');
|
||||
while (tokens.length && (hasDelimiters && tokens[0] !== close)) {
|
||||
result.push(consumeElement(tokens, untilTest));
|
||||
maybeConsumeOp(tokens, ',');
|
||||
}
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, close);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function consumeArray(tokens, hasDelimiters){
|
||||
return consumeList(tokens, ['[', ']'], hasDelimiters);
|
||||
}
|
||||
function consumeTuple(tokens, hasDelimiters){
|
||||
return consumeList(tokens, ['(', ')'], hasDelimiters);
|
||||
}
|
||||
function consumeFields(tokens, hasDelimiters){
|
||||
var result, untilTest, key;
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, '{');
|
||||
}
|
||||
result = {};
|
||||
untilTest = "," + (hasDelimiters ? '}' : '');
|
||||
while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) {
|
||||
key = consumeValue(tokens, ':');
|
||||
consumeOp(tokens, ':');
|
||||
result[key] = consumeElement(tokens, untilTest);
|
||||
maybeConsumeOp(tokens, ',');
|
||||
}
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, '}');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function consumeValue(tokens, untilTest){
|
||||
var out;
|
||||
untilTest == null && (untilTest = '');
|
||||
out = '';
|
||||
while (tokens.length && -1 === untilTest.indexOf(tokens[0])) {
|
||||
out += tokens.shift();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function consumeElement(tokens, untilTest){
|
||||
switch (tokens[0]) {
|
||||
case '[':
|
||||
return consumeArray(tokens, true);
|
||||
case '(':
|
||||
return consumeTuple(tokens, true);
|
||||
case '{':
|
||||
return consumeFields(tokens, true);
|
||||
default:
|
||||
return consumeValue(tokens, untilTest);
|
||||
}
|
||||
}
|
||||
function consumeTopLevel(tokens, types, options){
|
||||
var ref$, type, structure, origTokens, result, finalResult, x$, y$;
|
||||
ref$ = types[0], type = ref$.type, structure = ref$.structure;
|
||||
origTokens = tokens.concat();
|
||||
if (!options.explicit && types.length === 1 && ((!type && structure) || (type === 'Array' || type === 'Object'))) {
|
||||
result = structure === 'array' || type === 'Array'
|
||||
? consumeArray(tokens, tokens[0] === '[')
|
||||
: structure === 'tuple'
|
||||
? consumeTuple(tokens, tokens[0] === '(')
|
||||
: consumeFields(tokens, tokens[0] === '{');
|
||||
finalResult = tokens.length ? consumeElement(structure === 'array' || type === 'Array'
|
||||
? (x$ = origTokens, x$.unshift('['), x$.push(']'), x$)
|
||||
: (y$ = origTokens, y$.unshift('('), y$.push(')'), y$)) : result;
|
||||
} else {
|
||||
finalResult = consumeElement(tokens);
|
||||
}
|
||||
return finalResult;
|
||||
}
|
||||
special = /\[\]\(\)}{:,/.source;
|
||||
tokenRegex = RegExp('("(?:\\\\"|[^"])*")|(\'(?:\\\\\'|[^\'])*\')|(/(?:\\\\/|[^/])*/[a-zA-Z]*)|(#.*#)|([' + special + '])|([^\\s' + special + '](?:\\s*[^\\s' + special + ']+)*)|\\s*');
|
||||
module.exports = function(types, string, options){
|
||||
var tokens, node;
|
||||
options == null && (options = {});
|
||||
if (!options.explicit && types.length === 1 && types[0].type === 'String') {
|
||||
return "'" + string.replace(/\\'/g, "\\\\'") + "'";
|
||||
}
|
||||
tokens = reject(not$, string.split(tokenRegex));
|
||||
node = consumeTopLevel(tokens, types, options);
|
||||
if (!node) {
|
||||
throw new Error("Error parsing '" + string + "'.");
|
||||
}
|
||||
return node;
|
||||
};
|
||||
function not$(x){ return !x; }
|
||||
}).call(this);
|
||||
102
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/parse.js
generated
vendored
Normal file
102
static/js/ketcher2/node_modules/istanbul/node_modules/levn/lib/parse.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
// Generated by LiveScript 1.2.0
|
||||
(function(){
|
||||
var reject, special, tokenRegex;
|
||||
reject = require('prelude-ls').reject;
|
||||
function consumeOp(tokens, op){
|
||||
if (tokens[0] === op) {
|
||||
return tokens.shift();
|
||||
} else {
|
||||
throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + ".");
|
||||
}
|
||||
}
|
||||
function maybeConsumeOp(tokens, op){
|
||||
if (tokens[0] === op) {
|
||||
return tokens.shift();
|
||||
}
|
||||
}
|
||||
function consumeList(tokens, delimiters, hasDelimiters){
|
||||
var result;
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, delimiters[0]);
|
||||
}
|
||||
result = [];
|
||||
while (tokens.length && tokens[0] !== delimiters[1]) {
|
||||
result.push(consumeElement(tokens));
|
||||
maybeConsumeOp(tokens, ',');
|
||||
}
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, delimiters[1]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function consumeArray(tokens, hasDelimiters){
|
||||
return consumeList(tokens, ['[', ']'], hasDelimiters);
|
||||
}
|
||||
function consumeTuple(tokens, hasDelimiters){
|
||||
return consumeList(tokens, ['(', ')'], hasDelimiters);
|
||||
}
|
||||
function consumeFields(tokens, hasDelimiters){
|
||||
var result, key;
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, '{');
|
||||
}
|
||||
result = {};
|
||||
while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) {
|
||||
key = tokens.shift();
|
||||
consumeOp(tokens, ':');
|
||||
result[key] = consumeElement(tokens);
|
||||
maybeConsumeOp(tokens, ',');
|
||||
}
|
||||
if (hasDelimiters) {
|
||||
consumeOp(tokens, '}');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function consumeElement(tokens){
|
||||
switch (tokens[0]) {
|
||||
case '[':
|
||||
return consumeArray(tokens, true);
|
||||
case '(':
|
||||
return consumeTuple(tokens, true);
|
||||
case '{':
|
||||
return consumeFields(tokens, true);
|
||||
default:
|
||||
return tokens.shift();
|
||||
}
|
||||
}
|
||||
function consumeTopLevel(tokens, types){
|
||||
var ref$, type, structure, origTokens, result, finalResult, x$, y$;
|
||||
ref$ = types[0], type = ref$.type, structure = ref$.structure;
|
||||
origTokens = tokens.concat();
|
||||
if (types.length === 1 && (structure || (type === 'Array' || type === 'Object'))) {
|
||||
result = structure === 'array' || type === 'Array'
|
||||
? consumeArray(tokens, tokens[0] === '[')
|
||||
: structure === 'tuple'
|
||||
? consumeTuple(tokens, tokens[0] === '(')
|
||||
: consumeFields(tokens, tokens[0] === '{');
|
||||
finalResult = tokens.length ? consumeElement(structure === 'array' || type === 'Array'
|
||||
? (x$ = origTokens, x$.unshift('['), x$.push(']'), x$)
|
||||
: (y$ = origTokens, y$.unshift('('), y$.push(')'), y$)) : result;
|
||||
} else {
|
||||
finalResult = consumeElement(tokens);
|
||||
}
|
||||
if (tokens.length && origTokens.length) {
|
||||
throw new Error("Unable to parse " + JSON.stringify(origTokens) + " of type " + JSON.stringify(types) + ".");
|
||||
} else {
|
||||
return finalResult;
|
||||
}
|
||||
}
|
||||
special = /\[\]\(\)}{:,/.source;
|
||||
tokenRegex = RegExp('("(?:[^"]|\\\\")*")|(\'(?:[^\']|\\\\\')*\')|(#.*#)|(/(?:\\\\/|[^/])*/[gimy]*)|([' + special + '])|([^\\s' + special + ']+)|\\s*');
|
||||
module.exports = function(string, types){
|
||||
var tokens, node;
|
||||
tokens = reject(function(it){
|
||||
return !it || /^\s+$/.test(it);
|
||||
}, string.split(tokenRegex));
|
||||
node = consumeTopLevel(tokens, types);
|
||||
if (!node) {
|
||||
throw new Error("Error parsing '" + string + "'.");
|
||||
}
|
||||
return node;
|
||||
};
|
||||
}).call(this);
|
||||
77
static/js/ketcher2/node_modules/istanbul/node_modules/levn/package.json
generated
vendored
Normal file
77
static/js/ketcher2/node_modules/istanbul/node_modules/levn/package.json
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"_from": "levn@~0.3.0",
|
||||
"_id": "levn@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
|
||||
"_location": "/istanbul/levn",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "levn@~0.3.0",
|
||||
"name": "levn",
|
||||
"escapedName": "levn",
|
||||
"rawSpec": "~0.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul/optionator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
|
||||
"_shasum": "3b09924edf9f083c0490fdd4c0bc4421e04764ee",
|
||||
"_spec": "levn@~0.3.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul/node_modules/optionator",
|
||||
"author": {
|
||||
"name": "George Zahariev",
|
||||
"email": "z@georgezahariev.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/gkz/levn/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"prelude-ls": "~1.1.2",
|
||||
"type-check": "~0.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Light ECMAScript (JavaScript) Value Notation - human written, concise, typed, flexible",
|
||||
"devDependencies": {
|
||||
"istanbul": "~0.4.1",
|
||||
"livescript": "~1.4.0",
|
||||
"mocha": "~2.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/gkz/levn",
|
||||
"keywords": [
|
||||
"levn",
|
||||
"light",
|
||||
"ecmascript",
|
||||
"value",
|
||||
"notation",
|
||||
"json",
|
||||
"typed",
|
||||
"human",
|
||||
"concise",
|
||||
"typed",
|
||||
"flexible"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/",
|
||||
"name": "levn",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/gkz/levn.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
||||
52
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/CHANGELOG.md
generated
vendored
Normal file
52
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
# 0.8.2
|
||||
- fix bug #18 - detect missing value when flag is last item
|
||||
- update dependencies
|
||||
|
||||
# 0.8.1
|
||||
- update `fast-levenshtein` dependency
|
||||
|
||||
# 0.8.0
|
||||
- update `levn` dependency - supplying a float value to an option with type `Int` now throws an error, instead of silently converting to an `Int`
|
||||
|
||||
# 0.7.1
|
||||
- fix bug with use of `defaults` and `concatRepeatedArrays` or `mergeRepeatedObjects`
|
||||
|
||||
# 0.7.0
|
||||
- added `concatrepeatedarrays` option: `oneValuePerFlag`, only allows one array value per flag
|
||||
- added `typeAliases` option
|
||||
- added `parseArgv` which takes an array and parses with the first two items sliced off
|
||||
- changed enum help style
|
||||
- bug fixes (#12)
|
||||
- use of `concatRepeatedArrays` and `mergeRepeatedObjects` at the top level is deprecated, use it as either a per-option option, or set them in the `defaults` object to set them for all objects
|
||||
|
||||
# 0.6.0
|
||||
- added `defaults` lib-option flag, allowing one to set default properties for all options
|
||||
- added `concatRepeatedArrays` and `mergeRepeatedObjects` as option level properties, allowing you to turn this feature on for specific options only
|
||||
|
||||
# 0.5.0
|
||||
- `Boolean` flags with `default: 'true'`, and no short aliases, will by default show the `--no` version in help
|
||||
|
||||
# 0.4.0
|
||||
- add `mergeRepeatedObjects` setting
|
||||
|
||||
# 0.3.0
|
||||
- add `concatRepeatedArrays` setting
|
||||
- add `overrideRequired` option setting
|
||||
- use just Levenshtein string compare algo rather than Levenshtein Damerau to due dependency license issue
|
||||
|
||||
# 0.2.2
|
||||
- bug fixes
|
||||
|
||||
# 0.2.1
|
||||
- improved interpolation
|
||||
- added changelog
|
||||
|
||||
# 0.2.0
|
||||
- add dependency checks to options - added `dependsOn` as an option property
|
||||
- add interpolation for `prepend` and `append` text with new `generateHelp` option, `interpolate`
|
||||
|
||||
# 0.1.1
|
||||
- update dependencies
|
||||
|
||||
# 0.1.0
|
||||
- initial release
|
||||
22
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) George Zahariev
|
||||
|
||||
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.
|
||||
236
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/README.md
generated
vendored
Normal file
236
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/README.md
generated
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
# Optionator
|
||||
<a name="optionator" />
|
||||
|
||||
Optionator is a JavaScript option parsing and help generation library used by [eslint](http://eslint.org), [Grasp](http://graspjs.com), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and [many more](https://www.npmjs.com/browse/depended/optionator).
|
||||
|
||||
For an online demo, check out the [Grasp online demo](http://www.graspjs.com/#demo).
|
||||
|
||||
[About](#about) · [Usage](#usage) · [Settings Format](#settings-format) · [Argument Format](#argument-format)
|
||||
|
||||
## Why?
|
||||
The problem with other option parsers, such as `yargs` or `minimist`, is they just accept all input, valid or not.
|
||||
With Optionator, if you mistype an option, it will give you an error (with a suggestion for what you meant).
|
||||
If you give the wrong type of argument for an option, it will give you an error rather than supplying the wrong input to your application.
|
||||
|
||||
$ cmd --halp
|
||||
Invalid option '--halp' - perhaps you meant '--help'?
|
||||
|
||||
$ cmd --count str
|
||||
Invalid value for option 'count' - expected type Int, received value: str.
|
||||
|
||||
Other helpful features include reformatting the help text based on the size of the console, so that it fits even if the console is narrow, and accepting not just an array (eg. process.argv), but a string or object as well, making things like testing much easier.
|
||||
|
||||
## About
|
||||
Optionator uses [type-check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) behind the scenes to cast and verify input according the specified types.
|
||||
|
||||
MIT license. Version 0.8.2
|
||||
|
||||
npm install optionator
|
||||
|
||||
For updates on Optionator, [follow me on twitter](https://twitter.com/gkzahariev).
|
||||
|
||||
## Usage
|
||||
`require('optionator');` returns a function. It has one property, `VERSION`, the current version of the library as a string. This function is called with an object specifying your options and other information, see the [settings format section](#settings-format). This in turn returns an object with three properties, `parse`, `parseArgv`, `generateHelp`, and `generateHelpForOption`, which are all functions.
|
||||
|
||||
```js
|
||||
var optionator = require('optionator')({
|
||||
prepend: 'Usage: cmd [options]',
|
||||
append: 'Version 1.0.0',
|
||||
options: [{
|
||||
option: 'help',
|
||||
alias: 'h',
|
||||
type: 'Boolean',
|
||||
description: 'displays help'
|
||||
}, {
|
||||
option: 'count',
|
||||
alias: 'c',
|
||||
type: 'Int',
|
||||
description: 'number of things',
|
||||
example: 'cmd --count 2'
|
||||
}]
|
||||
});
|
||||
|
||||
var options = optionator.parseArgv(process.argv);
|
||||
if (options.help) {
|
||||
console.log(optionator.generateHelp());
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
### parse(input, parseOptions)
|
||||
`parse` processes the `input` according to your settings, and returns an object with the results.
|
||||
|
||||
##### arguments
|
||||
* input - `[String] | Object | String` - the input you wish to parse
|
||||
* parseOptions - `{slice: Int}` - all options optional
|
||||
- `slice` specifies how much to slice away from the beginning if the input is an array or string - by default `0` for string, `2` for array (works with `process.argv`)
|
||||
|
||||
##### returns
|
||||
`Object` - the parsed options, each key is a camelCase version of the option name (specified in dash-case), and each value is the processed value for that option. Positional values are in an array under the `_` key.
|
||||
|
||||
##### example
|
||||
```js
|
||||
parse(['node', 't.js', '--count', '2', 'positional']); // {count: 2, _: ['positional']}
|
||||
parse('--count 2 positional'); // {count: 2, _: ['positional']}
|
||||
parse({count: 2, _:['positional']}); // {count: 2, _: ['positional']}
|
||||
```
|
||||
|
||||
### parseArgv(input)
|
||||
`parseArgv` works exactly like `parse`, but only for array input and it slices off the first two elements.
|
||||
|
||||
##### arguments
|
||||
* input - `[String]` - the input you wish to parse
|
||||
|
||||
##### returns
|
||||
See "returns" section in "parse"
|
||||
|
||||
##### example
|
||||
```js
|
||||
parseArgv(process.argv);
|
||||
```
|
||||
|
||||
### generateHelp(helpOptions)
|
||||
`generateHelp` produces help text based on your settings.
|
||||
|
||||
##### arguments
|
||||
* helpOptions - `{showHidden: Boolean, interpolate: Object}` - all options optional
|
||||
- `showHidden` specifies whether to show options with `hidden: true` specified, by default it is `false`
|
||||
- `interpolate` specify data to be interpolated in `prepend` and `append` text, `{{key}}` is the format - eg. `generateHelp({interpolate:{version: '0.4.2'}})`, will change this `append` text: `Version {{version}}` to `Version 0.4.2`
|
||||
|
||||
##### returns
|
||||
`String` - the generated help text
|
||||
|
||||
##### example
|
||||
```js
|
||||
generateHelp(); /*
|
||||
"Usage: cmd [options] positional
|
||||
|
||||
-h, --help displays help
|
||||
-c, --count Int number of things
|
||||
|
||||
Version 1.0.0
|
||||
"*/
|
||||
```
|
||||
|
||||
### generateHelpForOption(optionName)
|
||||
`generateHelpForOption` produces expanded help text for the specified with `optionName` option. If an `example` was specified for the option, it will be displayed, and if a `longDescription` was specified, it will display that instead of the `description`.
|
||||
|
||||
##### arguments
|
||||
* optionName - `String` - the name of the option to display
|
||||
|
||||
##### returns
|
||||
`String` - the generated help text for the option
|
||||
|
||||
##### example
|
||||
```js
|
||||
generateHelpForOption('count'); /*
|
||||
"-c, --count Int
|
||||
description: number of things
|
||||
example: cmd --count 2
|
||||
"*/
|
||||
```
|
||||
|
||||
## Settings Format
|
||||
When your `require('optionator')`, you get a function that takes in a settings object. This object has the type:
|
||||
|
||||
{
|
||||
prepend: String,
|
||||
append: String,
|
||||
options: [{heading: String} | {
|
||||
option: String,
|
||||
alias: [String] | String,
|
||||
type: String,
|
||||
enum: [String],
|
||||
default: String,
|
||||
restPositional: Boolean,
|
||||
required: Boolean,
|
||||
overrideRequired: Boolean,
|
||||
dependsOn: [String] | String,
|
||||
concatRepeatedArrays: Boolean | (Boolean, Object),
|
||||
mergeRepeatedObjects: Boolean,
|
||||
description: String,
|
||||
longDescription: String,
|
||||
example: [String] | String
|
||||
}],
|
||||
helpStyle: {
|
||||
aliasSeparator: String,
|
||||
typeSeparator: String,
|
||||
descriptionSeparator: String,
|
||||
initialIndent: Int,
|
||||
secondaryIndent: Int,
|
||||
maxPadFactor: Number
|
||||
},
|
||||
mutuallyExclusive: [[String | [String]]],
|
||||
concatRepeatedArrays: Boolean | (Boolean, Object), // deprecated, set in defaults object
|
||||
mergeRepeatedObjects: Boolean, // deprecated, set in defaults object
|
||||
positionalAnywhere: Boolean,
|
||||
typeAliases: Object,
|
||||
defaults: Object
|
||||
}
|
||||
|
||||
All of the properties are optional (the `Maybe` has been excluded for brevities sake), except for having either `heading: String` or `option: String` in each object in the `options` array.
|
||||
|
||||
### Top Level Properties
|
||||
* `prepend` is an optional string to be placed before the options in the help text
|
||||
* `append` is an optional string to be placed after the options in the help text
|
||||
* `options` is a required array specifying your options and headings, the options and headings will be displayed in the order specified
|
||||
* `helpStyle` is an optional object which enables you to change the default appearance of some aspects of the help text
|
||||
* `mutuallyExclusive` is an optional array of arrays of either strings or arrays of strings. The top level array is a list of rules, each rule is a list of elements - each element can be either a string (the name of an option), or a list of strings (a group of option names) - there will be an error if more than one element is present
|
||||
* `concatRepeatedArrays` see description under the "Option Properties" heading - use at the top level is deprecated, if you want to set this for all options, use the `defaults` property
|
||||
* `mergeRepeatedObjects` see description under the "Option Properties" heading - use at the top level is deprecated, if you want to set this for all options, use the `defaults` property
|
||||
* `positionalAnywhere` is an optional boolean (defaults to `true`) - when `true` it allows positional arguments anywhere, when `false`, all arguments after the first positional one are taken to be positional as well, even if they look like a flag. For example, with `positionalAnywhere: false`, the arguments `--flag --boom 12 --crack` would have two positional arguments: `12` and `--crack`
|
||||
* `typeAliases` is an optional object, it allows you to set aliases for types, eg. `{Path: 'String'}` would allow you to use the type `Path` as an alias for the type `String`
|
||||
* `defaults` is an optional object following the option properties format, which specifies default values for all options. A default will be overridden if manually set. For example, you can do `default: { type: "String" }` to set the default type of all options to `String`, and then override that default in an individual option by setting the `type` property
|
||||
|
||||
#### Heading Properties
|
||||
* `heading` a required string, the name of the heading
|
||||
|
||||
#### Option Properties
|
||||
* `option` the required name of the option - use dash-case, without the leading dashes
|
||||
* `alias` is an optional string or array of strings which specify any aliases for the option
|
||||
* `type` is a required string in the [type check](https://github.com/gkz/type-check) [format](https://github.com/gkz/type-check#type-format), this will be used to cast the inputted value and validate it
|
||||
* `enum` is an optional array of strings, each string will be parsed by [levn](https://github.com/gkz/levn) - the argument value must be one of the resulting values - each potential value must validate against the specified `type`
|
||||
* `default` is a optional string, which will be parsed by [levn](https://github.com/gkz/levn) and used as the default value if none is set - the value must validate against the specified `type`
|
||||
* `restPositional` is an optional boolean - if set to `true`, everything after the option will be taken to be a positional argument, even if it looks like a named argument
|
||||
* `required` is an optional boolean - if set to `true`, the option parsing will fail if the option is not defined
|
||||
* `overrideRequired` is a optional boolean - if set to `true` and the option is used, and there is another option which is required but not set, it will override the need for the required option and there will be no error - this is useful if you have required options and want to use `--help` or `--version` flags
|
||||
* `concatRepeatedArrays` is an optional boolean or tuple with boolean and options object (defaults to `false`) - when set to `true` and an option contains an array value and is repeated, the subsequent values for the flag will be appended rather than overwriting the original value - eg. option `g` of type `[String]`: `-g a -g b -g c,d` will result in `['a','b','c','d']`
|
||||
|
||||
You can supply an options object by giving the following value: `[true, options]`. The one currently supported option is `oneValuePerFlag`, this only allows one array value per flag. This is useful if your potential values contain a comma.
|
||||
* `mergeRepeatedObjects` is an optional boolean (defaults to `false`) - when set to `true` and an option contains an object value and is repeated, the subsequent values for the flag will be merged rather than overwriting the original value - eg. option `g` of type `Object`: `-g a:1 -g b:2 -g c:3,d:4` will result in `{a: 1, b: 2, c: 3, d: 4}`
|
||||
* `dependsOn` is an optional string or array of strings - if simply a string (the name of another option), it will make sure that that other option is set, if an array of strings, depending on whether `'and'` or `'or'` is first, it will either check whether all (`['and', 'option-a', 'option-b']`), or at least one (`['or', 'option-a', 'option-b']`) other options are set
|
||||
* `description` is an optional string, which will be displayed next to the option in the help text
|
||||
* `longDescription` is an optional string, it will be displayed instead of the `description` when `generateHelpForOption` is used
|
||||
* `example` is an optional string or array of strings with example(s) for the option - these will be displayed when `generateHelpForOption` is used
|
||||
|
||||
#### Help Style Properties
|
||||
* `aliasSeparator` is an optional string, separates multiple names from each other - default: ' ,'
|
||||
* `typeSeparator` is an optional string, separates the type from the names - default: ' '
|
||||
* `descriptionSeparator` is an optional string , separates the description from the padded name and type - default: ' '
|
||||
* `initialIndent` is an optional int - the amount of indent for options - default: 2
|
||||
* `secondaryIndent` is an optional int - the amount of indent if wrapped fully (in addition to the initial indent) - default: 4
|
||||
* `maxPadFactor` is an optional number - affects the default level of padding for the names/type, it is multiplied by the average of the length of the names/type - default: 1.5
|
||||
|
||||
## Argument Format
|
||||
At the highest level there are two types of arguments: named, and positional.
|
||||
|
||||
Name arguments of any length are prefixed with `--` (eg. `--go`), and those of one character may be prefixed with either `--` or `-` (eg. `-g`).
|
||||
|
||||
There are two types of named arguments: boolean flags (eg. `--problemo`, `-p`) which take no value and result in a `true` if they are present, the falsey `undefined` if they are not present, or `false` if present and explicitly prefixed with `no` (eg. `--no-problemo`). Named arguments with values (eg. `--tseries 800`, `-t 800`) are the other type. If the option has a type `Boolean` it will automatically be made into a boolean flag. Any other type results in a named argument that takes a value.
|
||||
|
||||
For more information about how to properly set types to get the value you want, take a look at the [type check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) pages.
|
||||
|
||||
You can group single character arguments that use a single `-`, however all except the last must be boolean flags (which take no value). The last may be a boolean flag, or an argument which takes a value - eg. `-ba 2` is equivalent to `-b -a 2`.
|
||||
|
||||
Positional arguments are all those values which do not fall under the above - they can be anywhere, not just at the end. For example, in `cmd -b one -a 2 two` where `b` is a boolean flag, and `a` has the type `Number`, there are two positional arguments, `one` and `two`.
|
||||
|
||||
Everything after an `--` is positional, even if it looks like a named argument.
|
||||
|
||||
You may optionally use `=` to separate option names from values, for example: `--count=2`.
|
||||
|
||||
If you specify the option `NUM`, then any argument using a single `-` followed by a number will be valid and will set the value of `NUM`. Eg. `-2` will be parsed into `NUM: 2`.
|
||||
|
||||
If duplicate named arguments are present, the last one will be taken.
|
||||
|
||||
## Technical About
|
||||
`optionator` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [levn](https://github.com/gkz/levn) to cast arguments to their specified type, and uses [type-check](https://github.com/gkz/type-check) to validate values. It also uses the [prelude.ls](http://preludels.com/) library.
|
||||
247
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/lib/help.js
generated
vendored
Normal file
247
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/lib/help.js
generated
vendored
Normal file
@ -0,0 +1,247 @@
|
||||
// Generated by LiveScript 1.5.0
|
||||
(function(){
|
||||
var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp;
|
||||
ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines;
|
||||
ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin;
|
||||
wordwrap = require('wordwrap');
|
||||
getPreText = function(option, arg$, maxWidth){
|
||||
var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, wrap;
|
||||
mainName = option.option, shortNames = (ref$ = option.shortNames) != null
|
||||
? ref$
|
||||
: [], longNames = (ref$ = option.longNames) != null
|
||||
? ref$
|
||||
: [], type = option.type, description = option.description;
|
||||
aliasSeparator = arg$.aliasSeparator, typeSeparator = arg$.typeSeparator, initialIndent = arg$.initialIndent;
|
||||
if (option.negateName) {
|
||||
mainName = "no-" + mainName;
|
||||
if (longNames) {
|
||||
longNames = map(function(it){
|
||||
return "no-" + it;
|
||||
}, longNames);
|
||||
}
|
||||
}
|
||||
names = mainName.length === 1
|
||||
? [mainName].concat(shortNames, longNames)
|
||||
: shortNames.concat([mainName], longNames);
|
||||
namesString = map(nameToRaw, names).join(aliasSeparator);
|
||||
namesStringLen = namesString.length;
|
||||
typeSeparatorString = mainName === 'NUM' ? '::' : typeSeparator;
|
||||
typeSeparatorStringLen = typeSeparatorString.length;
|
||||
if (maxWidth != null && !option.boolean && initialIndent + namesStringLen + typeSeparatorStringLen + type.length > maxWidth) {
|
||||
wrap = wordwrap(initialIndent + namesStringLen + typeSeparatorStringLen, maxWidth);
|
||||
return namesString + "" + typeSeparatorString + wrap(type).replace(/^\s+/, '');
|
||||
} else {
|
||||
return namesString + "" + (option.boolean
|
||||
? ''
|
||||
: typeSeparatorString + "" + type);
|
||||
}
|
||||
};
|
||||
setHelpStyleDefaults = function(helpStyle){
|
||||
helpStyle.aliasSeparator == null && (helpStyle.aliasSeparator = ', ');
|
||||
helpStyle.typeSeparator == null && (helpStyle.typeSeparator = ' ');
|
||||
helpStyle.descriptionSeparator == null && (helpStyle.descriptionSeparator = ' ');
|
||||
helpStyle.initialIndent == null && (helpStyle.initialIndent = 2);
|
||||
helpStyle.secondaryIndent == null && (helpStyle.secondaryIndent = 4);
|
||||
helpStyle.maxPadFactor == null && (helpStyle.maxPadFactor = 1.5);
|
||||
};
|
||||
generateHelpForOption = function(getOption, arg$){
|
||||
var stdout, helpStyle, ref$;
|
||||
stdout = arg$.stdout, helpStyle = (ref$ = arg$.helpStyle) != null
|
||||
? ref$
|
||||
: {};
|
||||
setHelpStyleDefaults(helpStyle);
|
||||
return function(optionName){
|
||||
var maxWidth, wrap, option, e, pre, defaultString, restPositionalString, description, fullDescription, that, preDescription, descriptionString, exampleString, examples, seperator;
|
||||
maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
|
||||
wrap = maxWidth ? wordwrap(maxWidth) : id;
|
||||
try {
|
||||
option = getOption(dasherize(optionName));
|
||||
} catch (e$) {
|
||||
e = e$;
|
||||
return e.message;
|
||||
}
|
||||
pre = getPreText(option, helpStyle);
|
||||
defaultString = option['default'] && !option.negateName ? "\ndefault: " + option['default'] : '';
|
||||
restPositionalString = option.restPositional ? 'Everything after this option is considered a positional argument, even if it looks like an option.' : '';
|
||||
description = option.longDescription || option.description && sentencize(option.description);
|
||||
fullDescription = description && restPositionalString
|
||||
? description + " " + restPositionalString
|
||||
: (that = description || restPositionalString) ? that : '';
|
||||
preDescription = 'description:';
|
||||
descriptionString = !fullDescription
|
||||
? ''
|
||||
: maxWidth && fullDescription.length - 1 - preDescription.length > maxWidth
|
||||
? "\n" + preDescription + "\n" + wrap(fullDescription)
|
||||
: "\n" + preDescription + " " + fullDescription;
|
||||
exampleString = (that = option.example) ? (examples = [].concat(that), examples.length > 1
|
||||
? "\nexamples:\n" + unlines(examples)
|
||||
: "\nexample: " + examples[0]) : '';
|
||||
seperator = defaultString || descriptionString || exampleString ? "\n" + repeatString$('=', pre.length) : '';
|
||||
return pre + "" + seperator + defaultString + descriptionString + exampleString;
|
||||
};
|
||||
};
|
||||
generateHelp = function(arg$){
|
||||
var options, prepend, append, helpStyle, ref$, stdout, aliasSeparator, typeSeparator, descriptionSeparator, maxPadFactor, initialIndent, secondaryIndent;
|
||||
options = arg$.options, prepend = arg$.prepend, append = arg$.append, helpStyle = (ref$ = arg$.helpStyle) != null
|
||||
? ref$
|
||||
: {}, stdout = arg$.stdout;
|
||||
setHelpStyleDefaults(helpStyle);
|
||||
aliasSeparator = helpStyle.aliasSeparator, typeSeparator = helpStyle.typeSeparator, descriptionSeparator = helpStyle.descriptionSeparator, maxPadFactor = helpStyle.maxPadFactor, initialIndent = helpStyle.initialIndent, secondaryIndent = helpStyle.secondaryIndent;
|
||||
return function(arg$){
|
||||
var ref$, showHidden, interpolate, maxWidth, output, out, data, optionCount, totalPreLen, preLens, i$, len$, item, that, pre, descParts, desc, preLen, sortedPreLens, maxPreLen, preLenMean, x, padAmount, descSepLen, fullWrapCount, partialWrapCount, descLen, totalLen, initialSpace, wrapAllFull, i, wrap;
|
||||
ref$ = arg$ != null
|
||||
? arg$
|
||||
: {}, showHidden = ref$.showHidden, interpolate = ref$.interpolate;
|
||||
maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
|
||||
output = [];
|
||||
out = function(it){
|
||||
return output.push(it != null ? it : '');
|
||||
};
|
||||
if (prepend) {
|
||||
out(interpolate ? interp(prepend, interpolate) : prepend);
|
||||
out();
|
||||
}
|
||||
data = [];
|
||||
optionCount = 0;
|
||||
totalPreLen = 0;
|
||||
preLens = [];
|
||||
for (i$ = 0, len$ = (ref$ = options).length; i$ < len$; ++i$) {
|
||||
item = ref$[i$];
|
||||
if (showHidden || !item.hidden) {
|
||||
if (that = item.heading) {
|
||||
data.push({
|
||||
type: 'heading',
|
||||
value: that
|
||||
});
|
||||
} else {
|
||||
pre = getPreText(item, helpStyle, maxWidth);
|
||||
descParts = [];
|
||||
if ((that = item.description) != null) {
|
||||
descParts.push(that);
|
||||
}
|
||||
if (that = item['enum']) {
|
||||
descParts.push("either: " + naturalJoin(that));
|
||||
}
|
||||
if (item['default'] && !item.negateName) {
|
||||
descParts.push("default: " + item['default']);
|
||||
}
|
||||
desc = descParts.join(' - ');
|
||||
data.push({
|
||||
type: 'option',
|
||||
pre: pre,
|
||||
desc: desc,
|
||||
descLen: desc.length
|
||||
});
|
||||
preLen = pre.length;
|
||||
optionCount++;
|
||||
totalPreLen += preLen;
|
||||
preLens.push(preLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
sortedPreLens = sort(preLens);
|
||||
maxPreLen = sortedPreLens[sortedPreLens.length - 1];
|
||||
preLenMean = initialIndent + totalPreLen / optionCount;
|
||||
x = optionCount > 2 ? min(preLenMean * maxPadFactor, maxPreLen) : maxPreLen;
|
||||
for (i$ = sortedPreLens.length - 1; i$ >= 0; --i$) {
|
||||
preLen = sortedPreLens[i$];
|
||||
if (preLen <= x) {
|
||||
padAmount = preLen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
descSepLen = descriptionSeparator.length;
|
||||
if (maxWidth != null) {
|
||||
fullWrapCount = 0;
|
||||
partialWrapCount = 0;
|
||||
for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
|
||||
item = data[i$];
|
||||
if (item.type === 'option') {
|
||||
pre = item.pre, desc = item.desc, descLen = item.descLen;
|
||||
if (descLen === 0) {
|
||||
item.wrap = 'none';
|
||||
} else {
|
||||
preLen = max(padAmount, pre.length) + initialIndent + descSepLen;
|
||||
totalLen = preLen + descLen;
|
||||
if (totalLen > maxWidth) {
|
||||
if (descLen / 2.5 > maxWidth - preLen) {
|
||||
fullWrapCount++;
|
||||
item.wrap = 'full';
|
||||
} else {
|
||||
partialWrapCount++;
|
||||
item.wrap = 'partial';
|
||||
}
|
||||
} else {
|
||||
item.wrap = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initialSpace = repeatString$(' ', initialIndent);
|
||||
wrapAllFull = optionCount > 1 && fullWrapCount + partialWrapCount * 0.5 > optionCount * 0.5;
|
||||
for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
|
||||
i = i$;
|
||||
item = data[i$];
|
||||
if (item.type === 'heading') {
|
||||
if (i !== 0) {
|
||||
out();
|
||||
}
|
||||
out(item.value + ":");
|
||||
} else {
|
||||
pre = item.pre, desc = item.desc, descLen = item.descLen, wrap = item.wrap;
|
||||
if (maxWidth != null) {
|
||||
if (wrapAllFull || wrap === 'full') {
|
||||
wrap = wordwrap(initialIndent + secondaryIndent, maxWidth);
|
||||
out(initialSpace + "" + pre + "\n" + wrap(desc));
|
||||
continue;
|
||||
} else if (wrap === 'partial') {
|
||||
wrap = wordwrap(initialIndent + descSepLen + max(padAmount, pre.length), maxWidth);
|
||||
out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + wrap(desc).replace(/^\s+/, ''));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (descLen === 0) {
|
||||
out(initialSpace + "" + pre);
|
||||
} else {
|
||||
out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (append) {
|
||||
out();
|
||||
out(interpolate ? interp(append, interpolate) : append);
|
||||
}
|
||||
return unlines(output);
|
||||
};
|
||||
};
|
||||
function pad(str, num){
|
||||
var len, padAmount;
|
||||
len = str.length;
|
||||
padAmount = num - len;
|
||||
return str + "" + repeatString$(' ', padAmount > 0 ? padAmount : 0);
|
||||
}
|
||||
function sentencize(str){
|
||||
var first, rest, period;
|
||||
first = str.charAt(0).toUpperCase();
|
||||
rest = str.slice(1);
|
||||
period = /[\.!\?]$/.test(str) ? '' : '.';
|
||||
return first + "" + rest + period;
|
||||
}
|
||||
function interp(string, object){
|
||||
return string.replace(/{{([a-zA-Z$_][a-zA-Z$_0-9]*)}}/g, function(arg$, key){
|
||||
var ref$;
|
||||
return (ref$ = object[key]) != null
|
||||
? ref$
|
||||
: "{{" + key + "}}";
|
||||
});
|
||||
}
|
||||
module.exports = {
|
||||
generateHelp: generateHelp,
|
||||
generateHelpForOption: generateHelpForOption
|
||||
};
|
||||
function repeatString$(str, n){
|
||||
for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str;
|
||||
return r;
|
||||
}
|
||||
}).call(this);
|
||||
465
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/lib/index.js
generated
vendored
Normal file
465
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,465 @@
|
||||
// Generated by LiveScript 1.5.0
|
||||
(function(){
|
||||
var VERSION, ref$, id, map, compact, any, groupBy, partition, chars, isItNaN, keys, Obj, camelize, deepIs, closestString, nameToRaw, dasherize, naturalJoin, generateHelp, generateHelpForOption, parsedTypeCheck, parseType, parseLevn, camelizeKeys, parseString, main, toString$ = {}.toString, slice$ = [].slice;
|
||||
VERSION = '0.8.2';
|
||||
ref$ = require('prelude-ls'), id = ref$.id, map = ref$.map, compact = ref$.compact, any = ref$.any, groupBy = ref$.groupBy, partition = ref$.partition, chars = ref$.chars, isItNaN = ref$.isItNaN, keys = ref$.keys, Obj = ref$.Obj, camelize = ref$.camelize;
|
||||
deepIs = require('deep-is');
|
||||
ref$ = require('./util'), closestString = ref$.closestString, nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin;
|
||||
ref$ = require('./help'), generateHelp = ref$.generateHelp, generateHelpForOption = ref$.generateHelpForOption;
|
||||
ref$ = require('type-check'), parsedTypeCheck = ref$.parsedTypeCheck, parseType = ref$.parseType;
|
||||
parseLevn = require('levn').parsedTypeParse;
|
||||
camelizeKeys = function(obj){
|
||||
var key, value, resultObj$ = {};
|
||||
for (key in obj) {
|
||||
value = obj[key];
|
||||
resultObj$[camelize(key)] = value;
|
||||
}
|
||||
return resultObj$;
|
||||
};
|
||||
parseString = function(string){
|
||||
var assignOpt, regex, replaceRegex, result, this$ = this;
|
||||
assignOpt = '--?[a-zA-Z][-a-z-A-Z0-9]*=';
|
||||
regex = RegExp('(?:' + assignOpt + ')?(?:\'(?:\\\\\'|[^\'])+\'|"(?:\\\\"|[^"])+")|[^\'"\\s]+', 'g');
|
||||
replaceRegex = RegExp('^(' + assignOpt + ')?[\'"]([\\s\\S]*)[\'"]$');
|
||||
result = map(function(it){
|
||||
return it.replace(replaceRegex, '$1$2');
|
||||
}, string.match(regex) || []);
|
||||
return result;
|
||||
};
|
||||
main = function(libOptions){
|
||||
var opts, defaults, required, traverse, getOption, parse;
|
||||
opts = {};
|
||||
defaults = {};
|
||||
required = [];
|
||||
if (toString$.call(libOptions.stdout).slice(8, -1) === 'Undefined') {
|
||||
libOptions.stdout = process.stdout;
|
||||
}
|
||||
libOptions.positionalAnywhere == null && (libOptions.positionalAnywhere = true);
|
||||
libOptions.typeAliases == null && (libOptions.typeAliases = {});
|
||||
libOptions.defaults == null && (libOptions.defaults = {});
|
||||
if (libOptions.concatRepeatedArrays != null) {
|
||||
libOptions.defaults.concatRepeatedArrays = libOptions.concatRepeatedArrays;
|
||||
}
|
||||
if (libOptions.mergeRepeatedObjects != null) {
|
||||
libOptions.defaults.mergeRepeatedObjects = libOptions.mergeRepeatedObjects;
|
||||
}
|
||||
traverse = function(options){
|
||||
var i$, len$, option, name, k, ref$, v, type, that, e, parsedPossibilities, parsedType, j$, len1$, possibility, rawDependsType, dependsOpts, dependsType, cra, alias, shortNames, longNames, this$ = this;
|
||||
if (toString$.call(options).slice(8, -1) !== 'Array') {
|
||||
throw new Error('No options defined.');
|
||||
}
|
||||
for (i$ = 0, len$ = options.length; i$ < len$; ++i$) {
|
||||
option = options[i$];
|
||||
if (option.heading == null) {
|
||||
name = option.option;
|
||||
if (opts[name] != null) {
|
||||
throw new Error("Option '" + name + "' already defined.");
|
||||
}
|
||||
for (k in ref$ = libOptions.defaults) {
|
||||
v = ref$[k];
|
||||
option[k] == null && (option[k] = v);
|
||||
}
|
||||
if (option.type === 'Boolean') {
|
||||
option.boolean == null && (option.boolean = true);
|
||||
}
|
||||
if (option.parsedType == null) {
|
||||
if (!option.type) {
|
||||
throw new Error("No type defined for option '" + name + "'.");
|
||||
}
|
||||
try {
|
||||
type = (that = libOptions.typeAliases[option.type]) != null
|
||||
? that
|
||||
: option.type;
|
||||
option.parsedType = parseType(type);
|
||||
} catch (e$) {
|
||||
e = e$;
|
||||
throw new Error("Option '" + name + "': Error parsing type '" + option.type + "': " + e.message);
|
||||
}
|
||||
}
|
||||
if (option['default']) {
|
||||
try {
|
||||
defaults[name] = parseLevn(option.parsedType, option['default']);
|
||||
} catch (e$) {
|
||||
e = e$;
|
||||
throw new Error("Option '" + name + "': Error parsing default value '" + option['default'] + "' for type '" + option.type + "': " + e.message);
|
||||
}
|
||||
}
|
||||
if (option['enum'] && !option.parsedPossiblities) {
|
||||
parsedPossibilities = [];
|
||||
parsedType = option.parsedType;
|
||||
for (j$ = 0, len1$ = (ref$ = option['enum']).length; j$ < len1$; ++j$) {
|
||||
possibility = ref$[j$];
|
||||
try {
|
||||
parsedPossibilities.push(parseLevn(parsedType, possibility));
|
||||
} catch (e$) {
|
||||
e = e$;
|
||||
throw new Error("Option '" + name + "': Error parsing enum value '" + possibility + "' for type '" + option.type + "': " + e.message);
|
||||
}
|
||||
}
|
||||
option.parsedPossibilities = parsedPossibilities;
|
||||
}
|
||||
if (that = option.dependsOn) {
|
||||
if (that.length) {
|
||||
ref$ = [].concat(option.dependsOn), rawDependsType = ref$[0], dependsOpts = slice$.call(ref$, 1);
|
||||
dependsType = rawDependsType.toLowerCase();
|
||||
if (dependsOpts.length) {
|
||||
if (dependsType === 'and' || dependsType === 'or') {
|
||||
option.dependsOn = [dependsType].concat(slice$.call(dependsOpts));
|
||||
} else {
|
||||
throw new Error("Option '" + name + "': If you have more than one dependency, you must specify either 'and' or 'or'");
|
||||
}
|
||||
} else {
|
||||
if ((ref$ = dependsType.toLowerCase()) === 'and' || ref$ === 'or') {
|
||||
option.dependsOn = null;
|
||||
} else {
|
||||
option.dependsOn = ['and', rawDependsType];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
option.dependsOn = null;
|
||||
}
|
||||
}
|
||||
if (option.required) {
|
||||
required.push(name);
|
||||
}
|
||||
opts[name] = option;
|
||||
if (option.concatRepeatedArrays != null) {
|
||||
cra = option.concatRepeatedArrays;
|
||||
if ('Boolean' === toString$.call(cra).slice(8, -1)) {
|
||||
option.concatRepeatedArrays = [cra, {}];
|
||||
} else if (cra.length === 1) {
|
||||
option.concatRepeatedArrays = [cra[0], {}];
|
||||
} else if (cra.length !== 2) {
|
||||
throw new Error("Invalid setting for concatRepeatedArrays");
|
||||
}
|
||||
}
|
||||
if (option.alias || option.aliases) {
|
||||
if (name === 'NUM') {
|
||||
throw new Error("-NUM option can't have aliases.");
|
||||
}
|
||||
if (option.alias) {
|
||||
option.aliases == null && (option.aliases = [].concat(option.alias));
|
||||
}
|
||||
for (j$ = 0, len1$ = (ref$ = option.aliases).length; j$ < len1$; ++j$) {
|
||||
alias = ref$[j$];
|
||||
if (opts[alias] != null) {
|
||||
throw new Error("Option '" + alias + "' already defined.");
|
||||
}
|
||||
opts[alias] = option;
|
||||
}
|
||||
ref$ = partition(fn$, option.aliases), shortNames = ref$[0], longNames = ref$[1];
|
||||
option.shortNames == null && (option.shortNames = shortNames);
|
||||
option.longNames == null && (option.longNames = longNames);
|
||||
}
|
||||
if ((!option.aliases || option.shortNames.length === 0) && option.type === 'Boolean' && option['default'] === 'true') {
|
||||
option.negateName = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function fn$(it){
|
||||
return it.length === 1;
|
||||
}
|
||||
};
|
||||
traverse(libOptions.options);
|
||||
getOption = function(name){
|
||||
var opt, possiblyMeant;
|
||||
opt = opts[name];
|
||||
if (opt == null) {
|
||||
possiblyMeant = closestString(keys(opts), name);
|
||||
throw new Error("Invalid option '" + nameToRaw(name) + "'" + (possiblyMeant ? " - perhaps you meant '" + nameToRaw(possiblyMeant) + "'?" : '.'));
|
||||
}
|
||||
return opt;
|
||||
};
|
||||
parse = function(input, arg$){
|
||||
var slice, obj, positional, restPositional, overrideRequired, prop, setValue, setDefaults, checkRequired, mutuallyExclusiveError, checkMutuallyExclusive, checkDependency, checkDependencies, checkProp, args, key, value, option, ref$, i$, len$, arg, that, result, short, argName, usingAssign, val, flags, len, j$, len1$, i, flag, opt, name, valPrime, negated, noedName;
|
||||
slice = (arg$ != null
|
||||
? arg$
|
||||
: {}).slice;
|
||||
obj = {};
|
||||
positional = [];
|
||||
restPositional = false;
|
||||
overrideRequired = false;
|
||||
prop = null;
|
||||
setValue = function(name, value){
|
||||
var opt, val, cra, e, currentType;
|
||||
opt = getOption(name);
|
||||
if (opt.boolean) {
|
||||
val = value;
|
||||
} else {
|
||||
try {
|
||||
cra = opt.concatRepeatedArrays;
|
||||
if (cra != null && cra[0] && cra[1].oneValuePerFlag && opt.parsedType.length === 1 && opt.parsedType[0].structure === 'array') {
|
||||
val = [parseLevn(opt.parsedType[0].of, value)];
|
||||
} else {
|
||||
val = parseLevn(opt.parsedType, value);
|
||||
}
|
||||
} catch (e$) {
|
||||
e = e$;
|
||||
throw new Error("Invalid value for option '" + name + "' - expected type " + opt.type + ", received value: " + value + ".");
|
||||
}
|
||||
if (opt['enum'] && !any(function(it){
|
||||
return deepIs(it, val);
|
||||
}, opt.parsedPossibilities)) {
|
||||
throw new Error("Option " + name + ": '" + val + "' not one of " + naturalJoin(opt['enum']) + ".");
|
||||
}
|
||||
}
|
||||
currentType = toString$.call(obj[name]).slice(8, -1);
|
||||
if (obj[name] != null) {
|
||||
if (opt.concatRepeatedArrays != null && opt.concatRepeatedArrays[0] && currentType === 'Array') {
|
||||
obj[name] = obj[name].concat(val);
|
||||
} else if (opt.mergeRepeatedObjects && currentType === 'Object') {
|
||||
import$(obj[name], val);
|
||||
} else {
|
||||
obj[name] = val;
|
||||
}
|
||||
} else {
|
||||
obj[name] = val;
|
||||
}
|
||||
if (opt.restPositional) {
|
||||
restPositional = true;
|
||||
}
|
||||
if (opt.overrideRequired) {
|
||||
overrideRequired = true;
|
||||
}
|
||||
};
|
||||
setDefaults = function(){
|
||||
var name, ref$, value;
|
||||
for (name in ref$ = defaults) {
|
||||
value = ref$[name];
|
||||
if (obj[name] == null) {
|
||||
obj[name] = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
checkRequired = function(){
|
||||
var i$, ref$, len$, name;
|
||||
if (overrideRequired) {
|
||||
return;
|
||||
}
|
||||
for (i$ = 0, len$ = (ref$ = required).length; i$ < len$; ++i$) {
|
||||
name = ref$[i$];
|
||||
if (!obj[name]) {
|
||||
throw new Error("Option " + nameToRaw(name) + " is required.");
|
||||
}
|
||||
}
|
||||
};
|
||||
mutuallyExclusiveError = function(first, second){
|
||||
throw new Error("The options " + nameToRaw(first) + " and " + nameToRaw(second) + " are mutually exclusive - you cannot use them at the same time.");
|
||||
};
|
||||
checkMutuallyExclusive = function(){
|
||||
var rules, i$, len$, rule, present, j$, len1$, element, k$, len2$, opt;
|
||||
rules = libOptions.mutuallyExclusive;
|
||||
if (!rules) {
|
||||
return;
|
||||
}
|
||||
for (i$ = 0, len$ = rules.length; i$ < len$; ++i$) {
|
||||
rule = rules[i$];
|
||||
present = null;
|
||||
for (j$ = 0, len1$ = rule.length; j$ < len1$; ++j$) {
|
||||
element = rule[j$];
|
||||
if (toString$.call(element).slice(8, -1) === 'Array') {
|
||||
for (k$ = 0, len2$ = element.length; k$ < len2$; ++k$) {
|
||||
opt = element[k$];
|
||||
if (opt in obj) {
|
||||
if (present != null) {
|
||||
mutuallyExclusiveError(present, opt);
|
||||
} else {
|
||||
present = opt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (element in obj) {
|
||||
if (present != null) {
|
||||
mutuallyExclusiveError(present, element);
|
||||
} else {
|
||||
present = element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
checkDependency = function(option){
|
||||
var dependsOn, type, targetOptionNames, i$, len$, targetOptionName, targetOption;
|
||||
dependsOn = option.dependsOn;
|
||||
if (!dependsOn || option.dependenciesMet) {
|
||||
return true;
|
||||
}
|
||||
type = dependsOn[0], targetOptionNames = slice$.call(dependsOn, 1);
|
||||
for (i$ = 0, len$ = targetOptionNames.length; i$ < len$; ++i$) {
|
||||
targetOptionName = targetOptionNames[i$];
|
||||
targetOption = obj[targetOptionName];
|
||||
if (targetOption && checkDependency(targetOption)) {
|
||||
if (type === 'or') {
|
||||
return true;
|
||||
}
|
||||
} else if (type === 'and') {
|
||||
throw new Error("The option '" + option.option + "' did not have its dependencies met.");
|
||||
}
|
||||
}
|
||||
if (type === 'and') {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error("The option '" + option.option + "' did not meet any of its dependencies.");
|
||||
}
|
||||
};
|
||||
checkDependencies = function(){
|
||||
var name;
|
||||
for (name in obj) {
|
||||
checkDependency(opts[name]);
|
||||
}
|
||||
};
|
||||
checkProp = function(){
|
||||
if (prop) {
|
||||
throw new Error("Value for '" + prop + "' of type '" + getOption(prop).type + "' required.");
|
||||
}
|
||||
};
|
||||
switch (toString$.call(input).slice(8, -1)) {
|
||||
case 'String':
|
||||
args = parseString(input.slice(slice != null ? slice : 0));
|
||||
break;
|
||||
case 'Array':
|
||||
args = input.slice(slice != null ? slice : 2);
|
||||
break;
|
||||
case 'Object':
|
||||
obj = {};
|
||||
for (key in input) {
|
||||
value = input[key];
|
||||
if (key !== '_') {
|
||||
option = getOption(dasherize(key));
|
||||
if (parsedTypeCheck(option.parsedType, value)) {
|
||||
obj[option.option] = value;
|
||||
} else {
|
||||
throw new Error("Option '" + option.option + "': Invalid type for '" + value + "' - expected type '" + option.type + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
checkMutuallyExclusive();
|
||||
checkDependencies();
|
||||
setDefaults();
|
||||
checkRequired();
|
||||
return ref$ = camelizeKeys(obj), ref$._ = input._ || [], ref$;
|
||||
default:
|
||||
throw new Error("Invalid argument to 'parse': " + input + ".");
|
||||
}
|
||||
for (i$ = 0, len$ = args.length; i$ < len$; ++i$) {
|
||||
arg = args[i$];
|
||||
if (arg === '--') {
|
||||
restPositional = true;
|
||||
} else if (restPositional) {
|
||||
positional.push(arg);
|
||||
} else {
|
||||
if (that = arg.match(/^(--?)([a-zA-Z][-a-zA-Z0-9]*)(=)?(.*)?$/)) {
|
||||
result = that;
|
||||
checkProp();
|
||||
short = result[1].length === 1;
|
||||
argName = result[2];
|
||||
usingAssign = result[3] != null;
|
||||
val = result[4];
|
||||
if (usingAssign && val == null) {
|
||||
throw new Error("No value for '" + argName + "' specified.");
|
||||
}
|
||||
if (short) {
|
||||
flags = chars(argName);
|
||||
len = flags.length;
|
||||
for (j$ = 0, len1$ = flags.length; j$ < len1$; ++j$) {
|
||||
i = j$;
|
||||
flag = flags[j$];
|
||||
opt = getOption(flag);
|
||||
name = opt.option;
|
||||
if (restPositional) {
|
||||
positional.push(flag);
|
||||
} else if (i === len - 1) {
|
||||
if (usingAssign) {
|
||||
valPrime = opt.boolean ? parseLevn([{
|
||||
type: 'Boolean'
|
||||
}], val) : val;
|
||||
setValue(name, valPrime);
|
||||
} else if (opt.boolean) {
|
||||
setValue(name, true);
|
||||
} else {
|
||||
prop = name;
|
||||
}
|
||||
} else if (opt.boolean) {
|
||||
setValue(name, true);
|
||||
} else {
|
||||
throw new Error("Can't set argument '" + flag + "' when not last flag in a group of short flags.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
negated = false;
|
||||
if (that = argName.match(/^no-(.+)$/)) {
|
||||
negated = true;
|
||||
noedName = that[1];
|
||||
opt = getOption(noedName);
|
||||
} else {
|
||||
opt = getOption(argName);
|
||||
}
|
||||
name = opt.option;
|
||||
if (opt.boolean) {
|
||||
valPrime = usingAssign ? parseLevn([{
|
||||
type: 'Boolean'
|
||||
}], val) : true;
|
||||
if (negated) {
|
||||
setValue(name, !valPrime);
|
||||
} else {
|
||||
setValue(name, valPrime);
|
||||
}
|
||||
} else {
|
||||
if (negated) {
|
||||
throw new Error("Only use 'no-' prefix for Boolean options, not with '" + noedName + "'.");
|
||||
}
|
||||
if (usingAssign) {
|
||||
setValue(name, val);
|
||||
} else {
|
||||
prop = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (that = arg.match(/^-([0-9]+(?:\.[0-9]+)?)$/)) {
|
||||
opt = opts.NUM;
|
||||
if (!opt) {
|
||||
throw new Error('No -NUM option defined.');
|
||||
}
|
||||
setValue(opt.option, that[1]);
|
||||
} else {
|
||||
if (prop) {
|
||||
setValue(prop, arg);
|
||||
prop = null;
|
||||
} else {
|
||||
positional.push(arg);
|
||||
if (!libOptions.positionalAnywhere) {
|
||||
restPositional = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
checkProp();
|
||||
checkMutuallyExclusive();
|
||||
checkDependencies();
|
||||
setDefaults();
|
||||
checkRequired();
|
||||
return ref$ = camelizeKeys(obj), ref$._ = positional, ref$;
|
||||
};
|
||||
return {
|
||||
parse: parse,
|
||||
parseArgv: function(it){
|
||||
return parse(it, {
|
||||
slice: 2
|
||||
});
|
||||
},
|
||||
generateHelp: generateHelp(libOptions),
|
||||
generateHelpForOption: generateHelpForOption(getOption, libOptions)
|
||||
};
|
||||
};
|
||||
main.VERSION = VERSION;
|
||||
module.exports = main;
|
||||
function import$(obj, src){
|
||||
var own = {}.hasOwnProperty;
|
||||
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|
||||
return obj;
|
||||
}
|
||||
}).call(this);
|
||||
54
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/lib/util.js
generated
vendored
Normal file
54
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/lib/util.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
// Generated by LiveScript 1.5.0
|
||||
(function(){
|
||||
var prelude, map, sortBy, fl, closestString, nameToRaw, dasherize, naturalJoin;
|
||||
prelude = require('prelude-ls'), map = prelude.map, sortBy = prelude.sortBy;
|
||||
fl = require('fast-levenshtein');
|
||||
closestString = function(possibilities, input){
|
||||
var distances, ref$, string, distance, this$ = this;
|
||||
if (!possibilities.length) {
|
||||
return;
|
||||
}
|
||||
distances = map(function(it){
|
||||
var ref$, longer, shorter;
|
||||
ref$ = input.length > it.length
|
||||
? [input, it]
|
||||
: [it, input], longer = ref$[0], shorter = ref$[1];
|
||||
return {
|
||||
string: it,
|
||||
distance: fl.get(longer, shorter)
|
||||
};
|
||||
})(
|
||||
possibilities);
|
||||
ref$ = sortBy(function(it){
|
||||
return it.distance;
|
||||
}, distances)[0], string = ref$.string, distance = ref$.distance;
|
||||
return string;
|
||||
};
|
||||
nameToRaw = function(name){
|
||||
if (name.length === 1 || name === 'NUM') {
|
||||
return "-" + name;
|
||||
} else {
|
||||
return "--" + name;
|
||||
}
|
||||
};
|
||||
dasherize = function(string){
|
||||
if (/^[A-Z]/.test(string)) {
|
||||
return string;
|
||||
} else {
|
||||
return prelude.dasherize(string);
|
||||
}
|
||||
};
|
||||
naturalJoin = function(array){
|
||||
if (array.length < 3) {
|
||||
return array.join(' or ');
|
||||
} else {
|
||||
return array.slice(0, -1).join(', ') + ", or " + array[array.length - 1];
|
||||
}
|
||||
};
|
||||
module.exports = {
|
||||
closestString: closestString,
|
||||
nameToRaw: nameToRaw,
|
||||
dasherize: dasherize,
|
||||
naturalJoin: naturalJoin
|
||||
};
|
||||
}).call(this);
|
||||
74
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/package.json
generated
vendored
Normal file
74
static/js/ketcher2/node_modules/istanbul/node_modules/optionator/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "optionator@^0.8.1",
|
||||
"_id": "optionator@0.8.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
|
||||
"_location": "/istanbul/optionator",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "optionator@^0.8.1",
|
||||
"name": "optionator",
|
||||
"escapedName": "optionator",
|
||||
"rawSpec": "^0.8.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.8.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul/escodegen"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
|
||||
"_shasum": "364c5e409d3f4d6301d6c0b4c05bba50180aeb64",
|
||||
"_spec": "optionator@^0.8.1",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul/node_modules/escodegen",
|
||||
"author": {
|
||||
"name": "George Zahariev",
|
||||
"email": "z@georgezahariev.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/gkz/optionator/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"deep-is": "~0.1.3",
|
||||
"fast-levenshtein": "~2.0.4",
|
||||
"levn": "~0.3.0",
|
||||
"prelude-ls": "~1.1.2",
|
||||
"type-check": "~0.3.2",
|
||||
"wordwrap": "~1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "option parsing and help generation",
|
||||
"devDependencies": {
|
||||
"istanbul": "~0.4.1",
|
||||
"livescript": "~1.5.0",
|
||||
"mocha": "~3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/gkz/optionator",
|
||||
"keywords": [
|
||||
"options",
|
||||
"flags",
|
||||
"option parsing",
|
||||
"cli"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/",
|
||||
"name": "optionator",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/gkz/optionator.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "0.8.2"
|
||||
}
|
||||
18
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/LICENSE
generated
vendored
Normal file
18
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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.
|
||||
5
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/example/async.js
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/example/async.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var resolve = require('../');
|
||||
resolve('tap', { basedir: __dirname }, function (err, res) {
|
||||
if (err) console.error(err)
|
||||
else console.log(res)
|
||||
});
|
||||
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/example/sync.js
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/example/sync.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var resolve = require('../');
|
||||
var res = resolve.sync('tap', { basedir: __dirname });
|
||||
console.log(res);
|
||||
5
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/index.js
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var core = require('./lib/core');
|
||||
exports = module.exports = require('./lib/async');
|
||||
exports.core = core;
|
||||
exports.isCore = function (x) { return core[x] };
|
||||
exports.sync = require('./lib/sync');
|
||||
192
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/async.js
generated
vendored
Normal file
192
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/async.js
generated
vendored
Normal file
@ -0,0 +1,192 @@
|
||||
var core = require('./core');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var caller = require('./caller.js');
|
||||
var nodeModulesPaths = require('./node-modules-paths.js');
|
||||
var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\//;
|
||||
|
||||
module.exports = function resolve (x, opts, cb) {
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts;
|
||||
opts = {};
|
||||
}
|
||||
if (!opts) opts = {};
|
||||
if (typeof x !== 'string') {
|
||||
return process.nextTick(function () {
|
||||
cb(new Error('path must be a string'));
|
||||
});
|
||||
}
|
||||
|
||||
var isFile = opts.isFile || function (file, cb) {
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (err && err.code === 'ENOENT') cb(null, false)
|
||||
else if (err) cb(err)
|
||||
else cb(null, stat.isFile() || stat.isFIFO())
|
||||
});
|
||||
};
|
||||
var readFile = opts.readFile || fs.readFile;
|
||||
|
||||
var extensions = opts.extensions || [ '.js' ];
|
||||
var y = opts.basedir || path.dirname(caller());
|
||||
|
||||
opts.paths = opts.paths || [];
|
||||
|
||||
if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/.test(x)) {
|
||||
var res = path.resolve(y, x);
|
||||
if (x === '..') res += '/';
|
||||
if (/\/$/.test(x) && res === y) {
|
||||
loadAsDirectory(res, opts.package, onfile);
|
||||
}
|
||||
else loadAsFile(res, opts.package, onfile);
|
||||
}
|
||||
else loadNodeModules(x, y, function (err, n, pkg) {
|
||||
if (err) cb(err)
|
||||
else if (n) cb(null, n, pkg)
|
||||
else if (core[x]) return cb(null, x);
|
||||
else cb(new Error("Cannot find module '" + x + "' from '" + y + "'"))
|
||||
});
|
||||
|
||||
function onfile (err, m, pkg) {
|
||||
if (err) cb(err)
|
||||
else if (m) cb(null, m, pkg)
|
||||
else loadAsDirectory(res, function (err, d, pkg) {
|
||||
if (err) cb(err)
|
||||
else if (d) cb(null, d, pkg)
|
||||
else cb(new Error("Cannot find module '" + x + "' from '" + y + "'"))
|
||||
})
|
||||
}
|
||||
|
||||
function loadAsFile (x, pkg, cb) {
|
||||
if (typeof pkg === 'function') {
|
||||
cb = pkg;
|
||||
pkg = undefined;
|
||||
}
|
||||
|
||||
var exts = [''].concat(extensions);
|
||||
load(exts, x, pkg)
|
||||
|
||||
function load (exts, x, pkg) {
|
||||
if (exts.length === 0) return cb(null, undefined, pkg);
|
||||
var file = x + exts[0];
|
||||
|
||||
if (pkg) onpkg(null, pkg)
|
||||
else loadpkg(path.dirname(file), onpkg);
|
||||
|
||||
function onpkg (err, pkg_, dir) {
|
||||
pkg = pkg_;
|
||||
if (err) return cb(err)
|
||||
if (dir && pkg && opts.pathFilter) {
|
||||
var rfile = path.relative(dir, file);
|
||||
var rel = rfile.slice(0, rfile.length - exts[0].length);
|
||||
var r = opts.pathFilter(pkg, x, rel);
|
||||
if (r) return load(
|
||||
[''].concat(extensions.slice()),
|
||||
path.resolve(dir, r),
|
||||
pkg
|
||||
);
|
||||
}
|
||||
isFile(file, onex);
|
||||
}
|
||||
function onex (err, ex) {
|
||||
if (err) cb(err)
|
||||
else if (!ex) load(exts.slice(1), x, pkg)
|
||||
else cb(null, file, pkg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadpkg (dir, cb) {
|
||||
if (dir === '' || dir === '/') return cb(null);
|
||||
if (process.platform === 'win32' && /^\w:[\\\/]*$/.test(dir)) {
|
||||
return cb(null);
|
||||
}
|
||||
if (/[\\\/]node_modules[\\\/]*$/.test(dir)) return cb(null);
|
||||
|
||||
var pkgfile = path.join(dir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
// on err, ex is false
|
||||
if (!ex) return loadpkg(
|
||||
path.dirname(dir), cb
|
||||
);
|
||||
|
||||
readFile(pkgfile, function (err, body) {
|
||||
if (err) cb(err);
|
||||
try { var pkg = JSON.parse(body) }
|
||||
catch (err) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, pkgfile);
|
||||
}
|
||||
cb(null, pkg, dir);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadAsDirectory (x, fpkg, cb) {
|
||||
if (typeof fpkg === 'function') {
|
||||
cb = fpkg;
|
||||
fpkg = opts.package;
|
||||
}
|
||||
|
||||
var pkgfile = path.join(x, '/package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
if (err) return cb(err);
|
||||
if (!ex) return loadAsFile(path.join(x, '/index'), fpkg, cb);
|
||||
|
||||
readFile(pkgfile, function (err, body) {
|
||||
if (err) return cb(err);
|
||||
try {
|
||||
var pkg = JSON.parse(body);
|
||||
}
|
||||
catch (err) {}
|
||||
|
||||
if (opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, pkgfile);
|
||||
}
|
||||
|
||||
if (pkg.main) {
|
||||
if (pkg.main === '.' || pkg.main === './'){
|
||||
pkg.main = 'index'
|
||||
}
|
||||
loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (m) return cb(null, m, pkg);
|
||||
if (!pkg) return loadAsFile(path.join(x, '/index'), pkg, cb);
|
||||
|
||||
var dir = path.resolve(x, pkg.main);
|
||||
loadAsDirectory(dir, pkg, function (err, n, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (n) return cb(null, n, pkg);
|
||||
loadAsFile(path.join(x, '/index'), pkg, cb);
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
loadAsFile(path.join(x, '/index'), pkg, cb);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadNodeModules (x, start, cb) {
|
||||
(function process (dirs) {
|
||||
if (dirs.length === 0) return cb(null, undefined);
|
||||
var dir = dirs[0];
|
||||
|
||||
var file = path.join(dir, '/', x);
|
||||
loadAsFile(file, undefined, onfile);
|
||||
|
||||
function onfile (err, m, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (m) return cb(null, m, pkg);
|
||||
loadAsDirectory(path.join(dir, '/', x), undefined, ondir);
|
||||
}
|
||||
|
||||
function ondir (err, n, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (n) return cb(null, n, pkg);
|
||||
process(dirs.slice(1));
|
||||
}
|
||||
})(nodeModulesPaths(start, opts));
|
||||
}
|
||||
};
|
||||
8
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/caller.js
generated
vendored
Normal file
8
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/caller.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = function () {
|
||||
// see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
|
||||
var origPrepareStackTrace = Error.prepareStackTrace;
|
||||
Error.prepareStackTrace = function (_, stack) { return stack };
|
||||
var stack = (new Error()).stack;
|
||||
Error.prepareStackTrace = origPrepareStackTrace;
|
||||
return stack[2].getFileName();
|
||||
};
|
||||
4
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/core.js
generated
vendored
Normal file
4
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/core.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = require('./core.json').reduce(function (acc, x) {
|
||||
acc[x] = true;
|
||||
return acc;
|
||||
}, {});
|
||||
38
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/core.json
generated
vendored
Normal file
38
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/core.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
[
|
||||
"assert",
|
||||
"buffer_ieee754",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"_debugger",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"freelist",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"_linklist",
|
||||
"module",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"sys",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"vm",
|
||||
"zlib"
|
||||
]
|
||||
38
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/node-modules-paths.js
generated
vendored
Normal file
38
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/node-modules-paths.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function (start, opts) {
|
||||
var modules = opts.moduleDirectory
|
||||
? [].concat(opts.moduleDirectory)
|
||||
: ['node_modules']
|
||||
;
|
||||
|
||||
// ensure that `start` is an absolute path at this point,
|
||||
// resolving against the process' current working directory
|
||||
start = path.resolve(start);
|
||||
|
||||
var prefix = '/';
|
||||
if (/^([A-Za-z]:)/.test(start)) {
|
||||
prefix = '';
|
||||
} else if (/^\\\\/.test(start)) {
|
||||
prefix = '\\\\';
|
||||
}
|
||||
|
||||
var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/;
|
||||
|
||||
var parts = start.split(splitRe);
|
||||
|
||||
var dirs = [];
|
||||
for (var i = parts.length - 1; i >= 0; i--) {
|
||||
if (modules.indexOf(parts[i]) !== -1) continue;
|
||||
dirs = dirs.concat(modules.map(function(module_dir) {
|
||||
return prefix + path.join(
|
||||
path.join.apply(path, parts.slice(0, i + 1)),
|
||||
module_dir
|
||||
);
|
||||
}));
|
||||
}
|
||||
if (process.platform === 'win32'){
|
||||
dirs[dirs.length-1] = dirs[dirs.length-1].replace(":", ":\\");
|
||||
}
|
||||
return dirs.concat(opts.paths);
|
||||
}
|
||||
81
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/sync.js
generated
vendored
Normal file
81
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/lib/sync.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
var core = require('./core');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var caller = require('./caller.js');
|
||||
var nodeModulesPaths = require('./node-modules-paths.js');
|
||||
|
||||
module.exports = function (x, opts) {
|
||||
if (!opts) opts = {};
|
||||
var isFile = opts.isFile || function (file) {
|
||||
try { var stat = fs.statSync(file) }
|
||||
catch (err) { if (err && err.code === 'ENOENT') return false }
|
||||
return stat.isFile() || stat.isFIFO();
|
||||
};
|
||||
var readFileSync = opts.readFileSync || fs.readFileSync;
|
||||
|
||||
var extensions = opts.extensions || [ '.js' ];
|
||||
var y = opts.basedir || path.dirname(caller());
|
||||
|
||||
opts.paths = opts.paths || [];
|
||||
|
||||
if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/.test(x)) {
|
||||
var res = path.resolve(y, x);
|
||||
if (x === '..') res += '/';
|
||||
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
||||
if (m) return m;
|
||||
} else {
|
||||
var n = loadNodeModulesSync(x, y);
|
||||
if (n) return n;
|
||||
}
|
||||
|
||||
if (core[x]) return x;
|
||||
|
||||
throw new Error("Cannot find module '" + x + "' from '" + y + "'");
|
||||
|
||||
function loadAsFileSync (x) {
|
||||
if (isFile(x)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
for (var i = 0; i < extensions.length; i++) {
|
||||
var file = x + extensions[i];
|
||||
if (isFile(file)) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadAsDirectorySync (x) {
|
||||
var pkgfile = path.join(x, '/package.json');
|
||||
if (isFile(pkgfile)) {
|
||||
var body = readFileSync(pkgfile, 'utf8');
|
||||
try {
|
||||
var pkg = JSON.parse(body);
|
||||
if (opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, x);
|
||||
}
|
||||
|
||||
if (pkg.main) {
|
||||
var m = loadAsFileSync(path.resolve(x, pkg.main));
|
||||
if (m) return m;
|
||||
var n = loadAsDirectorySync(path.resolve(x, pkg.main));
|
||||
if (n) return n;
|
||||
}
|
||||
}
|
||||
catch (err) {}
|
||||
}
|
||||
|
||||
return loadAsFileSync(path.join( x, '/index'));
|
||||
}
|
||||
|
||||
function loadNodeModulesSync (x, start) {
|
||||
var dirs = nodeModulesPaths(start, opts);
|
||||
for (var i = 0; i < dirs.length; i++) {
|
||||
var dir = dirs[i];
|
||||
var m = loadAsFileSync(path.join( dir, '/', x));
|
||||
if (m) return m;
|
||||
var n = loadAsDirectorySync(path.join( dir, '/', x ));
|
||||
if (n) return n;
|
||||
}
|
||||
}
|
||||
};
|
||||
58
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/package.json
generated
vendored
Normal file
58
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/package.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "resolve@1.1.x",
|
||||
"_id": "resolve@1.1.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
|
||||
"_location": "/istanbul/resolve",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "resolve@1.1.x",
|
||||
"name": "resolve",
|
||||
"escapedName": "resolve",
|
||||
"rawSpec": "1.1.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
|
||||
"_shasum": "203114d82ad2c5ed9e8e0411b3932875e889e97b",
|
||||
"_spec": "resolve@1.1.x",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/istanbul",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-resolve/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
|
||||
"devDependencies": {
|
||||
"tap": "0.4.13",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-resolve#readme",
|
||||
"keywords": [
|
||||
"resolve",
|
||||
"require",
|
||||
"node",
|
||||
"module"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "resolve",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/node-resolve.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"version": "1.1.7"
|
||||
}
|
||||
148
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/readme.markdown
generated
vendored
Normal file
148
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/readme.markdown
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
# resolve
|
||||
|
||||
implements the [node `require.resolve()`
|
||||
algorithm](http://nodejs.org/docs/v0.4.8/api/all.html#all_Together...)
|
||||
such that you can `require.resolve()` on behalf of a file asynchronously and
|
||||
synchronously
|
||||
|
||||
[](http://travis-ci.org/substack/node-resolve)
|
||||
|
||||
# example
|
||||
|
||||
asynchronously resolve:
|
||||
|
||||
``` js
|
||||
var resolve = require('resolve');
|
||||
resolve('tap', { basedir: __dirname }, function (err, res) {
|
||||
if (err) console.error(err)
|
||||
else console.log(res)
|
||||
});
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/async.js
|
||||
/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
|
||||
```
|
||||
|
||||
synchronously resolve:
|
||||
|
||||
``` js
|
||||
var resolve = require('resolve');
|
||||
var res = resolve.sync('tap', { basedir: __dirname });
|
||||
console.log(res);
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/sync.js
|
||||
/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var resolve = require('resolve')
|
||||
```
|
||||
|
||||
## resolve(id, opts={}, cb)
|
||||
|
||||
Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`.
|
||||
|
||||
options are:
|
||||
|
||||
* opts.basedir - directory to begin resolving from
|
||||
|
||||
* opts.package - `package.json` data applicable to the module being loaded
|
||||
|
||||
* opts.extensions - array of file extensions to search in order
|
||||
|
||||
* opts.readFile - how to read files asynchronously
|
||||
|
||||
* opts.isFile - function to asynchronously test whether a file exists
|
||||
|
||||
* opts.packageFilter - transform the parsed package.json contents before looking
|
||||
at the "main" field
|
||||
|
||||
* opts.pathFilter(pkg, path, relativePath) - transform a path within a package
|
||||
* pkg - package data
|
||||
* path - the path being resolved
|
||||
* relativePath - the path relative from the package.json location
|
||||
* returns - a relative path that will be joined from the package.json location
|
||||
|
||||
* opts.paths - require.paths array to use if nothing is found on the normal
|
||||
node_modules recursive walk (probably don't use this)
|
||||
|
||||
* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
|
||||
|
||||
default `opts` values:
|
||||
|
||||
``` javascript
|
||||
{
|
||||
paths: [],
|
||||
basedir: __dirname,
|
||||
extensions: [ '.js' ],
|
||||
readFile: fs.readFile,
|
||||
isFile: function (file, cb) {
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (err && err.code === 'ENOENT') cb(null, false)
|
||||
else if (err) cb(err)
|
||||
else cb(null, stat.isFile())
|
||||
});
|
||||
},
|
||||
moduleDirectory: 'node_modules'
|
||||
}
|
||||
```
|
||||
|
||||
## resolve.sync(id, opts)
|
||||
|
||||
Synchronously resolve the module path string `id`, returning the result and
|
||||
throwing an error when `id` can't be resolved.
|
||||
|
||||
options are:
|
||||
|
||||
* opts.basedir - directory to begin resolving from
|
||||
|
||||
* opts.extensions - array of file extensions to search in order
|
||||
|
||||
* opts.readFile - how to read files synchronously
|
||||
|
||||
* opts.isFile - function to synchronously test whether a file exists
|
||||
|
||||
* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json
|
||||
* contents before looking at the "main" field
|
||||
|
||||
* opts.paths - require.paths array to use if nothing is found on the normal
|
||||
node_modules recursive walk (probably don't use this)
|
||||
|
||||
* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
|
||||
|
||||
default `opts` values:
|
||||
|
||||
``` javascript
|
||||
{
|
||||
paths: [],
|
||||
basedir: __dirname,
|
||||
extensions: [ '.js' ],
|
||||
readFileSync: fs.readFileSync,
|
||||
isFile: function (file) {
|
||||
try { return fs.statSync(file).isFile() }
|
||||
catch (e) { return false }
|
||||
},
|
||||
moduleDirectory: 'node_modules'
|
||||
}
|
||||
````
|
||||
|
||||
## resolve.isCore(pkg)
|
||||
|
||||
Return whether a package is in core.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install resolve
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
12
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/core.js
generated
vendored
Normal file
12
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/core.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('core modules', function (t) {
|
||||
t.ok(resolve.isCore('fs'));
|
||||
t.ok(resolve.isCore('net'));
|
||||
t.ok(resolve.isCore('http'));
|
||||
|
||||
t.ok(!resolve.isCore('seq'));
|
||||
t.ok(!resolve.isCore('../'));
|
||||
t.end();
|
||||
});
|
||||
29
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/dotdot.js
generated
vendored
Normal file
29
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/dotdot.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('dotdot', function (t) {
|
||||
t.plan(4);
|
||||
var dir = __dirname + '/dotdot/abc';
|
||||
|
||||
resolve('..', { basedir : dir }, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, __dirname + '/dotdot/index.js');
|
||||
});
|
||||
|
||||
resolve('.', { basedir : dir }, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, dir + '/index.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('dotdot sync', function (t) {
|
||||
t.plan(2);
|
||||
var dir = __dirname + '/dotdot/abc';
|
||||
|
||||
var a = resolve.sync('..', { basedir : dir });
|
||||
t.equal(a, __dirname + '/dotdot/index.js');
|
||||
|
||||
var b = resolve.sync('.', { basedir : dir });
|
||||
t.equal(b, dir + '/index.js');
|
||||
});
|
||||
2
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/dotdot/abc/index.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/dotdot/abc/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var x = require('..');
|
||||
console.log(x);
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/dotdot/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/dotdot/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'whatever'
|
||||
17
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/faulty_basedir.js
generated
vendored
Normal file
17
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/faulty_basedir.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
// not sure what's up with this test anymore
|
||||
if (process.platform !== 'win32') return;
|
||||
|
||||
test('faulty basedir must produce error in windows', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = 'C:\\a\\b\\c\\d';
|
||||
|
||||
resolve('tape/lib/test.js', { basedir : resolverDir }, function (err, res, pkg) {
|
||||
t.equal(true, !!err);
|
||||
});
|
||||
|
||||
});
|
||||
18
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/filter.js
generated
vendored
Normal file
18
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/filter.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('filter', function (t) {
|
||||
t.plan(2);
|
||||
var dir = __dirname + '/resolver';
|
||||
resolve('./baz', {
|
||||
basedir : dir,
|
||||
packageFilter : function (pkg) {
|
||||
pkg.main = 'doom';
|
||||
return pkg;
|
||||
}
|
||||
}, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/baz/doom.js');
|
||||
t.equal(pkg.main, 'doom');
|
||||
});
|
||||
});
|
||||
15
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/filter_sync.js
generated
vendored
Normal file
15
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/filter_sync.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('filter', function (t) {
|
||||
var dir = __dirname + '/resolver';
|
||||
var res = resolve.sync('./baz', {
|
||||
basedir : dir,
|
||||
packageFilter : function (pkg) {
|
||||
pkg.main = 'doom'
|
||||
return pkg;
|
||||
}
|
||||
});
|
||||
t.equal(res, dir + '/baz/doom.js');
|
||||
t.end();
|
||||
});
|
||||
142
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/mock.js
generated
vendored
Normal file
142
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/mock.js
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('mock', function (t) {
|
||||
t.plan(6);
|
||||
|
||||
var files = {
|
||||
'/foo/bar/baz.js' : 'beep'
|
||||
};
|
||||
|
||||
function opts (basedir) {
|
||||
return {
|
||||
basedir : basedir,
|
||||
isFile : function (file, cb) {
|
||||
cb(null, files.hasOwnProperty(file));
|
||||
},
|
||||
readFile : function (file, cb) {
|
||||
cb(null, files[file]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, '/foo/bar/baz.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, '/foo/bar/baz.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'baz' from '/foo/bar'");
|
||||
});
|
||||
|
||||
resolve('../baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module '../baz' from '/foo/bar'");
|
||||
});
|
||||
});
|
||||
|
||||
test('mock from package', function (t) {
|
||||
t.plan(6);
|
||||
|
||||
var files = {
|
||||
'/foo/bar/baz.js' : 'beep'
|
||||
};
|
||||
|
||||
function opts (basedir) {
|
||||
return {
|
||||
basedir : basedir,
|
||||
package : { main: 'bar' },
|
||||
isFile : function (file, cb) {
|
||||
cb(null, files.hasOwnProperty(file));
|
||||
},
|
||||
readFile : function (file, cb) {
|
||||
cb(null, files[file]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, '/foo/bar/baz.js');
|
||||
t.equal(pkg.main, 'bar');
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, '/foo/bar/baz.js');
|
||||
t.equal(pkg.main, 'bar');
|
||||
});
|
||||
|
||||
resolve('baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'baz' from '/foo/bar'");
|
||||
});
|
||||
|
||||
resolve('../baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module '../baz' from '/foo/bar'");
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {
|
||||
'/foo/node_modules/bar/baz.js' : 'beep',
|
||||
'/foo/node_modules/bar/package.json' : JSON.stringify({
|
||||
main : './baz.js'
|
||||
})
|
||||
};
|
||||
|
||||
function opts (basedir) {
|
||||
return {
|
||||
basedir : basedir,
|
||||
isFile : function (file, cb) {
|
||||
cb(null, files.hasOwnProperty(file));
|
||||
},
|
||||
readFile : function (file, cb) {
|
||||
cb(null, files[file]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, '/foo/node_modules/bar/baz.js');
|
||||
t.equal(pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package from package', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {
|
||||
'/foo/node_modules/bar/baz.js' : 'beep',
|
||||
'/foo/node_modules/bar/package.json' : JSON.stringify({
|
||||
main : './baz.js'
|
||||
})
|
||||
};
|
||||
|
||||
function opts (basedir) {
|
||||
return {
|
||||
basedir : basedir,
|
||||
package : { main: 'bar' },
|
||||
isFile : function (file, cb) {
|
||||
cb(null, files.hasOwnProperty(file));
|
||||
},
|
||||
readFile : function (file, cb) {
|
||||
cb(null, files[file]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, '/foo/node_modules/bar/baz.js');
|
||||
t.equal(pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
68
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/mock_sync.js
generated
vendored
Normal file
68
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/mock_sync.js
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('mock', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var files = {
|
||||
'/foo/bar/baz.js' : 'beep'
|
||||
};
|
||||
|
||||
function opts (basedir) {
|
||||
return {
|
||||
basedir : basedir,
|
||||
isFile : function (file) {
|
||||
return files.hasOwnProperty(file)
|
||||
},
|
||||
readFileSync : function (file) {
|
||||
return files[file]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t.equal(
|
||||
resolve.sync('./baz', opts('/foo/bar')),
|
||||
'/foo/bar/baz.js'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
resolve.sync('./baz.js', opts('/foo/bar')),
|
||||
'/foo/bar/baz.js'
|
||||
);
|
||||
|
||||
t.throws(function () {
|
||||
resolve.sync('baz', opts('/foo/bar'));
|
||||
});
|
||||
|
||||
t.throws(function () {
|
||||
resolve.sync('../baz', opts('/foo/bar'));
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var files = {
|
||||
'/foo/node_modules/bar/baz.js' : 'beep',
|
||||
'/foo/node_modules/bar/package.json' : JSON.stringify({
|
||||
main : './baz.js'
|
||||
})
|
||||
};
|
||||
|
||||
function opts (basedir) {
|
||||
return {
|
||||
basedir : basedir,
|
||||
isFile : function (file) {
|
||||
return files.hasOwnProperty(file)
|
||||
},
|
||||
readFileSync : function (file) {
|
||||
return files[file]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t.equal(
|
||||
resolve.sync('bar', opts('/foo')),
|
||||
'/foo/node_modules/bar/baz.js'
|
||||
);
|
||||
});
|
||||
56
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir.js
generated
vendored
Normal file
56
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('moduleDirectory strings', function (t) {
|
||||
t.plan(4);
|
||||
var dir = __dirname + '/module_dir';
|
||||
var xopts = {
|
||||
basedir : dir,
|
||||
moduleDirectory: 'xmodules'
|
||||
};
|
||||
resolve('aaa', xopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, dir + '/xmodules/aaa/index.js');
|
||||
});
|
||||
|
||||
var yopts = {
|
||||
basedir : dir,
|
||||
moduleDirectory: 'ymodules'
|
||||
};
|
||||
resolve('aaa', yopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, dir + '/ymodules/aaa/index.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('moduleDirectory array', function (t) {
|
||||
t.plan(6);
|
||||
var dir = __dirname + '/module_dir';
|
||||
var aopts = {
|
||||
basedir : dir,
|
||||
moduleDirectory: [ 'xmodules', 'ymodules', 'zmodules' ]
|
||||
};
|
||||
resolve('aaa', aopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, dir + '/xmodules/aaa/index.js');
|
||||
});
|
||||
|
||||
var bopts = {
|
||||
basedir : dir,
|
||||
moduleDirectory: [ 'zmodules', 'ymodules', 'xmodules' ]
|
||||
};
|
||||
resolve('aaa', bopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, dir + '/ymodules/aaa/index.js');
|
||||
});
|
||||
|
||||
var copts = {
|
||||
basedir : dir,
|
||||
moduleDirectory: [ 'xmodules', 'ymodules', 'zmodules' ]
|
||||
};
|
||||
resolve('bbb', copts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, dir + '/zmodules/bbb/main.js');
|
||||
});
|
||||
});
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = function (x) { return x * 100 }
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = function (x) { return x + 100 }
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = function (n) { return n * 111 }
|
||||
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"main": "main.js"
|
||||
}
|
||||
48
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path.js
generated
vendored
Normal file
48
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('$NODE_PATH', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
resolve('aaa', {
|
||||
paths: [
|
||||
__dirname + '/node_path/x',
|
||||
__dirname + '/node_path/y'
|
||||
],
|
||||
basedir: __dirname,
|
||||
}, function (err, res) {
|
||||
t.equal(res, __dirname + '/node_path/x/aaa/index.js');
|
||||
});
|
||||
|
||||
resolve('bbb', {
|
||||
paths: [
|
||||
__dirname + '/node_path/x',
|
||||
__dirname + '/node_path/y'
|
||||
],
|
||||
basedir: __dirname,
|
||||
}, function (err, res) {
|
||||
t.equal(res, __dirname + '/node_path/y/bbb/index.js');
|
||||
});
|
||||
|
||||
resolve('ccc', {
|
||||
paths: [
|
||||
__dirname + '/node_path/x',
|
||||
__dirname + '/node_path/y'
|
||||
],
|
||||
basedir: __dirname,
|
||||
}, function (err, res) {
|
||||
t.equal(res, __dirname + '/node_path/x/ccc/index.js');
|
||||
});
|
||||
|
||||
// ensure that relative paths still resolve against the
|
||||
// regular `node_modules` correctly
|
||||
resolve('tap', {
|
||||
paths: [
|
||||
'node_path',
|
||||
],
|
||||
basedir: 'node_path/x',
|
||||
}, function (err, res) {
|
||||
t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap/lib/main.js'));
|
||||
});
|
||||
});
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/x/aaa/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/x/aaa/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'A'
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/x/ccc/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/x/ccc/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'C'
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/y/bbb/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/y/bbb/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'B'
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/y/ccc/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/node_path/y/ccc/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'CY'
|
||||
9
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/nonstring.js
generated
vendored
Normal file
9
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/nonstring.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('nonstring', function (t) {
|
||||
t.plan(1);
|
||||
resolve(555, function (err, res, pkg) {
|
||||
t.ok(err);
|
||||
});
|
||||
});
|
||||
35
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter.js
generated
vendored
Normal file
35
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('#62: deep module references and the pathFilter', function(t){
|
||||
t.plan(9);
|
||||
|
||||
var resolverDir = __dirname + '/pathfilter/deep_ref';
|
||||
var pathFilter = function(pkg, x, remainder){
|
||||
t.equal(pkg.version, "1.2.3");
|
||||
t.equal(x, resolverDir + '/node_modules/deep/ref');
|
||||
t.equal(remainder, "ref");
|
||||
return "alt";
|
||||
};
|
||||
|
||||
resolve('deep/ref', { basedir : resolverDir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
|
||||
t.equal(pkg.version, "1.2.3");
|
||||
t.equal(res, resolverDir + '/node_modules/deep/ref.js');
|
||||
});
|
||||
|
||||
resolve('deep/deeper/ref', { basedir: resolverDir },
|
||||
function(err, res, pkg) {
|
||||
if(err) t.fail(err);
|
||||
t.notEqual(pkg, undefined);
|
||||
t.equal(pkg.version, "1.2.3");
|
||||
t.equal(res, resolverDir + '/node_modules/deep/deeper/ref.js');
|
||||
});
|
||||
|
||||
resolve('deep/ref', { basedir : resolverDir, pathFilter : pathFilter },
|
||||
function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, resolverDir + '/node_modules/deep/alt.js');
|
||||
});
|
||||
});
|
||||
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/main.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/main.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/alt.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/alt.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/deeper/ref.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/deeper/ref.js
generated
vendored
Normal file
4
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json
generated
vendored
Normal file
4
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "deep",
|
||||
"version": "1.2.3"
|
||||
}
|
||||
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/ref.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/ref.js
generated
vendored
Normal file
23
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence.js
generated
vendored
Normal file
23
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('precedence', function (t) {
|
||||
t.plan(3);
|
||||
var dir = path.join(__dirname, 'precedence/aaa');
|
||||
|
||||
resolve('./', { basedir : dir }, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
t.equal(pkg.name, 'resolve');
|
||||
});
|
||||
});
|
||||
|
||||
test('./ should not load ${dir}.js', function (t) {
|
||||
t.plan(1);
|
||||
var dir = path.join(__dirname, 'precedence/bbb');
|
||||
|
||||
resolve('./', { basedir : dir }, function (err, res, pkg) {
|
||||
t.ok(err);
|
||||
});
|
||||
});
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/aaa.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/aaa.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'wtf'
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/aaa/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/aaa/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'okok'
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/aaa/main.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/aaa/main.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
console.log(require('./'))
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/bbb.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/bbb.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports '>_<'
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/bbb/main.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/precedence/bbb/main.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
console.log(require('./')); // should throw
|
||||
281
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver.js
generated
vendored
Normal file
281
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver.js
generated
vendored
Normal file
@ -0,0 +1,281 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('async foo', function (t) {
|
||||
t.plan(9);
|
||||
var dir = __dirname + '/resolver';
|
||||
|
||||
resolve('./foo', { basedir : dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/foo.js');
|
||||
t.equal(pkg.name, 'resolve');
|
||||
});
|
||||
|
||||
resolve('./foo.js', { basedir : dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/foo.js');
|
||||
t.equal(pkg.name, 'resolve');
|
||||
});
|
||||
|
||||
resolve('./foo', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/foo.js');
|
||||
t.equal(pkg.main, 'resolver');
|
||||
});
|
||||
|
||||
resolve('./foo.js', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/foo.js');
|
||||
t.equal(pkg.main, 'resolver');
|
||||
});
|
||||
|
||||
resolve('foo', { basedir : dir }, function (err) {
|
||||
t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('bar', function (t) {
|
||||
t.plan(6);
|
||||
var dir = __dirname + '/resolver';
|
||||
|
||||
resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/bar/node_modules/foo/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/bar/node_modules/foo/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('foo', { basedir : dir + '/bar', package: { main: 'bar' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/bar/node_modules/foo/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
test('baz', function (t) {
|
||||
t.plan(4);
|
||||
var dir = __dirname + '/resolver';
|
||||
|
||||
resolve('./baz', { basedir : dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/baz/quux.js');
|
||||
t.equal(pkg.main, 'quux.js');
|
||||
});
|
||||
|
||||
resolve('./baz', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/baz/quux.js');
|
||||
t.equal(pkg.main, 'quux.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('biz', function (t) {
|
||||
t.plan(24);
|
||||
var dir = __dirname + '/resolver/biz/node_modules';
|
||||
|
||||
resolve('./grux', { basedir : dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/grux/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./grux', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/grux/index.js');
|
||||
t.equal(pkg.main, 'biz');
|
||||
});
|
||||
|
||||
resolve('./garply', { basedir : dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/garply/lib/index.js');
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('./garply', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/garply/lib/index.js');
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir : dir + '/grux' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/tiv/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir : dir + '/grux', package: { main: 'grux' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/tiv/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir : dir + '/garply' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/tiv/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir : dir + '/garply', package: { main: './lib' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/tiv/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('grux', { basedir : dir + '/tiv' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/grux/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('grux', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/grux/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('garply', { basedir : dir + '/tiv' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/garply/lib/index.js');
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('garply', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/garply/lib/index.js');
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
});
|
||||
|
||||
test('quux', function (t) {
|
||||
t.plan(2);
|
||||
var dir = __dirname + '/resolver/quux';
|
||||
|
||||
resolve('./foo', { basedir : dir, package: { main: 'quux' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/foo/index.js');
|
||||
t.equal(pkg.main, 'quux');
|
||||
});
|
||||
});
|
||||
|
||||
test('normalize', function (t) {
|
||||
t.plan(2);
|
||||
var dir = __dirname + '/resolver/biz/node_modules/grux';
|
||||
|
||||
resolve('../grux', { basedir : dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/index.js');
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
test('cup', function (t) {
|
||||
t.plan(3);
|
||||
var dir = __dirname + '/resolver';
|
||||
|
||||
resolve('./cup', { basedir : dir, extensions : [ '.js', '.coffee' ] },
|
||||
function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/cup.coffee');
|
||||
});
|
||||
|
||||
resolve('./cup.coffee', { basedir : dir }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/cup.coffee');
|
||||
});
|
||||
|
||||
resolve('./cup', { basedir : dir, extensions : [ '.js' ] },
|
||||
function (err, res) {
|
||||
t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('mug', function (t) {
|
||||
t.plan(3);
|
||||
var dir = __dirname + '/resolver';
|
||||
|
||||
resolve('./mug', { basedir : dir }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/mug.js');
|
||||
});
|
||||
|
||||
resolve('./mug', { basedir : dir, extensions : [ '.coffee', '.js' ] },
|
||||
function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/mug.coffee');
|
||||
});
|
||||
|
||||
resolve('./mug', { basedir : dir, extensions : [ '.js', '.coffee' ] },
|
||||
function (err, res) {
|
||||
t.equal(res, dir + '/mug.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('other path', function (t) {
|
||||
t.plan(4);
|
||||
var resolverDir = __dirname + '/resolver';
|
||||
var dir = resolverDir + '/bar';
|
||||
var otherDir = resolverDir + '/other_path';
|
||||
|
||||
resolve('root', { basedir : dir, paths: [otherDir] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, resolverDir + '/other_path/root.js');
|
||||
});
|
||||
|
||||
resolve('lib/other-lib', { basedir : dir, paths: [otherDir] },
|
||||
function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, resolverDir + '/other_path/lib/other-lib.js');
|
||||
});
|
||||
|
||||
resolve('root', { basedir : dir, }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'");
|
||||
});
|
||||
|
||||
resolve('zzz', { basedir : dir, paths: [otherDir] }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('incorrect main', function (t) {
|
||||
t.plan(1)
|
||||
|
||||
var resolverDir = __dirname + '/resolver';
|
||||
var dir = resolverDir + '/incorrect_main';
|
||||
|
||||
resolve('./incorrect_main', { basedir : resolverDir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, dir + '/index.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('without basedir', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var dir = __dirname + '/resolver/without_basedir';
|
||||
var tester = require(dir + '/main.js');
|
||||
|
||||
tester(t, function (err, res, pkg){
|
||||
if (err) {
|
||||
t.fail(err);
|
||||
} else {
|
||||
t.equal(res, dir + '/node_modules/mymodule.js');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('#25: node modules with the same name as node stdlib modules', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = __dirname + '/resolver/punycode';
|
||||
|
||||
resolve('punycode', { basedir : resolverDir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, resolverDir + '/node_modules/punycode/index.js');
|
||||
});
|
||||
});
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/baz/doom.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/baz/doom.js
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/baz/package.json
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/baz/package.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"main" : "quux.js"
|
||||
}
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/baz/quux.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/baz/quux.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 'hello garply';
|
||||
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"main" : "./lib"
|
||||
}
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('tiv') * 100;
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 3;
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/cup.coffee
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/cup.coffee
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
|
||||
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/foo.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/foo.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
2
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/incorrect_main/index.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/incorrect_main/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate
|
||||
module.exports = 1;
|
||||
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/incorrect_main/package.json
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/incorrect_main/package.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"main" : "wrong.js"
|
||||
}
|
||||
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/mug.coffee
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/mug.coffee
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/mug.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/mug.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/other_path/lib/other-lib.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/other_path/lib/other-lib.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/other_path/root.js
generated
vendored
Normal file
0
static/js/ketcher2/node_modules/istanbul/node_modules/resolve/test/resolver/other_path/root.js
generated
vendored
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user