@colbymchenry/codegraph-win32-arm64 1.6.3 → 1.6.4
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/lib/dist/.test-build-engine.json +1 -1
- package/lib/dist/.test-build-viewer.json +1 -1
- package/lib/dist/bin/codegraph.js +85 -17
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/db/queries.d.ts +44 -1
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +75 -5
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/engine.d.ts +1 -1
- package/lib/dist/engine.d.ts.map +1 -1
- package/lib/dist/engine.js +2 -1
- package/lib/dist/engine.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +4 -2
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +12 -1
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +28 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +106 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +11 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +42 -3
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/index.js +23 -2
- package/lib/dist/extraction/kernel/index.js.map +1 -1
- package/lib/dist/extraction/kernel/loader.d.ts +5 -1
- package/lib/dist/extraction/kernel/loader.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/loader.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts +47 -2
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +193 -6
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +8 -13
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/php.d.ts +9 -0
- package/lib/dist/extraction/languages/php.d.ts.map +1 -1
- package/lib/dist/extraction/languages/php.js +202 -2
- package/lib/dist/extraction/languages/php.js.map +1 -1
- package/lib/dist/extraction/languages/rust-macro-calls.d.ts +32 -0
- package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
- package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
- package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
- package/lib/dist/extraction/parse-budget.d.ts +42 -7
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
- package/lib/dist/extraction/parse-budget.js +39 -2
- package/lib/dist/extraction/parse-budget.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +1 -13
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +7 -19
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +77 -7
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +218 -18
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +9 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +17 -1
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/lib/dist/graph/file-drift.d.ts +35 -0
- package/lib/dist/graph/file-drift.d.ts.map +1 -0
- package/lib/dist/graph/file-drift.js +46 -0
- package/lib/dist/graph/file-drift.js.map +1 -0
- package/lib/dist/graph/queries.d.ts +4 -1
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -2
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/symbol-references.d.ts +86 -0
- package/lib/dist/graph/symbol-references.d.ts.map +1 -0
- package/lib/dist/graph/symbol-references.js +304 -0
- package/lib/dist/graph/symbol-references.js.map +1 -0
- package/lib/dist/graph/test-code.d.ts +15 -3
- package/lib/dist/graph/test-code.d.ts.map +1 -1
- package/lib/dist/graph/test-code.js +56 -2
- package/lib/dist/graph/test-code.js.map +1 -1
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +2 -4
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +24 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +42 -3
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +4 -1
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +2 -1
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +15 -0
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +10 -1
- package/lib/dist/installer/instructions-template.js.map +1 -1
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +1 -1
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +2 -2
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +18 -2
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +2 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +7 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-proof.d.ts +19 -0
- package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-proof.js +126 -0
- package/lib/dist/mcp/daemon-proof.js.map +1 -0
- package/lib/dist/mcp/daemon-registry.d.ts +7 -2
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +14 -2
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +46 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +97 -3
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +16 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +14 -0
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-diagnostics.d.ts +6 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
- package/lib/dist/mcp/explore-diagnostics.js +8 -0
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
- package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
- package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
- package/lib/dist/mcp/explore-one-symbol.js +431 -0
- package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
- package/lib/dist/mcp/hook-client.d.ts +44 -0
- package/lib/dist/mcp/hook-client.d.ts.map +1 -0
- package/lib/dist/mcp/hook-client.js +202 -0
- package/lib/dist/mcp/hook-client.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +13 -3
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +15 -9
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/opencode-tool-names.d.ts +32 -0
- package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
- package/lib/dist/mcp/opencode-tool-names.js +24 -0
- package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
- package/lib/dist/mcp/project-lifecycle.d.ts +6 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
- package/lib/dist/mcp/project-lifecycle.js +21 -3
- package/lib/dist/mcp/project-lifecycle.js.map +1 -1
- package/lib/dist/mcp/prompt-explore.d.ts +19 -0
- package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
- package/lib/dist/mcp/prompt-explore.js +6 -0
- package/lib/dist/mcp/prompt-explore.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +14 -7
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +71 -26
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +9 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +5 -0
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +18 -0
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +12 -1
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +19 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +42 -3
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +31 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +137 -32
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +20 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +30 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +4 -4
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +44 -77
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/event-emitter-synthesizer.d.ts +39 -0
- package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
- package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +80 -34
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/elysia.d.ts +38 -0
- package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/elysia.js +683 -0
- package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts +48 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +13 -2
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +5 -1
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.js +69 -11
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +2 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +164 -25
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +102 -0
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +289 -13
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +9 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
- package/lib/dist/resolution/js-builtins.js +21 -1
- package/lib/dist/resolution/js-builtins.js.map +1 -1
- package/lib/dist/resolution/module-importers.d.ts +25 -0
- package/lib/dist/resolution/module-importers.d.ts.map +1 -1
- package/lib/dist/resolution/module-importers.js +85 -0
- package/lib/dist/resolution/module-importers.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +129 -1
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +1603 -92
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/php-web-root.d.ts +39 -0
- package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
- package/lib/dist/resolution/php-web-root.js +141 -0
- package/lib/dist/resolution/php-web-root.js.map +1 -0
- package/lib/dist/resolution/python-overloads.d.ts +10 -0
- package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
- package/lib/dist/resolution/python-overloads.js +75 -0
- package/lib/dist/resolution/python-overloads.js.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
- package/lib/dist/resolution/swift-type-visibility.js +60 -3
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.js +31 -7
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +9 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +3 -0
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/kernel/codegraph-kernel.node +2 -2
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -47,8 +47,12 @@ const path = __importStar(require("path"));
|
|
|
47
47
|
const synthesis_stage_1 = require("../db/synthesis-stage");
|
|
48
48
|
const types_1 = require("./types");
|
|
49
49
|
const name_matcher_1 = require("./name-matcher");
|
|
50
|
+
const name_matcher_2 = require("./name-matcher");
|
|
51
|
+
const name_matcher_3 = require("./name-matcher");
|
|
50
52
|
const cpp_macro_visibility_1 = require("./cpp-macro-visibility");
|
|
51
53
|
const cpp_constructor_1 = require("./cpp-constructor");
|
|
54
|
+
const name_matcher_4 = require("./name-matcher");
|
|
55
|
+
const name_matcher_5 = require("./name-matcher");
|
|
52
56
|
const cpp_supertypes_1 = require("./cpp-supertypes");
|
|
53
57
|
const swift_type_visibility_1 = require("./swift-type-visibility");
|
|
54
58
|
const dart_libraries_1 = require("./dart-libraries");
|
|
@@ -56,11 +60,13 @@ const vbnet_receivers_1 = require("./vbnet-receivers");
|
|
|
56
60
|
const pascal_scope_1 = require("./pascal-scope");
|
|
57
61
|
const type_parameters_1 = require("./type-parameters");
|
|
58
62
|
const dart_local_scope_1 = require("./dart-local-scope");
|
|
63
|
+
const python_overloads_1 = require("./python-overloads");
|
|
59
64
|
const cpp_type_aliases_1 = require("./cpp-type-aliases");
|
|
60
65
|
const project_scans_1 = require("./project-scans");
|
|
61
66
|
const cpp_includers_1 = require("./cpp-includers");
|
|
62
67
|
const c_macro_renames_1 = require("./c-macro-renames");
|
|
63
|
-
const
|
|
68
|
+
const name_matcher_6 = require("./name-matcher");
|
|
69
|
+
const name_matcher_7 = require("./name-matcher");
|
|
64
70
|
const c_feature_variants_1 = require("./c-feature-variants");
|
|
65
71
|
const ambient_modules_1 = require("./ambient-modules");
|
|
66
72
|
const shopify_themes_1 = require("./shopify-themes");
|
|
@@ -74,6 +80,9 @@ const cargo_workspace_1 = require("./frameworks/cargo-workspace");
|
|
|
74
80
|
const frameworks_1 = require("./frameworks");
|
|
75
81
|
const package_deps_1 = require("./frameworks/package-deps");
|
|
76
82
|
const callback_synthesizer_1 = require("./callback-synthesizer");
|
|
83
|
+
const project_config_1 = require("../project-config");
|
|
84
|
+
const php_web_root_1 = require("./php-web-root");
|
|
85
|
+
const php_1 = require("../extraction/languages/php");
|
|
77
86
|
const cooperative_yield_1 = require("./cooperative-yield");
|
|
78
87
|
const parameter_flow_1 = require("./parameter-flow");
|
|
79
88
|
const file_limits_1 = require("../file-limits");
|
|
@@ -97,6 +106,7 @@ const SUPERTYPE_BEARING_KINDS = new Set([
|
|
|
97
106
|
const RESOLUTION_READ_EDGE_KINDS = ['implements', 'extends'];
|
|
98
107
|
const CHAIN_LANGUAGES = new Set(['java', 'kotlin', 'csharp', 'swift', 'rust', 'go', 'scala', 'dart', 'objc', 'pascal']);
|
|
99
108
|
const SCOPED_CHAIN_LANGUAGES = new Set(['rust']);
|
|
109
|
+
const JS_SELF_CALL_LANGUAGES = new Set(['typescript', 'tsx', 'javascript', 'jsx', 'vue', 'svelte', 'astro']);
|
|
100
110
|
const CHAIN_SHAPE = /^(.+)\(\)\.(\w+)$/;
|
|
101
111
|
const PHP_PROP_SHAPE = /^this->\w+\.\w+$/;
|
|
102
112
|
const CFML_CONSTRUCTED_CALL = /^([A-Za-z_$][\w$.-]*)\(\)\.([A-Za-z_$][\w$]*)$/;
|
|
@@ -121,6 +131,30 @@ const PYTHON_BUILT_INS = new Set([
|
|
|
121
131
|
'open', 'input', 'type', 'isinstance', 'hasattr', 'getattr', 'setattr',
|
|
122
132
|
'super', 'self', 'cls', 'None', 'True', 'False',
|
|
123
133
|
]);
|
|
134
|
+
const PYTHON_BUILTIN_NAMES = new Set([
|
|
135
|
+
'abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes',
|
|
136
|
+
'callable', 'chr', 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate',
|
|
137
|
+
'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
|
|
138
|
+
'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'map', 'max',
|
|
139
|
+
'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr',
|
|
140
|
+
'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
|
|
141
|
+
'type', 'vars', 'zip', '__import__', 'Ellipsis', 'NotImplemented', 'exit', 'quit', 'copyright', 'credits',
|
|
142
|
+
'license',
|
|
143
|
+
'BaseException', 'BaseExceptionGroup', 'Exception', 'ExceptionGroup', 'GeneratorExit', 'KeyboardInterrupt',
|
|
144
|
+
'SystemExit', 'ArithmeticError', 'FloatingPointError', 'OverflowError', 'ZeroDivisionError', 'AssertionError',
|
|
145
|
+
'AttributeError', 'BufferError', 'EOFError', 'ImportError', 'ModuleNotFoundError', 'LookupError', 'IndexError',
|
|
146
|
+
'KeyError', 'MemoryError', 'NameError', 'UnboundLocalError', 'OSError', 'EnvironmentError', 'IOError',
|
|
147
|
+
'WindowsError', 'BlockingIOError', 'ChildProcessError', 'ConnectionError', 'BrokenPipeError',
|
|
148
|
+
'ConnectionAbortedError', 'ConnectionRefusedError', 'ConnectionResetError', 'FileExistsError',
|
|
149
|
+
'FileNotFoundError', 'InterruptedError', 'IsADirectoryError', 'NotADirectoryError', 'PermissionError',
|
|
150
|
+
'ProcessLookupError', 'TimeoutError', 'ReferenceError', 'RuntimeError', 'NotImplementedError',
|
|
151
|
+
'PythonFinalizationError', 'RecursionError', 'StopAsyncIteration', 'StopIteration', 'SyntaxError',
|
|
152
|
+
'IndentationError', 'TabError', 'SystemError', 'TypeError', 'ValueError', 'UnicodeError',
|
|
153
|
+
'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeTranslateError',
|
|
154
|
+
'Warning', 'BytesWarning', 'DeprecationWarning', 'EncodingWarning', 'FutureWarning', 'ImportWarning',
|
|
155
|
+
'PendingDeprecationWarning', 'ResourceWarning', 'RuntimeWarning', 'SyntaxWarning', 'UnicodeWarning',
|
|
156
|
+
'UserWarning',
|
|
157
|
+
]);
|
|
124
158
|
const PYTHON_BUILT_IN_TYPES = new Set([
|
|
125
159
|
'list', 'dict', 'set', 'tuple', 'str', 'int', 'float', 'bool',
|
|
126
160
|
'bytes', 'bytearray', 'frozenset', 'object', 'super',
|
|
@@ -206,7 +240,7 @@ const CPP_BUILT_INS = new Set([
|
|
|
206
240
|
'make_unique', 'make_shared', 'make_pair',
|
|
207
241
|
'move', 'forward', 'swap',
|
|
208
242
|
]);
|
|
209
|
-
const MODULE_CONFIG_ROOT_FILES = ['tsconfig.json', 'jsconfig.json', 'tsconfig.base.json', 'go.mod', 'Cargo.toml', ...import_resolver_1.CPP_COMPILE_DB_FILES];
|
|
243
|
+
const MODULE_CONFIG_ROOT_FILES = ['tsconfig.json', 'jsconfig.json', 'tsconfig.base.json', 'go.mod', 'Cargo.toml', ...import_resolver_1.CPP_COMPILE_DB_FILES, project_config_1.PROJECT_CONFIG_FILENAME];
|
|
210
244
|
function parseModuleConfigSnapshot(stored) {
|
|
211
245
|
if (!stored)
|
|
212
246
|
return {};
|
|
@@ -241,12 +275,38 @@ function moduleConfigEntry(abs, previous, projectRoot) {
|
|
|
241
275
|
}
|
|
242
276
|
function moduleConfigDigest(abs, projectRoot) {
|
|
243
277
|
const file = path.basename(abs);
|
|
278
|
+
if (file === project_config_1.PROJECT_CONFIG_FILENAME) {
|
|
279
|
+
const webRoot = (0, project_config_1.loadWebRoot)(path.dirname(abs));
|
|
280
|
+
return webRoot === null ? 'absent' : (0, crypto_1.createHash)('sha256').update(`webRoot=${webRoot}`).digest('hex').slice(0, 16);
|
|
281
|
+
}
|
|
244
282
|
const read = file === 'go.mod' ? (0, go_module_1.loadGoModule)(path.dirname(abs))?.modulePath ?? ''
|
|
245
283
|
: file === 'Cargo.toml' ? cargoManifestDigestText(abs)
|
|
246
284
|
: file === 'compile_commands.json' ? ((0, import_resolver_1.readCompileDbIncludeDirs)(abs, projectRoot) ?? []).join('\n')
|
|
247
|
-
:
|
|
285
|
+
: file === 'package.json' ? packageJsonMainOf(abs)
|
|
286
|
+
: (0, path_aliases_1.aliasConfigFields)(abs) ?? '';
|
|
248
287
|
return (0, crypto_1.createHash)('sha256').update(read).digest('hex').slice(0, 16);
|
|
249
288
|
}
|
|
289
|
+
function readPackageJson(abs) {
|
|
290
|
+
try {
|
|
291
|
+
const text = (0, file_limits_1.readSourceText)(abs);
|
|
292
|
+
if (text === null)
|
|
293
|
+
return null;
|
|
294
|
+
const json = JSON.parse(text.replace(/^\uFEFF/, ''));
|
|
295
|
+
return json && typeof json === 'object' && !Array.isArray(json) ? json : null;
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const LOCAL_DEPENDENCY_SPEC = /^(?:(?:workspace|file|link|portal):|\.{1,2}\/|~\/|\/)/;
|
|
302
|
+
function packageJsonMainOf(abs) {
|
|
303
|
+
try {
|
|
304
|
+
return (0, import_resolver_1.packageJsonMain)(fs.readFileSync(abs, 'utf-8')) ?? '';
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return '';
|
|
308
|
+
}
|
|
309
|
+
}
|
|
250
310
|
function cargoManifestDigestText(abs) {
|
|
251
311
|
try {
|
|
252
312
|
return (0, name_matcher_1.cargoManifestFields)(fs.readFileSync(abs, 'utf-8'));
|
|
@@ -266,6 +326,8 @@ function moduleConfigLanguages(changed) {
|
|
|
266
326
|
for (const rel of changed) {
|
|
267
327
|
if (/(?:^|\/)go\.mod$/.test(rel))
|
|
268
328
|
languages.add('go');
|
|
329
|
+
else if (rel === project_config_1.PROJECT_CONFIG_FILENAME)
|
|
330
|
+
languages.add('php');
|
|
269
331
|
else if (/(?:^|\/)Cargo\.toml$/.test(rel))
|
|
270
332
|
languages.add('rust');
|
|
271
333
|
else if (/(?:^|\/)compile_commands\.json$/.test(rel))
|
|
@@ -318,6 +380,7 @@ class ReferenceResolver {
|
|
|
318
380
|
cachesWarmed = false;
|
|
319
381
|
projectAliases = undefined;
|
|
320
382
|
dirAliases = new Map();
|
|
383
|
+
phpWebRoots = null;
|
|
321
384
|
cargoCrates = undefined;
|
|
322
385
|
compileDbIncludeDirs = undefined;
|
|
323
386
|
layoutIncludeDirs = undefined;
|
|
@@ -523,12 +586,20 @@ class ReferenceResolver {
|
|
|
523
586
|
this.nodesByKindCache.clear();
|
|
524
587
|
this.fileExistsMemo.clear();
|
|
525
588
|
this.manifestScopes.clear();
|
|
589
|
+
this.installedPackages.clear();
|
|
590
|
+
this.directoryListings.clear();
|
|
591
|
+
this.searchedModules.clear();
|
|
592
|
+
this.realModulesDirs.clear();
|
|
593
|
+
this.ownPackageNames = null;
|
|
594
|
+
this.phpWebRoots = null;
|
|
595
|
+
this.installedNames.clear();
|
|
526
596
|
this.knownNames = null;
|
|
527
597
|
this.knownLowerNames = null;
|
|
528
598
|
this.knownFiles = null;
|
|
529
599
|
this.goModules = null;
|
|
530
600
|
this.goPackageDirs.clear();
|
|
531
601
|
this.cachesWarmed = false;
|
|
602
|
+
this.pythonFileBindings = null;
|
|
532
603
|
if (this.context) {
|
|
533
604
|
(0, import_resolver_1.clearImportResolverMemos)(this.context);
|
|
534
605
|
(0, name_matcher_1.clearNameMatcherMemos)(this.context);
|
|
@@ -546,6 +617,7 @@ class ReferenceResolver {
|
|
|
546
617
|
(0, c_macro_renames_1.clearCMacroRenames)(this.context);
|
|
547
618
|
(0, c_feature_variants_1.clearCFeatureVariantMemos)(this.context);
|
|
548
619
|
(0, ambient_modules_1.clearAmbientModuleMemos)(this.context);
|
|
620
|
+
(0, python_overloads_1.clearPythonOverloadMemos)(this.context);
|
|
549
621
|
(0, package_deps_1.clearDeclaredDependencies)(this.context);
|
|
550
622
|
}
|
|
551
623
|
}
|
|
@@ -637,7 +709,8 @@ class ReferenceResolver {
|
|
|
637
709
|
const resolved = (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context);
|
|
638
710
|
if (resolved !== null && this.isIndexedFile(resolved))
|
|
639
711
|
return false;
|
|
640
|
-
return this.isDeclaredOutsidePackage(source, fromFile)
|
|
712
|
+
return this.isDeclaredOutsidePackage(source, fromFile) ||
|
|
713
|
+
(import_resolver_1.ESM_IMPORT_LANGUAGES.has(language) && this.isInstalledPackage(source, fromFile));
|
|
641
714
|
},
|
|
642
715
|
resolveModuleFile: (source, fromFile, language) => (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context),
|
|
643
716
|
isDeclaredPackage: (source, fromFile) => this.isDeclaredOutsidePackage(source, fromFile),
|
|
@@ -765,6 +838,9 @@ class ReferenceResolver {
|
|
|
765
838
|
return exists;
|
|
766
839
|
},
|
|
767
840
|
readFile: (filePath) => this.readFileCached(filePath),
|
|
841
|
+
noteModuleConfigFile: (filePath) => {
|
|
842
|
+
this.moduleConfigFiles.add(path.join(this.projectRoot, filePath));
|
|
843
|
+
},
|
|
768
844
|
fileContains: (filePath, needle) => this.fileContains(filePath, needle),
|
|
769
845
|
scanFile: (filePath) => this.scanFile(filePath),
|
|
770
846
|
getFileLines: (filePath) => {
|
|
@@ -918,6 +994,7 @@ class ReferenceResolver {
|
|
|
918
994
|
this.dirAliases.set(d, found);
|
|
919
995
|
return found;
|
|
920
996
|
},
|
|
997
|
+
getPhpWebRoot: (fromFile) => this.phpWebRootOf(fromFile),
|
|
921
998
|
getGoPackageDir: (importPath, fromFile) => {
|
|
922
999
|
const own = fromFile === undefined ? null : this.nearestGoModule(goDirOf(fromFile));
|
|
923
1000
|
const key = `${importPath}\0${own?.rootDir ?? ''}`;
|
|
@@ -1193,6 +1270,9 @@ class ReferenceResolver {
|
|
|
1193
1270
|
}
|
|
1194
1271
|
}
|
|
1195
1272
|
resolveOneIn(ref) {
|
|
1273
|
+
if (ref.referenceKind === 'function_ref' && ref.language === 'rust' && ref.referenceName.includes('::')) {
|
|
1274
|
+
return this.resolveRustPathValue(ref);
|
|
1275
|
+
}
|
|
1196
1276
|
const byName = (0, name_matcher_1.rustChainedCallByName)(ref);
|
|
1197
1277
|
if (byName) {
|
|
1198
1278
|
const resolved = this.resolveOneIn(byName);
|
|
@@ -1202,11 +1282,11 @@ class ReferenceResolver {
|
|
|
1202
1282
|
return null;
|
|
1203
1283
|
const candidate = (0, dart_local_scope_1.gateDartLocal)((0, type_parameters_1.gateTypeParameter)((0, swift_type_visibility_1.gateSwiftTypeTarget)(this.gateTargetKind(this.resolveOneInner(ref), ref), ref, this.context), ref, this.context), ref, this.context);
|
|
1204
1284
|
const scoped = this.gateRustScope(candidate, ref);
|
|
1205
|
-
const resolved = (0, name_matcher_1.preferGoBuildTwin)(this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref), ref, this.context);
|
|
1285
|
+
const resolved = (0, python_overloads_1.preferPythonImplementation)((0, name_matcher_1.preferGoBuildTwin)(this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref), ref, this.context), ref, this.context);
|
|
1206
1286
|
if (resolved && ref.language === 'dart' && ref.referenceKind === 'references' &&
|
|
1207
1287
|
resolved.targetNodeId === ref.fromNodeId)
|
|
1208
1288
|
return null;
|
|
1209
|
-
if (resolved && (0, name_matcher_1.isPythonFromImportModule)(ref, this.context)) {
|
|
1289
|
+
if (resolved && ((0, name_matcher_1.isPythonFromImportModule)(ref, this.context) || (0, name_matcher_2.isPythonImportStatementModule)(ref, this.context))) {
|
|
1210
1290
|
const module = this.nodeById(resolved.targetNodeId);
|
|
1211
1291
|
if (module && module.kind !== 'file' && module.kind !== 'module')
|
|
1212
1292
|
return null;
|
|
@@ -1221,6 +1301,8 @@ class ReferenceResolver {
|
|
|
1221
1301
|
}
|
|
1222
1302
|
if (resolved && resolved.resolvedBy === 'import' && (0, name_matcher_1.isImportShadowedByJsBinding)(resolved, ref, this.context))
|
|
1223
1303
|
return null;
|
|
1304
|
+
if (resolved && (0, name_matcher_4.isRefusedDeepThisTarget)(resolved, ref, this.context))
|
|
1305
|
+
return null;
|
|
1224
1306
|
if (resolved && resolved.resolvedBy !== 'import') {
|
|
1225
1307
|
const specifier = (0, ambient_modules_1.ambientModuleDeclarations)(this.context).get(resolved.targetNodeId);
|
|
1226
1308
|
const declaringFile = specifier === undefined ? undefined : this.nodeById(resolved.targetNodeId)?.filePath;
|
|
@@ -1228,6 +1310,11 @@ class ReferenceResolver {
|
|
|
1228
1310
|
!(0, import_resolver_1.reachesAmbientModule)(ref, specifier, declaringFile, this.context))
|
|
1229
1311
|
return null;
|
|
1230
1312
|
}
|
|
1313
|
+
if (resolved && ref.language === 'python' && ref.referenceKind === 'calls' && resolved.resolvedBy !== 'framework') {
|
|
1314
|
+
const target = this.nodeById(resolved.targetNodeId);
|
|
1315
|
+
if (target && !(0, name_matcher_7.pythonSelfCallReaches)(target, ref, this.context))
|
|
1316
|
+
return null;
|
|
1317
|
+
}
|
|
1231
1318
|
if (!resolved || ref.referenceKind !== 'calls')
|
|
1232
1319
|
return resolved;
|
|
1233
1320
|
const call = ref.language === 'pascal' ? (0, pascal_scope_1.gatePascalCall)(resolved, ref, this.context) : resolved;
|
|
@@ -1247,6 +1334,18 @@ class ReferenceResolver {
|
|
|
1247
1334
|
confidence: Math.min(call.confidence, 0.85),
|
|
1248
1335
|
}, ref);
|
|
1249
1336
|
}
|
|
1337
|
+
resolveRustPathValue(ref) {
|
|
1338
|
+
const asCall = this.resolveOneIn({ ...ref, referenceKind: 'calls' });
|
|
1339
|
+
const target = asCall ? this.nodeById(asCall.targetNodeId) : undefined;
|
|
1340
|
+
if (!asCall || !target || (target.kind !== 'function' && target.kind !== 'method'))
|
|
1341
|
+
return null;
|
|
1342
|
+
if ((0, name_matcher_1.isRustTraitImplMember)(target, this.context))
|
|
1343
|
+
return null;
|
|
1344
|
+
const segments = ref.referenceName.split('::');
|
|
1345
|
+
if ((0, name_matcher_1.isRustOtherTypesMethod)(target, segments[segments.length - 2].replace(/^r#/, ''), this.context))
|
|
1346
|
+
return null;
|
|
1347
|
+
return { original: ref, targetNodeId: target.id, confidence: asCall.confidence, resolvedBy: 'function-ref' };
|
|
1348
|
+
}
|
|
1250
1349
|
resolveOneInner(ref) {
|
|
1251
1350
|
if ((0, cpp_constructor_1.isCppConstructorRef)(ref))
|
|
1252
1351
|
return (0, cpp_constructor_1.matchCppConstructor)(ref, this.context);
|
|
@@ -1254,8 +1353,8 @@ class ReferenceResolver {
|
|
|
1254
1353
|
return (0, cpp_supertypes_1.matchCppSupertype)(ref, this.context);
|
|
1255
1354
|
if ((0, cpp_supertypes_1.isCppDeclaredTypeRef)(ref, this.context))
|
|
1256
1355
|
return (0, cpp_supertypes_1.matchCppDeclaredType)(ref, this.context);
|
|
1257
|
-
if ((0,
|
|
1258
|
-
return (0,
|
|
1356
|
+
if ((0, name_matcher_6.isObjcDeclaredTypeRef)(ref))
|
|
1357
|
+
return (0, name_matcher_6.matchByExactName)(ref, this.context);
|
|
1259
1358
|
if ((0, pascal_scope_1.isPascalParenlessRef)(ref))
|
|
1260
1359
|
return (0, pascal_scope_1.matchPascalParenlessRef)(ref, this.context);
|
|
1261
1360
|
if ((0, pascal_scope_1.isPascalSystemCall)(ref, this.context))
|
|
@@ -1272,6 +1371,9 @@ class ReferenceResolver {
|
|
|
1272
1371
|
const asserted = (0, name_matcher_1.matchGoAssertedCall)(ref, this.context);
|
|
1273
1372
|
if (asserted !== undefined)
|
|
1274
1373
|
return asserted;
|
|
1374
|
+
const builtin = (0, name_matcher_1.matchGoBuiltinReceiverCall)(ref, this.context);
|
|
1375
|
+
if (builtin !== undefined)
|
|
1376
|
+
return builtin;
|
|
1275
1377
|
const indexed = (0, name_matcher_1.matchGoIndexedCall)(ref, this.context);
|
|
1276
1378
|
if (indexed !== undefined)
|
|
1277
1379
|
return indexed;
|
|
@@ -1362,11 +1464,11 @@ class ReferenceResolver {
|
|
|
1362
1464
|
if (ref.referenceName.startsWith('this.')) {
|
|
1363
1465
|
return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
|
|
1364
1466
|
}
|
|
1365
|
-
if ((ref.language === 'python' || ref.language === 'go') && ref.referenceName.includes('.')) {
|
|
1467
|
+
if ((ref.language === 'python' || ref.language === 'go' || ref.language === 'csharp') && ref.referenceName.includes('.')) {
|
|
1366
1468
|
return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
|
|
1367
1469
|
}
|
|
1368
1470
|
const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
1369
|
-
if (viaImport) {
|
|
1471
|
+
if (viaImport && !(0, name_matcher_1.isImportShadowedByJsBinding)(viaImport, ref, this.context)) {
|
|
1370
1472
|
const target = this.nodeById(viaImport.targetNodeId);
|
|
1371
1473
|
if (target &&
|
|
1372
1474
|
(target.kind === 'function' ||
|
|
@@ -1437,10 +1539,13 @@ class ReferenceResolver {
|
|
|
1437
1539
|
return chainResult;
|
|
1438
1540
|
}
|
|
1439
1541
|
const tImp = this.profileStages ? process.hrtime.bigint() : 0n;
|
|
1440
|
-
const selfCall = ref.
|
|
1542
|
+
const selfCall = ref.referenceKind === 'calls' &&
|
|
1543
|
+
(ref.language === 'python' || JS_SELF_CALL_LANGUAGES.has(ref.language)) &&
|
|
1441
1544
|
this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === ref.referenceName) &&
|
|
1442
|
-
(0, name_matcher_1.isPythonSelfCall)(ref, this.context);
|
|
1443
|
-
|
|
1545
|
+
((0, name_matcher_1.isPythonSelfCall)(ref, this.context) || (0, name_matcher_3.isJsThisCall)(ref, this.context));
|
|
1546
|
+
let importResult = selfCall ? null : this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
1547
|
+
if (importResult && (0, name_matcher_1.isImportShadowedByJsBinding)(importResult, ref, this.context))
|
|
1548
|
+
importResult = null;
|
|
1444
1549
|
if (this.profileStages)
|
|
1445
1550
|
this.stageAdd('viaImport', ref, !!importResult, tImp);
|
|
1446
1551
|
if (importResult) {
|
|
@@ -2231,6 +2336,29 @@ class ReferenceResolver {
|
|
|
2231
2336
|
getWorkspaceFingerprint() {
|
|
2232
2337
|
return (0, workspace_packages_1.workspaceFingerprint)(this.context.getWorkspacePackages?.() ?? null);
|
|
2233
2338
|
}
|
|
2339
|
+
phpWebRootOf(fromFile) {
|
|
2340
|
+
const configured = (0, project_config_1.loadWebRoot)(this.projectRoot);
|
|
2341
|
+
if (configured !== null)
|
|
2342
|
+
return configured;
|
|
2343
|
+
return this.inferredPhpWebRoots().get((0, php_web_root_1.folderOf)(fromFile)) ?? null;
|
|
2344
|
+
}
|
|
2345
|
+
inferredPhpWebRoots() {
|
|
2346
|
+
if (this.phpWebRoots === null) {
|
|
2347
|
+
const prefix = `${php_1.PHP_DOCUMENT_ROOT}/`;
|
|
2348
|
+
const includes = this.queries.getPhpDocumentRootIncludes(prefix)
|
|
2349
|
+
.map((row) => ({ filePath: row.filePath, written: row.name.slice(prefix.length) }));
|
|
2350
|
+
this.phpWebRoots = includes.length === 0
|
|
2351
|
+
? new Map()
|
|
2352
|
+
: (0, php_web_root_1.inferPhpWebRoots)(includes, (relPath) => this.context.fileExists(relPath));
|
|
2353
|
+
}
|
|
2354
|
+
return this.phpWebRoots;
|
|
2355
|
+
}
|
|
2356
|
+
getPhpWebRootSnapshot() {
|
|
2357
|
+
return (0, php_web_root_1.phpWebRootSnapshot)((0, project_config_1.loadWebRoot)(this.projectRoot), this.inferredPhpWebRoots());
|
|
2358
|
+
}
|
|
2359
|
+
phpWebRootsMoved(before, now) {
|
|
2360
|
+
return (0, php_web_root_1.phpWebRootsMoved)(before, now);
|
|
2361
|
+
}
|
|
2234
2362
|
workspacePackageDirOf(file) {
|
|
2235
2363
|
const ws = this.context.getWorkspacePackages?.();
|
|
2236
2364
|
return ws ? (0, workspace_packages_1.workspacePackageDirOf)(ws, file) : null;
|
|
@@ -2446,6 +2574,21 @@ class ReferenceResolver {
|
|
|
2446
2574
|
return dot > 0 && PYTHON_BUILT_IN_METHODS.has(ref.referenceName.slice(dot + 1)) &&
|
|
2447
2575
|
!PYTHON_BUILT_IN_TYPES.has(ref.referenceName.slice(0, dot));
|
|
2448
2576
|
}
|
|
2577
|
+
pythonFileBindings = null;
|
|
2578
|
+
isUnboundPythonBuiltin(ref) {
|
|
2579
|
+
const line = (this.context.getFileLines?.(ref.filePath) ?? this.context.readFile(ref.filePath)?.split(/\r?\n/))?.[ref.line - 1];
|
|
2580
|
+
if (line === undefined || !line.startsWith(ref.referenceName, ref.column) || /\.\s*$/.test(line.slice(0, ref.column)))
|
|
2581
|
+
return false;
|
|
2582
|
+
let file = this.pythonFileBindings;
|
|
2583
|
+
if (file?.filePath !== ref.filePath) {
|
|
2584
|
+
const names = new Set(this.context.getNodesInFile(ref.filePath).map((n) => n.name));
|
|
2585
|
+
for (const m of this.context.getImportMappings(ref.filePath, 'python'))
|
|
2586
|
+
names.add(m.localName);
|
|
2587
|
+
const star = /^[ \t]*from[ \t]+[\w.]+[ \t]+import[ \t(]*\*/m.test(this.context.readFile(ref.filePath) ?? '');
|
|
2588
|
+
this.pythonFileBindings = file = { filePath: ref.filePath, names, star };
|
|
2589
|
+
}
|
|
2590
|
+
return !file.star && !file.names.has(ref.referenceName);
|
|
2591
|
+
}
|
|
2449
2592
|
isGoProjectPackage(ref, qualifier) {
|
|
2450
2593
|
return this.context
|
|
2451
2594
|
.getImportMappings(ref.filePath, ref.language)
|
|
@@ -2472,6 +2615,9 @@ class ReferenceResolver {
|
|
|
2472
2615
|
if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
|
|
2473
2616
|
return true;
|
|
2474
2617
|
}
|
|
2618
|
+
if (ref.language === 'python' && PYTHON_BUILTIN_NAMES.has(name) && this.isUnboundPythonBuiltin(ref)) {
|
|
2619
|
+
return true;
|
|
2620
|
+
}
|
|
2475
2621
|
if (ref.language === 'python') {
|
|
2476
2622
|
const dotIdx = name.indexOf('.');
|
|
2477
2623
|
if (dotIdx > 0) {
|
|
@@ -2866,6 +3012,8 @@ class ReferenceResolver {
|
|
|
2866
3012
|
if (target && ref.language === 'go' && name_matcher_1.GO_TYPE_KINDS.has(target.kind) &&
|
|
2867
3013
|
!ref.referenceName.includes('.') && !(0, name_matcher_1.isGoBareName)(ref, this.context))
|
|
2868
3014
|
return null;
|
|
3015
|
+
if (target && (0, name_matcher_5.isLexicalBindingOfJsThisCall)(target, ref, this.context))
|
|
3016
|
+
return null;
|
|
2869
3017
|
}
|
|
2870
3018
|
if ((ref.referenceKind === 'calls' || ref.referenceKind === 'instantiates') && import_resolver_1.ESM_IMPORT_LANGUAGES.has(ref.language)) {
|
|
2871
3019
|
const target = this.nodeById(result.targetNodeId);
|
|
@@ -2936,6 +3084,9 @@ class ReferenceResolver {
|
|
|
2936
3084
|
return result;
|
|
2937
3085
|
if (!bare && !(0, name_matcher_1.isRustPathCallReachable)(target, ref, this.context))
|
|
2938
3086
|
return null;
|
|
3087
|
+
const guessed = result.byName === true || result.resolvedBy === 'exact-match' || result.resolvedBy === 'fuzzy';
|
|
3088
|
+
if ((0, name_matcher_1.isRustCallUnreachable)(target, ref, guessed, this.context))
|
|
3089
|
+
return null;
|
|
2939
3090
|
return (0, name_matcher_1.isRustForeignImplCallable)(target, ref, this.context) ? result : null;
|
|
2940
3091
|
}
|
|
2941
3092
|
mocklessContextFor(ref, base) {
|
|
@@ -3132,6 +3283,12 @@ class ReferenceResolver {
|
|
|
3132
3283
|
return this.knownFiles ? this.knownFiles.has(normalized) : this.queries.getFileByPath(normalized) !== null;
|
|
3133
3284
|
}
|
|
3134
3285
|
manifestScopes = new Map();
|
|
3286
|
+
installedPackages = new Map();
|
|
3287
|
+
directoryListings = new Map();
|
|
3288
|
+
searchedModules = new Map();
|
|
3289
|
+
realModulesDirs = new Map();
|
|
3290
|
+
ownPackageNames = null;
|
|
3291
|
+
installedNames = new Map();
|
|
3135
3292
|
isDeclaredOutsidePackage(source, fromFile) {
|
|
3136
3293
|
if (/^(?:node|bun|jsr|npm|https?):/.test(source) || source.startsWith('@std/') || NODE_BUILTINS.has(source))
|
|
3137
3294
|
return true;
|
|
@@ -3145,6 +3302,125 @@ class ReferenceResolver {
|
|
|
3145
3302
|
const provider = source.startsWith('astro:') ? 'astro' : /^\$(?:app|env|service-worker)(?:\/|$)/.test(source) ? '@sveltejs/kit' : null;
|
|
3146
3303
|
return provider !== null && !scope.own.has(provider) && !this.context.getWorkspacePackages?.()?.byName.has(provider);
|
|
3147
3304
|
}
|
|
3305
|
+
isInstalledPackage(source, fromFile) {
|
|
3306
|
+
const segments = source.split('/');
|
|
3307
|
+
const name = source.startsWith('@') ? segments.slice(0, 2).join('/') : segments[0];
|
|
3308
|
+
if (!/^(?:@[A-Za-z0-9][\w.~-]*\/)?[A-Za-z0-9][\w.~-]*$/.test(name))
|
|
3309
|
+
return false;
|
|
3310
|
+
const normalized = fromFile.replace(/\\/g, '/');
|
|
3311
|
+
const fromDir = normalized.includes('/') ? normalized.slice(0, normalized.lastIndexOf('/')) : '';
|
|
3312
|
+
const scope = this.manifestScope(fromDir);
|
|
3313
|
+
if (scope.own.has(name) || this.context.getWorkspacePackages?.()?.byName.has(name))
|
|
3314
|
+
return false;
|
|
3315
|
+
for (const modules of this.modulesSearchedFrom(fromDir)) {
|
|
3316
|
+
if (this.listing(modules) === null)
|
|
3317
|
+
continue;
|
|
3318
|
+
const copy = this.isRegistryCopy(modules, name);
|
|
3319
|
+
if (copy !== undefined)
|
|
3320
|
+
return copy && !this.isProjectPackageCopy(modules, name);
|
|
3321
|
+
}
|
|
3322
|
+
return false;
|
|
3323
|
+
}
|
|
3324
|
+
isProjectPackageCopy(modules, name) {
|
|
3325
|
+
const own = this.projectPackageNames();
|
|
3326
|
+
if (own.has(name))
|
|
3327
|
+
return true;
|
|
3328
|
+
const key = modules + '\0' + name;
|
|
3329
|
+
let installedAs = this.installedNames.get(key);
|
|
3330
|
+
if (installedAs === undefined) {
|
|
3331
|
+
const json = readPackageJson(path.join(modules, name, 'package.json'));
|
|
3332
|
+
installedAs = typeof json?.name === 'string' ? json.name : '';
|
|
3333
|
+
this.installedNames.set(key, installedAs);
|
|
3334
|
+
}
|
|
3335
|
+
return installedAs !== '' && own.has(installedAs);
|
|
3336
|
+
}
|
|
3337
|
+
projectPackageNames() {
|
|
3338
|
+
if (this.ownPackageNames)
|
|
3339
|
+
return this.ownPackageNames;
|
|
3340
|
+
const names = new Set();
|
|
3341
|
+
const dirs = new Set();
|
|
3342
|
+
for (const file of this.knownFiles ?? this.queries.getAllFilePaths()) {
|
|
3343
|
+
let dir = file.replace(/\\/g, '/');
|
|
3344
|
+
do {
|
|
3345
|
+
dir = dir.includes('/') ? dir.slice(0, dir.lastIndexOf('/')) : '';
|
|
3346
|
+
if (dirs.has(dir))
|
|
3347
|
+
break;
|
|
3348
|
+
dirs.add(dir);
|
|
3349
|
+
} while (dir !== '');
|
|
3350
|
+
}
|
|
3351
|
+
for (const dir of dirs) {
|
|
3352
|
+
const json = readPackageJson(path.join(this.projectRoot, dir, 'package.json'));
|
|
3353
|
+
if (!json)
|
|
3354
|
+
continue;
|
|
3355
|
+
if (typeof json.name === 'string')
|
|
3356
|
+
names.add(json.name);
|
|
3357
|
+
for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
|
|
3358
|
+
const deps = json[field];
|
|
3359
|
+
if (!deps || typeof deps !== 'object')
|
|
3360
|
+
continue;
|
|
3361
|
+
for (const [dep, version] of Object.entries(deps)) {
|
|
3362
|
+
if (typeof version === 'string' && LOCAL_DEPENDENCY_SPEC.test(version))
|
|
3363
|
+
names.add(dep);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
this.ownPackageNames = names;
|
|
3368
|
+
return names;
|
|
3369
|
+
}
|
|
3370
|
+
modulesSearchedFrom(dir) {
|
|
3371
|
+
const memo = this.searchedModules.get(dir);
|
|
3372
|
+
if (memo)
|
|
3373
|
+
return memo;
|
|
3374
|
+
let real = path.resolve(this.projectRoot, dir);
|
|
3375
|
+
try {
|
|
3376
|
+
real = fs.realpathSync(real);
|
|
3377
|
+
}
|
|
3378
|
+
catch { }
|
|
3379
|
+
const found = [];
|
|
3380
|
+
for (let at = real;; at = path.dirname(at)) {
|
|
3381
|
+
if (path.basename(at) !== 'node_modules')
|
|
3382
|
+
found.push(path.join(at, 'node_modules'));
|
|
3383
|
+
if (path.dirname(at) === at)
|
|
3384
|
+
break;
|
|
3385
|
+
}
|
|
3386
|
+
this.searchedModules.set(dir, found);
|
|
3387
|
+
return found;
|
|
3388
|
+
}
|
|
3389
|
+
isRegistryCopy(modules, name) {
|
|
3390
|
+
const key = modules + '\0' + name;
|
|
3391
|
+
if (this.installedPackages.has(key))
|
|
3392
|
+
return this.installedPackages.get(key);
|
|
3393
|
+
let answer;
|
|
3394
|
+
const scope = name.startsWith('@') ? name.slice(0, name.indexOf('/')) : null;
|
|
3395
|
+
const listed = scope
|
|
3396
|
+
? this.listing(modules)?.has(scope) && this.listing(path.join(modules, scope))?.has(name.slice(scope.length + 1))
|
|
3397
|
+
: this.listing(modules)?.has(name);
|
|
3398
|
+
if (listed) {
|
|
3399
|
+
try {
|
|
3400
|
+
let realModules = this.realModulesDirs.get(modules);
|
|
3401
|
+
if (realModules === undefined) {
|
|
3402
|
+
realModules = fs.realpathSync(modules);
|
|
3403
|
+
this.realModulesDirs.set(modules, realModules);
|
|
3404
|
+
}
|
|
3405
|
+
const rel = path.relative(path.dirname(realModules), fs.realpathSync(path.join(modules, name)));
|
|
3406
|
+
answer = rel.split(path.sep).includes('node_modules');
|
|
3407
|
+
}
|
|
3408
|
+
catch { }
|
|
3409
|
+
}
|
|
3410
|
+
this.installedPackages.set(key, answer);
|
|
3411
|
+
return answer;
|
|
3412
|
+
}
|
|
3413
|
+
listing(dir) {
|
|
3414
|
+
if (this.directoryListings.has(dir))
|
|
3415
|
+
return this.directoryListings.get(dir);
|
|
3416
|
+
let names = null;
|
|
3417
|
+
try {
|
|
3418
|
+
names = new Set(fs.readdirSync(dir));
|
|
3419
|
+
}
|
|
3420
|
+
catch { }
|
|
3421
|
+
this.directoryListings.set(dir, names);
|
|
3422
|
+
return names;
|
|
3423
|
+
}
|
|
3148
3424
|
manifestScope(dir) {
|
|
3149
3425
|
const memo = this.manifestScopes.get(dir);
|
|
3150
3426
|
if (memo)
|