@eagleoutice/flowr 2.2.15 → 2.2.16

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 (212) hide show
  1. package/README.md +210 -6
  2. package/benchmark/slicer.d.ts +3 -1
  3. package/benchmark/slicer.js +8 -5
  4. package/benchmark/summarizer/first-phase/process.d.ts +2 -1
  5. package/benchmark/summarizer/first-phase/process.js +2 -2
  6. package/cli/benchmark-app.d.ts +1 -0
  7. package/cli/benchmark-app.js +4 -1
  8. package/cli/benchmark-helper-app.d.ts +1 -0
  9. package/cli/benchmark-helper-app.js +7 -8
  10. package/cli/common/options.js +2 -0
  11. package/cli/export-quads-app.js +2 -1
  12. package/cli/flowr.js +58 -57
  13. package/cli/repl/commands/repl-cfg.js +13 -13
  14. package/cli/repl/commands/repl-commands.js +2 -2
  15. package/cli/repl/commands/repl-dataflow.js +10 -10
  16. package/cli/repl/commands/repl-execute.d.ts +2 -3
  17. package/cli/repl/commands/repl-execute.js +4 -4
  18. package/cli/repl/commands/repl-lineage.js +4 -4
  19. package/cli/repl/commands/repl-main.d.ts +12 -1
  20. package/cli/repl/commands/repl-normalize.js +6 -6
  21. package/cli/repl/commands/repl-parse.js +2 -2
  22. package/cli/repl/commands/repl-query.js +9 -9
  23. package/cli/repl/commands/repl-version.js +1 -1
  24. package/cli/repl/core.d.ts +5 -2
  25. package/cli/repl/core.js +10 -8
  26. package/cli/repl/server/connection.d.ts +3 -1
  27. package/cli/repl/server/connection.js +7 -5
  28. package/cli/repl/server/server.d.ts +3 -2
  29. package/cli/repl/server/server.js +4 -2
  30. package/cli/script-core/statistics-core.d.ts +2 -1
  31. package/cli/script-core/statistics-core.js +2 -2
  32. package/cli/script-core/statistics-helper-core.d.ts +2 -1
  33. package/cli/script-core/statistics-helper-core.js +5 -4
  34. package/cli/slicer-app.js +4 -2
  35. package/cli/statistics-app.js +2 -1
  36. package/cli/statistics-helper-app.js +2 -1
  37. package/config.d.ts +12 -10
  38. package/config.js +26 -42
  39. package/control-flow/cfg-dead-code.js +45 -2
  40. package/control-flow/cfg-simplification.d.ts +2 -0
  41. package/control-flow/control-flow-graph.d.ts +1 -0
  42. package/control-flow/control-flow-graph.js +4 -0
  43. package/control-flow/dfg-cfg-guided-visitor.d.ts +5 -3
  44. package/control-flow/dfg-cfg-guided-visitor.js +15 -4
  45. package/control-flow/extract-cfg.d.ts +4 -2
  46. package/control-flow/extract-cfg.js +4 -3
  47. package/control-flow/semantic-cfg-guided-visitor.d.ts +19 -1
  48. package/control-flow/semantic-cfg-guided-visitor.js +23 -3
  49. package/core/pipeline-executor.d.ts +4 -1
  50. package/core/pipeline-executor.js +6 -5
  51. package/core/steps/all/core/10-normalize.d.ts +2 -0
  52. package/core/steps/all/core/10-normalize.js +1 -1
  53. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -1
  54. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -2
  55. package/core/steps/all/core/20-dataflow.d.ts +2 -1
  56. package/core/steps/all/core/20-dataflow.js +2 -2
  57. package/core/steps/all/static-slicing/00-slice.d.ts +2 -1
  58. package/core/steps/all/static-slicing/00-slice.js +2 -2
  59. package/core/steps/pipeline/default-pipelines.d.ts +32 -31
  60. package/core/steps/pipeline/default-pipelines.js +8 -8
  61. package/core/steps/pipeline-step.d.ts +2 -1
  62. package/dataflow/environments/built-in-config.d.ts +3 -3
  63. package/dataflow/environments/built-in.d.ts +7 -1
  64. package/dataflow/environments/built-in.js +2 -2
  65. package/dataflow/environments/default-builtin-config.js +4 -2
  66. package/dataflow/environments/define.d.ts +2 -1
  67. package/dataflow/environments/define.js +4 -5
  68. package/dataflow/environments/remove.d.ts +6 -0
  69. package/dataflow/environments/remove.js +29 -0
  70. package/dataflow/eval/resolve/alias-tracking.d.ts +7 -2
  71. package/dataflow/eval/resolve/alias-tracking.js +9 -6
  72. package/dataflow/eval/resolve/resolve-argument.d.ts +8 -0
  73. package/dataflow/eval/resolve/resolve-argument.js +118 -0
  74. package/dataflow/eval/resolve/resolve.d.ts +18 -15
  75. package/dataflow/eval/resolve/resolve.js +20 -18
  76. package/dataflow/eval/values/string/string-constants.d.ts +1 -1
  77. package/dataflow/eval/values/string/string-constants.js +7 -2
  78. package/dataflow/extractor.d.ts +2 -1
  79. package/dataflow/extractor.js +2 -1
  80. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -6
  81. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  82. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
  83. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +11 -11
  84. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +10 -11
  85. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -2
  86. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -3
  87. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  89. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -3
  91. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +15 -15
  92. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  93. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  94. package/dataflow/internal/process/functions/call/common.js +1 -1
  95. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  96. package/dataflow/origin/dfg-get-symbol-refs.d.ts +21 -0
  97. package/dataflow/origin/dfg-get-symbol-refs.js +50 -0
  98. package/dataflow/processor.d.ts +5 -0
  99. package/documentation/doc-util/doc-cfg.js +4 -3
  100. package/documentation/doc-util/doc-code.d.ts +1 -1
  101. package/documentation/doc-util/doc-dfg.js +3 -2
  102. package/documentation/doc-util/doc-functions.d.ts +24 -0
  103. package/documentation/doc-util/doc-functions.js +65 -0
  104. package/documentation/doc-util/doc-normalized-ast.js +3 -2
  105. package/documentation/doc-util/doc-print.d.ts +5 -0
  106. package/documentation/doc-util/doc-print.js +36 -0
  107. package/documentation/doc-util/doc-query.js +3 -2
  108. package/documentation/doc-util/doc-repl.js +2 -1
  109. package/documentation/doc-util/doc-search.js +3 -2
  110. package/documentation/doc-util/doc-types.d.ts +28 -6
  111. package/documentation/doc-util/doc-types.js +89 -45
  112. package/documentation/print-cfg-wiki.js +6 -7
  113. package/documentation/print-core-wiki.js +5 -5
  114. package/documentation/print-dataflow-graph-wiki.js +10 -10
  115. package/documentation/print-engines-wiki.js +1 -2
  116. package/documentation/print-faq-wiki.js +8 -2
  117. package/documentation/print-interface-wiki.js +1 -2
  118. package/documentation/print-linter-issue.d.ts +1 -0
  119. package/documentation/print-linter-issue.js +71 -0
  120. package/documentation/print-linter-wiki.js +219 -34
  121. package/documentation/print-linting-and-testing-wiki.js +2 -4
  122. package/documentation/print-normalized-ast-wiki.js +3 -3
  123. package/documentation/print-query-wiki.js +1 -2
  124. package/documentation/print-readme.js +24 -1
  125. package/documentation/print-search-wiki.js +1 -2
  126. package/linter/linter-executor.d.ts +3 -1
  127. package/linter/linter-executor.js +3 -2
  128. package/linter/linter-format.d.ts +67 -7
  129. package/linter/linter-format.js +12 -1
  130. package/linter/linter-rules.d.ts +155 -16
  131. package/linter/linter-rules.js +12 -4
  132. package/linter/linter-tags.d.ts +80 -0
  133. package/linter/linter-tags.js +85 -0
  134. package/linter/rules/absolute-path.d.ts +71 -0
  135. package/linter/rules/absolute-path.js +177 -0
  136. package/linter/rules/deprecated-functions.d.ts +43 -0
  137. package/linter/rules/deprecated-functions.js +58 -0
  138. package/linter/rules/{2-file-path-validity.d.ts → file-path-validity.d.ts} +16 -6
  139. package/linter/rules/{2-file-path-validity.js → file-path-validity.js} +21 -13
  140. package/linter/rules/naming-convention.d.ts +71 -0
  141. package/linter/rules/naming-convention.js +164 -0
  142. package/linter/rules/seeded-randomness.d.ts +65 -0
  143. package/linter/rules/seeded-randomness.js +122 -0
  144. package/linter/rules/unused-definition.d.ts +41 -0
  145. package/linter/rules/unused-definition.js +105 -0
  146. package/package.json +4 -1
  147. package/queries/base-query-format.d.ts +2 -0
  148. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  149. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
  150. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  151. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  152. package/queries/catalog/config-query/config-query-executor.js +2 -3
  153. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  154. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -2
  155. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  156. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  157. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  158. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -116
  159. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  160. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  161. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  162. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  163. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  164. package/queries/catalog/linter-query/linter-query-executor.js +2 -2
  165. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  166. package/queries/catalog/linter-query/linter-query-format.js +16 -12
  167. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  168. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  169. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  170. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  171. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  172. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  173. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  174. package/queries/catalog/search-query/search-query-executor.js +2 -2
  175. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  176. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  177. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
  178. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  179. package/queries/query.d.ts +15 -15
  180. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -1
  181. package/r-bridge/lang-4.x/ast/parser/json/parser.js +4 -2
  182. package/r-bridge/lang-4.x/convert-values.js +2 -1
  183. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -1
  184. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  185. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
  186. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +7 -5
  187. package/r-bridge/shell.d.ts +3 -2
  188. package/r-bridge/shell.js +4 -5
  189. package/search/flowr-search-builder.d.ts +6 -2
  190. package/search/flowr-search-builder.js +7 -0
  191. package/search/flowr-search-filters.d.ts +32 -8
  192. package/search/flowr-search-filters.js +42 -15
  193. package/search/flowr-search.d.ts +4 -0
  194. package/search/search-executor/search-enrichers.d.ts +7 -3
  195. package/search/search-executor/search-enrichers.js +29 -20
  196. package/search/search-executor/search-generators.js +1 -1
  197. package/search/search-executor/search-transformer.d.ts +2 -0
  198. package/search/search-executor/search-transformer.js +10 -1
  199. package/slicing/static/static-slicer.d.ts +1 -1
  200. package/slicing/static/static-slicer.js +2 -3
  201. package/statistics/statistics.d.ts +3 -1
  202. package/statistics/statistics.js +5 -4
  203. package/util/containers.d.ts +12 -9
  204. package/util/containers.js +12 -9
  205. package/util/objects.d.ts +5 -4
  206. package/util/range.d.ts +5 -1
  207. package/util/range.js +11 -3
  208. package/util/text/strings.d.ts +6 -0
  209. package/util/text/strings.js +35 -0
  210. package/util/version.js +1 -1
  211. package/linter/rules/1-deprecated-functions.d.ts +0 -34
  212. package/linter/rules/1-deprecated-functions.js +0 -54
@@ -15,6 +15,7 @@ const assert_1 = require("../../util/assert");
15
15
  const time_1 = require("../../util/text/time");
16
16
  const doc_files_1 = require("./doc-files");
17
17
  const doc_code_1 = require("./doc-code");
18
+ const config_1 = require("../../config");
18
19
  function printDfGraph(graph, mark, simplified = false) {
19
20
  return `
20
21
  ${(0, doc_code_1.codeBlock)('mermaid', (0, dfg_1.graphToMermaid)({
@@ -37,7 +38,7 @@ async function printDfGraphForCode(parser, code, { simplified = false, mark, sho
37
38
  const now = performance.now();
38
39
  const result = await (0, default_pipelines_1.createDataflowPipeline)(parser, {
39
40
  request: (0, retriever_1.requestFromInput)(code)
40
- }).allRemainingSteps();
41
+ }, config_1.defaultConfigOptions).allRemainingSteps();
41
42
  const duration = performance.now() - now;
42
43
  if (switchCodeAndGraph) {
43
44
  (0, assert_1.guard)(showCode, 'can not switch code and graph if code is not shown');
@@ -76,7 +77,7 @@ async function verifyExpectedSubgraph(shell, code, expectedSubgraph) {
76
77
  parser: shell,
77
78
  request: (0, retriever_1.requestFromInput)(code),
78
79
  getId: (0, decorate_1.deterministicCountingIdGenerator)(0)
79
- }).allRemainingSteps();
80
+ }, config_1.defaultConfigOptions).allRemainingSteps();
80
81
  expectedSubgraph.setIdMap(info.normalize.idMap);
81
82
  expectedSubgraph = (0, resolve_graph_1.resolveDataflowGraph)(expectedSubgraph);
82
83
  const report = (0, diff_dataflow_graph_1.diffOfDataflowGraphs)({ name: 'expected', graph: expectedSubgraph }, { name: 'got', graph: info.dataflow.graph }, {
@@ -0,0 +1,24 @@
1
+ import type { Expression } from 'typescript';
2
+ import ts from 'typescript';
3
+ export interface FunctionElementInSource {
4
+ name: string;
5
+ node: ts.Node;
6
+ source: ts.SourceFile;
7
+ kind: 'function';
8
+ arguments: Expression[];
9
+ lineNumber: number;
10
+ comments?: string[];
11
+ }
12
+ export interface GetFunctionsOption {
13
+ readonly rootFolder?: string;
14
+ readonly files?: readonly string[];
15
+ readonly fname?: RegExp;
16
+ }
17
+ export interface FunctionsReport {
18
+ info: FunctionElementInSource[];
19
+ program: ts.Program;
20
+ }
21
+ /**
22
+ * Inspect typescript source code for types and return a report.
23
+ */
24
+ export declare function getFunctionsFromFolder(options: GetFunctionsOption): FunctionsReport;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getFunctionsFromFolder = getFunctionsFromFolder;
7
+ const typescript_1 = __importDefault(require("typescript"));
8
+ const assert_1 = require("../../util/assert");
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const doc_types_1 = require("./doc-types");
12
+ function collectHierarchyInformation(sourceFiles, options, fname) {
13
+ const hierarchyList = [];
14
+ const visit = (node, sourceFile) => {
15
+ if (!node) {
16
+ return;
17
+ }
18
+ if (typescript_1.default.isCallExpression(node) || typescript_1.default.isNewExpression(node)) {
19
+ const name = node.expression.getText(sourceFile);
20
+ if (!fname || fname.test(name)) {
21
+ const comments = typescript_1.default.getLeadingCommentRanges(sourceFile.getText(sourceFile), node.getFullStart())?.map(c => {
22
+ return (0, doc_types_1.removeCommentSymbolsFromTypeScriptComment)(sourceFile.getText(sourceFile).substring(c.pos, c.end).trim());
23
+ });
24
+ hierarchyList.push({
25
+ name: (0, doc_types_1.dropGenericsFromTypeName)(name),
26
+ node,
27
+ kind: 'function',
28
+ comments,
29
+ lineNumber: (0, doc_types_1.getStartLineOfTypeScriptNode)(node, sourceFile),
30
+ source: sourceFile,
31
+ arguments: node.arguments?.map(n => n) ?? []
32
+ });
33
+ }
34
+ }
35
+ typescript_1.default.forEachChild(node, child => visit(child, sourceFile));
36
+ };
37
+ sourceFiles.forEach(sourceFile => {
38
+ visit(sourceFile, sourceFile);
39
+ });
40
+ return hierarchyList;
41
+ }
42
+ /**
43
+ * Inspect typescript source code for types and return a report.
44
+ */
45
+ function getFunctionsFromFolder(options) {
46
+ (0, assert_1.guard)(options.rootFolder !== undefined || options.files !== undefined, 'Either rootFolder or files must be provided');
47
+ const fileNames = [...options.files ?? []];
48
+ if (options.rootFolder) {
49
+ for (const fileBuff of fs_1.default.readdirSync(options.rootFolder, { recursive: true })) {
50
+ const file = fileBuff.toString();
51
+ if (file.endsWith('.ts')) {
52
+ fileNames.push(path_1.default.join(options.rootFolder, file));
53
+ }
54
+ }
55
+ }
56
+ const { files, program } = (0, doc_types_1.getTypeScriptSourceFiles)(fileNames);
57
+ (0, assert_1.guard)(files.length > 0, () => `No source files found for ${JSON.stringify(fileNames)}`);
58
+ const withProgram = { ...options, program };
59
+ const hierarchyList = collectHierarchyInformation(files, withProgram, options.fname);
60
+ return {
61
+ info: hierarchyList,
62
+ program
63
+ };
64
+ }
65
+ //# sourceMappingURL=doc-functions.js.map
@@ -12,6 +12,7 @@ const assert_1 = require("../../util/assert");
12
12
  const ast_1 = require("../../util/mermaid/ast");
13
13
  const time_1 = require("../../util/text/time");
14
14
  const doc_files_1 = require("./doc-files");
15
+ const config_1 = require("../../config");
15
16
  function printNormalizedAst(ast, prefix = 'flowchart TD\n') {
16
17
  return `
17
18
  \`\`\`mermaid
@@ -23,7 +24,7 @@ async function printNormalizedAstForCode(parser, code, { showCode = true, prefix
23
24
  const now = performance.now();
24
25
  const result = await (0, default_pipelines_1.createNormalizePipeline)(parser, {
25
26
  request: (0, retriever_1.requestFromInput)(code)
26
- }).allRemainingSteps();
27
+ }, config_1.defaultConfigOptions).allRemainingSteps();
27
28
  const duration = performance.now() - now;
28
29
  const metaInfo = `The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parsing with the [${parser.name}](${doc_files_1.FlowrWikiBaseRef}/Engines) engine) within the generation environment.`;
29
30
  return '\n\n' + printNormalizedAst(result.normalize.ast, prefix) + (showCode ? `
@@ -57,7 +58,7 @@ async function verifyExpectedSubgraph(shell, code, expectedSubgraph) {
57
58
  const info = await (0, default_pipelines_1.createDataflowPipeline)(shell, {
58
59
  request: (0, retriever_1.requestFromInput)(code),
59
60
  getId: (0, decorate_1.deterministicCountingIdGenerator)(0)
60
- }).allRemainingSteps();
61
+ }, config_1.defaultConfigOptions).allRemainingSteps();
61
62
  expectedSubgraph.setIdMap(info.normalize.idMap);
62
63
  expectedSubgraph = (0, resolve_graph_1.resolveDataflowGraph)(expectedSubgraph);
63
64
  const report = (0, diff_dataflow_graph_1.diffOfDataflowGraphs)({ name: 'expected', graph: expectedSubgraph }, { name: 'got', graph: info.dataflow.graph }, {
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Writes the wiki documentation to the specified output path.
3
+ * Returns true if the file was updated, false if it was unchanged.
4
+ */
5
+ export declare function writeWikiTo(text: string, output_path: string, check_change?: boolean): boolean;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.writeWikiTo = writeWikiTo;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ /* eslint-disable */
10
+ const IgnoreRegex = /[0-9]+(\.[0-9]+)? ?ms|"timing":\s*[0-9]+(\.0-9)?,?|tmp-[A-Za-z0-9-]+/g;
11
+ /* eslint-enable */
12
+ /**
13
+ * Checks whether the file contains a different content, but ignores timing and some other non-semantic changes.
14
+ */
15
+ function didFileChange(filePath, content) {
16
+ if (!fs_1.default.existsSync(filePath)) {
17
+ return true; // If the file does not exist, it is considered changed.
18
+ }
19
+ const currentContent = fs_1.default.readFileSync(filePath, 'utf-8');
20
+ const cleanedCurrentContent = currentContent.replace(IgnoreRegex, '');
21
+ const cleanedNewContent = content.replace(IgnoreRegex, '');
22
+ return cleanedCurrentContent !== cleanedNewContent;
23
+ }
24
+ /**
25
+ * Writes the wiki documentation to the specified output path.
26
+ * Returns true if the file was updated, false if it was unchanged.
27
+ */
28
+ function writeWikiTo(text, output_path, check_change = true) {
29
+ if (!check_change || didFileChange(output_path, text)) {
30
+ fs_1.default.mkdirSync(path_1.default.dirname(output_path), { recursive: true });
31
+ fs_1.default.writeFileSync(output_path, text, 'utf-8');
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+ //# sourceMappingURL=doc-print.js.map
@@ -17,13 +17,14 @@ const doc_dfg_1 = require("./doc-dfg");
17
17
  const doc_code_1 = require("./doc-code");
18
18
  const time_1 = require("../../util/text/time");
19
19
  const query_print_1 = require("../../queries/query-print");
20
+ const config_1 = require("../../config");
20
21
  async function showQuery(shell, code, queries, { showCode, collapseResult, collapseQuery, addOutput = () => '' } = {}) {
21
22
  const now = performance.now();
22
23
  const analysis = await new pipeline_executor_1.PipelineExecutor(default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE, {
23
24
  parser: shell,
24
25
  request: (0, retriever_1.requestFromInput)(code)
25
- }).allRemainingSteps();
26
- const results = (0, query_1.executeQueries)({ dataflow: analysis.dataflow, ast: analysis.normalize }, queries);
26
+ }, config_1.defaultConfigOptions).allRemainingSteps();
27
+ const results = (0, query_1.executeQueries)({ dataflow: analysis.dataflow, ast: analysis.normalize, config: config_1.defaultConfigOptions }, queries);
27
28
  const duration = performance.now() - now;
28
29
  const metaInfo = `
29
30
  The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parsing and normalization and the query) within the generation environment.
@@ -11,6 +11,7 @@ const doc_docker_1 = require("./doc-docker");
11
11
  const prompt_1 = require("../../cli/repl/prompt");
12
12
  const doc_code_1 = require("./doc-code");
13
13
  const print_version_1 = require("../../cli/repl/print-version");
14
+ const config_1 = require("../../config");
14
15
  function printHelpForScript(script, starredVersion) {
15
16
  let base = `| **${(0, doc_cli_option_1.getReplCommand)(script[0], false, starredVersion !== undefined)}** | ${script[1].description}`;
16
17
  if (starredVersion) {
@@ -51,7 +52,7 @@ async function documentReplSession(parser, commands, options) {
51
52
  entry.lines.push(msg);
52
53
  }
53
54
  };
54
- await (0, core_1.replProcessAnswer)(collectingOutput, command.command, parser, options?.allowRSessionAccess ?? false);
55
+ await (0, core_1.replProcessAnswer)(config_1.defaultConfigOptions, collectingOutput, command.command, parser, options?.allowRSessionAccess ?? false);
55
56
  collect.push(entry);
56
57
  }
57
58
  let result = '';
@@ -17,13 +17,14 @@ const flowr_search_executor_1 = require("../../search/flowr-search-executor");
17
17
  const flowr_search_printer_1 = require("../../search/flowr-search-printer");
18
18
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
19
19
  const dfg_1 = require("../../util/mermaid/dfg");
20
+ const config_1 = require("../../config");
20
21
  async function showSearch(shell, code, search, { collapseResult = true } = {}) {
21
22
  const now = performance.now();
22
23
  const analysis = await new pipeline_executor_1.PipelineExecutor(default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE, {
23
24
  parser: shell,
24
25
  request: (0, retriever_1.requestFromInput)(code)
25
- }).allRemainingSteps();
26
- const result = (0, flowr_search_executor_1.runSearch)(search, analysis);
26
+ }, config_1.defaultConfigOptions).allRemainingSteps();
27
+ const result = (0, flowr_search_executor_1.runSearch)(search, { ...analysis, config: config_1.defaultConfigOptions });
27
28
  const duration = performance.now() - now;
28
29
  const metaInfo = `
29
30
  The search required _${(0, time_1.printAsMs)(duration)}_ (including parsing and normalization and the query) within the generation environment.
@@ -10,21 +10,42 @@ export interface TypeElementInSource {
10
10
  comments?: string[];
11
11
  readonly properties?: string[];
12
12
  }
13
+ export declare function getTypeScriptSourceFiles(fileNames: readonly string[]): {
14
+ files: ts.SourceFile[];
15
+ program: ts.Program;
16
+ };
17
+ export declare function dropGenericsFromTypeName(type: string): string;
18
+ export declare function removeCommentSymbolsFromTypeScriptComment(comment: string): string;
19
+ export declare function getTextualCommentsFromTypeScript(node: ts.Node): string[];
20
+ export declare function getStartLineOfTypeScriptNode(node: ts.Node, sourceFile: ts.SourceFile): number;
13
21
  export declare function getType(node: ts.Node, typeChecker: ts.TypeChecker): string;
14
22
  export declare function followTypeReference(type: ts.TypeReferenceNode, sourceFile: ts.SourceFile): string[];
15
- export declare function getTypePathLink({ filePath, lineNumber }: TypeElementInSource, prefix?: string): string;
23
+ export declare function getTypePathForTypeScript({ filePath }: Pick<TypeElementInSource, 'filePath'>): string;
24
+ export declare function getTypePathLink(elem: Pick<TypeElementInSource, 'filePath' | 'lineNumber'>, prefix?: string): string;
16
25
  export interface GetTypesAsMermaidOption {
17
26
  readonly rootFolder?: string;
18
27
  readonly files?: readonly string[];
19
- readonly typeName: string;
28
+ /** if you request a type name, we will generate a mermaid diagram for that type */
29
+ readonly typeNameForMermaid?: string;
20
30
  readonly inlineTypes?: readonly string[];
21
31
  }
22
- export interface MermaidTypeReport {
23
- text: string;
32
+ export interface TypeReport {
33
+ /** if you request a type name this will include the mermaid diagram for the type */
34
+ mermaid: string | undefined;
24
35
  info: TypeElementInSource[];
25
36
  program: ts.Program;
26
37
  }
27
- export declare function getTypesFromFolderAsMermaid(options: GetTypesAsMermaidOption): MermaidTypeReport;
38
+ export declare function getTypesFromFolder(options: GetTypesAsMermaidOption & {
39
+ typeNameForMermaid: string;
40
+ }): (TypeReport & {
41
+ mermaid: string;
42
+ });
43
+ export declare function getTypesFromFolder(options: GetTypesAsMermaidOption & {
44
+ typeNameForMermaid?: undefined;
45
+ }): (TypeReport & {
46
+ mermaid: undefined;
47
+ });
48
+ export declare function getTypesFromFolder(options: GetTypesAsMermaidOption): TypeReport;
28
49
  export declare function implSnippet(node: TypeElementInSource | undefined, program: ts.Program, showName?: boolean, nesting?: number, open?: boolean): string;
29
50
  export interface PrintHierarchyArguments {
30
51
  readonly program: ts.Program;
@@ -51,5 +72,6 @@ export declare function printCodeOfElement({ program, info }: FnInfo, name: stri
51
72
  * @param realNameWrapper - How to highlight the function in name in the `x::y` format?
52
73
  */
53
74
  export declare function shortLink(name: string, hierarchy: readonly TypeElementInSource[], codeStyle?: boolean, realNameWrapper?: string): string;
54
- export declare function getDocumentationForType(name: string, hierarchy: TypeElementInSource[], prefix?: string): string;
75
+ export declare function shortLinkFile(name: string, hierarchy: readonly TypeElementInSource[]): string;
76
+ export declare function getDocumentationForType(name: string, hierarchy: TypeElementInSource[], prefix?: string, fuzzy?: boolean): string;
55
77
  export {};
@@ -4,14 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.mermaidHide = void 0;
7
+ exports.getTypeScriptSourceFiles = getTypeScriptSourceFiles;
8
+ exports.dropGenericsFromTypeName = dropGenericsFromTypeName;
9
+ exports.removeCommentSymbolsFromTypeScriptComment = removeCommentSymbolsFromTypeScriptComment;
10
+ exports.getTextualCommentsFromTypeScript = getTextualCommentsFromTypeScript;
11
+ exports.getStartLineOfTypeScriptNode = getStartLineOfTypeScriptNode;
7
12
  exports.getType = getType;
8
13
  exports.followTypeReference = followTypeReference;
14
+ exports.getTypePathForTypeScript = getTypePathForTypeScript;
9
15
  exports.getTypePathLink = getTypePathLink;
10
- exports.getTypesFromFolderAsMermaid = getTypesFromFolderAsMermaid;
16
+ exports.getTypesFromFolder = getTypesFromFolder;
11
17
  exports.implSnippet = implSnippet;
12
18
  exports.printHierarchy = printHierarchy;
13
19
  exports.printCodeOfElement = printCodeOfElement;
14
20
  exports.shortLink = shortLink;
21
+ exports.shortLinkFile = shortLinkFile;
15
22
  exports.getDocumentationForType = getDocumentationForType;
16
23
  const typescript_1 = __importDefault(require("typescript"));
17
24
  const assert_1 = require("../../util/assert");
@@ -23,7 +30,7 @@ const doc_code_1 = require("./doc-code");
23
30
  const doc_structure_1 = require("./doc-structure");
24
31
  const html_hover_over_1 = require("../../util/html-hover-over");
25
32
  const doc_general_1 = require("./doc-general");
26
- function getSourceFiles(fileNames) {
33
+ function getTypeScriptSourceFiles(fileNames) {
27
34
  try {
28
35
  const program = typescript_1.default.createProgram(fileNames, { target: typescript_1.default.ScriptTarget.ESNext });
29
36
  return { program, files: fileNames.map(fileName => program.getSourceFile(fileName)).filter(file => !!file) };
@@ -33,7 +40,7 @@ function getSourceFiles(fileNames) {
33
40
  return { files: [], program: undefined };
34
41
  }
35
42
  }
36
- function dropGenericsFromType(type) {
43
+ function dropGenericsFromTypeName(type) {
37
44
  let previous;
38
45
  do {
39
46
  previous = type;
@@ -41,7 +48,7 @@ function dropGenericsFromType(type) {
41
48
  } while (type !== previous);
42
49
  return type;
43
50
  }
44
- function removeCommentSymbols(comment) {
51
+ function removeCommentSymbolsFromTypeScriptComment(comment) {
45
52
  return comment
46
53
  // remove '/** \n * \n */...
47
54
  .replace(/^\/\*\*?/gm, '').replace(/^\s*\*\s*/gm, '').replace(/\*\/$/gm, '').replace(/^\s*\*/gm, '')
@@ -49,22 +56,22 @@ function removeCommentSymbols(comment) {
49
56
  .replace(/\{@[a-zA-Z]+ ([^}]+\|)?(?<name>[^}]+)}/gm, '<code>$<name></code>')
50
57
  .trim();
51
58
  }
52
- function getTextualComments(node) {
59
+ function getTextualCommentsFromTypeScript(node) {
53
60
  const comments = typescript_1.default.getJSDocCommentsAndTags(node);
54
61
  const out = [];
55
62
  for (const { comment } of comments) {
56
63
  if (typeof comment === 'string') {
57
- out.push(removeCommentSymbols(comment));
64
+ out.push(removeCommentSymbolsFromTypeScriptComment(comment));
58
65
  }
59
66
  else if (comment !== undefined) {
60
67
  for (const c of comment) {
61
- out.push(removeCommentSymbols(c.getText(c.getSourceFile())));
68
+ out.push(removeCommentSymbolsFromTypeScriptComment(c.getText(c.getSourceFile())));
62
69
  }
63
70
  }
64
71
  }
65
72
  return out;
66
73
  }
67
- function getStartLine(node, sourceFile) {
74
+ function getStartLineOfTypeScriptNode(node, sourceFile) {
68
75
  const lineStart = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line;
69
76
  return lineStart + 1;
70
77
  }
@@ -97,17 +104,17 @@ function collectHierarchyInformation(sourceFiles, options) {
97
104
  const interfaceName = node.name?.getText(sourceFile) ?? '';
98
105
  const baseTypes = node.heritageClauses?.flatMap(clause => clause.types
99
106
  .map(type => type.getText(sourceFile) ?? '')
100
- .map(dropGenericsFromType)) ?? [];
107
+ .map(dropGenericsFromTypeName)) ?? [];
101
108
  const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') || [];
102
109
  hierarchyList.push({
103
- name: dropGenericsFromType(interfaceName),
110
+ name: dropGenericsFromTypeName(interfaceName),
104
111
  node,
105
112
  kind: 'interface',
106
113
  extends: baseTypes,
107
114
  generics,
108
- comments: getTextualComments(node),
115
+ comments: getTextualCommentsFromTypeScript(node),
109
116
  filePath: sourceFile.fileName,
110
- lineNumber: getStartLine(node, sourceFile),
117
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
111
118
  properties: node.members.map(member => {
112
119
  const name = member.name?.getText(sourceFile) ?? '';
113
120
  return `${name}${(0, mermaid_1.escapeMarkdown)(': ' + getType(member, typeChecker))}`;
@@ -121,55 +128,69 @@ function collectHierarchyInformation(sourceFiles, options) {
121
128
  baseTypes = node.type.types
122
129
  .filter(typeNode => typescript_1.default.isTypeReferenceNode(typeNode))
123
130
  .flatMap(typeName => followTypeReference(typeName, sourceFile))
124
- .map(dropGenericsFromType);
131
+ .map(dropGenericsFromTypeName);
125
132
  }
126
133
  else if (typescript_1.default.isTypeReferenceNode(node.type)) {
127
- baseTypes = [...followTypeReference(node.type, sourceFile)].map(dropGenericsFromType);
134
+ baseTypes = [...followTypeReference(node.type, sourceFile)].map(dropGenericsFromTypeName);
128
135
  }
129
136
  const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
130
137
  hierarchyList.push({
131
- name: dropGenericsFromType(typeName),
138
+ name: dropGenericsFromTypeName(typeName),
132
139
  node,
133
140
  kind: 'type',
134
141
  extends: baseTypes,
135
- comments: getTextualComments(node),
142
+ comments: getTextualCommentsFromTypeScript(node),
136
143
  generics,
137
144
  filePath: sourceFile.fileName,
138
- lineNumber: getStartLine(node, sourceFile),
145
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
139
146
  });
140
147
  }
141
148
  else if (typescript_1.default.isEnumDeclaration(node)) {
142
149
  const enumName = node.name?.getText(sourceFile) ?? '';
143
150
  hierarchyList.push({
144
- name: dropGenericsFromType(enumName),
151
+ name: dropGenericsFromTypeName(enumName),
145
152
  node,
146
153
  kind: 'enum',
147
154
  extends: [],
148
- comments: getTextualComments(node),
155
+ comments: getTextualCommentsFromTypeScript(node),
149
156
  generics: [],
150
157
  filePath: sourceFile.fileName,
151
- lineNumber: getStartLine(node, sourceFile),
158
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
152
159
  properties: node.members.map(member => {
153
160
  const name = member.name?.getText(sourceFile) ?? '';
154
161
  return `${name}${(0, mermaid_1.escapeMarkdown)(': ' + getType(member, typeChecker))}`;
155
162
  })
156
163
  });
157
164
  }
165
+ else if (typescript_1.default.isEnumMember(node)) {
166
+ const typeName = node.parent.name?.getText(sourceFile) ?? '';
167
+ const enumName = dropGenericsFromTypeName(typeName);
168
+ hierarchyList.push({
169
+ name: dropGenericsFromTypeName(node.name.getText(sourceFile)),
170
+ node,
171
+ kind: 'enum',
172
+ extends: [enumName],
173
+ comments: getTextualCommentsFromTypeScript(node),
174
+ generics: [],
175
+ filePath: sourceFile.fileName,
176
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
177
+ });
178
+ }
158
179
  else if (typescript_1.default.isClassDeclaration(node)) {
159
180
  const className = node.name?.getText(sourceFile) ?? '';
160
181
  const baseTypes = node.heritageClauses?.flatMap(clause => clause.types
161
182
  .map(type => type.getText(sourceFile) ?? '')
162
- .map(dropGenericsFromType)) ?? [];
183
+ .map(dropGenericsFromTypeName)) ?? [];
163
184
  const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
164
185
  hierarchyList.push({
165
- name: dropGenericsFromType(className),
186
+ name: dropGenericsFromTypeName(className),
166
187
  node,
167
188
  kind: 'class',
168
189
  extends: baseTypes,
169
- comments: getTextualComments(node),
190
+ comments: getTextualCommentsFromTypeScript(node),
170
191
  generics,
171
192
  filePath: sourceFile.fileName,
172
- lineNumber: getStartLine(node, sourceFile),
193
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
173
194
  properties: node.members.map(member => {
174
195
  const name = member.name?.getText(sourceFile) ?? '';
175
196
  return `${name}${(0, mermaid_1.escapeMarkdown)(': ' + getType(member, typeChecker))}`;
@@ -178,16 +199,16 @@ function collectHierarchyInformation(sourceFiles, options) {
178
199
  }
179
200
  else if (typescript_1.default.isVariableDeclaration(node) || typescript_1.default.isExportDeclaration(node) || typescript_1.default.isExportAssignment(node) || typescript_1.default.isDeclarationStatement(node)) {
180
201
  const name = node.name?.getText(sourceFile) ?? '';
181
- const comments = getTextualComments(node);
202
+ const comments = getTextualCommentsFromTypeScript(node);
182
203
  hierarchyList.push({
183
- name: dropGenericsFromType(name),
204
+ name: dropGenericsFromTypeName(name),
184
205
  node,
185
206
  kind: 'variable',
186
207
  extends: [],
187
208
  comments,
188
209
  generics: [],
189
210
  filePath: sourceFile.fileName,
190
- lineNumber: getStartLine(node, sourceFile),
211
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
191
212
  });
192
213
  }
193
214
  else if (typescript_1.default.isPropertyAssignment(node) || typescript_1.default.isPropertyDeclaration(node) || typescript_1.default.isPropertySignature(node)
@@ -199,16 +220,16 @@ function collectHierarchyInformation(sourceFiles, options) {
199
220
  parent = parent.parent;
200
221
  }
201
222
  if (typeof parent === 'object' && 'name' in parent) {
202
- const comments = getTextualComments(node);
223
+ const comments = getTextualCommentsFromTypeScript(node);
203
224
  hierarchyList.push({
204
- name: dropGenericsFromType(name),
225
+ name: dropGenericsFromTypeName(name),
205
226
  node,
206
227
  kind: 'variable',
207
228
  extends: [parent.name?.getText(sourceFile) ?? ''],
208
229
  comments,
209
230
  generics: [],
210
231
  filePath: sourceFile.fileName,
211
- lineNumber: getStartLine(node, sourceFile),
232
+ lineNumber: getStartLineOfTypeScriptNode(node, sourceFile),
212
233
  });
213
234
  }
214
235
  }
@@ -219,9 +240,12 @@ function collectHierarchyInformation(sourceFiles, options) {
219
240
  });
220
241
  return hierarchyList;
221
242
  }
222
- function getTypePathLink({ filePath, lineNumber }, prefix = doc_files_1.RemoteFlowrFilePathBaseRef) {
223
- const fromSource = filePath.replace(/^.*\/src\//, 'src/').replace(/^.*\/test\//, 'test/');
224
- return `${prefix}/${fromSource}#L${lineNumber}`;
243
+ function getTypePathForTypeScript({ filePath }) {
244
+ return filePath.replace(/^.*\/src\//, 'src/').replace(/^.*\/test\//, 'test/');
245
+ }
246
+ function getTypePathLink(elem, prefix = doc_files_1.RemoteFlowrFilePathBaseRef) {
247
+ const fromSource = getTypePathForTypeScript(elem);
248
+ return `${prefix}/${fromSource}#L${elem.lineNumber}`;
225
249
  }
226
250
  function generateMermaidClassDiagram(hierarchyList, rootName, options, visited = new Set()) {
227
251
  const collect = { nodeLines: [], edgeLines: [] };
@@ -261,10 +285,10 @@ function generateMermaidClassDiagram(hierarchyList, rootName, options, visited =
261
285
  }
262
286
  else {
263
287
  if (node.kind === 'type' || hierarchyList.find(h => h.name === baseType)?.kind === 'type') {
264
- collect.edgeLines.push(`${dropGenericsFromType(baseType)} .. ${node.name}`);
288
+ collect.edgeLines.push(`${dropGenericsFromTypeName(baseType)} .. ${node.name}`);
265
289
  }
266
290
  else {
267
- collect.edgeLines.push(`${dropGenericsFromType(baseType)} <|-- ${node.name}`);
291
+ collect.edgeLines.push(`${dropGenericsFromTypeName(baseType)} <|-- ${node.name}`);
268
292
  }
269
293
  const { nodeLines, edgeLines } = generateMermaidClassDiagram(hierarchyList, baseType, options, visited);
270
294
  collect.nodeLines.push(...nodeLines);
@@ -275,7 +299,10 @@ function generateMermaidClassDiagram(hierarchyList, rootName, options, visited =
275
299
  return collect;
276
300
  }
277
301
  function visualizeMermaidClassDiagram(hierarchyList, options) {
278
- const { nodeLines, edgeLines } = generateMermaidClassDiagram(hierarchyList, options.typeName, options);
302
+ if (!options.typeNameForMermaid) {
303
+ return undefined;
304
+ }
305
+ const { nodeLines, edgeLines } = generateMermaidClassDiagram(hierarchyList, options.typeNameForMermaid, options);
279
306
  return nodeLines.length === 0 && edgeLines.length === 0 ? '' : `
280
307
  classDiagram
281
308
  direction RL
@@ -284,17 +311,20 @@ ${edgeLines.join('\n')}
284
311
  `;
285
312
  }
286
313
  function getTypesFromFileAsMermaid(fileNames, options) {
287
- const { files, program } = getSourceFiles(fileNames);
314
+ const { files, program } = getTypeScriptSourceFiles(fileNames);
288
315
  (0, assert_1.guard)(files.length > 0, () => `No source files found for ${JSON.stringify(fileNames)}`);
289
316
  const withProgram = { ...options, program };
290
317
  const hierarchyList = collectHierarchyInformation(files, withProgram);
291
318
  return {
292
- text: visualizeMermaidClassDiagram(hierarchyList, withProgram),
319
+ mermaid: visualizeMermaidClassDiagram(hierarchyList, withProgram),
293
320
  info: hierarchyList,
294
321
  program
295
322
  };
296
323
  }
297
- function getTypesFromFolderAsMermaid(options) {
324
+ /**
325
+ * Inspect typescript source code for types and return a report.
326
+ */
327
+ function getTypesFromFolder(options) {
298
328
  (0, assert_1.guard)(options.rootFolder !== undefined || options.files !== undefined, 'Either rootFolder or files must be provided');
299
329
  const files = [...options.files ?? []];
300
330
  if (options.rootFolder) {
@@ -356,17 +386,22 @@ function printCodeOfElement({ program, info }, name) {
356
386
  const code = node.node.getFullText(program.getSourceFile(node.node.getSourceFile().fileName));
357
387
  return `${(0, doc_code_1.codeBlock)('ts', code)}\n<i>Defined at <a href="${getTypePathLink(node)}">${getTypePathLink(node, '.')}</a></i>\n`;
358
388
  }
359
- function retrieveNode(name, hierarchy) {
389
+ function fuzzyCompare(a, b) {
390
+ const aStr = a.toLowerCase().replace(/[^a-z0-9]/g, '-').trim();
391
+ const bStr = b.toLowerCase().replace(/[^a-z0-9]/g, '-').trim();
392
+ return aStr === bStr || aStr.includes(bStr) || bStr.includes(aStr);
393
+ }
394
+ function retrieveNode(name, hierarchy, fuzzy = false) {
360
395
  let container = undefined;
361
396
  if (name.includes('::')) {
362
397
  [container, name] = name.split(/:::?/);
363
398
  }
364
- let node = hierarchy.filter(e => e.name === name);
399
+ let node = hierarchy.filter(e => fuzzy ? fuzzyCompare(e.name, name) : e.name === name);
365
400
  if (node.length === 0) {
366
401
  return undefined;
367
402
  }
368
403
  else if (container) {
369
- node = node.filter(n => n.extends.includes(container));
404
+ node = node.filter(n => fuzzy ? n.extends.some(n => fuzzyCompare(n, container)) : n.extends.includes(container));
370
405
  if (node.length === 0) {
371
406
  return undefined;
372
407
  }
@@ -393,11 +428,20 @@ function shortLink(name, hierarchy, codeStyle = true, realNameWrapper = 'b') {
393
428
  pkg = undefined;
394
429
  }
395
430
  const comments = node.comments?.join('\n').replace(/\\?\n|```[a-zA-Z]*|\s\s*/g, ' ').replace(/<\/?code>|`/g, '').replace(/<\/?p\/?>/g, ' ').replace(/"/g, '\'') ?? '';
396
- return `[${codeStyle ? '<code>' : ''}${(node.comments?.length ?? 0) > 0 ?
397
- (0, html_hover_over_1.textWithTooltip)(pkg ? `${pkg}::<${realNameWrapper}>${mainName}</${realNameWrapper}>` : mainName, comments.length > 400 ? comments.slice(0, 400) + '...' : comments) : node.name}${codeStyle ? '</code>' : ''}](${getTypePathLink(node)})`;
431
+ return `<a href="${getTypePathLink(node)}">${codeStyle ? '<code>' : ''}${(node.comments?.length ?? 0) > 0 ?
432
+ (0, html_hover_over_1.textWithTooltip)(pkg ? `${pkg}::<${realNameWrapper}>${mainName}</${realNameWrapper}>` : mainName, comments.length > 400 ? comments.slice(0, 400) + '...' : comments) : node.name}${codeStyle ? '</code>' : ''}</a>`;
398
433
  }
399
- function getDocumentationForType(name, hierarchy, prefix = '') {
434
+ function shortLinkFile(name, hierarchy) {
400
435
  const res = retrieveNode(name, hierarchy);
436
+ if (!res) {
437
+ console.error(`Could not find node ${name} when resolving short link!`);
438
+ return '';
439
+ }
440
+ const [, , node] = res;
441
+ return `<a href="${getTypePathLink(node)}">${getTypePathForTypeScript(node)}</a>`;
442
+ }
443
+ function getDocumentationForType(name, hierarchy, prefix = '', fuzzy = false) {
444
+ const res = retrieveNode(name, hierarchy, fuzzy);
401
445
  if (!res) {
402
446
  return '';
403
447
  }