forked from enviPath/enviPy
Current Dev State
This commit is contained in:
21
static/js/ketcher2/node_modules/gulp-cond/LICENCE
generated
vendored
Executable file
21
static/js/ketcher2/node_modules/gulp-cond/LICENCE
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2013 Nicolas Froidure, <http://insertafter.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.
|
||||
85
static/js/ketcher2/node_modules/gulp-cond/README.md
generated
vendored
Normal file
85
static/js/ketcher2/node_modules/gulp-cond/README.md
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
# gulp-cond
|
||||
> A ternary operator for [Gulp](http://gulpjs.com/).
|
||||
|
||||
[](https://npmjs.org/package/gulp-cond)
|
||||
[](https://travis-ci.org/nfroidure/gulp-cond)
|
||||
[](https://david-dm.org/nfroidure/gulp-cond)
|
||||
[](https://david-dm.org/nfroidure/gulp-cond#info=devDependencies)
|
||||
[](https://coveralls.io/r/nfroidure/gulp-cond?branch=master)
|
||||
|
||||
## Usage
|
||||
|
||||
First, install `gulp-cond` as a development dependency:
|
||||
|
||||
```shell
|
||||
npm install --save-dev gulp-cond
|
||||
```
|
||||
|
||||
Then, use it to conditionnaly pipe plugins in your `gulpfile.js`:
|
||||
|
||||
```js
|
||||
var cond = require('gulp-cond');
|
||||
var prod = gulp.env.prod;
|
||||
|
||||
// Images
|
||||
gulp.task('build_images', function() {
|
||||
gulp.src('assets/images/**/*.svg')
|
||||
.pipe(cond(prod,
|
||||
gSvgmin(options), // minify SVG images under production
|
||||
gWatch().pipe(gLivereload(server))) // use live reload in dev mode
|
||||
)
|
||||
.pipe(gulp.dest('www/images'))
|
||||
});
|
||||
```
|
||||
|
||||
Alternatively, you can provide plugin functions instead of streams to
|
||||
instanciate streams only when needed :
|
||||
|
||||
```js
|
||||
var cond = require('gulp-cond');
|
||||
var prod = gulp.env.prod;
|
||||
|
||||
// Images
|
||||
gulp.task('build_images', function() {
|
||||
gulp.src('assets/images/**/*.svg')
|
||||
.pipe(cond(prod,
|
||||
gSvgmin.bind(null, options), // minify SVG images under production
|
||||
function () { // use live reload in dev mode
|
||||
return gWatch().pipe(gLivereload(server));
|
||||
})
|
||||
)
|
||||
.pipe(gulp.dest('www/images'))
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cond(condition, expr1, expr2)
|
||||
|
||||
#### condition
|
||||
Type: `Boolean` or `Function`
|
||||
|
||||
Required. A value or a function providing a value. If the value is truthy, expr1
|
||||
will be used, else, expr2 will be use if provided.
|
||||
|
||||
#### expr1
|
||||
Type: `Stream` or `Function`
|
||||
|
||||
Required. A stream or a function providing a stream.
|
||||
|
||||
#### expr2
|
||||
Type: `Stream` or `Function`
|
||||
Default value: `Stream.PassThrough`
|
||||
|
||||
A stream or a function providing a stream.
|
||||
|
||||
## Stats
|
||||
|
||||
[](https://nodei.co/npm/gulp-iconfont/)
|
||||
[](https://nodei.co/npm/gulp-iconfont/)
|
||||
|
||||
### Contributing / Issues
|
||||
|
||||
You may want to contribute to this project, pull requests are welcome if you
|
||||
accept to publish under the MIT licence.
|
||||
|
||||
76
static/js/ketcher2/node_modules/gulp-cond/package.json
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/gulp-cond/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "gulp-cond@^1.0.0",
|
||||
"_id": "gulp-cond@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-mYDDzcr6m8TNMKuHEIesE1lVtVg=",
|
||||
"_location": "/gulp-cond",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "gulp-cond@^1.0.0",
|
||||
"name": "gulp-cond",
|
||||
"escapedName": "gulp-cond",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-iconfont"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-cond/-/gulp-cond-1.0.0.tgz",
|
||||
"_shasum": "9980c3cdcafa9bc4cd30ab871087ac135955b558",
|
||||
"_spec": "gulp-cond@^1.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/gulp-iconfont",
|
||||
"author": {
|
||||
"name": "Nicolas Froidure",
|
||||
"url": "http://www.insertafter.com/blog.html"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nfroidure/gulp-cond/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Ternary operator for Gulp.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "^0.3.16",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-lcov-reporter": "0.0.2",
|
||||
"streamtest": "^1.2.1",
|
||||
"vinyl": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"homepage": "https://github.com/nfroidure/gulp-cond",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"gulp",
|
||||
"gulp-plugin",
|
||||
"condition",
|
||||
"operator",
|
||||
"ternary"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/nfroidure/gulp-cond/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "src/index.js",
|
||||
"name": "gulp-cond",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nfroidure/gulp-cond.git"
|
||||
},
|
||||
"scripts": {
|
||||
"cover": "./node_modules/istanbul/lib/cli.js cover --report html ./node_modules/mocha/bin/_mocha -- tests/*.mocha.js -R spec -t 5000",
|
||||
"coveralls": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report lcovonly -- tests/*.mocha.js -R spec -t 5000 && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
|
||||
"test": "mocha tests/*.mocha.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
20
static/js/ketcher2/node_modules/gulp-cond/src/index.js
generated
vendored
Normal file
20
static/js/ketcher2/node_modules/gulp-cond/src/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
var Stream = require('readable-stream');
|
||||
|
||||
var PLUGIN_NAME = 'gulp-cond';
|
||||
|
||||
function gulpCond(condition, expr1, expr2) {
|
||||
var value = 'function' == typeof condition ? condition() : condition;
|
||||
var outStream;
|
||||
|
||||
if(value) {
|
||||
outStream = 'function' == typeof expr1 ? expr1() : expr1;
|
||||
} else if(expr2) {
|
||||
outStream = 'function' == typeof expr2 ? expr2() : expr2;
|
||||
} else {
|
||||
outStream = new Stream.PassThrough({objectMode: true});
|
||||
}
|
||||
|
||||
return outStream;
|
||||
};
|
||||
|
||||
module.exports = gulpCond;
|
||||
294
static/js/ketcher2/node_modules/gulp-cond/tests/index.mocha.js
generated
vendored
Normal file
294
static/js/ketcher2/node_modules/gulp-cond/tests/index.mocha.js
generated
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
'use strict';
|
||||
|
||||
var StreamTest = require('streamtest');
|
||||
var assert = require('assert');
|
||||
var gulpCond = require('../src');
|
||||
var Stream = require('readable-stream');
|
||||
var File = require('vinyl');
|
||||
|
||||
function getStream(version) {
|
||||
return StreamTest[version].fromObjects([
|
||||
new File({
|
||||
path: 'file.foo',
|
||||
contents: null
|
||||
}),
|
||||
new File({
|
||||
path: 'file.foo',
|
||||
contents: null
|
||||
}),
|
||||
new File({
|
||||
path: 'file.foo',
|
||||
contents: null
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
function getTrans(prefix) {
|
||||
return Stream.Transform({
|
||||
objectMode: true,
|
||||
transform: function(file, unused, cb) {
|
||||
file.path = prefix + file.path;
|
||||
cb(null, file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
describe('gulp-cond', function() {
|
||||
|
||||
StreamTest.versions.forEach(function (version) {
|
||||
|
||||
describe('for ' + version + ' streams', function() {
|
||||
|
||||
describe('with a valid condition', function() {
|
||||
|
||||
describe('as a value', function() {
|
||||
|
||||
it('should work with stream', function(done) {
|
||||
var n = 0;
|
||||
var ended1 = false;
|
||||
var ended2 = false;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(true, getTrans('1').once('end', function() {
|
||||
ended1 = true;
|
||||
}), getTrans('2').once('end', function() {
|
||||
ended2 = true;
|
||||
})))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '1file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(ended1, true);
|
||||
assert.equal(ended2, false);
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with fn returning a stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(true, getTrans.bind(null, '1'), getTrans.bind(null, '2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '1file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('as a function', function() {
|
||||
|
||||
it('should work', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(function () {
|
||||
return true;
|
||||
}, getTrans('1'), getTrans('2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '1file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with fn returning a stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(function () {
|
||||
return true;
|
||||
}, getTrans.bind(null, '1'), getTrans.bind(null, '2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '1file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('with an invalid condition and a expr2', function() {
|
||||
|
||||
describe('as a value', function() {
|
||||
|
||||
it('should work with stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(false, getTrans('1'), getTrans('2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '2file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with fn returning a stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(false, getTrans.bind(null, '1'), getTrans.bind(null, '2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '2file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('as a function', function() {
|
||||
|
||||
it('should work', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(function () {
|
||||
return false;
|
||||
}, getTrans('1'), getTrans('2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '2file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with fn returning a stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(function () {
|
||||
return false;
|
||||
}, getTrans.bind(null, '1'), getTrans.bind(null, '2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '2file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('with an invalid condition and no expr2', function() {
|
||||
|
||||
describe('as a value', function() {
|
||||
|
||||
it('should work with stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(false, getTrans('1')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, 'file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with fn returning a stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(false, getTrans.bind(null, '1')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, 'file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('as a function', function() {
|
||||
|
||||
it('should work', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(function () {
|
||||
return false;
|
||||
}, getTrans('1')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, 'file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with fn returning a stream', function(done) {
|
||||
var n = 0;
|
||||
|
||||
getStream(version)
|
||||
.pipe(gulpCond(function () {
|
||||
return false;
|
||||
}, getTrans.bind(null, '1'), getTrans.bind(null, '2')))
|
||||
.pipe(StreamTest[version].toObjects(function(err, objs) {
|
||||
objs.forEach(function (file) {
|
||||
assert.equal(file.path, '2file.foo');
|
||||
assert.equal(file.contents, null);
|
||||
n++;
|
||||
});
|
||||
assert.equal(n, 3);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user