This commit is contained in:
oitsjustjose 2017-02-26 17:06:42 -05:00
commit 6b60015c02
9588 changed files with 1149251 additions and 49 deletions

15
node_modules/gulp-flatten/.npmignore generated vendored Normal file
View file

@ -0,0 +1,15 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
npm-debug.log
node_modules

5
node_modules/gulp-flatten/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,5 @@
language: node_js
node_js:
- "iojs"
- "node"
- "0.10"

20
node_modules/gulp-flatten/LICENSE generated vendored Normal file
View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Artem Medeusheyev
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.

169
node_modules/gulp-flatten/README.md generated vendored Normal file
View file

@ -0,0 +1,169 @@
# [gulp](http://gulpjs.com)-flatten [![NPM version](https://img.shields.io/npm/v/gulp-flatten.svg)](http://badge.fury.io/js/gulp-flatten) [![Build Status](https://api.travis-ci.org/armed/gulp-flatten.svg?branch=master)](https://travis-ci.org/armed/gulp-flatten)
>Remove or replace relative path for files (gulp v3).
## Install
```
npm install gulp-flatten
```
## Usage
Example source directory with bower compoments:
```
├── angular
│   ├── README.md
│   ├── angular-csp.css
│   ├── angular.js
│   ├── angular.min.js
│   └── bower.json
├── angular-route
│   ├── README.md
│   ├── angular-route.js
│   ├── angular-route.min.js
│   ├── angular-route.min.js.map
│   └── bower.json
├── angular-sanitize
│   ├── README.md
│   ├── angular-sanitize.js
│   ├── angular-sanitize.min.js
│   ├── angular-sanitize.min.js.map
│   └── bower.json
└── bootstrap
   ├── DOCS-LICENSE
   ├── LICENSE
   ├── LICENSE-MIT
   ├── README.md
   ├── bower.json
   └── dist
├── css
│   ├── bootstrap-theme.css
│   ├── bootstrap-theme.min.css
│   ├── bootstrap.css
│   └── bootstrap.min.css
├── fonts
│   ├── glyphicons-halflings-regular.eot
│   ├── glyphicons-halflings-regular.svg
│   ├── glyphicons-halflings-regular.ttf
│   └── glyphicons-halflings-regular.woff
└── js
├── bootstrap.js
└── bootstrap.min.js
```
By default `gulp` stores files with it's relative paths. To copy all minified javascript files from `bower_components` to `build` folder without relative paths:
```js
var flatten = require('gulp-flatten');
gulp.src('bower_components/**/*.min.js')
.pipe(flatten())
.pipe(gulp.dest('build/js'));
```
Result will be list of all `.min.js` files inside `build/js` dir:
```
build
└── js
├── angular-route.min.js
├── angular-sanitize.min.js
├── angular.min.js
└── bootstrap.min.js
```
## Options
### flatten(options)
#### options.newPath
Type: `String`
Default: `''`
Relative path for file.
#### options.includeParents
Type: `Number` or `Array` of two numbers
If passed in as positive number, it will include the number of top-level parents in the output. Using this code:
```js
gulp.src(['bower_components/**/*.css'])
.pipe(flatten({ includeParents: 1} ))
.pipe(gulp.dest('build/'));
```
will create this structure (from sample directory tree above):
```
└── bootstrap
├── bootstrap-theme.css
├── bootstrap-theme.min.css
├── bootstrap.css
├── bootstrap.min.css
└── bootstrap.min.js
```
If passed in as negative number, it will include the number of bottom-level parents in the output. Using this code:
```js
gulp.src(['bower_components/**/*.css'])
.pipe(flatten({ includeParents: -1} )) //or indludeParents: [0, 1]
.pipe(gulp.dest('build/'));
```
will create this structure:
```
└── css
├── bootstrap-theme.css
├── bootstrap-theme.min.css
├── bootstrap.css
├── bootstrap.min.css
└── bootstrap.min.js
```
If passes as array of two numbers, both parents from top and bottom will be kept in resulting path of a file.
```js
gulp.src(['bower_components/**/*.css'])
.pipe(flatten({ includeParents: [1, 1]} ))
.pipe(gulp.dest('build/'));
```
will create this structure:
```
└── bootstrap
└── css
├── bootstrap-theme.css
├── bootstrap-theme.min.css
├── bootstrap.css
└── bootstrap.min.css
```
#### options.subPath
Type: Number or Array of two Numbers [begin, end]
This options applies `Array.slice` to the array of path elements and allows you
to receive a subsequences of the path.
```js
gulp.src(['bower_components/**/*.css'])
.pipe(flatten({ subPath: [1, 1]} ))
.pipe(gulp.dest('build/'));
```
This as an example would flatten `top1/top2/bottom2/bottom1/file.txt` to `top2/file.txt`.
`[1, -1]` would flatten `top1/top2/bottom2/bottom1/file.txt` to `top2/bottom2/file.txt`.
Please refer to the [Array.slice documentation](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) for a detailed description.
**!** If you're using both `options.includeParents` combined with `options.subPath`
please note that `options.includeParents` is applied first.
## License
MIT

21
node_modules/gulp-flatten/index.js generated vendored Normal file
View file

@ -0,0 +1,21 @@
var path = require('path');
var through2 = require('through2');
var flattenPath = require('./lib/flatten-path');
var PluginError = require('gulp-util').PluginError;
module.exports = function(opts) {
opts = opts || {};
opts.newPath = opts.newPath || '';
return through2.obj(function(file, enc, next) {
if (!file.isDirectory()) {
try {
file.path = path.join(file.base, opts.newPath, flattenPath(file, opts));
this.push(file);
} catch (e) {
this.emit('error', new PluginError('gulp-flatten', e));
}
}
next();
});
};

69
node_modules/gulp-flatten/lib/flatten-path.js generated vendored Normal file
View file

@ -0,0 +1,69 @@
var path = require('path');
function includeParents(dirs, opts) {
var topLevels;
var bottomLevels = 0;
var topPath = [];
var bottomPath = [];
var newPath = [];
if (Array.isArray(opts)) {
topLevels = Math.abs(opts[0]);
bottomLevels = Math.abs(opts[1]);
} else if (opts >= 0) {
topLevels = opts;
} else {
bottomLevels = Math.abs(opts);
}
if (topLevels + bottomLevels > dirs.length) {
return dirs;
}
while (topLevels > 0) {
topPath.push(dirs.shift());
topLevels--;
}
while (bottomLevels > 0) {
bottomPath.unshift(dirs.pop());
bottomLevels--;
}
return topPath.concat(bottomPath);
}
function subPath(dirs, opts) {
if (Array.isArray(opts)) {
return dirs.slice(opts[0], opts[1]);
} else {
return dirs.slice(opts);
}
}
/**
* Flatten the path to the desired depth
*
* @param {File} file - vinyl file
* @param {Object} options
* @return {String}
*/
function flattenPath(file, opts) {
var fileName = path.basename(file.path);
var dirs;
if (!opts.includeParents && !opts.subPath) {
return fileName;
}
dirs = path.dirname(file.relative).split(path.sep);
if (opts.includeParents) {
dirs = includeParents(dirs, opts.includeParents);
}
if (opts.subPath) {
dirs = subPath(dirs, opts.subPath);
}
dirs.push(fileName);
return path.join.apply(path, dirs);
}
module.exports = flattenPath

103
node_modules/gulp-flatten/package.json generated vendored Normal file
View file

@ -0,0 +1,103 @@
{
"_args": [
[
{
"raw": "gulp-flatten@^0.3.1",
"scope": null,
"escapedName": "gulp-flatten",
"name": "gulp-flatten",
"rawSpec": "^0.3.1",
"spec": ">=0.3.1 <0.4.0",
"type": "range"
},
"/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui"
]
],
"_from": "gulp-flatten@>=0.3.1 <0.4.0",
"_id": "gulp-flatten@0.3.1",
"_inCache": true,
"_location": "/gulp-flatten",
"_nodeVersion": "6.2.2",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/gulp-flatten-0.3.1.tgz_1471072226352_0.27203780342824757"
},
"_npmUser": {
"name": "armed",
"email": "artem.medeusheyev@gmail.com"
},
"_npmVersion": "3.10.6",
"_phantomChildren": {},
"_requested": {
"raw": "gulp-flatten@^0.3.1",
"scope": null,
"escapedName": "gulp-flatten",
"name": "gulp-flatten",
"rawSpec": "^0.3.1",
"spec": ">=0.3.1 <0.4.0",
"type": "range"
},
"_requiredBy": [
"/semantic-ui"
],
"_resolved": "https://registry.npmjs.org/gulp-flatten/-/gulp-flatten-0.3.1.tgz",
"_shasum": "51e7fec13a33c404578d18c1589d1b5bc45fe1d6",
"_shrinkwrap": null,
"_spec": "gulp-flatten@^0.3.1",
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui",
"author": {
"name": "Artem Medeusheyev",
"email": "artem.medeusheyev@gmail.com"
},
"bugs": {
"url": "https://github.com/armed/gulp-flatten/issues"
},
"dependencies": {
"gulp-util": "^3.0.7",
"through2": "^2.0.0"
},
"description": "remove or replace relative path for files",
"devDependencies": {
"eslint-config-airbnb": "^1.0.2",
"gulp": "^3.9.0",
"mocha": "^2.3.4",
"pre-commit": "^1.1.2",
"should": "^7.1.1"
},
"directories": {},
"dist": {
"shasum": "51e7fec13a33c404578d18c1589d1b5bc45fe1d6",
"tarball": "https://registry.npmjs.org/gulp-flatten/-/gulp-flatten-0.3.1.tgz"
},
"engines": {
"node": ">=0.10"
},
"gitHead": "04c2b4625b947cd07acf6a924065eb13fe92f2ea",
"homepage": "https://github.com/armed/gulp-flatten",
"keywords": [
"gulpplugin",
"gulp",
"flatten",
"relative",
"path"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "armed",
"email": "artem.medeusheyev@gmail.com"
}
],
"name": "gulp-flatten",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/armed/gulp-flatten.git"
},
"scripts": {
"test": "mocha -R spec"
},
"version": "0.3.1"
}

75
node_modules/gulp-flatten/test/flatten-path.js generated vendored Normal file
View file

@ -0,0 +1,75 @@
var should = require('should');
var path = require('path');
var flattenPath = require('../lib/flatten-path');
var fileInstance;
describe('gulp-flatten', function () {
beforeEach(function () {
fileInstance = {
base: '/some/project/src/',
path: '/some/project/src/top1/top2/bottom2/bottom1/app.css',
relative: 'top1/top2/bottom2/bottom1/app.css'
};
});
describe('includeParents', function () {
it('should keep top parent dirs from indludeParents option', function (done) {
var topOnly = flattenPath(fileInstance, {includeParents: 1});
topOnly.should.equal('top1/app.css');
done();
});
it('should keep bottom parent dirs from indludeParents option', function (done) {
var bottomOnly = flattenPath(fileInstance, {includeParents: [0, 1]});
bottomOnly.should.equal('bottom1/app.css');
done();
});
it('should treat negative number in indludeParents as bottom parent levels', function (done) {
var bottomOnly = flattenPath(fileInstance, {includeParents: -1});
bottomOnly.should.equal('bottom1/app.css');
done();
});
it('should keep top and bottom parent dirs from indludeParents option', function (done) {
var both = flattenPath(fileInstance, {includeParents: [1, 2]});
both.should.equal('top1/bottom2/bottom1/app.css');
done();
});
it('should pick relative path if indludeParents bottom+top too long', function (done) {
var relative = flattenPath(fileInstance, {includeParents: [10, 10]});
relative.should.equal(fileInstance.relative);
done();
});
});
describe('subPath', function () {
it('should keep top parent dirs from subPath option', function (done) {
var topOnly = flattenPath(fileInstance, {subPath: [0, 2]});
topOnly.should.equal('top1/top2/app.css');
done();
});
it('should keep bottom parent dirs from subPath option', function (done) {
var bottomOnly = flattenPath(fileInstance, {subPath: -2});
bottomOnly.should.equal('bottom2/bottom1/app.css');
done();
});
it('should keep top2 and bottom2 from subPath option', function (done) {
var middleOnly = flattenPath(fileInstance, {subPath: [1, -1]});
middleOnly.should.equal('top2/bottom2/app.css');
done();
});
});
});

129
node_modules/gulp-flatten/test/main.js generated vendored Normal file
View file

@ -0,0 +1,129 @@
var should = require('should');
var flatten = require('../');
var File = require('gulp-util').File;
var gulp = require('gulp');
var path = require('path');
var fileInstance;
describe('gulp-flatten', function () {
beforeEach(function () {
fileInstance = new File({
cwd: '/some/project/',
base: '/some/project/src/',
path: '/some/project/src/assets/css/app.css',
contents: new Buffer('html { background-color: #777; }')
});
});
describe('flatten()', function () {
it('should strip relative path without options', function (done) {
var stream = flatten();
stream.on('error', done);
stream.on('data', function(newFile) {
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.relative);
newFile.relative.should.equal('app.css');
done();
});
stream.write(fileInstance);
});
it('should replace relative path with option path', function (done) {
var stream = flatten({newPath: 'new/path'});
stream.on('error', done);
stream.on('data', function(newFile) {
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.relative);
newFile.relative.should.equal('new/path/app.css'.split('/').join(path.sep));
done();
});
stream.write(fileInstance);
});
it('should emit arg error with nonstring option', function (done) {
var stream = flatten(123);
stream.on('error', function (err) {
should.exist(err);
should.exist(err.message);
should.ok(err.message === 'Path must be a string. Received undefined'
|| err.message === 'Arguments to path.join must be strings')
done();
});
stream.write(fileInstance);
});
it('should ignore directories', function (done) {
var stream = flatten();
stream.on('error', done);
stream.on('data', function(newFile) {
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.relative);
newFile.relative.should.equal('test.css');
done();
});
gulp.task('dottask', function () {
gulp.src(path.join(__dirname, '/test_dir/**/*.css'))
.pipe(stream);
});
gulp.start('dottask');
});
it('should strip relative path at the specified depth if depth option is passed', function (done) {
var stream = flatten({includeParents: 2});
stream.on('error', done);
stream.on('data', function(newFile) {
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.relative);
newFile.relative.should.equal('one/two/app.css'.split('/').join(path.sep));
done();
});
fileInstance.path = '/some/project/src/one/two/three/four/app.css';
stream.write(fileInstance);
});
it('should leave path from the end if depth option is passed as negative number', function (done) {
var stream = flatten({includeParents: -2});
stream.on('error', done);
stream.on('data', function(newFile) {
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.relative);
newFile.relative.should.equal('three/four/app.css'.split('/').join(path.sep));
done();
});
fileInstance.path = '/some/project/src/one/two/three/four/app.css';
stream.write(fileInstance);
});
it('should make no changes if the absolute depth option is greater than the tree depth', function (done) {
var stream = flatten({includeParents: 8});
stream.on('error', done);
stream.on('data', function(newFile) {
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.relative);
newFile.relative.should.equal('one/two/three/four/app.css'.split('/').join(path.sep));
done();
});
fileInstance.path = '/some/project/src/one/two/three/four/app.css';
stream.write(fileInstance);
});
});
});

View file

@ -0,0 +1,3 @@
.myclass {
color: red;
}