@govtechsg/oobee 0.10.86 → 0.10.87

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.
Files changed (40) hide show
  1. package/.github/workflows/image.yml +2 -3
  2. package/dist/cli.js +18 -5
  3. package/dist/combine.js +2 -0
  4. package/dist/constants/cliFunctions.js +2 -2
  5. package/dist/constants/common.js +55 -13
  6. package/dist/crawlers/crawlDomain.js +38 -13
  7. package/dist/crawlers/crawlIntelligentSitemap.js +62 -30
  8. package/dist/crawlers/crawlSitemap.js +44 -5
  9. package/dist/crawlers/custom/utils.js +81 -40
  10. package/dist/generateHtmlReport.js +18 -11
  11. package/dist/mergeAxeResults/itemReferences.js +60 -25
  12. package/dist/mergeAxeResults/sentryTelemetry.js +4 -1
  13. package/dist/mergeAxeResults.js +18 -9
  14. package/dist/static/ejs/partials/scripts/decodeUnzipParse.ejs +6 -3
  15. package/dist/static/ejs/partials/scripts/ruleModal/itemCardRenderer.ejs +38 -2
  16. package/dist/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +1 -1
  17. package/dist/static/ejs/partials/scripts/ruleModal/ruleOffcanvas.ejs +4 -4
  18. package/dist/static/ejs/summary.ejs +18 -12
  19. package/dist/utils.js +4 -3
  20. package/fix-summary-html-oom-pr.md +62 -0
  21. package/package.json +5 -5
  22. package/src/cli.ts +19 -5
  23. package/src/combine.ts +2 -0
  24. package/src/constants/cliFunctions.ts +2 -2
  25. package/src/constants/common.ts +65 -12
  26. package/src/crawlers/crawlDomain.ts +39 -13
  27. package/src/crawlers/crawlIntelligentSitemap.ts +63 -30
  28. package/src/crawlers/crawlSitemap.ts +50 -3
  29. package/src/crawlers/custom/utils.ts +99 -43
  30. package/src/generateHtmlReport.ts +21 -11
  31. package/src/mergeAxeResults/itemReferences.ts +70 -26
  32. package/src/mergeAxeResults/sentryTelemetry.ts +4 -1
  33. package/src/mergeAxeResults.ts +21 -11
  34. package/src/static/ejs/partials/scripts/decodeUnzipParse.ejs +6 -3
  35. package/src/static/ejs/partials/scripts/ruleModal/itemCardRenderer.ejs +38 -2
  36. package/src/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +1 -1
  37. package/src/static/ejs/partials/scripts/ruleModal/ruleOffcanvas.ejs +4 -4
  38. package/src/static/ejs/summary.ejs +18 -12
  39. package/src/utils.ts +4 -3
  40. package/testStaticJSScanner.html +1 -1
@@ -86,7 +86,7 @@
86
86
  // Use pre-computed htmlGroups for count if available, otherwise use pages
87
87
  const count = isHtmlGrouping && selectedCategory.htmlGroups
88
88
  ? Object.keys(selectedCategory.htmlGroups).length
89
- : selectedCategory.pagesAffected.length;
89
+ : (selectedCategory.pagesAffectedCount || selectedCategory.pagesAffected.length);
90
90
  if (isHtmlGrouping) {
91
91
  dropdownTitle.innerText = `HTML elements affected by this issue (${count})`;
92
92
  } else {
@@ -270,8 +270,8 @@ include('./pageAccordionBuilder') %> <%- include('./constants') %>
270
270
  if (!Array.isArray(rule.pagesAffected)) return;
271
271
 
272
272
  rule.pagesAffected.sort((a, b) => {
273
- const lenA = Array.isArray(a.items) ? a.items.length : 0;
274
- const lenB = Array.isArray(b.items) ? b.items.length : 0;
273
+ const lenA = Array.isArray(a.items) ? a.items.length : a.itemsCount || 0;
274
+ const lenB = Array.isArray(b.items) ? b.items.length : b.itemsCount || 0;
275
275
  return lenB - lenA; // DESC
276
276
  });
277
277
  });
@@ -295,10 +295,10 @@ include('./pageAccordionBuilder') %> <%- include('./constants') %>
295
295
  dropdownToggle.innerText = `${ruleInCategory.totalItems} Total occ.`;
296
296
  dropdownToggle.setAttribute('aria-label', occurrencesText);
297
297
  document.getElementById('expandedRuleDropdownTitle').innerText =
298
- `Pages affected by this issue (${ruleInCategory.pagesAffected.length})`;
298
+ `Pages affected by this issue (${(ruleInCategory.pagesAffectedCount || ruleInCategory.pagesAffected.length)})`;
299
299
  buildExpandedRuleCategoryContent(category, ruleInCategory);
300
300
  document.getElementById('expandedRulePageContent').innerText =
301
- `Total ${ruleInCategory.pagesAffected.length} affected pages`;
301
+ `Total ${(ruleInCategory.pagesAffectedCount || ruleInCategory.pagesAffected.length)} affected pages`;
302
302
  }
303
303
  }
304
304
  });
@@ -21,18 +21,24 @@
21
21
  %>
22
22
  <script>
23
23
  const scanItems = <%- JSON.stringify(
24
- {
25
- ...items,
26
- ...['mustFix','goodToFix','needsReview','passed'].reduce((acc, cat) => {
27
- if (items[cat]) {
28
- acc[cat] = {
29
- ...items[cat],
30
- rules: (items[cat].rules || []).map(({ htmlGroups, ...rest }) => rest),
31
- };
32
- }
33
- return acc;
34
- }, {}),
35
- }
24
+ ['mustFix','goodToFix','needsReview','passed'].reduce((acc, cat) => {
25
+ if (items[cat]) {
26
+ acc[cat] = {
27
+ description: items[cat].description,
28
+ totalItems: items[cat].totalItems,
29
+ totalRuleIssues: items[cat].totalRuleIssues,
30
+ rules: (items[cat].rules || []).map(rule => ({
31
+ rule: rule.rule,
32
+ description: rule.description,
33
+ helpUrl: rule.helpUrl,
34
+ conformance: rule.conformance,
35
+ totalItems: rule.totalItems,
36
+ pagesAffected: { length: (rule.pagesAffected || []).length },
37
+ })),
38
+ };
39
+ }
40
+ return acc;
41
+ }, {})
36
42
  ).replace(/<\//g, '<\\/') %>
37
43
  </script>
38
44
  <%- include('partials/scripts/summaryTable') %>
package/src/utils.ts CHANGED
@@ -5,6 +5,7 @@ import fs from 'fs-extra';
5
5
  import axe, { Rule } from 'axe-core';
6
6
  import { v4 as uuidv4 } from 'uuid';
7
7
  import { getDomain } from 'tldts';
8
+ import { normalizeUrl } from '@apify/utilities';
8
9
  import constants, {
9
10
  BrowserTypes,
10
11
  destinationPath,
@@ -1078,13 +1079,13 @@ export const randomThreeDigitNumberString = () => {
1078
1079
  return String(threeDigitNumber);
1079
1080
  };
1080
1081
 
1082
+ export const normUrl = (u: string): string => (u ? normalizeUrl(u) || u : '');
1083
+
1081
1084
  export const isFollowStrategy = (link1: string, link2: string, rule: string): boolean => {
1085
+ if (rule === 'all') return true;
1082
1086
  try {
1083
1087
  const parsedLink1 = new URL(link1);
1084
1088
  const parsedLink2 = new URL(link2);
1085
- if (rule === 'all') {
1086
- return true;
1087
- }
1088
1089
  if (rule === 'same-origin') {
1089
1090
  return parsedLink1.origin === parsedLink2.origin;
1090
1091
  }
@@ -186,7 +186,7 @@
186
186
  <li>
187
187
  <strong>Add the script</strong> — include the scanner before your closing
188
188
  <code>&lt;/body&gt;</code> tag:
189
- <pre>&lt;script src="https://cdn.jsdelivr.net/gh/GovTechSG/oobee@v0.10.86/oobee-client-scanner.js"&gt;&lt;/script&gt;</pre>
189
+ <pre>&lt;script src="https://cdn.jsdelivr.net/gh/GovTechSG/oobee@0.10.86/oobee-client-scanner.js"&gt;&lt;/script&gt;</pre>
190
190
 
191
191
  <br>This points to the <code>v0.10.86</code> release. Update the version tag as needed for newer releases.
192
192
  </li>