snyk 1.995.0 → 1.996.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.
@@ -146019,6 +146019,156 @@ var upperFirst = createCaseFirst('toUpperCase');
146019
146019
  module.exports = upperFirst;
146020
146020
 
146021
146021
 
146022
+ /***/ }),
146023
+
146024
+ /***/ 77103:
146025
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
146026
+
146027
+ "use strict";
146028
+
146029
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
146030
+ if (k2 === undefined) k2 = k;
146031
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
146032
+ }) : (function(o, m, k, k2) {
146033
+ if (k2 === undefined) k2 = k;
146034
+ o[k2] = m[k];
146035
+ }));
146036
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
146037
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
146038
+ }) : function(o, v) {
146039
+ o["default"] = v;
146040
+ });
146041
+ var __importStar = (this && this.__importStar) || function (mod) {
146042
+ if (mod && mod.__esModule) return mod;
146043
+ var result = {};
146044
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
146045
+ __setModuleDefault(result, mod);
146046
+ return result;
146047
+ };
146048
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
146049
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
146050
+ return new (P || (P = Promise))(function (resolve, reject) {
146051
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
146052
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
146053
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
146054
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
146055
+ });
146056
+ };
146057
+ var __generator = (this && this.__generator) || function (thisArg, body) {
146058
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
146059
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
146060
+ function verb(n) { return function (v) { return step([n, v]); }; }
146061
+ function step(op) {
146062
+ if (f) throw new TypeError("Generator is already executing.");
146063
+ while (_) try {
146064
+ 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;
146065
+ if (y = 0, t) op = [op[0] & 2, t.value];
146066
+ switch (op[0]) {
146067
+ case 0: case 1: t = op; break;
146068
+ case 4: _.label++; return { value: op[1], done: false };
146069
+ case 5: _.label++; y = op[1]; op = [0]; continue;
146070
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
146071
+ default:
146072
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
146073
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
146074
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
146075
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
146076
+ if (t[2]) _.ops.pop();
146077
+ _.trys.pop(); continue;
146078
+ }
146079
+ op = body.call(thisArg, _);
146080
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
146081
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
146082
+ }
146083
+ };
146084
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
146085
+ exports.lookpath = void 0;
146086
+ var fs = __importStar(__webpack_require__(35747));
146087
+ var path = __importStar(__webpack_require__(85622));
146088
+ var isWindows = /^win/i.test(process.platform);
146089
+ /**
146090
+ * Sometimes, people want to look for local executable files
146091
+ * which are specified with either relative or absolute file path.
146092
+ * @private
146093
+ * @param cmd
146094
+ * @return {string} An absolute path of given command, or undefined.
146095
+ */
146096
+ var isFilepath = function (cmd) {
146097
+ return cmd.includes(path.sep) ? path.resolve(cmd) : undefined;
146098
+ };
146099
+ /**
146100
+ * Just promisifies "fs.access"
146101
+ * @private
146102
+ * @param {string} fpath An absolute file path with an applicable extension appended.
146103
+ * @return {Promise<string>} Resolves absolute path or empty string.
146104
+ */
146105
+ var access = function (fpath) {
146106
+ return new Promise(function (resolve) { return fs.access(fpath, fs.constants.X_OK, function (err) { return resolve(err ? undefined : fpath); }); });
146107
+ };
146108
+ /**
146109
+ * Resolves if the given file is executable or not, regarding "PATHEXT" to be applied.
146110
+ * @private
146111
+ * @param {string} abspath A file path to be checked.
146112
+ * @return {Promise<string>} Resolves the absolute file path just checked, or undefined.
146113
+ */
146114
+ var isExecutable = function (abspath, opt) {
146115
+ if (opt === void 0) { opt = {}; }
146116
+ return __awaiter(void 0, void 0, void 0, function () {
146117
+ var envvars, exts, bins;
146118
+ return __generator(this, function (_a) {
146119
+ switch (_a.label) {
146120
+ case 0:
146121
+ envvars = opt.env || process.env;
146122
+ exts = (envvars.PATHEXT || '').split(path.delimiter).concat('');
146123
+ return [4 /*yield*/, Promise.all(exts.map(function (ext) { return access(abspath + ext); }))];
146124
+ case 1:
146125
+ bins = _a.sent();
146126
+ return [2 /*return*/, bins.find(function (bin) { return !!bin; })];
146127
+ }
146128
+ });
146129
+ });
146130
+ };
146131
+ /**
146132
+ * Returns a list of directories on which the target command should be looked for.
146133
+ * @private
146134
+ * @param {string[]} opt.include Will be added to "PATH" env.
146135
+ * @param {string[]} opt.exclude Will be filtered from "PATH" env.
146136
+ * @return {string[]} Directories to dig into.
146137
+ */
146138
+ var getDirsToWalkThrough = function (opt) {
146139
+ var envvars = opt.env || process.env;
146140
+ var envname = isWindows ? 'Path' : 'PATH';
146141
+ return (envvars[envname] || '').split(path.delimiter).concat(opt.include || []).filter(function (p) { return !(opt.exclude || []).includes(p); });
146142
+ };
146143
+ /**
146144
+ * Returns async promise with absolute file path of given command,
146145
+ * and resolves with undefined if the command not found.
146146
+ * @param {string} command Command name to look for.
146147
+ * @param {LookPathOption} opt Options for lookpath.
146148
+ * @return {Promise<string|undefined>} Resolves absolute file path, or undefined if not found.
146149
+ */
146150
+ function lookpath(command, opt) {
146151
+ if (opt === void 0) { opt = {}; }
146152
+ return __awaiter(this, void 0, void 0, function () {
146153
+ var directpath, dirs, bins;
146154
+ return __generator(this, function (_a) {
146155
+ switch (_a.label) {
146156
+ case 0:
146157
+ directpath = isFilepath(command);
146158
+ if (directpath)
146159
+ return [2 /*return*/, isExecutable(directpath, opt)];
146160
+ dirs = getDirsToWalkThrough(opt);
146161
+ return [4 /*yield*/, Promise.all(dirs.map(function (dir) { return isExecutable(path.join(dir, command), opt); }))];
146162
+ case 1:
146163
+ bins = _a.sent();
146164
+ return [2 /*return*/, bins.find(function (bin) { return !!bin; })];
146165
+ }
146166
+ });
146167
+ });
146168
+ }
146169
+ exports.lookpath = lookpath;
146170
+
146171
+
146022
146172
  /***/ }),
146023
146173
 
146024
146174
  /***/ 25989:
@@ -174629,6 +174779,7 @@ exports.jsonParse = exports.buildDepGraphFromImportsAndModules = exports.inspect
174629
174779
  const fs = __webpack_require__(35747);
174630
174780
  const path = __webpack_require__(85622);
174631
174781
  const tmp = __webpack_require__(91406);
174782
+ const lookpath_1 = __webpack_require__(77103);
174632
174783
  const debugLib = __webpack_require__(15158);
174633
174784
  const graphlib = __webpack_require__(39322);
174634
174785
  const dep_graph_1 = __webpack_require__(71479);
@@ -174639,6 +174790,10 @@ const debug = debugLib('snyk-go-plugin');
174639
174790
  const VIRTUAL_ROOT_NODE_ID = '.';
174640
174791
  async function inspect(root, targetFile, options = {}) {
174641
174792
  options.debug ? debugLib.enable('snyk-go-plugin') : debugLib.disable();
174793
+ const goPath = await lookpath_1.lookpath('go');
174794
+ if (!goPath) {
174795
+ throw new Error('The "go" command is not available on your system. To scan your dependencies in the CLI, you must ensure you have first installed the relevant package manager.');
174796
+ }
174642
174797
  const result = await Promise.all([
174643
174798
  getMetaData(root, targetFile),
174644
174799
  getDependencies(root, targetFile, options.args),
@@ -175055,8 +175210,8 @@ function isBuiltinPackage(pkgName) {
175055
175210
  Object.defineProperty(exports, "__esModule", ({ value: true }));
175056
175211
  exports.execute = void 0;
175057
175212
  const childProcess = __webpack_require__(63129);
175058
- function execute(command, args, options) {
175059
- const spawnOptions = { shell: true };
175213
+ function execute(command, args, options, shell = false) {
175214
+ const spawnOptions = { shell };
175060
175215
  if (options === null || options === void 0 ? void 0 : options.cwd) {
175061
175216
  spawnOptions.cwd = options.cwd;
175062
175217
  }