@contentful/experience-design-system-extraction 2.36.2-dev-build-a6f80ae6.0 → 2.36.2-dev-build-7907fec3.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/controller/extract-controller.d.ts +10 -0
- package/dist/src/extract/controller/extract-controller.js +33 -0
- package/dist/src/extract/controller/helpers/validate-endpoint-request.d.ts +2 -0
- package/dist/src/extract/controller/helpers/validate-endpoint-request.js +24 -0
- package/dist/src/extract/{astro.d.ts → framework-adapters/astro/extractor.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/astro/extractor.js +45 -0
- package/dist/src/extract/framework-adapters/astro/frontmatter.d.ts +11 -0
- package/dist/src/extract/framework-adapters/astro/frontmatter.js +96 -0
- package/dist/src/extract/framework-adapters/astro/helpers/collect-astro-props-bindings.d.ts +4 -0
- package/dist/src/extract/framework-adapters/astro/helpers/collect-astro-props-bindings.js +47 -0
- package/dist/src/extract/framework-adapters/astro/slots.d.ts +7 -0
- package/dist/src/extract/framework-adapters/astro/slots.js +44 -0
- package/dist/src/extract/{react.d.ts → framework-adapters/react/extractor.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/react/extractor.js +31 -0
- package/dist/src/extract/framework-adapters/react/helpers/collect-dom-wrapper-contexts.d.ts +4 -0
- package/dist/src/extract/framework-adapters/react/helpers/collect-dom-wrapper-contexts.js +73 -0
- package/dist/src/extract/framework-adapters/react/helpers/collect-prop-dataflow.d.ts +14 -0
- package/dist/src/extract/framework-adapters/react/helpers/collect-prop-dataflow.js +220 -0
- package/dist/src/extract/framework-adapters/react/helpers/collect-react-impl-hints.d.ts +5 -0
- package/dist/src/extract/framework-adapters/react/helpers/collect-react-impl-hints.js +32 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-is-pure-wrapper.d.ts +2 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-is-pure-wrapper.js +59 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-type-patterns.d.ts +8 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-dom-type-patterns.js +29 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-omit-wrapped-custom-props.d.ts +2 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-omit-wrapped-custom-props.js +64 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-pick-type-patterns.d.ts +4 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-pick-type-patterns.js +64 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-react-polymorphic.d.ts +5 -0
- package/dist/src/extract/framework-adapters/react/helpers/detect-react-polymorphic.js +170 -0
- package/dist/src/extract/framework-adapters/react/helpers/dom-attribute-surfaces.d.ts +15 -0
- package/dist/src/extract/framework-adapters/react/helpers/dom-attribute-surfaces.js +231 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-binding-fallback-props.d.ts +4 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-binding-fallback-props.js +50 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-from-react-source-file.d.ts +5 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-from-react-source-file.js +23 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-allowed-components.d.ts +2 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-allowed-components.js +25 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-binding-defaults.d.ts +6 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-binding-defaults.js +48 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-component-from-export.d.ts +15 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-component-from-export.js +106 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-prop-types.d.ts +3 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-prop-types.js +64 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-props-from-type.d.ts +15 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-props-from-type.js +318 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-slots.d.ts +6 -0
- package/dist/src/extract/framework-adapters/react/helpers/extract-react-slots.js +44 -0
- package/dist/src/extract/framework-adapters/react/helpers/filter-impl-alias-props.d.ts +4 -0
- package/dist/src/extract/framework-adapters/react/helpers/filter-impl-alias-props.js +52 -0
- package/dist/src/extract/framework-adapters/react/helpers/infer-primitive-dom-props.d.ts +6 -0
- package/dist/src/extract/framework-adapters/react/helpers/infer-primitive-dom-props.js +69 -0
- package/dist/src/extract/framework-adapters/react/helpers/resolve-component-function.d.ts +4 -0
- package/dist/src/extract/framework-adapters/react/helpers/resolve-component-function.js +131 -0
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-prop-forwarding.d.ts +8 -0
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-prop-forwarding.js +22 -0
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-props-type.d.ts +14 -0
- package/dist/src/extract/framework-adapters/react/helpers/resolve-react-props-type.js +86 -0
- package/dist/src/extract/framework-adapters/react/helpers/synthesize-react-structural-slots.d.ts +8 -0
- package/dist/src/extract/framework-adapters/react/helpers/synthesize-react-structural-slots.js +44 -0
- package/dist/src/extract/framework-adapters/shared/helpers/build-component-lookup-maps.d.ts +5 -0
- package/dist/src/extract/framework-adapters/shared/helpers/build-component-lookup-maps.js +10 -0
- package/dist/src/extract/framework-adapters/shared/helpers/collect-jsdoc-slot-comments.d.ts +2 -0
- package/dist/src/extract/framework-adapters/shared/helpers/collect-jsdoc-slot-comments.js +13 -0
- package/dist/src/extract/{file-extraction-workers.d.ts → framework-adapters/shared/helpers/file-processing/file-workers.d.ts} +1 -13
- package/dist/src/extract/{file-extraction-workers.js → framework-adapters/shared/helpers/file-processing/file-workers.js} +0 -19
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/project-source-files.d.ts +5 -0
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/project-source-files.js +13 -0
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/result-normalizer.d.ts +6 -0
- package/dist/src/extract/framework-adapters/shared/helpers/file-processing/result-normalizer.js +6 -0
- package/dist/src/extract/framework-adapters/shared/helpers/find-tsx-workspace-package.d.ts +2 -0
- package/dist/src/extract/framework-adapters/shared/helpers/find-tsx-workspace-package.js +62 -0
- package/dist/src/extract/{source-line-metadata.d.ts → framework-adapters/shared/helpers/get-node-source-lines.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-tsconfig-path.d.ts +7 -0
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-tsconfig-path.js +93 -0
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-workspace-imports.d.ts +6 -0
- package/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-workspace-imports.js +58 -0
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-node-utils.d.ts +13 -0
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-node-utils.js +76 -0
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-renderable-exports.d.ts +12 -0
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-renderable-exports.js +35 -0
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-shared.d.ts +14 -0
- package/dist/src/extract/framework-adapters/shared/helpers/tsx-shared.js +54 -0
- package/dist/src/extract/{stencil.d.ts → framework-adapters/stencil/extractor.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/stencil/extractor.js +82 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/detect-stencil-class.d.ts +7 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/detect-stencil-class.js +32 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-props.d.ts +5 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-props.js +62 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-slots.d.ts +6 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-slots.js +87 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/stencil-prop-helpers.d.ts +5 -0
- package/dist/src/extract/framework-adapters/stencil/helpers/stencil-prop-helpers.js +39 -0
- package/dist/src/extract/{svelte.d.ts → framework-adapters/svelte/extractor.d.ts} +2 -1
- package/dist/src/extract/framework-adapters/svelte/extractor.js +27 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/classify-svelte-props-annotation.d.ts +6 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/classify-svelte-props-annotation.js +51 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/collect-svelte-type-references.d.ts +3 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/collect-svelte-type-references.js +52 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-from-svelte-file.d.ts +7 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-from-svelte-file.js +90 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-ast-type-members.d.ts +15 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-ast-type-members.js +46 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-declaration-data.d.ts +7 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-declaration-data.js +64 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-external-type-members.d.ts +4 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-external-type-members.js +58 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-from-destructure.d.ts +4 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-from-destructure.js +85 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-props.d.ts +22 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-props.js +55 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-template-slots.d.ts +7 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-template-slots.js +63 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-type-member-props.d.ts +3 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-type-member-props.js +31 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/find-svelte-script-declarations.d.ts +8 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/find-svelte-script-declarations.js +91 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/get-svelte-component-name.d.ts +1 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/get-svelte-component-name.js +26 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type-strings.d.ts +3 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type-strings.js +91 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type.d.ts +11 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/render-svelte-type.js +68 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-dts-location.d.ts +1 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-dts-location.js +90 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-allowed-components.d.ts +2 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-allowed-components.js +20 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-external-type-readers.d.ts +3 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-external-type-readers.js +68 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-checker.d.ts +4 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-checker.js +68 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-members.d.ts +6 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-members.js +30 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-unresolved-retry.d.ts +13 -0
- package/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-unresolved-retry.js +192 -0
- package/dist/src/extract/framework-adapters/svelte/types/svelte-ast-node.d.ts +12 -0
- package/dist/src/extract/framework-adapters/svelte/types/svelte-ast-node.js +1 -0
- package/dist/src/extract/{vue.d.ts → framework-adapters/vue/extractor.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/vue/extractor.js +61 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-object-props.d.ts +3 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-object-props.js +67 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-options-props.d.ts +4 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-options-props.js +72 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-object-props.d.ts +8 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-object-props.js +64 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-props.d.ts +2 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-props.js +66 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-slots.d.ts +24 -0
- package/dist/src/extract/framework-adapters/vue/helpers/extract-vue-slots.js +56 -0
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-vue-component-name.d.ts +2 -0
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-vue-component-name.js +9 -0
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-workspace-module.d.ts +1 -0
- package/dist/src/extract/framework-adapters/vue/helpers/resolve-workspace-module.js +76 -0
- package/dist/src/extract/framework-adapters/vue/helpers/workspace-package-dirs.d.ts +2 -0
- package/dist/src/extract/framework-adapters/vue/helpers/workspace-package-dirs.js +77 -0
- package/dist/src/extract/{vue-tsx.d.ts → framework-adapters/vue-tsx/extractor.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/vue-tsx/extractor.js +82 -0
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-props.d.ts +5 -0
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-props.js +189 -0
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-slots.d.ts +4 -0
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-slots.js +91 -0
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/resolve-ast-object.d.ts +11 -0
- package/dist/src/extract/framework-adapters/vue-tsx/helpers/resolve-ast-object.js +95 -0
- package/dist/src/extract/{web-components.d.ts → framework-adapters/web-components/extractor.d.ts} +1 -1
- package/dist/src/extract/framework-adapters/web-components/extractor.js +55 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.d.ts +4 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.js +67 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/detect-wc-non-public-members.d.ts +9 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/detect-wc-non-public-members.js +11 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-accessor-props.d.ts +3 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-accessor-props.js +65 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-class-properties.d.ts +3 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-class-properties.js +60 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-inheritance.d.ts +4 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-inheritance.js +16 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-jsdoc-attr-props.d.ts +3 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-jsdoc-attr-props.js +24 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-observed-attrs.d.ts +3 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-observed-attrs.js +27 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-slots.d.ts +6 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-slots.js +56 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.d.ts +4 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.js +49 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/merge-wc-prop-lists.d.ts +9 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/merge-wc-prop-lists.js +19 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-base-class.d.ts +2 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-base-class.js +59 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-decorator-tag.d.ts +2 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-decorator-tag.js +54 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import-source.d.ts +7 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import-source.js +47 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import.d.ts +4 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import.js +93 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-sibling-definition.d.ts +4 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-sibling-definition.js +79 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-tag-name.d.ts +7 -0
- package/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-tag-name.js +62 -0
- package/dist/src/extract/helpers/evidence/ast/collect-structural-jsx-evidence.d.ts +5 -0
- package/dist/src/extract/helpers/evidence/ast/collect-structural-jsx-evidence.js +63 -0
- package/dist/src/extract/helpers/evidence/ast/detect-react-node-types.d.ts +2 -0
- package/dist/src/extract/helpers/evidence/ast/detect-react-node-types.js +24 -0
- package/dist/src/extract/helpers/evidence/ast/get-jsx-ast-data.d.ts +14 -0
- package/dist/src/extract/helpers/evidence/ast/get-jsx-ast-data.js +85 -0
- package/dist/src/extract/helpers/evidence/collect-jsx-component-references.d.ts +5 -0
- package/dist/src/extract/helpers/evidence/collect-jsx-component-references.js +52 -0
- package/dist/src/extract/helpers/evidence/detect-slot-from-prop.d.ts +16 -0
- package/dist/src/extract/helpers/evidence/detect-slot-from-prop.js +39 -0
- package/dist/src/extract/orchestrator/execute-extraction-orchestrator.d.ts +13 -0
- package/dist/src/extract/orchestrator/execute-extraction-orchestrator.js +17 -0
- package/dist/src/{pre-classify.d.ts → extract/services/classification/classify-component-props.d.ts} +3 -5
- package/dist/src/{pre-classify.js → extract/services/classification/classify-component-props.js} +8 -100
- package/dist/src/extract/services/classification/helpers/check-prop-types.d.ts +7 -0
- package/dist/src/extract/services/classification/helpers/check-prop-types.js +22 -0
- package/dist/src/extract/services/classification/helpers/detect-dom-props.d.ts +2 -0
- package/dist/src/extract/services/classification/helpers/detect-dom-props.js +63 -0
- package/dist/src/extract/services/deduplication/deduplicate-components.d.ts +2 -0
- package/dist/src/extract/services/deduplication/deduplicate-components.js +58 -0
- package/dist/src/extract/services/deduplication/helpers/component-path-analysis.d.ts +10 -0
- package/dist/src/extract/services/deduplication/helpers/component-path-analysis.js +85 -0
- package/dist/src/extract/services/deduplication/helpers/component-path-scoring.d.ts +10 -0
- package/dist/src/extract/services/deduplication/helpers/component-path-scoring.js +73 -0
- package/dist/src/extract/services/extraction/extract-components.d.ts +3 -0
- package/dist/src/extract/services/extraction/extract-components.js +19 -0
- package/dist/src/extract/services/extraction/helpers/collect-sveltekit-route-exclusions.d.ts +2 -0
- package/dist/src/extract/services/extraction/helpers/collect-sveltekit-route-exclusions.js +18 -0
- package/dist/src/extract/services/extraction/helpers/filter-hook-components.d.ts +6 -0
- package/dist/src/extract/services/extraction/helpers/filter-hook-components.js +18 -0
- package/dist/src/extract/services/extraction/helpers/register-extractors.d.ts +8 -0
- package/dist/src/extract/services/extraction/helpers/register-extractors.js +71 -0
- package/dist/src/extract/services/extraction/helpers/run-extractor-batches.d.ts +4 -0
- package/dist/src/extract/services/extraction/helpers/run-extractor-batches.js +24 -0
- package/dist/src/extract/services/quality/evaluate-extraction-quality.d.ts +4 -0
- package/dist/src/extract/services/quality/evaluate-extraction-quality.js +61 -0
- package/dist/src/extract/services/quality/helpers/authorability/evaluate-authorability.d.ts +28 -0
- package/dist/src/extract/services/quality/helpers/authorability/evaluate-authorability.js +67 -0
- package/dist/src/extract/services/quality/helpers/inspection/detect-data-wrapper-patterns.d.ts +16 -0
- package/dist/src/extract/services/quality/helpers/inspection/detect-data-wrapper-patterns.js +63 -0
- package/dist/src/extract/{source-inspection.d.ts → services/quality/helpers/inspection/inspect-component-source.d.ts} +3 -6
- package/dist/src/extract/{source-inspection.js → services/quality/helpers/inspection/inspect-component-source.js} +5 -65
- package/dist/src/extract/{validate.d.ts → services/quality/helpers/inspection/validate-extracted-components.d.ts} +1 -1
- package/dist/src/extract/services/quality/helpers/scoring/collect-scoring-inputs.d.ts +14 -0
- package/dist/src/extract/{scoring.js → services/quality/helpers/scoring/collect-scoring-inputs.js} +10 -24
- package/dist/src/extract/services/quality/helpers/scoring/compute-extraction-score.d.ts +6 -0
- package/dist/src/extract/services/quality/helpers/scoring/compute-extraction-score.js +12 -0
- package/dist/src/extract/types/classification.d.ts +4 -0
- package/dist/src/extract/types/classification.js +1 -0
- package/dist/src/extract/types/component-extractor.d.ts +7 -0
- package/dist/src/extract/types/component-extractor.js +1 -0
- package/dist/src/{types.d.ts → extract/types/component.d.ts} +0 -22
- package/dist/src/extract/types/component.js +1 -0
- package/dist/src/extract/types/contract.d.ts +16 -0
- package/dist/src/extract/types/contract.js +1 -0
- package/dist/src/extract/types/display.d.ts +3 -0
- package/dist/src/{types.js → extract/types/display.js} +1 -1
- package/dist/src/extract/types/options.d.ts +15 -0
- package/dist/src/extract/types/options.js +1 -0
- package/dist/src/extract/types/scoring.d.ts +9 -0
- package/dist/src/extract/types/scoring.js +1 -0
- package/dist/src/extract/types/source-inspection.d.ts +5 -0
- package/dist/src/extract/types/source-inspection.js +1 -0
- package/dist/src/index.d.ts +27 -21
- package/dist/src/index.js +21 -17
- package/package.json +1 -1
- package/dist/src/extract/astro.js +0 -226
- package/dist/src/extract/non-authorable-filter.d.ts +0 -17
- package/dist/src/extract/non-authorable-filter.js +0 -60
- package/dist/src/extract/pipeline.d.ts +0 -7
- package/dist/src/extract/pipeline.js +0 -343
- package/dist/src/extract/react.js +0 -2069
- package/dist/src/extract/scoring.d.ts +0 -12
- package/dist/src/extract/slot-detection.d.ts +0 -35
- package/dist/src/extract/slot-detection.js +0 -98
- package/dist/src/extract/stencil.js +0 -312
- package/dist/src/extract/structural-slot-evidence.d.ts +0 -63
- package/dist/src/extract/structural-slot-evidence.js +0 -278
- package/dist/src/extract/svelte.js +0 -1309
- package/dist/src/extract/tsx-shared.d.ts +0 -37
- package/dist/src/extract/tsx-shared.js +0 -368
- package/dist/src/extract/vue-tsx.js +0 -449
- package/dist/src/extract/vue.js +0 -605
- package/dist/src/extract/web-components.js +0 -863
- /package/dist/src/extract/{source-line-metadata.js → framework-adapters/shared/helpers/get-node-source-lines.js} +0 -0
- /package/dist/src/extract/{resolve-local-module.d.ts → framework-adapters/shared/helpers/resolve-import-file-path.d.ts} +0 -0
- /package/dist/src/extract/{resolve-local-module.js → framework-adapters/shared/helpers/resolve-import-file-path.js} +0 -0
- /package/dist/src/extract/{resolve-type-property.d.ts → framework-adapters/shared/helpers/resolve-type-symbol.d.ts} +0 -0
- /package/dist/src/extract/{resolve-type-property.js → framework-adapters/shared/helpers/resolve-type-symbol.js} +0 -0
- /package/dist/src/extract/{slot-allowed-components.d.ts → helpers/evidence/collect-allowed-component-names.d.ts} +0 -0
- /package/dist/src/extract/{slot-allowed-components.js → helpers/evidence/collect-allowed-component-names.js} +0 -0
- /package/dist/src/extract/{parse-imported-names.d.ts → helpers/evidence/parse-source-imports.d.ts} +0 -0
- /package/dist/src/extract/{parse-imported-names.js → helpers/evidence/parse-source-imports.js} +0 -0
- /package/dist/src/extract/{validate.js → services/quality/helpers/inspection/validate-extracted-components.js} +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { RawComponentDefinition } from '../types.js';
|
|
2
|
-
export type ExtractionConfidence = 1 | 2 | 3 | 4 | 5;
|
|
3
|
-
export type ExtractionScore = {
|
|
4
|
-
confidence: ExtractionConfidence;
|
|
5
|
-
reasons: string[];
|
|
6
|
-
};
|
|
7
|
-
export interface ExtractionScoreOptions {
|
|
8
|
-
additionalIssueCount?: number;
|
|
9
|
-
additionalReasons?: string[];
|
|
10
|
-
}
|
|
11
|
-
export declare function computeExtractionScore(component: RawComponentDefinition, options?: ExtractionScoreOptions): ExtractionScore;
|
|
12
|
-
export declare function deriveNeedsReview(confidence: ExtractionConfidence): boolean;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slot detection utilities for ReactNode-typed props.
|
|
3
|
-
*
|
|
4
|
-
* Props whose type resolves to ReactNode/ReactElement/JSX.Element are treated
|
|
5
|
-
* as slots rather than plain props — unless their name is in the content-name
|
|
6
|
-
* exception list (label, title, description, etc.).
|
|
7
|
-
*
|
|
8
|
-
* Array ReactNode types (e.g. ReactNode[]) ALWAYS become slots, even if the
|
|
9
|
-
* prop name is in the exception list.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Prop names that should remain as props even when typed as ReactNode.
|
|
13
|
-
* These are typically text-content names, not composable slots.
|
|
14
|
-
*/
|
|
15
|
-
export declare const CONTENT_NAME_EXCEPTIONS: Set<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Checks if a type string represents a ReactNode/ReactElement/JSX.Element type,
|
|
18
|
-
* including unions with null/undefined.
|
|
19
|
-
*/
|
|
20
|
-
export declare function isReactNodeType(typeText: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Checks if a type string represents an array of ReactNode.
|
|
23
|
-
* Examples: ReactNode[], React.ReactNode[], Array<ReactNode>
|
|
24
|
-
*/
|
|
25
|
-
export declare function isArrayReactNodeType(typeText: string): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Determines whether a prop should be converted to a slot based on its name and type.
|
|
28
|
-
*
|
|
29
|
-
* Rules:
|
|
30
|
-
* 1. If the type is not a ReactNode type → false
|
|
31
|
-
* 2. If the type is an array ReactNode → true (overrides exception list)
|
|
32
|
-
* 3. If the name is in the content-name exception list → false
|
|
33
|
-
* 4. Otherwise → true
|
|
34
|
-
*/
|
|
35
|
-
export declare function shouldBeSlot(propName: string, typeText: string): boolean;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slot detection utilities for ReactNode-typed props.
|
|
3
|
-
*
|
|
4
|
-
* Props whose type resolves to ReactNode/ReactElement/JSX.Element are treated
|
|
5
|
-
* as slots rather than plain props — unless their name is in the content-name
|
|
6
|
-
* exception list (label, title, description, etc.).
|
|
7
|
-
*
|
|
8
|
-
* Array ReactNode types (e.g. ReactNode[]) ALWAYS become slots, even if the
|
|
9
|
-
* prop name is in the exception list.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Prop names that should remain as props even when typed as ReactNode.
|
|
13
|
-
* These are typically text-content names, not composable slots.
|
|
14
|
-
*/
|
|
15
|
-
export const CONTENT_NAME_EXCEPTIONS = new Set([
|
|
16
|
-
'label',
|
|
17
|
-
'title',
|
|
18
|
-
'description',
|
|
19
|
-
'text',
|
|
20
|
-
'caption',
|
|
21
|
-
'message',
|
|
22
|
-
'placeholder',
|
|
23
|
-
'tooltip',
|
|
24
|
-
'heading',
|
|
25
|
-
'subheading',
|
|
26
|
-
'body',
|
|
27
|
-
'summary',
|
|
28
|
-
'excerpt',
|
|
29
|
-
]);
|
|
30
|
-
const REACT_NODE_EXACT_PATTERNS = ['ReactNode', 'React.ReactNode', 'ReactElement', 'React.ReactElement', 'JSX.Element'];
|
|
31
|
-
function normalizeReactNodeType(typeText) {
|
|
32
|
-
return typeText
|
|
33
|
-
.replace(/\s+/g, ' ')
|
|
34
|
-
.trim()
|
|
35
|
-
.split('|')
|
|
36
|
-
.map((part) => part.trim())
|
|
37
|
-
.filter((part) => part !== 'null' && part !== 'undefined')
|
|
38
|
-
.join(' | ');
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Checks if a type string represents a ReactNode/ReactElement/JSX.Element type,
|
|
42
|
-
* including unions with null/undefined.
|
|
43
|
-
*/
|
|
44
|
-
export function isReactNodeType(typeText) {
|
|
45
|
-
const stripped = normalizeReactNodeType(typeText);
|
|
46
|
-
// Check exact match (after stripping null/undefined union members)
|
|
47
|
-
if (REACT_NODE_EXACT_PATTERNS.includes(stripped)) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
// Check array patterns
|
|
51
|
-
if (isArrayReactNodeType(typeText)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Checks if a type string represents an array of ReactNode.
|
|
58
|
-
* Examples: ReactNode[], React.ReactNode[], Array<ReactNode>
|
|
59
|
-
*/
|
|
60
|
-
export function isArrayReactNodeType(typeText) {
|
|
61
|
-
const stripped = normalizeReactNodeType(typeText);
|
|
62
|
-
// Pattern: ReactNode[] or React.ReactNode[] etc.
|
|
63
|
-
for (const pattern of REACT_NODE_EXACT_PATTERNS) {
|
|
64
|
-
if (stripped === `${pattern}[]`) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Pattern: Array<ReactNode> or Array<React.ReactNode> etc.
|
|
69
|
-
for (const pattern of REACT_NODE_EXACT_PATTERNS) {
|
|
70
|
-
if (stripped === `Array<${pattern}>`) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Determines whether a prop should be converted to a slot based on its name and type.
|
|
78
|
-
*
|
|
79
|
-
* Rules:
|
|
80
|
-
* 1. If the type is not a ReactNode type → false
|
|
81
|
-
* 2. If the type is an array ReactNode → true (overrides exception list)
|
|
82
|
-
* 3. If the name is in the content-name exception list → false
|
|
83
|
-
* 4. Otherwise → true
|
|
84
|
-
*/
|
|
85
|
-
export function shouldBeSlot(propName, typeText) {
|
|
86
|
-
if (!isReactNodeType(typeText)) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
// Array ReactNode always becomes a slot, even for exception names
|
|
90
|
-
if (isArrayReactNodeType(typeText)) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
// Check exception list
|
|
94
|
-
if (CONTENT_NAME_EXCEPTIONS.has(propName)) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import { Project, Node, SyntaxKind } from 'ts-morph';
|
|
2
|
-
import { getJsxTagNameNode, isIntrinsicJsxElement, kebabToPascal } from './tsx-shared.js';
|
|
3
|
-
import { createSortedExtractionResult, extractProjectSourceFiles } from './file-extraction-workers.js';
|
|
4
|
-
function isStencilFile(sourceFile) {
|
|
5
|
-
return sourceFile.getImportDeclarations().some((imp) => imp.getModuleSpecifierValue() === '@stencil/core');
|
|
6
|
-
}
|
|
7
|
-
function getComponentTag(classDecl) {
|
|
8
|
-
for (const decorator of classDecl.getDecorators()) {
|
|
9
|
-
if (decorator.getName() !== 'Component')
|
|
10
|
-
continue;
|
|
11
|
-
const args = decorator.getArguments();
|
|
12
|
-
if (args.length === 0)
|
|
13
|
-
continue;
|
|
14
|
-
const arg = args[0];
|
|
15
|
-
if (!Node.isObjectLiteralExpression(arg))
|
|
16
|
-
continue;
|
|
17
|
-
const tagProp = arg.getProperty('tag');
|
|
18
|
-
if (!tagProp || !Node.isPropertyAssignment(tagProp))
|
|
19
|
-
continue;
|
|
20
|
-
const initializer = tagProp.getInitializer();
|
|
21
|
-
if (!initializer || !Node.isStringLiteral(initializer))
|
|
22
|
-
continue;
|
|
23
|
-
return initializer.getLiteralValue();
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
function hasDecorator(node, decoratorName) {
|
|
28
|
-
if (!Node.isPropertyDeclaration(node))
|
|
29
|
-
return false;
|
|
30
|
-
return node.getDecorators().some((d) => d.getName() === decoratorName);
|
|
31
|
-
}
|
|
32
|
-
function extractAllowedValues(typeText) {
|
|
33
|
-
// Match inline string literal unions: 'a' | 'b' | 'c'
|
|
34
|
-
const literalPattern = /^'[^']*'(?:\s*\|\s*'[^']*')+$/;
|
|
35
|
-
if (!literalPattern.test(typeText.trim()))
|
|
36
|
-
return undefined;
|
|
37
|
-
const values = typeText
|
|
38
|
-
.split('|')
|
|
39
|
-
.map((v) => v.trim().replace(/^'|'$/g, ''))
|
|
40
|
-
.filter(Boolean)
|
|
41
|
-
.sort();
|
|
42
|
-
return values.length >= 2 ? values : undefined;
|
|
43
|
-
}
|
|
44
|
-
function collectIntrinsicDomAttributeProps(classDecl, propNames) {
|
|
45
|
-
const domAttributeProps = new Set();
|
|
46
|
-
const renderMethod = classDecl.getMethod('render');
|
|
47
|
-
if (!renderMethod)
|
|
48
|
-
return domAttributeProps;
|
|
49
|
-
for (const attribute of renderMethod.getDescendantsOfKind(SyntaxKind.JsxAttribute)) {
|
|
50
|
-
const tagName = getJsxTagNameNode(attribute)?.getText();
|
|
51
|
-
const attributeName = attribute.getNameNode().getText();
|
|
52
|
-
if (!tagName || !propNames.has(attributeName) || !isIntrinsicJsxElement(tagName)) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const initializer = attribute.getInitializer();
|
|
56
|
-
if (!initializer || !Node.isJsxExpression(initializer))
|
|
57
|
-
continue;
|
|
58
|
-
const expression = initializer.getExpression();
|
|
59
|
-
if (!expression || !Node.isPropertyAccessExpression(expression))
|
|
60
|
-
continue;
|
|
61
|
-
if (!Node.isThisExpression(expression.getExpression()))
|
|
62
|
-
continue;
|
|
63
|
-
if (expression.getName() !== attributeName)
|
|
64
|
-
continue;
|
|
65
|
-
domAttributeProps.add(attributeName);
|
|
66
|
-
}
|
|
67
|
-
return domAttributeProps;
|
|
68
|
-
}
|
|
69
|
-
function extractProps(classDecl) {
|
|
70
|
-
const props = [];
|
|
71
|
-
const propNames = new Set(classDecl
|
|
72
|
-
.getProperties()
|
|
73
|
-
.filter((property) => hasDecorator(property, 'Prop'))
|
|
74
|
-
.map((property) => property.getName()));
|
|
75
|
-
const intrinsicDomAttributeProps = collectIntrinsicDomAttributeProps(classDecl, propNames);
|
|
76
|
-
for (const property of classDecl.getProperties()) {
|
|
77
|
-
if (!hasDecorator(property, 'Prop'))
|
|
78
|
-
continue;
|
|
79
|
-
const name = property.getName();
|
|
80
|
-
const typeNode = property.getTypeNode();
|
|
81
|
-
const typeText = typeNode ? typeNode.getText() : 'unknown';
|
|
82
|
-
const hasQuestionToken = property.hasQuestionToken();
|
|
83
|
-
const hasExclamation = property.hasExclamationToken();
|
|
84
|
-
const initializer = property.getInitializer();
|
|
85
|
-
let defaultValue;
|
|
86
|
-
if (initializer) {
|
|
87
|
-
if (Node.isStringLiteral(initializer)) {
|
|
88
|
-
defaultValue = initializer.getLiteralValue();
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
defaultValue = initializer.getText();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const isRequired = hasExclamation || (!hasQuestionToken && !initializer);
|
|
95
|
-
// JSDoc description
|
|
96
|
-
const jsDocs = property.getJsDocs();
|
|
97
|
-
let description;
|
|
98
|
-
let isDeprecated = false;
|
|
99
|
-
if (jsDocs.length > 0) {
|
|
100
|
-
const jsDoc = jsDocs[0];
|
|
101
|
-
description = jsDoc.getDescription().trim() || undefined;
|
|
102
|
-
for (const tag of jsDoc.getTags()) {
|
|
103
|
-
if (tag.getTagName() === 'deprecated') {
|
|
104
|
-
isDeprecated = true;
|
|
105
|
-
// The deprecated tag may carry a message (e.g. "@deprecated Use size instead.")
|
|
106
|
-
const tagComment = tag.getCommentText()?.trim();
|
|
107
|
-
if (tagComment && !description) {
|
|
108
|
-
description = tagComment;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (isDeprecated && description) {
|
|
114
|
-
description = `[DEPRECATED] ${description}`;
|
|
115
|
-
}
|
|
116
|
-
else if (isDeprecated) {
|
|
117
|
-
description = '[DEPRECATED]';
|
|
118
|
-
}
|
|
119
|
-
const allowedValues = extractAllowedValues(typeText);
|
|
120
|
-
props.push({
|
|
121
|
-
name,
|
|
122
|
-
type: typeText,
|
|
123
|
-
required: isRequired,
|
|
124
|
-
...(defaultValue !== undefined && { defaultValue }),
|
|
125
|
-
...(description && { description }),
|
|
126
|
-
...(allowedValues && { allowedValues }),
|
|
127
|
-
...(intrinsicDomAttributeProps.has(name) && { domAttribute: true }),
|
|
128
|
-
sourceStartLine: property.getStartLineNumber(),
|
|
129
|
-
sourceEndLine: property.getEndLineNumber(),
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return props.sort((a, b) => a.name.localeCompare(b.name));
|
|
133
|
-
}
|
|
134
|
-
function normalizeSlotName(name) {
|
|
135
|
-
const normalizedName = name && name.length > 0 ? name : 'default';
|
|
136
|
-
return {
|
|
137
|
-
name: normalizedName,
|
|
138
|
-
isDefault: normalizedName === 'default',
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function extractSlots(classDecl, warnings, componentName) {
|
|
142
|
-
const slots = new Map();
|
|
143
|
-
const upsertSlot = (slot) => {
|
|
144
|
-
const existing = slots.get(slot.name);
|
|
145
|
-
if (!existing) {
|
|
146
|
-
slots.set(slot.name, slot);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
slots.set(slot.name, {
|
|
150
|
-
...existing,
|
|
151
|
-
...slot,
|
|
152
|
-
description: existing.description ?? slot.description,
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
const jsDocs = classDecl.getJsDocs();
|
|
156
|
-
for (const jsDoc of jsDocs) {
|
|
157
|
-
for (const tag of jsDoc.getTags()) {
|
|
158
|
-
if (tag.getTagName() !== 'slot')
|
|
159
|
-
continue;
|
|
160
|
-
const comment = tag.getCommentText()?.trim();
|
|
161
|
-
if (!comment)
|
|
162
|
-
continue;
|
|
163
|
-
if (comment.startsWith('{')) {
|
|
164
|
-
try {
|
|
165
|
-
const parsed = JSON.parse(comment);
|
|
166
|
-
const slot = normalizeSlotName(parsed.name);
|
|
167
|
-
let description = parsed.description || undefined;
|
|
168
|
-
if (parsed.isDeprecated && description) {
|
|
169
|
-
description = `[DEPRECATED] ${description}`;
|
|
170
|
-
}
|
|
171
|
-
else if (parsed.isDeprecated) {
|
|
172
|
-
description = '[DEPRECATED]';
|
|
173
|
-
}
|
|
174
|
-
upsertSlot({
|
|
175
|
-
...slot,
|
|
176
|
-
...(description && { description }),
|
|
177
|
-
});
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
warnings.push(`Failed to parse @slot JSDoc in ${componentName}: invalid JSON "${comment}"`);
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
const match = comment.match(/^(?:(\S+)\s*-\s*)?(.*)$/s);
|
|
186
|
-
if (!match)
|
|
187
|
-
continue;
|
|
188
|
-
const [, rawName, rawDescription] = match;
|
|
189
|
-
const slot = normalizeSlotName(rawName);
|
|
190
|
-
const description = rawDescription.trim() || undefined;
|
|
191
|
-
upsertSlot({
|
|
192
|
-
...slot,
|
|
193
|
-
...(description && { description }),
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
for (const method of classDecl.getMethods()) {
|
|
198
|
-
method.forEachDescendant((node) => {
|
|
199
|
-
if (!Node.isJsxSelfClosingElement(node) && !Node.isJsxElement(node))
|
|
200
|
-
return;
|
|
201
|
-
const openingElement = Node.isJsxElement(node) ? node.getOpeningElement() : node;
|
|
202
|
-
const tagName = openingElement.getTagNameNode().getText();
|
|
203
|
-
const slotAttribute = openingElement
|
|
204
|
-
.getAttributes()
|
|
205
|
-
.find((attribute) => Node.isJsxAttribute(attribute) && attribute.getNameNode().getText() === 'slot');
|
|
206
|
-
if (tagName === 'slot') {
|
|
207
|
-
const nameAttribute = openingElement
|
|
208
|
-
.getAttributes()
|
|
209
|
-
.find((attribute) => Node.isJsxAttribute(attribute) && attribute.getNameNode().getText() === 'name');
|
|
210
|
-
const initializer = Node.isJsxAttribute(nameAttribute) ? nameAttribute.getInitializer() : undefined;
|
|
211
|
-
const name = initializer && Node.isStringLiteral(initializer)
|
|
212
|
-
? initializer.getLiteralValue()
|
|
213
|
-
: initializer && Node.isJsxExpression(initializer)
|
|
214
|
-
? (initializer.getExpression()?.getText() ?? '')
|
|
215
|
-
: '';
|
|
216
|
-
upsertSlot({
|
|
217
|
-
...normalizeSlotName(name),
|
|
218
|
-
});
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
if (!Node.isJsxAttribute(slotAttribute))
|
|
222
|
-
return;
|
|
223
|
-
const initializer = slotAttribute.getInitializer();
|
|
224
|
-
if (!initializer || !Node.isStringLiteral(initializer))
|
|
225
|
-
return;
|
|
226
|
-
const name = initializer.getLiteralValue();
|
|
227
|
-
if (!name)
|
|
228
|
-
return;
|
|
229
|
-
upsertSlot({
|
|
230
|
-
name,
|
|
231
|
-
isDefault: false,
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
return [...slots.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
236
|
-
}
|
|
237
|
-
function detectEvents(classDecl) {
|
|
238
|
-
const eventNames = [];
|
|
239
|
-
for (const property of classDecl.getProperties()) {
|
|
240
|
-
if (!hasDecorator(property, 'Event'))
|
|
241
|
-
continue;
|
|
242
|
-
eventNames.push(property.getName());
|
|
243
|
-
}
|
|
244
|
-
return eventNames.sort();
|
|
245
|
-
}
|
|
246
|
-
function extractFromSourceFile(sourceFile, warnings) {
|
|
247
|
-
const components = [];
|
|
248
|
-
for (const classDecl of sourceFile.getClasses()) {
|
|
249
|
-
const tag = getComponentTag(classDecl);
|
|
250
|
-
if (!tag)
|
|
251
|
-
continue;
|
|
252
|
-
const name = kebabToPascal(tag);
|
|
253
|
-
const props = extractProps(classDecl);
|
|
254
|
-
const slots = extractSlots(classDecl, warnings, name);
|
|
255
|
-
const eventNames = detectEvents(classDecl);
|
|
256
|
-
if (eventNames.length > 0) {
|
|
257
|
-
warnings.push(`Component ${name} has ${eventNames.length} events not captured: ${eventNames.join(', ')}`);
|
|
258
|
-
}
|
|
259
|
-
components.push({
|
|
260
|
-
name,
|
|
261
|
-
source: sourceFile.getFilePath(),
|
|
262
|
-
sourcePath: sourceFile.getFilePath(),
|
|
263
|
-
framework: 'stencil',
|
|
264
|
-
props,
|
|
265
|
-
slots,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
return components;
|
|
269
|
-
}
|
|
270
|
-
function detectFunctionalComponents(sourceFile, warnings) {
|
|
271
|
-
for (const [exportName, declarations] of sourceFile.getExportedDeclarations()) {
|
|
272
|
-
for (const decl of declarations) {
|
|
273
|
-
if (!Node.isVariableDeclaration(decl))
|
|
274
|
-
continue;
|
|
275
|
-
const typeNode = decl.getTypeNode();
|
|
276
|
-
if (!typeNode)
|
|
277
|
-
continue;
|
|
278
|
-
const typeText = typeNode.getText();
|
|
279
|
-
if (!typeText.startsWith('FunctionalComponent'))
|
|
280
|
-
continue;
|
|
281
|
-
warnings.push(`Stencil FunctionalComponent detected but not extracted: ${exportName} in ${sourceFile.getFilePath()}`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
export async function extractStencilComponents(filePaths) {
|
|
286
|
-
const tsxFiles = filePaths.filter((f) => /\.[jt]sx$/.test(f));
|
|
287
|
-
if (tsxFiles.length === 0) {
|
|
288
|
-
return { components: [], warnings: [] };
|
|
289
|
-
}
|
|
290
|
-
const project = new Project({
|
|
291
|
-
compilerOptions: {
|
|
292
|
-
jsx: 1, // JsxEmit.Preserve
|
|
293
|
-
target: 99, // ScriptTarget.ESNext
|
|
294
|
-
module: 99, // ModuleKind.ESNext
|
|
295
|
-
moduleResolution: 100, // ModuleResolutionKind.Bundler
|
|
296
|
-
skipLibCheck: true,
|
|
297
|
-
allowJs: true,
|
|
298
|
-
},
|
|
299
|
-
skipAddingFilesFromTsConfig: true,
|
|
300
|
-
});
|
|
301
|
-
for (const filePath of tsxFiles) {
|
|
302
|
-
project.addSourceFileAtPath(filePath);
|
|
303
|
-
}
|
|
304
|
-
const { items: components, warnings } = extractProjectSourceFiles(project, (sourceFile, sourceWarnings) => {
|
|
305
|
-
if (!isStencilFile(sourceFile))
|
|
306
|
-
return [];
|
|
307
|
-
const extracted = extractFromSourceFile(sourceFile, sourceWarnings);
|
|
308
|
-
detectFunctionalComponents(sourceFile, sourceWarnings);
|
|
309
|
-
return extracted;
|
|
310
|
-
});
|
|
311
|
-
return createSortedExtractionResult(components, warnings);
|
|
312
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { type FunctionDeclaration, type ArrowFunction, type FunctionExpression, type SourceFile } from 'ts-morph';
|
|
2
|
-
import { type AllowedComponentsContext } from './slot-allowed-components.js';
|
|
3
|
-
type FunctionLike = FunctionDeclaration | ArrowFunction | FunctionExpression;
|
|
4
|
-
/**
|
|
5
|
-
* Structural composition evidence: parent→child relationships a component's
|
|
6
|
-
* source implies through *usage*, not through a declared slot contract
|
|
7
|
-
* (`ReactElement<XProps>` on the slot's own prop type, `@allowedComponents`,
|
|
8
|
-
* a mapping-layer keyword). Declared contracts still win on conflict — see
|
|
9
|
-
* the `structural` provenance rank in the CLI's composition merge — this is
|
|
10
|
-
* a lower-trust supplementary signal for the common case where a component
|
|
11
|
-
* accepts `children: ReactNode` and narrows it at runtime instead.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Signal A — a type-predicate function anywhere in the file asserts a value
|
|
15
|
-
* `is ReactElement<XProps>` (e.g. `function isFooElement(c): c is
|
|
16
|
-
* ReactElement<FooProps>`). Common alongside a runtime `Children.map` /
|
|
17
|
-
* `cloneElement` narrowing pattern where the slot's own prop type is a bare
|
|
18
|
-
* `ReactNode` and carries no generic for the typed-slot extractor to read.
|
|
19
|
-
*/
|
|
20
|
-
export declare function collectTypePredicateComponentReferences(sourceFile: SourceFile, ctx: AllowedComponentsContext): string[];
|
|
21
|
-
/**
|
|
22
|
-
* Signal B — a runtime identity check against a known component, e.g.
|
|
23
|
-
* `isValidElement(child) && child.type === BlueAccordionItem`. `.type` on a
|
|
24
|
-
* React element is the actual component reference, so this is direct
|
|
25
|
-
* evidence the checked value is expected to BE that component — not a name
|
|
26
|
-
* guess, an identity comparison against the real imported binding.
|
|
27
|
-
*/
|
|
28
|
-
export declare function collectRuntimeTypeCheckComponentReferences(sourceFile: SourceFile, componentNames: ReadonlySet<string>): string[];
|
|
29
|
-
/**
|
|
30
|
-
* Signal C — a component's own render body literally instantiates another
|
|
31
|
-
* known local component as JSX (e.g. `<CardHeader/>` inside `Card`'s
|
|
32
|
-
* return). Direct structural nesting, not a slot being filled with
|
|
33
|
-
* caller-supplied content — the weakest-trust signal, kept last in the rank.
|
|
34
|
-
*/
|
|
35
|
-
export declare function collectRenderedComponentReferences(funcNode: FunctionLike, componentNames: ReadonlySet<string>, ownComponentName: string): string[];
|
|
36
|
-
/**
|
|
37
|
-
* Signal D — data-array render: the component's render body maps an array-
|
|
38
|
-
* typed prop to a known child component (e.g. `{items.map(x => <ItemRow
|
|
39
|
-
* .../>)}` inside a parent whose `items` prop is a plain data array).
|
|
40
|
-
*
|
|
41
|
-
* Fires only when ALL strict-gating conditions hold, to keep false positives
|
|
42
|
-
* off in the common case where mapping over data doesn't imply an authorable
|
|
43
|
-
* compositional slot. Conditions are listed in check order (cheap fails
|
|
44
|
-
* first) so the loop-body labels line up 1-to-1 with this list:
|
|
45
|
-
*
|
|
46
|
-
* 1. The `.map` callee is an identifier that matches a declared prop on
|
|
47
|
-
* the parent (`propNames`).
|
|
48
|
-
* 2. The prop's declared type text is a plain data array — not
|
|
49
|
-
* `ReactNode[]` / `ReactElement<...>[]` / `React.ReactNode[]`, etc.
|
|
50
|
-
* (those cases are already covered by the typed-slot pass, so firing
|
|
51
|
-
* this signal for them would double-count.)
|
|
52
|
-
* 3. The callback returns a JSX element whose tag is an identifier
|
|
53
|
-
* resolving to a known component (`componentNames`).
|
|
54
|
-
* 4. That child component is NOT rendered anywhere else in the parent's
|
|
55
|
-
* body — the map is the only render site.
|
|
56
|
-
*
|
|
57
|
-
* When all four hold, the mapped child is a strong candidate for a
|
|
58
|
-
* synthesised default slot on the parent — the extractor treats it that way
|
|
59
|
-
* only when there's no other slot to hang the evidence on (see the caller in
|
|
60
|
-
* react.ts).
|
|
61
|
-
*/
|
|
62
|
-
export declare function collectArrayMapRenderComponentReferences(funcNode: FunctionLike, componentNames: ReadonlySet<string>, ownComponentName: string, propTypesByName: ReadonlyMap<string, string>): string[];
|
|
63
|
-
export {};
|