@ng-doc/builder 16.10.0 → 16.11.1

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 (249) hide show
  1. package/classes/observable-set.d.ts +1 -0
  2. package/classes/observable-set.js +4 -0
  3. package/classes/observable-set.js.map +1 -1
  4. package/engine/.cache/apps/ng-doc/docs/ng-doc.api.js +3 -8
  5. package/engine/.cache/apps/ng-doc/docs/recipes/ignoring-file-lines/ng-doc.page.js +41 -0
  6. package/engine/.cache/apps/ng-doc/docs/recipes/ng-doc.category.js +30 -0
  7. package/engine/actions/playground.action.js +2 -2
  8. package/engine/actions/playground.action.js.map +1 -1
  9. package/engine/build-ng-doc.js +10 -2
  10. package/engine/build-ng-doc.js.map +1 -1
  11. package/engine/builder-operators/build.d.ts +2 -3
  12. package/engine/builder-operators/build.js +8 -4
  13. package/engine/builder-operators/build.js.map +1 -1
  14. package/engine/builder-operators/compile.d.ts +1 -1
  15. package/engine/builder-operators/compile.js.map +1 -1
  16. package/engine/builder-operators/emit.d.ts +2 -2
  17. package/engine/builder-operators/emit.js.map +1 -1
  18. package/engine/builder-operators/post-build.d.ts +6 -0
  19. package/engine/builder-operators/post-build.js +23 -0
  20. package/engine/builder-operators/post-build.js.map +1 -0
  21. package/engine/builder-operators/post-process.d.ts +2 -2
  22. package/engine/builder-operators/post-process.js +4 -5
  23. package/engine/builder-operators/post-process.js.map +1 -1
  24. package/engine/builder-operators/task.d.ts +1 -1
  25. package/engine/builder-operators/task.js.map +1 -1
  26. package/engine/builder-operators/to-builder-output.d.ts +6 -0
  27. package/engine/builder-operators/to-builder-output.js +13 -0
  28. package/engine/builder-operators/to-builder-output.js.map +1 -0
  29. package/engine/entities/abstractions/entity.d.ts +11 -11
  30. package/engine/entities/abstractions/entity.js +2 -5
  31. package/engine/entities/abstractions/entity.js.map +1 -1
  32. package/engine/entities/abstractions/file.entity.d.ts +2 -2
  33. package/engine/entities/abstractions/file.entity.js.map +1 -1
  34. package/engine/entities/abstractions/module.entity.d.ts +1 -1
  35. package/engine/entities/abstractions/module.entity.js.map +1 -1
  36. package/engine/entities/abstractions/navigation.entity.d.ts +1 -1
  37. package/engine/entities/abstractions/navigation.entity.js.map +1 -1
  38. package/engine/entities/abstractions/route.entity.d.ts +3 -4
  39. package/engine/entities/abstractions/route.entity.js +2 -2
  40. package/engine/entities/abstractions/route.entity.js.map +1 -1
  41. package/engine/entities/api-list.entity.d.ts +20 -0
  42. package/engine/entities/api-list.entity.js +69 -0
  43. package/engine/entities/api-list.entity.js.map +1 -0
  44. package/engine/entities/api-page.entity.d.ts +2 -3
  45. package/engine/entities/api-page.entity.js +26 -28
  46. package/engine/entities/api-page.entity.js.map +1 -1
  47. package/engine/entities/api-scope.entity.d.ts +2 -3
  48. package/engine/entities/api-scope.entity.js +13 -7
  49. package/engine/entities/api-scope.entity.js.map +1 -1
  50. package/engine/entities/api.entity.d.ts +3 -4
  51. package/engine/entities/api.entity.js +26 -29
  52. package/engine/entities/api.entity.js.map +1 -1
  53. package/engine/entities/category.entity.d.ts +2 -3
  54. package/engine/entities/category.entity.js +11 -13
  55. package/engine/entities/category.entity.js.map +1 -1
  56. package/engine/entities/context.entity.d.ts +11 -0
  57. package/engine/entities/context.entity.js +34 -0
  58. package/engine/entities/context.entity.js.map +1 -0
  59. package/engine/entities/generated-module.entity.d.ts +12 -0
  60. package/engine/entities/generated-module.entity.js +52 -0
  61. package/engine/entities/generated-module.entity.js.map +1 -0
  62. package/engine/entities/index-file.entity.d.ts +12 -0
  63. package/engine/entities/index-file.entity.js +52 -0
  64. package/engine/entities/index-file.entity.js.map +1 -0
  65. package/engine/entities/index.d.ts +8 -1
  66. package/engine/entities/index.js +8 -1
  67. package/engine/entities/index.js.map +1 -1
  68. package/engine/entities/indexes.entity.d.ts +3 -4
  69. package/engine/entities/indexes.entity.js +12 -14
  70. package/engine/entities/indexes.entity.js.map +1 -1
  71. package/engine/entities/keywords.entity.d.ts +12 -0
  72. package/engine/entities/keywords.entity.js +32 -0
  73. package/engine/entities/keywords.entity.js.map +1 -0
  74. package/engine/entities/page-demo.entity.d.ts +20 -0
  75. package/engine/entities/page-demo.entity.js +87 -0
  76. package/engine/entities/page-demo.entity.js.map +1 -0
  77. package/engine/entities/page-playground.entity.d.ts +21 -0
  78. package/engine/entities/page-playground.entity.js +80 -0
  79. package/engine/entities/page-playground.entity.js.map +1 -0
  80. package/engine/entities/page.entity.d.ts +6 -18
  81. package/engine/entities/page.entity.js +39 -107
  82. package/engine/entities/page.entity.js.map +1 -1
  83. package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.d.ts +5 -0
  84. package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.js +20 -0
  85. package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.js.map +1 -0
  86. package/engine/entities/plugins/entity-plugins/apply.plugin.d.ts +26 -0
  87. package/engine/entities/plugins/entity-plugins/apply.plugin.js +65 -0
  88. package/engine/entities/plugins/entity-plugins/apply.plugin.js.map +1 -0
  89. package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.d.ts +6 -0
  90. package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.js +23 -0
  91. package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.js.map +1 -0
  92. package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.d.ts +6 -0
  93. package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.js +27 -0
  94. package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.js.map +1 -0
  95. package/engine/entities/plugins/entity-plugins/index.d.ts +9 -0
  96. package/engine/entities/plugins/entity-plugins/index.js +13 -0
  97. package/engine/entities/plugins/entity-plugins/index.js.map +1 -0
  98. package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.d.ts +5 -0
  99. package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.js +21 -0
  100. package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.js.map +1 -0
  101. package/engine/entities/plugins/entity-plugins/post-process-html.plugin.d.ts +5 -0
  102. package/engine/entities/plugins/entity-plugins/post-process-html.plugin.js +18 -0
  103. package/engine/entities/plugins/entity-plugins/post-process-html.plugin.js.map +1 -0
  104. package/engine/entities/plugins/entity-plugins/process-html.plugin.d.ts +5 -0
  105. package/engine/entities/plugins/entity-plugins/process-html.plugin.js +18 -0
  106. package/engine/entities/plugins/entity-plugins/process-html.plugin.js.map +1 -0
  107. package/engine/entities/plugins/entity-plugins/remove-lines.plugin.d.ts +6 -0
  108. package/engine/entities/plugins/entity-plugins/remove-lines.plugin.js +23 -0
  109. package/engine/entities/plugins/entity-plugins/remove-lines.plugin.js.map +1 -0
  110. package/engine/entities/plugins/entity-plugins/wrap-code.plugin.d.ts +6 -0
  111. package/engine/entities/plugins/entity-plugins/wrap-code.plugin.js +21 -0
  112. package/engine/entities/plugins/entity-plugins/wrap-code.plugin.js.map +1 -0
  113. package/engine/entities/plugins/helpers/execute-plugins.d.ts +10 -0
  114. package/engine/entities/plugins/helpers/execute-plugins.js +18 -0
  115. package/engine/entities/plugins/helpers/execute-plugins.js.map +1 -0
  116. package/engine/entities/plugins/helpers/index.d.ts +1 -0
  117. package/engine/entities/plugins/helpers/index.js +5 -0
  118. package/engine/entities/plugins/helpers/index.js.map +1 -0
  119. package/engine/entities/plugins/index.d.ts +3 -0
  120. package/engine/entities/plugins/index.js +7 -0
  121. package/engine/entities/plugins/index.js.map +1 -0
  122. package/engine/entities/plugins/types/entity-plugin.d.ts +5 -0
  123. package/engine/entities/plugins/types/entity-plugin.js +3 -0
  124. package/engine/entities/plugins/types/entity-plugin.js.map +1 -0
  125. package/engine/entities/plugins/types/index.d.ts +1 -0
  126. package/engine/entities/plugins/types/index.js +5 -0
  127. package/engine/entities/plugins/types/index.js.map +1 -0
  128. package/engine/entities/routes.entity.d.ts +11 -0
  129. package/engine/entities/routes.entity.js +34 -0
  130. package/engine/entities/routes.entity.js.map +1 -0
  131. package/engine/entity-store.d.ts +1 -0
  132. package/engine/entity-store.js +3 -0
  133. package/engine/entity-store.js.map +1 -1
  134. package/engine/nunjucks/filters.d.ts +2 -2
  135. package/engine/nunjucks/filters.js +3 -2
  136. package/engine/nunjucks/filters.js.map +1 -1
  137. package/engine/variables.d.ts +1 -0
  138. package/engine/variables.js +1 -0
  139. package/engine/variables.js.map +1 -1
  140. package/helpers/angular/get-component-assets.d.ts +8 -0
  141. package/helpers/angular/get-component-assets.js +15 -0
  142. package/helpers/angular/get-component-assets.js.map +1 -0
  143. package/helpers/angular/get-component-source-files.d.ts +7 -0
  144. package/helpers/angular/get-component-source-files.js +23 -0
  145. package/helpers/angular/get-component-source-files.js.map +1 -0
  146. package/helpers/angular/index.d.ts +2 -0
  147. package/helpers/angular/index.js +2 -0
  148. package/helpers/angular/index.js.map +1 -1
  149. package/helpers/build-file-assets.d.ts +7 -0
  150. package/helpers/build-file-assets.js +25 -0
  151. package/helpers/build-file-assets.js.map +1 -0
  152. package/helpers/build-file-entity.js +14 -1
  153. package/helpers/build-file-entity.js.map +1 -1
  154. package/helpers/demo/assets-from-component-asset.d.ts +6 -0
  155. package/helpers/demo/assets-from-component-asset.js +14 -0
  156. package/helpers/demo/assets-from-component-asset.js.map +1 -0
  157. package/helpers/demo/index.d.ts +1 -0
  158. package/helpers/demo/index.js +5 -0
  159. package/helpers/demo/index.js.map +1 -0
  160. package/helpers/emit-built-output.d.ts +2 -2
  161. package/helpers/emit-built-output.js.map +1 -1
  162. package/helpers/entity-type.d.ts +1 -1
  163. package/helpers/extract-docs.js +4 -4
  164. package/helpers/extract-docs.js.map +1 -1
  165. package/helpers/format-code.d.ts +1 -1
  166. package/helpers/format-code.js +14 -3
  167. package/helpers/format-code.js.map +1 -1
  168. package/helpers/get-code-type-from-lang.d.ts +6 -0
  169. package/helpers/get-code-type-from-lang.js +31 -0
  170. package/helpers/get-code-type-from-lang.js.map +1 -0
  171. package/helpers/get-demo-class-declarations.d.ts +1 -1
  172. package/helpers/get-demo-class-declarations.js +18 -7
  173. package/helpers/get-demo-class-declarations.js.map +1 -1
  174. package/helpers/index.d.ts +7 -3
  175. package/helpers/index.js +7 -3
  176. package/helpers/index.js.map +1 -1
  177. package/helpers/markdown-to-html.d.ts +10 -0
  178. package/helpers/{marked.js → markdown-to-html.js} +11 -8
  179. package/helpers/markdown-to-html.js.map +1 -0
  180. package/helpers/process-html.d.ts +3 -3
  181. package/helpers/process-html.js +14 -11
  182. package/helpers/process-html.js.map +1 -1
  183. package/helpers/process-legacy-snippets.d.ts +9 -0
  184. package/helpers/process-legacy-snippets.js +70 -0
  185. package/helpers/process-legacy-snippets.js.map +1 -0
  186. package/helpers/process-snippets.d.ts +5 -5
  187. package/helpers/process-snippets.js +63 -50
  188. package/helpers/process-snippets.js.map +1 -1
  189. package/helpers/remove-lines-from-code.d.ts +6 -0
  190. package/helpers/remove-lines-from-code.js +30 -0
  191. package/helpers/remove-lines-from-code.js.map +1 -0
  192. package/helpers/snippets-from-asset.d.ts +9 -0
  193. package/helpers/snippets-from-asset.js +26 -0
  194. package/helpers/snippets-from-asset.js.map +1 -0
  195. package/interfaces/asset.d.ts +5 -7
  196. package/interfaces/build-result.d.ts +10 -0
  197. package/{types/snippet-type.js → interfaces/build-result.js} +1 -1
  198. package/interfaces/build-result.js.map +1 -0
  199. package/interfaces/index.d.ts +3 -0
  200. package/interfaces/index.js +3 -0
  201. package/interfaces/index.js.map +1 -1
  202. package/interfaces/output.d.ts +1 -3
  203. package/interfaces/snippet-config.d.ts +8 -0
  204. package/interfaces/snippet-config.js +3 -0
  205. package/interfaces/snippet-config.js.map +1 -0
  206. package/interfaces/snippet.d.ts +5 -4
  207. package/operators/error-handler.d.ts +1 -1
  208. package/package.json +5 -5
  209. package/parsers/helpers/index.d.ts +3 -0
  210. package/parsers/helpers/index.js +7 -0
  211. package/parsers/helpers/index.js.map +1 -0
  212. package/parsers/helpers/number.d.ts +2 -0
  213. package/parsers/helpers/number.js +7 -0
  214. package/parsers/helpers/number.js.map +1 -0
  215. package/parsers/helpers/param-value.d.ts +2 -0
  216. package/parsers/helpers/param-value.js +8 -0
  217. package/parsers/helpers/param-value.js.map +1 -0
  218. package/parsers/helpers/param.d.ts +7 -0
  219. package/parsers/helpers/param.js +19 -0
  220. package/parsers/helpers/param.js.map +1 -0
  221. package/parsers/parse-code-block-params.js +8 -13
  222. package/parsers/parse-code-block-params.js.map +1 -1
  223. package/parsers/parse-snippet.d.ts +6 -0
  224. package/parsers/parse-snippet.js +27 -0
  225. package/parsers/parse-snippet.js.map +1 -0
  226. package/schematics/category/index.js +2 -1
  227. package/schematics/category/index.js.map +1 -1
  228. package/schematics/page/index.js +2 -1
  229. package/schematics/page/index.js.map +1 -1
  230. package/templates/demo-assets.ts.nunj +13 -4
  231. package/templates/page.module.ts.nunj +3 -2
  232. package/templates/parts/usage-notes.html.nunj +1 -1
  233. package/templates/playgrounds.ts.nunj +5 -7
  234. package/types/index.d.ts +0 -1
  235. package/types/index.js +0 -1
  236. package/types/index.js.map +1 -1
  237. package/engine/entities/skeleton.entity.d.ts +0 -16
  238. package/engine/entities/skeleton.entity.js +0 -44
  239. package/engine/entities/skeleton.entity.js.map +0 -1
  240. package/helpers/build-assets.d.ts +0 -10
  241. package/helpers/build-assets.js +0 -55
  242. package/helpers/build-assets.js.map +0 -1
  243. package/helpers/get-component-asset.d.ts +0 -10
  244. package/helpers/get-component-asset.js +0 -50
  245. package/helpers/get-component-asset.js.map +0 -1
  246. package/helpers/marked.d.ts +0 -9
  247. package/helpers/marked.js.map +0 -1
  248. package/types/snippet-type.d.ts +0 -1
  249. package/types/snippet-type.js.map +0 -1
@@ -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","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,eAAI,CAAC,yBAAyB,CAAC,WAAW,CAAC,EAAE;YAChD,OAAO,WAAW,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,GAAqC,EAAE,QAAQ,EAAE,EAAE;;gBAC7F,MAAM,gBAAgB,GAAG,MAAA,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,0CAAE,mBAAmB,EAAE,CAAC;gBAE/E,IAAI,eAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;oBAC9C,IAAI,eAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,EAAE;wBAC/E,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC;wBAE7C,IAAI,IAAA,gBAAS,EAAC,SAAS,CAAC,EAAE;4BACzB,GAAG,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC;yBAClC;qBACD;yBAAM,IAAI,eAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE;wBAC/C,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;qBAC3C;iBACD;gBAED,OAAO,GAAG,CAAC;YACZ,CAAC,EAAE,EAAE,CAAC,CAAC;SACP;KACD;IAED,OAAO,EAAE,CAAC;AACX,CAAC;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"}
@@ -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-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nD,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;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M,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-sn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AC,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[];
@@ -1,67 +1,80 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processSnippets = 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');
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@ng-doc/core");
6
+ const fs = tslib_1.__importStar(require("fs"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const parse_snippet_1 = require("../parsers/parse-snippet");
9
+ const format_code_1 = require("./format-code");
10
+ const get_code_type_from_lang_1 = require("./get-code-type-from-lang");
11
+ const snippet = (id) => id
12
+ ? new RegExp(`\\n?\\r?^.*((\\/\\/|<!--|\\/\\*)\\s*)(snippet#${(0, core_1.escapeRegexp)(id)}.*?(?=(-->|\\*\\/)?))\\s*(-->|\\*\\/)?$`, 'gm')
13
+ : new RegExp(`\\n?\\r?^.*((\\/\\/|<!--|\\/\\*)\\s*)(snippet.*?(?=(-->|\\*\\/)?))\\s*(-->|\\*\\/)?$`, 'gm');
11
14
  /**
12
- * Finds and return all the snippets in the given string.
15
+ * Process snippets from code
13
16
  *
14
- * @param {string} content - Content
15
- * @returns {NgDocSnippet[]} - Array of snippets
17
+ * @param code - code to process
18
+ * @param basePath - base path to file
16
19
  */
17
- function processSnippets(content) {
18
- return [
19
- ...findSnippet(content, 'HTML', HTMLSnippetStart, HTMLSnippetEnd),
20
- ...findSnippet(content, 'styles', StylesSnippetStart, StylesSnippetEnd),
21
- ...findSnippet(content, 'TypeScript', TypeScriptSnippetStart, TypeScriptSnippetEnd),
22
- ];
23
- }
24
- exports.processSnippets = processSnippets;
25
- /**
26
- *
27
- * @param content
28
- * @param type
29
- * @param snippetStart
30
- * @param snippetEnd
31
- */
32
- function findSnippet(content, type, snippetStart, snippetEnd) {
33
- let snippetCounter = 0;
34
- const snippets = [];
35
- const startRegexp = new RegExp(snippetStart);
36
- let matchStart;
20
+ function processSnippets(code, basePath) {
21
+ var _a;
22
+ const result = [];
23
+ const endings = new Set();
24
+ const startRegexp = snippet();
25
+ let match;
37
26
  // eslint-disable-next-line no-cond-assign
38
- while ((matchStart = startRegexp.exec(content))) {
39
- const group = matchStart[2] ? matchStart[2].slice(1, matchStart[2].length - 1) : `Code Snippet ${++snippetCounter}`;
40
- const matchEnd = snippetEnd(group).exec(content);
41
- if (matchEnd) {
42
- const snippetCode = content.slice(matchStart.index + matchStart[0].length, matchEnd.index).trim();
43
- if (snippetCode) {
44
- snippets.push({
45
- content: removeSnippetsInCode(snippetCode),
46
- name: group,
47
- type,
48
- });
27
+ while ((match = startRegexp.exec(code))) {
28
+ const isHTMLComment = match[2] === '<!--';
29
+ if (((_a = match[3]) === null || _a === void 0 ? void 0 : _a.includes('snippet-from-file=')) && basePath) {
30
+ const config = (0, parse_snippet_1.parseSnippet)(match[3].trim());
31
+ if (config) {
32
+ const { title, lang, icon, opened, fromFile } = config;
33
+ const language = lang || (isHTMLComment ? 'html' : 'ts');
34
+ if (fromFile) {
35
+ const snippetCode = fs.readFileSync(path_1.default.join(basePath, fromFile), 'utf-8');
36
+ result.push({
37
+ title: title !== null && title !== void 0 ? title : path_1.default.basename(fromFile),
38
+ lang: language,
39
+ icon,
40
+ opened,
41
+ code: (0, format_code_1.formatCode)(removeSnippets(snippetCode), (0, get_code_type_from_lang_1.getCodeTypeFromLang)(language)).trim(),
42
+ });
43
+ }
44
+ }
45
+ }
46
+ else if (!endings.has(match.index)) {
47
+ const config = (0, parse_snippet_1.parseSnippet)(match[3].trim());
48
+ if (config) {
49
+ const { id, title, lang, icon, opened } = config;
50
+ const endRegexp = snippet(id);
51
+ endRegexp.lastIndex = match.index + match[0].length;
52
+ const matchEnd = endRegexp.exec(code);
53
+ if (matchEnd) {
54
+ endings.add(matchEnd.index);
55
+ const snippetCode = code.slice(match.index + match[0].length, matchEnd.index);
56
+ const language = lang || (isHTMLComment ? 'html' : 'ts');
57
+ if (snippetCode) {
58
+ result.push({
59
+ title,
60
+ lang: language,
61
+ icon,
62
+ opened,
63
+ code: (0, format_code_1.formatCode)(removeSnippets(snippetCode), (0, get_code_type_from_lang_1.getCodeTypeFromLang)(language)).trim(),
64
+ });
65
+ }
66
+ }
49
67
  }
50
68
  }
51
69
  }
52
- return snippets;
70
+ return result;
53
71
  }
72
+ exports.processSnippets = processSnippets;
54
73
  /**
55
74
  *
56
75
  * @param code
57
76
  */
58
- function removeSnippetsInCode(code) {
59
- return code
60
- .replace(HTMLSnippetStart, '')
61
- .replace(StylesSnippetStart, '')
62
- .replace(TypeScriptSnippetStart, '')
63
- .replace(HTMLSnippetEnd('.*', false), '')
64
- .replace(StylesSnippetEnd('.*', false), '')
65
- .replace(TypeScriptSnippetEnd('.*', false), '');
77
+ function removeSnippets(code) {
78
+ return code.replace(snippet(), '');
66
79
  }
67
80
  //# sourceMappingURL=process-snippets.js.map