react-lib-tools 0.0.46 → 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.
- package/dist/{CommonQuestionsRoute-Dvpg3myn.js → CommonQuestionsRoute-BA4ZhMTe.js} +2 -2
- package/dist/{CommonQuestionsRoute-Dvpg3myn.js.map → CommonQuestionsRoute-BA4ZhMTe.js.map} +1 -1
- package/dist/{CommonQuestionsRoute-DZff4CcU.cjs → CommonQuestionsRoute-vsAObCFT.cjs} +2 -2
- package/dist/{CommonQuestionsRoute-DZff4CcU.cjs.map → CommonQuestionsRoute-vsAObCFT.cjs.map} +1 -1
- package/dist/{GettingStartedRoute-CqONags2.js → GettingStartedRoute-C1eEI6XL.js} +2 -2
- package/dist/{GettingStartedRoute-CqONags2.js.map → GettingStartedRoute-C1eEI6XL.js.map} +1 -1
- package/dist/{GettingStartedRoute-Clt0_XG-.cjs → GettingStartedRoute-D144jL7r.cjs} +2 -2
- package/dist/{GettingStartedRoute-Clt0_XG-.cjs.map → GettingStartedRoute-D144jL7r.cjs.map} +1 -1
- package/dist/{PageNotFound-DHZsHski.cjs → PageNotFound-CGbDPOsm.cjs} +2 -2
- package/dist/{PageNotFound-DHZsHski.cjs.map → PageNotFound-CGbDPOsm.cjs.map} +1 -1
- package/dist/{PageNotFound-Ccu5CLOP.js → PageNotFound-CU9uqnRi.js} +2 -2
- package/dist/{PageNotFound-Ccu5CLOP.js.map → PageNotFound-CU9uqnRi.js.map} +1 -1
- package/dist/{SupportRoute-CP3loj1a.cjs → SupportRoute-BJbK64__.cjs} +2 -2
- package/dist/{SupportRoute-CP3loj1a.cjs.map → SupportRoute-BJbK64__.cjs.map} +1 -1
- package/dist/{SupportRoute-BeRkmVtV.js → SupportRoute-D907jHET.js} +2 -2
- package/dist/{SupportRoute-BeRkmVtV.js.map → SupportRoute-D907jHET.js.map} +1 -1
- package/dist/{VersionsRoute-Xo8_2OeH.js → VersionsRoute-CXRx1ZeN.js} +2 -2
- package/dist/{VersionsRoute-Xo8_2OeH.js.map → VersionsRoute-CXRx1ZeN.js.map} +1 -1
- package/dist/{VersionsRoute-Cs15std2.cjs → VersionsRoute-ahVJDsum.cjs} +2 -2
- package/dist/{VersionsRoute-Cs15std2.cjs.map → VersionsRoute-ahVJDsum.cjs.map} +1 -1
- package/dist/{index-Bq-3EQ1i.js → index-DHqKf7uc.js} +10 -8
- package/dist/{index-Bq-3EQ1i.js.map → index-DHqKf7uc.js.map} +1 -1
- package/dist/{index-BBqu13cy.cjs → index-DwdhsbJr.cjs} +2 -2
- package/dist/{index-BBqu13cy.cjs.map → index-DwdhsbJr.cjs.map} +1 -1
- package/dist/react-lib-tools.cjs +1 -1
- package/dist/react-lib-tools.js +1 -1
- package/package.json +1 -1
- package/scripts/utils/search/crawlPage.ts +37 -21
package/dist/react-lib-tools.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-
|
|
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
|
package/dist/react-lib-tools.js
CHANGED
|
@@ -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-
|
|
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
|
@@ -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
|
-
|
|
58
|
+
let text = "";
|
|
57
59
|
|
|
58
|
-
const main = document.body.querySelector("
|
|
60
|
+
const main = document.body.querySelector("[data-main-scrollable]");
|
|
59
61
|
if (main) {
|
|
60
|
-
|
|
61
|
-
switch (child.tagName) {
|
|
62
|
-
// case "CODE":
|
|
63
|
-
case "HEADER": {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
62
|
+
text = main.innerHTML;
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
+
"&": "&",
|
|
81
|
+
"<": "<",
|
|
82
|
+
">": ">",
|
|
83
|
+
""": '"',
|
|
84
|
+
"'": "'",
|
|
85
|
+
"–": "-",
|
|
86
|
+
" ": " "
|
|
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
|
|
103
|
+
text,
|
|
88
104
|
title,
|
|
89
105
|
words: Array.from(words)
|
|
90
106
|
};
|