Remove absolute paths

This commit is contained in:
CrazyMax 2020-04-08 00:33:20 +02:00
parent ff47e64685
commit fce5f2e313
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
342 changed files with 6646 additions and 7223 deletions

View file

@ -48,9 +48,8 @@ jobs:
-
name: NPM production deps
run: |
rm -rf node_modules
sed -i '/node_modules/d' .gitignore
npm install --production
npm run build-dep
npm run prune
-
name: Commit and push changes
run: |

View file

@ -82,6 +82,12 @@ try {
core.warning('myInput was not set');
}
if (core.isDebug()) {
// curl -v https://github.com
} else {
// curl https://github.com
}
// Do stuff
}
catch (err) {

View file

@ -55,6 +55,10 @@ export declare function setOutput(name: string, value: string): void;
* @param message add error issue message
*/
export declare function setFailed(message: string): void;
/**
* Gets whether Actions Step Debug is on or not
*/
export declare function isDebug(): boolean;
/**
* Writes debug message to user log
* @param message debug message

View file

@ -104,6 +104,13 @@ exports.setFailed = setFailed;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
/**
* Gets whether Actions Step Debug is on or not
*/
function isDebug() {
return process.env['RUNNER_DEBUG'] === '1';
}
exports.isDebug = isDebug;
/**
* Writes debug message to user log
* @param message debug message

View file

@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}

View file

@ -1,34 +1,27 @@
{
"_args": [
[
"@actions/core@1.2.2",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "@actions/core@1.2.2",
"_id": "@actions/core@1.2.2",
"_from": "@actions/core@1.2.3",
"_id": "@actions/core@1.2.3",
"_inBundle": false,
"_integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==",
"_integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==",
"_location": "/@actions/core",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@actions/core@1.2.2",
"raw": "@actions/core@1.2.3",
"name": "@actions/core",
"escapedName": "@actions%2fcore",
"scope": "@actions",
"rawSpec": "1.2.2",
"rawSpec": "1.2.3",
"saveSpec": null,
"fetchSpec": "1.2.2"
"fetchSpec": "1.2.3"
},
"_requiredBy": [
"/",
"/@actions/tool-cache"
],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
"_spec": "1.2.2",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz",
"_spec": "1.2.3",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -66,5 +59,5 @@
"tsc": "tsc"
},
"types": "lib/core.d.ts",
"version": "1.2.2"
}
"version": "1.2.3"
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"@actions/exec@1.0.3",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "@actions/exec@1.0.3",
"_id": "@actions/exec@1.0.3",
"_inBundle": false,
@ -28,7 +22,6 @@
],
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz",
"_spec": "1.0.3",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -67,4 +60,4 @@
},
"types": "lib/exec.d.ts",
"version": "1.0.3"
}
}

View file

@ -18,6 +18,8 @@ A lightweight HTTP client optimized for use with actions, TypeScript with generi
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
- Redirects supported
Features and releases [here](./RELEASES.md)
## Install
```
@ -49,7 +51,11 @@ export NODE_DEBUG=http
## Node support
The http-client is built using the latest LTS version of Node 12. We also support the latest LTS for Node 6, 8 and Node 10.
The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+.
## Support and Versioning
We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat).
## Contributing

13
node_modules/@actions/http-client/RELEASES.md generated vendored Normal file
View file

@ -0,0 +1,13 @@
## Releases
## 1.0.6
Automatically sends Content-Type and Accept application/json headers for \<verb>Json() helper methods if not set in the client or parameters.
## 1.0.5
Adds \<verb>Json() helper methods for json over http scenarios.
## 1.0.4
Started to add \<verb>Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types.
## 1.0.1 to 1.0.3
Adds proxy support.

View file

@ -29,6 +29,13 @@ export declare enum HttpCodes {
ServiceUnavailable = 503,
GatewayTimeout = 504
}
export declare enum Headers {
Accept = "accept",
ContentType = "content-type"
}
export declare enum MediaTypes {
ApplicationJson = "application/json"
}
/**
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
@ -64,6 +71,14 @@ export declare class HttpClient {
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
/**
* Gets a typed object from an endpoint
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
*/
getJson<T>(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
/**
* Makes a raw http request.
* All other methods such as get, post, patch, and request ultimately call this.
@ -95,6 +110,9 @@ export declare class HttpClient {
getAgent(serverUrl: string): http.Agent;
private _prepareRequest;
private _mergeHeaders;
private _getExistingOrDefaultHeader;
private _getAgent;
private _performExponentialBackoff;
private static dateTimeDeserializer;
private _processResponse;
}

View file

@ -34,6 +34,15 @@ var HttpCodes;
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
var Headers;
(function (Headers) {
Headers["Accept"] = "accept";
Headers["ContentType"] = "content-type";
})(Headers = exports.Headers || (exports.Headers = {}));
var MediaTypes;
(function (MediaTypes) {
MediaTypes["ApplicationJson"] = "application/json";
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
/**
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
@ -132,6 +141,36 @@ class HttpClient {
sendStream(verb, requestUrl, stream, additionalHeaders) {
return this.request(verb, requestUrl, stream, additionalHeaders);
}
/**
* Gets a typed object from an endpoint
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
*/
async getJson(requestUrl, additionalHeaders = {}) {
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
let res = await this.get(requestUrl, additionalHeaders);
return this._processResponse(res, this.requestOptions);
}
async postJson(requestUrl, obj, additionalHeaders = {}) {
let data = JSON.stringify(obj, null, 2);
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
let res = await this.post(requestUrl, data, additionalHeaders);
return this._processResponse(res, this.requestOptions);
}
async putJson(requestUrl, obj, additionalHeaders = {}) {
let data = JSON.stringify(obj, null, 2);
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
let res = await this.put(requestUrl, data, additionalHeaders);
return this._processResponse(res, this.requestOptions);
}
async patchJson(requestUrl, obj, additionalHeaders = {}) {
let data = JSON.stringify(obj, null, 2);
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
let res = await this.patch(requestUrl, data, additionalHeaders);
return this._processResponse(res, this.requestOptions);
}
/**
* Makes a raw http request.
* All other methods such as get, post, patch, and request ultimately call this.
@ -315,6 +354,14 @@ class HttpClient {
}
return lowercaseKeys(headers || {});
}
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {});
let clientHeader;
if (this.requestOptions && this.requestOptions.headers) {
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
}
return additionalHeaders[header] || clientHeader || _default;
}
_getAgent(parsedUrl) {
let agent;
let proxyUrl = pm.getProxyUrl(parsedUrl);
@ -382,5 +429,72 @@ class HttpClient {
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
return new Promise(resolve => setTimeout(() => resolve(), ms));
}
static dateTimeDeserializer(key, value) {
if (typeof value === 'string') {
let a = new Date(value);
if (!isNaN(a.valueOf())) {
return a;
}
}
return value;
}
async _processResponse(res, options) {
return new Promise(async (resolve, reject) => {
const statusCode = res.message.statusCode;
const response = {
statusCode: statusCode,
result: null,
headers: {}
};
// not found leads to null obj returned
if (statusCode == HttpCodes.NotFound) {
resolve(response);
}
let obj;
let contents;
// get the result from the body
try {
contents = await res.readBody();
if (contents && contents.length > 0) {
if (options && options.deserializeDates) {
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
}
else {
obj = JSON.parse(contents);
}
response.result = obj;
}
response.headers = res.message.headers;
}
catch (err) {
// Invalid resource (contents not json); leaving result obj null
}
// note that 3xx redirects are handled by the http layer.
if (statusCode > 299) {
let msg;
// if exception/error in body, attempt to get better error
if (obj && obj.message) {
msg = obj.message;
}
else if (contents && contents.length > 0) {
// it may be the case that the exception is in the body message as string
msg = contents;
}
else {
msg = "Failed request: (" + statusCode + ")";
}
let err = new Error(msg);
// attach statusCode and body obj (if available) to the error object
err['statusCode'] = statusCode;
if (response.result) {
err['result'] = response.result;
}
reject(err);
}
else {
resolve(response);
}
});
}
}
exports.HttpClient = HttpClient;

View file

@ -39,6 +39,12 @@ export interface IRequestOptions {
maxRedirects?: number;
maxSockets?: number;
keepAlive?: boolean;
deserializeDates?: boolean;
allowRetries?: boolean;
maxRetries?: number;
}
export interface ITypedResponse<T> {
statusCode: number;
result: T | null;
headers: Object;
}

View file

@ -1,22 +0,0 @@
# Changelog
- 0.0.6 (2018/09/11)
- Fix `localAddress` not working (#25)
- Fix `Host:` header for CONNECT method by @tmurakam (#29, #30)
- Fix default port for https (#32)
- Fix error handling when the proxy send illegal response body (#33)
- 0.0.5 (2017/06/12)
- Fix socket leak.
- 0.0.4 (2016/01/23)
- supported Node v0.12 or later.
- 0.0.3 (2014/01/20)
- fixed package.json
- 0.0.1 (2012/02/18)
- supported Node v0.6.x (0.6.11 or later).
- 0.0.0 (2012/02/11)
- first release.

View file

@ -1,185 +0,0 @@
# node-tunnel - HTTP/HTTPS Agents for tunneling proxies
[![Build Status](https://img.shields.io/travis/koichik/node-tunnel.svg?style=flat)](https://travis-ci.org/koichik/node-tunnel)
[![Dependency Status](http://img.shields.io/david/koichik/node-tunnel.svg?style=flat)](https://david-dm.org/koichik/node-tunnel#info=dependencies)
[![DevDependency Status](http://img.shields.io/david/dev/koichik/node-tunnel.svg?style=flat)](https://david-dm.org/koichik/node-tunnel#info=devDependencies)
## Example
```javascript
var tunnel = require('tunnel');
var tunnelingAgent = tunnel.httpsOverHttp({
proxy: {
host: 'localhost',
port: 3128
}
});
var req = https.request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
```
## Installation
$ npm install tunnel
## Usages
### HTTP over HTTP tunneling
```javascript
var tunnelingAgent = tunnel.httpOverHttp({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 80
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
}
}
});
var req = http.request({
host: 'example.com',
port: 80,
agent: tunnelingAgent
});
```
### HTTPS over HTTP tunneling
```javascript
var tunnelingAgent = tunnel.httpsOverHttp({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
// CA for origin server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Client certification for origin server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 80
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
},
}
});
var req = https.request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
```
### HTTP over HTTPS tunneling
```javascript
var tunnelingAgent = tunnel.httpOverHttps({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 443
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
},
// CA for proxy server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Server name for verification if necessary
servername: 'example.com',
// Client certification for proxy server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
}
});
var req = http.request({
host: 'example.com',
port: 80,
agent: tunnelingAgent
});
```
### HTTPS over HTTPS tunneling
```javascript
var tunnelingAgent = tunnel.httpsOverHttps({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
// CA for origin server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Client certification for origin server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 443
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
}
// CA for proxy server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Server name for verification if necessary
servername: 'example.com',
// Client certification for proxy server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
}
});
var req = https.request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
```
## CONTRIBUTORS
* [Aleksis Brezas (abresas)](https://github.com/abresas)
* [Jackson Tian (JacksonTian)](https://github.com/JacksonTian)
* [Dmitry Sorin (1999)](https://github.com/1999)
## License
Licensed under the [MIT](https://github.com/koichik/node-tunnel/blob/master/LICENSE) license.

View file

@ -1 +0,0 @@
module.exports = require('./lib/tunnel');

View file

@ -1,264 +0,0 @@
'use strict';
var net = require('net');
var tls = require('tls');
var http = require('http');
var https = require('https');
var events = require('events');
var assert = require('assert');
var util = require('util');
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, localAddress) {
var options = toOptions(host, port, localAddress);
for (var i = 0, len = self.requests.length; i < len; ++i) {
var pending = self.requests[i];
if (pending.host === options.host && pending.port === options.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, host, port, localAddress) {
var self = this;
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
if (self.sockets.length >= this.maxSockets) {
// We are over limit so we'll add it to the queue.
self.requests.push(options);
return;
}
// If we are under maxSockets create a new one.
self.createSocket(options, function(socket) {
socket.on('free', onFree);
socket.on('close', onCloseOrRemove);
socket.on('agentRemove', onCloseOrRemove);
req.onSocket(socket);
function onFree() {
self.emit('free', socket, options);
}
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,
headers: {
host: options.host + ':' + options.port
}
});
if (options.localAddress) {
connectOptions.localAddress = options.localAddress;
}
if (connectOptions.proxyAuth) {
connectOptions.headers = connectOptions.headers || {};
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
new Buffer(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) {
debug('tunneling socket could not be established, statusCode=%d',
res.statusCode);
socket.destroy();
var error = new Error('tunneling socket could not be established, ' +
'statusCode=' + res.statusCode);
error.code = 'ECONNRESET';
options.request.emit('error', error);
self.removeSocket(placeholder);
return;
}
if (head.length > 0) {
debug('got illegal response body from proxy');
socket.destroy();
var error = new Error('got illegal response body from proxy');
error.code = 'ECONNRESET';
options.request.emit('error', error);
self.removeSocket(placeholder);
return;
}
debug('tunneling connection has established');
self.sockets[self.sockets.indexOf(placeholder)] = socket;
return cb(socket);
}
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.createSocket(pending, function(socket) {
pending.request.onSocket(socket);
});
}
};
function createSecureSocket(options, cb) {
var self = this;
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
var hostHeader = options.request.getHeader('host');
var tlsOptions = mergeOptions({}, self.options, {
socket: socket,
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
});
// 0 is dummy port for v0.6
var secureSocket = tls.connect(0, tlsOptions);
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
cb(secureSocket);
});
}
function toOptions(host, port, localAddress) {
if (typeof host === 'string') { // since v0.10
return {
host: host,
port: port,
localAddress: localAddress
};
}
return host; // for v0.11 or later
}
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

View file

@ -1,67 +0,0 @@
{
"_args": [
[
"tunnel@0.0.6",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "tunnel@0.0.6",
"_id": "tunnel@0.0.6",
"_inBundle": false,
"_integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"_location": "/@actions/http-client/tunnel",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "tunnel@0.0.6",
"name": "tunnel",
"escapedName": "tunnel",
"rawSpec": "0.0.6",
"saveSpec": null,
"fetchSpec": "0.0.6"
},
"_requiredBy": [
"/@actions/http-client"
],
"_resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"_spec": "0.0.6",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Koichi Kobayashi",
"email": "koichik@improvement.jp"
},
"bugs": {
"url": "https://github.com/koichik/node-tunnel/issues"
},
"description": "Node HTTP/HTTPS Agents for tunneling proxies",
"devDependencies": {
"mocha": "^5.2.0",
"should": "^13.2.3"
},
"directories": {
"lib": "./lib"
},
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
},
"homepage": "https://github.com/koichik/node-tunnel/",
"keywords": [
"http",
"https",
"agent",
"proxy",
"tunnel"
],
"license": "MIT",
"main": "./index.js",
"name": "tunnel",
"repository": {
"type": "git",
"url": "git+https://github.com/koichik/node-tunnel.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.0.6"
}

View file

@ -1,33 +1,26 @@
{
"_args": [
[
"@actions/http-client@1.0.3",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "@actions/http-client@1.0.3",
"_id": "@actions/http-client@1.0.3",
"_from": "@actions/http-client@1.0.6",
"_id": "@actions/http-client@1.0.6",
"_inBundle": false,
"_integrity": "sha512-wFwh1U4adB/Zsk4cc9kVqaBOHoknhp/pJQk+aWTocbAZWpIl4Zx/At83WFRLXvxB+5HVTWOACM6qjULMZfQSfw==",
"_integrity": "sha512-LGmio4w98UyGX33b/W6V6Nx/sQHRXZ859YlMkn36wPsXPB82u8xTVlA/Dq2DXrm6lEq9RVmisRJa1c+HETAIJA==",
"_location": "/@actions/http-client",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@actions/http-client@1.0.3",
"raw": "@actions/http-client@1.0.6",
"name": "@actions/http-client",
"escapedName": "@actions%2fhttp-client",
"scope": "@actions",
"rawSpec": "1.0.3",
"rawSpec": "1.0.6",
"saveSpec": null,
"fetchSpec": "1.0.3"
"fetchSpec": "1.0.6"
},
"_requiredBy": [
"/@actions/tool-cache"
],
"_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.3.tgz",
"_spec": "1.0.3",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.6.tgz",
"_spec": "1.0.6",
"author": {
"name": "GitHub, Inc."
},
@ -62,5 +55,5 @@
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
"test": "jest"
},
"version": "1.0.3"
}
"version": "1.0.6"
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"@actions/io@1.0.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "@actions/io@1.0.1",
"_id": "@actions/io@1.0.1",
"_inBundle": false,
@ -28,7 +22,6 @@
],
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.1.tgz",
"_spec": "1.0.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -62,4 +55,4 @@
"tsc": "tsc"
},
"version": "1.0.1"
}
}

View file

@ -22,11 +22,11 @@ These can then be extracted in platform specific ways:
const tc = require('@actions/tool-cache');
if (process.platform === 'win32') {
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
// Or alternately
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
}
else {
@ -37,7 +37,7 @@ else {
#### Cache
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for private runners (private runners are still in development but are on the roadmap).
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for self-hosted runners.
You'll often want to add it to the path as part of this step:

12
node_modules/@actions/tool-cache/lib/retry-helper.d.ts generated vendored Normal file
View file

@ -0,0 +1,12 @@
/**
* Internal class for retries
*/
export declare class RetryHelper {
private maxAttempts;
private minSeconds;
private maxSeconds;
constructor(maxAttempts: number, minSeconds: number, maxSeconds: number);
execute<T>(action: () => Promise<T>, isRetryable?: (e: Error) => boolean): Promise<T>;
private getSleepAmount;
private sleep;
}

70
node_modules/@actions/tool-cache/lib/retry-helper.js generated vendored Normal file
View file

@ -0,0 +1,70 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
/**
* Internal class for retries
*/
class RetryHelper {
constructor(maxAttempts, minSeconds, maxSeconds) {
if (maxAttempts < 1) {
throw new Error('max attempts should be greater than or equal to 1');
}
this.maxAttempts = maxAttempts;
this.minSeconds = Math.floor(minSeconds);
this.maxSeconds = Math.floor(maxSeconds);
if (this.minSeconds > this.maxSeconds) {
throw new Error('min seconds should be less than or equal to max seconds');
}
}
execute(action, isRetryable) {
return __awaiter(this, void 0, void 0, function* () {
let attempt = 1;
while (attempt < this.maxAttempts) {
// Try
try {
return yield action();
}
catch (err) {
if (isRetryable && !isRetryable(err)) {
throw err;
}
core.info(err.message);
}
// Sleep
const seconds = this.getSleepAmount();
core.info(`Waiting ${seconds} seconds before trying again`);
yield this.sleep(seconds);
attempt++;
}
// Last attempt
return yield action();
});
}
getSleepAmount() {
return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
this.minSeconds);
}
sleep(seconds) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
});
}
}
exports.RetryHelper = RetryHelper;
//# sourceMappingURL=retry-helper.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"retry-helper.js","sourceRoot":"","sources":["../src/retry-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AAErC;;GAEG;AACH,MAAa,WAAW;IAKtB,YAAY,WAAmB,EAAE,UAAkB,EAAE,UAAkB;QACrE,IAAI,WAAW,GAAG,CAAC,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;SACrE;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACxC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACxC,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;IACH,CAAC;IAEK,OAAO,CACX,MAAwB,EACxB,WAAmC;;YAEnC,IAAI,OAAO,GAAG,CAAC,CAAA;YACf,OAAO,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE;gBACjC,MAAM;gBACN,IAAI;oBACF,OAAO,MAAM,MAAM,EAAE,CAAA;iBACtB;gBAAC,OAAO,GAAG,EAAE;oBACZ,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;wBACpC,MAAM,GAAG,CAAA;qBACV;oBAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;iBACvB;gBAED,QAAQ;gBACR,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;gBACrC,IAAI,CAAC,IAAI,CAAC,WAAW,OAAO,8BAA8B,CAAC,CAAA;gBAC3D,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBACzB,OAAO,EAAE,CAAA;aACV;YAED,eAAe;YACf,OAAO,MAAM,MAAM,EAAE,CAAA;QACvB,CAAC;KAAA;IAEO,cAAc;QACpB,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YACnE,IAAI,CAAC,UAAU,CAChB,CAAA;IACH,CAAC;IAEa,KAAK,CAAC,OAAe;;YACjC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAA;QACpE,CAAC;KAAA;CACF;AAxDD,kCAwDC"}

View file

@ -26,9 +26,12 @@ const os = __importStar(require("os"));
const path = __importStar(require("path"));
const httpm = __importStar(require("@actions/http-client"));
const semver = __importStar(require("semver"));
const stream = __importStar(require("stream"));
const util = __importStar(require("util"));
const v4_1 = __importDefault(require("uuid/v4"));
const exec_1 = require("@actions/exec/lib/exec");
const assert_1 = require("assert");
const retry_helper_1 = require("./retry-helper");
class HTTPError extends Error {
constructor(httpStatusCode) {
super(`Unexpected HTTP response: ${httpStatusCode}`);
@ -39,31 +42,6 @@ class HTTPError extends Error {
exports.HTTPError = HTTPError;
const IS_WINDOWS = process.platform === 'win32';
const userAgent = 'actions/tool-cache';
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
let tempDirectory = process.env['RUNNER_TEMP'] || '';
let cacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
// If directories not found, place them in common temp locations
if (!tempDirectory || !cacheRoot) {
let baseLocation;
if (IS_WINDOWS) {
// On windows use the USERPROFILE env variable
baseLocation = process.env['USERPROFILE'] || 'C:\\';
}
else {
if (process.platform === 'darwin') {
baseLocation = '/Users';
}
else {
baseLocation = '/home';
}
}
if (!tempDirectory) {
tempDirectory = path.join(baseLocation, 'actions', 'temp');
}
if (!cacheRoot) {
cacheRoot = path.join(baseLocation, 'actions', 'cache');
}
}
/**
* Download a tool from an url and stream it into a file
*
@ -73,52 +51,71 @@ if (!tempDirectory || !cacheRoot) {
*/
function downloadTool(url, dest) {
return __awaiter(this, void 0, void 0, function* () {
// Wrap in a promise so that we can resolve from within stream callbacks
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
try {
const http = new httpm.HttpClient(userAgent, [], {
allowRetries: true,
maxRetries: 3
});
dest = dest || path.join(tempDirectory, v4_1.default());
yield io.mkdirP(path.dirname(dest));
core.debug(`Downloading ${url}`);
core.debug(`Downloading ${dest}`);
if (fs.existsSync(dest)) {
throw new Error(`Destination file path ${dest} already exists`);
dest = dest || path.join(_getTempDirectory(), v4_1.default());
yield io.mkdirP(path.dirname(dest));
core.debug(`Downloading ${url}`);
core.debug(`Destination ${dest}`);
const maxAttempts = 3;
const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10);
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
return yield downloadToolAttempt(url, dest || '');
}), (err) => {
if (err instanceof HTTPError && err.httpStatusCode) {
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
if (err.httpStatusCode < 500 &&
err.httpStatusCode !== 408 &&
err.httpStatusCode !== 429) {
return false;
}
const response = yield http.get(url);
if (response.message.statusCode !== 200) {
const err = new HTTPError(response.message.statusCode);
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
throw err;
}
const file = fs.createWriteStream(dest);
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
try {
const stream = response.message.pipe(file);
stream.on('close', () => {
core.debug('download complete');
resolve(dest);
});
}
catch (err) {
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
reject(err);
}
}));
file.on('error', err => {
file.end();
reject(err);
});
}
catch (err) {
reject(err);
}
}));
// Otherwise retry
return true;
});
});
}
exports.downloadTool = downloadTool;
function downloadToolAttempt(url, dest) {
return __awaiter(this, void 0, void 0, function* () {
if (fs.existsSync(dest)) {
throw new Error(`Destination file path ${dest} already exists`);
}
// Get the response headers
const http = new httpm.HttpClient(userAgent, [], {
allowRetries: false
});
const response = yield http.get(url);
if (response.message.statusCode !== 200) {
const err = new HTTPError(response.message.statusCode);
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
throw err;
}
// Download the response body
const pipeline = util.promisify(stream.pipeline);
const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message);
const readStream = responseMessageFactory();
let succeeded = false;
try {
yield pipeline(readStream, fs.createWriteStream(dest));
core.debug('download complete');
succeeded = true;
return dest;
}
finally {
// Error, delete dest before retry
if (!succeeded) {
core.debug('download failed');
try {
yield io.rmRF(dest);
}
catch (err) {
core.debug(`Failed to delete '${dest}'. ${err.message}`);
}
}
}
});
}
/**
* Extract a .7z file
*
@ -208,14 +205,17 @@ function extractTar(file, dest, flags = 'xz') {
// Create dest
dest = yield _createExtractFolder(dest);
// Determine whether GNU tar
core.debug('Checking tar --version');
let versionOutput = '';
yield exec_1.exec('tar --version', [], {
ignoreReturnCode: true,
silent: true,
listeners: {
stdout: (data) => (versionOutput += data.toString()),
stderr: (data) => (versionOutput += data.toString())
}
});
core.debug(versionOutput.trim());
const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
// Initialize args
const args = [flags];
@ -376,7 +376,7 @@ function find(toolName, versionSpec, arch) {
let toolPath = '';
if (versionSpec) {
versionSpec = semver.clean(versionSpec) || '';
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch);
core.debug(`checking cache: ${cachePath}`);
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
@ -398,7 +398,7 @@ exports.find = find;
function findAllVersions(toolName, arch) {
const versions = [];
arch = arch || os.arch();
const toolPath = path.join(cacheRoot, toolName);
const toolPath = path.join(_getCacheDirectory(), toolName);
if (fs.existsSync(toolPath)) {
const children = fs.readdirSync(toolPath);
for (const child of children) {
@ -417,7 +417,7 @@ function _createExtractFolder(dest) {
return __awaiter(this, void 0, void 0, function* () {
if (!dest) {
// create a temp dir
dest = path.join(tempDirectory, v4_1.default());
dest = path.join(_getTempDirectory(), v4_1.default());
}
yield io.mkdirP(dest);
return dest;
@ -425,7 +425,7 @@ function _createExtractFolder(dest) {
}
function _createToolPath(tool, version, arch) {
return __awaiter(this, void 0, void 0, function* () {
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
core.debug(`destination ${folderPath}`);
const markerPath = `${folderPath}.complete`;
yield io.rmRF(folderPath);
@ -435,7 +435,7 @@ function _createToolPath(tool, version, arch) {
});
}
function _completeToolPath(tool, version, arch) {
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
const markerPath = `${folderPath}.complete`;
fs.writeFileSync(markerPath, '');
core.debug('finished caching tool');
@ -472,4 +472,29 @@ function _evaluateVersions(versions, versionSpec) {
}
return version;
}
/**
* Gets RUNNER_TOOL_CACHE
*/
function _getCacheDirectory() {
const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
return cacheDirectory;
}
/**
* Gets RUNNER_TEMP
*/
function _getTempDirectory() {
const tempDirectory = process.env['RUNNER_TEMP'] || '';
assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
return tempDirectory;
}
/**
* Gets a global variable
*/
function _getGlobal(key, defaultValue) {
/* eslint-disable @typescript-eslint/no-explicit-any */
const value = global[key];
/* eslint-enable @typescript-eslint/no-explicit-any */
return value !== undefined ? value : defaultValue;
}
//# sourceMappingURL=tool-cache.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,33 +1,26 @@
{
"_args": [
[
"@actions/tool-cache@1.3.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "@actions/tool-cache@1.3.1",
"_id": "@actions/tool-cache@1.3.1",
"_from": "@actions/tool-cache@1.3.3",
"_id": "@actions/tool-cache@1.3.3",
"_inBundle": false,
"_integrity": "sha512-sKoEJv0/c7WzjPEq2PO12Sc8QdEp58XIBHMm3c4lUn/iZWgLz9HBeCuFGpLQjDvXJNfLZ4g+WD+rMjgOmpH4Ag==",
"_integrity": "sha512-AFVyTLcIxusDVI1gMhbZW8m/On7YNJG+xYaxorV+qic+f7lO7h37aT2mfzxqAq7mwHxtP1YlVFNrXe9QDf/bPg==",
"_location": "/@actions/tool-cache",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@actions/tool-cache@1.3.1",
"raw": "@actions/tool-cache@1.3.3",
"name": "@actions/tool-cache",
"escapedName": "@actions%2ftool-cache",
"scope": "@actions",
"rawSpec": "1.3.1",
"rawSpec": "1.3.3",
"saveSpec": null,
"fetchSpec": "1.3.1"
"fetchSpec": "1.3.3"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.3.1.tgz",
"_spec": "1.3.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.3.3.tgz",
"_spec": "1.3.3",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -77,5 +70,5 @@
"tsc": "tsc"
},
"types": "lib/tool-cache.d.ts",
"version": "1.3.1"
}
"version": "1.3.3"
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"@sindresorhus/is@0.7.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "@sindresorhus/is@0.7.0",
"_id": "@sindresorhus/is@0.7.0",
"_inBundle": false,
@ -27,7 +21,6 @@
],
"_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz",
"_spec": "0.7.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -95,4 +88,4 @@
},
"types": "dist/index.d.ts",
"version": "0.7.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"file-type@4.4.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "file-type@4.4.0",
"_id": "file-type@4.4.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz",
"_spec": "4.4.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -139,4 +132,4 @@
"test": "xo && ava"
},
"version": "4.4.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"archive-type@4.0.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "archive-type@4.0.0",
"_id": "archive-type@4.0.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz",
"_spec": "4.0.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -77,4 +70,4 @@
"test": "xo && ava"
},
"version": "4.0.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"base64-js@1.3.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "base64-js@1.3.1",
"_id": "base64-js@1.3.1",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"_spec": "1.3.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "T. Jameson Little",
"email": "t.jameson.little@gmail.com"
@ -60,4 +53,4 @@
"unit": "tape test/*.js"
},
"version": "1.3.1"
}
}

9
node_modules/bl/package.json generated vendored
View file

@ -1,10 +1,4 @@
{
"_args": [
[
"bl@1.2.2",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "bl@1.2.2",
"_id": "bl@1.2.2",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
"_spec": "1.2.2",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"authors": [
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)",
"Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
@ -63,4 +56,4 @@
"test": "node test/test.js | faucet"
},
"version": "1.2.2"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"buffer-alloc-unsafe@1.1.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "buffer-alloc-unsafe@1.1.0",
"_id": "buffer-alloc-unsafe@1.1.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
"_spec": "1.1.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": {
"url": "https://github.com/LinusU/buffer-alloc-unsafe/issues"
},
@ -57,4 +50,4 @@
"test": "standard && node test"
},
"version": "1.1.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"buffer-alloc@1.2.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "buffer-alloc@1.2.0",
"_id": "buffer-alloc@1.2.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
"_spec": "1.2.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": {
"url": "https://github.com/LinusU/buffer-alloc/issues"
},
@ -59,4 +52,4 @@
"test": "standard && node test"
},
"version": "1.2.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"buffer-crc32@0.2.13",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "buffer-crc32@0.2.13",
"_id": "buffer-crc32@0.2.13",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
"_spec": "0.2.13",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Brian J. Brennan",
"email": "brianloveswords@gmail.com"
@ -69,4 +62,4 @@
"test": "tap tests/*.test.js"
},
"version": "0.2.13"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"buffer-fill@1.0.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "buffer-fill@1.0.0",
"_id": "buffer-fill@1.0.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
"_spec": "1.0.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": {
"url": "https://github.com/LinusU/buffer-fill/issues"
},
@ -49,4 +42,4 @@
"test": "standard && node test"
},
"version": "1.0.0"
}
}

2
node_modules/buffer/AUTHORS.md generated vendored
View file

@ -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.

7
node_modules/buffer/README.md generated vendored
View file

@ -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.

6
node_modules/buffer/index.js generated vendored
View file

@ -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'

32
node_modules/buffer/package.json generated vendored
View file

@ -1,32 +1,25 @@
{
"_args": [
[
"buffer@5.4.3",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_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",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz",
"_spec": "5.5.0",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
@ -51,7 +44,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 +99,11 @@
"test/common.js",
"test/_polyfill.js",
"perf/**/*.js"
],
"globals": [
"SharedArrayBuffer"
]
},
"types": "index.d.ts",
"version": "5.4.3"
}
"version": "5.5.0"
}

View file

@ -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;
};

View file

@ -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}));

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
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.

View file

@ -0,0 +1,76 @@
{
"_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",
"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
}
}

View file

@ -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`<br>
Default: `utf8`
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
##### maxBuffer
Type: `number`<br>
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)

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"lowercase-keys@1.0.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "lowercase-keys@1.0.0",
"_id": "lowercase-keys@1.0.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz",
"_spec": "1.0.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -67,4 +60,4 @@
"test": "node test.js"
},
"version": "1.0.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"cacheable-request@2.1.4",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "cacheable-request@2.1.4",
"_id": "cacheable-request@2.1.4",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz",
"_spec": "2.1.4",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Luke Childs",
"email": "lukechilds123@gmail.com",
@ -86,4 +79,4 @@
"xo": {
"extends": "xo-lukechilds"
}
}
}

37
node_modules/caw/index.js generated vendored
View file

@ -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));
};

84
node_modules/caw/package.json generated vendored
View file

@ -1,84 +0,0 @@
{
"_args": [
[
"caw@2.0.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_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": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"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
}
}
}

51
node_modules/caw/readme.md generated vendored
View file

@ -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`<br>
Default: `http`
Endpoint protocol.
## License
MIT © [Kevin Mårtensson](https://github.com/kevva)

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"clone-response@1.0.2",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "clone-response@1.0.2",
"_id": "clone-response@1.0.2",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
"_spec": "1.0.2",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Luke Childs",
"email": "lukechilds123@gmail.com",
@ -73,4 +66,4 @@
"xo": {
"extends": "xo-lukechilds"
}
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"commander@2.8.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "commander@2.8.1",
"_id": "commander@2.8.1",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
"_spec": "2.8.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
@ -65,4 +58,4 @@
"test": "make test"
},
"version": "2.8.1"
}
}

22
node_modules/config-chain/LICENCE generated vendored
View file

@ -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.

282
node_modules/config-chain/index.js generated vendored
View file

@ -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)
}

View file

@ -1,65 +0,0 @@
{
"_args": [
[
"config-chain@1.1.12",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_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": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"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"
}

View file

@ -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.
<br/>
## 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.

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"safe-buffer@5.1.2",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "safe-buffer@5.1.2",
"_id": "safe-buffer@5.1.2",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"_spec": "5.1.2",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
@ -62,4 +55,4 @@
},
"types": "index.d.ts",
"version": "5.1.2"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"content-disposition@0.5.3",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "content-disposition@0.5.3",
"_id": "content-disposition@0.5.3",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"_spec": "0.5.3",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
@ -79,4 +72,4 @@
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
},
"version": "0.5.3"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"core-util-is@1.0.2",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "core-util-is@1.0.2",
"_id": "core-util-is@1.0.2",
"_inBundle": false,
@ -27,7 +21,6 @@
],
"_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"_spec": "1.0.2",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
@ -63,4 +56,4 @@
"test": "tap test.js"
},
"version": "1.0.2"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"decode-uri-component@0.2.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "decode-uri-component@0.2.0",
"_id": "decode-uri-component@0.2.0",
"_inBundle": false,
@ -27,7 +21,6 @@
],
"_resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
"_spec": "0.2.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sam Verschueren",
"email": "sam.verschueren@gmail.com",
@ -70,4 +63,4 @@
"test": "xo && nyc ava"
},
"version": "0.2.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"decompress-response@3.3.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "decompress-response@3.3.0",
"_id": "decompress-response@3.3.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
"_spec": "3.3.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": {
"url": "https://github.com/sindresorhus/decompress-response/issues"
},
@ -85,4 +78,4 @@
"test": "xo && ava"
},
"version": "3.3.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"file-type@5.2.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "file-type@5.2.0",
"_id": "file-type@5.2.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
"_spec": "5.2.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -141,4 +134,4 @@
"test": "xo && ava"
},
"version": "5.2.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"decompress-tar@4.1.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "decompress-tar@4.1.1",
"_id": "decompress-tar@4.1.1",
"_inBundle": false,
@ -28,7 +22,6 @@
],
"_resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz",
"_spec": "4.1.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -72,4 +65,4 @@
"test": "xo && ava"
},
"version": "4.1.1"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"file-type@6.2.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "file-type@6.2.0",
"_id": "file-type@6.2.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz",
"_spec": "6.2.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -142,4 +135,4 @@
"test": "xo && ava"
},
"version": "6.2.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"decompress-tarbz2@4.1.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "decompress-tarbz2@4.1.1",
"_id": "decompress-tarbz2@4.1.1",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz",
"_spec": "4.1.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -74,4 +67,4 @@
"test": "xo && ava"
},
"version": "4.1.1"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"file-type@5.2.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "file-type@5.2.0",
"_id": "file-type@5.2.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
"_spec": "5.2.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -141,4 +134,4 @@
"test": "xo && ava"
},
"version": "5.2.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"decompress-targz@4.1.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "decompress-targz@4.1.1",
"_id": "decompress-targz@4.1.1",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz",
"_spec": "4.1.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -71,4 +64,4 @@
"test": "xo && ava"
},
"version": "4.1.1"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"file-type@3.9.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "file-type@3.9.0",
"_id": "file-type@3.9.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
"_spec": "3.9.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -135,4 +128,4 @@
"test": "xo && ava"
},
"version": "3.9.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"get-stream@2.3.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "get-stream@2.3.1",
"_id": "get-stream@2.3.1",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
"_spec": "2.3.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -81,4 +74,4 @@
"test": "xo && ava"
},
"version": "2.3.1"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"pify@2.3.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "pify@2.3.0",
"_id": "pify@2.3.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"_spec": "2.3.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -80,4 +73,4 @@
"test": "xo && ava && npm run optimization-test"
},
"version": "2.3.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"decompress-unzip@4.0.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "decompress-unzip@4.0.1",
"_id": "decompress-unzip@4.0.1",
"_inBundle": false,
@ -29,7 +23,6 @@
],
"_resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz",
"_spec": "4.0.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -76,4 +69,4 @@
"xo": {
"esnext": true
}
}
}

59
node_modules/decompress/index.js generated vendored
View file

@ -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);

22
node_modules/decompress/license generated vendored
View file

@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com>
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (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.

85
node_modules/decompress/node_modules/make-dir/index.js generated vendored Normal file
View file

@ -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));
};

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
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:

View file

@ -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;
};

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
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:

View file

@ -0,0 +1,79 @@
{
"_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",
"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"
}

View file

@ -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`<br>
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[]`<br>
Default: `[/.+(Sync|Stream)$/]`
Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default.
##### excludeMain
Type: `boolean`<br>
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`<br>
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)

View file

@ -0,0 +1,82 @@
{
"_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",
"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"
}

116
node_modules/decompress/node_modules/make-dir/readme.md generated vendored Normal file
View file

@ -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`<br>
Default: `0o777 & (~process.umask())`
Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
##### fs
Type: `Object`<br>
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)

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"pify@2.3.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "pify@2.3.0",
"_id": "pify@2.3.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"_spec": "2.3.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -80,4 +73,4 @@
"test": "xo && ava && npm run optimization-test"
},
"version": "2.3.0"
}
}

39
node_modules/decompress/package.json generated vendored
View file

@ -1,37 +1,35 @@
{
"_args": [
[
"decompress@4.2.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_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",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz",
"_spec": "4.2.1",
"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 +46,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 +80,10 @@
"scripts": {
"test": "xo && ava"
},
"version": "4.2.0"
}
"version": "4.2.1",
"xo": {
"rules": {
"promise/prefer-await-to-then": "off"
}
}
}

4
node_modules/decompress/readme.md generated vendored
View file

@ -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`

26
node_modules/download/index.js generated vendored
View file

@ -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;

50
node_modules/download/package.json generated vendored
View file

@ -1,32 +1,25 @@
{
"_args": [
[
"download@7.1.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_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",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/download/-/download-8.0.0.tgz",
"_spec": "8.0.0",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -37,30 +30,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 +74,5 @@
"scripts": {
"test": "xo && ava"
},
"version": "7.1.0"
}
"version": "8.0.0"
}

39
node_modules/download/readme.md generated vendored
View file

@ -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<Buffer>` 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)

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"duplexer3@0.1.4",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "duplexer3@0.1.4",
"_id": "duplexer3@0.1.4",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
"_spec": "0.1.4",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Conrad Pankoff",
"email": "deoxxa@fknsrs.biz",
@ -64,4 +57,4 @@
"test": "mocha -R tap"
},
"version": "0.1.4"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"end-of-stream@1.4.1",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "end-of-stream@1.4.1",
"_id": "end-of-stream@1.4.1",
"_inBundle": false,
@ -27,7 +21,6 @@
],
"_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
"_spec": "1.4.1",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Mathias Buus",
"email": "mathiasbuus@gmail.com"
@ -63,4 +56,4 @@
"test": "node test.js"
},
"version": "1.4.1"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"escape-string-regexp@1.0.5",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "escape-string-regexp@1.0.5",
"_id": "escape-string-regexp@1.0.5",
"_inBundle": false,
@ -30,7 +24,6 @@
],
"_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"_spec": "1.0.5",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -85,4 +78,4 @@
"test": "xo && ava"
},
"version": "1.0.5"
}
}

9
node_modules/ext-list/package.json generated vendored
View file

@ -1,10 +1,4 @@
{
"_args": [
[
"ext-list@2.2.2",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "ext-list@2.2.2",
"_id": "ext-list@2.2.2",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz",
"_spec": "2.2.2",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -64,4 +57,4 @@
"test": "xo && ava"
},
"version": "2.2.2"
}
}

9
node_modules/ext-name/package.json generated vendored
View file

@ -1,10 +1,4 @@
{
"_args": [
[
"ext-name@5.0.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "ext-name@5.0.0",
"_id": "ext-name@5.0.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz",
"_spec": "5.0.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
@ -66,4 +59,4 @@
"test": "xo && ava"
},
"version": "5.0.0"
}
}

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"fd-slicer@1.1.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "fd-slicer@1.1.0",
"_id": "fd-slicer@1.1.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
"_spec": "1.1.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Andrew Kelley",
"email": "superjoe30@gmail.com"
@ -65,4 +58,4 @@
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --timeout 10000 --reporter spec --check-leaks test/test.js"
},
"version": "1.1.0"
}
}

205
node_modules/file-type/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,205 @@
/// <reference types="node"/>
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<fileType.ReadableStreamWithFileType>;
};
export = fileType;

446
node_modules/file-type/index.js generated vendored
View file

@ -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));
}
});
});

69
node_modules/file-type/package.json generated vendored
View file

@ -1,32 +1,25 @@
{
"_args": [
[
"file-type@8.1.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_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==",
"_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",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"_resolved": "https://registry.npmjs.org/file-type/-/file-type-11.1.0.tgz",
"_spec": "11.1.0",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -35,17 +28,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 +72,10 @@
"webp",
"flif",
"cr2",
"orf",
"arw",
"dng",
"nef",
"tif",
"bmp",
"jxr",
@ -86,7 +88,6 @@
"7z",
"dmg",
"mp4",
"m4v",
"mid",
"mkv",
"webm",
@ -143,7 +144,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 +171,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"
}

107
node_modules/file-type/readme.md generated vendored
View file

@ -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

58
node_modules/file-type/util.js generated vendored Normal file
View file

@ -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;

View file

@ -1,10 +1,4 @@
{
"_args": [
[
"filename-reserved-regex@2.0.0",
"X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
]
],
"_from": "filename-reserved-regex@2.0.0",
"_id": "filename-reserved-regex@2.0.0",
"_inBundle": false,
@ -26,7 +20,6 @@
],
"_resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -68,4 +61,4 @@
"xo": {
"esnext": true
}
}
}

30
node_modules/filenamify/index.d.ts generated vendored Normal file
View file

@ -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;

13
node_modules/filenamify/index.js generated vendored
View file

@ -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;

Some files were not shown because too many files have changed in this diff Show more