From 4bcd932c28d0469a32c8f0cfb652b5b731cb4577 Mon Sep 17 00:00:00 2001 From: crazy-max Date: Fri, 3 Apr 2020 08:12:31 +0000 Subject: [PATCH] Update node_modules --- node_modules/buffer/AUTHORS.md | 2 + node_modules/buffer/README.md | 7 +- node_modules/buffer/index.js | 6 + node_modules/buffer/package.json | 25 +- .../node_modules/get-stream/buffer-stream.js | 51 + .../node_modules/get-stream/index.js | 51 + .../node_modules/get-stream}/license | 0 .../node_modules/get-stream/package.json | 83 + .../node_modules/get-stream/readme.md | 117 ++ node_modules/caw/index.js | 37 - node_modules/caw/package.json | 84 - node_modules/caw/readme.md | 51 - node_modules/config-chain/LICENCE | 22 - node_modules/config-chain/index.js | 282 ---- node_modules/config-chain/package.json | 65 - node_modules/config-chain/readme.markdown | 257 --- .../node_modules/is-stream/package.json | 73 - .../node_modules/is-stream/index.js | 21 - .../node_modules/is-stream/package.json | 73 - .../node_modules/is-stream/readme.md | 42 - .../node_modules/is-stream/index.js | 21 - .../node_modules/is-stream/readme.md | 42 - node_modules/decompress/index.js | 59 +- node_modules/decompress/license | 22 +- .../decompress/node_modules/make-dir/index.js | 85 + .../node_modules/make-dir}/license | 0 .../make-dir/node_modules/pify/index.js | 84 + .../make-dir/node_modules/pify}/license | 2 +- .../make-dir/node_modules/pify/package.json | 86 + .../make-dir/node_modules/pify/readme.md | 131 ++ .../node_modules/make-dir/package.json | 89 + .../node_modules/make-dir/readme.md | 116 ++ node_modules/decompress/package.json | 32 +- node_modules/decompress/readme.md | 4 +- node_modules/download/index.js | 26 +- node_modules/download/package.json | 43 +- node_modules/download/readme.md | 39 +- node_modules/file-type/index.d.ts | 205 +++ .../node_modules => }/file-type/index.js | 446 +++-- node_modules/{caw => file-type}/license | 2 +- .../node_modules => }/file-type/package.json | 64 +- .../node_modules => }/file-type/readme.md | 107 +- node_modules/file-type/util.js | 58 + node_modules/filenamify/index.d.ts | 30 + node_modules/filenamify/index.js | 13 +- node_modules/filenamify/package.json | 32 +- node_modules/filenamify/readme.md | 5 + node_modules/get-proxy/index.js | 13 - node_modules/get-proxy/package.json | 68 - node_modules/get-proxy/readme.md | 25 - node_modules/get-stream/buffer-stream.js | 10 +- node_modules/get-stream/index.js | 61 +- node_modules/get-stream/license | 20 +- node_modules/get-stream/package.json | 36 +- node_modules/get-stream/readme.md | 26 +- .../node_modules/get-stream/buffer-stream.js | 51 + .../got/node_modules/get-stream/index.js | 51 + .../node_modules/get-stream}/license | 0 .../got/node_modules/get-stream/package.json | 83 + .../got/node_modules/get-stream/readme.md | 117 ++ node_modules/got/node_modules/pify/index.js | 84 + .../node_modules/pify}/license | 2 +- .../got/node_modules/pify/package.json | 86 + node_modules/got/node_modules/pify/readme.md | 131 ++ node_modules/graceful-fs/graceful-fs.js | 10 +- node_modules/graceful-fs/package.json | 20 +- node_modules/ini/README.md | 102 -- node_modules/ini/ini.js | 194 --- node_modules/ini/package.json | 66 - .../node_modules => }/is-stream/index.js | 0 .../node_modules => }/is-stream/license | 0 .../node_modules => }/is-stream/package.json | 7 +- .../node_modules => }/is-stream/readme.md | 0 node_modules/isurl/package.json | 1 - node_modules/make-dir/index.d.ts | 39 + node_modules/make-dir/index.js | 100 +- .../make-dir/node_modules/.bin/semver | 1 + .../make-dir/node_modules/semver/CHANGELOG.md | 39 + .../node_modules/semver}/LICENSE | 0 .../make-dir/node_modules/semver/README.md | 412 +++++ .../make-dir/node_modules/semver/bin/semver | 160 ++ .../make-dir/node_modules/semver/package.json | 63 + .../make-dir/node_modules/semver/range.bnf | 16 + .../make-dir/node_modules/semver/semver.js | 1483 +++++++++++++++++ node_modules/make-dir/package.json | 40 +- node_modules/make-dir/readme.md | 23 +- node_modules/mime-db/HISTORY.md | 15 + node_modules/mime-db/README.md | 8 +- node_modules/mime-db/db.json | 188 ++- node_modules/mime-db/package.json | 34 +- node_modules/npm-conf/index.js | 43 - node_modules/npm-conf/lib/conf.js | 174 -- node_modules/npm-conf/lib/defaults.js | 169 -- node_modules/npm-conf/lib/make.js | 91 - node_modules/npm-conf/lib/types.js | 127 -- node_modules/npm-conf/lib/util.js | 147 -- node_modules/npm-conf/package.json | 85 - node_modules/npm-conf/readme.md | 47 - node_modules/pify/index.js | 84 +- node_modules/pify/package.json | 34 +- node_modules/pify/readme.md | 16 +- node_modules/proto-list/LICENSE | 15 - node_modules/proto-list/README.md | 3 - node_modules/proto-list/package.json | 54 - node_modules/proto-list/proto-list.js | 88 - node_modules/proto-list/test/basic.js | 61 - node_modules/pump/.travis.yml | 5 + node_modules/pump/LICENSE | 21 + node_modules/pump/README.md | 65 + node_modules/pump/index.js | 82 + node_modules/pump/package.json | 64 + node_modules/pump/test-browser.js | 66 + node_modules/pump/test-node.js | 53 + node_modules/readable-stream/.travis.yml | 39 +- .../readable-stream/lib/_stream_duplex.js | 2 +- .../lib/_stream_passthrough.js | 2 +- .../readable-stream/lib/_stream_readable.js | 2 +- .../readable-stream/lib/_stream_transform.js | 2 +- .../readable-stream/lib/_stream_writable.js | 2 +- node_modules/readable-stream/package.json | 20 +- node_modules/tunnel-agent/LICENSE | 55 - node_modules/tunnel-agent/README.md | 4 - node_modules/tunnel-agent/index.js | 244 --- node_modules/tunnel-agent/package.json | 59 - .../unbzip2-stream/dist/unbzip2-stream.min.js | 1 - node_modules/unbzip2-stream/index.js | 5 +- node_modules/unbzip2-stream/lib/bzip2.js | 2 - node_modules/unbzip2-stream/package.json | 20 +- node_modules/url-to-options/package.json | 1 - 129 files changed, 5485 insertions(+), 3646 deletions(-) create mode 100644 node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js create mode 100644 node_modules/cacheable-request/node_modules/get-stream/index.js rename node_modules/{decompress-tar/node_modules/is-stream => cacheable-request/node_modules/get-stream}/license (100%) create mode 100644 node_modules/cacheable-request/node_modules/get-stream/package.json create mode 100644 node_modules/cacheable-request/node_modules/get-stream/readme.md delete mode 100644 node_modules/caw/index.js delete mode 100644 node_modules/caw/package.json delete mode 100644 node_modules/caw/readme.md delete mode 100644 node_modules/config-chain/LICENCE delete mode 100755 node_modules/config-chain/index.js delete mode 100644 node_modules/config-chain/package.json delete mode 100644 node_modules/config-chain/readme.markdown delete mode 100644 node_modules/decompress-tar/node_modules/is-stream/package.json delete mode 100644 node_modules/decompress-tarbz2/node_modules/is-stream/index.js delete mode 100644 node_modules/decompress-tarbz2/node_modules/is-stream/package.json delete mode 100644 node_modules/decompress-tarbz2/node_modules/is-stream/readme.md delete mode 100644 node_modules/decompress-targz/node_modules/is-stream/index.js delete mode 100644 node_modules/decompress-targz/node_modules/is-stream/readme.md create mode 100644 node_modules/decompress/node_modules/make-dir/index.js rename node_modules/{download/node_modules/file-type => decompress/node_modules/make-dir}/license (100%) create mode 100644 node_modules/decompress/node_modules/make-dir/node_modules/pify/index.js rename node_modules/{get-proxy => decompress/node_modules/make-dir/node_modules/pify}/license (92%) create mode 100644 node_modules/decompress/node_modules/make-dir/node_modules/pify/package.json create mode 100644 node_modules/decompress/node_modules/make-dir/node_modules/pify/readme.md create mode 100644 node_modules/decompress/node_modules/make-dir/package.json create mode 100644 node_modules/decompress/node_modules/make-dir/readme.md create mode 100644 node_modules/file-type/index.d.ts rename node_modules/{download/node_modules => }/file-type/index.js (55%) rename node_modules/{caw => file-type}/license (92%) rename node_modules/{download/node_modules => }/file-type/package.json (69%) rename node_modules/{download/node_modules => }/file-type/readme.md (53%) create mode 100644 node_modules/file-type/util.js create mode 100644 node_modules/filenamify/index.d.ts delete mode 100644 node_modules/get-proxy/index.js delete mode 100644 node_modules/get-proxy/package.json delete mode 100644 node_modules/get-proxy/readme.md create mode 100644 node_modules/got/node_modules/get-stream/buffer-stream.js create mode 100644 node_modules/got/node_modules/get-stream/index.js rename node_modules/{decompress-tarbz2/node_modules/is-stream => got/node_modules/get-stream}/license (100%) create mode 100644 node_modules/got/node_modules/get-stream/package.json create mode 100644 node_modules/got/node_modules/get-stream/readme.md create mode 100644 node_modules/got/node_modules/pify/index.js rename node_modules/{npm-conf => got/node_modules/pify}/license (92%) create mode 100644 node_modules/got/node_modules/pify/package.json create mode 100644 node_modules/got/node_modules/pify/readme.md delete mode 100644 node_modules/ini/README.md delete mode 100644 node_modules/ini/ini.js delete mode 100644 node_modules/ini/package.json rename node_modules/{decompress-tar/node_modules => }/is-stream/index.js (100%) rename node_modules/{decompress-targz/node_modules => }/is-stream/license (100%) rename node_modules/{decompress-targz/node_modules => }/is-stream/package.json (92%) rename node_modules/{decompress-tar/node_modules => }/is-stream/readme.md (100%) create mode 100644 node_modules/make-dir/index.d.ts create mode 120000 node_modules/make-dir/node_modules/.bin/semver create mode 100644 node_modules/make-dir/node_modules/semver/CHANGELOG.md rename node_modules/{ini => make-dir/node_modules/semver}/LICENSE (100%) create mode 100644 node_modules/make-dir/node_modules/semver/README.md create mode 100755 node_modules/make-dir/node_modules/semver/bin/semver create mode 100644 node_modules/make-dir/node_modules/semver/package.json create mode 100644 node_modules/make-dir/node_modules/semver/range.bnf create mode 100644 node_modules/make-dir/node_modules/semver/semver.js delete mode 100644 node_modules/npm-conf/index.js delete mode 100644 node_modules/npm-conf/lib/conf.js delete mode 100644 node_modules/npm-conf/lib/defaults.js delete mode 100644 node_modules/npm-conf/lib/make.js delete mode 100644 node_modules/npm-conf/lib/types.js delete mode 100644 node_modules/npm-conf/lib/util.js delete mode 100644 node_modules/npm-conf/package.json delete mode 100644 node_modules/npm-conf/readme.md delete mode 100644 node_modules/proto-list/LICENSE delete mode 100644 node_modules/proto-list/README.md delete mode 100644 node_modules/proto-list/package.json delete mode 100644 node_modules/proto-list/proto-list.js delete mode 100644 node_modules/proto-list/test/basic.js create mode 100644 node_modules/pump/.travis.yml create mode 100644 node_modules/pump/LICENSE create mode 100644 node_modules/pump/README.md create mode 100644 node_modules/pump/index.js create mode 100644 node_modules/pump/package.json create mode 100644 node_modules/pump/test-browser.js create mode 100644 node_modules/pump/test-node.js delete mode 100644 node_modules/tunnel-agent/LICENSE delete mode 100644 node_modules/tunnel-agent/README.md delete mode 100644 node_modules/tunnel-agent/index.js delete mode 100644 node_modules/tunnel-agent/package.json delete mode 100644 node_modules/unbzip2-stream/dist/unbzip2-stream.min.js diff --git a/node_modules/buffer/AUTHORS.md b/node_modules/buffer/AUTHORS.md index 1bb05f7..396b45f 100644 --- a/node_modules/buffer/AUTHORS.md +++ b/node_modules/buffer/AUTHORS.md @@ -56,5 +56,7 @@ - kumavis (aaron@kumavis.me) - Sergey Ukustov (sergey.ukustov@machinomy.com) - Fei Liu (liu.feiwood@gmail.com) +- Blaine Bublitz (blaine.bublitz@gmail.com) +- Niklas Mischkulnig (mischnic@users.noreply.github.com) #### Generated by bin/update-authors.sh. diff --git a/node_modules/buffer/README.md b/node_modules/buffer/README.md index d5bfe6e..2aab37d 100644 --- a/node_modules/buffer/README.md +++ b/node_modules/buffer/README.md @@ -34,6 +34,11 @@ instance methods, and class methods that are supported. - Does not modify any browser prototypes or put anything on `window` - Comprehensive test suite (including all buffer tests from node.js core) +## `buffer` for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `buffer` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-buffer?utm_source=npm-buffer&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## install @@ -43,8 +48,6 @@ To use this module directly (without browserify), install it: npm install buffer ``` -[Get supported buffer with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-buffer?utm_source=npm-buffer&utm_medium=referral&utm_campaign=readme) - This module was previously called **native-buffer-browserify**, but please use **buffer** from now on. diff --git a/node_modules/buffer/index.js b/node_modules/buffer/index.js index 19b0468..4ec5595 100644 --- a/node_modules/buffer/index.js +++ b/node_modules/buffer/index.js @@ -142,6 +142,12 @@ function from (value, encodingOrOffset, length) { return fromArrayBuffer(value, encodingOrOffset, length) } + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + if (typeof value === 'number') { throw new TypeError( 'The "value" argument must not be of type number. Received type number' diff --git a/node_modules/buffer/package.json b/node_modules/buffer/package.json index 7da9a7a..6845e58 100644 --- a/node_modules/buffer/package.json +++ b/node_modules/buffer/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "buffer@5.4.3", + "buffer@5.5.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "buffer@5.4.3", - "_id": "buffer@5.4.3", + "_from": "buffer@5.5.0", + "_id": "buffer@5.5.0", "_inBundle": false, - "_integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", + "_integrity": "sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww==", "_location": "/buffer", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "buffer@5.4.3", + "raw": "buffer@5.5.0", "name": "buffer", "escapedName": "buffer", - "rawSpec": "5.4.3", + "rawSpec": "5.5.0", "saveSpec": null, - "fetchSpec": "5.4.3" + "fetchSpec": "5.5.0" }, "_requiredBy": [ "/unbzip2-stream" ], - "_resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", - "_spec": "5.4.3", + "_resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz", + "_spec": "5.5.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Feross Aboukhadijeh", @@ -51,7 +51,7 @@ }, "description": "Node.js Buffer API, for the browser", "devDependencies": { - "airtap": "^2.0.3", + "airtap": "^3.0.0", "benchmark": "^2.0.0", "browserify": "^16.1.0", "concat-stream": "^2.0.0", @@ -106,8 +106,11 @@ "test/common.js", "test/_polyfill.js", "perf/**/*.js" + ], + "globals": [ + "SharedArrayBuffer" ] }, "types": "index.d.ts", - "version": "5.4.3" + "version": "5.5.0" } diff --git a/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js b/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js new file mode 100644 index 0000000..ae45d3d --- /dev/null +++ b/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js @@ -0,0 +1,51 @@ +'use strict'; +const PassThrough = require('stream').PassThrough; + +module.exports = opts => { + opts = Object.assign({}, opts); + + const array = opts.array; + let encoding = opts.encoding; + const buffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || buffer); + } else { + encoding = encoding || 'utf8'; + } + + if (buffer) { + encoding = null; + } + + let len = 0; + const ret = []; + const stream = new PassThrough({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + stream.on('data', chunk => { + ret.push(chunk); + + if (objectMode) { + len = ret.length; + } else { + len += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return ret; + } + + return buffer ? Buffer.concat(ret, len) : ret.join(''); + }; + + stream.getBufferedLength = () => len; + + return stream; +}; diff --git a/node_modules/cacheable-request/node_modules/get-stream/index.js b/node_modules/cacheable-request/node_modules/get-stream/index.js new file mode 100644 index 0000000..2dc5ee9 --- /dev/null +++ b/node_modules/cacheable-request/node_modules/get-stream/index.js @@ -0,0 +1,51 @@ +'use strict'; +const bufferStream = require('./buffer-stream'); + +function getStream(inputStream, opts) { + if (!inputStream) { + return Promise.reject(new Error('Expected a stream')); + } + + opts = Object.assign({maxBuffer: Infinity}, opts); + + const maxBuffer = opts.maxBuffer; + let stream; + let clean; + + const p = new Promise((resolve, reject) => { + const error = err => { + if (err) { // null check + err.bufferedData = stream.getBufferedValue(); + } + + reject(err); + }; + + stream = bufferStream(opts); + inputStream.once('error', error); + inputStream.pipe(stream); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + reject(new Error('maxBuffer exceeded')); + } + }); + stream.once('error', error); + stream.on('end', resolve); + + clean = () => { + // some streams doesn't implement the `stream.Readable` interface correctly + if (inputStream.unpipe) { + inputStream.unpipe(stream); + } + }; + }); + + p.then(clean, clean); + + return p.then(() => stream.getBufferedValue()); +} + +module.exports = getStream; +module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'})); +module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true})); diff --git a/node_modules/decompress-tar/node_modules/is-stream/license b/node_modules/cacheable-request/node_modules/get-stream/license similarity index 100% rename from node_modules/decompress-tar/node_modules/is-stream/license rename to node_modules/cacheable-request/node_modules/get-stream/license diff --git a/node_modules/cacheable-request/node_modules/get-stream/package.json b/node_modules/cacheable-request/node_modules/get-stream/package.json new file mode 100644 index 0000000..963d727 --- /dev/null +++ b/node_modules/cacheable-request/node_modules/get-stream/package.json @@ -0,0 +1,83 @@ +{ + "_args": [ + [ + "get-stream@3.0.0", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "get-stream@3.0.0", + "_id": "get-stream@3.0.0", + "_inBundle": false, + "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "_location": "/cacheable-request/get-stream", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "get-stream@3.0.0", + "name": "get-stream", + "escapedName": "get-stream", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/cacheable-request" + ], + "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "_spec": "3.0.0", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/get-stream/issues" + }, + "description": "Get a stream as a string, buffer, or array", + "devDependencies": { + "ava": "*", + "into-stream": "^3.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "buffer-stream.js" + ], + "homepage": "https://github.com/sindresorhus/get-stream#readme", + "keywords": [ + "get", + "stream", + "promise", + "concat", + "string", + "str", + "text", + "buffer", + "read", + "data", + "consume", + "readable", + "readablestream", + "array", + "object", + "obj" + ], + "license": "MIT", + "name": "get-stream", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/get-stream.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/cacheable-request/node_modules/get-stream/readme.md b/node_modules/cacheable-request/node_modules/get-stream/readme.md new file mode 100644 index 0000000..73b188f --- /dev/null +++ b/node_modules/cacheable-request/node_modules/get-stream/readme.md @@ -0,0 +1,117 @@ +# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream) + +> Get a stream as a string, buffer, or array + + +## Install + +``` +$ npm install --save get-stream +``` + + +## Usage + +```js +const fs = require('fs'); +const getStream = require('get-stream'); +const stream = fs.createReadStream('unicorn.txt'); + +getStream(stream).then(str => { + console.log(str); + /* + ,,))))))));, + __)))))))))))))), + \|/ -\(((((''''((((((((. + -*-==//////(('' . `)))))), + /|\ ))| o ;-. '((((( ,(, + ( `| / ) ;))))' ,_))^;(~ + | | | ,))((((_ _____------~~~-. %,;(;(>';'~ + o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ + ; ''''```` `: `:::|\,__,%% );`'; ~ + | _ ) / `:|`----' `-' + ______/\/~ | / / + /~;;.____/;;' / ___--,-( `;;;/ + / // _;______;'------~~~~~ /;;/\ / + // | | / ; \;;,\ + (<_ | ; /',/-----' _> + \_| ||_ //~;~~~~~~~~~ + `\_| (,~~ + \~\ + ~~ + */ +}); +``` + + +## API + +The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. + +### getStream(stream, [options]) + +Get the `stream` as a string. + +#### options + +##### encoding + +Type: `string`
+Default: `utf8` + +[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. + +##### maxBuffer + +Type: `number`
+Default: `Infinity` + +Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected. + +### getStream.buffer(stream, [options]) + +Get the `stream` as a buffer. + +It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. + +### getStream.array(stream, [options]) + +Get the `stream` as an array of values. + +It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: + +- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). + +- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. + +- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. + + +## Errors + +If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. + +```js +getStream(streamThatErrorsAtTheEnd('unicorn')) + .catch(err => { + console.log(err.bufferedData); + //=> 'unicorn' + }); +``` + + +## FAQ + +### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? + +This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. + + +## Related + +- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/caw/index.js b/node_modules/caw/index.js deleted file mode 100644 index 69e7f55..0000000 --- a/node_modules/caw/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -const url = require('url'); -const getProxy = require('get-proxy'); -const isurl = require('isurl'); -const tunnelAgent = require('tunnel-agent'); -const urlToOptions = require('url-to-options'); - -module.exports = (proxy, opts) => { - proxy = proxy || getProxy(); - opts = Object.assign({}, opts); - - if (typeof proxy === 'object') { - opts = proxy; - proxy = getProxy(); - } - - if (!proxy) { - return null; - } - - proxy = isurl.lenient(proxy) ? urlToOptions(proxy) : url.parse(proxy); - - const uriProtocol = opts.protocol === 'https' ? 'https' : 'http'; - const proxyProtocol = proxy.protocol === 'https:' ? 'Https' : 'Http'; - const port = proxy.port || (proxyProtocol === 'Https' ? 443 : 80); - const method = `${uriProtocol}Over${proxyProtocol}`; - - delete opts.protocol; - - return tunnelAgent[method](Object.assign({ - proxy: { - port, - host: proxy.hostname, - proxyAuth: proxy.auth - } - }, opts)); -}; diff --git a/node_modules/caw/package.json b/node_modules/caw/package.json deleted file mode 100644 index 9adce97..0000000 --- a/node_modules/caw/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_args": [ - [ - "caw@2.0.1", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "caw@2.0.1", - "_id": "caw@2.0.1", - "_inBundle": false, - "_integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", - "_location": "/caw", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "caw@2.0.1", - "name": "caw", - "escapedName": "caw", - "rawSpec": "2.0.1", - "saveSpec": null, - "fetchSpec": "2.0.1" - }, - "_requiredBy": [ - "/download" - ], - "_resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", - "_spec": "2.0.1", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Kevin Mårtensson", - "email": "kevinmartensson@gmail.com", - "url": "github.com/kevva" - }, - "bugs": { - "url": "https://github.com/kevva/caw/issues" - }, - "dependencies": { - "get-proxy": "^2.0.0", - "isurl": "^1.0.0-alpha5", - "tunnel-agent": "^0.6.0", - "url-to-options": "^1.0.1" - }, - "description": "Construct HTTP/HTTPS agents for tunneling proxies", - "devDependencies": { - "ava": "*", - "create-cert": "^1.0.4", - "get-port": "^3.1.0", - "got": "^7.0.0", - "pify": "^3.0.0", - "proxyquire": "^1.7.9", - "sinon": "^2.3.1", - "universal-url": "1.0.0-alpha", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/kevva/caw#readme", - "keywords": [ - "http", - "https", - "proxy", - "tunnel" - ], - "license": "MIT", - "name": "caw", - "repository": { - "type": "git", - "url": "git+https://github.com/kevva/caw.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "2.0.1", - "xo": { - "rules": { - "ava/no-skip-test": 0 - } - } -} diff --git a/node_modules/caw/readme.md b/node_modules/caw/readme.md deleted file mode 100644 index 447191f..0000000 --- a/node_modules/caw/readme.md +++ /dev/null @@ -1,51 +0,0 @@ -# caw [![Build Status](https://travis-ci.org/kevva/caw.svg?branch=master)](https://travis-ci.org/kevva/caw) - -> Construct HTTP/HTTPS agents for tunneling proxies - - -## Install - -``` -$ npm install caw -``` - - -## Usage - -```js -const caw = require('caw'); -const got = require('got'); - -got('todomvc.com', { - agent: caw() -}, () => {}); -``` - - -## API - -### caw([proxy], [options]) - -#### proxy - -Type: `string` - -Proxy URL. If not set, it'll try getting it using [`get-proxy`](https://github.com/kevva/get-proxy). - -#### options - -Type: `Object` - -Besides the options below, you can pass in options allowed in [tunnel-agent](https://github.com/request/tunnel-agent). - -##### protocol - -Type: `string`
-Default: `http` - -Endpoint protocol. - - -## License - -MIT © [Kevin Mårtensson](https://github.com/kevva) diff --git a/node_modules/config-chain/LICENCE b/node_modules/config-chain/LICENCE deleted file mode 100644 index 171dd97..0000000 --- a/node_modules/config-chain/LICENCE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2011 Dominic Tarr - -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 diff --git a/node_modules/config-chain/index.js b/node_modules/config-chain/index.js deleted file mode 100755 index 0ef3a91..0000000 --- a/node_modules/config-chain/index.js +++ /dev/null @@ -1,282 +0,0 @@ -var ProtoList = require('proto-list') - , path = require('path') - , fs = require('fs') - , ini = require('ini') - , EE = require('events').EventEmitter - , url = require('url') - , http = require('http') - -var exports = module.exports = function () { - var args = [].slice.call(arguments) - , conf = new ConfigChain() - - while(args.length) { - var a = args.shift() - if(a) conf.push - ( 'string' === typeof a - ? json(a) - : a ) - } - - return conf -} - -//recursively find a file... - -var find = exports.find = function () { - var rel = path.join.apply(null, [].slice.call(arguments)) - - function find(start, rel) { - var file = path.join(start, rel) - try { - fs.statSync(file) - return file - } catch (err) { - if(path.dirname(start) !== start) // root - return find(path.dirname(start), rel) - } - } - return find(__dirname, rel) -} - -var parse = exports.parse = function (content, file, type) { - content = '' + content - // if we don't know what it is, try json and fall back to ini - // if we know what it is, then it must be that. - if (!type) { - try { return JSON.parse(content) } - catch (er) { return ini.parse(content) } - } else if (type === 'json') { - if (this.emit) { - try { return JSON.parse(content) } - catch (er) { this.emit('error', er) } - } else { - return JSON.parse(content) - } - } else { - return ini.parse(content) - } -} - -var json = exports.json = function () { - var args = [].slice.call(arguments).filter(function (arg) { return arg != null }) - var file = path.join.apply(null, args) - var content - try { - content = fs.readFileSync(file,'utf-8') - } catch (err) { - return - } - return parse(content, file, 'json') -} - -var env = exports.env = function (prefix, env) { - env = env || process.env - var obj = {} - var l = prefix.length - for(var k in env) { - if(k.indexOf(prefix) === 0) - obj[k.substring(l)] = env[k] - } - - return obj -} - -exports.ConfigChain = ConfigChain -function ConfigChain () { - EE.apply(this) - ProtoList.apply(this, arguments) - this._awaiting = 0 - this._saving = 0 - this.sources = {} -} - -// multi-inheritance-ish -var extras = { - constructor: { value: ConfigChain } -} -Object.keys(EE.prototype).forEach(function (k) { - extras[k] = Object.getOwnPropertyDescriptor(EE.prototype, k) -}) -ConfigChain.prototype = Object.create(ProtoList.prototype, extras) - -ConfigChain.prototype.del = function (key, where) { - // if not specified where, then delete from the whole chain, scorched - // earth style - if (where) { - var target = this.sources[where] - target = target && target.data - if (!target) { - return this.emit('error', new Error('not found '+where)) - } - delete target[key] - } else { - for (var i = 0, l = this.list.length; i < l; i ++) { - delete this.list[i][key] - } - } - return this -} - -ConfigChain.prototype.set = function (key, value, where) { - var target - - if (where) { - target = this.sources[where] - target = target && target.data - if (!target) { - return this.emit('error', new Error('not found '+where)) - } - } else { - target = this.list[0] - if (!target) { - return this.emit('error', new Error('cannot set, no confs!')) - } - } - target[key] = value - return this -} - -ConfigChain.prototype.get = function (key, where) { - if (where) { - where = this.sources[where] - if (where) where = where.data - if (where && Object.hasOwnProperty.call(where, key)) return where[key] - return undefined - } - return this.list[0][key] -} - -ConfigChain.prototype.save = function (where, type, cb) { - if (typeof type === 'function') cb = type, type = null - var target = this.sources[where] - if (!target || !(target.path || target.source) || !target.data) { - // TODO: maybe save() to a url target could be a PUT or something? - // would be easy to swap out with a reddis type thing, too - return this.emit('error', new Error('bad save target: '+where)) - } - - if (target.source) { - var pref = target.prefix || '' - Object.keys(target.data).forEach(function (k) { - target.source[pref + k] = target.data[k] - }) - return this - } - - var type = type || target.type - var data = target.data - if (target.type === 'json') { - data = JSON.stringify(data) - } else { - data = ini.stringify(data) - } - - this._saving ++ - fs.writeFile(target.path, data, 'utf8', function (er) { - this._saving -- - if (er) { - if (cb) return cb(er) - else return this.emit('error', er) - } - if (this._saving === 0) { - if (cb) cb() - this.emit('save') - } - }.bind(this)) - return this -} - -ConfigChain.prototype.addFile = function (file, type, name) { - name = name || file - var marker = {__source__:name} - this.sources[name] = { path: file, type: type } - this.push(marker) - this._await() - fs.readFile(file, 'utf8', function (er, data) { - if (er) this.emit('error', er) - this.addString(data, file, type, marker) - }.bind(this)) - return this -} - -ConfigChain.prototype.addEnv = function (prefix, env, name) { - name = name || 'env' - var data = exports.env(prefix, env) - this.sources[name] = { data: data, source: env, prefix: prefix } - return this.add(data, name) -} - -ConfigChain.prototype.addUrl = function (req, type, name) { - this._await() - var href = url.format(req) - name = name || href - var marker = {__source__:name} - this.sources[name] = { href: href, type: type } - this.push(marker) - http.request(req, function (res) { - var c = [] - var ct = res.headers['content-type'] - if (!type) { - type = ct.indexOf('json') !== -1 ? 'json' - : ct.indexOf('ini') !== -1 ? 'ini' - : href.match(/\.json$/) ? 'json' - : href.match(/\.ini$/) ? 'ini' - : null - marker.type = type - } - - res.on('data', c.push.bind(c)) - .on('end', function () { - this.addString(Buffer.concat(c), href, type, marker) - }.bind(this)) - .on('error', this.emit.bind(this, 'error')) - - }.bind(this)) - .on('error', this.emit.bind(this, 'error')) - .end() - - return this -} - -ConfigChain.prototype.addString = function (data, file, type, marker) { - data = this.parse(data, file, type) - this.add(data, marker) - return this -} - -ConfigChain.prototype.add = function (data, marker) { - if (marker && typeof marker === 'object') { - var i = this.list.indexOf(marker) - if (i === -1) { - return this.emit('error', new Error('bad marker')) - } - this.splice(i, 1, data) - marker = marker.__source__ - this.sources[marker] = this.sources[marker] || {} - this.sources[marker].data = data - // we were waiting for this. maybe emit 'load' - this._resolve() - } else { - if (typeof marker === 'string') { - this.sources[marker] = this.sources[marker] || {} - this.sources[marker].data = data - } - // trigger the load event if nothing was already going to do so. - this._await() - this.push(data) - process.nextTick(this._resolve.bind(this)) - } - return this -} - -ConfigChain.prototype.parse = exports.parse - -ConfigChain.prototype._await = function () { - this._awaiting++ -} - -ConfigChain.prototype._resolve = function () { - this._awaiting-- - if (this._awaiting === 0) this.emit('load', this) -} diff --git a/node_modules/config-chain/package.json b/node_modules/config-chain/package.json deleted file mode 100644 index bc93970..0000000 --- a/node_modules/config-chain/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_args": [ - [ - "config-chain@1.1.12", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "config-chain@1.1.12", - "_id": "config-chain@1.1.12", - "_inBundle": false, - "_integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", - "_location": "/config-chain", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "config-chain@1.1.12", - "name": "config-chain", - "escapedName": "config-chain", - "rawSpec": "1.1.12", - "saveSpec": null, - "fetchSpec": "1.1.12" - }, - "_requiredBy": [ - "/npm-conf" - ], - "_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", - "_spec": "1.1.12", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Dominic Tarr", - "email": "dominic.tarr@gmail.com", - "url": "http://dominictarr.com" - }, - "bugs": { - "url": "https://github.com/dominictarr/config-chain/issues" - }, - "dependencies": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - }, - "description": "HANDLE CONFIGURATION ONCE AND FOR ALL", - "devDependencies": { - "tap": "0.3.0" - }, - "files": [ - "index.js" - ], - "homepage": "http://github.com/dominictarr/config-chain", - "licenses": [ - { - "type": "MIT", - "url": "https://raw.githubusercontent.com/dominictarr/config-chain/master/LICENCE" - } - ], - "name": "config-chain", - "repository": { - "type": "git", - "url": "git+https://github.com/dominictarr/config-chain.git" - }, - "scripts": { - "test": "tap test/*" - }, - "version": "1.1.12" -} diff --git a/node_modules/config-chain/readme.markdown b/node_modules/config-chain/readme.markdown deleted file mode 100644 index 47f894c..0000000 --- a/node_modules/config-chain/readme.markdown +++ /dev/null @@ -1,257 +0,0 @@ -# config-chain - -A module for loading custom configurations - -## NOTE: Feature Freeze - -[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) - -This module is frozen. - -In general, we recommend using [rc](https://github.com/dominictarr/rc) instead, -but as [npm](https://github.com/npmjs/npm) depends on this, it cannot be changed. - - -## Install - -```sh -yarn add config-chain - -# npm users -npm install --save config-chain -``` - -## Usage - -```js -const cc = require('config-chain'); - -console.log(cc.env('TERM_', process.env)); -/* -{ SESSION_ID: 'w1:5F38', - PROGRAM_VERSION: '3.1.2', - PROGRAM: 'iTerm.app' } -*/ -``` - -The `.env` function gets all the keys on the provided object which are -prefixed by the specified prefix, removes the prefix, and puts the values on a new object. - -
- -## Full Usage - -``` js - - // npm install config-chain - - var cc = require('config-chain') - , opts = require('optimist').argv //ALWAYS USE OPTIMIST FOR COMMAND LINE OPTIONS. - , env = opts.env || process.env.YOUR_APP_ENV || 'dev' //SET YOUR ENV LIKE THIS. - - // EACH ARG TO CONFIGURATOR IS LOADED INTO CONFIGURATION CHAIN - // EARLIER ITEMS OVERIDE LATER ITEMS - // PUTS COMMAND LINE OPTS FIRST, AND DEFAULTS LAST! - - //strings are interpereted as filenames. - //will be loaded synchronously - - var conf = - cc( - //OVERRIDE SETTINGS WITH COMMAND LINE OPTS - opts, - - //ENV VARS IF PREFIXED WITH 'myApp_' - - cc.env('myApp_'), //myApp_foo = 'like this' - - //FILE NAMED BY ENV - path.join(__dirname, 'config.' + env + '.json'), - - //IF `env` is PRODUCTION - env === 'prod' - ? path.join(__dirname, 'special.json') //load a special file - : null //NULL IS IGNORED! - - //SUBDIR FOR ENV CONFIG - path.join(__dirname, 'config', env, 'config.json'), - - //SEARCH PARENT DIRECTORIES FROM CURRENT DIR FOR FILE - cc.find('config.json'), - - //PUT DEFAULTS LAST - { - host: 'localhost' - port: 8000 - }) - - var host = conf.get('host') - - // or - - var host = conf.store.host - -``` - -Finally, flexible configurations! 👌 - -## Custom Configuations - -```javascript -var cc = require('config-chain') - -// all the stuff you did before -var config = cc({ - some: 'object' - }, - cc.find('config.json'), - cc.env('myApp_') - ) - // CONFIGS AS A SERVICE, aka "CaaS", aka EVERY DEVOPS DREAM OMG! - .addUrl('http://configurator:1234/my-configs') - // ASYNC FTW! - .addFile('/path/to/file.json') - - // OBJECTS ARE OK TOO, they're SYNC but they still ORDER RIGHT - // BECAUSE PROMISES ARE USED BUT NO, NOT *THOSE* PROMISES, JUST - // ACTUAL PROMISES LIKE YOU MAKE TO YOUR MOM, KEPT OUT OF LOVE - .add({ another: 'object' }) - - // DIE A THOUSAND DEATHS IF THIS EVER HAPPENS!! - .on('error', function (er) { - // IF ONLY THERE WAS SOMETHIGN HARDER THAN THROW - // MY SORROW COULD BE ADEQUATELY EXPRESSED. /o\ - throw er - }) - - // THROW A PARTY IN YOUR FACE WHEN ITS ALL LOADED!! - .on('load', function (config) { - console.awesome('HOLY SHIT!') - }) -``` - -# API Docs - -## cc(...args) - -MAKE A CHAIN AND ADD ALL THE ARGS. - -If the arg is a STRING, then it shall be a JSON FILENAME. - -RETURN THE CHAIN! - -## cc.json(...args) - -Join the args into a JSON filename! - -SYNC I/O! - -## cc.find(relativePath) - -SEEK the RELATIVE PATH by climbing the TREE OF DIRECTORIES. - -RETURN THE FOUND PATH! - -SYNC I/O! - -## cc.parse(content, file, type) - -Parse the content string, and guess the type from either the -specified type or the filename. - -RETURN THE RESULTING OBJECT! - -NO I/O! - -## cc.env(prefix, env=process.env) - -Get all the keys on the provided object which are -prefixed by the specified prefix, removes the prefix, and puts the values on a new object. - -RETURN THE RESULTING OBJECT! - -NO I/O! - -## cc.ConfigChain() - -The ConfigChain class for CRAY CRAY JQUERY STYLE METHOD CHAINING! - -One of these is returned by the main exported function, as well. - -It inherits (prototypically) from -[ProtoList](https://github.com/isaacs/proto-list/), and also inherits -(parasitically) from -[EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter) - -It has all the methods from both, and except where noted, they are -unchanged. - -### LET IT BE KNOWN THAT chain IS AN INSTANCE OF ConfigChain. - -## chain.sources - -A list of all the places where it got stuff. The keys are the names -passed to addFile or addUrl etc, and the value is an object with some -info about the data source. - -## chain.addFile(filename, type, [name=filename]) - -Filename is the name of the file. Name is an arbitrary string to be -used later if you desire. Type is either 'ini' or 'json', and will -try to guess intelligently if omitted. - -Loaded files can be saved later. - -## chain.addUrl(url, type, [name=url]) - -Same as the filename thing, but with a url. - -Can't be saved later. - -## chain.addEnv(prefix, env, [name='env']) - -Add all the keys from the env object that start with the prefix. - -## chain.addString(data, file, type, [name]) - -Parse the string and add it to the set. (Mainly used internally.) - -## chain.add(object, [name]) - -Add the object to the set. - -## chain.root {Object} - -The root from which all the other config objects in the set descend -prototypically. - -Put your defaults here. - -## chain.set(key, value, name) - -Set the key to the value on the named config object. If name is -unset, then set it on the first config object in the set. (That is, -the one with the highest priority, which was added first.) - -## chain.get(key, [name]) - -Get the key from the named config object explicitly, or from the -resolved configs if not specified. - -## chain.save(name, type) - -Write the named config object back to its origin. - -Currently only supported for env and file config types. - -For files, encode the data according to the type. - -## chain.on('save', function () {}) - -When one or more files are saved, emits `save` event when they're all -saved. - -## chain.on('load', function (chain) {}) - -When the config chain has loaded all the specified files and urls and -such, the 'load' event fires. diff --git a/node_modules/decompress-tar/node_modules/is-stream/package.json b/node_modules/decompress-tar/node_modules/is-stream/package.json deleted file mode 100644 index 8e5a272..0000000 --- a/node_modules/decompress-tar/node_modules/is-stream/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_args": [ - [ - "is-stream@1.1.0", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "is-stream@1.1.0", - "_id": "is-stream@1.1.0", - "_inBundle": false, - "_integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "_location": "/decompress-tar/is-stream", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "is-stream@1.1.0", - "name": "is-stream", - "escapedName": "is-stream", - "rawSpec": "1.1.0", - "saveSpec": null, - "fetchSpec": "1.1.0" - }, - "_requiredBy": [ - "/decompress-tar" - ], - "_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "_spec": "1.1.0", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-stream/issues" - }, - "description": "Check if something is a Node.js stream", - "devDependencies": { - "ava": "*", - "tempfile": "^1.1.0", - "xo": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/is-stream#readme", - "keywords": [ - "stream", - "type", - "streams", - "writable", - "readable", - "duplex", - "transform", - "check", - "detect", - "is" - ], - "license": "MIT", - "name": "is-stream", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-stream.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.1.0" -} diff --git a/node_modules/decompress-tarbz2/node_modules/is-stream/index.js b/node_modules/decompress-tarbz2/node_modules/is-stream/index.js deleted file mode 100644 index 6f7ec91..0000000 --- a/node_modules/decompress-tarbz2/node_modules/is-stream/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var isStream = module.exports = function (stream) { - return stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function'; -}; - -isStream.writable = function (stream) { - return isStream(stream) && stream.writable !== false && typeof stream._write === 'function' && typeof stream._writableState === 'object'; -}; - -isStream.readable = function (stream) { - return isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object'; -}; - -isStream.duplex = function (stream) { - return isStream.writable(stream) && isStream.readable(stream); -}; - -isStream.transform = function (stream) { - return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object'; -}; diff --git a/node_modules/decompress-tarbz2/node_modules/is-stream/package.json b/node_modules/decompress-tarbz2/node_modules/is-stream/package.json deleted file mode 100644 index 255fec9..0000000 --- a/node_modules/decompress-tarbz2/node_modules/is-stream/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_args": [ - [ - "is-stream@1.1.0", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "is-stream@1.1.0", - "_id": "is-stream@1.1.0", - "_inBundle": false, - "_integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "_location": "/decompress-tarbz2/is-stream", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "is-stream@1.1.0", - "name": "is-stream", - "escapedName": "is-stream", - "rawSpec": "1.1.0", - "saveSpec": null, - "fetchSpec": "1.1.0" - }, - "_requiredBy": [ - "/decompress-tarbz2" - ], - "_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "_spec": "1.1.0", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-stream/issues" - }, - "description": "Check if something is a Node.js stream", - "devDependencies": { - "ava": "*", - "tempfile": "^1.1.0", - "xo": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/is-stream#readme", - "keywords": [ - "stream", - "type", - "streams", - "writable", - "readable", - "duplex", - "transform", - "check", - "detect", - "is" - ], - "license": "MIT", - "name": "is-stream", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-stream.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.1.0" -} diff --git a/node_modules/decompress-tarbz2/node_modules/is-stream/readme.md b/node_modules/decompress-tarbz2/node_modules/is-stream/readme.md deleted file mode 100644 index d8afce8..0000000 --- a/node_modules/decompress-tarbz2/node_modules/is-stream/readme.md +++ /dev/null @@ -1,42 +0,0 @@ -# is-stream [![Build Status](https://travis-ci.org/sindresorhus/is-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/is-stream) - -> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html) - - -## Install - -``` -$ npm install --save is-stream -``` - - -## Usage - -```js -const fs = require('fs'); -const isStream = require('is-stream'); - -isStream(fs.createReadStream('unicorn.png')); -//=> true - -isStream({}); -//=> false -``` - - -## API - -### isStream(stream) - -#### isStream.writable(stream) - -#### isStream.readable(stream) - -#### isStream.duplex(stream) - -#### isStream.transform(stream) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/decompress-targz/node_modules/is-stream/index.js b/node_modules/decompress-targz/node_modules/is-stream/index.js deleted file mode 100644 index 6f7ec91..0000000 --- a/node_modules/decompress-targz/node_modules/is-stream/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var isStream = module.exports = function (stream) { - return stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function'; -}; - -isStream.writable = function (stream) { - return isStream(stream) && stream.writable !== false && typeof stream._write === 'function' && typeof stream._writableState === 'object'; -}; - -isStream.readable = function (stream) { - return isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object'; -}; - -isStream.duplex = function (stream) { - return isStream.writable(stream) && isStream.readable(stream); -}; - -isStream.transform = function (stream) { - return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object'; -}; diff --git a/node_modules/decompress-targz/node_modules/is-stream/readme.md b/node_modules/decompress-targz/node_modules/is-stream/readme.md deleted file mode 100644 index d8afce8..0000000 --- a/node_modules/decompress-targz/node_modules/is-stream/readme.md +++ /dev/null @@ -1,42 +0,0 @@ -# is-stream [![Build Status](https://travis-ci.org/sindresorhus/is-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/is-stream) - -> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html) - - -## Install - -``` -$ npm install --save is-stream -``` - - -## Usage - -```js -const fs = require('fs'); -const isStream = require('is-stream'); - -isStream(fs.createReadStream('unicorn.png')); -//=> true - -isStream({}); -//=> false -``` - - -## API - -### isStream(stream) - -#### isStream.writable(stream) - -#### isStream.readable(stream) - -#### isStream.duplex(stream) - -#### isStream.transform(stream) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/decompress/index.js b/node_modules/decompress/index.js index 9193ebd..6aa67ca 100644 --- a/node_modules/decompress/index.js +++ b/node_modules/decompress/index.js @@ -19,6 +19,38 @@ const runPlugins = (input, opts) => { return Promise.all(opts.plugins.map(x => x(input, opts))).then(files => files.reduce((a, b) => a.concat(b))); }; +const safeMakeDir = (dir, realOutputPath) => { + return fsP.realpath(dir) + .catch(_ => { + const parent = path.dirname(dir); + return safeMakeDir(parent, realOutputPath); + }) + .then(realParentPath => { + if (realParentPath.indexOf(realOutputPath) !== 0) { + throw (new Error('Refusing to create a directory outside the output path.')); + } + + return makeDir(dir).then(fsP.realpath); + }); +}; + +const preventWritingThroughSymlink = (destination, realOutputPath) => { + return fsP.readlink(destination) + .catch(_ => { + // Either no file exists, or it's not a symlink. In either case, this is + // not an escape we need to worry about in this phase. + return null; + }) + .then(symlinkPointsTo => { + if (symlinkPointsTo) { + throw new Error('Refusing to write into a symlink'); + } + + // No symlink exists at `destination`, so we can continue + return realOutputPath; + }); +}; + const extractFile = (input, output, opts) => runPlugins(input, opts).then(files => { if (opts.strip > 0) { files = files @@ -47,12 +79,35 @@ const extractFile = (input, output, opts) => runPlugins(input, opts).then(files const now = new Date(); if (x.type === 'directory') { - return makeDir(dest) + return makeDir(output) + .then(outputPath => fsP.realpath(outputPath)) + .then(realOutputPath => safeMakeDir(dest, realOutputPath)) .then(() => fsP.utimes(dest, now, x.mtime)) .then(() => x); } - return makeDir(path.dirname(dest)) + return makeDir(output) + .then(outputPath => fsP.realpath(outputPath)) + .then(realOutputPath => { + // Attempt to ensure parent directory exists (failing if it's outside the output dir) + return safeMakeDir(path.dirname(dest), realOutputPath) + .then(() => realOutputPath); + }) + .then(realOutputPath => { + if (x.type === 'file') { + return preventWritingThroughSymlink(dest, realOutputPath); + } + + return realOutputPath; + }) + .then(realOutputPath => { + return fsP.realpath(path.dirname(dest)) + .then(realDestinationDir => { + if (realDestinationDir.indexOf(realOutputPath) !== 0) { + throw (new Error('Refusing to write outside output directory: ' + realDestinationDir)); + } + }); + }) .then(() => { if (x.type === 'link') { return fsP.link(x.linkname, dest); diff --git a/node_modules/decompress/license b/node_modules/decompress/license index a8ecbbe..db6bc32 100644 --- a/node_modules/decompress/license +++ b/node_modules/decompress/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License -Copyright (c) Kevin Mårtensson +Copyright (c) Kevin Mårtensson (github.com/kevva) -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: +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 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. +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/decompress/node_modules/make-dir/index.js b/node_modules/decompress/node_modules/make-dir/index.js new file mode 100644 index 0000000..1843955 --- /dev/null +++ b/node_modules/decompress/node_modules/make-dir/index.js @@ -0,0 +1,85 @@ +'use strict'; +const fs = require('fs'); +const path = require('path'); +const pify = require('pify'); + +const defaults = { + mode: 0o777 & (~process.umask()), + fs +}; + +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +const checkPath = pth => { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')); + + if (pathHasInvalidWinCharacters) { + const err = new Error(`Path contains invalid characters: ${pth}`); + err.code = 'EINVAL'; + throw err; + } + } +}; + +module.exports = (input, opts) => Promise.resolve().then(() => { + checkPath(input); + opts = Object.assign({}, defaults, opts); + + const mkdir = pify(opts.fs.mkdir); + const stat = pify(opts.fs.stat); + + const make = pth => { + return mkdir(pth, opts.mode) + .then(() => pth) + .catch(err => { + if (err.code === 'ENOENT') { + if (err.message.includes('null bytes') || path.dirname(pth) === pth) { + throw err; + } + + return make(path.dirname(pth)).then(() => make(pth)); + } + + return stat(pth) + .then(stats => stats.isDirectory() ? pth : Promise.reject()) + .catch(() => { + throw err; + }); + }); + }; + + return make(path.resolve(input)); +}); + +module.exports.sync = (input, opts) => { + checkPath(input); + opts = Object.assign({}, defaults, opts); + + const make = pth => { + try { + opts.fs.mkdirSync(pth, opts.mode); + } catch (err) { + if (err.code === 'ENOENT') { + if (err.message.includes('null bytes') || path.dirname(pth) === pth) { + throw err; + } + + make(path.dirname(pth)); + return make(pth); + } + + try { + if (!opts.fs.statSync(pth).isDirectory()) { + throw new Error('The path is not a directory'); + } + } catch (_) { + throw err; + } + } + + return pth; + }; + + return make(path.resolve(input)); +}; diff --git a/node_modules/download/node_modules/file-type/license b/node_modules/decompress/node_modules/make-dir/license similarity index 100% rename from node_modules/download/node_modules/file-type/license rename to node_modules/decompress/node_modules/make-dir/license diff --git a/node_modules/decompress/node_modules/make-dir/node_modules/pify/index.js b/node_modules/decompress/node_modules/make-dir/node_modules/pify/index.js new file mode 100644 index 0000000..1dee43a --- /dev/null +++ b/node_modules/decompress/node_modules/make-dir/node_modules/pify/index.js @@ -0,0 +1,84 @@ +'use strict'; + +const processFn = (fn, opts) => function () { + const P = opts.promiseModule; + const args = new Array(arguments.length); + + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P((resolve, reject) => { + if (opts.errorFirst) { + args.push(function (err, result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + if (err) { + results.unshift(err); + reject(results); + } else { + resolve(results); + } + } else if (err) { + reject(err); + } else { + resolve(result); + } + }); + } else { + args.push(function (result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 0; i < arguments.length; i++) { + results[i] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + } + + fn.apply(this, args); + }); +}; + +module.exports = (obj, opts) => { + opts = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, opts); + + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + let ret; + if (typeof obj === 'function') { + ret = function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, opts).apply(this, arguments); + }; + } else { + ret = Object.create(Object.getPrototypeOf(obj)); + } + + for (const key in obj) { // eslint-disable-line guard-for-in + const x = obj[key]; + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, opts) : x; + } + + return ret; +}; diff --git a/node_modules/get-proxy/license b/node_modules/decompress/node_modules/make-dir/node_modules/pify/license similarity index 92% rename from node_modules/get-proxy/license rename to node_modules/decompress/node_modules/make-dir/node_modules/pify/license index db6bc32..e7af2f7 100644 --- a/node_modules/get-proxy/license +++ b/node_modules/decompress/node_modules/make-dir/node_modules/pify/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Kevin Mårtensson (github.com/kevva) +Copyright (c) Sindre Sorhus (sindresorhus.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: diff --git a/node_modules/decompress/node_modules/make-dir/node_modules/pify/package.json b/node_modules/decompress/node_modules/make-dir/node_modules/pify/package.json new file mode 100644 index 0000000..edfe4f0 --- /dev/null +++ b/node_modules/decompress/node_modules/make-dir/node_modules/pify/package.json @@ -0,0 +1,86 @@ +{ + "_args": [ + [ + "pify@3.0.0", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "pify@3.0.0", + "_id": "pify@3.0.0", + "_inBundle": false, + "_integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "_location": "/decompress/make-dir/pify", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pify@3.0.0", + "name": "pify", + "escapedName": "pify", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/decompress/make-dir" + ], + "_resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "_spec": "3.0.0", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/pify/issues" + }, + "description": "Promisify a callback-style function", + "devDependencies": { + "ava": "*", + "pinkie-promise": "^2.0.0", + "v8-natives": "^1.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/pify#readme", + "keywords": [ + "promise", + "promises", + "promisify", + "all", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "await", + "es2015", + "bluebird" + ], + "license": "MIT", + "name": "pify", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/pify.git" + }, + "scripts": { + "optimization-test": "node --allow-natives-syntax optimization-test.js", + "test": "xo && ava && npm run optimization-test" + }, + "version": "3.0.0" +} diff --git a/node_modules/decompress/node_modules/make-dir/node_modules/pify/readme.md b/node_modules/decompress/node_modules/make-dir/node_modules/pify/readme.md new file mode 100644 index 0000000..376ca4e --- /dev/null +++ b/node_modules/decompress/node_modules/make-dir/node_modules/pify/readme.md @@ -0,0 +1,131 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// Promisify a single function +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// Promisify all methods in a module +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [options]) + +Returns a `Promise` wrapped version of the supplied function or module. + +#### input + +Type: `Function` `Object` + +Callback-style function or module whose methods you want to promisify. + +#### options + +##### multiArgs + +Type: `boolean`
+Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `string[]` `RegExp[]` + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `string[]` `RegExp[]`
+Default: `[/.+(Sync|Stream)$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean`
+Default: `false` + +If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(null, data); + }); +}; + +// Promisify methods but not `fn()` +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + +##### errorFirst + +Type: `boolean`
+Default: `true` + +Whether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc. + +##### promiseModule + +Type: `Function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + + +## Related + +- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/decompress/node_modules/make-dir/package.json b/node_modules/decompress/node_modules/make-dir/package.json new file mode 100644 index 0000000..bee867e --- /dev/null +++ b/node_modules/decompress/node_modules/make-dir/package.json @@ -0,0 +1,89 @@ +{ + "_args": [ + [ + "make-dir@1.3.0", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "make-dir@1.3.0", + "_id": "make-dir@1.3.0", + "_inBundle": false, + "_integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "_location": "/decompress/make-dir", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "make-dir@1.3.0", + "name": "make-dir", + "escapedName": "make-dir", + "rawSpec": "1.3.0", + "saveSpec": null, + "fetchSpec": "1.3.0" + }, + "_requiredBy": [ + "/decompress" + ], + "_resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "_spec": "1.3.0", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/make-dir/issues" + }, + "dependencies": { + "pify": "^3.0.0" + }, + "description": "Make a directory and its parents if needed - Think `mkdir -p`", + "devDependencies": { + "ava": "*", + "codecov": "^3.0.0", + "graceful-fs": "^4.1.11", + "nyc": "^11.3.0", + "path-type": "^3.0.0", + "tempy": "^0.2.1", + "xo": "^0.20.0" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/make-dir#readme", + "keywords": [ + "mkdir", + "mkdirp", + "make", + "directories", + "dir", + "dirs", + "folders", + "directory", + "folder", + "path", + "parent", + "parents", + "intermediate", + "recursively", + "recursive", + "create", + "fs", + "filesystem", + "file-system" + ], + "license": "MIT", + "name": "make-dir", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/make-dir.git" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "version": "1.3.0" +} diff --git a/node_modules/decompress/node_modules/make-dir/readme.md b/node_modules/decompress/node_modules/make-dir/readme.md new file mode 100644 index 0000000..8a32bf4 --- /dev/null +++ b/node_modules/decompress/node_modules/make-dir/readme.md @@ -0,0 +1,116 @@ +# make-dir [![Build Status: macOS & Linux](https://travis-ci.org/sindresorhus/make-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/make-dir) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/e0vtt8y600w91gcs/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/make-dir/branch/master) [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir) + +> Make a directory and its parents if needed - Think `mkdir -p` + + +## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp) + +- Promise API *(Async/await ready!)* +- Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66) +- 100% test coverage +- CI-tested on macOS, Linux, and Windows +- Actively maintained +- Doesn't bundle a CLI + + +## Install + +``` +$ npm install make-dir +``` + + +## Usage + +``` +$ pwd +/Users/sindresorhus/fun +$ tree +. +``` + +```js +const makeDir = require('make-dir'); + +makeDir('unicorn/rainbow/cake').then(path => { + console.log(path); + //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake' +}); +``` + +``` +$ tree +. +└── unicorn + └── rainbow + └── cake +``` + +Multiple directories: + +```js +const makeDir = require('make-dir'); + +Promise.all([ + makeDir('unicorn/rainbow') + makeDir('foo/bar') +]).then(paths => { + console.log(paths); + /* + [ + '/Users/sindresorhus/fun/unicorn/rainbow', + '/Users/sindresorhus/fun/foo/bar' + ] + */ +}); +``` + + +## API + +### makeDir(path, [options]) + +Returns a `Promise` for the path to the created directory. + +### makeDir.sync(path, [options]) + +Returns the path to the created directory. + +#### path + +Type: `string` + +Directory to create. + +#### options + +Type: `Object` + +##### mode + +Type: `integer`
+Default: `0o777 & (~process.umask())` + +Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). + +##### fs + +Type: `Object`
+Default: `require('fs')` + +Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + + +## Related + +- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module +- [del](https://github.com/sindresorhus/del) - Delete files and directories +- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching +- [cpy](https://github.com/sindresorhus/cpy) - Copy files +- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line +- [move-file](https://github.com/sindresorhus/move-file) - Move a file + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/decompress/package.json b/node_modules/decompress/package.json index 1dde3c5..a6abf07 100644 --- a/node_modules/decompress/package.json +++ b/node_modules/decompress/package.json @@ -1,37 +1,42 @@ { "_args": [ [ - "decompress@4.2.0", + "decompress@4.2.1", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "decompress@4.2.0", - "_id": "decompress@4.2.0", + "_from": "decompress@4.2.1", + "_id": "decompress@4.2.1", "_inBundle": false, - "_integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", + "_integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", "_location": "/decompress", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "decompress@4.2.0", + "raw": "decompress@4.2.1", "name": "decompress", "escapedName": "decompress", - "rawSpec": "4.2.0", + "rawSpec": "4.2.1", "saveSpec": null, - "fetchSpec": "4.2.0" + "fetchSpec": "4.2.1" }, "_requiredBy": [ "/download" ], - "_resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz", - "_spec": "4.2.0", + "_resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "_spec": "4.2.1", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Kevin Mårtensson", "email": "kevinmartensson@gmail.com", "url": "github.com/kevva" }, + "ava": { + "require": [ + "esm" + ] + }, "bugs": { "url": "https://github.com/kevva/decompress/issues" }, @@ -48,9 +53,11 @@ "description": "Extracting archives made easy", "devDependencies": { "ava": "*", + "esm": "^3.2.25", "is-jpg": "^1.0.0", "path-exists": "^3.0.0", "pify": "^2.3.0", + "rimraf": "^3.0.2", "xo": "*" }, "engines": { @@ -80,5 +87,10 @@ "scripts": { "test": "xo && ava" }, - "version": "4.2.0" + "version": "4.2.1", + "xo": { + "rules": { + "promise/prefer-await-to-then": "off" + } + } } diff --git a/node_modules/decompress/readme.md b/node_modules/decompress/readme.md index 3855419..fd23f91 100644 --- a/node_modules/decompress/readme.md +++ b/node_modules/decompress/readme.md @@ -7,7 +7,7 @@ ## Install ``` -$ npm install --save decompress +$ npm install decompress ``` @@ -66,6 +66,8 @@ decompress('unicorn.zip', 'dist', { }); ``` +*Note that in the current implementation, **`filter` is only applied after fully reading all files from the archive in memory**. Do not rely on this option to limit the amount of memory used by `decompress` to the size of the files included by `filter`. `decompress` will read the entire compressed file into memory regardless.* + ##### map Type: `Function` diff --git a/node_modules/download/index.js b/node_modules/download/index.js index 342ff47..e8dbda5 100644 --- a/node_modules/download/index.js +++ b/node_modules/download/index.js @@ -1,8 +1,7 @@ 'use strict'; const fs = require('fs'); const path = require('path'); -const url = require('url'); -const caw = require('caw'); +const {URL} = require('url'); const contentDisposition = require('content-disposition'); const archiveType = require('archive-type'); const decompress = require('decompress'); @@ -16,7 +15,7 @@ const fileType = require('file-type'); const extName = require('ext-name'); const fsP = pify(fs); -const filenameFromPath = res => path.basename(url.parse(res.requestUrl).pathname); +const filenameFromPath = res => path.basename(new URL(res.requestUrl).pathname); const getExtFromMime = res => { const header = res.headers['content-type']; @@ -58,37 +57,18 @@ const getFilename = (res, data) => { return filename; }; -const getProtocolFromUri = uri => { - let {protocol} = url.parse(uri); - - if (protocol) { - protocol = protocol.slice(0, -1); - } - - return protocol; -}; - module.exports = (uri, output, opts) => { if (typeof output === 'object') { opts = output; output = null; } - const protocol = getProtocolFromUri(uri); - opts = Object.assign({ encoding: null, rejectUnauthorized: process.env.npm_config_strict_ssl !== 'false' }, opts); - const agent = caw(opts.proxy, {protocol}); - const stream = got.stream(uri, Object.assign({agent}, opts)) - .on('redirect', (response, nextOptions) => { - const redirectProtocol = getProtocolFromUri(nextOptions.href); - if (redirectProtocol && redirectProtocol !== protocol) { - nextOptions.agent = caw(opts.proxy, {protocol: redirectProtocol}); - } - }); + const stream = got.stream(uri, opts); const promise = pEvent(stream, 'response').then(res => { const encoding = opts.encoding === null ? 'buffer' : opts.encoding; diff --git a/node_modules/download/package.json b/node_modules/download/package.json index 6f86270..e3a2c3d 100644 --- a/node_modules/download/package.json +++ b/node_modules/download/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "download@7.1.0", + "download@8.0.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "download@7.1.0", - "_id": "download@7.1.0", + "_from": "download@8.0.0", + "_id": "download@8.0.0", "_inBundle": false, - "_integrity": "sha512-xqnBTVd/E+GxJVrX5/eUJiLYjCGPwMpdL+jGhGU57BvtcA7wwhtHVbXBeUk51kOpW3S7Jn3BQbN9Q1R1Km2qDQ==", + "_integrity": "sha512-ASRY5QhDk7FK+XrQtQyvhpDKanLluEEQtWl/J7Lxuf/b+i8RYh997QeXvL85xitrmRKVlx9c7eTrcRdq2GS4eA==", "_location": "/download", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "download@7.1.0", + "raw": "download@8.0.0", "name": "download", "escapedName": "download", - "rawSpec": "7.1.0", + "rawSpec": "8.0.0", "saveSpec": null, - "fetchSpec": "7.1.0" + "fetchSpec": "8.0.0" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/download/-/download-7.1.0.tgz", - "_spec": "7.1.0", + "_resolved": "https://registry.npmjs.org/download/-/download-8.0.0.tgz", + "_spec": "8.0.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Kevin Mårtensson", @@ -37,30 +37,29 @@ }, "dependencies": { "archive-type": "^4.0.0", - "caw": "^2.0.1", "content-disposition": "^0.5.2", - "decompress": "^4.2.0", + "decompress": "^4.2.1", "ext-name": "^5.0.0", - "file-type": "^8.1.0", - "filenamify": "^2.0.0", - "get-stream": "^3.0.0", + "file-type": "^11.1.0", + "filenamify": "^3.0.0", + "get-stream": "^4.1.0", "got": "^8.3.1", - "make-dir": "^1.2.0", + "make-dir": "^2.1.0", "p-event": "^2.1.0", - "pify": "^3.0.0" + "pify": "^4.0.1" }, "description": "Download and extract files", "devDependencies": { - "ava": "*", + "ava": "^1.4.1", "is-zip": "^1.0.0", - "nock": "^9.2.5", + "nock": "^10.0.6", "path-exists": "^3.0.0", "random-buffer": "^0.1.0", - "rimraf": "^2.6.2", - "xo": "*" + "rimraf": "^3.0.0", + "xo": "^0.24.0" }, "engines": { - "node": ">=6" + "node": ">=10" }, "files": [ "index.js" @@ -82,5 +81,5 @@ "scripts": { "test": "xo && ava" }, - "version": "7.1.0" + "version": "8.0.0" } diff --git a/node_modules/download/readme.md b/node_modules/download/readme.md index dfb3fcf..892470f 100644 --- a/node_modules/download/readme.md +++ b/node_modules/download/readme.md @@ -18,28 +18,28 @@ $ npm install download const fs = require('fs'); const download = require('download'); -download('http://unicorn.com/foo.jpg', 'dist').then(() => { - console.log('done!'); -}); +(async () => { + await download('http://unicorn.com/foo.jpg', 'dist'); -download('http://unicorn.com/foo.jpg').then(data => { - fs.writeFileSync('dist/foo.jpg', data); -}); + fs.writeFileSync('dist/foo.jpg', await download('http://unicorn.com/foo.jpg')); -download('unicorn.com/foo.jpg').pipe(fs.createWriteStream('dist/foo.jpg')); + download('unicorn.com/foo.jpg').pipe(fs.createWriteStream('dist/foo.jpg')); -Promise.all([ - 'unicorn.com/foo.jpg', - 'cats.com/dancing.gif' -].map(x => download(x, 'dist'))).then(() => { - console.log('files downloaded!'); -}); + await Promise.all([ + 'unicorn.com/foo.jpg', + 'cats.com/dancing.gif' + ].map(url => download(url, 'dist'))); +})(); ``` +### Proxies + +To work with proxies, read the [`got documentation`](https://github.com/sindresorhus/got#proxies). + ## API -### download(url, [destination], [options]) +### download(url, destination?, options?) Returns both a `Promise` and a [Duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) with [additional events](https://github.com/sindresorhus/got#streams-1). @@ -73,14 +73,3 @@ If set to `true`, try extracting the file using [`decompress`](https://github.co Type: `string` Name of the saved file. - -##### proxy - -Type: `string` - -Proxy endpoint. - - -## License - -MIT © [Kevin Mårtensson](https://github.com/kevva) diff --git a/node_modules/file-type/index.d.ts b/node_modules/file-type/index.d.ts new file mode 100644 index 0000000..9810aa9 --- /dev/null +++ b/node_modules/file-type/index.d.ts @@ -0,0 +1,205 @@ +/// +import {Readable as ReadableStream} from 'stream'; + +declare namespace fileType { + type FileType = + | 'jpg' + | 'png' + | 'gif' + | 'webp' + | 'flif' + | 'cr2' + | 'orf' + | 'arw' + | 'dng' + | 'nef' + | 'tif' + | 'bmp' + | 'jxr' + | 'psd' + | 'zip' + | 'tar' + | 'rar' + | 'gz' + | 'bz2' + | '7z' + | 'dmg' + | 'mp4' + | 'mid' + | 'mkv' + | 'webm' + | 'mov' + | 'avi' + | 'wmv' + | 'mpg' + | 'mp2' + | 'mp3' + | 'm4a' + | 'ogg' + | 'opus' + | 'flac' + | 'wav' + | 'qcp' + | 'amr' + | 'pdf' + | 'epub' + | 'mobi' + | 'exe' + | 'swf' + | 'rtf' + | 'woff' + | 'woff2' + | 'eot' + | 'ttf' + | 'otf' + | 'ico' + | 'flv' + | 'ps' + | 'xz' + | 'sqlite' + | 'nes' + | 'crx' + | 'xpi' + | 'cab' + | 'deb' + | 'ar' + | 'rpm' + | 'Z' + | 'lz' + | 'msi' + | 'mxf' + | 'mts' + | 'wasm' + | 'blend' + | 'bpg' + | 'docx' + | 'pptx' + | 'xlsx' + | '3gp' + | '3g2' + | 'jp2' + | 'jpm' + | 'jpx' + | 'mj2' + | 'aif' + | 'odt' + | 'ods' + | 'odp' + | 'xml' + | 'heic' + | 'cur' + | 'ktx' + | 'ape' + | 'wv' + | 'asf' + | 'wma' + | 'wmv' + | 'dcm' + | 'mpc' + | 'ics' + | 'glb' + | 'pcap' + | 'dsf' + | 'lnk' + | 'alias' + | 'voc' + | 'ac3' + | 'm4a' + | 'm4b' + | 'm4p' + | 'm4v' + | 'f4a' + | 'f4b' + | 'f4p' + | 'f4v'; + + interface FileTypeResult { + /** + One of the supported [file types](https://github.com/sindresorhus/file-type#supported-file-types). + */ + ext: FileType; + + /** + The detected [MIME type](https://en.wikipedia.org/wiki/Internet_media_type). + */ + mime: string; + } + + type ReadableStreamWithFileType = ReadableStream & { + readonly fileType?: FileTypeResult; + }; +} + +declare const fileType: { + /** + Detect the file type of a `Buffer`/`Uint8Array`/`ArrayBuffer`. The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + + @param buffer - It only needs the first `.minimumBytes` bytes. The exception is detection of `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file. + @returns The detected file type and MIME type or `undefined` when there was no match. + + @example + ``` + import readChunk = require('read-chunk'); + import fileType = require('file-type'); + + const buffer = readChunk.sync('unicorn.png', 0, fileType.minimumBytes); + + fileType(buffer); + //=> {ext: 'png', mime: 'image/png'} + + + // Or from a remote location: + + import * as http from 'http'; + + const url = 'https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; + + http.get(url, response => { + response.on('readable', () => { + const chunk = response.read(fileType.minimumBytes); + response.destroy(); + console.log(fileType(chunk)); + //=> {ext: 'gif', mime: 'image/gif'} + }); + }); + ``` + */ + (buffer: Buffer | Uint8Array | ArrayBuffer): fileType.FileTypeResult | undefined; + + /** + The minimum amount of bytes needed to detect a file type. Currently, it's 4100 bytes, but it can change, so don't hard-code it. + */ + readonly minimumBytes: number; + + /** + Detect the file type of a readable stream. + + @param readableStream - A readable stream containing a file to examine, see: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). + @returns A `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileType()`. + + @example + ``` + import * as fs from 'fs'; + import * as crypto from 'crypto'; + import fileType = require('file-type'); + + (async () => { + const read = fs.createReadStream('encrypted.enc'); + const decipher = crypto.createDecipheriv(alg, key, iv); + + const stream = await fileType.stream(read.pipe(decipher)); + + console.log(stream.fileType); + //=> {ext: 'mov', mime: 'video/quicktime'} + + const write = fs.createWriteStream(`decrypted.${stream.fileType.ext}`); + stream.pipe(write); + })(); + ``` + */ + readonly stream: ( + readableStream: ReadableStream + ) => Promise; +}; + +export = fileType; diff --git a/node_modules/download/node_modules/file-type/index.js b/node_modules/file-type/index.js similarity index 55% rename from node_modules/download/node_modules/file-type/index.js rename to node_modules/file-type/index.js index 669fb55..a519ec8 100644 --- a/node_modules/download/node_modules/file-type/index.js +++ b/node_modules/file-type/index.js @@ -1,14 +1,19 @@ 'use strict'; -const toBytes = s => [...s].map(c => c.charCodeAt(0)); -const xpiZipFilename = toBytes('META-INF/mozilla.rsa'); -const oxmlContentTypes = toBytes('[Content_Types].xml'); -const oxmlRels = toBytes('_rels/.rels'); +const {stringToBytes, readUInt64LE, tarHeaderChecksumMatches, uint8ArrayUtf8ByteString} = require('./util'); -module.exports = input => { - const buf = input instanceof Uint8Array ? input : new Uint8Array(input); +const xpiZipFilename = stringToBytes('META-INF/mozilla.rsa'); +const oxmlContentTypes = stringToBytes('[Content_Types].xml'); +const oxmlRels = stringToBytes('_rels/.rels'); - if (!(buf && buf.length > 1)) { - return null; +const fileType = input => { + if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) { + throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof input}\``); + } + + const buffer = input instanceof Uint8Array ? input : new Uint8Array(input); + + if (!(buffer && buffer.length > 1)) { + return; } const check = (header, options) => { @@ -20,10 +25,10 @@ module.exports = input => { // If a bitmask is set if (options.mask) { // If header doesn't equal `buf` with bits masked off - if (header[i] !== (options.mask[i] & buf[i + options.offset])) { + if (header[i] !== (options.mask[i] & buffer[i + options.offset])) { return false; } - } else if (header[i] !== buf[i + options.offset]) { + } else if (header[i] !== buffer[i + options.offset]) { return false; } } @@ -31,7 +36,7 @@ module.exports = input => { return true; }; - const checkString = (header, options) => check(toBytes(header), options); + const checkString = (header, options) => check(stringToBytes(header), options); if (check([0xFF, 0xD8, 0xFF])) { return { @@ -68,7 +73,7 @@ module.exports = input => { }; } - // Needs to be before `tif` check + // `cr2`, `orf`, and `arw` need to be before `tif` check if ( (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && check([0x43, 0x52], {offset: 8}) @@ -79,6 +84,34 @@ module.exports = input => { }; } + if (check([0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18])) { + return { + ext: 'orf', + mime: 'image/x-olympus-orf' + }; + } + + if (check([0x49, 0x49, 0x2A, 0x00, 0x10, 0xFB, 0x86, 0x01])) { + return { + ext: 'arw', + mime: 'image/x-sony-arw' + }; + } + + if (check([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2D])) { + return { + ext: 'dng', + mime: 'image/x-adobe-dng' + }; + } + + if (check([0x49, 0x49, 0x2A, 0x00, 0x30, 0x3D, 0x72, 0x01, 0x1C])) { + return { + ext: 'nef', + mime: 'image/x-nikon-nef' + }; + } + if ( check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A]) @@ -151,48 +184,61 @@ module.exports = input => { }; } - // https://github.com/file/file/blob/master/magic/Magdir/msooxml - if (check(oxmlContentTypes, {offset: 30}) || check(oxmlRels, {offset: 30})) { - const sliced = buf.subarray(4, 4 + 2000); - const nextZipHeaderIndex = arr => arr.findIndex((el, i, arr) => arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4); - const header2Pos = nextZipHeaderIndex(sliced); + // The docx, xlsx and pptx file types extend the Office Open XML file format: + // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats + // We look for: + // - one entry named '[Content_Types].xml' or '_rels/.rels', + // - one entry indicating specific type of file. + // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. + const findNextZipHeaderIndex = (arr, startAt = 0) => arr.findIndex((el, i, arr) => i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4); - if (header2Pos !== -1) { - const slicedAgain = buf.subarray(header2Pos + 8, header2Pos + 8 + 1000); - const header3Pos = nextZipHeaderIndex(slicedAgain); + let zipHeaderIndex = 0; // The first zip header was already found at index 0 + let oxmlFound = false; + let type; - if (header3Pos !== -1) { - const offset = 8 + header2Pos + header3Pos + 30; + do { + const offset = zipHeaderIndex + 30; - if (checkString('word/', {offset})) { - return { - ext: 'docx', - mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - }; - } + if (!oxmlFound) { + oxmlFound = (check(oxmlContentTypes, {offset}) || check(oxmlRels, {offset})); + } - if (checkString('ppt/', {offset})) { - return { - ext: 'pptx', - mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - }; - } - - if (checkString('xl/', {offset})) { - return { - ext: 'xlsx', - mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - }; - } + if (!type) { + if (checkString('word/', {offset})) { + type = { + ext: 'docx', + mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + }; + } else if (checkString('ppt/', {offset})) { + type = { + ext: 'pptx', + mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + }; + } else if (checkString('xl/', {offset})) { + type = { + ext: 'xlsx', + mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }; } } + + if (oxmlFound && type) { + return type; + } + + zipHeaderIndex = findNextZipHeaderIndex(buffer, offset); + } while (zipHeaderIndex >= 0); + + // No more zip parts available in the buffer, but maybe we are almost certain about the type? + if (type) { + return type; } } if ( check([0x50, 0x4B]) && - (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && - (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8) + (buffer[2] === 0x3 || buffer[2] === 0x5 || buffer[2] === 0x7) && + (buffer[3] === 0x4 || buffer[3] === 0x6 || buffer[3] === 0x8) ) { return { ext: 'zip', @@ -200,7 +246,10 @@ module.exports = input => { }; } - if (check([0x75, 0x73, 0x74, 0x61, 0x72], {offset: 257})) { + if ( + check([0x30, 0x30, 0x30, 0x30, 0x30, 0x30], {offset: 148, mask: [0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8]}) && // Valid tar checksum + tarHeaderChecksumMatches(buffer) + ) { return { ext: 'tar', mime: 'application/x-tar' @@ -209,7 +258,7 @@ module.exports = input => { if ( check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && - (buf[6] === 0x0 || buf[6] === 0x1) + (buffer[6] === 0x0 || buffer[6] === 0x1) ) { return { ext: 'rar', @@ -245,25 +294,70 @@ module.exports = input => { }; } - if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5 - ( - check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], {offset: 4}) && - ( - check([0x6D, 0x70, 0x34, 0x31], {offset: 8}) || // MP41 - check([0x6D, 0x70, 0x34, 0x32], {offset: 8}) || // MP42 - check([0x69, 0x73, 0x6F, 0x6D], {offset: 8}) || // ISOM - check([0x69, 0x73, 0x6F, 0x32], {offset: 8}) || // ISO2 - check([0x6D, 0x6D, 0x70, 0x34], {offset: 8}) || // MMP4 - check([0x4D, 0x34, 0x56], {offset: 8}) || // M4V - check([0x64, 0x61, 0x73, 0x68], {offset: 8}) // DASH - ) - )) { + // `mov` format variants + if ( + check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || // `free` + check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // `mdat` MJPEG + check([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) || // `moov` + check([0x77, 0x69, 0x64, 0x65], {offset: 4}) // `wide` + ) { return { - ext: 'mp4', - mime: 'video/mp4' + ext: 'mov', + mime: 'video/quicktime' }; } + // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format) + // It's not required to be first, but it's recommended to be. Almost all ISO base media files start with `ftyp` box. + // `ftyp` box must contain a brand major identifier, which must consist of ISO 8859-1 printable characters. + // Here we check for 8859-1 printable characters (for simplicity, it's a mask which also catches one non-printable character). + if ( + check([0x66, 0x74, 0x79, 0x70], {offset: 4}) && // `ftyp` + (buffer[8] & 0x60) !== 0x00 && (buffer[9] & 0x60) !== 0x00 && (buffer[10] & 0x60) !== 0x00 && (buffer[11] & 0x60) !== 0x00 // Brand major + ) { + // They all can have MIME `video/mp4` except `application/mp4` special-case which is hard to detect. + // For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension. + const brandMajor = uint8ArrayUtf8ByteString(buffer, 8, 12); + switch (brandMajor) { + case 'mif1': + return {ext: 'heic', mime: 'image/heif'}; + case 'msf1': + return {ext: 'heic', mime: 'image/heif-sequence'}; + case 'heic': case 'heix': + return {ext: 'heic', mime: 'image/heic'}; + case 'hevc': case 'hevx': + return {ext: 'heic', mime: 'image/heic-sequence'}; + case 'qt ': + return {ext: 'mov', mime: 'video/quicktime'}; + case 'M4V ': case 'M4VH': case 'M4VP': + return {ext: 'm4v', mime: 'video/x-m4v'}; + case 'M4P ': + return {ext: 'm4p', mime: 'video/mp4'}; + case 'M4B ': + return {ext: 'm4b', mime: 'audio/mp4'}; + case 'M4A ': + return {ext: 'm4a', mime: 'audio/x-m4a'}; + case 'F4V ': + return {ext: 'f4v', mime: 'video/mp4'}; + case 'F4P ': + return {ext: 'f4p', mime: 'video/mp4'}; + case 'F4A ': + return {ext: 'f4a', mime: 'audio/mp4'}; + case 'F4B ': + return {ext: 'f4b', mime: 'audio/mp4'}; + default: + if (brandMajor.startsWith('3g')) { + if (brandMajor.startsWith('3g2')) { + return {ext: '3g2', mime: 'video/3gpp2'}; + } + + return {ext: '3gp', mime: 'video/3gpp'}; + } + + return {ext: 'mp4', mime: 'video/mp4'}; + } + } + if (check([0x4D, 0x54, 0x68, 0x64])) { return { ext: 'mid', @@ -273,7 +367,7 @@ module.exports = input => { // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska if (check([0x1A, 0x45, 0xDF, 0xA3])) { - const sliced = buf.subarray(4, 4 + 4096); + const sliced = buffer.subarray(4, 4 + 4096); const idPos = sliced.findIndex((el, i, arr) => arr[i] === 0x42 && arr[i + 1] === 0x82); if (idPos !== -1) { @@ -296,31 +390,22 @@ module.exports = input => { } } - if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || - check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || - check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], {offset: 4}) || - check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // MJPEG - check([0x77, 0x69, 0x64, 0x65], {offset: 4})) { - return { - ext: 'mov', - mime: 'video/quicktime' - }; - } - // RIFF file format which might be AVI, WAV, QCP, etc if (check([0x52, 0x49, 0x46, 0x46])) { if (check([0x41, 0x56, 0x49], {offset: 8})) { return { ext: 'avi', - mime: 'video/x-msvideo' + mime: 'video/vnd.avi' }; } + if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) { return { ext: 'wav', - mime: 'audio/x-wav' + mime: 'audio/vnd.wave' }; } + // QLCM, QCP file if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) { return { @@ -330,10 +415,41 @@ module.exports = input => { } } + // ASF_Header_Object first 80 bytes if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { + // Search for header should be in first 1KB of file. + + let offset = 30; + do { + const objectSize = readUInt64LE(buffer, offset + 16); + if (check([0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65], {offset})) { + // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365) + if (check([0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B], {offset: offset + 24})) { + // Found audio: + return { + ext: 'wma', + mime: 'audio/x-ms-wma' + }; + } + + if (check([0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B], {offset: offset + 24})) { + // Found video: + return { + ext: 'wmv', + mime: 'video/x-ms-asf' + }; + } + + break; + } + + offset += objectSize; + } while (offset + 24 <= buffer.length); + + // Default to ASF generic extension return { - ext: 'wmv', - mime: 'video/x-ms-wmv' + ext: 'asf', + mime: 'application/vnd.ms-asf' }; } @@ -347,18 +463,11 @@ module.exports = input => { }; } - if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], {offset: 4})) { - return { - ext: '3gp', - mime: 'video/3gpp' - }; - } - // Check for MPEG header at different starting offsets - for (let start = 0; start < 2 && start < (buf.length - 16); start++) { + for (let start = 0; start < 2 && start < (buffer.length - 16); start++) { if ( check([0x49, 0x44, 0x33], {offset: start}) || // ID3 header - check([0xFF, 0xE2], {offset: start, mask: [0xFF, 0xE2]}) // MPEG 1 or 2 Layer 3 header + check([0xFF, 0xE2], {offset: start, mask: [0xFF, 0xE6]}) // MPEG 1 or 2 Layer 3 header ) { return { ext: 'mp3', @@ -367,7 +476,7 @@ module.exports = input => { } if ( - check([0xFF, 0xE4], {offset: start, mask: [0xFF, 0xE4]}) // MPEG 1 or 2 Layer 2 header + check([0xFF, 0xE4], {offset: start, mask: [0xFF, 0xE6]}) // MPEG 1 or 2 Layer 2 header ) { return { ext: 'mp2', @@ -394,16 +503,6 @@ module.exports = input => { } } - if ( - check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], {offset: 4}) || - check([0x4D, 0x34, 0x41, 0x20]) - ) { - return { - ext: 'm4a', - mime: 'audio/m4a' - }; - } - // Needs to be before `ogg` check if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], {offset: 28})) { return { @@ -423,6 +522,7 @@ module.exports = input => { mime: 'video/ogg' }; } + // If '\x01video' in header. if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], {offset: 28})) { return { @@ -430,6 +530,7 @@ module.exports = input => { mime: 'video/ogg' }; } + // If ' FLAC' in header https://xiph.org/flac/faq.html if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], {offset: 28})) { return { @@ -468,13 +569,20 @@ module.exports = input => { }; } - if (check([0x4D, 0x41, 0x43, 0x20])) { + if (check([0x4D, 0x41, 0x43, 0x20])) { // 'MAC ' return { ext: 'ape', mime: 'audio/ape' }; } + if (check([0x77, 0x76, 0x70, 0x6B])) { // 'wvpk' + return { + ext: 'wv', + mime: 'audio/wavpack' + }; + } + if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) { return { ext: 'amr', @@ -497,7 +605,7 @@ module.exports = input => { } if ( - (buf[0] === 0x43 || buf[0] === 0x46) && + (buffer[0] === 0x43 || buffer[0] === 0x46) && check([0x57, 0x53], {offset: 1}) ) { return { @@ -556,7 +664,7 @@ module.exports = input => { ) { return { ext: 'eot', - mime: 'application/octet-stream' + mime: 'application/vnd.ms-fontobject' }; } @@ -746,7 +854,7 @@ module.exports = input => { } } - if (check([0x46, 0x4F, 0x52, 0x4D, 0x00])) { + if (check([0x46, 0x4F, 0x52, 0x4D])) { return { ext: 'aif', mime: 'audio/aiff' @@ -767,37 +875,6 @@ module.exports = input => { }; } - // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format) - if (check([0x66, 0x74, 0x79, 0x70], {offset: 4})) { - if (check([0x6D, 0x69, 0x66, 0x31], {offset: 8})) { - return { - ext: 'heic', - mime: 'image/heif' - }; - } - - if (check([0x6D, 0x73, 0x66, 0x31], {offset: 8})) { - return { - ext: 'heic', - mime: 'image/heif-sequence' - }; - } - - if (check([0x68, 0x65, 0x69, 0x63], {offset: 8}) || check([0x68, 0x65, 0x69, 0x78], {offset: 8})) { - return { - ext: 'heic', - mime: 'image/heic' - }; - } - - if (check([0x68, 0x65, 0x76, 0x63], {offset: 8}) || check([0x68, 0x65, 0x76, 0x78], {offset: 8})) { - return { - ext: 'heic', - mime: 'image/heic-sequence' - }; - } - } - if (check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) { return { ext: 'ktx', @@ -805,5 +882,110 @@ module.exports = input => { }; } - return null; + if (check([0x44, 0x49, 0x43, 0x4D], {offset: 128})) { + return { + ext: 'dcm', + mime: 'application/dicom' + }; + } + + // Musepack, SV7 + if (check([0x4D, 0x50, 0x2B])) { + return { + ext: 'mpc', + mime: 'audio/x-musepack' + }; + } + + // Musepack, SV8 + if (check([0x4D, 0x50, 0x43, 0x4B])) { + return { + ext: 'mpc', + mime: 'audio/x-musepack' + }; + } + + if (check([0x42, 0x45, 0x47, 0x49, 0x4E, 0x3A])) { + return { + ext: 'ics', + mime: 'text/calendar' + }; + } + + if (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) { + return { + ext: 'glb', + mime: 'model/gltf-binary' + }; + } + + if (check([0xD4, 0xC3, 0xB2, 0xA1]) || check([0xA1, 0xB2, 0xC3, 0xD4])) { + return { + ext: 'pcap', + mime: 'application/vnd.tcpdump.pcap' + }; + } + + // Sony DSD Stream File (DSF) + if (check([0x44, 0x53, 0x44, 0x20])) { + return { + ext: 'dsf', + mime: 'audio/x-dsf' // Non-standard + }; + } + + if (check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) { + return { + ext: 'lnk', + mime: 'application/x.ms.shortcut' // Invented by us + }; + } + + if (check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) { + return { + ext: 'alias', + mime: 'application/x.apple.alias' // Invented by us + }; + } + + if (checkString('Creative Voice File')) { + return { + ext: 'voc', + mime: 'audio/x-voc' + }; + } + + if (check([0x0B, 0x77])) { + return { + ext: 'ac3', + mime: 'audio/vnd.dolby.dd-raw' + }; + } }; + +module.exports = fileType; + +Object.defineProperty(fileType, 'minimumBytes', {value: 4100}); + +fileType.stream = readableStream => new Promise((resolve, reject) => { + // Using `eval` to work around issues when bundling with Webpack + const stream = eval('require')('stream'); // eslint-disable-line no-eval + + readableStream.once('readable', () => { + const pass = new stream.PassThrough(); + const chunk = readableStream.read(module.exports.minimumBytes) || readableStream.read(); + try { + pass.fileType = fileType(chunk); + } catch (error) { + reject(error); + } + + readableStream.unshift(chunk); + + if (stream.pipeline) { + resolve(stream.pipeline(readableStream, pass, () => {})); + } else { + resolve(readableStream.pipe(pass)); + } + }); +}); diff --git a/node_modules/caw/license b/node_modules/file-type/license similarity index 92% rename from node_modules/caw/license rename to node_modules/file-type/license index db6bc32..e7af2f7 100644 --- a/node_modules/caw/license +++ b/node_modules/file-type/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Kevin Mårtensson (github.com/kevva) +Copyright (c) Sindre Sorhus (sindresorhus.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: diff --git a/node_modules/download/node_modules/file-type/package.json b/node_modules/file-type/package.json similarity index 69% rename from node_modules/download/node_modules/file-type/package.json rename to node_modules/file-type/package.json index 854978d..ab4d8db 100644 --- a/node_modules/download/node_modules/file-type/package.json +++ b/node_modules/file-type/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "file-type@8.1.0", + "file-type@11.1.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "file-type@8.1.0", - "_id": "file-type@8.1.0", + "_from": "file-type@11.1.0", + "_id": "file-type@11.1.0", "_inBundle": false, - "_integrity": "sha512-qyQ0pzAy78gVoJsmYeNgl8uH8yKhr1lVhW7JbzJmnlRi0I4R2eEDEJZVKG8agpDnLpacwNbDhLNG/LMdxHD2YQ==", - "_location": "/download/file-type", + "_integrity": "sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g==", + "_location": "/file-type", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "file-type@8.1.0", + "raw": "file-type@11.1.0", "name": "file-type", "escapedName": "file-type", - "rawSpec": "8.1.0", + "rawSpec": "11.1.0", "saveSpec": null, - "fetchSpec": "8.1.0" + "fetchSpec": "11.1.0" }, "_requiredBy": [ "/download" ], - "_resolved": "https://registry.npmjs.org/file-type/-/file-type-8.1.0.tgz", - "_spec": "8.1.0", + "_resolved": "https://registry.npmjs.org/file-type/-/file-type-11.1.0.tgz", + "_spec": "11.1.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Sindre Sorhus", @@ -35,17 +35,22 @@ "bugs": { "url": "https://github.com/sindresorhus/file-type/issues" }, - "description": "Detect the file type of a Buffer/Uint8Array", + "description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer", "devDependencies": { - "ava": "*", - "read-chunk": "^2.0.0", - "xo": "*" + "@types/node": "^11.12.2", + "ava": "^1.4.1", + "pify": "^4.0.1", + "read-chunk": "^3.2.0", + "tsd": "^0.7.1", + "xo": "^0.24.0" }, "engines": { "node": ">=6" }, "files": [ - "index.js" + "index.js", + "index.d.ts", + "util.js" ], "homepage": "https://github.com/sindresorhus/file-type#readme", "keywords": [ @@ -74,6 +79,10 @@ "webp", "flif", "cr2", + "orf", + "arw", + "dng", + "nef", "tif", "bmp", "jxr", @@ -86,7 +95,6 @@ "7z", "dmg", "mp4", - "m4v", "mid", "mkv", "webm", @@ -143,7 +151,25 @@ "ods", "odp", "xml", - "heic" + "heic", + "wma", + "ics", + "glb", + "pcap", + "dsf", + "lnk", + "alias", + "voc", + "ac3", + "3g2", + "m4a", + "m4b", + "m4p", + "m4v", + "f4a", + "f4b", + "f4p", + "f4v" ], "license": "MIT", "name": "file-type", @@ -152,7 +178,7 @@ "url": "git+https://github.com/sindresorhus/file-type.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "8.1.0" + "version": "11.1.0" } diff --git a/node_modules/download/node_modules/file-type/readme.md b/node_modules/file-type/readme.md similarity index 53% rename from node_modules/download/node_modules/file-type/readme.md rename to node_modules/file-type/readme.md index bd04b8d..e29d5a7 100644 --- a/node_modules/download/node_modules/file-type/readme.md +++ b/node_modules/file-type/readme.md @@ -1,8 +1,8 @@ # file-type [![Build Status](https://travis-ci.org/sindresorhus/file-type.svg?branch=master)](https://travis-ci.org/sindresorhus/file-type) -> Detect the file type of a Buffer/Uint8Array +> Detect the file type of a Buffer/Uint8Array/ArrayBuffer -The file type is detected by checking the [magic number](http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. ## Install @@ -23,7 +23,8 @@ $ npm install file-type ```js const readChunk = require('read-chunk'); const fileType = require('file-type'); -const buffer = readChunk.sync('unicorn.png', 0, 4100); + +const buffer = readChunk.sync('unicorn.png', 0, fileType.minimumBytes); fileType(buffer); //=> {ext: 'png', mime: 'image/png'} @@ -34,17 +35,41 @@ Or from a remote location: ```js const http = require('http'); const fileType = require('file-type'); -const url = 'http://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; -http.get(url, res => { - res.once('data', chunk => { - res.destroy(); +const url = 'https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; + +http.get(url, response => { + response.on('readable', () => { + const chunk = response.read(fileType.minimumBytes); + response.destroy(); console.log(fileType(chunk)); //=> {ext: 'gif', mime: 'image/gif'} }); }); ``` +Or from a stream: + +```js +const fs = require('fs'); +const crypto = require('crypto'); +const fileType = require('file-type'); + +(async () => { + const read = fs.createReadStream('encrypted.enc'); + const decipher = crypto.createDecipheriv(alg, key, iv); + + const stream = await fileType.stream(read.pipe(decipher)); + + console.log(stream.fileType); + //=> {ext: 'mov', mime: 'video/quicktime'} + + const write = fs.createWriteStream(`decrypted.${stream.fileType.ext}`); + stream.pipe(write); +})(); +``` + + ##### Browser ```js @@ -68,15 +93,33 @@ xhr.send(); Returns an `Object` with: - `ext` - One of the [supported file types](#supported-file-types) -- `mime` - The [MIME type](http://en.wikipedia.org/wiki/Internet_media_type) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) -Or `null` when no match. +Or `undefined` when there is no match. #### input -Type: `Buffer` `Uint8Array` +Type: `Buffer | Uint8Array | ArrayBuffer` -It only needs the first 4100 bytes. +It only needs the first `.minimumBytes` bytes. The exception is detection of `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file. + +### fileType.minimumBytes + +Type: `number` + +The minimum amount of bytes needed to detect a file type. Currently, it's 4100 bytes, but it can change, so don't hardcode it. + +### fileType.stream(readableStream) + +Detect the file type of a readable stream. + +Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileType()`. + +*Note:* This method is only for Node.js. + +#### readableStream + +Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) ## Supported file types @@ -86,7 +129,11 @@ It only needs the first 4100 bytes. - [`gif`](https://en.wikipedia.org/wiki/GIF) - [`webp`](https://en.wikipedia.org/wiki/WebP) - [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) -- [`cr2`](http://fileinfo.com/extension/cr2) +- [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2) +- [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file +- [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file +- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file +- [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file - [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) @@ -99,7 +146,6 @@ It only needs the first 4100 bytes. - [`7z`](https://en.wikipedia.org/wiki/7z) - [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) -- [`m4v`](https://en.wikipedia.org/wiki/M4V) - [`mid`](https://en.wikipedia.org/wiki/MIDI) - [`mkv`](https://en.wikipedia.org/wiki/Matroska) - [`webm`](https://en.wikipedia.org/wiki/WebM) @@ -132,14 +178,14 @@ It only needs the first 4100 bytes. - [`ps`](https://en.wikipedia.org/wiki/Postscript) - [`xz`](https://en.wikipedia.org/wiki/Xz) - [`sqlite`](https://www.sqlite.org/fileformat2.html) -- [`nes`](http://fileinfo.com/extension/nes) +- [`nes`](https://fileinfo.com/extension/nes) - [`crx`](https://developer.chrome.com/extensions/crx) - [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) -- [`rpm`](http://fileinfo.com/extension/rpm) -- [`Z`](http://fileinfo.com/extension/z) +- [`rpm`](https://fileinfo.com/extension/rpm) +- [`Z`](https://fileinfo.com/extension/z) - [`lz`](https://en.wikipedia.org/wiki/Lzip) - [`msi`](https://en.wikipedia.org/wiki/Windows_Installer) - [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) @@ -150,7 +196,6 @@ It only needs the first 4100 bytes. - [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2) - [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 - [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 - [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 @@ -160,14 +205,38 @@ It only needs the first 4100 bytes. - [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets - [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations - [`xml`](https://en.wikipedia.org/wiki/XML) -- [`heic`](http://nokiatech.github.io/heif/technical.html) +- [`heic`](https://nokiatech.github.io/heif/technical.html) - [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio +- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack +- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format +- [`wma`](https://en.wikipedia.org/wiki/Windows_Media_Audio) - Windows Media Audio +- [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) - Windows Media Video +- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File +- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8) +- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar +- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format +- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format +- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) +- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut +- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file +- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File +- [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File +- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2#3GP) - Multimedia container format defined by the Third Generation Partnership Project (3GPP) for 3G UMTS multimedia services +- [`3g2`](https://en.wikipedia.org/wiki/3GP_and_3G2#3G2) - Multimedia container format defined by the 3GPP2 for 3G CDMA2000 multimedia services +- [`m4v`](https://en.wikipedia.org/wiki/M4V) - MPEG-4 Visual bitstreams +- [`m4p`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 files with audio streams encrypted by FairPlay Digital Rights Management as were sold through the iTunes Store +- [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files +- [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks +- [`f4v`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format used by Adobe Flash Player +- [`f4p`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format protected by Adobe Access DRM used by Adobe Flash Player +- [`f4a`](https://en.wikipedia.org/wiki/Flash_Video) - Audio-only ISO base media file format used by Adobe Flash Player +- [`f4b`](https://en.wikipedia.org/wiki/Flash_Video) - Audiobook and podcast ISO base media file format used by Adobe Flash Player *SVG isn't included as it requires the whole file to be read, but you can get it [here](https://github.com/sindresorhus/is-svg).* -*Pull request welcome for additional commonly used file types.* +*Pull requests are welcome for additional commonly used file types.* ## Related diff --git a/node_modules/file-type/util.js b/node_modules/file-type/util.js new file mode 100644 index 0000000..b0f67a3 --- /dev/null +++ b/node_modules/file-type/util.js @@ -0,0 +1,58 @@ +'use strict'; + +exports.stringToBytes = string => [...string].map(character => character.charCodeAt(0)); + +const uint8ArrayUtf8ByteString = (array, start, end) => { + return String.fromCharCode(...array.slice(start, end)); +}; + +exports.readUInt64LE = (buffer, offset = 0) => { + let n = buffer[offset]; + let mul = 1; + let i = 0; + + while (++i < 8) { + mul *= 0x100; + n += buffer[offset + i] * mul; + } + + return n; +}; + +exports.tarHeaderChecksumMatches = buffer => { // Does not check if checksum field characters are valid + if (buffer.length < 512) { // `tar` header size, cannot compute checksum without it + return false; + } + + const MASK_8TH_BIT = 0x80; + + let sum = 256; // Intitalize sum, with 256 as sum of 8 spaces in checksum field + let signedBitSum = 0; // Initialize signed bit sum + + for (let i = 0; i < 148; i++) { + const byte = buffer[i]; + sum += byte; + signedBitSum += byte & MASK_8TH_BIT; // Add signed bit to signed bit sum + } + + // Skip checksum field + + for (let i = 156; i < 512; i++) { + const byte = buffer[i]; + sum += byte; + signedBitSum += byte & MASK_8TH_BIT; // Add signed bit to signed bit sum + } + + const readSum = parseInt(uint8ArrayUtf8ByteString(buffer, 148, 154), 8); // Read sum in header + + // Some implementations compute checksum incorrectly using signed bytes + return ( + // Checksum in header equals the sum we calculated + readSum === sum || + + // Checksum in header equals sum we calculated plus signed-to-unsigned delta + readSum === (sum - (signedBitSum << 1)) + ); +}; + +exports.uint8ArrayUtf8ByteString = uint8ArrayUtf8ByteString; diff --git a/node_modules/filenamify/index.d.ts b/node_modules/filenamify/index.d.ts new file mode 100644 index 0000000..9f6ce0a --- /dev/null +++ b/node_modules/filenamify/index.d.ts @@ -0,0 +1,30 @@ +export interface Options { + /** + * String to use as replacement for reserved filename characters. + * + * Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` + * + * @default '!' + */ + readonly replacement?: string; +} + +/** + * Accepts a filename and returns a valid filename. + * + * @param input - A string to convert to a valid filename. + */ +export interface Filenamify { + (input: string, options?: Options): string; + + /** + * Accepts a path and returns the path with a valid filename. + * + * @param input - A string to convert to a valid path with a filename. + */ + path(input: string, options?: Options): string; +} + +declare const filenamify: Filenamify; + +export default filenamify; diff --git a/node_modules/filenamify/index.js b/node_modules/filenamify/index.js index 0f7bbd6..7993d46 100644 --- a/node_modules/filenamify/index.js +++ b/node_modules/filenamify/index.js @@ -10,13 +10,11 @@ const MAX_FILENAME_LENGTH = 100; const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex const reRelativePath = /^\.+/; -const fn = (string, options) => { +const filenamify = (string, options = {}) => { if (typeof string !== 'string') { throw new TypeError('Expected a string'); } - options = options || {}; - const replacement = options.replacement === undefined ? '!' : options.replacement; if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) { @@ -38,9 +36,10 @@ const fn = (string, options) => { return string; }; -fn.path = (pth, options) => { - pth = path.resolve(pth); - return path.join(path.dirname(pth), fn(path.basename(pth), options)); +filenamify.path = (filePath, options) => { + filePath = path.resolve(filePath); + return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options)); }; -module.exports = fn; +module.exports = filenamify; +module.exports.default = filenamify; diff --git a/node_modules/filenamify/package.json b/node_modules/filenamify/package.json index 477ee2a..c2fbc91 100644 --- a/node_modules/filenamify/package.json +++ b/node_modules/filenamify/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "filenamify@2.1.0", + "filenamify@3.0.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "filenamify@2.1.0", - "_id": "filenamify@2.1.0", + "_from": "filenamify@3.0.0", + "_id": "filenamify@3.0.0", "_inBundle": false, - "_integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", + "_integrity": "sha512-5EFZ//MsvJgXjBAFJ+Bh2YaCTRF/VP1YOmGrgt+KJ4SFRLjI87EIdwLLuT6wQX0I4F9W41xutobzczjsOKlI/g==", "_location": "/filenamify", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "filenamify@2.1.0", + "raw": "filenamify@3.0.0", "name": "filenamify", "escapedName": "filenamify", - "rawSpec": "2.1.0", + "rawSpec": "3.0.0", "saveSpec": null, - "fetchSpec": "2.1.0" + "fetchSpec": "3.0.0" }, "_requiredBy": [ "/download" ], - "_resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz", - "_spec": "2.1.0", + "_resolved": "https://registry.npmjs.org/filenamify/-/filenamify-3.0.0.tgz", + "_spec": "3.0.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Sindre Sorhus", @@ -42,14 +42,16 @@ }, "description": "Convert a string to a valid safe filename", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.3.1", + "tsd-check": "^0.3.0", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/filenamify#readme", "keywords": [ @@ -72,7 +74,7 @@ "url": "git+https://github.com/sindresorhus/filenamify.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd-check" }, - "version": "2.1.0" + "version": "3.0.0" } diff --git a/node_modules/filenamify/readme.md b/node_modules/filenamify/readme.md index abeef64..b0365e6 100644 --- a/node_modules/filenamify/readme.md +++ b/node_modules/filenamify/readme.md @@ -39,8 +39,12 @@ Accepts a path and returns the path with a valid filename. Type: `string` +A string to convert to a valid filename. + #### options +Type: `Object` + ##### replacement Type: `string`
@@ -53,6 +57,7 @@ Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` ## Related +- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this module - [filenamify-url](https://github.com/sindresorhus/filenamify-url) - Convert a URL to a valid filename - [valid-filename](https://github.com/sindresorhus/valid-filename) - Check if a string is a valid filename - [unused-filename](https://github.com/sindresorhus/unused-filename) - Get a unused filename by appending a number if it exists diff --git a/node_modules/get-proxy/index.js b/node_modules/get-proxy/index.js deleted file mode 100644 index 0bc8169..0000000 --- a/node_modules/get-proxy/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; -const npmConf = require('npm-conf')(); - -module.exports = () => { - return process.env.HTTPS_PROXY || - process.env.https_proxy || - process.env.HTTP_PROXY || - process.env.http_proxy || - npmConf.get('https-proxy') || - npmConf.get('http-proxy') || - npmConf.get('proxy') || - null; -}; diff --git a/node_modules/get-proxy/package.json b/node_modules/get-proxy/package.json deleted file mode 100644 index d688a42..0000000 --- a/node_modules/get-proxy/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_args": [ - [ - "get-proxy@2.1.0", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "get-proxy@2.1.0", - "_id": "get-proxy@2.1.0", - "_inBundle": false, - "_integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", - "_location": "/get-proxy", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "get-proxy@2.1.0", - "name": "get-proxy", - "escapedName": "get-proxy", - "rawSpec": "2.1.0", - "saveSpec": null, - "fetchSpec": "2.1.0" - }, - "_requiredBy": [ - "/caw" - ], - "_resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", - "_spec": "2.1.0", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Kevin Mårtensson", - "email": "kevinmartensson@gmail.com", - "url": "https://github.com/kevva" - }, - "bugs": { - "url": "https://github.com/kevva/get-proxy/issues" - }, - "dependencies": { - "npm-conf": "^1.1.0" - }, - "description": "Get configured proxy", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/kevva/get-proxy#readme", - "keywords": [ - "env", - "get", - "proxy" - ], - "license": "MIT", - "name": "get-proxy", - "repository": { - "type": "git", - "url": "git+https://github.com/kevva/get-proxy.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "2.1.0" -} diff --git a/node_modules/get-proxy/readme.md b/node_modules/get-proxy/readme.md deleted file mode 100644 index 927f005..0000000 --- a/node_modules/get-proxy/readme.md +++ /dev/null @@ -1,25 +0,0 @@ -# get-proxy [![Build Status](https://travis-ci.org/kevva/get-proxy.svg?branch=master)](http://travis-ci.org/kevva/get-proxy) - -> Get configured proxy - - -## Install - -``` -$ npm install get-proxy -``` - - -## Usage - -```js -const getProxy = require('get-proxy'); - -getProxy(); -//=> 'http://192.168.0.1:8080' -``` - - -## License - -MIT © [Kevin Mårtensson](https://github.com/kevva) diff --git a/node_modules/get-stream/buffer-stream.js b/node_modules/get-stream/buffer-stream.js index ae45d3d..4121c8e 100644 --- a/node_modules/get-stream/buffer-stream.js +++ b/node_modules/get-stream/buffer-stream.js @@ -1,11 +1,11 @@ 'use strict'; -const PassThrough = require('stream').PassThrough; +const {PassThrough} = require('stream'); -module.exports = opts => { - opts = Object.assign({}, opts); +module.exports = options => { + options = Object.assign({}, options); - const array = opts.array; - let encoding = opts.encoding; + const {array} = options; + let {encoding} = options; const buffer = encoding === 'buffer'; let objectMode = false; diff --git a/node_modules/get-stream/index.js b/node_modules/get-stream/index.js index 2dc5ee9..7e5584a 100644 --- a/node_modules/get-stream/index.js +++ b/node_modules/get-stream/index.js @@ -1,51 +1,50 @@ 'use strict'; +const pump = require('pump'); const bufferStream = require('./buffer-stream'); -function getStream(inputStream, opts) { +class MaxBufferError extends Error { + constructor() { + super('maxBuffer exceeded'); + this.name = 'MaxBufferError'; + } +} + +function getStream(inputStream, options) { if (!inputStream) { return Promise.reject(new Error('Expected a stream')); } - opts = Object.assign({maxBuffer: Infinity}, opts); + options = Object.assign({maxBuffer: Infinity}, options); + + const {maxBuffer} = options; - const maxBuffer = opts.maxBuffer; let stream; - let clean; - - const p = new Promise((resolve, reject) => { - const error = err => { - if (err) { // null check - err.bufferedData = stream.getBufferedValue(); + return new Promise((resolve, reject) => { + const rejectPromise = error => { + if (error) { // A null check + error.bufferedData = stream.getBufferedValue(); } - - reject(err); + reject(error); }; - stream = bufferStream(opts); - inputStream.once('error', error); - inputStream.pipe(stream); + stream = pump(inputStream, bufferStream(options), error => { + if (error) { + rejectPromise(error); + return; + } + + resolve(); + }); stream.on('data', () => { if (stream.getBufferedLength() > maxBuffer) { - reject(new Error('maxBuffer exceeded')); + rejectPromise(new MaxBufferError()); } }); - stream.once('error', error); - stream.on('end', resolve); - - clean = () => { - // some streams doesn't implement the `stream.Readable` interface correctly - if (inputStream.unpipe) { - inputStream.unpipe(stream); - } - }; - }); - - p.then(clean, clean); - - return p.then(() => stream.getBufferedValue()); + }).then(() => stream.getBufferedValue()); } module.exports = getStream; -module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'})); -module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true})); +module.exports.buffer = (stream, options) => getStream(stream, Object.assign({}, options, {encoding: 'buffer'})); +module.exports.array = (stream, options) => getStream(stream, Object.assign({}, options, {array: true})); +module.exports.MaxBufferError = MaxBufferError; diff --git a/node_modules/get-stream/license b/node_modules/get-stream/license index 654d0bf..e7af2f7 100644 --- a/node_modules/get-stream/license +++ b/node_modules/get-stream/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.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: +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 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. +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/get-stream/package.json b/node_modules/get-stream/package.json index 73df504..f6ffa75 100644 --- a/node_modules/get-stream/package.json +++ b/node_modules/get-stream/package.json @@ -1,33 +1,31 @@ { "_args": [ [ - "get-stream@3.0.0", + "get-stream@4.1.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "get-stream@3.0.0", - "_id": "get-stream@3.0.0", + "_from": "get-stream@4.1.0", + "_id": "get-stream@4.1.0", "_inBundle": false, - "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "_integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "_location": "/get-stream", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "get-stream@3.0.0", + "raw": "get-stream@4.1.0", "name": "get-stream", "escapedName": "get-stream", - "rawSpec": "3.0.0", + "rawSpec": "4.1.0", "saveSpec": null, - "fetchSpec": "3.0.0" + "fetchSpec": "4.1.0" }, "_requiredBy": [ - "/cacheable-request", - "/download", - "/got" + "/download" ], - "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "_spec": "3.0.0", + "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "_spec": "4.1.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Sindre Sorhus", @@ -37,6 +35,9 @@ "bugs": { "url": "https://github.com/sindresorhus/get-stream/issues" }, + "dependencies": { + "pump": "^3.0.0" + }, "description": "Get a stream as a string, buffer, or array", "devDependencies": { "ava": "*", @@ -44,7 +45,7 @@ "xo": "*" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ "index.js", @@ -57,7 +58,6 @@ "promise", "concat", "string", - "str", "text", "buffer", "read", @@ -66,8 +66,7 @@ "readable", "readablestream", "array", - "object", - "obj" + "object" ], "license": "MIT", "name": "get-stream", @@ -78,8 +77,5 @@ "scripts": { "test": "xo && ava" }, - "version": "3.0.0", - "xo": { - "esnext": true - } + "version": "4.1.0" } diff --git a/node_modules/get-stream/readme.md b/node_modules/get-stream/readme.md index 73b188f..b87a4d3 100644 --- a/node_modules/get-stream/readme.md +++ b/node_modules/get-stream/readme.md @@ -6,7 +6,7 @@ ## Install ``` -$ npm install --save get-stream +$ npm install get-stream ``` @@ -15,10 +15,11 @@ $ npm install --save get-stream ```js const fs = require('fs'); const getStream = require('get-stream'); -const stream = fs.createReadStream('unicorn.txt'); -getStream(stream).then(str => { - console.log(str); +(async () => { + const stream = fs.createReadStream('unicorn.txt'); + + console.log(await getStream(stream)); /* ,,))))))));, __)))))))))))))), @@ -40,7 +41,7 @@ getStream(stream).then(str => { \~\ ~~ */ -}); +})(); ``` @@ -54,6 +55,8 @@ Get the `stream` as a string. #### options +Type: `Object` + ##### encoding Type: `string`
@@ -66,7 +69,7 @@ Default: `utf8` Type: `number`
Default: `Infinity` -Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected. +Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error. ### getStream.buffer(stream, [options]) @@ -92,11 +95,14 @@ It honors both the `maxBuffer` and `encoding` options. The behavior changes slig If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. ```js -getStream(streamThatErrorsAtTheEnd('unicorn')) - .catch(err => { - console.log(err.bufferedData); +(async () => { + try { + await getStream(streamThatErrorsAtTheEnd('unicorn')); + } catch (error) { + console.log(error.bufferedData); //=> 'unicorn' - }); + } +})() ``` diff --git a/node_modules/got/node_modules/get-stream/buffer-stream.js b/node_modules/got/node_modules/get-stream/buffer-stream.js new file mode 100644 index 0000000..ae45d3d --- /dev/null +++ b/node_modules/got/node_modules/get-stream/buffer-stream.js @@ -0,0 +1,51 @@ +'use strict'; +const PassThrough = require('stream').PassThrough; + +module.exports = opts => { + opts = Object.assign({}, opts); + + const array = opts.array; + let encoding = opts.encoding; + const buffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || buffer); + } else { + encoding = encoding || 'utf8'; + } + + if (buffer) { + encoding = null; + } + + let len = 0; + const ret = []; + const stream = new PassThrough({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + stream.on('data', chunk => { + ret.push(chunk); + + if (objectMode) { + len = ret.length; + } else { + len += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return ret; + } + + return buffer ? Buffer.concat(ret, len) : ret.join(''); + }; + + stream.getBufferedLength = () => len; + + return stream; +}; diff --git a/node_modules/got/node_modules/get-stream/index.js b/node_modules/got/node_modules/get-stream/index.js new file mode 100644 index 0000000..2dc5ee9 --- /dev/null +++ b/node_modules/got/node_modules/get-stream/index.js @@ -0,0 +1,51 @@ +'use strict'; +const bufferStream = require('./buffer-stream'); + +function getStream(inputStream, opts) { + if (!inputStream) { + return Promise.reject(new Error('Expected a stream')); + } + + opts = Object.assign({maxBuffer: Infinity}, opts); + + const maxBuffer = opts.maxBuffer; + let stream; + let clean; + + const p = new Promise((resolve, reject) => { + const error = err => { + if (err) { // null check + err.bufferedData = stream.getBufferedValue(); + } + + reject(err); + }; + + stream = bufferStream(opts); + inputStream.once('error', error); + inputStream.pipe(stream); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + reject(new Error('maxBuffer exceeded')); + } + }); + stream.once('error', error); + stream.on('end', resolve); + + clean = () => { + // some streams doesn't implement the `stream.Readable` interface correctly + if (inputStream.unpipe) { + inputStream.unpipe(stream); + } + }; + }); + + p.then(clean, clean); + + return p.then(() => stream.getBufferedValue()); +} + +module.exports = getStream; +module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'})); +module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true})); diff --git a/node_modules/decompress-tarbz2/node_modules/is-stream/license b/node_modules/got/node_modules/get-stream/license similarity index 100% rename from node_modules/decompress-tarbz2/node_modules/is-stream/license rename to node_modules/got/node_modules/get-stream/license diff --git a/node_modules/got/node_modules/get-stream/package.json b/node_modules/got/node_modules/get-stream/package.json new file mode 100644 index 0000000..d3af236 --- /dev/null +++ b/node_modules/got/node_modules/get-stream/package.json @@ -0,0 +1,83 @@ +{ + "_args": [ + [ + "get-stream@3.0.0", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "get-stream@3.0.0", + "_id": "get-stream@3.0.0", + "_inBundle": false, + "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "_location": "/got/get-stream", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "get-stream@3.0.0", + "name": "get-stream", + "escapedName": "get-stream", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "_spec": "3.0.0", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/get-stream/issues" + }, + "description": "Get a stream as a string, buffer, or array", + "devDependencies": { + "ava": "*", + "into-stream": "^3.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "buffer-stream.js" + ], + "homepage": "https://github.com/sindresorhus/get-stream#readme", + "keywords": [ + "get", + "stream", + "promise", + "concat", + "string", + "str", + "text", + "buffer", + "read", + "data", + "consume", + "readable", + "readablestream", + "array", + "object", + "obj" + ], + "license": "MIT", + "name": "get-stream", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/get-stream.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/got/node_modules/get-stream/readme.md b/node_modules/got/node_modules/get-stream/readme.md new file mode 100644 index 0000000..73b188f --- /dev/null +++ b/node_modules/got/node_modules/get-stream/readme.md @@ -0,0 +1,117 @@ +# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream) + +> Get a stream as a string, buffer, or array + + +## Install + +``` +$ npm install --save get-stream +``` + + +## Usage + +```js +const fs = require('fs'); +const getStream = require('get-stream'); +const stream = fs.createReadStream('unicorn.txt'); + +getStream(stream).then(str => { + console.log(str); + /* + ,,))))))));, + __)))))))))))))), + \|/ -\(((((''''((((((((. + -*-==//////(('' . `)))))), + /|\ ))| o ;-. '((((( ,(, + ( `| / ) ;))))' ,_))^;(~ + | | | ,))((((_ _____------~~~-. %,;(;(>';'~ + o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ + ; ''''```` `: `:::|\,__,%% );`'; ~ + | _ ) / `:|`----' `-' + ______/\/~ | / / + /~;;.____/;;' / ___--,-( `;;;/ + / // _;______;'------~~~~~ /;;/\ / + // | | / ; \;;,\ + (<_ | ; /',/-----' _> + \_| ||_ //~;~~~~~~~~~ + `\_| (,~~ + \~\ + ~~ + */ +}); +``` + + +## API + +The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. + +### getStream(stream, [options]) + +Get the `stream` as a string. + +#### options + +##### encoding + +Type: `string`
+Default: `utf8` + +[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. + +##### maxBuffer + +Type: `number`
+Default: `Infinity` + +Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected. + +### getStream.buffer(stream, [options]) + +Get the `stream` as a buffer. + +It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. + +### getStream.array(stream, [options]) + +Get the `stream` as an array of values. + +It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: + +- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). + +- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. + +- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. + + +## Errors + +If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. + +```js +getStream(streamThatErrorsAtTheEnd('unicorn')) + .catch(err => { + console.log(err.bufferedData); + //=> 'unicorn' + }); +``` + + +## FAQ + +### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? + +This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. + + +## Related + +- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/got/node_modules/pify/index.js b/node_modules/got/node_modules/pify/index.js new file mode 100644 index 0000000..1dee43a --- /dev/null +++ b/node_modules/got/node_modules/pify/index.js @@ -0,0 +1,84 @@ +'use strict'; + +const processFn = (fn, opts) => function () { + const P = opts.promiseModule; + const args = new Array(arguments.length); + + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P((resolve, reject) => { + if (opts.errorFirst) { + args.push(function (err, result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + if (err) { + results.unshift(err); + reject(results); + } else { + resolve(results); + } + } else if (err) { + reject(err); + } else { + resolve(result); + } + }); + } else { + args.push(function (result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 0; i < arguments.length; i++) { + results[i] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + } + + fn.apply(this, args); + }); +}; + +module.exports = (obj, opts) => { + opts = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, opts); + + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + let ret; + if (typeof obj === 'function') { + ret = function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, opts).apply(this, arguments); + }; + } else { + ret = Object.create(Object.getPrototypeOf(obj)); + } + + for (const key in obj) { // eslint-disable-line guard-for-in + const x = obj[key]; + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, opts) : x; + } + + return ret; +}; diff --git a/node_modules/npm-conf/license b/node_modules/got/node_modules/pify/license similarity index 92% rename from node_modules/npm-conf/license rename to node_modules/got/node_modules/pify/license index db6bc32..e7af2f7 100644 --- a/node_modules/npm-conf/license +++ b/node_modules/got/node_modules/pify/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Kevin Mårtensson (github.com/kevva) +Copyright (c) Sindre Sorhus (sindresorhus.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: diff --git a/node_modules/got/node_modules/pify/package.json b/node_modules/got/node_modules/pify/package.json new file mode 100644 index 0000000..748dcb7 --- /dev/null +++ b/node_modules/got/node_modules/pify/package.json @@ -0,0 +1,86 @@ +{ + "_args": [ + [ + "pify@3.0.0", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "pify@3.0.0", + "_id": "pify@3.0.0", + "_inBundle": false, + "_integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "_location": "/got/pify", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pify@3.0.0", + "name": "pify", + "escapedName": "pify", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "_spec": "3.0.0", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/pify/issues" + }, + "description": "Promisify a callback-style function", + "devDependencies": { + "ava": "*", + "pinkie-promise": "^2.0.0", + "v8-natives": "^1.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/pify#readme", + "keywords": [ + "promise", + "promises", + "promisify", + "all", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "await", + "es2015", + "bluebird" + ], + "license": "MIT", + "name": "pify", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/pify.git" + }, + "scripts": { + "optimization-test": "node --allow-natives-syntax optimization-test.js", + "test": "xo && ava && npm run optimization-test" + }, + "version": "3.0.0" +} diff --git a/node_modules/got/node_modules/pify/readme.md b/node_modules/got/node_modules/pify/readme.md new file mode 100644 index 0000000..376ca4e --- /dev/null +++ b/node_modules/got/node_modules/pify/readme.md @@ -0,0 +1,131 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// Promisify a single function +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// Promisify all methods in a module +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [options]) + +Returns a `Promise` wrapped version of the supplied function or module. + +#### input + +Type: `Function` `Object` + +Callback-style function or module whose methods you want to promisify. + +#### options + +##### multiArgs + +Type: `boolean`
+Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `string[]` `RegExp[]` + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `string[]` `RegExp[]`
+Default: `[/.+(Sync|Stream)$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean`
+Default: `false` + +If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(null, data); + }); +}; + +// Promisify methods but not `fn()` +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + +##### errorFirst + +Type: `boolean`
+Default: `true` + +Whether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc. + +##### promiseModule + +Type: `Function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + + +## Related + +- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js index 3e1a9eb..8c75ee2 100644 --- a/node_modules/graceful-fs/graceful-fs.js +++ b/node_modules/graceful-fs/graceful-fs.js @@ -234,22 +234,24 @@ function patch (fs) { }) // legacy names + var FileReadStream = ReadStream Object.defineProperty(fs, 'FileReadStream', { get: function () { - return ReadStream + return FileReadStream }, set: function (val) { - ReadStream = val + FileReadStream = val }, enumerable: true, configurable: true }) + var FileWriteStream = WriteStream Object.defineProperty(fs, 'FileWriteStream', { get: function () { - return WriteStream + return FileWriteStream }, set: function (val) { - WriteStream = val + FileWriteStream = val }, enumerable: true, configurable: true diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index a80dcbd..72aade4 100644 --- a/node_modules/graceful-fs/package.json +++ b/node_modules/graceful-fs/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "graceful-fs@4.2.2", + "graceful-fs@4.2.3", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "graceful-fs@4.2.2", - "_id": "graceful-fs@4.2.2", + "_from": "graceful-fs@4.2.3", + "_id": "graceful-fs@4.2.3", "_inBundle": false, - "_integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==", + "_integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "_location": "/graceful-fs", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "graceful-fs@4.2.2", + "raw": "graceful-fs@4.2.3", "name": "graceful-fs", "escapedName": "graceful-fs", - "rawSpec": "4.2.2", + "rawSpec": "4.2.3", "saveSpec": null, - "fetchSpec": "4.2.2" + "fetchSpec": "4.2.3" }, "_requiredBy": [ "/decompress" ], - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", - "_spec": "4.2.2", + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "_spec": "4.2.3", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" @@ -78,5 +78,5 @@ "preversion": "npm test", "test": "node test.js | tap -" }, - "version": "4.2.2" + "version": "4.2.3" } diff --git a/node_modules/ini/README.md b/node_modules/ini/README.md deleted file mode 100644 index 33df258..0000000 --- a/node_modules/ini/README.md +++ /dev/null @@ -1,102 +0,0 @@ -An ini format parser and serializer for node. - -Sections are treated as nested objects. Items before the first -heading are saved on the object directly. - -## Usage - -Consider an ini-file `config.ini` that looks like this: - - ; this comment is being ignored - scope = global - - [database] - user = dbuser - password = dbpassword - database = use_this_database - - [paths.default] - datadir = /var/lib/data - array[] = first value - array[] = second value - array[] = third value - -You can read, manipulate and write the ini-file like so: - - var fs = require('fs') - , ini = require('ini') - - var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) - - config.scope = 'local' - config.database.database = 'use_another_database' - config.paths.default.tmpdir = '/tmp' - delete config.paths.default.datadir - config.paths.default.array.push('fourth value') - - fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' })) - -This will result in a file called `config_modified.ini` being written -to the filesystem with the following content: - - [section] - scope=local - [section.database] - user=dbuser - password=dbpassword - database=use_another_database - [section.paths.default] - tmpdir=/tmp - array[]=first value - array[]=second value - array[]=third value - array[]=fourth value - - -## API - -### decode(inistring) - -Decode the ini-style formatted `inistring` into a nested object. - -### parse(inistring) - -Alias for `decode(inistring)` - -### encode(object, [options]) - -Encode the object `object` into an ini-style formatted string. If the -optional parameter `section` is given, then all top-level properties -of the object are put into this section and the `section`-string is -prepended to all sub-sections, see the usage example above. - -The `options` object may contain the following: - -* `section` A string which will be the first `section` in the encoded - ini data. Defaults to none. -* `whitespace` Boolean to specify whether to put whitespace around the - `=` character. By default, whitespace is omitted, to be friendly to - some persnickety old parsers that don't tolerate it well. But some - find that it's more human-readable and pretty with the whitespace. - -For backwards compatibility reasons, if a `string` options is passed -in, then it is assumed to be the `section` value. - -### stringify(object, [options]) - -Alias for `encode(object, [options])` - -### safe(val) - -Escapes the string `val` such that it is safe to be used as a key or -value in an ini-file. Basically escapes quotes. For example - - ini.safe('"unsafe string"') - -would result in - - "\"unsafe string\"" - -### unsafe(val) - -Unescapes the string `val` diff --git a/node_modules/ini/ini.js b/node_modules/ini/ini.js deleted file mode 100644 index 590195d..0000000 --- a/node_modules/ini/ini.js +++ /dev/null @@ -1,194 +0,0 @@ -exports.parse = exports.decode = decode - -exports.stringify = exports.encode = encode - -exports.safe = safe -exports.unsafe = unsafe - -var eol = typeof process !== 'undefined' && - process.platform === 'win32' ? '\r\n' : '\n' - -function encode (obj, opt) { - var children = [] - var out = '' - - if (typeof opt === 'string') { - opt = { - section: opt, - whitespace: false - } - } else { - opt = opt || {} - opt.whitespace = opt.whitespace === true - } - - var separator = opt.whitespace ? ' = ' : '=' - - Object.keys(obj).forEach(function (k, _, __) { - var val = obj[k] - if (val && Array.isArray(val)) { - val.forEach(function (item) { - out += safe(k + '[]') + separator + safe(item) + '\n' - }) - } else if (val && typeof val === 'object') { - children.push(k) - } else { - out += safe(k) + separator + safe(val) + eol - } - }) - - if (opt.section && out.length) { - out = '[' + safe(opt.section) + ']' + eol + out - } - - children.forEach(function (k, _, __) { - var nk = dotSplit(k).join('\\.') - var section = (opt.section ? opt.section + '.' : '') + nk - var child = encode(obj[k], { - section: section, - whitespace: opt.whitespace - }) - if (out.length && child.length) { - out += eol - } - out += child - }) - - return out -} - -function dotSplit (str) { - return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002') - .replace(/\\\./g, '\u0001') - .split(/\./).map(function (part) { - return part.replace(/\1/g, '\\.') - .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001') - }) -} - -function decode (str) { - var out = {} - var p = out - var section = null - // section |key = value - var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i - var lines = str.split(/[\r\n]+/g) - - lines.forEach(function (line, _, __) { - if (!line || line.match(/^\s*[;#]/)) return - var match = line.match(re) - if (!match) return - if (match[1] !== undefined) { - section = unsafe(match[1]) - p = out[section] = out[section] || {} - return - } - var key = unsafe(match[2]) - var value = match[3] ? unsafe(match[4]) : true - switch (value) { - case 'true': - case 'false': - case 'null': value = JSON.parse(value) - } - - // Convert keys with '[]' suffix to an array - if (key.length > 2 && key.slice(-2) === '[]') { - key = key.substring(0, key.length - 2) - if (!p[key]) { - p[key] = [] - } else if (!Array.isArray(p[key])) { - p[key] = [p[key]] - } - } - - // safeguard against resetting a previously defined - // array by accidentally forgetting the brackets - if (Array.isArray(p[key])) { - p[key].push(value) - } else { - p[key] = value - } - }) - - // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} - // use a filter to return the keys that have to be deleted. - Object.keys(out).filter(function (k, _, __) { - if (!out[k] || - typeof out[k] !== 'object' || - Array.isArray(out[k])) { - return false - } - // see if the parent section is also an object. - // if so, add it to that, and mark this one for deletion - var parts = dotSplit(k) - var p = out - var l = parts.pop() - var nl = l.replace(/\\\./g, '.') - parts.forEach(function (part, _, __) { - if (!p[part] || typeof p[part] !== 'object') p[part] = {} - p = p[part] - }) - if (p === out && nl === l) { - return false - } - p[nl] = out[k] - return true - }).forEach(function (del, _, __) { - delete out[del] - }) - - return out -} - -function isQuoted (val) { - return (val.charAt(0) === '"' && val.slice(-1) === '"') || - (val.charAt(0) === "'" && val.slice(-1) === "'") -} - -function safe (val) { - return (typeof val !== 'string' || - val.match(/[=\r\n]/) || - val.match(/^\[/) || - (val.length > 1 && - isQuoted(val)) || - val !== val.trim()) - ? JSON.stringify(val) - : val.replace(/;/g, '\\;').replace(/#/g, '\\#') -} - -function unsafe (val, doUnesc) { - val = (val || '').trim() - if (isQuoted(val)) { - // remove the single quotes before calling JSON.parse - if (val.charAt(0) === "'") { - val = val.substr(1, val.length - 2) - } - try { val = JSON.parse(val) } catch (_) {} - } else { - // walk the val to find the first not-escaped ; character - var esc = false - var unesc = '' - for (var i = 0, l = val.length; i < l; i++) { - var c = val.charAt(i) - if (esc) { - if ('\\;#'.indexOf(c) !== -1) { - unesc += c - } else { - unesc += '\\' + c - } - esc = false - } else if (';#'.indexOf(c) !== -1) { - break - } else if (c === '\\') { - esc = true - } else { - unesc += c - } - } - if (esc) { - unesc += '\\' - } - return unesc.trim() - } - return val -} diff --git a/node_modules/ini/package.json b/node_modules/ini/package.json deleted file mode 100644 index 87d8566..0000000 --- a/node_modules/ini/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_args": [ - [ - "ini@1.3.5", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "ini@1.3.5", - "_id": "ini@1.3.5", - "_inBundle": false, - "_integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "_location": "/ini", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "ini@1.3.5", - "name": "ini", - "escapedName": "ini", - "rawSpec": "1.3.5", - "saveSpec": null, - "fetchSpec": "1.3.5" - }, - "_requiredBy": [ - "/config-chain" - ], - "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "_spec": "1.3.5", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/ini/issues" - }, - "dependencies": {}, - "description": "An ini encoder/decoder for node", - "devDependencies": { - "standard": "^10.0.3", - "tap": "^10.7.3 || 11" - }, - "engines": { - "node": "*" - }, - "files": [ - "ini.js" - ], - "homepage": "https://github.com/isaacs/ini#readme", - "license": "ISC", - "main": "ini.js", - "name": "ini", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/ini.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "pretest": "standard ini.js", - "preversion": "npm test", - "test": "tap test/*.js --100 -J" - }, - "version": "1.3.5" -} diff --git a/node_modules/decompress-tar/node_modules/is-stream/index.js b/node_modules/is-stream/index.js similarity index 100% rename from node_modules/decompress-tar/node_modules/is-stream/index.js rename to node_modules/is-stream/index.js diff --git a/node_modules/decompress-targz/node_modules/is-stream/license b/node_modules/is-stream/license similarity index 100% rename from node_modules/decompress-targz/node_modules/is-stream/license rename to node_modules/is-stream/license diff --git a/node_modules/decompress-targz/node_modules/is-stream/package.json b/node_modules/is-stream/package.json similarity index 92% rename from node_modules/decompress-targz/node_modules/is-stream/package.json rename to node_modules/is-stream/package.json index 11a2007..9566a69 100644 --- a/node_modules/decompress-targz/node_modules/is-stream/package.json +++ b/node_modules/is-stream/package.json @@ -9,7 +9,7 @@ "_id": "is-stream@1.1.0", "_inBundle": false, "_integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "_location": "/decompress-targz/is-stream", + "_location": "/is-stream", "_phantomChildren": {}, "_requested": { "type": "version", @@ -22,7 +22,10 @@ "fetchSpec": "1.1.0" }, "_requiredBy": [ - "/decompress-targz" + "/decompress-tar", + "/decompress-tarbz2", + "/decompress-targz", + "/execa" ], "_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "_spec": "1.1.0", diff --git a/node_modules/decompress-tar/node_modules/is-stream/readme.md b/node_modules/is-stream/readme.md similarity index 100% rename from node_modules/decompress-tar/node_modules/is-stream/readme.md rename to node_modules/is-stream/readme.md diff --git a/node_modules/isurl/package.json b/node_modules/isurl/package.json index 6939e05..6a0e29b 100644 --- a/node_modules/isurl/package.json +++ b/node_modules/isurl/package.json @@ -22,7 +22,6 @@ "fetchSpec": "1.0.0" }, "_requiredBy": [ - "/caw", "/got" ], "_resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", diff --git a/node_modules/make-dir/index.d.ts b/node_modules/make-dir/index.d.ts new file mode 100644 index 0000000..3e1529c --- /dev/null +++ b/node_modules/make-dir/index.d.ts @@ -0,0 +1,39 @@ +/// +import * as fs from 'fs'; + +export interface Options { + /** + * Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). + * + * @default 0o777 & (~process.umask()) + */ + readonly mode?: number; + + /** + * Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + * + * Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function. + * + * @default require('fs') + */ + readonly fs?: typeof fs; +} + +/** + * Make a directory and its parents if needed - Think `mkdir -p`. + * + * @param path - Directory to create. + * @returns A `Promise` for the path to the created directory. + */ +export default function makeDir( + path: string, + options?: Options +): Promise; + +/** + * Synchronously make a directory and its parents if needed - Think `mkdir -p`. + * + * @param path - Directory to create. + * @returns The path to the created directory. + */ +export function sync(path: string, options?: Options): string; diff --git a/node_modules/make-dir/index.js b/node_modules/make-dir/index.js index 1843955..4d95c91 100644 --- a/node_modules/make-dir/index.js +++ b/node_modules/make-dir/index.js @@ -2,12 +2,15 @@ const fs = require('fs'); const path = require('path'); const pify = require('pify'); +const semver = require('semver'); const defaults = { mode: 0o777 & (~process.umask()), fs }; +const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); + // https://github.com/nodejs/node/issues/8987 // https://github.com/libuv/libuv/pull/1088 const checkPath = pth => { @@ -15,27 +18,56 @@ const checkPath = pth => { const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')); if (pathHasInvalidWinCharacters) { - const err = new Error(`Path contains invalid characters: ${pth}`); - err.code = 'EINVAL'; - throw err; + const error = new Error(`Path contains invalid characters: ${pth}`); + error.code = 'EINVAL'; + throw error; } } }; -module.exports = (input, opts) => Promise.resolve().then(() => { - checkPath(input); - opts = Object.assign({}, defaults, opts); +const permissionError = pth => { + // This replicates the exception of `fs.mkdir` with native the + // `recusive` option when run on an invalid drive under Windows. + const error = new Error(`operation not permitted, mkdir '${pth}'`); + error.code = 'EPERM'; + error.errno = -4048; + error.path = pth; + error.syscall = 'mkdir'; + return error; +}; - const mkdir = pify(opts.fs.mkdir); - const stat = pify(opts.fs.stat); +const makeDir = (input, options) => Promise.resolve().then(() => { + checkPath(input); + options = Object.assign({}, defaults, options); + + // TODO: Use util.promisify when targeting Node.js 8 + const mkdir = pify(options.fs.mkdir); + const stat = pify(options.fs.stat); + + if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) { + const pth = path.resolve(input); + + return mkdir(pth, { + mode: options.mode, + recursive: true + }).then(() => pth); + } const make = pth => { - return mkdir(pth, opts.mode) + return mkdir(pth, options.mode) .then(() => pth) - .catch(err => { - if (err.code === 'ENOENT') { - if (err.message.includes('null bytes') || path.dirname(pth) === pth) { - throw err; + .catch(error => { + if (error.code === 'EPERM') { + throw error; + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } + + if (error.message.includes('null bytes')) { + throw error; } return make(path.dirname(pth)).then(() => make(pth)); @@ -44,7 +76,7 @@ module.exports = (input, opts) => Promise.resolve().then(() => { return stat(pth) .then(stats => stats.isDirectory() ? pth : Promise.reject()) .catch(() => { - throw err; + throw error; }); }); }; @@ -52,17 +84,39 @@ module.exports = (input, opts) => Promise.resolve().then(() => { return make(path.resolve(input)); }); -module.exports.sync = (input, opts) => { +module.exports = makeDir; +module.exports.default = makeDir; + +module.exports.sync = (input, options) => { checkPath(input); - opts = Object.assign({}, defaults, opts); + options = Object.assign({}, defaults, options); + + if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) { + const pth = path.resolve(input); + + fs.mkdirSync(pth, { + mode: options.mode, + recursive: true + }); + + return pth; + } const make = pth => { try { - opts.fs.mkdirSync(pth, opts.mode); - } catch (err) { - if (err.code === 'ENOENT') { - if (err.message.includes('null bytes') || path.dirname(pth) === pth) { - throw err; + options.fs.mkdirSync(pth, options.mode); + } catch (error) { + if (error.code === 'EPERM') { + throw error; + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } + + if (error.message.includes('null bytes')) { + throw error; } make(path.dirname(pth)); @@ -70,11 +124,11 @@ module.exports.sync = (input, opts) => { } try { - if (!opts.fs.statSync(pth).isDirectory()) { + if (!options.fs.statSync(pth).isDirectory()) { throw new Error('The path is not a directory'); } } catch (_) { - throw err; + throw error; } } diff --git a/node_modules/make-dir/node_modules/.bin/semver b/node_modules/make-dir/node_modules/.bin/semver new file mode 120000 index 0000000..317eb29 --- /dev/null +++ b/node_modules/make-dir/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver \ No newline at end of file diff --git a/node_modules/make-dir/node_modules/semver/CHANGELOG.md b/node_modules/make-dir/node_modules/semver/CHANGELOG.md new file mode 100644 index 0000000..66304fd --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/CHANGELOG.md @@ -0,0 +1,39 @@ +# changes log + +## 5.7 + +* Add `minVersion` method + +## 5.6 + +* Move boolean `loose` param to an options object, with + backwards-compatibility protection. +* Add ability to opt out of special prerelease version handling with + the `includePrerelease` option flag. + +## 5.5 + +* Add version coercion capabilities + +## 5.4 + +* Add intersection checking + +## 5.3 + +* Add `minSatisfying` method + +## 5.2 + +* Add `prerelease(v)` that returns prerelease components + +## 5.1 + +* Add Backus-Naur for ranges +* Remove excessively cute inspection methods + +## 5.0 + +* Remove AMD/Browserified build artifacts +* Fix ltr and gtr when using the `*` range +* Fix for range `*` with a prerelease identifier diff --git a/node_modules/ini/LICENSE b/node_modules/make-dir/node_modules/semver/LICENSE similarity index 100% rename from node_modules/ini/LICENSE rename to node_modules/make-dir/node_modules/semver/LICENSE diff --git a/node_modules/make-dir/node_modules/semver/README.md b/node_modules/make-dir/node_modules/semver/README.md new file mode 100644 index 0000000..f8dfa5a --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/README.md @@ -0,0 +1,412 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install --save semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/node_modules/make-dir/node_modules/semver/bin/semver b/node_modules/make-dir/node_modules/semver/bin/semver new file mode 100755 index 0000000..801e77f --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/bin/semver @@ -0,0 +1,160 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/node_modules/make-dir/node_modules/semver/package.json b/node_modules/make-dir/node_modules/semver/package.json new file mode 100644 index 0000000..89df38c --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/package.json @@ -0,0 +1,63 @@ +{ + "_args": [ + [ + "semver@5.7.1", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "semver@5.7.1", + "_id": "semver@5.7.1", + "_inBundle": false, + "_integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "_location": "/make-dir/semver", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "semver@5.7.1", + "name": "semver", + "escapedName": "semver", + "rawSpec": "5.7.1", + "saveSpec": null, + "fetchSpec": "5.7.1" + }, + "_requiredBy": [ + "/make-dir" + ], + "_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "_spec": "5.7.1", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "bin": { + "semver": "bin/semver" + }, + "bugs": { + "url": "https://github.com/npm/node-semver/issues" + }, + "description": "The semantic version parser used by npm.", + "devDependencies": { + "tap": "^13.0.0-rc.18" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "homepage": "https://github.com/npm/node-semver#readme", + "license": "ISC", + "main": "semver.js", + "name": "semver", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-semver.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap" + }, + "tap": { + "check-coverage": true + }, + "version": "5.7.1" +} diff --git a/node_modules/make-dir/node_modules/semver/range.bnf b/node_modules/make-dir/node_modules/semver/range.bnf new file mode 100644 index 0000000..d4c6ae0 --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/make-dir/node_modules/semver/semver.js b/node_modules/make-dir/node_modules/semver/semver.js new file mode 100644 index 0000000..d315d5d --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/semver.js @@ -0,0 +1,1483 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +// The actual regexps go on exports.re +var re = exports.re = [] +var src = exports.src = [] +var R = 0 + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++ +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' +var NUMERICIDENTIFIERLOOSE = R++ +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++ +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++ +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')' + +var MAINVERSIONLOOSE = R++ +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++ +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +var PRERELEASEIDENTIFIERLOOSE = R++ +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++ +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' + +var PRERELEASELOOSE = R++ +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++ +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++ +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++ +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?' + +src[FULL] = '^' + FULLPLAIN + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?' + +var LOOSE = R++ +src[LOOSE] = '^' + LOOSEPLAIN + '$' + +var GTLT = R++ +src[GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++ +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +var XRANGEIDENTIFIER = R++ +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' + +var XRANGEPLAIN = R++ +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGEPLAINLOOSE = R++ +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGE = R++ +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' +var XRANGELOOSE = R++ +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++ +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++ +src[LONETILDE] = '(?:~>?)' + +var TILDETRIM = R++ +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +var tildeTrimReplace = '$1~' + +var TILDE = R++ +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' +var TILDELOOSE = R++ +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++ +src[LONECARET] = '(?:\\^)' + +var CARETTRIM = R++ +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +var caretTrimReplace = '$1^' + +var CARET = R++ +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' +var CARETLOOSE = R++ +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++ +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' +var COMPARATOR = R++ +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++ +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++ +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$' + +var HYPHENRANGELOOSE = R++ +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +var STAR = R++ +src[STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? re[LOOSE] : re[FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY) { + return true + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + }) + }) +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? re[TILDELOOSE] : re[TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? re[CARETLOOSE] : re[CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], '') +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version) { + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + var match = version.match(re[COERCE]) + + if (match == null) { + return null + } + + return parse(match[1] + + '.' + (match[2] || '0') + + '.' + (match[3] || '0')) +} diff --git a/node_modules/make-dir/package.json b/node_modules/make-dir/package.json index 3be9aa2..b62d460 100644 --- a/node_modules/make-dir/package.json +++ b/node_modules/make-dir/package.json @@ -1,32 +1,31 @@ { "_args": [ [ - "make-dir@1.3.0", + "make-dir@2.1.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "make-dir@1.3.0", - "_id": "make-dir@1.3.0", + "_from": "make-dir@2.1.0", + "_id": "make-dir@2.1.0", "_inBundle": false, - "_integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "_integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", "_location": "/make-dir", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "make-dir@1.3.0", + "raw": "make-dir@2.1.0", "name": "make-dir", "escapedName": "make-dir", - "rawSpec": "1.3.0", + "rawSpec": "2.1.0", "saveSpec": null, - "fetchSpec": "1.3.0" + "fetchSpec": "2.1.0" }, "_requiredBy": [ - "/decompress", "/download" ], - "_resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "_spec": "1.3.0", + "_resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "_spec": "2.1.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Sindre Sorhus", @@ -37,23 +36,28 @@ "url": "https://github.com/sindresorhus/make-dir/issues" }, "dependencies": { - "pify": "^3.0.0" + "pify": "^4.0.1", + "semver": "^5.6.0" }, "description": "Make a directory and its parents if needed - Think `mkdir -p`", "devDependencies": { - "ava": "*", + "@types/graceful-fs": "^4.1.3", + "@types/node": "^11.10.4", + "ava": "^1.2.0", "codecov": "^3.0.0", "graceful-fs": "^4.1.11", - "nyc": "^11.3.0", + "nyc": "^13.1.0", "path-type": "^3.0.0", "tempy": "^0.2.1", - "xo": "^0.20.0" + "tsd-check": "^0.3.0", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/make-dir#readme", "keywords": [ @@ -84,7 +88,7 @@ "url": "git+https://github.com/sindresorhus/make-dir.git" }, "scripts": { - "test": "xo && nyc ava" + "test": "xo && nyc ava && tsd-check" }, - "version": "1.3.0" + "version": "2.1.0" } diff --git a/node_modules/make-dir/readme.md b/node_modules/make-dir/readme.md index 8a32bf4..8c225c1 100644 --- a/node_modules/make-dir/readme.md +++ b/node_modules/make-dir/readme.md @@ -1,4 +1,4 @@ -# make-dir [![Build Status: macOS & Linux](https://travis-ci.org/sindresorhus/make-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/make-dir) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/e0vtt8y600w91gcs/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/make-dir/branch/master) [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir) +# make-dir [![Build Status](https://travis-ci.org/sindresorhus/make-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/make-dir) [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir) > Make a directory and its parents if needed - Think `mkdir -p` @@ -11,6 +11,7 @@ - CI-tested on macOS, Linux, and Windows - Actively maintained - Doesn't bundle a CLI +- Uses native the `fs.mkdir/mkdirSync` [`recursive` option](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_mkdir_path_options_callback) in Node.js >=10.12.0 unless [overridden](#fs) ## Install @@ -32,10 +33,12 @@ $ tree ```js const makeDir = require('make-dir'); -makeDir('unicorn/rainbow/cake').then(path => { +(async () => { + const path = await makeDir('unicorn/rainbow/cake'); + console.log(path); //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake' -}); +})(); ``` ``` @@ -51,10 +54,12 @@ Multiple directories: ```js const makeDir = require('make-dir'); -Promise.all([ - makeDir('unicorn/rainbow') - makeDir('foo/bar') -]).then(paths => { +(async () => { + const paths = await Promise.all([ + makeDir('unicorn/rainbow'), + makeDir('foo/bar') + ]); + console.log(paths); /* [ @@ -62,7 +67,7 @@ Promise.all([ '/Users/sindresorhus/fun/foo/bar' ] */ -}); +})(); ``` @@ -100,6 +105,8 @@ Default: `require('fs')` Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). +Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function. + ## Related diff --git a/node_modules/mime-db/HISTORY.md b/node_modules/mime-db/HISTORY.md index 6233527..8afff37 100644 --- a/node_modules/mime-db/HISTORY.md +++ b/node_modules/mime-db/HISTORY.md @@ -1,3 +1,18 @@ +1.43.0 / 2020-01-05 +=================== + + * Add `application/x-keepass2` with extension `.kdbx` + * Add extension `.mxmf` to `audio/mobile-xmf` + * Add extensions from IANA for `application/*+xml` types + * Add new upstream MIME types + +1.42.0 / 2019-09-25 +=================== + + * Add `image/vnd.ms-dds` with extension `.dds` + * Add new upstream MIME types + * Remove compressible from `multipart/mixed` + 1.41.0 / 2019-08-30 =================== diff --git a/node_modules/mime-db/README.md b/node_modules/mime-db/README.md index dcc9d09..68e3a1a 100644 --- a/node_modules/mime-db/README.md +++ b/node_modules/mime-db/README.md @@ -76,13 +76,19 @@ and the values being an object with the following keys: To update the build, run `npm run build`. -## Adding Custom Media Types +### Adding Custom Media Types The best way to get new media types included in this library is to register them with the IANA. The community registration procedure is outlined in [RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types registered with the IANA are automatically pulled into this library. +If that is not possible / feasible, they can be added directly here as a +"custom" type. To do this, it is required to have a primary source that +definitively lists the media type. If an extension is going to be listed as +associateed with this media type, the source must definitively link the +media type and extension as well. + [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master [coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master [node-image]: https://badgen.net/npm/node/mime-db diff --git a/node_modules/mime-db/db.json b/node_modules/mime-db/db.json index 22d1495..cfa3c63 100644 --- a/node_modules/mime-db/db.json +++ b/node_modules/mime-db/db.json @@ -92,7 +92,8 @@ }, "application/atomdeleted+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["atomdeleted"] }, "application/atomicmail": { "source": "iana" @@ -104,15 +105,22 @@ }, "application/atsc-dwd+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["dwd"] }, "application/atsc-held+xml": { + "source": "iana", + "compressible": true, + "extensions": ["held"] + }, + "application/atsc-rdt+json": { "source": "iana", "compressible": true }, "application/atsc-rsat+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["rsat"] }, "application/atxml": { "source": "iana" @@ -142,7 +150,8 @@ }, "application/calendar+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xcs"] }, "application/call-completion": { "source": "iana" @@ -153,6 +162,9 @@ "application/cbor": { "source": "iana" }, + "application/cbor-seq": { + "source": "iana" + }, "application/cccex": { "source": "iana" }, @@ -167,7 +179,8 @@ }, "application/cdfx+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["cdfx"] }, "application/cdmi-capability": { "source": "iana", @@ -206,6 +219,10 @@ "application/cfw": { "source": "iana" }, + "application/clue+xml": { + "source": "iana", + "compressible": true + }, "application/clue_info+xml": { "source": "iana", "compressible": true @@ -403,7 +420,8 @@ }, "application/emotionml+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["emotionml"] }, "application/encaprtp": { "source": "iana" @@ -436,7 +454,8 @@ }, "application/fdt+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["fdt"] }, "application/fhir+json": { "source": "iana", @@ -577,7 +596,8 @@ }, "application/its+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["its"] }, "application/java-archive": { "source": "apache", @@ -662,7 +682,8 @@ }, "application/lgr+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["lgr"] }, "application/link-format": { "source": "iana" @@ -821,11 +842,13 @@ }, "application/mmt-aei+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["maei"] }, "application/mmt-usd+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["musd"] }, "application/mods+xml": { "source": "iana", @@ -863,11 +886,13 @@ }, "application/mrb-consumer+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xdf"] }, "application/mrb-publish+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xdf"] }, "application/msc-ivr+xml": { "source": "iana", @@ -886,6 +911,9 @@ "source": "iana", "compressible": true }, + "application/multipart-core": { + "source": "iana" + }, "application/mxf": { "source": "iana", "extensions": ["mxf"] @@ -970,7 +998,8 @@ }, "application/p2p-overlay+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["relo"] }, "application/parityfec": { "source": "iana" @@ -1088,7 +1117,8 @@ }, "application/provenance+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["provx"] }, "application/prs.alvestrand.titrax-sheet": { "source": "iana" @@ -1182,15 +1212,18 @@ }, "application/route-apd+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["rapd"] }, "application/route-s-tsid+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["sls"] }, "application/route-usd+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["rusd"] }, "application/rpki-ghostbusters": { "source": "iana", @@ -1284,7 +1317,8 @@ }, "application/senml+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["senmlx"] }, "application/senml-exi": { "source": "iana" @@ -1298,7 +1332,8 @@ }, "application/sensml+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["sensmlx"] }, "application/sensml-exi": { "source": "iana" @@ -1420,6 +1455,11 @@ "source": "iana", "compressible": true }, + "application/swid+xml": { + "source": "iana", + "compressible": true, + "extensions": ["swidtag"] + }, "application/tamp-apex-update": { "source": "iana" }, @@ -1505,7 +1545,8 @@ }, "application/ttml+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["ttml"] }, "application/tve-trigger": { "source": "iana" @@ -1525,7 +1566,8 @@ }, "application/urc-ressheet+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["rsheet"] }, "application/urc-targetdesc+xml": { "source": "iana", @@ -1551,7 +1593,8 @@ }, "application/vnd.1000minds.decision-model+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["1km"] }, "application/vnd.3gpp-prose+xml": { "source": "iana", @@ -1788,9 +1831,36 @@ "application/vnd.afpc.afplinedata": { "source": "iana" }, + "application/vnd.afpc.afplinedata-pagedef": { + "source": "iana" + }, + "application/vnd.afpc.foca-charset": { + "source": "iana" + }, + "application/vnd.afpc.foca-codedfont": { + "source": "iana" + }, + "application/vnd.afpc.foca-codepage": { + "source": "iana" + }, "application/vnd.afpc.modca": { "source": "iana" }, + "application/vnd.afpc.modca-formdef": { + "source": "iana" + }, + "application/vnd.afpc.modca-mediummap": { + "source": "iana" + }, + "application/vnd.afpc.modca-objectcontainer": { + "source": "iana" + }, + "application/vnd.afpc.modca-overlay": { + "source": "iana" + }, + "application/vnd.afpc.modca-pagesegment": { + "source": "iana" + }, "application/vnd.ah-barcode": { "source": "iana" }, @@ -1865,6 +1935,10 @@ "source": "iana", "compressible": true }, + "application/vnd.aplextor.warrp+json": { + "source": "iana", + "compressible": true + }, "application/vnd.apothekende.reservation+json": { "source": "iana", "compressible": true @@ -1929,7 +2003,8 @@ }, "application/vnd.balsamiq.bmml+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["bmml"] }, "application/vnd.balsamiq.bmpr": { "source": "iana" @@ -2579,6 +2654,10 @@ "application/vnd.ffsns": { "source": "iana" }, + "application/vnd.ficlab.flb+zip": { + "source": "iana", + "compressible": false + }, "application/vnd.filmit.zfc": { "source": "iana" }, @@ -2677,6 +2756,10 @@ "source": "iana", "extensions": ["txd"] }, + "application/vnd.gentics.grd+json": { + "source": "iana", + "compressible": true + }, "application/vnd.geo+json": { "source": "iana", "compressible": true @@ -3643,7 +3726,8 @@ }, "application/vnd.nokia.n-gage.ac+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["ac"] }, "application/vnd.nokia.n-gage.data": { "source": "iana", @@ -3997,7 +4081,8 @@ }, "application/vnd.openblox.game+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["obgx"] }, "application/vnd.openblox.game-binary": { "source": "iana" @@ -4011,7 +4096,8 @@ }, "application/vnd.openstreetmap.data+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["osm"] }, "application/vnd.openxmlformats-officedocument.custom-properties+xml": { "source": "iana", @@ -4690,7 +4776,8 @@ }, "application/vnd.software602.filler.form+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["fo"] }, "application/vnd.software602.filler.form-xml-zip": { "source": "iana" @@ -4837,7 +4924,8 @@ }, "application/vnd.syncml.dmddf+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["ddf"] }, "application/vnd.syncml.dmtnds+wbxml": { "source": "iana" @@ -5474,6 +5562,9 @@ "application/x-javascript": { "compressible": true }, + "application/x-keepass2": { + "extensions": ["kdbx"] + }, "application/x-latex": { "source": "apache", "compressible": false, @@ -5786,11 +5877,13 @@ }, "application/xcap-att+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xav"] }, "application/xcap-caps+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xca"] }, "application/xcap-diff+xml": { "source": "iana", @@ -5799,15 +5892,18 @@ }, "application/xcap-el+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xel"] }, "application/xcap-error+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xer"] }, "application/xcap-ns+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xns"] }, "application/xcon-conference-info+xml": { "source": "iana", @@ -5833,7 +5929,8 @@ }, "application/xliff+xml": { "source": "iana", - "compressible": true + "compressible": true, + "extensions": ["xlf"] }, "application/xml": { "source": "iana", @@ -6153,7 +6250,8 @@ "extensions": ["mid","midi","kar","rmi"] }, "audio/mobile-xmf": { - "source": "iana" + "source": "iana", + "extensions": ["mxmf"] }, "audio/mp3": { "compressible": false, @@ -6670,6 +6768,14 @@ "source": "iana", "extensions": ["jxrs"] }, + "image/jxs": { + "source": "iana", + "extensions": ["jxs"] + }, + "image/jxsc": { + "source": "iana", + "extensions": ["jxsc"] + }, "image/jxsi": { "source": "iana", "extensions": ["jxsi"] @@ -6791,6 +6897,9 @@ "image/vnd.mozilla.apng": { "source": "iana" }, + "image/vnd.ms-dds": { + "extensions": ["dds"] + }, "image/vnd.ms-modi": { "source": "iana", "extensions": ["mdi"] @@ -7143,8 +7252,7 @@ "source": "iana" }, "multipart/mixed": { - "source": "iana", - "compressible": false + "source": "iana" }, "multipart/multilingual": { "source": "iana" @@ -7411,6 +7519,9 @@ "text/vnd.esmertec.theme-descriptor": { "source": "iana" }, + "text/vnd.ficlab.flt": { + "source": "iana" + }, "text/vnd.fly": { "source": "iana", "extensions": ["fly"] @@ -7489,6 +7600,7 @@ "extensions": ["wmls"] }, "text/vtt": { + "source": "iana", "charset": "UTF-8", "compressible": true, "extensions": ["vtt"] diff --git a/node_modules/mime-db/package.json b/node_modules/mime-db/package.json index 2f0305c..2474d4e 100644 --- a/node_modules/mime-db/package.json +++ b/node_modules/mime-db/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "mime-db@1.41.0", + "mime-db@1.43.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "mime-db@1.41.0", - "_id": "mime-db@1.41.0", + "_from": "mime-db@1.43.0", + "_id": "mime-db@1.43.0", "_inBundle": false, - "_integrity": "sha512-B5gxBI+2K431XW8C2rcc/lhppbuji67nf9v39eH8pkWoZDxnAL0PxdpH32KYRScniF8qDHBDlI+ipgg5WrCUYw==", + "_integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", "_location": "/mime-db", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "mime-db@1.41.0", + "raw": "mime-db@1.43.0", "name": "mime-db", "escapedName": "mime-db", - "rawSpec": "1.41.0", + "rawSpec": "1.43.0", "saveSpec": null, - "fetchSpec": "1.41.0" + "fetchSpec": "1.43.0" }, "_requiredBy": [ "/ext-list" ], - "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.41.0.tgz", - "_spec": "1.41.0", + "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "_spec": "1.43.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "bugs": { "url": "https://github.com/jshttp/mime-db/issues" @@ -48,19 +48,19 @@ ], "description": "Media Type Database", "devDependencies": { - "bluebird": "3.5.5", + "bluebird": "3.7.2", "co": "4.6.0", "cogent": "1.0.1", - "csv-parse": "4.4.5", - "eslint": "6.2.2", + "csv-parse": "4.8.3", + "eslint": "6.8.0", "eslint-config-standard": "14.1.0", - "eslint-plugin-import": "2.18.2", - "eslint-plugin-node": "9.2.0", + "eslint-plugin-import": "2.19.1", + "eslint-plugin-node": "11.0.0", "eslint-plugin-promise": "4.2.1", "eslint-plugin-standard": "4.0.1", "gnode": "0.1.2", - "mocha": "6.2.0", - "nyc": "14.1.1", + "mocha": "7.0.0", + "nyc": "15.0.0", "raw-body": "2.4.1", "stream-to-array": "2.3.0" }, @@ -100,5 +100,5 @@ "update": "npm run fetch && npm run build", "version": "node scripts/version-history.js && git add HISTORY.md" }, - "version": "1.41.0" + "version": "1.43.0" } diff --git a/node_modules/npm-conf/index.js b/node_modules/npm-conf/index.js deleted file mode 100644 index ee735e1..0000000 --- a/node_modules/npm-conf/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -const path = require('path'); -const Conf = require('./lib/conf'); -const defaults = require('./lib/defaults'); - -// https://github.com/npm/npm/blob/latest/lib/config/core.js#L101-L200 -module.exports = opts => { - const conf = new Conf(Object.assign({}, defaults.defaults)); - - conf.add(Object.assign({}, opts), 'cli'); - conf.addEnv(); - conf.loadPrefix(); - - const projectConf = path.resolve(conf.localPrefix, '.npmrc'); - const userConf = conf.get('userconfig'); - - if (!conf.get('global') && projectConf !== userConf) { - conf.addFile(projectConf, 'project'); - } else { - conf.add({}, 'project'); - } - - conf.addFile(conf.get('userconfig'), 'user'); - - if (conf.get('prefix')) { - const etc = path.resolve(conf.get('prefix'), 'etc'); - conf.root.globalconfig = path.resolve(etc, 'npmrc'); - conf.root.globalignorefile = path.resolve(etc, 'npmignore'); - } - - conf.addFile(conf.get('globalconfig'), 'global'); - conf.loadUser(); - - const caFile = conf.get('cafile'); - - if (caFile) { - conf.loadCAFile(caFile); - } - - return conf; -}; - -module.exports.defaults = Object.assign({}, defaults.defaults); diff --git a/node_modules/npm-conf/lib/conf.js b/node_modules/npm-conf/lib/conf.js deleted file mode 100644 index b2a8f0a..0000000 --- a/node_modules/npm-conf/lib/conf.js +++ /dev/null @@ -1,174 +0,0 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const ConfigChain = require('config-chain').ConfigChain; -const util = require('./util'); - -class Conf extends ConfigChain { - // https://github.com/npm/npm/blob/latest/lib/config/core.js#L208-L222 - constructor(base) { - super(base); - this.root = base; - } - - // https://github.com/npm/npm/blob/latest/lib/config/core.js#L332-L342 - add(data, marker) { - try { - for (const x of Object.keys(data)) { - data[x] = util.parseField(data[x], x); - } - } catch (err) { - throw err; - } - - return super.add(data, marker); - } - - // https://github.com/npm/npm/blob/latest/lib/config/core.js#L312-L325 - addFile(file, name) { - name = name || file; - - const marker = {__source__: name}; - - this.sources[name] = {path: file, type: 'ini'}; - this.push(marker); - this._await(); - - try { - const contents = fs.readFileSync(file, 'utf8'); - this.addString(contents, file, 'ini', marker); - } catch (err) { - this.add({}, marker); - } - - return this; - } - - // https://github.com/npm/npm/blob/latest/lib/config/core.js#L344-L360 - addEnv(env) { - env = env || process.env; - - const conf = {}; - - Object.keys(env) - .filter(x => /^npm_config_/i.test(x)) - .forEach(x => { - if (!env[x]) { - return; - } - - const p = x.toLowerCase() - .replace(/^npm_config_/, '') - .replace(/(?!^)_/g, '-'); - - conf[p] = env[x]; - }); - - return super.addEnv('', conf, 'env'); - } - - // https://github.com/npm/npm/blob/latest/lib/config/load-prefix.js - loadPrefix() { - const cli = this.list[0]; - - Object.defineProperty(this, 'prefix', { - enumerable: true, - set: prefix => { - const g = this.get('global'); - this[g ? 'globalPrefix' : 'localPrefix'] = prefix; - }, - get: () => { - const g = this.get('global'); - return g ? this.globalPrefix : this.localPrefix; - } - }); - - Object.defineProperty(this, 'globalPrefix', { - enumerable: true, - set: prefix => { - this.set('prefix', prefix); - }, - get: () => { - return path.resolve(this.get('prefix')); - } - }); - - let p; - - Object.defineProperty(this, 'localPrefix', { - enumerable: true, - set: prefix => { - p = prefix; - }, - get: () => { - return p; - } - }); - - if (Object.prototype.hasOwnProperty.call(cli, 'prefix')) { - p = path.resolve(cli.prefix); - } else { - try { - const prefix = util.findPrefix(process.cwd()); - p = prefix; - } catch (err) { - throw err; - } - } - - return p; - } - - // https://github.com/npm/npm/blob/latest/lib/config/load-cafile.js - loadCAFile(file) { - if (!file) { - return; - } - - try { - const contents = fs.readFileSync(file, 'utf8'); - const delim = '-----END CERTIFICATE-----'; - const output = contents - .split(delim) - .filter(x => Boolean(x.trim())) - .map(x => x.trimLeft() + delim); - - this.set('ca', output); - } catch (err) { - if (err.code === 'ENOENT') { - return; - } - - throw err; - } - } - - // https://github.com/npm/npm/blob/latest/lib/config/set-user.js - loadUser() { - const defConf = this.root; - - if (this.get('global')) { - return; - } - - if (process.env.SUDO_UID) { - defConf.user = Number(process.env.SUDO_UID); - return; - } - - const prefix = path.resolve(this.get('prefix')); - - try { - const stats = fs.statSync(prefix); - defConf.user = stats.uid; - } catch (err) { - if (err.code === 'ENOENT') { - return; - } - - throw err; - } - } -} - -module.exports = Conf; diff --git a/node_modules/npm-conf/lib/defaults.js b/node_modules/npm-conf/lib/defaults.js deleted file mode 100644 index 6c0db4a..0000000 --- a/node_modules/npm-conf/lib/defaults.js +++ /dev/null @@ -1,169 +0,0 @@ - - // Generated with `lib/make.js` - 'use strict'; - const os = require('os'); - const path = require('path'); - - const temp = os.tmpdir(); - const uidOrPid = process.getuid ? process.getuid() : process.pid; - const hasUnicode = () => true; - const isWindows = process.platform === 'win32'; - - const osenv = { - editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? 'notepad.exe' : 'vi'), - shell: () => isWindows ? (process.env.COMSPEC || 'cmd.exe') : (process.env.SHELL || '/bin/bash') - }; - - const umask = { - fromString: () => process.umask() - }; - - let home = os.homedir(); - - if (home) { - process.env.HOME = home; - } else { - home = path.resolve(temp, 'npm-' + uidOrPid); - } - - const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm'; - const cacheRoot = process.platform === 'win32' ? process.env.APPDATA : home; - const cache = path.resolve(cacheRoot, cacheExtra); - - let defaults; - let globalPrefix; - - Object.defineProperty(exports, 'defaults', { - get: function () { - if (defaults) return defaults; - - if (process.env.PREFIX) { - globalPrefix = process.env.PREFIX; - } else if (process.platform === 'win32') { - // c:\node\node.exe --> prefix=c:\node\ - globalPrefix = path.dirname(process.execPath); - } else { - // /usr/local/bin/node --> prefix=/usr/local - globalPrefix = path.dirname(path.dirname(process.execPath)); // destdir only is respected on Unix - - if (process.env.DESTDIR) { - globalPrefix = path.join(process.env.DESTDIR, globalPrefix); - } - } - - defaults = { - access: null, - 'allow-same-version': false, - 'always-auth': false, - also: null, - 'auth-type': 'legacy', - 'bin-links': true, - browser: null, - ca: null, - cafile: null, - cache: cache, - 'cache-lock-stale': 60000, - 'cache-lock-retries': 10, - 'cache-lock-wait': 10000, - 'cache-max': Infinity, - 'cache-min': 10, - cert: null, - color: true, - depth: Infinity, - description: true, - dev: false, - 'dry-run': false, - editor: osenv.editor(), - 'engine-strict': false, - force: false, - 'fetch-retries': 2, - 'fetch-retry-factor': 10, - 'fetch-retry-mintimeout': 10000, - 'fetch-retry-maxtimeout': 60000, - git: 'git', - 'git-tag-version': true, - global: false, - globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'), - 'global-style': false, - group: process.platform === 'win32' ? 0 : process.env.SUDO_GID || process.getgid && process.getgid(), - 'ham-it-up': false, - heading: 'npm', - 'if-present': false, - 'ignore-prepublish': false, - 'ignore-scripts': false, - 'init-module': path.resolve(home, '.npm-init.js'), - 'init-author-name': '', - 'init-author-email': '', - 'init-author-url': '', - 'init-version': '1.0.0', - 'init-license': 'ISC', - json: false, - key: null, - 'legacy-bundling': false, - link: false, - 'local-address': undefined, - loglevel: 'notice', - logstream: process.stderr, - 'logs-max': 10, - long: false, - maxsockets: 50, - message: '%s', - 'metrics-registry': null, - 'node-version': process.version, - 'offline': false, - 'onload-script': false, - only: null, - optional: true, - 'package-lock': true, - parseable: false, - 'prefer-offline': false, - 'prefer-online': false, - prefix: globalPrefix, - production: process.env.NODE_ENV === 'production', - 'progress': !process.env.TRAVIS && !process.env.CI, - 'proprietary-attribs': true, - proxy: null, - 'https-proxy': null, - 'user-agent': 'npm/{npm-version} ' + 'node/{node-version} ' + '{platform} ' + '{arch}', - 'rebuild-bundle': true, - registry: 'https://registry.npmjs.org/', - rollback: true, - save: true, - 'save-bundle': false, - 'save-dev': false, - 'save-exact': false, - 'save-optional': false, - 'save-prefix': '^', - 'save-prod': false, - scope: '', - 'script-shell': null, - 'scripts-prepend-node-path': 'warn-only', - searchopts: '', - searchexclude: null, - searchlimit: 20, - searchstaleness: 15 * 60, - 'send-metrics': false, - shell: osenv.shell(), - shrinkwrap: true, - 'sign-git-tag': false, - 'sso-poll-frequency': 500, - 'sso-type': 'oauth', - 'strict-ssl': true, - tag: 'latest', - 'tag-version-prefix': 'v', - timing: false, - tmp: temp, - unicode: hasUnicode(), - 'unsafe-perm': process.platform === 'win32' || process.platform === 'cygwin' || !(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0, - usage: false, - user: process.platform === 'win32' ? 0 : 'nobody', - userconfig: path.resolve(home, '.npmrc'), - umask: process.umask ? process.umask() : umask.fromString('022'), - version: false, - versions: false, - viewer: process.platform === 'win32' ? 'browser' : 'man', - _exit: true - }; - return defaults; - } -}) diff --git a/node_modules/npm-conf/lib/make.js b/node_modules/npm-conf/lib/make.js deleted file mode 100644 index fb79d6c..0000000 --- a/node_modules/npm-conf/lib/make.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const babylon = require('babylon'); -const generate = require('babel-generator').default; -const traverse = require('babel-traverse').default; - -const defaultsTemplate = body => ` - // Generated with \`lib/make.js\` - 'use strict'; - const os = require('os'); - const path = require('path'); - - const temp = os.tmpdir(); - const uidOrPid = process.getuid ? process.getuid() : process.pid; - const hasUnicode = () => true; - const isWindows = process.platform === 'win32'; - - const osenv = { - editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? 'notepad.exe' : 'vi'), - shell: () => isWindows ? (process.env.COMSPEC || 'cmd.exe') : (process.env.SHELL || '/bin/bash') - }; - - const umask = { - fromString: () => process.umask() - }; - - let home = os.homedir(); - - if (home) { - process.env.HOME = home; - } else { - home = path.resolve(temp, 'npm-' + uidOrPid); - } - - const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm'; - const cacheRoot = process.platform === 'win32' ? process.env.APPDATA : home; - const cache = path.resolve(cacheRoot, cacheExtra); - - let defaults; - let globalPrefix; - - ${body} -`; - -const typesTemplate = body => ` - // Generated with \`lib/make.js\` - 'use strict'; - const path = require('path'); - const Stream = require('stream').Stream; - const url = require('url'); - - const Umask = () => {}; - const getLocalAddresses = () => []; - const semver = () => {}; - - ${body} -`; - -const defaults = require.resolve('npm/lib/config/defaults'); -const ast = babylon.parse(fs.readFileSync(defaults, 'utf8')); - -const isDefaults = node => - node.callee.type === 'MemberExpression' && - node.callee.object.name === 'Object' && - node.callee.property.name === 'defineProperty' && - node.arguments.some(x => x.name === 'exports'); - -const isTypes = node => - node.type === 'MemberExpression' && - node.object.name === 'exports' && - node.property.name === 'types'; - -let defs; -let types; - -traverse(ast, { - CallExpression(path) { - if (isDefaults(path.node)) { - defs = path.node; - } - }, - AssignmentExpression(path) { - if (path.node.left && isTypes(path.node.left)) { - types = path.node; - } - } -}); - -fs.writeFileSync(path.join(__dirname, 'defaults.js'), defaultsTemplate(generate(defs, {}, ast).code)); -fs.writeFileSync(path.join(__dirname, 'types.js'), typesTemplate(generate(types, {}, ast).code)); diff --git a/node_modules/npm-conf/lib/types.js b/node_modules/npm-conf/lib/types.js deleted file mode 100644 index ae82bc5..0000000 --- a/node_modules/npm-conf/lib/types.js +++ /dev/null @@ -1,127 +0,0 @@ - - // Generated with `lib/make.js` - 'use strict'; - const path = require('path'); - const Stream = require('stream').Stream; - const url = require('url'); - - const Umask = () => {}; - const getLocalAddresses = () => []; - const semver = () => {}; - - exports.types = { - access: [null, 'restricted', 'public'], - 'allow-same-version': Boolean, - 'always-auth': Boolean, - also: [null, 'dev', 'development'], - 'auth-type': ['legacy', 'sso', 'saml', 'oauth'], - 'bin-links': Boolean, - browser: [null, String], - ca: [null, String, Array], - cafile: path, - cache: path, - 'cache-lock-stale': Number, - 'cache-lock-retries': Number, - 'cache-lock-wait': Number, - 'cache-max': Number, - 'cache-min': Number, - cert: [null, String], - color: ['always', Boolean], - depth: Number, - description: Boolean, - dev: Boolean, - 'dry-run': Boolean, - editor: String, - 'engine-strict': Boolean, - force: Boolean, - 'fetch-retries': Number, - 'fetch-retry-factor': Number, - 'fetch-retry-mintimeout': Number, - 'fetch-retry-maxtimeout': Number, - git: String, - 'git-tag-version': Boolean, - global: Boolean, - globalconfig: path, - 'global-style': Boolean, - group: [Number, String], - 'https-proxy': [null, url], - 'user-agent': String, - 'ham-it-up': Boolean, - 'heading': String, - 'if-present': Boolean, - 'ignore-prepublish': Boolean, - 'ignore-scripts': Boolean, - 'init-module': path, - 'init-author-name': String, - 'init-author-email': String, - 'init-author-url': ['', url], - 'init-license': String, - 'init-version': semver, - json: Boolean, - key: [null, String], - 'legacy-bundling': Boolean, - link: Boolean, - // local-address must be listed as an IP for a local network interface - // must be IPv4 due to node bug - 'local-address': getLocalAddresses(), - loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'], - logstream: Stream, - 'logs-max': Number, - long: Boolean, - maxsockets: Number, - message: String, - 'metrics-registry': [null, String], - 'node-version': [null, semver], - offline: Boolean, - 'onload-script': [null, String], - only: [null, 'dev', 'development', 'prod', 'production'], - optional: Boolean, - 'package-lock': Boolean, - parseable: Boolean, - 'prefer-offline': Boolean, - 'prefer-online': Boolean, - prefix: path, - production: Boolean, - progress: Boolean, - 'proprietary-attribs': Boolean, - proxy: [null, false, url], - // allow proxy to be disabled explicitly - 'rebuild-bundle': Boolean, - registry: [null, url], - rollback: Boolean, - save: Boolean, - 'save-bundle': Boolean, - 'save-dev': Boolean, - 'save-exact': Boolean, - 'save-optional': Boolean, - 'save-prefix': String, - 'save-prod': Boolean, - scope: String, - 'script-shell': [null, String], - 'scripts-prepend-node-path': [false, true, 'auto', 'warn-only'], - searchopts: String, - searchexclude: [null, String], - searchlimit: Number, - searchstaleness: Number, - 'send-metrics': Boolean, - shell: String, - shrinkwrap: Boolean, - 'sign-git-tag': Boolean, - 'sso-poll-frequency': Number, - 'sso-type': [null, 'oauth', 'saml'], - 'strict-ssl': Boolean, - tag: String, - timing: Boolean, - tmp: path, - unicode: Boolean, - 'unsafe-perm': Boolean, - usage: Boolean, - user: [Number, String], - userconfig: path, - umask: Umask, - version: Boolean, - 'tag-version-prefix': String, - versions: Boolean, - viewer: String, - _exit: Boolean -} diff --git a/node_modules/npm-conf/lib/util.js b/node_modules/npm-conf/lib/util.js deleted file mode 100644 index 5cde7bc..0000000 --- a/node_modules/npm-conf/lib/util.js +++ /dev/null @@ -1,147 +0,0 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const types = require('./types'); - -// https://github.com/npm/npm/blob/latest/lib/config/core.js#L409-L423 -const envReplace = str => { - if (typeof str !== 'string' || !str) { - return str; - } - - // Replace any ${ENV} values with the appropriate environment - const regex = /(\\*)\$\{([^}]+)\}/g; - - return str.replace(regex, (orig, esc, name) => { - esc = esc.length > 0 && esc.length % 2; - - if (esc) { - return orig; - } - - if (process.env[name] === undefined) { - throw new Error(`Failed to replace env in config: ${orig}`); - } - - return process.env[name]; - }); -}; - -// https://github.com/npm/npm/blob/latest/lib/config/core.js#L362-L407 -const parseField = (field, key) => { - if (typeof field !== 'string') { - return field; - } - - const typeList = [].concat(types[key]); - const isPath = typeList.indexOf(path) !== -1; - const isBool = typeList.indexOf(Boolean) !== -1; - const isString = typeList.indexOf(String) !== -1; - const isNumber = typeList.indexOf(Number) !== -1; - - field = `${field}`.trim(); - - if (/^".*"$/.test(field)) { - try { - field = JSON.parse(field); - } catch (err) { - throw new Error(`Failed parsing JSON config key ${key}: ${field}`); - } - } - - if (isBool && !isString && field === '') { - return true; - } - - switch (field) { // eslint-disable-line default-case - case 'true': { - return true; - } - - case 'false': { - return false; - } - - case 'null': { - return null; - } - - case 'undefined': { - return undefined; - } - } - - field = envReplace(field); - - if (isPath) { - const regex = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//; - - if (regex.test(field) && process.env.HOME) { - field = path.resolve(process.env.HOME, field.substr(2)); - } - - field = path.resolve(field); - } - - if (isNumber && !field.isNan()) { - field = Number(field); - } - - return field; -}; - -// https://github.com/npm/npm/blob/latest/lib/config/find-prefix.js -const findPrefix = name => { - name = path.resolve(name); - - let walkedUp = false; - - while (path.basename(name) === 'node_modules') { - name = path.dirname(name); - walkedUp = true; - } - - if (walkedUp) { - return name; - } - - const find = (name, original) => { - const regex = /^[a-zA-Z]:(\\|\/)?$/; - - if (name === '/' || (process.platform === 'win32' && regex.test(name))) { - return original; - } - - try { - const files = fs.readdirSync(name); - - if (files.indexOf('node_modules') !== -1 || files.indexOf('package.json') !== -1) { - return name; - } - - const dirname = path.dirname(name); - - if (dirname === name) { - return original; - } - - return find(dirname, original); - } catch (err) { - if (name === original) { - if (err.code === 'ENOENT') { - return original; - } - - throw err; - } - - return original; - } - }; - - return find(name, name); -}; - -exports.envReplace = envReplace; -exports.findPrefix = findPrefix; -exports.parseField = parseField; diff --git a/node_modules/npm-conf/package.json b/node_modules/npm-conf/package.json deleted file mode 100644 index 6cdbde7..0000000 --- a/node_modules/npm-conf/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_args": [ - [ - "npm-conf@1.1.3", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "npm-conf@1.1.3", - "_id": "npm-conf@1.1.3", - "_inBundle": false, - "_integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", - "_location": "/npm-conf", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "npm-conf@1.1.3", - "name": "npm-conf", - "escapedName": "npm-conf", - "rawSpec": "1.1.3", - "saveSpec": null, - "fetchSpec": "1.1.3" - }, - "_requiredBy": [ - "/get-proxy" - ], - "_resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", - "_spec": "1.1.3", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Kevin Martensson", - "email": "kevinmartensson@gmail.com", - "url": "github.com/kevva" - }, - "bugs": { - "url": "https://github.com/kevva/npm-conf/issues" - }, - "dependencies": { - "config-chain": "^1.1.11", - "pify": "^3.0.0" - }, - "description": "Get the npm config", - "devDependencies": { - "ava": "*", - "babel-generator": "^6.24.1", - "babel-traverse": "^6.24.1", - "babylon": "^6.17.1", - "npm": "^5.0.4", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js", - "lib" - ], - "homepage": "https://github.com/kevva/npm-conf#readme", - "keywords": [ - "conf", - "config", - "global", - "npm", - "path", - "prefix", - "rc" - ], - "license": "MIT", - "name": "npm-conf", - "repository": { - "type": "git", - "url": "git+https://github.com/kevva/npm-conf.git" - }, - "scripts": { - "prepublish": "node lib/make.js", - "test": "xo && ava" - }, - "version": "1.1.3", - "xo": { - "ignores": [ - "lib/defaults.js", - "lib/types.js" - ] - } -} diff --git a/node_modules/npm-conf/readme.md b/node_modules/npm-conf/readme.md deleted file mode 100644 index d346d3e..0000000 --- a/node_modules/npm-conf/readme.md +++ /dev/null @@ -1,47 +0,0 @@ -# npm-conf [![Build Status](https://travis-ci.org/kevva/npm-conf.svg?branch=master)](https://travis-ci.org/kevva/npm-conf) - -> Get the npm config - - -## Install - -``` -$ npm install npm-conf -``` - - -## Usage - -```js -const npmConf = require('npm-conf'); - -const conf = npmConf(); - -conf.get('prefix') -//=> //=> /Users/unicorn/.npm-packages - -conf.get('registry') -//=> https://registry.npmjs.org/ -``` - -To get a list of all available `npm` config options: - -```bash -$ npm config list --long -``` - - -## API - -### npmConf() - -Returns the `npm` config. - -### npmConf.defaults - -Returns the default `npm` config. - - -## License - -MIT © [Kevin Mårtensson](https://github.com/kevva) diff --git a/node_modules/pify/index.js b/node_modules/pify/index.js index 1dee43a..df56221 100644 --- a/node_modules/pify/index.js +++ b/node_modules/pify/index.js @@ -1,83 +1,67 @@ 'use strict'; -const processFn = (fn, opts) => function () { - const P = opts.promiseModule; - const args = new Array(arguments.length); - - for (let i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } +const processFn = (fn, options) => function (...args) { + const P = options.promiseModule; return new P((resolve, reject) => { - if (opts.errorFirst) { - args.push(function (err, result) { - if (opts.multiArgs) { - const results = new Array(arguments.length - 1); - - for (let i = 1; i < arguments.length; i++) { - results[i - 1] = arguments[i]; - } - - if (err) { - results.unshift(err); - reject(results); + if (options.multiArgs) { + args.push((...result) => { + if (options.errorFirst) { + if (result[0]) { + reject(result); } else { - resolve(results); + result.shift(); + resolve(result); } - } else if (err) { - reject(err); + } else { + resolve(result); + } + }); + } else if (options.errorFirst) { + args.push((error, result) => { + if (error) { + reject(error); } else { resolve(result); } }); } else { - args.push(function (result) { - if (opts.multiArgs) { - const results = new Array(arguments.length - 1); - - for (let i = 0; i < arguments.length; i++) { - results[i] = arguments[i]; - } - - resolve(results); - } else { - resolve(result); - } - }); + args.push(resolve); } fn.apply(this, args); }); }; -module.exports = (obj, opts) => { - opts = Object.assign({ +module.exports = (input, options) => { + options = Object.assign({ exclude: [/.+(Sync|Stream)$/], errorFirst: true, promiseModule: Promise - }, opts); + }, options); + + const objType = typeof input; + if (!(input !== null && (objType === 'object' || objType === 'function'))) { + throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${input === null ? 'null' : objType}\``); + } const filter = key => { const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); - return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + return options.include ? options.include.some(match) : !options.exclude.some(match); }; let ret; - if (typeof obj === 'function') { - ret = function () { - if (opts.excludeMain) { - return obj.apply(this, arguments); - } - - return processFn(obj, opts).apply(this, arguments); + if (objType === 'function') { + ret = function (...args) { + return options.excludeMain ? input(...args) : processFn(input, options).apply(this, args); }; } else { - ret = Object.create(Object.getPrototypeOf(obj)); + ret = Object.create(Object.getPrototypeOf(input)); } - for (const key in obj) { // eslint-disable-line guard-for-in - const x = obj[key]; - ret[key] = typeof x === 'function' && filter(key) ? processFn(x, opts) : x; + for (const key in input) { // eslint-disable-line guard-for-in + const property = input[key]; + ret[key] = typeof property === 'function' && filter(key) ? processFn(property, options) : property; } return ret; diff --git a/node_modules/pify/package.json b/node_modules/pify/package.json index bee3218b..c06ad70 100644 --- a/node_modules/pify/package.json +++ b/node_modules/pify/package.json @@ -1,34 +1,32 @@ { "_args": [ [ - "pify@3.0.0", + "pify@4.0.1", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "pify@3.0.0", - "_id": "pify@3.0.0", + "_from": "pify@4.0.1", + "_id": "pify@4.0.1", "_inBundle": false, - "_integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "_integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "_location": "/pify", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "pify@3.0.0", + "raw": "pify@4.0.1", "name": "pify", "escapedName": "pify", - "rawSpec": "3.0.0", + "rawSpec": "4.0.1", "saveSpec": null, - "fetchSpec": "3.0.0" + "fetchSpec": "4.0.1" }, "_requiredBy": [ "/download", - "/got", - "/make-dir", - "/npm-conf" + "/make-dir" ], - "_resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "_spec": "3.0.0", + "_resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "_spec": "4.0.1", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Sindre Sorhus", @@ -40,13 +38,13 @@ }, "description": "Promisify a callback-style function", "devDependencies": { - "ava": "*", + "ava": "^0.25.0", "pinkie-promise": "^2.0.0", - "v8-natives": "^1.0.0", - "xo": "*" + "v8-natives": "^1.1.0", + "xo": "^0.23.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ "index.js" @@ -83,7 +81,7 @@ }, "scripts": { "optimization-test": "node --allow-natives-syntax optimization-test.js", - "test": "xo && ava && npm run optimization-test" + "test": "xo && ava" }, - "version": "3.0.0" + "version": "4.0.1" } diff --git a/node_modules/pify/readme.md b/node_modules/pify/readme.md index 376ca4e..7ae3f1c 100644 --- a/node_modules/pify/readme.md +++ b/node_modules/pify/readme.md @@ -2,11 +2,25 @@ > Promisify a callback-style function +--- + +
+ + Get professional support for 'pify' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
+ +--- + ## Install ``` -$ npm install --save pify +$ npm install pify ``` diff --git a/node_modules/proto-list/LICENSE b/node_modules/proto-list/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/proto-list/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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/proto-list/README.md b/node_modules/proto-list/README.md deleted file mode 100644 index 43cfa35..0000000 --- a/node_modules/proto-list/README.md +++ /dev/null @@ -1,3 +0,0 @@ -A list of objects, bound by their prototype chain. - -Used in npm's config stuff. diff --git a/node_modules/proto-list/package.json b/node_modules/proto-list/package.json deleted file mode 100644 index 8f45e0a..0000000 --- a/node_modules/proto-list/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_args": [ - [ - "proto-list@1.2.4", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "proto-list@1.2.4", - "_id": "proto-list@1.2.4", - "_inBundle": false, - "_integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", - "_location": "/proto-list", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "proto-list@1.2.4", - "name": "proto-list", - "escapedName": "proto-list", - "rawSpec": "1.2.4", - "saveSpec": null, - "fetchSpec": "1.2.4" - }, - "_requiredBy": [ - "/config-chain" - ], - "_resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "_spec": "1.2.4", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/proto-list/issues" - }, - "description": "A utility for managing a prototype chain", - "devDependencies": { - "tap": "0" - }, - "homepage": "https://github.com/isaacs/proto-list#readme", - "license": "ISC", - "main": "./proto-list.js", - "name": "proto-list", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/proto-list.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "1.2.4" -} diff --git a/node_modules/proto-list/proto-list.js b/node_modules/proto-list/proto-list.js deleted file mode 100644 index b55c25c..0000000 --- a/node_modules/proto-list/proto-list.js +++ /dev/null @@ -1,88 +0,0 @@ - -module.exports = ProtoList - -function setProto(obj, proto) { - if (typeof Object.setPrototypeOf === "function") - return Object.setPrototypeOf(obj, proto) - else - obj.__proto__ = proto -} - -function ProtoList () { - this.list = [] - var root = null - Object.defineProperty(this, 'root', { - get: function () { return root }, - set: function (r) { - root = r - if (this.list.length) { - setProto(this.list[this.list.length - 1], r) - } - }, - enumerable: true, - configurable: true - }) -} - -ProtoList.prototype = - { get length () { return this.list.length } - , get keys () { - var k = [] - for (var i in this.list[0]) k.push(i) - return k - } - , get snapshot () { - var o = {} - this.keys.forEach(function (k) { o[k] = this.get(k) }, this) - return o - } - , get store () { - return this.list[0] - } - , push : function (obj) { - if (typeof obj !== "object") obj = {valueOf:obj} - if (this.list.length >= 1) { - setProto(this.list[this.list.length - 1], obj) - } - setProto(obj, this.root) - return this.list.push(obj) - } - , pop : function () { - if (this.list.length >= 2) { - setProto(this.list[this.list.length - 2], this.root) - } - return this.list.pop() - } - , unshift : function (obj) { - setProto(obj, this.list[0] || this.root) - return this.list.unshift(obj) - } - , shift : function () { - if (this.list.length === 1) { - setProto(this.list[0], this.root) - } - return this.list.shift() - } - , get : function (key) { - return this.list[0][key] - } - , set : function (key, val, save) { - if (!this.length) this.push({}) - if (save && this.list[0].hasOwnProperty(key)) this.push({}) - return this.list[0][key] = val - } - , forEach : function (fn, thisp) { - for (var key in this.list[0]) fn.call(thisp, key, this.list[0][key]) - } - , slice : function () { - return this.list.slice.apply(this.list, arguments) - } - , splice : function () { - // handle injections - var ret = this.list.splice.apply(this.list, arguments) - for (var i = 0, l = this.list.length; i < l; i++) { - setProto(this.list[i], this.list[i + 1] || this.root) - } - return ret - } - } diff --git a/node_modules/proto-list/test/basic.js b/node_modules/proto-list/test/basic.js deleted file mode 100644 index 5cd66be..0000000 --- a/node_modules/proto-list/test/basic.js +++ /dev/null @@ -1,61 +0,0 @@ -var tap = require("tap") - , test = tap.test - , ProtoList = require("../proto-list.js") - -tap.plan(1) - -tap.test("protoList tests", function (t) { - var p = new ProtoList - p.push({foo:"bar"}) - p.push({}) - p.set("foo", "baz") - t.equal(p.get("foo"), "baz") - - var p = new ProtoList - p.push({foo:"bar"}) - p.set("foo", "baz") - t.equal(p.get("foo"), "baz") - t.equal(p.length, 1) - p.pop() - t.equal(p.length, 0) - p.set("foo", "asdf") - t.equal(p.length, 1) - t.equal(p.get("foo"), "asdf") - p.push({bar:"baz"}) - t.equal(p.length, 2) - t.equal(p.get("foo"), "asdf") - p.shift() - t.equal(p.length, 1) - t.equal(p.get("foo"), undefined) - - - p.unshift({foo:"blo", bar:"rab"}) - p.unshift({foo:"boo"}) - t.equal(p.length, 3) - t.equal(p.get("foo"), "boo") - t.equal(p.get("bar"), "rab") - - var ret = p.splice(1, 1, {bar:"bar"}) - t.same(ret, [{foo:"blo", bar:"rab"}]) - t.equal(p.get("bar"), "bar") - - // should not inherit default object properties - t.equal(p.get('hasOwnProperty'), undefined) - - // unless we give it those. - p.root = {} - t.equal(p.get('hasOwnProperty'), {}.hasOwnProperty) - - p.root = {default:'monkey'} - t.equal(p.get('default'), 'monkey') - - p.push({red:'blue'}) - p.push({red:'blue'}) - p.push({red:'blue'}) - while (p.length) { - t.equal(p.get('default'), 'monkey') - p.shift() - } - - t.end() -}) diff --git a/node_modules/pump/.travis.yml b/node_modules/pump/.travis.yml new file mode 100644 index 0000000..17f9433 --- /dev/null +++ b/node_modules/pump/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.10" + +script: "npm test" diff --git a/node_modules/pump/LICENSE b/node_modules/pump/LICENSE new file mode 100644 index 0000000..757562e --- /dev/null +++ b/node_modules/pump/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Mathias Buus + +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 diff --git a/node_modules/pump/README.md b/node_modules/pump/README.md new file mode 100644 index 0000000..4c81471 --- /dev/null +++ b/node_modules/pump/README.md @@ -0,0 +1,65 @@ +# pump + +pump is a small node module that pipes streams together and destroys all of them if one of them closes. + +``` +npm install pump +``` + +[![build status](http://img.shields.io/travis/mafintosh/pump.svg?style=flat)](http://travis-ci.org/mafintosh/pump) + +## What problem does it solve? + +When using standard `source.pipe(dest)` source will _not_ be destroyed if dest emits close or an error. +You are also not able to provide a callback to tell when then pipe has finished. + +pump does these two things for you + +## Usage + +Simply pass the streams you want to pipe together to pump and add an optional callback + +``` js +var pump = require('pump') +var fs = require('fs') + +var source = fs.createReadStream('/dev/random') +var dest = fs.createWriteStream('/dev/null') + +pump(source, dest, function(err) { + console.log('pipe finished', err) +}) + +setTimeout(function() { + dest.destroy() // when dest is closed pump will destroy source +}, 1000) +``` + +You can use pump to pipe more than two streams together as well + +``` js +var transform = someTransformStream() + +pump(source, transform, anotherTransform, dest, function(err) { + console.log('pipe finished', err) +}) +``` + +If `source`, `transform`, `anotherTransform` or `dest` closes all of them will be destroyed. + +Similarly to `stream.pipe()`, `pump()` returns the last stream passed in, so you can do: + +``` +return pump(s1, s2) // returns s2 +``` + +If you want to return a stream that combines *both* s1 and s2 to a single stream use +[pumpify](https://github.com/mafintosh/pumpify) instead. + +## License + +MIT + +## Related + +`pump` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. diff --git a/node_modules/pump/index.js b/node_modules/pump/index.js new file mode 100644 index 0000000..c15059f --- /dev/null +++ b/node_modules/pump/index.js @@ -0,0 +1,82 @@ +var once = require('once') +var eos = require('end-of-stream') +var fs = require('fs') // we only need fs to get the ReadStream and WriteStream prototypes + +var noop = function () {} +var ancient = /^v?\.0/.test(process.version) + +var isFn = function (fn) { + return typeof fn === 'function' +} + +var isFS = function (stream) { + if (!ancient) return false // newer node version do not need to care about fs is a special way + if (!fs) return false // browser + return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close) +} + +var isRequest = function (stream) { + return stream.setHeader && isFn(stream.abort) +} + +var destroyer = function (stream, reading, writing, callback) { + callback = once(callback) + + var closed = false + stream.on('close', function () { + closed = true + }) + + eos(stream, {readable: reading, writable: writing}, function (err) { + if (err) return callback(err) + closed = true + callback() + }) + + var destroyed = false + return function (err) { + if (closed) return + if (destroyed) return + destroyed = true + + if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks + if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want + + if (isFn(stream.destroy)) return stream.destroy() + + callback(err || new Error('stream was destroyed')) + } +} + +var call = function (fn) { + fn() +} + +var pipe = function (from, to) { + return from.pipe(to) +} + +var pump = function () { + var streams = Array.prototype.slice.call(arguments) + var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop + + if (Array.isArray(streams[0])) streams = streams[0] + if (streams.length < 2) throw new Error('pump requires two streams per minimum') + + var error + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1 + var writing = i > 0 + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err + if (err) destroys.forEach(call) + if (reading) return + destroys.forEach(call) + callback(error) + }) + }) + + return streams.reduce(pipe) +} + +module.exports = pump diff --git a/node_modules/pump/package.json b/node_modules/pump/package.json new file mode 100644 index 0000000..51a596b --- /dev/null +++ b/node_modules/pump/package.json @@ -0,0 +1,64 @@ +{ + "_args": [ + [ + "pump@3.0.0", + "/home/runner/work/ghaction-upx/ghaction-upx" + ] + ], + "_from": "pump@3.0.0", + "_id": "pump@3.0.0", + "_inBundle": false, + "_integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "_location": "/pump", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pump@3.0.0", + "name": "pump", + "escapedName": "pump", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/execa/get-stream", + "/get-stream", + "/jest-changed-files/get-stream" + ], + "_resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "_spec": "3.0.0", + "_where": "/home/runner/work/ghaction-upx/ghaction-upx", + "author": { + "name": "Mathias Buus Madsen", + "email": "mathiasbuus@gmail.com" + }, + "browser": { + "fs": false + }, + "bugs": { + "url": "https://github.com/mafintosh/pump/issues" + }, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + }, + "description": "pipe streams together and close all of them if one of them closes", + "homepage": "https://github.com/mafintosh/pump#readme", + "keywords": [ + "streams", + "pipe", + "destroy", + "callback" + ], + "license": "MIT", + "name": "pump", + "repository": { + "type": "git", + "url": "git://github.com/mafintosh/pump.git" + }, + "scripts": { + "test": "node test-browser.js && node test-node.js" + }, + "version": "3.0.0" +} diff --git a/node_modules/pump/test-browser.js b/node_modules/pump/test-browser.js new file mode 100644 index 0000000..9a06c8a --- /dev/null +++ b/node_modules/pump/test-browser.js @@ -0,0 +1,66 @@ +var stream = require('stream') +var pump = require('./index') + +var rs = new stream.Readable() +var ws = new stream.Writable() + +rs._read = function (size) { + this.push(Buffer(size).fill('abc')) +} + +ws._write = function (chunk, encoding, cb) { + setTimeout(function () { + cb() + }, 100) +} + +var toHex = function () { + var reverse = new (require('stream').Transform)() + + reverse._transform = function (chunk, enc, callback) { + reverse.push(chunk.toString('hex')) + callback() + } + + return reverse +} + +var wsClosed = false +var rsClosed = false +var callbackCalled = false + +var check = function () { + if (wsClosed && rsClosed && callbackCalled) { + console.log('test-browser.js passes') + clearTimeout(timeout) + } +} + +ws.on('finish', function () { + wsClosed = true + check() +}) + +rs.on('end', function () { + rsClosed = true + check() +}) + +var res = pump(rs, toHex(), toHex(), toHex(), ws, function () { + callbackCalled = true + check() +}) + +if (res !== ws) { + throw new Error('should return last stream') +} + +setTimeout(function () { + rs.push(null) + rs.emit('close') +}, 1000) + +var timeout = setTimeout(function () { + check() + throw new Error('timeout') +}, 5000) diff --git a/node_modules/pump/test-node.js b/node_modules/pump/test-node.js new file mode 100644 index 0000000..561251a --- /dev/null +++ b/node_modules/pump/test-node.js @@ -0,0 +1,53 @@ +var pump = require('./index') + +var rs = require('fs').createReadStream('/dev/random') +var ws = require('fs').createWriteStream('/dev/null') + +var toHex = function () { + var reverse = new (require('stream').Transform)() + + reverse._transform = function (chunk, enc, callback) { + reverse.push(chunk.toString('hex')) + callback() + } + + return reverse +} + +var wsClosed = false +var rsClosed = false +var callbackCalled = false + +var check = function () { + if (wsClosed && rsClosed && callbackCalled) { + console.log('test-node.js passes') + clearTimeout(timeout) + } +} + +ws.on('close', function () { + wsClosed = true + check() +}) + +rs.on('close', function () { + rsClosed = true + check() +}) + +var res = pump(rs, toHex(), toHex(), toHex(), ws, function () { + callbackCalled = true + check() +}) + +if (res !== ws) { + throw new Error('should return last stream') +} + +setTimeout(function () { + rs.destroy() +}, 1000) + +var timeout = setTimeout(function () { + throw new Error('timeout') +}, 5000) diff --git a/node_modules/readable-stream/.travis.yml b/node_modules/readable-stream/.travis.yml index 4099255..f62cdac 100644 --- a/node_modules/readable-stream/.travis.yml +++ b/node_modules/readable-stream/.travis.yml @@ -1,54 +1,33 @@ sudo: false language: node_js before_install: - - npm install -g npm@2 - - test $NPM_LEGACY && npm install -g npm@latest-3 || npm install npm -g + - (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true notifications: email: false matrix: fast_finish: true include: - node_js: '0.8' - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: '0.10' - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: '0.11' - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: '0.12' - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: 1 - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: 2 - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: 3 - env: - - TASK=test - - NPM_LEGACY=true + env: NPM_LEGACY=true - node_js: 4 - env: TASK=test - node_js: 5 - env: TASK=test - node_js: 6 - env: TASK=test - node_js: 7 - env: TASK=test - node_js: 8 - env: TASK=test - node_js: 9 - env: TASK=test -script: "npm run $TASK" +script: "npm run test" env: global: - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc= diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js index a1ca813..57003c3 100644 --- a/node_modules/readable-stream/lib/_stream_duplex.js +++ b/node_modules/readable-stream/lib/_stream_duplex.js @@ -43,7 +43,7 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js index a9c8358..612edb4 100644 --- a/node_modules/readable-stream/lib/_stream_passthrough.js +++ b/node_modules/readable-stream/lib/_stream_passthrough.js @@ -30,7 +30,7 @@ module.exports = PassThrough; var Transform = require('./_stream_transform'); /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js index bf34ac6..0f80764 100644 --- a/node_modules/readable-stream/lib/_stream_readable.js +++ b/node_modules/readable-stream/lib/_stream_readable.js @@ -64,7 +64,7 @@ function _isUint8Array(obj) { /**/ /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js index 5d1f8b8..fcfc105 100644 --- a/node_modules/readable-stream/lib/_stream_transform.js +++ b/node_modules/readable-stream/lib/_stream_transform.js @@ -68,7 +68,7 @@ module.exports = Transform; var Duplex = require('./_stream_duplex'); /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js index b3f4e85..b0b0220 100644 --- a/node_modules/readable-stream/lib/_stream_writable.js +++ b/node_modules/readable-stream/lib/_stream_writable.js @@ -64,7 +64,7 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = require('core-util-is'); +var util = Object.create(require('core-util-is')); util.inherits = require('inherits'); /**/ diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json index 8a708f7..fdbfa51 100644 --- a/node_modules/readable-stream/package.json +++ b/node_modules/readable-stream/package.json @@ -1,33 +1,33 @@ { "_args": [ [ - "readable-stream@2.3.6", + "readable-stream@2.3.7", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "readable-stream@2.3.6", - "_id": "readable-stream@2.3.6", + "_from": "readable-stream@2.3.7", + "_id": "readable-stream@2.3.7", "_inBundle": false, - "_integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "_integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "_location": "/readable-stream", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "readable-stream@2.3.6", + "raw": "readable-stream@2.3.7", "name": "readable-stream", "escapedName": "readable-stream", - "rawSpec": "2.3.6", + "rawSpec": "2.3.7", "saveSpec": null, - "fetchSpec": "2.3.6" + "fetchSpec": "2.3.7" }, "_requiredBy": [ "/bl", "/from2", "/tar-stream" ], - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "_spec": "2.3.6", + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "_spec": "2.3.7", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "browser": { "util": false, @@ -82,5 +82,5 @@ "report": "nyc report --reporter=lcov", "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js" }, - "version": "2.3.6" + "version": "2.3.7" } diff --git a/node_modules/tunnel-agent/LICENSE b/node_modules/tunnel-agent/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/tunnel-agent/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/tunnel-agent/README.md b/node_modules/tunnel-agent/README.md deleted file mode 100644 index bb533d5..0000000 --- a/node_modules/tunnel-agent/README.md +++ /dev/null @@ -1,4 +0,0 @@ -tunnel-agent -============ - -HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module. diff --git a/node_modules/tunnel-agent/index.js b/node_modules/tunnel-agent/index.js deleted file mode 100644 index 3ee9abc..0000000 --- a/node_modules/tunnel-agent/index.js +++ /dev/null @@ -1,244 +0,0 @@ -'use strict' - -var net = require('net') - , tls = require('tls') - , http = require('http') - , https = require('https') - , events = require('events') - , assert = require('assert') - , util = require('util') - , Buffer = require('safe-buffer').Buffer - ; - -exports.httpOverHttp = httpOverHttp -exports.httpsOverHttp = httpsOverHttp -exports.httpOverHttps = httpOverHttps -exports.httpsOverHttps = httpsOverHttps - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options) - agent.request = http.request - return agent -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options) - agent.request = http.request - agent.createSocket = createSecureSocket - agent.defaultPort = 443 - return agent -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options) - agent.request = https.request - return agent -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options) - agent.request = https.request - agent.createSocket = createSecureSocket - agent.defaultPort = 443 - return agent -} - - -function TunnelingAgent(options) { - var self = this - self.options = options || {} - self.proxyOptions = self.options.proxy || {} - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets - self.requests = [] - self.sockets = [] - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i] - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1) - pending.request.onSocket(socket) - return - } - } - socket.destroy() - self.removeSocket(socket) - }) -} -util.inherits(TunnelingAgent, events.EventEmitter) - -TunnelingAgent.prototype.addRequest = function addRequest(req, options) { - var self = this - - // Legacy API: addRequest(req, host, port, path) - if (typeof options === 'string') { - options = { - host: options, - port: arguments[2], - path: arguments[3] - }; - } - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: options.host, port: options.port, request: req}) - return - } - - // If we are under maxSockets create a new one. - self.createConnection({host: options.host, port: options.port, request: req}) -} - -TunnelingAgent.prototype.createConnection = function createConnection(pending) { - var self = this - - self.createSocket(pending, function(socket) { - socket.on('free', onFree) - socket.on('close', onCloseOrRemove) - socket.on('agentRemove', onCloseOrRemove) - pending.request.onSocket(socket) - - function onFree() { - self.emit('free', socket, pending.host, pending.port) - } - - function onCloseOrRemove(err) { - self.removeSocket(socket) - socket.removeListener('free', onFree) - socket.removeListener('close', onCloseOrRemove) - socket.removeListener('agentRemove', onCloseOrRemove) - } - }) -} - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this - var placeholder = {} - self.sockets.push(placeholder) - - var connectOptions = mergeOptions({}, self.proxyOptions, - { method: 'CONNECT' - , path: options.host + ':' + options.port - , agent: false - } - ) - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {} - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - Buffer.from(connectOptions.proxyAuth).toString('base64') - } - - debug('making CONNECT request') - var connectReq = self.request(connectOptions) - connectReq.useChunkedEncodingByDefault = false // for v0.6 - connectReq.once('response', onResponse) // for v0.6 - connectReq.once('upgrade', onUpgrade) // for v0.6 - connectReq.once('connect', onConnect) // for v0.7 or later - connectReq.once('error', onError) - connectReq.end() - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head) - }) - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners() - socket.removeAllListeners() - - if (res.statusCode === 200) { - assert.equal(head.length, 0) - debug('tunneling connection has established') - self.sockets[self.sockets.indexOf(placeholder)] = socket - cb(socket) - } else { - debug('tunneling socket could not be established, statusCode=%d', res.statusCode) - var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode) - error.code = 'ECONNRESET' - options.request.emit('error', error) - self.removeSocket(placeholder) - } - } - - function onError(cause) { - connectReq.removeAllListeners() - - debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack) - var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message) - error.code = 'ECONNRESET' - options.request.emit('error', error) - self.removeSocket(placeholder) - } -} - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) return - - this.sockets.splice(pos, 1) - - var pending = this.requests.shift() - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createConnection(pending) - } -} - -function createSecureSocket(options, cb) { - var self = this - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, - { servername: options.host - , socket: socket - } - )) - self.sockets[self.sockets.indexOf(socket)] = secureSocket - cb(secureSocket) - }) -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i] - if (typeof overrides === 'object') { - var keys = Object.keys(overrides) - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j] - if (overrides[k] !== undefined) { - target[k] = overrides[k] - } - } - } - } - return target -} - - -var debug -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments) - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0] - } else { - args.unshift('TUNNEL:') - } - console.error.apply(console, args) - } -} else { - debug = function() {} -} -exports.debug = debug // for test diff --git a/node_modules/tunnel-agent/package.json b/node_modules/tunnel-agent/package.json deleted file mode 100644 index 4741207..0000000 --- a/node_modules/tunnel-agent/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_args": [ - [ - "tunnel-agent@0.6.0", - "/home/runner/work/ghaction-upx/ghaction-upx" - ] - ], - "_from": "tunnel-agent@0.6.0", - "_id": "tunnel-agent@0.6.0", - "_inBundle": false, - "_integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "_location": "/tunnel-agent", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "tunnel-agent@0.6.0", - "name": "tunnel-agent", - "escapedName": "tunnel-agent", - "rawSpec": "0.6.0", - "saveSpec": null, - "fetchSpec": "0.6.0" - }, - "_requiredBy": [ - "/caw", - "/request" - ], - "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "_spec": "0.6.0", - "_where": "/home/runner/work/ghaction-upx/ghaction-upx", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com", - "url": "http://www.futurealoof.com" - }, - "bugs": { - "url": "https://github.com/mikeal/tunnel-agent/issues" - }, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.", - "devDependencies": {}, - "engines": { - "node": "*" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/mikeal/tunnel-agent#readme", - "license": "Apache-2.0", - "main": "index.js", - "name": "tunnel-agent", - "optionalDependencies": {}, - "repository": { - "url": "git+https://github.com/mikeal/tunnel-agent.git" - }, - "version": "0.6.0" -} diff --git a/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js b/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js deleted file mode 100644 index aacd41e..0000000 --- a/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.unbzip2Stream=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i=(25e3+1e5*blockSize||4)){decompressAndQueue(this)}},function end(x){while(!broken&&hasBytes>bitReader.bytesRead){decompressAndQueue(this)}if(!broken){if(streamCRC!==null)stream.emit("error",new Error("input stream ended prematurely"));this.queue(null)}})}}).call(this,require("buffer").Buffer)},{"./lib/bit_iterator":2,"./lib/bzip2":3,buffer:6,through:31}],2:[function(require,module,exports){var BITMASK=[0,1,3,7,15,31,63,127,255];module.exports=function bitIterator(nextBuffer){var bit=0,byte=0;var bytes=nextBuffer();var f=function(n){if(n===null&&bit!=0){bit=0;byte++;return}var result=0;while(n>0){if(byte>=bytes.length){byte=0;bytes=nextBuffer()}var left=8-bit;if(bit===0&&n>0)f.bytesRead++;if(n>=left){result<<=left;result|=BITMASK[left]&bytes[byte++];bit=0;n-=left}else{result<<=n;result|=(bytes[byte]&BITMASK[n]<<8-n-bit)>>8-n-bit;bit+=n;n=0}}return result};f.bytesRead=0;return f}},{}],3:[function(require,module,exports){function Bzip2Error(message){this.name="Bzip2Error";this.message=message;this.stack=(new Error).stack}Bzip2Error.prototype=new Error;var message={Error:function(message){throw new Bzip2Error(message)}};var bzip2={};bzip2.Bzip2Error=Bzip2Error;bzip2.crcTable=[0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188];bzip2.array=function(bytes){var bit=0,byte=0;var BITMASK=[0,1,3,7,15,31,63,127,255];return function(n){var result=0;while(n>0){var left=8-bit;if(n>=left){result<<=left;result|=BITMASK[left]&bytes[byte++];bit=0;n-=left}else{result<<=n;result|=(bytes[byte]&BITMASK[n]<<8-n-bit)>>8-n-bit;bit+=n;n=0}}return result}};bzip2.simple=function(srcbuffer,stream){var bits=bzip2.array(srcbuffer);var size=bzip2.header(bits);var ret=false;var bufsize=1e5*size;var buf=new Int32Array(bufsize);do{ret=bzip2.decompress(bits,stream,buf,bufsize)}while(!ret)};bzip2.header=function(bits){this.byteCount=new Int32Array(256);this.symToByte=new Uint8Array(256);this.mtfSymbol=new Int32Array(256);this.selectors=new Uint8Array(32768);if(bits(8*3)!=4348520)message.Error("No magic number found");var i=bits(8)-48;if(i<1||i>9)message.Error("Not a BZIP archive");return i};bzip2.decompress=function(bits,stream,buf,bufsize,streamCRC){var MAX_HUFCODE_BITS=20;var MAX_SYMBOLS=258;var SYMBOL_RUNA=0;var SYMBOL_RUNB=1;var GROUP_SIZE=50;var crc=0^-1;for(var h="",i=0;i<6;i++)h+=bits(8).toString(16);if(h=="177245385090"){var finalCRC=bits(32)|0;if(finalCRC!==streamCRC)message.Error("Error in bzip2: crc32 do not match");bits(null);return null}if(h!="314159265359")message.Error("eek not valid bzip data");var crcblock=bits(32)|0;if(bits(1))message.Error("unsupported obsolete version");var origPtr=bits(24);if(origPtr>bufsize)message.Error("Initial position larger than buffer size");var t=bits(16);var symTotal=0;for(i=0;i<16;i++){if(t&1<<15-i){var k=bits(16);for(j=0;j<16;j++){if(k&1<<15-j){this.symToByte[symTotal++]=16*i+j}}}}var groupCount=bits(3);if(groupCount<2||groupCount>6)message.Error("another error");var nSelectors=bits(15);if(nSelectors==0)message.Error("meh");for(var i=0;i=groupCount)message.Error("whoops another error");var uc=this.mtfSymbol[j];for(var k=j-1;k>=0;k--){this.mtfSymbol[k+1]=this.mtfSymbol[k]}this.mtfSymbol[0]=uc;this.selectors[i]=uc}var symCount=symTotal+2;var groups=[];var length=new Uint8Array(MAX_SYMBOLS),temp=new Uint16Array(MAX_HUFCODE_BITS+1);var hufGroup;for(var j=0;jMAX_HUFCODE_BITS)message.Error("I gave up a while ago on writing error messages");if(!bits(1))break;if(!bits(1))t++;else t--}length[i]=t}var minLen,maxLen;minLen=maxLen=length[0];for(var i=1;imaxLen)maxLen=length[i];else if(length[i]=nSelectors)message.Error("meow i'm a kitty, that's an error");hufGroup=groups[this.selectors[selector++]];base=hufGroup.base.subarray(1);limit=hufGroup.limit.subarray(1)}i=hufGroup.minLen;j=bits(i);while(true){if(i>hufGroup.maxLen)message.Error("rawr i'm a dinosaur");if(j<=limit[i])break;i++;j=j<<1|bits(1)}j-=base[i];if(j<0||j>=MAX_SYMBOLS)message.Error("moo i'm a cow");var nextSym=hufGroup.permute[j];if(nextSym==SYMBOL_RUNA||nextSym==SYMBOL_RUNB){if(!runPos){runPos=1;t=0}if(nextSym==SYMBOL_RUNA)t+=runPos;else t+=2*runPos;runPos<<=1;continue}if(runPos){runPos=0;if(count+t>bufsize)message.Error("Boom.");uc=this.symToByte[this.mtfSymbol[0]];this.byteCount[uc]+=t;while(t--)buf[count++]=uc}if(nextSym>symTotal)break;if(count>=bufsize)message.Error("I can't think of anything. Error");i=nextSym-1;uc=this.mtfSymbol[i];for(var k=i-1;k>=0;k--){this.mtfSymbol[k+1]=this.mtfSymbol[k]}this.mtfSymbol[0]=uc;uc=this.symToByte[uc];this.byteCount[uc]++;buf[count++]=uc}if(origPtr<0||origPtr>=count)message.Error("I'm a monkey and I'm throwing something at someone, namely you");var j=0;for(var i=0;i<256;i++){k=j+this.byteCount[i];this.byteCount[i]=j;j=k}for(var i=0;i>=8;run=-1}count=count;var copies,previous,outbyte;while(count){count--;previous=current;pos=buf[pos];current=pos&255;pos>>=8;if(run++==3){copies=current;outbyte=previous;current=-1}else{copies=1;outbyte=current}while(copies--){crc=(crc<<8^this.crcTable[(crc>>24^outbyte)&255])&4294967295;stream(outbyte)}if(current!=previous)run=0}crc=(crc^-1)>>>0;if((crc|0)!=(crcblock|0))message.Error("Error in bzip2: crc32 do not match");if(streamCRC===null)streamCRC=0;streamCRC=(crc^(streamCRC<<1|streamCRC>>>31))&4294967295;return streamCRC};module.exports=bzip2},{}],4:[function(require,module,exports){},{}],5:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}var validLen=b64.indexOf("=");if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;var len=placeHoldersLen>0?validLen-4:validLen;for(var i=0;i>16&255;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&255}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")}return parts.join("")}},{}],6:[function(require,module,exports){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42}catch(e){return false}}Object.defineProperty(Buffer.prototype,"parent",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.buffer}});Object.defineProperty(Buffer.prototype,"offset",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.byteOffset}});function createBuffer(length){if(length>K_MAX_LENGTH){throw new RangeError('The value "'+length+'" is invalid for option "size"')}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new TypeError('The "string" argument must be of type string. Received type number')}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species!=null&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="string"){return fromString(value,encodingOrOffset)}if(ArrayBuffer.isView(value)){return fromArrayLike(value)}if(value==null){throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="number"){throw new TypeError('The "value" argument must not be of type number. Received type number')}var valueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value){return Buffer.from(valueOf,encodingOrOffset,length)}var b=fromObject(value);if(b)return b;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof value[Symbol.toPrimitive]==="function"){return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be of type number')}else if(size<0){throw new RangeError('The value "'+size+'" is invalid for option "size"')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true&&b!==Buffer.prototype};Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array))a=Buffer.from(a,a.offset,a.byteLength);if(isInstance(b,Uint8Array))b=Buffer.from(b,b.offset,b.byteLength);if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array')}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i2&&arguments[2]===true;if(!mustMatch&&len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase){return mustMatch?-1:utf8ToBytes(string).length}encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;imax)str+=" ... ";return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)){target=Buffer.from(target,target.offset,target.byteLength)}if(!Buffer.isBuffer(target)){throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. '+"Received type "+typeof target)}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining}}var strLen=string.length;if(length>strLen/2){length=strLen/2}for(var i=0;i>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("Index out of range");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}if(val.length===1){var code=val.charCodeAt(0);if(encoding==="utf8"&&code<128||encoding==="latin1"){val=code}}}else if(typeof val==="number"){val=val&255}if(start<0||this.length>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!==obj}},{"base64-js":5,ieee754:9}],7:[function(require,module,exports){(function(Buffer){function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)==="[object Array]"}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":11}],8:[function(require,module,exports){var objectCreate=Object.create||objectCreatePolyfill;var objectKeys=Object.keys||objectKeysPolyfill;var bind=Function.prototype.bind||functionBindPolyfill;function EventEmitter(){if(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events")){this._events=objectCreate(null);this._eventsCount=0}this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;var defaultMaxListeners=10;var hasDefineProperty;try{var o={};if(Object.defineProperty)Object.defineProperty(o,"x",{value:0});hasDefineProperty=o.x===0}catch(err){hasDefineProperty=false}if(hasDefineProperty){Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:true,get:function(){return defaultMaxListeners},set:function(arg){if(typeof arg!=="number"||arg<0||arg!==arg)throw new TypeError('"defaultMaxListeners" must be a positive number');defaultMaxListeners=arg}})}else{EventEmitter.defaultMaxListeners=defaultMaxListeners}EventEmitter.prototype.setMaxListeners=function setMaxListeners(n){if(typeof n!=="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');this._maxListeners=n;return this};function $getMaxListeners(that){if(that._maxListeners===undefined)return EventEmitter.defaultMaxListeners;return that._maxListeners}EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return $getMaxListeners(this)};function emitNone(handler,isFn,self){if(isFn)handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i1)er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Unhandled "error" event. ('+er+")");err.context=er;throw err}return false}handler=events[type];if(!handler)return false;var isFn=typeof handler==="function";len=arguments.length;switch(len){case 1:emitNone(handler,isFn,this);break;case 2:emitOne(handler,isFn,this,arguments[1]);break;case 3:emitTwo(handler,isFn,this,arguments[1],arguments[2]);break;case 4:emitThree(handler,isFn,this,arguments[1],arguments[2],arguments[3]);break;default:args=new Array(len-1);for(i=1;i0&&existing.length>m){existing.warned=true;var w=new Error("Possible EventEmitter memory leak detected. "+existing.length+' "'+String(type)+'" listeners '+"added. Use emitter.setMaxListeners() to "+"increase limit.");w.name="MaxListenersExceededWarning";w.emitter=target;w.type=type;w.count=existing.length;if(typeof console==="object"&&console.warn){console.warn("%s: %s",w.name,w.message)}}}}return target}EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true)};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;switch(arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:var args=new Array(arguments.length);for(var i=0;i=0;i--){if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener;position=i;break}}if(position<0)return this;if(position===0)list.shift();else spliceOne(list,position);if(list.length===1)events[type]=list[0];if(events.removeListener)this.emit("removeListener",type,originalListener||listener)}return this};EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events,i;events=this._events;if(!events)return this;if(!events.removeListener){if(arguments.length===0){this._events=objectCreate(null);this._eventsCount=0}else if(events[type]){if(--this._eventsCount===0)this._events=objectCreate(null);else delete events[type]}return this}if(arguments.length===0){var keys=objectKeys(events);var key;for(i=0;i=0;i--){this.removeListener(type,listeners[i])}}return this};function _listeners(target,type,unwrap){var events=target._events;if(!events)return[];var evlistener=events[type];if(!evlistener)return[];if(typeof evlistener==="function")return unwrap?[evlistener.listener||evlistener]:[evlistener];return unwrap?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length)}EventEmitter.prototype.listeners=function listeners(type){return _listeners(this,type,true)};EventEmitter.prototype.rawListeners=function rawListeners(type){return _listeners(this,type,false)};EventEmitter.listenerCount=function(emitter,type){if(typeof emitter.listenerCount==="function"){return emitter.listenerCount(type)}else{return listenerCount.call(emitter,type)}};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(type){var events=this._events;if(events){var evlistener=events[type];if(typeof evlistener==="function"){return 1}else if(evlistener){return evlistener.length}}return 0}EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;k>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],10:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],11:[function(require,module,exports){module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],12:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],13:[function(require,module,exports){(function(process){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports={nextTick:nextTick}}else{module.exports=process}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1)});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3)});default:args=new Array(len-1);i=0;while(i1){for(var i=1;i0){if(typeof chunk!=="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk)}if(addToFront){if(state.endEmitted)stream.emit("error",new Error("stream.unshift() after end event"));else addChunk(stream,state,chunk,true)}else if(state.ended){stream.emit("error",new Error("stream.push() after EOF"))}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state)}else{addChunk(stream,state,chunk,false)}}}else if(!addToFront){state.reading=false}}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)pna.nextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;pna.nextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this,unpipeInfo);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(nstr.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;pna.nextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function indexOf(xs,x){for(var i=0,l=xs.length;i-1?setImmediate:pna.nextTick;var Duplex;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};var isDuplex=stream instanceof Duplex;this.objectMode=!!options.objectMode;if(isDuplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var writableHwm=options.writableHighWaterMark;var defaultHwm=this.objectMode?16:16*1024;if(hwm||hwm===0)this.highWaterMark=hwm;else if(isDuplex&&(writableHwm||writableHwm===0))this.highWaterMark=writableHwm;else this.highWaterMark=defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(_){}})();var realHasInstance;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){if(realHasInstance.call(this,object))return true;if(this!==Writable)return false;return object&&object._writableState instanceof WritableState}})}else{realHasInstance=function(object){return object instanceof this}}function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options)}this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);pna.nextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);pna.nextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=!state.objectMode&&_isUint8Array(chunk);if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk)}if(typeof encoding==="function"){cb=encoding;encoding=null}if(isBuf)encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:false,get:function(){return this._writableState.highWaterMark}});function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding="buffer";chunk=newChunk}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function join(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next}return ret};return BufferList}();if(util&&util.inspect&&util.inspect.custom){module.exports.prototype[util.inspect.custom]=function(){var obj=util.inspect({length:this.length});return this.constructor.name+" "+obj}}},{"safe-buffer":15,util:4}],24:[function(require,module,exports){"use strict";var pna=require("process-nextick-args");function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err)}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){pna.nextTick(emitErrorNT,this,err)}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(err||null,function(err){if(!cb&&err){pna.nextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true}}else if(cb){cb(err)}});return this}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":13}],25:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:8}],26:[function(require,module,exports){module.exports=require("./readable").PassThrough},{"./readable":27}],27:[function(require,module,exports){exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=exports;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")},{"./lib/_stream_duplex.js":18,"./lib/_stream_passthrough.js":19,"./lib/_stream_readable.js":20,"./lib/_stream_transform.js":21,"./lib/_stream_writable.js":22}],28:[function(require,module,exports){module.exports=require("./readable").Transform},{"./readable":27}],29:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":22}],30:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var isEncoding=Buffer.isEncoding||function(encoding){encoding=""+encoding;switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(true){switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase();retried=true}}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;nb=4;break;case"utf8":this.fillLast=utf8FillLast;nb=4;break;case"base64":this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return"";i=this.lastNeed;this.lastNeed=0}else{i=0}if(i>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return byte>>6===2?-1:-2}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"�"}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"�"}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"�"}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�";return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":15}],31:[function(require,module,exports){(function(process){var Stream=require("stream");exports=module.exports=through;through.through=through;function through(write,end,opts){write=write||function(data){this.queue(data)};end=end||function(){this.queue(null)};var ended=false,destroyed=false,buffer=[],_ended=false;var stream=new Stream;stream.readable=stream.writable=true;stream.paused=false;stream.autoDestroy=!(opts&&opts.autoDestroy===false);stream.write=function(data){write.call(this,data);return!stream.paused};function drain(){while(buffer.length&&!stream.paused){var data=buffer.shift();if(null===data)return stream.emit("end");else stream.emit("data",data)}}stream.queue=stream.push=function(data){if(_ended)return stream;if(data===null)_ended=true;buffer.push(data);drain();return stream};stream.on("end",function(){stream.readable=false;if(!stream.writable&&stream.autoDestroy)process.nextTick(function(){stream.destroy()})});function _end(){stream.writable=false;end.call(stream);if(!stream.readable&&stream.autoDestroy)stream.destroy()}stream.end=function(data){if(ended)return;ended=true;if(arguments.length)stream.write(data);_end();return stream};stream.destroy=function(){if(destroyed)return;destroyed=true;ended=true;buffer.length=0;stream.writable=stream.readable=false;stream.emit("close");return stream};stream.pause=function(){if(stream.paused)return;stream.paused=true;return stream};stream.resume=function(){if(stream.paused){stream.paused=false;stream.emit("resume")}drain();if(!stream.paused)stream.emit("drain");return stream};return stream}}).call(this,require("_process"))},{_process:14,stream:16}],32:[function(require,module,exports){(function(setImmediate,clearImmediate){var nextTick=require("process/browser.js").nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id)};exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout()},msecs)}};exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){if(args){fn.apply(null,args)}else{fn.call(null)}exports.clearImmediate(id)}});return id};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id]}}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":14,timers:32}],33:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1])(1)}); diff --git a/node_modules/unbzip2-stream/index.js b/node_modules/unbzip2-stream/index.js index 217d11f..4333963 100644 --- a/node_modules/unbzip2-stream/index.js +++ b/node_modules/unbzip2-stream/index.js @@ -17,6 +17,7 @@ function unbzip2Stream() { if(!blockSize){ blockSize = bz2.header(bitReader); //console.error("got header of", blockSize); + streamCRC = 0; return true; }else{ var bufsize = 100000 * blockSize; @@ -78,12 +79,12 @@ function unbzip2Stream() { }, function end(x) { //console.error(x,'last compressing with', hasBytes, 'bytes in buffer'); - while (!broken && hasBytes > bitReader.bytesRead){ + while (!broken && bitReader && hasBytes > bitReader.bytesRead){ decompressAndQueue(this); } if (!broken) { if (streamCRC !== null) - stream.emit('error', new Error("input stream ended prematurely")); + this.emit('error', new Error("input stream ended prematurely")); this.queue(null); } } diff --git a/node_modules/unbzip2-stream/lib/bzip2.js b/node_modules/unbzip2-stream/lib/bzip2.js index 6968e23..6d51074 100644 --- a/node_modules/unbzip2-stream/lib/bzip2.js +++ b/node_modules/unbzip2-stream/lib/bzip2.js @@ -358,8 +358,6 @@ bzip2.decompress = function(bits, stream, buf, bufsize, streamCRC) { crc = (crc ^ (-1)) >>> 0; if ((crc|0) != (crcblock|0)) message.Error("Error in bzip2: crc32 do not match"); - if (streamCRC === null) - streamCRC = 0; streamCRC = (crc ^ ((streamCRC << 1) | (streamCRC >>> 31))) & 0xFFFFFFFF; return streamCRC; } diff --git a/node_modules/unbzip2-stream/package.json b/node_modules/unbzip2-stream/package.json index 4325812..186d5b3 100644 --- a/node_modules/unbzip2-stream/package.json +++ b/node_modules/unbzip2-stream/package.json @@ -1,31 +1,31 @@ { "_args": [ [ - "unbzip2-stream@1.3.3", + "unbzip2-stream@1.4.0", "/home/runner/work/ghaction-upx/ghaction-upx" ] ], - "_from": "unbzip2-stream@1.3.3", - "_id": "unbzip2-stream@1.3.3", + "_from": "unbzip2-stream@1.4.0", + "_id": "unbzip2-stream@1.4.0", "_inBundle": false, - "_integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==", + "_integrity": "sha512-kVx7CDAsdBSWVf404Mw7oI9i09w5/mTT/Ruk+RWa64PLYKvsAucLLFHvQtnvjeADM4ZizxrvG5SHnF4Te4T2Cg==", "_location": "/unbzip2-stream", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "unbzip2-stream@1.3.3", + "raw": "unbzip2-stream@1.4.0", "name": "unbzip2-stream", "escapedName": "unbzip2-stream", - "rawSpec": "1.3.3", + "rawSpec": "1.4.0", "saveSpec": null, - "fetchSpec": "1.3.3" + "fetchSpec": "1.4.0" }, "_requiredBy": [ "/decompress-tarbz2" ], - "_resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz", - "_spec": "1.3.3", + "_resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.0.tgz", + "_spec": "1.4.0", "_where": "/home/runner/work/ghaction-upx/ghaction-upx", "author": { "name": "Jan Bölsche", @@ -79,5 +79,5 @@ "prepare-long-test": "head -c 104857600 < /dev/urandom | tee test/fixtures/vmlinux.bin | bzip2 > test/fixtures/vmlinux.bin.bz2", "test": "tape test/*.js" }, - "version": "1.3.3" + "version": "1.4.0" } diff --git a/node_modules/url-to-options/package.json b/node_modules/url-to-options/package.json index c16901d..bd7a3a0 100644 --- a/node_modules/url-to-options/package.json +++ b/node_modules/url-to-options/package.json @@ -22,7 +22,6 @@ "fetchSpec": "1.0.1" }, "_requiredBy": [ - "/caw", "/got" ], "_resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz",