@ng-doc/builder 15.0.0-beta.27 → 15.0.0-beta.29

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 (229) hide show
  1. package/engine/.cache/libs/app/components/api-list/api-list.component.js +7 -7
  2. package/engine/.cache/libs/app/components/code/code.component.js +12 -16
  3. package/engine/.cache/libs/app/components/demo/demo.component.js +8 -10
  4. package/engine/.cache/libs/app/components/navbar/navbar.component.js +1 -1
  5. package/engine/.cache/libs/app/components/page/page.module.js +1 -0
  6. package/engine/.cache/libs/app/components/page-map/page-map.component.js +1 -2
  7. package/engine/.cache/libs/app/components/playground/playground.component.js +5 -10
  8. package/engine/.cache/libs/app/components/playground-demo/playground-demo.component.js +8 -9
  9. package/engine/.cache/libs/app/components/playground-properties/playground-properties.component.js +1 -2
  10. package/engine/.cache/libs/app/components/playground-property/playground-property.component.js +9 -10
  11. package/engine/.cache/libs/app/components/root/root.component.js +2 -3
  12. package/engine/.cache/libs/app/components/sidebar/sidebar-category/sidebar-category.component.js +3 -5
  13. package/engine/.cache/libs/app/components/sidebar/sidebar.component.js +1 -2
  14. package/engine/.cache/libs/app/directives/code-highlighter/code-highlighter.directive.js +1 -2
  15. package/engine/.cache/libs/app/helpers/generate-page-map/generate-page-map.js +1 -2
  16. package/engine/.cache/libs/app/modules/root/ng-doc.module.js +3 -3
  17. package/engine/.cache/libs/app/pipes/filter-by-text/filter-by-text.pipe.js +1 -2
  18. package/engine/.cache/libs/app/processors/code-processor/code-processor.directive.js +2 -5
  19. package/engine/.cache/libs/app/processors/html-processor/html-processor.directive.js +1 -2
  20. package/engine/.cache/libs/app/processors/icon-processor/icon-processor.directive.js +2 -3
  21. package/engine/.cache/libs/app/processors/index.js +1 -0
  22. package/engine/.cache/libs/app/processors/playground-processor/playground-processor.directive.js +2 -3
  23. package/engine/.cache/libs/app/processors/tooltip-processor/index.js +6 -0
  24. package/engine/.cache/libs/app/processors/tooltip-processor/tooltip-processor.directive.js +30 -0
  25. package/engine/.cache/libs/app/processors/tooltip-processor/tooltip-processor.module.js +18 -0
  26. package/engine/.cache/libs/app/processors/tooltip-processor/tooltip-wrapper.component.js +30 -0
  27. package/engine/.cache/libs/app/services/theme/theme.service.js +1 -2
  28. package/engine/.cache/libs/builder/engine/actions/demo.action.js +1 -2
  29. package/engine/.cache/libs/builder/engine/actions/playground.action.js +3 -4
  30. package/engine/.cache/libs/builder/engine/actions.js +1 -2
  31. package/engine/.cache/libs/builder/engine/builder.js +2 -2
  32. package/engine/.cache/libs/builder/engine/entities/abstractions/entity.js +2 -3
  33. package/engine/.cache/libs/builder/engine/entities/abstractions/file.entity.js +7 -2
  34. package/engine/.cache/libs/builder/engine/entities/abstractions/module.entity.js +1 -2
  35. package/engine/.cache/libs/builder/engine/entities/abstractions/route.entity.js +1 -2
  36. package/engine/.cache/libs/builder/engine/entities/abstractions/source-file.entity.js +3 -3
  37. package/engine/.cache/libs/builder/engine/entities/api-page.entity.js +4 -4
  38. package/engine/.cache/libs/builder/engine/entities/api-scope.entity.js +1 -2
  39. package/engine/.cache/libs/builder/engine/entities/api.entity.js +9 -16
  40. package/engine/.cache/libs/builder/engine/entities/category.entity.js +6 -12
  41. package/engine/.cache/libs/builder/engine/entities/dependencies.entity.js +20 -9
  42. package/engine/.cache/libs/builder/engine/entities/page.entity.js +13 -20
  43. package/engine/.cache/libs/builder/engine/entities/playground.entity.js +4 -3
  44. package/engine/.cache/libs/builder/engine/entity-store.js +3 -5
  45. package/engine/.cache/libs/builder/engine/functions/build-candidates.js +1 -2
  46. package/engine/.cache/libs/builder/engine/post-processors/html-plugins/keywords-processor.js +19 -16
  47. package/engine/.cache/libs/builder/engine/post-processors/html-post-processor.js +5 -2
  48. package/engine/.cache/libs/builder/engine/renderer.js +10 -7
  49. package/engine/.cache/libs/builder/engine/template-filters.js +16 -1
  50. package/engine/.cache/libs/builder/engine/watcher.js +1 -1
  51. package/engine/.cache/libs/builder/helpers/build-assets.js +2 -0
  52. package/engine/.cache/libs/builder/helpers/build-global-indexes.js +1 -2
  53. package/engine/.cache/libs/builder/helpers/create-builder-context.js +3 -4
  54. package/engine/.cache/libs/builder/helpers/declaration-to-playground.js +6 -4
  55. package/engine/.cache/libs/builder/helpers/extract-path-anchor.js +2 -3
  56. package/engine/.cache/libs/builder/helpers/extract-selectors.js +2 -3
  57. package/engine/.cache/libs/builder/helpers/format-code.js +3 -6
  58. package/engine/.cache/libs/builder/helpers/generate-api-entities.js +1 -2
  59. package/engine/.cache/libs/builder/helpers/index.js +1 -0
  60. package/engine/.cache/libs/builder/helpers/marked.js +1 -1
  61. package/engine/.cache/libs/builder/helpers/no-empty.js +12 -0
  62. package/engine/.cache/libs/builder/helpers/not-empty-assets.js +1 -1
  63. package/engine/.cache/libs/builder/helpers/presentation.js +76 -5
  64. package/engine/.cache/libs/builder/helpers/typescript/class/find-base-class.js +21 -0
  65. package/engine/.cache/libs/builder/helpers/typescript/class/find-class.js +21 -0
  66. package/engine/.cache/libs/builder/helpers/typescript/class/for-all-classes.js +15 -0
  67. package/engine/.cache/libs/builder/helpers/typescript/class/index.js +6 -0
  68. package/engine/.cache/libs/builder/helpers/typescript/create-project.js +17 -2
  69. package/engine/.cache/libs/builder/helpers/typescript/find-declaration.js +3 -4
  70. package/engine/.cache/libs/builder/helpers/typescript/first-node-with-comment.js +13 -0
  71. package/engine/.cache/libs/builder/helpers/typescript/index.js +6 -0
  72. package/engine/.cache/libs/builder/helpers/typescript/interface/find-interface.js +29 -0
  73. package/engine/.cache/libs/builder/helpers/typescript/interface/for-all-interfaces.js +20 -0
  74. package/engine/.cache/libs/builder/helpers/typescript/interface/index.js +5 -0
  75. package/engine/.cache/libs/builder/helpers/typescript/method/get-class-methods.js +22 -0
  76. package/engine/.cache/libs/builder/helpers/typescript/method/get-implemented-method.js +44 -0
  77. package/engine/.cache/libs/builder/helpers/typescript/method/get-interface-methods.js +22 -0
  78. package/engine/.cache/libs/builder/helpers/typescript/method/get-method-chain.js +32 -0
  79. package/engine/.cache/libs/builder/helpers/typescript/method/get-overridden-method.js +26 -0
  80. package/engine/.cache/libs/builder/helpers/typescript/method/index.js +8 -0
  81. package/engine/.cache/libs/builder/helpers/typescript/node/index.js +4 -0
  82. package/engine/.cache/libs/builder/helpers/typescript/node/sort-by-nodes-name.js +11 -0
  83. package/engine/.cache/libs/builder/helpers/typescript/property/get-class-properties.js +22 -0
  84. package/engine/.cache/libs/builder/helpers/typescript/property/get-implemented-property.js +44 -0
  85. package/engine/.cache/libs/builder/helpers/typescript/property/get-interface-properties.js +22 -0
  86. package/engine/.cache/libs/builder/helpers/typescript/property/get-overridden-property.js +26 -0
  87. package/engine/.cache/libs/builder/helpers/typescript/property/get-property-chain.js +33 -0
  88. package/engine/.cache/libs/builder/helpers/typescript/property/index.js +8 -0
  89. package/engine/.cache/libs/builder/resolvers/common/get-property-assignment.js +1 -2
  90. package/engine/.cache/libs/builder/schematics/api/index.js +1 -1
  91. package/engine/.cache/libs/builder/schematics/category/index.js +1 -1
  92. package/engine/.cache/libs/builder/schematics/dependencies/index.js +2 -3
  93. package/engine/.cache/libs/builder/schematics/page/index.js +7 -1
  94. package/engine/.cache/libs/builder/templates-env/code.env.js +2 -0
  95. package/engine/.cache/libs/builder/templates-env/index.js +1 -0
  96. package/engine/.cache/libs/core/helpers/extract-value.js +1 -1
  97. package/engine/.cache/libs/core/helpers/kebab-case.js +4 -3
  98. package/engine/.cache/libs/ui-kit/cdk/combobox-host/combobox-host.component.js +8 -11
  99. package/engine/.cache/libs/ui-kit/components/clear-control/clear-control.component.js +3 -6
  100. package/engine/.cache/libs/ui-kit/components/dropdown/dropdown.component.js +27 -17
  101. package/engine/.cache/libs/ui-kit/components/input-wrapper/input-wrapper.component.js +3 -6
  102. package/engine/.cache/libs/ui-kit/components/list/list.component.js +7 -10
  103. package/engine/.cache/libs/ui-kit/components/option/option.component.js +2 -4
  104. package/engine/.cache/libs/ui-kit/components/overlay-container/overlay-container.component.js +5 -9
  105. package/engine/.cache/libs/ui-kit/components/selection/selection-host.directive.js +1 -2
  106. package/engine/.cache/libs/ui-kit/components/tab-group/tab-group.component.js +1 -2
  107. package/engine/.cache/libs/ui-kit/components/toggle/toggle.component.js +2 -3
  108. package/engine/.cache/libs/ui-kit/directives/media-query/media-query.directive.js +1 -2
  109. package/engine/.cache/libs/ui-kit/directives/tooltip/tooltip.directive.js +14 -7
  110. package/engine/.cache/libs/ui-kit/helpers/merge-overlay-configs.js +5 -3
  111. package/engine/.cache/libs/ui-kit/modules/root/root.module.js +1 -2
  112. package/engine/.cache/libs/ui-kit/services/notify/notify.service.js +2 -2
  113. package/engine/.cache/libs/ui-kit/services/overlay/overlay.service.js +2 -3
  114. package/engine/.cache/libs/ui-kit/services/overlay-strategy/overlay-strategy.js +4 -7
  115. package/engine/.cache/libs/ui-kit/utils/overlay-utils.js +1 -1
  116. package/engine/entities/api-page.entity.d.ts +1 -1
  117. package/engine/entities/dependencies.entity.js +14 -4
  118. package/engine/entities/dependencies.entity.js.map +1 -1
  119. package/engine/post-processors/html-plugins/keywords-processor.js +18 -15
  120. package/engine/post-processors/html-plugins/keywords-processor.js.map +1 -1
  121. package/engine/renderer.d.ts +1 -0
  122. package/engine/renderer.js +4 -1
  123. package/engine/renderer.js.map +1 -1
  124. package/engine/template-filters.d.ts +1 -1
  125. package/engine/template-filters.js +16 -1
  126. package/engine/template-filters.js.map +1 -1
  127. package/helpers/build-assets.js +2 -0
  128. package/helpers/build-assets.js.map +1 -1
  129. package/helpers/format-code.js +3 -6
  130. package/helpers/format-code.js.map +1 -1
  131. package/helpers/index.d.ts +1 -0
  132. package/helpers/index.js +1 -0
  133. package/helpers/index.js.map +1 -1
  134. package/helpers/no-empty.d.ts +5 -0
  135. package/helpers/no-empty.js +13 -0
  136. package/helpers/no-empty.js.map +1 -0
  137. package/helpers/not-empty-assets.js +1 -1
  138. package/helpers/not-empty-assets.js.map +1 -1
  139. package/helpers/presentation.d.ts +11 -1
  140. package/helpers/presentation.js +77 -4
  141. package/helpers/presentation.js.map +1 -1
  142. package/helpers/typescript/class/find-base-class.d.ts +7 -0
  143. package/helpers/typescript/class/find-base-class.js +22 -0
  144. package/helpers/typescript/class/find-base-class.js.map +1 -0
  145. package/helpers/typescript/class/find-class.d.ts +7 -0
  146. package/helpers/typescript/class/find-class.js +22 -0
  147. package/helpers/typescript/class/find-class.js.map +1 -0
  148. package/helpers/typescript/class/for-all-classes.d.ts +7 -0
  149. package/helpers/typescript/class/for-all-classes.js +16 -0
  150. package/helpers/typescript/class/for-all-classes.js.map +1 -0
  151. package/helpers/typescript/class/index.d.ts +3 -0
  152. package/helpers/typescript/class/index.js +7 -0
  153. package/helpers/typescript/class/index.js.map +1 -0
  154. package/helpers/typescript/first-node-with-comment.d.ts +8 -0
  155. package/helpers/typescript/first-node-with-comment.js +15 -0
  156. package/helpers/typescript/first-node-with-comment.js.map +1 -0
  157. package/helpers/typescript/index.d.ts +6 -0
  158. package/helpers/typescript/index.js +6 -0
  159. package/helpers/typescript/index.js.map +1 -1
  160. package/helpers/typescript/interface/find-interface.d.ts +7 -0
  161. package/helpers/typescript/interface/find-interface.js +30 -0
  162. package/helpers/typescript/interface/find-interface.js.map +1 -0
  163. package/helpers/typescript/interface/for-all-interfaces.d.ts +7 -0
  164. package/helpers/typescript/interface/for-all-interfaces.js +21 -0
  165. package/helpers/typescript/interface/for-all-interfaces.js.map +1 -0
  166. package/helpers/typescript/interface/index.d.ts +2 -0
  167. package/helpers/typescript/interface/index.js +6 -0
  168. package/helpers/typescript/interface/index.js.map +1 -0
  169. package/helpers/typescript/method/get-class-methods.d.ts +6 -0
  170. package/helpers/typescript/method/get-class-methods.js +23 -0
  171. package/helpers/typescript/method/get-class-methods.js.map +1 -0
  172. package/helpers/typescript/method/get-implemented-method.d.ts +7 -0
  173. package/helpers/typescript/method/get-implemented-method.js +46 -0
  174. package/helpers/typescript/method/get-implemented-method.js.map +1 -0
  175. package/helpers/typescript/method/get-interface-methods.d.ts +6 -0
  176. package/helpers/typescript/method/get-interface-methods.js +23 -0
  177. package/helpers/typescript/method/get-interface-methods.js.map +1 -0
  178. package/helpers/typescript/method/get-method-chain.d.ts +6 -0
  179. package/helpers/typescript/method/get-method-chain.js +33 -0
  180. package/helpers/typescript/method/get-method-chain.js.map +1 -0
  181. package/helpers/typescript/method/get-overridden-method.d.ts +7 -0
  182. package/helpers/typescript/method/get-overridden-method.js +28 -0
  183. package/helpers/typescript/method/get-overridden-method.js.map +1 -0
  184. package/helpers/typescript/method/index.d.ts +5 -0
  185. package/helpers/typescript/method/index.js +9 -0
  186. package/helpers/typescript/method/index.js.map +1 -0
  187. package/helpers/typescript/node/index.d.ts +1 -0
  188. package/helpers/typescript/node/index.js +5 -0
  189. package/helpers/typescript/node/index.js.map +1 -0
  190. package/helpers/typescript/node/sort-by-nodes-name.d.ts +6 -0
  191. package/helpers/typescript/node/sort-by-nodes-name.js +12 -0
  192. package/helpers/typescript/node/sort-by-nodes-name.js.map +1 -0
  193. package/helpers/typescript/property/get-class-properties.d.ts +6 -0
  194. package/helpers/typescript/property/get-class-properties.js +23 -0
  195. package/helpers/typescript/property/get-class-properties.js.map +1 -0
  196. package/helpers/typescript/property/get-implemented-property.d.ts +7 -0
  197. package/helpers/typescript/property/get-implemented-property.js +46 -0
  198. package/helpers/typescript/property/get-implemented-property.js.map +1 -0
  199. package/helpers/typescript/property/get-interface-properties.d.ts +6 -0
  200. package/helpers/typescript/property/get-interface-properties.js +23 -0
  201. package/helpers/typescript/property/get-interface-properties.js.map +1 -0
  202. package/helpers/typescript/property/get-overridden-property.d.ts +7 -0
  203. package/helpers/typescript/property/get-overridden-property.js +28 -0
  204. package/helpers/typescript/property/get-overridden-property.js.map +1 -0
  205. package/helpers/typescript/property/get-property-chain.d.ts +6 -0
  206. package/helpers/typescript/property/get-property-chain.js +34 -0
  207. package/helpers/typescript/property/get-property-chain.js.map +1 -0
  208. package/helpers/typescript/property/index.d.ts +5 -0
  209. package/helpers/typescript/property/index.js +9 -0
  210. package/helpers/typescript/property/index.js.map +1 -0
  211. package/interfaces/asset.d.ts +1 -0
  212. package/package.json +2 -2
  213. package/templates/api/class.html.nunj +22 -8
  214. package/templates/api/function.html.nunj +1 -1
  215. package/templates/api/interface.html.nunj +4 -4
  216. package/templates/code.html.nunj +3 -0
  217. package/templates/helpers/code.html.nunj +1 -1
  218. package/templates/helpers/constructor.html.nunj +34 -0
  219. package/templates/helpers/declaration-modifiers.html.nunj +5 -8
  220. package/templates/helpers/method.html.nunj +19 -4
  221. package/templates/helpers/methods.html.nunj +2 -2
  222. package/templates/helpers/parameters.html.nunj +2 -1
  223. package/templates/helpers/properties.html.nunj +19 -2
  224. package/templates-env/code.env.d.ts +4 -0
  225. package/templates-env/code.env.js +3 -0
  226. package/templates-env/code.env.js.map +1 -0
  227. package/templates-env/index.d.ts +1 -0
  228. package/templates-env/index.js +1 -0
  229. package/templates-env/index.js.map +1 -1
@@ -14,7 +14,6 @@ const component_decorator_resolver_1 = require("../../resolvers/component-decora
14
14
  */
15
15
  function playgroundAction(playgroundId) {
16
16
  return (project, page) => {
17
- var _a, _b, _c;
18
17
  try {
19
18
  if (!page.playground) {
20
19
  throw new Error(`Can't find the playground file for the page ${page.route}`);
@@ -23,10 +22,10 @@ function playgroundAction(playgroundId) {
23
22
  if (!declaration) {
24
23
  throw new Error(`Playground action didn't find the class declaration for the current target.`);
25
24
  }
26
- const decorator = (_a = declaration.getDecorator('Component')) !== null && _a !== void 0 ? _a : declaration.getDecorator('Directive');
27
- const decoratorArgument = decorator === null || decorator === void 0 ? void 0 : decorator.getArguments()[0];
25
+ const decorator = declaration.getDecorator('Component') ?? declaration.getDecorator('Directive');
26
+ const decoratorArgument = decorator?.getArguments()[0];
28
27
  const selectors = ts_morph_1.Node.isObjectLiteralExpression(decoratorArgument)
29
- ? (_c = (_b = (0, component_decorator_resolver_1.componentDecoratorResolver)(decoratorArgument).selector) === null || _b === void 0 ? void 0 : _b.replace(/[\n\s]/gm, '')) !== null && _c !== void 0 ? _c : ''
28
+ ? (0, component_decorator_resolver_1.componentDecoratorResolver)(decoratorArgument).selector?.replace(/[\n\s]/gm, '') ?? ''
30
29
  : '';
31
30
  const playgroundData = (0, declaration_to_playground_1.declarationToPlayground)(declaration);
32
31
  return {
@@ -15,9 +15,8 @@ class NgDocActions {
15
15
  return output.output;
16
16
  }
17
17
  performAction(action) {
18
- var _a;
19
18
  const output = action(this.page.sourceFile.getProject(), this.page);
20
- this.page.dependencies.add(...((_a = output.dependencies) !== null && _a !== void 0 ? _a : []));
19
+ this.page.dependencies.add(...(output.dependencies ?? []));
21
20
  return output;
22
21
  }
23
22
  }
@@ -62,7 +62,7 @@ class NgDocBuilder {
62
62
  .onChange(...dependencies)
63
63
  .pipe((0, operators_1.tap)(() => entity.dependenciesChanged()))), (0, operators_1.startWith)(null), (0, operators_1.mapTo)(entity), (0, operators_1.takeUntil)((0, rxjs_1.merge)(entity.onDestroy(), this.watcher.onChange(...entity.rootFiles))))))
64
64
  : (0, rxjs_1.of)(null)));
65
- }), (0, operators_2.bufferDebounce)(500), (0, operators_1.map)((entities) => entities.filter(core_1.isPresent)), (0, operators_1.tap)(() => { var _a; return this.entities.updateKeywordMap((_a = this.context.options.ngDoc) === null || _a === void 0 ? void 0 : _a.keywords); }),
65
+ }), (0, operators_2.bufferDebounce)(500), (0, operators_1.map)((entities) => entities.filter(core_1.isPresent)), (0, operators_1.tap)(() => this.entities.updateKeywordMap(this.context.options.ngDoc?.keywords)),
66
66
  // Build touched entities and their dependencies
67
67
  (0, operators_1.concatMap)((entities) => (0, fork_join_or_empty_1.forkJoinOrEmpty)((0, build_candidates_1.buildCandidates)(entities).map((entity) => entity.destroyed ? (0, rxjs_1.of)([]) : entity.buildArtifacts())).pipe((0, operators_1.switchMap)((output) => this.skeleton
68
68
  .buildArtifacts()
@@ -80,7 +80,7 @@ class NgDocBuilder {
80
80
  }
81
81
  get(id, canBeBuilt) {
82
82
  const entity = this.entities.get(id);
83
- return (0, core_1.isPresent)(canBeBuilt) ? ((entity === null || entity === void 0 ? void 0 : entity.canBeBuilt) === canBeBuilt ? entity : undefined) : entity;
83
+ return (0, core_1.isPresent)(canBeBuilt) ? (entity?.canBeBuilt === canBeBuilt ? entity : undefined) : entity;
84
84
  }
85
85
  collectGarbage() {
86
86
  this.entities.asArray().forEach((entity) => {
@@ -43,8 +43,7 @@ class NgDocEntity {
43
43
  * @type {Array<NgDocEntity>}
44
44
  */
45
45
  get parentEntities() {
46
- var _a, _b, _c;
47
- return [(_a = this.parent) !== null && _a !== void 0 ? _a : [], (_c = (_b = this.parent) === null || _b === void 0 ? void 0 : _b.parentEntities) !== null && _c !== void 0 ? _c : []].flat();
46
+ return [this.parent ?? [], this.parent?.parentEntities ?? []].flat();
48
47
  }
49
48
  /**
50
49
  * The children of the entity.
@@ -100,7 +99,7 @@ class NgDocEntity {
100
99
  We are checking that artifacts result was changed, otherwise we don't want to emit
101
100
  the same files to file system, because it will force Angular to rebuild application
102
101
  */
103
- if (artifacts.every((a, i) => { var _a; return a.content === ((_a = this.artifacts[i]) === null || _a === void 0 ? void 0 : _a.content); })) {
102
+ if (artifacts.every((a, i) => a.content === this.artifacts[i]?.content)) {
104
103
  return [];
105
104
  }
106
105
  this.artifacts = artifacts;
@@ -29,8 +29,13 @@ class NgDocFileEntity extends source_file_entity_1.NgDocSourceFileEntity {
29
29
  return (0, rxjs_1.of)(void 0);
30
30
  }
31
31
  getParentFromCategory() {
32
- var _a, _b, _c, _d, _e, _f;
33
- const sourceFilePath = (_f = (_e = (_d = (_c = (_b = (_a = this.getObjectExpressionFromDefault()) === null || _a === void 0 ? void 0 : _a.getProperty('category')) === null || _b === void 0 ? void 0 : _b.getChildrenOfKind(ts_morph_1.SyntaxKind.Identifier)) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.getDefinitions()[0]) === null || _e === void 0 ? void 0 : _e.getSourceFile()) === null || _f === void 0 ? void 0 : _f.getFilePath();
32
+ const sourceFilePath = this.getObjectExpressionFromDefault()
33
+ ?.getProperty('category')
34
+ ?.getChildrenOfKind(ts_morph_1.SyntaxKind.Identifier)
35
+ ?.pop()
36
+ ?.getDefinitions()[0]
37
+ ?.getSourceFile()
38
+ ?.getFilePath();
34
39
  if (sourceFilePath && (0, minimatch_1.default)(sourceFilePath, variables_1.CATEGORY_PATTERN) && sourceFilePath !== this.sourceFilePath) {
35
40
  const parent = this.builder.get(path.relative(this.context.context.workspaceRoot, sourceFilePath));
36
41
  return (0, helpers_1.isCategoryEntity)(parent) ? parent : undefined;
@@ -6,8 +6,7 @@ const helpers_1 = require("../../../helpers");
6
6
  const file_entity_1 = require("./file.entity");
7
7
  class NgDocModuleEntity extends file_entity_1.NgDocFileEntity {
8
8
  get folderPath() {
9
- var _a, _b;
10
- return path.join((_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.folderPath) !== null && _b !== void 0 ? _b : this.context.modulesPath, this.folderName);
9
+ return path.join(this.parent?.folderPath ?? this.context.modulesPath, this.folderName);
11
10
  }
12
11
  /**
13
12
  * Returns paths to the module in generated folder
@@ -14,10 +14,9 @@ class NgDocRouteEntity extends module_entity_1.NgDocModuleEntity {
14
14
  this.usedKeywords = new Set();
15
15
  }
16
16
  get fullRoute() {
17
- var _a, _b;
18
17
  const parentRoute = this.parent instanceof NgDocRouteEntity
19
18
  ? this.parent.fullRoute
20
- : (_b = (_a = this.context.options.ngDoc) === null || _a === void 0 ? void 0 : _a.routePrefix) !== null && _b !== void 0 ? _b : '';
19
+ : this.context.options.ngDoc?.routePrefix ?? '';
21
20
  return (0, helpers_1.slash)(path.join('/', parentRoute, this.route));
22
21
  }
23
22
  }
@@ -62,9 +62,9 @@ class NgDocSourceFileEntity extends entity_1.NgDocEntity {
62
62
  */
63
63
  getObjectExpressionFromDefault() {
64
64
  const defaultExport = this.sourceFile.getDefaultExportSymbol();
65
- const exportAlias = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.getAliasedSymbol();
66
- const valueDeclaration = exportAlias === null || exportAlias === void 0 ? void 0 : exportAlias.getValueDeclarationOrThrow();
67
- return valueDeclaration === null || valueDeclaration === void 0 ? void 0 : valueDeclaration.getFirstChildByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
65
+ const exportAlias = defaultExport?.getAliasedSymbol();
66
+ const valueDeclaration = exportAlias?.getValueDeclarationOrThrow();
67
+ return valueDeclaration?.getFirstChildByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
68
68
  }
69
69
  }
70
70
  exports.NgDocSourceFileEntity = NgDocSourceFileEntity;
@@ -32,9 +32,8 @@ class NgDocApiPageEntity extends route_entity_1.NgDocRouteEntity {
32
32
  return false;
33
33
  }
34
34
  get route() {
35
- var _a, _b, _c;
36
35
  return this.declaration
37
- ? (0, helpers_1.slash)(path.join((0, helpers_1.declarationFolderName)(this.declaration), (_c = (_b = (_a = this.declaration) === null || _a === void 0 ? void 0 : _a.getSymbol()) === null || _b === void 0 ? void 0 : _b.getName()) !== null && _c !== void 0 ? _c : ''))
36
+ ? (0, helpers_1.slash)(path.join((0, helpers_1.declarationFolderName)(this.declaration), this.declaration?.getSymbol()?.getName() ?? ''))
38
37
  : '';
39
38
  }
40
39
  emit() {
@@ -82,8 +81,9 @@ class NgDocApiPageEntity extends route_entity_1.NgDocRouteEntity {
82
81
  scope: this.parent.target,
83
82
  });
84
83
  return renderer.render('./api-page.html.nunj').pipe((0, operators_1.map)((output) => ({ content: output, filePath: this.builtPagePath })), (0, operators_1.catchError)((error) => {
85
- var _a, _b;
86
- this.logger.error(`\nError happened while processing Api Page for entity "${(_b = (_a = this.declaration) === null || _a === void 0 ? void 0 : _a.getSymbol()) === null || _b === void 0 ? void 0 : _b.getName()}":\n${error}"`);
84
+ this.logger.error(`\nError happened while processing Api Page for entity "${this.declaration
85
+ ?.getSymbol()
86
+ ?.getName()}":\n${error}"`);
87
87
  return (0, rxjs_1.of)(null);
88
88
  }));
89
89
  }
@@ -44,8 +44,7 @@ class NgDocApiScopeEntity extends navigation_entity_1.NgDocNavigationEntity {
44
44
  return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
45
45
  }
46
46
  get order() {
47
- var _a;
48
- return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
47
+ return this.target?.order;
49
48
  }
50
49
  get pages() {
51
50
  return (0, core_1.asArray)(this.children.values()).filter(helpers_1.isPageEntity);
@@ -16,8 +16,7 @@ class NgDocApiEntity extends navigation_entity_1.NgDocNavigationEntity {
16
16
  this.moduleFileName = `${(0, helpers_1.uniqueName)('ng-doc-api-list')}.module.ts`;
17
17
  }
18
18
  get route() {
19
- var _a, _b;
20
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.route) !== null && _b !== void 0 ? _b : 'api';
19
+ return this.target?.route ?? 'api';
21
20
  }
22
21
  /**
23
22
  * Returns full url from the root
@@ -28,16 +27,13 @@ class NgDocApiEntity extends navigation_entity_1.NgDocNavigationEntity {
28
27
  return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
29
28
  }
30
29
  get isRoot() {
31
- var _a;
32
- return !((_a = this.target) === null || _a === void 0 ? void 0 : _a.category);
30
+ return !this.target?.category;
33
31
  }
34
32
  get title() {
35
- var _a, _b;
36
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
33
+ return this.target?.title ?? '';
37
34
  }
38
35
  get order() {
39
- var _a;
40
- return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
36
+ return this.target?.order;
41
37
  }
42
38
  get buildCandidates() {
43
39
  return this.parentEntities;
@@ -81,14 +77,11 @@ class NgDocApiEntity extends navigation_entity_1.NgDocNavigationEntity {
81
77
  buildApiList() {
82
78
  const apiItems = this.children.filter(helpers_1.isApiScopeEntity).map((scope) => ({
83
79
  title: scope.title,
84
- items: scope.children.filter(helpers_1.isApiPageEntity).map((page) => {
85
- var _a, _b, _c, _d;
86
- return ({
87
- route: (0, helpers_1.slash)(path.join(scope.route, page.route)),
88
- type: (0, core_1.humanizeDeclarationName)((_b = (_a = page.declaration) === null || _a === void 0 ? void 0 : _a.getKindName()) !== null && _b !== void 0 ? _b : ''),
89
- name: (_d = (_c = page.declaration) === null || _c === void 0 ? void 0 : _c.getName()) !== null && _d !== void 0 ? _d : '',
90
- });
91
- }),
80
+ items: scope.children.filter(helpers_1.isApiPageEntity).map((page) => ({
81
+ route: (0, helpers_1.slash)(path.join(scope.route, page.route)),
82
+ type: (0, core_1.humanizeDeclarationName)(page.declaration?.getKindName() ?? ''),
83
+ name: page.declaration?.getName() ?? '',
84
+ })),
92
85
  }));
93
86
  return (0, rxjs_1.of)({
94
87
  content: JSON.stringify(apiItems, undefined, 2),
@@ -15,9 +15,8 @@ class NgDocCategoryEntity extends navigation_entity_1.NgDocNavigationEntity {
15
15
  this.moduleFileName = `${(0, helpers_1.uniqueName)('ng-doc-category')}.module.ts`;
16
16
  }
17
17
  get route() {
18
- var _a, _b;
19
18
  const folderName = path.basename(path.dirname(this.sourceFile.getFilePath()));
20
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.route) !== null && _b !== void 0 ? _b : folderName;
19
+ return this.target?.route ?? folderName;
21
20
  }
22
21
  /**
23
22
  * Returns full url from the root
@@ -28,12 +27,10 @@ class NgDocCategoryEntity extends navigation_entity_1.NgDocNavigationEntity {
28
27
  return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
29
28
  }
30
29
  get isRoot() {
31
- var _a;
32
- return !((_a = this.target) === null || _a === void 0 ? void 0 : _a.category);
30
+ return !this.target?.category;
33
31
  }
34
32
  get order() {
35
- var _a;
36
- return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
33
+ return this.target?.order;
37
34
  }
38
35
  get pages() {
39
36
  return (0, core_1.asArray)(this.children.values()).filter(helpers_1.isPageEntity);
@@ -45,19 +42,16 @@ class NgDocCategoryEntity extends navigation_entity_1.NgDocNavigationEntity {
45
42
  return [];
46
43
  }
47
44
  get title() {
48
- var _a, _b;
49
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
45
+ return this.target?.title ?? '';
50
46
  }
51
47
  get buildCandidates() {
52
48
  return this.childEntities;
53
49
  }
54
50
  get expandable() {
55
- var _a, _b;
56
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.expandable) !== null && _b !== void 0 ? _b : true;
51
+ return this.target?.expandable ?? true;
57
52
  }
58
53
  get expanded() {
59
- var _a, _b;
60
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.expanded) !== null && _b !== void 0 ? _b : false;
54
+ return this.target?.expanded ?? false;
61
55
  }
62
56
  update() {
63
57
  return super.update().pipe((0, operators_1.tap)(() => {
@@ -21,8 +21,7 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
21
21
  return false;
22
22
  }
23
23
  get folderPath() {
24
- var _a;
25
- return ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.folderPath) || '';
24
+ return this.parent?.folderPath || '';
26
25
  }
27
26
  get buildCandidates() {
28
27
  return (0, core_1.asArray)(this.parent);
@@ -68,7 +67,7 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
68
67
  const classDeclarations = this.getDemoClassDeclarations(objectExpression);
69
68
  this.componentsAssets = classDeclarations
70
69
  .map((classDeclarations) => this.getComponentAssets(classDeclarations))
71
- .reduce((acc, curr) => (Object.assign(Object.assign({}, acc), curr)), {});
70
+ .reduce((acc, curr) => ({ ...acc, ...curr }), {});
72
71
  }
73
72
  }
74
73
  buildComponentAssets() {
@@ -87,7 +86,7 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
87
86
  if (initializer && initializer instanceof ts_morph_1.ObjectLiteralExpression) {
88
87
  return initializer
89
88
  .getProperties()
90
- .map((property) => { var _a; return (_a = property.getType().getSymbol()) === null || _a === void 0 ? void 0 : _a.getValueDeclaration(); })
89
+ .map((property) => property.getType().getSymbol()?.getValueDeclaration())
91
90
  .filter(core_1.isPresent)
92
91
  .filter(ts_morph_1.Node.isClassDeclaration);
93
92
  }
@@ -95,9 +94,9 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
95
94
  return [];
96
95
  }
97
96
  getComponentAssets(classDeclaration) {
98
- var _a;
97
+ const render = new renderer_1.NgDocRenderer(this.builder);
99
98
  const decorator = classDeclaration.getDecorator('Component');
100
- const decoratorArgument = decorator === null || decorator === void 0 ? void 0 : decorator.getArguments()[0];
99
+ const decoratorArgument = decorator?.getArguments()[0];
101
100
  if (ts_morph_1.Node.isObjectLiteralExpression(decoratorArgument)) {
102
101
  const decoratorData = (0, component_decorator_resolver_1.componentDecoratorResolver)(decoratorArgument);
103
102
  const filePath = classDeclaration.getSourceFile().getFilePath();
@@ -112,9 +111,21 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
112
111
  .flat(),
113
112
  ];
114
113
  return {
115
- [(_a = classDeclaration.getName()) !== null && _a !== void 0 ? _a : '']: assets.map((asset) => {
116
- var _a, _b;
117
- return (Object.assign(Object.assign({}, asset), { output: (0, helpers_1.formatCode)(asset.output, asset.type), outputPath: (0, helpers_1.slash)(path.join((_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.assetsFolder) !== null && _b !== void 0 ? _b : this.folderPath, asset.name)) }));
114
+ [classDeclaration.getName() ?? '']: assets.map((asset) => {
115
+ const code = (0, helpers_1.formatCode)(asset.output, asset.type);
116
+ return {
117
+ ...asset,
118
+ code,
119
+ output: render
120
+ .renderSync('./code.html.nunj', {
121
+ overrideContext: {
122
+ code,
123
+ lang: asset.type,
124
+ },
125
+ })
126
+ .trim(),
127
+ outputPath: (0, helpers_1.slash)(path.join(this.parent?.assetsFolder ?? this.folderPath, `${asset.name}.html`)),
128
+ };
118
129
  }),
119
130
  };
120
131
  }
@@ -19,9 +19,8 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
19
19
  this.moduleFileName = `${(0, helpers_1.uniqueName)('ng-doc-page')}.module.ts`;
20
20
  }
21
21
  get route() {
22
- var _a, _b;
23
22
  const folderName = path.basename(path.dirname(this.sourceFile.getFilePath()));
24
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.route) !== null && _b !== void 0 ? _b : folderName;
23
+ return this.target?.route ?? folderName;
25
24
  }
26
25
  /**
27
26
  * Returns full url from the root
@@ -32,31 +31,25 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
32
31
  return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
33
32
  }
34
33
  get isRoot() {
35
- var _a;
36
- return !((_a = this.target) === null || _a === void 0 ? void 0 : _a.category);
34
+ return !this.target?.category;
37
35
  }
38
36
  get title() {
39
- var _a, _b;
40
- return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
37
+ return this.target?.title ?? '';
41
38
  }
42
39
  get canBeBuilt() {
43
- var _a, _b;
44
40
  return (!this.target ||
45
- !((_a = this.context.options.ngDoc) === null || _a === void 0 ? void 0 : _a.tag) ||
41
+ !this.context.options.ngDoc?.tag ||
46
42
  !this.target.onlyForTags ||
47
- (0, core_1.asArray)(this.target.onlyForTags).includes((_b = this.context.options.ngDoc) === null || _b === void 0 ? void 0 : _b.tag));
43
+ (0, core_1.asArray)(this.target.onlyForTags).includes(this.context.options.ngDoc?.tag));
48
44
  }
49
45
  get order() {
50
- var _a;
51
- return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
46
+ return this.target?.order;
52
47
  }
53
48
  get keywords() {
54
- var _a;
55
- return [...(0, core_1.asArray)((_a = this.target) === null || _a === void 0 ? void 0 : _a.keyword)].map((k) => `*${k}`);
49
+ return [...(0, core_1.asArray)(this.target?.keyword)].map((k) => `*${k}`);
56
50
  }
57
51
  get mdPath() {
58
- var _a, _b;
59
- return path.join(this.sourceFileFolder, (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.mdFile) !== null && _b !== void 0 ? _b : '');
52
+ return path.join(this.sourceFileFolder, this.target?.mdFile ?? '');
60
53
  }
61
54
  get builtPagePath() {
62
55
  return (0, helpers_1.slash)(path.relative(this.context.context.workspaceRoot, path.join(this.folderPath, variables_1.RENDERED_PAGE_NAME)));
@@ -88,8 +81,7 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
88
81
  }
89
82
  update() {
90
83
  return super.update().pipe((0, operators_1.tap)(() => {
91
- var _a;
92
- if (!(0, core_1.isPresent)((_a = this.target) === null || _a === void 0 ? void 0 : _a.mdFile) || !fs.existsSync(this.mdPath)) {
84
+ if (!(0, core_1.isPresent)(this.target?.mdFile) || !fs.existsSync(this.mdPath)) {
93
85
  throw new Error(`Failed to load ${this.sourceFile.getFilePath()}. Make sure that you define mdFile property correctly and .md file exists.`);
94
86
  }
95
87
  if (!this.title) {
@@ -117,17 +109,18 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
117
109
  return (0, rxjs_1.of)();
118
110
  }
119
111
  buildPage() {
120
- var _a, _b, _c;
121
112
  this.dependencies.clear();
122
113
  if (this.target) {
123
114
  this.dependencies.add(this.mdPath);
124
115
  this.playgroundFile && this.dependencies.add(this.playgroundFile);
125
- (_b = (_a = this.playground) === null || _a === void 0 ? void 0 : _a.sourceFile) === null || _b === void 0 ? void 0 : _b.getReferencedSourceFiles().forEach((sourceFile) => sourceFile.refreshFromFileSystemSync());
116
+ this.playground?.sourceFile
117
+ ?.getReferencedSourceFiles()
118
+ .forEach((sourceFile) => sourceFile.refreshFromFileSystemSync());
126
119
  const renderer = new renderer_1.NgDocRenderer(this.builder, {
127
120
  NgDocPage: this.target,
128
121
  NgDocActions: new actions_1.NgDocActions(this),
129
122
  }, this.dependencies);
130
- return renderer.render((_c = this.target) === null || _c === void 0 ? void 0 : _c.mdFile, { scope: this.sourceFileFolder }).pipe((0, operators_1.map)((markdown) => (0, helpers_1.marked)(markdown)), (0, operators_1.map)((output) => ({ content: output, filePath: this.builtPagePath })));
123
+ return renderer.render(this.target?.mdFile, { scope: this.sourceFileFolder }).pipe((0, operators_1.map)((markdown) => (0, helpers_1.marked)(markdown)), (0, operators_1.map)((output) => ({ content: output, filePath: this.builtPagePath })));
131
124
  }
132
125
  return (0, rxjs_1.of)();
133
126
  }
@@ -35,7 +35,6 @@ class NgDocPlaygroundEntity extends file_entity_1.NgDocFileEntity {
35
35
  }), (0, operators_1.mapTo)(void 0));
36
36
  }
37
37
  getTargetForPlayground(playgroundId) {
38
- var _a, _b;
39
38
  const expression = this.getObjectExpressionFromDefault();
40
39
  if (!expression) {
41
40
  throw new Error(`Failed to load ${this.sourceFile.getFilePath()}. Make sure that you have exported it as default.`);
@@ -48,8 +47,10 @@ class NgDocPlaygroundEntity extends file_entity_1.NgDocFileEntity {
48
47
  if (ts_morph_1.Node.isPropertyAssignment(target)) {
49
48
  const targetInitializer = target.getInitializer();
50
49
  if (ts_morph_1.Node.isIdentifier(targetInitializer)) {
51
- const declaration = (_b = (_a = targetInitializer
52
- .getType()) === null || _a === void 0 ? void 0 : _a.getSymbol()) === null || _b === void 0 ? void 0 : _b.getDeclarations()[0];
50
+ const declaration = targetInitializer
51
+ .getType()
52
+ ?.getSymbol()
53
+ ?.getDeclarations()[0];
53
54
  if (ts_morph_1.Node.isClassDeclaration(declaration)) {
54
55
  return declaration;
55
56
  }
@@ -12,9 +12,8 @@ class NgDocEntityStore extends Map {
12
12
  return (0, core_1.asArray)(this.values());
13
13
  }
14
14
  set(key, value) {
15
- var _a;
16
15
  if (this.get(key) !== value) {
17
- (_a = this.get(key)) === null || _a === void 0 ? void 0 : _a.destroy();
16
+ this.get(key)?.destroy();
18
17
  }
19
18
  return super.set(key, value);
20
19
  }
@@ -29,13 +28,12 @@ class NgDocEntityStore extends Map {
29
28
  }
30
29
  updateKeywordMap(globalKeywords) {
31
30
  this.keywordMap = new Map();
32
- (0, core_1.objectKeys)(globalKeywords !== null && globalKeywords !== void 0 ? globalKeywords : {}).forEach((key) => {
33
- var _a;
31
+ (0, core_1.objectKeys)(globalKeywords ?? {}).forEach((key) => {
34
32
  if (globalKeywords) {
35
33
  const globalKeyword = globalKeywords[key];
36
34
  if (globalKeyword) {
37
35
  this.addKeyword(key, {
38
- title: (_a = globalKeyword.title) !== null && _a !== void 0 ? _a : key,
36
+ title: globalKeyword.title ?? key,
39
37
  path: globalKeyword.path,
40
38
  isCodeLink: !!globalKeyword.isCodeLink,
41
39
  });
@@ -11,8 +11,7 @@ const helpers_1 = require("../../helpers");
11
11
  * @returns List of entities that should be rebuilt (including source entities)
12
12
  */
13
13
  function buildCandidates(entities) {
14
- var _a;
15
- const entitiesFromStore = (0, core_1.asArray)((_a = entities[0]) === null || _a === void 0 ? void 0 : _a.builder.entities.asArray());
14
+ const entitiesFromStore = (0, core_1.asArray)(entities[0]?.builder.entities.asArray());
16
15
  const candidates = (0, core_1.asArray)(new Set(entities.map((buildable) => [buildable, ...buildable.buildCandidates]).flat()));
17
16
  const candidatesKeywords = (0, core_1.asArray)(new Set(candidates
18
17
  .filter(helpers_1.isRouteEntity)
@@ -4,6 +4,7 @@ const helpers_1 = require("../../../helpers");
4
4
  const visit = require('unist-util-visit-parents');
5
5
  const is = require('hast-util-is-element');
6
6
  const textContent = require('hast-util-to-string');
7
+ const languages = ['typescript'];
7
8
  /**
8
9
  *
9
10
  * @param entityStore
@@ -19,21 +20,23 @@ function keywordsProcessor(entityStore, entity) {
19
20
  }
20
21
  const parent = ancestors[ancestors.length - 1];
21
22
  const isInlineCode = !is(parent, 'pre');
22
- visit(node, 'text', (node, ancestors) => {
23
- if (hasLinkAncestor(ancestors)) {
24
- return;
25
- }
26
- const parent = ancestors[ancestors.length - 1];
27
- const index = parent.children.indexOf(node);
28
- // Parse the text for words that we can convert to links
29
- const nodes = getNodes(node, parent, entityStore, isInlineCode, entity);
30
- // Replace the text node with the links and leftover text nodes
31
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
32
- // @ts-ignore
33
- Array.prototype.splice.apply(parent.children, [index, 1].concat(nodes));
34
- // Do not visit this node's children or the newly added nodes
35
- return [visit.SKIP, index + nodes.length];
36
- });
23
+ if (isInlineCode || languages.includes(node.properties.lang)) {
24
+ visit(node, 'text', (node, ancestors) => {
25
+ if (hasLinkAncestor(ancestors)) {
26
+ return;
27
+ }
28
+ const parent = ancestors[ancestors.length - 1];
29
+ const index = parent.children.indexOf(node);
30
+ // Parse the text for words that we can convert to links
31
+ const nodes = getNodes(node, parent, entityStore, isInlineCode, entity);
32
+ // Replace the text node with the links and leftover text nodes
33
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34
+ // @ts-ignore
35
+ Array.prototype.splice.apply(parent.children, [index, 1].concat(nodes));
36
+ // Do not visit this node's children or the newly added nodes
37
+ return [visit.SKIP, index + nodes.length];
38
+ });
39
+ }
37
40
  });
38
41
  }
39
42
  exports.default = keywordsProcessor;
@@ -73,7 +76,7 @@ function getNodes(node, parent, entityStore, inlineLink, e) {
73
76
  (0, helpers_1.printWarning)(`Keyword "${word}" is missing.`);
74
77
  }
75
78
  // Convert code tag to link if it's a link to the page entity
76
- if (inlineLink && (keyword === null || keyword === void 0 ? void 0 : keyword.isCodeLink) === false) {
79
+ if (inlineLink && keyword?.isCodeLink === false) {
77
80
  parent.tagName = 'a';
78
81
  parent.properties = { href: keyword.path };
79
82
  return { type: 'text', value: keyword.title };
@@ -11,13 +11,16 @@ const keywords_processor_1 = require("./html-plugins/keywords-processor");
11
11
  * @param content
12
12
  */
13
13
  function htmlPostProcessor(entity, content) {
14
- return Object.assign(Object.assign({}, content), { content: require('rehype')()
14
+ return {
15
+ ...content,
16
+ content: require('rehype')()
15
17
  .use(require('rehype-format'))
16
18
  .use(require('rehype-highlight'))
17
19
  .use(require('rehype-slug'))
18
20
  .use(autolink_headings_1.default, (0, helpers_1.isRouteEntity)(entity) ? entity.fullRoute : undefined)
19
21
  .use(keywords_processor_1.default, entity.builder.entities, (0, helpers_1.isRouteEntity)(entity) ? entity : undefined)
20
22
  .processSync(content.content)
21
- .toString() });
23
+ .toString()
24
+ };
22
25
  }
23
26
  exports.htmlPostProcessor = htmlPostProcessor;
@@ -15,9 +15,8 @@ class NgDocRelativeLoader {
15
15
  this.dependenciesStore = dependenciesStore;
16
16
  }
17
17
  getSource(name) {
18
- var _a;
19
18
  const fullPath = path.join(this.path, name);
20
- (_a = this.dependenciesStore) === null || _a === void 0 ? void 0 : _a.add(fullPath);
19
+ this.dependenciesStore?.add(fullPath);
21
20
  return {
22
21
  src: fs.readFileSync(fullPath, 'utf-8'),
23
22
  path: fullPath,
@@ -33,23 +32,27 @@ class NgDocRenderer {
33
32
  }
34
33
  render(template, options) {
35
34
  return new rxjs_1.Observable((observer) => {
36
- this.getEnvironment(options).render(template, this.getContext(options === null || options === void 0 ? void 0 : options.overrideContext), (err, data) => {
35
+ this.getEnvironment(options).render(template, this.getContext(options?.overrideContext), (err, data) => {
37
36
  if (err) {
38
37
  observer.error(err);
39
38
  }
40
39
  else {
41
- observer.next(data !== null && data !== void 0 ? data : '');
40
+ observer.next(data ?? '');
42
41
  observer.complete();
43
42
  }
44
43
  });
45
44
  });
46
45
  }
46
+ renderSync(template, options) {
47
+ return this.getEnvironment(options).render(template, this.getContext(options?.overrideContext));
48
+ }
47
49
  getContext(context) {
48
- return Object.assign({}, (context !== null && context !== void 0 ? context : this.context));
50
+ return {
51
+ ...(context ?? this.context),
52
+ };
49
53
  }
50
54
  getEnvironment(options) {
51
- var _a;
52
- let environment = new nunjucks_1.Environment(new NgDocRelativeLoader((_a = options === null || options === void 0 ? void 0 : options.scope) !== null && _a !== void 0 ? _a : variables_1.TEMPLATES_PATH, this.dependenciesStore), { autoescape: false });
55
+ let environment = new nunjucks_1.Environment(new NgDocRelativeLoader(options?.scope ?? variables_1.TEMPLATES_PATH, this.dependenciesStore), { autoescape: false });
53
56
  (0, core_1.objectKeys)(filters).forEach((filter) => (environment = environment.addFilter(filter, filters[filter])));
54
57
  environment.addGlobal('Node', ts_morph_1.Node);
55
58
  environment.addGlobal('NgDocBuilder', this.builder);