Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 909811825E for ; Fri, 13 Nov 2015 11:50:06 +0000 (UTC) Received: (qmail 66757 invoked by uid 500); 13 Nov 2015 11:50:06 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 66688 invoked by uid 500); 13 Nov 2015 11:50:06 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 66308 invoked by uid 99); 13 Nov 2015 11:50:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 11:50:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 00449E0A33; Fri, 13 Nov 2015 11:50:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: daserge@apache.org To: commits@cordova.apache.org Date: Fri, 13 Nov 2015 11:50:17 -0000 Message-Id: In-Reply-To: <52e8bbcfe178405d86a9273d98f04d6b@git.apache.org> References: <52e8bbcfe178405d86a9273d98f04d6b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [13/13] cordova-firefoxos git commit: CB-9836 Add .gitattributes to prevent CRLF line endings in repos CB-9836 Add .gitattributes to prevent CRLF line endings in repos Changes deps eols to LF github: close #25 Project: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/commit/325bb661 Tree: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/tree/325bb661 Diff: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/diff/325bb661 Branch: refs/heads/master Commit: 325bb661eebba83e0c8d19e86a155ffd5a043a0a Parents: 3a1effe Author: daserge Authored: Thu Nov 5 02:51:29 2015 -0800 Committer: daserge Committed: Fri Nov 13 03:48:57 2015 -0800 ---------------------------------------------------------------------- .gitattributes | 96 + node_modules/archiver/LICENSE-MIT | 42 +- node_modules/archiver/README.md | 428 +- node_modules/archiver/lib/archiver.js | 100 +- node_modules/archiver/lib/core.js | 974 +-- node_modules/archiver/lib/plugins/json.js | 138 +- node_modules/archiver/lib/plugins/tar.js | 190 +- node_modules/archiver/lib/plugins/zip.js | 92 +- node_modules/archiver/lib/util/file.js | 410 +- node_modules/archiver/lib/util/index.js | 296 +- .../node_modules/zip-stream/LICENSE-MIT | 42 +- .../archiver/node_modules/zip-stream/README.md | 208 +- .../node_modules/zip-stream/lib/util/index.js | 204 +- .../node_modules/zip-stream/lib/zip-stream.js | 218 +- .../node_modules/compress-commons/LICENSE-MIT | 42 +- .../node_modules/compress-commons/README.md | 48 +- .../lib/archivers/archive-entry.js | 30 +- .../lib/archivers/archive-output-stream.js | 234 +- .../lib/archivers/zip/constants.js | 140 +- .../lib/archivers/zip/general-purpose-bit.js | 200 +- .../compress-commons/lib/archivers/zip/util.js | 166 +- .../lib/archivers/zip/zip-archive-entry.js | 444 +- .../archivers/zip/zip-archive-output-stream.js | 852 +- .../compress-commons/lib/compress-commons.js | 24 +- .../compress-commons/lib/util/index.js | 58 +- .../node_modules/crc32-stream/CHANGELOG | 34 +- .../node_modules/crc32-stream/LICENSE-MIT | 42 +- .../node_modules/crc32-stream/README.md | 160 +- .../crc32-stream/lib/crc32-stream.js | 82 +- .../crc32-stream/lib/deflate-crc32-stream.js | 132 +- .../node_modules/crc32-stream/lib/index.js | 18 +- .../node_modules/JSONSelect/site/js/json2.js | 960 +-- .../node_modules/JSONSelect/site/js/showdown.js | 2602 +++--- .../JSONSelect/src/build/lib/jshint.js | 7708 +++++++++--------- .../node_modules/JSONSelect/site/js/json2.js | 960 +-- .../node_modules/JSONSelect/site/js/showdown.js | 2602 +++--- .../JSONSelect/src/build/lib/jshint.js | 7708 +++++++++--------- .../node_modules/archiver/LICENSE-MIT | 42 +- .../zip-folder/node_modules/archiver/README.md | 330 +- .../node_modules/archiver/lib/archiver.js | 82 +- .../archiver/lib/modules/core/index.js | 636 +- .../archiver/lib/modules/json/index.js | 140 +- .../archiver/lib/modules/tar/index.js | 166 +- .../archiver/lib/modules/zip/index.js | 76 +- .../node_modules/archiver/lib/util/file.js | 410 +- .../node_modules/archiver/lib/util/index.js | 204 +- .../node_modules/zip-stream/LICENSE-MIT | 42 +- .../archiver/node_modules/zip-stream/README.md | 208 +- .../node_modules/zip-stream/lib/util/index.js | 204 +- .../node_modules/zip-stream/lib/zip-stream.js | 218 +- .../node_modules/compress-commons/LICENSE-MIT | 42 +- .../node_modules/compress-commons/README.md | 50 +- .../lib/archivers/archive-entry.js | 30 +- .../lib/archivers/archive-output-stream.js | 224 +- .../lib/archivers/zip/constants.js | 132 +- .../lib/archivers/zip/general-purpose-bit.js | 200 +- .../compress-commons/lib/archivers/zip/util.js | 140 +- .../lib/archivers/zip/zip-archive-entry.js | 444 +- .../archivers/zip/zip-archive-output-stream.js | 672 +- .../compress-commons/lib/compress-commons.js | 24 +- .../compress-commons/lib/util/index.js | 58 +- .../node_modules/crc32-stream/CHANGELOG | 34 +- .../node_modules/crc32-stream/LICENSE-MIT | 42 +- .../node_modules/crc32-stream/README.md | 160 +- .../crc32-stream/lib/crc32-stream.js | 82 +- .../crc32-stream/lib/deflate-crc32-stream.js | 132 +- .../node_modules/crc32-stream/lib/index.js | 18 +- .../node_modules/JSONSelect/site/js/json2.js | 960 +-- .../node_modules/JSONSelect/site/js/showdown.js | 2602 +++--- .../JSONSelect/src/build/lib/jshint.js | 7708 +++++++++--------- 70 files changed, 22646 insertions(+), 22550 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/.gitattributes ---------------------------------------------------------------------- diff --git a/.gitattributes b/.gitattributes new file mode 100755 index 0000000..e6209c0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,96 @@ +* text eol=lf + +# source code +*.php text +*.css text +*.sass text +*.scss text +*.less text +*.styl text +*.js text +*.coffee text +*.json text +*.htm text +*.html text +*.xml text +*.svg text +*.txt text +*.ini text +*.inc text +*.pl text +*.rb text +*.py text +*.scm text +*.sql text +*.sh text +*.bat text + +# templates +*.ejs text +*.hbt text +*.jade text +*.haml text +*.hbs text +*.dot text +*.tmpl text +*.phtml text + +# server config +.htaccess text + +# git config +.gitattributes text +.gitignore text +.gitconfig text + +# code analysis config +.jshintrc text +.jscsrc text +.jshintignore text +.csslintrc text + +# misc config +*.yaml text +*.yml text +.editorconfig text + +# build config +*.npmignore text +*.bowerrc text + +# Heroku +Procfile text +.slugignore text + +# Documentation +*.md text +LICENSE text +AUTHORS text + + +# +## These files are binary and should be left untouched +# + +# (binary is a macro for -text -diff) +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.mov binary +*.mp4 binary +*.mp3 binary +*.flv binary +*.fla binary +*.swf binary +*.gz binary +*.zip binary +*.7z binary +*.ttf binary +*.eot binary +*.woff binary +*.pyc binary +*.pdf binary +*.tt binary +*.tgz binary http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/LICENSE-MIT ---------------------------------------------------------------------- diff --git a/node_modules/archiver/LICENSE-MIT b/node_modules/archiver/LICENSE-MIT index bc56a8a..88caf87 100644 --- a/node_modules/archiver/LICENSE-MIT +++ b/node_modules/archiver/LICENSE-MIT @@ -1,22 +1,22 @@ -Copyright (c) 2012-2014 Chris Talkington, 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 +Copyright (c) 2012-2014 Chris Talkington, 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. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/README.md ---------------------------------------------------------------------- diff --git a/node_modules/archiver/README.md b/node_modules/archiver/README.md index 94e6a1f..5d969b9 100644 --- a/node_modules/archiver/README.md +++ b/node_modules/archiver/README.md @@ -1,215 +1,215 @@ -# Archiver v0.14.3 [![Build Status](https://travis-ci.org/archiverjs/node-archiver.svg?branch=master)](https://travis-ci.org/archiverjs/node-archiver) - -a streaming interface for archive generation - -[![NPM](https://nodei.co/npm/archiver.png)](https://nodei.co/npm/archiver/) - -## Install - -```bash -npm install archiver --save -``` - -You can also use `npm install https://github.com/archiverjs/node-archiver/archive/master.tar.gz` to test upcoming versions. - -## Archiver - -#### create(format, options) - -Creates an Archiver instance based on the format (zip, tar, etc) passed. Parameters can be passed directly to `Archiver` constructor for convenience. - -#### registerFormat(format, module) - -Registers an archive format. Format modules are essentially transform streams with a few required methods. They will be further documented once a formal spec is in place. - -### Instance Methods - -Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) methods. - -#### abort() - -Aborts the archiving process, taking a best-effort approach, by: - -* removing any pending queue tasks -* allowing any active queue workers to finish -* detaching internal module pipes -* ending both sides of the Transform stream - -*It will NOT drain any remaining sources.* - -#### append(input, data) - -Appends an input source (text string, buffer, or stream) to the instance. When the instance has received, processed, and emitted the input, the `entry` event is fired. - -Replaced `#addFile` in v0.5. - -```js -archive.append('string', { name:'string.txt' }); -archive.append(new Buffer('string'), { name:'buffer.txt' }); -archive.append(fs.createReadStream('mydir/file.txt'), { name:'stream.txt' }); -archive.append(null, { name:'dir/' }); -``` - -#### bulk(mappings) - -Appends multiple entries from passed array of src-dest mappings. A [lazystream](https://github.com/jpommerening/node-lazystream) wrapper is used to prevent issues with open file limits. - -Globbing patterns are supported through use of the bundled [file-utils](https://github.com/SBoudrias/file-utils) module. - -The `data` property can be set (per src-dest mapping) to define data for matched entries. - -```js -archive.bulk([ - { src: ['mydir/**'], data: { date: new Date() } }, - { expand: true, cwd: 'mydir', src: ['**'], dest: 'newdir' } -]); -``` - -For more detail on this feature, please see [BULK.md](https://github.com/archiverjs/node-archiver/blob/master/BULK.md). - -#### directory(dirpath[, destpath, data]) - -Appends a directory and its files, recusively, given its dirpath. This is meant to be a simplier approach to something previously only possible with `bulk`. The use of `destpath` allows one to define a custom destination path within the resulting archive and `data` allows for setting data on each entry appended. - -```js -// mydir/ -> archive.ext/mydir/ -archive.directory('mydir'); - -// mydir/ -> archive.ext/abc/ -archive.directory('mydir', 'abc'); - -// mydir/ -> archive.ext/ -archive.directory('mydir', false, { date: new Date() }); -``` - -#### file(filepath, data) - -Appends a file given its filepath using a [lazystream](https://github.com/jpommerening/node-lazystream) wrapper to prevent issues with open file limits. When the instance has received, processed, and emitted the file, the `entry` event is fired. - -```js -archive.file('mydir/file.txt', { name:'file.txt' }); -``` - -#### finalize() - -Finalizes the instance and prevents further appending to the archive structure (queue will continue til drained). The `end`, `close` or `finish` events on the destination stream may fire right after calling this method so you should set listeners beforehand to properly detect stream completion. - -*You must call this method to get a valid archive and end the instance stream.* - -#### pointer() - -Returns the current byte length emitted by archiver. Use this in your end callback to log generated size. - -## Events - -Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) events. - -#### entry - -Fired when the entry's input has been processed and appended to the archive. Passes entry data as first argument. - -## Zip - -### Options - -#### comment `string` - -Sets the zip comment. - -#### statConcurrency `number` - -Sets the number of workers used to process the internal fs stat queue. Defaults to 4. - -#### store `boolean` - -If true, all entries will be archived without compression. Defaults to `false`. - -#### zlib `object` - -Passed to node's [zlib](http://nodejs.org/api/zlib.html#zlib_options) module to control compression. Options may vary by node version. - -### Entry Data - -#### name `string` `required` - -Sets the entry name including internal path. - -#### date `string|Date` - -Sets the entry date. This can be any valid date string or instance. Defaults to current time in locale. - -When using the `bulk` or `file` methods, fs stat data is used as the default value. - -#### store `boolean` - -If true, this entry will be archived without compression. Defaults to global `store` option. - -#### comment `string` - -Sets the entry comment. - -#### mode `number` - -Sets the entry permissions. Defaults to octal 0755 (directory) or 0644 (file). - -When using the `bulk` or `file` methods, fs stat data is used as the default value. - -#### stats `fs.Stats` - -Sets the fs stat data for this entry. This allows for reduction of fs stat calls when stat data is already known. - -## Tar - -### Options - -#### gzip `boolean` - -Compresses the tar archive using gzip, default is false. - -#### gzipOptions `object` - -Passed to node's [zlib](http://nodejs.org/api/zlib.html#zlib_options) module to control compression. Options may vary by node version. - -#### statConcurrency `number` - -Sets the number of workers used to process the internal fs stat queue. Defaults to 4. - -### Entry Data - -#### name `string` `required` - -Sets the entry name including internal path. - -#### date `string|Date` - -Sets the entry date. This can be any valid date string or instance. Defaults to current time in locale. - -When using the `bulk` or `file` methods, fs stat data is used as the default value. - -#### mode `number` - -Sets the entry permissions. Defaults to octal 0755 (directory) or 0644 (file). - -When using the `bulk` or `file` methods, fs stat data is used as the default value. - -#### stats `fs.Stats` - -Sets the fs stat data for this entry. This allows for reduction of fs stat calls when stat data is already known. - -## Custom Formats - -Archiver ships with out of the box support for TAR and ZIP archives. You can register additional formats with `registerFormat`. - -## Libraries - -Archiver makes use of several libraries/modules to avoid duplication of efforts. - -- [zip-stream](https://npmjs.org/package/zip-stream) -- [tar-stream](https://npmjs.org/package/tar-stream) - -## Things of Interest - -- [Examples](https://github.com/archiverjs/node-archiver/blob/master/examples) -- [Changelog](https://github.com/archiverjs/node-archiver/releases) -- [Contributing](https://github.com/archiverjs/node-archiver/blob/master/CONTRIBUTING.md) +# Archiver v0.14.3 [![Build Status](https://travis-ci.org/archiverjs/node-archiver.svg?branch=master)](https://travis-ci.org/archiverjs/node-archiver) + +a streaming interface for archive generation + +[![NPM](https://nodei.co/npm/archiver.png)](https://nodei.co/npm/archiver/) + +## Install + +```bash +npm install archiver --save +``` + +You can also use `npm install https://github.com/archiverjs/node-archiver/archive/master.tar.gz` to test upcoming versions. + +## Archiver + +#### create(format, options) + +Creates an Archiver instance based on the format (zip, tar, etc) passed. Parameters can be passed directly to `Archiver` constructor for convenience. + +#### registerFormat(format, module) + +Registers an archive format. Format modules are essentially transform streams with a few required methods. They will be further documented once a formal spec is in place. + +### Instance Methods + +Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) methods. + +#### abort() + +Aborts the archiving process, taking a best-effort approach, by: + +* removing any pending queue tasks +* allowing any active queue workers to finish +* detaching internal module pipes +* ending both sides of the Transform stream + +*It will NOT drain any remaining sources.* + +#### append(input, data) + +Appends an input source (text string, buffer, or stream) to the instance. When the instance has received, processed, and emitted the input, the `entry` event is fired. + +Replaced `#addFile` in v0.5. + +```js +archive.append('string', { name:'string.txt' }); +archive.append(new Buffer('string'), { name:'buffer.txt' }); +archive.append(fs.createReadStream('mydir/file.txt'), { name:'stream.txt' }); +archive.append(null, { name:'dir/' }); +``` + +#### bulk(mappings) + +Appends multiple entries from passed array of src-dest mappings. A [lazystream](https://github.com/jpommerening/node-lazystream) wrapper is used to prevent issues with open file limits. + +Globbing patterns are supported through use of the bundled [file-utils](https://github.com/SBoudrias/file-utils) module. + +The `data` property can be set (per src-dest mapping) to define data for matched entries. + +```js +archive.bulk([ + { src: ['mydir/**'], data: { date: new Date() } }, + { expand: true, cwd: 'mydir', src: ['**'], dest: 'newdir' } +]); +``` + +For more detail on this feature, please see [BULK.md](https://github.com/archiverjs/node-archiver/blob/master/BULK.md). + +#### directory(dirpath[, destpath, data]) + +Appends a directory and its files, recusively, given its dirpath. This is meant to be a simplier approach to something previously only possible with `bulk`. The use of `destpath` allows one to define a custom destination path within the resulting archive and `data` allows for setting data on each entry appended. + +```js +// mydir/ -> archive.ext/mydir/ +archive.directory('mydir'); + +// mydir/ -> archive.ext/abc/ +archive.directory('mydir', 'abc'); + +// mydir/ -> archive.ext/ +archive.directory('mydir', false, { date: new Date() }); +``` + +#### file(filepath, data) + +Appends a file given its filepath using a [lazystream](https://github.com/jpommerening/node-lazystream) wrapper to prevent issues with open file limits. When the instance has received, processed, and emitted the file, the `entry` event is fired. + +```js +archive.file('mydir/file.txt', { name:'file.txt' }); +``` + +#### finalize() + +Finalizes the instance and prevents further appending to the archive structure (queue will continue til drained). The `end`, `close` or `finish` events on the destination stream may fire right after calling this method so you should set listeners beforehand to properly detect stream completion. + +*You must call this method to get a valid archive and end the instance stream.* + +#### pointer() + +Returns the current byte length emitted by archiver. Use this in your end callback to log generated size. + +## Events + +Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) events. + +#### entry + +Fired when the entry's input has been processed and appended to the archive. Passes entry data as first argument. + +## Zip + +### Options + +#### comment `string` + +Sets the zip comment. + +#### statConcurrency `number` + +Sets the number of workers used to process the internal fs stat queue. Defaults to 4. + +#### store `boolean` + +If true, all entries will be archived without compression. Defaults to `false`. + +#### zlib `object` + +Passed to node's [zlib](http://nodejs.org/api/zlib.html#zlib_options) module to control compression. Options may vary by node version. + +### Entry Data + +#### name `string` `required` + +Sets the entry name including internal path. + +#### date `string|Date` + +Sets the entry date. This can be any valid date string or instance. Defaults to current time in locale. + +When using the `bulk` or `file` methods, fs stat data is used as the default value. + +#### store `boolean` + +If true, this entry will be archived without compression. Defaults to global `store` option. + +#### comment `string` + +Sets the entry comment. + +#### mode `number` + +Sets the entry permissions. Defaults to octal 0755 (directory) or 0644 (file). + +When using the `bulk` or `file` methods, fs stat data is used as the default value. + +#### stats `fs.Stats` + +Sets the fs stat data for this entry. This allows for reduction of fs stat calls when stat data is already known. + +## Tar + +### Options + +#### gzip `boolean` + +Compresses the tar archive using gzip, default is false. + +#### gzipOptions `object` + +Passed to node's [zlib](http://nodejs.org/api/zlib.html#zlib_options) module to control compression. Options may vary by node version. + +#### statConcurrency `number` + +Sets the number of workers used to process the internal fs stat queue. Defaults to 4. + +### Entry Data + +#### name `string` `required` + +Sets the entry name including internal path. + +#### date `string|Date` + +Sets the entry date. This can be any valid date string or instance. Defaults to current time in locale. + +When using the `bulk` or `file` methods, fs stat data is used as the default value. + +#### mode `number` + +Sets the entry permissions. Defaults to octal 0755 (directory) or 0644 (file). + +When using the `bulk` or `file` methods, fs stat data is used as the default value. + +#### stats `fs.Stats` + +Sets the fs stat data for this entry. This allows for reduction of fs stat calls when stat data is already known. + +## Custom Formats + +Archiver ships with out of the box support for TAR and ZIP archives. You can register additional formats with `registerFormat`. + +## Libraries + +Archiver makes use of several libraries/modules to avoid duplication of efforts. + +- [zip-stream](https://npmjs.org/package/zip-stream) +- [tar-stream](https://npmjs.org/package/tar-stream) + +## Things of Interest + +- [Examples](https://github.com/archiverjs/node-archiver/blob/master/examples) +- [Changelog](https://github.com/archiverjs/node-archiver/releases) +- [Contributing](https://github.com/archiverjs/node-archiver/blob/master/CONTRIBUTING.md) - [MIT License](https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/archiver.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/archiver.js b/node_modules/archiver/lib/archiver.js index 73a80e8..d07f636 100644 --- a/node_modules/archiver/lib/archiver.js +++ b/node_modules/archiver/lib/archiver.js @@ -1,51 +1,51 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var ArchiverCore = require('./core'); -var formats = {}; - -var archiver = module.exports = function(format, options) { - return archiver.create(format, options); -}; - -archiver.create = function(format, options) { - if (formats[format]) { - var instance = new ArchiverCore(options); - instance.setFormat(format); - instance.setModule(new formats[format](options)); - - return instance; - } else { - throw new Error('create(' + format + '): format not registered'); - } -}; - -archiver.registerFormat = function(format, module) { - if (formats[format]) { - throw new Error('register(' + format + '): format already registered'); - } - - if (typeof module !== 'function') { - throw new Error('register(' + format + '): format module invalid'); - } - - if (typeof module.prototype.append !== 'function' || typeof module.prototype.finalize !== 'function') { - throw new Error('register(' + format + '): format module missing methods'); - } - - formats[format] = module; - - // backwards compat - to be removed in 0.14 - var compatName = 'create' + format.charAt(0).toUpperCase() + format.slice(1); - archiver[compatName] = function(options) { - return archiver.create(format, options); - }; -}; - -archiver.registerFormat('zip', require('./plugins/zip')); -archiver.registerFormat('tar', require('./plugins/tar')); +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var ArchiverCore = require('./core'); +var formats = {}; + +var archiver = module.exports = function(format, options) { + return archiver.create(format, options); +}; + +archiver.create = function(format, options) { + if (formats[format]) { + var instance = new ArchiverCore(options); + instance.setFormat(format); + instance.setModule(new formats[format](options)); + + return instance; + } else { + throw new Error('create(' + format + '): format not registered'); + } +}; + +archiver.registerFormat = function(format, module) { + if (formats[format]) { + throw new Error('register(' + format + '): format already registered'); + } + + if (typeof module !== 'function') { + throw new Error('register(' + format + '): format module invalid'); + } + + if (typeof module.prototype.append !== 'function' || typeof module.prototype.finalize !== 'function') { + throw new Error('register(' + format + '): format module missing methods'); + } + + formats[format] = module; + + // backwards compat - to be removed in 0.14 + var compatName = 'create' + format.charAt(0).toUpperCase() + format.slice(1); + archiver[compatName] = function(options) { + return archiver.create(format, options); + }; +}; + +archiver.registerFormat('zip', require('./plugins/zip')); +archiver.registerFormat('tar', require('./plugins/tar')); archiver.registerFormat('json', require('./plugins/json')); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/core.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/core.js b/node_modules/archiver/lib/core.js index d5103f3..eba4534 100644 --- a/node_modules/archiver/lib/core.js +++ b/node_modules/archiver/lib/core.js @@ -1,488 +1,488 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var fs = require('fs'); -var inherits = require('util').inherits; -var Transform = require('readable-stream').Transform; - -var async = require('async'); - -var util = require('./util'); - -var Archiver = module.exports = function(options) { - if (!(this instanceof Archiver)) { - return new Archiver(options); - } - - options = this.options = util.defaults(options, { - highWaterMark: 1024 * 1024, - statConcurrency: 4 - }); - - Transform.call(this, options); - - this._entries = []; - this._format = false; - this._module = false; - this._pending = 0; - this._pointer = 0; - - this._queue = async.queue(this._onQueueTask.bind(this), 1); - this._queue.drain = this._onQueueDrain.bind(this); - - this._statQueue = async.queue(this._onStatQueueTask.bind(this), options.statConcurrency); - - this._state = { - aborted: false, - finalize: false, - finalizing: false, - finalized: false, - modulePiped: false - }; -}; - -inherits(Archiver, Transform); - -Archiver.prototype._abort = function() { - this._state.aborted = true; - this._queue.kill(); - this._statQueue.kill(); - - if (this._queue.idle()) { - this._shutdown(); - } -}; - -Archiver.prototype._append = function(filepath, data) { - data = data || {}; - - var task = { - source: null, - filepath: filepath - }; - - if (!data.name) { - data.name = filepath; - } - - data.sourcePath = filepath; - task.data = data; - - if (data.stats && data.stats instanceof fs.Stats) { - task = this._updateQueueTaskWithStats(task, data.stats); - this._queue.push(task); - } else { - this._statQueue.push(task); - } -}; - -Archiver.prototype._finalize = function() { - if (this._state.finalizing || this._state.finalized || this._state.aborted) { - return; - } - - this._state.finalizing = true; - - this._moduleFinalize(); - - this._state.finalizing = false; - this._state.finalized = true; -}; - -Archiver.prototype._maybeFinalize = function() { - if (this._state.finalizing || this._state.finalized || this._state.aborted) { - return false; - } - - if (this._state.finalize && this._pending === 0 && this._queue.idle() && this._statQueue.idle()) { - this._finalize(); - return true; - } - - return false; -}; - -Archiver.prototype._moduleAppend = function(source, data, callback) { - if (this._state.aborted) { - callback(); - return; - } - - this._module.append(source, data, function(err) { - this._task = null; - - if (this._state.aborted) { - this._shutdown(); - return; - } - - if (err) { - this.emit('error', err); - setImmediate(callback); - return; - } - - this.emit('entry', data); - this._entries.push(data); - - setImmediate(callback); - }.bind(this)); -}; - -Archiver.prototype._moduleFinalize = function() { - if (typeof this._module.finalize === 'function') { - this._module.finalize(); - } else if (typeof this._module.end === 'function') { - this._module.end(); - } else { - this.emit('error', new Error('module: no suitable finalize/end method found')); - return; - } -}; - -Archiver.prototype._modulePipe = function() { - this._module.on('error', this._onModuleError.bind(this)); - this._module.pipe(this); - this._state.modulePiped = true; -}; - -Archiver.prototype._moduleSupports = function(key) { - if (!this._module.supports || !this._module.supports[key]) { - return false; - } - - return this._module.supports[key]; -}; - -Archiver.prototype._moduleUnpipe = function() { - this._module.unpipe(this); - this._state.modulePiped = false; -}; - -Archiver.prototype._normalizeEntryData = function(data, stats) { - data = util.defaults(data, { - type: 'file', - name: null, - date: null, - mode: null, - sourcePath: null, - stats: false - }); - - if (stats && data.stats === false) { - data.stats = stats; - } - - var isDir = data.type === 'directory'; - - if (data.name) { - data.name = util.sanitizePath(data.name); - - if (data.name.slice(-1) === '/') { - isDir = true; - data.type = 'directory'; - } else if (isDir) { - data.name += '/'; - } - } - - if (typeof data.mode === 'number') { - data.mode &= 0777; - } else if (data.stats && data.mode === null) { - data.mode = data.stats.mode & 0777; - } else if (data.mode === null) { - data.mode = isDir ? 0755 : 0644; - } - - if (data.stats && data.date === null) { - data.date = data.stats.mtime; - } else { - data.date = util.dateify(data.date); - } - - return data; -}; - -Archiver.prototype._onModuleError = function(err) { - this.emit('error', err); -}; - -Archiver.prototype._onQueueDrain = function() { - if (this._state.finalizing || this._state.finalized || this._state.aborted) { - return; - } - - if (this._state.finalize && this._pending === 0 && this._queue.idle() && this._statQueue.idle()) { - this._finalize(); - return; - } -}; - -Archiver.prototype._onQueueTask = function(task, callback) { - if (this._state.finalizing || this._state.finalized || this._state.aborted) { - callback(); - return; - } - - this._task = task; - this._moduleAppend(task.source, task.data, callback); -}; - -Archiver.prototype._onStatQueueTask = function(task, callback) { - if (this._state.finalizing || this._state.finalized || this._state.aborted) { - callback(); - return; - } - - fs.stat(task.filepath, function(err, stats) { - if (this._state.aborted) { - setImmediate(callback); - return; - } - - if (err) { - this.emit('error', err); - setImmediate(callback); - return; - } - - task = this._updateQueueTaskWithStats(task, stats); - - if (task.source !== null) { - this._queue.push(task); - setImmediate(callback); - } else { - this.emit('error', new Error('unsupported entry: ' + task.filepath)); - setImmediate(callback); - return; - } - }.bind(this)); -}; - -Archiver.prototype._shutdown = function() { - this._moduleUnpipe(); - this.end(); -}; - -Archiver.prototype._transform = function(chunk, encoding, callback) { - if (chunk) { - this._pointer += chunk.length; - } - - callback(null, chunk); -}; - -Archiver.prototype._updateQueueTaskWithStats = function(task, stats) { - if (stats.isFile()) { - task.data.type = 'file'; - task.data.sourceType = 'stream'; - task.source = util.lazyReadStream(task.filepath); - } else if (stats.isDirectory() && this._moduleSupports('directory')) { - task.data.name = util.trailingSlashIt(task.data.name); - task.data.type = 'directory'; - task.data.sourcePath = util.trailingSlashIt(task.filepath); - task.data.sourceType = 'buffer'; - task.source = new Buffer(0); - } else { - return task; - } - - task.data = this._normalizeEntryData(task.data, stats); - return task; -}; - -Archiver.prototype.abort = function() { - if (this._state.aborted || this._state.finalized) { - return this; - } - - this._abort(); - - return this; -}; - -Archiver.prototype.append = function(source, data) { - if (this._state.finalize || this._state.aborted) { - this.emit('error', new Error('append: queue closed')); - return this; - } - - data = this._normalizeEntryData(data); - - if (typeof data.name !== 'string' || data.name.length === 0) { - this.emit('error', new Error('append: entry name must be a non-empty string value')); - return this; - } - - if (data.type === 'directory' && !this._moduleSupports('directory')) { - this.emit('error', new Error('append: entries of "directory" type not currently supported by this module')); - return this; - } - - source = util.normalizeInputSource(source); - - if (Buffer.isBuffer(source)) { - data.sourceType = 'buffer'; - } else if (util.isStream(source)) { - data.sourceType = 'stream'; - } else { - this.emit('error', new Error('append: input source must be valid Stream or Buffer instance')); - return this; - } - - this._queue.push({ - data: data, - source: source - }); - - return this; -}; - -Archiver.prototype.bulk = function(mappings) { - if (this._state.finalize || this._state.aborted) { - this.emit('error', new Error('bulk: queue closed')); - return this; - } - - if (!Array.isArray(mappings)) { - mappings = [mappings]; - } - - var self = this; - var files = util.file.normalizeFilesArray(mappings); - - files.forEach(function(file){ - var isExpandedPair = file.orig.expand || false; - var fileData = file.data || {}; - - file.src.forEach(function(filepath) { - var data = util._.extend({}, fileData); - data.name = isExpandedPair ? util.unixifyPath(file.dest) : util.unixifyPath(file.dest || '', filepath); - - if (data.name === '.') { - return; - } - - self._append(filepath, data); - }); - }); - - return this; -}; - -Archiver.prototype.directory = function(dirpath, destpath, data) { - if (this._state.finalize || this._state.aborted) { - this.emit('error', new Error('directory: queue closed')); - return this; - } - - if (typeof dirpath !== 'string' || dirpath.length === 0) { - this.emit('error', new Error('directory: dirpath must be a non-empty string value')); - return this; - } - - this._pending++; - - if (destpath === false) { - destpath = ''; - } else if (typeof destpath !== 'string'){ - destpath = dirpath; - } - - if (typeof data !== 'object') { - data = {}; - } - - var self = this; - - util.walkdir(dirpath, function(err, results) { - if (err) { - self.emit('error', err); - } else { - results.forEach(function(file) { - var entryData = util._.extend({}, data); - entryData.name = util.sanitizePath(destpath, file.relative); - entryData.stats = file.stats; - - self._append(file.path, entryData); - }); - } - - self._pending--; - self._maybeFinalize(); - }); - - return this; -}; - -Archiver.prototype.file = function(filepath, data) { - if (this._state.finalize || this._state.aborted) { - this.emit('error', new Error('file: queue closed')); - return this; - } - - if (typeof filepath !== 'string' || filepath.length === 0) { - this.emit('error', new Error('file: filepath must be a non-empty string value')); - return this; - } - - this._append(filepath, data); - - return this; -}; - -Archiver.prototype.finalize = function() { - if (this._state.aborted) { - this.emit('error', new Error('finalize: archive was aborted')); - return this; - } - - if (this._state.finalize) { - this.emit('error', new Error('finalize: archive already finalizing')); - return this; - } - - this._state.finalize = true; - - if (this._pending === 0 && this._queue.idle() && this._statQueue.idle()) { - this._finalize(); - } - - return this; -}; - -Archiver.prototype.setFormat = function(format) { - if (this._format) { - this.emit('error', new Error('format: archive format already set')); - return this; - } - - this._format = format; - - return this; -}; - -Archiver.prototype.setModule = function(module) { - if (this._state.aborted) { - this.emit('error', new Error('module: archive was aborted')); - return this; - } - - if (this._state.module) { - this.emit('error', new Error('module: module already set')); - return this; - } - - this._module = module; - this._modulePipe(); - - return this; -}; - -Archiver.prototype.pointer = function() { - return this._pointer; +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var fs = require('fs'); +var inherits = require('util').inherits; +var Transform = require('readable-stream').Transform; + +var async = require('async'); + +var util = require('./util'); + +var Archiver = module.exports = function(options) { + if (!(this instanceof Archiver)) { + return new Archiver(options); + } + + options = this.options = util.defaults(options, { + highWaterMark: 1024 * 1024, + statConcurrency: 4 + }); + + Transform.call(this, options); + + this._entries = []; + this._format = false; + this._module = false; + this._pending = 0; + this._pointer = 0; + + this._queue = async.queue(this._onQueueTask.bind(this), 1); + this._queue.drain = this._onQueueDrain.bind(this); + + this._statQueue = async.queue(this._onStatQueueTask.bind(this), options.statConcurrency); + + this._state = { + aborted: false, + finalize: false, + finalizing: false, + finalized: false, + modulePiped: false + }; +}; + +inherits(Archiver, Transform); + +Archiver.prototype._abort = function() { + this._state.aborted = true; + this._queue.kill(); + this._statQueue.kill(); + + if (this._queue.idle()) { + this._shutdown(); + } +}; + +Archiver.prototype._append = function(filepath, data) { + data = data || {}; + + var task = { + source: null, + filepath: filepath + }; + + if (!data.name) { + data.name = filepath; + } + + data.sourcePath = filepath; + task.data = data; + + if (data.stats && data.stats instanceof fs.Stats) { + task = this._updateQueueTaskWithStats(task, data.stats); + this._queue.push(task); + } else { + this._statQueue.push(task); + } +}; + +Archiver.prototype._finalize = function() { + if (this._state.finalizing || this._state.finalized || this._state.aborted) { + return; + } + + this._state.finalizing = true; + + this._moduleFinalize(); + + this._state.finalizing = false; + this._state.finalized = true; +}; + +Archiver.prototype._maybeFinalize = function() { + if (this._state.finalizing || this._state.finalized || this._state.aborted) { + return false; + } + + if (this._state.finalize && this._pending === 0 && this._queue.idle() && this._statQueue.idle()) { + this._finalize(); + return true; + } + + return false; +}; + +Archiver.prototype._moduleAppend = function(source, data, callback) { + if (this._state.aborted) { + callback(); + return; + } + + this._module.append(source, data, function(err) { + this._task = null; + + if (this._state.aborted) { + this._shutdown(); + return; + } + + if (err) { + this.emit('error', err); + setImmediate(callback); + return; + } + + this.emit('entry', data); + this._entries.push(data); + + setImmediate(callback); + }.bind(this)); +}; + +Archiver.prototype._moduleFinalize = function() { + if (typeof this._module.finalize === 'function') { + this._module.finalize(); + } else if (typeof this._module.end === 'function') { + this._module.end(); + } else { + this.emit('error', new Error('module: no suitable finalize/end method found')); + return; + } +}; + +Archiver.prototype._modulePipe = function() { + this._module.on('error', this._onModuleError.bind(this)); + this._module.pipe(this); + this._state.modulePiped = true; +}; + +Archiver.prototype._moduleSupports = function(key) { + if (!this._module.supports || !this._module.supports[key]) { + return false; + } + + return this._module.supports[key]; +}; + +Archiver.prototype._moduleUnpipe = function() { + this._module.unpipe(this); + this._state.modulePiped = false; +}; + +Archiver.prototype._normalizeEntryData = function(data, stats) { + data = util.defaults(data, { + type: 'file', + name: null, + date: null, + mode: null, + sourcePath: null, + stats: false + }); + + if (stats && data.stats === false) { + data.stats = stats; + } + + var isDir = data.type === 'directory'; + + if (data.name) { + data.name = util.sanitizePath(data.name); + + if (data.name.slice(-1) === '/') { + isDir = true; + data.type = 'directory'; + } else if (isDir) { + data.name += '/'; + } + } + + if (typeof data.mode === 'number') { + data.mode &= 0777; + } else if (data.stats && data.mode === null) { + data.mode = data.stats.mode & 0777; + } else if (data.mode === null) { + data.mode = isDir ? 0755 : 0644; + } + + if (data.stats && data.date === null) { + data.date = data.stats.mtime; + } else { + data.date = util.dateify(data.date); + } + + return data; +}; + +Archiver.prototype._onModuleError = function(err) { + this.emit('error', err); +}; + +Archiver.prototype._onQueueDrain = function() { + if (this._state.finalizing || this._state.finalized || this._state.aborted) { + return; + } + + if (this._state.finalize && this._pending === 0 && this._queue.idle() && this._statQueue.idle()) { + this._finalize(); + return; + } +}; + +Archiver.prototype._onQueueTask = function(task, callback) { + if (this._state.finalizing || this._state.finalized || this._state.aborted) { + callback(); + return; + } + + this._task = task; + this._moduleAppend(task.source, task.data, callback); +}; + +Archiver.prototype._onStatQueueTask = function(task, callback) { + if (this._state.finalizing || this._state.finalized || this._state.aborted) { + callback(); + return; + } + + fs.stat(task.filepath, function(err, stats) { + if (this._state.aborted) { + setImmediate(callback); + return; + } + + if (err) { + this.emit('error', err); + setImmediate(callback); + return; + } + + task = this._updateQueueTaskWithStats(task, stats); + + if (task.source !== null) { + this._queue.push(task); + setImmediate(callback); + } else { + this.emit('error', new Error('unsupported entry: ' + task.filepath)); + setImmediate(callback); + return; + } + }.bind(this)); +}; + +Archiver.prototype._shutdown = function() { + this._moduleUnpipe(); + this.end(); +}; + +Archiver.prototype._transform = function(chunk, encoding, callback) { + if (chunk) { + this._pointer += chunk.length; + } + + callback(null, chunk); +}; + +Archiver.prototype._updateQueueTaskWithStats = function(task, stats) { + if (stats.isFile()) { + task.data.type = 'file'; + task.data.sourceType = 'stream'; + task.source = util.lazyReadStream(task.filepath); + } else if (stats.isDirectory() && this._moduleSupports('directory')) { + task.data.name = util.trailingSlashIt(task.data.name); + task.data.type = 'directory'; + task.data.sourcePath = util.trailingSlashIt(task.filepath); + task.data.sourceType = 'buffer'; + task.source = new Buffer(0); + } else { + return task; + } + + task.data = this._normalizeEntryData(task.data, stats); + return task; +}; + +Archiver.prototype.abort = function() { + if (this._state.aborted || this._state.finalized) { + return this; + } + + this._abort(); + + return this; +}; + +Archiver.prototype.append = function(source, data) { + if (this._state.finalize || this._state.aborted) { + this.emit('error', new Error('append: queue closed')); + return this; + } + + data = this._normalizeEntryData(data); + + if (typeof data.name !== 'string' || data.name.length === 0) { + this.emit('error', new Error('append: entry name must be a non-empty string value')); + return this; + } + + if (data.type === 'directory' && !this._moduleSupports('directory')) { + this.emit('error', new Error('append: entries of "directory" type not currently supported by this module')); + return this; + } + + source = util.normalizeInputSource(source); + + if (Buffer.isBuffer(source)) { + data.sourceType = 'buffer'; + } else if (util.isStream(source)) { + data.sourceType = 'stream'; + } else { + this.emit('error', new Error('append: input source must be valid Stream or Buffer instance')); + return this; + } + + this._queue.push({ + data: data, + source: source + }); + + return this; +}; + +Archiver.prototype.bulk = function(mappings) { + if (this._state.finalize || this._state.aborted) { + this.emit('error', new Error('bulk: queue closed')); + return this; + } + + if (!Array.isArray(mappings)) { + mappings = [mappings]; + } + + var self = this; + var files = util.file.normalizeFilesArray(mappings); + + files.forEach(function(file){ + var isExpandedPair = file.orig.expand || false; + var fileData = file.data || {}; + + file.src.forEach(function(filepath) { + var data = util._.extend({}, fileData); + data.name = isExpandedPair ? util.unixifyPath(file.dest) : util.unixifyPath(file.dest || '', filepath); + + if (data.name === '.') { + return; + } + + self._append(filepath, data); + }); + }); + + return this; +}; + +Archiver.prototype.directory = function(dirpath, destpath, data) { + if (this._state.finalize || this._state.aborted) { + this.emit('error', new Error('directory: queue closed')); + return this; + } + + if (typeof dirpath !== 'string' || dirpath.length === 0) { + this.emit('error', new Error('directory: dirpath must be a non-empty string value')); + return this; + } + + this._pending++; + + if (destpath === false) { + destpath = ''; + } else if (typeof destpath !== 'string'){ + destpath = dirpath; + } + + if (typeof data !== 'object') { + data = {}; + } + + var self = this; + + util.walkdir(dirpath, function(err, results) { + if (err) { + self.emit('error', err); + } else { + results.forEach(function(file) { + var entryData = util._.extend({}, data); + entryData.name = util.sanitizePath(destpath, file.relative); + entryData.stats = file.stats; + + self._append(file.path, entryData); + }); + } + + self._pending--; + self._maybeFinalize(); + }); + + return this; +}; + +Archiver.prototype.file = function(filepath, data) { + if (this._state.finalize || this._state.aborted) { + this.emit('error', new Error('file: queue closed')); + return this; + } + + if (typeof filepath !== 'string' || filepath.length === 0) { + this.emit('error', new Error('file: filepath must be a non-empty string value')); + return this; + } + + this._append(filepath, data); + + return this; +}; + +Archiver.prototype.finalize = function() { + if (this._state.aborted) { + this.emit('error', new Error('finalize: archive was aborted')); + return this; + } + + if (this._state.finalize) { + this.emit('error', new Error('finalize: archive already finalizing')); + return this; + } + + this._state.finalize = true; + + if (this._pending === 0 && this._queue.idle() && this._statQueue.idle()) { + this._finalize(); + } + + return this; +}; + +Archiver.prototype.setFormat = function(format) { + if (this._format) { + this.emit('error', new Error('format: archive format already set')); + return this; + } + + this._format = format; + + return this; +}; + +Archiver.prototype.setModule = function(module) { + if (this._state.aborted) { + this.emit('error', new Error('module: archive was aborted')); + return this; + } + + if (this._state.module) { + this.emit('error', new Error('module: module already set')); + return this; + } + + this._module = module; + this._modulePipe(); + + return this; +}; + +Archiver.prototype.pointer = function() { + return this._pointer; }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/plugins/json.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/plugins/json.js b/node_modules/archiver/lib/plugins/json.js index 4659dc3..b6acc12 100644 --- a/node_modules/archiver/lib/plugins/json.js +++ b/node_modules/archiver/lib/plugins/json.js @@ -1,70 +1,70 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var inherits = require('util').inherits; -var Transform = require('readable-stream').Transform; - -var crc32 = require('buffer-crc32'); -var util = require('../util'); - -var Json = module.exports = function(options) { - if (!(this instanceof Json)) { - return new Json(options); - } - - options = this.options = util.defaults(options, {}); - - Transform.call(this, options); - - this.supports = { - directory: true - }; - - this.files = []; -}; - -inherits(Json, Transform); - -Json.prototype._transform = function(chunk, encoding, callback) { - callback(null, chunk); -}; - -Json.prototype._writeStringified = function() { - var fileString = JSON.stringify(this.files); - this.write(fileString); -}; - -Json.prototype.append = function(source, data, callback) { - var self = this; - - data.crc32 = 0; - - function onend(err, sourceBuffer) { - if (err) { - callback(err); - return; - } - - data.size = sourceBuffer.length || 0; - data.crc32 = crc32.unsigned(sourceBuffer); - - self.files.push(data); - - callback(null, data); - } - - if (data.sourceType === 'buffer') { - onend(null, source); - } else if (data.sourceType === 'stream') { - util.collectStream(source, onend); - } -}; - -Json.prototype.finalize = function() { - this._writeStringified(); - this.end(); +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var inherits = require('util').inherits; +var Transform = require('readable-stream').Transform; + +var crc32 = require('buffer-crc32'); +var util = require('../util'); + +var Json = module.exports = function(options) { + if (!(this instanceof Json)) { + return new Json(options); + } + + options = this.options = util.defaults(options, {}); + + Transform.call(this, options); + + this.supports = { + directory: true + }; + + this.files = []; +}; + +inherits(Json, Transform); + +Json.prototype._transform = function(chunk, encoding, callback) { + callback(null, chunk); +}; + +Json.prototype._writeStringified = function() { + var fileString = JSON.stringify(this.files); + this.write(fileString); +}; + +Json.prototype.append = function(source, data, callback) { + var self = this; + + data.crc32 = 0; + + function onend(err, sourceBuffer) { + if (err) { + callback(err); + return; + } + + data.size = sourceBuffer.length || 0; + data.crc32 = crc32.unsigned(sourceBuffer); + + self.files.push(data); + + callback(null, data); + } + + if (data.sourceType === 'buffer') { + onend(null, source); + } else if (data.sourceType === 'stream') { + util.collectStream(source, onend); + } +}; + +Json.prototype.finalize = function() { + this._writeStringified(); + this.end(); }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/plugins/tar.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/plugins/tar.js b/node_modules/archiver/lib/plugins/tar.js index c0816e7..a672bd4 100644 --- a/node_modules/archiver/lib/plugins/tar.js +++ b/node_modules/archiver/lib/plugins/tar.js @@ -1,96 +1,96 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var zlib = require('zlib'); - -var engine = require('tar-stream'); -var util = require('../util'); - -var Tar = module.exports = function(options) { - if (!(this instanceof Tar)) { - return new Tar(options); - } - - options = this.options = util.defaults(options, { - gzip: false - }); - - if (typeof options.gzipOptions !== 'object') { - options.gzipOptions = {}; - } - - this.supports = { - directory: true - }; - - this.engine = engine.pack(options); - this.compressor = false; - - if (options.gzip) { - this.compressor = zlib.createGzip(options.gzipOptions); - this.compressor.on('error', this._onCompressorError.bind(this)); - } -}; - -Tar.prototype._onCompressorError = function(err) { - this.engine.emit('error', err); -}; - -Tar.prototype.append = function(source, data, callback) { - var self = this; - - data.mtime = data.date; - - function append(err, sourceBuffer) { - if (err) { - callback(err); - return; - } - - self.engine.entry(data, sourceBuffer, function(err) { - callback(err, data); - }); - } - - if (data.sourceType === 'buffer') { - append(null, source); - } else if (data.sourceType === 'stream' && data._stats) { - data.size = data._stats.size; - - var entry = self.engine.entry(data, function(err) { - callback(err, data); - }); - - source.pipe(entry); - } else if (data.sourceType === 'stream') { - util.collectStream(source, append); - } -}; - -Tar.prototype.finalize = function() { - this.engine.finalize(); -}; - -Tar.prototype.on = function() { - return this.engine.on.apply(this.engine, arguments); -}; - -Tar.prototype.pipe = function(destination, options) { - if (this.compressor) { - return this.engine.pipe.apply(this.engine, [this.compressor]).pipe(destination, options); - } else { - return this.engine.pipe.apply(this.engine, arguments); - } -}; - -Tar.prototype.unpipe = function() { - if (this.compressor) { - return this.compressor.unpipe.apply(this.compressor, arguments); - } else { - return this.engine.unpipe.apply(this.engine, arguments); - } +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var zlib = require('zlib'); + +var engine = require('tar-stream'); +var util = require('../util'); + +var Tar = module.exports = function(options) { + if (!(this instanceof Tar)) { + return new Tar(options); + } + + options = this.options = util.defaults(options, { + gzip: false + }); + + if (typeof options.gzipOptions !== 'object') { + options.gzipOptions = {}; + } + + this.supports = { + directory: true + }; + + this.engine = engine.pack(options); + this.compressor = false; + + if (options.gzip) { + this.compressor = zlib.createGzip(options.gzipOptions); + this.compressor.on('error', this._onCompressorError.bind(this)); + } +}; + +Tar.prototype._onCompressorError = function(err) { + this.engine.emit('error', err); +}; + +Tar.prototype.append = function(source, data, callback) { + var self = this; + + data.mtime = data.date; + + function append(err, sourceBuffer) { + if (err) { + callback(err); + return; + } + + self.engine.entry(data, sourceBuffer, function(err) { + callback(err, data); + }); + } + + if (data.sourceType === 'buffer') { + append(null, source); + } else if (data.sourceType === 'stream' && data._stats) { + data.size = data._stats.size; + + var entry = self.engine.entry(data, function(err) { + callback(err, data); + }); + + source.pipe(entry); + } else if (data.sourceType === 'stream') { + util.collectStream(source, append); + } +}; + +Tar.prototype.finalize = function() { + this.engine.finalize(); +}; + +Tar.prototype.on = function() { + return this.engine.on.apply(this.engine, arguments); +}; + +Tar.prototype.pipe = function(destination, options) { + if (this.compressor) { + return this.engine.pipe.apply(this.engine, [this.compressor]).pipe(destination, options); + } else { + return this.engine.pipe.apply(this.engine, arguments); + } +}; + +Tar.prototype.unpipe = function() { + if (this.compressor) { + return this.compressor.unpipe.apply(this.compressor, arguments); + } else { + return this.engine.unpipe.apply(this.engine, arguments); + } }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/plugins/zip.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/plugins/zip.js b/node_modules/archiver/lib/plugins/zip.js index c46ffc4..b55d910 100644 --- a/node_modules/archiver/lib/plugins/zip.js +++ b/node_modules/archiver/lib/plugins/zip.js @@ -1,47 +1,47 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var engine = require('zip-stream'); -var util = require('../util'); - -var Zip = module.exports = function(options) { - if (!(this instanceof Zip)) { - return new Zip(options); - } - - options = this.options = util.defaults(options, { - comment: '', - forceUTC: false, - store: false - }); - - this.supports = { - directory: true - }; - - this.engine = new engine(options); -}; - -Zip.prototype.append = function(source, data, callback) { - this.engine.entry(source, data, callback); -}; - -Zip.prototype.finalize = function() { - this.engine.finalize(); -}; - -Zip.prototype.on = function() { - return this.engine.on.apply(this.engine, arguments); -}; - -Zip.prototype.pipe = function() { - return this.engine.pipe.apply(this.engine, arguments); -}; - -Zip.prototype.unpipe = function() { - return this.engine.unpipe.apply(this.engine, arguments); +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var engine = require('zip-stream'); +var util = require('../util'); + +var Zip = module.exports = function(options) { + if (!(this instanceof Zip)) { + return new Zip(options); + } + + options = this.options = util.defaults(options, { + comment: '', + forceUTC: false, + store: false + }); + + this.supports = { + directory: true + }; + + this.engine = new engine(options); +}; + +Zip.prototype.append = function(source, data, callback) { + this.engine.entry(source, data, callback); +}; + +Zip.prototype.finalize = function() { + this.engine.finalize(); +}; + +Zip.prototype.on = function() { + return this.engine.on.apply(this.engine, arguments); +}; + +Zip.prototype.pipe = function() { + return this.engine.pipe.apply(this.engine, arguments); +}; + +Zip.prototype.unpipe = function() { + return this.engine.unpipe.apply(this.engine, arguments); }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/util/file.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/util/file.js b/node_modules/archiver/lib/util/file.js index 4d671de..425895f 100644 --- a/node_modules/archiver/lib/util/file.js +++ b/node_modules/archiver/lib/util/file.js @@ -1,206 +1,206 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var fs = require('fs'); -var path = require('path'); - -var _ = require('lodash'); -var glob = require('glob'); - -var file = module.exports = {}; - -var pathSeparatorRe = /[\/\\]/g; - -// Process specified wildcard glob patterns or filenames against a -// callback, excluding and uniquing files in the result set. -var processPatterns = function(patterns, fn) { - // Filepaths to return. - var result = []; - // Iterate over flattened patterns array. - _.flatten(patterns).forEach(function(pattern) { - // If the first character is ! it should be omitted - var exclusion = pattern.indexOf('!') === 0; - // If the pattern is an exclusion, remove the ! - if (exclusion) { pattern = pattern.slice(1); } - // Find all matching files for this pattern. - var matches = fn(pattern); - if (exclusion) { - // If an exclusion, remove matching files. - result = _.difference(result, matches); - } else { - // Otherwise add matching files. - result = _.union(result, matches); - } - }); - return result; -}; - -// True if the file path exists. -file.exists = function() { - var filepath = path.join.apply(path, arguments); - return fs.existsSync(filepath); -}; - -// Return an array of all file paths that match the given wildcard patterns. -file.expand = function() { - var args = _.toArray(arguments); - // If the first argument is an options object, save those options to pass - // into the File.prototype.glob.sync method. - var options = _.isPlainObject(args[0]) ? args.shift() : {}; - // Use the first argument if it's an Array, otherwise convert the arguments - // object to an array and use that. - var patterns = Array.isArray(args[0]) ? args[0] : args; - // Return empty set if there are no patterns or filepaths. - if (patterns.length === 0) { return []; } - // Return all matching filepaths. - var matches = processPatterns(patterns, function(pattern) { - // Find all matching files for this pattern. - return glob.sync(pattern, options); - }); - // Filter result set? - if (options.filter) { - matches = matches.filter(function(filepath) { - filepath = path.join(options.cwd || '', filepath); - try { - if (typeof options.filter === 'function') { - return options.filter(filepath); - } else { - // If the file is of the right type and exists, this should work. - return fs.statSync(filepath)[options.filter](); - } - } catch(e) { - // Otherwise, it's probably not the right type. - return false; - } - }); - } - return matches; -}; - -// Build a multi task "files" object dynamically. -file.expandMapping = function(patterns, destBase, options) { - options = _.defaults({}, options, { - rename: function(destBase, destPath) { - return path.join(destBase || '', destPath); - } - }); - var files = []; - var fileByDest = {}; - // Find all files matching pattern, using passed-in options. - file.expand(options, patterns).forEach(function(src) { - var destPath = src; - // Flatten? - if (options.flatten) { - destPath = path.basename(destPath); - } - // Change the extension? - if (options.ext) { - destPath = destPath.replace(/(\.[^\/]*)?$/, options.ext); - } - // Generate destination filename. - var dest = options.rename(destBase, destPath, options); - // Prepend cwd to src path if necessary. - if (options.cwd) { src = path.join(options.cwd, src); } - // Normalize filepaths to be unix-style. - dest = dest.replace(pathSeparatorRe, '/'); - src = src.replace(pathSeparatorRe, '/'); - // Map correct src path to dest path. - if (fileByDest[dest]) { - // If dest already exists, push this src onto that dest's src array. - fileByDest[dest].src.push(src); - } else { - // Otherwise create a new src-dest file mapping object. - files.push({ - src: [src], - dest: dest, - }); - // And store a reference for later use. - fileByDest[dest] = files[files.length - 1]; - } - }); - return files; -}; - -// reusing bits of grunt's multi-task source normalization -file.normalizeFilesArray = function(data) { - var files = []; - - data.forEach(function(obj) { - var prop; - if ('src' in obj || 'dest' in obj) { - files.push(obj); - } - }); - - if (files.length === 0) { - return []; - } - - files = _(files).chain().forEach(function(obj) { - if (!('src' in obj) || !obj.src) { return; } - // Normalize .src properties to flattened array. - if (Array.isArray(obj.src)) { - obj.src = _.flatten(obj.src); - } else { - obj.src = [obj.src]; - } - }).map(function(obj) { - // Build options object, removing unwanted properties. - var expandOptions = _.extend({}, obj); - delete expandOptions.src; - delete expandOptions.dest; - - // Expand file mappings. - if (obj.expand) { - return file.expandMapping(obj.src, obj.dest, expandOptions).map(function(mapObj) { - // Copy obj properties to result. - var result = _.extend({}, obj); - // Make a clone of the orig obj available. - result.orig = _.extend({}, obj); - // Set .src and .dest, processing both as templates. - result.src = mapObj.src; - result.dest = mapObj.dest; - // Remove unwanted properties. - ['expand', 'cwd', 'flatten', 'rename', 'ext'].forEach(function(prop) { - delete result[prop]; - }); - return result; - }); - } - - // Copy obj properties to result, adding an .orig property. - var result = _.extend({}, obj); - // Make a clone of the orig obj available. - result.orig = _.extend({}, obj); - - if ('src' in result) { - // Expose an expand-on-demand getter method as .src. - Object.defineProperty(result, 'src', { - enumerable: true, - get: function fn() { - var src; - if (!('result' in fn)) { - src = obj.src; - // If src is an array, flatten it. Otherwise, make it into an array. - src = Array.isArray(src) ? _.flatten(src) : [src]; - // Expand src files, memoizing result. - fn.result = file.expand(expandOptions, src); - } - return fn.result; - } - }); - } - - if ('dest' in result) { - result.dest = obj.dest; - } - - return result; - }).flatten().value(); - - return files; +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var fs = require('fs'); +var path = require('path'); + +var _ = require('lodash'); +var glob = require('glob'); + +var file = module.exports = {}; + +var pathSeparatorRe = /[\/\\]/g; + +// Process specified wildcard glob patterns or filenames against a +// callback, excluding and uniquing files in the result set. +var processPatterns = function(patterns, fn) { + // Filepaths to return. + var result = []; + // Iterate over flattened patterns array. + _.flatten(patterns).forEach(function(pattern) { + // If the first character is ! it should be omitted + var exclusion = pattern.indexOf('!') === 0; + // If the pattern is an exclusion, remove the ! + if (exclusion) { pattern = pattern.slice(1); } + // Find all matching files for this pattern. + var matches = fn(pattern); + if (exclusion) { + // If an exclusion, remove matching files. + result = _.difference(result, matches); + } else { + // Otherwise add matching files. + result = _.union(result, matches); + } + }); + return result; +}; + +// True if the file path exists. +file.exists = function() { + var filepath = path.join.apply(path, arguments); + return fs.existsSync(filepath); +}; + +// Return an array of all file paths that match the given wildcard patterns. +file.expand = function() { + var args = _.toArray(arguments); + // If the first argument is an options object, save those options to pass + // into the File.prototype.glob.sync method. + var options = _.isPlainObject(args[0]) ? args.shift() : {}; + // Use the first argument if it's an Array, otherwise convert the arguments + // object to an array and use that. + var patterns = Array.isArray(args[0]) ? args[0] : args; + // Return empty set if there are no patterns or filepaths. + if (patterns.length === 0) { return []; } + // Return all matching filepaths. + var matches = processPatterns(patterns, function(pattern) { + // Find all matching files for this pattern. + return glob.sync(pattern, options); + }); + // Filter result set? + if (options.filter) { + matches = matches.filter(function(filepath) { + filepath = path.join(options.cwd || '', filepath); + try { + if (typeof options.filter === 'function') { + return options.filter(filepath); + } else { + // If the file is of the right type and exists, this should work. + return fs.statSync(filepath)[options.filter](); + } + } catch(e) { + // Otherwise, it's probably not the right type. + return false; + } + }); + } + return matches; +}; + +// Build a multi task "files" object dynamically. +file.expandMapping = function(patterns, destBase, options) { + options = _.defaults({}, options, { + rename: function(destBase, destPath) { + return path.join(destBase || '', destPath); + } + }); + var files = []; + var fileByDest = {}; + // Find all files matching pattern, using passed-in options. + file.expand(options, patterns).forEach(function(src) { + var destPath = src; + // Flatten? + if (options.flatten) { + destPath = path.basename(destPath); + } + // Change the extension? + if (options.ext) { + destPath = destPath.replace(/(\.[^\/]*)?$/, options.ext); + } + // Generate destination filename. + var dest = options.rename(destBase, destPath, options); + // Prepend cwd to src path if necessary. + if (options.cwd) { src = path.join(options.cwd, src); } + // Normalize filepaths to be unix-style. + dest = dest.replace(pathSeparatorRe, '/'); + src = src.replace(pathSeparatorRe, '/'); + // Map correct src path to dest path. + if (fileByDest[dest]) { + // If dest already exists, push this src onto that dest's src array. + fileByDest[dest].src.push(src); + } else { + // Otherwise create a new src-dest file mapping object. + files.push({ + src: [src], + dest: dest, + }); + // And store a reference for later use. + fileByDest[dest] = files[files.length - 1]; + } + }); + return files; +}; + +// reusing bits of grunt's multi-task source normalization +file.normalizeFilesArray = function(data) { + var files = []; + + data.forEach(function(obj) { + var prop; + if ('src' in obj || 'dest' in obj) { + files.push(obj); + } + }); + + if (files.length === 0) { + return []; + } + + files = _(files).chain().forEach(function(obj) { + if (!('src' in obj) || !obj.src) { return; } + // Normalize .src properties to flattened array. + if (Array.isArray(obj.src)) { + obj.src = _.flatten(obj.src); + } else { + obj.src = [obj.src]; + } + }).map(function(obj) { + // Build options object, removing unwanted properties. + var expandOptions = _.extend({}, obj); + delete expandOptions.src; + delete expandOptions.dest; + + // Expand file mappings. + if (obj.expand) { + return file.expandMapping(obj.src, obj.dest, expandOptions).map(function(mapObj) { + // Copy obj properties to result. + var result = _.extend({}, obj); + // Make a clone of the orig obj available. + result.orig = _.extend({}, obj); + // Set .src and .dest, processing both as templates. + result.src = mapObj.src; + result.dest = mapObj.dest; + // Remove unwanted properties. + ['expand', 'cwd', 'flatten', 'rename', 'ext'].forEach(function(prop) { + delete result[prop]; + }); + return result; + }); + } + + // Copy obj properties to result, adding an .orig property. + var result = _.extend({}, obj); + // Make a clone of the orig obj available. + result.orig = _.extend({}, obj); + + if ('src' in result) { + // Expose an expand-on-demand getter method as .src. + Object.defineProperty(result, 'src', { + enumerable: true, + get: function fn() { + var src; + if (!('result' in fn)) { + src = obj.src; + // If src is an array, flatten it. Otherwise, make it into an array. + src = Array.isArray(src) ? _.flatten(src) : [src]; + // Expand src files, memoizing result. + fn.result = file.expand(expandOptions, src); + } + return fn.result; + } + }); + } + + if ('dest' in result) { + result.dest = obj.dest; + } + + return result; + }).flatten().value(); + + return files; }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/lib/util/index.js ---------------------------------------------------------------------- diff --git a/node_modules/archiver/lib/util/index.js b/node_modules/archiver/lib/util/index.js index 132b406..0e5251e 100644 --- a/node_modules/archiver/lib/util/index.js +++ b/node_modules/archiver/lib/util/index.js @@ -1,149 +1,149 @@ -/** - * node-archiver - * - * Copyright (c) 2012-2014 Chris Talkington, contributors. - * Licensed under the MIT license. - * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT - */ -var fs = require('fs'); -var path = require('path'); - -var Stream = require('stream').Stream; -var PassThrough = require('readable-stream').PassThrough; - -var util = module.exports = {}; - -util._ = require('lodash'); -util.lazystream = require('lazystream'); -util.file = require('./file'); - -util.collectStream = function(source, callback) { - var collection = []; - var size = 0; - - source.on('error', callback); - - source.on('data', function(chunk) { - collection.push(chunk); - size += chunk.length; - }); - - source.on('end', function() { - var buf = new Buffer(size, 'utf8'); - var offset = 0; - - collection.forEach(function(data) { - data.copy(buf, offset); - offset += data.length; - }); - - callback(null, buf); - }); -}; - -util.dateify = function(dateish) { - dateish = dateish || new Date(); - - if (dateish instanceof Date) { - dateish = dateish; - } else if (typeof dateish === 'string') { - dateish = new Date(dateish); - } else { - dateish = new Date(); - } - - return dateish; -}; - -// this is slightly different from lodash version -util.defaults = function(object, source, guard) { - var args = arguments; - args[0] = args[0] || {}; - - return util._.defaults.apply(util._, args); -}; - -util.isStream = function(source) { - return source instanceof Stream; -}; - -util.lazyReadStream = function(filepath) { - return new util.lazystream.Readable(function() { - return fs.createReadStream(filepath); - }); -}; - -util.normalizeInputSource = function(source) { - if (source === null) { - return new Buffer(0); - } else if (typeof source === 'string') { - return new Buffer(source); - } else if (util.isStream(source) && !source._readableState) { - var normalized = new PassThrough(); - source.pipe(normalized); - - return normalized; - } - - return source; -}; - -util.sanitizePath = function() { - var filepath = path.join.apply(path, arguments); - return filepath.replace(/\\/g, '/').replace(/:/g, '').replace(/^(\.\.\/|\.\/|\/)+/, ''); -}; - -util.trailingSlashIt = function(str) { - return str.slice(-1) !== '/' ? str + '/' : str; -}; - -util.unixifyPath = function() { - var filepath = path.join.apply(path, arguments); - return filepath.replace(/\\/g, '/'); -}; - -util.walkdir = function(dirpath, base, callback) { - var results = []; - - if (typeof base === 'function') { - callback = base; - base = dirpath; - } - - fs.readdir(dirpath, function(err, list) { - var i = 0; - var file; - var filepath; - - if (err) { - return callback(err); - } - - (function next() { - file = list[i++]; - - if (!file) { - return callback(null, results); - } - - filepath = path.join(dirpath, file); - - fs.stat(filepath, function(err, stats) { - results.push({ - path: filepath, - relative: path.relative(base, filepath).replace(/\\/g, '/'), - stats: stats - }); - - if (stats && stats.isDirectory()) { - util.walkdir(filepath, base, function(err, res) { - results = results.concat(res); - next(); - }); - } else { - next(); - } - }); - })(); - }); +/** + * node-archiver + * + * Copyright (c) 2012-2014 Chris Talkington, contributors. + * Licensed under the MIT license. + * https://github.com/archiverjs/node-archiver/blob/master/LICENSE-MIT + */ +var fs = require('fs'); +var path = require('path'); + +var Stream = require('stream').Stream; +var PassThrough = require('readable-stream').PassThrough; + +var util = module.exports = {}; + +util._ = require('lodash'); +util.lazystream = require('lazystream'); +util.file = require('./file'); + +util.collectStream = function(source, callback) { + var collection = []; + var size = 0; + + source.on('error', callback); + + source.on('data', function(chunk) { + collection.push(chunk); + size += chunk.length; + }); + + source.on('end', function() { + var buf = new Buffer(size, 'utf8'); + var offset = 0; + + collection.forEach(function(data) { + data.copy(buf, offset); + offset += data.length; + }); + + callback(null, buf); + }); +}; + +util.dateify = function(dateish) { + dateish = dateish || new Date(); + + if (dateish instanceof Date) { + dateish = dateish; + } else if (typeof dateish === 'string') { + dateish = new Date(dateish); + } else { + dateish = new Date(); + } + + return dateish; +}; + +// this is slightly different from lodash version +util.defaults = function(object, source, guard) { + var args = arguments; + args[0] = args[0] || {}; + + return util._.defaults.apply(util._, args); +}; + +util.isStream = function(source) { + return source instanceof Stream; +}; + +util.lazyReadStream = function(filepath) { + return new util.lazystream.Readable(function() { + return fs.createReadStream(filepath); + }); +}; + +util.normalizeInputSource = function(source) { + if (source === null) { + return new Buffer(0); + } else if (typeof source === 'string') { + return new Buffer(source); + } else if (util.isStream(source) && !source._readableState) { + var normalized = new PassThrough(); + source.pipe(normalized); + + return normalized; + } + + return source; +}; + +util.sanitizePath = function() { + var filepath = path.join.apply(path, arguments); + return filepath.replace(/\\/g, '/').replace(/:/g, '').replace(/^(\.\.\/|\.\/|\/)+/, ''); +}; + +util.trailingSlashIt = function(str) { + return str.slice(-1) !== '/' ? str + '/' : str; +}; + +util.unixifyPath = function() { + var filepath = path.join.apply(path, arguments); + return filepath.replace(/\\/g, '/'); +}; + +util.walkdir = function(dirpath, base, callback) { + var results = []; + + if (typeof base === 'function') { + callback = base; + base = dirpath; + } + + fs.readdir(dirpath, function(err, list) { + var i = 0; + var file; + var filepath; + + if (err) { + return callback(err); + } + + (function next() { + file = list[i++]; + + if (!file) { + return callback(null, results); + } + + filepath = path.join(dirpath, file); + + fs.stat(filepath, function(err, stats) { + results.push({ + path: filepath, + relative: path.relative(base, filepath).replace(/\\/g, '/'), + stats: stats + }); + + if (stats && stats.isDirectory()) { + util.walkdir(filepath, base, function(err, res) { + results = results.concat(res); + next(); + }); + } else { + next(); + } + }); + })(); + }); }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/325bb661/node_modules/archiver/node_modules/zip-stream/LICENSE-MIT ---------------------------------------------------------------------- diff --git a/node_modules/archiver/node_modules/zip-stream/LICENSE-MIT b/node_modules/archiver/node_modules/zip-stream/LICENSE-MIT index 819b403..56420a6 100644 --- a/node_modules/archiver/node_modules/zip-stream/LICENSE-MIT +++ b/node_modules/archiver/node_modules/zip-stream/LICENSE-MIT @@ -1,22 +1,22 @@ -Copyright (c) 2014 Chris Talkington, 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 +Copyright (c) 2014 Chris Talkington, 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. \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org