snyk 1.893.0 → 1.894.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.
@@ -154685,15 +154685,24 @@ async function scan(options) {
154685
154685
  }
154686
154686
  exports.scan = scan;
154687
154687
  function getExcludedPatterns(projectRoot, policyFilePath = path_1.join(projectRoot, invariants_1.DEFAULT_SNYK_POLICY_FILE)) {
154688
- var _a;
154688
+ var _a, _b;
154689
154689
  if (!dotSnyk.exists(policyFilePath)) {
154690
154690
  return [];
154691
154691
  }
154692
154692
  const config = dotSnyk.parse(policyFilePath);
154693
- return [
154694
- policyFilePath,
154695
- ...dotSnyk.toAbsolutePaths(projectRoot, (_a = config === null || config === void 0 ? void 0 : config.exclude) === null || _a === void 0 ? void 0 : _a.global),
154696
- ];
154693
+ const paths = (_b = (_a = config === null || config === void 0 ? void 0 : config.exclude) === null || _a === void 0 ? void 0 : _a.global) === null || _b === void 0 ? void 0 : _b.filter((item) => {
154694
+ if (typeof item === 'object') {
154695
+ const key = Object.keys(item)[0];
154696
+ return !key ? false : !dotSnyk.hasExpired(item[key].expires);
154697
+ }
154698
+ return true;
154699
+ }).map((item) => {
154700
+ if (typeof item === 'object') {
154701
+ return Object.keys(item)[0];
154702
+ }
154703
+ return item;
154704
+ });
154705
+ return [policyFilePath, ...dotSnyk.toAbsolutePaths(projectRoot, paths)];
154697
154706
  }
154698
154707
  exports.getExcludedPatterns = getExcludedPatterns;
154699
154708
  //# sourceMappingURL=scan.js.map
@@ -154744,7 +154753,7 @@ exports.isBinary = isBinary;
154744
154753
  "use strict";
154745
154754
 
154746
154755
  Object.defineProperty(exports, "__esModule", ({ value: true }));
154747
- exports.toAbsolutePaths = exports.parse = exports.exists = void 0;
154756
+ exports.hasExpired = exports.toAbsolutePaths = exports.parse = exports.exists = void 0;
154748
154757
  const fs_1 = __webpack_require__(35747);
154749
154758
  const yaml_1 = __webpack_require__(6792);
154750
154759
  const path_1 = __webpack_require__(85622);
@@ -154776,6 +154785,21 @@ function toAbsolutePaths(basedir, paths = []) {
154776
154785
  return paths.map((p) => path_1.resolve(basedir, p));
154777
154786
  }
154778
154787
  exports.toAbsolutePaths = toAbsolutePaths;
154788
+ /**
154789
+ * Resolves an array of paths relative to the basedir
154790
+ * @param {string} expires - date string
154791
+ * @returns {boolean} - whether or not the provided date has expired
154792
+ */
154793
+ function hasExpired(expires) {
154794
+ if (expires === null || expires === undefined) {
154795
+ return false;
154796
+ }
154797
+ if (isNaN(Date.parse(expires))) {
154798
+ throw `Invalid date format provided dates should be formatted as "yyyy-MM-ddTHH:mm:ss.fffZ"`;
154799
+ }
154800
+ return new Date() > new Date(expires);
154801
+ }
154802
+ exports.hasExpired = hasExpired;
154779
154803
  //# sourceMappingURL=index.js.map
154780
154804
 
154781
154805
  /***/ }),