@contentful/experience-design-system-extraction 2.36.2-dev-build-c4497102.0 → 2.36.2-dev-build-a6f80ae6.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/dist/package.json +1 -1
- package/dist/src/extract/{framework-adapters/astro/extractor.d.ts → astro.d.ts} +1 -1
- package/dist/src/extract/astro.js +226 -0
- package/dist/src/extract/{framework-adapters/shared/helpers/file-processing/file-workers.d.ts → file-extraction-workers.d.ts} +13 -1
- package/dist/src/extract/{framework-adapters/shared/helpers/file-processing/file-workers.js → file-extraction-workers.js} +19 -0
- package/dist/src/extract/non-authorable-filter.d.ts +17 -0
- package/dist/src/extract/non-authorable-filter.js +60 -0
- package/dist/src/extract/pipeline.d.ts +7 -0
- package/dist/src/extract/pipeline.js +343 -0
- package/dist/src/extract/{framework-adapters/react/extractor.d.ts → react.d.ts} +1 -1
- package/dist/src/extract/react.js +2069 -0
- package/dist/src/extract/scoring.d.ts +12 -0
- package/dist/src/extract/{services/quality/helpers/scoring/collect-scoring-inputs.js → scoring.js} +24 -10
- package/dist/src/extract/slot-detection.d.ts +35 -0
- package/dist/src/extract/slot-detection.js +98 -0
- package/dist/src/extract/{services/quality/helpers/inspection/inspect-component-source.d.ts → source-inspection.d.ts} +6 -3
- package/dist/src/extract/{services/quality/helpers/inspection/inspect-component-source.js → source-inspection.js} +65 -5
- package/dist/src/extract/{framework-adapters/shared/helpers/get-node-source-lines.d.ts → source-line-metadata.d.ts} +1 -1
- package/dist/src/extract/{framework-adapters/stencil/extractor.d.ts → stencil.d.ts} +1 -1
- package/dist/src/extract/stencil.js +312 -0
- package/dist/src/extract/structural-slot-evidence.d.ts +63 -0
- package/dist/src/extract/structural-slot-evidence.js +278 -0
- package/dist/src/extract/{framework-adapters/svelte/extractor.d.ts → svelte.d.ts} +1 -2
- package/dist/src/extract/svelte.js +1309 -0
- package/dist/src/extract/tsx-shared.d.ts +37 -0
- package/dist/src/extract/tsx-shared.js +368 -0
- package/dist/src/extract/{services/quality/helpers/inspection/validate-extracted-components.d.ts → validate.d.ts} +1 -1
- package/dist/src/extract/{framework-adapters/vue-tsx/extractor.d.ts → vue-tsx.d.ts} +1 -1
- package/dist/src/extract/vue-tsx.js +449 -0
- package/dist/src/extract/{framework-adapters/vue/extractor.d.ts → vue.d.ts} +1 -1
- package/dist/src/extract/vue.js +605 -0
- package/dist/src/extract/{framework-adapters/web-components/extractor.d.ts → web-components.d.ts} +1 -1
- package/dist/src/extract/web-components.js +863 -0
- package/dist/src/index.d.ts +21 -27
- package/dist/src/index.js +17 -21
- package/dist/src/{extract/services/classification/classify-component-props.d.ts → pre-classify.d.ts} +5 -3
- package/dist/src/{extract/services/classification/classify-component-props.js → pre-classify.js} +100 -8
- package/dist/src/{extract/types/component.d.ts → types.d.ts} +22 -0
- package/dist/src/{extract/types/display.js → types.js} +1 -1
- package/package.json +1 -1
- package/dist/src/extract/controller/extract-controller.d.ts +0 -10
- package/dist/src/extract/controller/extract-controller.js +0 -33
- package/dist/src/extract/controller/helpers/validate-endpoint-request.d.ts +0 -2
- package/dist/src/extract/controller/helpers/validate-endpoint-request.js +0 -24
- package/dist/src/extract/framework-adapters/astro/extractor.js +0 -45
- package/dist/src/extract/framework-adapters/astro/frontmatter.d.ts +0 -11
- package/dist/src/extract/framework-adapters/astro/frontmatter.js +0 -96
- package/dist/src/extract/framework-adapters/astro/helpers/collect-astro-props-bindings.d.ts +0 -4
- package/dist/src/extract/framework-adapters/astro/helpers/collect-astro-props-bindings.js +0 -47
- package/dist/src/extract/framework-adapters/astro/slots.d.ts +0 -7
- package/dist/src/extract/framework-adapters/astro/slots.js +0 -44
- package/dist/src/extract/framework-adapters/react/extractor.js +0 -31
- package/dist/src/extract/framework-adapters/react/helpers/collect-dom-wrapper-contexts.d.ts +0 -4
- package/dist/src/extract/framework-adapters/react/helpers/collect-dom-wrapper-contexts.js +0 -73
- package/dist/src/extract/framework-adapters/react/helpers/collect-prop-dataflow.d.ts +0 -14
- package/dist/src/extract/framework-adapters/react/helpers/collect-prop-dataflow.js +0 -220
- package/dist/src/extract/framework-adapters/react/helpers/collect-react-impl-hints.d.ts +0 -5
- package/dist/src/extract/framework-adapters/react/helpers/collect-react-impl-hints.js +0 -32
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-is-pure-wrapper.d.ts +0 -2
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-is-pure-wrapper.js +0 -59
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-type-patterns.d.ts +0 -8
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-type-patterns.js +0 -29
- package/dist/src/extract/framework-adapters/react/helpers/detect-omit-wrapped-custom-props.d.ts +0 -2
- package/dist/src/extract/framework-adapters/react/helpers/detect-omit-wrapped-custom-props.js +0 -64
- package/dist/src/extract/framework-adapters/react/helpers/detect-pick-type-patterns.d.ts +0 -4
- package/dist/src/extract/framework-adapters/react/helpers/detect-pick-type-patterns.js +0 -64
- package/dist/src/extract/framework-adapters/react/helpers/detect-react-polymorphic.d.ts +0 -5
- package/dist/src/extract/framework-adapters/react/helpers/detect-react-polymorphic.js +0 -170
- package/dist/src/extract/framework-adapters/react/helpers/dom-attribute-surfaces.d.ts +0 -15
- package/dist/src/extract/framework-adapters/react/helpers/dom-attribute-surfaces.js +0 -231
- package/dist/src/extract/framework-adapters/react/helpers/extract-binding-fallback-props.d.ts +0 -4
- package/dist/src/extract/framework-adapters/react/helpers/extract-binding-fallback-props.js +0 -50
- package/dist/src/extract/framework-adapters/react/helpers/extract-from-react-source-file.d.ts +0 -5
- package/dist/src/extract/framework-adapters/react/helpers/extract-from-react-source-file.js +0 -23
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-allowed-components.d.ts +0 -2
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-allowed-components.js +0 -25
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-binding-defaults.d.ts +0 -6
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-binding-defaults.js +0 -48
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-component-from-export.d.ts +0 -15
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-component-from-export.js +0 -106
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-prop-types.d.ts +0 -3
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-prop-types.js +0 -64
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-props-from-type.d.ts +0 -15
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-props-from-type.js +0 -318
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-slots.d.ts +0 -6
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-slots.js +0 -44
- package/dist/src/extract/framework-adapters/react/helpers/filter-impl-alias-props.d.ts +0 -4
- package/dist/src/extract/framework-adapters/react/helpers/filter-impl-alias-props.js +0 -52
- package/dist/src/extract/framework-adapters/react/helpers/infer-primitive-dom-props.d.ts +0 -6
- package/dist/src/extract/framework-adapters/react/helpers/infer-primitive-dom-props.js +0 -69
- package/dist/src/extract/framework-adapters/react/helpers/resolve-component-function.d.ts +0 -4
- package/dist/src/extract/framework-adapters/react/helpers/resolve-component-function.js +0 -131
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-prop-forwarding.d.ts +0 -8
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-prop-forwarding.js +0 -22
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-props-type.d.ts +0 -14
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-props-type.js +0 -86
- package/dist/src/extract/framework-adapters/react/helpers/synthesize-react-structural-slots.d.ts +0 -8
- package/dist/src/extract/framework-adapters/react/helpers/synthesize-react-structural-slots.js +0 -44
- package/dist/src/extract/framework-adapters/shared/helpers/build-component-lookup-maps.d.ts +0 -5
- package/dist/src/extract/framework-adapters/shared/helpers/build-component-lookup-maps.js +0 -10
- package/dist/src/extract/framework-adapters/shared/helpers/collect-jsdoc-slot-comments.d.ts +0 -2
- package/dist/src/extract/framework-adapters/shared/helpers/collect-jsdoc-slot-comments.js +0 -13
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/project-source-files.d.ts +0 -5
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/project-source-files.js +0 -13
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/result-normalizer.d.ts +0 -6
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/result-normalizer.js +0 -6
- package/dist/src/extract/framework-adapters/shared/helpers/find-tsx-workspace-package.d.ts +0 -2
- package/dist/src/extract/framework-adapters/shared/helpers/find-tsx-workspace-package.js +0 -62
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-tsconfig-path.d.ts +0 -7
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-tsconfig-path.js +0 -93
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-workspace-imports.d.ts +0 -6
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-workspace-imports.js +0 -58
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-node-utils.d.ts +0 -13
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-node-utils.js +0 -76
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-renderable-exports.d.ts +0 -12
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-renderable-exports.js +0 -35
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-shared.d.ts +0 -14
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-shared.js +0 -54
- package/dist/src/extract/framework-adapters/stencil/extractor.js +0 -82
- package/dist/src/extract/framework-adapters/stencil/helpers/detect-stencil-class.d.ts +0 -7
- package/dist/src/extract/framework-adapters/stencil/helpers/detect-stencil-class.js +0 -32
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-props.d.ts +0 -5
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-props.js +0 -62
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-slots.d.ts +0 -6
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-slots.js +0 -87
- package/dist/src/extract/framework-adapters/stencil/helpers/stencil-prop-helpers.d.ts +0 -5
- package/dist/src/extract/framework-adapters/stencil/helpers/stencil-prop-helpers.js +0 -39
- package/dist/src/extract/framework-adapters/svelte/extractor.js +0 -27
- package/dist/src/extract/framework-adapters/svelte/helpers/classify-svelte-props-annotation.d.ts +0 -6
- package/dist/src/extract/framework-adapters/svelte/helpers/classify-svelte-props-annotation.js +0 -51
- package/dist/src/extract/framework-adapters/svelte/helpers/collect-svelte-type-references.d.ts +0 -3
- package/dist/src/extract/framework-adapters/svelte/helpers/collect-svelte-type-references.js +0 -52
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-from-svelte-file.d.ts +0 -7
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-from-svelte-file.js +0 -90
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-ast-type-members.d.ts +0 -15
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-ast-type-members.js +0 -46
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-declaration-data.d.ts +0 -7
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-declaration-data.js +0 -64
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-external-type-members.d.ts +0 -4
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-external-type-members.js +0 -58
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-from-destructure.d.ts +0 -4
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-from-destructure.js +0 -85
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-props.d.ts +0 -22
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-props.js +0 -55
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-template-slots.d.ts +0 -7
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-template-slots.js +0 -63
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-type-member-props.d.ts +0 -3
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-type-member-props.js +0 -31
- package/dist/src/extract/framework-adapters/svelte/helpers/find-svelte-script-declarations.d.ts +0 -8
- package/dist/src/extract/framework-adapters/svelte/helpers/find-svelte-script-declarations.js +0 -91
- package/dist/src/extract/framework-adapters/svelte/helpers/get-svelte-component-name.d.ts +0 -1
- package/dist/src/extract/framework-adapters/svelte/helpers/get-svelte-component-name.js +0 -26
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type-strings.d.ts +0 -3
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type-strings.js +0 -91
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type.d.ts +0 -11
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type.js +0 -68
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-dts-location.d.ts +0 -1
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-dts-location.js +0 -90
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-allowed-components.d.ts +0 -2
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-allowed-components.js +0 -20
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-external-type-readers.d.ts +0 -3
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-external-type-readers.js +0 -68
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-checker.d.ts +0 -4
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-checker.js +0 -68
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-members.d.ts +0 -6
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-members.js +0 -30
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-unresolved-retry.d.ts +0 -13
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-unresolved-retry.js +0 -192
- package/dist/src/extract/framework-adapters/svelte/types/svelte-ast-node.d.ts +0 -12
- package/dist/src/extract/framework-adapters/svelte/types/svelte-ast-node.js +0 -1
- package/dist/src/extract/framework-adapters/vue/extractor.js +0 -61
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-object-props.d.ts +0 -3
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-object-props.js +0 -67
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-options-props.d.ts +0 -4
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-options-props.js +0 -72
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-object-props.d.ts +0 -8
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-object-props.js +0 -64
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-props.d.ts +0 -2
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-props.js +0 -66
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-slots.d.ts +0 -24
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-slots.js +0 -56
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-vue-component-name.d.ts +0 -2
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-vue-component-name.js +0 -9
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-workspace-module.d.ts +0 -1
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-workspace-module.js +0 -76
- package/dist/src/extract/framework-adapters/vue/helpers/workspace-package-dirs.d.ts +0 -2
- package/dist/src/extract/framework-adapters/vue/helpers/workspace-package-dirs.js +0 -77
- package/dist/src/extract/framework-adapters/vue-tsx/extractor.js +0 -82
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-props.d.ts +0 -5
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-props.js +0 -189
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-slots.d.ts +0 -4
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-slots.js +0 -91
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/resolve-ast-object.d.ts +0 -11
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/resolve-ast-object.js +0 -95
- package/dist/src/extract/framework-adapters/web-components/extractor.js +0 -55
- package/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.d.ts +0 -4
- package/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.js +0 -67
- package/dist/src/extract/framework-adapters/web-components/helpers/detect-wc-non-public-members.d.ts +0 -9
- package/dist/src/extract/framework-adapters/web-components/helpers/detect-wc-non-public-members.js +0 -11
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-accessor-props.d.ts +0 -3
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-accessor-props.js +0 -65
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-class-properties.d.ts +0 -3
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-class-properties.js +0 -60
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-inheritance.d.ts +0 -4
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-inheritance.js +0 -16
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-jsdoc-attr-props.d.ts +0 -3
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-jsdoc-attr-props.js +0 -24
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-observed-attrs.d.ts +0 -3
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-observed-attrs.js +0 -27
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-slots.d.ts +0 -6
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-slots.js +0 -56
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.d.ts +0 -4
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.js +0 -49
- package/dist/src/extract/framework-adapters/web-components/helpers/merge-wc-prop-lists.d.ts +0 -9
- package/dist/src/extract/framework-adapters/web-components/helpers/merge-wc-prop-lists.js +0 -19
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-base-class.d.ts +0 -2
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-base-class.js +0 -59
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-decorator-tag.d.ts +0 -2
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-decorator-tag.js +0 -54
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import-source.d.ts +0 -7
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import-source.js +0 -47
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import.d.ts +0 -4
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import.js +0 -93
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-sibling-definition.d.ts +0 -4
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-sibling-definition.js +0 -79
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-tag-name.d.ts +0 -7
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-tag-name.js +0 -62
- package/dist/src/extract/helpers/evidence/ast/collect-structural-jsx-evidence.d.ts +0 -5
- package/dist/src/extract/helpers/evidence/ast/collect-structural-jsx-evidence.js +0 -63
- package/dist/src/extract/helpers/evidence/ast/detect-react-node-types.d.ts +0 -2
- package/dist/src/extract/helpers/evidence/ast/detect-react-node-types.js +0 -24
- package/dist/src/extract/helpers/evidence/ast/get-jsx-ast-data.d.ts +0 -14
- package/dist/src/extract/helpers/evidence/ast/get-jsx-ast-data.js +0 -85
- package/dist/src/extract/helpers/evidence/collect-jsx-component-references.d.ts +0 -5
- package/dist/src/extract/helpers/evidence/collect-jsx-component-references.js +0 -52
- package/dist/src/extract/helpers/evidence/detect-slot-from-prop.d.ts +0 -16
- package/dist/src/extract/helpers/evidence/detect-slot-from-prop.js +0 -39
- package/dist/src/extract/orchestrator/execute-extraction-orchestrator.d.ts +0 -13
- package/dist/src/extract/orchestrator/execute-extraction-orchestrator.js +0 -17
- package/dist/src/extract/services/classification/helpers/check-prop-types.d.ts +0 -7
- package/dist/src/extract/services/classification/helpers/check-prop-types.js +0 -22
- package/dist/src/extract/services/classification/helpers/detect-dom-props.d.ts +0 -2
- package/dist/src/extract/services/classification/helpers/detect-dom-props.js +0 -63
- package/dist/src/extract/services/deduplication/deduplicate-components.d.ts +0 -2
- package/dist/src/extract/services/deduplication/deduplicate-components.js +0 -58
- package/dist/src/extract/services/deduplication/helpers/component-path-analysis.d.ts +0 -10
- package/dist/src/extract/services/deduplication/helpers/component-path-analysis.js +0 -85
- package/dist/src/extract/services/deduplication/helpers/component-path-scoring.d.ts +0 -10
- package/dist/src/extract/services/deduplication/helpers/component-path-scoring.js +0 -73
- package/dist/src/extract/services/extraction/extract-components.d.ts +0 -3
- package/dist/src/extract/services/extraction/extract-components.js +0 -19
- package/dist/src/extract/services/extraction/helpers/collect-sveltekit-route-exclusions.d.ts +0 -2
- package/dist/src/extract/services/extraction/helpers/collect-sveltekit-route-exclusions.js +0 -18
- package/dist/src/extract/services/extraction/helpers/filter-hook-components.d.ts +0 -6
- package/dist/src/extract/services/extraction/helpers/filter-hook-components.js +0 -18
- package/dist/src/extract/services/extraction/helpers/register-extractors.d.ts +0 -8
- package/dist/src/extract/services/extraction/helpers/register-extractors.js +0 -71
- package/dist/src/extract/services/extraction/helpers/run-extractor-batches.d.ts +0 -4
- package/dist/src/extract/services/extraction/helpers/run-extractor-batches.js +0 -24
- package/dist/src/extract/services/quality/evaluate-extraction-quality.d.ts +0 -4
- package/dist/src/extract/services/quality/evaluate-extraction-quality.js +0 -61
- package/dist/src/extract/services/quality/helpers/authorability/evaluate-authorability.d.ts +0 -28
- package/dist/src/extract/services/quality/helpers/authorability/evaluate-authorability.js +0 -67
- package/dist/src/extract/services/quality/helpers/inspection/detect-data-wrapper-patterns.d.ts +0 -16
- package/dist/src/extract/services/quality/helpers/inspection/detect-data-wrapper-patterns.js +0 -63
- package/dist/src/extract/services/quality/helpers/scoring/collect-scoring-inputs.d.ts +0 -14
- package/dist/src/extract/services/quality/helpers/scoring/compute-extraction-score.d.ts +0 -6
- package/dist/src/extract/services/quality/helpers/scoring/compute-extraction-score.js +0 -12
- package/dist/src/extract/types/classification.d.ts +0 -4
- package/dist/src/extract/types/classification.js +0 -1
- package/dist/src/extract/types/component-extractor.d.ts +0 -7
- package/dist/src/extract/types/component-extractor.js +0 -1
- package/dist/src/extract/types/component.js +0 -1
- package/dist/src/extract/types/contract.d.ts +0 -16
- package/dist/src/extract/types/contract.js +0 -1
- package/dist/src/extract/types/display.d.ts +0 -3
- package/dist/src/extract/types/options.d.ts +0 -15
- package/dist/src/extract/types/options.js +0 -1
- package/dist/src/extract/types/scoring.d.ts +0 -9
- package/dist/src/extract/types/scoring.js +0 -1
- package/dist/src/extract/types/source-inspection.d.ts +0 -5
- package/dist/src/extract/types/source-inspection.js +0 -1
- /package/dist/src/extract/{helpers/evidence/parse-source-imports.d.ts → parse-imported-names.d.ts} +0 -0
- /package/dist/src/extract/{helpers/evidence/parse-source-imports.js → parse-imported-names.js} +0 -0
- /package/dist/src/extract/{framework-adapters/shared/helpers/resolve-import-file-path.d.ts → resolve-local-module.d.ts} +0 -0
- /package/dist/src/extract/{framework-adapters/shared/helpers/resolve-import-file-path.js → resolve-local-module.js} +0 -0
- /package/dist/src/extract/{framework-adapters/shared/helpers/resolve-type-symbol.d.ts → resolve-type-property.d.ts} +0 -0
- /package/dist/src/extract/{framework-adapters/shared/helpers/resolve-type-symbol.js → resolve-type-property.js} +0 -0
- /package/dist/src/extract/{helpers/evidence/collect-allowed-component-names.d.ts → slot-allowed-components.d.ts} +0 -0
- /package/dist/src/extract/{helpers/evidence/collect-allowed-component-names.js → slot-allowed-components.js} +0 -0
- /package/dist/src/extract/{framework-adapters/shared/helpers/get-node-source-lines.js → source-line-metadata.js} +0 -0
- /package/dist/src/extract/{services/quality/helpers/inspection/validate-extracted-components.js → validate.js} +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Project } from 'ts-morph';
|
|
2
|
-
import { createSortedExtractionResult } from '../shared/helpers/file-processing/result-normalizer.js';
|
|
3
|
-
import { extractProjectSourceFiles } from '../shared/helpers/file-processing/project-source-files.js';
|
|
4
|
-
import { extractAccessorProperties, extractClassProperties, extractJsDocAttributeProps, extractObservedAttributes, mergePropLists, mergeProps, } from './helpers/merge-wc-prop-lists.js';
|
|
5
|
-
import { buildTagNameMap, chooseComponentName, resolveWcTagName } from './helpers/resolve-wc-tag-name.js';
|
|
6
|
-
import { extractSlotsFromTemplate, mergeSlotLists, extractJsDocSlots, extractTemplateContent, extractFastTemplateSlots, } from './helpers/extract-wc-slots.js';
|
|
7
|
-
import { extractInheritedClassProperties, extractInheritedSlots } from './helpers/extract-wc-inheritance.js';
|
|
8
|
-
function extractFromSourceFile(sourceFile, project) {
|
|
9
|
-
const components = [];
|
|
10
|
-
const tagNameMap = buildTagNameMap(sourceFile);
|
|
11
|
-
for (const classDecl of sourceFile.getClasses()) {
|
|
12
|
-
const className = classDecl.getName();
|
|
13
|
-
if (!className)
|
|
14
|
-
continue;
|
|
15
|
-
const tagName = resolveWcTagName(classDecl, tagNameMap, project);
|
|
16
|
-
if (!tagName)
|
|
17
|
-
continue;
|
|
18
|
-
const name = chooseComponentName(classDecl, className, tagName);
|
|
19
|
-
const observedAttrs = extractObservedAttributes(classDecl);
|
|
20
|
-
const inheritedProps = extractInheritedClassProperties(classDecl, project);
|
|
21
|
-
const classProps = mergePropLists(extractJsDocAttributeProps(classDecl), extractAccessorProperties(classDecl), extractClassProperties(classDecl));
|
|
22
|
-
const props = mergeProps(observedAttrs, mergePropLists(inheritedProps, classProps));
|
|
23
|
-
const templateContent = extractTemplateContent(classDecl, project);
|
|
24
|
-
const slots = mergeSlotLists(extractInheritedSlots(classDecl, project), extractJsDocSlots(classDecl), extractSlotsFromTemplate(templateContent), extractFastTemplateSlots(classDecl, project));
|
|
25
|
-
components.push({
|
|
26
|
-
name,
|
|
27
|
-
source: sourceFile.getFilePath(),
|
|
28
|
-
sourcePath: sourceFile.getFilePath(),
|
|
29
|
-
framework: 'web-component',
|
|
30
|
-
props,
|
|
31
|
-
slots,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return components;
|
|
35
|
-
}
|
|
36
|
-
export async function extractWebComponentDefinitions(filePaths) {
|
|
37
|
-
const tsFiles = filePaths.filter((f) => /\.[jt]s$/.test(f) && !f.endsWith('.d.ts'));
|
|
38
|
-
if (tsFiles.length === 0) {
|
|
39
|
-
return { components: [], warnings: [] };
|
|
40
|
-
}
|
|
41
|
-
const project = new Project({
|
|
42
|
-
compilerOptions: {
|
|
43
|
-
target: 99,
|
|
44
|
-
module: 99,
|
|
45
|
-
moduleResolution: 100,
|
|
46
|
-
skipLibCheck: true,
|
|
47
|
-
},
|
|
48
|
-
skipAddingFilesFromTsConfig: true,
|
|
49
|
-
});
|
|
50
|
-
for (const filePath of tsFiles) {
|
|
51
|
-
project.addSourceFileAtPath(filePath);
|
|
52
|
-
}
|
|
53
|
-
const { items: components, warnings } = extractProjectSourceFiles(project, (sourceFile) => extractFromSourceFile(sourceFile, project));
|
|
54
|
-
return createSortedExtractionResult(components, warnings);
|
|
55
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Node, type Project } from 'ts-morph';
|
|
2
|
-
export declare function collectHtmlTaggedTemplates(root: Node): string[];
|
|
3
|
-
export declare function resolveTemplateHelperDeclarations(callExpression: import('ts-morph').CallExpression, project: Project): Node[];
|
|
4
|
-
export declare function collectHtmlTaggedTemplatesWithHelpers(root: Node, project: Project): string[];
|
package/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Node } from 'ts-morph';
|
|
2
|
-
import { loadSourceFile, resolveImportSourcePath } from './resolve-wc-import.js';
|
|
3
|
-
export function collectHtmlTaggedTemplates(root) {
|
|
4
|
-
const templates = [];
|
|
5
|
-
root.forEachDescendant((node) => {
|
|
6
|
-
if (!Node.isTaggedTemplateExpression(node))
|
|
7
|
-
return;
|
|
8
|
-
const tag = node.getTag();
|
|
9
|
-
if (tag.getText() !== 'html')
|
|
10
|
-
return;
|
|
11
|
-
const template = node.getTemplate();
|
|
12
|
-
if (Node.isNoSubstitutionTemplateLiteral(template) || Node.isTemplateExpression(template)) {
|
|
13
|
-
templates.push(template.getText().slice(1, -1));
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return templates;
|
|
17
|
-
}
|
|
18
|
-
export function resolveTemplateHelperDeclarations(callExpression, project) {
|
|
19
|
-
const expression = callExpression.getExpression();
|
|
20
|
-
if (!Node.isIdentifier(expression))
|
|
21
|
-
return [];
|
|
22
|
-
const declarations = [];
|
|
23
|
-
for (const definition of expression.getDefinitions()) {
|
|
24
|
-
const declarationNode = definition.getDeclarationNode();
|
|
25
|
-
if (!declarationNode)
|
|
26
|
-
continue;
|
|
27
|
-
if (Node.isFunctionDeclaration(declarationNode) || Node.isVariableDeclaration(declarationNode)) {
|
|
28
|
-
declarations.push(declarationNode);
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (!Node.isImportSpecifier(declarationNode))
|
|
32
|
-
continue;
|
|
33
|
-
const importDecl = declarationNode.getImportDeclaration();
|
|
34
|
-
const resolvedImportPath = resolveImportSourcePath(callExpression.getSourceFile().getFilePath(), importDecl.getModuleSpecifierValue());
|
|
35
|
-
if (!resolvedImportPath)
|
|
36
|
-
continue;
|
|
37
|
-
const importedFile = loadSourceFile(project, resolvedImportPath);
|
|
38
|
-
if (!importedFile)
|
|
39
|
-
continue;
|
|
40
|
-
const importedName = declarationNode.getNameNode().getText();
|
|
41
|
-
const importedFunction = importedFile.getFunction(importedName);
|
|
42
|
-
if (importedFunction) {
|
|
43
|
-
declarations.push(importedFunction);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const importedVariable = importedFile.getVariableDeclaration(importedName);
|
|
47
|
-
if (importedVariable)
|
|
48
|
-
declarations.push(importedVariable);
|
|
49
|
-
}
|
|
50
|
-
return declarations;
|
|
51
|
-
}
|
|
52
|
-
export function collectHtmlTaggedTemplatesWithHelpers(root, project) {
|
|
53
|
-
const templates = [...collectHtmlTaggedTemplates(root)];
|
|
54
|
-
const seenTemplateHelpers = new Set();
|
|
55
|
-
root.forEachDescendant((node) => {
|
|
56
|
-
if (!Node.isCallExpression(node))
|
|
57
|
-
return;
|
|
58
|
-
for (const declaration of resolveTemplateHelperDeclarations(node, project)) {
|
|
59
|
-
const helperKey = `${declaration.getSourceFile().getFilePath()}:${declaration.getStart()}`;
|
|
60
|
-
if (seenTemplateHelpers.has(helperKey))
|
|
61
|
-
continue;
|
|
62
|
-
seenTemplateHelpers.add(helperKey);
|
|
63
|
-
templates.push(...collectHtmlTaggedTemplates(declaration));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
return templates;
|
|
67
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/detect-wc-non-public-members.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function hasInternalJsDocTag(member: {
|
|
2
|
-
getJsDocs(): import('ts-morph').JSDoc[];
|
|
3
|
-
}): boolean;
|
|
4
|
-
export declare const NON_PUBLIC_LIT_DECORATORS: Set<string>;
|
|
5
|
-
export declare const INTERNAL_RUNTIME_FIELD_NAMES: Set<string>;
|
|
6
|
-
export declare function isNonPublicLitMember(member: {
|
|
7
|
-
getDecorators(): import('ts-morph').Decorator[];
|
|
8
|
-
}): boolean;
|
|
9
|
-
export declare function isInternalRuntimeField(name: string, applyRuntimeFieldDenylist: boolean): boolean;
|
package/dist/src/extract/framework-adapters/web-components/helpers/detect-wc-non-public-members.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function hasInternalJsDocTag(member) {
|
|
2
|
-
return member.getJsDocs().some((doc) => doc.getTags().some((tag) => tag.getTagName() === 'internal'));
|
|
3
|
-
}
|
|
4
|
-
export const NON_PUBLIC_LIT_DECORATORS = new Set(['consume', 'provide', 'query', 'queryAsync', 'state']);
|
|
5
|
-
export const INTERNAL_RUNTIME_FIELD_NAMES = new Set(['dir', 'initialReflectedProperties', 'lang']);
|
|
6
|
-
export function isNonPublicLitMember(member) {
|
|
7
|
-
return member.getDecorators().some((decorator) => NON_PUBLIC_LIT_DECORATORS.has(decorator.getName()));
|
|
8
|
-
}
|
|
9
|
-
export function isInternalRuntimeField(name, applyRuntimeFieldDenylist) {
|
|
10
|
-
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name);
|
|
11
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-accessor-props.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { hasInternalJsDocTag, isNonPublicLitMember, isInternalRuntimeField } from './detect-wc-non-public-members.js';
|
|
2
|
-
export function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
3
|
-
const props = [];
|
|
4
|
-
const accessors = new Map();
|
|
5
|
-
for (const getter of classDecl.getGetAccessors()) {
|
|
6
|
-
if (getter.isStatic())
|
|
7
|
-
continue;
|
|
8
|
-
if (hasInternalJsDocTag(getter))
|
|
9
|
-
continue;
|
|
10
|
-
if (isNonPublicLitMember(getter))
|
|
11
|
-
continue;
|
|
12
|
-
const name = getter.getName();
|
|
13
|
-
if (name === 'observedAttributes' ||
|
|
14
|
-
name === 'template' ||
|
|
15
|
-
name.startsWith('#') ||
|
|
16
|
-
isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
17
|
-
continue;
|
|
18
|
-
const scope = getter.getScope();
|
|
19
|
-
if (scope === 'private' || scope === 'protected')
|
|
20
|
-
continue;
|
|
21
|
-
const entry = accessors.get(name) ?? {};
|
|
22
|
-
entry.getter = getter;
|
|
23
|
-
accessors.set(name, entry);
|
|
24
|
-
}
|
|
25
|
-
for (const setter of classDecl.getSetAccessors()) {
|
|
26
|
-
if (setter.isStatic())
|
|
27
|
-
continue;
|
|
28
|
-
if (hasInternalJsDocTag(setter))
|
|
29
|
-
continue;
|
|
30
|
-
if (isNonPublicLitMember(setter))
|
|
31
|
-
continue;
|
|
32
|
-
const name = setter.getName();
|
|
33
|
-
if (name === 'observedAttributes' ||
|
|
34
|
-
name === 'template' ||
|
|
35
|
-
name.startsWith('#') ||
|
|
36
|
-
isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
37
|
-
continue;
|
|
38
|
-
const scope = setter.getScope();
|
|
39
|
-
if (scope === 'private' || scope === 'protected')
|
|
40
|
-
continue;
|
|
41
|
-
const entry = accessors.get(name) ?? {};
|
|
42
|
-
entry.setter = setter;
|
|
43
|
-
accessors.set(name, entry);
|
|
44
|
-
}
|
|
45
|
-
for (const [name, { getter, setter }] of accessors) {
|
|
46
|
-
const hasPropertyDecorator = getter?.getDecorators().some((decorator) => decorator.getName() === 'property') ||
|
|
47
|
-
setter?.getDecorators().some((decorator) => decorator.getName() === 'property');
|
|
48
|
-
if (!hasPropertyDecorator && !(getter && setter))
|
|
49
|
-
continue;
|
|
50
|
-
const type = getter?.getReturnTypeNode()?.getText() ?? setter?.getParameters()[0]?.getTypeNode()?.getText() ?? 'any';
|
|
51
|
-
const accessorNode = getter ?? setter;
|
|
52
|
-
props.push({
|
|
53
|
-
name,
|
|
54
|
-
type,
|
|
55
|
-
required: false,
|
|
56
|
-
...(accessorNode
|
|
57
|
-
? {
|
|
58
|
-
sourceStartLine: accessorNode.getStartLineNumber(),
|
|
59
|
-
sourceEndLine: accessorNode.getEndLineNumber(),
|
|
60
|
-
}
|
|
61
|
-
: {}),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return props;
|
|
65
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-class-properties.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Node } from 'ts-morph';
|
|
2
|
-
import { hasInternalJsDocTag, isNonPublicLitMember, isInternalRuntimeField } from './detect-wc-non-public-members.js';
|
|
3
|
-
function kebabToCamel(input) {
|
|
4
|
-
return input.replace(/-([a-z0-9])/gi, (_, char) => char.toUpperCase());
|
|
5
|
-
}
|
|
6
|
-
function getExplicitLitPropertyAttributeName(property) {
|
|
7
|
-
const decorator = property.getDecorators().find((candidate) => candidate.getName() === 'property');
|
|
8
|
-
const firstArg = decorator?.getArguments()[0];
|
|
9
|
-
if (!firstArg || !Node.isObjectLiteralExpression(firstArg))
|
|
10
|
-
return null;
|
|
11
|
-
const attributeProp = firstArg.getProperty('attribute');
|
|
12
|
-
if (!attributeProp || !Node.isPropertyAssignment(attributeProp))
|
|
13
|
-
return null;
|
|
14
|
-
const initializer = attributeProp.getInitializer();
|
|
15
|
-
if (!initializer || !Node.isStringLiteral(initializer))
|
|
16
|
-
return null;
|
|
17
|
-
return initializer.getLiteralValue();
|
|
18
|
-
}
|
|
19
|
-
export function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
20
|
-
const props = [];
|
|
21
|
-
for (const property of classDecl.getProperties()) {
|
|
22
|
-
if (property.isStatic())
|
|
23
|
-
continue;
|
|
24
|
-
if (hasInternalJsDocTag(property))
|
|
25
|
-
continue;
|
|
26
|
-
if (isNonPublicLitMember(property))
|
|
27
|
-
continue;
|
|
28
|
-
const name = property.getName();
|
|
29
|
-
if (name.startsWith('#') || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
30
|
-
continue;
|
|
31
|
-
const scope = property.getScope();
|
|
32
|
-
if (scope === 'private' || scope === 'protected')
|
|
33
|
-
continue;
|
|
34
|
-
const initializer = property.getInitializer();
|
|
35
|
-
const hasDecorators = property.getDecorators().length > 0;
|
|
36
|
-
if (!hasDecorators && initializer && Node.isArrowFunction(initializer))
|
|
37
|
-
continue;
|
|
38
|
-
if (initializer &&
|
|
39
|
-
Node.isCallExpression(initializer) &&
|
|
40
|
-
initializer.getExpression().getText() === 'this.attachInternals') {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const typeNode = property.getTypeNode();
|
|
44
|
-
const type = typeNode ? typeNode.getText() : 'any';
|
|
45
|
-
const publicName = name.startsWith('_') && hasDecorators ? getExplicitLitPropertyAttributeName(property) : null;
|
|
46
|
-
let defaultValue;
|
|
47
|
-
if (initializer) {
|
|
48
|
-
defaultValue = Node.isStringLiteral(initializer) ? initializer.getLiteralValue() : initializer.getText();
|
|
49
|
-
}
|
|
50
|
-
props.push({
|
|
51
|
-
name: publicName ? kebabToCamel(publicName) : name,
|
|
52
|
-
type,
|
|
53
|
-
required: false,
|
|
54
|
-
...(defaultValue !== undefined && { defaultValue }),
|
|
55
|
-
sourceStartLine: property.getStartLineNumber(),
|
|
56
|
-
sourceEndLine: property.getEndLineNumber(),
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return props;
|
|
60
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-inheritance.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type ClassDeclaration, type Project } from 'ts-morph';
|
|
2
|
-
import type { RawPropDefinition, RawSlotDefinition } from '../../../types/component.js';
|
|
3
|
-
export declare function extractInheritedClassProperties(classDecl: ClassDeclaration, project: Project, visitedFiles?: Set<string>, applyRuntimeFieldDenylist?: boolean): RawPropDefinition[];
|
|
4
|
-
export declare function extractInheritedSlots(classDecl: ClassDeclaration, project: Project, visitedFiles?: Set<string>): RawSlotDefinition[];
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-inheritance.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { extractAccessorProperties, extractClassProperties, extractJsDocAttributeProps, hasShoelaceRuntimeBookkeepingField, mergePropLists, } from './merge-wc-prop-lists.js';
|
|
2
|
-
import { mergeSlotLists, extractJsDocSlots } from './extract-wc-slots.js';
|
|
3
|
-
import { getImportedBaseClass } from './resolve-wc-base-class.js';
|
|
4
|
-
export function extractInheritedClassProperties(classDecl, project, visitedFiles = new Set(), applyRuntimeFieldDenylist = false) {
|
|
5
|
-
const baseClass = getImportedBaseClass(classDecl, project, visitedFiles);
|
|
6
|
-
if (!baseClass)
|
|
7
|
-
return [];
|
|
8
|
-
const nextApplyRuntimeFieldDenylist = applyRuntimeFieldDenylist || hasShoelaceRuntimeBookkeepingField(baseClass);
|
|
9
|
-
return mergePropLists(extractInheritedClassProperties(baseClass, project, visitedFiles, nextApplyRuntimeFieldDenylist), extractJsDocAttributeProps(baseClass), extractAccessorProperties(baseClass, nextApplyRuntimeFieldDenylist), extractClassProperties(baseClass, nextApplyRuntimeFieldDenylist));
|
|
10
|
-
}
|
|
11
|
-
export function extractInheritedSlots(classDecl, project, visitedFiles = new Set()) {
|
|
12
|
-
const baseClass = getImportedBaseClass(classDecl, project, visitedFiles);
|
|
13
|
-
if (!baseClass)
|
|
14
|
-
return [];
|
|
15
|
-
return mergeSlotLists(extractInheritedSlots(baseClass, project, visitedFiles), extractJsDocSlots(baseClass));
|
|
16
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-jsdoc-attr-props.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function extractJsDocAttributeProps(classDecl) {
|
|
2
|
-
const props = [];
|
|
3
|
-
for (const doc of classDecl.getJsDocs()) {
|
|
4
|
-
for (const tag of doc.getTags()) {
|
|
5
|
-
if (tag.getTagName() !== 'attribute')
|
|
6
|
-
continue;
|
|
7
|
-
const tagComment = tag.getCommentText();
|
|
8
|
-
const normalizedComment = Array.isArray(tagComment) ? tagComment.join(' ') : tagComment;
|
|
9
|
-
const match = normalizedComment?.match(/(?:\{([^}]+)\}\s+)?([^\s]+)(?:\s*-\s*([\s\S]*))?/);
|
|
10
|
-
if (!match)
|
|
11
|
-
continue;
|
|
12
|
-
const [, type, name, description] = match;
|
|
13
|
-
if (!name || name.startsWith('#'))
|
|
14
|
-
continue;
|
|
15
|
-
props.push({
|
|
16
|
-
name,
|
|
17
|
-
type: type?.trim() || 'any',
|
|
18
|
-
required: false,
|
|
19
|
-
...(description ? { description: description.replace(/\s+/g, ' ').trim() } : {}),
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return props;
|
|
24
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-observed-attrs.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Node } from 'ts-morph';
|
|
2
|
-
export function extractObservedAttributes(classDecl) {
|
|
3
|
-
const props = [];
|
|
4
|
-
const getter = classDecl.getGetAccessor('observedAttributes');
|
|
5
|
-
if (!getter || !getter.isStatic())
|
|
6
|
-
return props;
|
|
7
|
-
const body = getter.getBody();
|
|
8
|
-
if (!body)
|
|
9
|
-
return props;
|
|
10
|
-
body.forEachDescendant((node) => {
|
|
11
|
-
if (!Node.isReturnStatement(node))
|
|
12
|
-
return;
|
|
13
|
-
const expression = node.getExpression();
|
|
14
|
-
if (!expression || !Node.isArrayLiteralExpression(expression))
|
|
15
|
-
return;
|
|
16
|
-
for (const element of expression.getElements()) {
|
|
17
|
-
if (Node.isStringLiteral(element)) {
|
|
18
|
-
props.push({
|
|
19
|
-
name: element.getLiteralValue(),
|
|
20
|
-
type: 'string',
|
|
21
|
-
required: false,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return props;
|
|
27
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ClassDeclaration } from 'ts-morph';
|
|
2
|
-
import type { RawSlotDefinition } from '../../../types/component.js';
|
|
3
|
-
export { extractTemplateContent, extractFastTemplateSlots } from './extract-wc-template-content.js';
|
|
4
|
-
export declare function extractSlotsFromTemplate(templateContent: string): RawSlotDefinition[];
|
|
5
|
-
export declare function mergeSlotLists(...slotLists: RawSlotDefinition[][]): RawSlotDefinition[];
|
|
6
|
-
export declare function extractJsDocSlots(classDecl: ClassDeclaration): RawSlotDefinition[];
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { collectJsDocSlotComments } from '../../shared/helpers/collect-jsdoc-slot-comments.js';
|
|
2
|
-
export { extractTemplateContent, extractFastTemplateSlots } from './extract-wc-template-content.js';
|
|
3
|
-
export function extractSlotsFromTemplate(templateContent) {
|
|
4
|
-
const slots = new Map();
|
|
5
|
-
const slotRegex = /<slot\b([^>]*)>/g;
|
|
6
|
-
for (const match of templateContent.matchAll(slotRegex)) {
|
|
7
|
-
const attrs = match[1] ?? '';
|
|
8
|
-
const nameMatch = attrs.match(/\bname=["']([^"']+)["']/);
|
|
9
|
-
const name = nameMatch?.[1] ?? 'default';
|
|
10
|
-
slots.set(name, name === 'default');
|
|
11
|
-
}
|
|
12
|
-
return [...slots.entries()]
|
|
13
|
-
.map(([name, isDefault]) => ({ name, isDefault }))
|
|
14
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
15
|
-
}
|
|
16
|
-
export function mergeSlotLists(...slotLists) {
|
|
17
|
-
const merged = new Map();
|
|
18
|
-
for (const slotList of slotLists) {
|
|
19
|
-
for (const slot of slotList) {
|
|
20
|
-
const existing = merged.get(slot.name);
|
|
21
|
-
if (!existing) {
|
|
22
|
-
merged.set(slot.name, slot);
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
merged.set(slot.name, {
|
|
26
|
-
...existing,
|
|
27
|
-
...slot,
|
|
28
|
-
description: existing.description ?? slot.description,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return [...merged.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
33
|
-
}
|
|
34
|
-
export function extractJsDocSlots(classDecl) {
|
|
35
|
-
const slots = [];
|
|
36
|
-
for (const comment of collectJsDocSlotComments(classDecl)) {
|
|
37
|
-
let name = 'default';
|
|
38
|
-
let description = comment;
|
|
39
|
-
if (comment.startsWith('-')) {
|
|
40
|
-
description = comment.slice(1).trim();
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
const match = comment.match(/^(\S+)\s*-\s*(.*)$/s);
|
|
44
|
-
if (match) {
|
|
45
|
-
name = match[1];
|
|
46
|
-
description = match[2].trim();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
slots.push({
|
|
50
|
-
name,
|
|
51
|
-
isDefault: name === 'default',
|
|
52
|
-
...(description && { description }),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return mergeSlotLists(slots);
|
|
56
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type ClassDeclaration, type Project } from 'ts-morph';
|
|
2
|
-
import type { RawSlotDefinition } from '../../../types/component.js';
|
|
3
|
-
export declare function extractTemplateContent(classDecl: ClassDeclaration, project: Project): string;
|
|
4
|
-
export declare function extractFastTemplateSlots(classDecl: ClassDeclaration, project: Project): RawSlotDefinition[];
|
package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Node } from 'ts-morph';
|
|
2
|
-
import { loadSourceFile } from './resolve-wc-import.js';
|
|
3
|
-
import { extractSlotsFromTemplate } from './extract-wc-slots.js';
|
|
4
|
-
import { collectHtmlTaggedTemplatesWithHelpers } from './collect-wc-html-templates.js';
|
|
5
|
-
export function extractTemplateContent(classDecl, project) {
|
|
6
|
-
const templates = [];
|
|
7
|
-
classDecl.forEachDescendant((node) => {
|
|
8
|
-
if (!Node.isBinaryExpression(node))
|
|
9
|
-
return;
|
|
10
|
-
const leftText = node.getLeft().getText();
|
|
11
|
-
if (!leftText.includes('.innerHTML'))
|
|
12
|
-
return;
|
|
13
|
-
const right = node.getRight();
|
|
14
|
-
if (Node.isTemplateExpression(right) || Node.isNoSubstitutionTemplateLiteral(right)) {
|
|
15
|
-
templates.push(right.getText().slice(1, -1));
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
const renderMethod = classDecl.getMethod('render');
|
|
19
|
-
if (renderMethod && !renderMethod.isStatic()) {
|
|
20
|
-
templates.push(...collectHtmlTaggedTemplatesWithHelpers(renderMethod, project));
|
|
21
|
-
}
|
|
22
|
-
const templateGetter = classDecl.getGetAccessor('template');
|
|
23
|
-
if (templateGetter?.isStatic()) {
|
|
24
|
-
templateGetter.forEachDescendant((node) => {
|
|
25
|
-
if (Node.isTaggedTemplateExpression(node)) {
|
|
26
|
-
const tag = node.getTag();
|
|
27
|
-
if (tag.getText() === 'html') {
|
|
28
|
-
const template = node.getTemplate();
|
|
29
|
-
if (Node.isNoSubstitutionTemplateLiteral(template) || Node.isTemplateExpression(template)) {
|
|
30
|
-
templates.push(template.getText().slice(1, -1));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return templates.join('\n');
|
|
37
|
-
}
|
|
38
|
-
export function extractFastTemplateSlots(classDecl, project) {
|
|
39
|
-
const sourceFilePath = classDecl.getSourceFile().getFilePath();
|
|
40
|
-
if (!sourceFilePath.endsWith('.ts') || sourceFilePath.endsWith('.template.ts'))
|
|
41
|
-
return [];
|
|
42
|
-
const templatePath = `${sourceFilePath.slice(0, -'.ts'.length)}.template.ts`;
|
|
43
|
-
const templateFile = loadSourceFile(project, templatePath);
|
|
44
|
-
if (!templateFile)
|
|
45
|
-
return [];
|
|
46
|
-
const fragments = [];
|
|
47
|
-
fragments.push(...collectHtmlTaggedTemplatesWithHelpers(templateFile, project));
|
|
48
|
-
return extractSlotsFromTemplate(fragments.join('\n'));
|
|
49
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RawPropDefinition } from '../../../types/component.js';
|
|
2
|
-
import type { ClassDeclaration } from 'ts-morph';
|
|
3
|
-
export { extractObservedAttributes } from './extract-wc-observed-attrs.js';
|
|
4
|
-
export { extractAccessorProperties } from './extract-wc-accessor-props.js';
|
|
5
|
-
export { extractJsDocAttributeProps } from './extract-wc-jsdoc-attr-props.js';
|
|
6
|
-
export { extractClassProperties } from './extract-wc-class-properties.js';
|
|
7
|
-
export declare function hasShoelaceRuntimeBookkeepingField(classDecl: ClassDeclaration): boolean;
|
|
8
|
-
export declare function mergePropLists(...propLists: RawPropDefinition[][]): RawPropDefinition[];
|
|
9
|
-
export declare function mergeProps(observed: RawPropDefinition[], classProps: RawPropDefinition[]): RawPropDefinition[];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { extractObservedAttributes } from './extract-wc-observed-attrs.js';
|
|
2
|
-
export { extractAccessorProperties } from './extract-wc-accessor-props.js';
|
|
3
|
-
export { extractJsDocAttributeProps } from './extract-wc-jsdoc-attr-props.js';
|
|
4
|
-
export { extractClassProperties } from './extract-wc-class-properties.js';
|
|
5
|
-
export function hasShoelaceRuntimeBookkeepingField(classDecl) {
|
|
6
|
-
return classDecl.getProperties().some((property) => property.getName() === 'initialReflectedProperties');
|
|
7
|
-
}
|
|
8
|
-
export function mergePropLists(...propLists) {
|
|
9
|
-
const merged = new Map();
|
|
10
|
-
for (const propList of propLists) {
|
|
11
|
-
for (const prop of propList) {
|
|
12
|
-
merged.set(prop.name, prop);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return [...merged.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
16
|
-
}
|
|
17
|
-
export function mergeProps(observed, classProps) {
|
|
18
|
-
return mergePropLists(observed, classProps);
|
|
19
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Node, SyntaxKind } from 'ts-morph';
|
|
2
|
-
import { resolveImportSourcePath } from './resolve-wc-import.js';
|
|
3
|
-
export function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
4
|
-
const extendsClause = classDecl
|
|
5
|
-
.getHeritageClauses()
|
|
6
|
-
.find((clause) => clause.getToken() === SyntaxKind.ExtendsKeyword);
|
|
7
|
-
const typeNode = extendsClause?.getTypeNodes()[0];
|
|
8
|
-
if (!typeNode)
|
|
9
|
-
return null;
|
|
10
|
-
const expression = typeNode.getExpression();
|
|
11
|
-
if (!Node.isIdentifier(expression))
|
|
12
|
-
return null;
|
|
13
|
-
const baseName = expression.getText();
|
|
14
|
-
const importDecl = classDecl
|
|
15
|
-
.getSourceFile()
|
|
16
|
-
.getImportDeclarations()
|
|
17
|
-
.find((decl) => decl.getNamedImports().some((namedImport) => namedImport.getName() === baseName) ||
|
|
18
|
-
decl.getDefaultImport()?.getText() === baseName);
|
|
19
|
-
if (!importDecl)
|
|
20
|
-
return null;
|
|
21
|
-
const resolvedImportPath = resolveImportSourcePath(classDecl.getSourceFile().getFilePath(), importDecl.getModuleSpecifierValue());
|
|
22
|
-
if (!resolvedImportPath || visitedFiles.has(resolvedImportPath))
|
|
23
|
-
return null;
|
|
24
|
-
visitedFiles.add(resolvedImportPath);
|
|
25
|
-
let sourceFile = project.getSourceFile(resolvedImportPath);
|
|
26
|
-
if (!sourceFile) {
|
|
27
|
-
try {
|
|
28
|
-
sourceFile = project.addSourceFileAtPath(resolvedImportPath);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const directClass = sourceFile.getClass(baseName);
|
|
35
|
-
if (directClass)
|
|
36
|
-
return directClass;
|
|
37
|
-
for (const exportDecl of sourceFile.getExportDeclarations()) {
|
|
38
|
-
const moduleSpecifier = exportDecl.getModuleSpecifierValue();
|
|
39
|
-
if (!moduleSpecifier)
|
|
40
|
-
continue;
|
|
41
|
-
const reexportPath = resolveImportSourcePath(sourceFile.getFilePath(), moduleSpecifier);
|
|
42
|
-
if (!reexportPath || visitedFiles.has(reexportPath))
|
|
43
|
-
continue;
|
|
44
|
-
visitedFiles.add(reexportPath);
|
|
45
|
-
let reexportFile = project.getSourceFile(reexportPath);
|
|
46
|
-
if (!reexportFile) {
|
|
47
|
-
try {
|
|
48
|
-
reexportFile = project.addSourceFileAtPath(reexportPath);
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const reexportedClass = reexportFile.getClass(baseName);
|
|
55
|
-
if (reexportedClass)
|
|
56
|
-
return reexportedClass;
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
}
|
package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-decorator-tag.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Node } from 'ts-morph';
|
|
2
|
-
function camelToKebab(input) {
|
|
3
|
-
return input
|
|
4
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
5
|
-
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
|
|
6
|
-
.toLowerCase();
|
|
7
|
-
}
|
|
8
|
-
function resolveDecoratorInterpolation(node) {
|
|
9
|
-
if (Node.isIdentifier(node)) {
|
|
10
|
-
const definitions = node.getDefinitions();
|
|
11
|
-
for (const definition of definitions) {
|
|
12
|
-
const declarationNode = definition.getDeclarationNode();
|
|
13
|
-
if (!declarationNode)
|
|
14
|
-
continue;
|
|
15
|
-
if (Node.isVariableDeclaration(declarationNode)) {
|
|
16
|
-
const initializer = declarationNode.getInitializer();
|
|
17
|
-
if (initializer && Node.isStringLiteral(initializer))
|
|
18
|
-
return initializer.getLiteralValue();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const text = node.getText();
|
|
22
|
-
if (/Prefix$/.test(text))
|
|
23
|
-
return camelToKebab(text.replace(/Prefix$/, ''));
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
function resolveDecoratorTagArgument(node) {
|
|
28
|
-
if (Node.isStringLiteral(node) || Node.isNoSubstitutionTemplateLiteral(node))
|
|
29
|
-
return node.getLiteralValue();
|
|
30
|
-
if (!Node.isTemplateExpression(node))
|
|
31
|
-
return null;
|
|
32
|
-
let resolved = node.getHead().getLiteralText();
|
|
33
|
-
for (const span of node.getTemplateSpans()) {
|
|
34
|
-
const interpolation = resolveDecoratorInterpolation(span.getExpression());
|
|
35
|
-
if (!interpolation)
|
|
36
|
-
return null;
|
|
37
|
-
resolved += interpolation;
|
|
38
|
-
resolved += span.getLiteral().getLiteralText();
|
|
39
|
-
}
|
|
40
|
-
return resolved;
|
|
41
|
-
}
|
|
42
|
-
export function getElementTagNameFromDecorator(classDecl) {
|
|
43
|
-
for (const decorator of classDecl.getDecorators()) {
|
|
44
|
-
if (decorator.getName() !== 'customElement')
|
|
45
|
-
continue;
|
|
46
|
-
const firstArg = decorator.getArguments()[0];
|
|
47
|
-
if (!firstArg)
|
|
48
|
-
continue;
|
|
49
|
-
const resolved = resolveDecoratorTagArgument(firstArg);
|
|
50
|
-
if (resolved)
|
|
51
|
-
return resolved;
|
|
52
|
-
}
|
|
53
|
-
return null;
|
|
54
|
-
}
|