diff options
Diffstat (limited to 'node_modules/gulp')
81 files changed, 6008 insertions, 0 deletions
diff --git a/node_modules/gulp/CHANGELOG.md b/node_modules/gulp/CHANGELOG.md new file mode 100644 index 000000000..d9846eab7 --- /dev/null +++ b/node_modules/gulp/CHANGELOG.md @@ -0,0 +1,233 @@ +# gulp changelog + +## 3.9.0 + +- add babel support +- add transpiler fallback support +- add support for some renamed transpilers (livescript, etc) +- add JSCS +- update dependecies (liftoff, interpret) +- documentation tweaks + +## 3.8.11 + +- fix node 0.12/iojs problems +- add node 0.12 and iojs to travis +- update dependencies (liftoff, v8flags) +- documentation tweaks + +## 3.8.10 + +- add link to spanish docs +- update dependencies (archy, semver, mocha, etc) +- documentation tweaks + +## 3.8.9 + +- fix local version undefined output +- add completion for fish shell +- fix powershell completion line splitting +- add support for arbitrary node flags (oops, should have been a minor bump) +- add v8flags dependency +- update dependencies (liftoff) +- documentation tweaks + +## 3.8.8 + +- update dependencies (minimist, tildify) +- documentation tweaks + +## 3.8.7 + +- handle errors a bit better +- update dependencies (gulp-util, semver, etc) +- documentation tweaks + +## 3.8.6 + +- remove executable flag from LICENSE +- update dependencies (chalk, minimist, liftoff, etc) +- documentation tweaks + +## 3.8.5 + +- simplify --silent and --tasks-simple +- fix bug in autocomplete where errors would come out + +## 3.8.4 + +- CLI will use exit code 1 on exit when any task fails during the lifetime of the process + + +## 3.8.3 + +- Tweak error formatting to work better with PluginErrors and strings + +## 3.8.2 + +- add manpage generation + +## 3.8.1 + +- the CLI now adds process.env.INIT_CWD which is the original cwd it was launched from + +## 3.8.0 + +- update vinyl-fs + - gulp.src is now a writable passthrough, this means you can use it to add files to your pipeline at any point + - gulp.dest can now take a function to determine the folder + +This is now possible! + +```js +gulp.src('lib/*.js') + .pipe(uglify()) + .pipe(gulp.src('styles/*.css')) + .pipe(gulp.dest(function(file){ + // I don't know, you can do something cool here + return 'build/whatever'; + })); +``` + +## 3.7.0 + +- update vinyl-fs to remove BOM from UTF8 files +- add --tasks-simple flag for plaintext task listings +- updated autocomplete scripts to be simpler and use new --tasks-simple flag +- added support for transpilers via liftoff 0.11 and interpret + - just npm install your compiler (coffee-script for example) and it will work out of the box + +## 3.5.5 + +- update deps +- gulp.dest now support mode option, uses source file mode by default (file.stat.mode) +- use chalk for colors in bin +- update gulp.env deprecation msg to be more helpful + + +## 3.5.2 + +- add -V for version on CLI (unix standard) +- -v is deprecated, use -V +- add -T as an alias for --tasks +- documentation + +## 3.5 + +- added `gulp.watch(globs, tasksArray)` sugar +- remove gulp.taskQueue +- deprecate gulp.run +- deprecate gulp.env +- add engineStrict to prevent people with node < 0.9 from installing + +## 3.4 + +- added `--tasks` that prints out the tree of tasks + deps +- global cli + local install mismatch is no longer fatal +- remove tests for fs stuff +- switch core src, dest, and watch to vinyl-fs +- internal cleaning + +## 3.3.4 + +- `--base` is now `--cwd` + +## 3.3.3 + +- support for `--base` CLI arg to change where the search for gulpfile/`--require`s starts +- support for `--gulpfile` CLI arg to point to a gulpfile specifically + +## 3.3.0 + +- file.contents streams are no longer paused coming out of src +- dest now passes files through before they are empty to fix passing to multiple dests + +## 3.2.4 + +- Bug fix - we didn't have any CLI tests + +## 3.2.3 + +- Update dependencies for bug fixes +- autocomplete stuff in the completion folder + +## 3.2 + +- File object is now [vinyl](https://github.com/wearefractal/vinyl) +- .watch() is now [glob-watcher](https://github.com/wearefractal/glob-watcher) +- Fix CLI -v when no gulpfile found +- gulp-util updated +- Logging moved to CLI bin file + - Will cause double logging if you update global CLI to 3.2 but not local + - Will cause no logging if you update local to 3.1 but not global CLI +- Drop support for < 0.9 + +## 3.1.3 + +- Move isStream and isBuffer to gulp-util + +## 3.1 + +- Move file class to gulp-util + +## 3.0 + +- Ability to pass multiple globs and glob negations to glob-stream +- Breaking change to the way glob-stream works +- File object is now a class +- file.shortened changed to file.relative +- file.cwd added +- Break out getStats to avoid nesting +- Major code reorganization + +## 2.7 + +- Breaking change to the way options are passed to glob-stream +- Introduce new File object to ease pain of computing shortened names (now a getter) + +## 2.4 - 2.6 + +- Moved stuff to gulp-util +- Quit exposing createGlobStream (just use the glob-stream module) +- More logging +- Prettier time durations +- Tons of documentation changes +- gulp.trigger(tasks...) as a through stream + +## 1.2-2.4 (11/12/13) + +- src buffer=false fixed for 0.8 and 0.9 (remember to .resume() on these versions before consuming) +- CLI completely rewritten + - Colorful logging + - Uses local version of gulp to run tasks + - Uses findup to locate gulpfile (so you can run it anywhere in your project) + - chdir to gulpfile directory before loading it + - Correct exit codes on errors +- silent flag added to gulp to disable logging +- Fixes to task orchestration (3rd party) +- Better support for globbed directories (thanks @robrich) + +## 1.2 (10/28/13) + +- Can specify buffer=false on src streams to make file.content a stream +- Can specify read=false on src streams to disable file.content + +## 1.1 (10/21/13) + +- Can specify run callback +- Can specify task dependencies +- Tasks can accept callback or return promise +- `gulp.verbose` exposes run-time internals + +## 1.0 (9/26/13) + +- Specify dependency versions +- Updated docs + +## 0.2 (8/6/13) + +- Rename .files() to .src() and .folder() to .dest() + +## 0.1 (7/18/13) + +- Initial Release diff --git a/node_modules/gulp/LICENSE b/node_modules/gulp/LICENSE new file mode 100644 index 000000000..ee25a9095 --- /dev/null +++ b/node_modules/gulp/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2013-2016 Fractal <contact@wearefractal.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. diff --git a/node_modules/gulp/README.md b/node_modules/gulp/README.md new file mode 100644 index 000000000..b67798c75 --- /dev/null +++ b/node_modules/gulp/README.md @@ -0,0 +1,103 @@ +<p align="center"> + <a href="http://gulpjs.com"> + <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png"> + </a> + <p align="center">The streaming build system</p> +</p> + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +## What is gulp? + +- **Automation** - gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow. +- **Platform-agnostic** - Integrations are built into all major IDEs and people are using gulp with PHP, .NET, Node.js, Java, and other platforms. +- **Strong Ecosystem** - Use npm modules to do anything you want + over 2000 curated plugins for streaming file transformations +- **Simple** - By providing only a minimal API surface, gulp is easy to learn and simple to use + +## Documentation + +For a Getting started guide, API docs, recipes, making a plugin, etc. check out or docs! + +- Need something reliable? Check out the [documentation for the current release](/docs/README.md)! +- Want to help us test the latest and greatest? Check out the [documentation for the next release](https://github.com/gulpjs/gulp/tree/4.0)! + +## Sample `gulpfile.js` + +This file will give you a taste of what gulp does. + +```js +var gulp = require('gulp'); +var coffee = require('gulp-coffee'); +var concat = require('gulp-concat'); +var uglify = require('gulp-uglify'); +var imagemin = require('gulp-imagemin'); +var sourcemaps = require('gulp-sourcemaps'); +var del = require('del'); + +var paths = { + scripts: ['client/js/**/*.coffee', '!client/external/**/*.coffee'], + images: 'client/img/**/*' +}; + +// Not all tasks need to use streams +// A gulpfile is just another node program and you can use any package available on npm +gulp.task('clean', function() { + // You can use multiple globbing patterns as you would with `gulp.src` + return del(['build']); +}); + +gulp.task('scripts', ['clean'], function() { + // Minify and copy all JavaScript (except vendor scripts) + // with sourcemaps all the way down + return gulp.src(paths.scripts) + .pipe(sourcemaps.init()) + .pipe(coffee()) + .pipe(uglify()) + .pipe(concat('all.min.js')) + .pipe(sourcemaps.write()) + .pipe(gulp.dest('build/js')); +}); + +// Copy all static images +gulp.task('images', ['clean'], function() { + return gulp.src(paths.images) + // Pass in options to the task + .pipe(imagemin({optimizationLevel: 5})) + .pipe(gulp.dest('build/img')); +}); + +// Rerun the task when a file changes +gulp.task('watch', function() { + gulp.watch(paths.scripts, ['scripts']); + gulp.watch(paths.images, ['images']); +}); + +// The default task (called when you run `gulp` from cli) +gulp.task('default', ['watch', 'scripts', 'images']); +``` + +## Incremental Builds + +We recommend these plugins: + +- [gulp-changed](https://github.com/sindresorhus/gulp-changed) - only pass through changed files +- [gulp-cached](https://github.com/contra/gulp-cached) - in-memory file cache, not for operation on sets of files +- [gulp-remember](https://github.com/ahaurw01/gulp-remember) - pairs nicely with gulp-cached +- [gulp-newer](https://github.com/tschaub/gulp-newer) - pass through newer source files only, supports many:1 source:dest + +## Want to contribute? + +Anyone can help make this project better - check out our [Contributing guide](/CONTRIBUTING.md)! + +[downloads-image]: https://img.shields.io/npm/dm/gulp.svg +[npm-url]: https://www.npmjs.com/package/gulp +[npm-image]: https://img.shields.io/npm/v/gulp.svg + +[travis-url]: https://travis-ci.org/gulpjs/gulp +[travis-image]: https://img.shields.io/travis/gulpjs/gulp.svg + +[coveralls-url]: https://coveralls.io/r/gulpjs/gulp +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.png diff --git a/node_modules/gulp/bin/gulp.js b/node_modules/gulp/bin/gulp.js new file mode 100755 index 000000000..a5374c111 --- /dev/null +++ b/node_modules/gulp/bin/gulp.js @@ -0,0 +1,212 @@ +#!/usr/bin/env node + +'use strict'; +var gutil = require('gulp-util'); +var prettyTime = require('pretty-hrtime'); +var chalk = require('chalk'); +var semver = require('semver'); +var archy = require('archy'); +var Liftoff = require('liftoff'); +var tildify = require('tildify'); +var interpret = require('interpret'); +var v8flags = require('v8flags'); +var completion = require('../lib/completion'); +var argv = require('minimist')(process.argv.slice(2)); +var taskTree = require('../lib/taskTree'); + +// Set env var for ORIGINAL cwd +// before anything touches it +process.env.INIT_CWD = process.cwd(); + +var cli = new Liftoff({ + name: 'gulp', + completions: completion, + extensions: interpret.jsVariants, + v8flags: v8flags, +}); + +// Exit with 0 or 1 +var failed = false; +process.once('exit', function(code) { + if (code === 0 && failed) { + process.exit(1); + } +}); + +// Parse those args m8 +var cliPackage = require('../package'); +var versionFlag = argv.v || argv.version; +var tasksFlag = argv.T || argv.tasks; +var tasks = argv._; +var toRun = tasks.length ? tasks : ['default']; + +// This is a hold-over until we have a better logging system +// with log levels +var simpleTasksFlag = argv['tasks-simple']; +var shouldLog = !argv.silent && !simpleTasksFlag; + +if (!shouldLog) { + gutil.log = function() {}; +} + +cli.on('require', function(name) { + gutil.log('Requiring external module', chalk.magenta(name)); +}); + +cli.on('requireFail', function(name) { + gutil.log(chalk.red('Failed to load external module'), chalk.magenta(name)); +}); + +cli.on('respawn', function(flags, child) { + var nodeFlags = chalk.magenta(flags.join(', ')); + var pid = chalk.magenta(child.pid); + gutil.log('Node flags detected:', nodeFlags); + gutil.log('Respawned to PID:', pid); +}); + +cli.launch({ + cwd: argv.cwd, + configPath: argv.gulpfile, + require: argv.require, + completion: argv.completion, +}, handleArguments); + +// The actual logic +function handleArguments(env) { + if (versionFlag && tasks.length === 0) { + gutil.log('CLI version', cliPackage.version); + if (env.modulePackage && typeof env.modulePackage.version !== 'undefined') { + gutil.log('Local version', env.modulePackage.version); + } + process.exit(0); + } + + if (!env.modulePath) { + gutil.log( + chalk.red('Local gulp not found in'), + chalk.magenta(tildify(env.cwd)) + ); + gutil.log(chalk.red('Try running: npm install gulp')); + process.exit(1); + } + + if (!env.configPath) { + gutil.log(chalk.red('No gulpfile found')); + process.exit(1); + } + + // Check for semver difference between cli and local installation + if (semver.gt(cliPackage.version, env.modulePackage.version)) { + gutil.log(chalk.red('Warning: gulp version mismatch:')); + gutil.log(chalk.red('Global gulp is', cliPackage.version)); + gutil.log(chalk.red('Local gulp is', env.modulePackage.version)); + } + + // Chdir before requiring gulpfile to make sure + // we let them chdir as needed + if (process.cwd() !== env.cwd) { + process.chdir(env.cwd); + gutil.log( + 'Working directory changed to', + chalk.magenta(tildify(env.cwd)) + ); + } + + // This is what actually loads up the gulpfile + require(env.configPath); + gutil.log('Using gulpfile', chalk.magenta(tildify(env.configPath))); + + var gulpInst = require(env.modulePath); + logEvents(gulpInst); + + process.nextTick(function() { + if (simpleTasksFlag) { + return logTasksSimple(env, gulpInst); + } + if (tasksFlag) { + return logTasks(env, gulpInst); + } + gulpInst.start.apply(gulpInst, toRun); + }); +} + +function logTasks(env, localGulp) { + var tree = taskTree(localGulp.tasks); + tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); + archy(tree) + .split('\n') + .forEach(function(v) { + if (v.trim().length === 0) { + return; + } + gutil.log(v); + }); +} + +function logTasksSimple(env, localGulp) { + console.log(Object.keys(localGulp.tasks) + .join('\n') + .trim()); +} + +// Format orchestrator errors +function formatError(e) { + if (!e.err) { + return e.message; + } + + // PluginError + if (typeof e.err.showStack === 'boolean') { + return e.err.toString(); + } + + // Normal error + if (e.err.stack) { + return e.err.stack; + } + + // Unknown (string, number, etc.) + return new Error(String(e.err)).stack; +} + +// Wire up logging events +function logEvents(gulpInst) { + + // Total hack due to poor error management in orchestrator + gulpInst.on('err', function() { + failed = true; + }); + + gulpInst.on('task_start', function(e) { + // TODO: batch these + // so when 5 tasks start at once it only logs one time with all 5 + gutil.log('Starting', '\'' + chalk.cyan(e.task) + '\'...'); + }); + + gulpInst.on('task_stop', function(e) { + var time = prettyTime(e.hrDuration); + gutil.log( + 'Finished', '\'' + chalk.cyan(e.task) + '\'', + 'after', chalk.magenta(time) + ); + }); + + gulpInst.on('task_err', function(e) { + var msg = formatError(e); + var time = prettyTime(e.hrDuration); + gutil.log( + '\'' + chalk.cyan(e.task) + '\'', + chalk.red('errored after'), + chalk.magenta(time) + ); + gutil.log(msg); + }); + + gulpInst.on('task_not_found', function(err) { + gutil.log( + chalk.red('Task \'' + err.task + '\' is not in your gulpfile') + ); + gutil.log('Please check the documentation for proper gulpfile formatting'); + process.exit(1); + }); +} diff --git a/node_modules/gulp/completion/README.md b/node_modules/gulp/completion/README.md new file mode 100644 index 000000000..c0e8c9133 --- /dev/null +++ b/node_modules/gulp/completion/README.md @@ -0,0 +1,20 @@ +# Completion for gulp +> Thanks to grunt team and Tyler Kellen + +To enable tasks auto-completion in shell you should add `eval "$(gulp --completion=shell)"` in your `.shellrc` file. + +## Bash + +Add `eval "$(gulp --completion=bash)"` to `~/.bashrc`. + +## Zsh + +Add `eval "$(gulp --completion=zsh)"` to `~/.zshrc`. + +## Powershell + +Add `Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine)` to `$PROFILE`. + +## Fish + +Add `gulp --completion=fish | source` to `~/.config/fish/config.fish`. diff --git a/node_modules/gulp/completion/bash b/node_modules/gulp/completion/bash new file mode 100644 index 000000000..704c27c13 --- /dev/null +++ b/node_modules/gulp/completion/bash @@ -0,0 +1,27 @@ +#!/bin/bash + +# Borrowed from grunt-cli +# http://gruntjs.com/ +# +# Copyright (c) 2012 Tyler Kellen, contributors +# Licensed under the MIT license. +# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT + +# Usage: +# +# To enable bash <tab> completion for gulp, add the following line (minus the +# leading #, which is the bash comment character) to your ~/.bashrc file: +# +# eval "$(gulp --completion=bash)" + +# Enable bash autocompletion. +function _gulp_completions() { + # The currently-being-completed word. + local cur="${COMP_WORDS[COMP_CWORD]}" + #Grab tasks + local compls=$(gulp --tasks-simple) + # Tell complete what stuff to show. + COMPREPLY=($(compgen -W "$compls" -- "$cur")) +} + +complete -o default -F _gulp_completions gulp diff --git a/node_modules/gulp/completion/fish b/node_modules/gulp/completion/fish new file mode 100644 index 000000000..f27f2248b --- /dev/null +++ b/node_modules/gulp/completion/fish @@ -0,0 +1,10 @@ +#!/usr/bin/env fish + +# Usage: +# +# To enable fish <tab> completion for gulp, add the following line to +# your ~/.config/fish/config.fish file: +# +# gulp --completion=fish | source + +complete -c gulp -a "(gulp --tasks-simple)" -f diff --git a/node_modules/gulp/completion/powershell b/node_modules/gulp/completion/powershell new file mode 100644 index 000000000..08ec4382e --- /dev/null +++ b/node_modules/gulp/completion/powershell @@ -0,0 +1,61 @@ +# Copyright (c) 2014 Jason Jarrett +# +# Tab completion for the `gulp` +# +# Usage: +# +# To enable powershell <tab> completion for gulp you need to be running +# at least PowerShell v3 or greater and add the below to your $PROFILE +# +# Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine) +# +# + +$gulp_completion_Process = { + param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) + + + # Load up an assembly to read the gulpfile's sha1 + if(-not $global:GulpSHA1Managed) { + [Reflection.Assembly]::LoadWithPartialName("System.Security") | out-null + $global:GulpSHA1Managed = new-Object System.Security.Cryptography.SHA1Managed + } + + # setup a global (in-memory) cache + if(-not $global:GulpfileShaCache) { + $global:GulpfileShaCache = @{}; + } + + $cache = $global:GulpfileShaCache; + + # Get the gulpfile's sha1 + $sha1gulpFile = (resolve-path gulpfile.js -ErrorAction Ignore | %{ + $file = [System.IO.File]::Open($_.Path, "open", "read") + [string]::join('', ($global:GulpSHA1Managed.ComputeHash($file) | %{ $_.ToString("x2") })) + $file.Dispose() + }) + + # lookup the sha1 for previously cached task lists. + if($cache.ContainsKey($sha1gulpFile)){ + $tasks = $cache[$sha1gulpFile]; + } else { + $tasks = (gulp --tasks-simple).split("`n"); + $cache[$sha1gulpFile] = $tasks; + } + + + $tasks | + where { $_.startswith($commandName) } + Sort-Object | + foreach { New-Object System.Management.Automation.CompletionResult $_, $_, 'ParameterValue', ('{0}' -f $_) } +} + +if (-not $global:options) { + $global:options = @{ + CustomArgumentCompleters = @{}; + NativeArgumentCompleters = @{} + } +} + +$global:options['NativeArgumentCompleters']['gulp'] = $gulp_completion_Process +$function:tabexpansion2 = $function:tabexpansion2 -replace 'End\r\n{','End { if ($null -ne $options) { $options += $global:options} else {$options = $global:options}' diff --git a/node_modules/gulp/completion/zsh b/node_modules/gulp/completion/zsh new file mode 100644 index 000000000..8169b22d7 --- /dev/null +++ b/node_modules/gulp/completion/zsh @@ -0,0 +1,25 @@ +#!/bin/zsh + +# Borrowed from grunt-cli +# http://gruntjs.com/ +# +# Copyright (c) 2012 Tyler Kellen, contributors +# Licensed under the MIT license. +# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT + +# Usage: +# +# To enable zsh <tab> completion for gulp, add the following line (minus the +# leading #, which is the zsh comment character) to your ~/.zshrc file: +# +# eval "$(gulp --completion=zsh)" + +# Enable zsh autocompletion. +function _gulp_completion() { + # Grab tasks + compls=$(gulp --tasks-simple) + completions=(${=compls}) + compadd -- $completions +} + +compdef _gulp_completion gulp diff --git a/node_modules/gulp/gulp.1 b/node_modules/gulp/gulp.1 new file mode 100644 index 000000000..49ccc25e6 --- /dev/null +++ b/node_modules/gulp/gulp.1 @@ -0,0 +1,40 @@ +.TH "GULP" "" "February 2016" "" "" +.SH "NAME" +\fBgulp\fR +.SH gulp CLI docs +.SS Flags +.P +gulp has very few flags to know about\. All other flags are for tasks to use if needed\. +.RS 0 +.IP \(bu 2 +\fB\-v\fP or \fB\-\-version\fP will display the global and local gulp versions +.IP \(bu 2 +\fB\-\-require <module path>\fP will require a module before running the gulpfile\. This is useful for transpilers but also has other applications\. You can use multiple \fB\-\-require\fP flags +.IP \(bu 2 +\fB\-\-gulpfile <gulpfile path>\fP will manually set path of gulpfile\. Useful if you have multiple gulpfiles\. This will set the CWD to the gulpfile directory as well +.IP \(bu 2 +\fB\-\-cwd <dir path>\fP will manually set the CWD\. The search for the gulpfile, as well as the relativity of all requires will be from here +.IP \(bu 2 +\fB\-T\fP or \fB\-\-tasks\fP will display the task dependency tree for the loaded gulpfile +.IP \(bu 2 +\fB\-\-tasks\-simple\fP will display a plaintext list of tasks for the loaded gulpfile +.IP \(bu 2 +\fB\-\-color\fP will force gulp and gulp plugins to display colors even when no color support is detected +.IP \(bu 2 +\fB\-\-no\-color\fP will force gulp and gulp plugins to not display colors even when color support is detected +.IP \(bu 2 +\fB\-\-silent\fP will disable all gulp logging + +.RE +.P +The CLI adds process\.env\.INIT_CWD which is the original cwd it was launched from\. +.SS Task specific flags +.P +Refer to this StackOverflow \fIhttp://stackoverflow\.com/questions/23023650/is\-it\-possible\-to\-pass\-a\-flag\-to\-gulp\-to\-have\-it\-run\-tasks\-in\-different\-ways\fR link for how to add task specific flags +.SS Tasks +.P +Tasks can be executed by running \fBgulp <task> <othertask>\fP\|\. Just running \fBgulp\fP will execute the task you registered called \fBdefault\fP\|\. If there is no \fBdefault\fP task gulp will error\. +.SS Compilers +.P +You can find a list of supported languages at interpret \fIhttps://github\.com/tkellen/node\-interpret#jsvariants\fR\|\. If you would like to add support for a new language send pull request/open issues there\. + diff --git a/node_modules/gulp/index.js b/node_modules/gulp/index.js new file mode 100644 index 000000000..42bc69b3d --- /dev/null +++ b/node_modules/gulp/index.js @@ -0,0 +1,63 @@ +'use strict'; + +var util = require('util'); +var Orchestrator = require('orchestrator'); +var gutil = require('gulp-util'); +var deprecated = require('deprecated'); +var vfs = require('vinyl-fs'); + +function Gulp() { + Orchestrator.call(this); +} +util.inherits(Gulp, Orchestrator); + +Gulp.prototype.task = Gulp.prototype.add; +Gulp.prototype.run = function() { + // `run()` is deprecated as of 3.5 and will be removed in 4.0 + // Use task dependencies instead + + // Impose our opinion of "default" tasks onto orchestrator + var tasks = arguments.length ? arguments : ['default']; + + this.start.apply(this, tasks); +}; + +Gulp.prototype.src = vfs.src; +Gulp.prototype.dest = vfs.dest; +Gulp.prototype.watch = function(glob, opt, fn) { + if (typeof opt === 'function' || Array.isArray(opt)) { + fn = opt; + opt = null; + } + + // Array of tasks given + if (Array.isArray(fn)) { + return vfs.watch(glob, opt, function() { + this.start.apply(this, fn); + }.bind(this)); + } + + return vfs.watch(glob, opt, fn); +}; + +// Let people use this class from our instance +Gulp.prototype.Gulp = Gulp; + +// Deprecations +deprecated.field('gulp.env has been deprecated. ' + + 'Use your own CLI parser instead. ' + + 'We recommend using yargs or minimist.', + console.warn, + Gulp.prototype, + 'env', + gutil.env +); + +Gulp.prototype.run = deprecated.method('gulp.run() has been deprecated. ' + + 'Use task dependencies or gulp.watch task triggering instead.', + console.warn, + Gulp.prototype.run +); + +var inst = new Gulp(); +module.exports = inst; diff --git a/node_modules/gulp/lib/completion.js b/node_modules/gulp/lib/completion.js new file mode 100644 index 000000000..7000250b4 --- /dev/null +++ b/node_modules/gulp/lib/completion.js @@ -0,0 +1,22 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); + +module.exports = function(name) { + if (typeof name !== 'string') { + throw new Error('Missing completion type'); + } + var file = path.join(__dirname, '../completion', name); + try { + console.log(fs.readFileSync(file, 'utf8')); + process.exit(0); + } catch (err) { + console.log( + 'echo "gulp autocompletion rules for', + '\'' + name + '\'', + 'not found"' + ); + process.exit(5); + } +}; diff --git a/node_modules/gulp/lib/taskTree.js b/node_modules/gulp/lib/taskTree.js new file mode 100644 index 000000000..accb1a77f --- /dev/null +++ b/node_modules/gulp/lib/taskTree.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function(tasks) { + return Object.keys(tasks) + .reduce(function(prev, task) { + prev.nodes.push({ + label: task, + nodes: tasks[task].dep, + }); + return prev; + }, { + nodes: [], + }); +}; diff --git a/node_modules/gulp/node_modules/.bin/strip-bom b/node_modules/gulp/node_modules/.bin/strip-bom new file mode 120000 index 000000000..ba65fdf14 --- /dev/null +++ b/node_modules/gulp/node_modules/.bin/strip-bom @@ -0,0 +1 @@ +../strip-bom/cli.js
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/clone/.npmignore b/node_modules/gulp/node_modules/clone/.npmignore new file mode 100644 index 000000000..c2658d7d1 --- /dev/null +++ b/node_modules/gulp/node_modules/clone/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/gulp/node_modules/clone/.travis.yml b/node_modules/gulp/node_modules/clone/.travis.yml new file mode 100644 index 000000000..58f23716a --- /dev/null +++ b/node_modules/gulp/node_modules/clone/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.10 diff --git a/node_modules/gulp/node_modules/clone/LICENSE b/node_modules/gulp/node_modules/clone/LICENSE new file mode 100644 index 000000000..fc808cce8 --- /dev/null +++ b/node_modules/gulp/node_modules/clone/LICENSE @@ -0,0 +1,18 @@ +Copyright © 2011-2014 Paul Vorbach <paul@vorba.ch> + +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, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp/node_modules/clone/README.md b/node_modules/gulp/node_modules/clone/README.md new file mode 100644 index 000000000..d7231cfca --- /dev/null +++ b/node_modules/gulp/node_modules/clone/README.md @@ -0,0 +1,126 @@ +# clone + +[![build status](https://secure.travis-ci.org/pvorb/node-clone.png)](http://travis-ci.org/pvorb/node-clone) + +offers foolproof _deep cloning_ of variables in JavaScript. + + +## Installation + + npm install clone + +or + + ender build clone + + +## Example + +~~~ javascript +var clone = require('clone'); + +var a, b; + +a = { foo: { bar: 'baz' } }; // initial value of a + +b = clone(a); // clone a -> b +a.foo.bar = 'foo'; // change a + +console.log(a); // show a +console.log(b); // show b +~~~ + +This will print: + +~~~ javascript +{ foo: { bar: 'foo' } } +{ foo: { bar: 'baz' } } +~~~ + +**clone** masters cloning simple objects (even with custom prototype), arrays, +Date objects, and RegExp objects. Everything is cloned recursively, so that you +can clone dates in arrays in objects, for example. + + +## API + +`clone(val, circular, depth)` + + * `val` -- the value that you want to clone, any type allowed + * `circular` -- boolean + + Call `clone` with `circular` set to `false` if you are certain that `obj` + contains no circular references. This will give better performance if needed. + There is no error if `undefined` or `null` is passed as `obj`. + * `depth` -- depth to which the object is to be cloned (optional, + defaults to infinity) + +`clone.clonePrototype(obj)` + + * `obj` -- the object that you want to clone + +Does a prototype clone as +[described by Oran Looney](http://oranlooney.com/functional-javascript/). + + +## Circular References + +~~~ javascript +var a, b; + +a = { hello: 'world' }; + +a.myself = a; +b = clone(a); + +console.log(b); +~~~ + +This will print: + +~~~ javascript +{ hello: "world", myself: [Circular] } +~~~ + +So, `b.myself` points to `b`, not `a`. Neat! + + +## Test + + npm test + + +## Caveat + +Some special objects like a socket or `process.stdout`/`stderr` are known to not +be cloneable. If you find other objects that cannot be cloned, please [open an +issue](https://github.com/pvorb/node-clone/issues/new). + + +## Bugs and Issues + +If you encounter any bugs or issues, feel free to [open an issue at +github](https://github.com/pvorb/node-clone/issues) or send me an email to +<paul@vorba.ch>. I also always like to hear from you, if you’re using my code. + +## License + +Copyright © 2011-2014 [Paul Vorbach](http://paul.vorba.ch/) and +[contributors](https://github.com/pvorb/node-clone/graphs/contributors). + +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, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp/node_modules/clone/clone.js b/node_modules/gulp/node_modules/clone/clone.js new file mode 100644 index 000000000..f8fa3159a --- /dev/null +++ b/node_modules/gulp/node_modules/clone/clone.js @@ -0,0 +1,144 @@ +'use strict'; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +// shim for Node's 'util' package +// DO NOT REMOVE THIS! It is required for compatibility with EnderJS (http://enderjs.com/). +var util = { + isArray: function (ar) { + return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]'); + }, + isDate: function (d) { + return typeof d === 'object' && objectToString(d) === '[object Date]'; + }, + isRegExp: function (re) { + return typeof re === 'object' && objectToString(re) === '[object RegExp]'; + }, + getRegExpFlags: function (re) { + var flags = ''; + re.global && (flags += 'g'); + re.ignoreCase && (flags += 'i'); + re.multiline && (flags += 'm'); + return flags; + } +}; + + +if (typeof module === 'object') + module.exports = clone; + +/** + * Clones (copies) an Object using deep copying. + * + * This function supports circular references by default, but if you are certain + * there are no circular references in your object, you can save some CPU time + * by calling clone(obj, false). + * + * Caution: if `circular` is false and `parent` contains circular references, + * your program may enter an infinite loop and crash. + * + * @param `parent` - the object to be cloned + * @param `circular` - set to true if the object to be cloned may contain + * circular references. (optional - true by default) + * @param `depth` - set to a number if the object is only to be cloned to + * a particular depth. (optional - defaults to Infinity) + * @param `prototype` - sets the prototype to be used when cloning an object. + * (optional - defaults to parent prototype). +*/ + +function clone(parent, circular, depth, prototype) { + // maintain two arrays for circular references, where corresponding parents + // and children have the same index + var allParents = []; + var allChildren = []; + + var useBuffer = typeof Buffer != 'undefined'; + + if (typeof circular == 'undefined') + circular = true; + + if (typeof depth == 'undefined') + depth = Infinity; + + // recurse this function so we don't reset allParents and allChildren + function _clone(parent, depth) { + // cloning null always returns null + if (parent === null) + return null; + + if (depth == 0) + return parent; + + var child; + var proto; + if (typeof parent != 'object') { + return parent; + } + + if (util.isArray(parent)) { + child = []; + } else if (util.isRegExp(parent)) { + child = new RegExp(parent.source, util.getRegExpFlags(parent)); + if (parent.lastIndex) child.lastIndex = parent.lastIndex; + } else if (util.isDate(parent)) { + child = new Date(parent.getTime()); + } else if (useBuffer && Buffer.isBuffer(parent)) { + child = new Buffer(parent.length); + parent.copy(child); + return child; + } else { + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } + } + + if (circular) { + var index = allParents.indexOf(parent); + + if (index != -1) { + return allChildren[index]; + } + allParents.push(parent); + allChildren.push(child); + } + + for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } + child[i] = _clone(parent[i], depth - 1); + } + + return child; + } + + return _clone(parent, depth); +} + +/** + * Simple flat clone using prototype, accepts only objects, usefull for property + * override on FLAT configuration object (no nested props). + * + * USE WITH CAUTION! This may not behave as you wish if you do not know how this + * works. + */ +clone.clonePrototype = function(parent) { + if (parent === null) + return null; + + var c = function () {}; + c.prototype = parent; + return new c(); +}; diff --git a/node_modules/gulp/node_modules/clone/package.json b/node_modules/gulp/node_modules/clone/package.json new file mode 100644 index 000000000..8bcc03d3e --- /dev/null +++ b/node_modules/gulp/node_modules/clone/package.json @@ -0,0 +1,159 @@ +{ + "_args": [ + [ + { + "raw": "clone@^0.2.0", + "scope": null, + "escapedName": "clone", + "name": "clone", + "rawSpec": "^0.2.0", + "spec": ">=0.2.0 <0.3.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl" + ] + ], + "_from": "clone@>=0.2.0 <0.3.0", + "_id": "clone@0.2.0", + "_inCache": true, + "_location": "/gulp/clone", + "_npmUser": { + "name": "pvorb", + "email": "paul@vorba.ch" + }, + "_npmVersion": "1.4.14", + "_phantomChildren": {}, + "_requested": { + "raw": "clone@^0.2.0", + "scope": null, + "escapedName": "clone", + "name": "clone", + "rawSpec": "^0.2.0", + "spec": ">=0.2.0 <0.3.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp/vinyl" + ], + "_resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "_shasum": "c6126a90ad4f72dbf5acdb243cc37724fe93fc1f", + "_shrinkwrap": null, + "_spec": "clone@^0.2.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl", + "author": { + "name": "Paul Vorbach", + "email": "paul@vorba.ch", + "url": "http://paul.vorba.ch/" + }, + "bugs": { + "url": "https://github.com/pvorb/node-clone/issues" + }, + "contributors": [ + { + "name": "Blake Miner", + "email": "miner.blake@gmail.com", + "url": "http://www.blakeminer.com/" + }, + { + "name": "Tian You", + "email": "axqd001@gmail.com", + "url": "http://blog.axqd.net/" + }, + { + "name": "George Stagas", + "email": "gstagas@gmail.com", + "url": "http://stagas.com/" + }, + { + "name": "Tobiasz Cudnik", + "email": "tobiasz.cudnik@gmail.com", + "url": "https://github.com/TobiaszCudnik" + }, + { + "name": "Pavel Lang", + "email": "langpavel@phpskelet.org", + "url": "https://github.com/langpavel" + }, + { + "name": "Dan MacTough", + "url": "http://yabfog.com/" + }, + { + "name": "w1nk", + "url": "https://github.com/w1nk" + }, + { + "name": "Hugh Kennedy", + "url": "http://twitter.com/hughskennedy" + }, + { + "name": "Dustin Diaz", + "url": "http://dustindiaz.com" + }, + { + "name": "Ilya Shaisultanov", + "url": "https://github.com/diversario" + }, + { + "name": "Nathan MacInnes", + "email": "nathan@macinn.es", + "url": "http://macinn.es/" + }, + { + "name": "Benjamin E. Coe", + "email": "ben@npmjs.com", + "url": "https://twitter.com/benjamincoe" + }, + { + "name": "Nathan Zadoks", + "url": "https://github.com/nathan7" + }, + { + "name": "Róbert Oroszi", + "email": "robert+gh@oroszi.net", + "url": "https://github.com/oroce" + } + ], + "dependencies": {}, + "description": "deep cloning of objects and arrays", + "devDependencies": { + "nodeunit": "*", + "underscore": "*" + }, + "directories": {}, + "dist": { + "shasum": "c6126a90ad4f72dbf5acdb243cc37724fe93fc1f", + "tarball": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz" + }, + "engines": { + "node": "*" + }, + "gitHead": "bb11a43363a0f69e8ac014cb5376ce215ea1f8fd", + "homepage": "https://github.com/pvorb/node-clone", + "license": "MIT", + "main": "clone.js", + "maintainers": [ + { + "name": "pvorb", + "email": "paul@vorb.de" + } + ], + "name": "clone", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/pvorb/node-clone.git" + }, + "scripts": { + "test": "nodeunit test.js" + }, + "tags": [ + "clone", + "object", + "array", + "function", + "date" + ], + "version": "0.2.0" +} diff --git a/node_modules/gulp/node_modules/clone/test.js b/node_modules/gulp/node_modules/clone/test.js new file mode 100644 index 000000000..cb3d16631 --- /dev/null +++ b/node_modules/gulp/node_modules/clone/test.js @@ -0,0 +1,289 @@ +if(module.parent === null) { + console.log('Run this test file with nodeunit:'); + console.log('$ nodeunit test.js'); +} + + +var clone = require('./'); +var util = require('util'); +var _ = require('underscore'); + + + +exports["clone string"] = function(test) { + test.expect(2); // how many tests? + + var a = "foo"; + test.strictEqual(clone(a), a); + a = ""; + test.strictEqual(clone(a), a); + + test.done(); +}; + + + +exports["clone number"] = function(test) { + test.expect(5); // how many tests? + + var a = 0; + test.strictEqual(clone(a), a); + a = 1; + test.strictEqual(clone(a), a); + a = -1000; + test.strictEqual(clone(a), a); + a = 3.1415927; + test.strictEqual(clone(a), a); + a = -3.1415927; + test.strictEqual(clone(a), a); + + test.done(); +}; + + + +exports["clone date"] = function(test) { + test.expect(3); // how many tests? + + var a = new Date; + var c = clone(a); + test.ok(a instanceof Date); + test.ok(c instanceof Date); + test.equal(c.getTime(), a.getTime()); + + test.done(); +}; + + + +exports["clone object"] = function(test) { + test.expect(2); // how many tests? + + var a = { foo: { bar: "baz" } }; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + + + +exports["clone array"] = function(test) { + test.expect(2); // how many tests? + + var a = [ + { foo: "bar" }, + "baz" + ]; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + +exports["clone buffer"] = function(test) { + test.expect(1); + + var a = new Buffer("this is a test buffer"); + var b = clone(a); + + // no underscore equal since it has no concept of Buffers + test.deepEqual(b, a); + test.done(); +}; + + + +exports["clone regexp"] = function(test) { + test.expect(5); + + var a = /abc123/gi; + var b = clone(a); + + test.deepEqual(b, a); + + var c = /a/g; + test.ok(c.lastIndex === 0); + + c.exec('123a456a'); + test.ok(c.lastIndex === 4); + + var d = clone(c); + test.ok(d.global); + test.ok(d.lastIndex === 4); + + test.done(); +}; + + +exports["clone object containing array"] = function(test) { + test.expect(2); // how many tests? + + var a = { + arr1: [ { a: '1234', b: '2345' } ], + arr2: [ { c: '345', d: '456' } ] + }; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + + + +exports["clone object with circular reference"] = function(test) { + test.expect(8); // how many tests? + + var _ = test.ok; + var c = [1, "foo", {'hello': 'bar'}, function() {}, false, [2]]; + var b = [c, 2, 3, 4]; + var a = {'b': b, 'c': c}; + a.loop = a; + a.loop2 = a; + c.loop = c; + c.aloop = a; + var aCopy = clone(a); + _(a != aCopy); + _(a.c != aCopy.c); + _(aCopy.c == aCopy.b[0]); + _(aCopy.c.loop.loop.aloop == aCopy); + _(aCopy.c[0] == a.c[0]); + + //console.log(util.inspect(aCopy, true, null) ); + //console.log("------------------------------------------------------------"); + //console.log(util.inspect(a, true, null) ); + _(eq(a, aCopy)); + aCopy.c[0] = 2; + _(!eq(a, aCopy)); + aCopy.c = "2"; + _(!eq(a, aCopy)); + //console.log("------------------------------------------------------------"); + //console.log(util.inspect(aCopy, true, null) ); + + function eq(x, y) { + return util.inspect(x, true, null) === util.inspect(y, true, null); + } + + test.done(); +}; + + + +exports['clonePrototype'] = function(test) { + test.expect(3); // how many tests? + + var a = { + a: "aaa", + x: 123, + y: 45.65 + }; + var b = clone.clonePrototype(a); + + test.strictEqual(b.a, a.a); + test.strictEqual(b.x, a.x); + test.strictEqual(b.y, a.y); + + test.done(); +} + +exports['cloneWithinNewVMContext'] = function(test) { + test.expect(3); + var vm = require('vm'); + var ctx = vm.createContext({ clone: clone }); + var script = "clone( {array: [1, 2, 3], date: new Date(), regex: /^foo$/ig} );"; + var results = vm.runInContext(script, ctx); + test.ok(results.array instanceof Array); + test.ok(results.date instanceof Date); + test.ok(results.regex instanceof RegExp); + test.done(); +} + +exports['cloneObjectWithNoConstructor'] = function(test) { + test.expect(3); + var n = null; + var a = { foo: 'bar' }; + a.__proto__ = n; + test.ok(typeof a === 'object'); + test.ok(typeof a !== null); + var b = clone(a); + test.ok(a.foo, b.foo); + test.done(); +} + +exports['clone object with depth argument'] = function (test) { + test.expect(6); + var a = { + foo: { + bar : { + baz : 'qux' + } + } + }; + var b = clone(a, false, 1); + test.deepEqual(b, a); + test.notEqual(b, a); + test.strictEqual(b.foo, a.foo); + + b = clone(a, true, 2); + test.deepEqual(b, a); + test.notEqual(b.foo, a.foo); + test.strictEqual(b.foo.bar, a.foo.bar); + test.done(); +} + +exports['maintain prototype chain in clones'] = function (test) { + test.expect(1); + function Constructor() {} + var a = new Constructor(); + var b = clone(a); + test.strictEqual(Object.getPrototypeOf(a), Object.getPrototypeOf(b)); + test.done(); +} + +exports['parent prototype is overriden with prototype provided'] = function (test) { + test.expect(1); + function Constructor() {} + var a = new Constructor(); + var b = clone(a, true, Infinity, null); + test.strictEqual(b.__defineSetter__, undefined); + test.done(); +} + +exports['clone object with null children'] = function(test) { + test.expect(1); + var a = { + foo: { + bar: null, + baz: { + qux: false + } + } + }; + var b = clone(a); + test.deepEqual(b, a); + test.done(); +} + +exports['clone instance with getter'] = function(test) { + test.expect(1); + function Ctor() {}; + Object.defineProperty(Ctor.prototype, 'prop', { + configurable: true, + enumerable: true, + get: function() { + return 'value'; + } + }); + + var a = new Ctor(); + var b = clone(a); + + test.strictEqual(b.prop, 'value'); + test.done(); +};
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/graceful-fs/.npmignore b/node_modules/gulp/node_modules/graceful-fs/.npmignore new file mode 100644 index 000000000..2f24c57c3 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/.npmignore @@ -0,0 +1,3 @@ +node_modules/ +coverage/ +.nyc_output/ diff --git a/node_modules/gulp/node_modules/graceful-fs/.travis.yml b/node_modules/gulp/node_modules/graceful-fs/.travis.yml new file mode 100644 index 000000000..b535ef4d2 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/.travis.yml @@ -0,0 +1,7 @@ +sudo: false +language: node_js +node_js: + - '0.10' + - '0.12' + - '4' + - '6' diff --git a/node_modules/gulp/node_modules/graceful-fs/LICENSE b/node_modules/gulp/node_modules/graceful-fs/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/LICENSE @@ -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. diff --git a/node_modules/gulp/node_modules/graceful-fs/README.md b/node_modules/gulp/node_modules/graceful-fs/README.md new file mode 100644 index 000000000..13a2e8605 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/README.md @@ -0,0 +1,36 @@ +# graceful-fs + +graceful-fs functions as a drop-in replacement for the fs module, +making various improvements. + +The improvements are meant to normalize behavior across different +platforms and environments, and to make filesystem access more +resilient to errors. + +## Improvements over [fs module](http://api.nodejs.org/fs.html) + +graceful-fs: + +* Queues up `open` and `readdir` calls, and retries them once + something closes if there is an EMFILE error from too many file + descriptors. +* fixes `lchmod` for Node versions prior to 0.6.2. +* implements `fs.lutimes` if possible. Otherwise it becomes a noop. +* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or + `lchown` if the user isn't root. +* makes `lchmod` and `lchown` become noops, if not available. +* retries reading a file if `read` results in EAGAIN error. + +On Windows, it retries renaming a file for up to one second if `EACCESS` +or `EPERM` error occurs, likely because antivirus software has locked +the directory. + +## USAGE + +```javascript +// use just like fs +var fs = require('graceful-fs') + +// now go and do stuff with it... +fs.readFileSync('some-file-or-whatever') +``` diff --git a/node_modules/gulp/node_modules/graceful-fs/fs.js b/node_modules/gulp/node_modules/graceful-fs/fs.js new file mode 100644 index 000000000..7a37bb191 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/fs.js @@ -0,0 +1 @@ +module.exports = require('natives').require('fs', ['stream']) diff --git a/node_modules/gulp/node_modules/graceful-fs/graceful-fs.js b/node_modules/gulp/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 000000000..fb206b838 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,158 @@ +// Monkey-patching the fs module. +// It's ugly, but there is simply no other way to do this. +var fs = module.exports = require('./fs.js') + +var assert = require('assert') + +// fix up some busted stuff, mostly on windows and old nodes +require('./polyfills.js') + +var util = require('util') + +function noop () {} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs') +else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS: ' + m.split(/\n/).join('\nGFS: ') + console.error(m) + } + +if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug('fds', fds) + debug(queue) + assert.equal(queue.length, 0) + }) +} + + +var originalOpen = fs.open +fs.open = open + +function open(path, flags, mode, cb) { + if (typeof mode === "function") cb = mode, mode = null + if (typeof cb !== "function") cb = noop + new OpenReq(path, flags, mode, cb) +} + +function OpenReq(path, flags, mode, cb) { + this.path = path + this.flags = flags + this.mode = mode + this.cb = cb + Req.call(this) +} + +util.inherits(OpenReq, Req) + +OpenReq.prototype.process = function() { + originalOpen.call(fs, this.path, this.flags, this.mode, this.done) +} + +var fds = {} +OpenReq.prototype.done = function(er, fd) { + debug('open done', er, fd) + if (fd) + fds['fd' + fd] = this.path + Req.prototype.done.call(this, er, fd) +} + + +var originalReaddir = fs.readdir +fs.readdir = readdir + +function readdir(path, cb) { + if (typeof cb !== "function") cb = noop + new ReaddirReq(path, cb) +} + +function ReaddirReq(path, cb) { + this.path = path + this.cb = cb + Req.call(this) +} + +util.inherits(ReaddirReq, Req) + +ReaddirReq.prototype.process = function() { + originalReaddir.call(fs, this.path, this.done) +} + +ReaddirReq.prototype.done = function(er, files) { + if (files && files.sort) + files = files.sort() + Req.prototype.done.call(this, er, files) + onclose() +} + + +var originalClose = fs.close +fs.close = close + +function close (fd, cb) { + debug('close', fd) + if (typeof cb !== "function") cb = noop + delete fds['fd' + fd] + originalClose.call(fs, fd, function(er) { + onclose() + cb(er) + }) +} + + +var originalCloseSync = fs.closeSync +fs.closeSync = closeSync + +function closeSync (fd) { + try { + return originalCloseSync(fd) + } finally { + onclose() + } +} + + +// Req class +function Req () { + // start processing + this.done = this.done.bind(this) + this.failures = 0 + this.process() +} + +Req.prototype.done = function (er, result) { + var tryAgain = false + if (er) { + var code = er.code + var tryAgain = code === "EMFILE" || code === "ENFILE" + if (process.platform === "win32") + tryAgain = tryAgain || code === "OK" + } + + if (tryAgain) { + this.failures ++ + enqueue(this) + } else { + var cb = this.cb + cb(er, result) + } +} + +var queue = [] + +function enqueue(req) { + queue.push(req) + debug('enqueue %d %s', queue.length, req.constructor.name, req) +} + +function onclose() { + var req = queue.shift() + if (req) { + debug('process', req.constructor.name, req) + req.process() + } +} diff --git a/node_modules/gulp/node_modules/graceful-fs/package.json b/node_modules/gulp/node_modules/graceful-fs/package.json new file mode 100644 index 000000000..11abe2c95 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/package.json @@ -0,0 +1,112 @@ +{ + "_args": [ + [ + { + "raw": "graceful-fs@^3.0.0", + "scope": null, + "escapedName": "graceful-fs", + "name": "graceful-fs", + "rawSpec": "^3.0.0", + "spec": ">=3.0.0 <4.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs" + ] + ], + "_from": "graceful-fs@>=3.0.0 <4.0.0", + "_id": "graceful-fs@3.0.11", + "_inCache": true, + "_location": "/gulp/graceful-fs", + "_nodeVersion": "6.5.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/graceful-fs-3.0.11.tgz_1472583712827_0.6562602713238448" + }, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_npmVersion": "3.10.7", + "_phantomChildren": {}, + "_requested": { + "raw": "graceful-fs@^3.0.0", + "scope": null, + "escapedName": "graceful-fs", + "name": "graceful-fs", + "rawSpec": "^3.0.0", + "spec": ">=3.0.0 <4.0.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp/vinyl-fs" + ], + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "_shasum": "7613c778a1afea62f25c630a086d7f3acbbdd818", + "_shrinkwrap": null, + "_spec": "graceful-fs@^3.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/node-graceful-fs/issues" + }, + "dependencies": { + "natives": "^1.1.0" + }, + "description": "A drop-in replacement for fs, making various improvements.", + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "tap": "^1.2.0" + }, + "directories": { + "test": "test" + }, + "dist": { + "shasum": "7613c778a1afea62f25c630a086d7f3acbbdd818", + "tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz" + }, + "engines": { + "node": ">=0.4.0" + }, + "gitHead": "03d3cc6dbd4a499b1e13834eedbc469094a27582", + "homepage": "https://github.com/isaacs/node-graceful-fs#readme", + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "ISC", + "main": "graceful-fs.js", + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "name": "graceful-fs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-graceful-fs.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "3.0.11" +} diff --git a/node_modules/gulp/node_modules/graceful-fs/polyfills.js b/node_modules/gulp/node_modules/graceful-fs/polyfills.js new file mode 100644 index 000000000..42705391a --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,255 @@ +var fs = require('./fs.js') +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +var chdir = process.chdir +process.chdir = function(d) { + cwd = null + chdir.call(process, d) +} + +// (re-)implement some things that are known busted or missing. + +// lchmod, broken prior to 0.6.2 +// back-port the fix here. +if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + fs.lchmod = function (path, mode, callback) { + callback = callback || noop + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var err, err2 + try { + var ret = fs.fchmodSync(fd, mode) + } catch (er) { + err = er + } + try { + fs.closeSync(fd) + } catch (er) { + err2 = er + } + if (err || err2) throw (err || err2) + return ret + } +} + + +// lutimes implementation, or no-op +if (!fs.lutimes) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + cb = cb || noop + if (er) return cb(er) + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + return cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + , err + , err2 + , ret + + try { + var ret = fs.futimesSync(fd, at, mt) + } catch (er) { + err = er + } + try { + fs.closeSync(fd) + } catch (er) { + err2 = er + } + if (err || err2) throw (err || err2) + return ret + } + + } else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) { + // maybe utimensat will be bound soonish? + fs.lutimes = function (path, at, mt, cb) { + fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb) + } + + fs.lutimesSync = function (path, at, mt) { + return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW) + } + + } else { + fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) } + fs.lutimesSync = function () {} + } +} + + +// https://github.com/isaacs/node-graceful-fs/issues/4 +// Chown should not fail on einval or eperm if non-root. +// It should not fail on enosys ever, as this just indicates +// that a fs doesn't support the intended operation. + +fs.chown = chownFix(fs.chown) +fs.fchown = chownFix(fs.fchown) +fs.lchown = chownFix(fs.lchown) + +fs.chmod = chownFix(fs.chmod) +fs.fchmod = chownFix(fs.fchmod) +fs.lchmod = chownFix(fs.lchmod) + +fs.chownSync = chownFixSync(fs.chownSync) +fs.fchownSync = chownFixSync(fs.fchownSync) +fs.lchownSync = chownFixSync(fs.lchownSync) + +fs.chmodSync = chownFix(fs.chmodSync) +fs.fchmodSync = chownFix(fs.fchmodSync) +fs.lchmodSync = chownFix(fs.lchmodSync) + +function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er, res) { + if (chownErOk(er)) er = null + cb(er, res) + }) + } +} + +function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } +} + +// ENOSYS means that the fs doesn't support the op. Just ignore +// that, because it doesn't matter. +// +// if there's no getuid, or if getuid() is something other +// than 0, and the error is EINVAL or EPERM, then just ignore +// it. +// +// This specific case is a silent failure in cp, install, tar, +// and most other unix tools that manage permissions. +// +// When running as root, or if other types of errors are +// encountered, then it's strict. +function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false +} + + +// if lchmod/lchown do not exist, then make them no-ops +if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + process.nextTick(cb) + } + fs.lchmodSync = function () {} +} +if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + process.nextTick(cb) + } + fs.lchownSync = function () {} +} + + + +// on Windows, A/V software can lock the directory, causing this +// to fail with an EACCES or EPERM if the directory contains newly +// created files. Try again on failure, for up to 1 second. +if (process.platform === "win32") { + var rename_ = fs.rename + fs.rename = function rename (from, to, cb) { + var start = Date.now() + rename_(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 1000) { + return rename_(from, to, CB) + } + if(cb) cb(er) + }) + } +} + + +// if read() returns EAGAIN, then just try it again. +var read = fs.read +fs.read = function (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return read.call(fs, fd, buffer, offset, length, position, callback) +} + +var readSync = fs.readSync +fs.readSync = function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } +} + diff --git a/node_modules/gulp/node_modules/graceful-fs/test/max-open.js b/node_modules/gulp/node_modules/graceful-fs/test/max-open.js new file mode 100644 index 000000000..a6b9ba43d --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/test/max-open.js @@ -0,0 +1,69 @@ +var test = require('tap').test +var fs = require('../') + +test('open lots of stuff', function (t) { + // Get around EBADF from libuv by making sure that stderr is opened + // Otherwise Darwin will refuse to give us a FD for stderr! + process.stderr.write('') + + // How many parallel open()'s to do + var n = 1024 + var opens = 0 + var fds = [] + var going = true + var closing = false + var doneCalled = 0 + + for (var i = 0; i < n; i++) { + go() + } + + function go() { + opens++ + fs.open(__filename, 'r', function (er, fd) { + if (er) throw er + fds.push(fd) + if (going) go() + }) + } + + // should hit ulimit pretty fast + setTimeout(function () { + going = false + t.equal(opens - fds.length, n) + done() + }, 100) + + + function done () { + if (closing) return + doneCalled++ + + if (fds.length === 0) { + console.error('done called %d times', doneCalled) + // First because of the timeout + // Then to close the fd's opened afterwards + // Then this time, to complete. + // Might take multiple passes, depending on CPU speed + // and ulimit, but at least 3 in every case. + t.ok(doneCalled >= 2) + return t.end() + } + + closing = true + setTimeout(function () { + // console.error('do closing again') + closing = false + done() + }, 100) + + // console.error('closing time') + var closes = fds.slice(0) + fds.length = 0 + closes.forEach(function (fd) { + fs.close(fd, function (er) { + if (er) throw er + }) + }) + } +}) diff --git a/node_modules/gulp/node_modules/graceful-fs/test/open.js b/node_modules/gulp/node_modules/graceful-fs/test/open.js new file mode 100644 index 000000000..85732f236 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/test/open.js @@ -0,0 +1,39 @@ +var test = require('tap').test +var fs = require('../graceful-fs.js') + +test('graceful fs is monkeypatched fs', function (t) { + t.equal(fs, require('../fs.js')) + t.end() +}) + +test('open an existing file works', function (t) { + var fd = fs.openSync(__filename, 'r') + fs.closeSync(fd) + fs.open(__filename, 'r', function (er, fd) { + if (er) throw er + fs.close(fd, function (er) { + if (er) throw er + t.pass('works') + t.end() + }) + }) +}) + +test('open a non-existing file throws', function (t) { + var er + try { + var fd = fs.openSync('this file does not exist', 'r') + } catch (x) { + er = x + } + t.ok(er, 'should throw') + t.notOk(fd, 'should not get an fd') + t.equal(er.code, 'ENOENT') + + fs.open('neither does this file', 'r', function (er, fd) { + t.ok(er, 'should throw') + t.notOk(fd, 'should not get an fd') + t.equal(er.code, 'ENOENT') + t.end() + }) +}) diff --git a/node_modules/gulp/node_modules/graceful-fs/test/readdir-sort.js b/node_modules/gulp/node_modules/graceful-fs/test/readdir-sort.js new file mode 100644 index 000000000..cb63a6846 --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/test/readdir-sort.js @@ -0,0 +1,20 @@ +var test = require("tap").test +var fs = require("../fs.js") + +var readdir = fs.readdir +fs.readdir = function(path, cb) { + process.nextTick(function() { + cb(null, ["b", "z", "a"]) + }) +} + +var g = require("../") + +test("readdir reorder", function (t) { + g.readdir("whatevers", function (er, files) { + if (er) + throw er + t.same(files, [ "a", "b", "z" ]) + t.end() + }) +}) diff --git a/node_modules/gulp/node_modules/graceful-fs/test/write-then-read.js b/node_modules/gulp/node_modules/graceful-fs/test/write-then-read.js new file mode 100644 index 000000000..21e4c26bf --- /dev/null +++ b/node_modules/gulp/node_modules/graceful-fs/test/write-then-read.js @@ -0,0 +1,47 @@ +var fs = require('../'); +var rimraf = require('rimraf'); +var mkdirp = require('mkdirp'); +var test = require('tap').test; +var p = require('path').resolve(__dirname, 'files'); + +process.chdir(__dirname) + +// Make sure to reserve the stderr fd +process.stderr.write(''); + +var num = 4097; +var paths = new Array(num); + +test('make files', function (t) { + rimraf.sync(p); + mkdirp.sync(p); + + for (var i = 0; i < num; ++i) { + paths[i] = 'files/file-' + i; + fs.writeFileSync(paths[i], 'content'); + } + + t.end(); +}) + +test('read files', function (t) { + // now read them + var done = 0; + for (var i = 0; i < num; ++i) { + fs.readFile(paths[i], function(err, data) { + if (err) + throw err; + + ++done; + if (done === num) { + t.pass('success'); + t.end() + } + }); + } +}); + +test('cleanup', function (t) { + rimraf.sync(p); + t.end(); +}); diff --git a/node_modules/gulp/node_modules/readable-stream/.npmignore b/node_modules/gulp/node_modules/readable-stream/.npmignore new file mode 100644 index 000000000..38344f87a --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/.npmignore @@ -0,0 +1,5 @@ +build/ +test/ +examples/ +fs.js +zlib.js
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/readable-stream/LICENSE b/node_modules/gulp/node_modules/readable-stream/LICENSE new file mode 100644 index 000000000..e3d4e695a --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +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. diff --git a/node_modules/gulp/node_modules/readable-stream/README.md b/node_modules/gulp/node_modules/readable-stream/README.md new file mode 100644 index 000000000..3fb3e8023 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/README.md @@ -0,0 +1,15 @@ +# readable-stream + +***Node-core streams for userland*** + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + +This package is a mirror of the Streams2 and Streams3 implementations in Node-core. + +If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. + +**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. + +**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` + diff --git a/node_modules/gulp/node_modules/readable-stream/duplex.js b/node_modules/gulp/node_modules/readable-stream/duplex.js new file mode 100644 index 000000000..ca807af87 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/duplex.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_duplex.js") diff --git a/node_modules/gulp/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/gulp/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 000000000..b513d61a9 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,89 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +module.exports = Duplex; + +/*<replacement>*/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} +/*</replacement>*/ + + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +forEach(objectKeys(Writable.prototype), function(method) { + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; +}); + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(this.end.bind(this)); +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} diff --git a/node_modules/gulp/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/gulp/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 000000000..895ca50a1 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,46 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; diff --git a/node_modules/gulp/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/gulp/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 000000000..630722099 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,982 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +module.exports = Readable; + +/*<replacement>*/ +var isArray = require('isarray'); +/*</replacement>*/ + + +/*<replacement>*/ +var Buffer = require('buffer').Buffer; +/*</replacement>*/ + +Readable.ReadableState = ReadableState; + +var EE = require('events').EventEmitter; + +/*<replacement>*/ +if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { + return emitter.listeners(type).length; +}; +/*</replacement>*/ + +var Stream = require('stream'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var StringDecoder; + +util.inherits(Readable, Stream); + +function ReadableState(options, stream) { + options = options || {}; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = false; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // In streams that never have any data, and do push(null) right away, + // the consumer can miss the 'end' event if they do some I/O before + // consuming the stream. So, we don't emit('end') until some reading + // happens. + this.calledRead = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (typeof chunk === 'string' && !state.objectMode) { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null || chunk === undefined) { + state.reading = false; + if (!state.ended) + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) { + state.buffer.unshift(chunk); + } else { + state.reading = false; + state.buffer.push(chunk); + } + + if (state.needReadable) + emitReadable(stream); + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; +}; + +// Don't raise the hwm > 128MB +var MAX_HWM = 0x800000; +function roundUpToNextPowerOf2(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (n === null || isNaN(n)) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = roundUpToNextPowerOf2(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else + return state.length; + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + var state = this._readableState; + state.calledRead = true; + var nOrig = n; + var ret; + + if (typeof n !== 'number' || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + ret = null; + + // In cases where the decoder did not receive enough data + // to produce a full chunk, then immediately received an + // EOF, state.buffer will contain [<Buffer >, <Buffer 00 ...>]. + // howMuchToRead will see this and coerce the amount to + // read to zero (because it's looking at the length of the + // first <Buffer > in state.buffer), and we'll end up here. + // + // This can only happen via state.decoder -- no other venue + // exists for pushing a zero-length chunk into state.buffer + // and triggering this behavior. In this case, we return our + // remaining data and end the stream, if appropriate. + if (state.length > 0 && state.decoder) { + ret = fromList(n, state); + state.length -= ret.length; + } + + if (state.length === 0) + endReadable(this); + + return ret; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + + // if we currently have less than the highWaterMark, then also read some + if (state.length - n <= state.highWaterMark) + doRead = true; + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) + doRead = false; + + if (doRead) { + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read called its callback synchronously, then `reading` + // will be false, and we need to re-evaluate how much data we + // can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we happened to read() exactly the remaining amount in the + // buffer, and the EOF has been seen at this point, then make sure + // that we emit 'end' on the very next tick. + if (state.ended && !state.endEmitted && state.length === 0) + endReadable(this); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // if we've ended and we have some data left, then emit + // 'readable' now to make sure it gets picked up. + if (state.length > 0) + emitReadable(stream); + else + endReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (state.emittedReadable) + return; + + state.emittedReadable = true; + if (state.sync) + process.nextTick(function() { + emitReadable_(stream); + }); + else + emitReadable_(stream); +} + +function emitReadable_(stream) { + stream.emit('readable'); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(function() { + maybeReadMore_(stream, state); + }); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + if (readable !== src) return; + cleanup(); + } + + function onend() { + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + function cleanup() { + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (!dest._writableState || dest._writableState.needDrain) + ondrain(); + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + unpipe(); + dest.removeListener('error', onerror); + if (EE.listenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. + if (!dest._events || !dest._events.error) + dest.on('error', onerror); + else if (isArray(dest._events.error)) + dest._events.error.unshift(onerror); + else + dest._events.error = [onerror, dest._events.error]; + + + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + // the handler that waits for readable events after all + // the data gets sucked out in flow. + // This would be easier to follow with a .once() handler + // in flow(), but that is too slow. + this.on('readable', pipeOnReadable); + + state.flowing = true; + process.nextTick(function() { + flow(src); + }); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var dest = this; + var state = src._readableState; + state.awaitDrain--; + if (state.awaitDrain === 0) + flow(src); + }; +} + +function flow(src) { + var state = src._readableState; + var chunk; + state.awaitDrain = 0; + + function write(dest, i, list) { + var written = dest.write(chunk); + if (false === written) { + state.awaitDrain++; + } + } + + while (state.pipesCount && null !== (chunk = src.read())) { + + if (state.pipesCount === 1) + write(state.pipes, 0, null); + else + forEach(state.pipes, write); + + src.emit('data', chunk); + + // if anyone needs a drain, then we have to wait for that. + if (state.awaitDrain > 0) + return; + } + + // if every destination was unpiped, either before entering this + // function, or in the while loop, then stop flowing. + // + // NB: This is a pretty rare edge case. + if (state.pipesCount === 0) { + state.flowing = false; + + // if there were data event listeners added, then switch to old mode. + if (EE.listenerCount(src, 'data') > 0) + emitDataEvents(src); + return; + } + + // at this point, no one needed a drain, so we just ran out of data + // on the next readable event, start it over again. + state.ranOut = true; +} + +function pipeOnReadable() { + if (this._readableState.ranOut) { + this._readableState.ranOut = false; + flow(this); + } +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data' && !this._readableState.flowing) + emitDataEvents(this); + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + this.read(0); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + emitDataEvents(this); + this.read(0); + this.emit('resume'); +}; + +Readable.prototype.pause = function() { + emitDataEvents(this, true); + this.emit('pause'); +}; + +function emitDataEvents(stream, startPaused) { + var state = stream._readableState; + + if (state.flowing) { + // https://github.com/isaacs/readable-stream/issues/16 + throw new Error('Cannot switch to old mode now.'); + } + + var paused = startPaused || false; + var readable = false; + + // convert to an old-style stream. + stream.readable = true; + stream.pipe = Stream.prototype.pipe; + stream.on = stream.addListener = Stream.prototype.on; + + stream.on('readable', function() { + readable = true; + + var c; + while (!paused && (null !== (c = stream.read()))) + stream.emit('data', c); + + if (c === null) { + readable = false; + stream._readableState.needReadable = true; + } + }); + + stream.pause = function() { + paused = true; + this.emit('pause'); + }; + + stream.resume = function() { + paused = false; + if (readable) + process.nextTick(function() { + stream.emit('readable'); + }); + else + this.read(0); + this.emit('resume'); + }; + + // now make it start, just in case it hadn't already. + stream.emit('readable'); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + if (state.decoder) + chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + //if (state.objectMode && util.isNullOrUndefined(chunk)) + if (state.objectMode && (chunk === null || chunk === undefined)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (typeof stream[i] === 'function' && + typeof this[i] === 'undefined') { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }}(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; + } + } + } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted && state.calledRead) { + state.ended = true; + process.nextTick(function() { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } + }); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} diff --git a/node_modules/gulp/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/gulp/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 000000000..eb188df3e --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,210 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +util.inherits(Transform, Duplex); + + +function TransformState(options, stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + var ts = this._transformState = new TransformState(options, this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + this.once('finish', function() { + if ('function' === typeof this._flush) + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var rs = stream._readableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} diff --git a/node_modules/gulp/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/gulp/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 000000000..4bdaa4fa4 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,386 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; + +/*<replacement>*/ +var Buffer = require('buffer').Buffer; +/*</replacement>*/ + +Writable.WritableState = WritableState; + + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var Stream = require('stream'); + +util.inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; +} + +function Writable(options) { + var Duplex = require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (typeof cb !== 'function') + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) + ret = writeOrBuffer(this, state, chunk, encoding, cb); + + return ret; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + typeof chunk === 'string') { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; + + if (state.writing) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + process.nextTick(function() { + cb(er); + }); + else + cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && !state.bufferProcessing && state.buffer.length) + clearBuffer(stream, state); + + if (sync) { + process.nextTick(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + cb(); + if (finished) + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + state.bufferProcessing = false; + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (typeof chunk !== 'undefined' && chunk !== null) + this.write(chunk, encoding); + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + state.finished = true; + stream.emit('finish'); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} diff --git a/node_modules/gulp/node_modules/readable-stream/package.json b/node_modules/gulp/node_modules/readable-stream/package.json new file mode 100644 index 000000000..5a676a4b3 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/package.json @@ -0,0 +1,112 @@ +{ + "_args": [ + [ + { + "raw": "readable-stream@>=1.0.33-1 <1.1.0-0", + "scope": null, + "escapedName": "readable-stream", + "name": "readable-stream", + "rawSpec": ">=1.0.33-1 <1.1.0-0", + "spec": ">=1.0.33-1 <1.1.0-0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/through2" + ] + ], + "_from": "readable-stream@>=1.0.33-1 <1.1.0-0", + "_id": "readable-stream@1.0.34", + "_inCache": true, + "_location": "/gulp/readable-stream", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/readable-stream-1.0.34.tgz_1460562521506_0.019665231462568045" + }, + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "_npmVersion": "3.8.3", + "_phantomChildren": {}, + "_requested": { + "raw": "readable-stream@>=1.0.33-1 <1.1.0-0", + "scope": null, + "escapedName": "readable-stream", + "name": "readable-stream", + "rawSpec": ">=1.0.33-1 <1.1.0-0", + "spec": ">=1.0.33-1 <1.1.0-0", + "type": "range" + }, + "_requiredBy": [ + "/gulp/through2" + ], + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "_shasum": "125820e34bc842d2f2aaafafe4c2916ee32c157c", + "_shrinkwrap": null, + "_spec": "readable-stream@>=1.0.33-1 <1.1.0-0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/through2", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "browser": { + "util": false + }, + "bugs": { + "url": "https://github.com/isaacs/readable-stream/issues" + }, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + }, + "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", + "devDependencies": { + "tap": "~0.2.6" + }, + "directories": {}, + "dist": { + "shasum": "125820e34bc842d2f2aaafafe4c2916ee32c157c", + "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz" + }, + "gitHead": "1227c7b66deedb1dc5284a89425854d5f7ad9576", + "homepage": "https://github.com/isaacs/readable-stream#readme", + "keywords": [ + "readable", + "stream", + "pipe" + ], + "license": "MIT", + "main": "readable.js", + "maintainers": [ + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + } + ], + "name": "readable-stream", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/readable-stream.git" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "version": "1.0.34" +} diff --git a/node_modules/gulp/node_modules/readable-stream/passthrough.js b/node_modules/gulp/node_modules/readable-stream/passthrough.js new file mode 100644 index 000000000..27e8d8a55 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/passthrough.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_passthrough.js") diff --git a/node_modules/gulp/node_modules/readable-stream/readable.js b/node_modules/gulp/node_modules/readable-stream/readable.js new file mode 100644 index 000000000..26511e87b --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/readable.js @@ -0,0 +1,11 @@ +var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +if (!process.browser && process.env.READABLE_STREAM === 'disable') { + module.exports = require('stream'); +} diff --git a/node_modules/gulp/node_modules/readable-stream/transform.js b/node_modules/gulp/node_modules/readable-stream/transform.js new file mode 100644 index 000000000..5d482f078 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/transform.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_transform.js") diff --git a/node_modules/gulp/node_modules/readable-stream/writable.js b/node_modules/gulp/node_modules/readable-stream/writable.js new file mode 100644 index 000000000..e1e9efdf3 --- /dev/null +++ b/node_modules/gulp/node_modules/readable-stream/writable.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_writable.js") diff --git a/node_modules/gulp/node_modules/strip-bom/cli.js b/node_modules/gulp/node_modules/strip-bom/cli.js new file mode 100755 index 000000000..2c1e7c4d5 --- /dev/null +++ b/node_modules/gulp/node_modules/strip-bom/cli.js @@ -0,0 +1,42 @@ +#!/usr/bin/env node +'use strict'; +var fs = require('fs'); +var pkg = require('./package.json'); +var stripBom = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' strip-bom <file> > <new-file>', + ' cat <file> | strip-bom > <new-file>', + '', + ' Example', + ' strip-bom unicorn.txt > unicorn-without-bom.txt' + ].join('\n')); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +if (process.stdin.isTTY) { + if (!input) { + help(); + return; + } + + fs.createReadStream(input).pipe(stripBom.stream()).pipe(process.stdout); +} else { + process.stdin.pipe(stripBom.stream()).pipe(process.stdout); +} diff --git a/node_modules/gulp/node_modules/strip-bom/index.js b/node_modules/gulp/node_modules/strip-bom/index.js new file mode 100644 index 000000000..c085b4ce3 --- /dev/null +++ b/node_modules/gulp/node_modules/strip-bom/index.js @@ -0,0 +1,24 @@ +'use strict'; +var isUtf8 = require('is-utf8'); + +var stripBom = module.exports = function (arg) { + if (typeof arg === 'string') { + return arg.replace(/^\ufeff/g, ''); + } + + if (Buffer.isBuffer(arg) && isUtf8(arg) && + arg[0] === 0xef && arg[1] === 0xbb && arg[2] === 0xbf) { + return arg.slice(3); + } + + return arg; +}; + +stripBom.stream = function () { + var firstChunk = require('first-chunk-stream'); + + return firstChunk({minSize: 3}, function (chunk, enc, cb) { + this.push(stripBom(chunk)); + cb(); + }); +}; diff --git a/node_modules/gulp/node_modules/strip-bom/package.json b/node_modules/gulp/node_modules/strip-bom/package.json new file mode 100644 index 000000000..4fd8288a4 --- /dev/null +++ b/node_modules/gulp/node_modules/strip-bom/package.json @@ -0,0 +1,113 @@ +{ + "_args": [ + [ + { + "raw": "strip-bom@^1.0.0", + "scope": null, + "escapedName": "strip-bom", + "name": "strip-bom", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs" + ] + ], + "_from": "strip-bom@>=1.0.0 <2.0.0", + "_id": "strip-bom@1.0.0", + "_inCache": true, + "_location": "/gulp/strip-bom", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "_npmVersion": "1.4.9", + "_phantomChildren": {}, + "_requested": { + "raw": "strip-bom@^1.0.0", + "scope": null, + "escapedName": "strip-bom", + "name": "strip-bom", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp/vinyl-fs" + ], + "_resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", + "_shasum": "85b8862f3844b5a6d5ec8467a93598173a36f794", + "_shrinkwrap": null, + "_spec": "strip-bom@^1.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bin": { + "strip-bom": "cli.js" + }, + "bugs": { + "url": "https://github.com/sindresorhus/strip-bom/issues" + }, + "dependencies": { + "first-chunk-stream": "^1.0.0", + "is-utf8": "^0.2.0" + }, + "description": "Strip UTF-8 byte order mark (BOM) from a string/buffer/stream", + "devDependencies": { + "concat-stream": "^1.4.5", + "mocha": "*" + }, + "directories": {}, + "dist": { + "shasum": "85b8862f3844b5a6d5ec8467a93598173a36f794", + "tarball": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "cli.js", + "index.js" + ], + "homepage": "https://github.com/sindresorhus/strip-bom", + "keywords": [ + "cli", + "bin", + "app", + "bom", + "strip", + "byte", + "mark", + "unicode", + "utf8", + "utf-8", + "remove", + "trim", + "text", + "buffer", + "string", + "stream", + "streams" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "strip-bom", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/sindresorhus/strip-bom.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.0.0" +} diff --git a/node_modules/gulp/node_modules/strip-bom/readme.md b/node_modules/gulp/node_modules/strip-bom/readme.md new file mode 100644 index 000000000..10e1d8f97 --- /dev/null +++ b/node_modules/gulp/node_modules/strip-bom/readme.md @@ -0,0 +1,59 @@ +# strip-bom [![Build Status](https://travis-ci.org/sindresorhus/strip-bom.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-bom) + +> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string/buffer/stream + +From Wikipedia: + +> The Unicode Standard permits the BOM in UTF-8, but does not require nor recommend its use. Byte order has no meaning in UTF-8. + + +## Usage + +```sh +$ npm install --save strip-bom +``` + +```js +var fs = require('fs'); +var stripBom = require('strip-bom'); + +stripBom('\ufeffUnicorn'); +//=> Unicorn + +stripBom(fs.readFileSync('unicorn.txt')); +//=> Unicorn +``` + +Or as a [Transform stream](http://nodejs.org/api/stream.html#stream_class_stream_transform): + +```js +var fs = require('fs'); +var stripBom = require('strip-bom'); + +fs.createReadStream('unicorn.txt') + .pipe(stripBom.stream()) + .pipe(fs.createWriteStream('unicorn.txt')); +``` + + +## CLI + +```sh +$ npm install --global strip-bom +``` + +``` +$ strip-bom --help + + Usage + strip-bom <file> > <new-file> + cat <file> | strip-bom > <new-file> + + Example + strip-bom unicorn.txt > unicorn-without-bom.txt +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp/node_modules/through2/.npmignore b/node_modules/gulp/node_modules/through2/.npmignore new file mode 100644 index 000000000..1e1dcab34 --- /dev/null +++ b/node_modules/gulp/node_modules/through2/.npmignore @@ -0,0 +1,3 @@ +test +.jshintrc +.travis.yml
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/through2/LICENSE b/node_modules/gulp/node_modules/through2/LICENSE new file mode 100644 index 000000000..f6a0029de --- /dev/null +++ b/node_modules/gulp/node_modules/through2/LICENSE @@ -0,0 +1,39 @@ +Copyright 2013, Rod Vagg (the "Original Author") +All rights reserved. + +MIT +no-false-attribs 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. + +Distributions of all or part of the Software intended to be used +by the recipients as they would use the unmodified Software, +containing modifications that substantially alter, remove, or +disable functionality of the Software, outside of the documented +configuration mechanisms provided by the Software, shall be +modified such that the Original Author's bug reporting email +addresses and urls are either replaced with the contact information +of the parties responsible for the changes, or removed entirely. + +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. + + +Except where noted, this license applies to any and all software +programs and associated documentation files created by the +Original Author, when distributed with the Software.
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/through2/README.md b/node_modules/gulp/node_modules/through2/README.md new file mode 100644 index 000000000..11259a5f7 --- /dev/null +++ b/node_modules/gulp/node_modules/through2/README.md @@ -0,0 +1,132 @@ +# through2 + +[![NPM](https://nodei.co/npm/through2.png?downloads&downloadRank)](https://nodei.co/npm/through2/) + +**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise** + +Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`. + +Note: A **Streams3** version of through2 is available in npm with the tag `"1.0"` rather than `"latest"` so an `npm install through2` will get you the current Streams2 version (version number is 0.x.x). To use a Streams3 version use `npm install through2@1` to fetch the latest version 1.x.x. More information about Streams2 vs Streams3 and recommendations see the article **[Why I don't use Node's core 'stream' module](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html)**. + +```js +fs.createReadStream('ex.txt') + .pipe(through2(function (chunk, enc, callback) { + for (var i = 0; i < chunk.length; i++) + if (chunk[i] == 97) + chunk[i] = 122 // swap 'a' for 'z' + + this.push(chunk) + + callback() + })) + .pipe(fs.createWriteStream('out.txt')) +``` + +Or object streams: + +```js +var all = [] + +fs.createReadStream('data.csv') + .pipe(csv2()) + .pipe(through2.obj(function (chunk, enc, callback) { + var data = { + name : chunk[0] + , address : chunk[3] + , phone : chunk[10] + } + this.push(data) + + callback() + })) + .on('data', function (data) { + all.push(data) + }) + .on('end', function () { + doSomethingSpecial(all) + }) +``` + +Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`. + +## API + +<b><code>through2([ options, ] [ transformFunction ] [, flushFunction ])</code></b> + +Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`). + +### options + +The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`). + +The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call: + +```js +fs.createReadStream('/tmp/important.dat') + .pipe(through2({ objectMode: true, allowHalfOpen: false }, + function (chunk, enc, cb) { + cb(null, 'wut?') // note we can use the second argument on the callback + // to provide data as an alternative to this.push('wut?') + } + ) + .pipe(fs.createWriteStream('/tmp/wut.txt')) +``` + +### transformFunction + +The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk. + +To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on. + +Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error. + +If you **do not provide a `transformFunction`** then you will get a simple pass-through stream. + +### flushFunction + +The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress. + +```js +fs.createReadStream('/tmp/important.dat') + .pipe(through2( + function (chunk, enc, cb) { cb(null, chunk) }, // transform is a noop + function (cb) { // flush function + this.push('tacking on an extra buffer to the end'); + cb(); + } + )) + .pipe(fs.createWriteStream('/tmp/wut.txt')); +``` + +<b><code>through2.ctor([ options, ] transformFunction[, flushFunction ])</code></b> + +Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances. + +```js +var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) { + if (record.temp != null && record.unit = "F") { + record.temp = ( ( record.temp - 32 ) * 5 ) / 9 + record.unit = "C" + } + this.push(record) + callback() +}) + +// Create instances of FToC like so: +var converter = new FToC() +// Or: +var converter = FToC() +// Or specify/override options when you instantiate, if you prefer: +var converter = FToC({objectMode: true}) +``` + +## See Also + + - [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams. + - [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams. + - [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams. + - [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies. + +## License + +**through2** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/gulp/node_modules/through2/package.json b/node_modules/gulp/node_modules/through2/package.json new file mode 100644 index 000000000..f3a59a039 --- /dev/null +++ b/node_modules/gulp/node_modules/through2/package.json @@ -0,0 +1,98 @@ +{ + "_args": [ + [ + { + "raw": "through2@^0.6.1", + "scope": null, + "escapedName": "through2", + "name": "through2", + "rawSpec": "^0.6.1", + "spec": ">=0.6.1 <0.7.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs" + ] + ], + "_from": "through2@>=0.6.1 <0.7.0", + "_id": "through2@0.6.5", + "_inCache": true, + "_location": "/gulp/through2", + "_npmUser": { + "name": "bryce", + "email": "bryce@ravenwall.com" + }, + "_npmVersion": "1.4.28", + "_phantomChildren": {}, + "_requested": { + "raw": "through2@^0.6.1", + "scope": null, + "escapedName": "through2", + "name": "through2", + "rawSpec": "^0.6.1", + "spec": ">=0.6.1 <0.7.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp/vinyl-fs" + ], + "_resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "_shasum": "41ab9c67b29d57209071410e1d7a7a968cd3ad48", + "_shrinkwrap": null, + "_spec": "through2@^0.6.1", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs", + "author": { + "name": "Rod Vagg", + "email": "r@va.gg", + "url": "https://github.com/rvagg" + }, + "bugs": { + "url": "https://github.com/rvagg/through2/issues" + }, + "dependencies": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + }, + "description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise", + "devDependencies": { + "bl": ">=0.9.0 <0.10.0-0", + "stream-spigot": ">=3.0.4 <3.1.0-0", + "tape": ">=2.14.0 <2.15.0-0" + }, + "directories": {}, + "dist": { + "shasum": "41ab9c67b29d57209071410e1d7a7a968cd3ad48", + "tarball": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz" + }, + "gitHead": "ba4a87875f2c82323c10023e36f4ae4b386c1bf8", + "homepage": "https://github.com/rvagg/through2", + "keywords": [ + "stream", + "streams2", + "through", + "transform" + ], + "license": "MIT", + "main": "through2.js", + "maintainers": [ + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "bryce", + "email": "bryce@ravenwall.com" + } + ], + "name": "through2", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/rvagg/through2.git" + }, + "scripts": { + "test": "node test/test.js", + "test-local": "brtapsauce-local test/basic-test.js" + }, + "version": "0.6.5" +} diff --git a/node_modules/gulp/node_modules/through2/through2.js b/node_modules/gulp/node_modules/through2/through2.js new file mode 100644 index 000000000..5b7a880e8 --- /dev/null +++ b/node_modules/gulp/node_modules/through2/through2.js @@ -0,0 +1,96 @@ +var Transform = require('readable-stream/transform') + , inherits = require('util').inherits + , xtend = require('xtend') + +function DestroyableTransform(opts) { + Transform.call(this, opts) + this._destroyed = false +} + +inherits(DestroyableTransform, Transform) + +DestroyableTransform.prototype.destroy = function(err) { + if (this._destroyed) return + this._destroyed = true + + var self = this + process.nextTick(function() { + if (err) + self.emit('error', err) + self.emit('close') + }) +} + +// a noop _transform function +function noop (chunk, enc, callback) { + callback(null, chunk) +} + + +// create a new export function, used by both the main export and +// the .ctor export, contains common logic for dealing with arguments +function through2 (construct) { + return function (options, transform, flush) { + if (typeof options == 'function') { + flush = transform + transform = options + options = {} + } + + if (typeof transform != 'function') + transform = noop + + if (typeof flush != 'function') + flush = null + + return construct(options, transform, flush) + } +} + + +// main export, just make me a transform stream! +module.exports = through2(function (options, transform, flush) { + var t2 = new DestroyableTransform(options) + + t2._transform = transform + + if (flush) + t2._flush = flush + + return t2 +}) + + +// make me a reusable prototype that I can `new`, or implicitly `new` +// with a constructor call +module.exports.ctor = through2(function (options, transform, flush) { + function Through2 (override) { + if (!(this instanceof Through2)) + return new Through2(override) + + this.options = xtend(options, override) + + DestroyableTransform.call(this, this.options) + } + + inherits(Through2, DestroyableTransform) + + Through2.prototype._transform = transform + + if (flush) + Through2.prototype._flush = flush + + return Through2 +}) + + +module.exports.obj = through2(function (options, transform, flush) { + var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options)) + + t2._transform = transform + + if (flush) + t2._flush = flush + + return t2 +}) diff --git a/node_modules/gulp/node_modules/vinyl-fs/LICENSE b/node_modules/gulp/node_modules/vinyl-fs/LICENSE new file mode 100755 index 000000000..7cbe012c6 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014 Fractal <contact@wearefractal.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. diff --git a/node_modules/gulp/node_modules/vinyl-fs/README.md b/node_modules/gulp/node_modules/vinyl-fs/README.md new file mode 100644 index 000000000..d3248d777 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/README.md @@ -0,0 +1,93 @@ +# vinyl-fs [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status](https://david-dm.org/wearefractal/vinyl.png?theme=shields.io)](https://david-dm.org/wearefractal/vinyl-fs) + +## Information + +<table> +<tr> +<td>Package</td><td>vinyl-fs</td> +</tr> +<tr> +<td>Description</td> +<td>Vinyl adapter for the file system</td> +</tr> +<tr> +<td>Node Version</td> +<td>>= 0.10</td> +</tr> +</table> + +## Usage + +```javascript +var map = require('map-stream'); +var fs = require('vinyl-fs'); + +var log = function(file, cb) { + console.log(file.path); + cb(null, file); +}; + +fs.src(['./js/**/*.js', '!./js/vendor/*.js']) + .pipe(map(log)) + .pipe(fs.dest('./output')); +``` + +## API + +### src(globs[, opt]) + +- Takes a glob string or an array of glob strings as the first argument. +- Possible options for the second argument: + - cwd - Specify the working directory the folder is relative to. Default is `process.cwd()` + - base - Specify the folder relative to the cwd. Default is where the glob begins. This is used to determine the file names when saving in `.dest()` + - buffer - `true` or `false` if you want to buffer the file. + - Default value is `true` + - `false` will make file.contents a paused Stream + - read - `true` or `false` if you want the file to be read or not. Useful for stuff like `rm`ing files. + - Default value is `true` + - `false` will disable writing the file to disk via `.dest()` + - Any glob-related options are documented in [glob-stream] and [node-glob] +- Returns a Readable/Writable stream. +- On write the stream will simply pass items through. +- This stream emits matching [vinyl] File objects + +### watch(globs[, opt, cb]) + +This is just [glob-watcher] + +- Takes a glob string or an array of glob strings as the first argument. +- Possible options for the second argument: + - Any options are passed to [gaze] +- Returns an EventEmitter + - 'changed' event is emitted on each file change +- Optionally calls the callback on each change event + +### dest(folder[, opt]) + +- Takes a folder path as the first argument. +- First argument can also be a function that takes in a file and returns a folder path. +- Possible options for the second argument: + - cwd - Specify the working directory the folder is relative to. Default is `process.cwd()` + - mode - Specify the mode the files should be created with. Default is the mode of the input file (file.stat.mode) +- Returns a Readable/Writable stream. +- On write the stream will save the [vinyl] File to disk at the folder/cwd specified. +- After writing the file to disk, it will be emitted from the stream so you can keep piping these around +- The file will be modified after being written to this stream + - `cwd`, `base`, and `path` will be overwritten to match the folder + - `stat.mode` will be overwritten if you used a mode parameter + - `contents` will have it's position reset to the beginning if it is a stream + +[glob-stream]: https://github.com/wearefractal/glob-stream +[node-glob]: https://github.com/isaacs/node-glob +[gaze]: https://github.com/shama/gaze +[glob-watcher]: https://github.com/wearefractal/glob-watcher +[vinyl]: https://github.com/wearefractal/vinyl + +[npm-url]: https://npmjs.org/package/vinyl-fs +[npm-image]: https://badge.fury.io/js/vinyl-fs.png +[travis-url]: https://travis-ci.org/wearefractal/vinyl-fs +[travis-image]: https://travis-ci.org/wearefractal/vinyl-fs.png?branch=master +[coveralls-url]: https://coveralls.io/r/wearefractal/vinyl-fs +[coveralls-image]: https://coveralls.io/repos/wearefractal/vinyl-fs/badge.png +[depstat-url]: https://david-dm.org/wearefractal/vinyl-fs +[depstat-image]: https://david-dm.org/wearefractal/vinyl-fs.png diff --git a/node_modules/gulp/node_modules/vinyl-fs/index.js b/node_modules/gulp/node_modules/vinyl-fs/index.js new file mode 100644 index 000000000..7306aa78e --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/index.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = { + src: require('./lib/src'), + dest: require('./lib/dest'), + watch: require('glob-watcher') +}; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/dest/index.js b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/index.js new file mode 100644 index 000000000..1b94ad318 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/index.js @@ -0,0 +1,61 @@ +'use strict'; + +var defaults = require('defaults'); +var path = require('path'); +var through2 = require('through2'); +var mkdirp = require('mkdirp'); +var fs = require('graceful-fs'); + +var writeContents = require('./writeContents'); + + +function dest(outFolder, opt) { + opt = opt || {}; + if (typeof outFolder !== 'string' && typeof outFolder !== 'function') { + throw new Error('Invalid output folder'); + } + + var options = defaults(opt, { + cwd: process.cwd() + }); + + if (typeof options.mode === 'string') { + options.mode = parseInt(options.mode, 8); + } + + var cwd = path.resolve(options.cwd); + + function saveFile (file, enc, cb) { + var basePath; + if (typeof outFolder === 'string') { + basePath = path.resolve(cwd, outFolder); + } + if (typeof outFolder === 'function') { + basePath = path.resolve(cwd, outFolder(file)); + } + var writePath = path.resolve(basePath, file.relative); + var writeFolder = path.dirname(writePath); + + // wire up new properties + file.stat = file.stat ? file.stat : new fs.Stats(); + file.stat.mode = (options.mode || file.stat.mode); + file.cwd = cwd; + file.base = basePath; + file.path = writePath; + + // mkdirp the folder the file is going in + mkdirp(writeFolder, function(err){ + if (err) { + return cb(err); + } + writeContents(writePath, file, cb); + }); + } + + var stream = through2.obj(saveFile); + // TODO: option for either backpressure or lossy + stream.resume(); + return stream; +} + +module.exports = dest; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/index.js b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/index.js new file mode 100644 index 000000000..ab8f0f9df --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var fs = require('fs'); +var writeDir = require('./writeDir'); +var writeStream = require('./writeStream'); +var writeBuffer = require('./writeBuffer'); + +function writeContents(writePath, file, cb) { + var written = function(err) { + var done = function(err) { + cb(err, file); + }; + if (err) { + return done(err); + } + + if (!file.stat || typeof file.stat.mode !== 'number') { + return done(); + } + + fs.stat(writePath, function(err, st) { + if (err) { + return done(err); + } + // octal 7777 = decimal 4095 + var currentMode = (st.mode & 4095); + if (currentMode === file.stat.mode) { + return done(); + } + fs.chmod(writePath, file.stat.mode, done); + }); + }; + + // if directory then mkdirp it + if (file.isDirectory()) { + writeDir(writePath, file, written); + return; + } + + // stream it to disk yo + if (file.isStream()) { + writeStream(writePath, file, written); + return; + } + + // write it like normal + if (file.isBuffer()) { + writeBuffer(writePath, file, written); + return; + } + + // if no contents then do nothing + if (file.isNull()) { + cb(null, file); + return; + } +} + +module.exports = writeContents; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeBuffer.js b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeBuffer.js new file mode 100644 index 000000000..fe4be8f20 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeBuffer.js @@ -0,0 +1,13 @@ +'use strict'; + +var fs = require('graceful-fs'); + +function writeBuffer(writePath, file, cb) { + var opt = { + mode: file.stat.mode + }; + + fs.writeFile(writePath, file.contents, opt, cb); +} + +module.exports = writeBuffer; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeDir.js b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeDir.js new file mode 100644 index 000000000..9614b54d0 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeDir.js @@ -0,0 +1,9 @@ +'use strict'; + +var mkdirp = require('mkdirp'); + +function writeDir (writePath, file, cb) { + mkdirp(writePath, file.stat.mode, cb); +} + +module.exports = writeDir; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeStream.js b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeStream.js new file mode 100644 index 000000000..c49017aad --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/writeStream.js @@ -0,0 +1,22 @@ +'use strict'; + +var streamFile = require('../../src/getContents/streamFile'); +var fs = require('graceful-fs'); + +function writeStream (writePath, file, cb) { + var opt = { + mode: file.stat.mode + }; + + var outStream = fs.createWriteStream(writePath, opt); + + file.contents.once('error', cb); + outStream.once('error', cb); + outStream.once('finish', function() { + streamFile(file, cb); + }); + + file.contents.pipe(outStream); +} + +module.exports = writeStream; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js new file mode 100644 index 000000000..4448eb7e9 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js @@ -0,0 +1,16 @@ +'use strict'; + +var fs = require('graceful-fs'); +var stripBom = require('strip-bom'); + +function bufferFile(file, cb) { + fs.readFile(file.path, function (err, data) { + if (err) { + return cb(err); + } + file.contents = stripBom(data); + cb(null, file); + }); +} + +module.exports = bufferFile; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/index.js b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/index.js new file mode 100644 index 000000000..d21a25491 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/index.js @@ -0,0 +1,26 @@ +'use strict'; + +var through2 = require('through2'); + +var readDir = require('./readDir'); +var bufferFile = require('./bufferFile'); +var streamFile = require('./streamFile'); + +function getContents(opt) { + return through2.obj(function (file, enc, cb) { + // don't fail to read a directory + if (file.isDirectory()) { + return readDir(file, cb); + } + + // read and pass full contents + if (opt.buffer !== false) { + return bufferFile(file, cb); + } + + // dont buffer anything - just pass streams + return streamFile(file, cb); + }); +} + +module.exports = getContents; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/readDir.js b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/readDir.js new file mode 100644 index 000000000..783fac2cf --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/readDir.js @@ -0,0 +1,8 @@ +'use strict'; + +function readDir(file, cb) { + // do nothing for now + cb(null, file); +} + +module.exports = readDir; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/streamFile.js b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/streamFile.js new file mode 100644 index 000000000..1743edd7c --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/streamFile.js @@ -0,0 +1,13 @@ +'use strict'; + +var fs = require('graceful-fs'); +var stripBom = require('strip-bom'); + +function streamFile(file, cb) { + file.contents = fs.createReadStream(file.path) + .pipe(stripBom.stream()); + + cb(null, file); +} + +module.exports = streamFile; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/src/getStats.js b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getStats.js new file mode 100644 index 000000000..8380087c7 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/src/getStats.js @@ -0,0 +1,19 @@ +'use strict'; + +var through2 = require('through2'); +var fs = require('graceful-fs'); + +function getStats() { + return through2.obj(fetchStats); +} + +function fetchStats(file, enc, cb) { + fs.lstat(file.path, function (err, stat) { + if (stat) { + file.stat = stat; + } + cb(err, file); + }); +} + +module.exports = getStats; diff --git a/node_modules/gulp/node_modules/vinyl-fs/lib/src/index.js b/node_modules/gulp/node_modules/vinyl-fs/lib/src/index.js new file mode 100644 index 000000000..21a177159 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/lib/src/index.js @@ -0,0 +1,61 @@ +'use strict'; + +var defaults = require('defaults'); +var through = require('through2'); +var gs = require('glob-stream'); +var File = require('vinyl'); + +var getContents = require('./getContents'); +var getStats = require('./getStats'); + +function createFile (globFile, enc, cb) { + cb(null, new File(globFile)); +} + +function src(glob, opt) { + opt = opt || {}; + var pass = through.obj(); + + if (!isValidGlob(glob)) { + throw new Error('Invalid glob argument: ' + glob); + } + // return dead stream if empty array + if (Array.isArray(glob) && glob.length === 0) { + process.nextTick(pass.end.bind(pass)); + return pass; + } + + var options = defaults(opt, { + read: true, + buffer: true + }); + + var globStream = gs.create(glob, options); + + // when people write to use just pass it through + var outputStream = globStream + .pipe(through.obj(createFile)) + .pipe(getStats(options)); + + if (options.read !== false) { + outputStream = outputStream + .pipe(getContents(options)); + } + + return outputStream.pipe(pass); +} + +function isValidGlob(glob) { + if (typeof glob === 'string') { + return true; + } + if (Array.isArray(glob) && glob.length !== 0) { + return glob.every(isValidGlob); + } + if (Array.isArray(glob) && glob.length === 0) { + return true; + } + return false; +} + +module.exports = src; diff --git a/node_modules/gulp/node_modules/vinyl-fs/package.json b/node_modules/gulp/node_modules/vinyl-fs/package.json new file mode 100644 index 000000000..ceafe383f --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl-fs/package.json @@ -0,0 +1,117 @@ +{ + "_args": [ + [ + { + "raw": "vinyl-fs@^0.3.0", + "scope": null, + "escapedName": "vinyl-fs", + "name": "vinyl-fs", + "rawSpec": "^0.3.0", + "spec": ">=0.3.0 <0.4.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp" + ] + ], + "_from": "vinyl-fs@>=0.3.0 <0.4.0", + "_id": "vinyl-fs@0.3.14", + "_inCache": true, + "_location": "/gulp/vinyl-fs", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "phated", + "email": "blaine@iceddev.com" + }, + "_npmVersion": "2.14.3", + "_phantomChildren": {}, + "_requested": { + "raw": "vinyl-fs@^0.3.0", + "scope": null, + "escapedName": "vinyl-fs", + "name": "vinyl-fs", + "rawSpec": "^0.3.0", + "spec": ">=0.3.0 <0.4.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp" + ], + "_resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", + "_shasum": "9a6851ce1cac1c1cea5fe86c0931d620c2cfa9e6", + "_shrinkwrap": null, + "_spec": "vinyl-fs@^0.3.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp", + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "bugs": { + "url": "https://github.com/wearefractal/vinyl-fs/issues" + }, + "dependencies": { + "defaults": "^1.0.0", + "glob-stream": "^3.1.5", + "glob-watcher": "^0.0.6", + "graceful-fs": "^3.0.0", + "mkdirp": "^0.5.0", + "strip-bom": "^1.0.0", + "through2": "^0.6.1", + "vinyl": "^0.4.0" + }, + "description": "Vinyl adapter for the file system", + "devDependencies": { + "buffer-equal": "^0.0.1", + "coveralls": "^2.6.1", + "istanbul": "^0.3.0", + "jshint": "^2.4.1", + "mocha": "^2.0.0", + "mocha-lcov-reporter": "^0.0.1", + "rimraf": "^2.2.5", + "should": "^4.0.0", + "sinon": "^1.10.3" + }, + "directories": {}, + "dist": { + "shasum": "9a6851ce1cac1c1cea5fe86c0931d620c2cfa9e6", + "tarball": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz" + }, + "engines": { + "node": ">= 0.10" + }, + "files": [ + "index.js", + "lib" + ], + "gitHead": "1e026b90df987b6da0ca7da941fd61a7cd1e6d8f", + "homepage": "http://github.com/wearefractal/vinyl-fs", + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/wearefractal/vinyl-fs/raw/master/LICENSE" + } + ], + "main": "./index.js", + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "name": "vinyl-fs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/wearefractal/vinyl-fs.git" + }, + "scripts": { + "coveralls": "istanbul cover _mocha -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", + "test": "mocha --reporter spec && jshint lib" + }, + "version": "0.3.14" +} diff --git a/node_modules/gulp/node_modules/vinyl/LICENSE b/node_modules/gulp/node_modules/vinyl/LICENSE new file mode 100644 index 000000000..4f482f9ba --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Fractal <contact@wearefractal.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. diff --git a/node_modules/gulp/node_modules/vinyl/README.md b/node_modules/gulp/node_modules/vinyl/README.md new file mode 100644 index 000000000..ae6f16f96 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/README.md @@ -0,0 +1,127 @@ +# vinyl [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status](https://david-dm.org/wearefractal/vinyl.png?theme=shields.io)](https://david-dm.org/wearefractal/vinyl) + + +## Information + +<table> +<tr> +<td>Package</td><td>vinyl</td> +</tr> +<tr> +<td>Description</td> +<td>A virtual file format</td> +</tr> +<tr> +<td>Node Version</td> +<td>>= 0.9</td> +</tr> +</table> + +## What is this? + +Read this for more info about how this plays into the grand scheme of things https://medium.com/@eschoff/3828e8126466 + +## File + +```javascript +var File = require('vinyl'); + +var coffeeFile = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee", + contents: new Buffer("test = 123") +}); +``` + +### constructor(options) + +#### options.cwd + +Type: `String` +Default: `process.cwd()` + +#### options.base + +Used for relative pathing. Typically where a glob starts. + +Type: `String` +Default: `options.cwd` + +#### options.path + +Full path to the file. + +Type: `String` +Default: `null` + +#### options.stat + +The result of an fs.stat call. See [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information. + +Type: `fs.Stats` +Default: `null` + +#### options.contents + +File contents. + +Type: `Buffer, Stream, or null` +Default: `null` + +### isBuffer() + +Returns true if file.contents is a Buffer. + +### isStream() + +Returns true if file.contents is a Stream. + +### isNull() + +Returns true if file.contents is null. + +### clone() + +Returns a new File object with all attributes cloned. Custom attributes are deep-cloned. + +### pipe(stream[, opt]) + +If file.contents is a Buffer, it will write it to the stream. + +If file.contents is a Stream, it will pipe it to the stream. + +If file.contents is null, it will do nothing. + +If opt.end is false, the destination stream will not be ended (same as node core). + +Returns the stream. + +### inspect() + +Returns a pretty String interpretation of the File. Useful for console.log. + +### relative + +Returns path.relative for the file base and file path. + +Example: + +```javascript +var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee" +}); + +console.log(file.relative); // file.coffee +``` + +[npm-url]: https://npmjs.org/package/vinyl +[npm-image]: https://badge.fury.io/js/vinyl.png +[travis-url]: https://travis-ci.org/wearefractal/vinyl +[travis-image]: https://travis-ci.org/wearefractal/vinyl.png?branch=master +[coveralls-url]: https://coveralls.io/r/wearefractal/vinyl +[coveralls-image]: https://coveralls.io/repos/wearefractal/vinyl/badge.png +[depstat-url]: https://david-dm.org/wearefractal/vinyl +[depstat-image]: https://david-dm.org/wearefractal/vinyl.png diff --git a/node_modules/gulp/node_modules/vinyl/index.js b/node_modules/gulp/node_modules/vinyl/index.js new file mode 100644 index 000000000..9aa47b78f --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/index.js @@ -0,0 +1,175 @@ +var path = require('path'); +var clone = require('clone'); +var cloneStats = require('clone-stats'); +var cloneBuffer = require('./lib/cloneBuffer'); +var isBuffer = require('./lib/isBuffer'); +var isStream = require('./lib/isStream'); +var isNull = require('./lib/isNull'); +var inspectStream = require('./lib/inspectStream'); +var Stream = require('stream'); + +function File(file) { + if (!file) file = {}; + + // record path change + var history = file.path ? [file.path] : file.history; + this.history = history || []; + + // TODO: should this be moved to vinyl-fs? + this.cwd = file.cwd || process.cwd(); + this.base = file.base || this.cwd; + + // stat = fs stats object + // TODO: should this be moved to vinyl-fs? + this.stat = file.stat || null; + + // contents = stream, buffer, or null if not read + this.contents = file.contents || null; +} + +File.prototype.isBuffer = function() { + return isBuffer(this.contents); +}; + +File.prototype.isStream = function() { + return isStream(this.contents); +}; + +File.prototype.isNull = function() { + return isNull(this.contents); +}; + +// TODO: should this be moved to vinyl-fs? +File.prototype.isDirectory = function() { + return this.isNull() && this.stat && this.stat.isDirectory(); +}; + +File.prototype.clone = function(opt) { + if (typeof opt === 'boolean') { + opt = { + deep: opt, + contents: true + }; + } else if (!opt) { + opt = { + deep: false, + contents: true + }; + } else { + opt.deep = opt.deep === true; + opt.contents = opt.contents !== false; + } + + // clone our file contents + var contents; + if (this.isStream()) { + contents = this.contents.pipe(new Stream.PassThrough()); + this.contents = this.contents.pipe(new Stream.PassThrough()); + } else if (this.isBuffer()) { + contents = opt.contents ? cloneBuffer(this.contents) : this.contents; + } + + var file = new File({ + cwd: this.cwd, + base: this.base, + stat: (this.stat ? cloneStats(this.stat) : null), + history: this.history.slice(), + contents: contents + }); + + // clone our custom properties + Object.keys(this).forEach(function(key) { + // ignore built-in fields + if (key === '_contents' || key === 'stat' || + key === 'history' || key === 'path' || + key === 'base' || key === 'cwd') { + return; + } + file[key] = opt.deep ? clone(this[key], true) : this[key]; + }, this); + return file; +}; + +File.prototype.pipe = function(stream, opt) { + if (!opt) opt = {}; + if (typeof opt.end === 'undefined') opt.end = true; + + if (this.isStream()) { + return this.contents.pipe(stream, opt); + } + if (this.isBuffer()) { + if (opt.end) { + stream.end(this.contents); + } else { + stream.write(this.contents); + } + return stream; + } + + // isNull + if (opt.end) stream.end(); + return stream; +}; + +File.prototype.inspect = function() { + var inspect = []; + + // use relative path if possible + var filePath = (this.base && this.path) ? this.relative : this.path; + + if (filePath) { + inspect.push('"'+filePath+'"'); + } + + if (this.isBuffer()) { + inspect.push(this.contents.inspect()); + } + + if (this.isStream()) { + inspect.push(inspectStream(this.contents)); + } + + return '<File '+inspect.join(' ')+'>'; +}; + +// virtual attributes +// or stuff with extra logic +Object.defineProperty(File.prototype, 'contents', { + get: function() { + return this._contents; + }, + set: function(val) { + if (!isBuffer(val) && !isStream(val) && !isNull(val)) { + throw new Error('File.contents can only be a Buffer, a Stream, or null.'); + } + this._contents = val; + } +}); + +// TODO: should this be moved to vinyl-fs? +Object.defineProperty(File.prototype, 'relative', { + get: function() { + if (!this.base) throw new Error('No base specified! Can not get relative.'); + if (!this.path) throw new Error('No path specified! Can not get relative.'); + return path.relative(this.base, this.path); + }, + set: function() { + throw new Error('File.relative is generated from the base and path attributes. Do not modify it.'); + } +}); + +Object.defineProperty(File.prototype, 'path', { + get: function() { + return this.history[this.history.length - 1]; + }, + set: function(path) { + if (typeof path !== 'string') throw new Error('path should be string'); + + // record history only when path changed + if (path && path !== this.path) { + this.history.push(path); + } + } +}); + +module.exports = File; diff --git a/node_modules/gulp/node_modules/vinyl/lib/cloneBuffer.js b/node_modules/gulp/node_modules/vinyl/lib/cloneBuffer.js new file mode 100644 index 000000000..89f09eda1 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/lib/cloneBuffer.js @@ -0,0 +1,7 @@ +var Buffer = require('buffer').Buffer; + +module.exports = function(buf) { + var out = new Buffer(buf.length); + buf.copy(out); + return out; +}; diff --git a/node_modules/gulp/node_modules/vinyl/lib/inspectStream.js b/node_modules/gulp/node_modules/vinyl/lib/inspectStream.js new file mode 100644 index 000000000..d36df6ff6 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/lib/inspectStream.js @@ -0,0 +1,11 @@ +var isStream = require('./isStream'); + +module.exports = function(stream) { + if (!isStream(stream)) return; + + var streamType = stream.constructor.name; + // avoid StreamStream + if (streamType === 'Stream') streamType = ''; + + return '<'+streamType+'Stream>'; +}; diff --git a/node_modules/gulp/node_modules/vinyl/lib/isBuffer.js b/node_modules/gulp/node_modules/vinyl/lib/isBuffer.js new file mode 100644 index 000000000..0e23782c4 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/lib/isBuffer.js @@ -0,0 +1,7 @@ +var buf = require('buffer'); +var Buffer = buf.Buffer; + +// could use Buffer.isBuffer but this is the same exact thing... +module.exports = function(o) { + return typeof o === 'object' && o instanceof Buffer; +};
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/vinyl/lib/isNull.js b/node_modules/gulp/node_modules/vinyl/lib/isNull.js new file mode 100644 index 000000000..7f22c63ae --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/lib/isNull.js @@ -0,0 +1,3 @@ +module.exports = function(v) { + return v === null; +}; diff --git a/node_modules/gulp/node_modules/vinyl/lib/isStream.js b/node_modules/gulp/node_modules/vinyl/lib/isStream.js new file mode 100644 index 000000000..9ce0929b0 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/lib/isStream.js @@ -0,0 +1,5 @@ +var Stream = require('stream').Stream; + +module.exports = function(o) { + return !!o && o instanceof Stream; +};
\ No newline at end of file diff --git a/node_modules/gulp/node_modules/vinyl/package.json b/node_modules/gulp/node_modules/vinyl/package.json new file mode 100644 index 000000000..478070de8 --- /dev/null +++ b/node_modules/gulp/node_modules/vinyl/package.json @@ -0,0 +1,108 @@ +{ + "_args": [ + [ + { + "raw": "vinyl@^0.4.0", + "scope": null, + "escapedName": "vinyl", + "name": "vinyl", + "rawSpec": "^0.4.0", + "spec": ">=0.4.0 <0.5.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs" + ] + ], + "_from": "vinyl@>=0.4.0 <0.5.0", + "_id": "vinyl@0.4.6", + "_inCache": true, + "_location": "/gulp/vinyl", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + "_npmVersion": "2.1.6", + "_phantomChildren": {}, + "_requested": { + "raw": "vinyl@^0.4.0", + "scope": null, + "escapedName": "vinyl", + "name": "vinyl", + "rawSpec": "^0.4.0", + "spec": ">=0.4.0 <0.5.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp/vinyl-fs" + ], + "_resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "_shasum": "2f356c87a550a255461f36bbeb2a5ba8bf784847", + "_shrinkwrap": null, + "_spec": "vinyl@^0.4.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp/node_modules/vinyl-fs", + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "bugs": { + "url": "https://github.com/wearefractal/vinyl/issues" + }, + "dependencies": { + "clone": "^0.2.0", + "clone-stats": "^0.0.1" + }, + "description": "A virtual file format", + "devDependencies": { + "buffer-equal": "0.0.1", + "coveralls": "^2.6.1", + "event-stream": "^3.1.0", + "istanbul": "^0.3.0", + "jshint": "^2.4.1", + "lodash.templatesettings": "^2.4.1", + "mocha": "^2.0.0", + "mocha-lcov-reporter": "^0.0.1", + "rimraf": "^2.2.5", + "should": "^4.0.4" + }, + "directories": {}, + "dist": { + "shasum": "2f356c87a550a255461f36bbeb2a5ba8bf784847", + "tarball": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz" + }, + "engines": { + "node": ">= 0.9" + }, + "files": [ + "index.js", + "lib" + ], + "gitHead": "8255a5f1de7fecb1cd5e7ba7ac1ec997395f6be1", + "homepage": "http://github.com/wearefractal/vinyl", + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/wearefractal/vinyl/raw/master/LICENSE" + } + ], + "main": "./index.js", + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + } + ], + "name": "vinyl", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/wearefractal/vinyl.git" + }, + "scripts": { + "coveralls": "istanbul cover _mocha -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", + "test": "mocha --reporter spec && jshint lib" + }, + "version": "0.4.6" +} diff --git a/node_modules/gulp/package.json b/node_modules/gulp/package.json new file mode 100644 index 000000000..d31b5bdcb --- /dev/null +++ b/node_modules/gulp/package.json @@ -0,0 +1,160 @@ +{ + "_args": [ + [ + { + "raw": "gulp@^3.9.1", + "scope": null, + "escapedName": "gulp", + "name": "gulp", + "rawSpec": "^3.9.1", + "spec": ">=3.9.1 <4.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex" + ] + ], + "_from": "gulp@>=3.9.1 <4.0.0", + "_id": "gulp@3.9.1", + "_inCache": true, + "_location": "/gulp", + "_nodeVersion": "0.10.41", + "_npmOperationalInternal": { + "host": "packages-6-west.internal.npmjs.com", + "tmp": "tmp/gulp-3.9.1.tgz_1454957415500_0.15343931876122952" + }, + "_npmUser": { + "name": "phated", + "email": "blaine@iceddev.com" + }, + "_npmVersion": "2.14.14", + "_phantomChildren": { + "clone-stats": "0.0.1", + "core-util-is": "1.0.2", + "defaults": "1.0.3", + "first-chunk-stream": "1.0.0", + "glob-stream": "3.1.18", + "glob-watcher": "0.0.6", + "inherits": "2.0.3", + "is-utf8": "0.2.1", + "isarray": "0.0.1", + "mkdirp": "0.5.1", + "natives": "1.1.0", + "string_decoder": "0.10.31", + "xtend": "4.0.1" + }, + "_requested": { + "raw": "gulp@^3.9.1", + "scope": null, + "escapedName": "gulp", + "name": "gulp", + "rawSpec": "^3.9.1", + "spec": ">=3.9.1 <4.0.0", + "type": "range" + }, + "_requiredBy": [ + "#DEV:/" + ], + "_resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", + "_shasum": "571ce45928dd40af6514fc4011866016c13845b4", + "_shrinkwrap": null, + "_spec": "gulp@^3.9.1", + "_where": "/home/dold/repos/taler/wallet-webex", + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "bin": { + "gulp": "./bin/gulp.js" + }, + "bugs": { + "url": "https://github.com/gulpjs/gulp/issues" + }, + "dependencies": { + "archy": "^1.0.0", + "chalk": "^1.0.0", + "deprecated": "^0.0.1", + "gulp-util": "^3.0.0", + "interpret": "^1.0.0", + "liftoff": "^2.1.0", + "minimist": "^1.1.0", + "orchestrator": "^0.3.0", + "pretty-hrtime": "^1.0.0", + "semver": "^4.1.0", + "tildify": "^1.0.0", + "v8flags": "^2.0.2", + "vinyl-fs": "^0.3.0" + }, + "description": "The streaming build system", + "devDependencies": { + "coveralls": "^2.7.0", + "eslint": "^1.7.3", + "eslint-config-gulp": "^2.0.0", + "graceful-fs": "^3.0.0", + "istanbul": "^0.3.0", + "jscs": "^2.3.5", + "jscs-preset-gulp": "^1.0.0", + "marked-man": "^0.1.3", + "mkdirp": "^0.5.0", + "mocha": "^2.0.1", + "mocha-lcov-reporter": "^0.0.1", + "q": "^1.0.0", + "rimraf": "^2.2.5", + "should": "^5.0.1" + }, + "directories": {}, + "dist": { + "shasum": "571ce45928dd40af6514fc4011866016c13845b4", + "tarball": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz" + }, + "engines": { + "node": ">= 0.9" + }, + "files": [ + "index.js", + "lib", + "bin", + "completion", + "gulp.1" + ], + "gitHead": "9c14e3a13a73a32e424f144d62566671b2fcdbed", + "homepage": "http://gulpjs.com", + "license": "MIT", + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "man": [ + "gulp.1" + ], + "name": "gulp", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/gulpjs/gulp.git" + }, + "scripts": { + "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", + "lint": "eslint . && jscs *.js bin/ lib/ test/", + "prepublish": "marked-man --name gulp docs/CLI.md > gulp.1", + "pretest": "npm run lint", + "test": "mocha --reporter spec" + }, + "tags": [ + "build", + "stream", + "system", + "make", + "tool", + "asset", + "pipeline" + ], + "version": "3.9.1" +} |