@ng-doc/builder 16.9.0 → 16.11.0

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 (263) hide show
  1. package/browser/index.js +2 -1
  2. package/browser/index.js.map +1 -1
  3. package/browser/schema.json +7 -1
  4. package/classes/observable-set.d.ts +1 -0
  5. package/classes/observable-set.js +4 -0
  6. package/classes/observable-set.js.map +1 -1
  7. package/dev-server/index.js +2 -1
  8. package/dev-server/index.js.map +1 -1
  9. package/dev-server/schema.json +7 -1
  10. package/engine/.cache/apps/ng-doc/docs/ng-doc.api.js +3 -8
  11. package/engine/.cache/apps/ng-doc/docs/recipes/ignoring-file-lines/ng-doc.page.js +41 -0
  12. package/engine/.cache/apps/ng-doc/docs/recipes/ng-doc.category.js +30 -0
  13. package/engine/actions/playground.action.js +2 -2
  14. package/engine/actions/playground.action.js.map +1 -1
  15. package/engine/build-ng-doc.js +10 -2
  16. package/engine/build-ng-doc.js.map +1 -1
  17. package/engine/builder-operators/build.d.ts +2 -3
  18. package/engine/builder-operators/build.js +8 -4
  19. package/engine/builder-operators/build.js.map +1 -1
  20. package/engine/builder-operators/compile.d.ts +1 -1
  21. package/engine/builder-operators/compile.js.map +1 -1
  22. package/engine/builder-operators/emit.d.ts +2 -2
  23. package/engine/builder-operators/emit.js.map +1 -1
  24. package/engine/builder-operators/post-build.d.ts +6 -0
  25. package/engine/builder-operators/post-build.js +23 -0
  26. package/engine/builder-operators/post-build.js.map +1 -0
  27. package/engine/builder-operators/post-process.d.ts +2 -2
  28. package/engine/builder-operators/post-process.js +4 -5
  29. package/engine/builder-operators/post-process.js.map +1 -1
  30. package/engine/builder-operators/task.d.ts +1 -1
  31. package/engine/builder-operators/task.js.map +1 -1
  32. package/engine/builder-operators/to-builder-output.d.ts +6 -0
  33. package/engine/builder-operators/to-builder-output.js +13 -0
  34. package/engine/builder-operators/to-builder-output.js.map +1 -0
  35. package/engine/entities/abstractions/entity.d.ts +11 -11
  36. package/engine/entities/abstractions/entity.js +2 -5
  37. package/engine/entities/abstractions/entity.js.map +1 -1
  38. package/engine/entities/abstractions/file.entity.d.ts +2 -2
  39. package/engine/entities/abstractions/file.entity.js.map +1 -1
  40. package/engine/entities/abstractions/module.entity.d.ts +1 -1
  41. package/engine/entities/abstractions/module.entity.js.map +1 -1
  42. package/engine/entities/abstractions/navigation.entity.d.ts +1 -1
  43. package/engine/entities/abstractions/navigation.entity.js.map +1 -1
  44. package/engine/entities/abstractions/route.entity.d.ts +3 -4
  45. package/engine/entities/abstractions/route.entity.js +2 -2
  46. package/engine/entities/abstractions/route.entity.js.map +1 -1
  47. package/engine/entities/api-list.entity.d.ts +20 -0
  48. package/engine/entities/api-list.entity.js +69 -0
  49. package/engine/entities/api-list.entity.js.map +1 -0
  50. package/engine/entities/api-page.entity.d.ts +2 -3
  51. package/engine/entities/api-page.entity.js +26 -28
  52. package/engine/entities/api-page.entity.js.map +1 -1
  53. package/engine/entities/api-scope.entity.d.ts +2 -3
  54. package/engine/entities/api-scope.entity.js +13 -7
  55. package/engine/entities/api-scope.entity.js.map +1 -1
  56. package/engine/entities/api.entity.d.ts +3 -4
  57. package/engine/entities/api.entity.js +26 -29
  58. package/engine/entities/api.entity.js.map +1 -1
  59. package/engine/entities/category.entity.d.ts +2 -3
  60. package/engine/entities/category.entity.js +11 -13
  61. package/engine/entities/category.entity.js.map +1 -1
  62. package/engine/entities/context.entity.d.ts +11 -0
  63. package/engine/entities/context.entity.js +34 -0
  64. package/engine/entities/context.entity.js.map +1 -0
  65. package/engine/entities/generated-module.entity.d.ts +12 -0
  66. package/engine/entities/generated-module.entity.js +52 -0
  67. package/engine/entities/generated-module.entity.js.map +1 -0
  68. package/engine/entities/index-file.entity.d.ts +12 -0
  69. package/engine/entities/index-file.entity.js +52 -0
  70. package/engine/entities/index-file.entity.js.map +1 -0
  71. package/engine/entities/index.d.ts +8 -1
  72. package/engine/entities/index.js +8 -1
  73. package/engine/entities/index.js.map +1 -1
  74. package/engine/entities/indexes.entity.d.ts +3 -4
  75. package/engine/entities/indexes.entity.js +12 -14
  76. package/engine/entities/indexes.entity.js.map +1 -1
  77. package/engine/entities/keywords.entity.d.ts +12 -0
  78. package/engine/entities/keywords.entity.js +32 -0
  79. package/engine/entities/keywords.entity.js.map +1 -0
  80. package/engine/entities/page-demo.entity.d.ts +20 -0
  81. package/engine/entities/page-demo.entity.js +87 -0
  82. package/engine/entities/page-demo.entity.js.map +1 -0
  83. package/engine/entities/page-playground.entity.d.ts +21 -0
  84. package/engine/entities/page-playground.entity.js +80 -0
  85. package/engine/entities/page-playground.entity.js.map +1 -0
  86. package/engine/entities/page.entity.d.ts +6 -18
  87. package/engine/entities/page.entity.js +39 -107
  88. package/engine/entities/page.entity.js.map +1 -1
  89. package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.d.ts +5 -0
  90. package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.js +20 -0
  91. package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.js.map +1 -0
  92. package/engine/entities/plugins/entity-plugins/apply.plugin.d.ts +26 -0
  93. package/engine/entities/plugins/entity-plugins/apply.plugin.js +65 -0
  94. package/engine/entities/plugins/entity-plugins/apply.plugin.js.map +1 -0
  95. package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.d.ts +6 -0
  96. package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.js +23 -0
  97. package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.js.map +1 -0
  98. package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.d.ts +6 -0
  99. package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.js +27 -0
  100. package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.js.map +1 -0
  101. package/engine/entities/plugins/entity-plugins/index.d.ts +9 -0
  102. package/engine/entities/plugins/entity-plugins/index.js +13 -0
  103. package/engine/entities/plugins/entity-plugins/index.js.map +1 -0
  104. package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.d.ts +5 -0
  105. package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.js +21 -0
  106. package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.js.map +1 -0
  107. package/engine/entities/plugins/entity-plugins/post-process-html.plugin.d.ts +5 -0
  108. package/engine/entities/plugins/entity-plugins/post-process-html.plugin.js +18 -0
  109. package/engine/entities/plugins/entity-plugins/post-process-html.plugin.js.map +1 -0
  110. package/engine/entities/plugins/entity-plugins/process-html.plugin.d.ts +5 -0
  111. package/engine/entities/plugins/entity-plugins/process-html.plugin.js +18 -0
  112. package/engine/entities/plugins/entity-plugins/process-html.plugin.js.map +1 -0
  113. package/engine/entities/plugins/entity-plugins/remove-lines.plugin.d.ts +6 -0
  114. package/engine/entities/plugins/entity-plugins/remove-lines.plugin.js +23 -0
  115. package/engine/entities/plugins/entity-plugins/remove-lines.plugin.js.map +1 -0
  116. package/engine/entities/plugins/entity-plugins/wrap-code.plugin.d.ts +6 -0
  117. package/engine/entities/plugins/entity-plugins/wrap-code.plugin.js +21 -0
  118. package/engine/entities/plugins/entity-plugins/wrap-code.plugin.js.map +1 -0
  119. package/engine/entities/plugins/helpers/execute-plugins.d.ts +10 -0
  120. package/engine/entities/plugins/helpers/execute-plugins.js +18 -0
  121. package/engine/entities/plugins/helpers/execute-plugins.js.map +1 -0
  122. package/engine/entities/plugins/helpers/index.d.ts +1 -0
  123. package/engine/entities/plugins/helpers/index.js +5 -0
  124. package/engine/entities/plugins/helpers/index.js.map +1 -0
  125. package/engine/entities/plugins/index.d.ts +3 -0
  126. package/engine/entities/plugins/index.js +7 -0
  127. package/engine/entities/plugins/index.js.map +1 -0
  128. package/engine/entities/plugins/types/entity-plugin.d.ts +5 -0
  129. package/engine/entities/plugins/types/entity-plugin.js +3 -0
  130. package/engine/entities/plugins/types/entity-plugin.js.map +1 -0
  131. package/engine/entities/plugins/types/index.d.ts +1 -0
  132. package/engine/entities/plugins/types/index.js +5 -0
  133. package/engine/entities/plugins/types/index.js.map +1 -0
  134. package/engine/entities/routes.entity.d.ts +11 -0
  135. package/engine/entities/routes.entity.js +34 -0
  136. package/engine/entities/routes.entity.js.map +1 -0
  137. package/engine/entity-store.d.ts +1 -0
  138. package/engine/entity-store.js +3 -0
  139. package/engine/entity-store.js.map +1 -1
  140. package/engine/nunjucks/filters.d.ts +2 -2
  141. package/engine/nunjucks/filters.js +3 -2
  142. package/engine/nunjucks/filters.js.map +1 -1
  143. package/engine/variables.d.ts +1 -0
  144. package/engine/variables.js +1 -0
  145. package/engine/variables.js.map +1 -1
  146. package/helpers/angular/get-component-assets.d.ts +8 -0
  147. package/helpers/angular/get-component-assets.js +15 -0
  148. package/helpers/angular/get-component-assets.js.map +1 -0
  149. package/helpers/angular/get-component-source-files.d.ts +7 -0
  150. package/helpers/angular/get-component-source-files.js +23 -0
  151. package/helpers/angular/get-component-source-files.js.map +1 -0
  152. package/helpers/angular/index.d.ts +2 -0
  153. package/helpers/angular/index.js +2 -0
  154. package/helpers/angular/index.js.map +1 -1
  155. package/helpers/build-file-assets.d.ts +7 -0
  156. package/helpers/build-file-assets.js +25 -0
  157. package/helpers/build-file-assets.js.map +1 -0
  158. package/helpers/build-file-entity.js +14 -1
  159. package/helpers/build-file-entity.js.map +1 -1
  160. package/helpers/create-builder-context.d.ts +5 -5
  161. package/helpers/create-builder-context.js +6 -6
  162. package/helpers/create-builder-context.js.map +1 -1
  163. package/helpers/demo/assets-from-component-asset.d.ts +6 -0
  164. package/helpers/demo/assets-from-component-asset.js +14 -0
  165. package/helpers/demo/assets-from-component-asset.js.map +1 -0
  166. package/helpers/demo/index.d.ts +1 -0
  167. package/helpers/demo/index.js +5 -0
  168. package/helpers/demo/index.js.map +1 -0
  169. package/helpers/emit-built-output.d.ts +2 -2
  170. package/helpers/emit-built-output.js.map +1 -1
  171. package/helpers/entity-type.d.ts +1 -1
  172. package/helpers/extract-docs.js +4 -4
  173. package/helpers/extract-docs.js.map +1 -1
  174. package/helpers/format-code.d.ts +1 -1
  175. package/helpers/format-code.js +14 -3
  176. package/helpers/format-code.js.map +1 -1
  177. package/helpers/get-code-type-from-lang.d.ts +6 -0
  178. package/helpers/get-code-type-from-lang.js +31 -0
  179. package/helpers/get-code-type-from-lang.js.map +1 -0
  180. package/helpers/get-demo-class-declarations.d.ts +1 -1
  181. package/helpers/get-demo-class-declarations.js +18 -7
  182. package/helpers/get-demo-class-declarations.js.map +1 -1
  183. package/helpers/index.d.ts +7 -3
  184. package/helpers/index.js +7 -3
  185. package/helpers/index.js.map +1 -1
  186. package/helpers/load-config.d.ts +3 -2
  187. package/helpers/load-config.js +4 -3
  188. package/helpers/load-config.js.map +1 -1
  189. package/helpers/markdown-to-html.d.ts +10 -0
  190. package/helpers/{marked.js → markdown-to-html.js} +11 -8
  191. package/helpers/markdown-to-html.js.map +1 -0
  192. package/helpers/process-html.d.ts +3 -3
  193. package/helpers/process-html.js +14 -11
  194. package/helpers/process-html.js.map +1 -1
  195. package/helpers/process-legacy-snippets.d.ts +9 -0
  196. package/helpers/process-legacy-snippets.js +70 -0
  197. package/helpers/process-legacy-snippets.js.map +1 -0
  198. package/helpers/process-snippets.d.ts +5 -5
  199. package/helpers/process-snippets.js +63 -50
  200. package/helpers/process-snippets.js.map +1 -1
  201. package/helpers/remove-lines-from-code.d.ts +6 -0
  202. package/helpers/remove-lines-from-code.js +30 -0
  203. package/helpers/remove-lines-from-code.js.map +1 -0
  204. package/helpers/snippets-from-asset.d.ts +9 -0
  205. package/helpers/snippets-from-asset.js +26 -0
  206. package/helpers/snippets-from-asset.js.map +1 -0
  207. package/interfaces/asset.d.ts +5 -7
  208. package/interfaces/build-result.d.ts +10 -0
  209. package/{types/snippet-type.js → interfaces/build-result.js} +1 -1
  210. package/interfaces/build-result.js.map +1 -0
  211. package/interfaces/index.d.ts +3 -0
  212. package/interfaces/index.js +3 -0
  213. package/interfaces/index.js.map +1 -1
  214. package/interfaces/output.d.ts +1 -3
  215. package/interfaces/schema.d.ts +3 -0
  216. package/interfaces/snippet-config.d.ts +8 -0
  217. package/interfaces/snippet-config.js +3 -0
  218. package/interfaces/snippet-config.js.map +1 -0
  219. package/interfaces/snippet.d.ts +5 -4
  220. package/operators/error-handler.d.ts +1 -1
  221. package/package.json +6 -5
  222. package/parsers/helpers/index.d.ts +3 -0
  223. package/parsers/helpers/index.js +7 -0
  224. package/parsers/helpers/index.js.map +1 -0
  225. package/parsers/helpers/number.d.ts +2 -0
  226. package/parsers/helpers/number.js +7 -0
  227. package/parsers/helpers/number.js.map +1 -0
  228. package/parsers/helpers/param-value.d.ts +2 -0
  229. package/parsers/helpers/param-value.js +8 -0
  230. package/parsers/helpers/param-value.js.map +1 -0
  231. package/parsers/helpers/param.d.ts +7 -0
  232. package/parsers/helpers/param.js +19 -0
  233. package/parsers/helpers/param.js.map +1 -0
  234. package/parsers/parse-code-block-params.js +8 -13
  235. package/parsers/parse-code-block-params.js.map +1 -1
  236. package/parsers/parse-snippet.d.ts +6 -0
  237. package/parsers/parse-snippet.js +27 -0
  238. package/parsers/parse-snippet.js.map +1 -0
  239. package/schematics/category/files/ng-doc.category.ts.template +1 -1
  240. package/schematics/category/index.js +2 -1
  241. package/schematics/category/index.js.map +1 -1
  242. package/schematics/page/index.js +2 -1
  243. package/schematics/page/index.js.map +1 -1
  244. package/templates/demo-assets.ts.nunj +13 -4
  245. package/templates/page.module.ts.nunj +3 -2
  246. package/templates/parts/usage-notes.html.nunj +1 -1
  247. package/templates/playgrounds.ts.nunj +19 -9
  248. package/types/index.d.ts +0 -1
  249. package/types/index.js +0 -1
  250. package/types/index.js.map +1 -1
  251. package/engine/entities/skeleton.entity.d.ts +0 -16
  252. package/engine/entities/skeleton.entity.js +0 -44
  253. package/engine/entities/skeleton.entity.js.map +0 -1
  254. package/helpers/build-assets.d.ts +0 -10
  255. package/helpers/build-assets.js +0 -55
  256. package/helpers/build-assets.js.map +0 -1
  257. package/helpers/get-component-asset.d.ts +0 -10
  258. package/helpers/get-component-asset.js +0 -50
  259. package/helpers/get-component-asset.js.map +0 -1
  260. package/helpers/marked.d.ts +0 -9
  261. package/helpers/marked.js.map +0 -1
  262. package/types/snippet-type.d.ts +0 -1
  263. package/types/snippet-type.js.map +0 -1
@@ -4,7 +4,7 @@ exports.extractParameterDocs = exports.extractSeeDocs = exports.extractDocs = vo
4
4
  const tsdoc_1 = require("@microsoft/tsdoc");
5
5
  const core_1 = require("@ng-doc/core");
6
6
  const ts_doc_formatter_1 = require("../engine/ts-doc-formatter");
7
- const marked_1 = require("./marked");
7
+ const markdown_to_html_1 = require("./markdown-to-html");
8
8
  /**
9
9
  *
10
10
  * @param node
@@ -23,7 +23,7 @@ function extractDocs(node, customTag) {
23
23
  : ts_doc_formatter_1.TsDocFormatter.renderDocNode(context.docComment.summarySection);
24
24
  })
25
25
  .join('');
26
- return (0, marked_1.marked)(docs).trim();
26
+ return (0, markdown_to_html_1.markdownToHtml)(docs).trim();
27
27
  }
28
28
  exports.extractDocs = extractDocs;
29
29
  /**
@@ -38,7 +38,7 @@ function extractSeeDocs(node) {
38
38
  const context = parser.parseString(jsDoc.getText());
39
39
  return context.docComment.seeBlocks
40
40
  .map((seeBlock) => ts_doc_formatter_1.TsDocFormatter.renderDocNode(seeBlock))
41
- .map((block) => (0, marked_1.marked)(block));
41
+ .map((block) => (0, markdown_to_html_1.markdownToHtml)(block));
42
42
  })
43
43
  .flat();
44
44
  }
@@ -58,7 +58,7 @@ function extractParameterDocs(node, paramName) {
58
58
  return paramBlock ? ts_doc_formatter_1.TsDocFormatter.renderDocNode(paramBlock.content) : '';
59
59
  })
60
60
  .join('');
61
- return (0, marked_1.marked)(docs).trim();
61
+ return (0, markdown_to_html_1.markdownToHtml)(docs).trim();
62
62
  }
63
63
  exports.extractParameterDocs = extractParameterDocs;
64
64
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"extract-docs.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/extract-docs.ts"],"names":[],"mappings":";;;AAAA,4CAO0B;AAE1B,uCAAqC;AAGrC,iEAA0D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CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AAbD,oDAaC;AAED;;GAEG;AACH,SAAS,qBAAqB;IAC7B,MAAM,UAAU,GAAyB;QACxC,IAAI,0BAAkB,CAAC,EAAC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,0BAAkB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAC,CAAC;KAC/G,CAAC;IAEF,MAAM,aAAa,GAAuB,IAAI,0BAAkB,EAAE,CAAC;IAEnE,UAAU,CAAC,OAAO,CAAC,CAAC,GAAuB,EAAE,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IAErF,OAAO,aAAa,CAAC;AACtB,CAAC"}
@@ -6,4 +6,4 @@ import { NgDocCodeType } from '@ng-doc/core';
6
6
  * @param {NgDocCodeType} codeType Type of code
7
7
  * @returns {string} Formatted code
8
8
  */
9
- export declare function formatCode(code: string, codeType?: NgDocCodeType): string;
9
+ export declare function formatCode(code: string, codeType?: NgDocCodeType | null): string;
@@ -10,8 +10,14 @@ exports.formatCode = void 0;
10
10
  */
11
11
  function formatCode(code, codeType = 'TypeScript') {
12
12
  try {
13
- const parser = getPrettierParserFromCodeType(codeType);
14
- return require('prettier').format(code, { parser }).trim();
13
+ if (codeType) {
14
+ const parser = getPrettierParserFromCodeType(codeType);
15
+ const config = require('prettier').resolveConfig.sync(process.cwd());
16
+ return require('prettier')
17
+ .format(code, Object.assign(Object.assign({}, config), { parser, embeddedLanguageFormatting: 'auto' }))
18
+ .trim();
19
+ }
20
+ return code.trim();
15
21
  }
16
22
  catch (e) {
17
23
  return code;
@@ -31,8 +37,13 @@ function getPrettierParserFromCodeType(codeType) {
31
37
  case 'SCSS':
32
38
  case 'SASS':
33
39
  return 'css';
40
+ case 'HTML':
41
+ return 'html';
42
+ case 'TypeScript':
43
+ case 'JavaScript':
44
+ return 'typescript';
34
45
  default:
35
- return codeType.toLowerCase();
46
+ return undefined;
36
47
  }
37
48
  }
38
49
  //# sourceMappingURL=format-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-code.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/format-code.ts"],"names":[],"mappings":";;;AAGA;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,WAA0B,YAAY;IAC9E,IAAI;QACH,MAAM,MAAM,GAAkC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;QAEtF,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;KACzD;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,IAAI,CAAC;KACZ;AACF,CAAC;AARD,gCAQC;AAED;;;;;GAKG;AACH,SAAS,6BAA6B,CAAC,QAAuB;IAC7D,QAAQ,QAAQ,EAAE;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACV,OAAO,KAAK,CAAC;QACd;YACC,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;KAC/B;AACF,CAAC"}
1
+ {"version":3,"file":"format-code.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/format-code.ts"],"names":[],"mappings":";;;AAGA;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,WAAiC,YAAY;IACrF,IAAI;QACH,IAAI,QAAQ,EAAE;YACb,MAAM,MAAM,GAAkC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;YACtF,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAErE,OAAO,OAAO,CAAC,UAAU,CAAC;iBACvB,MAAM,CAAC,IAAI,kCAAM,MAAM,KAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,IAAE;iBACrE,IAAI,EAAE,CAAA;SACT;QAED,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;KACnB;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,IAAI,CAAC;KACZ;AACF,CAAC;AAfD,gCAeC;AAED;;;;;GAKG;AACH,SAAS,6BAA6B,CAAC,QAAuB;IAC7D,QAAQ,QAAQ,EAAE;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACV,OAAO,KAAK,CAAC;QACd,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,YAAY;YAChB,OAAO,YAAY,CAAC;QACrB;YACC,OAAO,SAAS,CAAC;KAClB;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { NgDocCodeType } from '@ng-doc/core';
2
+ /**
3
+ *
4
+ * @param lang
5
+ */
6
+ export declare function getCodeTypeFromLang(lang: string): NgDocCodeType | null;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCodeTypeFromLang = void 0;
4
+ /**
5
+ *
6
+ * @param lang
7
+ */
8
+ function getCodeTypeFromLang(lang) {
9
+ switch (lang) {
10
+ case 'css':
11
+ return 'CSS';
12
+ case 'less':
13
+ return 'LESS';
14
+ case 'scss':
15
+ return 'SCSS';
16
+ case 'sass':
17
+ return 'SASS';
18
+ case 'html':
19
+ return 'HTML';
20
+ case 'ts':
21
+ case 'typescript':
22
+ return 'TypeScript';
23
+ case 'js':
24
+ case 'javascript':
25
+ return 'JavaScript';
26
+ default:
27
+ return null;
28
+ }
29
+ }
30
+ exports.getCodeTypeFromLang = getCodeTypeFromLang;
31
+ //# sourceMappingURL=get-code-type-from-lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-code-type-from-lang.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-code-type-from-lang.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC/C,QAAQ,IAAI,EAAE;QACb,KAAK,KAAK;YACT,OAAO,KAAK,CAAC;QACd,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,IAAI,CAAC;QACV,KAAK,YAAY;YAChB,OAAO,YAAY,CAAC;QACrB,KAAK,IAAI,CAAC;QACV,KAAK,YAAY;YAChB,OAAO,YAAY,CAAC;QACrB;YACC,OAAO,IAAI,CAAC;KACb;AACF,CAAC;AArBD,kDAqBC"}
@@ -3,4 +3,4 @@ import { ClassDeclaration, ObjectLiteralExpression } from 'ts-morph';
3
3
  *
4
4
  * @param objectExpression
5
5
  */
6
- export declare function getDemoClassDeclarations(objectExpression: ObjectLiteralExpression): ClassDeclaration[];
6
+ export declare function getDemoClassDeclarations(objectExpression: ObjectLiteralExpression): Record<string, ClassDeclaration>;
@@ -11,15 +11,26 @@ function getDemoClassDeclarations(objectExpression) {
11
11
  const demoProperty = objectExpression.getProperty('demos');
12
12
  if (demoProperty && (ts_morph_1.Node.isPropertyAssignment(demoProperty) || ts_morph_1.Node.isShorthandPropertyAssignment(demoProperty))) {
13
13
  const initializer = demoProperty.getInitializer();
14
- if (initializer && initializer instanceof ts_morph_1.ObjectLiteralExpression) {
15
- return initializer
16
- .getProperties()
17
- .map((property) => { var _a; return (_a = property.getType().getSymbol()) === null || _a === void 0 ? void 0 : _a.getValueDeclaration(); })
18
- .filter(core_1.isPresent)
19
- .filter(ts_morph_1.Node.isClassDeclaration);
14
+ if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
15
+ return initializer.getProperties().reduce((acc, property) => {
16
+ var _a;
17
+ const classDeclaration = (_a = property.getType().getSymbol()) === null || _a === void 0 ? void 0 : _a.getValueDeclaration();
18
+ if (ts_morph_1.Node.isClassDeclaration(classDeclaration)) {
19
+ if (ts_morph_1.Node.isShorthandPropertyAssignment(property) && classDeclaration.getName()) {
20
+ const className = classDeclaration.getName();
21
+ if ((0, core_1.isPresent)(className)) {
22
+ acc[className] = classDeclaration;
23
+ }
24
+ }
25
+ else if (ts_morph_1.Node.isPropertyAssignment(property)) {
26
+ acc[property.getName()] = classDeclaration;
27
+ }
28
+ }
29
+ return acc;
30
+ }, {});
20
31
  }
21
32
  }
22
- return [];
33
+ return {};
23
34
  }
24
35
  exports.getDemoClassDeclarations = getDemoClassDeclarations;
25
36
  //# sourceMappingURL=get-demo-class-declarations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-demo-class-declarations.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-demo-class-declarations.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAA+G;AAE/G;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,gBAAyC;IACjF,MAAM,YAAY,GAAyC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEjG,IAAI,YAAY,IAAI,CAAC,eAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,IAAI,eAAI,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC,EAAE;QAClH,MAAM,WAAW,GAA2B,YAAY,CAAC,cAAc,EAAE,CAAC;QAE1E,IAAI,WAAW,IAAI,WAAW,YAAY,kCAAuB,EAAE;YAClE,OAAO,WAAW;iBAChB,aAAa,EAAE;iBACf,GAAG,CAAC,CAAC,QAAkC,EAAE,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,0CAAE,mBAAmB,EAAE,CAAA,EAAA,CAAC;iBAClG,MAAM,CAAC,gBAAS,CAAC;iBACjB,MAAM,CAAC,eAAI,CAAC,kBAAkB,CAAC,CAAC;SAClC;KACD;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AAhBD,4DAgBC"}
1
+ {"version":3,"file":"get-demo-class-declarations.js","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;AA5BD,4DA4BC"}
@@ -1,10 +1,11 @@
1
1
  export * from './angular';
2
- export * from './build-assets';
3
2
  export * from './build-entity-keyword';
3
+ export * from './build-file-assets';
4
4
  export * from './build-file-entity';
5
5
  export * from './code-type-from-ext';
6
6
  export * from './create-builder-context';
7
7
  export * from './declaration-folder-name';
8
+ export * from './demo';
8
9
  export * from './emit-built-output';
9
10
  export * from './entity-type';
10
11
  export * from './extract-docs';
@@ -13,7 +14,7 @@ export * from './extract-selectors';
13
14
  export * from './filter-useless-members';
14
15
  export * from './format-code';
15
16
  export * from './generate-api-entities';
16
- export * from './get-component-asset';
17
+ export * from './get-code-type-from-lang';
17
18
  export * from './get-declaration-type';
18
19
  export * from './get-demo-class-declarations';
19
20
  export * from './get-entity-constructor';
@@ -24,7 +25,7 @@ export * from './import-es-module';
24
25
  export * from './is-not-excluded-path';
25
26
  export * from './is-supported-declaration';
26
27
  export * from './keyword-key';
27
- export * from './marked';
28
+ export * from './markdown-to-html';
28
29
  export * from './mini-pattern';
29
30
  export * from './no-empty';
30
31
  export * from './no-line-breaks';
@@ -33,9 +34,12 @@ export * from './playground';
33
34
  export * from './presentation';
34
35
  export * from './print';
35
36
  export * from './process-html';
37
+ export * from './process-legacy-snippets';
36
38
  export * from './process-snippets';
39
+ export * from './remove-lines-from-code';
37
40
  export * from './repo-link';
38
41
  export * from './slash';
42
+ export * from './snippets-from-asset';
39
43
  export * from './sort-navigation-entities';
40
44
  export * from './string-expression';
41
45
  export * from './to-template-string';
package/helpers/index.js CHANGED
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./angular"), exports);
5
- tslib_1.__exportStar(require("./build-assets"), exports);
6
5
  tslib_1.__exportStar(require("./build-entity-keyword"), exports);
6
+ tslib_1.__exportStar(require("./build-file-assets"), exports);
7
7
  tslib_1.__exportStar(require("./build-file-entity"), exports);
8
8
  tslib_1.__exportStar(require("./code-type-from-ext"), exports);
9
9
  tslib_1.__exportStar(require("./create-builder-context"), exports);
10
10
  tslib_1.__exportStar(require("./declaration-folder-name"), exports);
11
+ tslib_1.__exportStar(require("./demo"), exports);
11
12
  tslib_1.__exportStar(require("./emit-built-output"), exports);
12
13
  tslib_1.__exportStar(require("./entity-type"), exports);
13
14
  tslib_1.__exportStar(require("./extract-docs"), exports);
@@ -16,7 +17,7 @@ tslib_1.__exportStar(require("./extract-selectors"), exports);
16
17
  tslib_1.__exportStar(require("./filter-useless-members"), exports);
17
18
  tslib_1.__exportStar(require("./format-code"), exports);
18
19
  tslib_1.__exportStar(require("./generate-api-entities"), exports);
19
- tslib_1.__exportStar(require("./get-component-asset"), exports);
20
+ tslib_1.__exportStar(require("./get-code-type-from-lang"), exports);
20
21
  tslib_1.__exportStar(require("./get-declaration-type"), exports);
21
22
  tslib_1.__exportStar(require("./get-demo-class-declarations"), exports);
22
23
  tslib_1.__exportStar(require("./get-entity-constructor"), exports);
@@ -27,7 +28,7 @@ tslib_1.__exportStar(require("./import-es-module"), exports);
27
28
  tslib_1.__exportStar(require("./is-not-excluded-path"), exports);
28
29
  tslib_1.__exportStar(require("./is-supported-declaration"), exports);
29
30
  tslib_1.__exportStar(require("./keyword-key"), exports);
30
- tslib_1.__exportStar(require("./marked"), exports);
31
+ tslib_1.__exportStar(require("./markdown-to-html"), exports);
31
32
  tslib_1.__exportStar(require("./mini-pattern"), exports);
32
33
  tslib_1.__exportStar(require("./no-empty"), exports);
33
34
  tslib_1.__exportStar(require("./no-line-breaks"), exports);
@@ -36,9 +37,12 @@ tslib_1.__exportStar(require("./playground"), exports);
36
37
  tslib_1.__exportStar(require("./presentation"), exports);
37
38
  tslib_1.__exportStar(require("./print"), exports);
38
39
  tslib_1.__exportStar(require("./process-html"), exports);
40
+ tslib_1.__exportStar(require("./process-legacy-snippets"), exports);
39
41
  tslib_1.__exportStar(require("./process-snippets"), exports);
42
+ tslib_1.__exportStar(require("./remove-lines-from-code"), exports);
40
43
  tslib_1.__exportStar(require("./repo-link"), exports);
41
44
  tslib_1.__exportStar(require("./slash"), exports);
45
+ tslib_1.__exportStar(require("./snippets-from-asset"), exports);
42
46
  tslib_1.__exportStar(require("./sort-navigation-entities"), exports);
43
47
  tslib_1.__exportStar(require("./string-expression"), exports);
44
48
  tslib_1.__exportStar(require("./to-template-string"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,yDAA+B;AAC/B,iEAAuC;AACvC,8DAAoC;AACpC,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,wDAA8B;AAC9B,kEAAwC;AACxC,gEAAsC;AACtC,iEAAuC;AACvC,wEAA8C;AAC9C,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,0DAAgC;AAChC,6DAAmC;AACnC,iEAAuC;AACvC,qEAA2C;AAC3C,wDAA8B;AAC9B,mDAAyB;AACzB,yDAA+B;AAC/B,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,uDAA6B;AAC7B,yDAA+B;AAC/B,kDAAwB;AACxB,yDAA+B;AAC/B,6DAAmC;AACnC,sDAA4B;AAC5B,kDAAwB;AACxB,qEAA2C;AAC3C,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,wDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,iEAAuC;AACvC,8DAAoC;AACpC,8DAAoC;AACpC,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,iDAAuB;AACvB,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,wDAA8B;AAC9B,kEAAwC;AACxC,oEAA0C;AAC1C,iEAAuC;AACvC,wEAA8C;AAC9C,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,0DAAgC;AAChC,6DAAmC;AACnC,iEAAuC;AACvC,qEAA2C;AAC3C,wDAA8B;AAC9B,6DAAmC;AACnC,yDAA+B;AAC/B,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,uDAA6B;AAC7B,yDAA+B;AAC/B,kDAAwB;AACxB,yDAA+B;AAC/B,oEAA0C;AAC1C,6DAAmC;AACnC,mEAAyC;AACzC,sDAA4B;AAC5B,kDAAwB;AACxB,gEAAsC;AACtC,qEAA2C;AAC3C,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,wDAA8B"}
@@ -2,6 +2,7 @@ import { NgDocConfiguration } from '../interfaces';
2
2
  /**
3
3
  * Loads configuration from global configuration file
4
4
  *
5
- * @param searchFrom
5
+ * @param path - Path to the configuration file
6
+ * @param search - Whether to search for the configuration file or not
6
7
  */
7
- export declare function loadConfig(searchFrom: string): [string, NgDocConfiguration];
8
+ export declare function loadConfig(path: string, search?: boolean): [string, NgDocConfiguration];
@@ -6,9 +6,10 @@ const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader")
6
6
  /**
7
7
  * Loads configuration from global configuration file
8
8
  *
9
- * @param searchFrom
9
+ * @param path - Path to the configuration file
10
+ * @param search - Whether to search for the configuration file or not
10
11
  */
11
- function loadConfig(searchFrom) {
12
+ function loadConfig(path, search = true) {
12
13
  var _a, _b;
13
14
  const moduleName = 'ng-doc';
14
15
  const explorerSync = (0, cosmiconfig_1.cosmiconfigSync)(moduleName, {
@@ -17,7 +18,7 @@ function loadConfig(searchFrom) {
17
18
  '.ts': (0, cosmiconfig_typescript_loader_1.TypeScriptLoader)(),
18
19
  },
19
20
  });
20
- const searchedFor = explorerSync.search(searchFrom);
21
+ const searchedFor = search ? explorerSync.search(path) : explorerSync.load(path);
21
22
  return [(_a = searchedFor === null || searchedFor === void 0 ? void 0 : searchedFor.filepath) !== null && _a !== void 0 ? _a : '', (_b = searchedFor === null || searchedFor === void 0 ? void 0 : searchedFor.config) !== null && _b !== void 0 ? _b : {}];
22
23
  }
23
24
  exports.loadConfig = loadConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/load-config.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAEhE,iFAA+D;AAI/D;;;;GAIG;AACH,SAAgB,UAAU,CAAC,UAAkB;;IAC5C,MAAM,UAAU,GAAW,QAAQ,CAAC;IAEpC,MAAM,YAAY,GAAuB,IAAA,6BAAe,EAAC,UAAU,EAAE;QACpE,YAAY,EAAE,CAAC,GAAG,UAAU,YAAY,CAAC;QACzC,OAAO,EAAE;YACR,KAAK,EAAE,IAAA,gDAAgB,GAAE;SACzB;KACD,CAAC,CAAC;IACH,MAAM,WAAW,GAA6B,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE9E,OAAO,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,EAAE,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;AACjE,CAAC;AAZD,gCAYC"}
1
+ {"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/load-config.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAEhE,iFAA+D;AAI/D;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,SAAkB,IAAI;;IAC9D,MAAM,UAAU,GAAW,QAAQ,CAAC;IAEpC,MAAM,YAAY,GAAuB,IAAA,6BAAe,EAAC,UAAU,EAAE;QACpE,YAAY,EAAE,CAAC,GAAG,UAAU,YAAY,CAAC;QACzC,OAAO,EAAE;YACR,KAAK,EAAE,IAAA,gDAAgB,GAAE;SACzB;KACD,CAAC,CAAC;IACH,MAAM,WAAW,GAA6B,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3G,OAAO,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,EAAE,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;AACjE,CAAC;AAZD,gCAYC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ *
3
+ * @param this
4
+ * @param markdown
5
+ * @param contextFolder
6
+ * @param page
7
+ * @param context
8
+ * @param addDependency
9
+ */
10
+ export declare function markdownToHtml(markdown: string, context?: string, addDependency?: (dep: string) => void): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.marked = void 0;
3
+ exports.markdownToHtml = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const builder_1 = require("@ng-doc/builder");
6
6
  const core_1 = require("@ng-doc/core");
@@ -8,6 +8,7 @@ const fs = tslib_1.__importStar(require("fs"));
8
8
  const marked_1 = require("marked");
9
9
  const node_os_1 = require("node:os");
10
10
  const path = tslib_1.__importStar(require("path"));
11
+ const remove_lines_from_code_1 = require("./remove-lines-from-code");
11
12
  const NOTE_ANCHOR = '<p><strong>Note</strong>';
12
13
  const WARNING_ANCHOR = '<p><strong>Warning</strong>';
13
14
  /**
@@ -16,22 +17,24 @@ const WARNING_ANCHOR = '<p><strong>Warning</strong>';
16
17
  * @param markdown
17
18
  * @param contextFolder
18
19
  * @param page
20
+ * @param context
21
+ * @param addDependency
19
22
  */
20
- function marked(markdown, page) {
23
+ function markdownToHtml(markdown, context, addDependency) {
21
24
  const renderer = {
22
25
  code(code, lang) {
23
26
  var _a;
24
27
  const { language, file, name, highlightedLines, fileLineStart, fileLineEnd, group, active, icon, } = (0, builder_1.parseCodeBlockParams)((_a = lang === null || lang === void 0 ? void 0 : lang.trim()) !== null && _a !== void 0 ? _a : 'typescript');
25
- if (file && page) {
26
- const relativeFilePath = path.join(page.mdFolder, file);
28
+ if (file && context) {
29
+ const relativeFilePath = path.join(context, file);
27
30
  const fileContent = fs
28
31
  .readFileSync(relativeFilePath !== null && relativeFilePath !== void 0 ? relativeFilePath : '', 'utf8')
29
32
  .split(node_os_1.EOL)
30
33
  .slice(fileLineStart, fileLineEnd)
31
34
  .join(node_os_1.EOL)
32
35
  .trim();
33
- page.dependencies.add(relativeFilePath);
34
- code = fileContent;
36
+ addDependency && addDependency(relativeFilePath);
37
+ code = (0, remove_lines_from_code_1.removeLinesFromCode)(fileContent);
35
38
  }
36
39
  const codeElement = `<pre><code class="language-${language !== null && language !== void 0 ? language : 'ts'}"
37
40
  lang="${language}"
@@ -55,5 +58,5 @@ function marked(markdown, page) {
55
58
  marked_1.marked.use({ renderer });
56
59
  return marked_1.marked.parse(markdown, { headerIds: false });
57
60
  }
58
- exports.marked = marked;
59
- //# sourceMappingURL=marked.js.map
61
+ exports.markdownToHtml = markdownToHtml;
62
+ //# sourceMappingURL=markdown-to-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-to-html.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/markdown-to-html.ts"],"names":[],"mappings":";;;;AAAA,6CAA2E;AAC3E,uCAAwC;AACxC,+CAAyB;AACzB,mCAA8B;AAC9B,qCAA4B;AAC5B,mDAA6B;AAE7B,qEAA6D;AAE7D,MAAM,WAAW,GAAW,0BAA0B,CAAC;AACvD,MAAM,cAAc,GAAW,6BAA6B,CAAC;AAE7D;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAAE,OAAgB,EAAE,aAAqC;IACvG,MAAM,QAAQ,GAA0B;QACvC,IAAI,CAAC,IAAY,EAAE,IAAwB;;YAC1C,MAAM,EACL,QAAQ,EACR,IAAI,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AC,CAAC,EACpB,IAAI,WAAW,eAAe;gBAChC,CAAC,CAAC,WAAW,CAAC;QAChB,CAAC;QACD,UAAU,CAAC,KAAa;YACvB,IAAI,IAAI,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAC9C,OAAO,kCAAkC,KAAK,CAAC,OAAO,CACrD,IAAI,MAAM,CAAC,IAAI,WAAW,MAAM,CAAC,EACjC,KAAK,CACL,sBAAsB,CAAC;aACxB;YAED,IAAI,IAAI,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBACjD,OAAO,qCAAqC,KAAK,CAAC,OAAO,CACxD,IAAI,MAAM,CAAC,IAAI,cAAc,MAAM,CAAC,EACpC,KAAK,CACL,sBAAsB,CAAC;aACxB;YAED,OAAO,sBAAsB,KAAK,sBAAsB,CAAC;QAC1D,CAAC;KACD,CAAC;IAEF,eAAM,CAAC,GAAG,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC;IAEvB,OAAO,eAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC,CAAC;AACnD,CAAC;AA/DD,wCA+DC"}
@@ -1,15 +1,15 @@
1
- import { NgDocRouteEntity } from '../engine/entities/abstractions/route.entity';
1
+ import { NgDocEntity } from '../engine/entities/abstractions/entity';
2
2
  /**
3
3
  * Processes html content for the current entity
4
4
  *
5
5
  * @param entity - The current entity
6
6
  * @param html - The html content to process
7
7
  */
8
- export declare function processHtml(entity: NgDocRouteEntity, html: string): Promise<string>;
8
+ export declare function processHtml(html: string, entity: NgDocEntity): Promise<string>;
9
9
  /**
10
10
  * Post-Processes html content for the current entity
11
11
  *
12
12
  * @param entity - The current entity
13
13
  * @param html - The html content to process
14
14
  */
15
- export declare function postProcessHtml(entity: NgDocRouteEntity, html: string): Promise<string>;
15
+ export declare function postProcessHtml(html: string, entity?: NgDocEntity): Promise<string>;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.postProcessHtml = exports.processHtml = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const core_1 = require("@ng-doc/core");
6
+ const entity_type_1 = require("./entity-type");
5
7
  const import_es_module_1 = require("./import-es-module");
6
8
  /**
7
9
  * Processes html content for the current entity
@@ -9,15 +11,15 @@ const import_es_module_1 = require("./import-es-module");
9
11
  * @param entity - The current entity
10
12
  * @param html - The html content to process
11
13
  */
12
- function processHtml(entity, html) {
13
- var _a;
14
+ function processHtml(html, entity) {
15
+ var _a, _b;
14
16
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
17
  const utils = yield (0, import_es_module_1.importEsModule)('@ng-doc/utils');
16
18
  return utils.htmlProcessor(html, {
17
- headings: (_a = entity.context.config.guide) === null || _a === void 0 ? void 0 : _a.anchorHeadings,
18
- route: entity.fullRoute,
19
- raiseError: entity.warnings.push.bind(entity.warnings),
20
- addAnchor: (anchor) => entity.anchors.push(anchor),
19
+ headings: (_a = entity === null || entity === void 0 ? void 0 : entity.context.config.guide) === null || _a === void 0 ? void 0 : _a.anchorHeadings,
20
+ route: (0, entity_type_1.isRouteEntity)(entity) ? entity.fullRoute : undefined,
21
+ raiseError: (_b = entity === null || entity === void 0 ? void 0 : entity.warnings.push.bind(entity.warnings)) !== null && _b !== void 0 ? _b : core_1.EMPTY_FUNCTION,
22
+ addAnchor: (anchor) => ((0, entity_type_1.isRouteEntity)(entity) ? entity.anchors.push(anchor) : undefined),
21
23
  });
22
24
  });
23
25
  }
@@ -28,14 +30,15 @@ exports.processHtml = processHtml;
28
30
  * @param entity - The current entity
29
31
  * @param html - The html content to process
30
32
  */
31
- function postProcessHtml(entity, html) {
33
+ function postProcessHtml(html, entity) {
34
+ var _a;
32
35
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
36
  const utils = yield (0, import_es_module_1.importEsModule)('@ng-doc/utils');
34
37
  return utils.htmlPostProcessor(html, {
35
- raiseError: entity.warnings.push.bind(entity.warnings),
36
- addUsedKeyword: entity.usedKeywords.add.bind(entity.usedKeywords),
37
- addPotentialKeyword: entity.potentialKeywords.add.bind(entity.potentialKeywords),
38
- getKeyword: entity.store.getByKeyword.bind(entity.store),
38
+ raiseError: (_a = entity === null || entity === void 0 ? void 0 : entity.warnings.push.bind(entity.warnings)) !== null && _a !== void 0 ? _a : core_1.EMPTY_FUNCTION,
39
+ addUsedKeyword: entity === null || entity === void 0 ? void 0 : entity.usedKeywords.add.bind(entity.usedKeywords),
40
+ addPotentialKeyword: entity === null || entity === void 0 ? void 0 : entity.potentialKeywords.add.bind(entity.potentialKeywords),
41
+ getKeyword: entity === null || entity === void 0 ? void 0 : entity.store.getByKeyword.bind(entity.store),
39
42
  });
40
43
  });
41
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"process-html.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/process-html.ts"],"names":[],"mappings":";;;;AAGA,yDAAkD;AAIlD;;;;;GAKG;AACH,SAAsB,WAAW,CAAC,MAAwB,EAAE,IAAY;;;QACvE,MAAM,KAAK,GAAU,MAAM,IAAA,iCAAc,EAAQ,eAAe,CAAC,CAAC;QAElE,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE;YAChC,QAAQ,EAAE,MAAA,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,0CAAE,cAAc;YACrD,KAAK,EAAE,MAAM,CAAC,SAAS;YACvB,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACtD,SAAS,EAAE,CAAC,MAAyB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;SACrE,CAAC,CAAC;;CACH;AATD,kCASC;AAED;;;;;GAKG;AACH,SAAsB,eAAe,CAAC,MAAwB,EAAE,IAAY;;QAC3E,MAAM,KAAK,GAAU,MAAM,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A,2BAAa,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC3G,CAAC,CAAC;;CACH;AATD,kCASC;AAED;;;;;GAKG;AACH,SAAsB,eAAe,CAAC,IAAY,EAAE,MAAoB;;;QACvE,MAAM,KAAK,GAAU,MAAM,IAAA,iCAAc,EAAQ,eAAe,CAAC,CAAC;QAElE,OAAO,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE;YACpC,UAAU,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAI,qBAAc;YACzE,cAAc,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAClE,mBAAmB,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;YACjF,UAAU,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;SACzD,CAAC,CAAC;;CACH;AATD,0CASC"}
@@ -0,0 +1,9 @@
1
+ import { NgDocSnippet } from '../interfaces/snippet';
2
+ /**
3
+ * Finds and return all the snippets in the given string.
4
+ *
5
+ * @deprecated - Use `processSnippets` instead
6
+ * @param content - Content
7
+ * @returns - Array of snippets
8
+ */
9
+ export declare function processLegacySnippets(content: string): NgDocSnippet[];
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processLegacySnippets = void 0;
4
+ const escape_regexp_1 = require("@ng-doc/core/helpers/escape-regexp");
5
+ const HTMLSnippetStart = /^.*(<!--\s*NgDocHTMLSnippetStart(\(.+\))?\s*-->).*$/gm;
6
+ const StylesSnippetStart = /^.*(\/\*\s*NgDocStyleSnippetStart(\(.+\))?\s*\*\/).*$/gm;
7
+ const TypeScriptSnippetStart = /^.*(\/\*\s*NgDocCodeSnippetStart(\(.+\))?\s*\*\/).*$/gm;
8
+ const HTMLSnippetEnd = (group = '', escape = true) => new RegExp(`^.*(<!--\\s*NgDocHTMLSnippetEnd(\\(${escape ? (0, escape_regexp_1.escapeRegexp)(group) : group}\\))?\\s*-->).*$`, 'gm');
9
+ const StylesSnippetEnd = (group = '', escape = true) => new RegExp(`^.*(\\/\\*\\s*NgDocStyleSnippetEnd(\\(${escape ? (0, escape_regexp_1.escapeRegexp)(group) : group}\\))?\\s*\\*\\/).*$`, 'gm');
10
+ const TypeScriptSnippetEnd = (group = '', escape = true) => new RegExp(`^.*(\\/\\*\\s*NgDocCodeSnippetEnd(\\(${escape ? (0, escape_regexp_1.escapeRegexp)(group) : group}\\))?\\s*\\*\\/).*$`, 'gm');
11
+ /**
12
+ * Finds and return all the snippets in the given string.
13
+ *
14
+ * @deprecated - Use `processSnippets` instead
15
+ * @param content - Content
16
+ * @returns - Array of snippets
17
+ */
18
+ function processLegacySnippets(content) {
19
+ return [
20
+ ...findSnippet(content, 'HTML', HTMLSnippetStart, HTMLSnippetEnd),
21
+ ...findSnippet(content, 'styles', StylesSnippetStart, StylesSnippetEnd),
22
+ ...findSnippet(content, 'TypeScript', TypeScriptSnippetStart, TypeScriptSnippetEnd),
23
+ ];
24
+ }
25
+ exports.processLegacySnippets = processLegacySnippets;
26
+ /**
27
+ * Finds the snippets in the given content.
28
+ *
29
+ * @param content - Content
30
+ * @param type - Snippet type
31
+ * @param snippetStart - Snippet start
32
+ * @param snippetEnd - Snippet end
33
+ */
34
+ function findSnippet(content, type, snippetStart, snippetEnd) {
35
+ var _a;
36
+ const snippets = [];
37
+ const startRegexp = new RegExp(snippetStart);
38
+ let matchStart;
39
+ // eslint-disable-next-line no-cond-assign
40
+ while ((matchStart = startRegexp.exec(content))) {
41
+ const group = (_a = matchStart[2]) === null || _a === void 0 ? void 0 : _a.slice(1, matchStart[2].length - 1);
42
+ const matchEnd = snippetEnd(group).exec(content);
43
+ if (matchEnd) {
44
+ const snippetCode = content.slice(matchStart.index + matchStart[0].length, matchEnd.index).trim();
45
+ if (snippetCode) {
46
+ snippets.push({
47
+ code: removeSnippetsInCode(snippetCode),
48
+ title: group,
49
+ lang: type,
50
+ });
51
+ }
52
+ }
53
+ }
54
+ return snippets;
55
+ }
56
+ /**
57
+ * Removes the snippets from the given code.
58
+ *
59
+ * @param code - Code
60
+ */
61
+ function removeSnippetsInCode(code) {
62
+ return code
63
+ .replace(HTMLSnippetStart, '')
64
+ .replace(StylesSnippetStart, '')
65
+ .replace(TypeScriptSnippetStart, '')
66
+ .replace(HTMLSnippetEnd('.*', false), '')
67
+ .replace(StylesSnippetEnd('.*', false), '')
68
+ .replace(TypeScriptSnippetEnd('.*', false), '');
69
+ }
70
+ //# sourceMappingURL=process-legacy-snippets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-legacy-snippets.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/process-legacy-snippets.ts"],"names":[],"mappings":";;;AAAA,sEAAgE;AAIhE,MAAM,gBAAgB,GAAW,uDAAuD,CAAC;AACzF,MAAM,kBAAkB,GAAW,yDAAyD,CAAC;AAC7F,MAAM,sBAAsB,GAAW,wDAAwD,CAAC;AAChG,MAAM,cAAc,GAAiD,CAAC,QAAgB,EAAE,EAAE,SAAkB,IAAI,EAAE,EAAE,CACnH,IAAI,MAAM,CAAC,sCAAsC,MAAM,CAAC,CAAC,CAAC,IAAA,4BAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,kBAAkB,EAAE,IAAI,CAAC,CAAC;AAChH,MAAM,gBAAgB,GAAiD,CAAC,QAAgB,EAAE,EAAE,SAAkB,IAAI,EAAE,EAAE,CACrH,IAAI,MAAM,C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EAAE;YACb,MAAM,WAAW,GAAW,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;YAE1G,IAAI,WAAW,EAAE;gBAChB,QAAQ,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,oBAAoB,CAAC,WAAW,CAAC;oBACvC,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,IAAI;iBACV,CAAC,CAAC;aACH;SACD;KACD;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACzC,OAAO,IAAI;SACT,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;SAC7B,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;SAC/B,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;SACnC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;SACxC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;SAC1C,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC"}
@@ -1,8 +1,8 @@
1
- import { NgDocSnippet } from '../interfaces/snippet';
1
+ import { NgDocSnippet } from '../interfaces';
2
2
  /**
3
- * Finds and return all the snippets in the given string.
3
+ * Process snippets from code
4
4
  *
5
- * @param {string} content - Content
6
- * @returns {NgDocSnippet[]} - Array of snippets
5
+ * @param code - code to process
6
+ * @param basePath - base path to file
7
7
  */
8
- export declare function processSnippets(content: string): NgDocSnippet[];
8
+ export declare function processSnippets(code: string, basePath?: string): NgDocSnippet[];