@ng-prism/core 22.5.0 → 22.7.0-beta.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 +13 -9
- package/dist/app/canvas/canvas-bg.styles.d.ts +1 -1
- package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
- package/dist/app/canvas/canvas-bg.styles.js +1 -1
- package/dist/app/canvas/canvas-overlay-tokens.d.ts +12 -0
- package/dist/app/canvas/canvas-overlay-tokens.d.ts.map +1 -0
- package/dist/app/canvas/canvas-overlay-tokens.js +52 -0
- package/dist/app/canvas/prism-canvas-bg-pill.component.js +2 -2
- package/dist/app/canvas/prism-canvas-pin-row.component.js +2 -2
- package/dist/app/canvas/prism-canvas-rulers.component.d.ts +2 -0
- package/dist/app/canvas/prism-canvas-rulers.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-rulers.component.js +17 -12
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +25 -3
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +154 -89
- package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-template-popover.component.js +16 -7
- package/dist/app/canvas/state-chips.d.ts +50 -0
- package/dist/app/canvas/state-chips.d.ts.map +1 -0
- package/dist/app/canvas/state-chips.js +40 -0
- package/dist/app/component-head/head-metrics.d.ts +35 -19
- package/dist/app/component-head/head-metrics.d.ts.map +1 -1
- package/dist/app/component-head/head-metrics.js +57 -27
- package/dist/app/component-head/pipe-facts.d.ts +9 -0
- package/dist/app/component-head/pipe-facts.d.ts.map +1 -0
- package/dist/app/component-head/pipe-facts.js +15 -0
- package/dist/app/component-head/prism-component-head.component.d.ts +20 -22
- package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-component-head.component.js +85 -96
- package/dist/app/component-head/prism-head-gauge.component.d.ts +8 -12
- package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-head-gauge.component.js +51 -67
- package/dist/app/component-head/prism-head-info.component.d.ts +14 -2
- package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-head-info.component.js +84 -20
- package/dist/app/component-head/prism-stat.component.d.ts +4 -5
- package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-stat.component.js +16 -12
- package/dist/app/component-head/service-facts.d.ts +8 -0
- package/dist/app/component-head/service-facts.d.ts.map +1 -0
- package/dist/app/component-head/service-facts.js +11 -0
- package/dist/app/controls/boolean-control.component.js +2 -2
- package/dist/app/controls/json-control.component.js +2 -2
- package/dist/app/controls/union-control.component.js +4 -3
- package/dist/app/directives/resize-value.d.ts +1 -1
- package/dist/app/directives/resize-value.js +1 -1
- package/dist/app/discovery-manifest.d.ts +2 -2
- package/dist/app/discovery-manifest.d.ts.map +1 -1
- package/dist/app/discovery-manifest.js +15 -3
- package/dist/app/header/header-brand.d.ts +25 -0
- package/dist/app/header/header-brand.d.ts.map +1 -0
- package/dist/app/header/header-brand.js +10 -0
- package/dist/app/header/prism-header.component.d.ts +2 -2
- package/dist/app/header/prism-header.component.d.ts.map +1 -1
- package/dist/app/header/prism-header.component.js +73 -57
- package/dist/app/icons/icon-registry.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.js +4 -1
- package/dist/app/index.d.ts +12 -0
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +12 -1
- package/dist/app/layout-menu/prism-layout-menu.component.d.ts +3 -0
- package/dist/app/layout-menu/prism-layout-menu.component.d.ts.map +1 -1
- package/dist/app/layout-menu/prism-layout-menu.component.js +72 -58
- package/dist/app/overview/open-in-playground.d.ts +19 -0
- package/dist/app/overview/open-in-playground.d.ts.map +1 -0
- package/dist/app/overview/open-in-playground.js +25 -0
- package/dist/app/overview/overview-matrix.d.ts +85 -0
- package/dist/app/overview/overview-matrix.d.ts.map +1 -0
- package/dist/app/overview/overview-matrix.js +98 -0
- package/dist/app/overview/overview-visibility.d.ts +10 -2
- package/dist/app/overview/overview-visibility.d.ts.map +1 -1
- package/dist/app/overview/overview-visibility.js +14 -3
- package/dist/app/overview/prism-overview-cell.component.d.ts +27 -2
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview-cell.component.js +145 -28
- package/dist/app/overview/prism-overview-matrix.component.d.ts +29 -0
- package/dist/app/overview/prism-overview-matrix.component.d.ts.map +1 -0
- package/dist/app/overview/prism-overview-matrix.component.js +155 -0
- package/dist/app/overview/prism-overview.component.d.ts +4 -0
- package/dist/app/overview/prism-overview.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview.component.js +37 -14
- package/dist/app/page-renderer/prism-page-renderer.component.js +2 -2
- package/dist/app/panels/a11y/a11y-core.plugin.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-core.plugin.js +0 -1
- package/dist/app/panels/a11y/a11y-header-badge.component.d.ts +1 -4
- package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-header-badge.component.js +8 -19
- package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +2 -2
- package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts +1 -0
- package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-overlay-host.component.js +4 -3
- package/dist/app/panels/a11y/a11y-panel.component.d.ts +4 -1
- package/dist/app/panels/a11y/a11y-panel.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-panel.component.js +32 -54
- package/dist/app/panels/a11y/a11y-score.component.d.ts +8 -3
- package/dist/app/panels/a11y/a11y-score.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-score.component.js +19 -35
- package/dist/app/panels/a11y/a11y-sr-overlay.component.js +2 -2
- package/dist/app/panels/a11y/a11y-sr.component.js +2 -2
- package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-summary.js +8 -1
- package/dist/app/panels/a11y/a11y-tree.component.js +2 -2
- package/dist/app/panels/a11y/a11y-violations.component.d.ts +23 -2
- package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-violations.component.js +104 -89
- package/dist/app/panels/a11y/severity.d.ts +9 -0
- package/dist/app/panels/a11y/severity.d.ts.map +1 -0
- package/dist/app/panels/a11y/severity.js +12 -0
- package/dist/app/panels/controls/controls-plugin.d.ts.map +1 -1
- package/dist/app/panels/controls/controls-plugin.js +1 -2
- package/dist/app/panels/controls/non-editable-input-types.d.ts +9 -1
- package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -1
- package/dist/app/panels/controls/non-editable-input-types.js +18 -0
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts +2 -1
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
- package/dist/app/panels/controls/prism-controls-panel.component.js +77 -59
- package/dist/app/panels/events/events-plugin.d.ts.map +1 -1
- package/dist/app/panels/events/events-plugin.js +1 -2
- package/dist/app/panels/events/prism-events-panel.component.d.ts +2 -0
- package/dist/app/panels/events/prism-events-panel.component.d.ts.map +1 -1
- package/dist/app/panels/events/prism-events-panel.component.js +20 -7
- package/dist/app/panels/events/prism-json-node.utils.d.ts +6 -0
- package/dist/app/panels/events/prism-json-node.utils.d.ts.map +1 -1
- package/dist/app/panels/events/prism-json-node.utils.js +8 -0
- package/dist/app/panels/panel-host/addon-panels.d.ts +11 -0
- package/dist/app/panels/panel-host/addon-panels.d.ts.map +1 -0
- package/dist/app/panels/panel-host/addon-panels.js +12 -0
- package/dist/app/panels/panel-host/panel-badge.d.ts +22 -0
- package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
- package/dist/app/panels/panel-host/panel-badge.js +56 -11
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +4 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.js +36 -70
- package/dist/app/pseudo/pseudo-state-marker.d.ts +32 -10
- package/dist/app/pseudo/pseudo-state-marker.d.ts.map +1 -1
- package/dist/app/pseudo/pseudo-state-marker.js +83 -67
- package/dist/app/pseudo/pseudo-targets.d.ts +11 -0
- package/dist/app/pseudo/pseudo-targets.d.ts.map +1 -0
- package/dist/app/pseudo/pseudo-targets.js +46 -0
- package/dist/app/pseudo/state-fit.d.ts +28 -0
- package/dist/app/pseudo/state-fit.d.ts.map +1 -0
- package/dist/app/pseudo/state-fit.js +97 -0
- package/dist/app/renderer/composition.d.ts +20 -0
- package/dist/app/renderer/composition.d.ts.map +1 -0
- package/dist/app/renderer/composition.js +26 -0
- package/dist/app/renderer/input-bindings.d.ts +28 -0
- package/dist/app/renderer/input-bindings.d.ts.map +1 -0
- package/dist/app/renderer/input-bindings.js +42 -0
- package/dist/app/renderer/known-inputs.d.ts +8 -1
- package/dist/app/renderer/known-inputs.d.ts.map +1 -1
- package/dist/app/renderer/known-inputs.js +13 -5
- package/dist/app/renderer/prism-renderer.component.d.ts +18 -4
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +78 -44
- package/dist/app/renderer/projectable-content.d.ts +8 -1
- package/dist/app/renderer/projectable-content.d.ts.map +1 -1
- package/dist/app/renderer/projectable-content.js +40 -29
- package/dist/app/renderer/rendered-key.d.ts +20 -6
- package/dist/app/renderer/rendered-key.d.ts.map +1 -1
- package/dist/app/renderer/rendered-key.js +25 -8
- package/dist/app/renderer/snippet-generator.d.ts +14 -2
- package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
- package/dist/app/renderer/snippet-generator.js +138 -81
- package/dist/app/services/navigation-item.d.ts +10 -0
- package/dist/app/services/navigation-item.d.ts.map +1 -0
- package/dist/app/services/navigation-item.js +20 -0
- package/dist/app/services/navigation-item.types.d.ts +8 -0
- package/dist/app/services/navigation-item.types.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.d.ts +12 -0
- package/dist/app/services/prism-layout.service.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.js +17 -7
- package/dist/app/services/prism-manifest.service.d.ts +4 -0
- package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
- package/dist/app/services/prism-manifest.service.js +4 -0
- package/dist/app/services/prism-navigation.service.d.ts +12 -0
- package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
- package/dist/app/services/prism-navigation.service.js +85 -19
- package/dist/app/services/prism-panel.service.d.ts +7 -3
- package/dist/app/services/prism-panel.service.d.ts.map +1 -1
- package/dist/app/services/prism-panel.service.js +13 -4
- package/dist/app/services/prism-pseudo-state.service.d.ts +59 -14
- package/dist/app/services/prism-pseudo-state.service.d.ts.map +1 -1
- package/dist/app/services/prism-pseudo-state.service.js +86 -29
- package/dist/app/services/prism-renderer.service.d.ts +23 -0
- package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
- package/dist/app/services/prism-renderer.service.js +77 -8
- package/dist/app/services/prism-search.service.d.ts +4 -0
- package/dist/app/services/prism-search.service.d.ts.map +1 -1
- package/dist/app/services/prism-search.service.js +29 -6
- package/dist/app/services/prism-theme.service.d.ts +11 -3
- package/dist/app/services/prism-theme.service.d.ts.map +1 -1
- package/dist/app/services/prism-theme.service.js +27 -19
- package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
- package/dist/app/services/prism-url-state.service.js +81 -12
- package/dist/app/shared/badge.types.d.ts +7 -0
- package/dist/app/shared/badge.types.d.ts.map +1 -0
- package/dist/app/shared/badge.types.js +9 -0
- package/dist/app/shared/brand-mark.d.ts +35 -0
- package/dist/app/shared/brand-mark.d.ts.map +1 -0
- package/dist/app/shared/brand-mark.js +52 -0
- package/dist/app/shared/metric-bar.d.ts +6 -0
- package/dist/app/shared/metric-bar.d.ts.map +1 -0
- package/dist/app/shared/metric-bar.js +7 -0
- package/dist/app/shared/prism-badge.component.d.ts +21 -0
- package/dist/app/shared/prism-badge.component.d.ts.map +1 -0
- package/dist/app/shared/prism-badge.component.js +68 -0
- package/dist/app/shared/prism-button.component.d.ts +12 -0
- package/dist/app/shared/prism-button.component.d.ts.map +1 -0
- package/dist/app/shared/prism-button.component.js +28 -0
- package/dist/app/shared/prism-icon-button.component.d.ts +17 -0
- package/dist/app/shared/prism-icon-button.component.d.ts.map +1 -0
- package/dist/app/shared/prism-icon-button.component.js +37 -0
- package/dist/app/shared/prism-list-row.component.d.ts +17 -0
- package/dist/app/shared/prism-list-row.component.d.ts.map +1 -0
- package/dist/app/shared/prism-list-row.component.js +57 -0
- package/dist/app/shared/prism-logo.component.d.ts +24 -0
- package/dist/app/shared/prism-logo.component.d.ts.map +1 -0
- package/dist/app/shared/prism-logo.component.js +77 -0
- package/dist/app/shared/prism-metric-badge.component.d.ts +9 -4
- package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
- package/dist/app/shared/prism-metric-badge.component.js +33 -12
- package/dist/app/shared/prism-metric-card.component.d.ts +30 -0
- package/dist/app/shared/prism-metric-card.component.d.ts.map +1 -0
- package/dist/app/shared/prism-metric-card.component.js +111 -0
- package/dist/app/shared/prism-panel-toolbar.component.d.ts +13 -0
- package/dist/app/shared/prism-panel-toolbar.component.d.ts.map +1 -0
- package/dist/app/shared/prism-panel-toolbar.component.js +28 -0
- package/dist/app/shared/prism-segmented.component.d.ts +25 -0
- package/dist/app/shared/prism-segmented.component.d.ts.map +1 -0
- package/dist/app/shared/prism-segmented.component.js +77 -0
- package/dist/app/shared/prism-tabs.component.d.ts +44 -0
- package/dist/app/shared/prism-tabs.component.d.ts.map +1 -0
- package/dist/app/shared/prism-tabs.component.js +134 -0
- package/dist/app/shared/roving-focus.d.ts +13 -0
- package/dist/app/shared/roving-focus.d.ts.map +1 -0
- package/dist/app/shared/roving-focus.js +34 -0
- package/dist/app/shell/prism-shell.component.d.ts +13 -0
- package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
- package/dist/app/shell/prism-shell.component.js +57 -28
- package/dist/app/shell/should-select-first.d.ts +17 -0
- package/dist/app/shell/should-select-first.d.ts.map +1 -0
- package/dist/app/shell/should-select-first.js +13 -0
- package/dist/app/sidebar/navigation-decorations.d.ts +23 -1
- package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
- package/dist/app/sidebar/navigation-decorations.js +33 -2
- package/dist/app/sidebar/prism-sidebar.component.d.ts +5 -15
- package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
- package/dist/app/sidebar/prism-sidebar.component.js +89 -77
- package/dist/app/theme/deprecated-tokens.d.ts +15 -0
- package/dist/app/theme/deprecated-tokens.d.ts.map +1 -0
- package/dist/app/theme/deprecated-tokens.js +22 -0
- package/dist/app/theme/favicon.d.ts +3 -0
- package/dist/app/theme/favicon.d.ts.map +1 -0
- package/dist/app/theme/favicon.js +3 -0
- package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
- package/dist/app/theme/prism-default-theme.js +122 -66
- package/dist/app/theme/resolve-theme-tokens.d.ts +29 -0
- package/dist/app/theme/resolve-theme-tokens.d.ts.map +1 -0
- package/dist/app/theme/resolve-theme-tokens.js +43 -0
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts +4 -7
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +31 -69
- package/dist/app/view-tab-bar/next-view-id.d.ts +7 -1
- package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -1
- package/dist/app/view-tab-bar/next-view-id.js +9 -1
- package/dist/app/view-tab-bar/panel-inputs.d.ts +28 -0
- package/dist/app/view-tab-bar/panel-inputs.d.ts.map +1 -0
- package/dist/app/view-tab-bar/panel-inputs.js +41 -0
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts +2 -3
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-panel-host.component.js +9 -9
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts +6 -0
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +22 -29
- package/dist/builder/config-loader/deprecated-options.d.ts +9 -0
- package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -0
- package/dist/builder/config-loader/deprecated-options.js +34 -0
- package/dist/builder/manifest/composition-wrapper.generator.d.ts +14 -0
- package/dist/builder/manifest/composition-wrapper.generator.d.ts.map +1 -0
- package/dist/builder/manifest/composition-wrapper.generator.js +66 -0
- package/dist/builder/manifest/host-parser.d.ts +2 -0
- package/dist/builder/manifest/host-parser.d.ts.map +1 -1
- package/dist/builder/manifest/host-parser.js +9 -4
- package/dist/builder/manifest/manifest-imports.d.ts +34 -0
- package/dist/builder/manifest/manifest-imports.d.ts.map +1 -0
- package/dist/builder/manifest/manifest-imports.js +91 -0
- package/dist/builder/manifest/runtime-manifest.generator.d.ts +13 -0
- package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.js +137 -65
- package/dist/builder/manifest/selector-element.d.ts +16 -0
- package/dist/builder/manifest/selector-element.d.ts.map +1 -0
- package/dist/builder/manifest/selector-element.js +46 -0
- package/dist/builder/manifest/template-literal.d.ts +3 -0
- package/dist/builder/manifest/template-literal.d.ts.map +1 -0
- package/dist/builder/manifest/template-literal.js +4 -0
- package/dist/builder/plugin-runner/plugin-runner.d.ts.map +1 -1
- package/dist/builder/plugin-runner/plugin-runner.js +29 -26
- package/dist/builder/scanner/api/angular-decorators.d.ts +84 -0
- package/dist/builder/scanner/api/angular-decorators.d.ts.map +1 -0
- package/dist/builder/scanner/api/angular-decorators.js +157 -0
- package/dist/builder/scanner/api/component-api.extractor.d.ts +13 -0
- package/dist/builder/scanner/api/component-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/component-api.extractor.js +104 -0
- package/dist/builder/scanner/api/doc-tags.d.ts +13 -0
- package/dist/builder/scanner/api/doc-tags.d.ts.map +1 -0
- package/dist/builder/scanner/api/doc-tags.js +101 -0
- package/dist/builder/scanner/api/export-index.d.ts +18 -0
- package/dist/builder/scanner/api/export-index.d.ts.map +1 -0
- package/dist/builder/scanner/api/export-index.js +22 -0
- package/dist/builder/scanner/api/member.extractor.d.ts +90 -0
- package/dist/builder/scanner/api/member.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/member.extractor.js +270 -0
- package/dist/builder/scanner/api/pipe-api.extractor.d.ts +12 -0
- package/dist/builder/scanner/api/pipe-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/pipe-api.extractor.js +52 -0
- package/dist/builder/scanner/api/service-api.extractor.d.ts +14 -0
- package/dist/builder/scanner/api/service-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/service-api.extractor.js +119 -0
- package/dist/builder/scanner/api/setup.reader.d.ts +26 -0
- package/dist/builder/scanner/api/setup.reader.d.ts.map +1 -0
- package/dist/builder/scanner/api/setup.reader.js +89 -0
- package/dist/builder/scanner/api/type-collector.d.ts +24 -0
- package/dist/builder/scanner/api/type-collector.d.ts.map +1 -0
- package/dist/builder/scanner/api/type-collector.js +211 -0
- package/dist/builder/scanner/ast-utils.d.ts +8 -0
- package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
- package/dist/builder/scanner/ast-utils.js +37 -1
- package/dist/builder/scanner/class-hierarchy.d.ts +5 -3
- package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -1
- package/dist/builder/scanner/class-hierarchy.js +12 -6
- package/dist/builder/scanner/component.scanner.d.ts +60 -6
- package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/component.scanner.js +229 -58
- package/dist/builder/scanner/composition/compose-template.d.ts +36 -0
- package/dist/builder/scanner/composition/compose-template.d.ts.map +1 -0
- package/dist/builder/scanner/composition/compose-template.js +187 -0
- package/dist/builder/scanner/composition/declarables.d.ts +54 -0
- package/dist/builder/scanner/composition/declarables.d.ts.map +1 -0
- package/dist/builder/scanner/composition/declarables.js +182 -0
- package/dist/builder/scanner/composition/match-declarables.d.ts +43 -0
- package/dist/builder/scanner/composition/match-declarables.d.ts.map +1 -0
- package/dist/builder/scanner/composition/match-declarables.js +131 -0
- package/dist/builder/scanner/composition/read-composition.d.ts +77 -0
- package/dist/builder/scanner/composition/read-composition.d.ts.map +1 -0
- package/dist/builder/scanner/composition/read-composition.js +302 -0
- package/dist/builder/scanner/composition/template-elements.d.ts +12 -0
- package/dist/builder/scanner/composition/template-elements.d.ts.map +1 -0
- package/dist/builder/scanner/composition/template-elements.js +41 -0
- package/dist/builder/scanner/entry-point-discovery.d.ts +5 -0
- package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
- package/dist/builder/scanner/entry-point-discovery.js +14 -0
- package/dist/builder/scanner/entry-point.scanner.d.ts +3 -1
- package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/entry-point.scanner.js +7 -6
- package/dist/builder/scanner/index.d.ts +4 -0
- package/dist/builder/scanner/index.d.ts.map +1 -1
- package/dist/builder/scanner/index.js +2 -0
- package/dist/builder/scanner/input.extractor.d.ts +31 -2
- package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.js +73 -17
- package/dist/builder/scanner/pipe.scanner.d.ts +29 -0
- package/dist/builder/scanner/pipe.scanner.d.ts.map +1 -0
- package/dist/builder/scanner/pipe.scanner.js +65 -0
- package/dist/builder/scanner/pseudo-states.d.ts +1 -0
- package/dist/builder/scanner/pseudo-states.d.ts.map +1 -1
- package/dist/builder/scanner/pseudo-states.js +1 -1
- package/dist/builder/scanner/scanner.d.ts +27 -3
- package/dist/builder/scanner/scanner.d.ts.map +1 -1
- package/dist/builder/scanner/scanner.js +68 -24
- package/dist/builder/scanner/service/angular-decorators.d.ts +80 -0
- package/dist/builder/scanner/service/angular-decorators.d.ts.map +1 -0
- package/dist/builder/scanner/service/angular-decorators.js +154 -0
- package/dist/builder/scanner/service/doc-tags.d.ts +13 -0
- package/dist/builder/scanner/service/doc-tags.d.ts.map +1 -0
- package/dist/builder/scanner/service/doc-tags.js +97 -0
- package/dist/builder/scanner/service/export-index.d.ts +18 -0
- package/dist/builder/scanner/service/export-index.d.ts.map +1 -0
- package/dist/builder/scanner/service/export-index.js +22 -0
- package/dist/builder/scanner/service/member.extractor.d.ts +65 -0
- package/dist/builder/scanner/service/member.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/service/member.extractor.js +216 -0
- package/dist/builder/scanner/service/pipe-api.extractor.d.ts +12 -0
- package/dist/builder/scanner/service/pipe-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/service/pipe-api.extractor.js +72 -0
- package/dist/builder/scanner/service/service-api.extractor.d.ts +14 -0
- package/dist/builder/scanner/service/service-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/service/service-api.extractor.js +119 -0
- package/dist/builder/scanner/service/setup.reader.d.ts +26 -0
- package/dist/builder/scanner/service/setup.reader.d.ts.map +1 -0
- package/dist/builder/scanner/service/setup.reader.js +89 -0
- package/dist/builder/scanner/service/type-collector.d.ts +23 -0
- package/dist/builder/scanner/service/type-collector.d.ts.map +1 -0
- package/dist/builder/scanner/service/type-collector.js +210 -0
- package/dist/builder/scanner/service.scanner.d.ts +26 -0
- package/dist/builder/scanner/service.scanner.d.ts.map +1 -0
- package/dist/builder/scanner/service.scanner.js +61 -0
- package/dist/builder/scanner/showcase-diagnostics.d.ts +60 -1
- package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -1
- package/dist/builder/scanner/showcase-diagnostics.js +123 -10
- package/dist/builder/scanner/showcase-states.d.ts +17 -0
- package/dist/builder/scanner/showcase-states.d.ts.map +1 -0
- package/dist/builder/scanner/showcase-states.js +58 -0
- package/dist/builder/scanner/source-file-cache.d.ts +26 -0
- package/dist/builder/scanner/source-file-cache.d.ts.map +1 -0
- package/dist/builder/scanner/source-file-cache.js +60 -0
- package/dist/builder/shared/prism-pipeline.d.ts +6 -0
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +71 -18
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.d.ts.map +1 -1
- package/dist/decorator/showcase.types.d.ts +102 -9
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/dist/plugin/index.d.ts +6 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +4 -0
- package/dist/plugin/pipe.types.d.ts +36 -0
- package/dist/plugin/pipe.types.d.ts.map +1 -0
- package/dist/plugin/pipe.types.js +1 -0
- package/dist/plugin/plugin.types.d.ts +184 -8
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- package/dist/plugin/service.types.d.ts +124 -0
- package/dist/plugin/service.types.d.ts.map +1 -0
- package/dist/plugin/service.types.js +1 -0
- package/dist/plugin/status.d.ts +27 -0
- package/dist/plugin/status.d.ts.map +1 -0
- package/dist/plugin/status.js +26 -0
- package/dist/shared/composition.d.ts +30 -0
- package/dist/shared/composition.d.ts.map +1 -0
- package/dist/shared/composition.js +29 -0
- package/dist/shared/pseudo-state.type.d.ts +2 -1
- package/dist/shared/pseudo-state.type.d.ts.map +1 -1
- package/dist/shared/void-elements.d.ts +3 -0
- package/dist/shared/void-elements.d.ts.map +1 -0
- package/dist/shared/void-elements.js +2 -0
- package/package.json +1 -1
- package/src/builder/build/schema.json +6 -6
- package/src/builder/serve/schema.json +6 -6
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { getClassHierarchy } from '../class-hierarchy.js';
|
|
3
|
+
import { isDocumented, isInternal, readDescription, readDocTags, readParamDescriptions } from './doc-tags.js';
|
|
4
|
+
/** The lifecycle hooks Angular calls on a service or a component; they are not part of what a user calls. */
|
|
5
|
+
const LIFECYCLE_HOOKS = new Set([
|
|
6
|
+
'ngOnInit',
|
|
7
|
+
'ngOnDestroy',
|
|
8
|
+
'ngOnChanges',
|
|
9
|
+
'ngDoCheck',
|
|
10
|
+
'ngAfterContentInit',
|
|
11
|
+
'ngAfterContentChecked',
|
|
12
|
+
'ngAfterViewInit',
|
|
13
|
+
'ngAfterViewChecked'
|
|
14
|
+
]);
|
|
15
|
+
/** A type as written, or as the checker prints it when there is nothing written. Whitespace is collapsed, so a multi-line literal type stays on one line. */
|
|
16
|
+
export function readTypeText(checker, typeNode, type) {
|
|
17
|
+
return typeNode ? collapseWhitespace(typeNode.getText()) : checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation);
|
|
18
|
+
}
|
|
19
|
+
/** Gives the text of a type and nothing else: no links, no documented types. */
|
|
20
|
+
export function textOnlyResolver(checker) {
|
|
21
|
+
return {
|
|
22
|
+
ref: (typeNode, type) => ({ text: readTypeText(checker, typeNode, type) })
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The public instance members of a class and of its base classes, nearest
|
|
27
|
+
* class first and in source order. A class that declares a name hides it in
|
|
28
|
+
* the classes above, whatever it declares: an `@internal` override removes
|
|
29
|
+
* the member, a redeclaration replaces the inherited one. A static member
|
|
30
|
+
* hides nothing, as it is not an instance member.
|
|
31
|
+
*
|
|
32
|
+
* Left out: `private`, `protected` and `#` members, names with a `_` prefix,
|
|
33
|
+
* lifecycle hooks, the constructor, statics and what is tagged `@internal`.
|
|
34
|
+
* The constructor's parameter properties (`constructor(readonly id: string)`)
|
|
35
|
+
* are properties, in the constructor's place, described by its `@param`.
|
|
36
|
+
* Methods are listed with or without JSDoc. A redeclaration without JSDoc of
|
|
37
|
+
* its own keeps its signature, but takes description, tags and `@param` texts
|
|
38
|
+
* from the nearest base class member of that name that has them.
|
|
39
|
+
*/
|
|
40
|
+
export function extractMembers(classDecl, checker, types) {
|
|
41
|
+
const properties = [];
|
|
42
|
+
const methods = [];
|
|
43
|
+
for (const { name, group, declaration, docs, inherited } of collectPublicMembers(classDecl, checker)) {
|
|
44
|
+
if (ts.isMethodDeclaration(declaration))
|
|
45
|
+
methods.push(...extractOverloads(name, group.filter(ts.isMethodDeclaration), inherited, checker, types));
|
|
46
|
+
else
|
|
47
|
+
properties.push(extractProperty(name, group, declaration, docs, checker, types));
|
|
48
|
+
}
|
|
49
|
+
return { properties, methods };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The methods {@link extractMembers} lists, but only those with docs of their
|
|
53
|
+
* own or taken from a base class member of that name. A component's public
|
|
54
|
+
* methods are often only there for its own template; the documented ones are
|
|
55
|
+
* those meant to be called from outside.
|
|
56
|
+
*/
|
|
57
|
+
export function extractDocumentedMethods(classDecl, checker, types) {
|
|
58
|
+
return collectPublicMembers(classDecl, checker).flatMap(({ name, group, declaration, docs, inherited }) => ts.isMethodDeclaration(declaration) && isDocumented(docs) ? extractOverloads(name, group.filter(ts.isMethodDeclaration), inherited, checker, types) : []);
|
|
59
|
+
}
|
|
60
|
+
/** The walk behind {@link extractMembers}: hierarchy, exclusions and inherited docs, properties and methods in one list. */
|
|
61
|
+
function collectPublicMembers(classDecl, checker) {
|
|
62
|
+
const members = [];
|
|
63
|
+
const declared = new Set();
|
|
64
|
+
const levels = getClassHierarchy(classDecl, checker).classes.map(({ classDecl: current }) => groupByName(current));
|
|
65
|
+
levels.forEach((groups, level) => {
|
|
66
|
+
for (const [name, group] of groups) {
|
|
67
|
+
if (declared.has(name))
|
|
68
|
+
continue;
|
|
69
|
+
// The doc block sits on one of them: the first overload, or the getter or the setter.
|
|
70
|
+
const declaration = group.find(hasOwnDocs) ?? group[0];
|
|
71
|
+
if (!isPublicApi(name, group, declaration))
|
|
72
|
+
continue;
|
|
73
|
+
const inherited = hasOwnDocs(declaration) ? undefined : findInheritedDocs(levels.slice(level + 1), name);
|
|
74
|
+
members.push({ name, group, declaration, docs: inherited ?? declaration, ...(inherited && { inherited }) });
|
|
75
|
+
}
|
|
76
|
+
for (const name of groups.keys())
|
|
77
|
+
declared.add(name);
|
|
78
|
+
});
|
|
79
|
+
return members;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The members of an interface or an object literal type, the inherited ones
|
|
83
|
+
* included, own members first. What is tagged `@internal` is left out; there
|
|
84
|
+
* is nothing private to leave out.
|
|
85
|
+
*/
|
|
86
|
+
export function extractObjectTypeMembers(type, checker, types) {
|
|
87
|
+
const properties = [];
|
|
88
|
+
const methods = [];
|
|
89
|
+
for (const symbol of checker.getPropertiesOfType(type)) {
|
|
90
|
+
const group = (symbol.declarations ?? []).filter((d) => ts.isMethodSignature(d) ||
|
|
91
|
+
ts.isMethodDeclaration(d) ||
|
|
92
|
+
ts.isPropertySignature(d) ||
|
|
93
|
+
ts.isPropertyDeclaration(d) ||
|
|
94
|
+
ts.isGetAccessor(d) ||
|
|
95
|
+
ts.isSetAccessor(d));
|
|
96
|
+
const declaration = group.find(isDocumented) ?? group[0];
|
|
97
|
+
if (!declaration || isInternal(declaration))
|
|
98
|
+
continue;
|
|
99
|
+
if (ts.isMethodSignature(declaration) || ts.isMethodDeclaration(declaration)) {
|
|
100
|
+
methods.push(...extractOverloads(symbol.name, group.filter(isMethodLike), undefined, checker, types));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
properties.push(extractProperty(symbol.name, group, declaration, declaration, checker, types));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { properties, methods };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The named instance members of a class by name, in source order: a getter and
|
|
110
|
+
* its setter, or the overloads of a method, share one entry. The parameter
|
|
111
|
+
* properties of the constructor come in where the constructor stands.
|
|
112
|
+
*/
|
|
113
|
+
function groupByName(classDecl) {
|
|
114
|
+
const groups = new Map();
|
|
115
|
+
const add = (name, member) => groups.set(name, [...(groups.get(name) ?? []), member]);
|
|
116
|
+
for (const member of classDecl.members) {
|
|
117
|
+
if (ts.isConstructorDeclaration(member)) {
|
|
118
|
+
for (const param of member.parameters) {
|
|
119
|
+
if (ts.isParameterPropertyDeclaration(param, member))
|
|
120
|
+
add(param.name.text, param);
|
|
121
|
+
}
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (!(ts.isPropertyDeclaration(member) || ts.isMethodDeclaration(member) || ts.isGetAccessorDeclaration(member) || ts.isSetAccessorDeclaration(member)))
|
|
125
|
+
continue;
|
|
126
|
+
if (hasModifier(member, ts.SyntaxKind.StaticKeyword))
|
|
127
|
+
continue;
|
|
128
|
+
const name = getMemberName(member);
|
|
129
|
+
if (name !== undefined)
|
|
130
|
+
add(name, member);
|
|
131
|
+
}
|
|
132
|
+
return groups;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Whether a member is documented where it is declared: by a doc block of its
|
|
136
|
+
* own, or, for a parameter property, by the constructor's `@param` for it.
|
|
137
|
+
*/
|
|
138
|
+
function hasOwnDocs(member) {
|
|
139
|
+
return isDocumented(member) || (ts.isParameter(member) && readParamDescriptions(member.parent).has(member.name.text));
|
|
140
|
+
}
|
|
141
|
+
function isPublicApi(name, group, declaration) {
|
|
142
|
+
if (name.startsWith('_') || LIFECYCLE_HOOKS.has(name))
|
|
143
|
+
return false;
|
|
144
|
+
if (group.some((member) => hasModifier(member, ts.SyntaxKind.PrivateKeyword) || hasModifier(member, ts.SyntaxKind.ProtectedKeyword)))
|
|
145
|
+
return false;
|
|
146
|
+
// Only its own block: a member is internal where it is declared, as for `stripInternal`.
|
|
147
|
+
return !isInternal(declaration);
|
|
148
|
+
}
|
|
149
|
+
/** The documented declaration of a name in the nearest of the given base classes that has one. */
|
|
150
|
+
function findInheritedDocs(levels, name) {
|
|
151
|
+
for (const groups of levels) {
|
|
152
|
+
const documented = groups.get(name)?.find(hasOwnDocs);
|
|
153
|
+
if (documented)
|
|
154
|
+
return documented;
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
/** `docs` is the node the doc block is read from: the declaration itself, or a declaration it inherits the docs of. */
|
|
159
|
+
function extractProperty(name, group, declaration, docs, checker, types) {
|
|
160
|
+
const getter = group.find(ts.isGetAccessorDeclaration);
|
|
161
|
+
const setter = group.find(ts.isSetAccessorDeclaration);
|
|
162
|
+
const isField = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration) || ts.isParameter(declaration);
|
|
163
|
+
// A property reads its type from the getter, and from the setter's parameter when there is none.
|
|
164
|
+
const typeNode = isField ? declaration.type : (getter?.type ?? setter?.parameters[0]?.type);
|
|
165
|
+
const property = {
|
|
166
|
+
name,
|
|
167
|
+
type: types.ref(typeNode, checker.getTypeAtLocation(declaration), `type of ${name}`, { kind: 'property', name }),
|
|
168
|
+
readonly: isField ? hasModifier(declaration, ts.SyntaxKind.ReadonlyKeyword) : !!getter && !setter,
|
|
169
|
+
tags: readDocTags(docs)
|
|
170
|
+
};
|
|
171
|
+
if (isField && declaration.questionToken)
|
|
172
|
+
property.optional = true;
|
|
173
|
+
// A parameter property has its text in the constructor's `@param`, unless it carries a block of its own.
|
|
174
|
+
const description = readDescription(docs) ?? (ts.isParameter(docs) && ts.isIdentifier(docs.name) ? readParamDescriptions(docs.parent).get(docs.name.text) : undefined);
|
|
175
|
+
if (description)
|
|
176
|
+
property.description = description;
|
|
177
|
+
return property;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The signatures a caller can use of a method that `declarations` declare in
|
|
181
|
+
* one class, in source order: its overload signatures, or the one declaration
|
|
182
|
+
* when there are none. The implementation of overloads is not one a caller
|
|
183
|
+
* can use. In a .d.ts every declaration is a signature.
|
|
184
|
+
*
|
|
185
|
+
* A signature without a doc block of its own takes the one of the
|
|
186
|
+
* implementation, then of the first documented signature, then `inherited`,
|
|
187
|
+
* the documented declaration of the method in the nearest base class that has
|
|
188
|
+
* one. The implementation and a base class document the method as a whole, so
|
|
189
|
+
* all of their block is taken. Another signature's block is about that
|
|
190
|
+
* signature: its description and `@param` texts are taken, its tags are not,
|
|
191
|
+
* since an overload marked `@deprecated` does not deprecate the one that
|
|
192
|
+
* replaces it.
|
|
193
|
+
*/
|
|
194
|
+
export function extractOverloads(name, declarations, inherited, checker, types) {
|
|
195
|
+
const signatures = declarations.filter((declaration) => !hasBody(declaration));
|
|
196
|
+
const implementation = declarations.find((declaration) => hasBody(declaration) && isDocumented(declaration));
|
|
197
|
+
const sibling = signatures.find(isDocumented);
|
|
198
|
+
const fallback = implementation ?? sibling ?? inherited;
|
|
199
|
+
return (signatures.length > 0 ? signatures : declarations).map((signature) => {
|
|
200
|
+
const docs = isDocumented(signature) ? signature : (fallback ?? signature);
|
|
201
|
+
const method = extractMethod(name, signature, docs, checker, types);
|
|
202
|
+
if (docs !== signature && docs === sibling)
|
|
203
|
+
method.tags = {};
|
|
204
|
+
return method;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The signature of a method, or of a function such as a setup function, with
|
|
209
|
+
* the doc block read from `docs`: the declaration itself, the statement of a
|
|
210
|
+
* `const` arrow function, or a declaration it inherits the docs of.
|
|
211
|
+
*/
|
|
212
|
+
export function extractMethod(name, declaration, docs, checker, types) {
|
|
213
|
+
const signature = checker.getSignatureFromDeclaration(declaration);
|
|
214
|
+
const returnType = signature ? checker.getReturnTypeOfSignature(signature) : checker.getTypeAtLocation(declaration);
|
|
215
|
+
const descriptions = readParamDescriptions(docs);
|
|
216
|
+
const result = {
|
|
217
|
+
name,
|
|
218
|
+
params: declaration.parameters.filter((param) => !isThisParameter(param)).map((param) => extractParam(name, param, descriptions, checker, types)),
|
|
219
|
+
returnType: types.ref(declaration.type, returnType, `returned by ${name}()`, { kind: 'return', method: name }),
|
|
220
|
+
tags: readDocTags(docs)
|
|
221
|
+
};
|
|
222
|
+
const description = readDescription(docs);
|
|
223
|
+
if (description)
|
|
224
|
+
result.description = description;
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
function extractParam(methodName, param, descriptions, checker, types) {
|
|
228
|
+
const name = ts.isIdentifier(param.name) ? param.name.text : collapseWhitespace(param.name.getText());
|
|
229
|
+
const result = {
|
|
230
|
+
name,
|
|
231
|
+
type: types.ref(param.type, checker.getTypeAtLocation(param), `parameter of ${methodName}()`, { kind: 'parameter', name, method: methodName }),
|
|
232
|
+
optional: !!(param.questionToken || param.initializer)
|
|
233
|
+
};
|
|
234
|
+
if (param.dotDotDotToken)
|
|
235
|
+
result.rest = true;
|
|
236
|
+
if (param.initializer)
|
|
237
|
+
result.defaultValue = collapseWhitespace(param.initializer.getText());
|
|
238
|
+
const description = descriptions.get(name);
|
|
239
|
+
if (description)
|
|
240
|
+
result.description = description;
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
/** The first parameter that is not `this`. */
|
|
244
|
+
export function firstParameter(declaration) {
|
|
245
|
+
return declaration.parameters.find((param) => !isThisParameter(param));
|
|
246
|
+
}
|
|
247
|
+
function isThisParameter(param) {
|
|
248
|
+
return ts.isIdentifier(param.name) && param.name.text === 'this';
|
|
249
|
+
}
|
|
250
|
+
/** `#private` and computed names have none: neither is part of the API a user reads. */
|
|
251
|
+
function getMemberName(member) {
|
|
252
|
+
if (!member.name)
|
|
253
|
+
return undefined;
|
|
254
|
+
if (ts.isIdentifier(member.name) || ts.isStringLiteral(member.name))
|
|
255
|
+
return member.name.text;
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
function isMethodLike(node) {
|
|
259
|
+
return ts.isMethodDeclaration(node) || ts.isMethodSignature(node);
|
|
260
|
+
}
|
|
261
|
+
/** An interface method has none, nor does an overload signature or a method in a .d.ts. */
|
|
262
|
+
function hasBody(declaration) {
|
|
263
|
+
return ts.isMethodDeclaration(declaration) && !!declaration.body;
|
|
264
|
+
}
|
|
265
|
+
function hasModifier(node, kind) {
|
|
266
|
+
return ts.canHaveModifiers(node) && !!ts.getModifiers(node)?.some((modifier) => modifier.kind === kind);
|
|
267
|
+
}
|
|
268
|
+
export function collapseWhitespace(text) {
|
|
269
|
+
return text.replace(/\s+/g, ' ').trim();
|
|
270
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { PipeApi } from '../../../plugin/pipe.types.js';
|
|
3
|
+
import type { ExportIndex } from './export-index.js';
|
|
4
|
+
import type { SetupRef } from './setup.reader.js';
|
|
5
|
+
/**
|
|
6
|
+
* What the API page of a pipe shows: the description and tags of the class,
|
|
7
|
+
* the signatures of `transform()`, its setup functions and tokens with their
|
|
8
|
+
* config tables, and every documented type all of them reach. A template only
|
|
9
|
+
* calls `transform()`: no other member is read, and none adds a type.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractPipeApi(classDecl: ts.ClassDeclaration, setupRefs: SetupRef[], checker: ts.TypeChecker, exportIndex: ExportIndex): PipeApi;
|
|
12
|
+
//# sourceMappingURL=pipe-api.extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-api.extractor.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/pipe-api.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAWhJ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { getClassChain } from '../class-hierarchy.js';
|
|
3
|
+
import { isDocumented, readDescription, readDocTags } from './doc-tags.js';
|
|
4
|
+
import { extractOverloads } from './member.extractor.js';
|
|
5
|
+
import { describeSetupEntries } from './service-api.extractor.js';
|
|
6
|
+
import { createTypeCollector } from './type-collector.js';
|
|
7
|
+
/**
|
|
8
|
+
* What the API page of a pipe shows: the description and tags of the class,
|
|
9
|
+
* the signatures of `transform()`, its setup functions and tokens with their
|
|
10
|
+
* config tables, and every documented type all of them reach. A template only
|
|
11
|
+
* calls `transform()`: no other member is read, and none adds a type.
|
|
12
|
+
*/
|
|
13
|
+
export function extractPipeApi(classDecl, setupRefs, checker, exportIndex) {
|
|
14
|
+
const collector = createTypeCollector(checker, exportIndex);
|
|
15
|
+
const transform = extractTransform(classDecl, checker, collector);
|
|
16
|
+
const setup = describeSetupEntries(setupRefs, checker, collector);
|
|
17
|
+
const api = { tags: readDocTags(classDecl), transform, setup, types: collector.drain() };
|
|
18
|
+
// The class's own block only: unlike a member, a pipe does not take the description of its base class.
|
|
19
|
+
const description = readDescription(classDecl);
|
|
20
|
+
if (description)
|
|
21
|
+
api.description = description;
|
|
22
|
+
return api;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The signatures of `transform()` in the nearest class that declares it,
|
|
26
|
+
* which may be a base class that only exists as a declaration, such as
|
|
27
|
+
* `DatePipe` in the .d.ts of `@angular/common`. See {@link extractOverloads}
|
|
28
|
+
* for which signatures are listed and where each takes its docs from.
|
|
29
|
+
*/
|
|
30
|
+
function extractTransform(classDecl, checker, types) {
|
|
31
|
+
const levels = getClassChain(classDecl, checker).map(getTransformDeclarations);
|
|
32
|
+
const level = levels.findIndex((declarations) => declarations.length > 0);
|
|
33
|
+
if (level < 0)
|
|
34
|
+
return [];
|
|
35
|
+
return extractOverloads('transform', levels[level], findInheritedDocs(levels.slice(level + 1)), checker, types);
|
|
36
|
+
}
|
|
37
|
+
/** The instance declarations of `transform()` in a class, in source order: the overload signatures and the implementation. */
|
|
38
|
+
function getTransformDeclarations(classDecl) {
|
|
39
|
+
return classDecl.members.filter((member) => ts.isMethodDeclaration(member) &&
|
|
40
|
+
(ts.isIdentifier(member.name) || ts.isStringLiteral(member.name)) &&
|
|
41
|
+
member.name.text === 'transform' &&
|
|
42
|
+
!ts.getModifiers(member)?.some((modifier) => modifier.kind === ts.SyntaxKind.StaticKeyword));
|
|
43
|
+
}
|
|
44
|
+
/** The first documented `transform()` declaration in the nearest of the given base classes that has one. */
|
|
45
|
+
function findInheritedDocs(levels) {
|
|
46
|
+
for (const declarations of levels) {
|
|
47
|
+
const documented = declarations.find(isDocumented);
|
|
48
|
+
if (documented)
|
|
49
|
+
return documented;
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ApiSetupEntry, ServiceApi } from '../../../plugin/service.types.js';
|
|
3
|
+
import type { ExportIndex } from './export-index.js';
|
|
4
|
+
import { type SetupRef } from './setup.reader.js';
|
|
5
|
+
import { type TypeCollector } from './type-collector.js';
|
|
6
|
+
/**
|
|
7
|
+
* What the API page of a service shows: the description and tags of the
|
|
8
|
+
* class, its public members, its setup functions and tokens with their config
|
|
9
|
+
* tables, and every documented type all of them reach.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractServiceApi(classDecl: ts.ClassDeclaration, setupRefs: SetupRef[], checker: ts.TypeChecker, exportIndex: ExportIndex): ServiceApi;
|
|
12
|
+
/** The setup functions and tokens of a service or a pipe, with their config tables; the types they reach go to `collector`. */
|
|
13
|
+
export declare function describeSetupEntries(setupRefs: SetupRef[], checker: ts.TypeChecker, collector: TypeCollector): ApiSetupEntry[];
|
|
14
|
+
//# sourceMappingURL=service-api.extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-api.extractor.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/service-api.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAe,aAAa,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE/F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,KAAK,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAK9E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,UAAU,CAUtJ;AAED,+HAA+H;AAC/H,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,aAAa,GAAG,aAAa,EAAE,CAE9H"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { readDescription, readDocTags } from './doc-tags.js';
|
|
3
|
+
import { extractMembers, extractMethod, extractObjectTypeMembers, firstParameter } from './member.extractor.js';
|
|
4
|
+
import { skipParentheses } from './setup.reader.js';
|
|
5
|
+
import { createTypeCollector } from './type-collector.js';
|
|
6
|
+
/** The wrappers a config table looks through. */
|
|
7
|
+
const CONFIG_WRAPPERS = new Set(['Partial', 'Required', 'Readonly']);
|
|
8
|
+
/**
|
|
9
|
+
* What the API page of a service shows: the description and tags of the
|
|
10
|
+
* class, its public members, its setup functions and tokens with their config
|
|
11
|
+
* tables, and every documented type all of them reach.
|
|
12
|
+
*/
|
|
13
|
+
export function extractServiceApi(classDecl, setupRefs, checker, exportIndex) {
|
|
14
|
+
const collector = createTypeCollector(checker, exportIndex);
|
|
15
|
+
const { properties, methods } = extractMembers(classDecl, checker, collector);
|
|
16
|
+
const setup = describeSetupEntries(setupRefs, checker, collector);
|
|
17
|
+
const api = { tags: readDocTags(classDecl), properties, methods, setup, types: collector.drain() };
|
|
18
|
+
const description = readDescription(classDecl);
|
|
19
|
+
if (description)
|
|
20
|
+
api.description = description;
|
|
21
|
+
return api;
|
|
22
|
+
}
|
|
23
|
+
/** The setup functions and tokens of a service or a pipe, with their config tables; the types they reach go to `collector`. */
|
|
24
|
+
export function describeSetupEntries(setupRefs, checker, collector) {
|
|
25
|
+
return setupRefs.map((ref) => (ref.kind === 'function' ? describeSetupFunction(ref, checker, collector) : describeSetupToken(ref, checker, collector)));
|
|
26
|
+
}
|
|
27
|
+
/** A setup function: its signature and docs, and the options of its first parameter when that is an object. */
|
|
28
|
+
function describeSetupFunction({ name, declaration, importPath }, checker, collector) {
|
|
29
|
+
const fn = ts.isFunctionDeclaration(declaration) ? declaration : skipParentheses(declaration.initializer);
|
|
30
|
+
const { params, returnType, description, tags } = extractMethod(name, fn, docNodeOf(declaration), checker, collector);
|
|
31
|
+
const entry = { name, kind: 'function', importPath, tags, params, returnType };
|
|
32
|
+
const param = firstParameter(fn);
|
|
33
|
+
const config = param && readConfig(param.type, checker.getTypeAtLocation(param), checker, collector.within(params[0].name));
|
|
34
|
+
if (description)
|
|
35
|
+
entry.description = description;
|
|
36
|
+
if (config)
|
|
37
|
+
entry.config = config;
|
|
38
|
+
return entry;
|
|
39
|
+
}
|
|
40
|
+
/** A token: `InjectionToken<T>` as written, and the options of `T` when that is an object. */
|
|
41
|
+
function describeSetupToken({ name, declaration, importPath }, checker, collector) {
|
|
42
|
+
// A token is always a `const`: the setup reader takes no other declaration for one.
|
|
43
|
+
const variable = declaration;
|
|
44
|
+
const typeNode = variable.type;
|
|
45
|
+
const type = checker.getTypeAtLocation(variable.name);
|
|
46
|
+
const docs = docNodeOf(variable);
|
|
47
|
+
const entry = {
|
|
48
|
+
name,
|
|
49
|
+
kind: 'token',
|
|
50
|
+
importPath,
|
|
51
|
+
tags: readDocTags(docs),
|
|
52
|
+
tokenType: collector.ref(typeNode, type, `type of ${name}`, { kind: 'property', name })
|
|
53
|
+
};
|
|
54
|
+
const argumentNode = typeNode && ts.isTypeReferenceNode(typeNode) ? typeNode.typeArguments?.[0] : undefined;
|
|
55
|
+
const argument = argumentNode ? checker.getTypeFromTypeNode(argumentNode) : isTypeReference(type) ? checker.getTypeArguments(type)[0] : undefined;
|
|
56
|
+
const config = argument && readConfig(argumentNode, argument, checker, collector.within(name));
|
|
57
|
+
const description = readDescription(docs);
|
|
58
|
+
if (description)
|
|
59
|
+
entry.description = description;
|
|
60
|
+
if (config)
|
|
61
|
+
entry.config = config;
|
|
62
|
+
return entry;
|
|
63
|
+
}
|
|
64
|
+
/** The doc block of a `const` sits on its statement, not on the declaration. */
|
|
65
|
+
function docNodeOf(declaration) {
|
|
66
|
+
return ts.isVariableDeclaration(declaration) && ts.isVariableStatement(declaration.parent.parent) ? declaration.parent.parent : declaration;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The options of a config object: the properties of an interface, an object
|
|
70
|
+
* literal type or an object type alias, looked for through `Partial`,
|
|
71
|
+
* `Required` and `Readonly`, which change what the options say. `undefined`
|
|
72
|
+
* for anything else, a class or an array or a primitive.
|
|
73
|
+
*/
|
|
74
|
+
function readConfig(typeNode, type, checker, types) {
|
|
75
|
+
const wrappers = [];
|
|
76
|
+
let node = typeNode;
|
|
77
|
+
// The type as annotated: the parameter's own type has `undefined` in it when the parameter is optional.
|
|
78
|
+
let current = node ? checker.getTypeFromTypeNode(node) : checker.getNonNullableType(type);
|
|
79
|
+
// Through the annotation where there is one, through the alias the checker keeps otherwise.
|
|
80
|
+
for (;;) {
|
|
81
|
+
if (node && ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && CONFIG_WRAPPERS.has(node.typeName.text) && node.typeArguments?.length === 1) {
|
|
82
|
+
wrappers.push(node.typeName.text);
|
|
83
|
+
node = node.typeArguments[0];
|
|
84
|
+
current = checker.getTypeFromTypeNode(node);
|
|
85
|
+
}
|
|
86
|
+
else if (!node && current.aliasSymbol && CONFIG_WRAPPERS.has(current.aliasSymbol.name) && current.aliasTypeArguments?.length === 1) {
|
|
87
|
+
wrappers.push(current.aliasSymbol.name);
|
|
88
|
+
current = current.aliasTypeArguments[0];
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!isConfigObject(current, checker))
|
|
95
|
+
return undefined;
|
|
96
|
+
const { properties } = extractObjectTypeMembers(current, checker, types);
|
|
97
|
+
// The innermost wrapper first: `Partial<Required<T>>` leaves every option optional.
|
|
98
|
+
for (const wrapper of wrappers.reverse())
|
|
99
|
+
properties.forEach((option) => applyWrapper(wrapper, option));
|
|
100
|
+
return properties.length > 0 ? properties : undefined;
|
|
101
|
+
}
|
|
102
|
+
function applyWrapper(wrapper, option) {
|
|
103
|
+
if (wrapper === 'Partial')
|
|
104
|
+
option.optional = true;
|
|
105
|
+
else if (wrapper === 'Required')
|
|
106
|
+
delete option.optional;
|
|
107
|
+
else
|
|
108
|
+
option.readonly = true;
|
|
109
|
+
}
|
|
110
|
+
function isConfigObject(type, checker) {
|
|
111
|
+
if (type.isIntersection())
|
|
112
|
+
return type.types.every((part) => isConfigObject(part, checker));
|
|
113
|
+
if (!(type.flags & ts.TypeFlags.Object) || type.objectFlags & ts.ObjectFlags.Class)
|
|
114
|
+
return false;
|
|
115
|
+
return !checker.isArrayType(type) && !checker.isTupleType(type) && type.getCallSignatures().length === 0;
|
|
116
|
+
}
|
|
117
|
+
function isTypeReference(type) {
|
|
118
|
+
return !!(type.flags & ts.TypeFlags.Object) && !!(type.objectFlags & ts.ObjectFlags.Reference);
|
|
119
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ExportIndex } from './export-index.js';
|
|
3
|
+
/** One entry of a service's `setup`: what the styleguide shows to configure the service, and where to import it from. */
|
|
4
|
+
export interface SetupRef {
|
|
5
|
+
name: string;
|
|
6
|
+
kind: 'function' | 'token';
|
|
7
|
+
declaration: ts.FunctionDeclaration | ts.VariableDeclaration;
|
|
8
|
+
importPath: string;
|
|
9
|
+
}
|
|
10
|
+
/** Only the literal: a `setup` that arrives through a spread or a constant is not found, and dropped without a word. */
|
|
11
|
+
export declare function findSetupProperty(showcaseArg: ts.Expression): ts.ObjectLiteralElementLike | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Read the functions and tokens a service names in `setup: () => [provideToast, TOAST_LABELS]`.
|
|
14
|
+
*
|
|
15
|
+
* `setup` is an arrow function, not an array, so that the imports it refers to
|
|
16
|
+
* are only touched when it runs: a showcase file that imports from a module
|
|
17
|
+
* which imports the service back would otherwise hit the temporal dead zone.
|
|
18
|
+
* The scanner never runs it. It reads the array literal in the source and
|
|
19
|
+
* traces each element to its declaration, and to the entry point that exports it.
|
|
20
|
+
*
|
|
21
|
+
* What cannot be read is reported and dropped: a `setup` of another shape as a
|
|
22
|
+
* whole, any other entry on its own.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readSetupRefs(showcaseArg: ts.Expression, className: string, checker: ts.TypeChecker, exportIndex: ExportIndex, report: (message: string) => void): SetupRef[];
|
|
25
|
+
export declare function skipParentheses(expression: ts.Expression): ts.Expression;
|
|
26
|
+
//# sourceMappingURL=setup.reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.reader.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/setup.reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,yHAAyH;AACzH,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAC3B,WAAW,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,mBAAmB,CAAC;IAC7D,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wHAAwH;AACxH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,wBAAwB,GAAG,SAAS,CAIrG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CACzB,WAAW,EAAE,EAAE,CAAC,UAAU,EAC1B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAClC,QAAQ,EAAE,CAkCZ;AAaD,wBAAgB,eAAe,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CAKxE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { describeInvalidSetup, describeSetupEntryNotExported, describeSetupEntryNotSupported } from '../showcase-diagnostics.js';
|
|
3
|
+
/** Only the literal: a `setup` that arrives through a spread or a constant is not found, and dropped without a word. */
|
|
4
|
+
export function findSetupProperty(showcaseArg) {
|
|
5
|
+
if (!ts.isObjectLiteralExpression(showcaseArg))
|
|
6
|
+
return undefined;
|
|
7
|
+
return showcaseArg.properties.find((p) => p.name !== undefined && (ts.isIdentifier(p.name) || ts.isStringLiteral(p.name)) && p.name.text === 'setup');
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Read the functions and tokens a service names in `setup: () => [provideToast, TOAST_LABELS]`.
|
|
11
|
+
*
|
|
12
|
+
* `setup` is an arrow function, not an array, so that the imports it refers to
|
|
13
|
+
* are only touched when it runs: a showcase file that imports from a module
|
|
14
|
+
* which imports the service back would otherwise hit the temporal dead zone.
|
|
15
|
+
* The scanner never runs it. It reads the array literal in the source and
|
|
16
|
+
* traces each element to its declaration, and to the entry point that exports it.
|
|
17
|
+
*
|
|
18
|
+
* What cannot be read is reported and dropped: a `setup` of another shape as a
|
|
19
|
+
* whole, any other entry on its own.
|
|
20
|
+
*/
|
|
21
|
+
export function readSetupRefs(showcaseArg, className, checker, exportIndex, report) {
|
|
22
|
+
const property = findSetupProperty(showcaseArg);
|
|
23
|
+
if (!property)
|
|
24
|
+
return [];
|
|
25
|
+
const array = ts.isPropertyAssignment(property) ? readSetupArray(property.initializer) : undefined;
|
|
26
|
+
if (!array) {
|
|
27
|
+
report(describeInvalidSetup(className, ts.isPropertyAssignment(property) ? property.initializer : property));
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const refs = [];
|
|
31
|
+
array.elements.forEach((element, index) => {
|
|
32
|
+
const symbol = resolveEntry(element, checker);
|
|
33
|
+
const target = symbol && classifyEntry(symbol, checker);
|
|
34
|
+
if (!symbol || !target) {
|
|
35
|
+
report(describeSetupEntryNotSupported(className, index, element));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const importPath = exportIndex.get(symbol);
|
|
39
|
+
if (importPath === undefined) {
|
|
40
|
+
report(describeSetupEntryNotExported(className, index, element));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
refs.push({ name: symbol.name, ...target, importPath });
|
|
44
|
+
});
|
|
45
|
+
return refs;
|
|
46
|
+
}
|
|
47
|
+
/** The array literal an arrow function returns, as an expression body or as the only statement of a block. */
|
|
48
|
+
function readSetupArray(initializer) {
|
|
49
|
+
if (!ts.isArrowFunction(initializer))
|
|
50
|
+
return undefined;
|
|
51
|
+
const { body } = initializer;
|
|
52
|
+
const returned = ts.isBlock(body) ? (body.statements.length === 1 && ts.isReturnStatement(body.statements[0]) ? body.statements[0].expression : undefined) : body;
|
|
53
|
+
const value = returned && skipParentheses(returned);
|
|
54
|
+
return value && ts.isArrayLiteralExpression(value) ? value : undefined;
|
|
55
|
+
}
|
|
56
|
+
export function skipParentheses(expression) {
|
|
57
|
+
let current = expression;
|
|
58
|
+
while (ts.isParenthesizedExpression(current))
|
|
59
|
+
current = current.expression;
|
|
60
|
+
return current;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The declaration symbol an entry refers to, with an import followed to its
|
|
64
|
+
* source: the symbol the export index holds. Only a name or a property access
|
|
65
|
+
* (`toasts.provideToast`) can refer to one; a call or a spread cannot.
|
|
66
|
+
*/
|
|
67
|
+
function resolveEntry(element, checker) {
|
|
68
|
+
if (!ts.isIdentifier(element) && !ts.isPropertyAccessExpression(element))
|
|
69
|
+
return undefined;
|
|
70
|
+
const symbol = checker.getSymbolAtLocation(element);
|
|
71
|
+
if (!symbol)
|
|
72
|
+
return undefined;
|
|
73
|
+
// A declaration that is exported from its own file is a local symbol there, and the export symbol is the one that is indexed.
|
|
74
|
+
return checker.getExportSymbolOfSymbol(symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol);
|
|
75
|
+
}
|
|
76
|
+
function classifyEntry(symbol, checker) {
|
|
77
|
+
for (const declaration of symbol.declarations ?? []) {
|
|
78
|
+
if (ts.isFunctionDeclaration(declaration))
|
|
79
|
+
return { kind: 'function', declaration };
|
|
80
|
+
if (!ts.isVariableDeclaration(declaration) || !(ts.getCombinedNodeFlags(declaration) & ts.NodeFlags.Const))
|
|
81
|
+
continue;
|
|
82
|
+
const initializer = declaration.initializer && skipParentheses(declaration.initializer);
|
|
83
|
+
if (initializer && (ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer)))
|
|
84
|
+
return { kind: 'function', declaration };
|
|
85
|
+
if (checker.getTypeAtLocation(declaration.name).getSymbol()?.name === 'InjectionToken')
|
|
86
|
+
return { kind: 'token', declaration };
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ApiTypeDoc } from '../../../plugin/service.types.js';
|
|
3
|
+
import type { ExportIndex } from './export-index.js';
|
|
4
|
+
import { type TypeRefResolver } from './member.extractor.js';
|
|
5
|
+
/** A {@link TypeRefResolver} that links the documented types it meets and collects them for the `types` of an API page. */
|
|
6
|
+
export interface TypeCollector extends TypeRefResolver {
|
|
7
|
+
/** A resolver for the members of the value at `path`, e.g. the options of a setup function's `config`. */
|
|
8
|
+
within(path: string): TypeRefResolver;
|
|
9
|
+
/** Documents what was reached so far, and what their members reach in turn, in the order of first reach. */
|
|
10
|
+
drain(): ApiTypeDoc[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Collects the types the API of a service, pipe or component reaches. A type
|
|
14
|
+
* is documented when it is an interface, class, type alias or enum, a scanned
|
|
15
|
+
* entry point exports it, and it is not tagged `@internal`. Anything else,
|
|
16
|
+
* `Signal` or `Provider` or a type the library keeps to itself, stays text
|
|
17
|
+
* without a link.
|
|
18
|
+
*
|
|
19
|
+
* Each type is documented once, under the id it got when it was first
|
|
20
|
+
* reached: its name, or `${name}@${importPath}` when a type of that name was
|
|
21
|
+
* reached before. That also ends a type that refers to itself.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createTypeCollector(checker: ts.TypeChecker, exportIndex: ExportIndex): TypeCollector;
|
|
24
|
+
//# sourceMappingURL=type-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-collector.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/type-collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAA0B,UAAU,EAAc,MAAM,kCAAkC,CAAC;AAEvG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAA8E,KAAK,eAAe,EAAiB,MAAM,uBAAuB,CAAC;AAexJ,2HAA2H;AAC3H,MAAM,WAAW,aAAc,SAAQ,eAAe;IAClD,0GAA0G;IAC1G,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IACtC,4GAA4G;IAC5G,KAAK,IAAI,UAAU,EAAE,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,aAAa,CAqGpG"}
|