@ng-doc/builder 22.0.0-beta.1 → 22.0.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 (439) hide show
  1. package/README.md +19 -28
  2. package/application/index.js +7 -2
  3. package/application/index.js.map +1 -1
  4. package/application/schema.json +11 -4
  5. package/builders.json +23 -13
  6. package/classes/observable-map.d.ts +1 -0
  7. package/classes/observable-map.js +14 -3
  8. package/classes/observable-map.js.map +1 -1
  9. package/classes/observable-set.js +2 -1
  10. package/classes/observable-set.js.map +1 -1
  11. package/dev-server/index.js +5 -3
  12. package/dev-server/index.js.map +1 -1
  13. package/engine/build-ng-doc.js +1 -16
  14. package/engine/build-ng-doc.js.map +1 -1
  15. package/engine/builders/api-list/api-list-component.builder.js +4 -4
  16. package/engine/builders/api-list/api-list-component.builder.js.map +1 -1
  17. package/engine/builders/api-list/api-page-template.builder.js +2 -2
  18. package/engine/builders/api-list/api-page-template.builder.js.map +1 -1
  19. package/engine/builders/global/keywords.builder.d.ts +1 -4
  20. package/engine/builders/global/keywords.builder.js +5 -9
  21. package/engine/builders/global/keywords.builder.js.map +1 -1
  22. package/engine/builders/global/search-indexes.builder.js +1 -1
  23. package/engine/builders/global/search-indexes.builder.js.map +1 -1
  24. package/engine/builders/helpers/create-entry-metadata.js +2 -1
  25. package/engine/builders/helpers/create-entry-metadata.js.map +1 -1
  26. package/engine/builders/helpers/create-import-path.js.map +1 -1
  27. package/engine/builders/helpers/get-entry-relative-path.js.map +1 -1
  28. package/engine/builders/page/demo-assets.builder.js +8 -5
  29. package/engine/builders/page/demo-assets.builder.js.map +1 -1
  30. package/engine/builders/page/playground.builder.js +1 -0
  31. package/engine/builders/page/playground.builder.js.map +1 -1
  32. package/engine/builders/shared/content.builder.js +3 -3
  33. package/engine/builders/shared/content.builder.js.map +1 -1
  34. package/engine/builders/shared/entry.builder.js +1 -13
  35. package/engine/builders/shared/entry.builder.js.map +1 -1
  36. package/engine/builders/shared/page-component.builder.js +16 -6
  37. package/engine/builders/shared/page-component.builder.js.map +1 -1
  38. package/engine/builders/shared/page-wrapper.builder.js +8 -5
  39. package/engine/builders/shared/page-wrapper.builder.js.map +1 -1
  40. package/engine/core/operators/distinct-pending.js.map +1 -1
  41. package/engine/core/operators/entries-emitter.js +2 -6
  42. package/engine/core/operators/entries-emitter.js.map +1 -1
  43. package/engine/core/operators/factory.js +1 -4
  44. package/engine/core/operators/factory.js.map +1 -1
  45. package/engine/core/operators/merge-factory.js +19 -17
  46. package/engine/core/operators/merge-factory.js.map +1 -1
  47. package/engine/core/operators/when-builders-done.js.map +1 -1
  48. package/engine/core/stores/index.d.ts +0 -1
  49. package/engine/core/stores/index.js +0 -1
  50. package/engine/core/stores/index.js.map +1 -1
  51. package/engine/core/triggers/on-dependencies-change.d.ts +1 -1
  52. package/engine/core/triggers/on-dependencies-change.js +2 -2
  53. package/engine/core/triggers/on-dependencies-change.js.map +1 -1
  54. package/engine/core/watcher/watch.js +19 -1
  55. package/engine/core/watcher/watch.js.map +1 -1
  56. package/engine/variables.d.ts +1 -0
  57. package/engine/variables.js +1 -0
  58. package/engine/variables.js.map +1 -1
  59. package/generator/artifacts/index.d.ts +317 -0
  60. package/generator/bootstrap/bin.d.ts +18 -0
  61. package/generator/bootstrap/bin.js +7274 -0
  62. package/generator/bootstrap/candidate-output-committer.d.ts +12 -0
  63. package/generator/bootstrap/cli.d.ts +42 -0
  64. package/generator/bootstrap/cli.js +7123 -0
  65. package/generator/bootstrap/constants.d.ts +4 -0
  66. package/generator/bootstrap/index.d.ts +111 -0
  67. package/generator/bootstrap/index.js +5020 -0
  68. package/generator/bootstrap/prerender-command.d.ts +31 -0
  69. package/generator/bootstrap/process-tree.d.ts +49 -0
  70. package/generator/build-metafile.json +11701 -0
  71. package/generator/build-provenance.json +119 -0
  72. package/generator/compiler/assemble.d.ts +41 -0
  73. package/generator/compiler/classify.d.ts +161 -0
  74. package/generator/compiler/closure-store.d.ts +55 -0
  75. package/generator/compiler/common.d.ts +32 -0
  76. package/generator/compiler/describe.d.ts +21 -0
  77. package/generator/compiler/dry-run.d.ts +108 -0
  78. package/generator/compiler/fast-start.d.ts +104 -0
  79. package/generator/compiler/fold.d.ts +116 -0
  80. package/generator/compiler/index.d.ts +111 -0
  81. package/generator/compiler/index.js +17759 -0
  82. package/generator/compiler/link.d.ts +38 -0
  83. package/generator/compiler/memo.d.ts +44 -0
  84. package/generator/compiler/plan.d.ts +92 -0
  85. package/generator/compiler/progress.d.ts +54 -0
  86. package/generator/compiler/render.d.ts +27 -0
  87. package/generator/compiler/retention.d.ts +181 -0
  88. package/generator/compiler/semantic-closure.d.ts +46 -0
  89. package/generator/compiler/targeted.d.ts +280 -0
  90. package/generator/content/content-compiler.d.ts +118 -0
  91. package/generator/content/highlight-cache.d.ts +139 -0
  92. package/generator/content/html-pipeline.d.ts +170 -0
  93. package/generator/content/html-pool.d.ts +239 -0
  94. package/generator/content/html-worker.js +1598 -0
  95. package/generator/content-module-ids.d.ts +8 -0
  96. package/generator/contracts.d.ts +1063 -0
  97. package/generator/contracts.js +15 -0
  98. package/generator/discovery/index.d.ts +77 -0
  99. package/generator/graph/index.d.ts +211 -0
  100. package/generator/graph/unit-index.d.ts +216 -0
  101. package/generator/kernel/canonical.d.ts +57 -0
  102. package/generator/kernel/flags.d.ts +49 -0
  103. package/generator/kernel/footprint.d.ts +88 -0
  104. package/generator/kernel/observations.d.ts +68 -0
  105. package/generator/kernel/paths.d.ts +22 -0
  106. package/generator/kernel/runtime-identity.d.ts +11 -0
  107. package/generator/outputs/index.d.ts +67 -0
  108. package/generator/package.json +3 -0
  109. package/generator/progress/ci.d.ts +22 -0
  110. package/generator/progress/detect.d.ts +60 -0
  111. package/generator/progress/events.d.ts +126 -0
  112. package/generator/progress/format.d.ts +83 -0
  113. package/generator/progress/gate.d.ts +49 -0
  114. package/generator/progress/host.d.ts +29 -0
  115. package/generator/progress/lines.d.ts +42 -0
  116. package/generator/progress/live.d.ts +115 -0
  117. package/generator/progress/model.d.ts +85 -0
  118. package/generator/progress/reporter.d.ts +87 -0
  119. package/generator/progress/settings.d.ts +60 -0
  120. package/generator/semantic/angular.d.ts +9 -0
  121. package/generator/semantic/api-enumeration.d.ts +19 -0
  122. package/generator/semantic/api-summary.d.ts +33 -0
  123. package/generator/semantic/dependencies.d.ts +20 -0
  124. package/generator/semantic/derived-classes.d.ts +58 -0
  125. package/generator/semantic/documentation-cache.d.ts +23 -0
  126. package/generator/semantic/fragments.d.ts +28 -0
  127. package/generator/semantic/owned-roots.d.ts +59 -0
  128. package/generator/semantic/program-builder.d.ts +55 -0
  129. package/generator/semantic/program-index.d.ts +124 -0
  130. package/generator/semantic/program-inputs.d.ts +26 -0
  131. package/generator/semantic/program-observations.d.ts +158 -0
  132. package/generator/semantic/program-retention.d.ts +147 -0
  133. package/generator/semantic/program-state.d.ts +196 -0
  134. package/generator/semantic/program-verify.d.ts +22 -0
  135. package/generator/semantic/recorder.d.ts +89 -0
  136. package/generator/semantic/rendering.d.ts +34 -0
  137. package/generator/semantic/semantic-closure.d.ts +129 -0
  138. package/generator/semantic/semantic-service.d.ts +186 -0
  139. package/generator/semantic/type-text.d.ts +5 -0
  140. package/generator/session/build-session.d.ts +206 -0
  141. package/generator/session/input-verification.d.ts +38 -0
  142. package/generator/session/parcel-event-source.d.ts +22 -0
  143. package/generator/session/progress.d.ts +72 -0
  144. package/generator/session/unchanged-saves.d.ts +63 -0
  145. package/generator/session/watch-inputs.d.ts +6 -0
  146. package/generator/session/watch-signals.d.ts +10 -0
  147. package/generator/templates/api/base.html.nunj +26 -0
  148. package/generator/templates/api/class-declaration.html.nunj +57 -0
  149. package/generator/templates/api/details/class-declaration.html.nunj +47 -0
  150. package/generator/templates/api/details/enum-declaration.html.nunj +0 -0
  151. package/generator/templates/api/details/function-declaration.html.nunj +14 -0
  152. package/generator/templates/api/details/helpers/decorators.html.nunj +14 -0
  153. package/generator/templates/api/details/helpers/extends.html.nunj +6 -0
  154. package/generator/templates/api/details/helpers/selectors.html.nunj +12 -0
  155. package/generator/templates/api/details/helpers/type-parameters.html.nunj +14 -0
  156. package/generator/templates/api/details/interface-declaration.html.nunj +27 -0
  157. package/generator/templates/api/details/type-alias-declaration.html.nunj +14 -0
  158. package/generator/templates/api/details/variable-declaration.html.nunj +0 -0
  159. package/generator/templates/api/details.html.nunj +9 -0
  160. package/generator/templates/api/enum-declaration.html.nunj +12 -0
  161. package/generator/templates/api/function-declaration.html.nunj +35 -0
  162. package/generator/templates/api/interface-declaration.html.nunj +37 -0
  163. package/generator/templates/api/type-alias-declaration.html.nunj +16 -0
  164. package/generator/templates/api/variable-declaration.html.nunj +8 -0
  165. package/generator/templates/api-header.html.nunj +11 -0
  166. package/generator/templates/api-list.ts.nunj +22 -0
  167. package/generator/templates/api-page-content.html.nunj +1 -0
  168. package/generator/templates/api-scope.ts.nunj +22 -0
  169. package/generator/templates/category.ts.nunj +22 -0
  170. package/generator/templates/code.html.nunj +3 -0
  171. package/generator/templates/context.ts.nunj +55 -0
  172. package/generator/templates/demo-assets.ts.nunj +25 -0
  173. package/generator/templates/helpers/accessor.html.nunj +76 -0
  174. package/generator/templates/helpers/accessors.html.nunj +7 -0
  175. package/generator/templates/helpers/badge.html.nunj +4 -0
  176. package/generator/templates/helpers/call-signature.html.nunj +70 -0
  177. package/generator/templates/helpers/code.html.nunj +3 -0
  178. package/generator/templates/helpers/constructor.html.nunj +32 -0
  179. package/generator/templates/helpers/declaration-modifiers.html.nunj +45 -0
  180. package/generator/templates/helpers/decorators.html.nunj +11 -0
  181. package/generator/templates/helpers/members.html.nunj +29 -0
  182. package/generator/templates/helpers/method.html.nunj +89 -0
  183. package/generator/templates/helpers/methods.html.nunj +7 -0
  184. package/generator/templates/helpers/modifier.html.nunj +4 -0
  185. package/generator/templates/helpers/no-content.html.nunj +3 -0
  186. package/generator/templates/helpers/overload.html.nunj +57 -0
  187. package/generator/templates/helpers/parameters.html.nunj +44 -0
  188. package/generator/templates/helpers/properties.html.nunj +61 -0
  189. package/generator/templates/helpers/status.html.nunj +33 -0
  190. package/generator/templates/helpers/tag.html.nunj +4 -0
  191. package/generator/templates/helpers/type.html.nunj +11 -0
  192. package/generator/templates/index.ts.nunj +2 -0
  193. package/generator/templates/page-header.html.nunj +5 -0
  194. package/generator/templates/page-wrapper.ts.nunj +64 -0
  195. package/generator/templates/page.ts.nunj +97 -0
  196. package/generator/templates/parts/examples.html.nunj +11 -0
  197. package/generator/templates/parts/member-examples.html.nunj +12 -0
  198. package/generator/templates/parts/member-remarks.html.nunj +8 -0
  199. package/generator/templates/parts/page-tags.html.nunj +10 -0
  200. package/generator/templates/parts/remarks.html.nunj +10 -0
  201. package/generator/templates/parts/see-also.html.nunj +23 -0
  202. package/generator/templates/parts/usage-notes.html.nunj +8 -0
  203. package/generator/templates/playgrounds.ts.nunj +63 -0
  204. package/generator/templates/routes.ts.nunj +49 -0
  205. package/generator/templates/symbol/decorators.html.nunj +12 -0
  206. package/generator/templates/symbol/details.html.nunj +62 -0
  207. package/generator/templates/symbol/extended-by.html.nunj +17 -0
  208. package/generator/templates/symbol/header.html.nunj +22 -0
  209. package/generator/templates/symbol/members.html.nunj +301 -0
  210. package/generator/templates/symbol/page.html.nunj +76 -0
  211. package/generator/templates/symbol/see-also.html.nunj +16 -0
  212. package/generator/vite/angular/ANALOG-LICENSE +21 -0
  213. package/generator/vite/angular/analog-provenance.json +880 -0
  214. package/generator/vite/angular/index.d.ts +14 -0
  215. package/generator/vite/angular/index.js +7300 -0
  216. package/generator/vite/angular-compatibility.d.ts +6 -0
  217. package/generator/vite/angular-composition.d.ts +68 -0
  218. package/generator/vite/angular-version.d.ts +38 -0
  219. package/generator/vite/application-builder.js +331 -0
  220. package/generator/vite/application-builder.schema.json +46 -0
  221. package/generator/vite/application.d.ts +91 -0
  222. package/generator/vite/assets.d.ts +11 -0
  223. package/generator/vite/bounded-close.d.ts +33 -0
  224. package/generator/vite/component-updates.d.ts +21 -0
  225. package/generator/vite/configuration.d.ts +3 -0
  226. package/generator/vite/dev-server-builder.js +334 -0
  227. package/generator/vite/dev-server-builder.schema.json +27 -0
  228. package/generator/vite/dev-styles.d.ts +65 -0
  229. package/generator/vite/diagnostics.d.ts +4 -0
  230. package/generator/vite/external-probes.d.ts +40 -0
  231. package/generator/vite/host-updates.d.ts +145 -0
  232. package/generator/vite/index.d.ts +13 -0
  233. package/generator/vite/index.js +11589 -0
  234. package/generator/vite/lease.d.ts +6 -0
  235. package/generator/vite/lifecycle.d.ts +119 -0
  236. package/generator/vite/mime.d.ts +2 -0
  237. package/generator/vite/missing-paths.d.ts +44 -0
  238. package/generator/vite/options.d.ts +87 -0
  239. package/generator/vite/output-watch.d.ts +41 -0
  240. package/generator/vite/paths.d.ts +7 -0
  241. package/generator/vite/plugin.d.ts +3 -0
  242. package/generator/vite/prerender-entry.js +395 -0
  243. package/generator/vite/prerender-runtime.d.ts +66 -0
  244. package/generator/vite/prerender.d.ts +27 -0
  245. package/generator/vite/production.d.ts +66 -0
  246. package/generator/vite/progress.d.ts +33 -0
  247. package/generator/vite/restore-theme.js +13 -0
  248. package/generator/vite/route-inventory.d.ts +24 -0
  249. package/generator/vite/ssr-renderer-control.d.ts +1 -0
  250. package/generator/vite/ssr-renderer-entry.js +444 -0
  251. package/generator/vite/ssr-renderer-protocol.d.ts +101 -0
  252. package/generator/vite/ssr-renderer.d.ts +74 -0
  253. package/generator/vite/theme-index.d.ts +13 -0
  254. package/generator/vite/tsconfig-paths.d.ts +64 -0
  255. package/generator/vite/vite-event-source.d.ts +198 -0
  256. package/generator/vite/vite-version.d.ts +26 -0
  257. package/generator/vite/watch-inputs.d.ts +39 -0
  258. package/generator/worker/entry.d.ts +1 -0
  259. package/generator/worker/entry.js +614 -0
  260. package/generator/worker/index.d.ts +156 -0
  261. package/generator/worker/index.js +1030 -0
  262. package/generator/worker/protocol.d.ts +160 -0
  263. package/helpers/angular/get-component-decorator.js +6 -6
  264. package/helpers/angular/get-component-decorator.js.map +1 -1
  265. package/helpers/angular/get-directive-decorator.js +3 -3
  266. package/helpers/angular/get-directive-decorator.js.map +1 -1
  267. package/helpers/angular/get-pipe-decorator.js +3 -3
  268. package/helpers/angular/get-pipe-decorator.js.map +1 -1
  269. package/helpers/build-indexes.js +5 -2
  270. package/helpers/build-indexes.js.map +1 -1
  271. package/helpers/construct-page-keyword.js +2 -1
  272. package/helpers/construct-page-keyword.js.map +1 -1
  273. package/helpers/extract-selectors.d.ts +1 -1
  274. package/helpers/extract-selectors.js +5 -3
  275. package/helpers/extract-selectors.js.map +1 -1
  276. package/helpers/filter-useless-members.d.ts +1 -1
  277. package/helpers/format-code.d.ts +2 -1
  278. package/helpers/format-code.js +13 -4
  279. package/helpers/format-code.js.map +1 -1
  280. package/helpers/import-fresh-esm.js.map +1 -1
  281. package/helpers/index.d.ts +2 -0
  282. package/helpers/index.js +2 -0
  283. package/helpers/index.js.map +1 -1
  284. package/helpers/keyword-heading-title.d.ts +7 -0
  285. package/helpers/keyword-heading-title.js +21 -0
  286. package/helpers/keyword-heading-title.js.map +1 -0
  287. package/helpers/markdown-to-html.js +3 -3
  288. package/helpers/markdown-to-html.js.map +1 -1
  289. package/helpers/navigation-title-order.d.ts +8 -0
  290. package/helpers/navigation-title-order.js +15 -0
  291. package/helpers/navigation-title-order.js.map +1 -0
  292. package/helpers/playground/get-playground-inputs.js +8 -4
  293. package/helpers/playground/get-playground-inputs.js.map +1 -1
  294. package/helpers/playground/get-playground-template-inputs.js +2 -1
  295. package/helpers/playground/get-playground-template-inputs.js.map +1 -1
  296. package/helpers/presentation.d.ts +7 -7
  297. package/helpers/presentation.js +23 -23
  298. package/helpers/presentation.js.map +1 -1
  299. package/helpers/print.js +32 -5
  300. package/helpers/print.js.map +1 -1
  301. package/helpers/process-snippets.d.ts +1 -1
  302. package/helpers/process-snippets.js +3 -3
  303. package/helpers/process-snippets.js.map +1 -1
  304. package/helpers/snippets-from-asset.d.ts +1 -1
  305. package/helpers/snippets-from-asset.js +2 -2
  306. package/helpers/snippets-from-asset.js.map +1 -1
  307. package/helpers/sort-navigation-entities.js +2 -1
  308. package/helpers/sort-navigation-entities.js.map +1 -1
  309. package/helpers/stable-generated-id.d.ts +2 -0
  310. package/helpers/stable-generated-id.js +12 -0
  311. package/helpers/stable-generated-id.js.map +1 -0
  312. package/helpers/text-order.d.ts +8 -0
  313. package/helpers/text-order.js +26 -0
  314. package/helpers/text-order.js.map +1 -0
  315. package/helpers/typescript/member/get-inherited-parent.d.ts +1 -1
  316. package/helpers/typescript/member/get-inherited-parent.js +2 -2
  317. package/helpers/typescript/member/get-inherited-parent.js.map +1 -1
  318. package/helpers/typescript/node/sort-by-nodes-name.d.ts +4 -2
  319. package/helpers/typescript/node/sort-by-nodes-name.js +6 -3
  320. package/helpers/typescript/node/sort-by-nodes-name.js.map +1 -1
  321. package/helpers/typescript/property/get-property-assignment.js.map +1 -1
  322. package/interfaces/schema.d.ts +1 -0
  323. package/package.json +87 -30
  324. package/parsers/helpers/number.d.ts +1 -1
  325. package/parsers/helpers/number.js +2 -2
  326. package/parsers/helpers/number.js.map +1 -1
  327. package/parsers/helpers/param-value.d.ts +1 -1
  328. package/parsers/helpers/param-value.js +2 -2
  329. package/parsers/helpers/param-value.js.map +1 -1
  330. package/parsers/helpers/param.js +3 -3
  331. package/parsers/helpers/param.js.map +1 -1
  332. package/parsers/parse-code-block-params.d.ts +1 -1
  333. package/parsers/parse-code-block-params.js +22 -16
  334. package/parsers/parse-code-block-params.js.map +1 -1
  335. package/parsers/parse-snippet.js +10 -10
  336. package/parsers/parse-snippet.js.map +1 -1
  337. package/schematics/collection.json +34 -23
  338. package/schematics/migrate-to-vite/analyze.d.ts +76 -0
  339. package/schematics/migrate-to-vite/analyze.js +816 -0
  340. package/schematics/migrate-to-vite/analyze.js.map +1 -0
  341. package/schematics/migrate-to-vite/index.d.ts +9 -0
  342. package/schematics/migrate-to-vite/index.js +585 -0
  343. package/schematics/migrate-to-vite/index.js.map +1 -0
  344. package/schematics/migrate-to-vite/legacy-folder.d.ts +84 -0
  345. package/schematics/migrate-to-vite/legacy-folder.js +340 -0
  346. package/schematics/migrate-to-vite/legacy-folder.js.map +1 -0
  347. package/schematics/migrate-to-vite/report.d.ts +32 -0
  348. package/schematics/migrate-to-vite/report.js +97 -0
  349. package/schematics/migrate-to-vite/report.js.map +1 -0
  350. package/schematics/migrate-to-vite/schema.d.ts +13 -0
  351. package/schematics/migrate-to-vite/schema.js +3 -0
  352. package/schematics/migrate-to-vite/schema.js.map +1 -0
  353. package/schematics/migrate-to-vite/schema.json +31 -0
  354. package/schematics/migrate-to-vite/setup/dependencies.d.ts +64 -0
  355. package/schematics/migrate-to-vite/setup/dependencies.js +183 -0
  356. package/schematics/migrate-to-vite/setup/dependencies.js.map +1 -0
  357. package/schematics/migrate-to-vite/setup/index.d.ts +6 -0
  358. package/schematics/migrate-to-vite/setup/index.js +13 -0
  359. package/schematics/migrate-to-vite/setup/index.js.map +1 -0
  360. package/schematics/migrate-to-vite/setup/json-file.d.ts +51 -0
  361. package/schematics/migrate-to-vite/setup/json-file.js +115 -0
  362. package/schematics/migrate-to-vite/setup/json-file.js.map +1 -0
  363. package/schematics/migrate-to-vite/setup/source.d.ts +30 -0
  364. package/schematics/migrate-to-vite/setup/source.js +202 -0
  365. package/schematics/migrate-to-vite/setup/source.js.map +1 -0
  366. package/schematics/migrate-to-vite/setup/targets.d.ts +51 -0
  367. package/schematics/migrate-to-vite/setup/targets.js +48 -0
  368. package/schematics/migrate-to-vite/setup/targets.js.map +1 -0
  369. package/schematics/migrate-to-vite/setup/vite-config.d.ts +100 -0
  370. package/schematics/migrate-to-vite/setup/vite-config.js +175 -0
  371. package/schematics/migrate-to-vite/setup/vite-config.js.map +1 -0
  372. package/schematics/migrate-to-vite/setup/workspace.d.ts +100 -0
  373. package/schematics/migrate-to-vite/setup/workspace.js +225 -0
  374. package/schematics/migrate-to-vite/setup/workspace.js.map +1 -0
  375. package/schematics/migrate-to-vite/state.d.ts +65 -0
  376. package/schematics/migrate-to-vite/state.js +92 -0
  377. package/schematics/migrate-to-vite/state.js.map +1 -0
  378. package/schematics/migrate-to-vite/testing/fixtures.d.ts +18 -0
  379. package/schematics/migrate-to-vite/testing/fixtures.js +279 -0
  380. package/schematics/migrate-to-vite/testing/fixtures.js.map +1 -0
  381. package/schematics/migrate-to-vite/update-note.d.ts +6 -0
  382. package/schematics/migrate-to-vite/update-note.js +23 -0
  383. package/schematics/migrate-to-vite/update-note.js.map +1 -0
  384. package/schematics/migration.json +5 -0
  385. package/schematics/migrations/standalone-pages/index.js +7 -6
  386. package/schematics/migrations/standalone-pages/index.js.map +1 -1
  387. package/schematics/vite-setup/index.d.ts +20 -0
  388. package/schematics/vite-setup/index.js +206 -0
  389. package/schematics/vite-setup/index.js.map +1 -0
  390. package/schematics/vite-setup/schema.d.ts +7 -0
  391. package/schematics/vite-setup/schema.js +3 -0
  392. package/schematics/vite-setup/schema.js.map +1 -0
  393. package/schematics/vite-setup/schema.json +19 -0
  394. package/scripts/restore-theme.js +9 -2
  395. package/templates/context.ts.nunj +3 -0
  396. package/templates/helpers/badge.html.nunj +1 -1
  397. package/templates/helpers/status.html.nunj +4 -8
  398. package/templates/page-wrapper.ts.nunj +24 -1
  399. package/templates/page.ts.nunj +25 -0
  400. package/templates/parts/page-tags.html.nunj +1 -1
  401. package/templates/playgrounds.ts.nunj +8 -9
  402. package/templates/routes.ts.nunj +6 -1
  403. package/templates/symbol/decorators.html.nunj +12 -0
  404. package/templates/symbol/details.html.nunj +62 -0
  405. package/templates/symbol/extended-by.html.nunj +17 -0
  406. package/templates/symbol/header.html.nunj +22 -0
  407. package/templates/symbol/members.html.nunj +301 -0
  408. package/templates/symbol/page.html.nunj +76 -0
  409. package/templates/symbol/see-also.html.nunj +16 -0
  410. package/engine/.cache/apps/ng-doc/docs/api-documentation/auto-generation/ng-doc.page.mjs +0 -20
  411. package/engine/.cache/apps/ng-doc/docs/api-documentation/documenting-declarations/ng-doc.page.mjs +0 -20
  412. package/engine/.cache/apps/ng-doc/docs/api-documentation/rendering-api/ng-doc.page.mjs +0 -19
  413. package/engine/.cache/apps/ng-doc/docs/customization/icons/ng-doc.page.mjs +0 -19
  414. package/engine/.cache/apps/ng-doc/docs/customization/layout/ng-doc.page.mjs +0 -19
  415. package/engine/.cache/apps/ng-doc/docs/customization/page-processors/ng-doc.page.mjs +0 -19
  416. package/engine/.cache/apps/ng-doc/docs/customization/page-skeleton/ng-doc.page.mjs +0 -19
  417. package/engine/.cache/apps/ng-doc/docs/customization/search/ng-doc.page.mjs +0 -19
  418. package/engine/.cache/apps/ng-doc/docs/customization/themes/ng-doc.page.mjs +0 -19
  419. package/engine/.cache/apps/ng-doc/docs/develop/ng-doc.page.mjs +0 -36
  420. package/engine/.cache/apps/ng-doc/docs/getting-started/configuration/ng-doc.page.mjs +0 -19
  421. package/engine/.cache/apps/ng-doc/docs/getting-started/installation/ng-doc.page.mjs +0 -19
  422. package/engine/.cache/apps/ng-doc/docs/getting-started/migrations/ng-doc.page.mjs +0 -18
  423. package/engine/.cache/apps/ng-doc/docs/getting-started/ssr/ng-doc.page.mjs +0 -19
  424. package/engine/.cache/apps/ng-doc/docs/getting-started/what-is-ng-doc/ng-doc.page.mjs +0 -19
  425. package/engine/.cache/apps/ng-doc/docs/ng-doc.api.mjs +0 -42
  426. package/engine/.cache/apps/ng-doc/docs/recipes/ignoring-file-lines/ng-doc.page.mjs +0 -18
  427. package/engine/.cache/apps/ng-doc/docs/recipes/performance/ng-doc.page.mjs +0 -19
  428. package/engine/.cache/apps/ng-doc/docs/writing-content/blockquotes/ng-doc.page.mjs +0 -18
  429. package/engine/.cache/apps/ng-doc/docs/writing-content/code-blocks/ng-doc.page.mjs +0 -18
  430. package/engine/.cache/apps/ng-doc/docs/writing-content/demo-and-demo-pane/ng-doc.page.mjs +0 -19
  431. package/engine/.cache/apps/ng-doc/docs/writing-content/images-videos-and-embeds/ng-doc.page.mjs +0 -18
  432. package/engine/.cache/apps/ng-doc/docs/writing-content/keywords/ng-doc.page.mjs +0 -17
  433. package/engine/.cache/apps/ng-doc/docs/writing-content/mermaid-diagrams/ng-doc.page.mjs +0 -18
  434. package/engine/.cache/apps/ng-doc/docs/writing-content/nunjucks/ng-doc.page.mjs +0 -18
  435. package/engine/.cache/apps/ng-doc/docs/writing-content/pages-and-categories/ng-doc.page.mjs +0 -18
  436. package/engine/.cache/apps/ng-doc/docs/writing-content/playground/ng-doc.page.mjs +0 -33
  437. package/engine/core/stores/entry-status.d.ts +0 -23
  438. package/engine/core/stores/entry-status.js +0 -36
  439. package/engine/core/stores/entry-status.js.map +0 -1
@@ -0,0 +1,816 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLAIN_MODE = exports.KNOWN_BUILD_OPTIONS = exports.LEGACY_SERVE_BUILDERS = exports.LEGACY_BUILD_BUILDERS = void 0;
4
+ exports.findLegacyTargets = findLegacyTargets;
5
+ exports.analyzeProject = analyzeProject;
6
+ const path_1 = require("path");
7
+ const dependencies_1 = require("./setup/dependencies");
8
+ const source_1 = require("./setup/source");
9
+ const targets_1 = require("./setup/targets");
10
+ const workspace_1 = require("./setup/workspace");
11
+ /** The legacy builders the schematic migrates. */
12
+ exports.LEGACY_BUILD_BUILDERS = ['@ng-doc/builder:application'];
13
+ exports.LEGACY_SERVE_BUILDERS = ['@ng-doc/builder:dev-server'];
14
+ /**
15
+ * Every option of Angular's `application` builder (and NgDoc's `ngDoc` extension) that the
16
+ * schematic knows. Anything else in a build target is reported as unknown.
17
+ */
18
+ exports.KNOWN_BUILD_OPTIONS = [
19
+ 'allowedCommonJsDependencies',
20
+ 'aot',
21
+ 'appShell',
22
+ 'assets',
23
+ 'baseHref',
24
+ 'browser',
25
+ 'budgets',
26
+ 'clearScreen',
27
+ 'conditions',
28
+ 'crossOrigin',
29
+ 'define',
30
+ 'deleteOutputPath',
31
+ 'deployUrl',
32
+ 'externalDependencies',
33
+ 'extractLicenses',
34
+ 'fileReplacements',
35
+ 'i18nDuplicateTranslation',
36
+ 'i18nMissingTranslation',
37
+ 'index',
38
+ 'inlineStyleLanguage',
39
+ 'loader',
40
+ 'localize',
41
+ 'main',
42
+ 'namedChunks',
43
+ 'ngDoc',
44
+ 'optimization',
45
+ 'outputHashing',
46
+ 'outputMode',
47
+ 'outputPath',
48
+ 'poll',
49
+ 'polyfills',
50
+ 'prerender',
51
+ 'preserveSymlinks',
52
+ 'progress',
53
+ 'scripts',
54
+ 'security',
55
+ 'server',
56
+ 'serviceWorker',
57
+ 'sourceMap',
58
+ 'ssr',
59
+ 'statsJson',
60
+ 'stylePreprocessorOptions',
61
+ 'styles',
62
+ 'subresourceIntegrity',
63
+ 'tsConfig',
64
+ 'verbose',
65
+ 'watch',
66
+ 'webWorkerTsConfig',
67
+ ];
68
+ /** The Vite mode that stands for a build target's plain options, when it has no default configuration. */
69
+ exports.PLAIN_MODE = 'default';
70
+ function uniqueName(name, taken) {
71
+ let candidate = name;
72
+ for (let index = 2; taken.includes(candidate); index++)
73
+ candidate = `${name}-${index}`;
74
+ return candidate;
75
+ }
76
+ /** The value of a vite-application flag when a configuration leaves it unset. */
77
+ function defaultFlag(key) {
78
+ return key === 'routes' ? [] : true;
79
+ }
80
+ /** Options without an effect under Vite, or whose Vite default matches the Angular CLI's. */
81
+ const DROPPED = {
82
+ allowedCommonJsDependencies: 'Vite has no CommonJS warning to silence.',
83
+ budgets: 'Vite has no size budgets.',
84
+ clearScreen: 'Vite manages its own terminal output.',
85
+ deleteOutputPath: 'The Vite build empties its output folders.',
86
+ extractLicenses: 'Vite keeps license comments in its output.',
87
+ i18nDuplicateTranslation: 'Only used with `localize`.',
88
+ i18nMissingTranslation: 'Only used with `localize`.',
89
+ namedChunks: 'Vite names chunks by default.',
90
+ optimization: 'Every `vite build` is optimized, in every mode; use the development server for unoptimized code.',
91
+ poll: 'Use Vite `server.watch.usePolling` if you need polling.',
92
+ progress: 'NgDoc reports its own progress (the plugin option `progress`).',
93
+ statsJson: 'Use a Rollup visualizer plugin.',
94
+ verbose: 'Use Vite `logLevel`.',
95
+ watch: 'Use the development server; `vite build --watch` is not supported.',
96
+ };
97
+ /** Options that are not migrated and need a manual change, with the Vite way to do it. */
98
+ const MANUAL = {
99
+ appShell: 'The Vite engine does not build an app shell; prerendered pages replace it.',
100
+ conditions: 'Set Vite `resolve.conditions` if the application needs custom export conditions.',
101
+ crossOrigin: 'Set the `crossorigin` attribute with a Vite plugin or in index.html.',
102
+ deployUrl: 'Vite `base` serves the whole application from one URL; use Vite `experimental.renderBuiltUrl` for a CDN.',
103
+ loader: 'Use Vite `assetsInclude` or a Vite plugin for these file types.',
104
+ preserveSymlinks: 'Set Vite `resolve.preserveSymlinks`.',
105
+ scripts: 'Import the scripts from the browser entry, or add `<script>` tags to index.html.',
106
+ serviceWorker: 'The Vite engine does not build the Angular service worker.',
107
+ subresourceIntegrity: 'Use a Vite plugin to add `integrity` attributes.',
108
+ webWorkerTsConfig: 'Vite bundles workers created with `new Worker(new URL(...))` itself.',
109
+ };
110
+ function isRecord(value) {
111
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
112
+ }
113
+ function asString(value) {
114
+ return typeof value === 'string' && value ? value : undefined;
115
+ }
116
+ function normalizePath(value) {
117
+ const normalized = path_1.posix.normalize(value.replace(/\\/g, '/')).replace(/^\.\/|\/$/g, '');
118
+ return normalized === '.' ? '' : normalized;
119
+ }
120
+ function same(left, right) {
121
+ return JSON.stringify(left) === JSON.stringify(right);
122
+ }
123
+ /** Every option key that appears in a target, in its options or in any configuration. */
124
+ function optionKeys(target) {
125
+ const keys = new Set(Object.keys(target.options ?? {}));
126
+ for (const configuration of Object.values(target.configurations ?? {})) {
127
+ for (const key of Object.keys(configuration ?? {}))
128
+ keys.add(key);
129
+ }
130
+ return [...keys].sort();
131
+ }
132
+ /** The legacy build and serve targets of a project, by name. */
133
+ function findLegacyTargets(project) {
134
+ const names = Object.keys(project.targets);
135
+ const build = names.find((name) => exports.LEGACY_BUILD_BUILDERS.includes((0, workspace_1.targetBuilder)(project.targets[name]) ?? ''));
136
+ const serve = names.find((name) => {
137
+ const target = project.targets[name];
138
+ if (!exports.LEGACY_SERVE_BUILDERS.includes((0, workspace_1.targetBuilder)(target) ?? ''))
139
+ return false;
140
+ const reference = asString((0, workspace_1.resolveTargetOptions)(target, target.defaultConfiguration)['buildTarget']);
141
+ const parsed = reference ? (0, workspace_1.parseTargetString)(reference) : undefined;
142
+ return !parsed || !build || parsed.target === build;
143
+ });
144
+ return { ...(build ? { build } : {}), ...(serve ? { serve } : {}) };
145
+ }
146
+ /** Looks for the NgDoc configuration the legacy engine would load: upward from the browser entry. */
147
+ function findNgDocConfig(tree, browser) {
148
+ let directory = path_1.posix.dirname(browser);
149
+ for (;;) {
150
+ for (const name of ['ng-doc.config.ts', 'ng-doc.config.js']) {
151
+ const candidate = directory === '.' ? name : path_1.posix.join(directory, name);
152
+ if (tree.exists(candidate))
153
+ return candidate;
154
+ }
155
+ if (directory === '.' || directory === '' || directory === '/')
156
+ return undefined;
157
+ directory = path_1.posix.dirname(directory);
158
+ }
159
+ }
160
+ function readBaseHref(tree, index) {
161
+ if (!tree.exists(index))
162
+ return undefined;
163
+ const match = /<base\s[^>]*href\s*=\s*(["'])([^"']*)\1/i.exec(tree.readText(index));
164
+ return match?.[2];
165
+ }
166
+ function fileReplacementsOf(value) {
167
+ if (!Array.isArray(value))
168
+ return [];
169
+ return value.flatMap((entry) => {
170
+ if (!isRecord(entry))
171
+ return [];
172
+ const replace = asString(entry['replace']) ?? asString(entry['src']);
173
+ const replacement = asString(entry['with']) ?? asString(entry['replaceWith']);
174
+ return replace && replacement ? [{ replace, with: replacement }] : [];
175
+ });
176
+ }
177
+ function sourceMapOf(value) {
178
+ if (value === true)
179
+ return true;
180
+ if (!isRecord(value))
181
+ return undefined;
182
+ if (value['scripts'] === false)
183
+ return undefined;
184
+ return value['hidden'] === true ? 'hidden' : true;
185
+ }
186
+ /**
187
+ * Analyzes the legacy `build` and `serve` targets of a project and plans the migration: the Vite
188
+ * setup, the new targets, the targets to retarget and every finding for the report.
189
+ */
190
+ function analyzeProject(tree, project, buildName, serveName, options, builderKey) {
191
+ const findings = [];
192
+ const add = (level, subject, message) => findings.push({ level, subject, message });
193
+ const legacy = project.targets[buildName];
194
+ const legacyBuildName = options.keptBuildName ?? `${buildName}-legacy`;
195
+ const modes = Object.keys(legacy.configurations ?? {});
196
+ const defaultConfiguration = legacy.defaultConfiguration;
197
+ // Nx interpolates `{workspaceRoot}`, `{projectRoot}` and `{projectName}` in options; the Vite
198
+ // configuration gets the resolved paths, the new targets keep the tokens.
199
+ const nx = (value) => value
200
+ .replace(/\{workspaceRoot\}\/?/g, '')
201
+ .replace(/\{projectRoot\}/g, project.root || '.')
202
+ .replace(/\{projectName\}/g, project.name);
203
+ const interpolate = (value) => typeof value === 'string'
204
+ ? nx(value)
205
+ : Array.isArray(value)
206
+ ? value.map((item) => interpolate(item))
207
+ : isRecord(value)
208
+ ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, interpolate(item)]))
209
+ : value;
210
+ const resolve = (configuration) => interpolate((0, workspace_1.resolveTargetOptions)(legacy, configuration));
211
+ const base = resolve(defaultConfiguration);
212
+ const perMode = Object.fromEntries(modes.map((mode) => [mode, resolve(mode)]));
213
+ const plain = resolve(undefined);
214
+ // Without a default configuration, `ng build` runs the plain options. The Vite target runs them
215
+ // as a mode no configuration is named after, which the generated configuration maps to them.
216
+ const plainMode = modes.length && !defaultConfiguration ? uniqueName(exports.PLAIN_MODE, modes) : undefined;
217
+ // Options that must be the same in every configuration: the application, not a mode, owns them.
218
+ const fixed = (option) => {
219
+ const values = [plain, ...Object.values(perMode)].map((resolved) => resolved[option]);
220
+ if (values.some((value) => !same(value, values[0]))) {
221
+ add('manual', `build.${option}`, `differs between the configurations; the configuration uses the value of ${defaultConfiguration ? `\`${defaultConfiguration}\`` : 'the target options'}. Move the other values into a mode-specific Vite setting by hand.`);
222
+ }
223
+ return base[option];
224
+ };
225
+ const sourceRoot = project.sourceRoot;
226
+ const browser = normalizePath(asString(fixed('browser')) ?? asString(fixed('main')) ?? path_1.posix.join(sourceRoot, 'main.ts'));
227
+ add('migrated', 'build.browser', `\`browser: '${browser}'\` of createNgDocApplicationPlugin.`);
228
+ const serverValue = fixed('server');
229
+ const server = asString(serverValue) ? normalizePath(asString(serverValue)) : undefined;
230
+ const serverModule = server ? (0, source_1.serverEntryNgModule)(tree, server) : undefined;
231
+ if (serverModule) {
232
+ add('blocking', 'build.server', `[NGDOC_MIGRATE_SERVER_NGMODULE] \`${server}\` exports the NgModule \`${serverModule}\` as its default export. The Vite engine prerenders with \`renderApplication\`, which needs a bootstrap function: export \`(context) => bootstrapApplication(App, config, context)\` instead (a standalone application), or keep the legacy builders.`);
233
+ }
234
+ else if (server) {
235
+ add('migrated', 'build.server', `\`server: '${server}'\` of createNgDocApplicationPlugin.`);
236
+ }
237
+ const indexValue = fixed('index');
238
+ let index = path_1.posix.join(sourceRoot, 'index.html');
239
+ if (indexValue === false) {
240
+ add('blocking', 'build.index', 'is `false`; the Vite engine needs an index.html.');
241
+ }
242
+ else if (asString(indexValue) || isRecord(indexValue)) {
243
+ index = normalizePath(asString(indexValue) ?? asString(indexValue['input']) ?? index);
244
+ }
245
+ if (path_1.posix.basename(index) !== 'index.html') {
246
+ add('blocking', 'build.index', `is \`${index}\`; Vite loads \`index.html\` from its root. Rename the file to index.html first.`);
247
+ }
248
+ const root = normalizePath(path_1.posix.dirname(index));
249
+ add('migrated', 'build.index', `Vite \`root\`: \`${root || '.'}\`.`);
250
+ const polyfillsValue = fixed('polyfills');
251
+ const polyfills = (Array.isArray(polyfillsValue)
252
+ ? polyfillsValue
253
+ : asString(polyfillsValue)
254
+ ? [polyfillsValue]
255
+ : []).filter((item) => typeof item === 'string');
256
+ if (polyfills.length)
257
+ add('migrated', 'build.polyfills', '`polyfills` of createNgDocApplicationPlugin.');
258
+ const styles = [];
259
+ const stylesValue = fixed('styles');
260
+ for (const entry of Array.isArray(stylesValue) ? stylesValue : []) {
261
+ if (typeof entry === 'string')
262
+ styles.push(entry);
263
+ else if (isRecord(entry) && asString(entry['input'])) {
264
+ if (entry['inject'] === false || entry['bundleName'] !== undefined) {
265
+ add('manual', 'build.styles', `\`${entry['input']}\` is a separate style bundle; the Vite engine injects every global style. Load it from the application instead.`);
266
+ }
267
+ else
268
+ styles.push(asString(entry['input']));
269
+ }
270
+ }
271
+ if (styles.length)
272
+ add('migrated', 'build.styles', '`styles` of createNgDocApplicationPlugin.');
273
+ const outDirLiteral = legacyOutDir(tree, project, browser, base);
274
+ const legacyOutput = outDirLiteral === null ? undefined : path_1.posix.join(outDirLiteral, 'ng-doc', project.name);
275
+ const generatedAssets = new Set([
276
+ path_1.posix.join('ng-doc', project.name, 'assets'),
277
+ legacyOutput && path_1.posix.join(legacyOutput, 'assets'),
278
+ ].filter((item) => !!item));
279
+ const assets = [];
280
+ const assetsValue = fixed('assets');
281
+ for (const entry of Array.isArray(assetsValue) ? assetsValue : []) {
282
+ if (typeof entry === 'string') {
283
+ assets.push(entry);
284
+ continue;
285
+ }
286
+ if (!isRecord(entry) || !asString(entry['glob']) || !asString(entry['input']))
287
+ continue;
288
+ const input = asString(entry['input']);
289
+ if (generatedAssets.has(normalizePath(input))) {
290
+ add('dropped', 'build.assets', `\`${input}\`: the NgDoc Vite plugin serves and emits the generated assets itself.`);
291
+ continue;
292
+ }
293
+ if (entry['followSymlinks'] === true) {
294
+ add('manual', 'build.assets', `\`${input}\` follows symbolic links; the Vite engine copies files only.`);
295
+ }
296
+ const ignore = Array.isArray(entry['ignore'])
297
+ ? entry['ignore'].filter((item) => typeof item === 'string')
298
+ : undefined;
299
+ assets.push({
300
+ glob: asString(entry['glob']),
301
+ input,
302
+ ...(asString(entry['output']) ? { output: asString(entry['output']) } : {}),
303
+ ...(ignore?.length ? { ignore } : {}),
304
+ });
305
+ }
306
+ if (assets.length)
307
+ add('migrated', 'build.assets', '`assets` of createNgDocApplicationPlugin.');
308
+ const inlineStyleLanguage = asString(fixed('inlineStyleLanguage'));
309
+ if (inlineStyleLanguage) {
310
+ add('migrated', 'build.inlineStyleLanguage', `\`inlineStylesExtension: '${inlineStyleLanguage}'\` of createNgDocAngularPlugins.`);
311
+ }
312
+ const stylePreprocessorOptions = fixed('stylePreprocessorOptions');
313
+ const loadPaths = [];
314
+ if (isRecord(stylePreprocessorOptions)) {
315
+ for (const [key, value] of Object.entries(stylePreprocessorOptions)) {
316
+ if (key === 'includePaths' && Array.isArray(value)) {
317
+ loadPaths.push(...value.filter((item) => typeof item === 'string'));
318
+ add('migrated', 'build.stylePreprocessorOptions.includePaths', 'Vite `css.preprocessorOptions.scss.loadPaths`.');
319
+ }
320
+ else {
321
+ add('manual', `build.stylePreprocessorOptions.${key}`, 'Set it in Vite `css.preprocessorOptions`.');
322
+ }
323
+ }
324
+ }
325
+ const externalValue = fixed('externalDependencies');
326
+ const externalDependencies = Array.isArray(externalValue)
327
+ ? externalValue.filter((item) => typeof item === 'string')
328
+ : [];
329
+ if (externalDependencies.length) {
330
+ add('migrated', 'build.externalDependencies', 'Vite `build.rolldownOptions.external`.');
331
+ }
332
+ const rawOutputPath = (0, workspace_1.resolveTargetOptions)(legacy, defaultConfiguration)['outputPath'];
333
+ const targetOutputPath = typeof rawOutputPath === 'string'
334
+ ? rawOutputPath
335
+ : isRecord(rawOutputPath) && typeof rawOutputPath['base'] === 'string'
336
+ ? rawOutputPath['base']
337
+ : undefined;
338
+ const outputPathValue = fixed('outputPath');
339
+ let outputPath = `dist/${project.name}`;
340
+ if (asString(outputPathValue))
341
+ outputPath = normalizePath(asString(outputPathValue));
342
+ else if (isRecord(outputPathValue) && asString(outputPathValue['base'])) {
343
+ outputPath = normalizePath(asString(outputPathValue['base']));
344
+ for (const [key, standard] of [
345
+ ['browser', 'browser'],
346
+ ['server', 'server'],
347
+ ['media', 'media'],
348
+ ]) {
349
+ const custom = outputPathValue[key];
350
+ if (typeof custom === 'string' && custom !== standard) {
351
+ add('manual', `build.outputPath.${key}`, `is \`${custom}\`; the Vite engine always writes \`${standard}/\`.`);
352
+ }
353
+ }
354
+ }
355
+ add('migrated', 'build.outputPath', `\`outputPath\` of the vite-application target.`);
356
+ // The settings a Vite mode may change, one per build configuration.
357
+ const indexBase = readBaseHref(tree, index);
358
+ const tsConfigDefault = path_1.posix.join(project.root, 'tsconfig.app.json');
359
+ const modeSettings = (resolved) => {
360
+ const baseHref = asString(resolved['baseHref']) ?? indexBase;
361
+ const define = isRecord(resolved['define'])
362
+ ? Object.fromEntries(Object.entries(resolved['define']).filter(([, value]) => typeof value === 'string'))
363
+ : undefined;
364
+ return {
365
+ tsconfig: normalizePath(asString(resolved['tsConfig']) ?? tsConfigDefault),
366
+ fileReplacements: fileReplacementsOf(resolved['fileReplacements']),
367
+ ...(baseHref && baseHref.startsWith('/') && baseHref !== '/'
368
+ ? { base: baseHref.replace(/\/?$/, '/') }
369
+ : {}),
370
+ ...(sourceMapOf(resolved['sourceMap'])
371
+ ? { sourcemap: sourceMapOf(resolved['sourceMap']) }
372
+ : {}),
373
+ ...(define && Object.keys(define).length ? { define } : {}),
374
+ };
375
+ };
376
+ const byMode = Object.fromEntries(modes.map((mode) => [mode, modeSettings(perMode[mode])]));
377
+ for (const resolved of [plain, ...Object.values(perMode)]) {
378
+ const baseHref = asString(resolved['baseHref']);
379
+ if (baseHref && !baseHref.startsWith('/')) {
380
+ add('manual', 'build.baseHref', `\`${baseHref}\` is not absolute; set Vite \`base\` by hand.`);
381
+ }
382
+ if (isRecord(resolved['sourceMap']) &&
383
+ (resolved['sourceMap']['styles'] !== undefined ||
384
+ resolved['sourceMap']['vendor'] !== undefined)) {
385
+ add('manual', 'build.sourceMap', 'Vite `build.sourcemap` covers scripts only; `styles` and `vendor` are not migrated.');
386
+ }
387
+ }
388
+ for (const [option, target] of [
389
+ ['tsConfig', '`tsconfig` of createNgDocAngularPlugins and the generator'],
390
+ ['fileReplacements', '`fileReplacements` of createNgDocAngularPlugins, per Vite mode'],
391
+ ['baseHref', 'Vite `base`'],
392
+ ['sourceMap', 'Vite `build.sourcemap`'],
393
+ ['define', 'Vite `define`'],
394
+ ]) {
395
+ if (optionKeys(legacy).includes(option))
396
+ add('migrated', `build.${option}`, `${target}.`);
397
+ }
398
+ // ngDoc: the configuration file, the only option of the legacy builders.
399
+ const ngDoc = isRecord(base['ngDoc']) ? base['ngDoc'] : {};
400
+ for (const key of Object.keys(ngDoc)) {
401
+ if (key !== 'config') {
402
+ add('manual', `build.ngDoc.${key}`, 'is not an option of the Vite engine.');
403
+ }
404
+ }
405
+ const ngDocConfig = asString(ngDoc['config'])
406
+ ? normalizePath(asString(ngDoc['config']))
407
+ : findNgDocConfig(tree, browser);
408
+ if (ngDocConfig) {
409
+ add('migrated', 'ngDoc.config', `\`generator.configFile\`: \`${ngDocConfig}\`.`);
410
+ }
411
+ else {
412
+ add('dropped', 'ngDoc.config', 'No ng-doc.config.ts was found; the engine uses its defaults.');
413
+ }
414
+ add('dropped', 'onlyForTags', 'The Vite engine applies `onlyForTags` of pages and categories, with the Vite mode as the build tag (the legacy engine ignored it).');
415
+ // Server rendering, prerendering and the output mode, per configuration: the target's options
416
+ // get the flags of the plain options, and a configuration only the flags it changes.
417
+ const renderFlags = (resolved) => {
418
+ const flags = {};
419
+ if (!server)
420
+ return flags;
421
+ const outputMode = asString(resolved['outputMode']);
422
+ const ssr = resolved['ssr'];
423
+ const prerender = resolved['prerender'];
424
+ const onRequest = outputMode === 'server' || (!outputMode && !!ssr && prerender === false);
425
+ if (onRequest) {
426
+ add('manual', 'build.outputMode', 'The Angular server that renders on request is not built. The vite-application target builds the server bundle and prerenders every route into `browser/`: deploy it as a static site' +
427
+ (options.keptBuildName
428
+ ? '.'
429
+ : `, or keep the \`${legacyBuildName}\` target for the server.`));
430
+ }
431
+ else if (!outputMode && prerender === false) {
432
+ // No prerendering, as in the legacy build; without `ssr` no server bundle either.
433
+ flags.prerender = false;
434
+ if (!ssr)
435
+ flags.ssr = false;
436
+ }
437
+ if (isRecord(ssr) && asString(ssr['entry'])) {
438
+ add('manual', 'build.ssr.entry', `\`${ssr['entry']}\` is not built. The server bundle is \`server/server.mjs\` with the application's render entry, not a web server.`);
439
+ }
440
+ if (outputMode) {
441
+ add('dropped', 'serverRoutes', 'Server route render modes (`app.routes.server.ts`) do not apply: every concrete route is prerendered.');
442
+ }
443
+ if (isRecord(prerender)) {
444
+ if (prerender['discoverRoutes'] === false)
445
+ flags.discoverRoutes = false;
446
+ const routesFile = asString(prerender['routesFile']);
447
+ if (routesFile) {
448
+ const file = normalizePath(nx(routesFile));
449
+ if (tree.exists(file)) {
450
+ flags.routes = tree
451
+ .readText(file)
452
+ .split(/\r?\n/)
453
+ .map((line) => line.trim())
454
+ .filter(Boolean);
455
+ add('migrated', 'build.prerender.routesFile', `its ${flags.routes.length} route(s) became \`routes\` of the vite-application target.`);
456
+ }
457
+ else {
458
+ add('manual', 'build.prerender.routesFile', `\`${routesFile}\` does not exist; add its routes to \`routes\` of the vite-application target.`);
459
+ }
460
+ }
461
+ }
462
+ add('migrated', 'build.prerender', flags.prerender === false
463
+ ? 'is `false`: the vite-application target does not prerender either.'
464
+ : 'The vite-application target builds the server bundle and prerenders every route.');
465
+ return flags;
466
+ };
467
+ const buildOptions = renderFlags(plain);
468
+ const buildConfigurations = Object.fromEntries(modes.map((mode) => {
469
+ const flags = renderFlags(perMode[mode]);
470
+ const changed = Object.fromEntries([...new Set([...Object.keys(flags), ...Object.keys(buildOptions)])]
471
+ .filter((key) => !same(flags[key], buildOptions[key]))
472
+ .map((key) => [key, flags[key] ?? defaultFlag(key)]));
473
+ return [mode, changed];
474
+ }));
475
+ if (!server &&
476
+ [plain, ...Object.values(perMode)].some((item) => item['prerender'] || item['ssr'])) {
477
+ add('manual', 'build.prerender', 'needs a `server` entry; without one the Vite engine builds the browser application only.');
478
+ }
479
+ for (const key of ['ssr', 'outputMode']) {
480
+ if (optionKeys(legacy).includes(key) && !server)
481
+ add('dropped', `build.${key}`, 'There is no server entry.');
482
+ }
483
+ // The remaining options: dropped, manual or blocking.
484
+ const handled = new Set([
485
+ 'browser',
486
+ 'main',
487
+ 'server',
488
+ 'index',
489
+ 'polyfills',
490
+ 'styles',
491
+ 'assets',
492
+ 'inlineStyleLanguage',
493
+ 'stylePreprocessorOptions',
494
+ 'externalDependencies',
495
+ 'outputPath',
496
+ 'tsConfig',
497
+ 'fileReplacements',
498
+ 'baseHref',
499
+ 'sourceMap',
500
+ 'define',
501
+ 'ngDoc',
502
+ 'ssr',
503
+ 'prerender',
504
+ 'outputMode',
505
+ ]);
506
+ for (const option of optionKeys(legacy).filter((key) => !handled.has(key))) {
507
+ const values = [plain, ...Object.values(perMode)].map((resolved) => resolved[option]);
508
+ const active = values.filter((value) => value !== undefined && value !== false);
509
+ if (option === 'localize') {
510
+ if (active.length && !values.every((value) => Array.isArray(value) && !value.length)) {
511
+ add('blocking', 'build.localize', 'The Vite engine does not build localized applications. Keep the legacy builders.');
512
+ }
513
+ else
514
+ add('dropped', 'build.localize', 'Localization is off.');
515
+ }
516
+ else if (option === 'aot') {
517
+ if (values.includes(false))
518
+ add('manual', 'build.aot', 'Analog always compiles ahead of time.');
519
+ else
520
+ add('dropped', 'build.aot', 'Analog always compiles ahead of time.');
521
+ }
522
+ else if (option === 'outputHashing') {
523
+ if (values.some((value) => value !== undefined && value !== 'all')) {
524
+ add('manual', 'build.outputHashing', 'Vite hashes every output file name; change `build.rolldownOptions.output` to name files differently.');
525
+ }
526
+ else
527
+ add('dropped', 'build.outputHashing', 'Vite hashes the output file names by default.');
528
+ }
529
+ else if (option === 'scripts') {
530
+ if (values.some((value) => Array.isArray(value) && value.length))
531
+ add('manual', 'build.scripts', MANUAL['scripts']);
532
+ else
533
+ add('dropped', 'build.scripts', 'The list is empty.');
534
+ }
535
+ else if (option === 'serviceWorker') {
536
+ if (active.length)
537
+ add('manual', 'build.serviceWorker', MANUAL['serviceWorker']);
538
+ else
539
+ add('dropped', 'build.serviceWorker', 'The service worker is off.');
540
+ }
541
+ else if (option === 'security') {
542
+ const autoCsp = values.some((value) => isRecord(value) && value['autoCsp']);
543
+ if (autoCsp)
544
+ add('manual', 'build.security.autoCsp', 'Add a Content Security Policy with a Vite plugin or at the web server.');
545
+ add('dropped', 'build.security', 'The Angular server options (`allowedHosts`) do not apply to prerendered output.');
546
+ }
547
+ else if (option in DROPPED) {
548
+ add('dropped', `build.${option}`, DROPPED[option]);
549
+ }
550
+ else if (option in MANUAL) {
551
+ add(active.length ? 'manual' : 'dropped', `build.${option}`, MANUAL[option]);
552
+ }
553
+ else {
554
+ add('manual', `build.${option}`, 'is not a known option of the Angular application builder and was not migrated.');
555
+ }
556
+ }
557
+ // i18n in the project itself.
558
+ if (isRecord(project.i18n) &&
559
+ isRecord(project.i18n['locales']) &&
560
+ Object.keys(project.i18n['locales']).length) {
561
+ add('manual', 'project.i18n', 'The project defines locales; the Vite engine builds the source locale only.');
562
+ }
563
+ // The serve target.
564
+ const serveSettings = serveName
565
+ ? analyzeServe(project, serveName, buildName, legacy, add, plainMode)
566
+ : undefined;
567
+ // The root component and the configuration file.
568
+ const rootComponent = options.rootComponent
569
+ ? normalizePath(options.rootComponent)
570
+ : (0, source_1.findRootComponent)(tree, browser);
571
+ if (!rootComponent) {
572
+ add('blocking', 'rootComponent', `The root component could not be found from \`${browser}\`. Run the schematic again with \`--root-component <file>\`.`);
573
+ }
574
+ else if (!tree.exists(rootComponent)) {
575
+ add('blocking', 'rootComponent', `\`${rootComponent}\` does not exist.`);
576
+ }
577
+ const configFile = normalizePath(options.viteConfig ?? path_1.posix.join(project.root, 'vite.config.mjs'));
578
+ // The tsconfig must still map @ng-doc/generated to the generated folder.
579
+ const tsconfig = modeSettings(base).tsconfig;
580
+ const paths = (0, dependencies_1.readTsconfigPaths)(tree, tsconfig);
581
+ if (!paths?.['@ng-doc/generated']) {
582
+ add('manual', 'tsconfig', `\`${tsconfig}\` maps no \`@ng-doc/generated\` path; map it to \`./${path_1.posix.join('ng-doc', project.name, 'index.ts')}\`.`);
583
+ }
584
+ else {
585
+ add('dropped', 'tsconfig', '`@ng-doc/generated` keeps pointing at the generated folder, which the Vite engine writes.');
586
+ }
587
+ const setup = {
588
+ project: project.name,
589
+ configFile,
590
+ root,
591
+ sourceRoot,
592
+ browser,
593
+ ...(server ? { server } : {}),
594
+ polyfills,
595
+ styles,
596
+ assets,
597
+ ...(inlineStyleLanguage && inlineStyleLanguage !== 'css'
598
+ ? { inlineStylesExtension: inlineStyleLanguage }
599
+ : {}),
600
+ loadPaths,
601
+ externalDependencies,
602
+ outputPath,
603
+ rootComponent: rootComponent ?? '',
604
+ ...(ngDocConfig ? { ngDocConfig } : {}),
605
+ docsRoot: normalizePath(path_1.posix.dirname(browser)),
606
+ outputRoot: path_1.posix.join('ng-doc', project.name),
607
+ cacheRoot: path_1.posix.join('.cache/ng-doc', project.name),
608
+ ...(serveSettings?.devServer ? { devServer: serveSettings.devServer } : {}),
609
+ modes: { byMode, fallback: modeSettings(plain) },
610
+ };
611
+ const keep = (target) => Object.fromEntries(Object.entries(target ?? {}).filter(([key]) => !['builder', 'executor', 'options', 'configurations', 'defaultConfiguration'].includes(key)));
612
+ const targets = (0, targets_1.createNgDocViteTargets)({
613
+ configFile,
614
+ outputPath: targetOutputPath ?? outputPath,
615
+ modes,
616
+ ...(defaultConfiguration ? { defaultConfiguration } : {}),
617
+ ...(plainMode ? { buildMode: plainMode } : {}),
618
+ build: buildOptions,
619
+ buildConfigurations,
620
+ serveModes: serveSettings?.modes ?? {},
621
+ ...(serveSettings?.mode ? { serveMode: serveSettings.mode } : {}),
622
+ ...(serveName && project.targets[serveName]?.defaultConfiguration
623
+ ? { serveDefaultConfiguration: project.targets[serveName].defaultConfiguration }
624
+ : {}),
625
+ ...(serveSettings?.host ? { host: serveSettings.host } : {}),
626
+ ...(serveSettings?.port !== undefined ? { port: serveSettings.port } : {}),
627
+ builderKey,
628
+ keepBuild: keep(legacy),
629
+ keepServe: keep(serveName ? project.targets[serveName] : undefined),
630
+ });
631
+ const retargets = findRetargets(project, buildName, legacyBuildName, legacy);
632
+ for (const retarget of retargets) {
633
+ add('migrated', `${retarget.target}.buildTarget`, `now \`${retarget.after}\`, so the Angular builder keeps reading the original build options.`);
634
+ }
635
+ return {
636
+ project,
637
+ build: { name: buildName, legacyName: legacyBuildName, legacy, next: targets.build },
638
+ ...(serveName
639
+ ? {
640
+ serve: {
641
+ name: serveName,
642
+ legacyName: `${serveName}-legacy`,
643
+ legacy: project.targets[serveName],
644
+ next: targets.serve,
645
+ },
646
+ }
647
+ : {}),
648
+ setup,
649
+ retargets,
650
+ ...(legacyOutput ? { legacyOutput } : {}),
651
+ findings,
652
+ };
653
+ }
654
+ /**
655
+ * Reads `outDir` of the NgDoc configuration when it is a string literal, the only form a schematic
656
+ * can evaluate; `null` when the configuration sets it some other way.
657
+ */
658
+ function legacyOutDir(tree, project, browser, options) {
659
+ const ngDoc = isRecord(options['ngDoc']) ? options['ngDoc'] : {};
660
+ const file = asString(ngDoc['config'])
661
+ ? normalizePath(asString(ngDoc['config']))
662
+ : findNgDocConfig(tree, browser);
663
+ if (!file || !tree.exists(file))
664
+ return '';
665
+ const text = tree.readText(file);
666
+ if (!/\boutDir\b/.test(text))
667
+ return '';
668
+ const literal = /\boutDir\s*:\s*(['"`])([^'"`$]*)\1/.exec(text);
669
+ return literal ? normalizePath(literal[2]) : null;
670
+ }
671
+ function analyzeServe(project, serveName, buildName, build, add, plainMode) {
672
+ const serve = project.targets[serveName];
673
+ const buildModes = Object.keys(build.configurations ?? {});
674
+ const modeOf = (reference, subject) => {
675
+ const parsed = asString(reference) ? (0, workspace_1.parseTargetString)(asString(reference)) : undefined;
676
+ if (!parsed)
677
+ return undefined;
678
+ if ((parsed.project && parsed.project !== project.name) ||
679
+ (parsed.target && parsed.target !== buildName)) {
680
+ add('manual', subject, `\`${reference}\` is not the migrated build target; the development server uses this project's Vite configuration.`);
681
+ return undefined;
682
+ }
683
+ // Without a configuration, Architect runs the build target's default configuration, or its
684
+ // plain options.
685
+ const configuration = parsed.configuration?.split(',')[0] ?? build.defaultConfiguration;
686
+ return configuration && buildModes.includes(configuration) ? configuration : plainMode;
687
+ };
688
+ const modes = {};
689
+ for (const [name, configuration] of Object.entries(serve.configurations ?? {})) {
690
+ const mode = modeOf(configuration?.['buildTarget'], `${serveName}.configurations.${name}.buildTarget`);
691
+ if (mode)
692
+ modes[name] = mode;
693
+ }
694
+ const mode = modeOf(serve.options?.['buildTarget'], `${serveName}.buildTarget`);
695
+ if (Object.keys(modes).length || mode) {
696
+ add('migrated', `${serveName}.buildTarget`, 'Each serve configuration sets the Vite mode of its build configuration.');
697
+ }
698
+ const devServer = {};
699
+ const plain = (0, workspace_1.resolveTargetOptions)(serve, serve.defaultConfiguration);
700
+ let host;
701
+ let port;
702
+ const keys = optionKeys(serve).filter((key) => key !== 'buildTarget');
703
+ for (const key of keys) {
704
+ const value = plain[key];
705
+ const subject = `${serveName}.${key}`;
706
+ switch (key) {
707
+ case 'host':
708
+ host = asString(value);
709
+ add('migrated', subject, '`host` of the vite-dev-server target.');
710
+ break;
711
+ case 'port':
712
+ port = typeof value === 'number' ? value : undefined;
713
+ add('migrated', subject, '`port` of the vite-dev-server target.');
714
+ break;
715
+ case 'headers':
716
+ if (isRecord(value)) {
717
+ devServer.headers = Object.fromEntries(Object.entries(value).filter(([, item]) => typeof item === 'string'));
718
+ add('migrated', subject, 'Vite `server.headers`.');
719
+ }
720
+ break;
721
+ case 'open':
722
+ if (value === true)
723
+ devServer.open = true;
724
+ add('migrated', subject, 'Vite `server.open`.');
725
+ break;
726
+ case 'allowedHosts':
727
+ if (value === true)
728
+ devServer.allowedHosts = true;
729
+ else if (Array.isArray(value) && value.length) {
730
+ devServer.allowedHosts = value.filter((item) => typeof item === 'string');
731
+ }
732
+ add('migrated', subject, 'Vite `server.allowedHosts`.');
733
+ break;
734
+ case 'hmr':
735
+ case 'liveReload':
736
+ case 'watch':
737
+ if (value === false) {
738
+ add('manual', subject, 'is `false`; the Vite engine needs file watching and hot module replacement, so it is ignored.');
739
+ }
740
+ else
741
+ add('dropped', subject, 'The Vite engine always watches and reloads.');
742
+ break;
743
+ case 'prebundle':
744
+ case 'verbose':
745
+ add('dropped', subject, 'Vite prebundles dependencies and logs by its own settings.');
746
+ break;
747
+ case 'ngDoc':
748
+ add('manual', subject, 'The development server uses the NgDoc settings of the build target.');
749
+ break;
750
+ case 'proxyConfig':
751
+ add('manual', subject, `\`${value}\`: move the proxy rules to Vite \`server.proxy\`.`);
752
+ break;
753
+ case 'ssl':
754
+ case 'sslKey':
755
+ case 'sslCert':
756
+ add('manual', subject, 'Set Vite `server.https` with the key and certificate.');
757
+ break;
758
+ default:
759
+ add('manual', subject, 'is not migrated to the Vite development server.');
760
+ }
761
+ }
762
+ return {
763
+ modes,
764
+ ...(mode ? { mode } : {}),
765
+ ...(host ? { host } : {}),
766
+ ...(port !== undefined ? { port } : {}),
767
+ ...(Object.keys(devServer).length ? { devServer } : {}),
768
+ };
769
+ }
770
+ /** Angular builders that read a build target's options and default to the project's `build`. */
771
+ const DEFAULT_BUILD_TARGET = {
772
+ '@angular/build:extract-i18n': '',
773
+ '@angular-devkit/build-angular:extract-i18n': '',
774
+ '@angular/build:unit-test': 'development',
775
+ };
776
+ /**
777
+ * The other targets of the project whose Angular builder reads the build target's options: their
778
+ * `buildTarget` (explicit, or the builder's default of `build`) must name the legacy target, which
779
+ * keeps the Angular options.
780
+ */
781
+ function findRetargets(project, buildName, legacyName, build) {
782
+ const retargets = [];
783
+ for (const [name, target] of Object.entries(project.targets)) {
784
+ const builder = (0, workspace_1.targetBuilder)(target) ?? '';
785
+ if (!target ||
786
+ exports.LEGACY_BUILD_BUILDERS.includes(builder) ||
787
+ exports.LEGACY_SERVE_BUILDERS.includes(builder))
788
+ continue;
789
+ if (!builder.startsWith('@angular/build:') &&
790
+ !builder.startsWith('@angular-devkit/build-angular:'))
791
+ continue;
792
+ const explicit = asString(target.options?.['buildTarget']);
793
+ if (explicit) {
794
+ const parsed = (0, workspace_1.parseTargetString)(explicit);
795
+ if (parsed &&
796
+ (parsed.project === '' || parsed.project === project.name) &&
797
+ parsed.target === buildName) {
798
+ retargets.push({
799
+ target: name,
800
+ before: explicit,
801
+ after: `${project.name}:${legacyName}${parsed.configuration ? `:${parsed.configuration}` : ''}`,
802
+ });
803
+ }
804
+ }
805
+ else if (builder in DEFAULT_BUILD_TARGET && buildName === 'build') {
806
+ const configuration = DEFAULT_BUILD_TARGET[builder];
807
+ const known = configuration && Object.keys(build.configurations ?? {}).includes(configuration);
808
+ retargets.push({
809
+ target: name,
810
+ after: `${project.name}:${legacyName}${known ? `:${configuration}` : ''}`,
811
+ });
812
+ }
813
+ }
814
+ return retargets;
815
+ }
816
+ //# sourceMappingURL=analyze.js.map