@nielspeter/eess-ts 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -35
- package/dist/builders/call-rule-builder.d.ts +66 -26
- package/dist/builders/call-rule-builder.d.ts.map +1 -1
- package/dist/builders/call-rule-builder.js +73 -31
- package/dist/builders/call-rule-builder.js.map +1 -1
- package/dist/builders/class-rule-builder.d.ts +125 -26
- package/dist/builders/class-rule-builder.d.ts.map +1 -1
- package/dist/builders/class-rule-builder.js +134 -30
- package/dist/builders/class-rule-builder.js.map +1 -1
- package/dist/builders/correspondence-builder.d.ts +287 -0
- package/dist/builders/correspondence-builder.d.ts.map +1 -0
- package/dist/builders/correspondence-builder.js +393 -0
- package/dist/builders/correspondence-builder.js.map +1 -0
- package/dist/builders/correspondence-findings.d.ts +104 -0
- package/dist/builders/correspondence-findings.d.ts.map +1 -0
- package/dist/builders/correspondence-findings.js +301 -0
- package/dist/builders/correspondence-findings.js.map +1 -0
- package/dist/builders/cross-layer-builder.d.ts +99 -16
- package/dist/builders/cross-layer-builder.d.ts.map +1 -1
- package/dist/builders/cross-layer-builder.js +181 -35
- package/dist/builders/cross-layer-builder.js.map +1 -1
- package/dist/builders/function-rule-builder.d.ts +144 -25
- package/dist/builders/function-rule-builder.d.ts.map +1 -1
- package/dist/builders/function-rule-builder.js +173 -26
- package/dist/builders/function-rule-builder.js.map +1 -1
- package/dist/builders/jsx-rule-builder.d.ts +70 -14
- package/dist/builders/jsx-rule-builder.d.ts.map +1 -1
- package/dist/builders/jsx-rule-builder.js +73 -14
- package/dist/builders/jsx-rule-builder.js.map +1 -1
- package/dist/builders/module-rule-builder.d.ts +2 -2
- package/dist/builders/module-rule-builder.d.ts.map +1 -1
- package/dist/builders/module-rule-builder.js +12 -3
- package/dist/builders/module-rule-builder.js.map +1 -1
- package/dist/builders/scoped-function-rule-builder.d.ts +11 -0
- package/dist/builders/scoped-function-rule-builder.d.ts.map +1 -1
- package/dist/builders/scoped-function-rule-builder.js +12 -0
- package/dist/builders/scoped-function-rule-builder.js.map +1 -1
- package/dist/builders/slice-discovery-message.d.ts +36 -0
- package/dist/builders/slice-discovery-message.d.ts.map +1 -0
- package/dist/builders/slice-discovery-message.js +181 -0
- package/dist/builders/slice-discovery-message.js.map +1 -0
- package/dist/builders/slice-rule-builder.d.ts +151 -12
- package/dist/builders/slice-rule-builder.d.ts.map +1 -1
- package/dist/builders/slice-rule-builder.js +242 -35
- package/dist/builders/slice-rule-builder.js.map +1 -1
- package/dist/builders/type-rule-builder.d.ts +95 -24
- package/dist/builders/type-rule-builder.d.ts.map +1 -1
- package/dist/builders/type-rule-builder.js +105 -29
- package/dist/builders/type-rule-builder.js.map +1 -1
- package/dist/{helpers → builders}/within.d.ts +2 -2
- package/dist/builders/within.d.ts.map +1 -0
- package/dist/{helpers → builders}/within.js +1 -1
- package/dist/builders/within.js.map +1 -0
- package/dist/cli/commands/baseline.d.ts +3 -2
- package/dist/cli/commands/baseline.d.ts.map +1 -1
- package/dist/cli/commands/baseline.js +68 -6
- package/dist/cli/commands/baseline.js.map +1 -1
- package/dist/cli/commands/check.d.ts +7 -2
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +241 -45
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +29 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +224 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/explain.d.ts +2 -1
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/explain.js +19 -10
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/init.d.ts +9 -3
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +162 -137
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/import-rule-module.d.ts +29 -0
- package/dist/cli/import-rule-module.d.ts.map +1 -0
- package/dist/cli/import-rule-module.js +60 -0
- package/dist/cli/import-rule-module.js.map +1 -0
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +98 -33
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/load-rules.d.ts +6 -11
- package/dist/cli/load-rules.d.ts.map +1 -1
- package/dist/cli/load-rules.js +21 -29
- package/dist/cli/load-rules.js.map +1 -1
- package/dist/cli/resolve-config.d.ts.map +1 -1
- package/dist/cli/resolve-config.js +24 -24
- package/dist/cli/resolve-config.js.map +1 -1
- package/dist/cli/rule-file-findings.d.ts +178 -0
- package/dist/cli/rule-file-findings.d.ts.map +1 -0
- package/dist/cli/rule-file-findings.js +293 -0
- package/dist/cli/rule-file-findings.js.map +1 -0
- package/dist/cli/watch.d.ts +20 -7
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +39 -14
- package/dist/cli/watch.js.map +1 -1
- package/dist/conditions/body-analysis-function.d.ts.map +1 -1
- package/dist/conditions/body-analysis-function.js +16 -7
- package/dist/conditions/body-analysis-function.js.map +1 -1
- package/dist/conditions/body-analysis-module.d.ts.map +1 -1
- package/dist/conditions/body-analysis-module.js +14 -9
- package/dist/conditions/body-analysis-module.js.map +1 -1
- package/dist/conditions/body-analysis.d.ts.map +1 -1
- package/dist/conditions/body-analysis.js +16 -7
- package/dist/conditions/body-analysis.js.map +1 -1
- package/dist/conditions/call.d.ts.map +1 -1
- package/dist/conditions/call.js +38 -17
- package/dist/conditions/call.js.map +1 -1
- package/dist/conditions/catch-analysis.d.ts +2 -1
- package/dist/conditions/catch-analysis.d.ts.map +1 -1
- package/dist/conditions/catch-analysis.js.map +1 -1
- package/dist/conditions/cross-layer.d.ts +2 -10
- package/dist/conditions/cross-layer.d.ts.map +1 -1
- package/dist/conditions/cross-layer.js +227 -23
- package/dist/conditions/cross-layer.js.map +1 -1
- package/dist/conditions/dependency.d.ts +35 -6
- package/dist/conditions/dependency.d.ts.map +1 -1
- package/dist/conditions/dependency.js +299 -45
- package/dist/conditions/dependency.js.map +1 -1
- package/dist/conditions/exports.d.ts.map +1 -1
- package/dist/conditions/exports.js +10 -0
- package/dist/conditions/exports.js.map +1 -1
- package/dist/conditions/function.d.ts.map +1 -1
- package/dist/conditions/function.js +19 -5
- package/dist/conditions/function.js.map +1 -1
- package/dist/conditions/helpers.d.ts +2 -1
- package/dist/conditions/helpers.d.ts.map +1 -1
- package/dist/conditions/helpers.js +4 -1
- package/dist/conditions/helpers.js.map +1 -1
- package/dist/conditions/jsx.d.ts.map +1 -1
- package/dist/conditions/jsx.js +7 -2
- package/dist/conditions/jsx.js.map +1 -1
- package/dist/conditions/match-identity.d.ts +43 -0
- package/dist/conditions/match-identity.d.ts.map +1 -0
- package/dist/conditions/match-identity.js +43 -0
- package/dist/conditions/match-identity.js.map +1 -0
- package/dist/conditions/members.d.ts.map +1 -1
- package/dist/conditions/members.js +17 -4
- package/dist/conditions/members.js.map +1 -1
- package/dist/conditions/reverse-dependency.d.ts +18 -5
- package/dist/conditions/reverse-dependency.d.ts.map +1 -1
- package/dist/conditions/reverse-dependency.js +109 -92
- package/dist/conditions/reverse-dependency.js.map +1 -1
- package/dist/conditions/slice.d.ts +86 -2
- package/dist/conditions/slice.d.ts.map +1 -1
- package/dist/conditions/slice.js +234 -53
- package/dist/conditions/slice.js.map +1 -1
- package/dist/conditions/structural.d.ts.map +1 -1
- package/dist/conditions/structural.js +16 -4
- package/dist/conditions/structural.js.map +1 -1
- package/dist/core/check-all.d.ts +19 -0
- package/dist/core/check-all.d.ts.map +1 -0
- package/dist/core/check-all.js +96 -0
- package/dist/core/check-all.js.map +1 -0
- package/dist/core/combinators.d.ts +48 -0
- package/dist/core/combinators.d.ts.map +1 -0
- package/dist/core/combinators.js +56 -0
- package/dist/core/combinators.js.map +1 -0
- package/dist/core/descendant-cache.d.ts +36 -0
- package/dist/core/descendant-cache.d.ts.map +1 -0
- package/dist/core/descendant-cache.js +119 -0
- package/dist/core/descendant-cache.js.map +1 -0
- package/dist/core/diagnose.d.ts +234 -0
- package/dist/core/diagnose.d.ts.map +1 -0
- package/dist/core/diagnose.js +382 -0
- package/dist/core/diagnose.js.map +1 -0
- package/dist/core/disk-set.d.ts +48 -0
- package/dist/core/disk-set.d.ts.map +1 -0
- package/dist/core/disk-set.js +218 -0
- package/dist/core/disk-set.js.map +1 -0
- package/dist/core/element-cache.d.ts +75 -0
- package/dist/core/element-cache.d.ts.map +1 -0
- package/dist/core/element-cache.js +32 -0
- package/dist/core/element-cache.js.map +1 -0
- package/dist/core/empty-project-advice.d.ts +75 -0
- package/dist/core/empty-project-advice.d.ts.map +1 -0
- package/dist/core/empty-project-advice.js +61 -0
- package/dist/core/empty-project-advice.js.map +1 -0
- package/dist/core/exclusion-comments.d.ts +54 -0
- package/dist/core/exclusion-comments.d.ts.map +1 -0
- package/dist/core/exclusion-comments.js +310 -0
- package/dist/core/exclusion-comments.js.map +1 -0
- package/dist/core/execute-rule.d.ts +150 -0
- package/dist/core/execute-rule.d.ts.map +1 -0
- package/dist/core/execute-rule.js +580 -0
- package/dist/core/execute-rule.js.map +1 -0
- package/dist/core/glob-diagnosis.d.ts +78 -0
- package/dist/core/glob-diagnosis.d.ts.map +1 -0
- package/dist/core/glob-diagnosis.js +134 -0
- package/dist/core/glob-diagnosis.js.map +1 -0
- package/dist/core/glob-evaluator.d.ts +48 -0
- package/dist/core/glob-evaluator.d.ts.map +1 -0
- package/dist/core/glob-evaluator.js +89 -0
- package/dist/core/glob-evaluator.js.map +1 -0
- package/dist/core/import-candidates.d.ts +60 -0
- package/dist/core/import-candidates.d.ts.map +1 -0
- package/dist/core/import-candidates.js +93 -0
- package/dist/core/import-candidates.js.map +1 -0
- package/dist/core/import-options.d.ts +55 -2
- package/dist/core/import-options.d.ts.map +1 -1
- package/dist/core/import-options.js +64 -0
- package/dist/core/import-options.js.map +1 -1
- package/dist/core/line-index.d.ts +3 -0
- package/dist/core/line-index.d.ts.map +1 -0
- package/dist/core/line-index.js +229 -0
- package/dist/core/line-index.js.map +1 -0
- package/dist/core/metric-violation.d.ts +86 -0
- package/dist/core/metric-violation.d.ts.map +1 -0
- package/dist/core/metric-violation.js +132 -0
- package/dist/core/metric-violation.js.map +1 -0
- package/dist/core/module-edges.d.ts +361 -0
- package/dist/core/module-edges.d.ts.map +1 -0
- package/dist/core/module-edges.js +592 -0
- package/dist/core/module-edges.js.map +1 -0
- package/dist/core/object-literal-functions.d.ts +42 -0
- package/dist/core/object-literal-functions.d.ts.map +1 -0
- package/dist/core/object-literal-functions.js +75 -0
- package/dist/core/object-literal-functions.js.map +1 -0
- package/dist/core/orphan-exclusions.d.ts +44 -0
- package/dist/core/orphan-exclusions.d.ts.map +1 -0
- package/dist/core/orphan-exclusions.js +214 -0
- package/dist/core/orphan-exclusions.js.map +1 -0
- package/dist/core/pair-condition.d.ts +32 -3
- package/dist/core/pair-condition.d.ts.map +1 -1
- package/dist/core/path-universe.d.ts +54 -0
- package/dist/core/path-universe.d.ts.map +1 -0
- package/dist/core/path-universe.js +65 -0
- package/dist/core/path-universe.js.map +1 -0
- package/dist/core/per-root-compiler-options.d.ts +20 -0
- package/dist/core/per-root-compiler-options.d.ts.map +1 -0
- package/dist/core/per-root-compiler-options.js +57 -0
- package/dist/core/per-root-compiler-options.js.map +1 -0
- package/dist/core/project-relative.d.ts +98 -0
- package/dist/core/project-relative.d.ts.map +1 -0
- package/dist/core/project-relative.js +185 -0
- package/dist/core/project-relative.js.map +1 -0
- package/dist/core/project.d.ts +7 -1
- package/dist/core/project.d.ts.map +1 -1
- package/dist/core/project.js +24 -0
- package/dist/core/project.js.map +1 -1
- package/dist/core/rule-builder.d.ts +282 -0
- package/dist/core/rule-builder.d.ts.map +1 -0
- package/dist/core/rule-builder.js +445 -0
- package/dist/core/rule-builder.js.map +1 -0
- package/dist/core/rule-declaration.d.ts +32 -0
- package/dist/core/rule-declaration.d.ts.map +1 -0
- package/dist/core/rule-declaration.js +126 -0
- package/dist/core/rule-declaration.js.map +1 -0
- package/dist/core/terminal-builder.d.ts +625 -0
- package/dist/core/terminal-builder.d.ts.map +1 -0
- package/dist/core/terminal-builder.js +787 -0
- package/dist/core/terminal-builder.js.map +1 -0
- package/dist/core/terminal-execution.d.ts +23 -0
- package/dist/core/terminal-execution.d.ts.map +1 -0
- package/dist/core/terminal-execution.js +71 -0
- package/dist/core/terminal-execution.js.map +1 -0
- package/dist/core/vacuity-diagnosis.d.ts +103 -0
- package/dist/core/vacuity-diagnosis.d.ts.map +1 -0
- package/dist/core/vacuity-diagnosis.js +415 -0
- package/dist/core/vacuity-diagnosis.js.map +1 -0
- package/dist/core/violation.d.ts +16 -11
- package/dist/core/violation.d.ts.map +1 -1
- package/dist/core/violation.js +33 -13
- package/dist/core/violation.js.map +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/resolver-rule-builder.d.ts +98 -23
- package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
- package/dist/graphql/resolver-rule-builder.js +151 -21
- package/dist/graphql/resolver-rule-builder.js.map +1 -1
- package/dist/graphql/schema-loader.d.ts +21 -0
- package/dist/graphql/schema-loader.d.ts.map +1 -1
- package/dist/graphql/schema-loader.js +81 -12
- package/dist/graphql/schema-loader.js.map +1 -1
- package/dist/graphql/schema-rule-builder.d.ts +57 -20
- package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
- package/dist/graphql/schema-rule-builder.js +101 -25
- package/dist/graphql/schema-rule-builder.js.map +1 -1
- package/dist/helpers/baseline-diagnostics.d.ts +45 -0
- package/dist/helpers/baseline-diagnostics.d.ts.map +1 -0
- package/dist/helpers/baseline-diagnostics.js +168 -0
- package/dist/helpers/baseline-diagnostics.js.map +1 -0
- package/dist/helpers/baseline-generator.d.ts +19 -0
- package/dist/helpers/baseline-generator.d.ts.map +1 -0
- package/dist/helpers/baseline-generator.js +18 -0
- package/dist/helpers/baseline-generator.js.map +1 -0
- package/dist/helpers/baseline.d.ts +336 -0
- package/dist/helpers/baseline.d.ts.map +1 -0
- package/dist/helpers/baseline.js +664 -0
- package/dist/helpers/baseline.js.map +1 -0
- package/dist/helpers/body-traversal.d.ts +27 -2
- package/dist/helpers/body-traversal.d.ts.map +1 -1
- package/dist/helpers/body-traversal.js +122 -16
- package/dist/helpers/body-traversal.js.map +1 -1
- package/dist/helpers/callback-extractor.d.ts.map +1 -1
- package/dist/helpers/callback-extractor.js +48 -47
- package/dist/helpers/callback-extractor.js.map +1 -1
- package/dist/helpers/complexity.d.ts +13 -5
- package/dist/helpers/complexity.d.ts.map +1 -1
- package/dist/helpers/complexity.js +15 -6
- package/dist/helpers/complexity.js.map +1 -1
- package/dist/helpers/diff-aware.d.ts +44 -0
- package/dist/helpers/diff-aware.d.ts.map +1 -0
- package/dist/helpers/diff-aware.js +84 -0
- package/dist/helpers/diff-aware.js.map +1 -0
- package/dist/helpers/matchers.d.ts +68 -7
- package/dist/helpers/matchers.d.ts.map +1 -1
- package/dist/helpers/matchers.js +114 -20
- package/dist/helpers/matchers.js.map +1 -1
- package/dist/helpers/slice-graph.d.ts +100 -8
- package/dist/helpers/slice-graph.d.ts.map +1 -1
- package/dist/helpers/slice-graph.js +126 -34
- package/dist/helpers/slice-graph.js.map +1 -1
- package/dist/helpers/tarjan.d.ts +0 -14
- package/dist/helpers/tarjan.d.ts.map +1 -1
- package/dist/helpers/tarjan.js +29 -16
- package/dist/helpers/tarjan.js.map +1 -1
- package/dist/index.d.ts +56 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -13
- package/dist/index.js.map +1 -1
- package/dist/models/arch-call.d.ts +3 -2
- package/dist/models/arch-call.d.ts.map +1 -1
- package/dist/models/arch-call.js.map +1 -1
- package/dist/models/arch-function.d.ts +28 -6
- package/dist/models/arch-function.d.ts.map +1 -1
- package/dist/models/arch-function.js +106 -3
- package/dist/models/arch-function.js.map +1 -1
- package/dist/models/arch-jsx-element.js +2 -2
- package/dist/models/arch-jsx-element.js.map +1 -1
- package/dist/models/slice.d.ts +33 -9
- package/dist/models/slice.d.ts.map +1 -1
- package/dist/models/slice.js +129 -19
- package/dist/models/slice.js.map +1 -1
- package/dist/predicates/call.d.ts.map +1 -1
- package/dist/predicates/call.js +5 -0
- package/dist/predicates/call.js.map +1 -1
- package/dist/predicates/identity.d.ts +21 -0
- package/dist/predicates/identity.d.ts.map +1 -1
- package/dist/predicates/identity.js +75 -3
- package/dist/predicates/identity.js.map +1 -1
- package/dist/predicates/index.d.ts +1 -1
- package/dist/predicates/index.d.ts.map +1 -1
- package/dist/predicates/index.js +1 -1
- package/dist/predicates/index.js.map +1 -1
- package/dist/predicates/metrics.d.ts +4 -2
- package/dist/predicates/metrics.d.ts.map +1 -1
- package/dist/predicates/metrics.js +4 -2
- package/dist/predicates/metrics.js.map +1 -1
- package/dist/predicates/module.d.ts +4 -12
- package/dist/predicates/module.d.ts.map +1 -1
- package/dist/predicates/module.js +57 -37
- package/dist/predicates/module.js.map +1 -1
- package/dist/presets/agent-guardrails.d.ts +22 -15
- package/dist/presets/agent-guardrails.d.ts.map +1 -1
- package/dist/presets/agent-guardrails.js +124 -19
- package/dist/presets/agent-guardrails.js.map +1 -1
- package/dist/presets/boundaries.d.ts +45 -2
- package/dist/presets/boundaries.d.ts.map +1 -1
- package/dist/presets/boundaries.js +132 -23
- package/dist/presets/boundaries.js.map +1 -1
- package/dist/presets/data-layer.d.ts +22 -2
- package/dist/presets/data-layer.d.ts.map +1 -1
- package/dist/presets/data-layer.js +58 -16
- package/dist/presets/data-layer.js.map +1 -1
- package/dist/presets/index.d.ts +7 -5
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +9 -3
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/layered.d.ts +46 -2
- package/dist/presets/layered.d.ts.map +1 -1
- package/dist/presets/layered.js +66 -29
- package/dist/presets/layered.js.map +1 -1
- package/dist/presets/recommended.d.ts +80 -9
- package/dist/presets/recommended.d.ts.map +1 -1
- package/dist/presets/recommended.js +25 -23
- package/dist/presets/recommended.js.map +1 -1
- package/dist/presets/shared.d.ts +270 -2
- package/dist/presets/shared.d.ts.map +1 -1
- package/dist/presets/shared.js +338 -4
- package/dist/presets/shared.js.map +1 -1
- package/dist/rules/code-quality.d.ts.map +1 -1
- package/dist/rules/code-quality.js +15 -6
- package/dist/rules/code-quality.js.map +1 -1
- package/dist/rules/hygiene.d.ts +1 -1
- package/dist/rules/hygiene.js +1 -1
- package/dist/rules/metrics-function.d.ts +2 -1
- package/dist/rules/metrics-function.d.ts.map +1 -1
- package/dist/rules/metrics-function.js +33 -6
- package/dist/rules/metrics-function.js.map +1 -1
- package/dist/rules/metrics.d.ts +2 -1
- package/dist/rules/metrics.d.ts.map +1 -1
- package/dist/rules/metrics.js +39 -9
- package/dist/rules/metrics.js.map +1 -1
- package/dist/smells/duplicate-bodies.d.ts +58 -5
- package/dist/smells/duplicate-bodies.d.ts.map +1 -1
- package/dist/smells/duplicate-bodies.js +137 -56
- package/dist/smells/duplicate-bodies.js.map +1 -1
- package/dist/smells/fingerprint.d.ts +8 -1
- package/dist/smells/fingerprint.d.ts.map +1 -1
- package/dist/smells/fingerprint.js +21 -3
- package/dist/smells/fingerprint.js.map +1 -1
- package/dist/smells/inconsistent-siblings.d.ts +128 -7
- package/dist/smells/inconsistent-siblings.d.ts.map +1 -1
- package/dist/smells/inconsistent-siblings.js +288 -86
- package/dist/smells/inconsistent-siblings.js.map +1 -1
- package/dist/smells/sibling-files.d.ts +47 -0
- package/dist/smells/sibling-files.d.ts.map +1 -0
- package/dist/smells/sibling-files.js +104 -0
- package/dist/smells/sibling-files.js.map +1 -0
- package/dist/smells/similar-pairs.d.ts +27 -0
- package/dist/smells/similar-pairs.d.ts.map +1 -0
- package/dist/smells/similar-pairs.js +52 -0
- package/dist/smells/similar-pairs.js.map +1 -0
- package/dist/smells/smell-builder.d.ts +57 -12
- package/dist/smells/smell-builder.d.ts.map +1 -1
- package/dist/smells/smell-builder.js +111 -14
- package/dist/smells/smell-builder.js.map +1 -1
- package/dist/tsconfig/index.d.ts +19 -0
- package/dist/tsconfig/index.d.ts.map +1 -0
- package/dist/tsconfig/index.js +20 -0
- package/dist/tsconfig/index.js.map +1 -0
- package/dist/tsconfig/tsconfig-builder.d.ts +42 -9
- package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
- package/dist/tsconfig/tsconfig-builder.js +64 -16
- package/dist/tsconfig/tsconfig-builder.js.map +1 -1
- package/package.json +3 -2
- package/dist/core/module-dependencies.d.ts +0 -28
- package/dist/core/module-dependencies.d.ts.map +0 -1
- package/dist/core/module-dependencies.js +0 -35
- package/dist/core/module-dependencies.js.map +0 -1
- package/dist/helpers/within.d.ts.map +0 -1
- package/dist/helpers/within.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ArchFunction } from '../models/arch-function.js';
|
|
2
|
+
import type { Fingerprint } from './fingerprint.js';
|
|
3
|
+
/** A function paired with its structural fingerprint. */
|
|
4
|
+
interface FingerprintedFunction {
|
|
5
|
+
fn: ArchFunction;
|
|
6
|
+
fingerprint: Fingerprint;
|
|
7
|
+
}
|
|
8
|
+
/** Two bodies the detector considers similar enough to report, and by how much. */
|
|
9
|
+
export interface SimilarPair {
|
|
10
|
+
a: ArchFunction;
|
|
11
|
+
b: ArchFunction;
|
|
12
|
+
similarity: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The pairwise comparison behind `smells.duplicateBodies()`.
|
|
16
|
+
*
|
|
17
|
+
* Separated from the builder because it is the algorithm, not the DSL: the
|
|
18
|
+
* builder's job is to collect a fluent configuration and hand it here. The
|
|
19
|
+
* thresholds arrive as arguments rather than being read off a builder, so the
|
|
20
|
+
* comparison is callable and testable without one.
|
|
21
|
+
*/
|
|
22
|
+
/** Build fingerprints for all collected functions. */
|
|
23
|
+
export declare function fingerprintAll(functions: ArchFunction[]): FingerprintedFunction[];
|
|
24
|
+
/** Compare all pairs of fingerprints, collect those above threshold. */
|
|
25
|
+
export declare function findSimilarPairs(items: FingerprintedFunction[], minSimilarity: number, minDistinctVocabulary: number): SimilarPair[];
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=similar-pairs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"similar-pairs.d.ts","sourceRoot":"","sources":["../../src/smells/similar-pairs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,yDAAyD;AACzD,UAAU,qBAAqB;IAC7B,EAAE,EAAE,YAAY,CAAA;IAChB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,YAAY,CAAA;IACf,CAAC,EAAE,YAAY,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AAEH,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,qBAAqB,EAAE,CAQjF;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,qBAAqB,EAAE,EAC9B,aAAa,EAAE,MAAM,EACrB,qBAAqB,EAAE,MAAM,GAC5B,WAAW,EAAE,CAiCf"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { buildFingerprint, computeSimilarity } from './fingerprint.js';
|
|
2
|
+
/**
|
|
3
|
+
* The pairwise comparison behind `smells.duplicateBodies()`.
|
|
4
|
+
*
|
|
5
|
+
* Separated from the builder because it is the algorithm, not the DSL: the
|
|
6
|
+
* builder's job is to collect a fluent configuration and hand it here. The
|
|
7
|
+
* thresholds arrive as arguments rather than being read off a builder, so the
|
|
8
|
+
* comparison is callable and testable without one.
|
|
9
|
+
*/
|
|
10
|
+
/** Build fingerprints for all collected functions. */
|
|
11
|
+
export function fingerprintAll(functions) {
|
|
12
|
+
const result = [];
|
|
13
|
+
for (const fn of functions) {
|
|
14
|
+
const body = fn.getBody();
|
|
15
|
+
if (!body)
|
|
16
|
+
continue;
|
|
17
|
+
result.push({ fn, fingerprint: buildFingerprint(body) });
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
/** Compare all pairs of fingerprints, collect those above threshold. */
|
|
22
|
+
export function findSimilarPairs(items, minSimilarity, minDistinctVocabulary) {
|
|
23
|
+
const pairs = [];
|
|
24
|
+
for (let i = 0; i < items.length; i++) {
|
|
25
|
+
for (let j = i + 1; j < items.length; j++) {
|
|
26
|
+
const a = items[i];
|
|
27
|
+
const b = items[j];
|
|
28
|
+
if (!a || !b)
|
|
29
|
+
continue;
|
|
30
|
+
// Fast rejection 1: if node counts differ too much, similarity cannot reach threshold
|
|
31
|
+
const maxCount = Math.max(a.fingerprint.nodeCount, b.fingerprint.nodeCount);
|
|
32
|
+
const minCount = Math.min(a.fingerprint.nodeCount, b.fingerprint.nodeCount);
|
|
33
|
+
if (maxCount > 0 && minCount / maxCount < minSimilarity) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
// Fast rejection 2 (plan 0103): neither body has enough distinct vocabulary
|
|
37
|
+
// for a match to be evidence of anything. `Math.min`, not sum or average —
|
|
38
|
+
// ONE small-vocabulary side is enough to make the pair uninformative
|
|
39
|
+
// regardless of the other side's size.
|
|
40
|
+
const minDistinct = Math.min(a.fingerprint.distinctVocabulary, b.fingerprint.distinctVocabulary);
|
|
41
|
+
if (minDistinct < minDistinctVocabulary) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const similarity = computeSimilarity(a.fingerprint, b.fingerprint);
|
|
45
|
+
if (similarity >= minSimilarity) {
|
|
46
|
+
pairs.push({ a: a.fn, b: b.fn, similarity });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return pairs;
|
|
51
|
+
}
|
|
52
|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CAAC,SAAS,CAAC,CAAA;YAC3E,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;YAC3E,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,QAAQ,GAAG,aAAa,EAAE,CAAC;gBACxD,SAAQ;YACV,CAAC;YACD,4EAA4E;YAC5E,2EAA2E;YAC3E,qEAAqE;YACrE,uCAAuC;YACvC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAC1B,CAAC,CAAC,WAAW,CAAC,kBAAkB,EAChC,CAAC,CAAC,WAAW,CAAC,kBAAkB,CACjC,CAAA;YACD,IAAI,WAAW,GAAG,qBAAqB,EAAE,CAAC;gBACxC,SAAQ;YACV,CAAC;YACD,MAAM,UAAU,GAAG,iBAAiB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;YAClE,IAAI,UAAU,IAAI,aAAa,EAAE,CAAC;gBAChC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { ArchProject } from '../core/project.js';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Extends TerminalBuilder for shared terminal methods (check/warn/excluding/because/rule).
|
|
7
|
-
*
|
|
8
|
-
* SmellBuilder does NOT extend RuleBuilder — smell detectors have a
|
|
9
|
-
* different chain grammar (no .that()/.should()) and execution model
|
|
10
|
-
* (pairwise comparison rather than individual element evaluation).
|
|
11
|
-
*/
|
|
2
|
+
import type { CollectResult } from '../core/terminal-builder.js';
|
|
3
|
+
import type { ArchViolation } from '@nielspeter/eess';
|
|
4
|
+
import type { GlobNode } from '@nielspeter/eess';
|
|
5
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
12
6
|
export declare abstract class SmellBuilder extends TerminalBuilder {
|
|
13
7
|
protected readonly project: ArchProject;
|
|
14
8
|
protected _folders: string[];
|
|
@@ -16,8 +10,27 @@ export declare abstract class SmellBuilder extends TerminalBuilder {
|
|
|
16
10
|
protected _ignoreTests: boolean;
|
|
17
11
|
protected _ignorePaths: string[];
|
|
18
12
|
protected _groupByFolder: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* This family's own narrowing, named — plan 0099 / ADR-010 part 4.
|
|
15
|
+
*
|
|
16
|
+
* `_minLines` defaults to 5 and neither `agentGuardrails` nor `strictBoundaries`
|
|
17
|
+
* exposes a knob for it, so a user whose bodies are all shorter is told their
|
|
18
|
+
* rule enforces nothing by a filter they never wrote and cannot reach. Naming it
|
|
19
|
+
* is the difference between an actionable finding and one that sends an agent
|
|
20
|
+
* hunting for filters that do not exist.
|
|
21
|
+
*/
|
|
22
|
+
/** This family counts function bodies, not subjects — plan 0099. */
|
|
23
|
+
protected examinedUnitNoun(): string;
|
|
24
|
+
protected narrowingHint(): string | undefined;
|
|
19
25
|
constructor(project: ArchProject);
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Scope detection to files matching the glob pattern.
|
|
28
|
+
*
|
|
29
|
+
* Note the name: this matches the **whole file path**, not the directory
|
|
30
|
+
* portion (`passesFileFilters` applies the matcher to `sf.getFilePath()`).
|
|
31
|
+
* So its declared kind is `file-path`, which is why plan 0069 derives `kind`
|
|
32
|
+
* from the string a matcher is applied to rather than from the method name.
|
|
33
|
+
*/
|
|
21
34
|
inFolder(glob: string): this;
|
|
22
35
|
/** Ignore functions/files shorter than N lines. Default: 5. */
|
|
23
36
|
minLines(n: number): this;
|
|
@@ -25,12 +38,44 @@ export declare abstract class SmellBuilder extends TerminalBuilder {
|
|
|
25
38
|
ignoreTests(): this;
|
|
26
39
|
/** Exclude files matching the given glob patterns. */
|
|
27
40
|
ignorePaths(...globs: string[]): this;
|
|
41
|
+
/** The project this detector was built against. See `RuleBuilder.getProject`. */
|
|
42
|
+
getProject(): ArchProject;
|
|
43
|
+
/**
|
|
44
|
+
* The globs this detector was scoped with.
|
|
45
|
+
*
|
|
46
|
+
* `inFolder` is `discovery`: it defines the population to scan, so a glob
|
|
47
|
+
* matching nothing means the detector scans nothing. `ignorePaths` is
|
|
48
|
+
* `exclusion` and is never a fault — an exclusion matching zero files is
|
|
49
|
+
* remedy-optional (proposal 006).
|
|
50
|
+
*
|
|
51
|
+
* Repeated `inFolder()` calls OR together (`folderMatchers.some`), so they
|
|
52
|
+
* form one `any` node rather than one node each.
|
|
53
|
+
*/
|
|
54
|
+
globs(): readonly GlobNode[];
|
|
28
55
|
/** Group violation output by directory. */
|
|
29
56
|
groupByFolder(): this;
|
|
57
|
+
/**
|
|
58
|
+
* An independent copy, carrying both scope lists.
|
|
59
|
+
*
|
|
60
|
+
* Without this, `ignorePaths()` on a copy would push into the array the
|
|
61
|
+
* original still points at — and a leaked *ignore* is a false green: the
|
|
62
|
+
* next detector off the same held builder would silently skip those files.
|
|
63
|
+
*/
|
|
64
|
+
protected copy(): this;
|
|
30
65
|
/** Delegate to detect() for the terminal builder pipeline. */
|
|
31
|
-
protected collectViolations():
|
|
66
|
+
protected collectViolations(): CollectResult;
|
|
32
67
|
/** Subclasses implement: run detection, return violations. */
|
|
33
68
|
protected abstract detect(): ArchViolation[];
|
|
69
|
+
/**
|
|
70
|
+
* Subclasses implement: units this detector examined — plan 0098.
|
|
71
|
+
*
|
|
72
|
+
* Declared here rather than left to the subclasses because
|
|
73
|
+
* `collectViolations()` is the seam and it cannot see a hook the subclass
|
|
74
|
+
* merely happens to have. Plan 0096 added `examinedUnits()` to both detectors
|
|
75
|
+
* and this class could not reach either; a new detector would have compiled
|
|
76
|
+
* with no evidence at all.
|
|
77
|
+
*/
|
|
78
|
+
abstract examinedUnits(): number;
|
|
34
79
|
/** Subclasses implement: human-readable rule description. */
|
|
35
80
|
protected abstract describe(): string;
|
|
36
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smell-builder.d.ts","sourceRoot":"","sources":["../../src/smells/smell-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"smell-builder.d.ts","sourceRoot":"","sources":["../../src/smells/smell-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAc7D,8BAAsB,YAAa,SAAQ,eAAe;IAiD5C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW;IAhDnD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAK;IACjC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAoB;IAC/C,SAAS,CAAC,YAAY,UAAQ;IAC9B,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,CAAK;IACrC,SAAS,CAAC,cAAc,UAAQ;IAEhC;;;;;;;;OAQG;IACH,oEAAoE;cACjD,gBAAgB,IAAI,MAAM;cAI1B,aAAa,IAAI,MAAM,GAAG,SAAS;gBA4BvB,OAAO,EAAE,WAAW;IAInD;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM5B,+DAA+D;IAC/D,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAMzB,+DAA+D;IAC/D,WAAW,IAAI,IAAI;IAMnB,sDAAsD;IACtD,WAAW,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAMrC,iFAAiF;IACjF,UAAU,IAAI,WAAW;IAIzB;;;;;;;;;;OAUG;IACM,KAAK,IAAI,SAAS,QAAQ,EAAE;IAuBrC,2CAA2C;IAC3C,aAAa,IAAI,IAAI;IAMrB;;;;;;OAMG;cACgB,IAAI,IAAI,IAAI;IAO/B,8DAA8D;IAC9D,SAAS,CAAC,iBAAiB,IAAI,aAAa;IAI5C,8DAA8D;IAC9D,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,aAAa,EAAE;IAE5C;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,IAAI,MAAM;IAEhC,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM;CACtC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { globAnyOf, stampGlobs } from '@nielspeter/eess';
|
|
2
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
3
|
+
import { isProjectRelative } from '../core/project-relative.js';
|
|
2
4
|
/**
|
|
3
5
|
* Base class for smell detector builders.
|
|
4
6
|
* Extends TerminalBuilder for shared terminal methods (check/warn/excluding/because/rule).
|
|
@@ -7,45 +9,140 @@ import { TerminalBuilder } from '@nielspeter/eess';
|
|
|
7
9
|
* different chain grammar (no .that()/.should()) and execution model
|
|
8
10
|
* (pairwise comparison rather than individual element evaluation).
|
|
9
11
|
*/
|
|
12
|
+
/** The `minLines` threshold applied when the author sets none. */
|
|
13
|
+
const DEFAULT_MIN_LINES = 5;
|
|
10
14
|
export class SmellBuilder extends TerminalBuilder {
|
|
11
15
|
project;
|
|
12
16
|
_folders = [];
|
|
13
|
-
_minLines =
|
|
17
|
+
_minLines = DEFAULT_MIN_LINES;
|
|
14
18
|
_ignoreTests = false;
|
|
15
19
|
_ignorePaths = [];
|
|
16
20
|
_groupByFolder = false;
|
|
21
|
+
/**
|
|
22
|
+
* This family's own narrowing, named — plan 0099 / ADR-010 part 4.
|
|
23
|
+
*
|
|
24
|
+
* `_minLines` defaults to 5 and neither `agentGuardrails` nor `strictBoundaries`
|
|
25
|
+
* exposes a knob for it, so a user whose bodies are all shorter is told their
|
|
26
|
+
* rule enforces nothing by a filter they never wrote and cannot reach. Naming it
|
|
27
|
+
* is the difference between an actionable finding and one that sends an agent
|
|
28
|
+
* hunting for filters that do not exist.
|
|
29
|
+
*/
|
|
30
|
+
/** This family counts function bodies, not subjects — plan 0099. */
|
|
31
|
+
examinedUnitNoun() {
|
|
32
|
+
return 'function bodies';
|
|
33
|
+
}
|
|
34
|
+
narrowingHint() {
|
|
35
|
+
const applied = [`minLines(${String(this._minLines)})`];
|
|
36
|
+
if (this._folders.length > 0)
|
|
37
|
+
applied.push(`inFolder(${this._folders.join(', ')})`);
|
|
38
|
+
if (this._ignorePaths.length > 0)
|
|
39
|
+
applied.push(`ignorePaths(${this._ignorePaths.join(', ')})`);
|
|
40
|
+
if (this._ignoreTests)
|
|
41
|
+
applied.push('ignoreTests()');
|
|
42
|
+
// The "you did not write it" clause is TRUE only while the value is still the
|
|
43
|
+
// default. Rendered with an author-written `.minLines(500)` it said
|
|
44
|
+
// "minLines(500) — minLines defaults to 5, a default you did not write",
|
|
45
|
+
// which is false on the path that produced it: an agent goes hunting for
|
|
46
|
+
// where 5 comes from and never touches the 500 that is the actual fault.
|
|
47
|
+
// ADR-009 rule 2, on an unsuppressable hard failure.
|
|
48
|
+
// States the filters as FACT, and does not claim they caused the emptiness.
|
|
49
|
+
//
|
|
50
|
+
// "Its own narrowing removed them" asserts removal. Measured on a types-only
|
|
51
|
+
// corpus with the default threshold: there were zero function bodies, so
|
|
52
|
+
// `minLines` removed nothing — the sentence named a false cause and pointed at
|
|
53
|
+
// a knob that `agentGuardrails` and `strictBoundaries` expose no setter for,
|
|
54
|
+
// on an unsuppressable hard failure. `narrowingHint()`'s own docstring
|
|
55
|
+
// promises the caller "names the possibility rather than asserting a cause it
|
|
56
|
+
// cannot verify"; this is the family honouring that rather than the base
|
|
57
|
+
// softening it afterwards.
|
|
58
|
+
const wroteItThemselves = this._minLines !== DEFAULT_MIN_LINES;
|
|
59
|
+
return wroteItThemselves
|
|
60
|
+
? `Its narrowing was: ${applied.join(', ')}.`
|
|
61
|
+
: `Its narrowing was: ${applied.join(', ')}` +
|
|
62
|
+
` — minLines defaults to ${String(DEFAULT_MIN_LINES)}, a default you did not write.`;
|
|
63
|
+
}
|
|
17
64
|
constructor(project) {
|
|
18
65
|
super();
|
|
19
66
|
this.project = project;
|
|
20
67
|
}
|
|
21
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Scope detection to files matching the glob pattern.
|
|
70
|
+
*
|
|
71
|
+
* Note the name: this matches the **whole file path**, not the directory
|
|
72
|
+
* portion (`passesFileFilters` applies the matcher to `sf.getFilePath()`).
|
|
73
|
+
* So its declared kind is `file-path`, which is why plan 0069 derives `kind`
|
|
74
|
+
* from the string a matcher is applied to rather than from the method name.
|
|
75
|
+
*/
|
|
22
76
|
inFolder(glob) {
|
|
23
|
-
this.
|
|
24
|
-
|
|
77
|
+
const next = this.copy();
|
|
78
|
+
next._folders.push(glob);
|
|
79
|
+
return next;
|
|
25
80
|
}
|
|
26
81
|
/** Ignore functions/files shorter than N lines. Default: 5. */
|
|
27
82
|
minLines(n) {
|
|
28
|
-
|
|
29
|
-
|
|
83
|
+
const next = this.copy();
|
|
84
|
+
next._minLines = n;
|
|
85
|
+
return next;
|
|
30
86
|
}
|
|
31
87
|
/** Exclude test files (*.test.ts, *.spec.ts, __tests__/**). */
|
|
32
88
|
ignoreTests() {
|
|
33
|
-
|
|
34
|
-
|
|
89
|
+
const next = this.copy();
|
|
90
|
+
next._ignoreTests = true;
|
|
91
|
+
return next;
|
|
35
92
|
}
|
|
36
93
|
/** Exclude files matching the given glob patterns. */
|
|
37
94
|
ignorePaths(...globs) {
|
|
38
|
-
this.
|
|
39
|
-
|
|
95
|
+
const next = this.copy();
|
|
96
|
+
next._ignorePaths.push(...globs);
|
|
97
|
+
return next;
|
|
98
|
+
}
|
|
99
|
+
/** The project this detector was built against. See `RuleBuilder.getProject`. */
|
|
100
|
+
getProject() {
|
|
101
|
+
return this.project;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The globs this detector was scoped with.
|
|
105
|
+
*
|
|
106
|
+
* `inFolder` is `discovery`: it defines the population to scan, so a glob
|
|
107
|
+
* matching nothing means the detector scans nothing. `ignorePaths` is
|
|
108
|
+
* `exclusion` and is never a fault — an exclusion matching zero files is
|
|
109
|
+
* remedy-optional (proposal 006).
|
|
110
|
+
*
|
|
111
|
+
* Repeated `inFolder()` calls OR together (`folderMatchers.some`), so they
|
|
112
|
+
* form one `any` node rather than one node each.
|
|
113
|
+
*/
|
|
114
|
+
globs() {
|
|
115
|
+
const trees = [];
|
|
116
|
+
if (this._folders.length > 0) {
|
|
117
|
+
trees.push(stampGlobs(globAnyOf(this._folders, 'file-path', this._folders.every((g) => isProjectRelative(g)) ? 'normalized' : 'absolute'), 'discovery', (g) => `inFolder("${g.glob}")`));
|
|
118
|
+
}
|
|
119
|
+
for (const glob of this._ignorePaths) {
|
|
120
|
+
trees.push(stampGlobs(globAnyOf([glob], 'file-path'), 'exclusion', (g) => `ignorePaths("${g.glob}")`));
|
|
121
|
+
}
|
|
122
|
+
return trees;
|
|
40
123
|
}
|
|
41
124
|
/** Group violation output by directory. */
|
|
42
125
|
groupByFolder() {
|
|
43
|
-
|
|
44
|
-
|
|
126
|
+
const next = this.copy();
|
|
127
|
+
next._groupByFolder = true;
|
|
128
|
+
return next;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* An independent copy, carrying both scope lists.
|
|
132
|
+
*
|
|
133
|
+
* Without this, `ignorePaths()` on a copy would push into the array the
|
|
134
|
+
* original still points at — and a leaked *ignore* is a false green: the
|
|
135
|
+
* next detector off the same held builder would silently skip those files.
|
|
136
|
+
*/
|
|
137
|
+
copy() {
|
|
138
|
+
const clone = super.copy();
|
|
139
|
+
clone._folders = [...this._folders];
|
|
140
|
+
clone._ignorePaths = [...this._ignorePaths];
|
|
141
|
+
return clone;
|
|
45
142
|
}
|
|
46
143
|
/** Delegate to detect() for the terminal builder pipeline. */
|
|
47
144
|
collectViolations() {
|
|
48
|
-
return this.detect();
|
|
145
|
+
return { violations: this.detect(), examined: this.examinedUnits() };
|
|
49
146
|
}
|
|
50
147
|
}
|
|
51
148
|
//# sourceMappingURL=smell-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smell-builder.js","sourceRoot":"","sources":["../../src/smells/smell-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"smell-builder.js","sourceRoot":"","sources":["../../src/smells/smell-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAE/D;;;;;;;GAOG;AACH,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,MAAM,OAAgB,YAAa,SAAQ,eAAe;IAiDzB;IAhDrB,QAAQ,GAAa,EAAE,CAAA;IACvB,SAAS,GAAW,iBAAiB,CAAA;IACrC,YAAY,GAAG,KAAK,CAAA;IACpB,YAAY,GAAa,EAAE,CAAA;IAC3B,cAAc,GAAG,KAAK,CAAA;IAEhC;;;;;;;;OAQG;IACH,oEAAoE;IACjD,gBAAgB;QACjC,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAEkB,aAAa;QAC9B,MAAM,OAAO,GAAG,CAAC,YAAY,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QACvD,IAAI,IAAI,CAAC,QAAQ,CAAC,M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,IAAI,IAAI,CAAC,CAC3F,CAAA;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,2CAA2C;IAC3C,aAAa;QACX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;OAMG;IACgB,IAAI;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;QAC1B,KAAK,CAAC,QAAQ,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnC,KAAK,CAAC,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAA;QAC3C,OAAO,KAAK,CAAA;IACd,CAAC;IAED,8DAA8D;IACpD,iBAAiB;QACzB,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,CAAA;IACtE,CAAC;CAkBF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ArchProject } from '../core/project.js';
|
|
2
|
+
import { TsconfigBuilder } from './tsconfig-builder.js';
|
|
3
|
+
/**
|
|
4
|
+
* Assert facts about a project's resolved TypeScript compiler options.
|
|
5
|
+
*
|
|
6
|
+
* Returns a builder with the same `.because()` / `.rule()` / `.excluding()` /
|
|
7
|
+
* `.check()` / `.warn()` / `.asSeverity()` / `.violations()` surface as every
|
|
8
|
+
* other rule. A flat top-level entry point like `project` — deliberately NOT a
|
|
9
|
+
* `config` namespace, which would collide with the tool's own
|
|
10
|
+
* `defineConfig` / `CliConfig` ("configure the tool") surface.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* tsconfig(p)
|
|
14
|
+
* .requires({ strict: true, noUncheckedIndexedAccess: true })
|
|
15
|
+
* .because('ADR-001 requires strict mode')
|
|
16
|
+
* .check()
|
|
17
|
+
*/
|
|
18
|
+
export declare function tsconfig(project: ArchProject): TsconfigBuilder;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tsconfig/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAE9D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TsconfigBuilder } from './tsconfig-builder.js';
|
|
2
|
+
/**
|
|
3
|
+
* Assert facts about a project's resolved TypeScript compiler options.
|
|
4
|
+
*
|
|
5
|
+
* Returns a builder with the same `.because()` / `.rule()` / `.excluding()` /
|
|
6
|
+
* `.check()` / `.warn()` / `.asSeverity()` / `.violations()` surface as every
|
|
7
|
+
* other rule. A flat top-level entry point like `project` — deliberately NOT a
|
|
8
|
+
* `config` namespace, which would collide with the tool's own
|
|
9
|
+
* `defineConfig` / `CliConfig` ("configure the tool") surface.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* tsconfig(p)
|
|
13
|
+
* .requires({ strict: true, noUncheckedIndexedAccess: true })
|
|
14
|
+
* .because('ADR-001 requires strict mode')
|
|
15
|
+
* .check()
|
|
16
|
+
*/
|
|
17
|
+
export function tsconfig(project) {
|
|
18
|
+
return new TsconfigBuilder(project);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tsconfig/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAoB;IAC3C,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { RuleDescription } from '@nielspeter/eess';
|
|
2
|
+
import type { CollectResult } from '../core/terminal-builder.js';
|
|
1
3
|
import type { CompilerOptions } from 'ts-morph';
|
|
2
|
-
import { TerminalBuilder } from '@nielspeter/eess';
|
|
3
4
|
import type { ArchProject } from '../core/project.js';
|
|
4
|
-
import
|
|
5
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
5
6
|
/**
|
|
6
7
|
* Asserts that a project's resolved TypeScript compiler options match a
|
|
7
8
|
* user-supplied spec. A non-iterating rule (one project → one options object),
|
|
@@ -19,14 +20,46 @@ export declare class TsconfigBuilder extends TerminalBuilder {
|
|
|
19
20
|
* Each present key must equal the project's resolved value (strict-family
|
|
20
21
|
* flags are resolved through `strict: true` the way tsc resolves them).
|
|
21
22
|
* Multiple `.requires()` calls merge additively; later keys win on conflict.
|
|
23
|
+
*
|
|
24
|
+
* Copy-on-write (bug 0016): a held `tsconfig(p)` is not edited by this call.
|
|
25
|
+
* No `copy()` override is needed because the merge builds a fresh object
|
|
26
|
+
* rather than mutating the inherited reference.
|
|
22
27
|
*/
|
|
23
28
|
requires(spec: Partial<CompilerOptions>): this;
|
|
24
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
31
|
+
*
|
|
32
|
+
* True once a requirement has been declared; `tsconfig()` with none asserts nothing.
|
|
33
|
+
*
|
|
34
|
+
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
35
|
+
* contract and the reason this is public rather than protected.
|
|
36
|
+
*/
|
|
37
|
+
assertsSomething(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The remedy for this builder's assertion-less state, as one string.
|
|
40
|
+
*
|
|
41
|
+
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
42
|
+
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
43
|
+
* what this builder is missing.
|
|
44
|
+
*/
|
|
45
|
+
assertionAdvice(): string;
|
|
46
|
+
/** Named by id or the fixed rule description, not 'unnamed' (plan 0070 §4). */
|
|
47
|
+
describeRule(): RuleDescription;
|
|
48
|
+
/**
|
|
49
|
+
* Requirements this rule declared — plan 0098.
|
|
50
|
+
*
|
|
51
|
+
* This family examines a CONFIG, not a corpus, so its unit is not a subject
|
|
52
|
+
* count. Zero means `.require({})`: a tsconfig rule that asserts nothing,
|
|
53
|
+
* which is this family's shape of the vacuity every other family expresses as
|
|
54
|
+
* an empty selection.
|
|
55
|
+
*/
|
|
56
|
+
examinedUnits(): number;
|
|
57
|
+
protected collectViolations(): CollectResult;
|
|
58
|
+
/**
|
|
59
|
+
* Prefer the public `getCompilerOptions()` (implemented by `project()` /
|
|
60
|
+
* `workspace()`); fall back to the internal ts-morph project so a bare
|
|
61
|
+
* `ArchProject` literal (e.g. a test double) still works.
|
|
62
|
+
*/
|
|
63
|
+
private getOptions;
|
|
25
64
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Entry point for a tsconfig config-assertion rule. Mirrors `project()` /
|
|
28
|
-
* `smells` — a flat top-level entry returning a builder that composes with
|
|
29
|
-
* `.because()` / `.excluding()` / `.check()` / `.warn()`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function tsconfig(p: ArchProject): TsconfigBuilder;
|
|
32
65
|
//# sourceMappingURL=tsconfig-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-builder.d.ts","sourceRoot":"","sources":["../../src/tsconfig/tsconfig-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsconfig-builder.d.ts","sourceRoot":"","sources":["../../src/tsconfig/tsconfig-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAK7D;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,eAAe;IAGtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,aAAa,CAA+B;gBAEvB,OAAO,EAAE,WAAW;IAIjD;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAM9C;;;;;;;OAOG;IACM,gBAAgB,IAAI,OAAO;IAIpC;;;;;;OAMG;IACM,eAAe,IAAI,MAAM;IAOlC,+EAA+E;IACtE,YAAY,IAAI,eAAe;IAOxC;;;;;;;OAOG;IACH,aAAa,IAAI,MAAM;IAIvB,SAAS,CAAC,iBAAiB,IAAI,aAAa;IA+B5C;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { isRecord } from '@nielspeter/eess';
|
|
1
2
|
import { ScriptTarget, ModuleKind, ModuleResolutionKind } from 'ts-morph';
|
|
2
|
-
import { TerminalBuilder } from '
|
|
3
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
3
4
|
import { isStrictFamily, resolveFlag } from './strict-family.js';
|
|
4
5
|
const RULE_DESCRIPTION = 'tsconfig compiler options must satisfy requirements';
|
|
5
6
|
/**
|
|
@@ -22,13 +23,58 @@ export class TsconfigBuilder extends TerminalBuilder {
|
|
|
22
23
|
* Each present key must equal the project's resolved value (strict-family
|
|
23
24
|
* flags are resolved through `strict: true` the way tsc resolves them).
|
|
24
25
|
* Multiple `.requires()` calls merge additively; later keys win on conflict.
|
|
26
|
+
*
|
|
27
|
+
* Copy-on-write (bug 0016): a held `tsconfig(p)` is not edited by this call.
|
|
28
|
+
* No `copy()` override is needed because the merge builds a fresh object
|
|
29
|
+
* rather than mutating the inherited reference.
|
|
25
30
|
*/
|
|
26
31
|
requires(spec) {
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
const next = this.copy();
|
|
33
|
+
next._requirements = { ...this._requirements, ...spec };
|
|
34
|
+
return next;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
38
|
+
*
|
|
39
|
+
* True once a requirement has been declared; `tsconfig()` with none asserts nothing.
|
|
40
|
+
*
|
|
41
|
+
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
42
|
+
* contract and the reason this is public rather than protected.
|
|
43
|
+
*/
|
|
44
|
+
assertsSomething() {
|
|
45
|
+
return Object.keys(this._requirements).length > 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The remedy for this builder's assertion-less state, as one string.
|
|
49
|
+
*
|
|
50
|
+
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
51
|
+
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
52
|
+
* what this builder is missing.
|
|
53
|
+
*/
|
|
54
|
+
assertionAdvice() {
|
|
55
|
+
return ('this rule has no requirements, so it asserts nothing and can never fail. Add ' +
|
|
56
|
+
'.requires({...}) with at least one compiler option, or delete the rule.');
|
|
57
|
+
}
|
|
58
|
+
/** Named by id or the fixed rule description, not 'unnamed' (plan 0070 §4). */
|
|
59
|
+
describeRule() {
|
|
60
|
+
return {
|
|
61
|
+
...super.describeRule(),
|
|
62
|
+
rule: this._metadata?.id ?? RULE_DESCRIPTION,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Requirements this rule declared — plan 0098.
|
|
67
|
+
*
|
|
68
|
+
* This family examines a CONFIG, not a corpus, so its unit is not a subject
|
|
69
|
+
* count. Zero means `.require({})`: a tsconfig rule that asserts nothing,
|
|
70
|
+
* which is this family's shape of the vacuity every other family expresses as
|
|
71
|
+
* an empty selection.
|
|
72
|
+
*/
|
|
73
|
+
examinedUnits() {
|
|
74
|
+
return Object.keys(this._requirements).length;
|
|
29
75
|
}
|
|
30
76
|
collectViolations() {
|
|
31
|
-
const opts = this.
|
|
77
|
+
const opts = this.getOptions();
|
|
32
78
|
const file = this.project.tsConfigPath;
|
|
33
79
|
const violations = [];
|
|
34
80
|
for (const key of Object.keys(this._requirements)) {
|
|
@@ -48,16 +94,21 @@ export class TsconfigBuilder extends TerminalBuilder {
|
|
|
48
94
|
suggestion: fixSuggestion(key, expected, strictFamily, opts),
|
|
49
95
|
});
|
|
50
96
|
}
|
|
51
|
-
|
|
97
|
+
// Plan 0098. This family examines a CONFIG, not a corpus, so its unit is the
|
|
98
|
+
// requirements the author declared — the loop above is over exactly these.
|
|
99
|
+
// Zero means `.require({})`: a tsconfig rule that asserts nothing, which is
|
|
100
|
+
// this family's shape of the vacuity every other family expresses as an
|
|
101
|
+
// empty selection.
|
|
102
|
+
return { violations, examined: this.examinedUnits() };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Prefer the public `getCompilerOptions()` (implemented by `project()` /
|
|
106
|
+
* `workspace()`); fall back to the internal ts-morph project so a bare
|
|
107
|
+
* `ArchProject` literal (e.g. a test double) still works.
|
|
108
|
+
*/
|
|
109
|
+
getOptions() {
|
|
110
|
+
return this.project.getCompilerOptions?.() ?? this.project._project.getCompilerOptions();
|
|
52
111
|
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Entry point for a tsconfig config-assertion rule. Mirrors `project()` /
|
|
56
|
-
* `smells` — a flat top-level entry returning a builder that composes with
|
|
57
|
-
* `.because()` / `.excluding()` / `.check()` / `.warn()`.
|
|
58
|
-
*/
|
|
59
|
-
export function tsconfig(p) {
|
|
60
|
-
return new TsconfigBuilder(p);
|
|
61
112
|
}
|
|
62
113
|
/**
|
|
63
114
|
* Human-readable fix hint for a mismatched flag. Enum-backed values are rendered
|
|
@@ -143,7 +194,4 @@ function deepEqual(a, b) {
|
|
|
143
194
|
}
|
|
144
195
|
return false;
|
|
145
196
|
}
|
|
146
|
-
function isRecord(value) {
|
|
147
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
148
|
-
}
|
|
149
197
|
//# sourceMappingURL=tsconfig-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-builder.js","sourceRoot":"","sources":["../../src/tsconfig/tsconfig-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsconfig-builder.js","sourceRoot":"","sources":["../../src/tsconfig/tsconfig-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhE,MAAM,gBAAgB,GAAG,qDAAqD,CAAA;AAE9E;;;;;;;GAOG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAGrB;IAFrB,aAAa,GAA6B,EAAE,CAAA;IAEpD,YAA6B,OAAoB;QAC/C,KAAK,EAAE,CAAA;QADoB,YAAO,GAAP,OAAO,CAAa;IAEjD,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAA8B;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,EAAE,CAAA;QACvD,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;;OAOG;IACM,gBAAgB;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAA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