snyk 1.949.0 → 1.950.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.
@@ -177349,6 +177349,7 @@ module.exports.setGracefulCleanup = setGracefulCleanup;
177349
177349
  "use strict";
177350
177350
 
177351
177351
  Object.defineProperty(exports, "__esModule", ({ value: true }));
177352
+ exports.MissingSubProjectError = void 0;
177352
177353
  var missing_sub_project_error_1 = __webpack_require__(43749);
177353
177354
  Object.defineProperty(exports, "MissingSubProjectError", ({ enumerable: true, get: function () { return missing_sub_project_error_1.MissingSubProjectError; } }));
177354
177355
  //# sourceMappingURL=index.js.map
@@ -177423,13 +177424,76 @@ function leftPad(s, n) {
177423
177424
 
177424
177425
  /***/ }),
177425
177426
 
177427
+ /***/ 23012:
177428
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
177429
+
177430
+ "use strict";
177431
+
177432
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
177433
+ exports.findChildren = exports.buildGraph = void 0;
177434
+ const dep_graph_1 = __webpack_require__(71479);
177435
+ async function buildGraph(snykGraph, projectName, projectVersion) {
177436
+ const pkgManager = { name: 'gradle' };
177437
+ const isEmptyGraph = !snykGraph || Object.keys(snykGraph).length === 0;
177438
+ const depGraphBuilder = new dep_graph_1.DepGraphBuilder(pkgManager, {
177439
+ name: projectName,
177440
+ version: projectVersion || '0.0.0',
177441
+ });
177442
+ if (isEmptyGraph) {
177443
+ return depGraphBuilder.build();
177444
+ }
177445
+ const visited = [];
177446
+ const queue = [];
177447
+ queue.push(...findChildren('root-node', snykGraph)); // queue direct dependencies
177448
+ // breadth first search
177449
+ while (queue.length > 0) {
177450
+ const item = queue.shift();
177451
+ if (!item)
177452
+ continue;
177453
+ const { id, parentId } = item;
177454
+ const node = snykGraph[id];
177455
+ if (!node)
177456
+ continue;
177457
+ const { name = 'unknown', version = 'unknown' } = node;
177458
+ if (visited.includes(id)) {
177459
+ const prunedId = id + ':pruned';
177460
+ depGraphBuilder.addPkgNode({ name, version }, prunedId, {
177461
+ labels: { pruned: 'true' },
177462
+ });
177463
+ depGraphBuilder.connectDep(parentId, prunedId);
177464
+ continue; // don't queue any more children
177465
+ }
177466
+ depGraphBuilder.addPkgNode({ name, version }, id);
177467
+ depGraphBuilder.connectDep(parentId, id);
177468
+ queue.push(...findChildren(id, snykGraph)); // queue children
177469
+ visited.push(id);
177470
+ }
177471
+ return depGraphBuilder.build();
177472
+ }
177473
+ exports.buildGraph = buildGraph;
177474
+ function findChildren(parentId, snykGraph) {
177475
+ var _a;
177476
+ const result = [];
177477
+ for (const id of Object.keys(snykGraph)) {
177478
+ const node = snykGraph[id];
177479
+ if ((_a = node === null || node === void 0 ? void 0 : node.parentIds) === null || _a === void 0 ? void 0 : _a.includes(parentId)) {
177480
+ result.push({ id, parentId });
177481
+ }
177482
+ }
177483
+ return result;
177484
+ }
177485
+ exports.findChildren = findChildren;
177486
+ //# sourceMappingURL=graph.js.map
177487
+
177488
+ /***/ }),
177489
+
177426
177490
  /***/ 71673:
177427
177491
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
177428
177492
 
177429
177493
  "use strict";
177430
177494
 
177431
177495
  Object.defineProperty(exports, "__esModule", ({ value: true }));
177432
- exports.exportsForTests = exports.formatArgWithWhiteSpace = exports.processProjectsInExtractedJSON = exports.buildGraph = exports.inspect = void 0;
177496
+ exports.exportsForTests = exports.formatArgWithWhiteSpace = exports.processProjectsInExtractedJSON = exports.inspect = void 0;
177433
177497
  const os = __webpack_require__(12087);
177434
177498
  const fs = __webpack_require__(35747);
177435
177499
  const path = __webpack_require__(85622);
@@ -177437,11 +177501,11 @@ const subProcess = __webpack_require__(84335);
177437
177501
  const tmp = __webpack_require__(84688);
177438
177502
  const errors_1 = __webpack_require__(45339);
177439
177503
  const chalk = __webpack_require__(35337);
177440
- const dep_graph_1 = __webpack_require__(71479);
177441
177504
  const cli_interface_1 = __webpack_require__(65266);
177442
- const javaCallGraphBuilder = __webpack_require__(48542);
177505
+ const javaCallGraphBuilder = __webpack_require__(16623);
177443
177506
  const gradle_attributes_pretty_1 = __webpack_require__(89173);
177444
177507
  const debugModule = __webpack_require__(15158);
177508
+ const graph_1 = __webpack_require__(23012);
177445
177509
  // To enable debugging output, use `snyk -d`
177446
177510
  let logger = null;
177447
177511
  function debugLog(s) {
@@ -177464,13 +177528,12 @@ const cannotResolveVariantMarkers = [
177464
177528
  ];
177465
177529
  // General implementation. The result type depends on the runtime type of `options`.
177466
177530
  async function inspect(root, targetFile, options) {
177467
- var _a, _b;
177468
177531
  debugLog('Gradle inspect called with: ' +
177469
177532
  JSON.stringify({
177470
177533
  root,
177471
177534
  targetFile,
177472
- allSubProjects: (_a = options) === null || _a === void 0 ? void 0 : _a.allSubProjects,
177473
- subProject: (_b = options) === null || _b === void 0 ? void 0 : _b.subProject,
177535
+ allSubProjects: options === null || options === void 0 ? void 0 : options.allSubProjects,
177536
+ subProject: options === null || options === void 0 ? void 0 : options.subProject,
177474
177537
  }));
177475
177538
  if (!options) {
177476
177539
  options = { dev: false };
@@ -177497,7 +177560,8 @@ async function inspect(root, targetFile, options) {
177497
177560
  if (options['configuration-attributes']) {
177498
177561
  confAttrs = options['configuration-attributes'];
177499
177562
  }
177500
- const timeout = (options === null || options === void 0 ? void 0 : options.callGraphBuilderTimeout) ? (options === null || options === void 0 ? void 0 : options.callGraphBuilderTimeout) * 1000
177563
+ const timeout = (options === null || options === void 0 ? void 0 : options.callGraphBuilderTimeout)
177564
+ ? (options === null || options === void 0 ? void 0 : options.callGraphBuilderTimeout) * 1000
177501
177565
  : undefined;
177502
177566
  callGraph = await getCallGraph(targetPath, command, initScriptPath, confAttrs, timeout);
177503
177567
  }
@@ -177567,43 +177631,6 @@ function extractJsonFromScriptOutput(stdoutText) {
177567
177631
  ' characters');
177568
177632
  return JSON.parse(jsonLine);
177569
177633
  }
177570
- async function buildGraph(snykGraph, projectName, projectVersion) {
177571
- const pkgManager = { name: 'gradle' };
177572
- const isEmptyGraph = !snykGraph || Object.keys(snykGraph).length === 0;
177573
- const depGraphBuilder = new dep_graph_1.DepGraphBuilder(pkgManager, {
177574
- name: projectName,
177575
- version: projectVersion || '0.0.0',
177576
- });
177577
- if (isEmptyGraph) {
177578
- return depGraphBuilder.build();
177579
- }
177580
- for (const id of Object.keys(snykGraph)) {
177581
- const { name, version } = snykGraph[id];
177582
- const nodeId = `${name}@${version}`;
177583
- depGraphBuilder.addPkgNode({ name, version }, nodeId);
177584
- }
177585
- // Edges
177586
- for (const id of Object.keys(snykGraph)) {
177587
- snykGraph[id].parentIds = Array.from(new Set(snykGraph[id].parentIds).values());
177588
- const { name, version, parentIds } = snykGraph[id];
177589
- const nodeId = `${name}@${version}`;
177590
- if (parentIds && parentIds.length > 0) {
177591
- for (let parentId of parentIds) {
177592
- // case of missing assign version
177593
- if (!parentId.includes('@') && snykGraph[parentId]) {
177594
- const { name, version } = snykGraph[parentId];
177595
- parentId = `${name}@${version}`;
177596
- }
177597
- depGraphBuilder.connectDep(parentId, nodeId);
177598
- }
177599
- }
177600
- else {
177601
- depGraphBuilder.connectDep('root-node', nodeId);
177602
- }
177603
- }
177604
- return depGraphBuilder.build();
177605
- }
177606
- exports.buildGraph = buildGraph;
177607
177634
  async function getAllDepsOneProject(root, targetFile, options, subProject) {
177608
177635
  const allProjectDeps = await getAllDeps(root, targetFile, options);
177609
177636
  const allSubProjectNames = allProjectDeps.allSubProjectNames;
@@ -177765,7 +177792,7 @@ async function getAllDepsWithPlugin(root, targetFile, options) {
177765
177792
  cleanupCallback();
177766
177793
  }
177767
177794
  const extractedJSON = extractJsonFromScriptOutput(stdoutText);
177768
- const jsonAttrsPretty = gradle_attributes_pretty_1.getGradleAttributesPretty(stdoutText);
177795
+ const jsonAttrsPretty = (0, gradle_attributes_pretty_1.getGradleAttributesPretty)(stdoutText);
177769
177796
  logger(`The following attributes and their possible values were found in your configurations: ${jsonAttrsPretty}`);
177770
177797
  return extractedJSON;
177771
177798
  }
@@ -177802,7 +177829,7 @@ message from above, starting with ===== DEBUG INFORMATION START =====.`;
177802
177829
  // impossible.
177803
177830
  // There are no automated tests for this yet (setting up Android SDK is quite problematic).
177804
177831
  // See test/manual/README.md
177805
- const jsonAttrsPretty = gradle_attributes_pretty_1.getGradleAttributesPretty(error.message);
177832
+ const jsonAttrsPretty = (0, gradle_attributes_pretty_1.getGradleAttributesPretty)(error.message);
177806
177833
  if (jsonAttrsPretty) {
177807
177834
  logger(`The following attributes and their possible values were found in your configurations: ${jsonAttrsPretty}`);
177808
177835
  }
@@ -177867,7 +177894,7 @@ async function processProjectsInExtractedJSON(root, extractedJSON) {
177867
177894
  ? `${path.basename(root)}/${projectId}`
177868
177895
  : `${defaultProject}/${projectId}`;
177869
177896
  }
177870
- extractedJSON.projects[projectId].depGraph = await buildGraph(snykGraph, projectName, projectVersion);
177897
+ extractedJSON.projects[projectId].depGraph = await (0, graph_1.buildGraph)(snykGraph, projectName, projectVersion);
177871
177898
  // this property usage ends here
177872
177899
  delete extractedJSON.projects[projectId].snykGraph;
177873
177900
  }
@@ -177896,1062 +177923,97 @@ function getCommand(root, targetFile) {
177896
177923
  if (fs.existsSync(pathToWrapper)) {
177897
177924
  return quotLocal + pathToWrapper + quotLocal;
177898
177925
  }
177899
- return 'gradle';
177900
- }
177901
- function formatArgWithWhiteSpace(arg) {
177902
- if (/\s/.test(arg)) {
177903
- return quot + arg + quot;
177904
- }
177905
- return arg;
177906
- }
177907
- exports.formatArgWithWhiteSpace = formatArgWithWhiteSpace;
177908
- function buildArgs(root, targetFile, initGradlePath, options) {
177909
- const args = [];
177910
- args.push('snykResolvedDepsJson', '-q');
177911
- if (targetFile) {
177912
- if (!fs.existsSync(path.resolve(root, targetFile))) {
177913
- throw new Error('File not found: "' + targetFile + '"');
177914
- }
177915
- args.push('--build-file');
177916
- const formattedTargetFile = formatArgWithWhiteSpace(targetFile);
177917
- args.push(formattedTargetFile);
177918
- }
177919
- // Arguments to init script are supplied as properties: https://stackoverflow.com/a/48370451
177920
- if (options['configuration-matching']) {
177921
- args.push(`-Pconfiguration=${quot}${options['configuration-matching']}${quot}`);
177922
- }
177923
- if (options['configuration-attributes']) {
177924
- args.push(`-PconfAttr=${quot}${options['configuration-attributes']}${quot}`);
177925
- }
177926
- if (options.initScript) {
177927
- const formattedInitScript = formatArgWithWhiteSpace(path.resolve(options.initScript));
177928
- args.push('--init-script', formattedInitScript);
177929
- }
177930
- if (!options.daemon) {
177931
- args.push('--no-daemon');
177932
- }
177933
- // Parallel builds can cause race conditions and multiple JSONDEPS lines in the output
177934
- // Gradle 4.3.0+ has `--no-parallel` flag, but we want to support older versions.
177935
- // Not `=false` to be compatible with 3.5.x: https://github.com/gradle/gradle/issues/1827
177936
- args.push('-Dorg.gradle.parallel=');
177937
- // Since version 4.3.0+ Gradle uses different console output mechanism. Default mode is 'auto',
177938
- // if Gradle is attached to a terminal. It means build output will use ANSI control characters
177939
- // to generate the rich output, therefore JSON cannot be parsed.
177940
- args.push('-Dorg.gradle.console=plain');
177941
- if (!cli_interface_1.legacyPlugin.isMultiSubProject(options)) {
177942
- args.push('-PonlySubProject=' + (options.subProject || '.'));
177943
- }
177944
- args.push('-I ' + initGradlePath);
177945
- if (options.args) {
177946
- args.push(...options.args);
177947
- }
177948
- // There might be a legacy --configuration option in 'args'.
177949
- // It has been superseded by --configuration-matching option for Snyk CLI (see buildArgs),
177950
- // but we are handling it to support the legacy setups.
177951
- args.forEach((a, i) => {
177952
- // Transform --configuration=foo
177953
- args[i] = a.replace(/^--configuration[= ]([a-zA-Z_]+)/, `-Pconfiguration=${quot}^$1$$${quot}`);
177954
- // Transform --configuration foo
177955
- if (a === '--configuration') {
177956
- args[i] = `-Pconfiguration=${quot}^${args[i + 1]}$${quot}`;
177957
- args[i + 1] = '';
177958
- }
177959
- });
177960
- return args;
177961
- }
177962
- async function getCallGraph(targetPath, command, initScriptPath, confAttrs, timeout) {
177963
- try {
177964
- debugLog(`getting call graph from path ${targetPath}`);
177965
- const callGraph = await javaCallGraphBuilder.getCallGraphGradle(path.dirname(targetPath), command, initScriptPath, confAttrs, timeout);
177966
- debugLog('got call graph successfully');
177967
- return callGraph;
177968
- }
177969
- catch (e) {
177970
- debugLog('call graph error: ' + e);
177971
- return {
177972
- message: e.message,
177973
- innerError: e.innerError || e,
177974
- };
177975
- }
177976
- }
177977
- exports.exportsForTests = {
177978
- buildArgs,
177979
- extractJsonFromScriptOutput,
177980
- getVersionBuildInfo,
177981
- toCamelCase,
177982
- getGradleAttributesPretty: gradle_attributes_pretty_1.getGradleAttributesPretty,
177983
- getPluginFileName,
177984
- };
177985
- //# sourceMappingURL=index.js.map
177986
-
177987
- /***/ }),
177988
-
177989
- /***/ 84335:
177990
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
177991
-
177992
- "use strict";
177993
-
177994
- Object.defineProperty(exports, "__esModule", ({ value: true }));
177995
- exports.execute = void 0;
177996
- const childProcess = __webpack_require__(63129);
177997
- const debugModule = __webpack_require__(15158);
177998
- const debugLogging = debugModule('snyk-gradle-plugin');
177999
- // Executes a subprocess. Resolves successfully with stdout contents if the exit code is 0.
178000
- function execute(command, args, options, perLineCallback) {
178001
- const spawnOptions = { shell: true };
178002
- if (options && options.cwd) {
178003
- spawnOptions.cwd = options.cwd;
178004
- }
178005
- return new Promise((resolve, reject) => {
178006
- let stdout = '';
178007
- let stderr = '';
178008
- const proc = childProcess.spawn(command, args, spawnOptions);
178009
- proc.stdout.on('data', (data) => {
178010
- const strData = data.toString();
178011
- stdout = stdout + strData;
178012
- if (perLineCallback) {
178013
- strData.split('\n').forEach(perLineCallback);
178014
- }
178015
- });
178016
- proc.stderr.on('data', (data) => {
178017
- stderr = stderr + data;
178018
- });
178019
- proc.on('close', (code) => {
178020
- if (code !== 0) {
178021
- const fullCommand = command + ' ' + args.join(' ');
178022
- return reject(new Error(`
178023
- >>> command: ${fullCommand}
178024
- >>> exit code: ${code}
178025
- >>> stdout:
178026
- ${stdout}
178027
- >>> stderr:
178028
- ${stderr}
178029
- `));
178030
- }
178031
- if (stderr) {
178032
- debugLogging('subprocess exit code = 0, but stderr was not empty: ' + stderr);
178033
- }
178034
- resolve(stdout);
178035
- });
178036
- });
178037
- }
178038
- exports.execute = execute;
178039
- //# sourceMappingURL=sub-process.js.map
178040
-
178041
- /***/ }),
178042
-
178043
- /***/ 39533:
178044
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178045
-
178046
- "use strict";
178047
-
178048
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178049
- exports.buildCallGraph = void 0;
178050
- const graphlib_1 = __webpack_require__(39322);
178051
- const class_parsing_1 = __webpack_require__(61914);
178052
- function getNodeLabel(functionCall, classPerJarMapping) {
178053
- // com.ibm.wala.FakeRootClass:fakeRootMethod
178054
- const [className, functionName] = functionCall.split(':');
178055
- const jarName = classPerJarMapping[className];
178056
- return {
178057
- className,
178058
- functionName,
178059
- jarName,
178060
- };
178061
- }
178062
- function buildCallGraph(input, classPerJarMapping) {
178063
- const graph = new graphlib_1.Graph();
178064
- for (const line of input.trim().split('\n')) {
178065
- const [caller, callee] = line
178066
- .trim()
178067
- .split(' -> ')
178068
- .map(class_parsing_1.removeParams)
178069
- .map(class_parsing_1.toFQclassName);
178070
- graph.setNode(caller, getNodeLabel(caller, classPerJarMapping));
178071
- graph.setNode(callee, getNodeLabel(callee, classPerJarMapping));
178072
- graph.setEdge(caller, callee);
178073
- }
178074
- return graph;
178075
- }
178076
- exports.buildCallGraph = buildCallGraph;
178077
- //# sourceMappingURL=call-graph.js.map
178078
-
178079
- /***/ }),
178080
-
178081
- /***/ 61914:
178082
- /***/ ((__unused_webpack_module, exports) => {
178083
-
178084
- "use strict";
178085
-
178086
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178087
- exports.toFQclassName = exports.removeParams = void 0;
178088
- function removeParams(functionCall) {
178089
- // com/ibm/wala/FakeRootClass.fakeRootMethod:()V
178090
- return functionCall.split(':')[0];
178091
- }
178092
- exports.removeParams = removeParams;
178093
- function toFQclassName(functionCall) {
178094
- // com/ibm/wala/FakeRootClass.fakeRootMethod -> com.ibm.wala.FakeRootClass:fakeRootMethod
178095
- return functionCall.replace('.', ':').replace(/\//g, '.');
178096
- }
178097
- exports.toFQclassName = toFQclassName;
178098
- //# sourceMappingURL=class-parsing.js.map
178099
-
178100
- /***/ }),
178101
-
178102
- /***/ 1268:
178103
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178104
-
178105
- "use strict";
178106
-
178107
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178108
- exports.ClassPath = void 0;
178109
- const path = __webpack_require__(85622);
178110
- function canonicalize(rawClasspath) {
178111
- let sanitisedClassPath = rawClasspath.trim();
178112
- while (sanitisedClassPath.startsWith(path.delimiter)) {
178113
- sanitisedClassPath = sanitisedClassPath.slice(1);
178114
- }
178115
- while (sanitisedClassPath.endsWith(path.delimiter)) {
178116
- sanitisedClassPath = sanitisedClassPath.slice(0, -1);
178117
- }
178118
- return sanitisedClassPath;
178119
- }
178120
- class ClassPath {
178121
- constructor(classPath) {
178122
- this.value = canonicalize(classPath);
178123
- }
178124
- isEmpty() {
178125
- return this.value.length === 0;
178126
- }
178127
- concat(other) {
178128
- const elements = this.value.split(path.delimiter);
178129
- const otherElements = other.value.split(path.delimiter);
178130
- const newElements = Array.from(new Set(elements.concat(otherElements)).values());
178131
- return new ClassPath(newElements.join(path.delimiter));
178132
- }
178133
- toString() {
178134
- return this.value;
178135
- }
178136
- }
178137
- exports.ClassPath = ClassPath;
178138
- //# sourceMappingURL=classpath.js.map
178139
-
178140
- /***/ }),
178141
-
178142
- /***/ 93506:
178143
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
178144
-
178145
- "use strict";
178146
-
178147
- const snykConfig = __webpack_require__(8658);
178148
- const path = __webpack_require__(85622);
178149
- const config = snykConfig.loadConfig(path.join(__dirname, '..'));
178150
- module.exports = config;
178151
- //# sourceMappingURL=config.js.map
178152
-
178153
- /***/ }),
178154
-
178155
- /***/ 13062:
178156
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178157
-
178158
- "use strict";
178159
-
178160
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178161
- exports.debug = void 0;
178162
- const debugModule = __webpack_require__(15158);
178163
- // To enable debugging output, use `snyk -d`
178164
- function debug(s) {
178165
- if (process.env.DEBUG) {
178166
- debugModule.enable(process.env.DEBUG);
178167
- }
178168
- return debugModule(`snyk-java-call-graph-builder`)(s);
178169
- }
178170
- exports.debug = debug;
178171
- //# sourceMappingURL=debug.js.map
178172
-
178173
- /***/ }),
178174
-
178175
- /***/ 61640:
178176
- /***/ ((__unused_webpack_module, exports) => {
178177
-
178178
- "use strict";
178179
-
178180
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178181
- exports.MalformedModulesSpecError = exports.SubprocessError = exports.SubprocessTimeoutError = exports.MissingTargetFolderError = exports.EmptyClassPathError = exports.ClassPathGenerationError = exports.CallGraphGenerationError = void 0;
178182
- class CallGraphGenerationError extends Error {
178183
- constructor(msg, innerError) {
178184
- super(msg);
178185
- Object.setPrototypeOf(this, CallGraphGenerationError.prototype);
178186
- this.innerError = innerError;
178187
- }
178188
- }
178189
- exports.CallGraphGenerationError = CallGraphGenerationError;
178190
- class ClassPathGenerationError extends Error {
178191
- constructor(innerError) {
178192
- super('Class path generation error');
178193
- 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.";
178194
- Object.setPrototypeOf(this, ClassPathGenerationError.prototype);
178195
- this.innerError = innerError;
178196
- }
178197
- }
178198
- exports.ClassPathGenerationError = ClassPathGenerationError;
178199
- class EmptyClassPathError extends Error {
178200
- constructor(command) {
178201
- super(`The command "${command}" returned an empty class path`);
178202
- 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.';
178203
- Object.setPrototypeOf(this, EmptyClassPathError.prototype);
178204
- }
178205
- }
178206
- exports.EmptyClassPathError = EmptyClassPathError;
178207
- class MissingTargetFolderError extends Error {
178208
- constructor(targetPath, packageManager) {
178209
- super(`Could not find the target folder starting in "${targetPath}"`);
178210
- this.errorMessagePerPackageManager = {
178211
- mvn: "Could not find the project's output directory. Please build your project and try again. " +
178212
- 'The reachable vulnerabilities feature only supports the default Maven project layout, ' +
178213
- "where the output directory is named 'target'.",
178214
- gradle: "Could not find the project's target folder. Please compile your code and try again.",
178215
- };
178216
- Object.setPrototypeOf(this, MissingTargetFolderError.prototype);
178217
- this.userMessage = this.errorMessagePerPackageManager[packageManager];
178218
- }
178219
- }
178220
- exports.MissingTargetFolderError = MissingTargetFolderError;
178221
- class SubprocessTimeoutError extends Error {
178222
- constructor(command, args, timeout) {
178223
- super(`The command "${command} ${args}" timed out after ${timeout / 1000}s`);
178224
- this.userMessage = 'Scanning for reachable vulnerabilities took too long. Please use the --reachable-timeout flag to increase the timeout for finding reachable vulnerabilities.';
178225
- Object.setPrototypeOf(this, SubprocessTimeoutError.prototype);
178226
- }
178227
- }
178228
- exports.SubprocessTimeoutError = SubprocessTimeoutError;
178229
- class SubprocessError extends Error {
178230
- constructor(command, args, exitCode, stdError) {
178231
- super(`The command "${command} ${args}" exited with code ${exitCode}${stdError ? ', Standard Error Output: ' + stdError : ''}`);
178232
- Object.setPrototypeOf(this, SubprocessError.prototype);
178233
- }
178234
- }
178235
- exports.SubprocessError = SubprocessError;
178236
- class MalformedModulesSpecError extends Error {
178237
- constructor(modulesXml) {
178238
- super(`Malformed modules XML: ${modulesXml}`);
178239
- Object.setPrototypeOf(this, MalformedModulesSpecError.prototype);
178240
- }
178241
- }
178242
- exports.MalformedModulesSpecError = MalformedModulesSpecError;
178243
- //# sourceMappingURL=errors.js.map
178244
-
178245
- /***/ }),
178246
-
178247
- /***/ 43206:
178248
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178249
-
178250
- "use strict";
178251
-
178252
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178253
- exports.fetch = exports.JAR_NAME = void 0;
178254
- const tslib_1 = __webpack_require__(53784);
178255
- const fs = __webpack_require__(35747);
178256
- const path = __webpack_require__(85622);
178257
- const needle = __webpack_require__(64484);
178258
- const ciInfo = __webpack_require__(65692);
178259
- const ProgressBar = __webpack_require__(15157);
178260
- const tempDir = __webpack_require__(21661);
178261
- const crypto = __webpack_require__(76417);
178262
- const debug_1 = __webpack_require__(13062);
178263
- const metrics = __webpack_require__(83549);
178264
- const promisifedFs = __webpack_require__(47172);
178265
- exports.JAR_NAME = 'java-call-graph-generator.jar';
178266
- const LOCAL_PATH = path.join(tempDir, 'call-graph-generator', exports.JAR_NAME);
178267
- function createProgressBar(total, name) {
178268
- return new ProgressBar(`downloading ${name} [:bar] :rate/Kbps :percent :etas remaining`, {
178269
- complete: '=',
178270
- incomplete: '.',
178271
- width: 20,
178272
- total: total / 1000,
178273
- clear: true,
178274
- });
178275
- }
178276
- function downloadAnalyzer(url, localPath, expectedChecksum) {
178277
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178278
- return new Promise((resolve, reject) => {
178279
- const fsStream = fs.createWriteStream(localPath + '.part');
178280
- try {
178281
- let progressBar;
178282
- debug_1.debug(`fetching java graph generator from ${url}`);
178283
- const req = needle.get(url);
178284
- let matchChecksum;
178285
- let hasError = false;
178286
- // TODO: Try pump (https://www.npmjs.com/package/pump) for more organised flow
178287
- req
178288
- .on('response', (res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
178289
- if (res.statusCode >= 400) {
178290
- const err = new Error('Bad HTTP response for snyk-call-graph-generator download');
178291
- // TODO: add custom error for status code => err.statusCode = res.statusCode;
178292
- fsStream.destroy();
178293
- hasError = true;
178294
- return reject(err);
178295
- }
178296
- matchChecksum = verifyChecksum(req, expectedChecksum);
178297
- debug_1.debug(`downloading ${exports.JAR_NAME} ...`);
178298
- if (!ciInfo.isCI) {
178299
- const total = parseInt(res.headers['content-length'], 10);
178300
- progressBar = createProgressBar(total, exports.JAR_NAME);
178301
- }
178302
- }))
178303
- .on('data', (chunk) => {
178304
- if (progressBar) {
178305
- progressBar.tick(chunk.length / 1000);
178306
- }
178307
- })
178308
- .on('error', (err) => {
178309
- return reject(err);
178310
- })
178311
- .pipe(fsStream)
178312
- .on('error', (err) => {
178313
- fsStream.destroy();
178314
- return reject(err);
178315
- })
178316
- .on('finish', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
178317
- if (hasError) {
178318
- yield promisifedFs.unlink(localPath + '.part');
178319
- }
178320
- else {
178321
- if (!(yield matchChecksum)) {
178322
- return reject(new Error('Wrong checksum of downloaded call-graph-generator.'));
178323
- }
178324
- yield promisifedFs.rename(localPath + '.part', localPath);
178325
- resolve(localPath);
178326
- }
178327
- }));
178328
- }
178329
- catch (err) {
178330
- reject(err);
178331
- }
178332
- });
178333
- });
178334
- }
178335
- function verifyChecksum(localPathStream, expectedChecksum) {
178336
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178337
- return new Promise((resolve, reject) => {
178338
- const hash = crypto.createHash('sha256');
178339
- localPathStream
178340
- .on('error', reject)
178341
- .on('data', (chunk) => {
178342
- hash.update(chunk);
178343
- })
178344
- .on('end', () => {
178345
- resolve(hash.digest('hex') === expectedChecksum);
178346
- });
178347
- });
178348
- });
178349
- }
178350
- function fetch(url, expectedChecksum) {
178351
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178352
- const localPath = LOCAL_PATH;
178353
- if (yield promisifedFs.exists(localPath)) {
178354
- if (yield verifyChecksum(fs.createReadStream(localPath), expectedChecksum)) {
178355
- return localPath;
178356
- }
178357
- debug_1.debug(`new version of ${exports.JAR_NAME} available`);
178358
- }
178359
- if (!(yield promisifedFs.exists(path.dirname(localPath)))) {
178360
- yield promisifedFs.mkdir(path.dirname(localPath));
178361
- }
178362
- return yield metrics.timeIt('fetchCallGraphBuilder', () => downloadAnalyzer(url, localPath, expectedChecksum));
178363
- });
178364
- }
178365
- exports.fetch = fetch;
178366
- //# sourceMappingURL=fetch-snyk-java-call-graph-generator.js.map
178367
-
178368
- /***/ }),
178369
-
178370
- /***/ 61942:
178371
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178372
-
178373
- "use strict";
178374
-
178375
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178376
- exports.getClassPathFromGradle = exports.getGradleCommandArgs = void 0;
178377
- const tslib_1 = __webpack_require__(53784);
178378
- __webpack_require__(20406);
178379
- const sub_process_1 = __webpack_require__(79838);
178380
- const path = __webpack_require__(85622);
178381
- const os_1 = __webpack_require__(12087);
178382
- const errors_1 = __webpack_require__(61640);
178383
- const fs = __webpack_require__(35747);
178384
- const tmp = __webpack_require__(84688);
178385
- function getGradleCommandArgs(targetPath, initScript, confAttrs) {
178386
- // For binary releases, the original file would be in the binary build and inaccesible
178387
- const originalPath = path.join(__dirname, ...'../bin/init.gradle'.split('/'));
178388
- const tmpFilePath = tmp.fileSync().name;
178389
- fs.copyFileSync(originalPath, tmpFilePath);
178390
- const gradleArgs = ['printClasspath', '-I', tmpFilePath, '-q'];
178391
- if (targetPath) {
178392
- gradleArgs.push('-p', targetPath);
178393
- }
178394
- if (initScript) {
178395
- gradleArgs.push('--init-script', initScript);
178396
- }
178397
- if (confAttrs) {
178398
- const isWin = /^win/.test(os_1.platform());
178399
- const quot = isWin ? '"' : "'";
178400
- gradleArgs.push(`-PconfAttrs=${quot}${confAttrs}${quot}`);
178401
- }
178402
- return gradleArgs;
178403
- }
178404
- exports.getGradleCommandArgs = getGradleCommandArgs;
178405
- function getClassPathFromGradle(targetPath, gradlePath, initScript, confAttrs) {
178406
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178407
- const args = getGradleCommandArgs(targetPath, initScript, confAttrs);
178408
- try {
178409
- const output = yield sub_process_1.execute(gradlePath, args, { cwd: targetPath });
178410
- const lines = output.trim().split(os_1.EOL);
178411
- const lastLine = lines[lines.length - 1];
178412
- return lastLine.trim();
178413
- }
178414
- catch (e) {
178415
- console.log(e);
178416
- throw new errors_1.ClassPathGenerationError(e);
178417
- }
178418
- });
178419
- }
178420
- exports.getClassPathFromGradle = getClassPathFromGradle;
178421
- //# sourceMappingURL=gradle-wrapper.js.map
178422
-
178423
- /***/ }),
178424
-
178425
- /***/ 48542:
178426
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178427
-
178428
- "use strict";
178429
-
178430
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178431
- exports.findBuildDirs = exports.runtimeMetrics = exports.getCallGraphGradle = exports.getCallGraphMvn = exports.getCallGraphMvnLegacy = void 0;
178432
- const tslib_1 = __webpack_require__(53784);
178433
- __webpack_require__(20406);
178434
- const mvn_wrapper_legacy_1 = __webpack_require__(42519);
178435
- const gradle_wrapper_1 = __webpack_require__(61942);
178436
- const java_wrapper_1 = __webpack_require__(60621);
178437
- const metrics_1 = __webpack_require__(83549);
178438
- const errors_1 = __webpack_require__(61640);
178439
- const promisified_fs_glob_1 = __webpack_require__(47172);
178440
- const path = __webpack_require__(85622);
178441
- const mvn_wrapper_1 = __webpack_require__(384);
178442
- const debug_1 = __webpack_require__(13062);
178443
- const tmp = __webpack_require__(84688);
178444
- tmp.setGracefulCleanup();
178445
- function getCallGraphMvnLegacy(targetPath, timeout, customMavenArgs) {
178446
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178447
- try {
178448
- const [classPath, targets] = yield Promise.all([
178449
- metrics_1.timeIt('getMvnClassPath', () => mvn_wrapper_legacy_1.getClassPathFromMvn(targetPath, customMavenArgs)),
178450
- metrics_1.timeIt('getEntrypoints', () => findBuildDirs(targetPath, 'mvn')),
178451
- ]);
178452
- return yield metrics_1.timeIt('getCallGraph', () => java_wrapper_1.getCallGraph(classPath, targetPath, targets, timeout));
178453
- }
178454
- catch (e) {
178455
- throw new errors_1.CallGraphGenerationError(e.userMessage ||
178456
- '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);
178457
- }
178458
- });
178459
- }
178460
- exports.getCallGraphMvnLegacy = getCallGraphMvnLegacy;
178461
- function getCallGraphMvn(targetPath, timeout, customMavenArgs) {
178462
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178463
- try {
178464
- const project = yield mvn_wrapper_1.makeMavenProject(targetPath, customMavenArgs);
178465
- const classPath = project.getClassPath();
178466
- const buildDirectories = yield Promise.all(project.modules.map((m) => m.buildDirectory));
178467
- return yield metrics_1.timeIt('getCallGraph', () => java_wrapper_1.getCallGraph(classPath, targetPath, buildDirectories, timeout));
178468
- }
178469
- catch (e) {
178470
- debug_1.debug(`Failed to get the call graph for the Maven project in: ${targetPath}. ' +
178471
- 'Falling back to the legacy method.`);
178472
- return getCallGraphMvnLegacy(targetPath, timeout, customMavenArgs);
178473
- }
178474
- });
178475
- }
178476
- exports.getCallGraphMvn = getCallGraphMvn;
178477
- function getCallGraphGradle(targetPath, gradlePath = 'gradle', initScript, confAttrs, timeout) {
178478
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178479
- const [classPath, targets] = yield Promise.all([
178480
- metrics_1.timeIt('getGradleClassPath', () => gradle_wrapper_1.getClassPathFromGradle(targetPath, gradlePath, initScript, confAttrs)),
178481
- metrics_1.timeIt('getEntrypoints', () => findBuildDirs(targetPath, 'gradle')),
178482
- ]);
178483
- debug_1.debug(`got class path: ${classPath}`);
178484
- debug_1.debug(`got targets: ${targets}`);
178485
- return yield metrics_1.timeIt('getCallGraph', () => java_wrapper_1.getCallGraph(classPath, targetPath, targets, timeout));
178486
- });
178487
- }
178488
- exports.getCallGraphGradle = getCallGraphGradle;
178489
- function runtimeMetrics() {
178490
- return metrics_1.getMetrics();
178491
- }
178492
- exports.runtimeMetrics = runtimeMetrics;
178493
- function findBuildDirs(targetPath, packageManager) {
178494
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178495
- const targetFoldersByPackageManager = {
178496
- mvn: 'target',
178497
- gradle: 'build',
178498
- };
178499
- const targetDirs = yield promisified_fs_glob_1.glob(path.join(targetPath, `**/${targetFoldersByPackageManager[packageManager]}`));
178500
- if (!targetDirs.length) {
178501
- throw new errors_1.MissingTargetFolderError(targetPath, packageManager);
178502
- }
178503
- return targetDirs;
178504
- });
178505
- }
178506
- exports.findBuildDirs = findBuildDirs;
178507
- //# sourceMappingURL=index.js.map
178508
-
178509
- /***/ }),
178510
-
178511
- /***/ 60621:
178512
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178513
-
178514
- "use strict";
178515
-
178516
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178517
- exports.getCallGraph = exports.getClassPerJarMapping = exports.getCallGraphGenCommandArgs = void 0;
178518
- const tslib_1 = __webpack_require__(53784);
178519
- __webpack_require__(20406);
178520
- const jszip = __webpack_require__(66085);
178521
- const path = __webpack_require__(85622);
178522
- const config = __webpack_require__(93506);
178523
- const sub_process_1 = __webpack_require__(79838);
178524
- const fetch_snyk_java_call_graph_generator_1 = __webpack_require__(43206);
178525
- const call_graph_1 = __webpack_require__(39533);
178526
- const promisifedFs = __webpack_require__(47172);
178527
- const promisified_fs_glob_1 = __webpack_require__(47172);
178528
- const class_parsing_1 = __webpack_require__(61914);
178529
- const metrics_1 = __webpack_require__(83549);
178530
- const tempDir = __webpack_require__(21661);
178531
- function getCallGraphGenCommandArgs(classPath, jarPath, targets) {
178532
- return [
178533
- '-cp',
178534
- jarPath,
178535
- 'io.snyk.callgraph.app.App',
178536
- '--application-classpath-file',
178537
- classPath,
178538
- '--dirs-to-get-entrypoints',
178539
- targets.join(','),
178540
- ];
178541
- }
178542
- exports.getCallGraphGenCommandArgs = getCallGraphGenCommandArgs;
178543
- function getClassPerJarMapping(classPath) {
178544
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178545
- const classPerJarMapping = {};
178546
- for (const classPathItem of classPath.split(path.delimiter)) {
178547
- // classpath can also contain local directories with classes - we don't need them for package mapping
178548
- if (!classPathItem.endsWith('.jar')) {
178549
- continue;
178550
- }
178551
- const jarFileContent = yield promisified_fs_glob_1.readFile(classPathItem);
178552
- const jarContent = yield jszip.loadAsync(jarFileContent);
178553
- for (const classFile of Object.keys(jarContent.files).filter((name) => name.endsWith('.class'))) {
178554
- const className = class_parsing_1.toFQclassName(classFile.replace('.class', '')); // removing .class from name
178555
- classPerJarMapping[className] = classPathItem;
178556
- }
178557
- }
178558
- return classPerJarMapping;
178559
- });
178560
- }
178561
- exports.getClassPerJarMapping = getClassPerJarMapping;
178562
- function getCallGraph(classPath, targetPath, targets, timeout) {
178563
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178564
- const [jarPath, { tmpDir, classPathFile }] = yield Promise.all([
178565
- fetch_snyk_java_call_graph_generator_1.fetch(config.CALL_GRAPH_GENERATOR_URL, config.CALL_GRAPH_GENERATOR_CHECKSUM),
178566
- writeClassPathToTempDir(classPath),
178567
- ]);
178568
- const callgraphGenCommandArgs = getCallGraphGenCommandArgs(classPathFile, jarPath, targets);
178569
- try {
178570
- const [javaOutput, classPerJarMapping] = yield Promise.all([
178571
- metrics_1.timeIt('generateCallGraph', () => sub_process_1.execute('java', callgraphGenCommandArgs, {
178572
- cwd: targetPath,
178573
- timeout,
178574
- })),
178575
- metrics_1.timeIt('mapClassesPerJar', () => getClassPerJarMapping(classPath)),
178576
- ]);
178577
- return call_graph_1.buildCallGraph(javaOutput, classPerJarMapping);
178578
- }
178579
- finally {
178580
- // Fire and forget - we don't have to wait for a deletion of a temporary file
178581
- cleanupTempDir(classPathFile, tmpDir);
178582
- }
178583
- });
178584
- }
178585
- exports.getCallGraph = getCallGraph;
178586
- function writeClassPathToTempDir(classPath) {
178587
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178588
- const tmpDir = yield promisifedFs.mkdtemp(path.join(tempDir, 'call-graph-generator'));
178589
- const classPathFile = path.join(tmpDir, 'callgraph-classpath');
178590
- yield promisifedFs.writeFile(classPathFile, classPath);
178591
- return { tmpDir, classPathFile };
178592
- });
178593
- }
178594
- function cleanupTempDir(classPathFile, tmpDir) {
178595
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178596
- try {
178597
- yield promisifedFs.unlink(classPathFile);
178598
- yield promisifedFs.rmdir(tmpDir);
178599
- }
178600
- catch (_a) {
178601
- // we couldn't delete temporary data in temporary folder, no big deal
178602
- }
178603
- });
178604
- }
178605
- //# sourceMappingURL=java-wrapper.js.map
178606
-
178607
- /***/ }),
178608
-
178609
- /***/ 83549:
178610
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178611
-
178612
- "use strict";
178613
-
178614
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178615
- exports.getMetrics = exports.timeIt = void 0;
178616
- const tslib_1 = __webpack_require__(53784);
178617
- const metricsState = {
178618
- getEntrypoints: { seconds: 0, nanoseconds: 0 },
178619
- generateCallGraph: { seconds: 0, nanoseconds: 0 },
178620
- mapClassesPerJar: { seconds: 0, nanoseconds: 0 },
178621
- getCallGraph: { seconds: 0, nanoseconds: 0 },
178622
- };
178623
- function start(metric) {
178624
- const [secs, nsecs] = process.hrtime();
178625
- metricsState[metric] = { seconds: secs, nanoseconds: nsecs };
178626
- }
178627
- function stop(metric) {
178628
- const { seconds, nanoseconds } = metricsState[metric] || {
178629
- seconds: 0,
178630
- nanoseconds: 0,
178631
- };
178632
- const [secs, nsecs] = process.hrtime([seconds, nanoseconds]);
178633
- metricsState[metric] = { seconds: secs, nanoseconds: nsecs };
178634
- }
178635
- function getMetrics() {
178636
- const metrics = {};
178637
- for (const [metric, value] of Object.entries(metricsState)) {
178638
- if (!value) {
178639
- continue;
178640
- }
178641
- const { seconds, nanoseconds } = value;
178642
- metrics[metric] = seconds + nanoseconds / 1e9;
178643
- }
178644
- return metrics;
178645
- }
178646
- exports.getMetrics = getMetrics;
178647
- function timeIt(metric, fn) {
178648
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178649
- start(metric);
178650
- const x = yield fn();
178651
- stop(metric);
178652
- return x;
178653
- });
178654
- }
178655
- exports.timeIt = timeIt;
178656
- //# sourceMappingURL=metrics.js.map
178657
-
178658
- /***/ }),
178659
-
178660
- /***/ 42519:
178661
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178662
-
178663
- "use strict";
178664
-
178665
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178666
- exports.getClassPathFromMvn = exports.mergeMvnClassPaths = exports.parseMvnExecCommandOutput = exports.parseMvnDependencyPluginCommandOutput = exports.getMvnCommandArgsForMvnExec = void 0;
178667
- const tslib_1 = __webpack_require__(53784);
178668
- __webpack_require__(20406);
178669
- const sub_process_1 = __webpack_require__(79838);
178670
- const errors_1 = __webpack_require__(61640);
178671
- const path = __webpack_require__(85622);
178672
- const os = __webpack_require__(12087);
178673
- function getMvnCommandArgsForMvnExec(targetPath) {
178674
- return process.platform === 'win32'
178675
- ? [
178676
- '-q',
178677
- 'exec:exec',
178678
- '-Dexec.classpathScope="compile"',
178679
- '-Dexec.executable="cmd"',
178680
- '-Dexec.args="/c echo %classpath"',
178681
- '-f',
178682
- targetPath,
178683
- ]
178684
- : [
178685
- '-q',
178686
- 'exec:exec',
178687
- '-Dexec.classpathScope="compile"',
178688
- '-Dexec.executable="echo"',
178689
- '-Dexec.args="%classpath"',
178690
- '-f',
178691
- targetPath,
178692
- ];
178693
- }
178694
- exports.getMvnCommandArgsForMvnExec = getMvnCommandArgsForMvnExec;
178695
- function getMvnCommandArgsForDependencyPlugin(targetPath) {
178696
- return ['dependency:build-classpath', '-f', targetPath];
178697
- }
178698
- function parseMvnDependencyPluginCommandOutput(mvnCommandOutput) {
178699
- const outputLines = mvnCommandOutput.split(os.EOL);
178700
- const uniqueClassPaths = new Set();
178701
- let startIndex = 0;
178702
- let i = outputLines.indexOf('[INFO] Dependencies classpath:', startIndex);
178703
- while (i > -1) {
178704
- if (outputLines[i + 1] !== '') {
178705
- uniqueClassPaths.add(outputLines[i + 1]);
178706
- }
178707
- startIndex = i + 2;
178708
- i = outputLines.indexOf('[INFO] Dependencies classpath:', startIndex);
178709
- }
178710
- return Array.from(uniqueClassPaths.values()).sort();
178711
- }
178712
- exports.parseMvnDependencyPluginCommandOutput = parseMvnDependencyPluginCommandOutput;
178713
- function parseMvnExecCommandOutput(mvnCommandOutput) {
178714
- return mvnCommandOutput
178715
- .trim()
178716
- .split(os.EOL)
178717
- .sort();
178718
- }
178719
- exports.parseMvnExecCommandOutput = parseMvnExecCommandOutput;
178720
- function mergeMvnClassPaths(classPaths) {
178721
- // this magic joins all items in array with :, splits result by : again
178722
- // makes Set (to uniq items), create Array from it and join it by : to have
178723
- // proper path like format
178724
- return Array.from(new Set(classPaths.join(path.delimiter).split(path.delimiter)))
178725
- .sort()
178726
- .join(path.delimiter);
178727
- }
178728
- exports.mergeMvnClassPaths = mergeMvnClassPaths;
178729
- function getClassPathFromMvn(targetPath, customMavenArgs = []) {
178730
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178731
- let classPaths = [];
178732
- let args = [];
178733
- try {
178734
- try {
178735
- // there are two ways of getting classpath - either from maven plugin or by exec command
178736
- // try `mvn exec` for classpath
178737
- args = getMvnCommandArgsForMvnExec(targetPath).concat(customMavenArgs);
178738
- const output = yield sub_process_1.execute('mvn', args, { cwd: targetPath });
178739
- classPaths = parseMvnExecCommandOutput(output);
178740
- }
178741
- catch (e) {
178742
- // if it fails, try mvn dependency:build-classpath
178743
- // TODO send error message for further analysis
178744
- args = getMvnCommandArgsForDependencyPlugin(targetPath).concat(customMavenArgs);
178745
- const output = yield sub_process_1.execute('mvn', args, { cwd: targetPath });
178746
- classPaths = parseMvnDependencyPluginCommandOutput(output);
178747
- }
178748
- }
178749
- catch (e) {
178750
- throw new errors_1.ClassPathGenerationError(e);
178751
- }
178752
- if (classPaths.length === 0) {
178753
- throw new errors_1.EmptyClassPathError(`mvn ${args.join(' ')}`);
178754
- }
178755
- return mergeMvnClassPaths(classPaths);
178756
- });
178757
- }
178758
- exports.getClassPathFromMvn = getClassPathFromMvn;
178759
- //# sourceMappingURL=mvn-wrapper-legacy.js.map
178760
-
178761
- /***/ }),
178762
-
178763
- /***/ 384:
178764
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178765
-
178766
- "use strict";
178767
-
178768
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178769
- exports.makeMavenProject = exports.makeMavenModule = exports.MavenProject = exports.MavenModule = exports.parseModuleNames = exports.getDepsClassPath = exports.getOutputDir = exports.getBuildDir = exports.withOutputToTemporaryFile = void 0;
178770
- const tslib_1 = __webpack_require__(53784);
178771
- __webpack_require__(20406);
178772
- const path = __webpack_require__(85622);
178773
- const fs = __webpack_require__(35747);
178774
- const xmlJs = __webpack_require__(7888);
178775
- const classpath_1 = __webpack_require__(1268);
178776
- const tmp = __webpack_require__(84688);
178777
- const sub_process_1 = __webpack_require__(79838);
178778
- const errors_1 = __webpack_require__(61640);
178779
- const metrics_1 = __webpack_require__(83549);
178780
- const debug_1 = __webpack_require__(13062);
178781
- // Low level helper functions
178782
- function withOutputToTemporaryFile(f) {
178783
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178784
- // NOTE(alexmu): We have to do this little dance with output written to files
178785
- // because that seems to be the only way to get the output without having to
178786
- // parse maven logs
178787
- const file = tmp.fileSync({ discardDescriptor: true });
178788
- try {
178789
- yield f(file.name);
178790
- }
178791
- catch (e) {
178792
- debug_1.debug(`Failed to execute command with temporary file: ${e}`);
178793
- throw e;
178794
- }
178795
- try {
178796
- return fs.readFileSync(file.name, 'utf8');
178797
- }
178798
- catch (e) {
178799
- debug_1.debug(`Failed to read temporary file: ${e}`);
178800
- throw e;
178801
- }
178802
- });
178803
- }
178804
- exports.withOutputToTemporaryFile = withOutputToTemporaryFile;
178805
- function runCommand(projectDirectory, args) {
178806
- return sub_process_1.execute('mvn', args.concat(['-f', projectDirectory]), {
178807
- cwd: projectDirectory,
178808
- });
178809
- }
178810
- // Domain specific helpers
178811
- function evaluateExpression(projectDirectory, expression, customMavenArgs = []) {
178812
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178813
- return yield withOutputToTemporaryFile((outputFile) => tslib_1.__awaiter(this, void 0, void 0, function* () {
178814
- yield runCommand(projectDirectory, [
178815
- 'help:evaluate',
178816
- `-Dexpression="${expression}"`,
178817
- `-Doutput=${outputFile}`,
178818
- ...customMavenArgs,
178819
- ]);
178820
- }));
178821
- });
178822
- }
178823
- function getBuildDir(baseDir, customMavenArgs) {
178824
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178825
- return yield evaluateExpression(baseDir, 'project.build.directory', customMavenArgs);
178826
- });
178827
- }
178828
- exports.getBuildDir = getBuildDir;
178829
- function getOutputDir(baseDir, customMavenArgs) {
178830
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178831
- return yield evaluateExpression(baseDir, 'project.build.outputDirectory', customMavenArgs);
178832
- });
178833
- }
178834
- exports.getOutputDir = getOutputDir;
178835
- function getDepsClassPath(baseDir, customMavenArgs = []) {
178836
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178837
- const classPath = yield withOutputToTemporaryFile((outputFile) => tslib_1.__awaiter(this, void 0, void 0, function* () {
178838
- yield runCommand(baseDir, [
178839
- 'dependency:build-classpath',
178840
- `-Dmdep.outputFile=${outputFile}`,
178841
- ...customMavenArgs,
178842
- ]);
178843
- }));
178844
- return new classpath_1.ClassPath(classPath);
178845
- });
178846
- }
178847
- exports.getDepsClassPath = getDepsClassPath;
178848
- function parseModuleNames(modulesXml) {
178849
- const modulesSpec = xmlJs.xml2js(modulesXml, { compact: true });
178850
- if ('strings' in modulesSpec && 'string' in modulesSpec['strings']) {
178851
- debug_1.debug(`Found 'strings' in the modules XML`);
178852
- return modulesSpec['strings']['string'].map((s) => s['_text']);
178853
- }
178854
- else if ('modules' in modulesSpec) {
178855
- debug_1.debug(`Empty modules XML`);
178856
- return [];
178857
- }
178858
- else {
178859
- throw new errors_1.MalformedModulesSpecError(modulesXml);
178860
- }
178861
- }
178862
- exports.parseModuleNames = parseModuleNames;
178863
- // Maven model
178864
- class MavenModule {
178865
- constructor(baseDir, buildDirectory, outputDirectory, dependenciesClassPath) {
178866
- if ((buildDirectory === null || buildDirectory === void 0 ? void 0 : buildDirectory.length) === 0) {
178867
- throw new Error(`Empty build directory for the project in: ${baseDir}`);
178868
- }
178869
- if ((outputDirectory === null || outputDirectory === void 0 ? void 0 : outputDirectory.length) === 0) {
178870
- throw new Error(`Empty output directory for the project in: ${baseDir}`);
178871
- }
178872
- if (dependenciesClassPath === null || dependenciesClassPath === void 0 ? void 0 : dependenciesClassPath.isEmpty()) {
178873
- throw new Error(`Empty dependencies for the project in: ${baseDir}`);
178874
- }
178875
- this.baseDirectory = baseDir;
178876
- this.buildDirectory = buildDirectory;
178877
- this.outputDirectory = outputDirectory;
178878
- this.dependenciesClassPath = dependenciesClassPath;
178879
- }
178880
- getClassPath() {
178881
- debug_1.debug(`Dependencies class path: ${this.dependenciesClassPath}`);
178882
- debug_1.debug(`Output directory: ${this.outputDirectory}`);
178883
- return this.dependenciesClassPath.concat(new classpath_1.ClassPath(this.outputDirectory));
177926
+ return 'gradle';
177927
+ }
177928
+ function formatArgWithWhiteSpace(arg) {
177929
+ if (/\s/.test(arg)) {
177930
+ return quot + arg + quot;
178884
177931
  }
177932
+ return arg;
178885
177933
  }
178886
- exports.MavenModule = MavenModule;
178887
- class MavenProject {
178888
- constructor(baseDir, modules) {
178889
- if ((modules === null || modules === void 0 ? void 0 : modules.length) === 0) {
178890
- throw new Error(`Empty module list for the project in: ${baseDir}`);
177934
+ exports.formatArgWithWhiteSpace = formatArgWithWhiteSpace;
177935
+ function buildArgs(root, targetFile, initGradlePath, options) {
177936
+ const args = [];
177937
+ args.push('snykResolvedDepsJson', '-q');
177938
+ if (targetFile) {
177939
+ if (!fs.existsSync(path.resolve(root, targetFile))) {
177940
+ throw new Error('File not found: "' + targetFile + '"');
178891
177941
  }
178892
- this.baseDir = baseDir;
178893
- this.modules = modules;
177942
+ args.push('--build-file');
177943
+ const formattedTargetFile = formatArgWithWhiteSpace(targetFile);
177944
+ args.push(formattedTargetFile);
178894
177945
  }
178895
- getClassPath() {
178896
- const classPaths = this.modules.map((module) => module.getClassPath());
178897
- const cp = classPaths.reduce((cp1, cp2) => cp1.concat(cp2));
178898
- debug_1.debug(`Project class path: ${cp}`);
178899
- return cp.toString();
177946
+ // Arguments to init script are supplied as properties: https://stackoverflow.com/a/48370451
177947
+ if (options['configuration-matching']) {
177948
+ args.push(`-Pconfiguration=${quot}${options['configuration-matching']}${quot}`);
178900
177949
  }
178901
- }
178902
- exports.MavenProject = MavenProject;
178903
- // Factories that deal with the low level details
178904
- function makeMavenModule(baseDir, args) {
178905
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178906
- const buildDir = yield getBuildDir(baseDir, args);
178907
- const outputDir = yield getOutputDir(baseDir, args);
178908
- const depsClassPath = yield metrics_1.timeIt('getMvnClassPath', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
178909
- return yield getDepsClassPath(baseDir, args);
178910
- }));
178911
- return new MavenModule(baseDir, buildDir, outputDir, depsClassPath);
177950
+ if (options['configuration-attributes']) {
177951
+ args.push(`-PconfAttr=${quot}${options['configuration-attributes']}${quot}`);
177952
+ }
177953
+ if (options.initScript) {
177954
+ const formattedInitScript = formatArgWithWhiteSpace(path.resolve(options.initScript));
177955
+ args.push('--init-script', formattedInitScript);
177956
+ }
177957
+ if (!options.daemon) {
177958
+ args.push('--no-daemon');
177959
+ }
177960
+ // Parallel builds can cause race conditions and multiple JSONDEPS lines in the output
177961
+ // Gradle 4.3.0+ has `--no-parallel` flag, but we want to support older versions.
177962
+ // Not `=false` to be compatible with 3.5.x: https://github.com/gradle/gradle/issues/1827
177963
+ args.push('-Dorg.gradle.parallel=');
177964
+ // Since version 4.3.0+ Gradle uses different console output mechanism. Default mode is 'auto',
177965
+ // if Gradle is attached to a terminal. It means build output will use ANSI control characters
177966
+ // to generate the rich output, therefore JSON cannot be parsed.
177967
+ args.push('-Dorg.gradle.console=plain');
177968
+ if (!cli_interface_1.legacyPlugin.isMultiSubProject(options)) {
177969
+ args.push('-PonlySubProject=' + (options.subProject || '.'));
177970
+ }
177971
+ args.push('-I ' + initGradlePath);
177972
+ if (options.args) {
177973
+ args.push(...options.args);
177974
+ }
177975
+ // There might be a legacy --configuration option in 'args'.
177976
+ // It has been superseded by --configuration-matching option for Snyk CLI (see buildArgs),
177977
+ // but we are handling it to support the legacy setups.
177978
+ args.forEach((a, i) => {
177979
+ // Transform --configuration=foo
177980
+ args[i] = a.replace(/^--configuration[= ]([a-zA-Z_]+)/, `-Pconfiguration=${quot}^$1$$${quot}`);
177981
+ // Transform --configuration foo
177982
+ if (a === '--configuration') {
177983
+ args[i] = `-Pconfiguration=${quot}^${args[i + 1]}$${quot}`;
177984
+ args[i + 1] = '';
177985
+ }
178912
177986
  });
177987
+ return args;
178913
177988
  }
178914
- exports.makeMavenModule = makeMavenModule;
178915
- function makeMavenProject(baseDir, customMavenArgs) {
178916
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
178917
- const modulesXml = yield evaluateExpression(baseDir, 'project.modules', customMavenArgs);
178918
- const moduleNames = parseModuleNames(modulesXml);
178919
- const modules = [yield makeMavenModule(baseDir, customMavenArgs)];
178920
- const submodules = yield Promise.all(moduleNames.map((name) => makeMavenModule(path.join(baseDir, name))));
178921
- modules.push(...submodules);
178922
- const validModules = modules.filter((module) => fs.existsSync(module.buildDirectory));
178923
- return new MavenProject(baseDir, validModules);
178924
- });
177989
+ async function getCallGraph(targetPath, command, initScriptPath, confAttrs, timeout) {
177990
+ try {
177991
+ debugLog(`getting call graph from path ${targetPath}`);
177992
+ const callGraph = await javaCallGraphBuilder.getCallGraphGradle(path.dirname(targetPath), command, initScriptPath, confAttrs, timeout);
177993
+ debugLog('got call graph successfully');
177994
+ return callGraph;
177995
+ }
177996
+ catch (e) {
177997
+ debugLog('call graph error: ' + e);
177998
+ return {
177999
+ message: e.message,
178000
+ innerError: e.innerError || e,
178001
+ };
178002
+ }
178925
178003
  }
178926
- exports.makeMavenProject = makeMavenProject;
178927
- //# sourceMappingURL=mvn-wrapper.js.map
178928
-
178929
- /***/ }),
178930
-
178931
- /***/ 47172:
178932
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178933
-
178934
- "use strict";
178935
-
178936
- Object.defineProperty(exports, "__esModule", ({ value: true }));
178937
- exports.glob = exports.rmdir = exports.writeFile = exports.readFile = exports.mkdtemp = exports.mkdir = exports.unlink = exports.rename = exports.exists = void 0;
178938
- const util_1 = __webpack_require__(31669);
178939
- const fs = __webpack_require__(35747);
178940
- const globOrig = __webpack_require__(12884);
178941
- exports.exists = util_1.promisify(fs.exists);
178942
- exports.rename = util_1.promisify(fs.rename);
178943
- exports.unlink = util_1.promisify(fs.unlink);
178944
- exports.mkdir = util_1.promisify(fs.mkdir);
178945
- exports.mkdtemp = util_1.promisify(fs.mkdtemp);
178946
- exports.readFile = util_1.promisify(fs.readFile);
178947
- exports.writeFile = util_1.promisify(fs.writeFile);
178948
- exports.rmdir = util_1.promisify(fs.rmdir);
178949
- exports.glob = util_1.promisify(globOrig);
178950
- //# sourceMappingURL=promisified-fs-glob.js.map
178004
+ exports.exportsForTests = {
178005
+ buildArgs,
178006
+ extractJsonFromScriptOutput,
178007
+ getVersionBuildInfo,
178008
+ toCamelCase,
178009
+ getGradleAttributesPretty: gradle_attributes_pretty_1.getGradleAttributesPretty,
178010
+ getPluginFileName,
178011
+ };
178012
+ //# sourceMappingURL=index.js.map
178951
178013
 
178952
178014
  /***/ }),
178953
178015
 
178954
- /***/ 79838:
178016
+ /***/ 84335:
178955
178017
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
178956
178018
 
178957
178019
  "use strict";
@@ -178959,9 +178021,10 @@ exports.glob = util_1.promisify(globOrig);
178959
178021
  Object.defineProperty(exports, "__esModule", ({ value: true }));
178960
178022
  exports.execute = void 0;
178961
178023
  const childProcess = __webpack_require__(63129);
178962
- const debug_1 = __webpack_require__(13062);
178963
- const errors_1 = __webpack_require__(61640);
178964
- function execute(command, args, options) {
178024
+ const debugModule = __webpack_require__(15158);
178025
+ const debugLogging = debugModule('snyk-gradle-plugin');
178026
+ // Executes a subprocess. Resolves successfully with stdout contents if the exit code is 0.
178027
+ function execute(command, args, options, perLineCallback) {
178965
178028
  const spawnOptions = { shell: true };
178966
178029
  if (options && options.cwd) {
178967
178030
  spawnOptions.cwd = options.cwd;
@@ -178969,36 +178032,31 @@ function execute(command, args, options) {
178969
178032
  return new Promise((resolve, reject) => {
178970
178033
  let stdout = '';
178971
178034
  let stderr = '';
178972
- debug_1.debug(`executing command: "${command} ${args.join(' ')}"`);
178973
178035
  const proc = childProcess.spawn(command, args, spawnOptions);
178974
- let timerId = null;
178975
- if (options === null || options === void 0 ? void 0 : options.timeout) {
178976
- timerId = setTimeout(() => {
178977
- proc.kill();
178978
- const err = new errors_1.SubprocessTimeoutError(command, args.join(' '), options.timeout || 0);
178979
- debug_1.debug(err.message);
178980
- reject(err);
178981
- }, options.timeout);
178982
- }
178983
178036
  proc.stdout.on('data', (data) => {
178984
- stdout = stdout + data;
178037
+ const strData = data.toString();
178038
+ stdout = stdout + strData;
178039
+ if (perLineCallback) {
178040
+ strData.split('\n').forEach(perLineCallback);
178041
+ }
178985
178042
  });
178986
178043
  proc.stderr.on('data', (data) => {
178987
178044
  stderr = stderr + data;
178988
178045
  });
178989
178046
  proc.on('close', (code) => {
178990
- if (timerId !== null) {
178991
- clearTimeout(timerId);
178992
- }
178993
178047
  if (code !== 0) {
178994
- const trimmedStackTrace = stderr
178995
- .replace(/\t/g, '')
178996
- .split('\n')
178997
- .slice(0, 5)
178998
- .join(', ');
178999
- const err = new errors_1.SubprocessError(command, args.join(' '), code, trimmedStackTrace);
179000
- debug_1.debug(err.message);
179001
- return reject(err);
178048
+ const fullCommand = command + ' ' + args.join(' ');
178049
+ return reject(new Error(`
178050
+ >>> command: ${fullCommand}
178051
+ >>> exit code: ${code}
178052
+ >>> stdout:
178053
+ ${stdout}
178054
+ >>> stderr:
178055
+ ${stderr}
178056
+ `));
178057
+ }
178058
+ if (stderr) {
178059
+ debugLogging('subprocess exit code = 0, but stderr was not empty: ' + stderr);
179002
178060
  }
179003
178061
  resolve(stdout);
179004
178062
  });
@@ -179007,258 +178065,6 @@ function execute(command, args, options) {
179007
178065
  exports.execute = execute;
179008
178066
  //# sourceMappingURL=sub-process.js.map
179009
178067
 
179010
- /***/ }),
179011
-
179012
- /***/ 53784:
179013
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
179014
-
179015
- "use strict";
179016
- __webpack_require__.r(__webpack_exports__);
179017
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
179018
- /* harmony export */ "__extends": () => (/* binding */ __extends),
179019
- /* harmony export */ "__assign": () => (/* binding */ __assign),
179020
- /* harmony export */ "__rest": () => (/* binding */ __rest),
179021
- /* harmony export */ "__decorate": () => (/* binding */ __decorate),
179022
- /* harmony export */ "__param": () => (/* binding */ __param),
179023
- /* harmony export */ "__metadata": () => (/* binding */ __metadata),
179024
- /* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
179025
- /* harmony export */ "__generator": () => (/* binding */ __generator),
179026
- /* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
179027
- /* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
179028
- /* harmony export */ "__values": () => (/* binding */ __values),
179029
- /* harmony export */ "__read": () => (/* binding */ __read),
179030
- /* harmony export */ "__spread": () => (/* binding */ __spread),
179031
- /* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
179032
- /* harmony export */ "__await": () => (/* binding */ __await),
179033
- /* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
179034
- /* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
179035
- /* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
179036
- /* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
179037
- /* harmony export */ "__importStar": () => (/* binding */ __importStar),
179038
- /* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
179039
- /* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
179040
- /* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet)
179041
- /* harmony export */ });
179042
- /*! *****************************************************************************
179043
- Copyright (c) Microsoft Corporation.
179044
-
179045
- Permission to use, copy, modify, and/or distribute this software for any
179046
- purpose with or without fee is hereby granted.
179047
-
179048
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
179049
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
179050
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
179051
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
179052
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
179053
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
179054
- PERFORMANCE OF THIS SOFTWARE.
179055
- ***************************************************************************** */
179056
- /* global Reflect, Promise */
179057
-
179058
- var extendStatics = function(d, b) {
179059
- extendStatics = Object.setPrototypeOf ||
179060
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
179061
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
179062
- return extendStatics(d, b);
179063
- };
179064
-
179065
- function __extends(d, b) {
179066
- extendStatics(d, b);
179067
- function __() { this.constructor = d; }
179068
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
179069
- }
179070
-
179071
- var __assign = function() {
179072
- __assign = Object.assign || function __assign(t) {
179073
- for (var s, i = 1, n = arguments.length; i < n; i++) {
179074
- s = arguments[i];
179075
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
179076
- }
179077
- return t;
179078
- }
179079
- return __assign.apply(this, arguments);
179080
- }
179081
-
179082
- function __rest(s, e) {
179083
- var t = {};
179084
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
179085
- t[p] = s[p];
179086
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
179087
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
179088
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
179089
- t[p[i]] = s[p[i]];
179090
- }
179091
- return t;
179092
- }
179093
-
179094
- function __decorate(decorators, target, key, desc) {
179095
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
179096
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
179097
- 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;
179098
- return c > 3 && r && Object.defineProperty(target, key, r), r;
179099
- }
179100
-
179101
- function __param(paramIndex, decorator) {
179102
- return function (target, key) { decorator(target, key, paramIndex); }
179103
- }
179104
-
179105
- function __metadata(metadataKey, metadataValue) {
179106
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
179107
- }
179108
-
179109
- function __awaiter(thisArg, _arguments, P, generator) {
179110
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
179111
- return new (P || (P = Promise))(function (resolve, reject) {
179112
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
179113
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
179114
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
179115
- step((generator = generator.apply(thisArg, _arguments || [])).next());
179116
- });
179117
- }
179118
-
179119
- function __generator(thisArg, body) {
179120
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
179121
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
179122
- function verb(n) { return function (v) { return step([n, v]); }; }
179123
- function step(op) {
179124
- if (f) throw new TypeError("Generator is already executing.");
179125
- while (_) try {
179126
- 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;
179127
- if (y = 0, t) op = [op[0] & 2, t.value];
179128
- switch (op[0]) {
179129
- case 0: case 1: t = op; break;
179130
- case 4: _.label++; return { value: op[1], done: false };
179131
- case 5: _.label++; y = op[1]; op = [0]; continue;
179132
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
179133
- default:
179134
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
179135
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
179136
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
179137
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
179138
- if (t[2]) _.ops.pop();
179139
- _.trys.pop(); continue;
179140
- }
179141
- op = body.call(thisArg, _);
179142
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
179143
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
179144
- }
179145
- }
179146
-
179147
- function __createBinding(o, m, k, k2) {
179148
- if (k2 === undefined) k2 = k;
179149
- o[k2] = m[k];
179150
- }
179151
-
179152
- function __exportStar(m, exports) {
179153
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
179154
- }
179155
-
179156
- function __values(o) {
179157
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
179158
- if (m) return m.call(o);
179159
- if (o && typeof o.length === "number") return {
179160
- next: function () {
179161
- if (o && i >= o.length) o = void 0;
179162
- return { value: o && o[i++], done: !o };
179163
- }
179164
- };
179165
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
179166
- }
179167
-
179168
- function __read(o, n) {
179169
- var m = typeof Symbol === "function" && o[Symbol.iterator];
179170
- if (!m) return o;
179171
- var i = m.call(o), r, ar = [], e;
179172
- try {
179173
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
179174
- }
179175
- catch (error) { e = { error: error }; }
179176
- finally {
179177
- try {
179178
- if (r && !r.done && (m = i["return"])) m.call(i);
179179
- }
179180
- finally { if (e) throw e.error; }
179181
- }
179182
- return ar;
179183
- }
179184
-
179185
- function __spread() {
179186
- for (var ar = [], i = 0; i < arguments.length; i++)
179187
- ar = ar.concat(__read(arguments[i]));
179188
- return ar;
179189
- }
179190
-
179191
- function __spreadArrays() {
179192
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
179193
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
179194
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
179195
- r[k] = a[j];
179196
- return r;
179197
- };
179198
-
179199
- function __await(v) {
179200
- return this instanceof __await ? (this.v = v, this) : new __await(v);
179201
- }
179202
-
179203
- function __asyncGenerator(thisArg, _arguments, generator) {
179204
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
179205
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
179206
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
179207
- 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); }); }; }
179208
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
179209
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
179210
- function fulfill(value) { resume("next", value); }
179211
- function reject(value) { resume("throw", value); }
179212
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
179213
- }
179214
-
179215
- function __asyncDelegator(o) {
179216
- var i, p;
179217
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
179218
- 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; }
179219
- }
179220
-
179221
- function __asyncValues(o) {
179222
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
179223
- var m = o[Symbol.asyncIterator], i;
179224
- 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);
179225
- 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); }); }; }
179226
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
179227
- }
179228
-
179229
- function __makeTemplateObject(cooked, raw) {
179230
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
179231
- return cooked;
179232
- };
179233
-
179234
- function __importStar(mod) {
179235
- if (mod && mod.__esModule) return mod;
179236
- var result = {};
179237
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
179238
- result.default = mod;
179239
- return result;
179240
- }
179241
-
179242
- function __importDefault(mod) {
179243
- return (mod && mod.__esModule) ? mod : { default: mod };
179244
- }
179245
-
179246
- function __classPrivateFieldGet(receiver, privateMap) {
179247
- if (!privateMap.has(receiver)) {
179248
- throw new TypeError("attempted to get private field on non-instance");
179249
- }
179250
- return privateMap.get(receiver);
179251
- }
179252
-
179253
- function __classPrivateFieldSet(receiver, privateMap, value) {
179254
- if (!privateMap.has(receiver)) {
179255
- throw new TypeError("attempted to set private field on non-instance");
179256
- }
179257
- privateMap.set(receiver, value);
179258
- return value;
179259
- }
179260
-
179261
-
179262
178068
  /***/ }),
179263
178069
 
179264
178070
  /***/ 48959:
@@ -179861,80 +178667,6 @@ module.exports = {
179861
178667
  };
179862
178668
 
179863
178669
 
179864
- /***/ }),
179865
-
179866
- /***/ 65692:
179867
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
179868
-
179869
- "use strict";
179870
-
179871
-
179872
- var vendors = __webpack_require__(21520)
179873
-
179874
- var env = process.env
179875
-
179876
- // Used for testing only
179877
- Object.defineProperty(exports, "_vendors", ({
179878
- value: vendors.map(function (v) { return v.constant })
179879
- }))
179880
-
179881
- exports.name = null
179882
- exports.isPR = null
179883
-
179884
- vendors.forEach(function (vendor) {
179885
- var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]
179886
- var isCI = envs.every(function (obj) {
179887
- return checkEnv(obj)
179888
- })
179889
-
179890
- exports[vendor.constant] = isCI
179891
-
179892
- if (isCI) {
179893
- exports.name = vendor.name
179894
-
179895
- switch (typeof vendor.pr) {
179896
- case 'string':
179897
- // "pr": "CIRRUS_PR"
179898
- exports.isPR = !!env[vendor.pr]
179899
- break
179900
- case 'object':
179901
- if ('env' in vendor.pr) {
179902
- // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
179903
- exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne
179904
- } else if ('any' in vendor.pr) {
179905
- // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
179906
- exports.isPR = vendor.pr.any.some(function (key) {
179907
- return !!env[key]
179908
- })
179909
- } else {
179910
- // "pr": { "DRONE_BUILD_EVENT": "pull_request" }
179911
- exports.isPR = checkEnv(vendor.pr)
179912
- }
179913
- break
179914
- default:
179915
- // PR detection not supported for this vendor
179916
- exports.isPR = null
179917
- }
179918
- }
179919
- })
179920
-
179921
- exports.isCI = !!(
179922
- env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
179923
- env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
179924
- env.BUILD_NUMBER || // Jenkins, TeamCity
179925
- env.RUN_ID || // TaskCluster, dsari
179926
- exports.name ||
179927
- false
179928
- )
179929
-
179930
- function checkEnv (obj) {
179931
- if (typeof obj === 'string') return !!env[obj]
179932
- return Object.keys(obj).every(function (k) {
179933
- return env[k] === obj[k]
179934
- })
179935
- }
179936
-
179937
-
179938
178670
  /***/ }),
179939
178671
 
179940
178672
  /***/ 99595:
@@ -259469,14 +258201,6 @@ module.exports = JSON.parse('[{"name":"AppVeyor","constant":"APPVEYOR","env":"AP
259469
258201
 
259470
258202
  /***/ }),
259471
258203
 
259472
- /***/ 21520:
259473
- /***/ ((module) => {
259474
-
259475
- "use strict";
259476
- 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"}}]');
259477
-
259478
- /***/ }),
259479
-
259480
258204
  /***/ 66674:
259481
258205
  /***/ ((module) => {
259482
258206