Download tarball from zig download index (#2)

* Download tarball from zig download index

* try this

* Remove promisify

* Revert "try this"

This reverts commit e6ecfb58ed2819755bc79af1349e4fd0db59e3b5.
This commit is contained in:
Renée Kooi 2019-10-07 10:17:11 +02:00 committed by GitHub
parent 44120b6411
commit e834313fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 1454 additions and 8 deletions

View File

@ -1,25 +1,51 @@
const os = require('os') const os = require('os')
const path = require('path') const path = require('path')
const semver = require('semver') const semver = require('semver')
const get = require('simple-get').concat
const actions = require('@actions/core') const actions = require('@actions/core')
const cache = require('@actions/tool-cache') const cache = require('@actions/tool-cache')
function getJSON (opts) {
return new Promise((resolve, reject) => {
get({ ...opts, json: true }, (err, req, data) => {
if (err) {
reject(err)
} else {
resolve(data)
}
})
})
}
async function downloadZig (version) { async function downloadZig (version) {
const host = { const host = {
linux: 'linux-x86_64', linux: 'x86_64-linux',
darwin: 'macos-x86_64', darwin: 'x86_64-macos',
win32: 'windows-x86_64' win32: 'x86_64-windows'
}[os.platform()] }[os.platform()] || os.platform()
const ext = { const ext = {
linux: 'tar.xz', linux: 'tar.xz',
darwin: 'tar.xz', darwin: 'tar.xz',
win32: 'zip' win32: 'zip'
}[os.platform()] }[os.platform()]
const variantName = `zig-${host}-${version}` const index = await getJSON({ url: 'https://ziglang.org/download/index.json' })
const url = `https://github.com/ziglang/zig/releases/download/${version}/${variantName}.${ext}`
const downloadPath = await cache.downloadTool(url) const availableVersions = Object.keys(index).filter((v) => semver.valid(v))
const useVersion = semver.maxSatisfying(availableVersions, version)
const meta = index[useVersion || version]
if (!meta || !meta[host]) {
throw new Error(`Could not find version ${version} for platform ${host}`)
}
const hostVariantName = {
linux: 'linux-x86_64',
darwin: 'macos-x86_64',
win32: 'windows-x86_64'
}[os.platform()]
const variantName = `zig-${hostVariantName}-${version}`
const downloadPath = await cache.downloadTool(meta[host].tarball)
const zigPath = ext === 'zip' const zigPath = ext === 'zip'
? await cache.extractZip(downloadPath) ? await cache.extractZip(downloadPath)
: await cache.extractTar(downloadPath, undefined, 'x') : await cache.extractTar(downloadPath, undefined, 'x')

29
node_modules/decompress-response/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,29 @@
/// <reference types="node"/>
import {IncomingMessage} from 'http';
declare const decompressResponse: {
/**
Decompress a HTTP response if needed.
@param response - The HTTP incoming stream with compressed data.
@returns The decompressed HTTP response stream.
@example
```
import {http} from 'http';
import decompressResponse = require('decompress-response');
http.get('https://sindresorhus.com', response => {
response = decompressResponse(response);
});
```
*/
(response: IncomingMessage): IncomingMessage;
// TODO: remove this in the next major version, refactor the whole definition to:
// declare function decompressResponse(response: IncomingMessage): IncomingMessage;
// export = decompressResponse;
default: typeof decompressResponse;
};
export = decompressResponse;

40
node_modules/decompress-response/index.js generated vendored Normal file
View File

@ -0,0 +1,40 @@
'use strict';
const {PassThrough: PassThroughStream} = require('stream');
const zlib = require('zlib');
const mimicResponse = require('mimic-response');
const decompressResponse = response => {
const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase();
if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) {
return response;
}
const isBrotli = contentEncoding === 'br';
if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') {
return response;
}
const decompress = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
const stream = new PassThroughStream();
mimicResponse(response, stream);
decompress.on('error', error => {
// Ignore empty response
if (error.code === 'Z_BUF_ERROR') {
stream.end();
return;
}
stream.emit('error', error);
});
response.pipe(decompress).pipe(stream);
return stream;
};
module.exports = decompressResponse;
// TODO: remove this in the next major version
module.exports.default = decompressResponse;

9
node_modules/decompress-response/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
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.

82
node_modules/decompress-response/package.json generated vendored Normal file
View File

@ -0,0 +1,82 @@
{
"_from": "decompress-response@^4.2.0",
"_id": "decompress-response@4.2.1",
"_inBundle": false,
"_integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
"_location": "/decompress-response",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "decompress-response@^4.2.0",
"name": "decompress-response",
"escapedName": "decompress-response",
"rawSpec": "^4.2.0",
"saveSpec": null,
"fetchSpec": "^4.2.0"
},
"_requiredBy": [
"/simple-get"
],
"_resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
"_shasum": "414023cc7a302da25ce2ec82d0d5238ccafd8986",
"_spec": "decompress-response@^4.2.0",
"_where": "/home/goto-bus-stop/Code/goto-bus-stop/setup-zig/node_modules/simple-get",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/decompress-response/issues"
},
"bundleDependencies": false,
"dependencies": {
"mimic-response": "^2.0.0"
},
"deprecated": false,
"description": "Decompress a HTTP response if needed",
"devDependencies": {
"@types/node": "^12.7.1",
"ava": "^2.2.0",
"get-stream": "^5.0.0",
"pify": "^4.0.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/decompress-response#readme",
"keywords": [
"decompress",
"response",
"http",
"https",
"zlib",
"gzip",
"zip",
"deflate",
"unzip",
"ungzip",
"incoming",
"message",
"stream",
"compressed",
"brotli"
],
"license": "MIT",
"name": "decompress-response",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/decompress-response.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "4.2.1"
}

52
node_modules/decompress-response/readme.md generated vendored Normal file
View File

@ -0,0 +1,52 @@
# decompress-response [![Build Status](https://travis-ci.org/sindresorhus/decompress-response.svg?branch=master)](https://travis-ci.org/sindresorhus/decompress-response)
> Decompress a HTTP response if needed
Decompresses the [response](https://nodejs.org/api/http.html#http_class_http_incomingmessage) from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped, deflated or compressed with Brotli, otherwise just passes it through.
Used by [`got`](https://github.com/sindresorhus/got).
## Install
```
$ npm install decompress-response
```
## Usage
```js
const http = require('http');
const decompressResponse = require('decompress-response');
http.get('https://sindresorhus.com', response => {
response = decompressResponse(response);
});
```
## API
### decompressResponse(response)
Returns the decompressed HTTP response stream.
#### response
Type: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
The HTTP incoming stream with compressed data.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-unzip-response?utm_source=npm-unzip-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

36
node_modules/mimic-response/index.js generated vendored Normal file
View File

@ -0,0 +1,36 @@
'use strict';
// We define these manually to ensure they're always copied
// even if they would move up the prototype chain
// https://nodejs.org/api/http.html#http_class_http_incomingmessage
const knownProperties = [
'aborted',
'complete',
'destroy',
'headers',
'httpVersion',
'httpVersionMinor',
'httpVersionMajor',
'method',
'rawHeaders',
'rawTrailers',
'setTimeout',
'socket',
'statusCode',
'statusMessage',
'trailers',
'url'
];
module.exports = (fromStream, toStream) => {
const fromProps = new Set(Object.keys(fromStream).concat(knownProperties));
for (const prop of fromProps) {
// Don't overwrite existing properties
if (prop in toStream) {
continue;
}
toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop];
}
};

9
node_modules/mimic-response/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
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.

69
node_modules/mimic-response/package.json generated vendored Normal file
View File

@ -0,0 +1,69 @@
{
"_from": "mimic-response@^2.0.0",
"_id": "mimic-response@2.0.0",
"_inBundle": false,
"_integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==",
"_location": "/mimic-response",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "mimic-response@^2.0.0",
"name": "mimic-response",
"escapedName": "mimic-response",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/decompress-response"
],
"_resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz",
"_shasum": "996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46",
"_spec": "mimic-response@^2.0.0",
"_where": "/home/goto-bus-stop/Code/goto-bus-stop/setup-zig/node_modules/decompress-response",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/mimic-response/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Mimic a Node.js HTTP response stream",
"devDependencies": {
"ava": "^1.1.0",
"create-test-server": "^2.4.0",
"pify": "^4.0.1",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/mimic-response#readme",
"keywords": [
"mimic",
"response",
"stream",
"http",
"https",
"request",
"get",
"core"
],
"license": "MIT",
"name": "mimic-response",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/mimic-response.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "2.0.0"
}

54
node_modules/mimic-response/readme.md generated vendored Normal file
View File

@ -0,0 +1,54 @@
# mimic-response [![Build Status](https://travis-ci.org/sindresorhus/mimic-response.svg?branch=master)](https://travis-ci.org/sindresorhus/mimic-response)
> Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
## Install
```
$ npm install mimic-response
```
## Usage
```js
const stream = require('stream');
const mimicResponse = require('mimic-response');
const responseStream = getHttpResponseStream();
const myStream = new stream.PassThrough();
mimicResponse(responseStream, myStream);
console.log(myStream.statusCode);
//=> 200
```
## API
### mimicResponse(from, to)
#### from
Type: `Stream`
[Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
#### to
Type: `Stream`
Any stream.
## Related
- [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one
- [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

15
node_modules/once/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

79
node_modules/once/README.md generated vendored Normal file
View File

@ -0,0 +1,79 @@
# once
Only call a function once.
## usage
```javascript
var once = require('once')
function load (file, cb) {
cb = once(cb)
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}
```
Or add to the Function.prototype in a responsible way:
```javascript
// only has to be done once
require('once').proto()
function load (file, cb) {
cb = cb.once()
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}
```
Ironically, the prototype feature makes this module twice as
complicated as necessary.
To check whether you function has been called, use `fn.called`. Once the
function is called for the first time the return value of the original
function is saved in `fn.value` and subsequent calls will continue to
return this value.
```javascript
var once = require('once')
function load (cb) {
cb = once(cb)
var stream = createStream()
stream.once('data', cb)
stream.once('end', function () {
if (!cb.called) cb(new Error('not found'))
})
}
```
## `once.strict(func)`
Throw an error if the function is called twice.
Some functions are expected to be called only once. Using `once` for them would
potentially hide logical errors.
In the example below, the `greet` function has to call the callback only once:
```javascript
function greet (name, cb) {
// return is missing from the if statement
// when no name is passed, the callback is called twice
if (!name) cb('Hello anonymous')
cb('Hello ' + name)
}
function log (msg) {
console.log(msg)
}
// this will print 'Hello anonymous' but the logical error will be missed
greet(null, once(msg))
// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
greet(null, once.strict(msg))
```

42
node_modules/once/once.js generated vendored Normal file
View File

@ -0,0 +1,42 @@
var wrappy = require('wrappy')
module.exports = wrappy(once)
module.exports.strict = wrappy(onceStrict)
once.proto = once(function () {
Object.defineProperty(Function.prototype, 'once', {
value: function () {
return once(this)
},
configurable: true
})
Object.defineProperty(Function.prototype, 'onceStrict', {
value: function () {
return onceStrict(this)
},
configurable: true
})
})
function once (fn) {
var f = function () {
if (f.called) return f.value
f.called = true
return f.value = fn.apply(this, arguments)
}
f.called = false
return f
}
function onceStrict (fn) {
var f = function () {
if (f.called)
throw new Error(f.onceError)
f.called = true
return f.value = fn.apply(this, arguments)
}
var name = fn.name || 'Function wrapped with `once`'
f.onceError = name + " shouldn't be called more than once"
f.called = false
return f
}

66
node_modules/once/package.json generated vendored Normal file
View File

@ -0,0 +1,66 @@
{
"_from": "once@^1.3.1",
"_id": "once@1.4.0",
"_inBundle": false,
"_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"_location": "/once",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "once@^1.3.1",
"name": "once",
"escapedName": "once",
"rawSpec": "^1.3.1",
"saveSpec": null,
"fetchSpec": "^1.3.1"
},
"_requiredBy": [
"/simple-get"
],
"_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
"_spec": "once@^1.3.1",
"_where": "/home/goto-bus-stop/Code/goto-bus-stop/setup-zig/node_modules/simple-get",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/once/issues"
},
"bundleDependencies": false,
"dependencies": {
"wrappy": "1"
},
"deprecated": false,
"description": "Run a function exactly one time",
"devDependencies": {
"tap": "^7.0.1"
},
"directories": {
"test": "test"
},
"files": [
"once.js"
],
"homepage": "https://github.com/isaacs/once#readme",
"keywords": [
"once",
"function",
"one",
"single"
],
"license": "ISC",
"main": "once.js",
"name": "once",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/once.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "1.4.0"
}

3
node_modules/simple-concat/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,3 @@
language: node_js
node_js:
- 'node'

20
node_modules/simple-concat/LICENSE generated vendored Normal file
View File

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

42
node_modules/simple-concat/README.md generated vendored Normal file
View File

@ -0,0 +1,42 @@
# simple-concat [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url]
[travis-image]: https://img.shields.io/travis/feross/simple-concat/master.svg
[travis-url]: https://travis-ci.org/feross/simple-concat
[npm-image]: https://img.shields.io/npm/v/simple-concat.svg
[npm-url]: https://npmjs.org/package/simple-concat
[downloads-image]: https://img.shields.io/npm/dm/simple-concat.svg
[downloads-url]: https://npmjs.org/package/simple-concat
### Super-minimalist version of `concat-stream`. Less than 15 lines!
## install
```
npm install simple-concat
```
## usage
This example is longer than the implementation.
```js
var s = new stream.PassThrough()
concat(s, function (err, buf) {
if (err) throw err
console.error(buf)
})
s.write('abc')
setTimeout(function () {
s.write('123')
}, 10)
setTimeout(function () {
s.write('456')
}, 20)
setTimeout(function () {
s.end('789')
}, 30)
```
## license
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).

14
node_modules/simple-concat/index.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
module.exports = function (stream, cb) {
var chunks = []
stream.on('data', function (chunk) {
chunks.push(chunk)
})
stream.once('end', function () {
if (cb) cb(null, Buffer.concat(chunks))
cb = null
})
stream.once('error', function (err) {
if (cb) cb(err)
cb = null
})
}

58
node_modules/simple-concat/package.json generated vendored Normal file
View File

@ -0,0 +1,58 @@
{
"_from": "simple-concat@^1.0.0",
"_id": "simple-concat@1.0.0",
"_inBundle": false,
"_integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=",
"_location": "/simple-concat",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "simple-concat@^1.0.0",
"name": "simple-concat",
"escapedName": "simple-concat",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/simple-get"
],
"_resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz",
"_shasum": "7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6",
"_spec": "simple-concat@^1.0.0",
"_where": "/home/goto-bus-stop/Code/goto-bus-stop/setup-zig/node_modules/simple-get",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
"url": "http://feross.org/"
},
"bugs": {
"url": "https://github.com/feross/simple-concat/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Super-minimalist version of `concat-stream`. Less than 15 lines!",
"devDependencies": {
"standard": "^6.0.8",
"tape": "^4.0.0"
},
"homepage": "https://github.com/feross/simple-concat",
"keywords": [
"concat",
"concat-stream",
"concat stream"
],
"license": "MIT",
"main": "index.js",
"name": "simple-concat",
"repository": {
"type": "git",
"url": "git://github.com/feross/simple-concat.git"
},
"scripts": {
"test": "standard && tape test/*.js"
},
"version": "1.0.0"
}

41
node_modules/simple-concat/test/basic.js generated vendored Normal file
View File

@ -0,0 +1,41 @@
var concat = require('../')
var stream = require('stream')
var test = require('tape')
test('basic', function (t) {
t.plan(2)
var s = new stream.PassThrough()
concat(s, function (err, buf) {
t.error(err)
t.deepEqual(buf, new Buffer('abc123456789'))
})
s.write('abc')
setTimeout(function () {
s.write('123')
}, 10)
setTimeout(function () {
s.write('456')
}, 20)
setTimeout(function () {
s.end('789')
}, 30)
})
test('error', function (t) {
t.plan(2)
var s = new stream.PassThrough()
concat(s, function (err, buf) {
t.ok(err, 'got expected error')
t.ok(!buf)
})
s.write('abc')
setTimeout(function () {
s.write('123')
}, 10)
setTimeout(function () {
s.write('456')
}, 20)
setTimeout(function () {
s.emit('error', new Error('error'))
}, 30)
})

20
node_modules/simple-get/LICENSE generated vendored Normal file
View File

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

319
node_modules/simple-get/README.md generated vendored Normal file
View File

@ -0,0 +1,319 @@
# simple-get [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/simple-get/master.svg
[travis-url]: https://travis-ci.org/feross/simple-get
[npm-image]: https://img.shields.io/npm/v/simple-get.svg
[npm-url]: https://npmjs.org/package/simple-get
[downloads-image]: https://img.shields.io/npm/dm/simple-get.svg
[downloads-url]: https://npmjs.org/package/simple-get
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
### Simplest way to make http get requests
## features
This module is the lightest possible wrapper on top of node.js `http`, but supporting these essential features:
- follows redirects
- automatically handles gzip/deflate responses
- supports HTTPS
- supports specifying a timeout
- supports convenience `url` key so there's no need to use `url.parse` on the url when specifying options
- composes well with npm packages for features like cookies, proxies, form data, & OAuth
All this in < 100 lines of code.
## install
```
npm install simple-get
```
## usage
Note, all these examples also work in the browser with [browserify](http://browserify.org/).
### simple GET request
Doesn't get easier than this:
```js
const get = require('simple-get')
get('http://example.com', function (err, res) {
if (err) throw err
console.log(res.statusCode) // 200
res.pipe(process.stdout) // `res` is a stream
})
```
### even simpler GET request
If you just want the data, and don't want to deal with streams:
```js
const get = require('simple-get')
get.concat('http://example.com', function (err, res, data) {
if (err) throw err
console.log(res.statusCode) // 200
console.log(data) // Buffer('this is the server response')
})
```
### POST, PUT, PATCH, HEAD, DELETE support
For `POST`, call `get.post` or use option `{ method: 'POST' }`.
```js
const get = require('simple-get')
const opts = {
url: 'http://example.com',
body: 'this is the POST body'
}
get.post(opts, function (err, res) {
if (err) throw err
res.pipe(process.stdout) // `res` is a stream
})
```
#### A more complex example:
```js
const get = require('simple-get')
get({
url: 'http://example.com',
method: 'POST',
body: 'this is the POST body',
// simple-get accepts all options that node.js `http` accepts
// See: http://nodejs.org/api/http.html#http_http_request_options_callback
headers: {
'user-agent': 'my cool app'
}
}, function (err, res) {
if (err) throw err
// All properties/methods from http.IncomingResponse are available,
// even if a gunzip/inflate transform stream was returned.
// See: http://nodejs.org/api/http.html#http_http_incomingmessage
res.setTimeout(10000)
console.log(res.headers)
res.on('data', function (chunk) {
// `chunk` is the decoded response, after it's been gunzipped or inflated
// (if applicable)
console.log('got a chunk of the response: ' + chunk)
}))
})
```
### JSON
You can serialize/deserialize request and response with JSON:
```js
const get = require('simple-get')
const opts = {
method: 'POST',
url: 'http://example.com',
body: {
key: 'value'
},
json: true
}
get.concat(opts, function (err, res, data) {
if (err) throw err
console.log(data.key) // `data` is an object
})
```
### Timeout
You can set a timeout (in milliseconds) on the request with the `timeout` option.
If the request takes longer than `timeout` to complete, then the entire request
will fail with an `Error`.
```js
const get = require('simple-get')
const opts = {
url: 'http://example.com',
timeout: 2000 // 2 second timeout
}
get(opts, function (err, res) {})
```
### One Quick Tip
It's a good idea to set the `'user-agent'` header so the provider can more easily
see how their resource is used.
```js
const get = require('simple-get')
const pkg = require('./package.json')
get('http://example.com', {
headers: {
'user-agent': `my-module/${pkg.version} (https://github.com/username/my-module)`
}
})
```
### Proxies
You can use the [`tunnel`](https://github.com/koichik/node-tunnel) module with the
`agent` option to work with proxies:
```js
const get = require('simple-get')
const tunnel = require('tunnel')
const opts = {
url: 'http://example.com',
agent: tunnel.httpOverHttp({
proxy: {
host: 'localhost'
}
})
}
get(opts, function (err, res) {})
```
### Cookies
You can use the [`cookie`](https://github.com/jshttp/cookie) module to include
cookies in a request:
```js
const get = require('simple-get')
const cookie = require('cookie')
const opts = {
url: 'http://example.com',
headers: {
cookie: cookie.serialize('foo', 'bar')
}
}
get(opts, function (err, res) {})
```
### Form data
You can use the [`form-data`](https://github.com/form-data/form-data) module to
create POST request with form data:
```js
const fs = require('fs')
const get = require('simple-get')
const FormData = require('form-data')
const form = new FormData()
form.append('my_file', fs.createReadStream('/foo/bar.jpg'))
const opts = {
url: 'http://example.com',
body: form
}
get.post(opts, function (err, res) {})
```
#### Or, include `application/x-www-form-urlencoded` form data manually:
```js
const get = require('simple-get')
const opts = {
url: 'http://example.com',
form: {
key: 'value'
}
}
get.post(opts, function (err, res) {})
```
### Specifically disallowing redirects
```js
const get = require('simple-get')
const opts = {
url: 'http://example.com/will-redirect-elsewhere',
followRedirects: false
}
// res.statusCode will be 301, no error thrown
get(opts, function (err, res) {})
```
### OAuth
You can use the [`oauth-1.0a`](https://github.com/ddo/oauth-1.0a) module to create
a signed OAuth request:
```js
const get = require('simple-get')
const crypto = require('crypto')
const OAuth = require('oauth-1.0a')
const oauth = OAuth({
consumer: {
key: process.env.CONSUMER_KEY,
secret: process.env.CONSUMER_SECRET
},
signature_method: 'HMAC-SHA1',
hash_function: (baseString, key) => crypto.createHmac('sha1', key).update(baseString).digest('base64')
})
const token = {
key: process.env.ACCESS_TOKEN,
secret: process.env.ACCESS_TOKEN_SECRET
}
const url = 'https://api.twitter.com/1.1/statuses/home_timeline.json'
const opts = {
url: url,
headers: oauth.toHeader(oauth.authorize({url, method: 'GET'}, token)),
json: true
}
get(opts, function (err, res) {})
```
### Throttle requests
You can use [limiter](https://github.com/jhurliman/node-rate-limiter) to throttle requests. This is useful when calling an API that is rate limited.
```js
const simpleGet = require('simple-get')
const RateLimiter = require('limiter').RateLimiter
const limiter = new RateLimiter(1, 'second')
const get = (opts, cb) => limiter.removeTokens(1, () => simpleGet(opts, cb))
get.concat = (opts, cb) => limiter.removeTokens(1, () => simpleGet.concat(opts, cb))
var opts = {
url: 'http://example.com'
}
get.concat(opts, processResult)
get.concat(opts, processResult)
function processResult (err, res, data) {
if (err) throw err
console.log(data.toString())
}
```
## license
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).

99
node_modules/simple-get/index.js generated vendored Normal file
View File

@ -0,0 +1,99 @@
module.exports = simpleGet
const concat = require('simple-concat')
const decompressResponse = require('decompress-response') // excluded from browser build
const http = require('http')
const https = require('https')
const once = require('once')
const querystring = require('querystring')
const url = require('url')
const isStream = o => o !== null && typeof o === 'object' && typeof o.pipe === 'function'
function simpleGet (opts, cb) {
opts = Object.assign({ maxRedirects: 10 }, typeof opts === 'string' ? { url: opts } : opts)
cb = once(cb)
if (opts.url) {
const { hostname, port, protocol, auth, path } = url.parse(opts.url) // eslint-disable-line node/no-deprecated-api
delete opts.url
if (!hostname && !port && !protocol && !auth) opts.path = path // Relative redirect
else Object.assign(opts, { hostname, port, protocol, auth, path }) // Absolute redirect
}
const headers = { 'accept-encoding': 'gzip, deflate' }
if (opts.headers) Object.keys(opts.headers).forEach(k => (headers[k.toLowerCase()] = opts.headers[k]))
opts.headers = headers
let body
if (opts.body) {
body = opts.json && !isStream(opts.body) ? JSON.stringify(opts.body) : opts.body
} else if (opts.form) {
body = typeof opts.form === 'string' ? opts.form : querystring.stringify(opts.form)
opts.headers['content-type'] = 'application/x-www-form-urlencoded'
}
if (body) {
if (!opts.method) opts.method = 'POST'
if (!isStream(body)) opts.headers['content-length'] = Buffer.byteLength(body)
if (opts.json && !opts.form) opts.headers['content-type'] = 'application/json'
}
delete opts.body; delete opts.form
if (opts.json) opts.headers.accept = 'application/json'
if (opts.method) opts.method = opts.method.toUpperCase()
const protocol = opts.protocol === 'https:' ? https : http // Support http/https urls
const req = protocol.request(opts, res => {
if (opts.followRedirects !== false && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
opts.url = res.headers.location // Follow 3xx redirects
delete opts.headers.host // Discard `host` header on redirect (see #32)
res.resume() // Discard response
if (opts.method === 'POST' && [301, 302].includes(res.statusCode)) {
opts.method = 'GET' // On 301/302 redirect, change POST to GET (see #35)
delete opts.headers['content-length']; delete opts.headers['content-type']
}
if (opts.maxRedirects-- === 0) return cb(new Error('too many redirects'))
else return simpleGet(opts, cb)
}
const tryUnzip = typeof decompressResponse === 'function' && opts.method !== 'HEAD'
cb(null, tryUnzip ? decompressResponse(res) : res)
})
req.on('timeout', () => {
req.abort()
cb(new Error('Request timed out'))
})
req.on('error', cb)
if (isStream(body)) body.on('error', cb).pipe(req)
else req.end(body)
return req
}
simpleGet.concat = (opts, cb) => {
return simpleGet(opts, (err, res) => {
if (err) return cb(err)
concat(res, (err, data) => {
if (err) return cb(err)
if (opts.json) {
try {
data = JSON.parse(data.toString())
} catch (err) {
return cb(err, res, data)
}
}
cb(null, res, data)
})
})
}
;['get', 'post', 'put', 'patch', 'head', 'delete'].forEach(method => {
simpleGet[method] = (opts, cb) => {
if (typeof opts === 'string') opts = { url: opts }
return simpleGet(Object.assign({ method: method.toUpperCase() }, opts), cb)
}
})

79
node_modules/simple-get/package.json generated vendored Normal file
View File

@ -0,0 +1,79 @@
{
"_from": "simple-get",
"_id": "simple-get@3.1.0",
"_inBundle": false,
"_integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==",
"_location": "/simple-get",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "simple-get",
"name": "simple-get",
"escapedName": "simple-get",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz",
"_shasum": "b45be062435e50d159540b576202ceec40b9c6b3",
"_spec": "simple-get",
"_where": "/home/goto-bus-stop/Code/goto-bus-stop/setup-zig",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
"url": "http://feross.org/"
},
"browser": {
"decompress-response": false
},
"bugs": {
"url": "https://github.com/feross/simple-get/issues"
},
"bundleDependencies": false,
"dependencies": {
"decompress-response": "^4.2.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
},
"deprecated": false,
"description": "Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.",
"devDependencies": {
"self-signed-https": "^1.0.5",
"standard": "*",
"string-to-stream": "^3.0.0",
"tape": "^4.0.0"
},
"homepage": "https://github.com/feross/simple-get",
"keywords": [
"request",
"http",
"GET",
"get request",
"http.get",
"redirects",
"follow redirects",
"gzip",
"deflate",
"https",
"http-https",
"stream",
"simple request",
"simple get"
],
"license": "MIT",
"main": "index.js",
"name": "simple-get",
"repository": {
"type": "git",
"url": "git://github.com/feross/simple-get.git"
},
"scripts": {
"test": "standard && tape test/*.js"
},
"version": "3.1.0"
}

15
node_modules/wrappy/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

36
node_modules/wrappy/README.md generated vendored Normal file
View File

@ -0,0 +1,36 @@
# wrappy
Callback wrapping utility
## USAGE
```javascript
var wrappy = require("wrappy")
// var wrapper = wrappy(wrapperFunction)
// make sure a cb is called only once
// See also: http://npm.im/once for this specific use case
var once = wrappy(function (cb) {
var called = false
return function () {
if (called) return
called = true
return cb.apply(this, arguments)
}
})
function printBoo () {
console.log('boo')
}
// has some rando property
printBoo.iAmBooPrinter = true
var onlyPrintOnce = once(printBoo)
onlyPrintOnce() // prints 'boo'
onlyPrintOnce() // does nothing
// random property is retained!
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
```

58
node_modules/wrappy/package.json generated vendored Normal file
View File

@ -0,0 +1,58 @@
{
"_from": "wrappy@1",
"_id": "wrappy@1.0.2",
"_inBundle": false,
"_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"_location": "/wrappy",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "wrappy@1",
"name": "wrappy",
"escapedName": "wrappy",
"rawSpec": "1",
"saveSpec": null,
"fetchSpec": "1"
},
"_requiredBy": [
"/once"
],
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
"_spec": "wrappy@1",
"_where": "/home/goto-bus-stop/Code/goto-bus-stop/setup-zig/node_modules/once",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/npm/wrappy/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Callback wrapping utility",
"devDependencies": {
"tap": "^2.3.1"
},
"directories": {
"test": "test"
},
"files": [
"wrappy.js"
],
"homepage": "https://github.com/npm/wrappy",
"license": "ISC",
"main": "wrappy.js",
"name": "wrappy",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/wrappy.git"
},
"scripts": {
"test": "tap --coverage test/*.js"
},
"version": "1.0.2"
}

33
node_modules/wrappy/wrappy.js generated vendored Normal file
View File

@ -0,0 +1,33 @@
// Returns a wrapper function that returns a wrapped callback
// The wrapper function should do some stuff, and return a
// presumably different callback function.
// This makes sure that own properties are retained, so that
// decorations and such are not lost along the way.
module.exports = wrappy
function wrappy (fn, cb) {
if (fn && cb) return wrappy(fn)(cb)
if (typeof fn !== 'function')
throw new TypeError('need wrapper function')
Object.keys(fn).forEach(function (k) {
wrapper[k] = fn[k]
})
return wrapper
function wrapper() {
var args = new Array(arguments.length)
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}
var ret = fn.apply(this, args)
var cb = args[args.length-1]
if (typeof ret === 'function' && ret !== cb) {
Object.keys(cb).forEach(function (k) {
ret[k] = cb[k]
})
}
return ret
}
}

View File

@ -28,6 +28,7 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.1.3", "@actions/core": "^1.1.3",
"@actions/tool-cache": "^1.1.2", "@actions/tool-cache": "^1.1.2",
"semver": "^6.3.0" "semver": "^6.3.0",
"simple-get": "^3.1.0"
} }
} }