@snyk/code-client
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -1,2 +0,2 @@ | ||
import * as flatCache from 'flat-cache'; | ||
import { Cache } from './cache'; | ||
import { ISupportedFiles, IFileInfo } from './interfaces/files.interface'; | ||
@@ -16,5 +16,5 @@ export declare function notEmpty<T>(value: T | null | undefined): value is T; | ||
}>; | ||
export declare function getFileInfo(filePath: string, baseDir: string, withContent?: boolean, cache?: flatCache.Cache | null): Promise<IFileInfo | null>; | ||
export declare function getFileInfo(filePath: string, baseDir: string, withContent?: boolean, cache?: Cache | null): Promise<IFileInfo | null>; | ||
export declare function resolveBundleFiles(baseDir: string, bundleMissingFiles: string[]): Promise<IFileInfo[]>; | ||
export declare function resolveBundleFilePath(baseDir: string, bundleFilePath: string): string; | ||
export declare function composeFilePayloads(files: IFileInfo[], bucketSize?: number): Generator<IFileInfo[]>; |
@@ -33,3 +33,3 @@ "use strict"; | ||
const util_1 = __importDefault(require("util")); | ||
const flatCache = __importStar(require("flat-cache")); | ||
const cache_1 = require("./cache"); | ||
const constants_1 = require("./constants"); | ||
@@ -155,4 +155,3 @@ const isWindows = nodePath.sep === '\\'; | ||
async function* collectBundleFiles(baseDir, paths, supportedFiles, fileIgnores = constants_1.IGNORES_DEFAULT, maxFileSize = constants_1.MAX_PAYLOAD, symlinksEnabled = false) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
const cache = flatCache.load(constants_1.CACHE_KEY, baseDir); | ||
const cache = new cache_1.Cache(constants_1.CACHE_KEY, baseDir); | ||
const files = []; | ||
@@ -195,3 +194,2 @@ const dirs = []; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
cache.save(); | ||
@@ -203,3 +201,3 @@ } | ||
let bundleFiles = []; | ||
const cache = flatCache.load(constants_1.CACHE_KEY, baseDir); | ||
const cache = new cache_1.Cache(constants_1.CACHE_KEY, baseDir); | ||
// Filter for supported extensions/files only | ||
@@ -260,7 +258,5 @@ let processingFiles = filterSupportedFiles(files, supportedFiles); | ||
// Try to get hash from cache | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
const cachedData = cache.getKey(filePath); | ||
if (cachedData) { | ||
if (cachedData[0] === fileStats.size && cachedData[1] === fileStats.mtimeMs) { | ||
// eslint-disable-next-line prefer-destructuring | ||
fileHash = cachedData[2]; | ||
@@ -277,3 +273,2 @@ } | ||
fileHash = calcHash(fileContent); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
cache === null || cache === void 0 ? void 0 : cache.setKey(filePath, [fileStats.size, fileStats.mtimeMs, fileHash]); | ||
@@ -298,4 +293,3 @@ } | ||
async function resolveBundleFiles(baseDir, bundleMissingFiles) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
const cache = flatCache.load('.dccache', baseDir); | ||
const cache = new cache_1.Cache('.dccache', baseDir); | ||
const tasks = bundleMissingFiles.map(mf => { | ||
@@ -306,3 +300,2 @@ const filePath = resolveBundleFilePath(baseDir, mf); | ||
const res = (await Promise.all(tasks)).filter(notEmpty); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
cache.save(true); | ||
@@ -309,0 +302,0 @@ return res; |
@@ -39,2 +39,3 @@ { | ||
"@types/node": "^14.6.2", | ||
"@types/write": "^2.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.0.1", | ||
@@ -52,3 +53,4 @@ "@typescript-eslint/parser": "^4.0.1", | ||
"yalc": "^1.0.0-pre.44", | ||
"jsonschema": "^1.2.11" | ||
"jsonschema": "^1.2.11", | ||
"write": "^2.0.0" | ||
}, | ||
@@ -71,7 +73,6 @@ "dependencies": { | ||
"micromatch": "^4.0.2", | ||
"flat-cache": "^3.0.4", | ||
"@types/uuid": "^8.3.0", | ||
"uuid": "^8.3.2" | ||
}, | ||
"version": "3.1.2" | ||
"version": "3.1.3" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138695
17
46
2029
17
2
- Removedflat-cache@^3.0.4
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedflat-cache@3.2.0(transitive)
- Removedflatted@3.3.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedwrappy@1.0.2(transitive)