--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
4
node_modules/gulp-dedupe/.npmignore
generated
vendored
Normal file
4
node_modules/gulp-dedupe/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
node_modules
|
||||
npm-debug.log
|
||||
.DS_Store
|
||||
tmp
|
||||
7
node_modules/gulp-dedupe/.travis.yml
generated
vendored
Normal file
7
node_modules/gulp-dedupe/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.10"
|
||||
|
||||
before_install:
|
||||
- npm install -g mocha
|
||||
22
node_modules/gulp-dedupe/LICENSE
generated
vendored
Normal file
22
node_modules/gulp-dedupe/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Marat Abdullin
|
||||
|
||||
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.
|
||||
|
||||
30
node_modules/gulp-dedupe/README.md
generated
vendored
Normal file
30
node_modules/gulp-dedupe/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# gulp-dedupe [](https://travis-ci.org/hoho/gulp-dedupe)
|
||||
|
||||
Check for duplicates in the stream and filter them or throw an error.
|
||||
|
||||
|
||||
Install:
|
||||
|
||||
```sh
|
||||
npm install gulp-dedupe --save-dev
|
||||
```
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var dedupe = require('gulp-dedupe');
|
||||
|
||||
...
|
||||
.pipe(dedupe()) // Remove duplicates from previous tasks (if any).
|
||||
.pipe(concat('bundle.css')) // For example, we need to concat the result without duplicates.
|
||||
.pipe(gulp.dest('./build'));
|
||||
```
|
||||
|
||||
`dedupe(options)` optionally accepts `options` object. There are two options:
|
||||
|
||||
+ `error` to emit an error in case of duplicate (`false` by default).
|
||||
+ `same` to emit an error in case duplicates have different contents (`true` by
|
||||
default).
|
||||
+ `diff` to supply duplicates with different contents error (`same: true`)
|
||||
with actual diff (`false` by default).
|
||||
68
node_modules/gulp-dedupe/index.js
generated
vendored
Normal file
68
node_modules/gulp-dedupe/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*!
|
||||
* gulp-dedupe, https://github.com/hoho/gulp-dedupe
|
||||
* (c) 2014 Marat Abdullin, MIT license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var through = require('through');
|
||||
var gutil = require('gulp-util');
|
||||
var PluginError = gutil.PluginError;
|
||||
var path = require('path');
|
||||
var defaults = require('lodash.defaults');
|
||||
|
||||
|
||||
module.exports = function(options) {
|
||||
var filesMap = {};
|
||||
|
||||
options = defaults(options || {}, {
|
||||
error: false, // Throw an error in case of duplicate.
|
||||
same: true, // Throw an error in case duplicates have different contents.
|
||||
diff: false // Supply duplicates with different content error with actual diff.
|
||||
});
|
||||
|
||||
function bufferContents(file) {
|
||||
if (file.isNull()) { return; }
|
||||
if (file.isStream()) { return this.emit('error', new PluginError('gulp-dedupe', 'Streaming not supported')); }
|
||||
|
||||
var fullpath = path.resolve(file.path),
|
||||
f;
|
||||
|
||||
if ((f = filesMap[fullpath])) {
|
||||
if (options.error) {
|
||||
this.emit('error', new PluginError('gulp-dedupe', 'Duplicate `' + file.path + '`'));
|
||||
} else if (options.same && file.contents.toString() !== f.contents.toString()) {
|
||||
var errorDiff = [];
|
||||
|
||||
if (options.diff) {
|
||||
require('colors');
|
||||
var diff = require('diff').diffChars(file.contents.toString(), f.contents.toString());
|
||||
|
||||
errorDiff.push(':\n');
|
||||
|
||||
diff.forEach(function(part){
|
||||
// green for additions, red for deletions
|
||||
// grey for common parts
|
||||
var color = part.added ? 'green' :
|
||||
part.removed ? 'red' : 'grey';
|
||||
errorDiff.push(part.value[color]);
|
||||
});
|
||||
}
|
||||
|
||||
errorDiff = errorDiff.join('');
|
||||
|
||||
this.emit('error', new PluginError('gulp-dedupe', 'Duplicate file `' + file.path + '` with different contents' + errorDiff));
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
filesMap[fullpath] = file;
|
||||
}
|
||||
this.emit('data', file);
|
||||
}
|
||||
|
||||
function endStream() {
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
return through(bufferContents, endStream);
|
||||
};
|
||||
95
node_modules/gulp-dedupe/package.json
generated
vendored
Normal file
95
node_modules/gulp-dedupe/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "gulp-dedupe@0.0.2",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-dedupe",
|
||||
"name": "gulp-dedupe",
|
||||
"rawSpec": "0.0.2",
|
||||
"spec": "0.0.2",
|
||||
"type": "version"
|
||||
},
|
||||
"/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui"
|
||||
]
|
||||
],
|
||||
"_from": "gulp-dedupe@0.0.2",
|
||||
"_id": "gulp-dedupe@0.0.2",
|
||||
"_inCache": true,
|
||||
"_location": "/gulp-dedupe",
|
||||
"_npmUser": {
|
||||
"name": "hoho",
|
||||
"email": "dakota@brokenpipe.ru"
|
||||
},
|
||||
"_npmVersion": "1.4.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "gulp-dedupe@0.0.2",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-dedupe",
|
||||
"name": "gulp-dedupe",
|
||||
"rawSpec": "0.0.2",
|
||||
"spec": "0.0.2",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/semantic-ui"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-dedupe/-/gulp-dedupe-0.0.2.tgz",
|
||||
"_shasum": "36ef92adf7fcf53e2f096fbe9665d988f9e1ca7e",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "gulp-dedupe@0.0.2",
|
||||
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui",
|
||||
"author": {
|
||||
"name": "Marat Abdullin",
|
||||
"email": "dakota@brokenpipe.ru"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/hoho/gulp-dedupe/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"colors": "~1.0.2",
|
||||
"diff": "~1.0.8",
|
||||
"gulp-util": "~3.0.1",
|
||||
"lodash.defaults": "~2.4.1",
|
||||
"through": "~2.3.6"
|
||||
},
|
||||
"description": "Check for duplicates in the stream and filter them or throw an error",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "36ef92adf7fcf53e2f096fbe9665d988f9e1ca7e",
|
||||
"tarball": "https://registry.npmjs.org/gulp-dedupe/-/gulp-dedupe-0.0.2.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
},
|
||||
"homepage": "https://github.com/hoho/gulp-dedupe",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"dedupe",
|
||||
"duplicates"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "hoho",
|
||||
"email": "dakota@brokenpipe.ru"
|
||||
}
|
||||
],
|
||||
"name": "gulp-dedupe",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hoho/gulp-dedupe.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.0.2"
|
||||
}
|
||||
128
node_modules/gulp-dedupe/test/main.js
generated
vendored
Normal file
128
node_modules/gulp-dedupe/test/main.js
generated
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
var dedupe = require('../');
|
||||
var should = require('should');
|
||||
var through = require('through');
|
||||
var path = require('path');
|
||||
var File = require('gulp-util').File;
|
||||
var Buffer = require('buffer').Buffer;
|
||||
var fs = require('fs');
|
||||
require('mocha');
|
||||
|
||||
|
||||
describe('gulp-dedupe', function() {
|
||||
describe('dedupe()', function() {
|
||||
testDedupe(
|
||||
undefined,
|
||||
[
|
||||
'file1.txt', 'Contents1',
|
||||
'file1.txt', 'Contents1',
|
||||
'file2.txt', 'Contents2',
|
||||
'file1.txt', 'Contents1',
|
||||
'file2.txt', 'Contents2',
|
||||
'file3.txt', 'Contents3',
|
||||
'file4.txt', 'Contents4',
|
||||
'test/file1.txt', 'Contents1',
|
||||
'file4.txt', 'Contents4'
|
||||
],
|
||||
[
|
||||
'file1.txt', 'Contents1',
|
||||
'file2.txt', 'Contents2',
|
||||
'file3.txt', 'Contents3',
|
||||
'file4.txt', 'Contents4',
|
||||
'test/file1.txt', 'Contents1'
|
||||
]
|
||||
);
|
||||
|
||||
testDedupe(
|
||||
{error: true},
|
||||
[
|
||||
'file1.txt', 'Contents1',
|
||||
'file1.txt', 'Contents1'
|
||||
],
|
||||
[
|
||||
'file1.txt', 'Contents1', 'Duplicate `file1.txt`'
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
testDedupe(
|
||||
undefined,
|
||||
[
|
||||
'file1.txt', 'Contents1',
|
||||
'file1.txt', 'Contents2'
|
||||
],
|
||||
[
|
||||
'file1.txt', 'Contents1', 'Duplicate file `file1.txt` with different contents'
|
||||
]
|
||||
);
|
||||
|
||||
testDedupe(
|
||||
{diff: true},
|
||||
[
|
||||
'file1.txt', 'Contents1',
|
||||
'file1.txt', 'Contents2'
|
||||
],
|
||||
[
|
||||
'file1.txt', 'Contents1', 'Duplicate file `file1.txt` with different contents:\n'
|
||||
]
|
||||
);
|
||||
|
||||
testDedupe(
|
||||
{same: false},
|
||||
[
|
||||
'file1.txt', 'Contents1',
|
||||
'file1.txt', 'Contents2'
|
||||
],
|
||||
[
|
||||
'file1.txt', 'Contents1'
|
||||
]
|
||||
);
|
||||
|
||||
function testDedupe(options, files, results) {
|
||||
var stream = dedupe(options);
|
||||
|
||||
it('should dedupe files', function(done) {
|
||||
stream.on('data', function (file) {
|
||||
var expectedFilename = results.shift(),
|
||||
expectedHead = results.shift();
|
||||
should.exist(file);
|
||||
should.exist(file.relative);
|
||||
should.exist(file.contents);
|
||||
should.exist(expectedFilename);
|
||||
should.exist(expectedHead);
|
||||
|
||||
var retFilename = path.resolve(file.path);
|
||||
retFilename.should.equal(path.resolve(expectedFilename));
|
||||
file.relative.should.equal(expectedFilename);
|
||||
|
||||
Buffer.isBuffer(file.contents).should.equal(true);
|
||||
file.contents.toString().substring(0, expectedHead.length).should.equal(expectedHead);
|
||||
|
||||
if (results && !results.length) {
|
||||
results = null;
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('error', function(err) {
|
||||
var expected = results.shift();
|
||||
var msg = (err.message || '').substring(0, expected.length);
|
||||
msg.should.equal(expected);
|
||||
});
|
||||
|
||||
while (files.length) {
|
||||
stream.write(new File({
|
||||
path: files.shift(),
|
||||
contents: new Buffer(files.shift())
|
||||
}));
|
||||
}
|
||||
|
||||
stream.end();
|
||||
|
||||
if (results && !results.length) {
|
||||
results = null;
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue