mirror of
https://github.com/actions/labeler.git
synced 2025-12-12 12:37:48 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5c9bd0f54 | ||
|
|
04aa5dbc72 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
describe("TODO - Add a test suite", () => {
|
describe('TODO - Add a test suite', () => {
|
||||||
it("TODO - Add a test", async () => {});
|
it('TODO - Add a test', async () => {
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: 'Pull Request Triager'
|
name: 'Pull Request Labeler'
|
||||||
description: 'Label pull requests by files altered'
|
description: 'Label pull requests by files altered'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
42
lib/main.js
42
lib/main.js
@@ -1,19 +1,32 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
if (k2 === undefined) k2 = k;
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
}) : (function(o, m, k, k2) {
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
if (k2 === undefined) k2 = k;
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
o[k2] = m[k];
|
||||||
});
|
}));
|
||||||
};
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
result["default"] = mod;
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
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());
|
||||||
|
});
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const github = __importStar(require("@actions/github"));
|
const github = __importStar(require("@actions/github"));
|
||||||
@@ -86,8 +99,15 @@ function fetchContent(client, repoPath) {
|
|||||||
const response = yield client.repos.getContents({
|
const response = yield client.repos.getContents({
|
||||||
owner: github.context.repo.owner,
|
owner: github.context.repo.owner,
|
||||||
repo: github.context.repo.repo,
|
repo: github.context.repo.repo,
|
||||||
path: repoPath
|
path: repoPath,
|
||||||
|
ref: github.context.sha
|
||||||
});
|
});
|
||||||
|
if (!('content' in response.data)) {
|
||||||
|
throw new Error(`The path '${repoPath}' is not a file`);
|
||||||
|
}
|
||||||
|
if (!response.data.content) {
|
||||||
|
throw new Error(`The file '${repoPath}' has no content`);
|
||||||
|
}
|
||||||
return Buffer.from(response.data.content, 'base64').toString();
|
return Buffer.from(response.data.content, 'base64').toString();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
1
node_modules/.bin/acorn
generated
vendored
Symbolic link
1
node_modules/.bin/acorn
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../acorn/bin/acorn
|
||||||
1
node_modules/.bin/atob
generated
vendored
Symbolic link
1
node_modules/.bin/atob
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../atob/bin/atob.js
|
||||||
1
node_modules/.bin/escodegen
generated
vendored
Symbolic link
1
node_modules/.bin/escodegen
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../escodegen/bin/escodegen.js
|
||||||
1
node_modules/.bin/esgenerate
generated
vendored
Symbolic link
1
node_modules/.bin/esgenerate
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../escodegen/bin/esgenerate.js
|
||||||
1
node_modules/.bin/handlebars
generated
vendored
Symbolic link
1
node_modules/.bin/handlebars
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../handlebars/bin/handlebars
|
||||||
1
node_modules/.bin/husky-upgrade
generated
vendored
Symbolic link
1
node_modules/.bin/husky-upgrade
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../husky/lib/upgrader/bin.js
|
||||||
1
node_modules/.bin/import-local-fixture
generated
vendored
Symbolic link
1
node_modules/.bin/import-local-fixture
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../import-local/fixtures/cli.js
|
||||||
1
node_modules/.bin/is-ci
generated
vendored
Symbolic link
1
node_modules/.bin/is-ci
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../is-ci/bin.js
|
||||||
1
node_modules/.bin/jest
generated
vendored
Symbolic link
1
node_modules/.bin/jest
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../jest/bin/jest.js
|
||||||
1
node_modules/.bin/jest-runtime
generated
vendored
Symbolic link
1
node_modules/.bin/jest-runtime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../jest-runtime/bin/jest-runtime.js
|
||||||
1
node_modules/.bin/jsesc
generated
vendored
Symbolic link
1
node_modules/.bin/jsesc
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../jsesc/bin/jsesc
|
||||||
1
node_modules/.bin/json5
generated
vendored
Symbolic link
1
node_modules/.bin/json5
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../json5/lib/cli.js
|
||||||
1
node_modules/.bin/loose-envify
generated
vendored
Symbolic link
1
node_modules/.bin/loose-envify
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../loose-envify/cli.js
|
||||||
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../mkdirp/bin/cmd.js
|
||||||
1
node_modules/.bin/parser
generated
vendored
Symbolic link
1
node_modules/.bin/parser
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../@babel/parser/bin/babel-parser.js
|
||||||
1
node_modules/.bin/prettier
generated
vendored
Symbolic link
1
node_modules/.bin/prettier
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../prettier/bin-prettier.js
|
||||||
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../rimraf/bin.js
|
||||||
1
node_modules/.bin/run-node
generated
vendored
Symbolic link
1
node_modules/.bin/run-node
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../run-node/run-node
|
||||||
1
node_modules/.bin/sane
generated
vendored
Symbolic link
1
node_modules/.bin/sane
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sane/src/cli.js
|
||||||
1
node_modules/.bin/sshpk-conv
generated
vendored
Symbolic link
1
node_modules/.bin/sshpk-conv
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sshpk/bin/sshpk-conv
|
||||||
1
node_modules/.bin/sshpk-sign
generated
vendored
Symbolic link
1
node_modules/.bin/sshpk-sign
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sshpk/bin/sshpk-sign
|
||||||
1
node_modules/.bin/sshpk-verify
generated
vendored
Symbolic link
1
node_modules/.bin/sshpk-verify
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sshpk/bin/sshpk-verify
|
||||||
1
node_modules/.bin/ts-jest
generated
vendored
Symbolic link
1
node_modules/.bin/ts-jest
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../ts-jest/cli.js
|
||||||
1
node_modules/.bin/tsc
generated
vendored
Symbolic link
1
node_modules/.bin/tsc
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../typescript/bin/tsc
|
||||||
1
node_modules/.bin/tsserver
generated
vendored
Symbolic link
1
node_modules/.bin/tsserver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../typescript/bin/tsserver
|
||||||
1
node_modules/.bin/uglifyjs
generated
vendored
Symbolic link
1
node_modules/.bin/uglifyjs
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../uglify-js/bin/uglifyjs
|
||||||
15
node_modules/.bin/uuid
generated
vendored
15
node_modules/.bin/uuid
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../uuid/bin/uuid" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
||||||
1
node_modules/.bin/uuid
generated
vendored
Symbolic link
1
node_modules/.bin/uuid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../uuid/bin/uuid
|
||||||
7
node_modules/.bin/uuid.cmd
generated
vendored
7
node_modules/.bin/uuid.cmd
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\uuid\bin\uuid" %*
|
|
||||||
)
|
|
||||||
1
node_modules/.bin/watch
generated
vendored
Symbolic link
1
node_modules/.bin/watch
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../@cnakazawa/watch/cli.js
|
||||||
7
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
7
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
||||||
76
node_modules/@actions/core/README.md
generated
vendored
76
node_modules/@actions/core/README.md
generated
vendored
@@ -4,4 +4,78 @@
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
See [src/core.ts](src/core.ts).
|
#### Inputs/Outputs
|
||||||
|
|
||||||
|
You can use this library to get inputs or set outputs:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
|
||||||
|
core.setOutput('outputKey', 'outputVal');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exporting variables/secrets
|
||||||
|
|
||||||
|
You can also export variables and secrets for future steps. Variables get set in the environment automatically, while secrets must be scoped into the environment from a workflow using `{{ secret.FOO }}`. Secrets will also be masked from the logs:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
|
||||||
|
core.exportVariable('envVar', 'Val');
|
||||||
|
core.exportSecret('secretVar', variableWithSecretValue);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### PATH Manipulation
|
||||||
|
|
||||||
|
You can explicitly add items to the path for all remaining steps in a workflow:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
core.addPath('pathToTool');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exit codes
|
||||||
|
|
||||||
|
You should use this library to set the failing exit code for your action:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Do stuff
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// setFailed logs the message and sets a failing exit code
|
||||||
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Logging
|
||||||
|
|
||||||
|
Finally, this library provides some utilities for logging:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const myInput = core.getInput('input');
|
||||||
|
try {
|
||||||
|
core.debug('Inside try block');
|
||||||
|
|
||||||
|
if (!myInput) {
|
||||||
|
core.warning('myInput wasnt set');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.error('Error ${err}, action may still succeed though');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
10
node_modules/@actions/core/lib/core.d.ts
generated
vendored
10
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -16,11 +16,7 @@ export declare enum ExitCode {
|
|||||||
/**
|
/**
|
||||||
* A code indicating that the action was a failure
|
* A code indicating that the action was a failure
|
||||||
*/
|
*/
|
||||||
Failure = 1,
|
Failure = 1
|
||||||
/**
|
|
||||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
|
||||||
*/
|
|
||||||
Neutral = 78
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* sets env variable for this action and future actions in the job
|
* sets env variable for this action and future actions in the job
|
||||||
@@ -54,10 +50,6 @@ export declare function getInput(name: string, options?: InputOptions): string;
|
|||||||
* @param value value to store
|
* @param value value to store
|
||||||
*/
|
*/
|
||||||
export declare function setOutput(name: string, value: string): void;
|
export declare function setOutput(name: string, value: string): void;
|
||||||
/**
|
|
||||||
* Sets the action status to neutral
|
|
||||||
*/
|
|
||||||
export declare function setNeutral(): void;
|
|
||||||
/**
|
/**
|
||||||
* Sets the action status to failed.
|
* Sets the action status to failed.
|
||||||
* When the action exits it will be with an exit code of 1
|
* When the action exits it will be with an exit code of 1
|
||||||
|
|||||||
11
node_modules/@actions/core/lib/core.js
generated
vendored
11
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -15,10 +15,6 @@ var ExitCode;
|
|||||||
* A code indicating that the action was a failure
|
* A code indicating that the action was a failure
|
||||||
*/
|
*/
|
||||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||||
/**
|
|
||||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Neutral"] = 78] = "Neutral";
|
|
||||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
@@ -80,13 +76,6 @@ exports.setOutput = setOutput;
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Results
|
// Results
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
|
||||||
* Sets the action status to neutral
|
|
||||||
*/
|
|
||||||
function setNeutral() {
|
|
||||||
process.exitCode = ExitCode.Neutral;
|
|
||||||
}
|
|
||||||
exports.setNeutral = setNeutral;
|
|
||||||
/**
|
/**
|
||||||
* Sets the action status to failed.
|
* Sets the action status to failed.
|
||||||
* When the action exits it will be with an exit code of 1
|
* When the action exits it will be with an exit code of 1
|
||||||
|
|||||||
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,8CAAY,CAAA;AACd,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB;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;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACzB,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAHD,oCAGC;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,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACpE,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;;GAEG;AACH,SAAgB,UAAU;IACxB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;AACrC,CAAC;AAFD,gCAEC;AAED;;;;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"}
|
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,6BAA4B;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;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACzB,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAHD,oCAGC;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,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACpE,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"}
|
||||||
39
node_modules/@actions/core/package.json
generated
vendored
39
node_modules/@actions/core/package.json
generated
vendored
@@ -1,34 +1,36 @@
|
|||||||
{
|
{
|
||||||
"_from": "file:toolkit\\actions-core-0.0.0.tgz",
|
"_args": [
|
||||||
"_id": "@actions/core@0.0.0",
|
[
|
||||||
|
"@actions/core@1.0.0",
|
||||||
|
"C:\\Users\\damccorm\\Documents\\labeler"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@actions/core@1.0.0",
|
||||||
|
"_id": "@actions/core@1.0.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-P+mC79gXC2yvyU0+RDctxKUI1Q3tNruB+aSmFI47j2H0DylxtDEgycW9WXwt/zCY62lfwfvBoGKpuJRvFHDqpw==",
|
"_integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==",
|
||||||
"_location": "/@actions/core",
|
"_location": "/@actions/core",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "file",
|
"type": "version",
|
||||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
"registry": true,
|
||||||
"raw": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
"raw": "@actions/core@1.0.0",
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"escapedName": "@actions%2fcore",
|
"escapedName": "@actions%2fcore",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
|
"rawSpec": "1.0.0",
|
||||||
"saveSpec": "file:toolkit\\actions-core-0.0.0.tgz",
|
"saveSpec": null,
|
||||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-core-0.0.0.tgz"
|
"fetchSpec": "1.0.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/",
|
"/"
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
],
|
||||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-core-0.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz",
|
||||||
"_shasum": "3f3d82f209fd62dd9c01f180c963596f6c479f29",
|
"_spec": "1.0.0",
|
||||||
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
"_where": "C:\\Users\\damccorm\\Documents\\labeler",
|
||||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions core lib",
|
"description": "Actions core lib",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.0.2"
|
"@types/node": "^12.0.2"
|
||||||
@@ -40,6 +42,7 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
|
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"core",
|
"core",
|
||||||
@@ -59,5 +62,5 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "0.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
7
node_modules/@actions/exec/README.md
generated
vendored
7
node_modules/@actions/exec/README.md
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
# `@actions/exec`
|
|
||||||
|
|
||||||
> Functions necessary for running tools on the command line
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
See [src/exec.ts](src/exec.ts).
|
|
||||||
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
@@ -1,12 +0,0 @@
|
|||||||
import * as im from './interfaces';
|
|
||||||
/**
|
|
||||||
* Exec a command.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
|
||||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
|
||||||
36
node_modules/@actions/exec/lib/exec.js
generated
vendored
36
node_modules/@actions/exec/lib/exec.js
generated
vendored
@@ -1,36 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const tr = require("./toolrunner");
|
|
||||||
/**
|
|
||||||
* Exec a command.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
|
||||||
function exec(commandLine, args, options) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const commandArgs = tr.argStringToArray(commandLine);
|
|
||||||
if (commandArgs.length === 0) {
|
|
||||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
|
||||||
}
|
|
||||||
// Path to tool to execute should be first arg
|
|
||||||
const toolPath = commandArgs[0];
|
|
||||||
args = commandArgs.slice(1).concat(args || []);
|
|
||||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
|
||||||
return runner.exec();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.exec = exec;
|
|
||||||
//# sourceMappingURL=exec.js.map
|
|
||||||
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
|
||||||
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as stream from 'stream';
|
|
||||||
/**
|
|
||||||
* Interface for exec options
|
|
||||||
*/
|
|
||||||
export interface ExecOptions {
|
|
||||||
/** optional working directory. defaults to current */
|
|
||||||
cwd?: string;
|
|
||||||
/** optional envvar dictionary. defaults to current process's env */
|
|
||||||
env?: {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
/** optional. defaults to false */
|
|
||||||
silent?: boolean;
|
|
||||||
/** optional out stream to use. Defaults to process.stdout */
|
|
||||||
outStream?: stream.Writable;
|
|
||||||
/** optional err stream to use. Defaults to process.stderr */
|
|
||||||
errStream?: stream.Writable;
|
|
||||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
|
||||||
windowsVerbatimArguments?: boolean;
|
|
||||||
/** optional. whether to fail if output to stderr. defaults to false */
|
|
||||||
failOnStdErr?: boolean;
|
|
||||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
|
||||||
ignoreReturnCode?: boolean;
|
|
||||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
|
||||||
delay?: number;
|
|
||||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
|
||||||
listeners?: {
|
|
||||||
stdout?: (data: Buffer) => void;
|
|
||||||
stderr?: (data: Buffer) => void;
|
|
||||||
stdline?: (data: string) => void;
|
|
||||||
errline?: (data: string) => void;
|
|
||||||
debug?: (data: string) => void;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=interfaces.js.map
|
|
||||||
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
|
||||||
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
@@ -1,37 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as events from 'events';
|
|
||||||
import * as im from './interfaces';
|
|
||||||
export declare class ToolRunner extends events.EventEmitter {
|
|
||||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
|
||||||
private toolPath;
|
|
||||||
private args;
|
|
||||||
private options;
|
|
||||||
private _debug;
|
|
||||||
private _getCommandString;
|
|
||||||
private _processLineBuffer;
|
|
||||||
private _getSpawnFileName;
|
|
||||||
private _getSpawnArgs;
|
|
||||||
private _endsWith;
|
|
||||||
private _isCmdFile;
|
|
||||||
private _windowsQuoteCmdArg;
|
|
||||||
private _uvQuoteCmdArg;
|
|
||||||
private _cloneExecOptions;
|
|
||||||
private _getSpawnOptions;
|
|
||||||
/**
|
|
||||||
* Exec a tool.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param tool path to tool to exec
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns number
|
|
||||||
*/
|
|
||||||
exec(): Promise<number>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Convert an arg string to an array of args. Handles escaping
|
|
||||||
*
|
|
||||||
* @param argString string of arguments
|
|
||||||
* @returns string[] array of arguments
|
|
||||||
*/
|
|
||||||
export declare function argStringToArray(argString: string): string[];
|
|
||||||
573
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
573
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
@@ -1,573 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const os = require("os");
|
|
||||||
const events = require("events");
|
|
||||||
const child = require("child_process");
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
/*
|
|
||||||
* Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
|
|
||||||
*/
|
|
||||||
class ToolRunner extends events.EventEmitter {
|
|
||||||
constructor(toolPath, args, options) {
|
|
||||||
super();
|
|
||||||
if (!toolPath) {
|
|
||||||
throw new Error("Parameter 'toolPath' cannot be null or empty.");
|
|
||||||
}
|
|
||||||
this.toolPath = toolPath;
|
|
||||||
this.args = args || [];
|
|
||||||
this.options = options || {};
|
|
||||||
}
|
|
||||||
_debug(message) {
|
|
||||||
if (this.options.listeners && this.options.listeners.debug) {
|
|
||||||
this.options.listeners.debug(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_getCommandString(options, noPrefix) {
|
|
||||||
const toolPath = this._getSpawnFileName();
|
|
||||||
const args = this._getSpawnArgs(options);
|
|
||||||
let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
// Windows + cmd file
|
|
||||||
if (this._isCmdFile()) {
|
|
||||||
cmd += toolPath;
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${a}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Windows + verbatim
|
|
||||||
else if (options.windowsVerbatimArguments) {
|
|
||||||
cmd += `"${toolPath}"`;
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${a}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Windows (regular)
|
|
||||||
else {
|
|
||||||
cmd += this._windowsQuoteCmdArg(toolPath);
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${this._windowsQuoteCmdArg(a)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// OSX/Linux - this can likely be improved with some form of quoting.
|
|
||||||
// creating processes on Unix is fundamentally different than Windows.
|
|
||||||
// on Unix, execvp() takes an arg array.
|
|
||||||
cmd += toolPath;
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${a}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cmd;
|
|
||||||
}
|
|
||||||
_processLineBuffer(data, strBuffer, onLine) {
|
|
||||||
try {
|
|
||||||
let s = strBuffer + data.toString();
|
|
||||||
let n = s.indexOf(os.EOL);
|
|
||||||
while (n > -1) {
|
|
||||||
const line = s.substring(0, n);
|
|
||||||
onLine(line);
|
|
||||||
// the rest of the string ...
|
|
||||||
s = s.substring(n + os.EOL.length);
|
|
||||||
n = s.indexOf(os.EOL);
|
|
||||||
}
|
|
||||||
strBuffer = s;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// streaming lines to console is best effort. Don't fail a build.
|
|
||||||
this._debug(`error processing line. Failed with error ${err}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_getSpawnFileName() {
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
if (this._isCmdFile()) {
|
|
||||||
return process.env['COMSPEC'] || 'cmd.exe';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.toolPath;
|
|
||||||
}
|
|
||||||
_getSpawnArgs(options) {
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
if (this._isCmdFile()) {
|
|
||||||
let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
|
|
||||||
for (const a of this.args) {
|
|
||||||
argline += ' ';
|
|
||||||
argline += options.windowsVerbatimArguments
|
|
||||||
? a
|
|
||||||
: this._windowsQuoteCmdArg(a);
|
|
||||||
}
|
|
||||||
argline += '"';
|
|
||||||
return [argline];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.args;
|
|
||||||
}
|
|
||||||
_endsWith(str, end) {
|
|
||||||
return str.endsWith(end);
|
|
||||||
}
|
|
||||||
_isCmdFile() {
|
|
||||||
const upperToolPath = this.toolPath.toUpperCase();
|
|
||||||
return (this._endsWith(upperToolPath, '.CMD') ||
|
|
||||||
this._endsWith(upperToolPath, '.BAT'));
|
|
||||||
}
|
|
||||||
_windowsQuoteCmdArg(arg) {
|
|
||||||
// for .exe, apply the normal quoting rules that libuv applies
|
|
||||||
if (!this._isCmdFile()) {
|
|
||||||
return this._uvQuoteCmdArg(arg);
|
|
||||||
}
|
|
||||||
// otherwise apply quoting rules specific to the cmd.exe command line parser.
|
|
||||||
// the libuv rules are generic and are not designed specifically for cmd.exe
|
|
||||||
// command line parser.
|
|
||||||
//
|
|
||||||
// for a detailed description of the cmd.exe command line parser, refer to
|
|
||||||
// http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
|
|
||||||
// need quotes for empty arg
|
|
||||||
if (!arg) {
|
|
||||||
return '""';
|
|
||||||
}
|
|
||||||
// determine whether the arg needs to be quoted
|
|
||||||
const cmdSpecialChars = [
|
|
||||||
' ',
|
|
||||||
'\t',
|
|
||||||
'&',
|
|
||||||
'(',
|
|
||||||
')',
|
|
||||||
'[',
|
|
||||||
']',
|
|
||||||
'{',
|
|
||||||
'}',
|
|
||||||
'^',
|
|
||||||
'=',
|
|
||||||
';',
|
|
||||||
'!',
|
|
||||||
"'",
|
|
||||||
'+',
|
|
||||||
',',
|
|
||||||
'`',
|
|
||||||
'~',
|
|
||||||
'|',
|
|
||||||
'<',
|
|
||||||
'>',
|
|
||||||
'"'
|
|
||||||
];
|
|
||||||
let needsQuotes = false;
|
|
||||||
for (const char of arg) {
|
|
||||||
if (cmdSpecialChars.some(x => x === char)) {
|
|
||||||
needsQuotes = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// short-circuit if quotes not needed
|
|
||||||
if (!needsQuotes) {
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
// the following quoting rules are very similar to the rules that by libuv applies.
|
|
||||||
//
|
|
||||||
// 1) wrap the string in quotes
|
|
||||||
//
|
|
||||||
// 2) double-up quotes - i.e. " => ""
|
|
||||||
//
|
|
||||||
// this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
|
|
||||||
// doesn't work well with a cmd.exe command line.
|
|
||||||
//
|
|
||||||
// note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
|
|
||||||
// for example, the command line:
|
|
||||||
// foo.exe "myarg:""my val"""
|
|
||||||
// is parsed by a .NET console app into an arg array:
|
|
||||||
// [ "myarg:\"my val\"" ]
|
|
||||||
// which is the same end result when applying libuv quoting rules. although the actual
|
|
||||||
// command line from libuv quoting rules would look like:
|
|
||||||
// foo.exe "myarg:\"my val\""
|
|
||||||
//
|
|
||||||
// 3) double-up slashes that preceed a quote,
|
|
||||||
// e.g. hello \world => "hello \world"
|
|
||||||
// hello\"world => "hello\\""world"
|
|
||||||
// hello\\"world => "hello\\\\""world"
|
|
||||||
// hello world\ => "hello world\\"
|
|
||||||
//
|
|
||||||
// technically this is not required for a cmd.exe command line, or the batch argument parser.
|
|
||||||
// the reasons for including this as a .cmd quoting rule are:
|
|
||||||
//
|
|
||||||
// a) this is optimized for the scenario where the argument is passed from the .cmd file to an
|
|
||||||
// external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
|
|
||||||
//
|
|
||||||
// b) it's what we've been doing previously (by deferring to node default behavior) and we
|
|
||||||
// haven't heard any complaints about that aspect.
|
|
||||||
//
|
|
||||||
// note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
|
|
||||||
// escaped when used on the command line directly - even though within a .cmd file % can be escaped
|
|
||||||
// by using %%.
|
|
||||||
//
|
|
||||||
// the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
|
|
||||||
// the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
|
|
||||||
//
|
|
||||||
// one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
|
|
||||||
// often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
|
|
||||||
// variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
|
|
||||||
// to an external program.
|
|
||||||
//
|
|
||||||
// an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
|
|
||||||
// % can be escaped within a .cmd file.
|
|
||||||
let reverse = '"';
|
|
||||||
let quoteHit = true;
|
|
||||||
for (let i = arg.length; i > 0; i--) {
|
|
||||||
// walk the string in reverse
|
|
||||||
reverse += arg[i - 1];
|
|
||||||
if (quoteHit && arg[i - 1] === '\\') {
|
|
||||||
reverse += '\\'; // double the slash
|
|
||||||
}
|
|
||||||
else if (arg[i - 1] === '"') {
|
|
||||||
quoteHit = true;
|
|
||||||
reverse += '"'; // double the quote
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
quoteHit = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reverse += '"';
|
|
||||||
return reverse
|
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('');
|
|
||||||
}
|
|
||||||
_uvQuoteCmdArg(arg) {
|
|
||||||
// Tool runner wraps child_process.spawn() and needs to apply the same quoting as
|
|
||||||
// Node in certain cases where the undocumented spawn option windowsVerbatimArguments
|
|
||||||
// is used.
|
|
||||||
//
|
|
||||||
// Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
|
|
||||||
// see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
|
|
||||||
// pasting copyright notice from Node within this function:
|
|
||||||
//
|
|
||||||
// Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to
|
|
||||||
// deal in the Software without restriction, including without limitation the
|
|
||||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
||||||
// sell copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
||||||
// IN THE SOFTWARE.
|
|
||||||
if (!arg) {
|
|
||||||
// Need double quotation for empty argument
|
|
||||||
return '""';
|
|
||||||
}
|
|
||||||
if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
|
|
||||||
// No quotation needed
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
if (!arg.includes('"') && !arg.includes('\\')) {
|
|
||||||
// No embedded double quotes or backslashes, so I can just wrap
|
|
||||||
// quote marks around the whole thing.
|
|
||||||
return `"${arg}"`;
|
|
||||||
}
|
|
||||||
// Expected input/output:
|
|
||||||
// input : hello"world
|
|
||||||
// output: "hello\"world"
|
|
||||||
// input : hello""world
|
|
||||||
// output: "hello\"\"world"
|
|
||||||
// input : hello\world
|
|
||||||
// output: hello\world
|
|
||||||
// input : hello\\world
|
|
||||||
// output: hello\\world
|
|
||||||
// input : hello\"world
|
|
||||||
// output: "hello\\\"world"
|
|
||||||
// input : hello\\"world
|
|
||||||
// output: "hello\\\\\"world"
|
|
||||||
// input : hello world\
|
|
||||||
// output: "hello world\\" - note the comment in libuv actually reads "hello world\"
|
|
||||||
// but it appears the comment is wrong, it should be "hello world\\"
|
|
||||||
let reverse = '"';
|
|
||||||
let quoteHit = true;
|
|
||||||
for (let i = arg.length; i > 0; i--) {
|
|
||||||
// walk the string in reverse
|
|
||||||
reverse += arg[i - 1];
|
|
||||||
if (quoteHit && arg[i - 1] === '\\') {
|
|
||||||
reverse += '\\';
|
|
||||||
}
|
|
||||||
else if (arg[i - 1] === '"') {
|
|
||||||
quoteHit = true;
|
|
||||||
reverse += '\\';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
quoteHit = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reverse += '"';
|
|
||||||
return reverse
|
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('');
|
|
||||||
}
|
|
||||||
_cloneExecOptions(options) {
|
|
||||||
options = options || {};
|
|
||||||
const result = {
|
|
||||||
cwd: options.cwd || process.cwd(),
|
|
||||||
env: options.env || process.env,
|
|
||||||
silent: options.silent || false,
|
|
||||||
windowsVerbatimArguments: options.windowsVerbatimArguments || false,
|
|
||||||
failOnStdErr: options.failOnStdErr || false,
|
|
||||||
ignoreReturnCode: options.ignoreReturnCode || false,
|
|
||||||
delay: options.delay || 10000
|
|
||||||
};
|
|
||||||
result.outStream = options.outStream || process.stdout;
|
|
||||||
result.errStream = options.errStream || process.stderr;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
_getSpawnOptions(options, toolPath) {
|
|
||||||
options = options || {};
|
|
||||||
const result = {};
|
|
||||||
result.cwd = options.cwd;
|
|
||||||
result.env = options.env;
|
|
||||||
result['windowsVerbatimArguments'] =
|
|
||||||
options.windowsVerbatimArguments || this._isCmdFile();
|
|
||||||
if (options.windowsVerbatimArguments) {
|
|
||||||
result.argv0 = `"${toolPath}"`;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Exec a tool.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param tool path to tool to exec
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns number
|
|
||||||
*/
|
|
||||||
exec() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this._debug(`exec tool: ${this.toolPath}`);
|
|
||||||
this._debug('arguments:');
|
|
||||||
for (const arg of this.args) {
|
|
||||||
this._debug(` ${arg}`);
|
|
||||||
}
|
|
||||||
const optionsNonNull = this._cloneExecOptions(this.options);
|
|
||||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
||||||
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
|
|
||||||
}
|
|
||||||
const state = new ExecState(optionsNonNull, this.toolPath);
|
|
||||||
state.on('debug', (message) => {
|
|
||||||
this._debug(message);
|
|
||||||
});
|
|
||||||
const fileName = this._getSpawnFileName();
|
|
||||||
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
|
||||||
const stdbuffer = '';
|
|
||||||
if (cp.stdout) {
|
|
||||||
cp.stdout.on('data', (data) => {
|
|
||||||
if (this.options.listeners && this.options.listeners.stdout) {
|
|
||||||
this.options.listeners.stdout(data);
|
|
||||||
}
|
|
||||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
||||||
optionsNonNull.outStream.write(data);
|
|
||||||
}
|
|
||||||
this._processLineBuffer(data, stdbuffer, (line) => {
|
|
||||||
if (this.options.listeners && this.options.listeners.stdline) {
|
|
||||||
this.options.listeners.stdline(line);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const errbuffer = '';
|
|
||||||
if (cp.stderr) {
|
|
||||||
cp.stderr.on('data', (data) => {
|
|
||||||
state.processStderr = true;
|
|
||||||
if (this.options.listeners && this.options.listeners.stderr) {
|
|
||||||
this.options.listeners.stderr(data);
|
|
||||||
}
|
|
||||||
if (!optionsNonNull.silent &&
|
|
||||||
optionsNonNull.errStream &&
|
|
||||||
optionsNonNull.outStream) {
|
|
||||||
const s = optionsNonNull.failOnStdErr
|
|
||||||
? optionsNonNull.errStream
|
|
||||||
: optionsNonNull.outStream;
|
|
||||||
s.write(data);
|
|
||||||
}
|
|
||||||
this._processLineBuffer(data, errbuffer, (line) => {
|
|
||||||
if (this.options.listeners && this.options.listeners.errline) {
|
|
||||||
this.options.listeners.errline(line);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
cp.on('error', (err) => {
|
|
||||||
state.processError = err.message;
|
|
||||||
state.processExited = true;
|
|
||||||
state.processClosed = true;
|
|
||||||
state.CheckComplete();
|
|
||||||
});
|
|
||||||
cp.on('exit', (code) => {
|
|
||||||
state.processExitCode = code;
|
|
||||||
state.processExited = true;
|
|
||||||
this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
|
|
||||||
state.CheckComplete();
|
|
||||||
});
|
|
||||||
cp.on('close', (code) => {
|
|
||||||
state.processExitCode = code;
|
|
||||||
state.processExited = true;
|
|
||||||
state.processClosed = true;
|
|
||||||
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
|
|
||||||
state.CheckComplete();
|
|
||||||
});
|
|
||||||
state.on('done', (error, exitCode) => {
|
|
||||||
if (stdbuffer.length > 0) {
|
|
||||||
this.emit('stdline', stdbuffer);
|
|
||||||
}
|
|
||||||
if (errbuffer.length > 0) {
|
|
||||||
this.emit('errline', errbuffer);
|
|
||||||
}
|
|
||||||
cp.removeAllListeners();
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(exitCode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.ToolRunner = ToolRunner;
|
|
||||||
/**
|
|
||||||
* Convert an arg string to an array of args. Handles escaping
|
|
||||||
*
|
|
||||||
* @param argString string of arguments
|
|
||||||
* @returns string[] array of arguments
|
|
||||||
*/
|
|
||||||
function argStringToArray(argString) {
|
|
||||||
const args = [];
|
|
||||||
let inQuotes = false;
|
|
||||||
let escaped = false;
|
|
||||||
let arg = '';
|
|
||||||
function append(c) {
|
|
||||||
// we only escape double quotes.
|
|
||||||
if (escaped && c !== '"') {
|
|
||||||
arg += '\\';
|
|
||||||
}
|
|
||||||
arg += c;
|
|
||||||
escaped = false;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < argString.length; i++) {
|
|
||||||
const c = argString.charAt(i);
|
|
||||||
if (c === '"') {
|
|
||||||
if (!escaped) {
|
|
||||||
inQuotes = !inQuotes;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
append(c);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c === '\\' && escaped) {
|
|
||||||
append(c);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c === '\\' && inQuotes) {
|
|
||||||
escaped = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c === ' ' && !inQuotes) {
|
|
||||||
if (arg.length > 0) {
|
|
||||||
args.push(arg);
|
|
||||||
arg = '';
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
append(c);
|
|
||||||
}
|
|
||||||
if (arg.length > 0) {
|
|
||||||
args.push(arg.trim());
|
|
||||||
}
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
exports.argStringToArray = argStringToArray;
|
|
||||||
class ExecState extends events.EventEmitter {
|
|
||||||
constructor(options, toolPath) {
|
|
||||||
super();
|
|
||||||
this.processClosed = false; // tracks whether the process has exited and stdio is closed
|
|
||||||
this.processError = '';
|
|
||||||
this.processExitCode = 0;
|
|
||||||
this.processExited = false; // tracks whether the process has exited
|
|
||||||
this.processStderr = false; // tracks whether stderr was written to
|
|
||||||
this.delay = 10000; // 10 seconds
|
|
||||||
this.done = false;
|
|
||||||
this.timeout = null;
|
|
||||||
if (!toolPath) {
|
|
||||||
throw new Error('toolPath must not be empty');
|
|
||||||
}
|
|
||||||
this.options = options;
|
|
||||||
this.toolPath = toolPath;
|
|
||||||
if (options.delay) {
|
|
||||||
this.delay = options.delay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CheckComplete() {
|
|
||||||
if (this.done) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.processClosed) {
|
|
||||||
this._setResult();
|
|
||||||
}
|
|
||||||
else if (this.processExited) {
|
|
||||||
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_debug(message) {
|
|
||||||
this.emit('debug', message);
|
|
||||||
}
|
|
||||||
_setResult() {
|
|
||||||
// determine whether there is an error
|
|
||||||
let error;
|
|
||||||
if (this.processExited) {
|
|
||||||
if (this.processError) {
|
|
||||||
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
|
|
||||||
}
|
|
||||||
else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
|
|
||||||
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
|
|
||||||
}
|
|
||||||
else if (this.processStderr && this.options.failOnStdErr) {
|
|
||||||
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// clear the timeout
|
|
||||||
if (this.timeout) {
|
|
||||||
clearTimeout(this.timeout);
|
|
||||||
this.timeout = null;
|
|
||||||
}
|
|
||||||
this.done = true;
|
|
||||||
this.emit('done', error, this.processExitCode);
|
|
||||||
}
|
|
||||||
static HandleTimeout(state) {
|
|
||||||
if (state.done) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!state.processClosed && state.processExited) {
|
|
||||||
const message = `The STDIO streams did not close within ${state.delay /
|
|
||||||
1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
|
|
||||||
state._debug(message);
|
|
||||||
}
|
|
||||||
state._setResult();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=toolrunner.js.map
|
|
||||||
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
File diff suppressed because one or more lines are too long
63
node_modules/@actions/exec/package.json
generated
vendored
63
node_modules/@actions/exec/package.json
generated
vendored
@@ -1,63 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "file:toolkit\\actions-exec-0.0.0.tgz",
|
|
||||||
"_id": "@actions/exec@0.0.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A==",
|
|
||||||
"_location": "/@actions/exec",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "file",
|
|
||||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"raw": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
|
||||||
"name": "@actions/exec",
|
|
||||||
"escapedName": "@actions%2fexec",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "file:toolkit/actions-exec-0.0.0.tgz",
|
|
||||||
"saveSpec": "file:toolkit\\actions-exec-0.0.0.tgz",
|
|
||||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-exec-0.0.0.tgz"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
|
||||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-exec-0.0.0.tgz",
|
|
||||||
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
|
|
||||||
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
|
||||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions exec lib",
|
|
||||||
"devDependencies": {
|
|
||||||
"@actions/io": "^0.0.0"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
|
||||||
"keywords": [
|
|
||||||
"exec",
|
|
||||||
"actions"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/exec.js",
|
|
||||||
"name": "@actions/exec",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"version": "0.0.0"
|
|
||||||
}
|
|
||||||
48
node_modules/@actions/github/README.md
generated
vendored
48
node_modules/@actions/github/README.md
generated
vendored
@@ -4,38 +4,47 @@
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the API.
|
Returns an authenticated Octokit client that follows the machine [proxy settings](https://help.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners). See https://octokit.github.io/rest.js for the API.
|
||||||
|
|
||||||
```
|
```js
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
// This should be a token with access to your repository scoped in as a secret.
|
async function run() {
|
||||||
const myToken = core.getInput('myToken');
|
// This should be a token with access to your repository scoped in as a secret.
|
||||||
|
// The YML workflow will need to set myToken with the GitHub Secret Token
|
||||||
|
// myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret
|
||||||
|
const myToken = core.getInput('myToken');
|
||||||
|
|
||||||
const octokit = new github.GitHub(myToken);
|
const octokit = new github.GitHub(myToken);
|
||||||
|
|
||||||
const pulls = await octokit.pulls.get({
|
const { data: pullRequest } = await octokit.pulls.get({
|
||||||
owner: 'octokit',
|
owner: 'octokit',
|
||||||
repo: 'rest.js',
|
repo: 'rest.js',
|
||||||
pull_number: 123,
|
pull_number: 123,
|
||||||
mediaType: {
|
mediaType: {
|
||||||
format: 'diff'
|
format: 'diff'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(pulls);
|
console.log(pullRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also make GraphQL requests:
|
You can pass client options, as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor.
|
||||||
|
|
||||||
```
|
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
|
||||||
|
|
||||||
|
```js
|
||||||
const result = await octokit.graphql(query, variables);
|
const result = await octokit.graphql(query, variables);
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, you can get the context of the current action:
|
Finally, you can get the context of the current action:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
@@ -46,3 +55,20 @@ const newIssue = await octokit.issues.create({
|
|||||||
body: 'Hello Universe!'
|
body: 'Hello Universe!'
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Webhook payload typescript definitions
|
||||||
|
|
||||||
|
The npm module `@octokit/webhooks` provides type definitions for the response payloads. You can cast the payload to these types for better type information.
|
||||||
|
|
||||||
|
First, install the npm module `npm install @octokit/webhooks`
|
||||||
|
|
||||||
|
Then, assert the type based on the eventName
|
||||||
|
```ts
|
||||||
|
import * as core from '@actions/core'
|
||||||
|
import * as github from '@actions/github'
|
||||||
|
import * as Webhooks from '@octokit/webhooks'
|
||||||
|
if (github.context.eventName === 'push') {
|
||||||
|
const pushPayload = github.context.payload as Webhooks.WebhookPayloadPush
|
||||||
|
core.info(`The head commit is: ${pushPayload.head}`)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
4
node_modules/@actions/github/lib/context.d.ts
generated
vendored
4
node_modules/@actions/github/lib/context.d.ts
generated
vendored
@@ -14,12 +14,12 @@ export declare class Context {
|
|||||||
* Hydrate the context from the environment
|
* Hydrate the context from the environment
|
||||||
*/
|
*/
|
||||||
constructor();
|
constructor();
|
||||||
readonly issue: {
|
get issue(): {
|
||||||
owner: string;
|
owner: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
number: number;
|
number: number;
|
||||||
};
|
};
|
||||||
readonly repo: {
|
get repo(): {
|
||||||
owner: string;
|
owner: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
};
|
};
|
||||||
|
|||||||
18
node_modules/@actions/github/lib/context.js
generated
vendored
18
node_modules/@actions/github/lib/context.js
generated
vendored
@@ -1,14 +1,22 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
const fs_1 = require("fs");
|
||||||
|
const os_1 = require("os");
|
||||||
class Context {
|
class Context {
|
||||||
/**
|
/**
|
||||||
* Hydrate the context from the environment
|
* Hydrate the context from the environment
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.payload = process.env.GITHUB_EVENT_PATH
|
this.payload = {};
|
||||||
? require(process.env.GITHUB_EVENT_PATH)
|
if (process.env.GITHUB_EVENT_PATH) {
|
||||||
: {};
|
if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) {
|
||||||
|
this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const path = process.env.GITHUB_EVENT_PATH;
|
||||||
|
process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.eventName = process.env.GITHUB_EVENT_NAME;
|
this.eventName = process.env.GITHUB_EVENT_NAME;
|
||||||
this.sha = process.env.GITHUB_SHA;
|
this.sha = process.env.GITHUB_SHA;
|
||||||
this.ref = process.env.GITHUB_REF;
|
this.ref = process.env.GITHUB_REF;
|
||||||
@@ -18,7 +26,7 @@ class Context {
|
|||||||
}
|
}
|
||||||
get issue() {
|
get issue() {
|
||||||
const payload = this.payload;
|
const payload = this.payload;
|
||||||
return Object.assign({}, this.repo, { number: (payload.issue || payload.pullRequest || payload).number });
|
return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
|
||||||
}
|
}
|
||||||
get repo() {
|
get repo() {
|
||||||
if (process.env.GITHUB_REPOSITORY) {
|
if (process.env.GITHUB_REPOSITORY) {
|
||||||
|
|||||||
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAGA,0DAA0D;AAE1D,MAAa,OAAO;IAalB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB;YAC1C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;YACxC,CAAC,CAAC,EAAE,CAAA;QACN,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;IACjD,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,yBACK,IAAI,CAAC,IAAI,IACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,CAAC,MAAM,IACjE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AAtDD,0BAsDC"}
|
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAalB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,eAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,iBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;gBAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,kBAAkB,QAAG,EAAE,CAAC,CAAA;aACvE;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;IACjD,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,uCACK,IAAI,CAAC,IAAI,KACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,IAClE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AA9DD,0BA8DC"}
|
||||||
27
node_modules/@actions/github/lib/github.d.ts
generated
vendored
27
node_modules/@actions/github/lib/github.d.ts
generated
vendored
@@ -1,8 +1,27 @@
|
|||||||
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
|
import { graphql as GraphQL } from '@octokit/graphql/dist-types/types';
|
||||||
import Octokit from '@octokit/rest';
|
import { Octokit } from '@octokit/rest';
|
||||||
import * as Context from './context';
|
import * as Context from './context';
|
||||||
export declare const context: Context.Context;
|
export declare const context: Context.Context;
|
||||||
export declare class GitHub extends Octokit {
|
export declare class GitHub extends Octokit {
|
||||||
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
|
graphql: GraphQL;
|
||||||
constructor(token: string);
|
/**
|
||||||
|
* Sets up the REST client and GraphQL client with auth and proxy support.
|
||||||
|
* The parameter `token` or `opts.auth` must be supplied. The GraphQL client
|
||||||
|
* authorization is not setup when `opts.auth` is a function or object.
|
||||||
|
*
|
||||||
|
* @param token Auth token
|
||||||
|
* @param opts Octokit options
|
||||||
|
*/
|
||||||
|
constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>);
|
||||||
|
constructor(opts: Octokit.Options);
|
||||||
|
/**
|
||||||
|
* Disambiguates the constructor overload parameters
|
||||||
|
*/
|
||||||
|
private static disambiguate;
|
||||||
|
private static getOctokitOptions;
|
||||||
|
private static getGraphQL;
|
||||||
|
private static getAuthString;
|
||||||
|
private static getProxyAgent;
|
||||||
|
private static getApiBaseUrl;
|
||||||
|
private static getGraphQLBaseUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
101
node_modules/@actions/github/lib/github.js
generated
vendored
101
node_modules/@actions/github/lib/github.js
generated
vendored
@@ -1,7 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@@ -12,17 +9,99 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
|
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
|
||||||
const graphql_1 = require("@octokit/graphql");
|
const graphql_1 = require("@octokit/graphql");
|
||||||
const rest_1 = __importDefault(require("@octokit/rest"));
|
const rest_1 = require("@octokit/rest");
|
||||||
const Context = __importStar(require("./context"));
|
const Context = __importStar(require("./context"));
|
||||||
|
const httpClient = __importStar(require("@actions/http-client"));
|
||||||
// We need this in order to extend Octokit
|
// We need this in order to extend Octokit
|
||||||
rest_1.default.prototype = new rest_1.default();
|
rest_1.Octokit.prototype = new rest_1.Octokit();
|
||||||
exports.context = new Context.Context();
|
exports.context = new Context.Context();
|
||||||
class GitHub extends rest_1.default {
|
class GitHub extends rest_1.Octokit {
|
||||||
constructor(token) {
|
constructor(token, opts) {
|
||||||
super({ auth: `token ${token}` });
|
super(GitHub.getOctokitOptions(GitHub.disambiguate(token, opts)));
|
||||||
this.graphql = graphql_1.defaults({
|
this.graphql = GitHub.getGraphQL(GitHub.disambiguate(token, opts));
|
||||||
headers: { authorization: `token ${token}` }
|
}
|
||||||
});
|
/**
|
||||||
|
* Disambiguates the constructor overload parameters
|
||||||
|
*/
|
||||||
|
static disambiguate(token, opts) {
|
||||||
|
return [
|
||||||
|
typeof token === 'string' ? token : '',
|
||||||
|
typeof token === 'object' ? token : opts || {}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
static getOctokitOptions(args) {
|
||||||
|
const token = args[0];
|
||||||
|
const options = Object.assign({}, args[1]); // Shallow clone - don't mutate the object provided by the caller
|
||||||
|
// Base URL - GHES or Dotcom
|
||||||
|
options.baseUrl = options.baseUrl || this.getApiBaseUrl();
|
||||||
|
// Auth
|
||||||
|
const auth = GitHub.getAuthString(token, options);
|
||||||
|
if (auth) {
|
||||||
|
options.auth = auth;
|
||||||
|
}
|
||||||
|
// Proxy
|
||||||
|
const agent = GitHub.getProxyAgent(options.baseUrl, options);
|
||||||
|
if (agent) {
|
||||||
|
// Shallow clone - don't mutate the object provided by the caller
|
||||||
|
options.request = options.request ? Object.assign({}, options.request) : {};
|
||||||
|
// Set the agent
|
||||||
|
options.request.agent = agent;
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
static getGraphQL(args) {
|
||||||
|
const defaults = {};
|
||||||
|
defaults.baseUrl = this.getGraphQLBaseUrl();
|
||||||
|
const token = args[0];
|
||||||
|
const options = args[1];
|
||||||
|
// Authorization
|
||||||
|
const auth = this.getAuthString(token, options);
|
||||||
|
if (auth) {
|
||||||
|
defaults.headers = {
|
||||||
|
authorization: auth
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Proxy
|
||||||
|
const agent = GitHub.getProxyAgent(defaults.baseUrl, options);
|
||||||
|
if (agent) {
|
||||||
|
defaults.request = { agent };
|
||||||
|
}
|
||||||
|
return graphql_1.graphql.defaults(defaults);
|
||||||
|
}
|
||||||
|
static getAuthString(token, options) {
|
||||||
|
// Validate args
|
||||||
|
if (!token && !options.auth) {
|
||||||
|
throw new Error('Parameter token or opts.auth is required');
|
||||||
|
}
|
||||||
|
else if (token && options.auth) {
|
||||||
|
throw new Error('Parameters token and opts.auth may not both be specified');
|
||||||
|
}
|
||||||
|
return typeof options.auth === 'string' ? options.auth : `token ${token}`;
|
||||||
|
}
|
||||||
|
static getProxyAgent(destinationUrl, options) {
|
||||||
|
var _a;
|
||||||
|
if (!((_a = options.request) === null || _a === void 0 ? void 0 : _a.agent)) {
|
||||||
|
if (httpClient.getProxyUrl(destinationUrl)) {
|
||||||
|
const hc = new httpClient.HttpClient();
|
||||||
|
return hc.getAgent(destinationUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
static getApiBaseUrl() {
|
||||||
|
return process.env['GITHUB_API_URL'] || 'https://api.github.com';
|
||||||
|
}
|
||||||
|
static getGraphQLBaseUrl() {
|
||||||
|
let url = process.env['GITHUB_GRAPHQL_URL'] || 'https://api.github.com/graphql';
|
||||||
|
// Shouldn't be a trailing slash, but remove if so
|
||||||
|
if (url.endsWith('/')) {
|
||||||
|
url = url.substr(0, url.length - 1);
|
||||||
|
}
|
||||||
|
// Remove trailing "/graphql"
|
||||||
|
if (url.toUpperCase().endsWith('/GRAPHQL')) {
|
||||||
|
url = url.substr(0, url.length - '/graphql'.length);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.GitHub = GitHub;
|
exports.GitHub = GitHub;
|
||||||
|
|||||||
2
node_modules/@actions/github/lib/github.js.map
generated
vendored
2
node_modules/@actions/github/lib/github.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}
|
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gGAAgG;AAChG,8CAAwC;AAUxC,wCAAqC;AACrC,mDAAoC;AAEpC,iEAAkD;AAElD,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAiBjC,YAAY,KAA+B,EAAE,IAAsB;QACjE,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAEjE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IACpE,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,YAAY,CACzB,KAA+B,EAC/B,IAAsB;QAEtB,OAAO;YACL,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACtC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;SAC/C,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,iBAAiB,CAC9B,IAA+B;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACrB,MAAM,OAAO,qBAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,iEAAiE;QAE9F,4BAA4B;QAC5B,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE,CAAA;QAEzD,OAAO;QACP,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACjD,IAAI,IAAI,EAAE;YACR,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;SACpB;QAED,QAAQ;QACR,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5D,IAAI,KAAK,EAAE;YACT,iEAAiE;YACjE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAA;YAE7D,gBAAgB;YAChB,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;SAC9B;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,IAA+B;QACvD,MAAM,QAAQ,GAA6B,EAAE,CAAA;QAC7C,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAEvB,gBAAgB;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAC/C,IAAI,IAAI,EAAE;YACR,QAAQ,CAAC,OAAO,GAAG;gBACjB,aAAa,EAAE,IAAI;aACpB,CAAA;SACF;QAED,QAAQ;QACR,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC7D,IAAI,KAAK,EAAE;YACT,QAAQ,CAAC,OAAO,GAAG,EAAC,KAAK,EAAC,CAAA;SAC3B;QAED,OAAO,iBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACnC,CAAC;IAEO,MAAM,CAAC,aAAa,CAC1B,KAAa,EACb,OAAwB;QAExB,gBAAgB;QAChB,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;SAC5D;aAAM,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;YAChC,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAA;SACF;QAED,OAAO,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAA;IAC3E,CAAC;IAEO,MAAM,CAAC,aAAa,CAC1B,cAAsB,EACtB,OAAwB;;QAExB,IAAI,QAAC,OAAO,CAAC,OAAO,0CAAE,KAAK,CAAA,EAAE;YAC3B,IAAI,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;gBAC1C,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;gBACtC,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;aACnC;SACF;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,wBAAwB,CAAA;IAClE,CAAC;IAEO,MAAM,CAAC,iBAAiB;QAC9B,IAAI,GAAG,GACL,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,gCAAgC,CAAA;QAEvE,kDAAkD;QAClD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;SACpC;QAED,6BAA6B;QAC7B,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YAC1C,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;SACpD;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CACF;AAxID,wBAwIC"}
|
||||||
50
node_modules/@actions/github/package.json
generated
vendored
50
node_modules/@actions/github/package.json
generated
vendored
@@ -1,43 +1,42 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_from": "@actions/github@^2.2.0",
|
||||||
[
|
"_id": "@actions/github@2.2.0",
|
||||||
"@actions/github@file:toolkit\\actions-github-0.0.0.tgz",
|
|
||||||
"Z:\\Dreamlifter\\actions-labeler"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
|
||||||
"_id": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-CByX5VIagC5BqGwsHD9Qt5MfN+H6GDC9qQl+MIUipaHTc89sUG/vAY/xQDS9vxuuRwrxbdERwKO3dR6U1BSziw==",
|
"_integrity": "sha512-9UAZqn8ywdR70n3GwVle4N8ALosQs4z50N7XMXrSTUVOmVpaBC5kE3TRTT7qQdi3OaQV24mjGuJZsHUmhD+ZXw==",
|
||||||
"_location": "/@actions/github",
|
"_location": "/@actions/github",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "file",
|
"type": "range",
|
||||||
"where": "Z:\\Dreamlifter\\actions-labeler",
|
"registry": true,
|
||||||
"raw": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
"raw": "@actions/github@^2.2.0",
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"escapedName": "@actions%2fgithub",
|
"escapedName": "@actions%2fgithub",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "file:toolkit/actions-github-0.0.0.tgz",
|
"rawSpec": "^2.2.0",
|
||||||
"saveSpec": "file:toolkit\\actions-github-0.0.0.tgz",
|
"saveSpec": null,
|
||||||
"fetchSpec": "Z:\\Dreamlifter\\actions-labeler\\toolkit\\actions-github-0.0.0.tgz"
|
"fetchSpec": "^2.2.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/"
|
"/"
|
||||||
],
|
],
|
||||||
"_resolved": false,
|
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-2.2.0.tgz",
|
||||||
"_spec": "file:toolkit/actions-github-0.0.0.tgz",
|
"_shasum": "8952fe96b12b881fa39340f0e7202b04dc5c3e71",
|
||||||
"_where": "Z:\\Dreamlifter\\actions-labeler",
|
"_spec": "@actions/github@^2.2.0",
|
||||||
|
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/graphql": "^2.0.1",
|
"@actions/http-client": "^1.0.3",
|
||||||
"@octokit/rest": "^16.15.0"
|
"@octokit/graphql": "^4.3.1",
|
||||||
|
"@octokit/rest": "^16.43.1"
|
||||||
},
|
},
|
||||||
|
"deprecated": false,
|
||||||
"description": "Actions github lib",
|
"description": "Actions github lib",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^24.7.1"
|
"jest": "^25.1.0",
|
||||||
|
"proxy": "^1.0.1"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
@@ -59,12 +58,17 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/github"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
"format": "prettier --write **/*.ts",
|
||||||
|
"format-check": "prettier --check **/*.ts",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "0.0.0"
|
"types": "lib/github.d.ts",
|
||||||
|
"version": "2.2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
21
node_modules/@actions/http-client/LICENSE
generated
vendored
Normal file
21
node_modules/@actions/http-client/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
Copyright (c) GitHub, Inc.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
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.
|
||||||
79
node_modules/@actions/http-client/README.md
generated
vendored
Normal file
79
node_modules/@actions/http-client/README.md
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="actions.png">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# Actions Http-Client
|
||||||
|
|
||||||
|
[](https://github.com/actions/http-client/actions)
|
||||||
|
|
||||||
|
A lightweight HTTP client optimized for use with actions, TypeScript with generics and async await.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- HTTP client with TypeScript generics and async/await/Promises
|
||||||
|
- Typings included so no need to acquire separately (great for intellisense and no versioning drift)
|
||||||
|
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
||||||
|
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
||||||
|
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
||||||
|
- Redirects supported
|
||||||
|
|
||||||
|
Features and releases [here](./RELEASES.md)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install @actions/http-client --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Samples
|
||||||
|
|
||||||
|
See the [HTTP](./__tests__) tests for detailed examples.
|
||||||
|
|
||||||
|
## Errors
|
||||||
|
|
||||||
|
### HTTP
|
||||||
|
|
||||||
|
The HTTP client does not throw unless truly exceptional.
|
||||||
|
|
||||||
|
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
||||||
|
* Redirects (3xx) will be followed by default.
|
||||||
|
|
||||||
|
See [HTTP tests](./__tests__) for detailed examples.
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
||||||
|
|
||||||
|
```
|
||||||
|
export NODE_DEBUG=http
|
||||||
|
```
|
||||||
|
|
||||||
|
## Node support
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
We welcome PRs. Please create an issue and if applicable, a design before proceeding with code.
|
||||||
|
|
||||||
|
once:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
To build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
To run all tests:
|
||||||
|
```bash
|
||||||
|
$ npm test
|
||||||
|
```
|
||||||
16
node_modules/@actions/http-client/RELEASES.md
generated
vendored
Normal file
16
node_modules/@actions/http-client/RELEASES.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
## Releases
|
||||||
|
|
||||||
|
## 1.0.7
|
||||||
|
Update NPM dependencies and add 429 to the list of HttpCodes
|
||||||
|
|
||||||
|
## 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.
|
||||||
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
Normal file
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
Normal file
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import ifm = require('./interfaces');
|
||||||
|
export declare class BasicCredentialHandler implements ifm.IRequestHandler {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
constructor(username: string, password: string);
|
||||||
|
prepareRequest(options: any): void;
|
||||||
|
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class BearerCredentialHandler implements ifm.IRequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: any): void;
|
||||||
|
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: any): void;
|
||||||
|
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||||
|
}
|
||||||
58
node_modules/@actions/http-client/auth.js
generated
vendored
Normal file
58
node_modules/@actions/http-client/auth.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
class BasicCredentialHandler {
|
||||||
|
constructor(username, password) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
prepareRequest(options) {
|
||||||
|
options.headers['Authorization'] =
|
||||||
|
'Basic ' +
|
||||||
|
Buffer.from(this.username + ':' + this.password).toString('base64');
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication(response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
||||||
|
class BearerCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
options.headers['Authorization'] = 'Bearer ' + this.token;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication(response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
||||||
|
class PersonalAccessTokenCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
options.headers['Authorization'] =
|
||||||
|
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication(response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
||||||
119
node_modules/@actions/http-client/index.d.ts
generated
vendored
Normal file
119
node_modules/@actions/http-client/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import http = require('http');
|
||||||
|
import ifm = require('./interfaces');
|
||||||
|
export declare enum HttpCodes {
|
||||||
|
OK = 200,
|
||||||
|
MultipleChoices = 300,
|
||||||
|
MovedPermanently = 301,
|
||||||
|
ResourceMoved = 302,
|
||||||
|
SeeOther = 303,
|
||||||
|
NotModified = 304,
|
||||||
|
UseProxy = 305,
|
||||||
|
SwitchProxy = 306,
|
||||||
|
TemporaryRedirect = 307,
|
||||||
|
PermanentRedirect = 308,
|
||||||
|
BadRequest = 400,
|
||||||
|
Unauthorized = 401,
|
||||||
|
PaymentRequired = 402,
|
||||||
|
Forbidden = 403,
|
||||||
|
NotFound = 404,
|
||||||
|
MethodNotAllowed = 405,
|
||||||
|
NotAcceptable = 406,
|
||||||
|
ProxyAuthenticationRequired = 407,
|
||||||
|
RequestTimeout = 408,
|
||||||
|
Conflict = 409,
|
||||||
|
Gone = 410,
|
||||||
|
TooManyRequests = 429,
|
||||||
|
InternalServerError = 500,
|
||||||
|
NotImplemented = 501,
|
||||||
|
BadGateway = 502,
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
export declare function getProxyUrl(serverUrl: string): string;
|
||||||
|
export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
||||||
|
constructor(message: http.IncomingMessage);
|
||||||
|
message: http.IncomingMessage;
|
||||||
|
readBody(): Promise<string>;
|
||||||
|
}
|
||||||
|
export declare function isHttps(requestUrl: string): boolean;
|
||||||
|
export declare class HttpClient {
|
||||||
|
userAgent: string | undefined;
|
||||||
|
handlers: ifm.IRequestHandler[];
|
||||||
|
requestOptions: ifm.IRequestOptions;
|
||||||
|
private _ignoreSslError;
|
||||||
|
private _socketTimeout;
|
||||||
|
private _allowRedirects;
|
||||||
|
private _allowRedirectDowngrade;
|
||||||
|
private _maxRedirects;
|
||||||
|
private _allowRetries;
|
||||||
|
private _maxRetries;
|
||||||
|
private _agent;
|
||||||
|
private _proxyAgent;
|
||||||
|
private _keepAlive;
|
||||||
|
private _disposed;
|
||||||
|
constructor(userAgent?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
||||||
|
options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
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.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose(): void;
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream): Promise<ifm.IHttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: ifm.IHttpClientResponse) => void): void;
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl: string): http.Agent;
|
||||||
|
private _prepareRequest;
|
||||||
|
private _mergeHeaders;
|
||||||
|
private _getExistingOrDefaultHeader;
|
||||||
|
private _getAgent;
|
||||||
|
private _performExponentialBackoff;
|
||||||
|
private static dateTimeDeserializer;
|
||||||
|
private _processResponse;
|
||||||
|
}
|
||||||
531
node_modules/@actions/http-client/index.js
generated
vendored
Normal file
531
node_modules/@actions/http-client/index.js
generated
vendored
Normal file
@@ -0,0 +1,531 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const url = require("url");
|
||||||
|
const http = require("http");
|
||||||
|
const https = require("https");
|
||||||
|
const pm = require("./proxy");
|
||||||
|
let tunnel;
|
||||||
|
var HttpCodes;
|
||||||
|
(function (HttpCodes) {
|
||||||
|
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||||
|
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
||||||
|
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
||||||
|
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
||||||
|
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
||||||
|
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
||||||
|
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
||||||
|
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
||||||
|
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
||||||
|
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
||||||
|
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
||||||
|
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
||||||
|
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
||||||
|
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
||||||
|
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
||||||
|
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
||||||
|
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
||||||
|
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
||||||
|
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
||||||
|
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
||||||
|
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
||||||
|
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
||||||
|
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
||||||
|
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
||||||
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
function getProxyUrl(serverUrl) {
|
||||||
|
let proxyUrl = pm.getProxyUrl(url.parse(serverUrl));
|
||||||
|
return proxyUrl ? proxyUrl.href : '';
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
const HttpRedirectCodes = [
|
||||||
|
HttpCodes.MovedPermanently,
|
||||||
|
HttpCodes.ResourceMoved,
|
||||||
|
HttpCodes.SeeOther,
|
||||||
|
HttpCodes.TemporaryRedirect,
|
||||||
|
HttpCodes.PermanentRedirect
|
||||||
|
];
|
||||||
|
const HttpResponseRetryCodes = [
|
||||||
|
HttpCodes.BadGateway,
|
||||||
|
HttpCodes.ServiceUnavailable,
|
||||||
|
HttpCodes.GatewayTimeout
|
||||||
|
];
|
||||||
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||||
|
const ExponentialBackoffCeiling = 10;
|
||||||
|
const ExponentialBackoffTimeSlice = 5;
|
||||||
|
class HttpClientResponse {
|
||||||
|
constructor(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
readBody() {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
let output = Buffer.alloc(0);
|
||||||
|
this.message.on('data', (chunk) => {
|
||||||
|
output = Buffer.concat([output, chunk]);
|
||||||
|
});
|
||||||
|
this.message.on('end', () => {
|
||||||
|
resolve(output.toString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientResponse = HttpClientResponse;
|
||||||
|
function isHttps(requestUrl) {
|
||||||
|
let parsedUrl = url.parse(requestUrl);
|
||||||
|
return parsedUrl.protocol === 'https:';
|
||||||
|
}
|
||||||
|
exports.isHttps = isHttps;
|
||||||
|
class HttpClient {
|
||||||
|
constructor(userAgent, handlers, requestOptions) {
|
||||||
|
this._ignoreSslError = false;
|
||||||
|
this._allowRedirects = true;
|
||||||
|
this._allowRedirectDowngrade = false;
|
||||||
|
this._maxRedirects = 50;
|
||||||
|
this._allowRetries = false;
|
||||||
|
this._maxRetries = 1;
|
||||||
|
this._keepAlive = false;
|
||||||
|
this._disposed = false;
|
||||||
|
this.userAgent = userAgent;
|
||||||
|
this.handlers = handlers || [];
|
||||||
|
this.requestOptions = requestOptions;
|
||||||
|
if (requestOptions) {
|
||||||
|
if (requestOptions.ignoreSslError != null) {
|
||||||
|
this._ignoreSslError = requestOptions.ignoreSslError;
|
||||||
|
}
|
||||||
|
this._socketTimeout = requestOptions.socketTimeout;
|
||||||
|
if (requestOptions.allowRedirects != null) {
|
||||||
|
this._allowRedirects = requestOptions.allowRedirects;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRedirectDowngrade != null) {
|
||||||
|
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRedirects != null) {
|
||||||
|
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
||||||
|
}
|
||||||
|
if (requestOptions.keepAlive != null) {
|
||||||
|
this._keepAlive = requestOptions.keepAlive;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRetries != null) {
|
||||||
|
this._allowRetries = requestOptions.allowRetries;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRetries != null) {
|
||||||
|
this._maxRetries = requestOptions.maxRetries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
get(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
del(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
post(requestUrl, data, additionalHeaders) {
|
||||||
|
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
patch(requestUrl, data, additionalHeaders) {
|
||||||
|
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
put(requestUrl, data, additionalHeaders) {
|
||||||
|
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
head(requestUrl, additionalHeaders) {
|
||||||
|
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
||||||
|
}
|
||||||
|
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.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
async request(verb, requestUrl, data, headers) {
|
||||||
|
if (this._disposed) {
|
||||||
|
throw new Error('Client has already been disposed.');
|
||||||
|
}
|
||||||
|
let parsedUrl = url.parse(requestUrl);
|
||||||
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
||||||
|
// Only perform retries on reads since writes may not be idempotent.
|
||||||
|
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
||||||
|
? this._maxRetries + 1
|
||||||
|
: 1;
|
||||||
|
let numTries = 0;
|
||||||
|
let response;
|
||||||
|
while (numTries < maxTries) {
|
||||||
|
response = await this.requestRaw(info, data);
|
||||||
|
// Check if it's an authentication challenge
|
||||||
|
if (response &&
|
||||||
|
response.message &&
|
||||||
|
response.message.statusCode === HttpCodes.Unauthorized) {
|
||||||
|
let authenticationHandler;
|
||||||
|
for (let i = 0; i < this.handlers.length; i++) {
|
||||||
|
if (this.handlers[i].canHandleAuthentication(response)) {
|
||||||
|
authenticationHandler = this.handlers[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (authenticationHandler) {
|
||||||
|
return authenticationHandler.handleAuthentication(this, info, data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We have received an unauthorized response but have no handlers to handle it.
|
||||||
|
// Let the response return to the caller.
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let redirectsRemaining = this._maxRedirects;
|
||||||
|
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
||||||
|
this._allowRedirects &&
|
||||||
|
redirectsRemaining > 0) {
|
||||||
|
const redirectUrl = response.message.headers['location'];
|
||||||
|
if (!redirectUrl) {
|
||||||
|
// if there's no location to redirect to, we won't
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let parsedRedirectUrl = url.parse(redirectUrl);
|
||||||
|
if (parsedUrl.protocol == 'https:' &&
|
||||||
|
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
||||||
|
!this._allowRedirectDowngrade) {
|
||||||
|
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
||||||
|
}
|
||||||
|
// we need to finish reading the response before reassigning response
|
||||||
|
// which will leak the open socket.
|
||||||
|
await response.readBody();
|
||||||
|
// strip authorization header if redirected to a different hostname
|
||||||
|
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
||||||
|
for (let header in headers) {
|
||||||
|
// header names are case insensitive
|
||||||
|
if (header.toLowerCase() === 'authorization') {
|
||||||
|
delete headers[header];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let's make the request with the new redirectUrl
|
||||||
|
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||||
|
response = await this.requestRaw(info, data);
|
||||||
|
redirectsRemaining--;
|
||||||
|
}
|
||||||
|
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
||||||
|
// If not a retry code, return immediately instead of retrying
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
numTries += 1;
|
||||||
|
if (numTries < maxTries) {
|
||||||
|
await response.readBody();
|
||||||
|
await this._performExponentialBackoff(numTries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose() {
|
||||||
|
if (this._agent) {
|
||||||
|
this._agent.destroy();
|
||||||
|
}
|
||||||
|
this._disposed = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info, data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let callbackForResult = function (err, res) {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
resolve(res);
|
||||||
|
};
|
||||||
|
this.requestRawWithCallback(info, data, callbackForResult);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info, data, onResult) {
|
||||||
|
let socket;
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
||||||
|
}
|
||||||
|
let callbackCalled = false;
|
||||||
|
let handleResult = (err, res) => {
|
||||||
|
if (!callbackCalled) {
|
||||||
|
callbackCalled = true;
|
||||||
|
onResult(err, res);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let req = info.httpModule.request(info.options, (msg) => {
|
||||||
|
let res = new HttpClientResponse(msg);
|
||||||
|
handleResult(null, res);
|
||||||
|
});
|
||||||
|
req.on('socket', sock => {
|
||||||
|
socket = sock;
|
||||||
|
});
|
||||||
|
// If we ever get disconnected, we want the socket to timeout eventually
|
||||||
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
||||||
|
if (socket) {
|
||||||
|
socket.end();
|
||||||
|
}
|
||||||
|
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
||||||
|
});
|
||||||
|
req.on('error', function (err) {
|
||||||
|
// err has statusCode property
|
||||||
|
// res should have headers
|
||||||
|
handleResult(err, null);
|
||||||
|
});
|
||||||
|
if (data && typeof data === 'string') {
|
||||||
|
req.write(data, 'utf8');
|
||||||
|
}
|
||||||
|
if (data && typeof data !== 'string') {
|
||||||
|
data.on('close', function () {
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
data.pipe(req);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl) {
|
||||||
|
let parsedUrl = url.parse(serverUrl);
|
||||||
|
return this._getAgent(parsedUrl);
|
||||||
|
}
|
||||||
|
_prepareRequest(method, requestUrl, headers) {
|
||||||
|
const info = {};
|
||||||
|
info.parsedUrl = requestUrl;
|
||||||
|
const usingSsl = info.parsedUrl.protocol === 'https:';
|
||||||
|
info.httpModule = usingSsl ? https : http;
|
||||||
|
const defaultPort = usingSsl ? 443 : 80;
|
||||||
|
info.options = {};
|
||||||
|
info.options.host = info.parsedUrl.hostname;
|
||||||
|
info.options.port = info.parsedUrl.port
|
||||||
|
? parseInt(info.parsedUrl.port)
|
||||||
|
: defaultPort;
|
||||||
|
info.options.path =
|
||||||
|
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
||||||
|
info.options.method = method;
|
||||||
|
info.options.headers = this._mergeHeaders(headers);
|
||||||
|
if (this.userAgent != null) {
|
||||||
|
info.options.headers['user-agent'] = this.userAgent;
|
||||||
|
}
|
||||||
|
info.options.agent = this._getAgent(info.parsedUrl);
|
||||||
|
// gives handlers an opportunity to participate
|
||||||
|
if (this.handlers) {
|
||||||
|
this.handlers.forEach(handler => {
|
||||||
|
handler.prepareRequest(info.options);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
_mergeHeaders(headers) {
|
||||||
|
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
let useProxy = proxyUrl && proxyUrl.hostname;
|
||||||
|
if (this._keepAlive && useProxy) {
|
||||||
|
agent = this._proxyAgent;
|
||||||
|
}
|
||||||
|
if (this._keepAlive && !useProxy) {
|
||||||
|
agent = this._agent;
|
||||||
|
}
|
||||||
|
// if agent is already assigned use that agent.
|
||||||
|
if (!!agent) {
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
const usingSsl = parsedUrl.protocol === 'https:';
|
||||||
|
let maxSockets = 100;
|
||||||
|
if (!!this.requestOptions) {
|
||||||
|
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
||||||
|
}
|
||||||
|
if (useProxy) {
|
||||||
|
// If using proxy, need tunnel
|
||||||
|
if (!tunnel) {
|
||||||
|
tunnel = require('tunnel');
|
||||||
|
}
|
||||||
|
const agentOptions = {
|
||||||
|
maxSockets: maxSockets,
|
||||||
|
keepAlive: this._keepAlive,
|
||||||
|
proxy: {
|
||||||
|
proxyAuth: proxyUrl.auth,
|
||||||
|
host: proxyUrl.hostname,
|
||||||
|
port: proxyUrl.port
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let tunnelAgent;
|
||||||
|
const overHttps = proxyUrl.protocol === 'https:';
|
||||||
|
if (usingSsl) {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
||||||
|
}
|
||||||
|
agent = tunnelAgent(agentOptions);
|
||||||
|
this._proxyAgent = agent;
|
||||||
|
}
|
||||||
|
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
||||||
|
if (this._keepAlive && !agent) {
|
||||||
|
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
||||||
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
||||||
|
this._agent = agent;
|
||||||
|
}
|
||||||
|
// if not using private agent and tunnel agent isn't setup then use global agent
|
||||||
|
if (!agent) {
|
||||||
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
||||||
|
}
|
||||||
|
if (usingSsl && this._ignoreSslError) {
|
||||||
|
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||||
|
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||||
|
// we have to cast it to any and change it directly
|
||||||
|
agent.options = Object.assign(agent.options || {}, {
|
||||||
|
rejectUnauthorized: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
_performExponentialBackoff(retryNumber) {
|
||||||
|
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
||||||
|
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;
|
||||||
50
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
Normal file
50
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import http = require('http');
|
||||||
|
import url = require('url');
|
||||||
|
export interface IHeaders {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
export interface IHttpClient {
|
||||||
|
options(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
put(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: IHeaders): Promise<IHttpClientResponse>;
|
||||||
|
requestRaw(info: IRequestInfo, data: string | NodeJS.ReadableStream): Promise<IHttpClientResponse>;
|
||||||
|
requestRawWithCallback(info: IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: IHttpClientResponse) => void): void;
|
||||||
|
}
|
||||||
|
export interface IRequestHandler {
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(response: IHttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: IHttpClient, requestInfo: IRequestInfo, objs: any): Promise<IHttpClientResponse>;
|
||||||
|
}
|
||||||
|
export interface IHttpClientResponse {
|
||||||
|
message: http.IncomingMessage;
|
||||||
|
readBody(): Promise<string>;
|
||||||
|
}
|
||||||
|
export interface IRequestInfo {
|
||||||
|
options: http.RequestOptions;
|
||||||
|
parsedUrl: url.Url;
|
||||||
|
httpModule: any;
|
||||||
|
}
|
||||||
|
export interface IRequestOptions {
|
||||||
|
headers?: IHeaders;
|
||||||
|
socketTimeout?: number;
|
||||||
|
ignoreSslError?: boolean;
|
||||||
|
allowRedirects?: boolean;
|
||||||
|
allowRedirectDowngrade?: boolean;
|
||||||
|
maxRedirects?: number;
|
||||||
|
maxSockets?: number;
|
||||||
|
keepAlive?: boolean;
|
||||||
|
deserializeDates?: boolean;
|
||||||
|
allowRetries?: boolean;
|
||||||
|
maxRetries?: number;
|
||||||
|
}
|
||||||
|
export interface ITypedResponse<T> {
|
||||||
|
statusCode: number;
|
||||||
|
result: T | null;
|
||||||
|
headers: Object;
|
||||||
|
}
|
||||||
67
node_modules/@actions/http-client/package.json
generated
vendored
Normal file
67
node_modules/@actions/http-client/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"_from": "@actions/http-client@^1.0.3",
|
||||||
|
"_id": "@actions/http-client@1.0.8",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==",
|
||||||
|
"_location": "/@actions/http-client",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@actions/http-client@^1.0.3",
|
||||||
|
"name": "@actions/http-client",
|
||||||
|
"escapedName": "@actions%2fhttp-client",
|
||||||
|
"scope": "@actions",
|
||||||
|
"rawSpec": "^1.0.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@actions/github"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz",
|
||||||
|
"_shasum": "8bd76e8eca89dc8bcf619aa128eba85f7a39af45",
|
||||||
|
"_spec": "@actions/http-client@^1.0.3",
|
||||||
|
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler/node_modules/@actions/github",
|
||||||
|
"author": {
|
||||||
|
"name": "GitHub, Inc."
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/http-client/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "0.0.6"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Actions Http Client",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^25.1.4",
|
||||||
|
"@types/node": "^12.12.31",
|
||||||
|
"jest": "^25.1.0",
|
||||||
|
"prettier": "^2.0.4",
|
||||||
|
"proxy": "^1.0.1",
|
||||||
|
"ts-jest": "^25.2.1",
|
||||||
|
"typescript": "^3.8.3"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/actions/http-client#readme",
|
||||||
|
"keywords": [
|
||||||
|
"Actions",
|
||||||
|
"Http"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "@actions/http-client",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/http-client.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"audit-check": "npm audit --audit-level=moderate",
|
||||||
|
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
|
||||||
|
"format": "prettier --write *.ts && prettier --write **/*.ts",
|
||||||
|
"format-check": "prettier --check *.ts && prettier --check **/*.ts",
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"version": "1.0.8"
|
||||||
|
}
|
||||||
4
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
Normal file
4
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as url from 'url';
|
||||||
|
export declare function getProxyUrl(reqUrl: url.Url): url.Url | undefined;
|
||||||
|
export declare function checkBypass(reqUrl: url.Url): boolean;
|
||||||
58
node_modules/@actions/http-client/proxy.js
generated
vendored
Normal file
58
node_modules/@actions/http-client/proxy.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const url = require("url");
|
||||||
|
function getProxyUrl(reqUrl) {
|
||||||
|
let usingSsl = reqUrl.protocol === 'https:';
|
||||||
|
let proxyUrl;
|
||||||
|
if (checkBypass(reqUrl)) {
|
||||||
|
return proxyUrl;
|
||||||
|
}
|
||||||
|
let proxyVar;
|
||||||
|
if (usingSsl) {
|
||||||
|
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||||
|
}
|
||||||
|
if (proxyVar) {
|
||||||
|
proxyUrl = url.parse(proxyVar);
|
||||||
|
}
|
||||||
|
return proxyUrl;
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
function checkBypass(reqUrl) {
|
||||||
|
if (!reqUrl.hostname) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||||
|
if (!noProxy) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Determine the request port
|
||||||
|
let reqPort;
|
||||||
|
if (reqUrl.port) {
|
||||||
|
reqPort = Number(reqUrl.port);
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'http:') {
|
||||||
|
reqPort = 80;
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'https:') {
|
||||||
|
reqPort = 443;
|
||||||
|
}
|
||||||
|
// Format the request hostname and hostname with port
|
||||||
|
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||||
|
if (typeof reqPort === 'number') {
|
||||||
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||||
|
}
|
||||||
|
// Compare request host against noproxy
|
||||||
|
for (let upperNoProxyItem of noProxy
|
||||||
|
.split(',')
|
||||||
|
.map(x => x.trim().toUpperCase())
|
||||||
|
.filter(x => x)) {
|
||||||
|
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exports.checkBypass = checkBypass;
|
||||||
49
node_modules/@actions/io/README.md
generated
vendored
49
node_modules/@actions/io/README.md
generated
vendored
@@ -1,49 +0,0 @@
|
|||||||
# `@actions/io`
|
|
||||||
|
|
||||||
> Core functions for cli filesystem scenarios
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* Copies a file or folder.
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See CopyOptions.
|
|
||||||
*/
|
|
||||||
export function cp(source: string, dest: string, options?: CopyOptions): Promise<void>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a path recursively with force
|
|
||||||
*
|
|
||||||
* @param path path to remove
|
|
||||||
*/
|
|
||||||
export function rmRF(path: string): Promise<void>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a directory. Creates the full path with folders in between
|
|
||||||
*
|
|
||||||
* @param p path to create
|
|
||||||
* @returns Promise<void>
|
|
||||||
*/
|
|
||||||
export function mkdirP(p: string): Promise<void>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves a path.
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See CopyOptions.
|
|
||||||
*/
|
|
||||||
export function mv(source: string, dest: string, options?: CopyOptions): Promise<void>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
|
||||||
*
|
|
||||||
* @param tool name of the tool
|
|
||||||
* @param options optional. See WhichOptions.
|
|
||||||
* @returns Promise<string> path to tool
|
|
||||||
*/
|
|
||||||
export function which(tool: string, options?: WhichOptions): Promise<string>
|
|
||||||
```
|
|
||||||
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as fs from 'fs';
|
|
||||||
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
|
||||||
export declare const IS_WINDOWS: boolean;
|
|
||||||
export declare function exists(fsPath: string): Promise<boolean>;
|
|
||||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
|
||||||
/**
|
|
||||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
|
||||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
|
||||||
*/
|
|
||||||
export declare function isRooted(p: string): boolean;
|
|
||||||
/**
|
|
||||||
* Recursively create a directory at `fsPath`.
|
|
||||||
*
|
|
||||||
* This implementation is optimistic, meaning it attempts to create the full
|
|
||||||
* path first, and backs up the path stack from there.
|
|
||||||
*
|
|
||||||
* @param fsPath The path to create
|
|
||||||
* @param maxDepth The maximum recursion depth
|
|
||||||
* @param depth The current recursion depth
|
|
||||||
*/
|
|
||||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Best effort attempt to determine whether a file exists and is executable.
|
|
||||||
* @param filePath file path to check
|
|
||||||
* @param extensions additional file extensions to try
|
|
||||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
|
||||||
*/
|
|
||||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
|
||||||
194
node_modules/@actions/io/lib/io-util.js
generated
vendored
194
node_modules/@actions/io/lib/io-util.js
generated
vendored
@@ -1,194 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var _a;
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const assert_1 = require("assert");
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
|
||||||
function exists(fsPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
yield exports.stat(fsPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (err.code === 'ENOENT') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.exists = exists;
|
|
||||||
function isDirectory(fsPath, useStat = false) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
|
||||||
return stats.isDirectory();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.isDirectory = isDirectory;
|
|
||||||
/**
|
|
||||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
|
||||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
|
||||||
*/
|
|
||||||
function isRooted(p) {
|
|
||||||
p = normalizeSeparators(p);
|
|
||||||
if (!p) {
|
|
||||||
throw new Error('isRooted() parameter "p" cannot be empty');
|
|
||||||
}
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
|
||||||
); // e.g. C: or C:\hello
|
|
||||||
}
|
|
||||||
return p.startsWith('/');
|
|
||||||
}
|
|
||||||
exports.isRooted = isRooted;
|
|
||||||
/**
|
|
||||||
* Recursively create a directory at `fsPath`.
|
|
||||||
*
|
|
||||||
* This implementation is optimistic, meaning it attempts to create the full
|
|
||||||
* path first, and backs up the path stack from there.
|
|
||||||
*
|
|
||||||
* @param fsPath The path to create
|
|
||||||
* @param maxDepth The maximum recursion depth
|
|
||||||
* @param depth The current recursion depth
|
|
||||||
*/
|
|
||||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
||||||
fsPath = path.resolve(fsPath);
|
|
||||||
if (depth >= maxDepth)
|
|
||||||
return exports.mkdir(fsPath);
|
|
||||||
try {
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
switch (err.code) {
|
|
||||||
case 'ENOENT': {
|
|
||||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
let stats;
|
|
||||||
try {
|
|
||||||
stats = yield exports.stat(fsPath);
|
|
||||||
}
|
|
||||||
catch (err2) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
if (!stats.isDirectory())
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mkdirP = mkdirP;
|
|
||||||
/**
|
|
||||||
* Best effort attempt to determine whether a file exists and is executable.
|
|
||||||
* @param filePath file path to check
|
|
||||||
* @param extensions additional file extensions to try
|
|
||||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
|
||||||
*/
|
|
||||||
function tryGetExecutablePath(filePath, extensions) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let stats = undefined;
|
|
||||||
try {
|
|
||||||
// test file exists
|
|
||||||
stats = yield exports.stat(filePath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (err.code !== 'ENOENT') {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stats && stats.isFile()) {
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
// on Windows, test for valid extension
|
|
||||||
const upperExt = path.extname(filePath).toUpperCase();
|
|
||||||
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (isUnixExecutable(stats)) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// try each extension
|
|
||||||
const originalFilePath = filePath;
|
|
||||||
for (const extension of extensions) {
|
|
||||||
filePath = originalFilePath + extension;
|
|
||||||
stats = undefined;
|
|
||||||
try {
|
|
||||||
stats = yield exports.stat(filePath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (err.code !== 'ENOENT') {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stats && stats.isFile()) {
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
// preserve the case of the actual file (since an extension was appended)
|
|
||||||
try {
|
|
||||||
const directory = path.dirname(filePath);
|
|
||||||
const upperName = path.basename(filePath).toUpperCase();
|
|
||||||
for (const actualName of yield exports.readdir(directory)) {
|
|
||||||
if (upperName === actualName.toUpperCase()) {
|
|
||||||
filePath = path.join(directory, actualName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
|
||||||
}
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (isUnixExecutable(stats)) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.tryGetExecutablePath = tryGetExecutablePath;
|
|
||||||
function normalizeSeparators(p) {
|
|
||||||
p = p || '';
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
// convert slashes on Windows
|
|
||||||
p = p.replace(/\//g, '\\');
|
|
||||||
// remove redundant slashes
|
|
||||||
return p.replace(/\\\\+/g, '\\');
|
|
||||||
}
|
|
||||||
// remove redundant slashes
|
|
||||||
return p.replace(/\/\/+/g, '/');
|
|
||||||
}
|
|
||||||
// on Mac/Linux, test the execute bit
|
|
||||||
// R W X R W X R W X
|
|
||||||
// 256 128 64 32 16 8 4 2 1
|
|
||||||
function isUnixExecutable(stats) {
|
|
||||||
return ((stats.mode & 1) > 0 ||
|
|
||||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
|
||||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=io-util.js.map
|
|
||||||
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAYE,qTAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,UAAmB,KAAK;;QAExB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;QAChE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;CAAA;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAS;IAChC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,IAAI,kBAAU,EAAE;QACd,OAAO,CACL,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,8BAA8B;SACxE,CAAA,CAAC,sBAAsB;KACzB;IAED,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAbD,4BAaC;AAED;;;;;;;;;GASG;AACH,SAAsB,MAAM,CAC1B,MAAc,EACd,WAAmB,IAAI,EACvB,QAAgB,CAAC;;QAEjB,WAAE,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAA;QAE9C,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE7B,IAAI,KAAK,IAAI,QAAQ;YAAE,OAAO,aAAK,CAAC,MAAM,CAAC,CAAA;QAE3C,IAAI;YACF,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;YACnB,OAAM;SACP;QAAC,OAAO,GAAG,EAAE;YACZ,QAAQ,GAAG,CAAC,IAAI,EAAE;gBAChB,KAAK,QAAQ,CAAC,CAAC;oBACb,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;oBACvD,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;oBACnB,OAAM;iBACP;gBACD,OAAO,CAAC,CAAC;oBACP,IAAI,KAAe,CAAA;oBAEnB,IAAI;wBACF,KAAK,GAAG,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;qBAC3B;oBAAC,OAAO,IAAI,EAAE;wBACb,MAAM,GAAG,CAAA;qBACV;oBAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;wBAAE,MAAM,GAAG,CAAA;iBACpC;aACF;SACF;IACH,CAAC;CAAA;AAlCD,wBAkCC;AAED;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,QAAgB,EAChB,UAAoB;;QAEpB,IAAI,KAAK,GAAyB,SAAS,CAAA;QAC3C,IAAI;YACF,mBAAmB;YACnB,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;SAC7B;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;aACF;SACF;QACD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;YAC3B,IAAI,kBAAU,EAAE;gBACd,uCAAuC;gBACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;gBACrD,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,EAAE;oBACpE,OAAO,QAAQ,CAAA;iBAChB;aACF;iBAAM;gBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBAC3B,OAAO,QAAQ,CAAA;iBAChB;aACF;SACF;QAED,qBAAqB;QACrB,MAAM,gBAAgB,GAAG,QAAQ,CAAA;QACjC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAAA;YAEvC,KAAK,GAAG,SAAS,CAAA;YACjB,IAAI;gBACF,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;aAC7B;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACzB,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;iBACF;aACF;YAED,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;gBAC3B,IAAI,kBAAU,EAAE;oBACd,yEAAyE;oBACzE,IAAI;wBACF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACxC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;wBACvD,KAAK,MAAM,UAAU,IAAI,MAAM,eAAO,CAAC,SAAS,CAAC,EAAE;4BACjD,IAAI,SAAS,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE;gCAC1C,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;gCAC3C,MAAK;6BACN;yBACF;qBACF;oBAAC,OAAO,GAAG,EAAE;wBACZ,sCAAsC;wBACtC,OAAO,CAAC,GAAG,CACT,yEAAyE,QAAQ,MAAM,GAAG,EAAE,CAC7F,CAAA;qBACF;oBAED,OAAO,QAAQ,CAAA;iBAChB;qBAAM;oBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;wBAC3B,OAAO,QAAQ,CAAA;qBAChB;iBACF;aACF;SACF;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA5ED,oDA4EC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
|
||||||
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
@@ -1,56 +0,0 @@
|
|||||||
/**
|
|
||||||
* Interface for cp/mv options
|
|
||||||
*/
|
|
||||||
export interface CopyOptions {
|
|
||||||
/** Optional. Whether to recursively copy all subdirectories. Defaults to false */
|
|
||||||
recursive?: boolean;
|
|
||||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
|
||||||
force?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Interface for cp/mv options
|
|
||||||
*/
|
|
||||||
export interface MoveOptions {
|
|
||||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
|
||||||
force?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Copies a file or folder.
|
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See CopyOptions.
|
|
||||||
*/
|
|
||||||
export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Moves a path.
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See MoveOptions.
|
|
||||||
*/
|
|
||||||
export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Remove a path recursively with force
|
|
||||||
*
|
|
||||||
* @param inputPath path to remove
|
|
||||||
*/
|
|
||||||
export declare function rmRF(inputPath: string): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Make a directory. Creates the full path with folders in between
|
|
||||||
* Will throw if it fails
|
|
||||||
*
|
|
||||||
* @param fsPath path to create
|
|
||||||
* @returns Promise<void>
|
|
||||||
*/
|
|
||||||
export declare function mkdirP(fsPath: string): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
|
||||||
* If you check and the tool does not exist, it will throw.
|
|
||||||
*
|
|
||||||
* @param tool name of the tool
|
|
||||||
* @param check whether to check if tool exists
|
|
||||||
* @returns Promise<string> path to tool
|
|
||||||
*/
|
|
||||||
export declare function which(tool: string, check?: boolean): Promise<string>;
|
|
||||||
289
node_modules/@actions/io/lib/io.js
generated
vendored
289
node_modules/@actions/io/lib/io.js
generated
vendored
@@ -1,289 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const childProcess = require("child_process");
|
|
||||||
const path = require("path");
|
|
||||||
const util_1 = require("util");
|
|
||||||
const ioUtil = require("./io-util");
|
|
||||||
const exec = util_1.promisify(childProcess.exec);
|
|
||||||
/**
|
|
||||||
* Copies a file or folder.
|
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See CopyOptions.
|
|
||||||
*/
|
|
||||||
function cp(source, dest, options = {}) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const { force, recursive } = readCopyOptions(options);
|
|
||||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
|
||||||
// Dest is an existing file, but not forcing
|
|
||||||
if (destStat && destStat.isFile() && !force) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// If dest is an existing directory, should copy inside.
|
|
||||||
const newDest = destStat && destStat.isDirectory()
|
|
||||||
? path.join(dest, path.basename(source))
|
|
||||||
: dest;
|
|
||||||
if (!(yield ioUtil.exists(source))) {
|
|
||||||
throw new Error(`no such file or directory: ${source}`);
|
|
||||||
}
|
|
||||||
const sourceStat = yield ioUtil.stat(source);
|
|
||||||
if (sourceStat.isDirectory()) {
|
|
||||||
if (!recursive) {
|
|
||||||
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield cpDirRecursive(source, newDest, 0, force);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (path.relative(source, newDest) === '') {
|
|
||||||
// a file cannot be copied to itself
|
|
||||||
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
|
||||||
}
|
|
||||||
yield copyFile(source, newDest, force);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.cp = cp;
|
|
||||||
/**
|
|
||||||
* Moves a path.
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See MoveOptions.
|
|
||||||
*/
|
|
||||||
function mv(source, dest, options = {}) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (yield ioUtil.exists(dest)) {
|
|
||||||
let destExists = true;
|
|
||||||
if (yield ioUtil.isDirectory(dest)) {
|
|
||||||
// If dest is directory copy src into dest
|
|
||||||
dest = path.join(dest, path.basename(source));
|
|
||||||
destExists = yield ioUtil.exists(dest);
|
|
||||||
}
|
|
||||||
if (destExists) {
|
|
||||||
if (options.force == null || options.force) {
|
|
||||||
yield rmRF(dest);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error('Destination already exists');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
yield mkdirP(path.dirname(dest));
|
|
||||||
yield ioUtil.rename(source, dest);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mv = mv;
|
|
||||||
/**
|
|
||||||
* Remove a path recursively with force
|
|
||||||
*
|
|
||||||
* @param inputPath path to remove
|
|
||||||
*/
|
|
||||||
function rmRF(inputPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (ioUtil.IS_WINDOWS) {
|
|
||||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
||||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
||||||
try {
|
|
||||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
||||||
yield exec(`rd /s /q "${inputPath}"`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield exec(`del /f /a "${inputPath}"`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
|
||||||
try {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let isDir = false;
|
|
||||||
try {
|
|
||||||
isDir = yield ioUtil.isDirectory(inputPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isDir) {
|
|
||||||
yield exec(`rm -rf "${inputPath}"`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.rmRF = rmRF;
|
|
||||||
/**
|
|
||||||
* Make a directory. Creates the full path with folders in between
|
|
||||||
* Will throw if it fails
|
|
||||||
*
|
|
||||||
* @param fsPath path to create
|
|
||||||
* @returns Promise<void>
|
|
||||||
*/
|
|
||||||
function mkdirP(fsPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
yield ioUtil.mkdirP(fsPath);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mkdirP = mkdirP;
|
|
||||||
/**
|
|
||||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
|
||||||
* If you check and the tool does not exist, it will throw.
|
|
||||||
*
|
|
||||||
* @param tool name of the tool
|
|
||||||
* @param check whether to check if tool exists
|
|
||||||
* @returns Promise<string> path to tool
|
|
||||||
*/
|
|
||||||
function which(tool, check) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!tool) {
|
|
||||||
throw new Error("parameter 'tool' is required");
|
|
||||||
}
|
|
||||||
// recursive when check=true
|
|
||||||
if (check) {
|
|
||||||
const result = yield which(tool, false);
|
|
||||||
if (!result) {
|
|
||||||
if (ioUtil.IS_WINDOWS) {
|
|
||||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// build the list of extensions to try
|
|
||||||
const extensions = [];
|
|
||||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
|
||||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
|
||||||
if (extension) {
|
|
||||||
extensions.push(extension);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if it's rooted, return it if exists. otherwise return empty.
|
|
||||||
if (ioUtil.isRooted(tool)) {
|
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
|
||||||
if (filePath) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// if any path separators, return empty
|
|
||||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// build the list of directories
|
|
||||||
//
|
|
||||||
// Note, technically "where" checks the current directory on Windows. From a task lib perspective,
|
|
||||||
// it feels like we should not do this. Checking the current directory seems like more of a use
|
|
||||||
// case of a shell, and the which() function exposed by the task lib should strive for consistency
|
|
||||||
// across platforms.
|
|
||||||
const directories = [];
|
|
||||||
if (process.env.PATH) {
|
|
||||||
for (const p of process.env.PATH.split(path.delimiter)) {
|
|
||||||
if (p) {
|
|
||||||
directories.push(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// return the first match
|
|
||||||
for (const directory of directories) {
|
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
|
||||||
if (filePath) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
throw new Error(`which failed with message ${err.message}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.which = which;
|
|
||||||
function readCopyOptions(options) {
|
|
||||||
const force = options.force == null ? true : options.force;
|
|
||||||
const recursive = Boolean(options.recursive);
|
|
||||||
return { force, recursive };
|
|
||||||
}
|
|
||||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// Ensure there is not a run away recursive copy
|
|
||||||
if (currentDepth >= 255)
|
|
||||||
return;
|
|
||||||
currentDepth++;
|
|
||||||
yield mkdirP(destDir);
|
|
||||||
const files = yield ioUtil.readdir(sourceDir);
|
|
||||||
for (const fileName of files) {
|
|
||||||
const srcFile = `${sourceDir}/${fileName}`;
|
|
||||||
const destFile = `${destDir}/${fileName}`;
|
|
||||||
const srcFileStat = yield ioUtil.lstat(srcFile);
|
|
||||||
if (srcFileStat.isDirectory()) {
|
|
||||||
// Recurse
|
|
||||||
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield copyFile(srcFile, destFile, force);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Change the mode for the newly created directory
|
|
||||||
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Buffered file copy
|
|
||||||
function copyFile(srcFile, destFile, force) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
|
||||||
// unlink/re-link it
|
|
||||||
try {
|
|
||||||
yield ioUtil.lstat(destFile);
|
|
||||||
yield ioUtil.unlink(destFile);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
// Try to override file permission
|
|
||||||
if (e.code === 'EPERM') {
|
|
||||||
yield ioUtil.chmod(destFile, '0666');
|
|
||||||
yield ioUtil.unlink(destFile);
|
|
||||||
}
|
|
||||||
// other errors = it doesn't exist, no work to do
|
|
||||||
}
|
|
||||||
// Copy over symlink
|
|
||||||
const symlinkFull = yield ioUtil.readlink(srcFile);
|
|
||||||
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
|
||||||
}
|
|
||||||
else if (!(yield ioUtil.exists(destFile)) || force) {
|
|
||||||
yield ioUtil.copyFile(srcFile, destFile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=io.js.map
|
|
||||||
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
File diff suppressed because one or more lines are too long
60
node_modules/@actions/io/package.json
generated
vendored
60
node_modules/@actions/io/package.json
generated
vendored
@@ -1,60 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "file:toolkit\\actions-io-0.0.0.tgz",
|
|
||||||
"_id": "@actions/io@0.0.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-BZqiiacJkzERkYIMUQWrujLZWSFHEA6bD/LzR7QSDHpx32+PPk7NaUNmt8CG+y+OlYPc/ZZGaY3368K1ppfptA==",
|
|
||||||
"_location": "/@actions/io",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "file",
|
|
||||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"raw": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
|
||||||
"name": "@actions/io",
|
|
||||||
"escapedName": "@actions%2fio",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "file:toolkit/actions-io-0.0.0.tgz",
|
|
||||||
"saveSpec": "file:toolkit\\actions-io-0.0.0.tgz",
|
|
||||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-io-0.0.0.tgz"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
|
||||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-io-0.0.0.tgz",
|
|
||||||
"_shasum": "64c85baec8d8ed889a5fb8e2ef794e36a692eeb8",
|
|
||||||
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
|
||||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions io lib",
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
|
|
||||||
"keywords": [
|
|
||||||
"io",
|
|
||||||
"actions"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/io.js",
|
|
||||||
"name": "@actions/io",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"version": "0.0.0"
|
|
||||||
}
|
|
||||||
7
node_modules/@actions/tool-cache/README.md
generated
vendored
7
node_modules/@actions/tool-cache/README.md
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
# `@actions/tool-cache`
|
|
||||||
|
|
||||||
> Functions necessary for downloading and caching tools.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
See [src/tool-cache.ts](src/tool-cache.ts).
|
|
||||||
78
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
78
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
@@ -1,78 +0,0 @@
|
|||||||
export declare class HTTPError extends Error {
|
|
||||||
readonly httpStatusCode: number | undefined;
|
|
||||||
constructor(httpStatusCode: number | undefined);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Download a tool from an url and stream it into a file
|
|
||||||
*
|
|
||||||
* @param url url of tool to download
|
|
||||||
* @returns path to downloaded tool
|
|
||||||
*/
|
|
||||||
export declare function downloadTool(url: string): Promise<string>;
|
|
||||||
/**
|
|
||||||
* Extract a .7z file
|
|
||||||
*
|
|
||||||
* @param file path to the .7z file
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
|
||||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
|
||||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
|
||||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
|
||||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
|
||||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
|
||||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
|
||||||
* to 7zr.exe can be pass to this function.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
|
||||||
/**
|
|
||||||
* Extract a tar
|
|
||||||
*
|
|
||||||
* @param file path to the tar
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
export declare function extractTar(file: string, dest?: string): Promise<string>;
|
|
||||||
/**
|
|
||||||
* Extract a zip
|
|
||||||
*
|
|
||||||
* @param file path to the zip
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
|
||||||
/**
|
|
||||||
* Caches a directory and installs it into the tool cacheDir
|
|
||||||
*
|
|
||||||
* @param sourceDir the directory to cache into tools
|
|
||||||
* @param tool tool name
|
|
||||||
* @param version version of the tool. semver format
|
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
|
||||||
*/
|
|
||||||
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
|
||||||
/**
|
|
||||||
* Caches a downloaded file (GUID) and installs it
|
|
||||||
* into the tool cache with a given targetName
|
|
||||||
*
|
|
||||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
|
||||||
* @param targetFile the name of the file name in the tools directory
|
|
||||||
* @param tool tool name
|
|
||||||
* @param version version of the tool. semver format
|
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
|
||||||
*/
|
|
||||||
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
|
||||||
/**
|
|
||||||
* Finds the path to a tool version in the local installed tool cache
|
|
||||||
*
|
|
||||||
* @param toolName name of the tool
|
|
||||||
* @param versionSpec version of the tool
|
|
||||||
* @param arch optional arch. defaults to arch of computer
|
|
||||||
*/
|
|
||||||
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
|
||||||
/**
|
|
||||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
|
||||||
*
|
|
||||||
* @param toolName name of the tool
|
|
||||||
* @param arch optional arch. defaults to arch of computer
|
|
||||||
*/
|
|
||||||
export declare function findAllVersions(toolName: string, arch?: string): string[];
|
|
||||||
436
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
436
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
@@ -1,436 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const core = require("@actions/core");
|
|
||||||
const io = require("@actions/io");
|
|
||||||
const fs = require("fs");
|
|
||||||
const os = require("os");
|
|
||||||
const path = require("path");
|
|
||||||
const httpm = require("typed-rest-client/HttpClient");
|
|
||||||
const semver = require("semver");
|
|
||||||
const uuidV4 = require("uuid/v4");
|
|
||||||
const exec_1 = require("@actions/exec/lib/exec");
|
|
||||||
const assert_1 = require("assert");
|
|
||||||
class HTTPError extends Error {
|
|
||||||
constructor(httpStatusCode) {
|
|
||||||
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
|
||||||
this.httpStatusCode = httpStatusCode;
|
|
||||||
Object.setPrototypeOf(this, new.target.prototype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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
|
|
||||||
*
|
|
||||||
* @param url url of tool to download
|
|
||||||
* @returns path to downloaded tool
|
|
||||||
*/
|
|
||||||
function downloadTool(url) {
|
|
||||||
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
|
|
||||||
});
|
|
||||||
const destPath = path.join(tempDirectory, uuidV4());
|
|
||||||
yield io.mkdirP(tempDirectory);
|
|
||||||
core.debug(`Downloading ${url}`);
|
|
||||||
core.debug(`Downloading ${destPath}`);
|
|
||||||
if (fs.existsSync(destPath)) {
|
|
||||||
throw new Error(`Destination file path ${destPath} already exists`);
|
|
||||||
}
|
|
||||||
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(destPath);
|
|
||||||
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(destPath);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.downloadTool = downloadTool;
|
|
||||||
/**
|
|
||||||
* Extract a .7z file
|
|
||||||
*
|
|
||||||
* @param file path to the .7z file
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
|
||||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
|
||||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
|
||||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
|
||||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
|
||||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
|
||||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
|
||||||
* to 7zr.exe can be pass to this function.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
function extract7z(file, dest, _7zPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
|
||||||
assert_1.ok(file, 'parameter "file" is required');
|
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
|
||||||
const originalCwd = process.cwd();
|
|
||||||
process.chdir(dest);
|
|
||||||
if (_7zPath) {
|
|
||||||
try {
|
|
||||||
const args = [
|
|
||||||
'x',
|
|
||||||
'-bb1',
|
|
||||||
'-bd',
|
|
||||||
'-sccUTF-8',
|
|
||||||
file
|
|
||||||
];
|
|
||||||
const options = {
|
|
||||||
silent: true
|
|
||||||
};
|
|
||||||
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
process.chdir(originalCwd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const escapedScript = path
|
|
||||||
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
|
||||||
.replace(/'/g, "''")
|
|
||||||
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
||||||
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
||||||
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
|
||||||
const args = [
|
|
||||||
'-NoLogo',
|
|
||||||
'-Sta',
|
|
||||||
'-NoProfile',
|
|
||||||
'-NonInteractive',
|
|
||||||
'-ExecutionPolicy',
|
|
||||||
'Unrestricted',
|
|
||||||
'-Command',
|
|
||||||
command
|
|
||||||
];
|
|
||||||
const options = {
|
|
||||||
silent: true
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
const powershellPath = yield io.which('powershell', true);
|
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
process.chdir(originalCwd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extract7z = extract7z;
|
|
||||||
/**
|
|
||||||
* Extract a tar
|
|
||||||
*
|
|
||||||
* @param file path to the tar
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
function extractTar(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!file) {
|
|
||||||
throw new Error("parameter 'file' is required");
|
|
||||||
}
|
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
|
||||||
const tarPath = yield io.which('tar', true);
|
|
||||||
yield exec_1.exec(`"${tarPath}"`, ['xzC', dest, '-f', file]);
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extractTar = extractTar;
|
|
||||||
/**
|
|
||||||
* Extract a zip
|
|
||||||
*
|
|
||||||
* @param file path to the zip
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
function extractZip(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!file) {
|
|
||||||
throw new Error("parameter 'file' is required");
|
|
||||||
}
|
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
yield extractZipWin(file, dest);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield extractZipNix(file, dest);
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extractZip = extractZip;
|
|
||||||
function extractZipWin(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// build the powershell command
|
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
|
||||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
||||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
|
||||||
// run powershell
|
|
||||||
const powershellPath = yield io.which('powershell');
|
|
||||||
const args = [
|
|
||||||
'-NoLogo',
|
|
||||||
'-Sta',
|
|
||||||
'-NoProfile',
|
|
||||||
'-NonInteractive',
|
|
||||||
'-ExecutionPolicy',
|
|
||||||
'Unrestricted',
|
|
||||||
'-Command',
|
|
||||||
command
|
|
||||||
];
|
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function extractZipNix(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
|
||||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Caches a directory and installs it into the tool cacheDir
|
|
||||||
*
|
|
||||||
* @param sourceDir the directory to cache into tools
|
|
||||||
* @param tool tool name
|
|
||||||
* @param version version of the tool. semver format
|
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
|
||||||
*/
|
|
||||||
function cacheDir(sourceDir, tool, version, arch) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
version = semver.clean(version) || version;
|
|
||||||
arch = arch || os.arch();
|
|
||||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
|
||||||
core.debug(`source dir: ${sourceDir}`);
|
|
||||||
if (!fs.statSync(sourceDir).isDirectory()) {
|
|
||||||
throw new Error('sourceDir is not a directory');
|
|
||||||
}
|
|
||||||
// Create the tool dir
|
|
||||||
const destPath = yield _createToolPath(tool, version, arch);
|
|
||||||
// copy each child item. do not move. move can fail on Windows
|
|
||||||
// due to anti-virus software having an open handle on a file.
|
|
||||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
|
||||||
const s = path.join(sourceDir, itemName);
|
|
||||||
yield io.cp(s, destPath, { recursive: true });
|
|
||||||
}
|
|
||||||
// write .complete
|
|
||||||
_completeToolPath(tool, version, arch);
|
|
||||||
return destPath;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.cacheDir = cacheDir;
|
|
||||||
/**
|
|
||||||
* Caches a downloaded file (GUID) and installs it
|
|
||||||
* into the tool cache with a given targetName
|
|
||||||
*
|
|
||||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
|
||||||
* @param targetFile the name of the file name in the tools directory
|
|
||||||
* @param tool tool name
|
|
||||||
* @param version version of the tool. semver format
|
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
|
||||||
*/
|
|
||||||
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
version = semver.clean(version) || version;
|
|
||||||
arch = arch || os.arch();
|
|
||||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
|
||||||
core.debug(`source file: ${sourceFile}`);
|
|
||||||
if (!fs.statSync(sourceFile).isFile()) {
|
|
||||||
throw new Error('sourceFile is not a file');
|
|
||||||
}
|
|
||||||
// create the tool dir
|
|
||||||
const destFolder = yield _createToolPath(tool, version, arch);
|
|
||||||
// copy instead of move. move can fail on Windows due to
|
|
||||||
// anti-virus software having an open handle on a file.
|
|
||||||
const destPath = path.join(destFolder, targetFile);
|
|
||||||
core.debug(`destination file ${destPath}`);
|
|
||||||
yield io.cp(sourceFile, destPath);
|
|
||||||
// write .complete
|
|
||||||
_completeToolPath(tool, version, arch);
|
|
||||||
return destFolder;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.cacheFile = cacheFile;
|
|
||||||
/**
|
|
||||||
* Finds the path to a tool version in the local installed tool cache
|
|
||||||
*
|
|
||||||
* @param toolName name of the tool
|
|
||||||
* @param versionSpec version of the tool
|
|
||||||
* @param arch optional arch. defaults to arch of computer
|
|
||||||
*/
|
|
||||||
function find(toolName, versionSpec, arch) {
|
|
||||||
if (!toolName) {
|
|
||||||
throw new Error('toolName parameter is required');
|
|
||||||
}
|
|
||||||
if (!versionSpec) {
|
|
||||||
throw new Error('versionSpec parameter is required');
|
|
||||||
}
|
|
||||||
arch = arch || os.arch();
|
|
||||||
// attempt to resolve an explicit version
|
|
||||||
if (!_isExplicitVersion(versionSpec)) {
|
|
||||||
const localVersions = findAllVersions(toolName, arch);
|
|
||||||
const match = _evaluateVersions(localVersions, versionSpec);
|
|
||||||
versionSpec = match;
|
|
||||||
}
|
|
||||||
// check for the explicit version in the cache
|
|
||||||
let toolPath = '';
|
|
||||||
if (versionSpec) {
|
|
||||||
versionSpec = semver.clean(versionSpec) || '';
|
|
||||||
const cachePath = path.join(cacheRoot, 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}`);
|
|
||||||
toolPath = cachePath;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug('not found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toolPath;
|
|
||||||
}
|
|
||||||
exports.find = find;
|
|
||||||
/**
|
|
||||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
|
||||||
*
|
|
||||||
* @param toolName name of the tool
|
|
||||||
* @param arch optional arch. defaults to arch of computer
|
|
||||||
*/
|
|
||||||
function findAllVersions(toolName, arch) {
|
|
||||||
const versions = [];
|
|
||||||
arch = arch || os.arch();
|
|
||||||
const toolPath = path.join(cacheRoot, toolName);
|
|
||||||
if (fs.existsSync(toolPath)) {
|
|
||||||
const children = fs.readdirSync(toolPath);
|
|
||||||
for (const child of children) {
|
|
||||||
if (_isExplicitVersion(child)) {
|
|
||||||
const fullPath = path.join(toolPath, child, arch || '');
|
|
||||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
|
||||||
versions.push(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return versions;
|
|
||||||
}
|
|
||||||
exports.findAllVersions = findAllVersions;
|
|
||||||
function _createExtractFolder(dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!dest) {
|
|
||||||
// create a temp dir
|
|
||||||
dest = path.join(tempDirectory, uuidV4());
|
|
||||||
}
|
|
||||||
yield io.mkdirP(dest);
|
|
||||||
return 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 || '');
|
|
||||||
core.debug(`destination ${folderPath}`);
|
|
||||||
const markerPath = `${folderPath}.complete`;
|
|
||||||
yield io.rmRF(folderPath);
|
|
||||||
yield io.rmRF(markerPath);
|
|
||||||
yield io.mkdirP(folderPath);
|
|
||||||
return folderPath;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function _completeToolPath(tool, version, arch) {
|
|
||||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
|
||||||
const markerPath = `${folderPath}.complete`;
|
|
||||||
fs.writeFileSync(markerPath, '');
|
|
||||||
core.debug('finished caching tool');
|
|
||||||
}
|
|
||||||
function _isExplicitVersion(versionSpec) {
|
|
||||||
const c = semver.clean(versionSpec) || '';
|
|
||||||
core.debug(`isExplicit: ${c}`);
|
|
||||||
const valid = semver.valid(c) != null;
|
|
||||||
core.debug(`explicit? ${valid}`);
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
function _evaluateVersions(versions, versionSpec) {
|
|
||||||
let version = '';
|
|
||||||
core.debug(`evaluating ${versions.length} versions`);
|
|
||||||
versions = versions.sort((a, b) => {
|
|
||||||
if (semver.gt(a, b)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
|
||||||
const potential = versions[i];
|
|
||||||
const satisfied = semver.satisfies(potential, versionSpec);
|
|
||||||
if (satisfied) {
|
|
||||||
version = potential;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (version) {
|
|
||||||
core.debug(`matched: ${version}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug('match not found');
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=tool-cache.js.map
|
|
||||||
1
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
1
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
File diff suppressed because one or more lines are too long
74
node_modules/@actions/tool-cache/package.json
generated
vendored
74
node_modules/@actions/tool-cache/package.json
generated
vendored
@@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
|
||||||
"_id": "@actions/tool-cache@0.0.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-CCJjXKGfqR34oo1mgKpUk63g3fcoIq+aNJBZ7b73aWGot0ddju2cefJrKjhEun4FI7gYsLYg+ayAUnbFwkGd4Q==",
|
|
||||||
"_location": "/@actions/tool-cache",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "file",
|
|
||||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
|
||||||
"name": "@actions/tool-cache",
|
|
||||||
"escapedName": "@actions%2ftool-cache",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
|
||||||
"saveSpec": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
|
||||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/"
|
|
||||||
],
|
|
||||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
|
||||||
"_shasum": "223a115ab2782ba0a7ad4a0a829030b9cb84eade",
|
|
||||||
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
|
||||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/core": "^0.0.0",
|
|
||||||
"@actions/exec": "^0.0.0",
|
|
||||||
"@actions/io": "^0.0.0",
|
|
||||||
"semver": "^6.1.0",
|
|
||||||
"typed-rest-client": "^1.4.0",
|
|
||||||
"uuid": "^3.3.2"
|
|
||||||
},
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions tool-cache lib",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/nock": "^10.0.3",
|
|
||||||
"@types/semver": "^6.0.0",
|
|
||||||
"@types/uuid": "^3.4.4",
|
|
||||||
"nock": "^10.0.6"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"scripts"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
|
||||||
"keywords": [
|
|
||||||
"exec",
|
|
||||||
"actions"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/tool-cache.js",
|
|
||||||
"name": "@actions/tool-cache",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"version": "0.0.0"
|
|
||||||
}
|
|
||||||
60
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
60
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
@@ -1,60 +0,0 @@
|
|||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Source,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Target)
|
|
||||||
|
|
||||||
# This script translates the output from 7zdec into UTF8. Node has limited
|
|
||||||
# built-in support for encodings.
|
|
||||||
#
|
|
||||||
# 7zdec uses the system default code page. The system default code page varies
|
|
||||||
# depending on the locale configuration. On an en-US box, the system default code
|
|
||||||
# page is Windows-1252.
|
|
||||||
#
|
|
||||||
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
|
||||||
# determine whether data is passed correctly between processes. This is because
|
|
||||||
# the 'ç' character has a different code point across each of the common encodings
|
|
||||||
# on a typical en-US box, i.e.
|
|
||||||
# 1) the default console-output code page (IBM437)
|
|
||||||
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
|
||||||
# 3) UTF8
|
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
|
|
||||||
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
|
||||||
$stdout = [System.Console]::OpenStandardOutput()
|
|
||||||
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
|
||||||
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
|
||||||
[System.Console]::SetOut($writer)
|
|
||||||
|
|
||||||
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
|
||||||
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
|
||||||
|
|
||||||
Set-Location -LiteralPath $Target
|
|
||||||
|
|
||||||
# Print the ##command.
|
|
||||||
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
|
||||||
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
|
||||||
|
|
||||||
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
|
||||||
# from the external command.
|
|
||||||
$OutputEncoding = [System.Text.Encoding]::Default
|
|
||||||
|
|
||||||
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
|
||||||
# will launch the external command in such a way that it inherits the streams.
|
|
||||||
& $_7zdec x $Source 2>&1 |
|
|
||||||
ForEach-Object {
|
|
||||||
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
|
||||||
[System.Console]::WriteLine($_.Exception.Message)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
[System.Console]::WriteLine($_)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
|
||||||
[System.Console]::Out.Flush()
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
exit $LASTEXITCODE
|
|
||||||
}
|
|
||||||
BIN
node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
generated
vendored
BIN
node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
generated
vendored
Binary file not shown.
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip
generated
vendored
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip
generated
vendored
Binary file not shown.
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# @babel/code-frame
|
||||||
|
|
||||||
|
> Generate errors that contain a code frame that point to source locations.
|
||||||
|
|
||||||
|
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/code-frame
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/code-frame --dev
|
||||||
|
```
|
||||||
173
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
173
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.codeFrameColumns = codeFrameColumns;
|
||||||
|
exports.default = _default;
|
||||||
|
|
||||||
|
function _highlight() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/highlight"));
|
||||||
|
|
||||||
|
_highlight = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||||
|
|
||||||
|
let deprecationWarningShown = false;
|
||||||
|
|
||||||
|
function getDefs(chalk) {
|
||||||
|
return {
|
||||||
|
gutter: chalk.grey,
|
||||||
|
marker: chalk.red.bold,
|
||||||
|
message: chalk.red.bold
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||||
|
|
||||||
|
function getMarkerLines(loc, source, opts) {
|
||||||
|
const startLoc = Object.assign({
|
||||||
|
column: 0,
|
||||||
|
line: -1
|
||||||
|
}, loc.start);
|
||||||
|
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||||
|
const {
|
||||||
|
linesAbove = 2,
|
||||||
|
linesBelow = 3
|
||||||
|
} = opts || {};
|
||||||
|
const startLine = startLoc.line;
|
||||||
|
const startColumn = startLoc.column;
|
||||||
|
const endLine = endLoc.line;
|
||||||
|
const endColumn = endLoc.column;
|
||||||
|
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||||
|
let end = Math.min(source.length, endLine + linesBelow);
|
||||||
|
|
||||||
|
if (startLine === -1) {
|
||||||
|
start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endLine === -1) {
|
||||||
|
end = source.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lineDiff = endLine - startLine;
|
||||||
|
const markerLines = {};
|
||||||
|
|
||||||
|
if (lineDiff) {
|
||||||
|
for (let i = 0; i <= lineDiff; i++) {
|
||||||
|
const lineNumber = i + startLine;
|
||||||
|
|
||||||
|
if (!startColumn) {
|
||||||
|
markerLines[lineNumber] = true;
|
||||||
|
} else if (i === 0) {
|
||||||
|
const sourceLength = source[lineNumber - 1].length;
|
||||||
|
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||||
|
} else if (i === lineDiff) {
|
||||||
|
markerLines[lineNumber] = [0, endColumn];
|
||||||
|
} else {
|
||||||
|
const sourceLength = source[lineNumber - i].length;
|
||||||
|
markerLines[lineNumber] = [0, sourceLength];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (startColumn === endColumn) {
|
||||||
|
if (startColumn) {
|
||||||
|
markerLines[startLine] = [startColumn, 0];
|
||||||
|
} else {
|
||||||
|
markerLines[startLine] = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
markerLines
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||||
|
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
|
||||||
|
const chalk = (0, _highlight().getChalk)(opts);
|
||||||
|
const defs = getDefs(chalk);
|
||||||
|
|
||||||
|
const maybeHighlight = (chalkFn, string) => {
|
||||||
|
return highlighted ? chalkFn(string) : string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const lines = rawLines.split(NEWLINE);
|
||||||
|
const {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
markerLines
|
||||||
|
} = getMarkerLines(loc, lines, opts);
|
||||||
|
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||||
|
const numberMaxWidth = String(end).length;
|
||||||
|
const highlightedLines = highlighted ? (0, _highlight().default)(rawLines, opts) : rawLines;
|
||||||
|
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
||||||
|
const number = start + 1 + index;
|
||||||
|
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||||
|
const gutter = ` ${paddedNumber} | `;
|
||||||
|
const hasMarker = markerLines[number];
|
||||||
|
const lastMarkerLine = !markerLines[number + 1];
|
||||||
|
|
||||||
|
if (hasMarker) {
|
||||||
|
let markerLine = "";
|
||||||
|
|
||||||
|
if (Array.isArray(hasMarker)) {
|
||||||
|
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||||
|
const numberOfMarkers = hasMarker[1] || 1;
|
||||||
|
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||||
|
|
||||||
|
if (lastMarkerLine && opts.message) {
|
||||||
|
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
||||||
|
} else {
|
||||||
|
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
||||||
|
}
|
||||||
|
}).join("\n");
|
||||||
|
|
||||||
|
if (opts.message && !hasColumns) {
|
||||||
|
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highlighted) {
|
||||||
|
return chalk.reset(frame);
|
||||||
|
} else {
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
||||||
|
if (!deprecationWarningShown) {
|
||||||
|
deprecationWarningShown = true;
|
||||||
|
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||||
|
|
||||||
|
if (process.emitWarning) {
|
||||||
|
process.emitWarning(message, "DeprecationWarning");
|
||||||
|
} else {
|
||||||
|
const deprecationError = new Error(message);
|
||||||
|
deprecationError.name = "DeprecationWarning";
|
||||||
|
console.warn(new Error(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
colNumber = Math.max(colNumber, 0);
|
||||||
|
const location = {
|
||||||
|
start: {
|
||||||
|
column: colNumber,
|
||||||
|
line: lineNumber
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return codeFrameColumns(rawLines, location, opts);
|
||||||
|
}
|
||||||
61
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
61
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"@babel/code-frame@7.5.5",
|
||||||
|
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_development": true,
|
||||||
|
"_from": "@babel/code-frame@7.5.5",
|
||||||
|
"_id": "@babel/code-frame@7.5.5",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
|
||||||
|
"_location": "/@babel/code-frame",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@babel/code-frame@7.5.5",
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"escapedName": "@babel%2fcode-frame",
|
||||||
|
"scope": "@babel",
|
||||||
|
"rawSpec": "7.5.5",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "7.5.5"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@babel/core",
|
||||||
|
"/@babel/template",
|
||||||
|
"/@babel/traverse",
|
||||||
|
"/jest-message-util",
|
||||||
|
"/read-pkg/parse-json"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
|
||||||
|
"_spec": "7.5.5",
|
||||||
|
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||||
|
"author": {
|
||||||
|
"name": "Sebastian McKenzie",
|
||||||
|
"email": "sebmck@gmail.com"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/highlight": "^7.0.0"
|
||||||
|
},
|
||||||
|
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
||||||
|
"homepage": "https://babeljs.io/",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
|
||||||
|
},
|
||||||
|
"version": "7.5.5"
|
||||||
|
}
|
||||||
22
node_modules/@babel/core/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
19
node_modules/@babel/core/README.md
generated
vendored
Normal file
19
node_modules/@babel/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# @babel/core
|
||||||
|
|
||||||
|
> Babel compiler core.
|
||||||
|
|
||||||
|
See our website [@babel/core](https://babeljs.io/docs/en/next/babel-core.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/core
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/core --dev
|
||||||
|
```
|
||||||
199
node_modules/@babel/core/lib/config/caching.js
generated
vendored
Normal file
199
node_modules/@babel/core/lib/config/caching.js
generated
vendored
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.makeStrongCache = makeStrongCache;
|
||||||
|
exports.makeWeakCache = makeWeakCache;
|
||||||
|
exports.assertSimpleType = assertSimpleType;
|
||||||
|
|
||||||
|
function makeStrongCache(handler) {
|
||||||
|
return makeCachedFunction(new Map(), handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeWeakCache(handler) {
|
||||||
|
return makeCachedFunction(new WeakMap(), handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeCachedFunction(callCache, handler) {
|
||||||
|
return function cachedFunction(arg, data) {
|
||||||
|
let cachedValue = callCache.get(arg);
|
||||||
|
|
||||||
|
if (cachedValue) {
|
||||||
|
for (const _ref of cachedValue) {
|
||||||
|
const {
|
||||||
|
value,
|
||||||
|
valid
|
||||||
|
} = _ref;
|
||||||
|
if (valid(data)) return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cache = new CacheConfigurator(data);
|
||||||
|
const value = handler(arg, cache);
|
||||||
|
if (!cache.configured()) cache.forever();
|
||||||
|
cache.deactivate();
|
||||||
|
|
||||||
|
switch (cache.mode()) {
|
||||||
|
case "forever":
|
||||||
|
cachedValue = [{
|
||||||
|
value,
|
||||||
|
valid: () => true
|
||||||
|
}];
|
||||||
|
callCache.set(arg, cachedValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "invalidate":
|
||||||
|
cachedValue = [{
|
||||||
|
value,
|
||||||
|
valid: cache.validator()
|
||||||
|
}];
|
||||||
|
callCache.set(arg, cachedValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "valid":
|
||||||
|
if (cachedValue) {
|
||||||
|
cachedValue.push({
|
||||||
|
value,
|
||||||
|
valid: cache.validator()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
cachedValue = [{
|
||||||
|
value,
|
||||||
|
valid: cache.validator()
|
||||||
|
}];
|
||||||
|
callCache.set(arg, cachedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class CacheConfigurator {
|
||||||
|
constructor(data) {
|
||||||
|
this._active = true;
|
||||||
|
this._never = false;
|
||||||
|
this._forever = false;
|
||||||
|
this._invalidate = false;
|
||||||
|
this._configured = false;
|
||||||
|
this._pairs = [];
|
||||||
|
this._data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
simple() {
|
||||||
|
return makeSimpleConfigurator(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
mode() {
|
||||||
|
if (this._never) return "never";
|
||||||
|
if (this._forever) return "forever";
|
||||||
|
if (this._invalidate) return "invalidate";
|
||||||
|
return "valid";
|
||||||
|
}
|
||||||
|
|
||||||
|
forever() {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._never) {
|
||||||
|
throw new Error("Caching has already been configured with .never()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._forever = true;
|
||||||
|
this._configured = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
never() {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._forever) {
|
||||||
|
throw new Error("Caching has already been configured with .forever()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._never = true;
|
||||||
|
this._configured = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
using(handler) {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._never || this._forever) {
|
||||||
|
throw new Error("Caching has already been configured with .never or .forever()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._configured = true;
|
||||||
|
const key = handler(this._data);
|
||||||
|
|
||||||
|
this._pairs.push([key, handler]);
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
invalidate(handler) {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._never || this._forever) {
|
||||||
|
throw new Error("Caching has already been configured with .never or .forever()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._invalidate = true;
|
||||||
|
this._configured = true;
|
||||||
|
const key = handler(this._data);
|
||||||
|
|
||||||
|
this._pairs.push([key, handler]);
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
validator() {
|
||||||
|
const pairs = this._pairs;
|
||||||
|
return data => pairs.every(([key, fn]) => key === fn(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
deactivate() {
|
||||||
|
this._active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
configured() {
|
||||||
|
return this._configured;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeSimpleConfigurator(cache) {
|
||||||
|
function cacheFn(val) {
|
||||||
|
if (typeof val === "boolean") {
|
||||||
|
if (val) cache.forever();else cache.never();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache.using(() => assertSimpleType(val()));
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheFn.forever = () => cache.forever();
|
||||||
|
|
||||||
|
cacheFn.never = () => cache.never();
|
||||||
|
|
||||||
|
cacheFn.using = cb => cache.using(() => assertSimpleType(cb()));
|
||||||
|
|
||||||
|
cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb()));
|
||||||
|
|
||||||
|
return cacheFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertSimpleType(value) {
|
||||||
|
if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
|
||||||
|
throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
439
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
Normal file
439
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
Normal file
@@ -0,0 +1,439 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.buildPresetChain = buildPresetChain;
|
||||||
|
exports.buildRootChain = buildRootChain;
|
||||||
|
exports.buildPresetChainWalker = void 0;
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _debug() {
|
||||||
|
const data = _interopRequireDefault(require("debug"));
|
||||||
|
|
||||||
|
_debug = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _options = require("./validation/options");
|
||||||
|
|
||||||
|
var _patternToRegex = _interopRequireDefault(require("./pattern-to-regex"));
|
||||||
|
|
||||||
|
var _files = require("./files");
|
||||||
|
|
||||||
|
var _caching = require("./caching");
|
||||||
|
|
||||||
|
var _configDescriptors = require("./config-descriptors");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const debug = (0, _debug().default)("babel:config:config-chain");
|
||||||
|
|
||||||
|
function buildPresetChain(arg, context) {
|
||||||
|
const chain = buildPresetChainWalker(arg, context);
|
||||||
|
if (!chain) return null;
|
||||||
|
return {
|
||||||
|
plugins: dedupDescriptors(chain.plugins),
|
||||||
|
presets: dedupDescriptors(chain.presets),
|
||||||
|
options: chain.options.map(o => normalizeOptions(o))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildPresetChainWalker = makeChainWalker({
|
||||||
|
init: arg => arg,
|
||||||
|
root: preset => loadPresetDescriptors(preset),
|
||||||
|
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
|
||||||
|
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
|
||||||
|
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName)
|
||||||
|
});
|
||||||
|
exports.buildPresetChainWalker = buildPresetChainWalker;
|
||||||
|
const loadPresetDescriptors = (0, _caching.makeWeakCache)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
|
||||||
|
const loadPresetEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
|
||||||
|
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
|
||||||
|
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||||
|
|
||||||
|
function buildRootChain(opts, context) {
|
||||||
|
const programmaticChain = loadProgrammaticChain({
|
||||||
|
options: opts,
|
||||||
|
dirname: context.cwd
|
||||||
|
}, context);
|
||||||
|
if (!programmaticChain) return null;
|
||||||
|
let configFile;
|
||||||
|
|
||||||
|
if (typeof opts.configFile === "string") {
|
||||||
|
configFile = (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
|
||||||
|
} else if (opts.configFile !== false) {
|
||||||
|
configFile = (0, _files.findRootConfig)(context.root, context.envName, context.caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
babelrc,
|
||||||
|
babelrcRoots
|
||||||
|
} = opts;
|
||||||
|
let babelrcRootsDirectory = context.cwd;
|
||||||
|
const configFileChain = emptyChain();
|
||||||
|
|
||||||
|
if (configFile) {
|
||||||
|
const validatedFile = validateConfigFile(configFile);
|
||||||
|
const result = loadFileChain(validatedFile, context);
|
||||||
|
if (!result) return null;
|
||||||
|
|
||||||
|
if (babelrc === undefined) {
|
||||||
|
babelrc = validatedFile.options.babelrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (babelrcRoots === undefined) {
|
||||||
|
babelrcRootsDirectory = validatedFile.dirname;
|
||||||
|
babelrcRoots = validatedFile.options.babelrcRoots;
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeChain(configFileChain, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
const pkgData = typeof context.filename === "string" ? (0, _files.findPackageData)(context.filename) : null;
|
||||||
|
let ignoreFile, babelrcFile;
|
||||||
|
const fileChain = emptyChain();
|
||||||
|
|
||||||
|
if ((babelrc === true || babelrc === undefined) && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
|
||||||
|
({
|
||||||
|
ignore: ignoreFile,
|
||||||
|
config: babelrcFile
|
||||||
|
} = (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||||
|
|
||||||
|
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (babelrcFile) {
|
||||||
|
const result = loadFileChain(validateBabelrcFile(babelrcFile), context);
|
||||||
|
if (!result) return null;
|
||||||
|
mergeChain(fileChain, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
|
||||||
|
return {
|
||||||
|
plugins: dedupDescriptors(chain.plugins),
|
||||||
|
presets: dedupDescriptors(chain.presets),
|
||||||
|
options: chain.options.map(o => normalizeOptions(o)),
|
||||||
|
ignore: ignoreFile || undefined,
|
||||||
|
babelrc: babelrcFile || undefined,
|
||||||
|
config: configFile || undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) {
|
||||||
|
if (typeof babelrcRoots === "boolean") return babelrcRoots;
|
||||||
|
const absoluteRoot = context.root;
|
||||||
|
|
||||||
|
if (babelrcRoots === undefined) {
|
||||||
|
return pkgData.directories.indexOf(absoluteRoot) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let babelrcPatterns = babelrcRoots;
|
||||||
|
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
|
||||||
|
babelrcPatterns = babelrcPatterns.map(pat => {
|
||||||
|
return typeof pat === "string" ? _path().default.resolve(babelrcRootsDirectory, pat) : pat;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
|
||||||
|
return pkgData.directories.indexOf(absoluteRoot) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return babelrcPatterns.some(pat => {
|
||||||
|
if (typeof pat === "string") {
|
||||||
|
pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkgData.directories.some(directory => {
|
||||||
|
return matchPattern(pat, babelrcRootsDirectory, directory, context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateConfigFile = (0, _caching.makeWeakCache)(file => ({
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: (0, _options.validate)("configfile", file.options)
|
||||||
|
}));
|
||||||
|
const validateBabelrcFile = (0, _caching.makeWeakCache)(file => ({
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: (0, _options.validate)("babelrcfile", file.options)
|
||||||
|
}));
|
||||||
|
const validateExtendFile = (0, _caching.makeWeakCache)(file => ({
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: (0, _options.validate)("extendsfile", file.options)
|
||||||
|
}));
|
||||||
|
const loadProgrammaticChain = makeChainWalker({
|
||||||
|
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
|
||||||
|
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
|
||||||
|
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
|
||||||
|
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName)
|
||||||
|
});
|
||||||
|
const loadFileChain = makeChainWalker({
|
||||||
|
root: file => loadFileDescriptors(file),
|
||||||
|
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
|
||||||
|
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
|
||||||
|
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName)
|
||||||
|
});
|
||||||
|
const loadFileDescriptors = (0, _caching.makeWeakCache)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
|
||||||
|
const loadFileEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
|
||||||
|
const loadFileOverridesDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
|
||||||
|
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||||
|
|
||||||
|
function buildRootDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors) {
|
||||||
|
return descriptors(dirname, options, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildEnvDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors, envName) {
|
||||||
|
const opts = options.env && options.env[envName];
|
||||||
|
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildOverrideDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors, index) {
|
||||||
|
const opts = options.overrides && options.overrides[index];
|
||||||
|
if (!opts) throw new Error("Assertion failure - missing override");
|
||||||
|
return descriptors(dirname, opts, `${alias}.overrides[${index}]`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildOverrideEnvDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors, index, envName) {
|
||||||
|
const override = options.overrides && options.overrides[index];
|
||||||
|
if (!override) throw new Error("Assertion failure - missing override");
|
||||||
|
const opts = override.env && override.env[envName];
|
||||||
|
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeChainWalker({
|
||||||
|
root,
|
||||||
|
env,
|
||||||
|
overrides,
|
||||||
|
overridesEnv
|
||||||
|
}) {
|
||||||
|
return (input, context, files = new Set()) => {
|
||||||
|
const {
|
||||||
|
dirname
|
||||||
|
} = input;
|
||||||
|
const flattenedConfigs = [];
|
||||||
|
const rootOpts = root(input);
|
||||||
|
|
||||||
|
if (configIsApplicable(rootOpts, dirname, context)) {
|
||||||
|
flattenedConfigs.push(rootOpts);
|
||||||
|
const envOpts = env(input, context.envName);
|
||||||
|
|
||||||
|
if (envOpts && configIsApplicable(envOpts, dirname, context)) {
|
||||||
|
flattenedConfigs.push(envOpts);
|
||||||
|
}
|
||||||
|
|
||||||
|
(rootOpts.options.overrides || []).forEach((_, index) => {
|
||||||
|
const overrideOps = overrides(input, index);
|
||||||
|
|
||||||
|
if (configIsApplicable(overrideOps, dirname, context)) {
|
||||||
|
flattenedConfigs.push(overrideOps);
|
||||||
|
const overrideEnvOpts = overridesEnv(input, index, context.envName);
|
||||||
|
|
||||||
|
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {
|
||||||
|
flattenedConfigs.push(overrideEnvOpts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flattenedConfigs.some(({
|
||||||
|
options: {
|
||||||
|
ignore,
|
||||||
|
only
|
||||||
|
}
|
||||||
|
}) => shouldIgnore(context, ignore, only, dirname))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chain = emptyChain();
|
||||||
|
|
||||||
|
for (const op of flattenedConfigs) {
|
||||||
|
if (!mergeExtendsChain(chain, op.options, dirname, context, files)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeChainOpts(chain, op);
|
||||||
|
}
|
||||||
|
|
||||||
|
return chain;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeExtendsChain(chain, opts, dirname, context, files) {
|
||||||
|
if (opts.extends === undefined) return true;
|
||||||
|
const file = (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
|
||||||
|
|
||||||
|
if (files.has(file)) {
|
||||||
|
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
files.add(file);
|
||||||
|
const fileChain = loadFileChain(validateExtendFile(file), context, files);
|
||||||
|
files.delete(file);
|
||||||
|
if (!fileChain) return false;
|
||||||
|
mergeChain(chain, fileChain);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeChain(target, source) {
|
||||||
|
target.options.push(...source.options);
|
||||||
|
target.plugins.push(...source.plugins);
|
||||||
|
target.presets.push(...source.presets);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeChainOpts(target, {
|
||||||
|
options,
|
||||||
|
plugins,
|
||||||
|
presets
|
||||||
|
}) {
|
||||||
|
target.options.push(options);
|
||||||
|
target.plugins.push(...plugins());
|
||||||
|
target.presets.push(...presets());
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
function emptyChain() {
|
||||||
|
return {
|
||||||
|
options: [],
|
||||||
|
presets: [],
|
||||||
|
plugins: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeOptions(opts) {
|
||||||
|
const options = Object.assign({}, opts);
|
||||||
|
delete options.extends;
|
||||||
|
delete options.env;
|
||||||
|
delete options.overrides;
|
||||||
|
delete options.plugins;
|
||||||
|
delete options.presets;
|
||||||
|
delete options.passPerPreset;
|
||||||
|
delete options.ignore;
|
||||||
|
delete options.only;
|
||||||
|
delete options.test;
|
||||||
|
delete options.include;
|
||||||
|
delete options.exclude;
|
||||||
|
|
||||||
|
if (options.hasOwnProperty("sourceMap")) {
|
||||||
|
options.sourceMaps = options.sourceMap;
|
||||||
|
delete options.sourceMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dedupDescriptors(items) {
|
||||||
|
const map = new Map();
|
||||||
|
const descriptors = [];
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
if (typeof item.value === "function") {
|
||||||
|
const fnKey = item.value;
|
||||||
|
let nameMap = map.get(fnKey);
|
||||||
|
|
||||||
|
if (!nameMap) {
|
||||||
|
nameMap = new Map();
|
||||||
|
map.set(fnKey, nameMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
let desc = nameMap.get(item.name);
|
||||||
|
|
||||||
|
if (!desc) {
|
||||||
|
desc = {
|
||||||
|
value: item
|
||||||
|
};
|
||||||
|
descriptors.push(desc);
|
||||||
|
if (!item.ownPass) nameMap.set(item.name, desc);
|
||||||
|
} else {
|
||||||
|
desc.value = item;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
descriptors.push({
|
||||||
|
value: item
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return descriptors.reduce((acc, desc) => {
|
||||||
|
acc.push(desc.value);
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
function configIsApplicable({
|
||||||
|
options
|
||||||
|
}, dirname, context) {
|
||||||
|
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname));
|
||||||
|
}
|
||||||
|
|
||||||
|
function configFieldIsApplicable(context, test, dirname) {
|
||||||
|
const patterns = Array.isArray(test) ? test : [test];
|
||||||
|
return matchesPatterns(context, patterns, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldIgnore(context, ignore, only, dirname) {
|
||||||
|
if (ignore && matchesPatterns(context, ignore, dirname)) {
|
||||||
|
debug("Ignored %o because it matched one of %O from %o", context.filename, ignore, dirname);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (only && !matchesPatterns(context, only, dirname)) {
|
||||||
|
debug("Ignored %o because it failed to match one of %O from %o", context.filename, only, dirname);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesPatterns(context, patterns, dirname) {
|
||||||
|
return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context));
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchPattern(pattern, dirname, pathToTest, context) {
|
||||||
|
if (typeof pattern === "function") {
|
||||||
|
return !!pattern(pathToTest, {
|
||||||
|
dirname,
|
||||||
|
envName: context.envName,
|
||||||
|
caller: context.caller
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof pathToTest !== "string") {
|
||||||
|
throw new Error(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof pattern === "string") {
|
||||||
|
pattern = (0, _patternToRegex.default)(pattern, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pattern.test(pathToTest);
|
||||||
|
}
|
||||||
210
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
Normal file
210
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.createCachedDescriptors = createCachedDescriptors;
|
||||||
|
exports.createUncachedDescriptors = createUncachedDescriptors;
|
||||||
|
exports.createDescriptor = createDescriptor;
|
||||||
|
|
||||||
|
var _files = require("./files");
|
||||||
|
|
||||||
|
var _item = require("./item");
|
||||||
|
|
||||||
|
var _caching = require("./caching");
|
||||||
|
|
||||||
|
function isEqualDescriptor(a, b) {
|
||||||
|
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCachedDescriptors(dirname, options, alias) {
|
||||||
|
const {
|
||||||
|
plugins,
|
||||||
|
presets,
|
||||||
|
passPerPreset
|
||||||
|
} = options;
|
||||||
|
return {
|
||||||
|
options,
|
||||||
|
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [],
|
||||||
|
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createUncachedDescriptors(dirname, options, alias) {
|
||||||
|
let plugins;
|
||||||
|
let presets;
|
||||||
|
return {
|
||||||
|
options,
|
||||||
|
plugins: () => {
|
||||||
|
if (!plugins) {
|
||||||
|
plugins = createPluginDescriptors(options.plugins || [], dirname, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugins;
|
||||||
|
},
|
||||||
|
presets: () => {
|
||||||
|
if (!presets) {
|
||||||
|
presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return presets;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
|
||||||
|
const createCachedPresetDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
|
||||||
|
const dirname = cache.using(dir => dir);
|
||||||
|
return (0, _caching.makeStrongCache)(alias => (0, _caching.makeStrongCache)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
|
||||||
|
});
|
||||||
|
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
|
||||||
|
const createCachedPluginDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
|
||||||
|
const dirname = cache.using(dir => dir);
|
||||||
|
return (0, _caching.makeStrongCache)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
|
||||||
|
});
|
||||||
|
const DEFAULT_OPTIONS = {};
|
||||||
|
|
||||||
|
function loadCachedDescriptor(cache, desc) {
|
||||||
|
const {
|
||||||
|
value,
|
||||||
|
options = DEFAULT_OPTIONS
|
||||||
|
} = desc;
|
||||||
|
if (options === false) return desc;
|
||||||
|
let cacheByOptions = cache.get(value);
|
||||||
|
|
||||||
|
if (!cacheByOptions) {
|
||||||
|
cacheByOptions = new WeakMap();
|
||||||
|
cache.set(value, cacheByOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
let possibilities = cacheByOptions.get(options);
|
||||||
|
|
||||||
|
if (!possibilities) {
|
||||||
|
possibilities = [];
|
||||||
|
cacheByOptions.set(options, possibilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (possibilities.indexOf(desc) === -1) {
|
||||||
|
const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc));
|
||||||
|
|
||||||
|
if (matches.length > 0) {
|
||||||
|
return matches[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
possibilities.push(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPresetDescriptors(items, dirname, alias, passPerPreset) {
|
||||||
|
return createDescriptors("preset", items, dirname, alias, passPerPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPluginDescriptors(items, dirname, alias) {
|
||||||
|
return createDescriptors("plugin", items, dirname, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDescriptors(type, items, dirname, alias, ownPass) {
|
||||||
|
const descriptors = items.map((item, index) => createDescriptor(item, dirname, {
|
||||||
|
type,
|
||||||
|
alias: `${alias}$${index}`,
|
||||||
|
ownPass: !!ownPass
|
||||||
|
}));
|
||||||
|
assertNoDuplicates(descriptors);
|
||||||
|
return descriptors;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDescriptor(pair, dirname, {
|
||||||
|
type,
|
||||||
|
alias,
|
||||||
|
ownPass
|
||||||
|
}) {
|
||||||
|
const desc = (0, _item.getItemDescriptor)(pair);
|
||||||
|
|
||||||
|
if (desc) {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
let name;
|
||||||
|
let options;
|
||||||
|
let value = pair;
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
if (value.length === 3) {
|
||||||
|
[value, options, name] = value;
|
||||||
|
} else {
|
||||||
|
[value, options] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let file = undefined;
|
||||||
|
let filepath = null;
|
||||||
|
|
||||||
|
if (typeof value === "string") {
|
||||||
|
if (typeof type !== "string") {
|
||||||
|
throw new Error("To resolve a string-based item, the type of item must be given");
|
||||||
|
}
|
||||||
|
|
||||||
|
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
|
||||||
|
const request = value;
|
||||||
|
({
|
||||||
|
filepath,
|
||||||
|
value
|
||||||
|
} = resolver(value, dirname));
|
||||||
|
file = {
|
||||||
|
request,
|
||||||
|
resolved: filepath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
throw new Error(`Unexpected falsy value: ${String(value)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === "object" && value.__esModule) {
|
||||||
|
if (value.default) {
|
||||||
|
value = value.default;
|
||||||
|
} else {
|
||||||
|
throw new Error("Must export a default export when using ES6 modules.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value !== "object" && typeof value !== "function") {
|
||||||
|
throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filepath !== null && typeof value === "object" && value) {
|
||||||
|
throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
alias: filepath || alias,
|
||||||
|
value,
|
||||||
|
options,
|
||||||
|
dirname,
|
||||||
|
ownPass,
|
||||||
|
file
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertNoDuplicates(items) {
|
||||||
|
const map = new Map();
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
if (typeof item.value !== "function") continue;
|
||||||
|
let nameMap = map.get(item.value);
|
||||||
|
|
||||||
|
if (!nameMap) {
|
||||||
|
nameMap = new Set();
|
||||||
|
map.set(item.value, nameMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameMap.has(item.name)) {
|
||||||
|
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`].join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
nameMap.add(item.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
323
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
Normal file
323
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
Normal file
@@ -0,0 +1,323 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.findConfigUpwards = findConfigUpwards;
|
||||||
|
exports.findRelativeConfig = findRelativeConfig;
|
||||||
|
exports.findRootConfig = findRootConfig;
|
||||||
|
exports.loadConfig = loadConfig;
|
||||||
|
|
||||||
|
function _debug() {
|
||||||
|
const data = _interopRequireDefault(require("debug"));
|
||||||
|
|
||||||
|
_debug = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fs() {
|
||||||
|
const data = _interopRequireDefault(require("fs"));
|
||||||
|
|
||||||
|
_fs = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _json() {
|
||||||
|
const data = _interopRequireDefault(require("json5"));
|
||||||
|
|
||||||
|
_json = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _resolve() {
|
||||||
|
const data = _interopRequireDefault(require("resolve"));
|
||||||
|
|
||||||
|
_resolve = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _caching = require("../caching");
|
||||||
|
|
||||||
|
var _configApi = _interopRequireDefault(require("../helpers/config-api"));
|
||||||
|
|
||||||
|
var _utils = require("./utils");
|
||||||
|
|
||||||
|
var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const debug = (0, _debug().default)("babel:config:loading:files:configuration");
|
||||||
|
const BABEL_CONFIG_JS_FILENAME = "babel.config.js";
|
||||||
|
const BABELRC_FILENAME = ".babelrc";
|
||||||
|
const BABELRC_JS_FILENAME = ".babelrc.js";
|
||||||
|
const BABELIGNORE_FILENAME = ".babelignore";
|
||||||
|
|
||||||
|
function findConfigUpwards(rootDir) {
|
||||||
|
let dirname = rootDir;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (_fs().default.existsSync(_path().default.join(dirname, BABEL_CONFIG_JS_FILENAME))) {
|
||||||
|
return dirname;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextDir = _path().default.dirname(dirname);
|
||||||
|
|
||||||
|
if (dirname === nextDir) break;
|
||||||
|
dirname = nextDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findRelativeConfig(packageData, envName, caller) {
|
||||||
|
let config = null;
|
||||||
|
let ignore = null;
|
||||||
|
|
||||||
|
const dirname = _path().default.dirname(packageData.filepath);
|
||||||
|
|
||||||
|
for (const loc of packageData.directories) {
|
||||||
|
if (!config) {
|
||||||
|
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce((previousConfig, name) => {
|
||||||
|
const filepath = _path().default.join(loc, name);
|
||||||
|
|
||||||
|
const config = readConfig(filepath, envName, caller);
|
||||||
|
|
||||||
|
if (config && previousConfig) {
|
||||||
|
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${name}\n` + `from ${loc}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config || previousConfig;
|
||||||
|
}, null);
|
||||||
|
const pkgConfig = packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) : null;
|
||||||
|
|
||||||
|
if (pkgConfig) {
|
||||||
|
if (config) {
|
||||||
|
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(pkgConfig.filepath)}#babel\n` + ` - ${_path().default.basename(config.filepath)}\n` + `from ${loc}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
config = pkgConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config) {
|
||||||
|
debug("Found configuration %o from %o.", config.filepath, dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ignore) {
|
||||||
|
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
|
||||||
|
|
||||||
|
ignore = readIgnoreConfig(ignoreLoc);
|
||||||
|
|
||||||
|
if (ignore) {
|
||||||
|
debug("Found ignore %o from %o.", ignore.filepath, dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
config,
|
||||||
|
ignore
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findRootConfig(dirname, envName, caller) {
|
||||||
|
const filepath = _path().default.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
|
||||||
|
|
||||||
|
const conf = readConfig(filepath, envName, caller);
|
||||||
|
|
||||||
|
if (conf) {
|
||||||
|
debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadConfig(name, dirname, envName, caller) {
|
||||||
|
const filepath = _resolve().default.sync(name, {
|
||||||
|
basedir: dirname
|
||||||
|
});
|
||||||
|
|
||||||
|
const conf = readConfig(filepath, envName, caller);
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
|
throw new Error(`Config file ${filepath} contains no configuration data`);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug("Loaded config %o from %o.", name, dirname);
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readConfig(filepath, envName, caller) {
|
||||||
|
return _path().default.extname(filepath) === ".js" ? readConfigJS(filepath, {
|
||||||
|
envName,
|
||||||
|
caller
|
||||||
|
}) : readConfigJSON5(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
const LOADING_CONFIGS = new Set();
|
||||||
|
const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
|
||||||
|
if (!_fs().default.existsSync(filepath)) {
|
||||||
|
cache.forever();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOADING_CONFIGS.has(filepath)) {
|
||||||
|
cache.never();
|
||||||
|
debug("Auto-ignoring usage of config %o.", filepath);
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let options;
|
||||||
|
|
||||||
|
try {
|
||||||
|
LOADING_CONFIGS.add(filepath);
|
||||||
|
|
||||||
|
const configModule = require(filepath);
|
||||||
|
|
||||||
|
options = configModule && configModule.__esModule ? configModule.default || undefined : configModule;
|
||||||
|
} catch (err) {
|
||||||
|
err.message = `${filepath}: Error while loading config - ${err.message}`;
|
||||||
|
throw err;
|
||||||
|
} finally {
|
||||||
|
LOADING_CONFIGS.delete(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof options === "function") {
|
||||||
|
options = options((0, _configApi.default)(cache));
|
||||||
|
if (!cache.configured()) throwConfigError();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
||||||
|
throw new Error(`${filepath}: Configuration should be an exported JavaScript object.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof options.then === "function") {
|
||||||
|
throw new Error(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const packageToBabelConfig = (0, _caching.makeWeakCache)(file => {
|
||||||
|
const babel = file.options["babel"];
|
||||||
|
if (typeof babel === "undefined") return null;
|
||||||
|
|
||||||
|
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
|
||||||
|
throw new Error(`${file.filepath}: .babel property must be an object`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: babel
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||||
|
let options;
|
||||||
|
|
||||||
|
try {
|
||||||
|
options = _json().default.parse(content);
|
||||||
|
} catch (err) {
|
||||||
|
err.message = `${filepath}: Error while parsing config - ${err.message}`;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options) throw new Error(`${filepath}: No config detected`);
|
||||||
|
|
||||||
|
if (typeof options !== "object") {
|
||||||
|
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(options)) {
|
||||||
|
throw new Error(`${filepath}: Expected config object but found array`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||||
|
const ignoreDir = _path().default.dirname(filepath);
|
||||||
|
|
||||||
|
const ignorePatterns = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line);
|
||||||
|
|
||||||
|
for (const pattern of ignorePatterns) {
|
||||||
|
if (pattern[0] === "!") {
|
||||||
|
throw new Error(`Negation of file paths is not supported.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function throwConfigError() {
|
||||||
|
throw new Error(`\
|
||||||
|
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
|
||||||
|
for various types of caching, using the first param of their handler functions:
|
||||||
|
|
||||||
|
module.exports = function(api) {
|
||||||
|
// The API exposes the following:
|
||||||
|
|
||||||
|
// Cache the returned value forever and don't call this function again.
|
||||||
|
api.cache(true);
|
||||||
|
|
||||||
|
// Don't cache at all. Not recommended because it will be very slow.
|
||||||
|
api.cache(false);
|
||||||
|
|
||||||
|
// Cached based on the value of some function. If this function returns a value different from
|
||||||
|
// a previously-encountered value, the plugins will re-evaluate.
|
||||||
|
var env = api.cache(() => process.env.NODE_ENV);
|
||||||
|
|
||||||
|
// If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
|
||||||
|
// any possible NODE_ENV value that might come up during plugin execution.
|
||||||
|
var isProd = api.cache(() => process.env.NODE_ENV === "production");
|
||||||
|
|
||||||
|
// .cache(fn) will perform a linear search though instances to find the matching plugin based
|
||||||
|
// based on previous instantiated plugins. If you want to recreate the plugin and discard the
|
||||||
|
// previous instance whenever something changes, you may use:
|
||||||
|
var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
|
||||||
|
|
||||||
|
// Note, we also expose the following more-verbose versions of the above examples:
|
||||||
|
api.cache.forever(); // api.cache(true)
|
||||||
|
api.cache.never(); // api.cache(false)
|
||||||
|
api.cache.using(fn); // api.cache(fn)
|
||||||
|
|
||||||
|
// Return the value that will be cached.
|
||||||
|
return { };
|
||||||
|
};`);
|
||||||
|
}
|
||||||
59
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
Normal file
59
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.findConfigUpwards = findConfigUpwards;
|
||||||
|
exports.findPackageData = findPackageData;
|
||||||
|
exports.findRelativeConfig = findRelativeConfig;
|
||||||
|
exports.findRootConfig = findRootConfig;
|
||||||
|
exports.loadConfig = loadConfig;
|
||||||
|
exports.resolvePlugin = resolvePlugin;
|
||||||
|
exports.resolvePreset = resolvePreset;
|
||||||
|
exports.loadPlugin = loadPlugin;
|
||||||
|
exports.loadPreset = loadPreset;
|
||||||
|
|
||||||
|
function findConfigUpwards(rootDir) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findPackageData(filepath) {
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
directories: [],
|
||||||
|
pkg: null,
|
||||||
|
isPackage: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findRelativeConfig(pkgData, envName, caller) {
|
||||||
|
return {
|
||||||
|
pkg: null,
|
||||||
|
config: null,
|
||||||
|
ignore: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findRootConfig(dirname, envName, caller) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadConfig(name, dirname, envName, caller) {
|
||||||
|
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePlugin(name, dirname) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePreset(name, dirname) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPlugin(name, dirname) {
|
||||||
|
throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPreset(name, dirname) {
|
||||||
|
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
|
||||||
|
}
|
||||||
67
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
Normal file
67
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findPackageData", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _package.findPackageData;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findConfigUpwards", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.findConfigUpwards;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findRelativeConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.findRelativeConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findRootConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.findRootConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.loadConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolvePlugin", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.resolvePlugin;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolvePreset", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.resolvePreset;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPlugin", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.loadPlugin;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPreset", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.loadPreset;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var _package = require("./package");
|
||||||
|
|
||||||
|
var _configuration = require("./configuration");
|
||||||
|
|
||||||
|
var _plugins = require("./plugins");
|
||||||
|
|
||||||
|
({});
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user