@bigbinary/neeto-playwright-commons 1.9.10 → 1.9.11
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/configs/scripts/jsdoc-builder/utils.mjs +35 -6
- package/index.d.ts +2550 -158
- package/package.json +1 -1
|
@@ -28,6 +28,7 @@ import _traverse from "@babel/traverse";
|
|
|
28
28
|
import _generate from "@babel/generator";
|
|
29
29
|
|
|
30
30
|
import { matches } from "@bigbinary/neeto-cist";
|
|
31
|
+
import { endsWith } from "ramda";
|
|
31
32
|
|
|
32
33
|
const traverse = _traverse.default;
|
|
33
34
|
const generate = _generate.default;
|
|
@@ -79,7 +80,9 @@ const getParagraphChildrenText = node => {
|
|
|
79
80
|
const children = node.children;
|
|
80
81
|
if (children.length === 1) return children[0].value;
|
|
81
82
|
|
|
82
|
-
return children
|
|
83
|
+
return children
|
|
84
|
+
.map(child => child.value || child.children?.[0]?.value)
|
|
85
|
+
.join("");
|
|
83
86
|
};
|
|
84
87
|
|
|
85
88
|
const transformParagraph = node => {
|
|
@@ -206,14 +209,15 @@ export const defaultTypeFileTraverser = options => {
|
|
|
206
209
|
export const findVariableDeclarationName = node =>
|
|
207
210
|
node?.declarations?.[0]?.id?.name || node?.declaration?.id?.name;
|
|
208
211
|
|
|
212
|
+
export const isUtil = entityName => endsWith("Utils", entityName);
|
|
213
|
+
|
|
209
214
|
export const findClassPropertyName = node => node?.key?.name;
|
|
210
215
|
|
|
211
|
-
export const
|
|
216
|
+
export const handleEntity = (
|
|
212
217
|
node,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const entityName = extractEntityName(node);
|
|
218
|
+
entityTitleToDescMapOfAllFiles,
|
|
219
|
+
entityName
|
|
220
|
+
) => {
|
|
217
221
|
const entityDesc = entityTitleToDescMapOfAllFiles[entityName];
|
|
218
222
|
|
|
219
223
|
if (!entityName || !entityDesc) {
|
|
@@ -221,6 +225,31 @@ export const handleNode = ({
|
|
|
221
225
|
}
|
|
222
226
|
|
|
223
227
|
babelTypes.addComment(node, "leading", entityDesc);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export const handleUtilityMethods = (node, entityTitleToDescMapOfAllFiles) => {
|
|
231
|
+
const members =
|
|
232
|
+
node?.declarations?.[0]?.id?.typeAnnotation?.typeAnnotation?.members;
|
|
233
|
+
|
|
234
|
+
members.map(methodNode => {
|
|
235
|
+
handleEntity(
|
|
236
|
+
methodNode,
|
|
237
|
+
entityTitleToDescMapOfAllFiles,
|
|
238
|
+
methodNode.key.name
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export const handleNode = ({
|
|
244
|
+
node,
|
|
245
|
+
extractEntityName,
|
|
246
|
+
options: { entityTitleToDescMapOfAllFiles, typeFileName, typeFileAST },
|
|
247
|
+
}) => {
|
|
248
|
+
const entityName = extractEntityName(node);
|
|
249
|
+
|
|
250
|
+
isUtil(entityName)
|
|
251
|
+
? handleUtilityMethods(node, entityTitleToDescMapOfAllFiles)
|
|
252
|
+
: handleEntity(node, entityTitleToDescMapOfAllFiles, entityName);
|
|
224
253
|
|
|
225
254
|
const { code } = generate(typeFileAST, {});
|
|
226
255
|
|