@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
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make a project-relative glob work, instead of failing loudly — plan 0067 C.
|
|
3
|
+
*
|
|
4
|
+
* Globs are matched against **absolute** file paths, so `'src/domain/**'`
|
|
5
|
+
* matches nothing. That is the single commonest real mistake with this library:
|
|
6
|
+
* it is the shape 0.18.1 was released for, and as of **0.34.0** it is a hard
|
|
7
|
+
* build failure telling the author to prefix `'**\/'`.
|
|
8
|
+
*
|
|
9
|
+
* Prefixing works but says something different. `'**\/src/domain/**'` matches a
|
|
10
|
+
* `src/domain` **anywhere** — including `vendor/thing/src/domain`, and
|
|
11
|
+
* including a second `src/` nested inside a monorepo package. What the author
|
|
12
|
+
* meant was the one at the project root. 0067 called normalization "the root
|
|
13
|
+
* cause" fix for that reason, and 0069 sequenced it directly after R3b.
|
|
14
|
+
*
|
|
15
|
+
* So an unanchored glob is matched against the path **relative to the
|
|
16
|
+
* tsconfig's directory**, in addition to the absolute path. Both spellings keep
|
|
17
|
+
* working and they mean different things:
|
|
18
|
+
*
|
|
19
|
+
* | glob | matches |
|
|
20
|
+
* | --------------------- | ------------------------------------------- |
|
|
21
|
+
* | `'src/domain/**'` | that folder **at the project root** |
|
|
22
|
+
* | `'**\/src/domain/**'` | a `src/domain` **anywhere** in the project |
|
|
23
|
+
* | `'/abs/src/domain/**'`| exactly that absolute path |
|
|
24
|
+
*
|
|
25
|
+
* ## Why the root comes from the element, not from the builder
|
|
26
|
+
*
|
|
27
|
+
* A predicate is constructed two ways that must not diverge:
|
|
28
|
+
* `.that().resideInFolder(g)`, where the builder knows the project, and
|
|
29
|
+
* `.that().satisfy(resideInFolder(g))`, where nothing does.
|
|
30
|
+
* `tests/core/glob-declaration.test.ts` exists to assert the two spellings
|
|
31
|
+
* agree, and threading the root through only the first would break that.
|
|
32
|
+
*
|
|
33
|
+
* Every `Located` element can reach its own `SourceFile`, and ts-morph carries
|
|
34
|
+
* the tsconfig it was loaded from on the project's compiler options. So the
|
|
35
|
+
* root is derived where the match happens, from the element itself, and both
|
|
36
|
+
* spellings get it for free.
|
|
37
|
+
*
|
|
38
|
+
* `configFilePath` is `undefined` for a project built in memory or without a
|
|
39
|
+
* tsconfig. That is a genuine "no root known" and normalization is skipped —
|
|
40
|
+
* the glob keeps its absolute-only meaning rather than being matched against
|
|
41
|
+
* something invented.
|
|
42
|
+
*/
|
|
43
|
+
import type { Project as TsMorphProject, SourceFile } from 'ts-morph';
|
|
44
|
+
/**
|
|
45
|
+
* Whether a glob can already match an absolute path, so the `**\/` hint would
|
|
46
|
+
* be a no-op (or worse). Covers POSIX-absolute and Windows drive-absolute
|
|
47
|
+
* globs as well as an explicit globstar.
|
|
48
|
+
*
|
|
49
|
+
* Lives here rather than in `glob-diagnosis.ts` (which re-exports it) because
|
|
50
|
+
* `isProjectRelative` below is defined as its negation, and this module sits
|
|
51
|
+
* under the one that diagnoses.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isAnchored(glob: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Does this glob name a location relative to the project root?
|
|
56
|
+
*
|
|
57
|
+
* Only an **unanchored, relative** glob is normalized. `'**\/x'` is explicitly
|
|
58
|
+
* "anywhere" and must keep meaning that; `'/abs/x'` is already absolute. So
|
|
59
|
+
* this is the same population `syntacticFault` calls `unanchored`, which is
|
|
60
|
+
* what makes the two consistent: a glob stops being reported dead for being
|
|
61
|
+
* unanchored exactly when it starts working.
|
|
62
|
+
*/
|
|
63
|
+
export declare function isProjectRelative(glob: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Record the directories a project was loaded from.
|
|
66
|
+
*
|
|
67
|
+
* Load-bearing for `workspace()`, which has several. For a single-tsconfig
|
|
68
|
+
* `project()` it is **defence in depth and not independently observable**:
|
|
69
|
+
* removing that call leaves every test green, because `rootOf` then falls
|
|
70
|
+
* through to ts-morph's `configFilePath`, which agrees. Recorded rather than
|
|
71
|
+
* papered over — a sabotage row that survives because the behaviour is
|
|
72
|
+
* genuinely redundant is a different thing from a missing guard, and the next
|
|
73
|
+
* person to see it green should not go hunting for a test to write.
|
|
74
|
+
*/
|
|
75
|
+
export declare function registerProjectRoots(tsMorphProject: TsMorphProject, tsConfigPaths: readonly string[]): void;
|
|
76
|
+
/**
|
|
77
|
+
* The project root implied by a tsconfig path.
|
|
78
|
+
*
|
|
79
|
+
* Preferred wherever the caller holds the `ArchProject`, because it is the path
|
|
80
|
+
* the user named rather than what ts-morph recorded — `getCompilerOptions()
|
|
81
|
+
* .configFilePath` is `undefined` for an in-memory project even when the
|
|
82
|
+
* `ArchProject` carries a perfectly good path, and normalization then silently
|
|
83
|
+
* did not happen. The predicates cannot use this (they see only an element, by
|
|
84
|
+
* design, so the builder and `.satisfy()` spellings cannot diverge); the slice
|
|
85
|
+
* resolver can.
|
|
86
|
+
*/
|
|
87
|
+
export declare function rootFromTsConfigPath(tsConfigPath: string): string | undefined;
|
|
88
|
+
export declare function rootOf(sourceFile: SourceFile, fallbackTsConfigPath?: string): string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* `absolutePath` relative to the project root, or `undefined` when it sits
|
|
91
|
+
* outside the root or the root is unknown.
|
|
92
|
+
*
|
|
93
|
+
* Never `path.relative`, which emits `../../..` for a path above the root and
|
|
94
|
+
* so encodes the root's depth — machine-dependent, and the mistake
|
|
95
|
+
* `path-universe.ts` documents avoiding for the same reason.
|
|
96
|
+
*/
|
|
97
|
+
export declare function relativeToRoot(sourceFile: SourceFile, absolutePath: string, fallbackTsConfigPath?: string): string | undefined;
|
|
98
|
+
//# sourceMappingURL=project-relative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-relative.d.ts","sourceRoot":"","sources":["../../src/core/project-relative.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErE;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgCvD;AA+BD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,IAAI,CAKN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY7E;AAOD,wBAAgB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAqChG;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,EACpB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,MAAM,GAAG,SAAS,CAKpB"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a glob can already match an absolute path, so the `**\/` hint would
|
|
3
|
+
* be a no-op (or worse). Covers POSIX-absolute and Windows drive-absolute
|
|
4
|
+
* globs as well as an explicit globstar.
|
|
5
|
+
*
|
|
6
|
+
* Lives here rather than in `glob-diagnosis.ts` (which re-exports it) because
|
|
7
|
+
* `isProjectRelative` below is defined as its negation, and this module sits
|
|
8
|
+
* under the one that diagnoses.
|
|
9
|
+
*/
|
|
10
|
+
export function isAnchored(glob) {
|
|
11
|
+
return glob.startsWith('**/') || glob.startsWith('/') || /^[A-Za-z]:\//.test(glob);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Does this glob name a location relative to the project root?
|
|
15
|
+
*
|
|
16
|
+
* Only an **unanchored, relative** glob is normalized. `'**\/x'` is explicitly
|
|
17
|
+
* "anywhere" and must keep meaning that; `'/abs/x'` is already absolute. So
|
|
18
|
+
* this is the same population `syntacticFault` calls `unanchored`, which is
|
|
19
|
+
* what makes the two consistent: a glob stops being reported dead for being
|
|
20
|
+
* unanchored exactly when it starts working.
|
|
21
|
+
*/
|
|
22
|
+
export function isProjectRelative(glob) {
|
|
23
|
+
// A `./` segment is excluded, and that exclusion is load-bearing rather than
|
|
24
|
+
// fussy. `syntacticFault` reports `dot-segment` for a `./` anywhere in a
|
|
25
|
+
// glob, so normalizing one would make the rule MATCH at runtime while the
|
|
26
|
+
// gate still reported it dead — two derivations disagreeing about the same
|
|
27
|
+
// glob, which is the failure this project spends most of its guards on.
|
|
28
|
+
// Measured before this line existed: `'./src/domain/**'` selected 3 subjects
|
|
29
|
+
// and produced a dead-selector finding in the same run.
|
|
30
|
+
//
|
|
31
|
+
// `./` is a mistake in both worlds — it never occurs in an absolute path and
|
|
32
|
+
// it says nothing extra in a relative one — so the honest fix is to leave it
|
|
33
|
+
// failing, with advice that says to remove it.
|
|
34
|
+
// `..` is not relative-to-the-root in any usable sense: containment returns
|
|
35
|
+
// `undefined` for anything above the root, deliberately, so a `../`
|
|
36
|
+
// glob would normalize to nothing and be reported dead with three false
|
|
37
|
+
// causes. Excluded alongside `./` — both are mistakes in both readings.
|
|
38
|
+
if (/(?:^|\/)\.\.?\//.test(glob))
|
|
39
|
+
return false;
|
|
40
|
+
// Derived from `isAnchored`, not restated. They were two lists and disagreed:
|
|
41
|
+
// `isAnchored` recognises a drive-absolute `C:/x/**` and this did not, so a
|
|
42
|
+
// Windows path was declared project-relative. Benign today — it still matches
|
|
43
|
+
// the absolute path — but `base` is a function of this at three sites now,
|
|
44
|
+
// and `base` affects the verdict.
|
|
45
|
+
// `isAnchored` covers `/x`, `**/x` and a drive-absolute `C:/x` — the last of
|
|
46
|
+
// which this used to miss, declaring a Windows path project-relative.
|
|
47
|
+
if (isAnchored(glob))
|
|
48
|
+
return false;
|
|
49
|
+
// `*/x/**` is deliberately NOT normalized, even though it is unanchored.
|
|
50
|
+
// Normalizing it would make it match, which sounds like an improvement until
|
|
51
|
+
// you notice it is the LAST reachable `unanchored` fault for a path glob —
|
|
52
|
+
// the anchor advice, and the whole `ANCHOR_ADVICE` grouping in the slice
|
|
53
|
+
// discovery message, would become unreachable code. Left failing, with a
|
|
54
|
+
// remedy that works: `'**/x/**'`.
|
|
55
|
+
return !glob.startsWith('*/');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The directory holding the tsconfig this element's project was loaded from.
|
|
59
|
+
*
|
|
60
|
+
* Forward slashes, no trailing separator — the same normalization
|
|
61
|
+
* `path-universe.ts` applies, so the two cannot disagree about what the root
|
|
62
|
+
* is. `undefined` when the project has no tsconfig.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Every directory a project was loaded from, by ts-morph `Project`.
|
|
66
|
+
*
|
|
67
|
+
* A **workspace has no single root.** `workspace([a, b])` sets
|
|
68
|
+
* `ArchProject.tsConfigPath` to the alphabetically first config, so resolving
|
|
69
|
+
* "the project root" from it silently meant *that one package*: measured on a
|
|
70
|
+
* two-package workspace, `'src/api/**'` matched `packages/alpha` and not
|
|
71
|
+
* `packages/beta`, and adding a package named `aaa` would have changed which
|
|
72
|
+
* one it meant. That is the machine-dependent shape bug 0011 already cost this
|
|
73
|
+
* project once — a rule scoped by a name nobody chose deliberately.
|
|
74
|
+
*
|
|
75
|
+
* So a file resolves against **the root that contains it**, and every root is
|
|
76
|
+
* kept. For a single-tsconfig project there is one, and the behaviour is
|
|
77
|
+
* exactly what it was.
|
|
78
|
+
*
|
|
79
|
+
* A `WeakMap` on the ts-morph project, because a predicate sees only an
|
|
80
|
+
* element: `sourceFile.getProject()` is the one handle both the predicate and
|
|
81
|
+
* the slice resolver can reach, and ts-morph itself records only the primary
|
|
82
|
+
* config.
|
|
83
|
+
*/
|
|
84
|
+
const rootsByProject = new WeakMap();
|
|
85
|
+
/**
|
|
86
|
+
* Record the directories a project was loaded from.
|
|
87
|
+
*
|
|
88
|
+
* Load-bearing for `workspace()`, which has several. For a single-tsconfig
|
|
89
|
+
* `project()` it is **defence in depth and not independently observable**:
|
|
90
|
+
* removing that call leaves every test green, because `rootOf` then falls
|
|
91
|
+
* through to ts-morph's `configFilePath`, which agrees. Recorded rather than
|
|
92
|
+
* papered over — a sabotage row that survives because the behaviour is
|
|
93
|
+
* genuinely redundant is a different thing from a missing guard, and the next
|
|
94
|
+
* person to see it green should not go hunting for a test to write.
|
|
95
|
+
*/
|
|
96
|
+
export function registerProjectRoots(tsMorphProject, tsConfigPaths) {
|
|
97
|
+
const roots = tsConfigPaths
|
|
98
|
+
.map((configPath) => rootFromTsConfigPath(configPath))
|
|
99
|
+
.filter((root) => root !== undefined);
|
|
100
|
+
if (roots.length > 0)
|
|
101
|
+
rootsByProject.set(tsMorphProject, roots);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The project root implied by a tsconfig path.
|
|
105
|
+
*
|
|
106
|
+
* Preferred wherever the caller holds the `ArchProject`, because it is the path
|
|
107
|
+
* the user named rather than what ts-morph recorded — `getCompilerOptions()
|
|
108
|
+
* .configFilePath` is `undefined` for an in-memory project even when the
|
|
109
|
+
* `ArchProject` carries a perfectly good path, and normalization then silently
|
|
110
|
+
* did not happen. The predicates cannot use this (they see only an element, by
|
|
111
|
+
* design, so the builder and `.satisfy()` spellings cannot diverge); the slice
|
|
112
|
+
* resolver can.
|
|
113
|
+
*/
|
|
114
|
+
export function rootFromTsConfigPath(tsConfigPath) {
|
|
115
|
+
if (tsConfigPath === '')
|
|
116
|
+
return undefined;
|
|
117
|
+
const normalized = tsConfigPath.replaceAll('\\', '/');
|
|
118
|
+
const lastSlash = normalized.lastIndexOf('/');
|
|
119
|
+
if (lastSlash === -1)
|
|
120
|
+
return undefined;
|
|
121
|
+
// A tsconfig AT the filesystem root gives `'/'`, not `''`. Returning `''`
|
|
122
|
+
// overloaded one value with two meanings — "no root known" and "the root is
|
|
123
|
+
// `/`" — and the three copies of this derivation disagreed about which:
|
|
124
|
+
// measured on `/tsconfig.json`, the rule discovered its file and `diagnose()`
|
|
125
|
+
// called the same glob dead, in one run. Reachable in a container that mounts
|
|
126
|
+
// the repository at `/`.
|
|
127
|
+
return lastSlash === 0 ? '/' : normalized.slice(0, lastSlash);
|
|
128
|
+
}
|
|
129
|
+
/** The prefix a path under `root` starts with. `'/'` is its own prefix. */
|
|
130
|
+
function prefixOf(root) {
|
|
131
|
+
return root === '/' ? '/' : `${root}/`;
|
|
132
|
+
}
|
|
133
|
+
export function rootOf(sourceFile, fallbackTsConfigPath) {
|
|
134
|
+
const filePath = sourceFile.getFilePath().replaceAll('\\', '/');
|
|
135
|
+
// The registered root that CONTAINS this file, longest first — a nested
|
|
136
|
+
// package's tsconfig must win over the repository's, or every file in it
|
|
137
|
+
// resolves against the outer root and the inner one never applies.
|
|
138
|
+
const registered = rootsByProject.get(sourceFile.getProject());
|
|
139
|
+
if (registered !== undefined) {
|
|
140
|
+
// Roots WERE registered for this project (a real `workspace()`) — fail
|
|
141
|
+
// CLOSED here (ADR-009) rather than falling through to the generic fallback
|
|
142
|
+
// below. That fallback resolves to the tie-break-winner's own tsconfig for a
|
|
143
|
+
// `workspace()`-built project, which is a specific, plausible-looking, WRONG
|
|
144
|
+
// answer for a file outside every registered package (a shared root-level
|
|
145
|
+
// `.d.ts`, a broad `include`/`references` reaching outside a package's own
|
|
146
|
+
// directory) — exactly the silent mis-scoping this module exists to
|
|
147
|
+
// eliminate, just relocated to the edges. `fallbackTsConfigPath` doesn't
|
|
148
|
+
// rescue it either: for a `workspace()` caller it is typically the primary
|
|
149
|
+
// config's own path (see `resolveByDefinition`'s `project.tsConfigPath`), so
|
|
150
|
+
// honoring it here would reintroduce the same bug through the back door.
|
|
151
|
+
//
|
|
152
|
+
// eess's own fix (plan 0148 Phase 1). The wholesale engine copy of plan 0165
|
|
153
|
+
// reverted it to `if (best !== undefined) return best`, which reads as a
|
|
154
|
+
// harmless guard and is in fact the fall-through. Pinned by
|
|
155
|
+
// `tests/core/project-relative.test.ts` · `a file outside every registered
|
|
156
|
+
// root of a real workspace() is unresolved, not silently the tie-break
|
|
157
|
+
// winner`.
|
|
158
|
+
const containing = registered
|
|
159
|
+
.filter((root) => filePath.startsWith(prefixOf(root)))
|
|
160
|
+
.sort((a, b) => b.length - a.length);
|
|
161
|
+
return containing[0];
|
|
162
|
+
}
|
|
163
|
+
// A project built without going through `project()`/`workspace()` — a test
|
|
164
|
+
// double, or an in-memory project, where ts-morph records no config path.
|
|
165
|
+
if (fallbackTsConfigPath !== undefined)
|
|
166
|
+
return rootFromTsConfigPath(fallbackTsConfigPath);
|
|
167
|
+
const configFilePath = sourceFile.getProject().getCompilerOptions().configFilePath;
|
|
168
|
+
return typeof configFilePath === 'string' ? rootFromTsConfigPath(configFilePath) : undefined;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* `absolutePath` relative to the project root, or `undefined` when it sits
|
|
172
|
+
* outside the root or the root is unknown.
|
|
173
|
+
*
|
|
174
|
+
* Never `path.relative`, which emits `../../..` for a path above the root and
|
|
175
|
+
* so encodes the root's depth — machine-dependent, and the mistake
|
|
176
|
+
* `path-universe.ts` documents avoiding for the same reason.
|
|
177
|
+
*/
|
|
178
|
+
export function relativeToRoot(sourceFile, absolutePath, fallbackTsConfigPath) {
|
|
179
|
+
const root = rootOf(sourceFile, fallbackTsConfigPath);
|
|
180
|
+
if (root === undefined)
|
|
181
|
+
return undefined;
|
|
182
|
+
const prefix = prefixOf(root);
|
|
183
|
+
return absolutePath.startsWith(prefix) ? absolutePath.slice(prefix.length) : undefined;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=project-relative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-relative.js","sourceRoot":"","sources":["../../src/core/project-relative.ts"],"names":[],"mappings":"AA4CA;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACpF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,6EAA6E;IAC7E,yEAAyE;IACzE,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,6EAA6E;IAC7E,wDAAwD;IACxD,EAAE;IACF,6EAA6E;IAC7E,6EAA6E;IAC7E,+CAA+C;IAC/C,4EAA4E;IAC5E,oEAAoE;IACpE,wEAAwE;IACxE,wEAAwE;IACxE,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAC9C,8EAA8E;IAC9E,4EAA4E;IAC5E,8EAA8E;IAC9E,2EAA2E;IAC3E,kCAAkC;IAClC,6EAA6E;IAC7E,sEAAsE;IACtE,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAClC,yEAAyE;IACzE,6EAA6E;IAC7E,2EAA2E;IAC3E,yEAAyE;IACzE,yEAAyE;IACzE,kCAAkC;IAClC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAC;AAED;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,cAAc,GAAG,IAAI,OAAO,EAAqC,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,cAA8B,E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AAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC7B,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACxF,CAAC"}
|
package/dist/core/project.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Project, type SourceFile } from 'ts-morph';
|
|
1
|
+
import { Project, type SourceFile, type CompilerOptions } from 'ts-morph';
|
|
2
2
|
/**
|
|
3
3
|
* A loaded TypeScript project. Returned by `project()`.
|
|
4
4
|
*
|
|
@@ -10,6 +10,12 @@ export interface ArchProject {
|
|
|
10
10
|
readonly tsConfigPath: string;
|
|
11
11
|
/** Returns all source files included by the tsconfig. */
|
|
12
12
|
getSourceFiles(): SourceFile[];
|
|
13
|
+
/**
|
|
14
|
+
* Resolved TypeScript compiler options (after `extends`), as `tsc` computes
|
|
15
|
+
* them. Optional so bare `ArchProject` literals (test doubles) stay valid;
|
|
16
|
+
* `project()` and `workspace()` always implement it. Used by `tsconfig()`.
|
|
17
|
+
*/
|
|
18
|
+
getCompilerOptions?(): CompilerOptions;
|
|
13
19
|
/**
|
|
14
20
|
* The underlying ts-morph Project.
|
|
15
21
|
* @internal Used by entry points — not part of the public API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA;AAOzE;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B,yDAAyD;IACzD,cAAc,IAAI,UAAU,EAAE,CAAA;IAE9B;;;;OAIG;IACH,kBAAkB,CAAC,IAAI,eAAe,CAAA;IAEtC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC3B;AAID;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAmCzD;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,WAAW,CAuE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAQxC"}
|
package/dist/core/project.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { ArchConfigError } from '@nielspeter/eess';
|
|
1
2
|
import { Project } from 'ts-morph';
|
|
2
3
|
import path from 'node:path';
|
|
4
|
+
import { clearRegisteredCaches } from '@nielspeter/eess/internal';
|
|
3
5
|
import fs from 'node:fs';
|
|
6
|
+
import { registerProjectRoots } from './project-relative.js';
|
|
7
|
+
import { registerRootCompilerOptions } from './per-root-compiler-options.js';
|
|
4
8
|
const cache = new Map();
|
|
5
9
|
/**
|
|
6
10
|
* Load a TypeScript project from a tsconfig.json path.
|
|
@@ -19,18 +23,22 @@ export function project(tsConfigPath) {
|
|
|
19
23
|
return cached;
|
|
20
24
|
}
|
|
21
25
|
if (!fs.existsSync(resolved)) {
|
|
22
|
-
throw new
|
|
26
|
+
throw new ArchConfigError('project', `tsconfig not found: ${resolved}\n` +
|
|
23
27
|
`Provide a valid path to tsconfig.json, e.g. project('tsconfig.json') or project('./packages/app/tsconfig.json')`);
|
|
24
28
|
}
|
|
25
29
|
const tsMorphProject = new Project({
|
|
26
30
|
tsConfigFilePath: resolved,
|
|
27
31
|
});
|
|
32
|
+
registerProjectRoots(tsMorphProject, [resolved]);
|
|
28
33
|
const archProject = {
|
|
29
34
|
tsConfigPath: resolved,
|
|
30
35
|
_project: tsMorphProject,
|
|
31
36
|
getSourceFiles() {
|
|
32
37
|
return tsMorphProject.getSourceFiles();
|
|
33
38
|
},
|
|
39
|
+
getCompilerOptions() {
|
|
40
|
+
return tsMorphProject.getCompilerOptions();
|
|
41
|
+
},
|
|
34
42
|
};
|
|
35
43
|
cache.set(resolved, archProject);
|
|
36
44
|
return archProject;
|
|
@@ -67,7 +75,7 @@ const workspaceCache = new Map();
|
|
|
67
75
|
*/
|
|
68
76
|
export function workspace(tsConfigPaths) {
|
|
69
77
|
if (tsConfigPaths.length === 0) {
|
|
70
|
-
throw new
|
|
78
|
+
throw new ArchConfigError('workspace', 'workspace() requires at least one tsconfig path.\n' +
|
|
71
79
|
'Example: workspace(["apps/web/tsconfig.json", "packages/shared/tsconfig.json"])');
|
|
72
80
|
}
|
|
73
81
|
// Sort resolved paths so the primary config (first) is deterministic
|
|
@@ -85,14 +93,14 @@ export function workspace(tsConfigPaths) {
|
|
|
85
93
|
// Validate all paths exist before creating the project
|
|
86
94
|
for (const resolved of resolvedPaths) {
|
|
87
95
|
if (!fs.existsSync(resolved)) {
|
|
88
|
-
throw new
|
|
96
|
+
throw new ArchConfigError('workspace', `tsconfig not found: ${resolved}\n` +
|
|
89
97
|
`Provide valid paths to tsconfig.json files in the workspace() call.`);
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
100
|
// Create project with the alphabetically first tsconfig's compiler options
|
|
93
101
|
const primaryConfig = resolvedPaths[0];
|
|
94
102
|
if (!primaryConfig)
|
|
95
|
-
throw new
|
|
103
|
+
throw new ArchConfigError('workspace', 'No resolved paths available');
|
|
96
104
|
const tsMorphProject = new Project({
|
|
97
105
|
tsConfigFilePath: primaryConfig,
|
|
98
106
|
});
|
|
@@ -102,12 +110,24 @@ export function workspace(tsConfigPaths) {
|
|
|
102
110
|
if (configPath)
|
|
103
111
|
tsMorphProject.addSourceFilesFromTsConfig(configPath);
|
|
104
112
|
}
|
|
113
|
+
// EVERY config, not just the primary: a relative glob resolves against the
|
|
114
|
+
// package that contains the file, so `'src/api/**'` means each package's
|
|
115
|
+
// `src/api` rather than the alphabetically-first one's (bug 0035).
|
|
116
|
+
registerProjectRoots(tsMorphProject, resolvedPaths);
|
|
117
|
+
// Same argument, one field over: compiler options are per package too, and
|
|
118
|
+
// `addSourceFilesFromTsConfig` above adds files WITHOUT adding options — so
|
|
119
|
+
// `getCompilerOptions()` answers for the primary config whatever package a file is in.
|
|
120
|
+
// Bug 0058, measured wrong in both directions before this line existed.
|
|
121
|
+
registerRootCompilerOptions(tsMorphProject, resolvedPaths);
|
|
105
122
|
const archProject = {
|
|
106
123
|
tsConfigPath: primaryConfig,
|
|
107
124
|
_project: tsMorphProject,
|
|
108
125
|
getSourceFiles() {
|
|
109
126
|
return tsMorphProject.getSourceFiles();
|
|
110
127
|
},
|
|
128
|
+
getCompilerOptions() {
|
|
129
|
+
return tsMorphProject.getCompilerOptions();
|
|
130
|
+
},
|
|
111
131
|
};
|
|
112
132
|
workspaceCache.set(cacheKey, archProject);
|
|
113
133
|
return archProject;
|
|
@@ -123,5 +143,10 @@ export function workspace(tsConfigPaths) {
|
|
|
123
143
|
export function resetProjectCache() {
|
|
124
144
|
cache.clear();
|
|
125
145
|
workspaceCache.clear();
|
|
146
|
+
// Plan 0075/0076: the memoized element collections and module edges are keyed
|
|
147
|
+
// on objects this function replaces, so `project()` callers are covered by
|
|
148
|
+
// identity alone. A consumer holding their OWN `ArchProject` is not, and this
|
|
149
|
+
// is their documented way to invalidate after mutating the ts-morph project.
|
|
150
|
+
clearRegisteredCaches();
|
|
126
151
|
}
|
|
127
152
|
//# sourceMappingURL=project.js.map
|
package/dist/core/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAA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