mobbdev 0.0.172 → 0.0.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +26 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1207,7 +1207,7 @@ var progressMassages = {
|
|
|
1207
1207
|
processingVulnerabilityReport: "\u2699\uFE0F Proccessing vulnerability report",
|
|
1208
1208
|
processingVulnerabilityReportFailed: "\u2699\uFE0F Error Proccessing vulnerability report"
|
|
1209
1209
|
};
|
|
1210
|
-
var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 *
|
|
1210
|
+
var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 * 30;
|
|
1211
1211
|
|
|
1212
1212
|
// src/features/analysis/index.ts
|
|
1213
1213
|
import crypto from "node:crypto";
|
|
@@ -7068,6 +7068,7 @@ import AdmZip from "adm-zip";
|
|
|
7068
7068
|
import Debug10 from "debug";
|
|
7069
7069
|
import { globby } from "globby";
|
|
7070
7070
|
import { isBinary } from "istextorbinary";
|
|
7071
|
+
import { simpleGit as simpleGit3 } from "simple-git";
|
|
7071
7072
|
var debug10 = Debug10("mobbdev:pack");
|
|
7072
7073
|
var MAX_FILE_SIZE = 1024 * 1024 * 5;
|
|
7073
7074
|
function endsWithAny(str, suffixes) {
|
|
@@ -7080,6 +7081,29 @@ function _get_manifest_files_suffixes() {
|
|
|
7080
7081
|
}
|
|
7081
7082
|
async function pack(srcDirPath, vulnFiles) {
|
|
7082
7083
|
debug10("pack folder %s", srcDirPath);
|
|
7084
|
+
let git = void 0;
|
|
7085
|
+
try {
|
|
7086
|
+
git = simpleGit3({
|
|
7087
|
+
baseDir: srcDirPath,
|
|
7088
|
+
maxConcurrentProcesses: 1,
|
|
7089
|
+
trimmed: true
|
|
7090
|
+
});
|
|
7091
|
+
await git.status();
|
|
7092
|
+
} catch (e) {
|
|
7093
|
+
debug10("failed to run git %o", e);
|
|
7094
|
+
git = void 0;
|
|
7095
|
+
if (e instanceof Error) {
|
|
7096
|
+
if (e.message.includes(" spawn ")) {
|
|
7097
|
+
debug10("git cli not installed");
|
|
7098
|
+
} else if (e.message.includes("not a git repository")) {
|
|
7099
|
+
debug10("folder is not a git repo");
|
|
7100
|
+
} else {
|
|
7101
|
+
throw e;
|
|
7102
|
+
}
|
|
7103
|
+
} else {
|
|
7104
|
+
throw e;
|
|
7105
|
+
}
|
|
7106
|
+
}
|
|
7083
7107
|
const filepaths = await globby("**", {
|
|
7084
7108
|
gitignore: true,
|
|
7085
7109
|
onlyFiles: true,
|
|
@@ -7104,7 +7128,7 @@ async function pack(srcDirPath, vulnFiles) {
|
|
|
7104
7128
|
debug10("ignoring %s because the size is > 5MB", filepath);
|
|
7105
7129
|
continue;
|
|
7106
7130
|
}
|
|
7107
|
-
const data = fs2.readFileSync(absFilepath);
|
|
7131
|
+
const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) : fs2.readFileSync(absFilepath);
|
|
7108
7132
|
if (isBinary(null, data)) {
|
|
7109
7133
|
debug10("ignoring %s because is seems to be a binary file", filepath);
|
|
7110
7134
|
continue;
|