@ng-doc/builder 22.0.0-beta.2 → 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.
- package/README.md +19 -28
- package/application/index.js +2 -2
- package/application/index.js.map +1 -1
- package/application/schema.json +1 -2
- package/builders.json +23 -13
- package/classes/observable-map.d.ts +1 -0
- package/classes/observable-map.js +14 -3
- package/classes/observable-map.js.map +1 -1
- package/classes/observable-set.js +2 -1
- package/classes/observable-set.js.map +1 -1
- package/dev-server/index.js +5 -3
- package/dev-server/index.js.map +1 -1
- package/engine/builders/api-list/api-list-component.builder.js +4 -4
- package/engine/builders/api-list/api-list-component.builder.js.map +1 -1
- package/engine/builders/api-list/api-page-template.builder.js +2 -2
- package/engine/builders/api-list/api-page-template.builder.js.map +1 -1
- package/engine/builders/global/keywords.builder.d.ts +1 -4
- package/engine/builders/global/keywords.builder.js +5 -9
- package/engine/builders/global/keywords.builder.js.map +1 -1
- package/engine/builders/global/search-indexes.builder.js +1 -1
- package/engine/builders/global/search-indexes.builder.js.map +1 -1
- package/engine/builders/helpers/create-entry-metadata.js +2 -1
- package/engine/builders/helpers/create-entry-metadata.js.map +1 -1
- package/engine/builders/helpers/create-import-path.js.map +1 -1
- package/engine/builders/helpers/get-entry-relative-path.js.map +1 -1
- package/engine/builders/page/demo-assets.builder.js +8 -5
- package/engine/builders/page/demo-assets.builder.js.map +1 -1
- package/engine/builders/page/playground.builder.js +1 -0
- package/engine/builders/page/playground.builder.js.map +1 -1
- package/engine/builders/shared/content.builder.js +3 -3
- package/engine/builders/shared/content.builder.js.map +1 -1
- package/engine/builders/shared/page-component.builder.js +16 -6
- package/engine/builders/shared/page-component.builder.js.map +1 -1
- package/engine/builders/shared/page-wrapper.builder.js +8 -5
- package/engine/builders/shared/page-wrapper.builder.js.map +1 -1
- package/engine/core/operators/distinct-pending.js.map +1 -1
- package/engine/core/operators/factory.js +1 -4
- package/engine/core/operators/factory.js.map +1 -1
- package/engine/core/operators/merge-factory.js +19 -17
- package/engine/core/operators/merge-factory.js.map +1 -1
- package/engine/core/operators/when-builders-done.js.map +1 -1
- package/engine/core/triggers/on-dependencies-change.d.ts +1 -1
- package/engine/core/triggers/on-dependencies-change.js +2 -2
- package/engine/core/triggers/on-dependencies-change.js.map +1 -1
- package/generator/artifacts/index.d.ts +317 -0
- package/generator/bootstrap/bin.d.ts +18 -0
- package/generator/bootstrap/bin.js +7274 -0
- package/generator/bootstrap/candidate-output-committer.d.ts +12 -0
- package/generator/bootstrap/cli.d.ts +42 -0
- package/generator/bootstrap/cli.js +7123 -0
- package/generator/bootstrap/constants.d.ts +4 -0
- package/generator/bootstrap/index.d.ts +111 -0
- package/generator/bootstrap/index.js +5020 -0
- package/generator/bootstrap/prerender-command.d.ts +31 -0
- package/generator/bootstrap/process-tree.d.ts +49 -0
- package/generator/build-metafile.json +11701 -0
- package/generator/build-provenance.json +119 -0
- package/generator/compiler/assemble.d.ts +41 -0
- package/generator/compiler/classify.d.ts +161 -0
- package/generator/compiler/closure-store.d.ts +55 -0
- package/generator/compiler/common.d.ts +32 -0
- package/generator/compiler/describe.d.ts +21 -0
- package/generator/compiler/dry-run.d.ts +108 -0
- package/generator/compiler/fast-start.d.ts +104 -0
- package/generator/compiler/fold.d.ts +116 -0
- package/generator/compiler/index.d.ts +111 -0
- package/generator/compiler/index.js +17759 -0
- package/generator/compiler/link.d.ts +38 -0
- package/generator/compiler/memo.d.ts +44 -0
- package/generator/compiler/plan.d.ts +92 -0
- package/generator/compiler/progress.d.ts +54 -0
- package/generator/compiler/render.d.ts +27 -0
- package/generator/compiler/retention.d.ts +181 -0
- package/generator/compiler/semantic-closure.d.ts +46 -0
- package/generator/compiler/targeted.d.ts +280 -0
- package/generator/content/content-compiler.d.ts +118 -0
- package/generator/content/highlight-cache.d.ts +139 -0
- package/generator/content/html-pipeline.d.ts +170 -0
- package/generator/content/html-pool.d.ts +239 -0
- package/generator/content/html-worker.js +1598 -0
- package/generator/content-module-ids.d.ts +8 -0
- package/generator/contracts.d.ts +1063 -0
- package/generator/contracts.js +15 -0
- package/generator/discovery/index.d.ts +77 -0
- package/generator/graph/index.d.ts +211 -0
- package/generator/graph/unit-index.d.ts +216 -0
- package/generator/kernel/canonical.d.ts +57 -0
- package/generator/kernel/flags.d.ts +49 -0
- package/generator/kernel/footprint.d.ts +88 -0
- package/generator/kernel/observations.d.ts +68 -0
- package/generator/kernel/paths.d.ts +22 -0
- package/generator/kernel/runtime-identity.d.ts +11 -0
- package/generator/outputs/index.d.ts +67 -0
- package/generator/package.json +3 -0
- package/generator/progress/ci.d.ts +22 -0
- package/generator/progress/detect.d.ts +60 -0
- package/generator/progress/events.d.ts +126 -0
- package/generator/progress/format.d.ts +83 -0
- package/generator/progress/gate.d.ts +49 -0
- package/generator/progress/host.d.ts +29 -0
- package/generator/progress/lines.d.ts +42 -0
- package/generator/progress/live.d.ts +115 -0
- package/generator/progress/model.d.ts +85 -0
- package/generator/progress/reporter.d.ts +87 -0
- package/generator/progress/settings.d.ts +60 -0
- package/generator/semantic/angular.d.ts +9 -0
- package/generator/semantic/api-enumeration.d.ts +19 -0
- package/generator/semantic/api-summary.d.ts +33 -0
- package/generator/semantic/dependencies.d.ts +20 -0
- package/generator/semantic/derived-classes.d.ts +58 -0
- package/generator/semantic/documentation-cache.d.ts +23 -0
- package/generator/semantic/fragments.d.ts +28 -0
- package/generator/semantic/owned-roots.d.ts +59 -0
- package/generator/semantic/program-builder.d.ts +55 -0
- package/generator/semantic/program-index.d.ts +124 -0
- package/generator/semantic/program-inputs.d.ts +26 -0
- package/generator/semantic/program-observations.d.ts +158 -0
- package/generator/semantic/program-retention.d.ts +147 -0
- package/generator/semantic/program-state.d.ts +196 -0
- package/generator/semantic/program-verify.d.ts +22 -0
- package/generator/semantic/recorder.d.ts +89 -0
- package/generator/semantic/rendering.d.ts +34 -0
- package/generator/semantic/semantic-closure.d.ts +129 -0
- package/generator/semantic/semantic-service.d.ts +186 -0
- package/generator/semantic/type-text.d.ts +5 -0
- package/generator/session/build-session.d.ts +206 -0
- package/generator/session/input-verification.d.ts +38 -0
- package/generator/session/parcel-event-source.d.ts +22 -0
- package/generator/session/progress.d.ts +72 -0
- package/generator/session/unchanged-saves.d.ts +63 -0
- package/generator/session/watch-inputs.d.ts +6 -0
- package/generator/session/watch-signals.d.ts +10 -0
- package/generator/templates/api/base.html.nunj +26 -0
- package/generator/templates/api/class-declaration.html.nunj +57 -0
- package/generator/templates/api/details/class-declaration.html.nunj +47 -0
- package/generator/templates/api/details/enum-declaration.html.nunj +0 -0
- package/generator/templates/api/details/function-declaration.html.nunj +14 -0
- package/generator/templates/api/details/helpers/decorators.html.nunj +14 -0
- package/generator/templates/api/details/helpers/extends.html.nunj +6 -0
- package/generator/templates/api/details/helpers/selectors.html.nunj +12 -0
- package/generator/templates/api/details/helpers/type-parameters.html.nunj +14 -0
- package/generator/templates/api/details/interface-declaration.html.nunj +27 -0
- package/generator/templates/api/details/type-alias-declaration.html.nunj +14 -0
- package/generator/templates/api/details/variable-declaration.html.nunj +0 -0
- package/generator/templates/api/details.html.nunj +9 -0
- package/generator/templates/api/enum-declaration.html.nunj +12 -0
- package/generator/templates/api/function-declaration.html.nunj +35 -0
- package/generator/templates/api/interface-declaration.html.nunj +37 -0
- package/generator/templates/api/type-alias-declaration.html.nunj +16 -0
- package/generator/templates/api/variable-declaration.html.nunj +8 -0
- package/generator/templates/api-header.html.nunj +11 -0
- package/generator/templates/api-list.ts.nunj +22 -0
- package/generator/templates/api-page-content.html.nunj +1 -0
- package/generator/templates/api-scope.ts.nunj +22 -0
- package/generator/templates/category.ts.nunj +22 -0
- package/generator/templates/code.html.nunj +3 -0
- package/generator/templates/context.ts.nunj +55 -0
- package/generator/templates/demo-assets.ts.nunj +25 -0
- package/generator/templates/helpers/accessor.html.nunj +76 -0
- package/generator/templates/helpers/accessors.html.nunj +7 -0
- package/generator/templates/helpers/badge.html.nunj +4 -0
- package/generator/templates/helpers/call-signature.html.nunj +70 -0
- package/generator/templates/helpers/code.html.nunj +3 -0
- package/generator/templates/helpers/constructor.html.nunj +32 -0
- package/generator/templates/helpers/declaration-modifiers.html.nunj +45 -0
- package/generator/templates/helpers/decorators.html.nunj +11 -0
- package/generator/templates/helpers/members.html.nunj +29 -0
- package/generator/templates/helpers/method.html.nunj +89 -0
- package/generator/templates/helpers/methods.html.nunj +7 -0
- package/generator/templates/helpers/modifier.html.nunj +4 -0
- package/generator/templates/helpers/no-content.html.nunj +3 -0
- package/generator/templates/helpers/overload.html.nunj +57 -0
- package/generator/templates/helpers/parameters.html.nunj +44 -0
- package/generator/templates/helpers/properties.html.nunj +61 -0
- package/generator/templates/helpers/status.html.nunj +33 -0
- package/generator/templates/helpers/tag.html.nunj +4 -0
- package/generator/templates/helpers/type.html.nunj +11 -0
- package/generator/templates/index.ts.nunj +2 -0
- package/generator/templates/page-header.html.nunj +5 -0
- package/generator/templates/page-wrapper.ts.nunj +64 -0
- package/generator/templates/page.ts.nunj +97 -0
- package/generator/templates/parts/examples.html.nunj +11 -0
- package/generator/templates/parts/member-examples.html.nunj +12 -0
- package/generator/templates/parts/member-remarks.html.nunj +8 -0
- package/generator/templates/parts/page-tags.html.nunj +10 -0
- package/generator/templates/parts/remarks.html.nunj +10 -0
- package/generator/templates/parts/see-also.html.nunj +23 -0
- package/generator/templates/parts/usage-notes.html.nunj +8 -0
- package/generator/templates/playgrounds.ts.nunj +63 -0
- package/generator/templates/routes.ts.nunj +49 -0
- package/generator/templates/symbol/decorators.html.nunj +12 -0
- package/generator/templates/symbol/details.html.nunj +62 -0
- package/generator/templates/symbol/extended-by.html.nunj +17 -0
- package/generator/templates/symbol/header.html.nunj +22 -0
- package/generator/templates/symbol/members.html.nunj +301 -0
- package/generator/templates/symbol/page.html.nunj +76 -0
- package/generator/templates/symbol/see-also.html.nunj +16 -0
- package/generator/vite/angular/ANALOG-LICENSE +21 -0
- package/generator/vite/angular/analog-provenance.json +880 -0
- package/generator/vite/angular/index.d.ts +14 -0
- package/generator/vite/angular/index.js +7300 -0
- package/generator/vite/angular-compatibility.d.ts +6 -0
- package/generator/vite/angular-composition.d.ts +68 -0
- package/generator/vite/angular-version.d.ts +38 -0
- package/generator/vite/application-builder.js +331 -0
- package/generator/vite/application-builder.schema.json +46 -0
- package/generator/vite/application.d.ts +91 -0
- package/generator/vite/assets.d.ts +11 -0
- package/generator/vite/bounded-close.d.ts +33 -0
- package/generator/vite/component-updates.d.ts +21 -0
- package/generator/vite/configuration.d.ts +3 -0
- package/generator/vite/dev-server-builder.js +334 -0
- package/generator/vite/dev-server-builder.schema.json +27 -0
- package/generator/vite/dev-styles.d.ts +65 -0
- package/generator/vite/diagnostics.d.ts +4 -0
- package/generator/vite/external-probes.d.ts +40 -0
- package/generator/vite/host-updates.d.ts +145 -0
- package/generator/vite/index.d.ts +13 -0
- package/generator/vite/index.js +11589 -0
- package/generator/vite/lease.d.ts +6 -0
- package/generator/vite/lifecycle.d.ts +119 -0
- package/generator/vite/mime.d.ts +2 -0
- package/generator/vite/missing-paths.d.ts +44 -0
- package/generator/vite/options.d.ts +87 -0
- package/generator/vite/output-watch.d.ts +41 -0
- package/generator/vite/paths.d.ts +7 -0
- package/generator/vite/plugin.d.ts +3 -0
- package/generator/vite/prerender-entry.js +395 -0
- package/generator/vite/prerender-runtime.d.ts +66 -0
- package/generator/vite/prerender.d.ts +27 -0
- package/generator/vite/production.d.ts +66 -0
- package/generator/vite/progress.d.ts +33 -0
- package/generator/vite/restore-theme.js +13 -0
- package/generator/vite/route-inventory.d.ts +24 -0
- package/generator/vite/ssr-renderer-control.d.ts +1 -0
- package/generator/vite/ssr-renderer-entry.js +444 -0
- package/generator/vite/ssr-renderer-protocol.d.ts +101 -0
- package/generator/vite/ssr-renderer.d.ts +74 -0
- package/generator/vite/theme-index.d.ts +13 -0
- package/generator/vite/tsconfig-paths.d.ts +64 -0
- package/generator/vite/vite-event-source.d.ts +198 -0
- package/generator/vite/vite-version.d.ts +26 -0
- package/generator/vite/watch-inputs.d.ts +39 -0
- package/generator/worker/entry.d.ts +1 -0
- package/generator/worker/entry.js +614 -0
- package/generator/worker/index.d.ts +156 -0
- package/generator/worker/index.js +1030 -0
- package/generator/worker/protocol.d.ts +160 -0
- package/helpers/angular/get-component-decorator.js +6 -6
- package/helpers/angular/get-component-decorator.js.map +1 -1
- package/helpers/angular/get-directive-decorator.js +3 -3
- package/helpers/angular/get-directive-decorator.js.map +1 -1
- package/helpers/angular/get-pipe-decorator.js +3 -3
- package/helpers/angular/get-pipe-decorator.js.map +1 -1
- package/helpers/build-indexes.js +5 -2
- package/helpers/build-indexes.js.map +1 -1
- package/helpers/construct-page-keyword.js +2 -1
- package/helpers/construct-page-keyword.js.map +1 -1
- package/helpers/extract-selectors.d.ts +1 -1
- package/helpers/extract-selectors.js +5 -3
- package/helpers/extract-selectors.js.map +1 -1
- package/helpers/filter-useless-members.d.ts +1 -1
- package/helpers/format-code.d.ts +2 -1
- package/helpers/format-code.js +13 -4
- package/helpers/format-code.js.map +1 -1
- package/helpers/import-fresh-esm.js.map +1 -1
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +2 -0
- package/helpers/index.js.map +1 -1
- package/helpers/keyword-heading-title.d.ts +7 -0
- package/helpers/keyword-heading-title.js +21 -0
- package/helpers/keyword-heading-title.js.map +1 -0
- package/helpers/markdown-to-html.js +3 -3
- package/helpers/markdown-to-html.js.map +1 -1
- package/helpers/navigation-title-order.d.ts +8 -0
- package/helpers/navigation-title-order.js +15 -0
- package/helpers/navigation-title-order.js.map +1 -0
- package/helpers/playground/get-playground-inputs.js +8 -4
- package/helpers/playground/get-playground-inputs.js.map +1 -1
- package/helpers/playground/get-playground-template-inputs.js +2 -1
- package/helpers/playground/get-playground-template-inputs.js.map +1 -1
- package/helpers/presentation.d.ts +7 -7
- package/helpers/presentation.js +23 -23
- package/helpers/presentation.js.map +1 -1
- package/helpers/print.js +32 -5
- package/helpers/print.js.map +1 -1
- package/helpers/process-snippets.d.ts +1 -1
- package/helpers/process-snippets.js +3 -3
- package/helpers/process-snippets.js.map +1 -1
- package/helpers/snippets-from-asset.d.ts +1 -1
- package/helpers/snippets-from-asset.js +2 -2
- package/helpers/snippets-from-asset.js.map +1 -1
- package/helpers/sort-navigation-entities.js +2 -1
- package/helpers/sort-navigation-entities.js.map +1 -1
- package/helpers/stable-generated-id.d.ts +2 -0
- package/helpers/stable-generated-id.js +12 -0
- package/helpers/stable-generated-id.js.map +1 -0
- package/helpers/text-order.d.ts +8 -0
- package/helpers/text-order.js +26 -0
- package/helpers/text-order.js.map +1 -0
- package/helpers/typescript/member/get-inherited-parent.d.ts +1 -1
- package/helpers/typescript/member/get-inherited-parent.js +2 -2
- package/helpers/typescript/member/get-inherited-parent.js.map +1 -1
- package/helpers/typescript/node/sort-by-nodes-name.d.ts +4 -2
- package/helpers/typescript/node/sort-by-nodes-name.js +6 -3
- package/helpers/typescript/node/sort-by-nodes-name.js.map +1 -1
- package/helpers/typescript/property/get-property-assignment.js.map +1 -1
- package/package.json +86 -29
- package/parsers/helpers/number.d.ts +1 -1
- package/parsers/helpers/number.js +2 -2
- package/parsers/helpers/number.js.map +1 -1
- package/parsers/helpers/param-value.d.ts +1 -1
- package/parsers/helpers/param-value.js +2 -2
- package/parsers/helpers/param-value.js.map +1 -1
- package/parsers/helpers/param.js +3 -3
- package/parsers/helpers/param.js.map +1 -1
- package/parsers/parse-code-block-params.d.ts +1 -1
- package/parsers/parse-code-block-params.js +22 -16
- package/parsers/parse-code-block-params.js.map +1 -1
- package/parsers/parse-snippet.js +10 -10
- package/parsers/parse-snippet.js.map +1 -1
- package/schematics/collection.json +34 -23
- package/schematics/migrate-to-vite/analyze.d.ts +76 -0
- package/schematics/migrate-to-vite/analyze.js +816 -0
- package/schematics/migrate-to-vite/analyze.js.map +1 -0
- package/schematics/migrate-to-vite/index.d.ts +9 -0
- package/schematics/migrate-to-vite/index.js +585 -0
- package/schematics/migrate-to-vite/index.js.map +1 -0
- package/schematics/migrate-to-vite/legacy-folder.d.ts +84 -0
- package/schematics/migrate-to-vite/legacy-folder.js +340 -0
- package/schematics/migrate-to-vite/legacy-folder.js.map +1 -0
- package/schematics/migrate-to-vite/report.d.ts +32 -0
- package/schematics/migrate-to-vite/report.js +97 -0
- package/schematics/migrate-to-vite/report.js.map +1 -0
- package/schematics/migrate-to-vite/schema.d.ts +13 -0
- package/schematics/migrate-to-vite/schema.js +3 -0
- package/schematics/migrate-to-vite/schema.js.map +1 -0
- package/schematics/migrate-to-vite/schema.json +31 -0
- package/schematics/migrate-to-vite/setup/dependencies.d.ts +64 -0
- package/schematics/migrate-to-vite/setup/dependencies.js +183 -0
- package/schematics/migrate-to-vite/setup/dependencies.js.map +1 -0
- package/schematics/migrate-to-vite/setup/index.d.ts +6 -0
- package/schematics/migrate-to-vite/setup/index.js +13 -0
- package/schematics/migrate-to-vite/setup/index.js.map +1 -0
- package/schematics/migrate-to-vite/setup/json-file.d.ts +51 -0
- package/schematics/migrate-to-vite/setup/json-file.js +115 -0
- package/schematics/migrate-to-vite/setup/json-file.js.map +1 -0
- package/schematics/migrate-to-vite/setup/source.d.ts +30 -0
- package/schematics/migrate-to-vite/setup/source.js +202 -0
- package/schematics/migrate-to-vite/setup/source.js.map +1 -0
- package/schematics/migrate-to-vite/setup/targets.d.ts +51 -0
- package/schematics/migrate-to-vite/setup/targets.js +48 -0
- package/schematics/migrate-to-vite/setup/targets.js.map +1 -0
- package/schematics/migrate-to-vite/setup/vite-config.d.ts +100 -0
- package/schematics/migrate-to-vite/setup/vite-config.js +175 -0
- package/schematics/migrate-to-vite/setup/vite-config.js.map +1 -0
- package/schematics/migrate-to-vite/setup/workspace.d.ts +100 -0
- package/schematics/migrate-to-vite/setup/workspace.js +225 -0
- package/schematics/migrate-to-vite/setup/workspace.js.map +1 -0
- package/schematics/migrate-to-vite/state.d.ts +65 -0
- package/schematics/migrate-to-vite/state.js +92 -0
- package/schematics/migrate-to-vite/state.js.map +1 -0
- package/schematics/migrate-to-vite/testing/fixtures.d.ts +18 -0
- package/schematics/migrate-to-vite/testing/fixtures.js +279 -0
- package/schematics/migrate-to-vite/testing/fixtures.js.map +1 -0
- package/schematics/migrate-to-vite/update-note.d.ts +6 -0
- package/schematics/migrate-to-vite/update-note.js +23 -0
- package/schematics/migrate-to-vite/update-note.js.map +1 -0
- package/schematics/migration.json +5 -0
- package/schematics/migrations/standalone-pages/index.js +7 -6
- package/schematics/migrations/standalone-pages/index.js.map +1 -1
- package/schematics/vite-setup/index.d.ts +20 -0
- package/schematics/vite-setup/index.js +206 -0
- package/schematics/vite-setup/index.js.map +1 -0
- package/schematics/vite-setup/schema.d.ts +7 -0
- package/schematics/vite-setup/schema.js +3 -0
- package/schematics/vite-setup/schema.js.map +1 -0
- package/schematics/vite-setup/schema.json +19 -0
- package/scripts/restore-theme.js +9 -2
- package/templates/context.ts.nunj +3 -0
- package/templates/helpers/badge.html.nunj +1 -1
- package/templates/helpers/status.html.nunj +4 -8
- package/templates/page-wrapper.ts.nunj +24 -1
- package/templates/page.ts.nunj +25 -0
- package/templates/parts/page-tags.html.nunj +1 -1
- package/templates/playgrounds.ts.nunj +8 -9
- package/templates/routes.ts.nunj +6 -1
- package/templates/symbol/decorators.html.nunj +12 -0
- package/templates/symbol/details.html.nunj +62 -0
- package/templates/symbol/extended-by.html.nunj +17 -0
- package/templates/symbol/header.html.nunj +22 -0
- package/templates/symbol/members.html.nunj +301 -0
- package/templates/symbol/page.html.nunj +76 -0
- package/templates/symbol/see-also.html.nunj +16 -0
- package/engine/.cache/apps/ng-doc/docs/api-documentation/auto-generation/ng-doc.page.mjs +0 -20
- package/engine/.cache/apps/ng-doc/docs/api-documentation/documenting-declarations/ng-doc.page.mjs +0 -20
- package/engine/.cache/apps/ng-doc/docs/api-documentation/rendering-api/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/customization/icons/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/customization/layout/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/customization/page-processors/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/customization/page-skeleton/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/customization/search/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/customization/themes/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/develop/ng-doc.page.mjs +0 -36
- package/engine/.cache/apps/ng-doc/docs/getting-started/configuration/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/getting-started/installation/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/getting-started/migrations/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/getting-started/ssr/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/getting-started/what-is-ng-doc/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/ng-doc.api.mjs +0 -42
- package/engine/.cache/apps/ng-doc/docs/recipes/ignoring-file-lines/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/recipes/performance/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/writing-content/blockquotes/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/writing-content/code-blocks/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/writing-content/demo-and-demo-pane/ng-doc.page.mjs +0 -19
- package/engine/.cache/apps/ng-doc/docs/writing-content/images-videos-and-embeds/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/writing-content/keywords/ng-doc.page.mjs +0 -17
- package/engine/.cache/apps/ng-doc/docs/writing-content/mermaid-diagrams/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/writing-content/nunjucks/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/writing-content/pages-and-categories/ng-doc.page.mjs +0 -18
- package/engine/.cache/apps/ng-doc/docs/writing-content/playground/ng-doc.page.mjs +0 -33
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export declare const ANGULAR_COMPATIBILITY_FORMAT = "ng-doc-analog-2.8.0-resources-v1";
|
|
3
|
+
export declare const ANGULAR_COMPILER_NAME = "@analogjs/vite-plugin-angular";
|
|
4
|
+
/** Compatibility assertion for the tested compiler implementation; not an authenticity signature. */
|
|
5
|
+
export declare function qualifyAngularPlugins(plugins: Plugin[]): Plugin[];
|
|
6
|
+
export declare function assertAngularCompatibility(plugins: readonly Plugin[]): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HmrContext, Plugin, ViteDevServer } from 'vite';
|
|
2
|
+
import { type HostUpdateTicket, type InitialCompilationInventory } from './host-updates.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a hot update is for a global style sheet or for a Sass file only global sheets use:
|
|
5
|
+
* every module of the file reaches, through style sheets alone, only virtual importers (ids
|
|
6
|
+
* starting with a NUL character, such as the application's browser entry). A component style
|
|
7
|
+
* sheet is served with a query (`?direct&ngcomp`) or imported by the component's TypeScript, so
|
|
8
|
+
* neither it nor a partial it uses ever matches.
|
|
9
|
+
* @param context - The hot update.
|
|
10
|
+
* @returns Whether only global style sheets depend on the file.
|
|
11
|
+
*/
|
|
12
|
+
export declare function globalStyleSheet(context: Pick<HmrContext, 'file' | 'modules'>): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The hooks NgDoc's patched Analog compiler exposes as `api.ngDocHost` (the
|
|
15
|
+
* `generation-claimed-filesystem-*` changes): a claimed add or unlink event invalidates the
|
|
16
|
+
* compiler's caches at once and joins its next pass instead of starting one, and `passes` counts
|
|
17
|
+
* its passes.
|
|
18
|
+
*/
|
|
19
|
+
export interface AnalogHostHooks {
|
|
20
|
+
claimFilesystemChange?: (file: string) => boolean;
|
|
21
|
+
readonly passes: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The patched compiler's hooks, when it exposes them.
|
|
25
|
+
* @param compiler The Analog compiler plugin.
|
|
26
|
+
*/
|
|
27
|
+
export declare function analogHostHooks(compiler: Plugin | undefined): AnalogHostHooks | undefined;
|
|
28
|
+
export interface AngularCompositionBridge {
|
|
29
|
+
initialize(): Promise<void>;
|
|
30
|
+
initialCompilationInventory?(): InitialCompilationInventory | undefined;
|
|
31
|
+
start(file: string, read: () => string | Promise<string>): HostUpdateTicket;
|
|
32
|
+
/** Other TypeScript outputs to compile in this ready ticket's pass (see compilerCompanions). */
|
|
33
|
+
companions?(ticket: HostUpdateTicket): string[];
|
|
34
|
+
/** A mark of the diagnostics recorded so far (see HostUpdateCoordinator.diagnosticMark). */
|
|
35
|
+
diagnosticMark?(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the add or unlink event of `file` joins the pass of its generation (a generated output
|
|
38
|
+
* or a watched description module).
|
|
39
|
+
*/
|
|
40
|
+
claimsFilesystemChange?(file: string): boolean;
|
|
41
|
+
acknowledge(ticket: HostUpdateTicket, resourceWitness: boolean, compilerPass?: boolean, recoverBefore?: number): Promise<void>;
|
|
42
|
+
diagnostic(ticket: HostUpdateTicket, error: Error): void;
|
|
43
|
+
committed(ticket: HostUpdateTicket): Promise<void>;
|
|
44
|
+
settle(ticket: HostUpdateTicket): Promise<void>;
|
|
45
|
+
fail(error: Error): void;
|
|
46
|
+
}
|
|
47
|
+
export interface AngularComposition {
|
|
48
|
+
readonly plugins: Plugin[];
|
|
49
|
+
attachServer(server: ViteDevServer): void;
|
|
50
|
+
observeStartupUpdate(file: string, read: () => string | Promise<string>): void;
|
|
51
|
+
preflight(): Promise<void>;
|
|
52
|
+
dispose(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The id Analog keys its per-file maps with: forward slashes, as Vite normalizes ids. A resolved
|
|
56
|
+
* Windows path would miss them and compile a companion from stale bytes.
|
|
57
|
+
*/
|
|
58
|
+
export declare function analogFileId(file: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* The user error for an import Vite could not resolve, or undefined for any other error. Vite's
|
|
61
|
+
* import analysis reports it after every transform has run, so the Angular compiler is not at
|
|
62
|
+
* fault: the import names a module that does not exist, or one that only a tsconfig path mapping
|
|
63
|
+
* or a Vite alias the configuration lacks would resolve.
|
|
64
|
+
* @param cause - The error of a module transform.
|
|
65
|
+
*/
|
|
66
|
+
export declare function unresolvedImportError(cause: unknown): Error | undefined;
|
|
67
|
+
/** Owns the supported Analog compiler hooks while retaining the complete factory result. */
|
|
68
|
+
export declare function composeAngularPlugins(angularPlugins: readonly Plugin[], componentProbe: string, bridge: AngularCompositionBridge): AngularComposition;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first Angular release with the newer `@angular/build` transformer API. The bundled Analog 2.8
|
|
3
|
+
* picks the API it calls from the `@angular/compiler-cli` version (`>=22.2.0` calls
|
|
4
|
+
* `initializeHash()` and passes transform options), but takes the implementation from the
|
|
5
|
+
* `@angular/build` it resolves. When the two packages fall on different sides of this release,
|
|
6
|
+
* linking fails late with "Hash utility must be initialized" or a wrong call signature.
|
|
7
|
+
*
|
|
8
|
+
* The builder therefore takes `@angular/build` as a peer dependency, the application's own copy, and
|
|
9
|
+
* the engine checks at start that the pair agrees.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TRANSFORM_OPTIONS_ANGULAR = "22.2.0";
|
|
12
|
+
/**
|
|
13
|
+
* Whether the bundled Analog can drive this `@angular/build` from this `@angular/compiler-cli`: both
|
|
14
|
+
* versions are valid, of the same major, and on the same side of {@link TRANSFORM_OPTIONS_ANGULAR}.
|
|
15
|
+
* Different patch or minor releases on the same side work, as they do in the Angular CLI.
|
|
16
|
+
* @param compiler - The `@angular/compiler-cli` version.
|
|
17
|
+
* @param build - The `@angular/build` version.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isConsistentAngularBuild(compiler: string, build: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The version of the `@angular/compiler-cli` that the bundled Analog loads: the one resolved from
|
|
22
|
+
* NgDoc's own location. Undefined when none can be resolved.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveAngularCompilerVersion(): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The version of the `@angular/build` that the bundled Analog loads, resolved from NgDoc's own
|
|
27
|
+
* location like its `require('@angular/build/private')`. Undefined when none can be resolved.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveAngularBuildVersion(): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Fails when the Vite engine would run with an `@angular/compiler-cli` and an `@angular/build`
|
|
32
|
+
* that the bundled Analog cannot drive together ({@link isConsistentAngularBuild}), or without
|
|
33
|
+
* either of them. This happens when the package manager installs a second `@angular/build` for
|
|
34
|
+
* NgDoc instead of reusing the application's (an override, or a lockfile written before).
|
|
35
|
+
* @param compiler - The `@angular/compiler-cli` version; by default the one NgDoc resolves.
|
|
36
|
+
* @param build - The `@angular/build` version; by default the one NgDoc resolves.
|
|
37
|
+
*/
|
|
38
|
+
export declare function assertConsistentAngularBuild(compiler?: string | undefined, build?: string | undefined): void;
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
// libs/builder/generator/vite/application-builder.ts
|
|
2
|
+
import { createBuilder } from "@angular-devkit/architect";
|
|
3
|
+
|
|
4
|
+
// libs/builder/generator/vite/builders.ts
|
|
5
|
+
import path2 from "node:path";
|
|
6
|
+
import { Observable } from "rxjs";
|
|
7
|
+
import { createServer as viteCreateServer } from "vite";
|
|
8
|
+
|
|
9
|
+
// libs/builder/generator/vite/production.ts
|
|
10
|
+
import { rm, writeFile } from "node:fs/promises";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { build as viteBuild } from "vite";
|
|
13
|
+
|
|
14
|
+
// libs/builder/generator/vite/angular-version.ts
|
|
15
|
+
import { createRequire } from "node:module";
|
|
16
|
+
var TRANSFORM_OPTIONS_ANGULAR = "22.2.0";
|
|
17
|
+
var VERSION = /^(\d+)\.(\d+)\.(\d+)(?:[-+][0-9A-Za-z.+-]*)?$/;
|
|
18
|
+
function parse(version) {
|
|
19
|
+
const match = VERSION.exec(version);
|
|
20
|
+
return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : void 0;
|
|
21
|
+
}
|
|
22
|
+
function usesTransformOptions([major, minor, patch]) {
|
|
23
|
+
const [lowMajor, lowMinor, lowPatch] = parse(TRANSFORM_OPTIONS_ANGULAR);
|
|
24
|
+
if (major !== lowMajor) return major > lowMajor;
|
|
25
|
+
if (minor !== lowMinor) return minor > lowMinor;
|
|
26
|
+
return patch >= lowPatch;
|
|
27
|
+
}
|
|
28
|
+
function isConsistentAngularBuild(compiler, build) {
|
|
29
|
+
const left = parse(compiler);
|
|
30
|
+
const right = parse(build);
|
|
31
|
+
if (!left || !right || left[0] !== right[0]) return false;
|
|
32
|
+
return usesTransformOptions(left) === usesTransformOptions(right);
|
|
33
|
+
}
|
|
34
|
+
function resolveVersion(name) {
|
|
35
|
+
try {
|
|
36
|
+
const manifest = createRequire(import.meta.url)(`${name}/package.json`);
|
|
37
|
+
return typeof manifest.version === "string" ? manifest.version : void 0;
|
|
38
|
+
} catch {
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function resolveAngularCompilerVersion() {
|
|
43
|
+
return resolveVersion("@angular/compiler-cli");
|
|
44
|
+
}
|
|
45
|
+
function resolveAngularBuildVersion() {
|
|
46
|
+
return resolveVersion("@angular/build");
|
|
47
|
+
}
|
|
48
|
+
function assertConsistentAngularBuild(compiler = resolveAngularCompilerVersion(), build = resolveAngularBuildVersion()) {
|
|
49
|
+
if (compiler && build && isConsistentAngularBuild(compiler, build)) return;
|
|
50
|
+
if (!compiler || !build) {
|
|
51
|
+
const missing = !compiler ? "@angular/compiler-cli" : "@angular/build";
|
|
52
|
+
throw new Error(
|
|
53
|
+
`[NGDOC_VITE_ANGULAR_VERSION] The NgDoc Vite engine needs @angular/compiler-cli and @angular/build of the application's Angular 22, but ${missing} is not installed. Install it in the application's devDependencies: npm i -D ${missing}@22.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(
|
|
57
|
+
`[NGDOC_VITE_ANGULAR_VERSION] NgDoc resolves @angular/compiler-cli ${compiler} and @angular/build ${build}, which belong to different Angular releases: the Vite engine drives @angular/build through the compiler's version, so both must be from before ${TRANSFORM_OPTIONS_ANGULAR} or both from ${TRANSFORM_OPTIONS_ANGULAR} or later. This usually means a second @angular/build was installed for NgDoc: check with \`npm ls @angular/build\`, then install the same Angular version for every @angular/* package (ng update @angular/core@22 @angular/cli@22) and reinstall, or deduplicate @angular/build (npm dedupe, an override or a resolution).`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// libs/builder/generator/vite/prerender.ts
|
|
62
|
+
import { fork } from "node:child_process";
|
|
63
|
+
import { fileURLToPath } from "node:url";
|
|
64
|
+
function prerenderError(code, message2) {
|
|
65
|
+
return new Error(`[${code}] ${message2}`);
|
|
66
|
+
}
|
|
67
|
+
function heapArguments(execArgv) {
|
|
68
|
+
return execArgv.filter(
|
|
69
|
+
(item) => /^--(?:max-old-space-size|max-semi-space-size|stack-size)=/.test(item)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function prerenderNgDoc(options) {
|
|
73
|
+
const request = {
|
|
74
|
+
browserDir: options.browserDir,
|
|
75
|
+
serverEntry: options.serverEntry,
|
|
76
|
+
routes: [...options.routes ?? []],
|
|
77
|
+
discoverRoutes: options.discoverRoutes ?? true,
|
|
78
|
+
...options.routeTimeoutMs === void 0 ? {} : { routeTimeoutMs: options.routeTimeoutMs }
|
|
79
|
+
};
|
|
80
|
+
if (request.routeTimeoutMs !== void 0 && (!Number.isSafeInteger(request.routeTimeoutMs) || request.routeTimeoutMs < 1)) {
|
|
81
|
+
return Promise.reject(
|
|
82
|
+
prerenderError("NGDOC_PRERENDER_OPTION", "routeTimeoutMs must be a positive integer.")
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return new Promise((resolve, reject) => {
|
|
86
|
+
if (options.signal?.aborted) {
|
|
87
|
+
reject(prerenderError("NGDOC_PRERENDER_ABORTED", "Prerendering was aborted."));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const child = fork(
|
|
91
|
+
fileURLToPath(options.entryUrl ?? new URL("./prerender-entry.js", import.meta.url)),
|
|
92
|
+
[],
|
|
93
|
+
// Keep the host's heap limits (a large site renders many routes in one process), nothing else.
|
|
94
|
+
{ execArgv: heapArguments(process.execArgv), stdio: ["ignore", "inherit", "inherit", "ipc"] }
|
|
95
|
+
);
|
|
96
|
+
let reply;
|
|
97
|
+
const abort = () => child.kill("SIGKILL");
|
|
98
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
99
|
+
child.on("message", (message2) => {
|
|
100
|
+
reply ??= message2;
|
|
101
|
+
});
|
|
102
|
+
child.once("error", (error) => {
|
|
103
|
+
options.signal?.removeEventListener("abort", abort);
|
|
104
|
+
reject(error);
|
|
105
|
+
});
|
|
106
|
+
child.once("exit", (code, signal) => {
|
|
107
|
+
options.signal?.removeEventListener("abort", abort);
|
|
108
|
+
if (options.signal?.aborted) {
|
|
109
|
+
reject(prerenderError("NGDOC_PRERENDER_ABORTED", "Prerendering was aborted."));
|
|
110
|
+
} else if (reply?.type === "result" && code === 0) {
|
|
111
|
+
resolve(reply.report);
|
|
112
|
+
} else if (reply?.type === "error") {
|
|
113
|
+
reject(new Error(reply.message));
|
|
114
|
+
} else {
|
|
115
|
+
reject(
|
|
116
|
+
prerenderError(
|
|
117
|
+
"NGDOC_PRERENDER_EXIT",
|
|
118
|
+
`The prerender process exited without a result (code=${String(code)}, signal=${String(signal)}).`
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
child.send(request, () => {
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// libs/builder/generator/vite/vite-version.ts
|
|
129
|
+
import { version as resolvedViteVersion } from "vite";
|
|
130
|
+
var SUPPORTED_VITE_RANGE = "^8.3.0";
|
|
131
|
+
var SUPPORTED_MAJOR = 8;
|
|
132
|
+
var MINIMUM_MINOR = 3;
|
|
133
|
+
function isSupportedViteVersion(version) {
|
|
134
|
+
const match = /^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.exec(version);
|
|
135
|
+
if (!match) return false;
|
|
136
|
+
const [major, minor, patch] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
137
|
+
if (major !== SUPPORTED_MAJOR || minor < MINIMUM_MINOR) return false;
|
|
138
|
+
return !(match[4] && minor === MINIMUM_MINOR && patch === 0);
|
|
139
|
+
}
|
|
140
|
+
function assertSupportedViteVersion(found = resolvedViteVersion) {
|
|
141
|
+
if (found && isSupportedViteVersion(found)) return;
|
|
142
|
+
throw new Error(
|
|
143
|
+
`[NGDOC_VITE_VERSION] The NgDoc Vite engine requires vite ${SUPPORTED_VITE_RANGE}, but vite ${found || "(unknown version)"} is running. Install a supported release in the application's devDependencies: npm i -D vite@${SUPPORTED_VITE_RANGE}. The legacy builders (@ng-doc/builder:application and dev-server) do not use Vite.`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// libs/builder/generator/vite/production.ts
|
|
148
|
+
var defaultDependencies = {
|
|
149
|
+
build: viteBuild,
|
|
150
|
+
prerender: prerenderNgDoc
|
|
151
|
+
};
|
|
152
|
+
function generationHandoff() {
|
|
153
|
+
const handoff = { schemaVersion: 1 };
|
|
154
|
+
return { name: "@ng-doc/vite:generation-handoff", api: { ngDocGeneration: handoff } };
|
|
155
|
+
}
|
|
156
|
+
function buildError(code, message2) {
|
|
157
|
+
return new Error(`[${code}] ${message2}`);
|
|
158
|
+
}
|
|
159
|
+
function applicationProbe() {
|
|
160
|
+
let found;
|
|
161
|
+
return {
|
|
162
|
+
plugin: {
|
|
163
|
+
name: "@ng-doc/vite:build-probe",
|
|
164
|
+
configResolved(config) {
|
|
165
|
+
const matches = config.plugins.filter(
|
|
166
|
+
(plugin) => plugin.api?.ngDocApplication?.schemaVersion === 1
|
|
167
|
+
);
|
|
168
|
+
if (matches.length > 1) {
|
|
169
|
+
throw buildError(
|
|
170
|
+
"NGDOC_VITE_APPLICATION",
|
|
171
|
+
"Expected at most one createNgDocApplicationPlugin in the Vite configuration."
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
found = matches[0]?.api.ngDocApplication;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
api: () => found
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
async function buildNgDocViteApplication(options, dependencies = defaultDependencies) {
|
|
181
|
+
assertSupportedViteVersion();
|
|
182
|
+
assertConsistentAngularBuild();
|
|
183
|
+
const configFile = path.resolve(options.configFile);
|
|
184
|
+
const outputPath = path.resolve(options.outputPath);
|
|
185
|
+
const browser = path.join(outputPath, "browser");
|
|
186
|
+
const serverDirectory = path.join(outputPath, "server");
|
|
187
|
+
const serverEntry = path.join(serverDirectory, "server.mjs");
|
|
188
|
+
const mode = options.mode ?? "production";
|
|
189
|
+
const log = options.log ?? (() => {
|
|
190
|
+
});
|
|
191
|
+
const aborted = () => {
|
|
192
|
+
if (options.signal?.aborted)
|
|
193
|
+
throw buildError("NGDOC_VITE_BUILD_ABORTED", "The build was aborted.");
|
|
194
|
+
};
|
|
195
|
+
const timed = async (label, step) => {
|
|
196
|
+
const started = Date.now();
|
|
197
|
+
const value = await step();
|
|
198
|
+
log(`${label} in ${((Date.now() - started) / 1e3).toFixed(1)} s`);
|
|
199
|
+
return value;
|
|
200
|
+
};
|
|
201
|
+
let ssr = options.ssr;
|
|
202
|
+
const noServer = () => buildError(
|
|
203
|
+
"NGDOC_VITE_SERVER_ENTRY",
|
|
204
|
+
"Prerendering needs the server bundle: build it (ssr) from createNgDocApplicationPlugin with a server entry."
|
|
205
|
+
);
|
|
206
|
+
if (!options.skipBuild && options.prerender === true && options.ssr === false) throw noServer();
|
|
207
|
+
if (!options.skipBuild) {
|
|
208
|
+
const probe = applicationProbe();
|
|
209
|
+
const generation = generationHandoff();
|
|
210
|
+
await timed(
|
|
211
|
+
`Built the browser bundle into ${browser}`,
|
|
212
|
+
() => dependencies.build({
|
|
213
|
+
configFile,
|
|
214
|
+
mode,
|
|
215
|
+
plugins: [probe.plugin, generation],
|
|
216
|
+
build: { outDir: browser, emptyOutDir: true }
|
|
217
|
+
})
|
|
218
|
+
);
|
|
219
|
+
aborted();
|
|
220
|
+
const entry = probe.api()?.serverEntry;
|
|
221
|
+
ssr ??= entry !== void 0;
|
|
222
|
+
if (!ssr) {
|
|
223
|
+
await rm(serverDirectory, { recursive: true, force: true });
|
|
224
|
+
await rm(path.join(outputPath, "prerendered-routes.json"), { force: true });
|
|
225
|
+
if (options.prerender === true) throw noServer();
|
|
226
|
+
} else {
|
|
227
|
+
if (!entry) {
|
|
228
|
+
throw buildError(
|
|
229
|
+
"NGDOC_VITE_SERVER_ENTRY",
|
|
230
|
+
"The server build needs createNgDocApplicationPlugin with a server entry in the Vite configuration."
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
await timed(
|
|
234
|
+
`Built the server bundle into ${serverDirectory}`,
|
|
235
|
+
() => dependencies.build({
|
|
236
|
+
configFile,
|
|
237
|
+
mode,
|
|
238
|
+
plugins: [generation],
|
|
239
|
+
build: {
|
|
240
|
+
ssr: true,
|
|
241
|
+
outDir: serverDirectory,
|
|
242
|
+
emptyOutDir: true,
|
|
243
|
+
rolldownOptions: {
|
|
244
|
+
input: { server: entry },
|
|
245
|
+
output: {
|
|
246
|
+
format: "es",
|
|
247
|
+
entryFileNames: "[name].mjs",
|
|
248
|
+
chunkFileNames: "chunks/[name]-[hash].mjs"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
aborted();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const prerender = options.prerender ?? (options.skipBuild ? true : ssr === true);
|
|
258
|
+
if (!prerender) return { browser, ...ssr ? { server: serverEntry } : {} };
|
|
259
|
+
const report = await timed(
|
|
260
|
+
"Prerendered the routes",
|
|
261
|
+
() => dependencies.prerender({
|
|
262
|
+
browserDir: browser,
|
|
263
|
+
serverEntry,
|
|
264
|
+
routes: options.routes ?? [],
|
|
265
|
+
discoverRoutes: options.discoverRoutes ?? true,
|
|
266
|
+
...options.routeTimeoutMs === void 0 ? {} : { routeTimeoutMs: options.routeTimeoutMs },
|
|
267
|
+
...options.signal ? { signal: options.signal } : {}
|
|
268
|
+
})
|
|
269
|
+
);
|
|
270
|
+
await writeFile(
|
|
271
|
+
path.join(outputPath, "prerendered-routes.json"),
|
|
272
|
+
`${JSON.stringify({ routes: report.routes, excluded: report.excluded }, null, 2)}
|
|
273
|
+
`
|
|
274
|
+
);
|
|
275
|
+
log(`Prerendered ${report.routes.length} route(s) into ${browser}`);
|
|
276
|
+
if (report.errors.length) {
|
|
277
|
+
log(`The application logged ${report.errors.length} error(s) while prerendering:`);
|
|
278
|
+
for (const { route, message: message2 } of report.errors.slice(0, 10)) log(` ${route}: ${message2}`);
|
|
279
|
+
}
|
|
280
|
+
return { browser, server: serverEntry, prerendered: report };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// libs/builder/generator/vite/builders.ts
|
|
284
|
+
var defaultDependencies2 = {
|
|
285
|
+
build: (options) => buildNgDocViteApplication(options),
|
|
286
|
+
createServer: viteCreateServer
|
|
287
|
+
};
|
|
288
|
+
function message(error) {
|
|
289
|
+
return error instanceof Error ? error.message : String(error);
|
|
290
|
+
}
|
|
291
|
+
async function runViteApplicationBuilder(options, context, dependencies = defaultDependencies2, signal) {
|
|
292
|
+
const resolve = (value) => path2.resolve(context.workspaceRoot, value);
|
|
293
|
+
try {
|
|
294
|
+
await dependencies.build({
|
|
295
|
+
configFile: resolve(options.configFile),
|
|
296
|
+
outputPath: resolve(options.outputPath),
|
|
297
|
+
mode: options.mode ?? "production",
|
|
298
|
+
...options.ssr === void 0 ? {} : { ssr: options.ssr },
|
|
299
|
+
...options.prerender === void 0 ? {} : { prerender: options.prerender },
|
|
300
|
+
...options.routes ? { routes: options.routes } : {},
|
|
301
|
+
...options.discoverRoutes === void 0 ? {} : { discoverRoutes: options.discoverRoutes },
|
|
302
|
+
...options.routeTimeout === void 0 ? {} : { routeTimeoutMs: options.routeTimeout },
|
|
303
|
+
log: (line) => context.logger.info(line),
|
|
304
|
+
...signal ? { signal } : {}
|
|
305
|
+
});
|
|
306
|
+
return { success: true };
|
|
307
|
+
} catch (error) {
|
|
308
|
+
context.logger.error(message(error));
|
|
309
|
+
return { success: false, error: message(error) };
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function viteApplicationBuilderOutputs(options, context, dependencies = defaultDependencies2) {
|
|
313
|
+
return new Observable((subscriber) => {
|
|
314
|
+
const controller = new AbortController();
|
|
315
|
+
void runViteApplicationBuilder(options, context, dependencies, controller.signal).then(
|
|
316
|
+
(output) => {
|
|
317
|
+
subscriber.next(output);
|
|
318
|
+
subscriber.complete();
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
return () => controller.abort();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// libs/builder/generator/vite/application-builder.ts
|
|
326
|
+
var application_builder_default = createBuilder(
|
|
327
|
+
(options, context) => viteApplicationBuilderOutputs(options, context)
|
|
328
|
+
);
|
|
329
|
+
export {
|
|
330
|
+
application_builder_default as default
|
|
331
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"title": "NgDoc Vite application",
|
|
4
|
+
"description": "Builds an Angular application with Vite and the NgDoc Vite engine: the browser bundle, the server bundle and every prerendered route.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"configFile": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The Vite configuration file, relative to the workspace root."
|
|
10
|
+
},
|
|
11
|
+
"outputPath": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The output directory, relative to the workspace root: browser/, server/server.mjs and prerendered-routes.json."
|
|
14
|
+
},
|
|
15
|
+
"mode": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The Vite mode.",
|
|
18
|
+
"default": "production"
|
|
19
|
+
},
|
|
20
|
+
"ssr": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"description": "Build the server bundle. Defaults to true when the Vite configuration's createNgDocApplicationPlugin has a server entry."
|
|
23
|
+
},
|
|
24
|
+
"prerender": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"description": "Prerender every route into browser/. Defaults to true when the server bundle is built."
|
|
27
|
+
},
|
|
28
|
+
"routes": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": { "type": "string" },
|
|
31
|
+
"description": "Routes prerendered in addition to the discovered ones, for example pages with route parameters."
|
|
32
|
+
},
|
|
33
|
+
"routeTimeout": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"minimum": 1,
|
|
36
|
+
"description": "Fails a route that takes longer to render, in milliseconds. No limit by default."
|
|
37
|
+
},
|
|
38
|
+
"discoverRoutes": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Prerender every concrete route of the application's router configuration.",
|
|
41
|
+
"default": true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": ["configFile", "outputPath"],
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* An asset entry, as in the `assets` option of Angular's application builder: a path (a file or
|
|
4
|
+
* a directory, relative to the workspace root) or a glob with its input and output directories.
|
|
5
|
+
*/
|
|
6
|
+
export type NgDocViteAssetPattern = string | {
|
|
7
|
+
glob: string;
|
|
8
|
+
input: string;
|
|
9
|
+
output?: string;
|
|
10
|
+
ignore?: string[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The Angular application a Vite configuration builds. `browser`, `server`, `polyfills`, `styles`
|
|
14
|
+
* and `assets` mean what they mean in an `angular.json` build target; the target's other options
|
|
15
|
+
* have a Vite or Analog equivalent, which the plugin names when one is passed. Relative paths
|
|
16
|
+
* resolve against `workspaceRoot`.
|
|
17
|
+
*/
|
|
18
|
+
export interface NgDocViteApplicationOptions {
|
|
19
|
+
/** Absolute workspace root (default: the current directory). */
|
|
20
|
+
workspaceRoot?: string;
|
|
21
|
+
/** The project's source root: a path asset lands at its path relative to it (default: the directory of `browser`). */
|
|
22
|
+
sourceRoot?: string;
|
|
23
|
+
/** The browser entry, for example `src/main.ts`. */
|
|
24
|
+
browser: string;
|
|
25
|
+
/**
|
|
26
|
+
* The server entry, for example `src/main.server.ts`, whose default export bootstraps the
|
|
27
|
+
* application for the server. It enables the server build and prerendering.
|
|
28
|
+
*/
|
|
29
|
+
server?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Modules imported before the application, for example `['zone.js']`. The server entry keeps
|
|
32
|
+
* only `zone.js` (as `zone.js/node`) and `@angular/localize/init`, as the Angular CLI does.
|
|
33
|
+
*/
|
|
34
|
+
polyfills?: string[];
|
|
35
|
+
/** Global style sheets, in order. */
|
|
36
|
+
styles?: string[];
|
|
37
|
+
/** Files copied into the build and served by the development server. */
|
|
38
|
+
assets?: NgDocViteAssetPattern[];
|
|
39
|
+
}
|
|
40
|
+
/** The URL of the browser entry module that the index page loads. */
|
|
41
|
+
export declare const NG_DOC_BROWSER_ENTRY = "/@ng-doc-application/browser.js";
|
|
42
|
+
/** The module id of the server entry; `buildNgDocViteApplication` builds it into `server.mjs`. */
|
|
43
|
+
export declare const NG_DOC_SERVER_ENTRY = "/@ng-doc-application/server.js";
|
|
44
|
+
interface ResolvedAsset {
|
|
45
|
+
input: string;
|
|
46
|
+
output: string;
|
|
47
|
+
glob: string;
|
|
48
|
+
ignore: string[];
|
|
49
|
+
}
|
|
50
|
+
/** What `buildNgDocViteApplication` reads from the plugin of a resolved configuration. */
|
|
51
|
+
export interface NgDocViteApplicationApi {
|
|
52
|
+
readonly schemaVersion: 1;
|
|
53
|
+
readonly serverEntry?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Checks the keys of the options: an Angular CLI build option the plugin does not take fails with
|
|
57
|
+
* its Vite or Analog equivalent; an option without an effect is returned for a warning.
|
|
58
|
+
*/
|
|
59
|
+
export declare function checkOptionKeys(options: object): string[];
|
|
60
|
+
/** The polyfills of the server entry: Angular keeps only zone.js (for Node) and localize. */
|
|
61
|
+
export declare function serverPolyfills(polyfills: readonly string[]): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Resolves Angular CLI asset entries; a path entry is expanded against the file system.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveAssets(assets: readonly NgDocViteAssetPattern[], workspaceRoot: string, sourceRoot: string): Promise<ResolvedAsset[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Every asset file by its output name; a later entry wins over an earlier one, as in Angular.
|
|
68
|
+
*/
|
|
69
|
+
export declare function collectAssets(assets: readonly ResolvedAsset[]): Promise<Map<string, string>>;
|
|
70
|
+
/**
|
|
71
|
+
* The asset files a development request can name, the last matching entry first. An entry's
|
|
72
|
+
* output prefix and glob can match a file it does not have, so the server serves the first
|
|
73
|
+
* candidate that exists: a later entry wins over an earlier one only with a file, as in
|
|
74
|
+
* `collectAssets` and the Angular CLI.
|
|
75
|
+
*/
|
|
76
|
+
export declare function matchAssets(assets: readonly ResolvedAsset[], base: string, url: string): Array<{
|
|
77
|
+
file: string;
|
|
78
|
+
relative: string;
|
|
79
|
+
}>;
|
|
80
|
+
/** Sets `<base href>` to an absolute Vite base, or adds it at the start of `<head>`. */
|
|
81
|
+
export declare function withBase(html: string, base: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* Builds and serves an Angular application with Vite the way the Angular CLI application builder
|
|
84
|
+
* does: the index page loads the polyfills, global styles and browser entry; assets are served in
|
|
85
|
+
* development and copied into the build; `<base href>` follows Vite's `base`. With a `server`
|
|
86
|
+
* entry, `NG_DOC_SERVER_ENTRY` is a self-contained server bundle for prerendering.
|
|
87
|
+
*
|
|
88
|
+
* Use it next to `createNgDocVitePlugin`. The Vite `root` is the directory of `index.html`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function createNgDocApplicationPlugin(options: NgDocViteApplicationOptions): Plugin;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Connect, Rolldown } from 'vite';
|
|
2
|
+
import type { BuildResult, PublishedGeneratorConfiguration } from '../contracts.js';
|
|
3
|
+
export declare class GeneratedAssetInventory {
|
|
4
|
+
private assets;
|
|
5
|
+
update(result: Extract<BuildResult, {
|
|
6
|
+
status: 'success';
|
|
7
|
+
}>, configuration: PublishedGeneratorConfiguration): void;
|
|
8
|
+
middleware(base: string): Connect.NextHandleFunction;
|
|
9
|
+
emit(context: Rolldown.PluginContext, bundle: Rolldown.OutputBundle): Promise<void>;
|
|
10
|
+
size(): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ViteDevServer } from 'vite';
|
|
2
|
+
/** How long Vite's own close may still run once NgDoc has released what it owns. */
|
|
3
|
+
export declare const HOST_CLOSE_BOUND_MS = 5000;
|
|
4
|
+
export interface BoundedCloseOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Starts NgDoc's complete disposal (idempotent). Part of it waits on work that Vite owns, such
|
|
7
|
+
* as an in-flight component probe transform, so it is bounded together with Vite's close.
|
|
8
|
+
*/
|
|
9
|
+
dispose(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Settles once NgDoc's own processes, watchers and output lease are released. Called after
|
|
12
|
+
* `dispose()` has started. It is never bounded: resolving close before it would leave children.
|
|
13
|
+
*/
|
|
14
|
+
released(): Promise<unknown>;
|
|
15
|
+
warn(message: string): void;
|
|
16
|
+
error(message: string): void;
|
|
17
|
+
boundMs?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Makes `server.close()` release NgDoc first and settle even when Vite's own close never does.
|
|
21
|
+
*
|
|
22
|
+
* Vite 7's dependency optimizer never settled the processing promise of a dependency whose first
|
|
23
|
+
* optimization close cancelled, so a pending request for it kept `DevEnvironment.close()` waiting
|
|
24
|
+
* forever. Vite 8 settles those promises on close; the bound stays as a safety net for any other
|
|
25
|
+
* request or plugin hook that never settles, and costs nothing when close does.
|
|
26
|
+
*
|
|
27
|
+
* The replacement always waits for NgDoc to release its own resources. It then gives Vite's close
|
|
28
|
+
* and the rest of NgDoc's disposal `boundMs`. On timeout it reports one diagnostic and resolves;
|
|
29
|
+
* a later failure of either is still logged. Failures within the bound are rethrown.
|
|
30
|
+
* @param server - The development server whose `close` is replaced.
|
|
31
|
+
* @param options - NgDoc's disposal, release signal, loggers and optional bound.
|
|
32
|
+
*/
|
|
33
|
+
export declare function boundServerClose(server: Pick<ViteDevServer, 'close'>, options: BoundedCloseOptions): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Lets Analog's component update endpoint answer only the requests that answer an update event
|
|
4
|
+
* Analog sent; every other request gets an empty module, which applies no update.
|
|
5
|
+
*
|
|
6
|
+
* Angular's HMR code for a component loads `@ng/component?c=<file>@<class>&t=<timestamp>` on each
|
|
7
|
+
* `angular:component-update` event, with the event's timestamp, and once more whenever the module
|
|
8
|
+
* is evaluated, with `Date.now()`. The module Vite serves is always the latest compilation, so the
|
|
9
|
+
* load-time request never has anything to apply. Analog's endpoint answers it with the file's last
|
|
10
|
+
* update as soon as Vite has ever invalidated the module, and it keeps one update per file, that of
|
|
11
|
+
* the file's last component. Vite invalidates every module when the dependency optimizer reloads
|
|
12
|
+
* the page after it found a dependency late (a template-derived import, a demo's dependency). From
|
|
13
|
+
* then on, until the server restarts, each load applied the last component's metadata to every
|
|
14
|
+
* other component of its file, with the wrong namespaces: `Cannot read properties of undefined
|
|
15
|
+
* (reading 'MatButton')`, or another component's template.
|
|
16
|
+
*
|
|
17
|
+
* Analog's SSR path answers the load-time request of every module the same way, without any
|
|
18
|
+
* invalidation; the gate covers it too.
|
|
19
|
+
* @returns A serve-only plugin that must run before Analog's live reload plugin.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createComponentUpdateGate(): Plugin;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ArtifactSnapshot, PublishedGeneratorConfiguration } from '../contracts.js';
|
|
2
|
+
export declare function requirePublishedConfiguration(snapshot: ArtifactSnapshot): PublishedGeneratorConfiguration;
|
|
3
|
+
export declare function sameRuntimeConfiguration(left: PublishedGeneratorConfiguration, right: PublishedGeneratorConfiguration): boolean;
|