@kkvcrobatz107/codegraph 0.9.6-pkm.1
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/LICENSE +21 -0
- package/README.md +595 -0
- package/dist/bin/codegraph.d.ts +25 -0
- package/dist/bin/codegraph.d.ts.map +1 -0
- package/dist/bin/codegraph.js +1563 -0
- package/dist/bin/codegraph.js.map +1 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/node-version-check.d.ts.map +1 -0
- package/dist/bin/node-version-check.js +79 -0
- package/dist/bin/node-version-check.js.map +1 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/bin/uninstall.d.ts.map +1 -0
- package/dist/bin/uninstall.js +36 -0
- package/dist/bin/uninstall.js.map +1 -0
- package/dist/context/formatter.d.ts +30 -0
- package/dist/context/formatter.d.ts.map +1 -0
- package/dist/context/formatter.js +244 -0
- package/dist/context/formatter.js.map +1 -0
- package/dist/context/index.d.ts +110 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +1169 -0
- package/dist/context/index.js.map +1 -0
- package/dist/db/index.d.ts +101 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +251 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +131 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +281 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +1300 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.sql +151 -0
- package/dist/db/sqlite-adapter.d.ts +46 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/dist/db/sqlite-adapter.js +114 -0
- package/dist/db/sqlite-adapter.js.map +1 -0
- package/dist/directory.d.ts +57 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +264 -0
- package/dist/directory.js.map +1 -0
- package/dist/errors.d.ts +136 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +219 -0
- package/dist/errors.js.map +1 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/dist/extraction/dfm-extractor.js +151 -0
- package/dist/extraction/dfm-extractor.js.map +1 -0
- package/dist/extraction/grammars.d.ts +90 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +407 -0
- package/dist/extraction/grammars.js.map +1 -0
- package/dist/extraction/index.d.ts +138 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +1378 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/languages/c-cpp.d.ts +4 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/dist/extraction/languages/c-cpp.js +171 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -0
- package/dist/extraction/languages/csharp.d.ts +3 -0
- package/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/dist/extraction/languages/csharp.js +73 -0
- package/dist/extraction/languages/csharp.js.map +1 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/dart.d.ts.map +1 -0
- package/dist/extraction/languages/dart.js +192 -0
- package/dist/extraction/languages/dart.js.map +1 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/go.d.ts.map +1 -0
- package/dist/extraction/languages/go.js +70 -0
- package/dist/extraction/languages/go.js.map +1 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/index.d.ts.map +1 -0
- package/dist/extraction/languages/index.js +51 -0
- package/dist/extraction/languages/index.js.map +1 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/java.d.ts.map +1 -0
- package/dist/extraction/languages/java.js +70 -0
- package/dist/extraction/languages/java.js.map +1 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/dist/extraction/languages/javascript.js +90 -0
- package/dist/extraction/languages/javascript.js.map +1 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/dist/extraction/languages/kotlin.js +259 -0
- package/dist/extraction/languages/kotlin.js.map +1 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts.map +1 -0
- package/dist/extraction/languages/lua.js +150 -0
- package/dist/extraction/languages/lua.js.map +1 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts.map +1 -0
- package/dist/extraction/languages/luau.js +37 -0
- package/dist/extraction/languages/luau.js.map +1 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +133 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/dist/extraction/languages/pascal.js +66 -0
- package/dist/extraction/languages/pascal.js.map +1 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/php.d.ts.map +1 -0
- package/dist/extraction/languages/php.js +107 -0
- package/dist/extraction/languages/php.js.map +1 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/python.d.ts.map +1 -0
- package/dist/extraction/languages/python.js +56 -0
- package/dist/extraction/languages/python.js.map +1 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/dist/extraction/languages/ruby.js +114 -0
- package/dist/extraction/languages/ruby.js.map +1 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/rust.d.ts.map +1 -0
- package/dist/extraction/languages/rust.js +109 -0
- package/dist/extraction/languages/rust.js.map +1 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/scala.d.ts.map +1 -0
- package/dist/extraction/languages/scala.js +139 -0
- package/dist/extraction/languages/scala.js.map +1 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/swift.d.ts.map +1 -0
- package/dist/extraction/languages/swift.js +91 -0
- package/dist/extraction/languages/swift.js.map +1 -0
- package/dist/extraction/languages/typescript.d.ts +3 -0
- package/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/dist/extraction/languages/typescript.js +129 -0
- package/dist/extraction/languages/typescript.js.map +1 -0
- package/dist/extraction/liquid-extractor.d.ts +52 -0
- package/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/dist/extraction/liquid-extractor.js +313 -0
- package/dist/extraction/liquid-extractor.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +198 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/parse-worker.d.ts.map +1 -0
- package/dist/extraction/parse-worker.js +94 -0
- package/dist/extraction/parse-worker.js.map +1 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/dist/extraction/svelte-extractor.js +272 -0
- package/dist/extraction/svelte-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-helpers.js +103 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +193 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-types.js +10 -0
- package/dist/extraction/tree-sitter-types.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts +291 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/dist/extraction/tree-sitter.js +2961 -0
- package/dist/extraction/tree-sitter.js.map +1 -0
- package/dist/extraction/vue-extractor.d.ts +36 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/dist/extraction/vue-extractor.js +163 -0
- package/dist/extraction/vue-extractor.js.map +1 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/dist/extraction/wasm-runtime-flags.js +105 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +366 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/graph/traversal.d.ts.map +1 -0
- package/dist/graph/traversal.js +528 -0
- package/dist/graph/traversal.js.map +1 -0
- package/dist/index.d.ts +460 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +863 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/claude-md-template.d.ts +14 -0
- package/dist/installer/claude-md-template.d.ts.map +1 -0
- package/dist/installer/claude-md-template.js +21 -0
- package/dist/installer/claude-md-template.js.map +1 -0
- package/dist/installer/config-writer.d.ts +29 -0
- package/dist/installer/config-writer.d.ts.map +1 -0
- package/dist/installer/config-writer.js +111 -0
- package/dist/installer/config-writer.js.map +1 -0
- package/dist/installer/index.d.ts +117 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +528 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +28 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +65 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +307 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +47 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +401 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/codex.d.ts.map +1 -0
- package/dist/installer/targets/codex.js +185 -0
- package/dist/installer/targets/codex.js.map +1 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/cursor.d.ts.map +1 -0
- package/dist/installer/targets/cursor.js +283 -0
- package/dist/installer/targets/cursor.js.map +1 -0
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +165 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -0
- package/dist/installer/targets/hermes.js +359 -0
- package/dist/installer/targets/hermes.js.map +1 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +196 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts +30 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +235 -0
- package/dist/installer/targets/opencode.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +91 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +77 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +246 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/toml.d.ts.map +1 -0
- package/dist/installer/targets/toml.js +147 -0
- package/dist/installer/targets/toml.js.map +1 -0
- package/dist/installer/targets/types.d.ts +116 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +16 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +125 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon.d.ts +161 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +403 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/engine.d.ts +100 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +291 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +109 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +470 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/proxy.d.ts +46 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +276 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +19 -0
- package/dist/mcp/server-instructions.d.ts.map +1 -0
- package/dist/mcp/server-instructions.js +73 -0
- package/dist/mcp/server-instructions.js.map +1 -0
- package/dist/mcp/session.d.ts +67 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +276 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +385 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +2545 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +343 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +924 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/dist/resolution/frameworks/csharp.js +241 -0
- package/dist/resolution/frameworks/csharp.js.map +1 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/dist/resolution/frameworks/drupal.js +367 -0
- package/dist/resolution/frameworks/drupal.js.map +1 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +143 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/dist/resolution/frameworks/express.js +308 -0
- package/dist/resolution/frameworks/express.js.map +1 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/dist/resolution/frameworks/go.js +161 -0
- package/dist/resolution/frameworks/go.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +48 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/resolution/frameworks/index.js +161 -0
- package/dist/resolution/frameworks/index.js.map +1 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/dist/resolution/frameworks/java.js +504 -0
- package/dist/resolution/frameworks/java.js.map +1 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/dist/resolution/frameworks/laravel.js +257 -0
- package/dist/resolution/frameworks/laravel.js.map +1 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/dist/resolution/frameworks/nestjs.js +698 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/dist/resolution/frameworks/python.js +396 -0
- package/dist/resolution/frameworks/python.js.map +1 -0
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +360 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/dist/resolution/frameworks/react.js +365 -0
- package/dist/resolution/frameworks/react.js.map +1 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/dist/resolution/frameworks/ruby.js +302 -0
- package/dist/resolution/frameworks/ruby.js.map +1 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/dist/resolution/frameworks/rust.js +304 -0
- package/dist/resolution/frameworks/rust.js.map +1 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/dist/resolution/frameworks/svelte.js +249 -0
- package/dist/resolution/frameworks/svelte.js.map +1 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift.js +400 -0
- package/dist/resolution/frameworks/swift.js.map +1 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/dist/resolution/frameworks/vue.js +306 -0
- package/dist/resolution/frameworks/vue.js.map +1 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +68 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -0
- package/dist/resolution/import-resolver.js +1231 -0
- package/dist/resolution/import-resolver.js.map +1 -0
- package/dist/resolution/index.d.ts +116 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +878 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.d.ts.map +1 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/lru-cache.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +32 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +596 -0
- package/dist/resolution/name-matcher.js.map +1 -0
- package/dist/resolution/path-aliases.d.ts +68 -0
- package/dist/resolution/path-aliases.d.ts.map +1 -0
- package/dist/resolution/path-aliases.js +238 -0
- package/dist/resolution/path-aliases.js.map +1 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/strip-comments.d.ts.map +1 -0
- package/dist/resolution/strip-comments.js +441 -0
- package/dist/resolution/strip-comments.js.map +1 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +209 -0
- package/dist/resolution/types.d.ts.map +1 -0
- package/dist/resolution/types.js +8 -0
- package/dist/resolution/types.js.map +1 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-parser.d.ts.map +1 -0
- package/dist/search/query-parser.js +177 -0
- package/dist/search/query-parser.js.map +1 -0
- package/dist/search/query-utils.d.ts +53 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +350 -0
- package/dist/search/query-utils.js.map +1 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/git-hooks.d.ts.map +1 -0
- package/dist/sync/git-hooks.js +223 -0
- package/dist/sync/git-hooks.js.map +1 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +35 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watch-policy.d.ts.map +1 -0
- package/dist/sync/watch-policy.js +124 -0
- package/dist/sync/watch-policy.js.map +1 -0
- package/dist/sync/watcher.d.ts +191 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +398 -0
- package/dist/sync/watcher.js.map +1 -0
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +136 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/types.d.ts +369 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +78 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +78 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/dist/ui/shimmer-progress.js +90 -0
- package/dist/ui/shimmer-progress.js.map +1 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/dist/ui/shimmer-worker.js +118 -0
- package/dist/ui/shimmer-worker.js.map +1 -0
- package/dist/ui/types.d.ts +17 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +3 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/utils.d.ts +205 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +549 -0
- package/dist/utils.js.map +1 -0
- package/package.json +59 -0
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/audit.sh +68 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +107 -0
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +67 -0
- package/scripts/agent-eval/parse-run.mjs +45 -0
- package/scripts/agent-eval/parse-session.mjs +93 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +67 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +118 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/npm-shim.js +246 -0
- package/scripts/pack-npm.sh +95 -0
- package/scripts/prepare-release.mjs +270 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drupal.d.ts","sourceRoot":"","sources":["../../../src/resolution/frameworks/drupal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,OAAO,EAAE,iBAAiB,EAAiD,MAAM,UAAU,CAAC;AAoP5F,eAAO,MAAM,cAAc,EAAE,iBAsH5B,CAAC"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Drupal Framework Resolver
|
|
4
|
+
*
|
|
5
|
+
* Supports Drupal 8/9/10/11 (Composer-based projects). Drupal 7 is not supported.
|
|
6
|
+
*
|
|
7
|
+
* ## What this resolver does
|
|
8
|
+
*
|
|
9
|
+
* 1. **Detection** — reads composer.json and checks for any `drupal/*` dependency in
|
|
10
|
+
* `require` or `require-dev`.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Route extraction** — parses `*.routing.yml` files and emits `route` nodes for each
|
|
13
|
+
* Drupal route, with `references` edges to the `_controller`, `_form`, or entity handler
|
|
14
|
+
* class/method.
|
|
15
|
+
*
|
|
16
|
+
* 3. **Hook detection** — scans `.module`, `.install`, `.theme`, and `.inc` files for Drupal
|
|
17
|
+
* hook implementations. Two strategies are used:
|
|
18
|
+
* a. Docblock: `@Implements hook_X()` → precise, no false positives.
|
|
19
|
+
* b. Name pattern: function `{moduleName}_{hookSuffix}()` → catches hooks without
|
|
20
|
+
* docblocks but may produce false positives on helper functions.
|
|
21
|
+
* Detected hooks emit an `UnresolvedRef` from the implementing function node to the
|
|
22
|
+
* canonical `hook_X` name, linking implementations to the hook when `codegraph_callers`
|
|
23
|
+
* is invoked.
|
|
24
|
+
*
|
|
25
|
+
* ## Design decisions (review in future iterations)
|
|
26
|
+
*
|
|
27
|
+
* - Hook graph resolution (v1): hook references are stored as UnresolvedRef pointing to the
|
|
28
|
+
* canonical `hook_X` name. If Drupal core is indexed, these will resolve to core hook
|
|
29
|
+
* definitions. Without core, they remain unresolved but are still searchable via
|
|
30
|
+
* `codegraph_search("form_alter")`. Full hook-node creation (virtual nodes for every hook)
|
|
31
|
+
* is deferred to a future iteration.
|
|
32
|
+
*
|
|
33
|
+
* - Services / plugins (out of scope for v1): `*.services.yml` service definitions and plugin
|
|
34
|
+
* annotations (`@Block`, `@FormElement`, etc.) are not extracted. Add a TODO below when
|
|
35
|
+
* ready to implement.
|
|
36
|
+
*
|
|
37
|
+
* - Twig templates (out of scope for v1): `.twig` files are tracked as file nodes but no
|
|
38
|
+
* symbol extraction is performed (no tree-sitter Twig grammar). Implement when a Twig
|
|
39
|
+
* grammar WASM is available.
|
|
40
|
+
*
|
|
41
|
+
* ## TODOs for future iterations
|
|
42
|
+
*
|
|
43
|
+
* - TODO: Extract service definitions from `*.services.yml` files (class → service-id edges).
|
|
44
|
+
* - TODO: Extract plugin annotations (`@Block`, `@FormElement`, `@Field`, etc.) from PHP
|
|
45
|
+
* docblocks and emit plugin nodes with references to the annotated class.
|
|
46
|
+
* - TODO: Add Twig symbol extraction when a tree-sitter Twig grammar becomes available.
|
|
47
|
+
* - TODO: Improve hook resolution: create virtual `hook_*` nodes so `codegraph_callers`
|
|
48
|
+
* returns all implementations even when Drupal core is not indexed.
|
|
49
|
+
*/
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.drupalResolver = void 0;
|
|
52
|
+
const tree_sitter_helpers_1 = require("../../extraction/tree-sitter-helpers");
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Helpers
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
/**
|
|
57
|
+
* Parse the last PHP namespace segment from a FQCN like `\Drupal\mymodule\Controller\Foo`.
|
|
58
|
+
* Returns `null` for strings that don't look like a FQCN.
|
|
59
|
+
*/
|
|
60
|
+
function lastSegment(fqcn) {
|
|
61
|
+
const clean = fqcn.replace(/^\\+/, '').trim();
|
|
62
|
+
if (!clean.includes('\\'))
|
|
63
|
+
return null;
|
|
64
|
+
const parts = clean.split('\\');
|
|
65
|
+
return parts[parts.length - 1] ?? null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Derive the Drupal module name from a file path.
|
|
69
|
+
* e.g. `web/modules/custom/my_module/my_module.module` → `my_module`
|
|
70
|
+
*/
|
|
71
|
+
function moduleNameFromPath(filePath) {
|
|
72
|
+
const match = filePath.match(/\/([^/]+)\.[^./]+$/);
|
|
73
|
+
return match ? match[1] : null;
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Route extraction helpers
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
/**
|
|
79
|
+
* Extract route nodes and handler references from a Drupal `*.routing.yml` file.
|
|
80
|
+
*
|
|
81
|
+
* Drupal routing YAML format:
|
|
82
|
+
*
|
|
83
|
+
* route.name:
|
|
84
|
+
* path: '/some/path'
|
|
85
|
+
* defaults:
|
|
86
|
+
* _controller: '\Drupal\module\Controller\MyController::method'
|
|
87
|
+
* _form: '\Drupal\module\Form\MyForm'
|
|
88
|
+
* _title: 'Page title'
|
|
89
|
+
* requirements:
|
|
90
|
+
* _permission: 'access content'
|
|
91
|
+
* methods: [GET, POST] # optional
|
|
92
|
+
*/
|
|
93
|
+
function extractDrupalRoutes(filePath, content) {
|
|
94
|
+
const nodes = [];
|
|
95
|
+
const references = [];
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
const lines = content.split('\n');
|
|
98
|
+
let pending = null;
|
|
99
|
+
let currentPath = null;
|
|
100
|
+
let handlerRefs = [];
|
|
101
|
+
let methods = [];
|
|
102
|
+
const flushRoute = () => {
|
|
103
|
+
if (!pending || !currentPath)
|
|
104
|
+
return;
|
|
105
|
+
const methodTag = methods.length > 0 ? ` [${methods.join(',')}]` : '';
|
|
106
|
+
const routeNode = {
|
|
107
|
+
id: `route:${filePath}:${pending.lineNum}:${currentPath}`,
|
|
108
|
+
kind: 'route',
|
|
109
|
+
name: `${currentPath}${methodTag}`,
|
|
110
|
+
qualifiedName: `${filePath}::${pending.name}`,
|
|
111
|
+
filePath,
|
|
112
|
+
startLine: pending.lineNum,
|
|
113
|
+
endLine: pending.lineNum,
|
|
114
|
+
startColumn: 0,
|
|
115
|
+
endColumn: 0,
|
|
116
|
+
language: 'yaml',
|
|
117
|
+
updatedAt: now,
|
|
118
|
+
};
|
|
119
|
+
nodes.push(routeNode);
|
|
120
|
+
for (const handler of handlerRefs) {
|
|
121
|
+
references.push({
|
|
122
|
+
fromNodeId: routeNode.id,
|
|
123
|
+
referenceName: handler,
|
|
124
|
+
referenceKind: 'references',
|
|
125
|
+
line: pending.lineNum,
|
|
126
|
+
column: 0,
|
|
127
|
+
filePath,
|
|
128
|
+
language: 'yaml',
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
for (let i = 0; i < lines.length; i++) {
|
|
133
|
+
const line = lines[i];
|
|
134
|
+
const trimmed = line.trim();
|
|
135
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
136
|
+
continue;
|
|
137
|
+
// Top-level route name: no leading whitespace, ends with a colon (no value after)
|
|
138
|
+
if (/^\S.*:\s*$/.test(line) && !/^\s/.test(line)) {
|
|
139
|
+
flushRoute();
|
|
140
|
+
pending = { name: trimmed.slice(0, -1).trim(), lineNum: i + 1 };
|
|
141
|
+
currentPath = null;
|
|
142
|
+
handlerRefs = [];
|
|
143
|
+
methods = [];
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
// path: '/some/path'
|
|
147
|
+
const pathMatch = trimmed.match(/^path:\s*['"]?([^'"#\n]+?)['"]?\s*(?:#.*)?$/);
|
|
148
|
+
if (pathMatch) {
|
|
149
|
+
currentPath = pathMatch[1].trim();
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
// _controller: '\Drupal\...\Class::method'
|
|
153
|
+
const controllerMatch = trimmed.match(/^_controller:\s*['"]?([^'"#\n]+?)['"]?\s*(?:#.*)?$/);
|
|
154
|
+
if (controllerMatch) {
|
|
155
|
+
handlerRefs.push(controllerMatch[1].trim());
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
// _form: '\Drupal\...\Form\MyForm'
|
|
159
|
+
const formMatch = trimmed.match(/^_form:\s*['"]?([^'"#\n]+?)['"]?\s*(?:#.*)?$/);
|
|
160
|
+
if (formMatch) {
|
|
161
|
+
handlerRefs.push(formMatch[1].trim());
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
// _entity_form / _entity_list / _entity_view: entity.type
|
|
165
|
+
const entityMatch = trimmed.match(/^_(entity_form|entity_list|entity_view):\s*['"]?([^'"#\n]+?)['"]?\s*(?:#.*)?$/);
|
|
166
|
+
if (entityMatch) {
|
|
167
|
+
handlerRefs.push(entityMatch[2].trim());
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// methods: [GET, POST] or methods: [GET]
|
|
171
|
+
const methodsMatch = trimmed.match(/^methods:\s*\[([^\]]+)\]/);
|
|
172
|
+
if (methodsMatch) {
|
|
173
|
+
methods = methodsMatch[1].split(',').map((m) => m.trim().toUpperCase()).filter(Boolean);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
flushRoute();
|
|
178
|
+
return { nodes, references };
|
|
179
|
+
}
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// Hook detection helpers
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
const HOOK_FILE_EXTENSIONS = ['.module', '.install', '.theme', '.inc'];
|
|
184
|
+
function isDrupalHookFile(filePath) {
|
|
185
|
+
return HOOK_FILE_EXTENSIONS.some((ext) => filePath.endsWith(ext));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Extract hook implementation references from a Drupal PHP file.
|
|
189
|
+
*
|
|
190
|
+
* Strategy A (primary): look for docblocks containing `Implements hook_X().`
|
|
191
|
+
* followed immediately by the function definition. This is the Drupal coding
|
|
192
|
+
* standard and is precise.
|
|
193
|
+
*
|
|
194
|
+
* Strategy B (fallback): for functions whose name starts with `{moduleName}_`,
|
|
195
|
+
* treat the suffix as the hook name. Catches hooks without docblocks but may
|
|
196
|
+
* produce false positives on non-hook helper functions.
|
|
197
|
+
*
|
|
198
|
+
* Each detected hook emits an UnresolvedRef from the implementing function node
|
|
199
|
+
* (identified by computing the same ID tree-sitter would generate) to the
|
|
200
|
+
* canonical hook name, e.g. `hook_form_alter`.
|
|
201
|
+
*/
|
|
202
|
+
function extractDrupalHooks(filePath, content) {
|
|
203
|
+
const references = [];
|
|
204
|
+
// Build a map of function name → 1-indexed line number for all top-level functions.
|
|
205
|
+
// This mirrors tree-sitter's line numbering so we can reconstruct node IDs.
|
|
206
|
+
const funcLineMap = new Map();
|
|
207
|
+
const funcDef = /^function\s+(\w+)\s*\(/gm;
|
|
208
|
+
let fm;
|
|
209
|
+
while ((fm = funcDef.exec(content)) !== null) {
|
|
210
|
+
const name = fm[1];
|
|
211
|
+
if (!funcLineMap.has(name)) {
|
|
212
|
+
// line = number of newlines before match start + 1
|
|
213
|
+
funcLineMap.set(name, content.slice(0, fm.index).split('\n').length);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const emitHookRef = (hookName, funcName) => {
|
|
217
|
+
const lineNum = funcLineMap.get(funcName);
|
|
218
|
+
if (lineNum === undefined)
|
|
219
|
+
return;
|
|
220
|
+
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(filePath, 'function', funcName, lineNum);
|
|
221
|
+
references.push({
|
|
222
|
+
fromNodeId: nodeId,
|
|
223
|
+
referenceName: hookName,
|
|
224
|
+
referenceKind: 'references',
|
|
225
|
+
line: lineNum,
|
|
226
|
+
column: 0,
|
|
227
|
+
filePath,
|
|
228
|
+
language: 'php',
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
// Strategy A: docblock `Implements hook_X().` followed by function definition.
|
|
232
|
+
// The docblock and function may be separated by blank lines.
|
|
233
|
+
const docblockPattern = /\/\*\*[\s\S]*?(?:@|\*\s+)Implements\s+(hook_\w+)\s*\(\)[\s\S]*?\*\/\s*\n(?:\s*\n)*function\s+(\w+)\s*\(/g;
|
|
234
|
+
const docblockMatched = new Set();
|
|
235
|
+
let match;
|
|
236
|
+
while ((match = docblockPattern.exec(content)) !== null) {
|
|
237
|
+
const [, hookName, funcName] = match;
|
|
238
|
+
emitHookRef(hookName, funcName);
|
|
239
|
+
docblockMatched.add(funcName);
|
|
240
|
+
}
|
|
241
|
+
// Strategy B: fallback name-pattern matching for functions without docblocks.
|
|
242
|
+
// Only applies to functions whose name starts with {moduleName}_ and that were
|
|
243
|
+
// not already matched by Strategy A.
|
|
244
|
+
const moduleName = moduleNameFromPath(filePath);
|
|
245
|
+
if (moduleName) {
|
|
246
|
+
const prefix = moduleName + '_';
|
|
247
|
+
for (const [funcName] of funcLineMap) {
|
|
248
|
+
if (docblockMatched.has(funcName))
|
|
249
|
+
continue;
|
|
250
|
+
if (!funcName.startsWith(prefix))
|
|
251
|
+
continue;
|
|
252
|
+
const hookSuffix = funcName.slice(prefix.length);
|
|
253
|
+
if (!hookSuffix)
|
|
254
|
+
continue;
|
|
255
|
+
// Emit a reference to hook_{suffix} — the resolver will link it if the
|
|
256
|
+
// hook is defined somewhere in the indexed graph (e.g. Drupal core).
|
|
257
|
+
emitHookRef(`hook_${hookSuffix}`, funcName);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return { nodes: [], references };
|
|
261
|
+
}
|
|
262
|
+
// ---------------------------------------------------------------------------
|
|
263
|
+
// Resolver
|
|
264
|
+
// ---------------------------------------------------------------------------
|
|
265
|
+
exports.drupalResolver = {
|
|
266
|
+
name: 'drupal',
|
|
267
|
+
languages: ['php', 'yaml'],
|
|
268
|
+
// Drupal route handlers are FQCNs (`\Drupal\…\Class::method`, the single-colon
|
|
269
|
+
// controller-service form `\Drupal\…\Class:method`, or a bare `\…\FormClass`)
|
|
270
|
+
// and hook refs are canonical `hook_*` names — none match a declared symbol, so
|
|
271
|
+
// resolveOne's pre-filter would drop them before resolve() runs. Claim the
|
|
272
|
+
// shapes resolve() handles (mirrors the Rails `controller#action` claim).
|
|
273
|
+
claimsReference(name) {
|
|
274
|
+
return (name.startsWith('hook_') ||
|
|
275
|
+
name.includes('\\') ||
|
|
276
|
+
/^[A-Za-z_]\w*::?\w+$/.test(name));
|
|
277
|
+
},
|
|
278
|
+
detect(context) {
|
|
279
|
+
// Primary: composer.json identifies a Drupal project/module/theme/profile.
|
|
280
|
+
// A contrib module often has an EMPTY `require` (no `drupal/*` dep) but still
|
|
281
|
+
// declares `"name": "drupal/<module>"` and `"type": "drupal-module"`, so check
|
|
282
|
+
// those too — checking deps alone misses every standalone contrib module.
|
|
283
|
+
const composer = context.readFile('composer.json');
|
|
284
|
+
if (composer) {
|
|
285
|
+
try {
|
|
286
|
+
const json = JSON.parse(composer);
|
|
287
|
+
if (typeof json.name === 'string' && json.name.startsWith('drupal/'))
|
|
288
|
+
return true;
|
|
289
|
+
if (typeof json.type === 'string' && json.type.startsWith('drupal-'))
|
|
290
|
+
return true;
|
|
291
|
+
const deps = { ...json.require, ...(json['require-dev'] ?? {}) };
|
|
292
|
+
if (Object.keys(deps).some((k) => k.startsWith('drupal/')))
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
// malformed composer.json — fall through to file-based detection
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Fallback (composer-less module, or a non-Drupal composer.json): the
|
|
300
|
+
// unmistakable Drupal signature is a `*.info.yml` manifest alongside a
|
|
301
|
+
// Drupal PHP/route file. Require both so a stray `.info.yml` elsewhere
|
|
302
|
+
// doesn't trigger a false positive.
|
|
303
|
+
const files = context.getAllFiles();
|
|
304
|
+
const hasInfoYml = files.some((f) => f.endsWith('.info.yml'));
|
|
305
|
+
if (!hasInfoYml)
|
|
306
|
+
return false;
|
|
307
|
+
return files.some((f) => f.endsWith('.routing.yml') ||
|
|
308
|
+
f.endsWith('.module') ||
|
|
309
|
+
f.endsWith('.install') ||
|
|
310
|
+
f.endsWith('.theme'));
|
|
311
|
+
},
|
|
312
|
+
resolve(ref, context) {
|
|
313
|
+
const name = ref.referenceName;
|
|
314
|
+
// _controller: '\Drupal\module\...\ClassName::methodName' (double colon) or the
|
|
315
|
+
// single-colon controller-service form '\Drupal\...\ClassName:methodName'.
|
|
316
|
+
const controllerMatch = name.match(/^\\?(?:Drupal\\[^:]+\\)?([^\\:]+):{1,2}(\w+)$/);
|
|
317
|
+
if (controllerMatch) {
|
|
318
|
+
const [, className, methodName] = controllerMatch;
|
|
319
|
+
const classNodes = context.getNodesByName(className);
|
|
320
|
+
for (const cls of classNodes) {
|
|
321
|
+
if (cls.kind !== 'class')
|
|
322
|
+
continue;
|
|
323
|
+
const fileNodes = context.getNodesInFile(cls.filePath);
|
|
324
|
+
const method = fileNodes.find((n) => n.kind === 'method' && n.name === methodName);
|
|
325
|
+
if (method) {
|
|
326
|
+
return { original: ref, targetNodeId: method.id, confidence: 0.9, resolvedBy: 'framework' };
|
|
327
|
+
}
|
|
328
|
+
return { original: ref, targetNodeId: cls.id, confidence: 0.7, resolvedBy: 'framework' };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
// _form / _entity_form: '\Drupal\module\...\ClassName' (bare FQCN, no method)
|
|
332
|
+
if (name.includes('\\') && !name.includes(':')) {
|
|
333
|
+
const className = lastSegment(name);
|
|
334
|
+
if (className) {
|
|
335
|
+
const classNodes = context.getNodesByName(className);
|
|
336
|
+
const cls = classNodes.find((n) => n.kind === 'class');
|
|
337
|
+
if (cls) {
|
|
338
|
+
return { original: ref, targetNodeId: cls.id, confidence: 0.85, resolvedBy: 'framework' };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// hook_X — find any function whose name ends in _{hookSuffix} in a hook file
|
|
343
|
+
if (name.startsWith('hook_')) {
|
|
344
|
+
const hookSuffix = name.slice(5); // strip 'hook_'
|
|
345
|
+
const candidates = context.getNodesByKind('function').filter((n) => n.name.endsWith(`_${hookSuffix}`) && isDrupalHookFile(n.filePath));
|
|
346
|
+
if (candidates.length > 0) {
|
|
347
|
+
return {
|
|
348
|
+
original: ref,
|
|
349
|
+
targetNodeId: candidates[0].id,
|
|
350
|
+
confidence: 0.75,
|
|
351
|
+
resolvedBy: 'framework',
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return null;
|
|
356
|
+
},
|
|
357
|
+
extract(filePath, content) {
|
|
358
|
+
if (filePath.endsWith('.routing.yml')) {
|
|
359
|
+
return extractDrupalRoutes(filePath, content);
|
|
360
|
+
}
|
|
361
|
+
if (isDrupalHookFile(filePath) || filePath.endsWith('.php')) {
|
|
362
|
+
return extractDrupalHooks(filePath, content);
|
|
363
|
+
}
|
|
364
|
+
return { nodes: [], references: [] };
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
//# sourceMappingURL=drupal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drupal.js","sourceRoot":"","sources":["../../../src/resolution/frameworks/drupal.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;;;AAEH,8EAAsE;A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AAO,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expo-modules.d.ts","sourceRoot":"","sources":["../../../src/resolution/frameworks/expo-modules.ts"],"names":[],"mappings":"AAyCA,OAAO,EAEL,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAsGlB,eAAO,MAAM,mBAAmB,EAAE,iBA8CjC,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expoModulesResolver = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Match `Function("name")`, `AsyncFunction("name")`, or `Property("name")`
|
|
6
|
+
* at the start of an expression (line-anchored after optional whitespace).
|
|
7
|
+
* The trailing closure that follows isn't captured — we just need the name
|
|
8
|
+
* literal that becomes the JS-visible method.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: the regex deliberately requires the open paren to live on the same
|
|
11
|
+
* line as the keyword, which matches every real Expo Module declaration
|
|
12
|
+
* style. Multi-line `AsyncFunction(\n"x"\n)` forms aren't a real shape in
|
|
13
|
+
* the SDK; if any appear we'd extend the regex.
|
|
14
|
+
*/
|
|
15
|
+
const EXPO_DECL_RE = /\b(Function|AsyncFunction|Property|Constants)\s*\(\s*["']([A-Za-z_][A-Za-z0-9_]*)["']/g;
|
|
16
|
+
/**
|
|
17
|
+
* Match the module name literal `Name("ExpoX")`. Used to enrich each emitted
|
|
18
|
+
* method's qualifiedName so the same JS callsite to `Foo.fn` doesn't ambiguate
|
|
19
|
+
* across multiple Expo modules in a monorepo.
|
|
20
|
+
*/
|
|
21
|
+
const EXPO_MODULE_NAME_RE = /\bName\s*\(\s*["']([A-Za-z_][A-Za-z0-9_]*)["']/;
|
|
22
|
+
/**
|
|
23
|
+
* Heuristic class-name match — used as a fallback if `Name(...)` literal
|
|
24
|
+
* isn't found. Detects `class XxxModule: Module` (Swift) or
|
|
25
|
+
* `class XxxModule : Module` (Kotlin / with whitespace tolerance).
|
|
26
|
+
*/
|
|
27
|
+
const EXPO_CLASS_RE = /\bclass\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*Module\b/;
|
|
28
|
+
/**
|
|
29
|
+
* Detect whether a file is plausibly an Expo Module — looking for both
|
|
30
|
+
* the `: Module` inheritance and at least one declarative `Function(...)`
|
|
31
|
+
* / `AsyncFunction(...)` / `Property(...)` / `Name(...)` literal. Any one
|
|
32
|
+
* of those alone produces too many false positives (random Swift code can
|
|
33
|
+
* have `class X: Module` for unrelated reasons).
|
|
34
|
+
*/
|
|
35
|
+
function isExpoModuleSource(source) {
|
|
36
|
+
if (!EXPO_CLASS_RE.test(source))
|
|
37
|
+
return false;
|
|
38
|
+
// Reset lastIndex defensively; EXPO_DECL_RE has the `g` flag.
|
|
39
|
+
EXPO_DECL_RE.lastIndex = 0;
|
|
40
|
+
return EXPO_DECL_RE.test(source);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Extract Expo Module method declarations from a Swift / Kotlin source
|
|
44
|
+
* file. Each `Function("X") { … }` / `AsyncFunction("X") { … }` /
|
|
45
|
+
* `Property("X") { … }` literal becomes a method node named `X`,
|
|
46
|
+
* attributed to the file at the line of the literal.
|
|
47
|
+
*/
|
|
48
|
+
function extractExpoMethods(filePath, source, language) {
|
|
49
|
+
if (!isExpoModuleSource(source))
|
|
50
|
+
return [];
|
|
51
|
+
const nodes = [];
|
|
52
|
+
const nameMatch = source.match(EXPO_MODULE_NAME_RE);
|
|
53
|
+
const classMatch = source.match(EXPO_CLASS_RE);
|
|
54
|
+
// Prefer the explicit `Name("X")` literal — that's the JS-visible
|
|
55
|
+
// module name. Class name is the fallback.
|
|
56
|
+
const moduleName = nameMatch?.[1] ?? classMatch?.[1] ?? 'ExpoModule';
|
|
57
|
+
const now = Date.now();
|
|
58
|
+
const seenAtLine = new Set();
|
|
59
|
+
EXPO_DECL_RE.lastIndex = 0;
|
|
60
|
+
let m;
|
|
61
|
+
while ((m = EXPO_DECL_RE.exec(source)) !== null) {
|
|
62
|
+
const kind = m[1];
|
|
63
|
+
const methodName = m[2];
|
|
64
|
+
// Compute line number from match index.
|
|
65
|
+
const before = source.slice(0, m.index);
|
|
66
|
+
const startLine = before.split('\n').length;
|
|
67
|
+
// Avoid duplicates if the same method literal appears twice in one
|
|
68
|
+
// file (e.g., declared and re-declared inside a `View {...}` block).
|
|
69
|
+
const dedupKey = `${methodName}:${startLine}`;
|
|
70
|
+
if (seenAtLine.has(dedupKey))
|
|
71
|
+
continue;
|
|
72
|
+
seenAtLine.add(dedupKey);
|
|
73
|
+
const startColumn = before.length - before.lastIndexOf('\n') - 1;
|
|
74
|
+
nodes.push({
|
|
75
|
+
id: `expo-module:${filePath}:${moduleName}:${methodName}:${startLine}`,
|
|
76
|
+
kind: 'method',
|
|
77
|
+
name: methodName,
|
|
78
|
+
qualifiedName: `${filePath}::${moduleName}.${methodName}`,
|
|
79
|
+
filePath,
|
|
80
|
+
language,
|
|
81
|
+
startLine,
|
|
82
|
+
// We don't extract the closure body's end-line — use the literal's
|
|
83
|
+
// line as a single-line range. trace/explore still surfaces the
|
|
84
|
+
// declaration site, which is the main user-visible signal.
|
|
85
|
+
endLine: startLine,
|
|
86
|
+
startColumn,
|
|
87
|
+
endColumn: startColumn + kind.length + 2 + methodName.length + 2,
|
|
88
|
+
docstring: `Expo Modules ${kind}("${methodName}") in ${moduleName}`,
|
|
89
|
+
signature: `${kind}("${methodName}")`,
|
|
90
|
+
isExported: true,
|
|
91
|
+
updatedAt: now,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return nodes;
|
|
95
|
+
}
|
|
96
|
+
exports.expoModulesResolver = {
|
|
97
|
+
name: 'expo-modules',
|
|
98
|
+
languages: ['swift', 'kotlin'],
|
|
99
|
+
/**
|
|
100
|
+
* Detect Expo Modules by looking at the project's package.json or
|
|
101
|
+
* a small scan of source files for the `: Module` + declarative-DSL
|
|
102
|
+
* markers. Either signal suffices.
|
|
103
|
+
*/
|
|
104
|
+
detect(context) {
|
|
105
|
+
const pkg = context.readFile('package.json');
|
|
106
|
+
if (pkg && /["']expo-modules-core["']\s*:/.test(pkg))
|
|
107
|
+
return true;
|
|
108
|
+
const files = context.getAllFiles();
|
|
109
|
+
for (let i = 0; i < Math.min(files.length, 200); i++) {
|
|
110
|
+
const f = files[i];
|
|
111
|
+
if (!f)
|
|
112
|
+
continue;
|
|
113
|
+
if (f.endsWith('.swift') || f.endsWith('.kt')) {
|
|
114
|
+
const src = context.readFile(f);
|
|
115
|
+
if (src && isExpoModuleSource(src))
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Per-file extraction — the orchestrator invokes this for every
|
|
123
|
+
* `.swift` / `.kt` file in the project. We only emit nodes when the
|
|
124
|
+
* file looks like an Expo Module; otherwise return empty.
|
|
125
|
+
*/
|
|
126
|
+
extract(filePath, source) {
|
|
127
|
+
const language = filePath.endsWith('.kt') ? 'kotlin' : 'swift';
|
|
128
|
+
return {
|
|
129
|
+
nodes: extractExpoMethods(filePath, source, language),
|
|
130
|
+
references: [],
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* No bespoke resolution needed — the synthetic method nodes emitted by
|
|
135
|
+
* `extract()` get picked up by the standard name-matcher when a JS
|
|
136
|
+
* callsite like `Foo.takePictureAsync(args)` resolves. Returning null
|
|
137
|
+
* here is correct.
|
|
138
|
+
*/
|
|
139
|
+
resolve() {
|
|
140
|
+
return null;
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=expo-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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