react-lib-tools 0.0.45 → 0.0.47

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 (28) hide show
  1. package/dist/{CommonQuestionsRoute-xnhbeLos.js → CommonQuestionsRoute-BA4ZhMTe.js} +2 -2
  2. package/dist/{CommonQuestionsRoute-xnhbeLos.js.map → CommonQuestionsRoute-BA4ZhMTe.js.map} +1 -1
  3. package/dist/{CommonQuestionsRoute-BaUo7C5J.cjs → CommonQuestionsRoute-vsAObCFT.cjs} +2 -2
  4. package/dist/{CommonQuestionsRoute-BaUo7C5J.cjs.map → CommonQuestionsRoute-vsAObCFT.cjs.map} +1 -1
  5. package/dist/{GettingStartedRoute-Cp6EFnMw.js → GettingStartedRoute-C1eEI6XL.js} +2 -2
  6. package/dist/{GettingStartedRoute-Cp6EFnMw.js.map → GettingStartedRoute-C1eEI6XL.js.map} +1 -1
  7. package/dist/{GettingStartedRoute-Caqc6Q58.cjs → GettingStartedRoute-D144jL7r.cjs} +2 -2
  8. package/dist/{GettingStartedRoute-Caqc6Q58.cjs.map → GettingStartedRoute-D144jL7r.cjs.map} +1 -1
  9. package/dist/{PageNotFound-7zWg_AHz.cjs → PageNotFound-CGbDPOsm.cjs} +2 -2
  10. package/dist/{PageNotFound-7zWg_AHz.cjs.map → PageNotFound-CGbDPOsm.cjs.map} +1 -1
  11. package/dist/{PageNotFound-CB141q5L.js → PageNotFound-CU9uqnRi.js} +2 -2
  12. package/dist/{PageNotFound-CB141q5L.js.map → PageNotFound-CU9uqnRi.js.map} +1 -1
  13. package/dist/{SupportRoute-CIsa-DtE.cjs → SupportRoute-BJbK64__.cjs} +2 -2
  14. package/dist/{SupportRoute-CIsa-DtE.cjs.map → SupportRoute-BJbK64__.cjs.map} +1 -1
  15. package/dist/{SupportRoute-BdQqhjzf.js → SupportRoute-D907jHET.js} +2 -2
  16. package/dist/{SupportRoute-BdQqhjzf.js.map → SupportRoute-D907jHET.js.map} +1 -1
  17. package/dist/{VersionsRoute-BuGTWWLr.js → VersionsRoute-CXRx1ZeN.js} +2 -2
  18. package/dist/{VersionsRoute-BuGTWWLr.js.map → VersionsRoute-CXRx1ZeN.js.map} +1 -1
  19. package/dist/{VersionsRoute-5s8sUTHm.cjs → VersionsRoute-ahVJDsum.cjs} +2 -2
  20. package/dist/{VersionsRoute-5s8sUTHm.cjs.map → VersionsRoute-ahVJDsum.cjs.map} +1 -1
  21. package/dist/{index-Cpw2WkF7.js → index-DHqKf7uc.js} +12 -10
  22. package/dist/{index-Cpw2WkF7.js.map → index-DHqKf7uc.js.map} +1 -1
  23. package/dist/{index-rOOr2GGh.cjs → index-DwdhsbJr.cjs} +2 -2
  24. package/dist/{index-rOOr2GGh.cjs.map → index-DwdhsbJr.cjs.map} +1 -1
  25. package/dist/react-lib-tools.cjs +1 -1
  26. package/dist/react-lib-tools.js +1 -1
  27. package/package.json +1 -1
  28. package/scripts/utils/search/crawlPage.ts +37 -21
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-rOOr2GGh.cjs");exports.AppRoot=o.AppRoot;exports.Block=o.Block;exports.Box=o.Box;exports.Button=o.Button;exports.Callout=o.Callout;exports.Checkbox=o.Checkbox;exports.Code=o.Code;exports.ComponentProps=o.ComponentProps;exports.ComponentPropsSection=o.ComponentPropsSection;exports.DocsSection=o.DocsSection;exports.ErrorBoundary=o.ErrorBoundary;exports.ExternalLink=o.ExternalLink;exports.Header=o.Header;exports.ImperativeHandle=o.ImperativeHandle;exports.Input=o.Input;exports.Link=o.Link;exports.LoadingSpinner=o.LoadingSpinner;exports.NavLink=o.NavLink;exports.NavSection=o.NavSection;exports.Radio=o.Radio;exports.Select=o.Select;exports.Tooltip=o.Tooltip;exports.assert=o.assert;exports.cn=o.cn;exports.getIntentClassNames=o.getIntentClassNames;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-DwdhsbJr.cjs");exports.AppRoot=o.AppRoot;exports.Block=o.Block;exports.Box=o.Box;exports.Button=o.Button;exports.Callout=o.Callout;exports.Checkbox=o.Checkbox;exports.Code=o.Code;exports.ComponentProps=o.ComponentProps;exports.ComponentPropsSection=o.ComponentPropsSection;exports.DocsSection=o.DocsSection;exports.ErrorBoundary=o.ErrorBoundary;exports.ExternalLink=o.ExternalLink;exports.Header=o.Header;exports.ImperativeHandle=o.ImperativeHandle;exports.Input=o.Input;exports.Link=o.Link;exports.LoadingSpinner=o.LoadingSpinner;exports.NavLink=o.NavLink;exports.NavSection=o.NavSection;exports.Radio=o.Radio;exports.Select=o.Select;exports.Tooltip=o.Tooltip;exports.assert=o.assert;exports.cn=o.cn;exports.getIntentClassNames=o.getIntentClassNames;
2
2
  //# sourceMappingURL=react-lib-tools.cjs.map
@@ -1,4 +1,4 @@
1
- import { A as o, a as e, B as n, b as t, C as r, c as i, d as p, i as c, j as l, D as d, e as C, E as k, H as m, I as B, f as L, L as S, g as u, N as x, h as I, R as N, k as g, T as v, l as E, m as H, n as R } from "./index-Cpw2WkF7.js";
1
+ import { A as o, a as e, B as n, b as t, C as r, c as i, d as p, i as c, j as l, D as d, e as C, E as k, H as m, I as B, f as L, L as S, g as u, N as x, h as I, R as N, k as g, T as v, l as E, m as H, n as R } from "./index-DHqKf7uc.js";
2
2
  export {
3
3
  o as AppRoot,
4
4
  e as Block,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-lib-tools",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "type": "module",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
6
6
  "contributors": [
@@ -36,6 +36,8 @@ export async function crawlPage({
36
36
  await page.goto(`${host}${path}`);
37
37
  await page.waitForSelector("main");
38
38
 
39
+ page.on("console", (event) => console.log(event.text()));
40
+
39
41
  const result = await page.evaluate(
40
42
  async ([filterSelector, stopWords]) => {
41
43
  const paths: string[] = [];
@@ -53,38 +55,52 @@ export async function crawlPage({
53
55
  document.body.querySelector("header [data-title]")?.textContent ?? "";
54
56
 
55
57
  const words = new Set<string>();
56
- const texts: string[] = [];
58
+ let text = "";
57
59
 
58
- const main = document.body.querySelector("header")?.parentElement;
60
+ const main = document.body.querySelector("[data-main-scrollable]");
59
61
  if (main) {
60
- for (const child of main.children) {
61
- switch (child.tagName) {
62
- // case "CODE":
63
- case "HEADER": {
64
- continue;
65
- }
66
- }
62
+ text = main.innerHTML;
67
63
 
68
- if (filterSelector && child.querySelector(filterSelector)) {
69
- continue;
64
+ // Filter out special content (e.g. lorem ipsum type text)
65
+ if (filterSelector) {
66
+ const matches = document.querySelectorAll(filterSelector);
67
+ for (const match of matches) {
68
+ text = text.replace(match.outerHTML, "");
70
69
  }
70
+ }
71
71
 
72
- if (child.textContent) {
73
- texts.push(child.textContent);
74
- child.textContent.split(/[\s.:]/).forEach((word) => {
75
- word = word.trim().toLowerCase();
76
- if (word && !stopWords.includes(word)) {
77
- words.add(word);
78
- }
79
- });
80
- }
72
+ // Ensure whitespace between HTML tags
73
+ text = text.replaceAll("><", "> <");
74
+
75
+ // Strip HTML tags
76
+ text = text.replaceAll(/<[^>]+>/g, "");
77
+
78
+ // Replace HTML entities
79
+ const HTML_ENTITIES: { [chars: string]: string } = {
80
+ "&amp;": "&",
81
+ "&lt;": "<",
82
+ "&gt;": ">",
83
+ "&quot;": '"',
84
+ "&#039;": "'",
85
+ "&ndash;": "-",
86
+ "&nbsp;": " "
87
+ };
88
+ for (const chars in HTML_ENTITIES) {
89
+ text = text.replaceAll(chars, HTML_ENTITIES[chars]);
81
90
  }
91
+
92
+ text.split(/[\s.:?]/).forEach((word) => {
93
+ word = word.trim().toLowerCase();
94
+ if (word && !stopWords.includes(word)) {
95
+ words.add(word);
96
+ }
97
+ });
82
98
  }
83
99
 
84
100
  return {
85
101
  paths,
86
102
  section,
87
- text: texts.join(" "),
103
+ text,
88
104
  title,
89
105
  words: Array.from(words)
90
106
  };