gitnexus 1.6.11-rc.8 → 1.6.11
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 +95 -26
- package/dist/_shared/graph/types.d.ts +81 -2
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/integrations/circuit-breaker.d.ts.map +1 -1
- package/dist/_shared/integrations/circuit-breaker.js.map +1 -1
- package/dist/_shared/integrations/resilient-fetch.d.ts.map +1 -1
- package/dist/_shared/integrations/resilient-fetch.js.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +2 -0
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/languages.d.ts +2 -1
- package/dist/_shared/languages.d.ts.map +1 -1
- package/dist/_shared/languages.js +1 -0
- package/dist/_shared/languages.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +2 -2
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +4 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/scope-resolution/evidence-weights.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/finalize-algorithm.js +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.d.ts +3 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.js +4 -0
- package/dist/_shared/scope-resolution/language-classification.js.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +10 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +15 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +4 -0
- package/dist/cli/ai-context.js +90 -14
- package/dist/cli/analyze-config.js +14 -0
- package/dist/cli/analyze-options.d.ts +14 -0
- package/dist/cli/analyze-watch.d.ts +20 -0
- package/dist/cli/analyze-watch.js +434 -0
- package/dist/cli/analyze.js +27 -9
- package/dist/cli/auto-sync.d.ts +1 -0
- package/dist/cli/auto-sync.js +107 -0
- package/dist/cli/command-banner.d.ts +15 -0
- package/dist/cli/command-banner.js +42 -0
- package/dist/cli/detect-changes-format.js +21 -0
- package/dist/cli/doctor.d.ts +7 -0
- package/dist/cli/doctor.js +14 -0
- package/dist/cli/group.js +7 -1
- package/dist/cli/help-i18n.js +4 -0
- package/dist/cli/i18n/en.d.ts +18 -3
- package/dist/cli/i18n/en.js +18 -3
- package/dist/cli/i18n/resources.d.ts +33 -3
- package/dist/cli/i18n/zh-CN.d.ts +15 -0
- package/dist/cli/i18n/zh-CN.js +18 -3
- package/dist/cli/index.js +34 -7
- package/dist/cli/mcp.d.ts +15 -0
- package/dist/cli/mcp.js +44 -0
- package/dist/cli/optional-grammars.d.ts +3 -2
- package/dist/cli/optional-grammars.js +19 -3
- package/dist/cli/setup.js +41 -15
- package/dist/cli/update-notice.d.ts +34 -0
- package/dist/cli/update-notice.js +91 -0
- package/dist/cli/update.d.ts +21 -0
- package/dist/cli/update.js +93 -0
- package/dist/cli/watch.d.ts +1 -20
- package/dist/cli/watch.js +5 -371
- package/dist/core/analysis-feature-registry.d.ts +2 -0
- package/dist/core/analysis-feature-registry.js +15 -0
- package/dist/core/analyzer-identity.js +21 -3
- package/dist/core/auto-sync/analysis-worker-launch.d.ts +30 -0
- package/dist/core/auto-sync/analysis-worker-launch.js +166 -0
- package/dist/core/auto-sync/config.d.ts +33 -0
- package/dist/core/auto-sync/config.js +320 -0
- package/dist/core/auto-sync/index.d.ts +6 -0
- package/dist/core/auto-sync/index.js +6 -0
- package/dist/core/auto-sync/path-security.d.ts +9 -0
- package/dist/core/auto-sync/path-security.js +251 -0
- package/dist/core/auto-sync/repo.d.ts +1 -0
- package/dist/core/auto-sync/repo.js +6 -0
- package/dist/core/auto-sync/runner.d.ts +44 -0
- package/dist/core/auto-sync/runner.js +428 -0
- package/dist/core/auto-sync/starter.d.ts +50 -0
- package/dist/core/auto-sync/starter.js +497 -0
- package/dist/core/auto-sync/state.d.ts +37 -0
- package/dist/core/auto-sync/state.js +119 -0
- package/dist/core/group/config-parser.js +8 -1
- package/dist/core/group/cross-impact.d.ts +3 -0
- package/dist/core/group/cross-impact.js +36 -4
- package/dist/core/group/extractors/http-patterns/java.js +22 -8
- package/dist/core/group/extractors/http-patterns/kotlin.js +86 -31
- package/dist/core/group/extractors/http-patterns/node.js +145 -8
- package/dist/core/group/extractors/http-patterns/python.js +11 -7
- package/dist/core/group/extractors/http-route-extractor.js +63 -17
- package/dist/core/group/extractors/java-workspace-extractor.js +244 -31
- package/dist/core/group/group-lock.js +5 -6
- package/dist/core/group/normalization.d.ts +38 -1
- package/dist/core/group/normalization.js +59 -3
- package/dist/core/group/service.d.ts +11 -0
- package/dist/core/group/service.js +13 -1
- package/dist/core/group/storage.js +2 -2
- package/dist/core/group/sync.d.ts +24 -1
- package/dist/core/group/sync.js +46 -8
- package/dist/core/group/types.d.ts +13 -0
- package/dist/core/incremental/derived-writeback.d.ts +36 -0
- package/dist/core/incremental/derived-writeback.js +68 -0
- package/dist/core/incremental/spring-config-drift.d.ts +12 -0
- package/dist/core/incremental/spring-config-drift.js +46 -0
- package/dist/core/incremental/subgraph-extract.d.ts +7 -4
- package/dist/core/incremental/subgraph-extract.js +30 -5
- package/dist/core/ingestion/asyncapi/document.d.ts +226 -0
- package/dist/core/ingestion/asyncapi/document.js +758 -0
- package/dist/core/ingestion/asyncapi/protocol.d.ts +79 -0
- package/dist/core/ingestion/asyncapi/protocol.js +203 -0
- package/dist/core/ingestion/call-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/zig.js +4 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.d.ts +100 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.js +319 -0
- package/dist/core/ingestion/call-processor.js +3 -1
- package/dist/core/ingestion/class-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/zig.js +32 -0
- package/dist/core/ingestion/class-extractors/generic.js +4 -1
- package/dist/core/ingestion/class-types.d.ts +6 -2
- package/dist/core/ingestion/destination-key.d.ts +59 -0
- package/dist/core/ingestion/destination-key.js +61 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +6 -2
- package/dist/core/ingestion/entry-point-scoring.js +8 -44
- package/dist/core/ingestion/export-detection.d.ts +37 -0
- package/dist/core/ingestion/export-detection.js +60 -0
- package/dist/core/ingestion/field-extractors/configs/zig.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/zig.js +49 -0
- package/dist/core/ingestion/field-extractors/generic.d.ts +1 -1
- package/dist/core/ingestion/field-extractors/generic.js +12 -1
- package/dist/core/ingestion/frameworks/spring/actuator-runtime.d.ts +26 -0
- package/dist/core/ingestion/frameworks/spring/actuator-runtime.js +843 -0
- package/dist/core/ingestion/frameworks/spring/analysis-features.d.ts +5 -0
- package/dist/core/ingestion/frameworks/spring/analysis-features.js +9 -0
- package/dist/core/ingestion/frameworks/spring/annotation-arguments.js +8 -1
- package/dist/core/ingestion/frameworks/spring/argument-facts.d.ts +80 -0
- package/dist/core/ingestion/frameworks/spring/argument-facts.js +85 -0
- package/dist/core/ingestion/frameworks/spring/config-bindings.d.ts +1 -0
- package/dist/core/ingestion/frameworks/spring/config-bindings.js +2 -1
- package/dist/core/ingestion/frameworks/spring/destinations.d.ts +539 -0
- package/dist/core/ingestion/frameworks/spring/destinations.js +840 -0
- package/dist/core/ingestion/frameworks/spring/dynamic-lookups.d.ts +22 -0
- package/dist/core/ingestion/frameworks/spring/dynamic-lookups.js +124 -0
- package/dist/core/ingestion/frameworks/spring/message-producers.d.ts +78 -0
- package/dist/core/ingestion/frameworks/spring/message-producers.js +90 -0
- package/dist/core/ingestion/frameworks/spring/non-http-handlers.d.ts +29 -0
- package/dist/core/ingestion/frameworks/spring/vendor-prefixes.d.ts +7 -0
- package/dist/core/ingestion/frameworks/spring/vendor-prefixes.js +22 -0
- package/dist/core/ingestion/import-resolvers/configs/zig.d.ts +13 -0
- package/dist/core/ingestion/import-resolvers/configs/zig.js +26 -0
- package/dist/core/ingestion/import-resolvers/zig.d.ts +34 -0
- package/dist/core/ingestion/import-resolvers/zig.js +193 -0
- package/dist/core/ingestion/language-config.d.ts +177 -0
- package/dist/core/ingestion/language-config.js +719 -0
- package/dist/core/ingestion/language-provider.d.ts +178 -1
- package/dist/core/ingestion/language-provider.js +22 -0
- package/dist/core/ingestion/languages/csharp/razor-view-components.d.ts +62 -0
- package/dist/core/ingestion/languages/csharp/razor-view-components.js +954 -0
- package/dist/core/ingestion/languages/csharp/resolution-config.d.ts +3 -0
- package/dist/core/ingestion/languages/csharp/resolution-config.js +6 -1
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -0
- package/dist/core/ingestion/languages/index.d.ts +1 -0
- package/dist/core/ingestion/languages/index.js +2 -0
- package/dist/core/ingestion/languages/java/analysis-features.d.ts +1 -1
- package/dist/core/ingestion/languages/java/analysis-features.js +14 -6
- package/dist/core/ingestion/languages/java/capture-side-channel.d.ts +8 -0
- package/dist/core/ingestion/languages/java/capture-side-channel.js +34 -0
- package/dist/core/ingestion/languages/java/captures.js +22 -1
- package/dist/core/ingestion/languages/java/lombok-synthesizer.d.ts +42 -0
- package/dist/core/ingestion/languages/java/lombok-synthesizer.js +439 -0
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -0
- package/dist/core/ingestion/languages/java/spring-actuator.d.ts +2 -0
- package/dist/core/ingestion/languages/java/spring-actuator.js +62 -0
- package/dist/core/ingestion/languages/java/spring-di.d.ts +17 -1
- package/dist/core/ingestion/languages/java/spring-di.js +44 -2
- package/dist/core/ingestion/languages/java/spring-dynamic-lookup.d.ts +8 -0
- package/dist/core/ingestion/languages/java/spring-dynamic-lookup.js +62 -0
- package/dist/core/ingestion/languages/java/spring-message-producers.d.ts +20 -0
- package/dist/core/ingestion/languages/java/spring-message-producers.js +83 -0
- package/dist/core/ingestion/languages/java/spring-non-http-handlers.d.ts +11 -1
- package/dist/core/ingestion/languages/java/spring-non-http-handlers.js +13 -3
- package/dist/core/ingestion/languages/java.js +18 -8
- package/dist/core/ingestion/languages/jvm/accessor-synthesis.d.ts +99 -0
- package/dist/core/ingestion/languages/jvm/accessor-synthesis.js +173 -0
- package/dist/core/ingestion/languages/jvm/beanspec.d.ts +17 -0
- package/dist/core/ingestion/languages/jvm/beanspec.js +42 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +15 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +50 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +24 -1
- package/dist/core/ingestion/languages/kotlin/lombok-synthesizer.d.ts +26 -0
- package/dist/core/ingestion/languages/kotlin/lombok-synthesizer.js +417 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +4 -0
- package/dist/core/ingestion/languages/kotlin/spring-actuator.d.ts +4 -0
- package/dist/core/ingestion/languages/kotlin/spring-actuator.js +172 -0
- package/dist/core/ingestion/languages/kotlin/spring-config-bindings.d.ts +18 -0
- package/dist/core/ingestion/languages/kotlin/spring-config-bindings.js +411 -0
- package/dist/core/ingestion/languages/kotlin/spring-di.d.ts +51 -1
- package/dist/core/ingestion/languages/kotlin/spring-di.js +86 -6
- package/dist/core/ingestion/languages/kotlin/spring-dynamic-lookup.d.ts +8 -0
- package/dist/core/ingestion/languages/kotlin/spring-dynamic-lookup.js +77 -0
- package/dist/core/ingestion/languages/kotlin/spring-message-producers.d.ts +17 -0
- package/dist/core/ingestion/languages/kotlin/spring-message-producers.js +119 -0
- package/dist/core/ingestion/languages/kotlin/spring-non-http-handlers.d.ts +16 -0
- package/dist/core/ingestion/languages/kotlin/spring-non-http-handlers.js +77 -2
- package/dist/core/ingestion/languages/kotlin.js +24 -0
- package/dist/core/ingestion/languages/python.js +2 -0
- package/dist/core/ingestion/languages/rust/query.js +8 -8
- package/dist/core/ingestion/languages/zig/captures.d.ts +260 -0
- package/dist/core/ingestion/languages/zig/captures.js +2070 -0
- package/dist/core/ingestion/languages/zig/index.d.ts +4 -0
- package/dist/core/ingestion/languages/zig/index.js +4 -0
- package/dist/core/ingestion/languages/zig/interpret.d.ts +36 -0
- package/dist/core/ingestion/languages/zig/interpret.js +176 -0
- package/dist/core/ingestion/languages/zig/query.d.ts +3 -0
- package/dist/core/ingestion/languages/zig/query.js +426 -0
- package/dist/core/ingestion/languages/zig/range-binding.d.ts +37 -0
- package/dist/core/ingestion/languages/zig/range-binding.js +373 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.d.ts +12 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.js +58 -0
- package/dist/core/ingestion/languages/zig/simple-hooks.d.ts +25 -0
- package/dist/core/ingestion/languages/zig/simple-hooks.js +143 -0
- package/dist/core/ingestion/languages/zig.d.ts +32 -0
- package/dist/core/ingestion/languages/zig.js +130 -0
- package/dist/core/ingestion/method-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/zig.js +120 -0
- package/dist/core/ingestion/method-extractors/generic.js +16 -4
- package/dist/core/ingestion/method-types.d.ts +10 -4
- package/dist/core/ingestion/model/field-registry.d.ts +3 -3
- package/dist/core/ingestion/model/field-registry.js +11 -7
- package/dist/core/ingestion/model/method-registry.d.ts +3 -3
- package/dist/core/ingestion/model/method-registry.js +13 -8
- package/dist/core/ingestion/model/registration-table.js +3 -0
- package/dist/core/ingestion/model/type-registry.js +8 -4
- package/dist/core/ingestion/pipeline-phases/di.js +47 -14
- package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
- package/dist/core/ingestion/pipeline-phases/index.js +1 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +7 -1
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +79 -91
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +2 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +39 -4
- package/dist/core/ingestion/pipeline-phases/routes.js +27 -18
- package/dist/core/ingestion/pipeline-phases/runner.d.ts +4 -1
- package/dist/core/ingestion/pipeline-phases/runner.js +34 -14
- package/dist/core/ingestion/pipeline-phases/scan.js +82 -1
- package/dist/core/ingestion/pipeline-phases/spring-auto-configuration.d.ts +2 -0
- package/dist/core/ingestion/pipeline-phases/spring-auto-configuration.js +8 -0
- package/dist/core/ingestion/pipeline-phases/spring-destinations.d.ts +123 -0
- package/dist/core/ingestion/pipeline-phases/spring-destinations.js +688 -0
- package/dist/core/ingestion/pipeline.d.ts +30 -1
- package/dist/core/ingestion/pipeline.js +52 -14
- package/dist/core/ingestion/resolve-references.js +5 -0
- package/dist/core/ingestion/route-extractors/constant-resolver.d.ts +16 -0
- package/dist/core/ingestion/route-extractors/constant-resolver.js +10 -0
- package/dist/core/ingestion/route-extractors/java-const-resolver.d.ts +27 -1
- package/dist/core/ingestion/route-extractors/java-const-resolver.js +161 -13
- package/dist/core/ingestion/route-extractors/kotlin-const-resolver.d.ts +12 -18
- package/dist/core/ingestion/route-extractors/kotlin-const-resolver.js +214 -33
- package/dist/core/ingestion/route-extractors/kotlin-spring.d.ts +13 -0
- package/dist/core/ingestion/route-extractors/kotlin-spring.js +259 -0
- package/dist/core/ingestion/route-extractors/python-decorator-handler.d.ts +6 -0
- package/dist/core/ingestion/route-extractors/python-decorator-handler.js +16 -0
- package/dist/core/ingestion/route-extractors/spring-shared.d.ts +30 -1
- package/dist/core/ingestion/route-extractors/spring-shared.js +77 -9
- package/dist/core/ingestion/route-extractors/spring.js +9 -5
- package/dist/core/ingestion/scope-extractor.js +8 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +62 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +4 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +2 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +28 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +11 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.d.ts +23 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +24 -3
- package/dist/core/ingestion/scope-resolution/passes/callable-value-flow.d.ts +11 -1
- package/dist/core/ingestion/scope-resolution/passes/callable-value-flow.js +26 -6
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.d.ts +11 -0
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +29 -3
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +8 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +35 -9
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +1 -4
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +277 -9
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +2 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +7 -3
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +43 -9
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +71 -10
- package/dist/core/ingestion/tree-sitter-queries.d.ts +1 -0
- package/dist/core/ingestion/tree-sitter-queries.js +161 -0
- package/dist/core/ingestion/type-extractors/zig.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/zig.js +17 -0
- package/dist/core/ingestion/utils/ast-helpers.d.ts +40 -1
- package/dist/core/ingestion/utils/ast-helpers.js +124 -6
- package/dist/core/ingestion/utils/callable-flow-captures.d.ts +9 -0
- package/dist/core/ingestion/utils/callable-flow-captures.js +75 -14
- package/dist/core/ingestion/utils/test-file-path.d.ts +28 -0
- package/dist/core/ingestion/utils/test-file-path.js +87 -0
- package/dist/core/ingestion/variable-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/zig.js +71 -0
- package/dist/core/ingestion/workers/parse-worker.js +85 -14
- package/dist/core/install-context.d.ts +4 -0
- package/dist/core/install-context.js +152 -0
- package/dist/core/lbug/csv-generator.d.ts +10 -1
- package/dist/core/lbug/csv-generator.js +92 -22
- package/dist/core/lbug/graph-emit-sink.d.ts +3 -2
- package/dist/core/lbug/graph-emit-sink.js +4 -2
- package/dist/core/lbug/lbug-adapter.d.ts +100 -5
- package/dist/core/lbug/lbug-adapter.js +236 -24
- package/dist/core/lbug/schema.d.ts +6 -5
- package/dist/core/lbug/schema.js +84 -22
- package/dist/core/net/url-guard.d.ts +6 -0
- package/dist/core/net/url-guard.js +147 -0
- package/dist/core/package-version.d.ts +5 -0
- package/dist/core/package-version.js +10 -0
- package/dist/core/run-analyze.d.ts +21 -4
- package/dist/core/run-analyze.js +426 -117
- package/dist/core/search/fts-indexes.d.ts +19 -1
- package/dist/core/search/fts-indexes.js +28 -1
- package/dist/core/tree-sitter/parser-loader.js +16 -0
- package/dist/core/update-cache.d.ts +39 -0
- package/dist/core/update-cache.js +141 -0
- package/dist/core/update-check.d.ts +31 -0
- package/dist/core/update-check.js +274 -0
- package/dist/mcp/local/local-backend.d.ts +27 -13
- package/dist/mcp/local/local-backend.js +148 -60
- package/dist/mcp/repository-policy.d.ts +5 -1
- package/dist/mcp/repository-policy.js +48 -4
- package/dist/mcp/resources.js +10 -1
- package/dist/mcp/server.js +8 -9
- package/dist/mcp/tools.js +32 -22
- package/dist/server/analyze-launch.d.ts +2 -0
- package/dist/server/analyze-launch.js +2 -0
- package/dist/server/analyze-worker-protocol.d.ts +6 -1
- package/dist/server/analyze-worker.d.ts +1 -0
- package/dist/server/analyze-worker.js +38 -20
- package/dist/server/api.d.ts +5 -1
- package/dist/server/api.js +105 -88
- package/dist/server/git-clone.d.ts +40 -16
- package/dist/server/git-clone.js +253 -199
- package/dist/server/grep-params.d.ts +18 -0
- package/dist/server/grep-params.js +83 -0
- package/dist/server/grep-scan.d.ts +23 -0
- package/dist/server/grep-scan.js +107 -0
- package/dist/server/grep-worker.d.ts +1 -0
- package/dist/server/grep-worker.js +12 -0
- package/dist/server/mcp-http.d.ts +8 -0
- package/dist/server/mcp-http.js +16 -1
- package/dist/server/update-controller.d.ts +29 -0
- package/dist/server/update-controller.js +82 -0
- package/dist/storage/file-lock.d.ts +15 -0
- package/dist/storage/file-lock.js +155 -0
- package/dist/storage/fs-atomic.d.ts +24 -0
- package/dist/storage/fs-atomic.js +86 -2
- package/dist/storage/global-dir.d.ts +2 -0
- package/dist/storage/global-dir.js +6 -0
- package/dist/storage/parse-cache.d.ts +45 -7
- package/dist/storage/parse-cache.js +189 -42
- package/dist/storage/parsedfile-store.d.ts +41 -60
- package/dist/storage/parsedfile-store.js +247 -171
- package/dist/storage/repo-manager.d.ts +10 -4
- package/dist/storage/repo-manager.js +35 -25
- package/dist/storage/repo-meta.d.ts +34 -0
- package/dist/storage/v8-sidecar.d.ts +48 -0
- package/dist/storage/v8-sidecar.js +347 -0
- package/dist/types/pipeline.d.ts +14 -0
- package/dist/utils/process-identity.d.ts +2 -0
- package/dist/utils/process-identity.js +35 -0
- package/package.json +10 -4
- package/scripts/assert-web-assets.mjs +35 -0
- package/scripts/build-web.js +72 -0
- package/scripts/build.js +31 -28
- package/scripts/cross-platform-tests.ts +5 -0
- package/skills/gitnexus-cli.md +5 -1
- package/web/assets/ProcessFlowModal-DAeX2BHW.js +24 -0
- package/web/assets/{abnfDiagram-QNN2D4NM-Cq2djWWe.js → abnfDiagram-PAR5IXJI-J3OdeHLl.js} +1 -1
- package/web/assets/{agent-BWAXPjC5.js → agent-BMRqXorA.js} +6 -4
- package/web/assets/architecture-7GRP2DOG-M7G3SWCO-G3sWyX6M.js +1 -0
- package/web/assets/architectureDiagram-2PNWDENW-ysKcRlGT.js +36 -0
- package/web/assets/blockDiagram-PUWGUBOA-oLXTa1lY.js +129 -0
- package/web/assets/c4Diagram-3NLNHZP5-D3iu4eC0.js +38 -0
- package/web/assets/{chunk-2SREHG4O-Dip42xOq.js → chunk-2NMSUPJH-B24w-wng.js} +1 -1
- package/web/assets/{chunk-VJFVEZTB-CX66F2ep.js → chunk-32MCUW2P-ByUyt0Sa.js} +3 -3
- package/web/assets/{chunk-4RFN2BYJ-DHHWuC-n.js → chunk-3NPNU5GP-DocZ07Sg.js} +1 -1
- package/web/assets/{chunk-XNMVGMAZ-Cg_LnPtj.js → chunk-3SMGFRGC-CAu4JRLv.js} +1 -1
- package/web/assets/{chunk-W44A43WB-BN8EQc_u.js → chunk-4CAJECRU-DRYMwG9z.js} +1 -1
- package/web/assets/chunk-4OADUZ5Q-CxrSvOwZ.js +10 -0
- package/web/assets/{chunk-DMV4VAQV-Bn6WXDSX.js → chunk-5IQCK5RY-CCMhl4so.js} +2 -2
- package/web/assets/{chunk-RRFMTAIC-CMN0wcYA.js → chunk-5MVFYWFU-Db9KvrYO.js} +1 -1
- package/web/assets/chunk-CLS4B6BI-Uvx5QNsu.js +168 -0
- package/web/assets/chunk-DZP67EKU-B3Mt380j.js +70 -0
- package/web/assets/{chunk-6L755F7B-CMhLBxi2.js → chunk-EICP7K5X-CqwE9hui.js} +1 -1
- package/web/assets/{chunk-BI6VK774-D0oaWk8V.js → chunk-GDY2UAB4-CtQQR0a8.js} +1 -1
- package/web/assets/chunk-H7VHZCWX-CE1nAmt6.js +1 -0
- package/web/assets/chunk-IJBDOHL6-BUKtY6oF.js +1 -0
- package/web/assets/{chunk-OIYT25JQ-CQ6KOZGX.js → chunk-JFFVMJIA-0fJenqia.js} +1 -1
- package/web/assets/{chunk-HNC4WDU7-DoU3KnA7.js → chunk-JZGDI5JK-BeTMSSkJ.js} +1 -1
- package/web/assets/{chunk-EQFTRU2I-1ix7TzW9.js → chunk-KD6SPIPN-Qp1Pflah.js} +1 -1
- package/web/assets/chunk-NF366YI6-CpSpya3n.js +231 -0
- package/web/assets/chunk-NUDPKBEF-CU1-BQIW.js +34 -0
- package/web/assets/{chunk-SATU7PGQ-B1zhgOvc.js → chunk-OJINMHTS-zOCQe4eI.js} +1 -1
- package/web/assets/{chunk-E5QJAATJ-dh-5CtIV.js → chunk-Q6NGPIAH-yyBomb63.js} +1 -1
- package/web/assets/chunk-QJSWEUOL-D_rf9gPD.js +128 -0
- package/web/assets/chunk-R7JDMUKV-CRoqKpD6.js +1 -0
- package/web/assets/{chunk-VE5CLXGZ-C1vB7wpY.js → chunk-RCXAM2GK-CUqrWQDV.js} +1 -1
- package/web/assets/{chunk-66DQ2XMT-CM0xjFAN.js → chunk-RT4MAWR3-zXy9-Lvt.js} +1 -1
- package/web/assets/{chunk-TZUXEDM2-B7p9AcTw.js → chunk-SFMINX4W-J2UrvMpD.js} +1 -1
- package/web/assets/{chunk-LORZLZWG-B57uGw2N.js → chunk-SLDQ463B-CHY6e_bQ.js} +2 -2
- package/web/assets/{chunk-FWYVLQTC-BgDItRzJ.js → chunk-TCEHX7R3-CXPDEVbm.js} +1 -1
- package/web/assets/{chunk-224SPVON-B8gxtXpy.js → chunk-VQC2EELJ-Dc8fIy4R.js} +1 -1
- package/web/assets/chunk-VRZKL3EH-DB3KixTQ.js +1 -0
- package/web/assets/{chunk-A7VWPJGB-B4O3oQdQ.js → chunk-VTHDQ7BV-b7FsPQZO.js} +1 -1
- package/web/assets/chunk-VY2OSTJR-Dkgc3Brg.js +2 -0
- package/web/assets/chunk-WUBWJARI-7FwILJ3k.js +2 -0
- package/web/assets/{chunk-D6VWDJW2-BxcBdZ9c.js → chunk-YBMQ5JGJ-BSnyWZmd.js} +1 -1
- package/web/assets/chunk-YDMLL4PJ-IHhMngTz.js +2 -0
- package/web/assets/chunk-Z6V44ARX-BjCEsF0Q.js +62 -0
- package/web/assets/chunk-ZJJ7VQJP-Dz089b-K.js +321 -0
- package/web/assets/chunk-ZNLK7HRR-B0iFpmW4.js +1 -0
- package/web/assets/chunk-ZQN7UHIL-Cy7KAjQt.js +1 -0
- package/web/assets/{chunk-L5GCOVLC-CE2w8Nm_.js → chunk-ZS6VBONO-DBjJO0w9.js} +2 -2
- package/web/assets/{chunk-NV3KIAZN-5yvcpMiu.js → chunk-ZUNWM646-DNRJyNPe.js} +1 -1
- package/web/assets/classDiagram-FGAMPOII-C5Ibyode.js +1 -0
- package/web/assets/classDiagram-v2-AI5RJEK4-C5Ibyode.js +1 -0
- package/web/assets/{cose-bilkent-RZA4XIPR-BHpK4Crp.js → cose-bilkent-Q72C2OJ3-DMeFXnK8.js} +1 -1
- package/web/assets/cynefin-OW5HDTMX-6OCTWOGG-vlqakYcO.js +1 -0
- package/web/assets/{cynefinDiagram-TR7LZUCG-C3Iar9lZ.js → cynefinDiagram-2OOWUY4M-BY6DZkTt.js} +1 -1
- package/web/assets/dagre-MPVFI544-DWO70fy_.js +4 -0
- package/web/assets/diagram-AE4NWXFW-f7JRVRUL.js +24 -0
- package/web/assets/{diagram-L7DVE3PN-GIRyVUtt.js → diagram-BUJID5UG-BXZv1rCS.js} +2 -2
- package/web/assets/{diagram-JCD7PQ7C-DC5-9FRr.js → diagram-C44CZ5NI-CRNfvjCq.js} +1 -1
- package/web/assets/diagram-EYOLEXXS-DZOjKQVE.js +30 -0
- package/web/assets/diagram-P7B6PWOJ-D3SQmw3_.js +3 -0
- package/web/assets/{ebnfDiagram-DRHRQJWO-D8_CI4ZF.js → ebnfDiagram-FTPZ3PV6-jKWpIDN2.js} +1 -1
- package/web/assets/erDiagram-H3ERR26V-BqJntEuJ.js +99 -0
- package/web/assets/eventmodeling-NTZA5JFV-WKSWQHFS-Bq4FqtBL.js +1 -0
- package/web/assets/flowDiagram-YHGXBVSY-Dnlk2bEu.js +1 -0
- package/web/assets/ganttDiagram-RWFTB7ED-Bl6Y1K5T.js +292 -0
- package/web/assets/gitGraph-4MIJSDKK-JH2HKYUO-B3yc4GkH.js +1 -0
- package/web/assets/gitGraphDiagram-MAR6GKOP-CkNvsrdw.js +106 -0
- package/web/assets/{index-CJDpyH-n.css → index-C2_aej58.css} +1 -1
- package/web/assets/{index-DDRie6_8.js → index-Dj3vQOHK.js} +51 -51
- package/web/assets/info-A6RAGUB7-3TX3OFWW-BM3N5_Dv.js +1 -0
- package/web/assets/infoDiagram-LV547AFH-COkFutAf.js +2 -0
- package/web/assets/{ishikawaDiagram-4JDSWWDM-DmqWtjkl.js → ishikawaDiagram-PUJQGNDS-Bb8FylSR.js} +2 -2
- package/web/assets/{journeyDiagram-QUS3FAKT-XAzVzrQW.js → journeyDiagram-EW5QJT4W-BzoHUBhM.js} +4 -4
- package/web/assets/{kanban-definition-D4L7SQKK-YurRnmYn.js → kanban-definition-JSQERAZB-Uy2Pi0yQ.js} +4 -4
- package/web/assets/katex-CZ4GXH2S-C0Fcou7U.js +257 -0
- package/web/assets/{mindmap-definition-66QP5TD6-ChrWWnil.js → mindmap-definition-VBJCLQLM-B-CnOnt_.js} +3 -3
- package/web/assets/packet-AYTQ26CC-MKII6P3Y-Bd52ZE3V.js +1 -0
- package/web/assets/{pegDiagram-YKIO5C6U-QGeQLEq2.js → pegDiagram-7WILOQTJ-D9sneKXg.js} +1 -1
- package/web/assets/pie-WAS4IAKB-6B4OPMJ5-DW5Xy69Z.js +1 -0
- package/web/assets/pieDiagram-EFA7CBSB-Dx2NQofL.js +39 -0
- package/web/assets/{quadrantDiagram-VO5QLCXA-B7098wSc.js → quadrantDiagram-WARVYA7P-DPKL9_0A.js} +3 -3
- package/web/assets/radar-RG4KPBEZ-UPTR3XUL-CkzibT2h.js +1 -0
- package/web/assets/railroad-74A4TZTK-MEFUPFMS-D9zF-mDN.js +1 -0
- package/web/assets/railroad-abnf-HS5TGJTU-R5YG2S5D-ruacjUbX.js +1 -0
- package/web/assets/railroad-ebnf-LZEXJU2U-G5QEX2L6-S1zc5OiO.js +1 -0
- package/web/assets/railroad-peg-WCYAUIDC-H5I2ZRY2-Cbcr0XzY.js +1 -0
- package/web/assets/{railroadDiagram-M77LTMSB-AXu4vxk_.js → railroadDiagram-5NIQVNLQ-DsweTo14.js} +1 -1
- package/web/assets/{requirementDiagram-RASO5HTO-B-l8InpK.js → requirementDiagram-SXREGOKZ-CXwdNSVR.js} +4 -4
- package/web/assets/{sankeyDiagram-F32LOJ6L-Kd7zjJgX.js → sankeyDiagram-VV74M2VP-CA6jtP9P.js} +3 -3
- package/web/assets/{sequenceDiagram-URATNSBD-BlcdY9DS.js → sequenceDiagram-52ZFIFDL-k_5rEbzm.js} +15 -15
- package/web/assets/src-Df5C1Nz4.js +1 -0
- package/web/assets/stateDiagram-3QAKPIVI-BejHTf31.js +1 -0
- package/web/assets/stateDiagram-v2-HN2P4RDZ-BrfoRuOc.js +1 -0
- package/web/assets/swimlanes-QLVP42QD-CQSVO5D6.js +1 -0
- package/web/assets/swimlanesDiagram-JKPDBFCN-DrWB9kcD.js +8 -0
- package/web/assets/{timeline-definition-WJXWRH4I-DUfp1R3E.js → timeline-definition-GS45XAXW-C0Ks8rPP.js} +4 -4
- package/web/assets/treeView-Q6P3EWNA-ZRJGANNQ-DmKOCo6L.js +1 -0
- package/web/assets/treemap-WGGIJYW6-K64VN5AS-DO3xY92U.js +1 -0
- package/web/assets/{vennDiagram-K3VCMQLI-Bj-FN-XS.js → vennDiagram-QIQU2ZRJ-rgPiS837.js} +3 -3
- package/web/assets/wardley-WFR3VGLG-D67OWCCH-DiDPBNft.js +1 -0
- package/web/assets/wardleyDiagram-U6YNM66N-DRVr7SPi.js +78 -0
- package/web/assets/{xychartDiagram-5VRUVLCW-CK_rbSWE.js → xychartDiagram-XJAZEDNM-COtlZzYb.js} +3 -3
- package/web/index.html +19 -17
- package/web/assets/ProcessFlowModal-Badh2Pbg.js +0 -24
- package/web/assets/architecture-TIHT7OUA-V6N4J3SY-fTePvLoe.js +0 -1
- package/web/assets/architectureDiagram-OT7VKSJ7-mKEXxkeF.js +0 -36
- package/web/assets/blockDiagram-54WLDVWM-Dg_hrRWE.js +0 -132
- package/web/assets/c4Diagram-X2LASM7V-CnhoT4aV.js +0 -10
- package/web/assets/chunk-2AEHWXPW-CV4r6-1I.js +0 -127
- package/web/assets/chunk-5VCL7Z4A-CQ-2dYWj.js +0 -1
- package/web/assets/chunk-6BELYETK-ChsYtfHW.js +0 -1
- package/web/assets/chunk-7CWYLC5S-DRgGkkpF.js +0 -2
- package/web/assets/chunk-7FYTHRHK-CsmYIswB.js +0 -32
- package/web/assets/chunk-KRXBNO2N-C-UNuKKf.js +0 -1
- package/web/assets/chunk-LAHSG3N2-Bz4hcn0N.js +0 -321
- package/web/assets/chunk-LIEV3EAG-pyKGssV3.js +0 -1
- package/web/assets/chunk-NLANEA3F-XpH_NPA5.js +0 -62
- package/web/assets/chunk-PE7DX7ZZ-CCvRVj43.js +0 -10
- package/web/assets/chunk-Q67WD55A-BWCH2SVz.js +0 -156
- package/web/assets/chunk-SZD42YQK-ijyKKVr1.js +0 -70
- package/web/assets/chunk-TFPGFQPA-Dj6a-0pC.js +0 -231
- package/web/assets/chunk-TGVD4F4B-BMc31Gj2.js +0 -2
- package/web/assets/chunk-UAT7B5JY-DW-A_fpI.js +0 -1
- package/web/assets/chunk-VY5UBI4V-yxPQAWxw.js +0 -1
- package/web/assets/chunk-WJBAP47W-BckNkuEN.js +0 -1
- package/web/assets/classDiagram-VPOSVPXH-BjOiXA_C.js +0 -1
- package/web/assets/classDiagram-v2-5VFNUXQA-BjOiXA_C.js +0 -1
- package/web/assets/cynefin-VYW2F7L2-2VAHYKR6-DAsF6GZv.js +0 -1
- package/web/assets/dagre-K64A6Z3X-CUwi79mA.js +0 -4
- package/web/assets/diagram-2TLGJV2N-C2F5Nfym.js +0 -30
- package/web/assets/diagram-KFBZAVDW-Dfmf_4ti.js +0 -3
- package/web/assets/diagram-YP3FGXHI-CyNFYtkd.js +0 -24
- package/web/assets/erDiagram-SZLJLQMB-CohQjznC.js +0 -85
- package/web/assets/eventmodeling-45OFAUF4-AOUJWSLX-BvTc6iQi.js +0 -1
- package/web/assets/flowDiagram-BWE6NHOH-B6RnEvD9.js +0 -1
- package/web/assets/ganttDiagram-2QTCJSNI-Cks_mEcF.js +0 -292
- package/web/assets/gitGraph-TEB2WS4Q-U5VWYIBC-Dy7CCSZ5.js +0 -1
- package/web/assets/gitGraphDiagram-VVZAVV5G-CG41cIVc.js +0 -106
- package/web/assets/info-DKCQHKI2-DX6KST54-BLJg1ikX.js +0 -1
- package/web/assets/infoDiagram-FY4PZKRE-BJ3vPVwW.js +0 -2
- package/web/assets/katex-C5OPUE3Q-Bnbavtmu.js +0 -257
- package/web/assets/packet-7NZHBO7P-5WG45QPS-KUxcuvaA.js +0 -1
- package/web/assets/pie-RZYD4A2V-2OCZ2VTD-DPs08kJY.js +0 -1
- package/web/assets/pieDiagram-YPY3TKG5-BuT3MYzm.js +0 -39
- package/web/assets/radar-I7S5WNFK-EPLSA35B-w5F0K3a7.js +0 -1
- package/web/assets/railroad-3IZDKUUU-PWFQV6Y6-Bu668yqY.js +0 -1
- package/web/assets/railroad-abnf-AHOZXSZD-JYYJX3BS-B6ghpETS.js +0 -1
- package/web/assets/railroad-ebnf-EBAXGLYW-RBZ4ONAP-D-XmHh3M.js +0 -1
- package/web/assets/railroad-peg-LSFZ7HO6-KHNPXGPG-mhkrhzEn.js +0 -1
- package/web/assets/src-C5sx_gMp.js +0 -1
- package/web/assets/stateDiagram-DODFXNG5-DTdHc-fF.js +0 -1
- package/web/assets/stateDiagram-v2-JNMM5JRA-DioNLDDo.js +0 -1
- package/web/assets/swimlanes-OSWOYLSK-CA0ofdwY.js +0 -2
- package/web/assets/swimlanesDiagram-RHGX2RDE-PkwUdckC.js +0 -8
- package/web/assets/treeView-QDETBFTQ-EHYTSQNO-C5lpBgPm.js +0 -1
- package/web/assets/treemap-6X3UGDF4-CCWCF7EK-BB0ZyO-B.js +0 -1
- package/web/assets/wardley-OPB4EBWU-6OWERDVT-CEA3Nq0j.js +0 -1
- package/web/assets/wardleyDiagram-XK6FUAWV-CVV0dHFr.js +0 -78
- /package/web/assets/{sizeCapture-5GORAGP4-BEqQzsxs.js → sizeCapture-FGA5AGYP-BEqQzsxs.js} +0 -0
|
@@ -0,0 +1,954 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASP.NET Core ViewComponent convention support.
|
|
3
|
+
*
|
|
4
|
+
* Same bound as Spring Boot DI in Java/Kotlin: do not resolve into the SDK
|
|
5
|
+
* (`Microsoft.AspNetCore.Mvc.ViewComponent`, `IViewComponentHelper`,
|
|
6
|
+
* `Component.InvokeAsync` itself). Those types live outside the workspace.
|
|
7
|
+
* The only hop worth taking is the framework convention that lands on an
|
|
8
|
+
* **in-repo** class — `InvokeAsync("Foo")` → workspace `FooViewComponent`,
|
|
9
|
+
* just as a Spring `@Autowired IFoo` fans out to an in-repo `@Service`,
|
|
10
|
+
* not to `ApplicationContext`.
|
|
11
|
+
*
|
|
12
|
+
* Razor templates are not parsed as C# (markup + code would poison
|
|
13
|
+
* tree-sitter-c-sharp). A small Razor state machine extracts C# islands and
|
|
14
|
+
* markup tag helpers; C# files use a string/comment-aware lexer so attributes
|
|
15
|
+
* and literals are not mistaken for helper calls. Literal names are enough
|
|
16
|
+
* because the target catalog is already built from parsed `.cs` classes.
|
|
17
|
+
*/
|
|
18
|
+
import fs from 'node:fs/promises';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import { glob } from 'glob';
|
|
21
|
+
import { createIgnoreFilter } from '../../../../config/ignore-service.js';
|
|
22
|
+
import { generateId } from '../../../../lib/utils.js';
|
|
23
|
+
import { getMaxFileSizeBytes } from '../../utils/max-file-size.js';
|
|
24
|
+
import { resolveDefGraphId } from '../../scope-resolution/graph-bridge/ids.js';
|
|
25
|
+
import { definitionIdPosition } from '../../scope-resolution/utils/definition-id.js';
|
|
26
|
+
const VIEW_COMPONENT_SUFFIX = 'ViewComponent';
|
|
27
|
+
const VIEW_COMPONENT_TAG_RE = /<\s*vc:([a-z][a-z0-9-]*)\b/gi;
|
|
28
|
+
const COMPONENT_NAME_RE = /^[A-Za-z_][A-Za-z0-9_.-]*$/;
|
|
29
|
+
const TYPE_MODIFIERS = new Set([
|
|
30
|
+
'public',
|
|
31
|
+
'internal',
|
|
32
|
+
'protected',
|
|
33
|
+
'private',
|
|
34
|
+
'abstract',
|
|
35
|
+
'sealed',
|
|
36
|
+
'partial',
|
|
37
|
+
'static',
|
|
38
|
+
'new',
|
|
39
|
+
'file',
|
|
40
|
+
'required',
|
|
41
|
+
'unsafe',
|
|
42
|
+
'readonly',
|
|
43
|
+
]);
|
|
44
|
+
const RAZOR_BLOCK_KEYWORDS = new Set([
|
|
45
|
+
'if',
|
|
46
|
+
'for',
|
|
47
|
+
'foreach',
|
|
48
|
+
'while',
|
|
49
|
+
'using',
|
|
50
|
+
'switch',
|
|
51
|
+
'try',
|
|
52
|
+
'lock',
|
|
53
|
+
'functions',
|
|
54
|
+
'helper',
|
|
55
|
+
'code',
|
|
56
|
+
'section',
|
|
57
|
+
'do',
|
|
58
|
+
]);
|
|
59
|
+
class SourceCursor {
|
|
60
|
+
source;
|
|
61
|
+
i = 0;
|
|
62
|
+
line = 1;
|
|
63
|
+
col = 0;
|
|
64
|
+
constructor(source) {
|
|
65
|
+
this.source = source;
|
|
66
|
+
}
|
|
67
|
+
get length() {
|
|
68
|
+
return this.source.length;
|
|
69
|
+
}
|
|
70
|
+
get done() {
|
|
71
|
+
return this.i >= this.source.length;
|
|
72
|
+
}
|
|
73
|
+
peek(n = 0) {
|
|
74
|
+
return this.source[this.i + n] ?? '';
|
|
75
|
+
}
|
|
76
|
+
startsWith(value) {
|
|
77
|
+
return this.source.startsWith(value, this.i);
|
|
78
|
+
}
|
|
79
|
+
snapshot() {
|
|
80
|
+
return { i: this.i, line: this.line, col: this.col };
|
|
81
|
+
}
|
|
82
|
+
restore(pos) {
|
|
83
|
+
this.i = pos.i;
|
|
84
|
+
this.line = pos.line;
|
|
85
|
+
this.col = pos.col;
|
|
86
|
+
}
|
|
87
|
+
advance(count = 1) {
|
|
88
|
+
const end = Math.min(this.i + count, this.source.length);
|
|
89
|
+
while (this.i < end) {
|
|
90
|
+
const ch = this.source[this.i];
|
|
91
|
+
this.i += 1;
|
|
92
|
+
if (ch === '\n') {
|
|
93
|
+
this.line += 1;
|
|
94
|
+
this.col = 0;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.col += 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function isIdentStart(ch) {
|
|
103
|
+
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch === '_' || ch === '@';
|
|
104
|
+
}
|
|
105
|
+
function isIdentPart(ch) {
|
|
106
|
+
return isIdentStart(ch) || (ch >= '0' && ch <= '9');
|
|
107
|
+
}
|
|
108
|
+
function skipWhitespace(cur) {
|
|
109
|
+
while (!cur.done) {
|
|
110
|
+
const ch = cur.peek();
|
|
111
|
+
if (ch !== ' ' && ch !== '\t' && ch !== '\n' && ch !== '\r' && ch !== '\f' && ch !== '\v')
|
|
112
|
+
break;
|
|
113
|
+
cur.advance();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Skip line comments and block comments. Returns true if a comment was consumed. */
|
|
117
|
+
function skipCsharpComment(cur) {
|
|
118
|
+
if (cur.startsWith('//')) {
|
|
119
|
+
while (!cur.done && cur.peek() !== '\n')
|
|
120
|
+
cur.advance();
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
if (cur.startsWith('/*')) {
|
|
124
|
+
cur.advance(2);
|
|
125
|
+
while (!cur.done && !cur.startsWith('*/'))
|
|
126
|
+
cur.advance();
|
|
127
|
+
if (cur.startsWith('*/'))
|
|
128
|
+
cur.advance(2);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
function skipCsharpTrivia(cur) {
|
|
134
|
+
for (;;) {
|
|
135
|
+
skipWhitespace(cur);
|
|
136
|
+
if (!skipCsharpComment(cur))
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function skipRegularString(cur, interpolated) {
|
|
141
|
+
cur.advance(); // opening "
|
|
142
|
+
while (!cur.done) {
|
|
143
|
+
const ch = cur.peek();
|
|
144
|
+
if (ch === '\\') {
|
|
145
|
+
cur.advance(2);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (interpolated && ch === '{') {
|
|
149
|
+
if (cur.peek(1) === '{') {
|
|
150
|
+
cur.advance(2);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
skipInterpolation(cur);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
cur.advance();
|
|
157
|
+
if (ch === '"')
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function skipVerbatimString(cur, interpolated) {
|
|
162
|
+
cur.advance(2); // @"
|
|
163
|
+
while (!cur.done) {
|
|
164
|
+
const ch = cur.peek();
|
|
165
|
+
if (ch === '"') {
|
|
166
|
+
if (cur.peek(1) === '"') {
|
|
167
|
+
cur.advance(2);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
cur.advance();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (interpolated && ch === '{') {
|
|
174
|
+
if (cur.peek(1) === '{') {
|
|
175
|
+
cur.advance(2);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
skipInterpolation(cur);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
cur.advance();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function skipRawString(cur) {
|
|
185
|
+
let quoteCount = 0;
|
|
186
|
+
while (cur.peek() === '"') {
|
|
187
|
+
quoteCount += 1;
|
|
188
|
+
cur.advance();
|
|
189
|
+
}
|
|
190
|
+
while (!cur.done) {
|
|
191
|
+
if (cur.peek() !== '"') {
|
|
192
|
+
cur.advance();
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
let seen = 0;
|
|
196
|
+
while (cur.peek() === '"') {
|
|
197
|
+
seen += 1;
|
|
198
|
+
cur.advance();
|
|
199
|
+
}
|
|
200
|
+
if (seen >= quoteCount)
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function skipInterpolation(cur) {
|
|
205
|
+
cur.advance(); // {
|
|
206
|
+
let depth = 1;
|
|
207
|
+
while (!cur.done && depth > 0) {
|
|
208
|
+
skipCsharpTrivia(cur);
|
|
209
|
+
if (cur.done)
|
|
210
|
+
return;
|
|
211
|
+
if (skipCsharpString(cur))
|
|
212
|
+
continue;
|
|
213
|
+
const ch = cur.peek();
|
|
214
|
+
if (ch === '{')
|
|
215
|
+
depth += 1;
|
|
216
|
+
else if (ch === '}')
|
|
217
|
+
depth -= 1;
|
|
218
|
+
cur.advance();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function skipCsharpString(cur) {
|
|
222
|
+
const ch = cur.peek();
|
|
223
|
+
if (ch === "'") {
|
|
224
|
+
cur.advance();
|
|
225
|
+
if (cur.peek() === '\\')
|
|
226
|
+
cur.advance(2);
|
|
227
|
+
else
|
|
228
|
+
cur.advance();
|
|
229
|
+
if (cur.peek() === "'")
|
|
230
|
+
cur.advance();
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
if (ch === '"') {
|
|
234
|
+
if (cur.peek(1) === '"' && cur.peek(2) === '"')
|
|
235
|
+
skipRawString(cur);
|
|
236
|
+
else
|
|
237
|
+
skipRegularString(cur, false);
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
if (ch === '$' && cur.peek(1) === '@' && cur.peek(2) === '"') {
|
|
241
|
+
cur.advance();
|
|
242
|
+
skipVerbatimString(cur, true);
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
if (ch === '@' && cur.peek(1) === '$' && cur.peek(2) === '"') {
|
|
246
|
+
cur.advance(2);
|
|
247
|
+
skipVerbatimString(cur, true);
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
if (ch === '@' && cur.peek(1) === '"') {
|
|
251
|
+
skipVerbatimString(cur, false);
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
if (ch === '$' && cur.peek(1) === '"') {
|
|
255
|
+
if (cur.peek(2) === '"' && cur.peek(3) === '"') {
|
|
256
|
+
cur.advance();
|
|
257
|
+
skipRawString(cur);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
cur.advance();
|
|
261
|
+
skipRegularString(cur, true);
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
function readIdent(cur) {
|
|
268
|
+
if (!isIdentStart(cur.peek()))
|
|
269
|
+
return undefined;
|
|
270
|
+
const start = cur.i;
|
|
271
|
+
if (cur.peek() === '@')
|
|
272
|
+
cur.advance();
|
|
273
|
+
if (!isIdentStart(cur.peek()) && !(cur.peek() >= 'A' && cur.peek() <= 'z')) {
|
|
274
|
+
cur.i = start;
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
while (isIdentPart(cur.peek()) && cur.peek() !== '@')
|
|
278
|
+
cur.advance();
|
|
279
|
+
const raw = cur.source.slice(start, cur.i);
|
|
280
|
+
return raw.startsWith('@') ? raw.slice(1) : raw;
|
|
281
|
+
}
|
|
282
|
+
function tryReadIdent(cur) {
|
|
283
|
+
skipCsharpTrivia(cur);
|
|
284
|
+
return readIdent(cur);
|
|
285
|
+
}
|
|
286
|
+
function decodeCsharpString(cur) {
|
|
287
|
+
skipCsharpTrivia(cur);
|
|
288
|
+
const start = cur.snapshot();
|
|
289
|
+
const ch = cur.peek();
|
|
290
|
+
if (ch === '$')
|
|
291
|
+
return undefined;
|
|
292
|
+
if (ch === '@' && cur.peek(1) === '"') {
|
|
293
|
+
cur.advance(2);
|
|
294
|
+
let value = '';
|
|
295
|
+
while (!cur.done) {
|
|
296
|
+
if (cur.peek() === '"') {
|
|
297
|
+
if (cur.peek(1) === '"') {
|
|
298
|
+
value += '"';
|
|
299
|
+
cur.advance(2);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
cur.advance();
|
|
303
|
+
return value;
|
|
304
|
+
}
|
|
305
|
+
value += cur.peek();
|
|
306
|
+
cur.advance();
|
|
307
|
+
}
|
|
308
|
+
cur.restore(start);
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
if (ch === '"' && cur.peek(1) === '"' && cur.peek(2) === '"') {
|
|
312
|
+
let quoteCount = 0;
|
|
313
|
+
while (cur.peek() === '"') {
|
|
314
|
+
quoteCount += 1;
|
|
315
|
+
cur.advance();
|
|
316
|
+
}
|
|
317
|
+
const bodyStart = cur.i;
|
|
318
|
+
while (!cur.done) {
|
|
319
|
+
if (cur.peek() !== '"') {
|
|
320
|
+
cur.advance();
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const closeStart = cur.i;
|
|
324
|
+
let seen = 0;
|
|
325
|
+
while (cur.peek() === '"') {
|
|
326
|
+
seen += 1;
|
|
327
|
+
cur.advance();
|
|
328
|
+
}
|
|
329
|
+
if (seen >= quoteCount) {
|
|
330
|
+
return cur.source.slice(bodyStart, closeStart);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
cur.restore(start);
|
|
334
|
+
return undefined;
|
|
335
|
+
}
|
|
336
|
+
if (ch === '"') {
|
|
337
|
+
cur.advance();
|
|
338
|
+
let value = '';
|
|
339
|
+
while (!cur.done) {
|
|
340
|
+
const next = cur.peek();
|
|
341
|
+
if (next === '\\') {
|
|
342
|
+
cur.advance();
|
|
343
|
+
const esc = cur.peek();
|
|
344
|
+
cur.advance();
|
|
345
|
+
const map = {
|
|
346
|
+
n: '\n',
|
|
347
|
+
r: '\r',
|
|
348
|
+
t: '\t',
|
|
349
|
+
'"': '"',
|
|
350
|
+
'\\': '\\',
|
|
351
|
+
'0': '\0',
|
|
352
|
+
};
|
|
353
|
+
value += map[esc] ?? esc;
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (next === '"') {
|
|
357
|
+
cur.advance();
|
|
358
|
+
return value;
|
|
359
|
+
}
|
|
360
|
+
value += next;
|
|
361
|
+
cur.advance();
|
|
362
|
+
}
|
|
363
|
+
cur.restore(start);
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
return undefined;
|
|
367
|
+
}
|
|
368
|
+
function skipBalanced(cur, open, close) {
|
|
369
|
+
skipCsharpTrivia(cur);
|
|
370
|
+
if (cur.peek() !== open)
|
|
371
|
+
return false;
|
|
372
|
+
let depth = 0;
|
|
373
|
+
while (!cur.done) {
|
|
374
|
+
skipCsharpTrivia(cur);
|
|
375
|
+
if (cur.done)
|
|
376
|
+
return false;
|
|
377
|
+
if (skipCsharpString(cur))
|
|
378
|
+
continue;
|
|
379
|
+
const ch = cur.peek();
|
|
380
|
+
if (ch === open)
|
|
381
|
+
depth += 1;
|
|
382
|
+
else if (ch === close) {
|
|
383
|
+
depth -= 1;
|
|
384
|
+
cur.advance();
|
|
385
|
+
if (depth === 0)
|
|
386
|
+
return true;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
cur.advance();
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
function componentNameFromLiteral(value) {
|
|
394
|
+
if (value === undefined || !COMPONENT_NAME_RE.test(value))
|
|
395
|
+
return undefined;
|
|
396
|
+
return value;
|
|
397
|
+
}
|
|
398
|
+
function isViewComponentAttributeName(name) {
|
|
399
|
+
return name === 'ViewComponent' || name === 'ViewComponentAttribute';
|
|
400
|
+
}
|
|
401
|
+
function readQualifiedTail(cur) {
|
|
402
|
+
skipCsharpTrivia(cur);
|
|
403
|
+
let name = readIdent(cur);
|
|
404
|
+
if (name === undefined)
|
|
405
|
+
return undefined;
|
|
406
|
+
for (;;) {
|
|
407
|
+
skipCsharpTrivia(cur);
|
|
408
|
+
if (cur.peek() === '.' || (cur.peek() === ':' && cur.peek(1) === ':')) {
|
|
409
|
+
cur.advance(cur.peek() === ':' ? 2 : 1);
|
|
410
|
+
skipCsharpTrivia(cur);
|
|
411
|
+
const next = readIdent(cur);
|
|
412
|
+
if (next === undefined)
|
|
413
|
+
return name;
|
|
414
|
+
name = next;
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
return name;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function readViewComponentNameArgument(cur) {
|
|
421
|
+
skipCsharpTrivia(cur);
|
|
422
|
+
if (cur.peek() !== '(')
|
|
423
|
+
return undefined;
|
|
424
|
+
cur.advance();
|
|
425
|
+
let alias;
|
|
426
|
+
while (!cur.done && cur.peek() !== ')') {
|
|
427
|
+
skipCsharpTrivia(cur);
|
|
428
|
+
if (cur.peek() === ')')
|
|
429
|
+
break;
|
|
430
|
+
const beforeArg = cur.snapshot();
|
|
431
|
+
const ident = readIdent(cur);
|
|
432
|
+
skipCsharpTrivia(cur);
|
|
433
|
+
if (ident === 'Name' && cur.peek() === '=') {
|
|
434
|
+
cur.advance();
|
|
435
|
+
alias = componentNameFromLiteral(decodeCsharpString(cur));
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
cur.restore(beforeArg);
|
|
439
|
+
skipCsharpTrivia(cur);
|
|
440
|
+
if (cur.peek() === '"' || cur.peek() === '@') {
|
|
441
|
+
// Positional string arguments are not ViewComponentAttribute.Name.
|
|
442
|
+
skipCsharpString(cur);
|
|
443
|
+
}
|
|
444
|
+
else if (cur.peek() === '(' || cur.peek() === '[' || cur.peek() === '{') {
|
|
445
|
+
const open = cur.peek();
|
|
446
|
+
const close = open === '(' ? ')' : open === '[' ? ']' : '}';
|
|
447
|
+
skipBalanced(cur, open, close);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
while (!cur.done && cur.peek() !== ',' && cur.peek() !== ')') {
|
|
451
|
+
if (skipCsharpString(cur))
|
|
452
|
+
continue;
|
|
453
|
+
if (skipCsharpComment(cur))
|
|
454
|
+
continue;
|
|
455
|
+
cur.advance();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
skipCsharpTrivia(cur);
|
|
460
|
+
if (cur.peek() === ',')
|
|
461
|
+
cur.advance();
|
|
462
|
+
}
|
|
463
|
+
if (cur.peek() === ')')
|
|
464
|
+
cur.advance();
|
|
465
|
+
return alias;
|
|
466
|
+
}
|
|
467
|
+
function collectInvokeAfterIdent(ident, cur, previous, memberReceiver, names) {
|
|
468
|
+
skipCsharpTrivia(cur);
|
|
469
|
+
const hasMvcReceiver = previous !== '.' || memberReceiver === 'this' || memberReceiver === 'base';
|
|
470
|
+
if (ident === 'ViewComponent' && cur.peek() === '(') {
|
|
471
|
+
if (previous === '[' || previous === ',' || !hasMvcReceiver)
|
|
472
|
+
return;
|
|
473
|
+
cur.advance();
|
|
474
|
+
const name = componentNameFromLiteral(decodeCsharpString(cur));
|
|
475
|
+
if (name !== undefined)
|
|
476
|
+
names.add(name);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (ident !== 'Component' || cur.peek() !== '.' || !hasMvcReceiver)
|
|
480
|
+
return;
|
|
481
|
+
const afterDot = cur.snapshot();
|
|
482
|
+
cur.advance();
|
|
483
|
+
skipCsharpTrivia(cur);
|
|
484
|
+
if (readIdent(cur) !== 'InvokeAsync') {
|
|
485
|
+
cur.restore(afterDot);
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
skipCsharpTrivia(cur);
|
|
489
|
+
if (cur.peek() !== '(')
|
|
490
|
+
return;
|
|
491
|
+
cur.advance();
|
|
492
|
+
const name = componentNameFromLiteral(decodeCsharpString(cur));
|
|
493
|
+
if (name !== undefined)
|
|
494
|
+
names.add(name);
|
|
495
|
+
}
|
|
496
|
+
/** In-repo C# `Component.InvokeAsync("X")` / `ViewComponent("X")` literals. */
|
|
497
|
+
export function extractCsharpViewComponentInvocations(source) {
|
|
498
|
+
if (!source.includes('ViewComponent') && !source.includes('InvokeAsync'))
|
|
499
|
+
return [];
|
|
500
|
+
const names = new Set();
|
|
501
|
+
const cur = new SourceCursor(source);
|
|
502
|
+
let previous;
|
|
503
|
+
let memberReceiver;
|
|
504
|
+
let squareDepth = 0;
|
|
505
|
+
while (!cur.done) {
|
|
506
|
+
skipCsharpTrivia(cur);
|
|
507
|
+
if (cur.done)
|
|
508
|
+
break;
|
|
509
|
+
if (skipCsharpString(cur)) {
|
|
510
|
+
previous = 'string';
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const ident = readIdent(cur);
|
|
514
|
+
if (ident !== undefined) {
|
|
515
|
+
const inAttribute = squareDepth > 0;
|
|
516
|
+
collectInvokeAfterIdent(ident, cur, inAttribute ? '[' : previous, memberReceiver, names);
|
|
517
|
+
previous = ident;
|
|
518
|
+
memberReceiver = undefined;
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
const ch = cur.peek();
|
|
522
|
+
if (ch === '[')
|
|
523
|
+
squareDepth += 1;
|
|
524
|
+
else if (ch === ']' && squareDepth > 0)
|
|
525
|
+
squareDepth -= 1;
|
|
526
|
+
memberReceiver = ch === '.' ? previous : undefined;
|
|
527
|
+
previous = ch;
|
|
528
|
+
cur.advance();
|
|
529
|
+
}
|
|
530
|
+
return [...names];
|
|
531
|
+
}
|
|
532
|
+
function parseAttributeListBody(cur) {
|
|
533
|
+
const aliases = [];
|
|
534
|
+
skipCsharpTrivia(cur);
|
|
535
|
+
const specifier = cur.snapshot();
|
|
536
|
+
const specifierName = readIdent(cur);
|
|
537
|
+
skipCsharpTrivia(cur);
|
|
538
|
+
if (specifierName !== undefined && cur.peek() === ':' && cur.peek(1) !== ':') {
|
|
539
|
+
cur.advance();
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
cur.restore(specifier);
|
|
543
|
+
}
|
|
544
|
+
while (!cur.done && cur.peek() !== ']') {
|
|
545
|
+
skipCsharpTrivia(cur);
|
|
546
|
+
if (cur.peek() === ']')
|
|
547
|
+
break;
|
|
548
|
+
const tail = readQualifiedTail(cur);
|
|
549
|
+
skipCsharpTrivia(cur);
|
|
550
|
+
if (tail !== undefined && isViewComponentAttributeName(tail) && cur.peek() === '(') {
|
|
551
|
+
const alias = readViewComponentNameArgument(cur);
|
|
552
|
+
if (alias !== undefined)
|
|
553
|
+
aliases.push(alias);
|
|
554
|
+
}
|
|
555
|
+
else if (cur.peek() === '(') {
|
|
556
|
+
skipBalanced(cur, '(', ')');
|
|
557
|
+
}
|
|
558
|
+
skipCsharpTrivia(cur);
|
|
559
|
+
if (cur.peek() === ',')
|
|
560
|
+
cur.advance();
|
|
561
|
+
else
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
if (cur.peek() === ']')
|
|
565
|
+
cur.advance();
|
|
566
|
+
return aliases;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Explicit `[ViewComponent(Name = "...")]` aliases keyed to the following
|
|
570
|
+
* class declaration. Positional constructor arguments are ignored: the MVC
|
|
571
|
+
* attribute only exposes `Name` as a property.
|
|
572
|
+
*/
|
|
573
|
+
export function extractViewComponentAliasBinds(source) {
|
|
574
|
+
if (!source.includes('ViewComponent'))
|
|
575
|
+
return [];
|
|
576
|
+
const binds = [];
|
|
577
|
+
const cur = new SourceCursor(source);
|
|
578
|
+
const pending = [];
|
|
579
|
+
const flushPending = (className, startLine, startCol) => {
|
|
580
|
+
const aliases = pending.flatMap((entry) => entry.aliases);
|
|
581
|
+
const start = pending[0];
|
|
582
|
+
binds.push({
|
|
583
|
+
className,
|
|
584
|
+
startLine: start?.startLine ?? startLine,
|
|
585
|
+
startCol: start?.startCol ?? startCol,
|
|
586
|
+
aliases: [...new Set(aliases)],
|
|
587
|
+
});
|
|
588
|
+
pending.length = 0;
|
|
589
|
+
};
|
|
590
|
+
while (!cur.done) {
|
|
591
|
+
skipCsharpTrivia(cur);
|
|
592
|
+
if (cur.done)
|
|
593
|
+
break;
|
|
594
|
+
if (skipCsharpString(cur))
|
|
595
|
+
continue;
|
|
596
|
+
const startLine = cur.line;
|
|
597
|
+
const startCol = cur.col;
|
|
598
|
+
if (cur.peek() === '[') {
|
|
599
|
+
cur.advance();
|
|
600
|
+
const aliases = parseAttributeListBody(cur);
|
|
601
|
+
pending.push({ startLine, startCol, aliases });
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
const ident = readIdent(cur);
|
|
605
|
+
if (ident === undefined) {
|
|
606
|
+
pending.length = 0;
|
|
607
|
+
cur.advance();
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
if (TYPE_MODIFIERS.has(ident))
|
|
611
|
+
continue;
|
|
612
|
+
if (ident === 'class' || ident === 'record') {
|
|
613
|
+
let className = tryReadIdent(cur);
|
|
614
|
+
if (ident === 'record' && (className === 'class' || className === 'struct')) {
|
|
615
|
+
className = tryReadIdent(cur);
|
|
616
|
+
}
|
|
617
|
+
if (className !== undefined && pending.some((entry) => entry.aliases.length > 0)) {
|
|
618
|
+
flushPending(className, startLine, startCol);
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
pending.length = 0;
|
|
622
|
+
}
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
pending.length = 0;
|
|
626
|
+
}
|
|
627
|
+
return binds;
|
|
628
|
+
}
|
|
629
|
+
/** Extract explicit `[ViewComponent(Name = "...")]` aliases by class name. */
|
|
630
|
+
export function extractViewComponentAliases(source) {
|
|
631
|
+
const aliases = new Map();
|
|
632
|
+
for (const bind of extractViewComponentAliasBinds(source)) {
|
|
633
|
+
if (bind.aliases.length === 0)
|
|
634
|
+
continue;
|
|
635
|
+
const existing = aliases.get(bind.className);
|
|
636
|
+
if (existing) {
|
|
637
|
+
for (const alias of bind.aliases) {
|
|
638
|
+
if (!existing.includes(alias))
|
|
639
|
+
existing.push(alias);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
aliases.set(bind.className, [...bind.aliases]);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return aliases;
|
|
647
|
+
}
|
|
648
|
+
function tagNameToComponentName(tagName) {
|
|
649
|
+
return tagName
|
|
650
|
+
.split('-')
|
|
651
|
+
.filter(Boolean)
|
|
652
|
+
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
653
|
+
.join('');
|
|
654
|
+
}
|
|
655
|
+
function collectVcTags(span, names) {
|
|
656
|
+
VIEW_COMPONENT_TAG_RE.lastIndex = 0;
|
|
657
|
+
for (const match of span.matchAll(VIEW_COMPONENT_TAG_RE)) {
|
|
658
|
+
names.add(tagNameToComponentName(match[1]));
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
function skipRazorComment(cur) {
|
|
662
|
+
if (!cur.startsWith('@*'))
|
|
663
|
+
return false;
|
|
664
|
+
cur.advance(2);
|
|
665
|
+
while (!cur.done && !cur.startsWith('*@'))
|
|
666
|
+
cur.advance();
|
|
667
|
+
if (cur.startsWith('*@'))
|
|
668
|
+
cur.advance(2);
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
function countAtRun(cur) {
|
|
672
|
+
let count = 0;
|
|
673
|
+
while (cur.peek() === '@') {
|
|
674
|
+
count += 1;
|
|
675
|
+
cur.advance();
|
|
676
|
+
}
|
|
677
|
+
return count;
|
|
678
|
+
}
|
|
679
|
+
function scanCsharpSpan(span, names) {
|
|
680
|
+
for (const name of extractCsharpViewComponentInvocations(span))
|
|
681
|
+
names.add(name);
|
|
682
|
+
}
|
|
683
|
+
function skipOptionalParens(cur) {
|
|
684
|
+
skipWhitespace(cur);
|
|
685
|
+
if (cur.peek() === '(')
|
|
686
|
+
skipBalanced(cur, '(', ')');
|
|
687
|
+
}
|
|
688
|
+
function consumeRazorCodeBlock(cur, names) {
|
|
689
|
+
skipCsharpTrivia(cur);
|
|
690
|
+
skipOptionalParens(cur);
|
|
691
|
+
skipCsharpTrivia(cur);
|
|
692
|
+
if (cur.peek() !== '{') {
|
|
693
|
+
const start = cur.i;
|
|
694
|
+
while (!cur.done && cur.peek() !== '\n' && cur.peek() !== '{') {
|
|
695
|
+
if (skipCsharpString(cur) || skipCsharpComment(cur))
|
|
696
|
+
continue;
|
|
697
|
+
cur.advance();
|
|
698
|
+
}
|
|
699
|
+
scanCsharpSpan(cur.source.slice(start, cur.i), names);
|
|
700
|
+
if (cur.peek() === '{')
|
|
701
|
+
consumeRazorCodeBlock(cur, names);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const bodyStart = cur.i + 1;
|
|
705
|
+
if (!skipBalanced(cur, '{', '}'))
|
|
706
|
+
return;
|
|
707
|
+
scanCsharpSpan(cur.source.slice(bodyStart, cur.i - 1), names);
|
|
708
|
+
}
|
|
709
|
+
function consumeImplicitExpression(cur, names) {
|
|
710
|
+
const start = cur.i;
|
|
711
|
+
skipCsharpTrivia(cur);
|
|
712
|
+
if (cur.peek() === '(') {
|
|
713
|
+
const innerStart = cur.i + 1;
|
|
714
|
+
if (skipBalanced(cur, '(', ')')) {
|
|
715
|
+
scanCsharpSpan(cur.source.slice(innerStart, cur.i - 1), names);
|
|
716
|
+
}
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
// Implicit expressions: `@await Component.InvokeAsync("X")` / `@Component.InvokeAsync(...)`.
|
|
720
|
+
while (!cur.done) {
|
|
721
|
+
skipCsharpTrivia(cur);
|
|
722
|
+
if (cur.done)
|
|
723
|
+
break;
|
|
724
|
+
if (skipCsharpString(cur))
|
|
725
|
+
continue;
|
|
726
|
+
if (cur.peek() === '(') {
|
|
727
|
+
skipBalanced(cur, '(', ')');
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
if (cur.peek() === '{') {
|
|
731
|
+
skipBalanced(cur, '{', '}');
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
const ch = cur.peek();
|
|
735
|
+
if (ch === '<' || ch === '\n')
|
|
736
|
+
break;
|
|
737
|
+
if (ch === '@')
|
|
738
|
+
break;
|
|
739
|
+
if (!isIdentPart(ch) && ch !== '.' && ch !== '?') {
|
|
740
|
+
if (ch === ';')
|
|
741
|
+
cur.advance();
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
cur.advance();
|
|
745
|
+
}
|
|
746
|
+
scanCsharpSpan(cur.source.slice(start, cur.i), names);
|
|
747
|
+
}
|
|
748
|
+
function consumeRazorTransition(cur, names) {
|
|
749
|
+
skipWhitespace(cur);
|
|
750
|
+
if (cur.peek() === '{') {
|
|
751
|
+
consumeRazorCodeBlock(cur, names);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
if (cur.peek() === '(') {
|
|
755
|
+
consumeImplicitExpression(cur, names);
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
const identStart = cur.snapshot();
|
|
759
|
+
const ident = readIdent(cur);
|
|
760
|
+
if (ident === undefined) {
|
|
761
|
+
consumeImplicitExpression(cur, names);
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
if (ident === 'await' || ident === 'Component') {
|
|
765
|
+
cur.restore(identStart);
|
|
766
|
+
consumeImplicitExpression(cur, names);
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
if (RAZOR_BLOCK_KEYWORDS.has(ident)) {
|
|
770
|
+
if (ident === 'section' || ident === 'helper')
|
|
771
|
+
tryReadIdent(cur);
|
|
772
|
+
consumeRazorCodeBlock(cur, names);
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
cur.restore(identStart);
|
|
776
|
+
consumeImplicitExpression(cur, names);
|
|
777
|
+
}
|
|
778
|
+
/** Extract statically resolvable ViewComponent names from one Razor template. */
|
|
779
|
+
export function extractRazorViewComponentInvocations(source) {
|
|
780
|
+
// Most views do not invoke a ViewComponent. Avoid the character-by-character
|
|
781
|
+
// Razor scan unless one of the two supported invocation spellings is present.
|
|
782
|
+
// This is only a coarse gate; the state machine below still decides whether a
|
|
783
|
+
// token is executable markup/C# or a comment/string/escaped transition.
|
|
784
|
+
if (!source.includes('InvokeAsync') && !/<\s*vc:/i.test(source))
|
|
785
|
+
return [];
|
|
786
|
+
const names = new Set();
|
|
787
|
+
const cur = new SourceCursor(source);
|
|
788
|
+
let markupStart = 0;
|
|
789
|
+
const flushMarkup = () => {
|
|
790
|
+
if (cur.i > markupStart)
|
|
791
|
+
collectVcTags(source.slice(markupStart, cur.i), names);
|
|
792
|
+
};
|
|
793
|
+
while (!cur.done) {
|
|
794
|
+
if (cur.peek() !== '@') {
|
|
795
|
+
cur.advance();
|
|
796
|
+
continue;
|
|
797
|
+
}
|
|
798
|
+
flushMarkup();
|
|
799
|
+
if (skipRazorComment(cur)) {
|
|
800
|
+
markupStart = cur.i;
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
const atCount = countAtRun(cur);
|
|
804
|
+
const leftover = atCount % 2;
|
|
805
|
+
if (leftover === 0) {
|
|
806
|
+
markupStart = cur.i;
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
consumeRazorTransition(cur, names);
|
|
810
|
+
markupStart = cur.i;
|
|
811
|
+
}
|
|
812
|
+
flushMarkup();
|
|
813
|
+
return [...names];
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Read Razor views once per C# resolution pass. The same ignore rules and file
|
|
817
|
+
* size ceiling as repository scanning are applied, and edge emission later
|
|
818
|
+
* additionally requires a live File node. This prevents ignored, oversized,
|
|
819
|
+
* or concurrently removed templates from entering the graph.
|
|
820
|
+
*/
|
|
821
|
+
export async function loadRazorViewComponentConfig(repoRoot) {
|
|
822
|
+
const ignore = await createIgnoreFilter(repoRoot);
|
|
823
|
+
const paths = await glob('**/*.cshtml', {
|
|
824
|
+
cwd: repoRoot,
|
|
825
|
+
nodir: true,
|
|
826
|
+
dot: false,
|
|
827
|
+
ignore,
|
|
828
|
+
});
|
|
829
|
+
paths.sort();
|
|
830
|
+
const maxBytes = getMaxFileSizeBytes();
|
|
831
|
+
const views = new Map();
|
|
832
|
+
for (const rawPath of paths) {
|
|
833
|
+
const filePath = rawPath.replace(/\\/g, '/');
|
|
834
|
+
// The size gate and the read go through one handle so both observe the same
|
|
835
|
+
// inode. Re-resolving the path for the read would let a template swapped in
|
|
836
|
+
// between them be read unchecked (CodeQL js/file-system-race).
|
|
837
|
+
let handle;
|
|
838
|
+
try {
|
|
839
|
+
handle = await fs.open(path.join(repoRoot, filePath), 'r');
|
|
840
|
+
const stat = await handle.stat();
|
|
841
|
+
if (!stat.isFile() || stat.size > maxBytes)
|
|
842
|
+
continue;
|
|
843
|
+
const source = await handle.readFile('utf8');
|
|
844
|
+
views.set(filePath, extractRazorViewComponentInvocations(source));
|
|
845
|
+
}
|
|
846
|
+
catch {
|
|
847
|
+
// A view may disappear between glob/open/read during watch mode.
|
|
848
|
+
}
|
|
849
|
+
finally {
|
|
850
|
+
await handle?.close().catch(() => { });
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return { views };
|
|
854
|
+
}
|
|
855
|
+
function addCandidate(candidates, invocationName, targetId) {
|
|
856
|
+
const key = invocationName.toLocaleLowerCase('en-US');
|
|
857
|
+
const existing = candidates.get(key);
|
|
858
|
+
if (existing) {
|
|
859
|
+
existing.add(targetId);
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
candidates.set(key, new Set([targetId]));
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
function bindAliasesForClass(binds, className, nodeId, filePath) {
|
|
866
|
+
const matches = binds.filter((bind) => bind.className === className);
|
|
867
|
+
if (matches.length === 0)
|
|
868
|
+
return undefined;
|
|
869
|
+
if (matches.length === 1)
|
|
870
|
+
return matches[0].aliases;
|
|
871
|
+
const pos = definitionIdPosition(nodeId, filePath);
|
|
872
|
+
if (pos === undefined)
|
|
873
|
+
return undefined;
|
|
874
|
+
const atPosition = matches.filter((bind) => bind.startLine === pos.line && bind.startCol === pos.column);
|
|
875
|
+
if (atPosition.length === 1)
|
|
876
|
+
return atPosition[0].aliases;
|
|
877
|
+
return undefined;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Emit workspace File → in-repo ViewComponent Class CALLS edges.
|
|
881
|
+
*
|
|
882
|
+
* Targets are only Class nodes produced from this repo's `.cs` files. There is
|
|
883
|
+
* no lookup of ASP.NET SDK types; `: ViewComponent` in source is a naming
|
|
884
|
+
* hint, not a resolved EXTENDS edge to `Microsoft.AspNetCore.Mvc.ViewComponent`.
|
|
885
|
+
*
|
|
886
|
+
* Ambiguous component names fail closed: two in-repo classes claiming the
|
|
887
|
+
* same name is not evidence for picking either one.
|
|
888
|
+
*/
|
|
889
|
+
export function emitRazorViewComponentEdges(graph, parsedFiles, nodeLookup, config, csharpSources) {
|
|
890
|
+
if (!config)
|
|
891
|
+
return;
|
|
892
|
+
const candidates = new Map();
|
|
893
|
+
for (const parsed of parsedFiles) {
|
|
894
|
+
if (!parsed.filePath.endsWith('.cs'))
|
|
895
|
+
continue;
|
|
896
|
+
const source = csharpSources.get(parsed.filePath) ?? '';
|
|
897
|
+
const binds = source.includes('ViewComponent') ? extractViewComponentAliasBinds(source) : [];
|
|
898
|
+
for (const def of parsed.localDefs) {
|
|
899
|
+
if (def.type !== 'Class')
|
|
900
|
+
continue;
|
|
901
|
+
const className = def.qualifiedName?.split('.').pop() ?? def.nodeId.split(':').pop() ?? '';
|
|
902
|
+
const conventionalName = className.endsWith(VIEW_COMPONENT_SUFFIX)
|
|
903
|
+
? className.slice(0, -VIEW_COMPONENT_SUFFIX.length)
|
|
904
|
+
: undefined;
|
|
905
|
+
const explicitAliases = bindAliasesForClass(binds, className, def.nodeId, parsed.filePath);
|
|
906
|
+
if (!conventionalName && (explicitAliases === undefined || explicitAliases.length === 0)) {
|
|
907
|
+
continue;
|
|
908
|
+
}
|
|
909
|
+
const targetId = resolveDefGraphId(parsed.filePath, def, nodeLookup);
|
|
910
|
+
if (!targetId || !graph.getNode(targetId))
|
|
911
|
+
continue;
|
|
912
|
+
// An explicit [ViewComponent(Name = "...")] replaces the suffix name,
|
|
913
|
+
// matching ASP.NET. Never register the SDK base type as a candidate.
|
|
914
|
+
if (explicitAliases !== undefined && explicitAliases.length > 0) {
|
|
915
|
+
for (const alias of explicitAliases)
|
|
916
|
+
addCandidate(candidates, alias, targetId);
|
|
917
|
+
}
|
|
918
|
+
else if (conventionalName) {
|
|
919
|
+
addCandidate(candidates, conventionalName, targetId);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
const emitFromFile = (filePath, invocationNames) => {
|
|
924
|
+
const sourceId = generateId('File', filePath);
|
|
925
|
+
if (!graph.getNode(sourceId))
|
|
926
|
+
return;
|
|
927
|
+
for (const invocationName of invocationNames) {
|
|
928
|
+
const matches = candidates.get(invocationName.toLocaleLowerCase('en-US'));
|
|
929
|
+
if (!matches || matches.size !== 1)
|
|
930
|
+
continue;
|
|
931
|
+
const targetId = matches.values().next().value;
|
|
932
|
+
if (typeof targetId !== 'string' || !graph.getNode(targetId))
|
|
933
|
+
continue;
|
|
934
|
+
graph.addRelationship({
|
|
935
|
+
id: generateId('CALLS', `${sourceId}:razor-view-component:${targetId}`),
|
|
936
|
+
sourceId,
|
|
937
|
+
targetId,
|
|
938
|
+
type: 'CALLS',
|
|
939
|
+
confidence: 0.9,
|
|
940
|
+
reason: 'aspnet-razor-view-component',
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
for (const [viewPath, invocationNames] of config.views) {
|
|
945
|
+
emitFromFile(viewPath, invocationNames);
|
|
946
|
+
}
|
|
947
|
+
for (const [filePath, source] of csharpSources) {
|
|
948
|
+
if (!filePath.endsWith('.cs'))
|
|
949
|
+
continue;
|
|
950
|
+
if (!source.includes('ViewComponent') && !source.includes('InvokeAsync'))
|
|
951
|
+
continue;
|
|
952
|
+
emitFromFile(filePath, extractCsharpViewComponentInvocations(source));
|
|
953
|
+
}
|
|
954
|
+
}
|