snyk 1.718.0 → 1.722.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/64.index.js +1334 -10
- package/dist/cli/64.index.js.map +1 -1
- package/dist/cli/741.index.js +24 -16
- package/dist/cli/741.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +12 -12
- package/dist/gosrc/resolve-deps.go +557 -2
- package/package.json +2 -2
- package/dist/gosrc/resolver/dirwalk/dirwalk.go +0 -57
- package/dist/gosrc/resolver/graph/graph.go +0 -67
- package/dist/gosrc/resolver/pkg.go +0 -224
- package/dist/gosrc/resolver/resolver.go +0 -218
package/dist/cli/64.index.js
CHANGED
|
@@ -6292,6 +6292,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
6292
6292
|
exports.parseFileContent = void 0;
|
|
6293
6293
|
var YAML = __webpack_require__(6792);
|
|
6294
6294
|
function parseFileContent(fileContent) {
|
|
6295
|
+
// YAML should fail on \/ but the library doesn't: https://snyksec.atlassian.net/browse/CC-1175
|
|
6296
|
+
if (fileContent.includes('\\/')) {
|
|
6297
|
+
throw new Error('Found escape character \\/.');
|
|
6298
|
+
}
|
|
6295
6299
|
// the YAML library can parse both YAML and JSON content, as well as content with singe/multiple YAMLs
|
|
6296
6300
|
// by using this library we don't have to disambiguate between these different contents ourselves
|
|
6297
6301
|
return YAML.parseAllDocuments(fileContent).map(function (doc) {
|
|
@@ -183437,10 +183441,6 @@ function createAssets() {
|
|
|
183437
183441
|
// https://www.npmjs.com/package/pkg#detecting-assets-in-source-code
|
|
183438
183442
|
return [
|
|
183439
183443
|
path.join(__dirname, '../gosrc/resolve-deps.go'),
|
|
183440
|
-
path.join(__dirname, '../gosrc/resolver/pkg.go'),
|
|
183441
|
-
path.join(__dirname, '../gosrc/resolver/resolver.go'),
|
|
183442
|
-
path.join(__dirname, '../gosrc/resolver/dirwalk/dirwalk.go'),
|
|
183443
|
-
path.join(__dirname, '../gosrc/resolver/graph/graph.go'),
|
|
183444
183444
|
];
|
|
183445
183445
|
}
|
|
183446
183446
|
function writeFile(writeFilePath, contents) {
|
|
@@ -183501,7 +183501,7 @@ async function getDependencies(root, targetFile) {
|
|
|
183501
183501
|
}
|
|
183502
183502
|
const args = ['run', goResolveTool, ignorePkgsParam];
|
|
183503
183503
|
debug('executing go deps resolver', { cmd: 'go' + args.join(' ') });
|
|
183504
|
-
const graphStr = await
|
|
183504
|
+
const graphStr = await runGo(args, { cwd: root, env: { GO111MODULE: 'off' } });
|
|
183505
183505
|
tempDirObj.removeCallback();
|
|
183506
183506
|
debug('loading deps resolver graph output to graphlib', { jsonSize: graphStr.length });
|
|
183507
183507
|
const graph = graphlib.json.read(JSON.parse(graphStr));
|
|
@@ -183689,9 +183689,12 @@ async function buildDepGraphFromImportsAndModules(root = '.', targetFile = 'go.m
|
|
|
183689
183689
|
let goDepsOutput;
|
|
183690
183690
|
try {
|
|
183691
183691
|
const goModAbsolutPath = path.resolve(root, path.dirname(targetFile));
|
|
183692
|
-
goDepsOutput = await
|
|
183692
|
+
goDepsOutput = await runGo(['list', '-json', '-deps', './...'], { cwd: goModAbsolutPath });
|
|
183693
183693
|
}
|
|
183694
183694
|
catch (err) {
|
|
183695
|
+
if (/cannot find main module, but found/.test(err)) {
|
|
183696
|
+
return depGraphBuilder.build();
|
|
183697
|
+
}
|
|
183695
183698
|
const userError = new custom_error_1.CustomError(err);
|
|
183696
183699
|
userError.userMessage = "'go list -json -deps ./...' command failed with error: " + userError.message;
|
|
183697
183700
|
throw userError;
|
|
@@ -183721,6 +183724,21 @@ async function buildDepGraphFromImportsAndModules(root = '.', targetFile = 'go.m
|
|
|
183721
183724
|
return depGraphBuilder.build();
|
|
183722
183725
|
}
|
|
183723
183726
|
exports.buildDepGraphFromImportsAndModules = buildDepGraphFromImportsAndModules;
|
|
183727
|
+
async function runGo(args, options, additionalGoCommands = []) {
|
|
183728
|
+
try {
|
|
183729
|
+
return await subProcess.execute('go', args, options);
|
|
183730
|
+
}
|
|
183731
|
+
catch (err) {
|
|
183732
|
+
const [command] = /(go mod download)|(go get [^"]*)/.exec(err) || [];
|
|
183733
|
+
if (command && !additionalGoCommands.includes(command)) {
|
|
183734
|
+
debug('running command:', command);
|
|
183735
|
+
const [_, ...newArgs] = command.split(' ');
|
|
183736
|
+
await subProcess.execute('go', newArgs, options);
|
|
183737
|
+
return runGo(args, options, additionalGoCommands.concat(command));
|
|
183738
|
+
}
|
|
183739
|
+
throw err;
|
|
183740
|
+
}
|
|
183741
|
+
}
|
|
183724
183742
|
function buildGraph(depGraphBuilder, depPackages, packagesByName, currentParent, childrenChain, ancestorsChain) {
|
|
183725
183743
|
var _a;
|
|
183726
183744
|
const depPackagesLen = depPackages.length;
|
|
@@ -183808,9 +183826,12 @@ function execute(command, args, options) {
|
|
|
183808
183826
|
// Even just running `go version > 1.txt` in the terminal produces an empty file.
|
|
183809
183827
|
}
|
|
183810
183828
|
const spawnOptions = { shell: true };
|
|
183811
|
-
if (options
|
|
183829
|
+
if (options === null || options === void 0 ? void 0 : options.cwd) {
|
|
183812
183830
|
spawnOptions.cwd = options.cwd;
|
|
183813
183831
|
}
|
|
183832
|
+
if (options === null || options === void 0 ? void 0 : options.env) {
|
|
183833
|
+
spawnOptions.env = Object.assign(Object.assign({}, process.env), options.env);
|
|
183834
|
+
}
|
|
183814
183835
|
return new Promise((resolve, reject) => {
|
|
183815
183836
|
let stdout = '';
|
|
183816
183837
|
let stderr = '';
|
|
@@ -185084,7 +185105,7 @@ const errors_1 = __webpack_require__(45339);
|
|
|
185084
185105
|
const chalk = __webpack_require__(35337);
|
|
185085
185106
|
const dep_graph_1 = __webpack_require__(71479);
|
|
185086
185107
|
const cli_interface_1 = __webpack_require__(65266);
|
|
185087
|
-
const javaCallGraphBuilder = __webpack_require__(
|
|
185108
|
+
const javaCallGraphBuilder = __webpack_require__(48542);
|
|
185088
185109
|
const gradle_attributes_pretty_1 = __webpack_require__(89173);
|
|
185089
185110
|
const debugModule = __webpack_require__(15158);
|
|
185090
185111
|
// To enable debugging output, use `snyk -d`
|
|
@@ -185662,6 +185683,1227 @@ ${stderr}
|
|
|
185662
185683
|
exports.execute = execute;
|
|
185663
185684
|
//# sourceMappingURL=sub-process.js.map
|
|
185664
185685
|
|
|
185686
|
+
/***/ }),
|
|
185687
|
+
|
|
185688
|
+
/***/ 39533:
|
|
185689
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
185690
|
+
|
|
185691
|
+
"use strict";
|
|
185692
|
+
|
|
185693
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
185694
|
+
exports.buildCallGraph = void 0;
|
|
185695
|
+
const graphlib_1 = __webpack_require__(39322);
|
|
185696
|
+
const class_parsing_1 = __webpack_require__(61914);
|
|
185697
|
+
function getNodeLabel(functionCall, classPerJarMapping) {
|
|
185698
|
+
// com.ibm.wala.FakeRootClass:fakeRootMethod
|
|
185699
|
+
const [className, functionName] = functionCall.split(':');
|
|
185700
|
+
const jarName = classPerJarMapping[className];
|
|
185701
|
+
return {
|
|
185702
|
+
className,
|
|
185703
|
+
functionName,
|
|
185704
|
+
jarName,
|
|
185705
|
+
};
|
|
185706
|
+
}
|
|
185707
|
+
function buildCallGraph(input, classPerJarMapping) {
|
|
185708
|
+
const graph = new graphlib_1.Graph();
|
|
185709
|
+
for (const line of input.trim().split('\n')) {
|
|
185710
|
+
const [caller, callee] = line
|
|
185711
|
+
.trim()
|
|
185712
|
+
.split(' -> ')
|
|
185713
|
+
.map(class_parsing_1.removeParams)
|
|
185714
|
+
.map(class_parsing_1.toFQclassName);
|
|
185715
|
+
graph.setNode(caller, getNodeLabel(caller, classPerJarMapping));
|
|
185716
|
+
graph.setNode(callee, getNodeLabel(callee, classPerJarMapping));
|
|
185717
|
+
graph.setEdge(caller, callee);
|
|
185718
|
+
}
|
|
185719
|
+
return graph;
|
|
185720
|
+
}
|
|
185721
|
+
exports.buildCallGraph = buildCallGraph;
|
|
185722
|
+
//# sourceMappingURL=call-graph.js.map
|
|
185723
|
+
|
|
185724
|
+
/***/ }),
|
|
185725
|
+
|
|
185726
|
+
/***/ 61914:
|
|
185727
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
185728
|
+
|
|
185729
|
+
"use strict";
|
|
185730
|
+
|
|
185731
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
185732
|
+
exports.toFQclassName = exports.removeParams = void 0;
|
|
185733
|
+
function removeParams(functionCall) {
|
|
185734
|
+
// com/ibm/wala/FakeRootClass.fakeRootMethod:()V
|
|
185735
|
+
return functionCall.split(':')[0];
|
|
185736
|
+
}
|
|
185737
|
+
exports.removeParams = removeParams;
|
|
185738
|
+
function toFQclassName(functionCall) {
|
|
185739
|
+
// com/ibm/wala/FakeRootClass.fakeRootMethod -> com.ibm.wala.FakeRootClass:fakeRootMethod
|
|
185740
|
+
return functionCall.replace('.', ':').replace(/\//g, '.');
|
|
185741
|
+
}
|
|
185742
|
+
exports.toFQclassName = toFQclassName;
|
|
185743
|
+
//# sourceMappingURL=class-parsing.js.map
|
|
185744
|
+
|
|
185745
|
+
/***/ }),
|
|
185746
|
+
|
|
185747
|
+
/***/ 1268:
|
|
185748
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
185749
|
+
|
|
185750
|
+
"use strict";
|
|
185751
|
+
|
|
185752
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
185753
|
+
exports.ClassPath = void 0;
|
|
185754
|
+
const path = __webpack_require__(85622);
|
|
185755
|
+
function canonicalize(rawClasspath) {
|
|
185756
|
+
let sanitisedClassPath = rawClasspath.trim();
|
|
185757
|
+
while (sanitisedClassPath.startsWith(path.delimiter)) {
|
|
185758
|
+
sanitisedClassPath = sanitisedClassPath.slice(1);
|
|
185759
|
+
}
|
|
185760
|
+
while (sanitisedClassPath.endsWith(path.delimiter)) {
|
|
185761
|
+
sanitisedClassPath = sanitisedClassPath.slice(0, -1);
|
|
185762
|
+
}
|
|
185763
|
+
return sanitisedClassPath;
|
|
185764
|
+
}
|
|
185765
|
+
class ClassPath {
|
|
185766
|
+
constructor(classPath) {
|
|
185767
|
+
this.value = canonicalize(classPath);
|
|
185768
|
+
}
|
|
185769
|
+
isEmpty() {
|
|
185770
|
+
return this.value.length === 0;
|
|
185771
|
+
}
|
|
185772
|
+
concat(other) {
|
|
185773
|
+
const elements = this.value.split(path.delimiter);
|
|
185774
|
+
const otherElements = other.value.split(path.delimiter);
|
|
185775
|
+
const newElements = Array.from(new Set(elements.concat(otherElements)).values());
|
|
185776
|
+
return new ClassPath(newElements.join(path.delimiter));
|
|
185777
|
+
}
|
|
185778
|
+
toString() {
|
|
185779
|
+
return this.value;
|
|
185780
|
+
}
|
|
185781
|
+
}
|
|
185782
|
+
exports.ClassPath = ClassPath;
|
|
185783
|
+
//# sourceMappingURL=classpath.js.map
|
|
185784
|
+
|
|
185785
|
+
/***/ }),
|
|
185786
|
+
|
|
185787
|
+
/***/ 93506:
|
|
185788
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
185789
|
+
|
|
185790
|
+
"use strict";
|
|
185791
|
+
|
|
185792
|
+
const snykConfig = __webpack_require__(8658);
|
|
185793
|
+
const path = __webpack_require__(85622);
|
|
185794
|
+
const config = snykConfig.loadConfig(path.join(__dirname, '..'));
|
|
185795
|
+
module.exports = config;
|
|
185796
|
+
//# sourceMappingURL=config.js.map
|
|
185797
|
+
|
|
185798
|
+
/***/ }),
|
|
185799
|
+
|
|
185800
|
+
/***/ 13062:
|
|
185801
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
185802
|
+
|
|
185803
|
+
"use strict";
|
|
185804
|
+
|
|
185805
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
185806
|
+
exports.debug = void 0;
|
|
185807
|
+
const debugModule = __webpack_require__(15158);
|
|
185808
|
+
// To enable debugging output, use `snyk -d`
|
|
185809
|
+
function debug(s) {
|
|
185810
|
+
if (process.env.DEBUG) {
|
|
185811
|
+
debugModule.enable(process.env.DEBUG);
|
|
185812
|
+
}
|
|
185813
|
+
return debugModule(`snyk-java-call-graph-builder`)(s);
|
|
185814
|
+
}
|
|
185815
|
+
exports.debug = debug;
|
|
185816
|
+
//# sourceMappingURL=debug.js.map
|
|
185817
|
+
|
|
185818
|
+
/***/ }),
|
|
185819
|
+
|
|
185820
|
+
/***/ 61640:
|
|
185821
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
185822
|
+
|
|
185823
|
+
"use strict";
|
|
185824
|
+
|
|
185825
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
185826
|
+
exports.MalformedModulesSpecError = exports.SubprocessError = exports.SubprocessTimeoutError = exports.MissingTargetFolderError = exports.EmptyClassPathError = exports.ClassPathGenerationError = exports.CallGraphGenerationError = void 0;
|
|
185827
|
+
class CallGraphGenerationError extends Error {
|
|
185828
|
+
constructor(msg, innerError) {
|
|
185829
|
+
super(msg);
|
|
185830
|
+
Object.setPrototypeOf(this, CallGraphGenerationError.prototype);
|
|
185831
|
+
this.innerError = innerError;
|
|
185832
|
+
}
|
|
185833
|
+
}
|
|
185834
|
+
exports.CallGraphGenerationError = CallGraphGenerationError;
|
|
185835
|
+
class ClassPathGenerationError extends Error {
|
|
185836
|
+
constructor(innerError) {
|
|
185837
|
+
super('Class path generation error');
|
|
185838
|
+
this.userMessage = "Could not determine the project's class path. Please contact our support or submit an issue at https://github.com/snyk/java-call-graph-builder/issues. Re-running the command with the `-d` flag will provide useful information for the support engineers.";
|
|
185839
|
+
Object.setPrototypeOf(this, ClassPathGenerationError.prototype);
|
|
185840
|
+
this.innerError = innerError;
|
|
185841
|
+
}
|
|
185842
|
+
}
|
|
185843
|
+
exports.ClassPathGenerationError = ClassPathGenerationError;
|
|
185844
|
+
class EmptyClassPathError extends Error {
|
|
185845
|
+
constructor(command) {
|
|
185846
|
+
super(`The command "${command}" returned an empty class path`);
|
|
185847
|
+
this.userMessage = 'The class path for the project is empty. Please contact our support or submit an issue at https://github.com/snyk/java-call-graph-builder/issues. Re-running the command with the `-d` flag will provide useful information for the support engineers.';
|
|
185848
|
+
Object.setPrototypeOf(this, EmptyClassPathError.prototype);
|
|
185849
|
+
}
|
|
185850
|
+
}
|
|
185851
|
+
exports.EmptyClassPathError = EmptyClassPathError;
|
|
185852
|
+
class MissingTargetFolderError extends Error {
|
|
185853
|
+
constructor(targetPath, packageManager) {
|
|
185854
|
+
super(`Could not find the target folder starting in "${targetPath}"`);
|
|
185855
|
+
this.errorMessagePerPackageManager = {
|
|
185856
|
+
mvn: "Could not find the project's output directory. Please build your project and try again. " +
|
|
185857
|
+
'The reachable vulnerabilities feature only supports the default Maven project layout, ' +
|
|
185858
|
+
"where the output directory is named 'target'.",
|
|
185859
|
+
gradle: "Could not find the project's target folder. Please compile your code and try again.",
|
|
185860
|
+
};
|
|
185861
|
+
Object.setPrototypeOf(this, MissingTargetFolderError.prototype);
|
|
185862
|
+
this.userMessage = this.errorMessagePerPackageManager[packageManager];
|
|
185863
|
+
}
|
|
185864
|
+
}
|
|
185865
|
+
exports.MissingTargetFolderError = MissingTargetFolderError;
|
|
185866
|
+
class SubprocessTimeoutError extends Error {
|
|
185867
|
+
constructor(command, args, timeout) {
|
|
185868
|
+
super(`The command "${command} ${args}" timed out after ${timeout / 1000}s`);
|
|
185869
|
+
this.userMessage = 'Scanning for reachable vulnerabilities took too long. Please use the --reachable-timeout flag to increase the timeout for finding reachable vulnerabilities.';
|
|
185870
|
+
Object.setPrototypeOf(this, SubprocessTimeoutError.prototype);
|
|
185871
|
+
}
|
|
185872
|
+
}
|
|
185873
|
+
exports.SubprocessTimeoutError = SubprocessTimeoutError;
|
|
185874
|
+
class SubprocessError extends Error {
|
|
185875
|
+
constructor(command, args, exitCode, stdError) {
|
|
185876
|
+
super(`The command "${command} ${args}" exited with code ${exitCode}${stdError ? ', Standard Error Output: ' + stdError : ''}`);
|
|
185877
|
+
Object.setPrototypeOf(this, SubprocessError.prototype);
|
|
185878
|
+
}
|
|
185879
|
+
}
|
|
185880
|
+
exports.SubprocessError = SubprocessError;
|
|
185881
|
+
class MalformedModulesSpecError extends Error {
|
|
185882
|
+
constructor(modulesXml) {
|
|
185883
|
+
super(`Malformed modules XML: ${modulesXml}`);
|
|
185884
|
+
Object.setPrototypeOf(this, MalformedModulesSpecError.prototype);
|
|
185885
|
+
}
|
|
185886
|
+
}
|
|
185887
|
+
exports.MalformedModulesSpecError = MalformedModulesSpecError;
|
|
185888
|
+
//# sourceMappingURL=errors.js.map
|
|
185889
|
+
|
|
185890
|
+
/***/ }),
|
|
185891
|
+
|
|
185892
|
+
/***/ 43206:
|
|
185893
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
185894
|
+
|
|
185895
|
+
"use strict";
|
|
185896
|
+
|
|
185897
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
185898
|
+
exports.fetch = exports.JAR_NAME = void 0;
|
|
185899
|
+
const tslib_1 = __webpack_require__(53784);
|
|
185900
|
+
const fs = __webpack_require__(35747);
|
|
185901
|
+
const path = __webpack_require__(85622);
|
|
185902
|
+
const needle = __webpack_require__(64484);
|
|
185903
|
+
const ciInfo = __webpack_require__(65692);
|
|
185904
|
+
const ProgressBar = __webpack_require__(15157);
|
|
185905
|
+
const tempDir = __webpack_require__(21661);
|
|
185906
|
+
const crypto = __webpack_require__(76417);
|
|
185907
|
+
const debug_1 = __webpack_require__(13062);
|
|
185908
|
+
const metrics = __webpack_require__(83549);
|
|
185909
|
+
const promisifedFs = __webpack_require__(47172);
|
|
185910
|
+
exports.JAR_NAME = 'java-call-graph-generator.jar';
|
|
185911
|
+
const LOCAL_PATH = path.join(tempDir, 'call-graph-generator', exports.JAR_NAME);
|
|
185912
|
+
function createProgressBar(total, name) {
|
|
185913
|
+
return new ProgressBar(`downloading ${name} [:bar] :rate/Kbps :percent :etas remaining`, {
|
|
185914
|
+
complete: '=',
|
|
185915
|
+
incomplete: '.',
|
|
185916
|
+
width: 20,
|
|
185917
|
+
total: total / 1000,
|
|
185918
|
+
clear: true,
|
|
185919
|
+
});
|
|
185920
|
+
}
|
|
185921
|
+
function downloadAnalyzer(url, localPath, expectedChecksum) {
|
|
185922
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185923
|
+
return new Promise((resolve, reject) => {
|
|
185924
|
+
const fsStream = fs.createWriteStream(localPath + '.part');
|
|
185925
|
+
try {
|
|
185926
|
+
let progressBar;
|
|
185927
|
+
debug_1.debug(`fetching java graph generator from ${url}`);
|
|
185928
|
+
const req = needle.get(url);
|
|
185929
|
+
let matchChecksum;
|
|
185930
|
+
let hasError = false;
|
|
185931
|
+
// TODO: Try pump (https://www.npmjs.com/package/pump) for more organised flow
|
|
185932
|
+
req
|
|
185933
|
+
.on('response', (res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185934
|
+
if (res.statusCode >= 400) {
|
|
185935
|
+
const err = new Error('Bad HTTP response for snyk-call-graph-generator download');
|
|
185936
|
+
// TODO: add custom error for status code => err.statusCode = res.statusCode;
|
|
185937
|
+
fsStream.destroy();
|
|
185938
|
+
hasError = true;
|
|
185939
|
+
return reject(err);
|
|
185940
|
+
}
|
|
185941
|
+
matchChecksum = verifyChecksum(req, expectedChecksum);
|
|
185942
|
+
debug_1.debug(`downloading ${exports.JAR_NAME} ...`);
|
|
185943
|
+
if (!ciInfo.isCI) {
|
|
185944
|
+
const total = parseInt(res.headers['content-length'], 10);
|
|
185945
|
+
progressBar = createProgressBar(total, exports.JAR_NAME);
|
|
185946
|
+
}
|
|
185947
|
+
}))
|
|
185948
|
+
.on('data', (chunk) => {
|
|
185949
|
+
if (progressBar) {
|
|
185950
|
+
progressBar.tick(chunk.length / 1000);
|
|
185951
|
+
}
|
|
185952
|
+
})
|
|
185953
|
+
.on('error', (err) => {
|
|
185954
|
+
return reject(err);
|
|
185955
|
+
})
|
|
185956
|
+
.pipe(fsStream)
|
|
185957
|
+
.on('error', (err) => {
|
|
185958
|
+
fsStream.destroy();
|
|
185959
|
+
return reject(err);
|
|
185960
|
+
})
|
|
185961
|
+
.on('finish', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185962
|
+
if (hasError) {
|
|
185963
|
+
yield promisifedFs.unlink(localPath + '.part');
|
|
185964
|
+
}
|
|
185965
|
+
else {
|
|
185966
|
+
if (!(yield matchChecksum)) {
|
|
185967
|
+
return reject(new Error('Wrong checksum of downloaded call-graph-generator.'));
|
|
185968
|
+
}
|
|
185969
|
+
yield promisifedFs.rename(localPath + '.part', localPath);
|
|
185970
|
+
resolve(localPath);
|
|
185971
|
+
}
|
|
185972
|
+
}));
|
|
185973
|
+
}
|
|
185974
|
+
catch (err) {
|
|
185975
|
+
reject(err);
|
|
185976
|
+
}
|
|
185977
|
+
});
|
|
185978
|
+
});
|
|
185979
|
+
}
|
|
185980
|
+
function verifyChecksum(localPathStream, expectedChecksum) {
|
|
185981
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185982
|
+
return new Promise((resolve, reject) => {
|
|
185983
|
+
const hash = crypto.createHash('sha256');
|
|
185984
|
+
localPathStream
|
|
185985
|
+
.on('error', reject)
|
|
185986
|
+
.on('data', (chunk) => {
|
|
185987
|
+
hash.update(chunk);
|
|
185988
|
+
})
|
|
185989
|
+
.on('end', () => {
|
|
185990
|
+
resolve(hash.digest('hex') === expectedChecksum);
|
|
185991
|
+
});
|
|
185992
|
+
});
|
|
185993
|
+
});
|
|
185994
|
+
}
|
|
185995
|
+
function fetch(url, expectedChecksum) {
|
|
185996
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185997
|
+
const localPath = LOCAL_PATH;
|
|
185998
|
+
if (yield promisifedFs.exists(localPath)) {
|
|
185999
|
+
if (yield verifyChecksum(fs.createReadStream(localPath), expectedChecksum)) {
|
|
186000
|
+
return localPath;
|
|
186001
|
+
}
|
|
186002
|
+
debug_1.debug(`new version of ${exports.JAR_NAME} available`);
|
|
186003
|
+
}
|
|
186004
|
+
if (!(yield promisifedFs.exists(path.dirname(localPath)))) {
|
|
186005
|
+
yield promisifedFs.mkdir(path.dirname(localPath));
|
|
186006
|
+
}
|
|
186007
|
+
return yield metrics.timeIt('fetchCallGraphBuilder', () => downloadAnalyzer(url, localPath, expectedChecksum));
|
|
186008
|
+
});
|
|
186009
|
+
}
|
|
186010
|
+
exports.fetch = fetch;
|
|
186011
|
+
//# sourceMappingURL=fetch-snyk-java-call-graph-generator.js.map
|
|
186012
|
+
|
|
186013
|
+
/***/ }),
|
|
186014
|
+
|
|
186015
|
+
/***/ 61942:
|
|
186016
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186017
|
+
|
|
186018
|
+
"use strict";
|
|
186019
|
+
|
|
186020
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186021
|
+
exports.getClassPathFromGradle = exports.getGradleCommandArgs = void 0;
|
|
186022
|
+
const tslib_1 = __webpack_require__(53784);
|
|
186023
|
+
__webpack_require__(20406);
|
|
186024
|
+
const sub_process_1 = __webpack_require__(79838);
|
|
186025
|
+
const path = __webpack_require__(85622);
|
|
186026
|
+
const os_1 = __webpack_require__(12087);
|
|
186027
|
+
const errors_1 = __webpack_require__(61640);
|
|
186028
|
+
const fs = __webpack_require__(35747);
|
|
186029
|
+
const tmp = __webpack_require__(84688);
|
|
186030
|
+
function getGradleCommandArgs(targetPath, initScript, confAttrs) {
|
|
186031
|
+
// For binary releases, the original file would be in the binary build and inaccesible
|
|
186032
|
+
const originalPath = path.join(__dirname, ...'../bin/init.gradle'.split('/'));
|
|
186033
|
+
const tmpFilePath = tmp.fileSync().name;
|
|
186034
|
+
fs.copyFileSync(originalPath, tmpFilePath);
|
|
186035
|
+
const gradleArgs = ['printClasspath', '-I', tmpFilePath, '-q'];
|
|
186036
|
+
if (targetPath) {
|
|
186037
|
+
gradleArgs.push('-p', targetPath);
|
|
186038
|
+
}
|
|
186039
|
+
if (initScript) {
|
|
186040
|
+
gradleArgs.push('--init-script', initScript);
|
|
186041
|
+
}
|
|
186042
|
+
if (confAttrs) {
|
|
186043
|
+
const isWin = /^win/.test(os_1.platform());
|
|
186044
|
+
const quot = isWin ? '"' : "'";
|
|
186045
|
+
gradleArgs.push(`-PconfAttrs=${quot}${confAttrs}${quot}`);
|
|
186046
|
+
}
|
|
186047
|
+
return gradleArgs;
|
|
186048
|
+
}
|
|
186049
|
+
exports.getGradleCommandArgs = getGradleCommandArgs;
|
|
186050
|
+
function getClassPathFromGradle(targetPath, gradlePath, initScript, confAttrs) {
|
|
186051
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186052
|
+
const args = getGradleCommandArgs(targetPath, initScript, confAttrs);
|
|
186053
|
+
try {
|
|
186054
|
+
const output = yield sub_process_1.execute(gradlePath, args, { cwd: targetPath });
|
|
186055
|
+
const lines = output.trim().split(os_1.EOL);
|
|
186056
|
+
const lastLine = lines[lines.length - 1];
|
|
186057
|
+
return lastLine.trim();
|
|
186058
|
+
}
|
|
186059
|
+
catch (e) {
|
|
186060
|
+
console.log(e);
|
|
186061
|
+
throw new errors_1.ClassPathGenerationError(e);
|
|
186062
|
+
}
|
|
186063
|
+
});
|
|
186064
|
+
}
|
|
186065
|
+
exports.getClassPathFromGradle = getClassPathFromGradle;
|
|
186066
|
+
//# sourceMappingURL=gradle-wrapper.js.map
|
|
186067
|
+
|
|
186068
|
+
/***/ }),
|
|
186069
|
+
|
|
186070
|
+
/***/ 48542:
|
|
186071
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186072
|
+
|
|
186073
|
+
"use strict";
|
|
186074
|
+
|
|
186075
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186076
|
+
exports.findBuildDirs = exports.runtimeMetrics = exports.getCallGraphGradle = exports.getCallGraphMvn = exports.getCallGraphMvnLegacy = void 0;
|
|
186077
|
+
const tslib_1 = __webpack_require__(53784);
|
|
186078
|
+
__webpack_require__(20406);
|
|
186079
|
+
const mvn_wrapper_legacy_1 = __webpack_require__(42519);
|
|
186080
|
+
const gradle_wrapper_1 = __webpack_require__(61942);
|
|
186081
|
+
const java_wrapper_1 = __webpack_require__(60621);
|
|
186082
|
+
const metrics_1 = __webpack_require__(83549);
|
|
186083
|
+
const errors_1 = __webpack_require__(61640);
|
|
186084
|
+
const promisified_fs_glob_1 = __webpack_require__(47172);
|
|
186085
|
+
const path = __webpack_require__(85622);
|
|
186086
|
+
const mvn_wrapper_1 = __webpack_require__(384);
|
|
186087
|
+
const debug_1 = __webpack_require__(13062);
|
|
186088
|
+
const tmp = __webpack_require__(84688);
|
|
186089
|
+
tmp.setGracefulCleanup();
|
|
186090
|
+
function getCallGraphMvnLegacy(targetPath, timeout, customMavenArgs) {
|
|
186091
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186092
|
+
try {
|
|
186093
|
+
const [classPath, targets] = yield Promise.all([
|
|
186094
|
+
metrics_1.timeIt('getMvnClassPath', () => mvn_wrapper_legacy_1.getClassPathFromMvn(targetPath, customMavenArgs)),
|
|
186095
|
+
metrics_1.timeIt('getEntrypoints', () => findBuildDirs(targetPath, 'mvn')),
|
|
186096
|
+
]);
|
|
186097
|
+
return yield metrics_1.timeIt('getCallGraph', () => java_wrapper_1.getCallGraph(classPath, targetPath, targets, timeout));
|
|
186098
|
+
}
|
|
186099
|
+
catch (e) {
|
|
186100
|
+
throw new errors_1.CallGraphGenerationError(e.userMessage ||
|
|
186101
|
+
'Failed to scan for reachable vulnerabilities. Please contact our support or submit an issue at https://github.com/snyk/java-call-graph-builder/issues. Re-running the command with the `-d` flag will provide useful information for the support engineers.', e);
|
|
186102
|
+
}
|
|
186103
|
+
});
|
|
186104
|
+
}
|
|
186105
|
+
exports.getCallGraphMvnLegacy = getCallGraphMvnLegacy;
|
|
186106
|
+
function getCallGraphMvn(targetPath, timeout, customMavenArgs) {
|
|
186107
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186108
|
+
try {
|
|
186109
|
+
const project = yield mvn_wrapper_1.makeMavenProject(targetPath, customMavenArgs);
|
|
186110
|
+
const classPath = project.getClassPath();
|
|
186111
|
+
const buildDirectories = yield Promise.all(project.modules.map((m) => m.buildDirectory));
|
|
186112
|
+
return yield metrics_1.timeIt('getCallGraph', () => java_wrapper_1.getCallGraph(classPath, targetPath, buildDirectories, timeout));
|
|
186113
|
+
}
|
|
186114
|
+
catch (e) {
|
|
186115
|
+
debug_1.debug(`Failed to get the call graph for the Maven project in: ${targetPath}. ' +
|
|
186116
|
+
'Falling back to the legacy method.`);
|
|
186117
|
+
return getCallGraphMvnLegacy(targetPath, timeout, customMavenArgs);
|
|
186118
|
+
}
|
|
186119
|
+
});
|
|
186120
|
+
}
|
|
186121
|
+
exports.getCallGraphMvn = getCallGraphMvn;
|
|
186122
|
+
function getCallGraphGradle(targetPath, gradlePath = 'gradle', initScript, confAttrs, timeout) {
|
|
186123
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186124
|
+
const [classPath, targets] = yield Promise.all([
|
|
186125
|
+
metrics_1.timeIt('getGradleClassPath', () => gradle_wrapper_1.getClassPathFromGradle(targetPath, gradlePath, initScript, confAttrs)),
|
|
186126
|
+
metrics_1.timeIt('getEntrypoints', () => findBuildDirs(targetPath, 'gradle')),
|
|
186127
|
+
]);
|
|
186128
|
+
debug_1.debug(`got class path: ${classPath}`);
|
|
186129
|
+
debug_1.debug(`got targets: ${targets}`);
|
|
186130
|
+
return yield metrics_1.timeIt('getCallGraph', () => java_wrapper_1.getCallGraph(classPath, targetPath, targets, timeout));
|
|
186131
|
+
});
|
|
186132
|
+
}
|
|
186133
|
+
exports.getCallGraphGradle = getCallGraphGradle;
|
|
186134
|
+
function runtimeMetrics() {
|
|
186135
|
+
return metrics_1.getMetrics();
|
|
186136
|
+
}
|
|
186137
|
+
exports.runtimeMetrics = runtimeMetrics;
|
|
186138
|
+
function findBuildDirs(targetPath, packageManager) {
|
|
186139
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186140
|
+
const targetFoldersByPackageManager = {
|
|
186141
|
+
mvn: 'target',
|
|
186142
|
+
gradle: 'build',
|
|
186143
|
+
};
|
|
186144
|
+
const targetDirs = yield promisified_fs_glob_1.glob(path.join(targetPath, `**/${targetFoldersByPackageManager[packageManager]}`));
|
|
186145
|
+
if (!targetDirs.length) {
|
|
186146
|
+
throw new errors_1.MissingTargetFolderError(targetPath, packageManager);
|
|
186147
|
+
}
|
|
186148
|
+
return targetDirs;
|
|
186149
|
+
});
|
|
186150
|
+
}
|
|
186151
|
+
exports.findBuildDirs = findBuildDirs;
|
|
186152
|
+
//# sourceMappingURL=index.js.map
|
|
186153
|
+
|
|
186154
|
+
/***/ }),
|
|
186155
|
+
|
|
186156
|
+
/***/ 60621:
|
|
186157
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186158
|
+
|
|
186159
|
+
"use strict";
|
|
186160
|
+
|
|
186161
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186162
|
+
exports.getCallGraph = exports.getClassPerJarMapping = exports.getCallGraphGenCommandArgs = void 0;
|
|
186163
|
+
const tslib_1 = __webpack_require__(53784);
|
|
186164
|
+
__webpack_require__(20406);
|
|
186165
|
+
const jszip = __webpack_require__(66085);
|
|
186166
|
+
const path = __webpack_require__(85622);
|
|
186167
|
+
const config = __webpack_require__(93506);
|
|
186168
|
+
const sub_process_1 = __webpack_require__(79838);
|
|
186169
|
+
const fetch_snyk_java_call_graph_generator_1 = __webpack_require__(43206);
|
|
186170
|
+
const call_graph_1 = __webpack_require__(39533);
|
|
186171
|
+
const promisifedFs = __webpack_require__(47172);
|
|
186172
|
+
const promisified_fs_glob_1 = __webpack_require__(47172);
|
|
186173
|
+
const class_parsing_1 = __webpack_require__(61914);
|
|
186174
|
+
const metrics_1 = __webpack_require__(83549);
|
|
186175
|
+
const tempDir = __webpack_require__(21661);
|
|
186176
|
+
function getCallGraphGenCommandArgs(classPath, jarPath, targets) {
|
|
186177
|
+
return [
|
|
186178
|
+
'-cp',
|
|
186179
|
+
jarPath,
|
|
186180
|
+
'io.snyk.callgraph.app.App',
|
|
186181
|
+
'--application-classpath-file',
|
|
186182
|
+
classPath,
|
|
186183
|
+
'--dirs-to-get-entrypoints',
|
|
186184
|
+
targets.join(','),
|
|
186185
|
+
];
|
|
186186
|
+
}
|
|
186187
|
+
exports.getCallGraphGenCommandArgs = getCallGraphGenCommandArgs;
|
|
186188
|
+
function getClassPerJarMapping(classPath) {
|
|
186189
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186190
|
+
const classPerJarMapping = {};
|
|
186191
|
+
for (const classPathItem of classPath.split(path.delimiter)) {
|
|
186192
|
+
// classpath can also contain local directories with classes - we don't need them for package mapping
|
|
186193
|
+
if (!classPathItem.endsWith('.jar')) {
|
|
186194
|
+
continue;
|
|
186195
|
+
}
|
|
186196
|
+
const jarFileContent = yield promisified_fs_glob_1.readFile(classPathItem);
|
|
186197
|
+
const jarContent = yield jszip.loadAsync(jarFileContent);
|
|
186198
|
+
for (const classFile of Object.keys(jarContent.files).filter((name) => name.endsWith('.class'))) {
|
|
186199
|
+
const className = class_parsing_1.toFQclassName(classFile.replace('.class', '')); // removing .class from name
|
|
186200
|
+
classPerJarMapping[className] = classPathItem;
|
|
186201
|
+
}
|
|
186202
|
+
}
|
|
186203
|
+
return classPerJarMapping;
|
|
186204
|
+
});
|
|
186205
|
+
}
|
|
186206
|
+
exports.getClassPerJarMapping = getClassPerJarMapping;
|
|
186207
|
+
function getCallGraph(classPath, targetPath, targets, timeout) {
|
|
186208
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186209
|
+
const [jarPath, { tmpDir, classPathFile }] = yield Promise.all([
|
|
186210
|
+
fetch_snyk_java_call_graph_generator_1.fetch(config.CALL_GRAPH_GENERATOR_URL, config.CALL_GRAPH_GENERATOR_CHECKSUM),
|
|
186211
|
+
writeClassPathToTempDir(classPath),
|
|
186212
|
+
]);
|
|
186213
|
+
const callgraphGenCommandArgs = getCallGraphGenCommandArgs(classPathFile, jarPath, targets);
|
|
186214
|
+
try {
|
|
186215
|
+
const [javaOutput, classPerJarMapping] = yield Promise.all([
|
|
186216
|
+
metrics_1.timeIt('generateCallGraph', () => sub_process_1.execute('java', callgraphGenCommandArgs, {
|
|
186217
|
+
cwd: targetPath,
|
|
186218
|
+
timeout,
|
|
186219
|
+
})),
|
|
186220
|
+
metrics_1.timeIt('mapClassesPerJar', () => getClassPerJarMapping(classPath)),
|
|
186221
|
+
]);
|
|
186222
|
+
return call_graph_1.buildCallGraph(javaOutput, classPerJarMapping);
|
|
186223
|
+
}
|
|
186224
|
+
finally {
|
|
186225
|
+
// Fire and forget - we don't have to wait for a deletion of a temporary file
|
|
186226
|
+
cleanupTempDir(classPathFile, tmpDir);
|
|
186227
|
+
}
|
|
186228
|
+
});
|
|
186229
|
+
}
|
|
186230
|
+
exports.getCallGraph = getCallGraph;
|
|
186231
|
+
function writeClassPathToTempDir(classPath) {
|
|
186232
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186233
|
+
const tmpDir = yield promisifedFs.mkdtemp(path.join(tempDir, 'call-graph-generator'));
|
|
186234
|
+
const classPathFile = path.join(tmpDir, 'callgraph-classpath');
|
|
186235
|
+
yield promisifedFs.writeFile(classPathFile, classPath);
|
|
186236
|
+
return { tmpDir, classPathFile };
|
|
186237
|
+
});
|
|
186238
|
+
}
|
|
186239
|
+
function cleanupTempDir(classPathFile, tmpDir) {
|
|
186240
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186241
|
+
try {
|
|
186242
|
+
yield promisifedFs.unlink(classPathFile);
|
|
186243
|
+
yield promisifedFs.rmdir(tmpDir);
|
|
186244
|
+
}
|
|
186245
|
+
catch (_a) {
|
|
186246
|
+
// we couldn't delete temporary data in temporary folder, no big deal
|
|
186247
|
+
}
|
|
186248
|
+
});
|
|
186249
|
+
}
|
|
186250
|
+
//# sourceMappingURL=java-wrapper.js.map
|
|
186251
|
+
|
|
186252
|
+
/***/ }),
|
|
186253
|
+
|
|
186254
|
+
/***/ 83549:
|
|
186255
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186256
|
+
|
|
186257
|
+
"use strict";
|
|
186258
|
+
|
|
186259
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186260
|
+
exports.getMetrics = exports.timeIt = void 0;
|
|
186261
|
+
const tslib_1 = __webpack_require__(53784);
|
|
186262
|
+
const metricsState = {
|
|
186263
|
+
getEntrypoints: { seconds: 0, nanoseconds: 0 },
|
|
186264
|
+
generateCallGraph: { seconds: 0, nanoseconds: 0 },
|
|
186265
|
+
mapClassesPerJar: { seconds: 0, nanoseconds: 0 },
|
|
186266
|
+
getCallGraph: { seconds: 0, nanoseconds: 0 },
|
|
186267
|
+
};
|
|
186268
|
+
function start(metric) {
|
|
186269
|
+
const [secs, nsecs] = process.hrtime();
|
|
186270
|
+
metricsState[metric] = { seconds: secs, nanoseconds: nsecs };
|
|
186271
|
+
}
|
|
186272
|
+
function stop(metric) {
|
|
186273
|
+
const { seconds, nanoseconds } = metricsState[metric] || {
|
|
186274
|
+
seconds: 0,
|
|
186275
|
+
nanoseconds: 0,
|
|
186276
|
+
};
|
|
186277
|
+
const [secs, nsecs] = process.hrtime([seconds, nanoseconds]);
|
|
186278
|
+
metricsState[metric] = { seconds: secs, nanoseconds: nsecs };
|
|
186279
|
+
}
|
|
186280
|
+
function getMetrics() {
|
|
186281
|
+
const metrics = {};
|
|
186282
|
+
for (const [metric, value] of Object.entries(metricsState)) {
|
|
186283
|
+
if (!value) {
|
|
186284
|
+
continue;
|
|
186285
|
+
}
|
|
186286
|
+
const { seconds, nanoseconds } = value;
|
|
186287
|
+
metrics[metric] = seconds + nanoseconds / 1e9;
|
|
186288
|
+
}
|
|
186289
|
+
return metrics;
|
|
186290
|
+
}
|
|
186291
|
+
exports.getMetrics = getMetrics;
|
|
186292
|
+
function timeIt(metric, fn) {
|
|
186293
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186294
|
+
start(metric);
|
|
186295
|
+
const x = yield fn();
|
|
186296
|
+
stop(metric);
|
|
186297
|
+
return x;
|
|
186298
|
+
});
|
|
186299
|
+
}
|
|
186300
|
+
exports.timeIt = timeIt;
|
|
186301
|
+
//# sourceMappingURL=metrics.js.map
|
|
186302
|
+
|
|
186303
|
+
/***/ }),
|
|
186304
|
+
|
|
186305
|
+
/***/ 42519:
|
|
186306
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186307
|
+
|
|
186308
|
+
"use strict";
|
|
186309
|
+
|
|
186310
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186311
|
+
exports.getClassPathFromMvn = exports.mergeMvnClassPaths = exports.parseMvnExecCommandOutput = exports.parseMvnDependencyPluginCommandOutput = exports.getMvnCommandArgsForMvnExec = void 0;
|
|
186312
|
+
const tslib_1 = __webpack_require__(53784);
|
|
186313
|
+
__webpack_require__(20406);
|
|
186314
|
+
const sub_process_1 = __webpack_require__(79838);
|
|
186315
|
+
const errors_1 = __webpack_require__(61640);
|
|
186316
|
+
const path = __webpack_require__(85622);
|
|
186317
|
+
const os = __webpack_require__(12087);
|
|
186318
|
+
function getMvnCommandArgsForMvnExec(targetPath) {
|
|
186319
|
+
return process.platform === 'win32'
|
|
186320
|
+
? [
|
|
186321
|
+
'-q',
|
|
186322
|
+
'exec:exec',
|
|
186323
|
+
'-Dexec.classpathScope="compile"',
|
|
186324
|
+
'-Dexec.executable="cmd"',
|
|
186325
|
+
'-Dexec.args="/c echo %classpath"',
|
|
186326
|
+
'-f',
|
|
186327
|
+
targetPath,
|
|
186328
|
+
]
|
|
186329
|
+
: [
|
|
186330
|
+
'-q',
|
|
186331
|
+
'exec:exec',
|
|
186332
|
+
'-Dexec.classpathScope="compile"',
|
|
186333
|
+
'-Dexec.executable="echo"',
|
|
186334
|
+
'-Dexec.args="%classpath"',
|
|
186335
|
+
'-f',
|
|
186336
|
+
targetPath,
|
|
186337
|
+
];
|
|
186338
|
+
}
|
|
186339
|
+
exports.getMvnCommandArgsForMvnExec = getMvnCommandArgsForMvnExec;
|
|
186340
|
+
function getMvnCommandArgsForDependencyPlugin(targetPath) {
|
|
186341
|
+
return ['dependency:build-classpath', '-f', targetPath];
|
|
186342
|
+
}
|
|
186343
|
+
function parseMvnDependencyPluginCommandOutput(mvnCommandOutput) {
|
|
186344
|
+
const outputLines = mvnCommandOutput.split(os.EOL);
|
|
186345
|
+
const uniqueClassPaths = new Set();
|
|
186346
|
+
let startIndex = 0;
|
|
186347
|
+
let i = outputLines.indexOf('[INFO] Dependencies classpath:', startIndex);
|
|
186348
|
+
while (i > -1) {
|
|
186349
|
+
if (outputLines[i + 1] !== '') {
|
|
186350
|
+
uniqueClassPaths.add(outputLines[i + 1]);
|
|
186351
|
+
}
|
|
186352
|
+
startIndex = i + 2;
|
|
186353
|
+
i = outputLines.indexOf('[INFO] Dependencies classpath:', startIndex);
|
|
186354
|
+
}
|
|
186355
|
+
return Array.from(uniqueClassPaths.values()).sort();
|
|
186356
|
+
}
|
|
186357
|
+
exports.parseMvnDependencyPluginCommandOutput = parseMvnDependencyPluginCommandOutput;
|
|
186358
|
+
function parseMvnExecCommandOutput(mvnCommandOutput) {
|
|
186359
|
+
return mvnCommandOutput
|
|
186360
|
+
.trim()
|
|
186361
|
+
.split(os.EOL)
|
|
186362
|
+
.sort();
|
|
186363
|
+
}
|
|
186364
|
+
exports.parseMvnExecCommandOutput = parseMvnExecCommandOutput;
|
|
186365
|
+
function mergeMvnClassPaths(classPaths) {
|
|
186366
|
+
// this magic joins all items in array with :, splits result by : again
|
|
186367
|
+
// makes Set (to uniq items), create Array from it and join it by : to have
|
|
186368
|
+
// proper path like format
|
|
186369
|
+
return Array.from(new Set(classPaths.join(path.delimiter).split(path.delimiter)))
|
|
186370
|
+
.sort()
|
|
186371
|
+
.join(path.delimiter);
|
|
186372
|
+
}
|
|
186373
|
+
exports.mergeMvnClassPaths = mergeMvnClassPaths;
|
|
186374
|
+
function getClassPathFromMvn(targetPath, customMavenArgs = []) {
|
|
186375
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186376
|
+
let classPaths = [];
|
|
186377
|
+
let args = [];
|
|
186378
|
+
try {
|
|
186379
|
+
try {
|
|
186380
|
+
// there are two ways of getting classpath - either from maven plugin or by exec command
|
|
186381
|
+
// try `mvn exec` for classpath
|
|
186382
|
+
args = getMvnCommandArgsForMvnExec(targetPath).concat(customMavenArgs);
|
|
186383
|
+
const output = yield sub_process_1.execute('mvn', args, { cwd: targetPath });
|
|
186384
|
+
classPaths = parseMvnExecCommandOutput(output);
|
|
186385
|
+
}
|
|
186386
|
+
catch (e) {
|
|
186387
|
+
// if it fails, try mvn dependency:build-classpath
|
|
186388
|
+
// TODO send error message for further analysis
|
|
186389
|
+
args = getMvnCommandArgsForDependencyPlugin(targetPath).concat(customMavenArgs);
|
|
186390
|
+
const output = yield sub_process_1.execute('mvn', args, { cwd: targetPath });
|
|
186391
|
+
classPaths = parseMvnDependencyPluginCommandOutput(output);
|
|
186392
|
+
}
|
|
186393
|
+
}
|
|
186394
|
+
catch (e) {
|
|
186395
|
+
throw new errors_1.ClassPathGenerationError(e);
|
|
186396
|
+
}
|
|
186397
|
+
if (classPaths.length === 0) {
|
|
186398
|
+
throw new errors_1.EmptyClassPathError(`mvn ${args.join(' ')}`);
|
|
186399
|
+
}
|
|
186400
|
+
return mergeMvnClassPaths(classPaths);
|
|
186401
|
+
});
|
|
186402
|
+
}
|
|
186403
|
+
exports.getClassPathFromMvn = getClassPathFromMvn;
|
|
186404
|
+
//# sourceMappingURL=mvn-wrapper-legacy.js.map
|
|
186405
|
+
|
|
186406
|
+
/***/ }),
|
|
186407
|
+
|
|
186408
|
+
/***/ 384:
|
|
186409
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186410
|
+
|
|
186411
|
+
"use strict";
|
|
186412
|
+
|
|
186413
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186414
|
+
exports.makeMavenProject = exports.makeMavenModule = exports.MavenProject = exports.MavenModule = exports.parseModuleNames = exports.getDepsClassPath = exports.getOutputDir = exports.getBuildDir = exports.withOutputToTemporaryFile = void 0;
|
|
186415
|
+
const tslib_1 = __webpack_require__(53784);
|
|
186416
|
+
__webpack_require__(20406);
|
|
186417
|
+
const path = __webpack_require__(85622);
|
|
186418
|
+
const fs = __webpack_require__(35747);
|
|
186419
|
+
const xmlJs = __webpack_require__(7888);
|
|
186420
|
+
const classpath_1 = __webpack_require__(1268);
|
|
186421
|
+
const tmp = __webpack_require__(84688);
|
|
186422
|
+
const sub_process_1 = __webpack_require__(79838);
|
|
186423
|
+
const errors_1 = __webpack_require__(61640);
|
|
186424
|
+
const metrics_1 = __webpack_require__(83549);
|
|
186425
|
+
const debug_1 = __webpack_require__(13062);
|
|
186426
|
+
// Low level helper functions
|
|
186427
|
+
function withOutputToTemporaryFile(f) {
|
|
186428
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186429
|
+
// NOTE(alexmu): We have to do this little dance with output written to files
|
|
186430
|
+
// because that seems to be the only way to get the output without having to
|
|
186431
|
+
// parse maven logs
|
|
186432
|
+
const file = tmp.fileSync({ discardDescriptor: true });
|
|
186433
|
+
try {
|
|
186434
|
+
yield f(file.name);
|
|
186435
|
+
}
|
|
186436
|
+
catch (e) {
|
|
186437
|
+
debug_1.debug(`Failed to execute command with temporary file: ${e}`);
|
|
186438
|
+
throw e;
|
|
186439
|
+
}
|
|
186440
|
+
try {
|
|
186441
|
+
return fs.readFileSync(file.name, 'utf8');
|
|
186442
|
+
}
|
|
186443
|
+
catch (e) {
|
|
186444
|
+
debug_1.debug(`Failed to read temporary file: ${e}`);
|
|
186445
|
+
throw e;
|
|
186446
|
+
}
|
|
186447
|
+
});
|
|
186448
|
+
}
|
|
186449
|
+
exports.withOutputToTemporaryFile = withOutputToTemporaryFile;
|
|
186450
|
+
function runCommand(projectDirectory, args) {
|
|
186451
|
+
return sub_process_1.execute('mvn', args.concat(['-f', projectDirectory]), {
|
|
186452
|
+
cwd: projectDirectory,
|
|
186453
|
+
});
|
|
186454
|
+
}
|
|
186455
|
+
// Domain specific helpers
|
|
186456
|
+
function evaluateExpression(projectDirectory, expression, customMavenArgs = []) {
|
|
186457
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186458
|
+
return yield withOutputToTemporaryFile((outputFile) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186459
|
+
yield runCommand(projectDirectory, [
|
|
186460
|
+
'help:evaluate',
|
|
186461
|
+
`-Dexpression="${expression}"`,
|
|
186462
|
+
`-Doutput=${outputFile}`,
|
|
186463
|
+
...customMavenArgs,
|
|
186464
|
+
]);
|
|
186465
|
+
}));
|
|
186466
|
+
});
|
|
186467
|
+
}
|
|
186468
|
+
function getBuildDir(baseDir, customMavenArgs) {
|
|
186469
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186470
|
+
return yield evaluateExpression(baseDir, 'project.build.directory', customMavenArgs);
|
|
186471
|
+
});
|
|
186472
|
+
}
|
|
186473
|
+
exports.getBuildDir = getBuildDir;
|
|
186474
|
+
function getOutputDir(baseDir, customMavenArgs) {
|
|
186475
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186476
|
+
return yield evaluateExpression(baseDir, 'project.build.outputDirectory', customMavenArgs);
|
|
186477
|
+
});
|
|
186478
|
+
}
|
|
186479
|
+
exports.getOutputDir = getOutputDir;
|
|
186480
|
+
function getDepsClassPath(baseDir, customMavenArgs = []) {
|
|
186481
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186482
|
+
const classPath = yield withOutputToTemporaryFile((outputFile) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186483
|
+
yield runCommand(baseDir, [
|
|
186484
|
+
'dependency:build-classpath',
|
|
186485
|
+
`-Dmdep.outputFile=${outputFile}`,
|
|
186486
|
+
...customMavenArgs,
|
|
186487
|
+
]);
|
|
186488
|
+
}));
|
|
186489
|
+
return new classpath_1.ClassPath(classPath);
|
|
186490
|
+
});
|
|
186491
|
+
}
|
|
186492
|
+
exports.getDepsClassPath = getDepsClassPath;
|
|
186493
|
+
function parseModuleNames(modulesXml) {
|
|
186494
|
+
const modulesSpec = xmlJs.xml2js(modulesXml, { compact: true });
|
|
186495
|
+
if ('strings' in modulesSpec && 'string' in modulesSpec['strings']) {
|
|
186496
|
+
debug_1.debug(`Found 'strings' in the modules XML`);
|
|
186497
|
+
return modulesSpec['strings']['string'].map((s) => s['_text']);
|
|
186498
|
+
}
|
|
186499
|
+
else if ('modules' in modulesSpec) {
|
|
186500
|
+
debug_1.debug(`Empty modules XML`);
|
|
186501
|
+
return [];
|
|
186502
|
+
}
|
|
186503
|
+
else {
|
|
186504
|
+
throw new errors_1.MalformedModulesSpecError(modulesXml);
|
|
186505
|
+
}
|
|
186506
|
+
}
|
|
186507
|
+
exports.parseModuleNames = parseModuleNames;
|
|
186508
|
+
// Maven model
|
|
186509
|
+
class MavenModule {
|
|
186510
|
+
constructor(baseDir, buildDirectory, outputDirectory, dependenciesClassPath) {
|
|
186511
|
+
if ((buildDirectory === null || buildDirectory === void 0 ? void 0 : buildDirectory.length) === 0) {
|
|
186512
|
+
throw new Error(`Empty build directory for the project in: ${baseDir}`);
|
|
186513
|
+
}
|
|
186514
|
+
if ((outputDirectory === null || outputDirectory === void 0 ? void 0 : outputDirectory.length) === 0) {
|
|
186515
|
+
throw new Error(`Empty output directory for the project in: ${baseDir}`);
|
|
186516
|
+
}
|
|
186517
|
+
if (dependenciesClassPath === null || dependenciesClassPath === void 0 ? void 0 : dependenciesClassPath.isEmpty()) {
|
|
186518
|
+
throw new Error(`Empty dependencies for the project in: ${baseDir}`);
|
|
186519
|
+
}
|
|
186520
|
+
this.baseDirectory = baseDir;
|
|
186521
|
+
this.buildDirectory = buildDirectory;
|
|
186522
|
+
this.outputDirectory = outputDirectory;
|
|
186523
|
+
this.dependenciesClassPath = dependenciesClassPath;
|
|
186524
|
+
}
|
|
186525
|
+
getClassPath() {
|
|
186526
|
+
debug_1.debug(`Dependencies class path: ${this.dependenciesClassPath}`);
|
|
186527
|
+
debug_1.debug(`Output directory: ${this.outputDirectory}`);
|
|
186528
|
+
return this.dependenciesClassPath.concat(new classpath_1.ClassPath(this.outputDirectory));
|
|
186529
|
+
}
|
|
186530
|
+
}
|
|
186531
|
+
exports.MavenModule = MavenModule;
|
|
186532
|
+
class MavenProject {
|
|
186533
|
+
constructor(baseDir, modules) {
|
|
186534
|
+
if ((modules === null || modules === void 0 ? void 0 : modules.length) === 0) {
|
|
186535
|
+
throw new Error(`Empty module list for the project in: ${baseDir}`);
|
|
186536
|
+
}
|
|
186537
|
+
this.baseDir = baseDir;
|
|
186538
|
+
this.modules = modules;
|
|
186539
|
+
}
|
|
186540
|
+
getClassPath() {
|
|
186541
|
+
const classPaths = this.modules.map((module) => module.getClassPath());
|
|
186542
|
+
const cp = classPaths.reduce((cp1, cp2) => cp1.concat(cp2));
|
|
186543
|
+
debug_1.debug(`Project class path: ${cp}`);
|
|
186544
|
+
return cp.toString();
|
|
186545
|
+
}
|
|
186546
|
+
}
|
|
186547
|
+
exports.MavenProject = MavenProject;
|
|
186548
|
+
// Factories that deal with the low level details
|
|
186549
|
+
function makeMavenModule(baseDir, args) {
|
|
186550
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186551
|
+
const buildDir = yield getBuildDir(baseDir, args);
|
|
186552
|
+
const outputDir = yield getOutputDir(baseDir, args);
|
|
186553
|
+
const depsClassPath = yield metrics_1.timeIt('getMvnClassPath', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186554
|
+
return yield getDepsClassPath(baseDir, args);
|
|
186555
|
+
}));
|
|
186556
|
+
return new MavenModule(baseDir, buildDir, outputDir, depsClassPath);
|
|
186557
|
+
});
|
|
186558
|
+
}
|
|
186559
|
+
exports.makeMavenModule = makeMavenModule;
|
|
186560
|
+
function makeMavenProject(baseDir, customMavenArgs) {
|
|
186561
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186562
|
+
const modulesXml = yield evaluateExpression(baseDir, 'project.modules', customMavenArgs);
|
|
186563
|
+
const moduleNames = parseModuleNames(modulesXml);
|
|
186564
|
+
const modules = [yield makeMavenModule(baseDir, customMavenArgs)];
|
|
186565
|
+
const submodules = yield Promise.all(moduleNames.map((name) => makeMavenModule(path.join(baseDir, name))));
|
|
186566
|
+
modules.push(...submodules);
|
|
186567
|
+
const validModules = modules.filter((module) => fs.existsSync(module.buildDirectory));
|
|
186568
|
+
return new MavenProject(baseDir, validModules);
|
|
186569
|
+
});
|
|
186570
|
+
}
|
|
186571
|
+
exports.makeMavenProject = makeMavenProject;
|
|
186572
|
+
//# sourceMappingURL=mvn-wrapper.js.map
|
|
186573
|
+
|
|
186574
|
+
/***/ }),
|
|
186575
|
+
|
|
186576
|
+
/***/ 47172:
|
|
186577
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186578
|
+
|
|
186579
|
+
"use strict";
|
|
186580
|
+
|
|
186581
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186582
|
+
exports.glob = exports.rmdir = exports.writeFile = exports.readFile = exports.mkdtemp = exports.mkdir = exports.unlink = exports.rename = exports.exists = void 0;
|
|
186583
|
+
const util_1 = __webpack_require__(31669);
|
|
186584
|
+
const fs = __webpack_require__(35747);
|
|
186585
|
+
const globOrig = __webpack_require__(12884);
|
|
186586
|
+
exports.exists = util_1.promisify(fs.exists);
|
|
186587
|
+
exports.rename = util_1.promisify(fs.rename);
|
|
186588
|
+
exports.unlink = util_1.promisify(fs.unlink);
|
|
186589
|
+
exports.mkdir = util_1.promisify(fs.mkdir);
|
|
186590
|
+
exports.mkdtemp = util_1.promisify(fs.mkdtemp);
|
|
186591
|
+
exports.readFile = util_1.promisify(fs.readFile);
|
|
186592
|
+
exports.writeFile = util_1.promisify(fs.writeFile);
|
|
186593
|
+
exports.rmdir = util_1.promisify(fs.rmdir);
|
|
186594
|
+
exports.glob = util_1.promisify(globOrig);
|
|
186595
|
+
//# sourceMappingURL=promisified-fs-glob.js.map
|
|
186596
|
+
|
|
186597
|
+
/***/ }),
|
|
186598
|
+
|
|
186599
|
+
/***/ 79838:
|
|
186600
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
186601
|
+
|
|
186602
|
+
"use strict";
|
|
186603
|
+
|
|
186604
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
186605
|
+
exports.execute = void 0;
|
|
186606
|
+
const childProcess = __webpack_require__(63129);
|
|
186607
|
+
const debug_1 = __webpack_require__(13062);
|
|
186608
|
+
const errors_1 = __webpack_require__(61640);
|
|
186609
|
+
function execute(command, args, options) {
|
|
186610
|
+
const spawnOptions = { shell: true };
|
|
186611
|
+
if (options && options.cwd) {
|
|
186612
|
+
spawnOptions.cwd = options.cwd;
|
|
186613
|
+
}
|
|
186614
|
+
return new Promise((resolve, reject) => {
|
|
186615
|
+
let stdout = '';
|
|
186616
|
+
let stderr = '';
|
|
186617
|
+
debug_1.debug(`executing command: "${command} ${args.join(' ')}"`);
|
|
186618
|
+
const proc = childProcess.spawn(command, args, spawnOptions);
|
|
186619
|
+
let timerId = null;
|
|
186620
|
+
if (options === null || options === void 0 ? void 0 : options.timeout) {
|
|
186621
|
+
timerId = setTimeout(() => {
|
|
186622
|
+
proc.kill();
|
|
186623
|
+
const err = new errors_1.SubprocessTimeoutError(command, args.join(' '), options.timeout || 0);
|
|
186624
|
+
debug_1.debug(err.message);
|
|
186625
|
+
reject(err);
|
|
186626
|
+
}, options.timeout);
|
|
186627
|
+
}
|
|
186628
|
+
proc.stdout.on('data', (data) => {
|
|
186629
|
+
stdout = stdout + data;
|
|
186630
|
+
});
|
|
186631
|
+
proc.stderr.on('data', (data) => {
|
|
186632
|
+
stderr = stderr + data;
|
|
186633
|
+
});
|
|
186634
|
+
proc.on('close', (code) => {
|
|
186635
|
+
if (timerId !== null) {
|
|
186636
|
+
clearTimeout(timerId);
|
|
186637
|
+
}
|
|
186638
|
+
if (code !== 0) {
|
|
186639
|
+
const trimmedStackTrace = stderr
|
|
186640
|
+
.replace(/\t/g, '')
|
|
186641
|
+
.split('\n')
|
|
186642
|
+
.slice(0, 5)
|
|
186643
|
+
.join(', ');
|
|
186644
|
+
const err = new errors_1.SubprocessError(command, args.join(' '), code, trimmedStackTrace);
|
|
186645
|
+
debug_1.debug(err.message);
|
|
186646
|
+
return reject(err);
|
|
186647
|
+
}
|
|
186648
|
+
resolve(stdout);
|
|
186649
|
+
});
|
|
186650
|
+
});
|
|
186651
|
+
}
|
|
186652
|
+
exports.execute = execute;
|
|
186653
|
+
//# sourceMappingURL=sub-process.js.map
|
|
186654
|
+
|
|
186655
|
+
/***/ }),
|
|
186656
|
+
|
|
186657
|
+
/***/ 53784:
|
|
186658
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
186659
|
+
|
|
186660
|
+
"use strict";
|
|
186661
|
+
__webpack_require__.r(__webpack_exports__);
|
|
186662
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
186663
|
+
/* harmony export */ "__extends": () => (/* binding */ __extends),
|
|
186664
|
+
/* harmony export */ "__assign": () => (/* binding */ __assign),
|
|
186665
|
+
/* harmony export */ "__rest": () => (/* binding */ __rest),
|
|
186666
|
+
/* harmony export */ "__decorate": () => (/* binding */ __decorate),
|
|
186667
|
+
/* harmony export */ "__param": () => (/* binding */ __param),
|
|
186668
|
+
/* harmony export */ "__metadata": () => (/* binding */ __metadata),
|
|
186669
|
+
/* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
|
|
186670
|
+
/* harmony export */ "__generator": () => (/* binding */ __generator),
|
|
186671
|
+
/* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
|
|
186672
|
+
/* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
|
|
186673
|
+
/* harmony export */ "__values": () => (/* binding */ __values),
|
|
186674
|
+
/* harmony export */ "__read": () => (/* binding */ __read),
|
|
186675
|
+
/* harmony export */ "__spread": () => (/* binding */ __spread),
|
|
186676
|
+
/* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
|
|
186677
|
+
/* harmony export */ "__await": () => (/* binding */ __await),
|
|
186678
|
+
/* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
|
|
186679
|
+
/* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
|
|
186680
|
+
/* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
|
|
186681
|
+
/* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
|
|
186682
|
+
/* harmony export */ "__importStar": () => (/* binding */ __importStar),
|
|
186683
|
+
/* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
|
|
186684
|
+
/* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
|
|
186685
|
+
/* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet)
|
|
186686
|
+
/* harmony export */ });
|
|
186687
|
+
/*! *****************************************************************************
|
|
186688
|
+
Copyright (c) Microsoft Corporation.
|
|
186689
|
+
|
|
186690
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
186691
|
+
purpose with or without fee is hereby granted.
|
|
186692
|
+
|
|
186693
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
186694
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
186695
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
186696
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
186697
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
186698
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
186699
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
186700
|
+
***************************************************************************** */
|
|
186701
|
+
/* global Reflect, Promise */
|
|
186702
|
+
|
|
186703
|
+
var extendStatics = function(d, b) {
|
|
186704
|
+
extendStatics = Object.setPrototypeOf ||
|
|
186705
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
186706
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
186707
|
+
return extendStatics(d, b);
|
|
186708
|
+
};
|
|
186709
|
+
|
|
186710
|
+
function __extends(d, b) {
|
|
186711
|
+
extendStatics(d, b);
|
|
186712
|
+
function __() { this.constructor = d; }
|
|
186713
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
186714
|
+
}
|
|
186715
|
+
|
|
186716
|
+
var __assign = function() {
|
|
186717
|
+
__assign = Object.assign || function __assign(t) {
|
|
186718
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
186719
|
+
s = arguments[i];
|
|
186720
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
186721
|
+
}
|
|
186722
|
+
return t;
|
|
186723
|
+
}
|
|
186724
|
+
return __assign.apply(this, arguments);
|
|
186725
|
+
}
|
|
186726
|
+
|
|
186727
|
+
function __rest(s, e) {
|
|
186728
|
+
var t = {};
|
|
186729
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
186730
|
+
t[p] = s[p];
|
|
186731
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
186732
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
186733
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
186734
|
+
t[p[i]] = s[p[i]];
|
|
186735
|
+
}
|
|
186736
|
+
return t;
|
|
186737
|
+
}
|
|
186738
|
+
|
|
186739
|
+
function __decorate(decorators, target, key, desc) {
|
|
186740
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
186741
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
186742
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
186743
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
186744
|
+
}
|
|
186745
|
+
|
|
186746
|
+
function __param(paramIndex, decorator) {
|
|
186747
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
186748
|
+
}
|
|
186749
|
+
|
|
186750
|
+
function __metadata(metadataKey, metadataValue) {
|
|
186751
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
186752
|
+
}
|
|
186753
|
+
|
|
186754
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
186755
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
186756
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
186757
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
186758
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
186759
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
186760
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
186761
|
+
});
|
|
186762
|
+
}
|
|
186763
|
+
|
|
186764
|
+
function __generator(thisArg, body) {
|
|
186765
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
186766
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
186767
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
186768
|
+
function step(op) {
|
|
186769
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
186770
|
+
while (_) try {
|
|
186771
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
186772
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
186773
|
+
switch (op[0]) {
|
|
186774
|
+
case 0: case 1: t = op; break;
|
|
186775
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
186776
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
186777
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
186778
|
+
default:
|
|
186779
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
186780
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
186781
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
186782
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
186783
|
+
if (t[2]) _.ops.pop();
|
|
186784
|
+
_.trys.pop(); continue;
|
|
186785
|
+
}
|
|
186786
|
+
op = body.call(thisArg, _);
|
|
186787
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
186788
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
186789
|
+
}
|
|
186790
|
+
}
|
|
186791
|
+
|
|
186792
|
+
function __createBinding(o, m, k, k2) {
|
|
186793
|
+
if (k2 === undefined) k2 = k;
|
|
186794
|
+
o[k2] = m[k];
|
|
186795
|
+
}
|
|
186796
|
+
|
|
186797
|
+
function __exportStar(m, exports) {
|
|
186798
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
186799
|
+
}
|
|
186800
|
+
|
|
186801
|
+
function __values(o) {
|
|
186802
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
186803
|
+
if (m) return m.call(o);
|
|
186804
|
+
if (o && typeof o.length === "number") return {
|
|
186805
|
+
next: function () {
|
|
186806
|
+
if (o && i >= o.length) o = void 0;
|
|
186807
|
+
return { value: o && o[i++], done: !o };
|
|
186808
|
+
}
|
|
186809
|
+
};
|
|
186810
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
186811
|
+
}
|
|
186812
|
+
|
|
186813
|
+
function __read(o, n) {
|
|
186814
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
186815
|
+
if (!m) return o;
|
|
186816
|
+
var i = m.call(o), r, ar = [], e;
|
|
186817
|
+
try {
|
|
186818
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
186819
|
+
}
|
|
186820
|
+
catch (error) { e = { error: error }; }
|
|
186821
|
+
finally {
|
|
186822
|
+
try {
|
|
186823
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
186824
|
+
}
|
|
186825
|
+
finally { if (e) throw e.error; }
|
|
186826
|
+
}
|
|
186827
|
+
return ar;
|
|
186828
|
+
}
|
|
186829
|
+
|
|
186830
|
+
function __spread() {
|
|
186831
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
186832
|
+
ar = ar.concat(__read(arguments[i]));
|
|
186833
|
+
return ar;
|
|
186834
|
+
}
|
|
186835
|
+
|
|
186836
|
+
function __spreadArrays() {
|
|
186837
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
186838
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
186839
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
186840
|
+
r[k] = a[j];
|
|
186841
|
+
return r;
|
|
186842
|
+
};
|
|
186843
|
+
|
|
186844
|
+
function __await(v) {
|
|
186845
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
186846
|
+
}
|
|
186847
|
+
|
|
186848
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
186849
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
186850
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
186851
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
186852
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
186853
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
186854
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
186855
|
+
function fulfill(value) { resume("next", value); }
|
|
186856
|
+
function reject(value) { resume("throw", value); }
|
|
186857
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
186858
|
+
}
|
|
186859
|
+
|
|
186860
|
+
function __asyncDelegator(o) {
|
|
186861
|
+
var i, p;
|
|
186862
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
186863
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
186864
|
+
}
|
|
186865
|
+
|
|
186866
|
+
function __asyncValues(o) {
|
|
186867
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
186868
|
+
var m = o[Symbol.asyncIterator], i;
|
|
186869
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
186870
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
186871
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
186872
|
+
}
|
|
186873
|
+
|
|
186874
|
+
function __makeTemplateObject(cooked, raw) {
|
|
186875
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
186876
|
+
return cooked;
|
|
186877
|
+
};
|
|
186878
|
+
|
|
186879
|
+
function __importStar(mod) {
|
|
186880
|
+
if (mod && mod.__esModule) return mod;
|
|
186881
|
+
var result = {};
|
|
186882
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
186883
|
+
result.default = mod;
|
|
186884
|
+
return result;
|
|
186885
|
+
}
|
|
186886
|
+
|
|
186887
|
+
function __importDefault(mod) {
|
|
186888
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
186889
|
+
}
|
|
186890
|
+
|
|
186891
|
+
function __classPrivateFieldGet(receiver, privateMap) {
|
|
186892
|
+
if (!privateMap.has(receiver)) {
|
|
186893
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
186894
|
+
}
|
|
186895
|
+
return privateMap.get(receiver);
|
|
186896
|
+
}
|
|
186897
|
+
|
|
186898
|
+
function __classPrivateFieldSet(receiver, privateMap, value) {
|
|
186899
|
+
if (!privateMap.has(receiver)) {
|
|
186900
|
+
throw new TypeError("attempted to set private field on non-instance");
|
|
186901
|
+
}
|
|
186902
|
+
privateMap.set(receiver, value);
|
|
186903
|
+
return value;
|
|
186904
|
+
}
|
|
186905
|
+
|
|
186906
|
+
|
|
185665
186907
|
/***/ }),
|
|
185666
186908
|
|
|
185667
186909
|
/***/ 48959:
|
|
@@ -186264,6 +187506,80 @@ module.exports = {
|
|
|
186264
187506
|
};
|
|
186265
187507
|
|
|
186266
187508
|
|
|
187509
|
+
/***/ }),
|
|
187510
|
+
|
|
187511
|
+
/***/ 65692:
|
|
187512
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
187513
|
+
|
|
187514
|
+
"use strict";
|
|
187515
|
+
|
|
187516
|
+
|
|
187517
|
+
var vendors = __webpack_require__(21520)
|
|
187518
|
+
|
|
187519
|
+
var env = process.env
|
|
187520
|
+
|
|
187521
|
+
// Used for testing only
|
|
187522
|
+
Object.defineProperty(exports, "_vendors", ({
|
|
187523
|
+
value: vendors.map(function (v) { return v.constant })
|
|
187524
|
+
}))
|
|
187525
|
+
|
|
187526
|
+
exports.name = null
|
|
187527
|
+
exports.isPR = null
|
|
187528
|
+
|
|
187529
|
+
vendors.forEach(function (vendor) {
|
|
187530
|
+
var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]
|
|
187531
|
+
var isCI = envs.every(function (obj) {
|
|
187532
|
+
return checkEnv(obj)
|
|
187533
|
+
})
|
|
187534
|
+
|
|
187535
|
+
exports[vendor.constant] = isCI
|
|
187536
|
+
|
|
187537
|
+
if (isCI) {
|
|
187538
|
+
exports.name = vendor.name
|
|
187539
|
+
|
|
187540
|
+
switch (typeof vendor.pr) {
|
|
187541
|
+
case 'string':
|
|
187542
|
+
// "pr": "CIRRUS_PR"
|
|
187543
|
+
exports.isPR = !!env[vendor.pr]
|
|
187544
|
+
break
|
|
187545
|
+
case 'object':
|
|
187546
|
+
if ('env' in vendor.pr) {
|
|
187547
|
+
// "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
|
|
187548
|
+
exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne
|
|
187549
|
+
} else if ('any' in vendor.pr) {
|
|
187550
|
+
// "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
|
|
187551
|
+
exports.isPR = vendor.pr.any.some(function (key) {
|
|
187552
|
+
return !!env[key]
|
|
187553
|
+
})
|
|
187554
|
+
} else {
|
|
187555
|
+
// "pr": { "DRONE_BUILD_EVENT": "pull_request" }
|
|
187556
|
+
exports.isPR = checkEnv(vendor.pr)
|
|
187557
|
+
}
|
|
187558
|
+
break
|
|
187559
|
+
default:
|
|
187560
|
+
// PR detection not supported for this vendor
|
|
187561
|
+
exports.isPR = null
|
|
187562
|
+
}
|
|
187563
|
+
}
|
|
187564
|
+
})
|
|
187565
|
+
|
|
187566
|
+
exports.isCI = !!(
|
|
187567
|
+
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
|
|
187568
|
+
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
|
|
187569
|
+
env.BUILD_NUMBER || // Jenkins, TeamCity
|
|
187570
|
+
env.RUN_ID || // TaskCluster, dsari
|
|
187571
|
+
exports.name ||
|
|
187572
|
+
false
|
|
187573
|
+
)
|
|
187574
|
+
|
|
187575
|
+
function checkEnv (obj) {
|
|
187576
|
+
if (typeof obj === 'string') return !!env[obj]
|
|
187577
|
+
return Object.keys(obj).every(function (k) {
|
|
187578
|
+
return env[k] === obj[k]
|
|
187579
|
+
})
|
|
187580
|
+
}
|
|
187581
|
+
|
|
187582
|
+
|
|
186267
187583
|
/***/ }),
|
|
186268
187584
|
|
|
186269
187585
|
/***/ 99595:
|
|
@@ -236490,7 +237806,7 @@ module.exports = Channel;
|
|
|
236490
237806
|
|
|
236491
237807
|
/***/ }),
|
|
236492
237808
|
|
|
236493
|
-
/***/
|
|
237809
|
+
/***/ 11126:
|
|
236494
237810
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
236495
237811
|
|
|
236496
237812
|
// This wrapper class is used to retain backwards compatibility with
|
|
@@ -237119,7 +238435,7 @@ var parseKey = ssh2_streams.utils.parseKey;
|
|
|
237119
238435
|
var HTTPAgents = __webpack_require__(13657);
|
|
237120
238436
|
var Channel = __webpack_require__(50491);
|
|
237121
238437
|
var agentQuery = __webpack_require__(81119);
|
|
237122
|
-
var SFTPWrapper = __webpack_require__(
|
|
238438
|
+
var SFTPWrapper = __webpack_require__(11126);
|
|
237123
238439
|
var readUInt32BE = __webpack_require__(40510).readUInt32BE;
|
|
237124
238440
|
|
|
237125
238441
|
var MAX_CHANNEL = Math.pow(2, 32) - 1;
|
|
@@ -270708,6 +272024,14 @@ module.exports = JSON.parse('[{"name":"AppVeyor","constant":"APPVEYOR","env":"AP
|
|
|
270708
272024
|
|
|
270709
272025
|
/***/ }),
|
|
270710
272026
|
|
|
272027
|
+
/***/ 21520:
|
|
272028
|
+
/***/ ((module) => {
|
|
272029
|
+
|
|
272030
|
+
"use strict";
|
|
272031
|
+
module.exports = JSON.parse('[{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI","pr":"SYSTEM_PULLREQUEST_PULLREQUESTID"},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY_BUILD_BASE","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Shippable","constant":"SHIPPABLE","env":"SHIPPABLE","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Solano CI","constant":"SOLANO","env":"TDDIUM","pr":"TDDIUM_PR_ID"},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}}]');
|
|
272032
|
+
|
|
272033
|
+
/***/ }),
|
|
272034
|
+
|
|
270711
272035
|
/***/ 99186:
|
|
270712
272036
|
/***/ ((module) => {
|
|
270713
272037
|
|