@nielspeter/eess-ts 0.2.1 → 0.5.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 +75 -32
- 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 +141 -55
- 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 +385 -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 +182 -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 +177 -39
- 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 +16 -19
- 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 +243 -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 +109 -42
- 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 +8 -3
- package/dist/cli/commands/baseline.d.ts.map +1 -1
- package/dist/cli/commands/baseline.js +111 -7
- 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 +385 -47
- 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 +47 -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 +101 -43
- 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 +25 -32
- package/dist/cli/load-rules.js.map +1 -1
- package/dist/cli/resolve-config.d.ts +0 -8
- package/dist/cli/resolve-config.d.ts.map +1 -1
- package/dist/cli/resolve-config.js +25 -55
- 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 +351 -0
- package/dist/cli/rule-file-findings.js.map +1 -0
- package/dist/cli/watch.d.ts +17 -34
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +14 -129
- 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 +41 -19
- 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 +41 -37
- 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 +20 -6
- 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 +155 -93
- 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 +150 -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 +49 -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 +117 -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 +390 -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 +19 -0
- package/dist/core/exclusion-comments.d.ts.map +1 -0
- package/dist/core/exclusion-comments.js +7 -0
- package/dist/core/exclusion-comments.js.map +1 -0
- package/dist/core/execute-rule.d.ts +158 -0
- package/dist/core/execute-rule.d.ts.map +1 -0
- package/dist/core/execute-rule.js +666 -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/invalidate-on-modify.d.ts +20 -0
- package/dist/core/invalidate-on-modify.d.ts.map +1 -0
- package/dist/core/invalidate-on-modify.js +26 -0
- package/dist/core/invalidate-on-modify.js.map +1 -0
- 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 +227 -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 +593 -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 +224 -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 +22 -0
- package/dist/core/path-universe.d.ts.map +1 -0
- package/dist/core/path-universe.js +45 -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 +29 -4
- package/dist/core/project.js.map +1 -1
- package/dist/core/rule-builder.d.ts +303 -0
- package/dist/core/rule-builder.d.ts.map +1 -0
- package/dist/core/rule-builder.js +463 -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 +88 -0
- package/dist/core/rule-declaration.js.map +1 -0
- package/dist/core/terminal-builder.d.ts +629 -0
- package/dist/core/terminal-builder.d.ts.map +1 -0
- package/dist/core/terminal-builder.js +807 -0
- package/dist/core/terminal-builder.js.map +1 -0
- package/dist/core/terminal-execution.d.ts +39 -0
- package/dist/core/terminal-execution.d.ts.map +1 -0
- package/dist/core/terminal-execution.js +103 -0
- package/dist/core/terminal-execution.js.map +1 -0
- package/dist/core/ts-comment-mask.d.ts +2 -0
- package/dist/core/ts-comment-mask.d.ts.map +1 -0
- package/dist/core/ts-comment-mask.js +102 -0
- package/dist/core/ts-comment-mask.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/graphql-rule-builder.d.ts +95 -0
- package/dist/graphql/graphql-rule-builder.d.ts.map +1 -0
- package/dist/graphql/graphql-rule-builder.js +127 -0
- package/dist/graphql/graphql-rule-builder.js.map +1 -0
- package/dist/graphql/index.d.ts +1 -0
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +2 -1
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/resolver-rule-builder.d.ts +44 -23
- package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
- package/dist/graphql/resolver-rule-builder.js +80 -72
- 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 +82 -12
- package/dist/graphql/schema-loader.js.map +1 -1
- package/dist/graphql/schema-predicates.d.ts.map +1 -1
- package/dist/graphql/schema-predicates.js +17 -12
- package/dist/graphql/schema-predicates.js.map +1 -1
- package/dist/graphql/schema-rule-builder.d.ts +15 -24
- package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
- package/dist/graphql/schema-rule-builder.js +39 -77
- 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 +28 -0
- package/dist/helpers/baseline-generator.d.ts.map +1 -0
- package/dist/helpers/baseline-generator.js +27 -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 +135 -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 +53 -84
- 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 +16 -0
- package/dist/helpers/diff-aware.d.ts.map +1 -0
- package/dist/helpers/diff-aware.js +16 -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 +164 -86
- 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 +55 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -15
- 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 +54 -8
- package/dist/models/arch-function.d.ts.map +1 -1
- package/dist/models/arch-function.js +145 -8
- package/dist/models/arch-function.js.map +1 -1
- package/dist/models/arch-jsx-element.d.ts.map +1 -1
- package/dist/models/arch-jsx-element.js +18 -19
- 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/jsx.d.ts.map +1 -1
- package/dist/predicates/jsx.js +2 -1
- package/dist/predicates/jsx.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 +49 -16
- package/dist/presets/agent-guardrails.d.ts.map +1 -1
- package/dist/presets/agent-guardrails.js +308 -19
- package/dist/presets/agent-guardrails.js.map +1 -1
- package/dist/presets/boundaries.d.ts +46 -3
- 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 +23 -3
- 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 +10 -5
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +19 -3
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/layered.d.ts +47 -3
- 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 +81 -10
- 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 +267 -2
- package/dist/presets/shared.d.ts.map +1 -1
- package/dist/presets/shared.js +367 -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 +63 -39
- 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 +80 -47
- package/dist/rules/metrics.js.map +1 -1
- package/dist/smells/clusters.d.ts +78 -0
- package/dist/smells/clusters.d.ts.map +1 -0
- package/dist/smells/clusters.js +124 -0
- package/dist/smells/clusters.js.map +1 -0
- package/dist/smells/duplicate-bodies.d.ts +92 -5
- package/dist/smells/duplicate-bodies.d.ts.map +1 -1
- package/dist/smells/duplicate-bodies.js +203 -73
- package/dist/smells/duplicate-bodies.js.map +1 -1
- package/dist/smells/duplicate-report.d.ts +90 -0
- package/dist/smells/duplicate-report.d.ts.map +1 -0
- package/dist/smells/duplicate-report.js +344 -0
- package/dist/smells/duplicate-report.js.map +1 -0
- package/dist/smells/fingerprint.d.ts +20 -1
- package/dist/smells/fingerprint.d.ts.map +1 -1
- package/dist/smells/fingerprint.js +27 -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 +28 -0
- package/dist/smells/similar-pairs.d.ts.map +1 -0
- package/dist/smells/similar-pairs.js +134 -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 +112 -14
- package/dist/smells/smell-builder.js.map +1 -1
- package/dist/smells/variation.d.ts +47 -0
- package/dist/smells/variation.d.ts.map +1 -0
- package/dist/smells/variation.js +90 -0
- package/dist/smells/variation.js.map +1 -0
- 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 +65 -16
- package/dist/tsconfig/tsconfig-builder.js.map +1 -1
- package/package.json +4 -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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { SourceFile } from 'ts-morph';
|
|
2
2
|
import type { Slice } from '../models/slice.js';
|
|
3
|
+
import type { ImportOptions } from '../core/import-options.js';
|
|
4
|
+
import type { ModuleEdge } from '../core/module-edges.js';
|
|
3
5
|
/**
|
|
4
6
|
* An edge in the slice dependency graph.
|
|
5
|
-
* Represents: a file in `from`
|
|
7
|
+
* Represents: a file in `from` depends on a file in `to`.
|
|
6
8
|
*/
|
|
7
|
-
|
|
9
|
+
interface SliceEdge {
|
|
8
10
|
from: string;
|
|
9
11
|
to: string;
|
|
10
12
|
}
|
|
@@ -13,20 +15,110 @@ export interface SliceEdge {
|
|
|
13
15
|
* Shared by buildSliceDependencyGraph and findSliceDependencyDetails.
|
|
14
16
|
*/
|
|
15
17
|
export declare function buildFileToSliceMap(slices: Slice[]): Map<string, string>;
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Which erasure question a condition is asking.
|
|
20
|
+
*
|
|
21
|
+
* Both live on this graph and they are **not the same question**, which only became
|
|
22
|
+
* visible when `ModuleEdge` learned to tell them apart
|
|
23
|
+
* ([ts-archunit plan 0087](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0087-an-inline-type-import-still-requests-the-module.md)):
|
|
24
|
+
*
|
|
25
|
+
* - `'module-request'` — will importing this file cause the target to be *evaluated*?
|
|
26
|
+
* That is what a **cycle** is: a deadlock in module-initialization order. Used by
|
|
27
|
+
* `beFreeOfCycles`.
|
|
28
|
+
* - `'type-bindings'` — does this file *reference* the target's types? That is
|
|
29
|
+
* **coupling**, which is what `notDependOn` and `respectLayerOrder` are about, and
|
|
30
|
+
* it matches what `dependOn`/`notImportFrom` have always meant by
|
|
31
|
+
* `ignoreTypeImports`.
|
|
32
|
+
*
|
|
33
|
+
* They diverge for exactly two spellings, and only under `verbatimModuleSyntax: true`:
|
|
34
|
+
* `import { type X } from 's'` and `export { type X } from 's'` emit `import {} from 's'`
|
|
35
|
+
* / `export {} from 's'`. Those are eager edges — so a cycle question must count them —
|
|
36
|
+
* while the bindings crossing them are still purely type-level, so a coupling question
|
|
37
|
+
* told to ignore type imports must not.
|
|
38
|
+
*
|
|
39
|
+
* Getting this backwards is a false positive on one side and a false negative on the
|
|
40
|
+
* other, in the same release.
|
|
41
|
+
*/
|
|
42
|
+
type ErasureQuestion = 'module-request' | 'type-bindings';
|
|
43
|
+
/**
|
|
44
|
+
* Build a directed dependency graph between slices.
|
|
45
|
+
*
|
|
46
|
+
* For each file in each slice, resolve its dependencies. If the target file
|
|
47
|
+
* belongs to a different slice, add a directed edge from the depending slice
|
|
48
|
+
* to the depended-upon slice.
|
|
49
|
+
*
|
|
50
|
+
* @param slices - The resolved slices
|
|
51
|
+
* @param fileToSlice - Pre-built file-to-slice map (optional, built internally if not provided)
|
|
52
|
+
* @param options - `ignoreTypeImports` drops edges that are erased at compile time
|
|
53
|
+
* @returns Unique directed edges between slices
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* A built graph, and the only way to ask it for the sites behind one of its edges.
|
|
57
|
+
*
|
|
58
|
+
* `question` and `options` must be the same for the graph and for the details walk, and
|
|
59
|
+
* for a while they were four literals across two call sites kept in step by convention.
|
|
60
|
+
* The failure is silent and specific: the conditions emit **one violation per detail**, so
|
|
61
|
+
* a graph that counts an edge the details walk cannot see reports nothing at all, and a
|
|
62
|
+
* details walk that counts more reports the wrong site.
|
|
63
|
+
*
|
|
64
|
+
* A review measured the live half of that. Passing `'type-bindings'` to `beFreeOfCycles`'s
|
|
65
|
+
* details call — the one mutation of eight that stayed **green** — turned the cycle finding
|
|
66
|
+
* into *"feature dynamically imports legacy at index.ts:1"*, pointing the reader at the one
|
|
67
|
+
* construct that BREAKS cycles and telling them to remove it. ADR-009 rule 2, from a
|
|
68
|
+
* mismatch no test could see.
|
|
69
|
+
*
|
|
70
|
+
* So the pairing is no longer expressible: `detailsFor` reads what the graph was built
|
|
71
|
+
* with. This also retires the older `options`-mismatch hazard the docstrings managed with
|
|
72
|
+
* prose.
|
|
73
|
+
*/
|
|
74
|
+
interface SliceGraph {
|
|
75
|
+
readonly edges: SliceEdge[];
|
|
76
|
+
detailsFor(fromSliceName: string, toSliceName: string): SliceDependencySite[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build the graph, and bind the details walk to the same question and options.
|
|
80
|
+
*
|
|
81
|
+
* Prefer this over the two loose functions; they remain exported because
|
|
82
|
+
* `tests/` and the reverse-graph work call them directly with an explicit question.
|
|
83
|
+
*/
|
|
84
|
+
export declare function sliceGraph(slices: Slice[], fileToSlice: Map<string, string> | undefined, options: ImportOptions | undefined, question: ErasureQuestion): SliceGraph;
|
|
17
85
|
/**
|
|
18
86
|
* Find which specific files cause a dependency from one slice to another.
|
|
19
87
|
* Used for detailed violation messages.
|
|
20
88
|
*
|
|
89
|
+
* **`options` must be the options the graph was built with**, and that is not a style
|
|
90
|
+
* preference. `respectLayerOrder` and `notDependOn` push one violation *per detail*,
|
|
91
|
+
* so a graph that counts an edge this function cannot see finds the dependency and
|
|
92
|
+
* reports **nothing** — a false green produced by two filters disagreeing rather than
|
|
93
|
+
* by either one being absent. `beFreeOfCycles` fails differently and more quietly: it
|
|
94
|
+
* still reports the cycle, at `unknown:0`, which is a finding whose remedy nobody can
|
|
95
|
+
* act on.
|
|
96
|
+
*
|
|
21
97
|
* @param slices - The resolved slices
|
|
22
98
|
* @param fromSliceName - Source slice name
|
|
23
99
|
* @param toSliceName - Target slice name
|
|
24
100
|
* @param fileToSlice - Pre-built file-to-slice map (optional, built internally if not provided)
|
|
101
|
+
* @param options - Must match the options passed to `buildSliceDependencyGraph`
|
|
25
102
|
* @returns Array of { sourceFile, importPath, importLine }
|
|
26
103
|
*/
|
|
27
|
-
export
|
|
28
|
-
sourceFile: SourceFile;
|
|
29
|
-
importPath: string;
|
|
30
|
-
importLine: number;
|
|
31
|
-
|
|
104
|
+
export interface SliceDependencySite {
|
|
105
|
+
readonly sourceFile: SourceFile;
|
|
106
|
+
readonly importPath: string;
|
|
107
|
+
readonly importLine: number;
|
|
108
|
+
/**
|
|
109
|
+
* The edge itself, so a caller can build an identity and a message from what the
|
|
110
|
+
* dependency *is* rather than from where it sits.
|
|
111
|
+
*
|
|
112
|
+
* Added by [ts-archunit plan 0088](https://github.com/nielspeter/ts-archunit/blob/main/plans/0088-a-slice-finding-identifies-itself.md): the
|
|
113
|
+
* dependency conditions identify a finding by `basename::kind::specifier::names` and
|
|
114
|
+
* deliberately **not** by line, because a line moves when anything above it is edited
|
|
115
|
+
* (see `ArchViolation.identity`). The slice conditions could not follow that scheme
|
|
116
|
+
* while this function returned only a line number.
|
|
117
|
+
*
|
|
118
|
+
* It also unblocks naming the offending edge's KIND in the message — `edgeVerb()` has
|
|
119
|
+
* returned `'re-exports'` since v0.28.0 and no slice condition could use it.
|
|
120
|
+
*/
|
|
121
|
+
readonly edge: ModuleEdge;
|
|
122
|
+
}
|
|
123
|
+
export {};
|
|
32
124
|
//# sourceMappingURL=slice-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-graph.d.ts","sourceRoot":"","sources":["../../src/helpers/slice-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"slice-graph.d.ts","sourceRoot":"","sources":["../../src/helpers/slice-graph.ts"],"names":[],"mappings":"AAAA,OAAO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1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { edgesOf, FORWARD_EDGE_KINDS } from '../core/module-edges.js';
|
|
2
2
|
/**
|
|
3
3
|
* Build a reverse lookup map: file path -> slice name.
|
|
4
4
|
* Shared by buildSliceDependencyGraph and findSliceDependencyDetails.
|
|
@@ -13,25 +13,115 @@ export function buildFileToSliceMap(slices) {
|
|
|
13
13
|
return fileToSlice;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The edge kinds a **cycle** question counts: the eager static ones.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* A cycle question asks "what does this slice depend on when the program starts", which
|
|
19
|
+
* is what makes a cycle a cycle. Of `module-edges.ts`' five kinds, two qualify — and
|
|
20
|
+
* each exclusion is a decision with a reason, not an omission:
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* - `import` and `reexport` — **counted.** Both are eager: `export { x } from './b.js'`
|
|
23
|
+
* emits an import of `./b.js`, so that module is evaluated whether or not anything
|
|
24
|
+
* reads `x`. A barrel file is built out of re-exports, and `a → barrel → a` is the
|
|
25
|
+
* cycle real codebases actually have
|
|
26
|
+
* ([ts-archunit plan 0085](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0085-the-slice-graph-cannot-see-a-re-export.md)).
|
|
27
|
+
* - `dynamic` — **not counted.** `import('./b.js')` is lazy, so it cannot deadlock
|
|
28
|
+
* module initialization, and it is most often the *deliberate* fix for a cycle.
|
|
29
|
+
* Reporting it as one would fail the rule for applying its own remedy.
|
|
30
|
+
* - `require` — **not counted.** CJS, and this is an ESM-only package (ADR-004). Named
|
|
31
|
+
* here rather than left implicit, so the next reader knows it was considered. The
|
|
32
|
+
* surviving gap is `require` in an `allowJs` project: recorded, not fixed.
|
|
33
|
+
* - `type-expression` — **not counted**, and excluded by *kind* rather than by
|
|
34
|
+
* `typeOnly`. `type X = import('./b.js').Y` is erased, so it must stay out even
|
|
35
|
+
* under `ignoreTypeImports: false` — filtering it on the flag alone would make that
|
|
36
|
+
* option add a class of edge this graph has never had.
|
|
37
|
+
*
|
|
38
|
+
* **This set is the cycle question's answer and nothing else's.** It governed all three
|
|
39
|
+
* slice conditions until [ts-archunit bug 0059](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0059-slice-conditions-and-module-conditions-disagree-about-a-dependency.md),
|
|
40
|
+
* which is how the cycle rationale came to justify a false negative on two conditions
|
|
41
|
+
* that are not about cycles: `slices(p).should().notDependOn('legacy')` reported **0**
|
|
42
|
+
* while `modules(p).should().notImportFromCondition('**\/legacy/**')` reported **1**, on
|
|
43
|
+
* the same file, the same edge and the same run. See `kindsFor` below.
|
|
25
44
|
*/
|
|
45
|
+
const EAGER_STATIC_KINDS = new Set([
|
|
46
|
+
'import',
|
|
47
|
+
'reexport',
|
|
48
|
+
]);
|
|
26
49
|
/**
|
|
27
|
-
*
|
|
50
|
+
* The edges leaving one file, as a slice graph counts them.
|
|
51
|
+
*
|
|
52
|
+
* Reads `edgesOf()` — the one definition of a module edge (plan 0071, from bug 0022,
|
|
53
|
+
* where five sites collecting `getImportDeclarations()` disagreed with the reverse
|
|
54
|
+
* graph about re-exports). The slice graph was the call site that never adopted it, so
|
|
55
|
+
* `export { x } from './banned.js'` was a dependency to `notImportFrom` and invisible
|
|
56
|
+
* to `beFreeOfCycles` **in the same run**. `edgesOf()` is cached per file and
|
|
57
|
+
* invalidated on modification, so this also replaces a per-call resolution walk.
|
|
58
|
+
*
|
|
59
|
+
* `ignoreTypeImports` drops the erased edges. A type-only import or re-export creates
|
|
60
|
+
* no runtime dependency, so counting it invents cycles that cannot exist at runtime —
|
|
61
|
+
*
|
|
62
|
+
* Which erasure the filter reads depends on the `question`: `'module-request'` reads
|
|
63
|
+
* `erasesModuleRequest`, `'type-bindings'` reads `typeOnly`. Those differ for two
|
|
64
|
+
* spellings under `verbatimModuleSyntax: true` — `import { type X } from 's'` emits
|
|
65
|
+
* `import {} from 's'`, so the specifiers are erased and the module request is not
|
|
66
|
+
* ([ts-archunit plan 0087](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0087-an-inline-type-import-still-requests-the-module.md),
|
|
67
|
+
* shipped in v0.49.0; this paragraph described it as unshipped until v0.49.1).
|
|
68
|
+
*
|
|
69
|
+
* [ts-archunit plan 0084](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0084-cycle-detection-that-ignores-type-only-imports.md),
|
|
70
|
+
* which is worth remembering for what it cost: this repo's own `arch/no-cycles` rule
|
|
71
|
+
* sat at `.warn()` for months with a comment saying "switch to .check() when
|
|
72
|
+
* beFreeOfCycles ignores import type", and while it could not fail it let a new cycle
|
|
73
|
+
* in overnight.
|
|
74
|
+
*/
|
|
75
|
+
function sliceEdgesOf(file, options, question) {
|
|
76
|
+
const ignoreErased = options?.ignoreTypeImports === true;
|
|
77
|
+
const { counts, erased } = QUESTIONS[question];
|
|
78
|
+
return edgesOf(file).filter((edge) => counts(edge.kind) && !(ignoreErased && erased(edge)));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Which edge kinds the question counts — the fix for
|
|
82
|
+
* [ts-archunit bug 0059](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0059-slice-conditions-and-module-conditions-disagree-about-a-dependency.md).
|
|
83
|
+
*
|
|
84
|
+
* The erasure predicate was already a function of the question
|
|
85
|
+
* ([ts-archunit plan 0087](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0087-an-inline-type-import-still-requests-the-module.md));
|
|
86
|
+
* the KIND set was not, so one answer — the cycle one — was serving both questions.
|
|
87
|
+
*
|
|
88
|
+
* - `'module-request'` → the eager static kinds above. A cycle is a deadlock in
|
|
89
|
+
* initialization order, and `import('./b.js')` is lazy: it cannot deadlock, and it is
|
|
90
|
+
* most often the deliberate *fix* for a cycle. Reporting it would fail the rule for
|
|
91
|
+
* applying its own remedy.
|
|
92
|
+
* - `'type-bindings'` → whatever `FORWARD_EDGE_KINDS` says, which is the constant
|
|
93
|
+
* `notImportFrom` and `dependOn` already read. A lazy import of `legacy` is still a
|
|
94
|
+
* forbidden dependency: it is coupling, it breaks when `legacy` is deleted, and nobody
|
|
95
|
+
* is applying a remedy by writing it.
|
|
96
|
+
*
|
|
97
|
+
* **Reusing `FORWARD_EDGE_KINDS` rather than writing a second list is the point.** It is
|
|
98
|
+
* what makes the two families agree *by construction* instead of by two lists someone
|
|
99
|
+
* must keep in step — which is exactly how
|
|
100
|
+
* [ts-archunit bug 0022](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0022-forward-import-conditions-are-blind-to-reexports-and-dynamic-imports.md)
|
|
101
|
+
* happened one layer down, and how this bug re-opened it one layer up. That constant is
|
|
102
|
+
* a total `Record<ModuleEdgeKind, boolean>`, so a sixth edge kind is a compile error
|
|
103
|
+
* there rather than a silent omission here.
|
|
28
104
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
105
|
+
const QUESTIONS = {
|
|
106
|
+
'module-request': {
|
|
107
|
+
counts: (kind) => EAGER_STATIC_KINDS.has(kind),
|
|
108
|
+
erased: (edge) => edge.erasesModuleRequest,
|
|
109
|
+
},
|
|
110
|
+
'type-bindings': {
|
|
111
|
+
counts: (kind) => FORWARD_EDGE_KINDS[kind],
|
|
112
|
+
erased: (edge) => edge.typeOnly,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Collect unique slice edges from a single file's dependencies.
|
|
117
|
+
*/
|
|
118
|
+
function collectEdgesFromFile(file, sliceName, fileToSlice, edgeSet, edges, options, question) {
|
|
119
|
+
for (const edge of sliceEdgesOf(file, options, question)) {
|
|
120
|
+
// A local `export { x }` with no `from` has no specifier, and a specifier the
|
|
121
|
+
// compiler could not resolve points outside the program.
|
|
122
|
+
if (edge.resolvedPath === undefined)
|
|
33
123
|
continue;
|
|
34
|
-
const targetSlice = fileToSlice.get(
|
|
124
|
+
const targetSlice = fileToSlice.get(edge.resolvedPath);
|
|
35
125
|
if (targetSlice && targetSlice !== sliceName) {
|
|
36
126
|
const edgeKey = `${sliceName}->${targetSlice}`;
|
|
37
127
|
if (!edgeSet.has(edgeKey)) {
|
|
@@ -41,45 +131,47 @@ function collectEdgesFromFile(file, sliceName, fileToSlice, edgeSet, edges) {
|
|
|
41
131
|
}
|
|
42
132
|
}
|
|
43
133
|
}
|
|
44
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Build the graph, and bind the details walk to the same question and options.
|
|
136
|
+
*
|
|
137
|
+
* Prefer this over the two loose functions; they remain exported because
|
|
138
|
+
* `tests/` and the reverse-graph work call them directly with an explicit question.
|
|
139
|
+
*/
|
|
140
|
+
export function sliceGraph(slices, fileToSlice, options, question) {
|
|
141
|
+
const map = fileToSlice ?? buildFileToSliceMap(slices);
|
|
142
|
+
return {
|
|
143
|
+
edges: buildSliceDependencyGraph(slices, map, options, question),
|
|
144
|
+
detailsFor: (from, to) => findSliceDependencyDetails(slices, from, to, map, options, question),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function buildSliceDependencyGraph(slices, fileToSlice, options, question) {
|
|
45
148
|
const map = fileToSlice ?? buildFileToSliceMap(slices);
|
|
46
149
|
// Collect unique edges
|
|
47
150
|
const edgeSet = new Set();
|
|
48
151
|
const edges = [];
|
|
49
152
|
for (const slice of slices) {
|
|
50
153
|
for (const file of slice.files) {
|
|
51
|
-
collectEdgesFromFile(file, slice.name, map, edgeSet, edges);
|
|
154
|
+
collectEdgesFromFile(file, slice.name, map, edgeSet, edges, options, question);
|
|
52
155
|
}
|
|
53
156
|
}
|
|
54
157
|
return edges;
|
|
55
158
|
}
|
|
56
|
-
|
|
57
|
-
* Find which specific files cause a dependency from one slice to another.
|
|
58
|
-
* Used for detailed violation messages.
|
|
59
|
-
*
|
|
60
|
-
* @param slices - The resolved slices
|
|
61
|
-
* @param fromSliceName - Source slice name
|
|
62
|
-
* @param toSliceName - Target slice name
|
|
63
|
-
* @param fileToSlice - Pre-built file-to-slice map (optional, built internally if not provided)
|
|
64
|
-
* @returns Array of { sourceFile, importPath, importLine }
|
|
65
|
-
*/
|
|
66
|
-
export function findSliceDependencyDetails(slices, fromSliceName, toSliceName, fileToSlice) {
|
|
159
|
+
function findSliceDependencyDetails(slices, fromSliceName, toSliceName, fileToSlice, options, question) {
|
|
67
160
|
const map = fileToSlice ?? buildFileToSliceMap(slices);
|
|
68
161
|
const fromSlice = slices.find((s) => s.name === fromSliceName);
|
|
69
162
|
if (!fromSlice)
|
|
70
163
|
return [];
|
|
71
164
|
const details = [];
|
|
72
165
|
for (const file of fromSlice.files) {
|
|
73
|
-
for (const
|
|
74
|
-
|
|
75
|
-
if (!resolved)
|
|
166
|
+
for (const edge of sliceEdgesOf(file, options, question)) {
|
|
167
|
+
if (edge.resolvedPath === undefined)
|
|
76
168
|
continue;
|
|
77
|
-
|
|
78
|
-
if (targetSlice === toSliceName) {
|
|
169
|
+
if (map.get(edge.resolvedPath) === toSliceName) {
|
|
79
170
|
details.push({
|
|
80
171
|
sourceFile: file,
|
|
81
|
-
importPath:
|
|
82
|
-
importLine:
|
|
172
|
+
importPath: edge.resolvedPath,
|
|
173
|
+
importLine: edge.line,
|
|
174
|
+
edge,
|
|
83
175
|
});
|
|
84
176
|
}
|
|
85
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-graph.js","sourceRoot":"","sources":["../../src/helpers/slice-graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slice-graph.js","sourceRoot":"","sources":["../../src/helpers/slice-graph.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWrE;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAA;IAC7C,KAAK,MA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;oBAChB,UAAU,EAAE,IAAI,CAAC,YAAY;oBAC7B,UAAU,EAAE,IAAI,CAAC,IAAI;oBACrB,IAAI;iBACL,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/helpers/tarjan.d.ts
CHANGED
|
@@ -3,19 +3,5 @@
|
|
|
3
3
|
* Keys are node indices, values are arrays of neighbor indices.
|
|
4
4
|
*/
|
|
5
5
|
export type AdjacencyList = Map<number, number[]>;
|
|
6
|
-
/**
|
|
7
|
-
* Find all strongly connected components in a directed graph
|
|
8
|
-
* using Tarjan's algorithm.
|
|
9
|
-
*
|
|
10
|
-
* Returns only components with size > 1 (i.e., actual cycles).
|
|
11
|
-
* Each component is an array of node indices forming a cycle.
|
|
12
|
-
*
|
|
13
|
-
* Time complexity: O(V + E)
|
|
14
|
-
* Space complexity: O(V)
|
|
15
|
-
*
|
|
16
|
-
* @param nodeCount - Total number of nodes (0-indexed)
|
|
17
|
-
* @param edges - Adjacency list: node index -> list of neighbor indices
|
|
18
|
-
* @returns Array of strongly connected components (size > 1)
|
|
19
|
-
*/
|
|
20
6
|
export declare function tarjanSCC(nodeCount: number, edges: AdjacencyList): number[][];
|
|
21
7
|
//# sourceMappingURL=tarjan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tarjan.d.ts","sourceRoot":"","sources":["../../src/helpers/tarjan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"tarjan.d.ts","sourceRoot":"","sources":["../../src/helpers/tarjan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAsCjD,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,EAAE,EAAE,CAqD7E"}
|
package/dist/helpers/tarjan.js
CHANGED
|
@@ -12,6 +12,25 @@
|
|
|
12
12
|
* @param edges - Adjacency list: node index -> list of neighbor indices
|
|
13
13
|
* @returns Array of strongly connected components (size > 1)
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* Read an index that the algorithm guarantees is in range.
|
|
17
|
+
*
|
|
18
|
+
* `noUncheckedIndexedAccess` types every element access as `T | undefined`, and
|
|
19
|
+
* the original code answered that with `!` — which ADR-005 bars, and which turns
|
|
20
|
+
* a genuinely impossible state into silence if it ever stops being impossible.
|
|
21
|
+
* A named accessor narrows for real and fails LOUDLY instead: every index here
|
|
22
|
+
* comes from `edges`, so an out-of-range one means the caller's adjacency list
|
|
23
|
+
* disagrees with `nodeCount`, which is worth an error rather than a `-1` that
|
|
24
|
+
* reads as "unvisited" and quietly changes the result.
|
|
25
|
+
*/
|
|
26
|
+
function at(values, i, what) {
|
|
27
|
+
const value = values[i];
|
|
28
|
+
if (value === undefined) {
|
|
29
|
+
throw new RangeError(`tarjanSCC: ${what}[${String(i)}] is outside the graph (${String(values.length)} nodes) — ` +
|
|
30
|
+
'the adjacency list names a node that nodeCount does not cover.');
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
15
34
|
export function tarjanSCC(nodeCount, edges) {
|
|
16
35
|
const index = new Array(nodeCount).fill(-1);
|
|
17
36
|
const lowlink = new Array(nodeCount).fill(-1);
|
|
@@ -27,34 +46,28 @@ export function tarjanSCC(nodeCount, edges) {
|
|
|
27
46
|
onStack[v] = true;
|
|
28
47
|
const neighbors = edges.get(v) ?? [];
|
|
29
48
|
for (const w of neighbors) {
|
|
30
|
-
// lv/lw/iw are always defined here (v and w are bounded indices into
|
|
31
|
-
// pre-filled arrays); the guards satisfy noUncheckedIndexedAccess.
|
|
32
|
-
const lv = lowlink[v];
|
|
33
49
|
if (index[w] === -1) {
|
|
34
50
|
// w has not been visited
|
|
35
51
|
strongConnect(w);
|
|
36
|
-
|
|
37
|
-
if (lv !== undefined && lw !== undefined)
|
|
38
|
-
lowlink[v] = Math.min(lv, lw);
|
|
52
|
+
lowlink[v] = Math.min(at(lowlink, v, 'lowlink'), at(lowlink, w, 'lowlink'));
|
|
39
53
|
}
|
|
40
54
|
else if (onStack[w]) {
|
|
41
55
|
// w is on the stack, so it's in the current SCC
|
|
42
|
-
|
|
43
|
-
if (lv !== undefined && iw !== undefined)
|
|
44
|
-
lowlink[v] = Math.min(lv, iw);
|
|
56
|
+
lowlink[v] = Math.min(at(lowlink, v, 'lowlink'), at(index, w, 'index'));
|
|
45
57
|
}
|
|
46
58
|
}
|
|
47
59
|
// If v is a root node, pop the SCC
|
|
48
60
|
if (lowlink[v] === index[v]) {
|
|
49
61
|
const scc = [];
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (popped === v)
|
|
62
|
+
let w;
|
|
63
|
+
do {
|
|
64
|
+
const popped = stack.pop();
|
|
65
|
+
if (popped === undefined)
|
|
55
66
|
break;
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
w = popped;
|
|
68
|
+
onStack[w] = false;
|
|
69
|
+
scc.push(w);
|
|
70
|
+
} while (w !== v);
|
|
58
71
|
// Only report cycles (size > 1)
|
|
59
72
|
if (scc.length > 1) {
|
|
60
73
|
sccs.push(scc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tarjan.js","sourceRoot":"","sources":["../../src/helpers/tarjan.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,KAAoB;IAC/D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAS,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,MAAM,OAAO,GAAG,IAAI,KAAK,CAAS,SAAS,CAAC,CAAC,IAAI,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C;QACH,CAAC;QAED,mCAAmC;QACnC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAa,EAAE,CAAA;YACxB,IAAI,CAAS,CAAA;YACb,GAAG,CAAC;gBACF,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;gBAC1B,IAAI,MAAM,KAAK,SAAS;oBAAE,MAAK;gBAC/B,CAAC,GAAG,MAAM,CAAA;gBACV,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;gBAClB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACb,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAC;YAEjB,gCAAgC;YAChC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpB,aAAa,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { project, workspace, resetProjectCache } from './core/project.js';
|
|
2
|
+
export { checkAll } from './core/check-all.js';
|
|
2
3
|
export type { ArchProject } from './core/project.js';
|
|
3
4
|
export type { Predicate } from '@nielspeter/eess';
|
|
4
|
-
export { not, and, or } from '
|
|
5
|
+
export { not, and, or } from './core/combinators.js';
|
|
5
6
|
export type { Condition, ConditionContext } from '@nielspeter/eess';
|
|
6
|
-
export type { ArchViolation } from '
|
|
7
|
+
export type { ArchViolation } from '@nielspeter/eess';
|
|
7
8
|
export { createViolation, getElementName, getElementFile, getElementLine, } from './core/violation.js';
|
|
8
|
-
export { RuleBuilder } from '
|
|
9
|
-
export { TerminalBuilder } from '
|
|
10
|
-
export { ArchRuleError } from '@nielspeter/eess';
|
|
9
|
+
export { RuleBuilder } from './core/rule-builder.js';
|
|
10
|
+
export { TerminalBuilder } from './core/terminal-builder.js';
|
|
11
|
+
export { ArchRuleError, isArchRuleError, ArchConfigError, isArchConfigError, } from '@nielspeter/eess';
|
|
11
12
|
export type { RuleMetadata } from '@nielspeter/eess';
|
|
12
13
|
export type { RuleDescription } from '@nielspeter/eess';
|
|
13
14
|
export { generateCodeFrame } from '@nielspeter/eess';
|
|
@@ -15,10 +16,14 @@ export type { CodeFrameOptions } from '@nielspeter/eess';
|
|
|
15
16
|
export { formatViolations, formatViolationsPlain } from '@nielspeter/eess';
|
|
16
17
|
export type { FormatOptions } from '@nielspeter/eess';
|
|
17
18
|
export { definePredicate, defineCondition } from '@nielspeter/eess';
|
|
19
|
+
export { globNode, globAnyOf } from '@nielspeter/eess';
|
|
20
|
+
export type { DeclaredGlob, DeclaredGlobs, GlobBase, GlobKind, GlobNode, GlobPosition, GlobSite, GlobTree, OpaqueGlob, } from '@nielspeter/eess';
|
|
21
|
+
export type { DiagnosableRule, DiagnosticFinding } from './core/diagnose.js';
|
|
22
|
+
export { diagnose } from './core/diagnose.js';
|
|
18
23
|
export type { Named, Located, Exportable } from './predicates/index.js';
|
|
19
|
-
export { haveNameMatching, haveNameStartingWith, haveNameEndingWith, resideInFile, resideInFolder, areExported, areNotExported, } from './predicates/index.js';
|
|
24
|
+
export { haveNameMatching, haveNameStartingWith, haveNameEndingWith, resideInFile, resideInFolder, havePathMatching, areExported, areNotExported, } from './predicates/index.js';
|
|
20
25
|
export { resideInFile as conditionResideInFile, resideInFolder as conditionResideInFolder, haveNameMatching as conditionHaveNameMatching, beExported, notExist, } from './conditions/structural.js';
|
|
21
|
-
export { importFrom, notImportFrom as predicateNotImportFrom, exportSymbolNamed,
|
|
26
|
+
export { importFrom, notImportFrom as predicateNotImportFrom, exportSymbolNamed, } from './predicates/module.js';
|
|
22
27
|
export type { ImportOptions } from './core/import-options.js';
|
|
23
28
|
export { isTypeOnlyImport } from './core/import-options.js';
|
|
24
29
|
export { onlyImportFrom, notImportFrom as conditionNotImportFrom, onlyHaveTypeImportsFrom, notHaveAliasedImports, dependOn, } from './conditions/dependency.js';
|
|
@@ -28,7 +33,9 @@ export { extend, implement, haveDecorator, haveDecoratorMatching, areAbstract, h
|
|
|
28
33
|
export { shouldExtend, shouldImplement, shouldHaveMethodNamed, shouldNotHaveMethodMatching, acceptParameterOfType as classAcceptParameterOfType, notAcceptParameterOfType as classNotAcceptParameterOfType, } from './conditions/class.js';
|
|
29
34
|
export { functions, FunctionRuleBuilder } from './builders/function-rule-builder.js';
|
|
30
35
|
export type { ArchFunction } from './models/arch-function.js';
|
|
31
|
-
export { collectFunctions, fromFunctionDeclaration, fromArrowVariableDeclaration, fromMethodDeclaration, } from './models/arch-function.js';
|
|
36
|
+
export { collectFunctions, fromFunctionDeclaration, fromFunctionInitializerDeclaration, fromArrowVariableDeclaration, fromMethodDeclaration, } from './models/arch-function.js';
|
|
37
|
+
export type { FunctionCollectionOptions } from './models/arch-function.js';
|
|
38
|
+
export type { ObjectLiteralFunction } from './core/object-literal-functions.js';
|
|
32
39
|
export { arePublic, areProtected, arePrivate, areAsync, areNotAsync, haveParameterCount, haveParameterCountGreaterThan, haveParameterCountLessThan, haveParameterNamed, haveReturnType, haveRestParameter, haveOptionalParameter, haveParameterOfType, haveParameterNameMatching, } from './predicates/function.js';
|
|
33
40
|
export { notExist as functionNotExist, beExported as functionBeExported, beAsync as functionBeAsync, haveNameMatching as functionHaveNameMatching, acceptParameterOfType as functionAcceptParameterOfType, notAcceptParameterOfType as functionNotAcceptParameterOfType, haveReturnTypeMatching as functionHaveReturnTypeMatching, } from './conditions/function.js';
|
|
34
41
|
export { types, TypeRuleBuilder } from './builders/type-rule-builder.js';
|
|
@@ -52,23 +59,25 @@ export { beFreeOfCycles, respectLayerOrder, notDependOn } from './conditions/sli
|
|
|
52
59
|
export { slices, SliceRuleBuilder } from './builders/slice-rule-builder.js';
|
|
53
60
|
export type { CheckOptions, OutputFormat } from '@nielspeter/eess';
|
|
54
61
|
export { formatViolationsJson } from '@nielspeter/eess';
|
|
62
|
+
export type { ArchJsonReport, ArchJsonViolation, ArchJsonSuppression, ArchJsonUntestedAllowlist, } from '@nielspeter/eess';
|
|
55
63
|
export { formatViolationsGitHub } from '@nielspeter/eess';
|
|
56
64
|
export { detectFormat, isCI } from '@nielspeter/eess';
|
|
57
|
-
export { withBaseline, generateBaseline, Baseline } from '
|
|
58
|
-
export type {
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
61
|
-
export
|
|
65
|
+
export { withBaseline, generateBaseline, Baseline } from './helpers/baseline.js';
|
|
66
|
+
export type { BaselineDelta } from './helpers/baseline.js';
|
|
67
|
+
export type { BaselineEntry, BaselineFile, BaselineOptions } from './helpers/baseline.js';
|
|
68
|
+
export { diffAware, DiffFilter } from './helpers/diff-aware.js';
|
|
69
|
+
export { parseExclusionComments, isExcludedByComment } from './core/exclusion-comments.js';
|
|
70
|
+
export type { ExclusionComment, ExclusionWarning, ParseResult } from './core/exclusion-comments.js';
|
|
62
71
|
export { silent } from '@nielspeter/eess';
|
|
63
72
|
export type { SilentExclusion } from '@nielspeter/eess';
|
|
64
|
-
export { collectViolations } from '
|
|
73
|
+
export { collectViolations } from './helpers/baseline-generator.js';
|
|
65
74
|
export { calls, CallRuleBuilder } from './builders/call-rule-builder.js';
|
|
66
75
|
export type { ArchCall } from './models/arch-call.js';
|
|
67
|
-
export {
|
|
76
|
+
export { fromCallExpression } from './models/arch-call.js';
|
|
68
77
|
export { onObject, withMethod, withArgMatching, withStringArg } from './predicates/call.js';
|
|
69
78
|
export { haveCallbackContaining as callHaveCallbackContaining, notHaveCallbackContaining as callNotHaveCallbackContaining, notExist as callNotExist, haveArgumentWithProperty, notHaveArgumentWithProperty, haveArgumentContaining as callHaveArgumentContaining, notHaveArgumentContaining as callNotHaveArgumentContaining, } from './conditions/call.js';
|
|
70
|
-
export { within } from './
|
|
71
|
-
export type { ScopedContext } from './
|
|
79
|
+
export { within } from './builders/within.js';
|
|
80
|
+
export type { ScopedContext } from './builders/within.js';
|
|
72
81
|
export { ScopedFunctionRuleBuilder } from './builders/scoped-function-rule-builder.js';
|
|
73
82
|
export { extractCallbacks } from './helpers/callback-extractor.js';
|
|
74
83
|
export type { ExtractedCallback } from './helpers/callback-extractor.js';
|
|
@@ -77,16 +86,22 @@ export type { ArchPattern, PropertyConstraint } from './helpers/pattern.js';
|
|
|
77
86
|
export { followPattern } from './conditions/pattern.js';
|
|
78
87
|
export { smells } from './smells/index.js';
|
|
79
88
|
export { SmellBuilder } from './smells/smell-builder.js';
|
|
80
|
-
export { tsconfig
|
|
81
|
-
export {
|
|
89
|
+
export { tsconfig } from './tsconfig/index.js';
|
|
90
|
+
export { TsconfigBuilder } from './tsconfig/tsconfig-builder.js';
|
|
82
91
|
export { DuplicateBodiesBuilder } from './smells/duplicate-bodies.js';
|
|
83
92
|
export { InconsistentSiblingsBuilder } from './smells/inconsistent-siblings.js';
|
|
84
93
|
export type { Fingerprint } from './smells/fingerprint.js';
|
|
85
94
|
export { buildFingerprint, computeSimilarity } from './smells/fingerprint.js';
|
|
95
|
+
export { variationBetween } from './smells/variation.js';
|
|
96
|
+
export type { Variation, VariationAxis } from './smells/variation.js';
|
|
86
97
|
export type { Layer, LayerPair } from './models/cross-layer.js';
|
|
87
98
|
export type { PairCondition } from './core/pair-condition.js';
|
|
88
99
|
export { crossLayer, CrossLayerBuilder } from './builders/cross-layer-builder.js';
|
|
89
100
|
export { haveMatchingCounterpart, haveConsistentExports, satisfyPairCondition, } from './conditions/cross-layer.js';
|
|
101
|
+
export { crossProject, CrossProjectBuilder, byName, byArg, byPropertyNames, } from './builders/correspondence-builder.js';
|
|
102
|
+
export type { KeyFn, KeysSource } from './builders/correspondence-builder.js';
|
|
103
|
+
export { setCorrespondence } from '@nielspeter/eess';
|
|
104
|
+
export type { CorrespondenceResult } from '@nielspeter/eess';
|
|
90
105
|
export { haveCyclomaticComplexity, haveMoreLinesThan, haveMoreMethodsThan, haveComplexity, haveMoreFunctionLinesThan, } from './predicates/metrics.js';
|
|
91
106
|
export { cyclomaticComplexity, linesOfCode } from './helpers/complexity.js';
|
|
92
107
|
export { noEval, noFunctionConstructor, noProcessEnv, noConsoleLog, noConsole, noJsonParse, functionNoEval, functionNoFunctionConstructor, functionNoProcessEnv, functionNoConsoleLog, functionNoConsole, functionNoJsonParse, moduleNoEval, moduleNoProcessEnv, moduleNoConsoleLog, } from './rules/security.js';
|
|
@@ -100,4 +115,25 @@ export { areHtmlElements, areComponents, withAttribute as jsxWithAttribute, with
|
|
|
100
115
|
export { notExist as jsxNotExist, haveAttribute as jsxHaveAttribute, notHaveAttribute as jsxNotHaveAttribute, haveAttributeMatching as jsxHaveAttributeMatching, notHaveAttributeMatching as jsxNotHaveAttributeMatching, } from './conditions/jsx.js';
|
|
101
116
|
export { defineConfig } from './cli/config.js';
|
|
102
117
|
export type { CliConfig } from './cli/config.js';
|
|
118
|
+
export { orphanExclusions } from './core/orphan-exclusions.js';
|
|
119
|
+
export type { OrphanExclusion } from './core/orphan-exclusions.js';
|
|
120
|
+
export type { Selection, ElementInfo, RuleBuilderLike, EdgeCoverage, GlobLeaf, ReportMode, } from '@nielspeter/eess';
|
|
121
|
+
export { rootFromTsConfigPath, rootOf, relativeToRoot } from './core/project-relative.js';
|
|
122
|
+
export { syntacticFault } from './core/glob-diagnosis.js';
|
|
123
|
+
export { dispatchRule, finishPreset } from '@nielspeter/eess';
|
|
124
|
+
export { collectResult, mergeCollectResults, hasEvidence, EMITTER_NO_RECEIPT, EMITTER_PASS_WITHOUT_EVIDENCE, EMITTER_EXPIRED_DECLARATION, EMITTER_CONTRADICTORY_EVIDENCE, EMITTER_SOURCE_EMPTY, } from '@nielspeter/eess';
|
|
125
|
+
export type { Evidence } from '@nielspeter/eess';
|
|
126
|
+
export type { RuleSeverity, PresetBaseOptions, PresetReportOptions, ReportOptions, } from '@nielspeter/eess';
|
|
127
|
+
export { assertsCardinality, reportViolations } from '@nielspeter/eess';
|
|
128
|
+
export type { BaselineFilter, DiffFilterLike, Matcher, UntestedReason } from '@nielspeter/eess';
|
|
129
|
+
export type { CollectResult } from './core/terminal-builder.js';
|
|
130
|
+
export type { DiskSet, OnDisk } from './core/disk-set.js';
|
|
131
|
+
export { diskSet } from './core/disk-set.js';
|
|
132
|
+
export type { GlobFault } from './core/glob-diagnosis.js';
|
|
133
|
+
export { pathUniverse } from './core/path-universe.js';
|
|
134
|
+
export type { PathUniverse } from '@nielspeter/eess';
|
|
135
|
+
export { validateOverrides } from './presets/shared.js';
|
|
136
|
+
export { STRICT_FAMILY_SIZE } from './tsconfig/strict-family.js';
|
|
137
|
+
export type { StrictFamilyFlag } from './tsconfig/strict-family.js';
|
|
138
|
+
export type { PresetDelivery } from './presets/shared.js';
|
|
103
139
|
//# sourceMappingURL=index.d.ts.map
|