webguardx 0.1.0 → 0.1.1
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/bin/cli.cjs +76 -51
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.js +75 -50
- package/dist/bin/cli.js.map +1 -1
- package/dist/index.cjs +48 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -169,23 +169,40 @@ function defineConfig(config) {
|
|
|
169
169
|
var import_path = __toESM(require("path"), 1);
|
|
170
170
|
var import_fs = __toESM(require("fs"), 1);
|
|
171
171
|
|
|
172
|
+
// src/utils/colors.ts
|
|
173
|
+
var enabled = process.env.NO_COLOR === void 0 && process.env.FORCE_COLOR !== "0" && process.stdout.isTTY !== false;
|
|
174
|
+
function wrap(open, close) {
|
|
175
|
+
return enabled ? (s) => `${open}${s}${close}` : (s) => s;
|
|
176
|
+
}
|
|
177
|
+
var c = {
|
|
178
|
+
bold: wrap("\x1B[1m", "\x1B[22m"),
|
|
179
|
+
dim: wrap("\x1B[2m", "\x1B[22m"),
|
|
180
|
+
red: wrap("\x1B[31m", "\x1B[39m"),
|
|
181
|
+
green: wrap("\x1B[32m", "\x1B[39m"),
|
|
182
|
+
yellow: wrap("\x1B[33m", "\x1B[39m"),
|
|
183
|
+
blue: wrap("\x1B[34m", "\x1B[39m"),
|
|
184
|
+
cyan: wrap("\x1B[36m", "\x1B[39m"),
|
|
185
|
+
gray: wrap("\x1B[90m", "\x1B[39m"),
|
|
186
|
+
bgRed: wrap("\x1B[41m", "\x1B[49m"),
|
|
187
|
+
bgGreen: wrap("\x1B[42m", "\x1B[49m")
|
|
188
|
+
};
|
|
189
|
+
|
|
172
190
|
// src/utils/logger.ts
|
|
173
|
-
var import_chalk = __toESM(require("chalk"), 1);
|
|
174
191
|
var log = {
|
|
175
192
|
info(msg) {
|
|
176
|
-
console.log(
|
|
193
|
+
console.log(c.blue("i"), msg);
|
|
177
194
|
},
|
|
178
195
|
success(msg) {
|
|
179
|
-
console.log(
|
|
196
|
+
console.log(c.green("\u2713"), msg);
|
|
180
197
|
},
|
|
181
198
|
warn(msg) {
|
|
182
|
-
console.log(
|
|
199
|
+
console.log(c.yellow("\u26A0"), msg);
|
|
183
200
|
},
|
|
184
201
|
error(msg) {
|
|
185
|
-
console.log(
|
|
202
|
+
console.log(c.red("\u2717"), msg);
|
|
186
203
|
},
|
|
187
204
|
dim(msg) {
|
|
188
|
-
console.log(
|
|
205
|
+
console.log(c.dim(msg));
|
|
189
206
|
},
|
|
190
207
|
plain(msg) {
|
|
191
208
|
console.log(msg);
|
|
@@ -323,11 +340,11 @@ async function cookieInject(config, outputDir) {
|
|
|
323
340
|
ensureDir(authDir);
|
|
324
341
|
const storagePath = import_path5.default.join(authDir, "storageState.json");
|
|
325
342
|
const storageState = {
|
|
326
|
-
cookies: config.cookies.map((
|
|
327
|
-
name:
|
|
328
|
-
value:
|
|
329
|
-
domain:
|
|
330
|
-
path:
|
|
343
|
+
cookies: config.cookies.map((c2) => ({
|
|
344
|
+
name: c2.name,
|
|
345
|
+
value: c2.value,
|
|
346
|
+
domain: c2.domain,
|
|
347
|
+
path: c2.path || "/",
|
|
331
348
|
expires: -1,
|
|
332
349
|
httpOnly: false,
|
|
333
350
|
secure: true,
|
|
@@ -667,14 +684,14 @@ function getEnabledAudits(auditsConfig, pluginAudits = [], customAudits = []) {
|
|
|
667
684
|
for (const audit of [...pluginAudits, ...customAudits]) {
|
|
668
685
|
allAudits[audit.name] = audit;
|
|
669
686
|
}
|
|
670
|
-
const
|
|
687
|
+
const enabled2 = [];
|
|
671
688
|
for (const [name, audit] of Object.entries(allAudits)) {
|
|
672
689
|
const isEnabled = auditsConfig[name] ?? true;
|
|
673
690
|
if (isEnabled) {
|
|
674
|
-
|
|
691
|
+
enabled2.push(audit);
|
|
675
692
|
}
|
|
676
693
|
}
|
|
677
|
-
return
|
|
694
|
+
return enabled2;
|
|
678
695
|
}
|
|
679
696
|
|
|
680
697
|
// src/runner/page-runner.ts
|
|
@@ -866,31 +883,30 @@ function reportJson(result, runDir) {
|
|
|
866
883
|
}
|
|
867
884
|
|
|
868
885
|
// src/reporters/terminal.ts
|
|
869
|
-
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
870
886
|
function reportTerminal(result) {
|
|
871
887
|
const { summary } = result;
|
|
872
888
|
console.log("");
|
|
873
|
-
console.log(
|
|
874
|
-
console.log(
|
|
875
|
-
console.log(
|
|
889
|
+
console.log(c.bold("\u2500".repeat(60)));
|
|
890
|
+
console.log(c.bold(" Summary"));
|
|
891
|
+
console.log(c.bold("\u2500".repeat(60)));
|
|
876
892
|
console.log("");
|
|
877
893
|
console.log(` Total audits: ${summary.totalAudits}`);
|
|
878
894
|
console.log(
|
|
879
|
-
` ${
|
|
895
|
+
` ${c.green("\u2713 Passed:")} ${summary.passed}`
|
|
880
896
|
);
|
|
881
897
|
if (summary.failed > 0) {
|
|
882
898
|
console.log(
|
|
883
|
-
` ${
|
|
899
|
+
` ${c.red("\u2717 Failed:")} ${summary.failed}`
|
|
884
900
|
);
|
|
885
901
|
}
|
|
886
902
|
if (summary.warnings > 0) {
|
|
887
903
|
console.log(
|
|
888
|
-
` ${
|
|
904
|
+
` ${c.yellow("\u26A0 Warnings:")} ${summary.warnings}`
|
|
889
905
|
);
|
|
890
906
|
}
|
|
891
907
|
if (summary.skipped > 0) {
|
|
892
908
|
console.log(
|
|
893
|
-
` ${
|
|
909
|
+
` ${c.dim("\u25CB Skipped:")} ${summary.skipped}`
|
|
894
910
|
);
|
|
895
911
|
}
|
|
896
912
|
console.log(
|
|
@@ -901,24 +917,24 @@ function reportTerminal(result) {
|
|
|
901
917
|
(p) => p.audits.filter((a) => a.severity === "fail")
|
|
902
918
|
);
|
|
903
919
|
if (failedAudits.length > 0) {
|
|
904
|
-
console.log(
|
|
920
|
+
console.log(c.bold(c.red(" Failed Audits:")));
|
|
905
921
|
for (const audit of failedAudits) {
|
|
906
922
|
console.log(
|
|
907
|
-
|
|
923
|
+
c.red(` \u2717 ${audit.page} \u2192 ${audit.audit}: ${audit.message}`)
|
|
908
924
|
);
|
|
909
925
|
}
|
|
910
926
|
console.log("");
|
|
911
927
|
}
|
|
912
928
|
if (summary.failed > 0) {
|
|
913
929
|
console.log(
|
|
914
|
-
|
|
930
|
+
c.bold(c.red(` Result: FAIL (${summary.failed} failure(s))`))
|
|
915
931
|
);
|
|
916
932
|
} else if (summary.warnings > 0) {
|
|
917
933
|
console.log(
|
|
918
|
-
|
|
934
|
+
c.bold(c.yellow(` Result: PASS with ${summary.warnings} warning(s)`))
|
|
919
935
|
);
|
|
920
936
|
} else {
|
|
921
|
-
console.log(
|
|
937
|
+
console.log(c.bold(c.green(" Result: PASS")));
|
|
922
938
|
}
|
|
923
939
|
console.log("");
|
|
924
940
|
}
|
|
@@ -1610,11 +1626,11 @@ function compareRuns(baseline, current) {
|
|
|
1610
1626
|
currentTimestamp: current.timestamp,
|
|
1611
1627
|
changes,
|
|
1612
1628
|
summary: {
|
|
1613
|
-
regressions: changes.filter((
|
|
1614
|
-
improvements: changes.filter((
|
|
1615
|
-
unchanged: changes.filter((
|
|
1616
|
-
newAudits: changes.filter((
|
|
1617
|
-
removedAudits: changes.filter((
|
|
1629
|
+
regressions: changes.filter((c2) => c2.type === "regression").length,
|
|
1630
|
+
improvements: changes.filter((c2) => c2.type === "improvement").length,
|
|
1631
|
+
unchanged: changes.filter((c2) => c2.type === "unchanged").length,
|
|
1632
|
+
newAudits: changes.filter((c2) => c2.type === "new").length,
|
|
1633
|
+
removedAudits: changes.filter((c2) => c2.type === "removed").length
|
|
1618
1634
|
}
|
|
1619
1635
|
};
|
|
1620
1636
|
}
|