@colbymchenry/codegraph-win32-arm64 1.6.1 → 1.6.3
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/bin/codegraph +1 -1
- package/bin/codegraph.cmd +1 -1
- package/lib/dist/.test-build-engine.json +1 -1
- package/lib/dist/.test-build-viewer.json +1 -1
- package/lib/dist/bin/codegraph.d.ts +3 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +427 -684
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +7 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +30 -74
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/bin/fatal-handler.js +0 -46
- package/lib/dist/bin/fatal-handler.js.map +1 -1
- package/lib/dist/bin/node-version-check.js +0 -33
- package/lib/dist/bin/node-version-check.js.map +1 -1
- package/lib/dist/bin/uninstall.js +0 -19
- package/lib/dist/bin/uninstall.js.map +1 -1
- package/lib/dist/bin/viewer-gate.js +0 -14
- package/lib/dist/bin/viewer-gate.js.map +1 -1
- package/lib/dist/compile-cache.d.ts +2 -0
- package/lib/dist/compile-cache.d.ts.map +1 -0
- package/lib/dist/compile-cache.js +45 -0
- package/lib/dist/compile-cache.js.map +1 -0
- package/lib/dist/context/formatter.js +3 -66
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +44 -1
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +123 -430
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/context/markers.js +0 -17
- package/lib/dist/context/markers.js.map +1 -1
- package/lib/dist/db/index.d.ts +44 -1
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +123 -395
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +11 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +71 -79
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/name-substring-index.d.ts +63 -0
- package/lib/dist/db/name-substring-index.d.ts.map +1 -0
- package/lib/dist/db/name-substring-index.js +151 -0
- package/lib/dist/db/name-substring-index.js.map +1 -0
- package/lib/dist/db/node-sqlite.d.ts +19 -0
- package/lib/dist/db/node-sqlite.d.ts.map +1 -0
- package/lib/dist/db/node-sqlite.js +23 -0
- package/lib/dist/db/node-sqlite.js.map +1 -0
- package/lib/dist/db/open-error.d.ts +36 -0
- package/lib/dist/db/open-error.d.ts.map +1 -0
- package/lib/dist/db/open-error.js +63 -0
- package/lib/dist/db/open-error.js.map +1 -0
- package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
- package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
- package/lib/dist/db/parameter-flow-queries.js +168 -0
- package/lib/dist/db/parameter-flow-queries.js.map +1 -0
- package/lib/dist/db/queries.d.ts +641 -40
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1370 -1398
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/reference-tail.d.ts +83 -0
- package/lib/dist/db/reference-tail.d.ts.map +1 -0
- package/lib/dist/db/reference-tail.js +68 -0
- package/lib/dist/db/reference-tail.js.map +1 -0
- package/lib/dist/db/schema.sql +18 -2
- package/lib/dist/db/sqlite-adapter.d.ts +18 -1
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +12 -62
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
- package/lib/dist/db/synthesis-stage.js +2 -6
- package/lib/dist/db/synthesis-stage.js.map +1 -1
- package/lib/dist/db/wal-valve.js +1 -153
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/db/wsl-shared-index.js +0 -37
- package/lib/dist/db/wsl-shared-index.js.map +1 -1
- package/lib/dist/directory.d.ts +81 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +91 -500
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/engine.d.ts +15 -0
- package/lib/dist/engine.d.ts.map +1 -0
- package/lib/dist/engine.js +34 -0
- package/lib/dist/engine.js.map +1 -0
- package/lib/dist/errors.d.ts +10 -0
- package/lib/dist/errors.d.ts.map +1 -1
- package/lib/dist/errors.js +8 -101
- package/lib/dist/errors.js.map +1 -1
- package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/astro-extractor.js +15 -133
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +102 -10
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +260 -179
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/commonjs-requires.d.ts +23 -0
- package/lib/dist/extraction/commonjs-requires.d.ts.map +1 -0
- package/lib/dist/extraction/commonjs-requires.js +37 -0
- package/lib/dist/extraction/commonjs-requires.js.map +1 -0
- package/lib/dist/extraction/dfm-extractor.js +0 -21
- package/lib/dist/extraction/dfm-extractor.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -24
- package/lib/dist/extraction/extraction-version.js.map +1 -1
- package/lib/dist/extraction/function-ref.d.ts +40 -0
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +145 -206
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +9 -0
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +29 -154
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +47 -4
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +91 -374
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +216 -11
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +703 -1368
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/decode.js +0 -16
- package/lib/dist/extraction/kernel/decode.js.map +1 -1
- package/lib/dist/extraction/kernel/index.d.ts +3 -1
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/index.js +29 -131
- package/lib/dist/extraction/kernel/index.js.map +1 -1
- package/lib/dist/extraction/kernel/layout.js +42 -76
- package/lib/dist/extraction/kernel/layout.js.map +1 -1
- package/lib/dist/extraction/kernel/loader.js +0 -37
- package/lib/dist/extraction/kernel/loader.js.map +1 -1
- package/lib/dist/extraction/languages/arkts.js +0 -59
- package/lib/dist/extraction/languages/arkts.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +140 -28
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +876 -823
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/cfquery.js +0 -9
- package/lib/dist/extraction/languages/cfquery.js.map +1 -1
- package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/cfscript.js +80 -9
- package/lib/dist/extraction/languages/cfscript.js.map +1 -1
- package/lib/dist/extraction/languages/cobol.js +0 -114
- package/lib/dist/extraction/languages/cobol.js.map +1 -1
- package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
- package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
- package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +11 -54
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts +84 -0
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +335 -159
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +15 -102
- package/lib/dist/extraction/languages/erlang.js.map +1 -1
- package/lib/dist/extraction/languages/go.d.ts +48 -0
- package/lib/dist/extraction/languages/go.d.ts.map +1 -1
- package/lib/dist/extraction/languages/go.js +102 -31
- package/lib/dist/extraction/languages/go.js.map +1 -1
- package/lib/dist/extraction/languages/index.js +0 -6
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/java.d.ts.map +1 -1
- package/lib/dist/extraction/languages/java.js +67 -78
- package/lib/dist/extraction/languages/java.js.map +1 -1
- package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/javascript.js +2 -12
- package/lib/dist/extraction/languages/javascript.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts +15 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +69 -150
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/lua.js +2 -39
- package/lib/dist/extraction/languages/lua.js.map +1 -1
- package/lib/dist/extraction/languages/luau.js +0 -14
- package/lib/dist/extraction/languages/luau.js.map +1 -1
- package/lib/dist/extraction/languages/nix.js +0 -16
- package/lib/dist/extraction/languages/nix.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +5 -16
- package/lib/dist/extraction/languages/objc.js.map +1 -1
- package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
- package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
- package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
- package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
- package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
- package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
- package/lib/dist/extraction/languages/pascal-system.js +23 -0
- package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
- package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
- package/lib/dist/extraction/languages/pascal.js +3 -4
- package/lib/dist/extraction/languages/pascal.js.map +1 -1
- package/lib/dist/extraction/languages/php.js +5 -42
- package/lib/dist/extraction/languages/php.js.map +1 -1
- package/lib/dist/extraction/languages/python.js +2 -20
- package/lib/dist/extraction/languages/python.js.map +1 -1
- package/lib/dist/extraction/languages/r.js +8 -78
- package/lib/dist/extraction/languages/r.js.map +1 -1
- package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
- package/lib/dist/extraction/languages/ruby.js +17 -25
- package/lib/dist/extraction/languages/ruby.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts +10 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +15 -47
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/languages/scala.js +5 -41
- package/lib/dist/extraction/languages/scala.js.map +1 -1
- package/lib/dist/extraction/languages/solidity.js +1 -82
- package/lib/dist/extraction/languages/solidity.js.map +1 -1
- package/lib/dist/extraction/languages/swift.d.ts +15 -0
- package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
- package/lib/dist/extraction/languages/swift.js +33 -27
- package/lib/dist/extraction/languages/swift.js.map +1 -1
- package/lib/dist/extraction/languages/terraform.js +6 -152
- package/lib/dist/extraction/languages/terraform.js.map +1 -1
- package/lib/dist/extraction/languages/typescript.d.ts +71 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +86 -41
- package/lib/dist/extraction/languages/typescript.js.map +1 -1
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
- package/lib/dist/extraction/languages/vbnet.js +9 -42
- package/lib/dist/extraction/languages/vbnet.js.map +1 -1
- package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
- package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
- package/lib/dist/extraction/lazy-frameworks.js +8 -0
- package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
- package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/liquid-extractor.js +89 -148
- package/lib/dist/extraction/liquid-extractor.js.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +0 -78
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-budget.d.ts +16 -0
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -0
- package/lib/dist/extraction/parse-budget.js +11 -0
- package/lib/dist/extraction/parse-budget.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +41 -5
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +74 -158
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.d.ts +1 -1
- package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
- package/lib/dist/extraction/parse-worker.js +7 -58
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/razor-extractor.d.ts +9 -0
- package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/razor-extractor.js +45 -69
- package/lib/dist/extraction/razor-extractor.js.map +1 -1
- package/lib/dist/extraction/razor-script.d.ts +23 -0
- package/lib/dist/extraction/razor-script.d.ts.map +1 -0
- package/lib/dist/extraction/razor-script.js +244 -0
- package/lib/dist/extraction/razor-script.js.map +1 -0
- package/lib/dist/extraction/sfc-script.d.ts +85 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -0
- package/lib/dist/extraction/sfc-script.js +136 -0
- package/lib/dist/extraction/sfc-script.js.map +1 -0
- package/lib/dist/extraction/store-worker.d.ts +1 -1
- package/lib/dist/extraction/store-worker.d.ts.map +1 -1
- package/lib/dist/extraction/store-worker.js +5 -37
- package/lib/dist/extraction/store-worker.js.map +1 -1
- package/lib/dist/extraction/store-writer.d.ts +10 -2
- package/lib/dist/extraction/store-writer.d.ts.map +1 -1
- package/lib/dist/extraction/store-writer.js +8 -32
- package/lib/dist/extraction/store-writer.js.map +1 -1
- package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/svelte-extractor.js +16 -122
- package/lib/dist/extraction/svelte-extractor.js.map +1 -1
- package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
- package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
- package/lib/dist/extraction/syntax-tokens.js +6 -153
- package/lib/dist/extraction/syntax-tokens.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.js +0 -7
- package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +455 -9
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +1998 -2517
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +20 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +113 -115
- package/lib/dist/extraction/vue-extractor.js.map +1 -1
- package/lib/dist/extraction/vue-options-api.d.ts +28 -0
- package/lib/dist/extraction/vue-options-api.d.ts.map +1 -0
- package/lib/dist/extraction/vue-options-api.js +164 -0
- package/lib/dist/extraction/vue-options-api.js.map +1 -0
- package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
- package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
- package/lib/dist/extraction/vue-template-calls.js +497 -0
- package/lib/dist/extraction/vue-template-calls.js.map +1 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +6 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +1 -88
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/lib/dist/file-limits.d.ts +8 -0
- package/lib/dist/file-limits.d.ts.map +1 -1
- package/lib/dist/file-limits.js +13 -28
- package/lib/dist/file-limits.js.map +1 -1
- package/lib/dist/graph/branch-guards.d.ts +17 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -1
- package/lib/dist/graph/branch-guards.js +98 -250
- package/lib/dist/graph/branch-guards.js.map +1 -1
- package/lib/dist/graph/call-sites.d.ts +12 -0
- package/lib/dist/graph/call-sites.d.ts.map +1 -0
- package/lib/dist/graph/call-sites.js +17 -0
- package/lib/dist/graph/call-sites.js.map +1 -0
- package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
- package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
- package/lib/dist/graph/cobol-copybooks.js +45 -0
- package/lib/dist/graph/cobol-copybooks.js.map +1 -0
- package/lib/dist/graph/dead-code.d.ts +26 -4
- package/lib/dist/graph/dead-code.d.ts.map +1 -1
- package/lib/dist/graph/dead-code.js +157 -311
- package/lib/dist/graph/dead-code.js.map +1 -1
- package/lib/dist/graph/dynamic-boundary-report.js +1 -88
- package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
- package/lib/dist/graph/file-cycles.d.ts +20 -0
- package/lib/dist/graph/file-cycles.d.ts.map +1 -0
- package/lib/dist/graph/file-cycles.js +79 -0
- package/lib/dist/graph/file-cycles.js.map +1 -0
- package/lib/dist/graph/go-package.d.ts +27 -0
- package/lib/dist/graph/go-package.d.ts.map +1 -0
- package/lib/dist/graph/go-package.js +49 -0
- package/lib/dist/graph/go-package.js.map +1 -0
- package/lib/dist/graph/index.d.ts +2 -0
- package/lib/dist/graph/index.d.ts.map +1 -1
- package/lib/dist/graph/index.js +4 -6
- package/lib/dist/graph/index.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
- package/lib/dist/graph/named-symbol-flow.js +85 -219
- package/lib/dist/graph/named-symbol-flow.js.map +1 -1
- package/lib/dist/graph/owning-package.d.ts +59 -0
- package/lib/dist/graph/owning-package.d.ts.map +1 -0
- package/lib/dist/graph/owning-package.js +120 -0
- package/lib/dist/graph/owning-package.js.map +1 -0
- package/lib/dist/graph/queries.d.ts +2 -2
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -135
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/symbol-lookup.d.ts +15 -3
- package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
- package/lib/dist/graph/symbol-lookup.js +47 -89
- package/lib/dist/graph/symbol-lookup.js.map +1 -1
- package/lib/dist/graph/synthesized-hop.d.ts +37 -0
- package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
- package/lib/dist/graph/synthesized-hop.js +62 -0
- package/lib/dist/graph/synthesized-hop.js.map +1 -0
- package/lib/dist/graph/test-code.d.ts +21 -0
- package/lib/dist/graph/test-code.d.ts.map +1 -0
- package/lib/dist/graph/test-code.js +50 -0
- package/lib/dist/graph/test-code.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +31 -2
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +98 -226
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/graph/type-hierarchy.js +0 -138
- package/lib/dist/graph/type-hierarchy.js.map +1 -1
- package/lib/dist/index.d.ts +195 -25
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +697 -1105
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/beta-signup.js +0 -39
- package/lib/dist/installer/beta-signup.js.map +1 -1
- package/lib/dist/installer/config-writer.js +0 -24
- package/lib/dist/installer/config-writer.js.map +1 -1
- package/lib/dist/installer/index.d.ts +9 -5
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +25 -159
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +1 -1
- package/lib/dist/installer/instructions-template.js +0 -37
- package/lib/dist/installer/instructions-template.js.map +1 -1
- package/lib/dist/installer/targets/antigravity.js +0 -113
- package/lib/dist/installer/targets/antigravity.js.map +1 -1
- package/lib/dist/installer/targets/bob.d.ts +20 -0
- package/lib/dist/installer/targets/bob.d.ts.map +1 -0
- package/lib/dist/installer/targets/bob.js +83 -0
- package/lib/dist/installer/targets/bob.js.map +1 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +1 -185
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +17 -109
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.js +2 -54
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
- package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
- package/lib/dist/installer/targets/copilot-vscode.js +0 -58
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
- package/lib/dist/installer/targets/cursor.js +7 -88
- package/lib/dist/installer/targets/cursor.js.map +1 -1
- package/lib/dist/installer/targets/droid.d.ts +18 -0
- package/lib/dist/installer/targets/droid.d.ts.map +1 -0
- package/lib/dist/installer/targets/droid.js +92 -0
- package/lib/dist/installer/targets/droid.js.map +1 -0
- package/lib/dist/installer/targets/dsh.d.ts +35 -0
- package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
- package/lib/dist/installer/targets/dsh.js +267 -0
- package/lib/dist/installer/targets/dsh.js.map +1 -0
- package/lib/dist/installer/targets/gemini.js +0 -37
- package/lib/dist/installer/targets/gemini.js.map +1 -1
- package/lib/dist/installer/targets/grok.d.ts +25 -0
- package/lib/dist/installer/targets/grok.d.ts.map +1 -0
- package/lib/dist/installer/targets/grok.js +96 -0
- package/lib/dist/installer/targets/grok.js.map +1 -0
- package/lib/dist/installer/targets/hermes.d.ts +19 -7
- package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
- package/lib/dist/installer/targets/hermes.js +218 -214
- package/lib/dist/installer/targets/hermes.js.map +1 -1
- package/lib/dist/installer/targets/json-config.d.ts +45 -0
- package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
- package/lib/dist/installer/targets/json-config.js +128 -0
- package/lib/dist/installer/targets/json-config.js.map +1 -0
- package/lib/dist/installer/targets/kimi.d.ts +21 -0
- package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
- package/lib/dist/installer/targets/kimi.js +97 -0
- package/lib/dist/installer/targets/kimi.js.map +1 -0
- package/lib/dist/installer/targets/kiro.js +1 -41
- package/lib/dist/installer/targets/kiro.js.map +1 -1
- package/lib/dist/installer/targets/opencode.js +0 -102
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/pi.d.ts +24 -0
- package/lib/dist/installer/targets/pi.d.ts.map +1 -0
- package/lib/dist/installer/targets/pi.js +100 -0
- package/lib/dist/installer/targets/pi.js.map +1 -0
- package/lib/dist/installer/targets/qoder.d.ts +23 -0
- package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
- package/lib/dist/installer/targets/qoder.js +83 -0
- package/lib/dist/installer/targets/qoder.js.map +1 -0
- package/lib/dist/installer/targets/qwen.d.ts +21 -0
- package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
- package/lib/dist/installer/targets/qwen.js +115 -0
- package/lib/dist/installer/targets/qwen.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +18 -25
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +81 -11
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +183 -129
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/toml.d.ts +82 -6
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +318 -112
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +1 -1
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/installer/targets/types.js +0 -13
- package/lib/dist/installer/targets/types.js.map +1 -1
- package/lib/dist/installer/targets/windsurf.d.ts +22 -0
- package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
- package/lib/dist/installer/targets/windsurf.js +90 -0
- package/lib/dist/installer/targets/windsurf.js.map +1 -0
- package/lib/dist/lazy-engine.d.ts +22 -0
- package/lib/dist/lazy-engine.d.ts.map +1 -0
- package/lib/dist/lazy-engine.js +16 -0
- package/lib/dist/lazy-engine.js.map +1 -0
- package/lib/dist/mcp/answer-freshness.js +0 -6
- package/lib/dist/mcp/answer-freshness.js.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +2 -23
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +2 -79
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +44 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +189 -118
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +23 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +89 -373
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +4 -78
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/early-ppid.js +0 -24
- package/lib/dist/mcp/early-ppid.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +10 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +41 -152
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.js +0 -108
- package/lib/dist/mcp/explore-dedup.js.map +1 -1
- package/lib/dist/mcp/explore-diagnostics.js +0 -116
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
- package/lib/dist/mcp/explore-session-state.js +0 -129
- package/lib/dist/mcp/explore-session-state.js.map +1 -1
- package/lib/dist/mcp/index-freshness-worker.js +5 -4
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
- package/lib/dist/mcp/index-freshness.d.ts +7 -1
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -1
- package/lib/dist/mcp/index-freshness.js +20 -12
- package/lib/dist/mcp/index-freshness.js.map +1 -1
- package/lib/dist/mcp/index-version-warning.d.ts +21 -0
- package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
- package/lib/dist/mcp/index-version-warning.js +38 -0
- package/lib/dist/mcp/index-version-warning.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +19 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +118 -293
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +106 -121
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/ppid-watchdog.js +0 -24
- package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
- package/lib/dist/mcp/process-identity.d.ts +42 -0
- package/lib/dist/mcp/process-identity.d.ts.map +1 -0
- package/lib/dist/mcp/process-identity.js +130 -0
- package/lib/dist/mcp/process-identity.js.map +1 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
- package/lib/dist/mcp/project-lifecycle.js +55 -21
- package/lib/dist/mcp/project-lifecycle.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +26 -8
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +209 -223
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +58 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +140 -100
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/query-worker.js +24 -36
- package/lib/dist/mcp/query-worker.js.map +1 -1
- package/lib/dist/mcp/server-instructions.js +0 -31
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +27 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +29 -130
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.js +1 -48
- package/lib/dist/mcp/startup-handshake.js.map +1 -1
- package/lib/dist/mcp/stdin-teardown.js +0 -28
- package/lib/dist/mcp/stdin-teardown.js.map +1 -1
- package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
- package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
- package/lib/dist/mcp/stdout-teardown.js +20 -0
- package/lib/dist/mcp/stdout-teardown.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +159 -20
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +730 -3545
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +4 -96
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/mcp/version.d.ts +13 -1
- package/lib/dist/mcp/version.d.ts.map +1 -1
- package/lib/dist/mcp/version.js +19 -21
- package/lib/dist/mcp/version.js.map +1 -1
- package/lib/dist/mcp/writer-lock.d.ts +11 -0
- package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
- package/lib/dist/mcp/writer-lock.js +49 -46
- package/lib/dist/mcp/writer-lock.js.map +1 -1
- package/lib/dist/project-config.js +1 -138
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/alias-binding.d.ts +7 -0
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
- package/lib/dist/resolution/alias-binding.js +19 -52
- package/lib/dist/resolution/alias-binding.js.map +1 -1
- package/lib/dist/resolution/ambient-modules.d.ts +185 -0
- package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
- package/lib/dist/resolution/ambient-modules.js +732 -0
- package/lib/dist/resolution/ambient-modules.js.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts +96 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.js +695 -0
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -0
- package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
- package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
- package/lib/dist/resolution/c-feature-variants.js +249 -0
- package/lib/dist/resolution/c-feature-variants.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
- package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
- package/lib/dist/resolution/c-macro-renames.js +95 -0
- package/lib/dist/resolution/c-macro-renames.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +15 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1487 -1234
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
- package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
- package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +0 -27
- package/lib/dist/resolution/cooperative-yield.js.map +1 -1
- package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
- package/lib/dist/resolution/cpp-constructor.js +15 -17
- package/lib/dist/resolution/cpp-constructor.js.map +1 -1
- package/lib/dist/resolution/cpp-includers.d.ts +46 -0
- package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-includers.js +153 -0
- package/lib/dist/resolution/cpp-includers.js.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
- package/lib/dist/resolution/cpp-macro-visibility.js +60 -61
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
- package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
- package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-namespaces.js +151 -0
- package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
- package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
- package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-raw-strings.js +167 -0
- package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
- package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
- package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-supertypes.js +322 -0
- package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
- package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
- package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
- package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
- package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
- package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-type-aliases.js +648 -0
- package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
- package/lib/dist/resolution/dart-libraries.d.ts +75 -0
- package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
- package/lib/dist/resolution/dart-libraries.js +721 -0
- package/lib/dist/resolution/dart-libraries.js.map +1 -0
- package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
- package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
- package/lib/dist/resolution/dart-local-scope.js +565 -0
- package/lib/dist/resolution/dart-local-scope.js.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
- package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/frameworks/angular-router.d.ts +142 -0
- package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/angular-router.js +959 -0
- package/lib/dist/resolution/frameworks/angular-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/astro.js +30 -60
- package/lib/dist/resolution/frameworks/astro.js.map +1 -1
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
- package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/cics.js +7 -33
- package/lib/dist/resolution/frameworks/cics.js.map +1 -1
- package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
- package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
- package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
- package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
- package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/component-folder.js +11 -0
- package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +106 -101
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
- package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/drupal.js +377 -142
- package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.d.ts +10 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.js +79 -65
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +6 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.js +64 -183
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +215 -173
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.js +11 -112
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +15 -61
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/goframe.js +1 -55
- package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +16 -2
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +20 -48
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +209 -147
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.js +291 -71
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts +35 -0
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js +33 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +236 -192
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
- package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
- package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.js +11 -66
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/object-literal.js +0 -21
- package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
- package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
- package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/package-deps.js +35 -26
- package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
- package/lib/dist/resolution/frameworks/page-component.d.ts +20 -0
- package/lib/dist/resolution/frameworks/page-component.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/page-component.js +31 -0
- package/lib/dist/resolution/frameworks/page-component.js.map +1 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/play.js +27 -33
- package/lib/dist/resolution/frameworks/play.js.map +1 -1
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +106 -116
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.js +1 -166
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +17 -7
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.js +21 -79
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/react.d.ts +68 -1
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +1721 -114
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +152 -52
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/rust.js +51 -70
- package/lib/dist/resolution/frameworks/rust.js.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.js +9 -74
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
- package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
- package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +199 -167
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
- package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/terraform.js +1 -85
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.d.ts +26 -10
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.js +147 -147
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/vue.d.ts +9 -2
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue.js +69 -107
- package/lib/dist/resolution/frameworks/vue.js.map +1 -1
- package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
- package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
- package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
- package/lib/dist/resolution/go-module.d.ts +23 -7
- package/lib/dist/resolution/go-module.d.ts.map +1 -1
- package/lib/dist/resolution/go-module.js +21 -24
- package/lib/dist/resolution/go-module.js.map +1 -1
- package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
- package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
- package/lib/dist/resolution/go-stdlib-methods.js +224 -0
- package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.js +2 -53
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +298 -23
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +1802 -1280
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +449 -5
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +1477 -981
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +14 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
- package/lib/dist/resolution/js-builtins.js +15 -13
- package/lib/dist/resolution/js-builtins.js.map +1 -1
- package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
- package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
- package/lib/dist/resolution/js-class-expressions.js +25 -0
- package/lib/dist/resolution/js-class-expressions.js.map +1 -0
- package/lib/dist/resolution/js-super-calls.d.ts +18 -0
- package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
- package/lib/dist/resolution/js-super-calls.js +94 -0
- package/lib/dist/resolution/js-super-calls.js.map +1 -0
- package/lib/dist/resolution/jsx-code.d.ts +28 -0
- package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
- package/lib/dist/resolution/jsx-code.js +459 -0
- package/lib/dist/resolution/jsx-code.js.map +1 -0
- package/lib/dist/resolution/lru-cache.d.ts +5 -13
- package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
- package/lib/dist/resolution/lru-cache.js +43 -32
- package/lib/dist/resolution/lru-cache.js.map +1 -1
- package/lib/dist/resolution/memory-budget.js +0 -52
- package/lib/dist/resolution/memory-budget.js.map +1 -1
- package/lib/dist/resolution/module-importers.d.ts +185 -0
- package/lib/dist/resolution/module-importers.d.ts.map +1 -0
- package/lib/dist/resolution/module-importers.js +588 -0
- package/lib/dist/resolution/module-importers.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +891 -8
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +25013 -2928
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
- package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.js +46 -28
- package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/override-parameters.d.ts +40 -0
- package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/override-parameters.js +339 -0
- package/lib/dist/resolution/override-parameters.js.map +1 -0
- package/lib/dist/resolution/parameter-flow.d.ts +218 -0
- package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
- package/lib/dist/resolution/parameter-flow.js +474 -0
- package/lib/dist/resolution/parameter-flow.js.map +1 -0
- package/lib/dist/resolution/pascal-scope.d.ts +91 -0
- package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
- package/lib/dist/resolution/pascal-scope.js +961 -0
- package/lib/dist/resolution/pascal-scope.js.map +1 -0
- package/lib/dist/resolution/path-aliases.d.ts +32 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +43 -110
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/resolution/project-scans.d.ts +38 -0
- package/lib/dist/resolution/project-scans.d.ts.map +1 -0
- package/lib/dist/resolution/project-scans.js +30 -0
- package/lib/dist/resolution/project-scans.js.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts +2 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.js +67 -48
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +43 -3
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +55 -97
- package/lib/dist/resolution/resolver-pool.js.map +1 -1
- package/lib/dist/resolution/resolver-worker.d.ts +1 -1
- package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-worker.js +10 -36
- package/lib/dist/resolution/resolver-worker.js.map +1 -1
- package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
- package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
- package/lib/dist/resolution/resurrect-ref.js +19 -0
- package/lib/dist/resolution/resurrect-ref.js.map +1 -0
- package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
- package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
- package/lib/dist/resolution/ruby-constant-paths.js +255 -0
- package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
- package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
- package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
- package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
- package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
- package/lib/dist/resolution/rust-scopes.d.ts +120 -0
- package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
- package/lib/dist/resolution/rust-scopes.js +730 -0
- package/lib/dist/resolution/rust-scopes.js.map +1 -0
- package/lib/dist/resolution/shopify-themes.d.ts +10 -0
- package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
- package/lib/dist/resolution/shopify-themes.js +19 -0
- package/lib/dist/resolution/shopify-themes.js.map +1 -0
- package/lib/dist/resolution/strip-comments.d.ts +20 -1
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +164 -119
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
- package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
- package/lib/dist/resolution/swift-objc-bridge.js +0 -160
- package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
- package/lib/dist/resolution/swift-type-visibility.d.ts +68 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.js +355 -0
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -0
- package/lib/dist/resolution/synth-utils.js +1 -22
- package/lib/dist/resolution/synth-utils.js.map +1 -1
- package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
- package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
- package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
- package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts +7 -2
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.js +318 -121
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
- package/lib/dist/resolution/type-parameters.d.ts +34 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/type-parameters.js +285 -0
- package/lib/dist/resolution/type-parameters.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +209 -10
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js +0 -47
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
- package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
- package/lib/dist/resolution/vbnet-receivers.js +1482 -0
- package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
- package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
- package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts +206 -15
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +570 -152
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/dist/search/identifier-segments.js +2 -93
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-parser.js +0 -54
- package/lib/dist/search/query-parser.js.map +1 -1
- package/lib/dist/search/query-paths.js +0 -167
- package/lib/dist/search/query-paths.js.map +1 -1
- package/lib/dist/search/query-utils.d.ts +44 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +120 -198
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/git-hooks.d.ts +14 -5
- package/lib/dist/sync/git-hooks.d.ts.map +1 -1
- package/lib/dist/sync/git-hooks.js +118 -65
- package/lib/dist/sync/git-hooks.js.map +1 -1
- package/lib/dist/sync/index.js +0 -14
- package/lib/dist/sync/index.js.map +1 -1
- package/lib/dist/sync/watch-policy.js +0 -45
- package/lib/dist/sync/watch-policy.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +29 -11
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +83 -487
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +29 -2
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +59 -78
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +68 -146
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +46 -0
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +15 -44
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui/color.js +0 -19
- package/lib/dist/ui/color.js.map +1 -1
- package/lib/dist/ui/glyphs.js +2 -45
- package/lib/dist/ui/glyphs.js.map +1 -1
- package/lib/dist/ui/shimmer-progress.js +0 -21
- package/lib/dist/ui/shimmer-progress.js.map +1 -1
- package/lib/dist/ui/shimmer-worker.js +0 -22
- package/lib/dist/ui/shimmer-worker.js.map +1 -1
- package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
- package/lib/dist/ui-server/api/deadcode.js +2 -31
- package/lib/dist/ui-server/api/deadcode.js.map +1 -1
- package/lib/dist/ui-server/api/effects.d.ts +7 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -1
- package/lib/dist/ui-server/api/effects.js +20 -103
- package/lib/dist/ui-server/api/effects.js.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.d.ts +6 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.js +73 -130
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
- package/lib/dist/ui-server/api/events.js +0 -145
- package/lib/dist/ui-server/api/events.js.map +1 -1
- package/lib/dist/ui-server/api/file.js +0 -80
- package/lib/dist/ui-server/api/file.js.map +1 -1
- package/lib/dist/ui-server/api/filecode.js +0 -95
- package/lib/dist/ui-server/api/filecode.js.map +1 -1
- package/lib/dist/ui-server/api/flow.js +0 -149
- package/lib/dist/ui-server/api/flow.js.map +1 -1
- package/lib/dist/ui-server/api/hierarchy.js +0 -28
- package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
- package/lib/dist/ui-server/api/index.js +0 -88
- package/lib/dist/ui-server/api/index.js.map +1 -1
- package/lib/dist/ui-server/api/map.d.ts +41 -6
- package/lib/dist/ui-server/api/map.d.ts.map +1 -1
- package/lib/dist/ui-server/api/map.js +95 -308
- package/lib/dist/ui-server/api/map.js.map +1 -1
- package/lib/dist/ui-server/api/node.d.ts.map +1 -1
- package/lib/dist/ui-server/api/node.js +4 -109
- package/lib/dist/ui-server/api/node.js.map +1 -1
- package/lib/dist/ui-server/api/nodes.js +0 -16
- package/lib/dist/ui-server/api/nodes.js.map +1 -1
- package/lib/dist/ui-server/api/program.js +0 -90
- package/lib/dist/ui-server/api/program.js.map +1 -1
- package/lib/dist/ui-server/api/respond.js +0 -60
- package/lib/dist/ui-server/api/respond.js.map +1 -1
- package/lib/dist/ui-server/api/route-roots.d.ts +6 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
- package/lib/dist/ui-server/api/route-roots.js +18 -39
- package/lib/dist/ui-server/api/route-roots.js.map +1 -1
- package/lib/dist/ui-server/api/routes.d.ts +2 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
- package/lib/dist/ui-server/api/routes.js +47 -47
- package/lib/dist/ui-server/api/routes.js.map +1 -1
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
- package/lib/dist/ui-server/api/screens.js +16 -171
- package/lib/dist/ui-server/api/screens.js.map +1 -1
- package/lib/dist/ui-server/api/search.js +0 -62
- package/lib/dist/ui-server/api/search.js.map +1 -1
- package/lib/dist/ui-server/api/session.js +0 -58
- package/lib/dist/ui-server/api/session.js.map +1 -1
- package/lib/dist/ui-server/api/source.d.ts.map +1 -1
- package/lib/dist/ui-server/api/source.js +0 -161
- package/lib/dist/ui-server/api/source.js.map +1 -1
- package/lib/dist/ui-server/api/stats.js +0 -58
- package/lib/dist/ui-server/api/stats.js.map +1 -1
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
- package/lib/dist/ui-server/api/steps.js +105 -373
- package/lib/dist/ui-server/api/steps.js.map +1 -1
- package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
- package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
- package/lib/dist/ui-server/api/trail-store.js +24 -106
- package/lib/dist/ui-server/api/trail-store.js.map +1 -1
- package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
- package/lib/dist/ui-server/api/trails.js +20 -94
- package/lib/dist/ui-server/api/trails.js.map +1 -1
- package/lib/dist/ui-server/api/when.d.ts +10 -2
- package/lib/dist/ui-server/api/when.d.ts.map +1 -1
- package/lib/dist/ui-server/api/when.js +32 -44
- package/lib/dist/ui-server/api/when.js.map +1 -1
- package/lib/dist/ui-server/api/wire.js +0 -58
- package/lib/dist/ui-server/api/wire.js.map +1 -1
- package/lib/dist/ui-server/assets.js +0 -35
- package/lib/dist/ui-server/assets.js.map +1 -1
- package/lib/dist/ui-server/constants.js +0 -26
- package/lib/dist/ui-server/constants.js.map +1 -1
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts +28 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js +114 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -0
- package/lib/dist/ui-server/highlight/index.d.ts.map +1 -1
- package/lib/dist/ui-server/highlight/index.js +7 -133
- package/lib/dist/ui-server/highlight/index.js.map +1 -1
- package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
- package/lib/dist/ui-server/highlight/languages.js +0 -31
- package/lib/dist/ui-server/highlight/languages.js.map +1 -1
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts +7 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js +15 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -0
- package/lib/dist/ui-server/index.d.ts +25 -0
- package/lib/dist/ui-server/index.d.ts.map +1 -1
- package/lib/dist/ui-server/index.js +35 -103
- package/lib/dist/ui-server/index.js.map +1 -1
- package/lib/dist/ui-server/open-browser.js +0 -34
- package/lib/dist/ui-server/open-browser.js.map +1 -1
- package/lib/dist/ui-server/security.d.ts +5 -0
- package/lib/dist/ui-server/security.d.ts.map +1 -1
- package/lib/dist/ui-server/security.js +11 -147
- package/lib/dist/ui-server/security.js.map +1 -1
- package/lib/dist/ui-server/static.js +0 -41
- package/lib/dist/ui-server/static.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +61 -10
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +191 -225
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/upgrade/remove-binary.js +2 -67
- package/lib/dist/upgrade/remove-binary.js.map +1 -1
- package/lib/dist/upgrade/update-check.js +1 -81
- package/lib/dist/upgrade/update-check.js.map +1 -1
- package/lib/dist/utils.d.ts +69 -1
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +224 -266
- package/lib/dist/utils.js.map +1 -1
- package/lib/dist/viewer/assets/{index-D4S7YUPf.js → index-BSGpxBr9.js} +60 -58
- package/lib/dist/viewer/index.html +1 -1
- package/lib/dist/worker-teardown.d.ts +48 -0
- package/lib/dist/worker-teardown.d.ts.map +1 -0
- package/lib/dist/worker-teardown.js +53 -0
- package/lib/dist/worker-teardown.js.map +1 -0
- package/lib/kernel/codegraph-kernel.node +2 -2
- package/lib/node_modules/.package-lock.json +4 -4
- package/lib/node_modules/ignore/README.md +138 -8
- package/lib/node_modules/ignore/index.d.ts +56 -20
- package/lib/node_modules/ignore/index.js +1033 -221
- package/lib/node_modules/ignore/legacy.js +871 -178
- package/lib/node_modules/ignore/package.json +10 -4
- package/lib/package.json +14 -8
- package/node.exe +2 -2
- package/package.json +1 -1
|
@@ -1,41 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* React Framework Resolver
|
|
4
|
-
*
|
|
5
|
-
* Handles React patterns: React Router routes, components, hooks, contexts.
|
|
6
|
-
* Next.js pages, route handlers and navigation are `nextjs.ts`'s.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.reactResolver = void 0;
|
|
4
|
+
exports.configHrefExpression = configHrefExpression;
|
|
5
|
+
exports.exportedComponent = exportedComponent;
|
|
6
|
+
exports.declaredComponent = declaredComponent;
|
|
7
|
+
exports.lazyValueModules = lazyValueModules;
|
|
8
|
+
exports.declarationText = declarationText;
|
|
9
|
+
exports.wrappedComponentName = wrappedComponentName;
|
|
10
|
+
exports.initializerAt = initializerAt;
|
|
11
|
+
exports.isTableRoute = isTableRoute;
|
|
10
12
|
const package_deps_1 = require("./package-deps");
|
|
13
|
+
const import_resolver_1 = require("../import-resolver");
|
|
14
|
+
const alias_binding_1 = require("../alias-binding");
|
|
15
|
+
const strip_comments_1 = require("../strip-comments");
|
|
16
|
+
const utils_1 = require("../../utils");
|
|
17
|
+
const synth_utils_1 = require("../synth-utils");
|
|
18
|
+
const query_utils_1 = require("../../search/query-utils");
|
|
19
|
+
const object_literal_1 = require("./object-literal");
|
|
20
|
+
const component_folder_1 = require("./component-folder");
|
|
21
|
+
const REACT_SCRIPT_LANGUAGES = new Set(['typescript', 'javascript', 'tsx', 'jsx']);
|
|
11
22
|
exports.reactResolver = {
|
|
12
23
|
name: 'react',
|
|
13
|
-
// Includes 'tsx'/'jsx' so route extraction runs on JSX files (where
|
|
14
|
-
// `<Route element={<X/>}>` routes live) — without them the .tsx/.jsx grammars
|
|
15
|
-
// were filtered out of the extract pass and those routes were never indexed.
|
|
16
|
-
// (resolve() is unaffected — it runs for every detected framework regardless
|
|
17
|
-
// of language; only the extract pass filters on `languages`.)
|
|
18
24
|
languages: ['javascript', 'typescript', 'tsx', 'jsx'],
|
|
19
25
|
detect(context) {
|
|
20
|
-
// React in a package.json — the root's, or a workspace's (`frontend/`, `apps/web/`).
|
|
21
26
|
if ((0, package_deps_1.dependsOn)(context, 'react', 'next', 'react-native'))
|
|
22
27
|
return true;
|
|
23
|
-
// Check for .jsx/.tsx files
|
|
24
28
|
const allFiles = context.getAllFiles();
|
|
25
29
|
return allFiles.some((f) => f.endsWith('.jsx') || f.endsWith('.tsx'));
|
|
26
30
|
},
|
|
31
|
+
claimsReference(name) {
|
|
32
|
+
return name.startsWith(LAZY_ROUTE_PREFIX) || name.startsWith(LAYOUT_PREFIX) || PICKED_EXPORT.test(name);
|
|
33
|
+
},
|
|
27
34
|
resolve(ref, context) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
if (!REACT_SCRIPT_LANGUAGES.has(ref.language))
|
|
36
|
+
return null;
|
|
37
|
+
if (ref.referenceName.startsWith(LAZY_ROUTE_PREFIX)) {
|
|
38
|
+
const target = lazyRouteComponent(ref.referenceName.slice(LAZY_ROUTE_PREFIX.length), ref.filePath, context);
|
|
39
|
+
return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework' } : null;
|
|
40
|
+
}
|
|
41
|
+
const picked = PICKED_EXPORT.exec(ref.referenceName);
|
|
42
|
+
if (picked) {
|
|
43
|
+
const target = isReactRouteRef(ref) ? pickedExport(picked[1], picked[2], ref.filePath, context) : null;
|
|
44
|
+
return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework' } : null;
|
|
45
|
+
}
|
|
46
|
+
if (ref.referenceName.startsWith(LAYOUT_PREFIX)) {
|
|
47
|
+
const target = layoutComponent(ref.referenceName.slice(LAYOUT_PREFIX.length), ref, context);
|
|
48
|
+
return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework', metadata: { layout: true } } : null;
|
|
49
|
+
}
|
|
50
|
+
if (context.getImportMappings?.(ref.filePath, ref.language)?.some((m) => m.localName === ref.referenceName)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
36
53
|
if ((ref.language === 'tsx' || ref.language === 'jsx') &&
|
|
37
54
|
isPascalCase(ref.referenceName) &&
|
|
38
55
|
!isBuiltInType(ref.referenceName)) {
|
|
56
|
+
const own = ownDeclarations(ref.referenceName, ref.filePath, context);
|
|
57
|
+
if (namesType(ref)) {
|
|
58
|
+
const type = own.find((n) => n.kind === 'type_alias' || n.kind === 'interface');
|
|
59
|
+
return type && own.some((n) => n.kind !== 'type_alias' && n.kind !== 'interface' && n.kind !== 'class')
|
|
60
|
+
? { original: ref, targetNodeId: type.id, confidence: 0.8, resolvedBy: 'framework' } : null;
|
|
61
|
+
}
|
|
62
|
+
const value = declaredComponent(ref.referenceName, ref.filePath, context);
|
|
63
|
+
if (value) {
|
|
64
|
+
return value.component ? { original: ref, targetNodeId: value.component.id, confidence: 0.9, resolvedBy: 'framework' } : null;
|
|
65
|
+
}
|
|
66
|
+
const component = own.find((n) => COMPONENT_KINDS.has(n.kind));
|
|
67
|
+
if (component) {
|
|
68
|
+
return { original: ref, targetNodeId: component.id, confidence: 0.8, resolvedBy: 'framework' };
|
|
69
|
+
}
|
|
70
|
+
if (own.length > 0)
|
|
71
|
+
return null;
|
|
39
72
|
const result = resolveComponent(ref.referenceName, ref.filePath, context);
|
|
40
73
|
if (result) {
|
|
41
74
|
return {
|
|
@@ -46,9 +79,8 @@ exports.reactResolver = {
|
|
|
46
79
|
};
|
|
47
80
|
}
|
|
48
81
|
}
|
|
49
|
-
// Pattern 2: Hook references (use*)
|
|
50
82
|
if (ref.referenceName.startsWith('use') && ref.referenceName.length > 3) {
|
|
51
|
-
const result = resolveHook(ref.referenceName, context);
|
|
83
|
+
const result = resolveHook(ref.referenceName, ref.filePath, context, ref.language);
|
|
52
84
|
if (result) {
|
|
53
85
|
return {
|
|
54
86
|
original: ref,
|
|
@@ -58,9 +90,8 @@ exports.reactResolver = {
|
|
|
58
90
|
};
|
|
59
91
|
}
|
|
60
92
|
}
|
|
61
|
-
// Pattern 3: Context references
|
|
62
93
|
if (ref.referenceName.endsWith('Context') || ref.referenceName.endsWith('Provider')) {
|
|
63
|
-
const result = resolveContext(ref.referenceName, context);
|
|
94
|
+
const result = resolveContext(ref.referenceName, ref, context);
|
|
64
95
|
if (result) {
|
|
65
96
|
return {
|
|
66
97
|
original: ref,
|
|
@@ -76,20 +107,9 @@ exports.reactResolver = {
|
|
|
76
107
|
const nodes = [];
|
|
77
108
|
const references = [];
|
|
78
109
|
const now = Date.now();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// (`forwardRef`/`memo`/`styled`) as `component` nodes (#841), and `useX`
|
|
83
|
-
// hooks as `function` nodes. Re-deriving them here with regex only ran on
|
|
84
|
-
// .ts/.js anyway (this resolver's `languages` didn't include the 'tsx'/'jsx'
|
|
85
|
-
// grammars), and it DUPLICATED those tree-sitter nodes (e.g. a `useAuth`
|
|
86
|
-
// ended up as two `function` nodes). This `extract` now contributes only
|
|
87
|
-
// what tree-sitter can't: route nodes (React Router + Next.js conventions),
|
|
88
|
-
// which is why 'tsx'/'jsx' are now in `languages` — `<Route>`/`element={<X/>}`
|
|
89
|
-
// routes live in JSX files and were previously skipped entirely.
|
|
90
|
-
// Read only each opening tag's own attributes, including expression values.
|
|
91
|
-
const declarations = scanRouteDeclarations(content, !/\.(?:ts|mts|cts)$/.test(filePath));
|
|
92
|
-
for (const { path: routePath, component, at } of declarations) {
|
|
110
|
+
const declarations = scanRouteDeclarations(content, allowsJsx(filePath));
|
|
111
|
+
for (const route of declarations) {
|
|
112
|
+
const { path: routePath, parts, at } = route;
|
|
93
113
|
const line = content.slice(0, at).split('\n').length;
|
|
94
114
|
const routeNode = {
|
|
95
115
|
id: `route:${filePath}:${line}:${routePath}`,
|
|
@@ -103,44 +123,616 @@ exports.reactResolver = {
|
|
|
103
123
|
endColumn: 0,
|
|
104
124
|
language: filePath.endsWith('.tsx') ? 'tsx' : 'jsx',
|
|
105
125
|
updatedAt: now,
|
|
126
|
+
...(parts.some((p) => p.expr) ? { signature: ROUTE_PARTS_PREFIX + JSON.stringify(parts) } : {}),
|
|
106
127
|
};
|
|
107
128
|
nodes.push(routeNode);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
fromNodeId: routeNode.id,
|
|
111
|
-
referenceName: component,
|
|
112
|
-
referenceKind: 'references',
|
|
113
|
-
line,
|
|
114
|
-
column: 0,
|
|
115
|
-
filePath,
|
|
116
|
-
language: filePath.endsWith('.tsx') ? 'tsx' : 'jsx',
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Next.js pages and route handlers are `frameworks/nextjs.ts`'s.
|
|
129
|
+
references.push(...routeReferences(route, routeNode.id, filePath, line));
|
|
130
|
+
}
|
|
121
131
|
return { nodes, references };
|
|
122
132
|
},
|
|
133
|
+
postExtract(context) {
|
|
134
|
+
const updates = [];
|
|
135
|
+
for (const route of context.getNodesByKind('route')) {
|
|
136
|
+
if (!route.signature?.startsWith(ROUTE_PARTS_PREFIX))
|
|
137
|
+
continue;
|
|
138
|
+
let parts;
|
|
139
|
+
try {
|
|
140
|
+
parts = JSON.parse(route.signature.slice(ROUTE_PARTS_PREFIX.length));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const values = parts.map((p) => p.lit ?? (p.expr ? constantPathValue(p.expr, route.filePath, context) : null));
|
|
146
|
+
if (values.some((v) => v === null))
|
|
147
|
+
continue;
|
|
148
|
+
const name = composeRoutePath(values);
|
|
149
|
+
if (name !== route.name)
|
|
150
|
+
updates.push({ ...route, name });
|
|
151
|
+
}
|
|
152
|
+
return updates;
|
|
153
|
+
},
|
|
154
|
+
crossFileNodes(context) {
|
|
155
|
+
return { kind: 'route', owns: isTableRoute, ...tableRoutes(context) };
|
|
156
|
+
},
|
|
157
|
+
lazyModules(ref, context) {
|
|
158
|
+
const name = ref.referenceName;
|
|
159
|
+
const picked = isReactRouteRef(ref) ? PICKED_EXPORT.exec(name.startsWith(LAYOUT_PREFIX) ? name.slice(LAYOUT_PREFIX.length) : name) : null;
|
|
160
|
+
if (picked) {
|
|
161
|
+
const reads = new Set();
|
|
162
|
+
pickedExport(picked[1], picked[2], ref.filePath, context, reads);
|
|
163
|
+
return [...reads];
|
|
164
|
+
}
|
|
165
|
+
let spec;
|
|
166
|
+
if (name.startsWith(LAZY_ROUTE_PREFIX))
|
|
167
|
+
spec = name.slice(LAZY_ROUTE_PREFIX.length);
|
|
168
|
+
else if (name.startsWith(LAYOUT_PREFIX + LAZY_ROUTE_PREFIX))
|
|
169
|
+
spec = name.slice(LAYOUT_PREFIX.length + LAZY_ROUTE_PREFIX.length);
|
|
170
|
+
else if (isReactRouteRef(ref)) {
|
|
171
|
+
const own = name.startsWith(LAYOUT_PREFIX) ? name.slice(LAYOUT_PREFIX.length) : name;
|
|
172
|
+
const loaded = isPascalCase(own) && !isBuiltInType(own) ? declaredLoader(own, ref.filePath, context) : undefined;
|
|
173
|
+
if (loaded && loaded.member !== 'default') {
|
|
174
|
+
const reads = new Set();
|
|
175
|
+
pickedExport(loaded.spec, loaded.member, ref.filePath, context, reads);
|
|
176
|
+
return [...reads];
|
|
177
|
+
}
|
|
178
|
+
spec = loaded?.spec;
|
|
179
|
+
}
|
|
180
|
+
return spec ? lazyRouteFiles(spec, ref.filePath, context) : [];
|
|
181
|
+
},
|
|
123
182
|
};
|
|
124
|
-
|
|
183
|
+
const LAZY_ROUTE_PREFIX = 'lazy-import:';
|
|
184
|
+
const ROUTE_PARTS_PREFIX = 'route-parts:';
|
|
185
|
+
const LAYOUT_PREFIX = 'layout:';
|
|
186
|
+
const OUTLET = 'Outlet';
|
|
187
|
+
const PICKED_EXPORT = /^import:(.+)#([A-Za-z_$][\w$]*)$/;
|
|
188
|
+
function composeRoutePath(parts) {
|
|
189
|
+
let path = '';
|
|
190
|
+
for (const part of parts) {
|
|
191
|
+
if (part.startsWith('/'))
|
|
192
|
+
path = part;
|
|
193
|
+
else if (part)
|
|
194
|
+
path = `${path.replace(/\/+$/, '')}/${part}`;
|
|
195
|
+
}
|
|
196
|
+
return ('/' + path.replace(/^\/+/, '')).replace(/\/{2,}/g, '/').replace(/(.)\/$/, '$1');
|
|
197
|
+
}
|
|
198
|
+
function constantPathValue(expr, fromFile, context) {
|
|
199
|
+
const [root, ...keys] = expr.split('.');
|
|
200
|
+
if (!root || keys.length === 0)
|
|
201
|
+
return null;
|
|
202
|
+
let file = fromFile;
|
|
203
|
+
let name = root;
|
|
204
|
+
const mapping = context.getImportMappings(fromFile, 'tsx').find((m) => m.localName === root) ??
|
|
205
|
+
context.getImportMappings(fromFile, 'typescript').find((m) => m.localName === root);
|
|
206
|
+
if (mapping) {
|
|
207
|
+
const resolved = (0, import_resolver_1.resolveImportPath)(mapping.source, fromFile, 'typescript', context);
|
|
208
|
+
if (!resolved)
|
|
209
|
+
return null;
|
|
210
|
+
file = resolved;
|
|
211
|
+
if (mapping.exportedName && mapping.exportedName !== 'default' && mapping.exportedName !== '*')
|
|
212
|
+
name = mapping.exportedName;
|
|
213
|
+
}
|
|
214
|
+
const decl = context.getNodesInFile(file).find((n) => n.name === name && (n.kind === 'constant' || n.kind === 'variable'));
|
|
215
|
+
if (!decl)
|
|
216
|
+
return null;
|
|
217
|
+
const lines = context.readFile(file)?.split('\n') ?? [];
|
|
218
|
+
const text = lines.slice(decl.startLine - 1, decl.endLine).join('\n');
|
|
219
|
+
const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${(0, utils_1.escapeRegExp)(name)}\\b`))));
|
|
220
|
+
return open < 0 ? null : readObjectPath(text, open, keys);
|
|
221
|
+
}
|
|
222
|
+
function configHrefExpression(expr, fromFile, context) {
|
|
223
|
+
const m = /^\s*([A-Za-z_$][\w$]*)((?:\s*\??\.\s*[A-Za-z_$][\w$]*)+)\s*(\((?:[^()]|\([^()]*\))*\))?\s*$/.exec(expr);
|
|
224
|
+
if (!m)
|
|
225
|
+
return null;
|
|
226
|
+
const root = m[1];
|
|
227
|
+
const keys = m[2].split('.').map((k) => k.replace(/[?\s]/g, '')).filter(Boolean);
|
|
228
|
+
let file = fromFile;
|
|
229
|
+
let name = root;
|
|
230
|
+
const mapping = context.getImportMappings(fromFile, 'tsx').find((x) => x.localName === root) ??
|
|
231
|
+
context.getImportMappings(fromFile, 'typescript').find((x) => x.localName === root);
|
|
232
|
+
if (mapping) {
|
|
233
|
+
const resolved = (0, import_resolver_1.resolveImportPath)(mapping.source, fromFile, 'typescript', context);
|
|
234
|
+
if (!resolved)
|
|
235
|
+
return null;
|
|
236
|
+
file = resolved;
|
|
237
|
+
if (mapping.exportedName && mapping.exportedName !== 'default' && mapping.exportedName !== '*')
|
|
238
|
+
name = mapping.exportedName;
|
|
239
|
+
}
|
|
240
|
+
const decl = context.getNodesInFile(file).find((n) => n.name === name && (n.kind === 'constant' || n.kind === 'variable'));
|
|
241
|
+
if (!decl)
|
|
242
|
+
return null;
|
|
243
|
+
const lines = context.readFile(file)?.split('\n') ?? [];
|
|
244
|
+
const text = lines.slice(decl.startLine - 1, decl.endLine).join('\n');
|
|
245
|
+
const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${(0, utils_1.escapeRegExp)(name)}\\b`))));
|
|
246
|
+
if (open < 0)
|
|
247
|
+
return null;
|
|
248
|
+
let value = readObjectValue(text, open, keys);
|
|
249
|
+
if (value === null)
|
|
250
|
+
return null;
|
|
251
|
+
if (m[3] !== undefined) {
|
|
252
|
+
const body = /^(?:async\s+)?(?:\([^()]*(?:\([^()]*\)[^()]*)*\)|[A-Za-z_$][\w$]*)\s*(?::\s*[^=]+?)?=>\s*/.exec(value);
|
|
253
|
+
if (!body)
|
|
254
|
+
return null;
|
|
255
|
+
value = value.slice(body[0].length).trim();
|
|
256
|
+
if (value.startsWith('{'))
|
|
257
|
+
value = /\breturn\s+([`'"][\s\S]*?[`'"])\s*;?\s*}/.exec(value)?.[1] ?? '';
|
|
258
|
+
}
|
|
259
|
+
if (!/^[`'"]/.test(value))
|
|
260
|
+
return null;
|
|
261
|
+
return value.startsWith('`') ? dropGluedTemplateHoles(value) : value;
|
|
262
|
+
}
|
|
263
|
+
function dropGluedTemplateHoles(template) {
|
|
264
|
+
let out = '';
|
|
265
|
+
for (let i = 0; i < template.length; i++) {
|
|
266
|
+
if (template[i] === '$' && template[i + 1] === '{') {
|
|
267
|
+
let depth = 0;
|
|
268
|
+
let j = i + 1;
|
|
269
|
+
for (; j < template.length; j++) {
|
|
270
|
+
if (template[j] === '{')
|
|
271
|
+
depth++;
|
|
272
|
+
else if (template[j] === '}' && --depth === 0)
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
const hole = template.slice(i, j + 1);
|
|
276
|
+
const next = template[j + 1];
|
|
277
|
+
if (out.endsWith('/') && (next === '/' || next === '`' || next === '?' || next === undefined))
|
|
278
|
+
out += hole;
|
|
279
|
+
i = j;
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
out += template[i];
|
|
283
|
+
}
|
|
284
|
+
return out;
|
|
285
|
+
}
|
|
286
|
+
function readObjectValue(text, at, keys) {
|
|
287
|
+
const skipString = (j) => {
|
|
288
|
+
const quote = text[j];
|
|
289
|
+
for (j++; j < text.length && text[j] !== quote; j++)
|
|
290
|
+
if (text[j] === '\\')
|
|
291
|
+
j++;
|
|
292
|
+
return j + 1;
|
|
293
|
+
};
|
|
294
|
+
const skipValue = (j) => {
|
|
295
|
+
let depth = 0;
|
|
296
|
+
for (; j < text.length; j++) {
|
|
297
|
+
const ch = text[j];
|
|
298
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
299
|
+
j = skipString(j) - 1;
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (ch === '{' || ch === '[' || ch === '(')
|
|
303
|
+
depth++;
|
|
304
|
+
else if (ch === '}' || ch === ']' || ch === ')') {
|
|
305
|
+
if (depth === 0)
|
|
306
|
+
return j;
|
|
307
|
+
depth--;
|
|
308
|
+
}
|
|
309
|
+
else if (ch === ',' && depth === 0)
|
|
310
|
+
return j;
|
|
311
|
+
}
|
|
312
|
+
return j;
|
|
313
|
+
};
|
|
314
|
+
let i = at + 1;
|
|
315
|
+
while (i < text.length) {
|
|
316
|
+
const m = /^\s*(?:([A-Za-z_$][\w$]*)|["']([^"']+)["'])\s*:\s*/.exec(text.slice(i));
|
|
317
|
+
if (!m) {
|
|
318
|
+
const next = skipValue(i);
|
|
319
|
+
if (text[next] !== ',')
|
|
320
|
+
return null;
|
|
321
|
+
i = next + 1;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const key = m[1] ?? m[2];
|
|
325
|
+
const valueAt = i + m[0].length;
|
|
326
|
+
const end = skipValue(valueAt);
|
|
327
|
+
if (key === keys[0]) {
|
|
328
|
+
if (keys.length === 1)
|
|
329
|
+
return text.slice(valueAt, end).trim();
|
|
330
|
+
return text[valueAt] === '{' ? readObjectValue(text, valueAt, keys.slice(1)) : null;
|
|
331
|
+
}
|
|
332
|
+
if (text[end] !== ',')
|
|
333
|
+
return null;
|
|
334
|
+
i = end + 1;
|
|
335
|
+
}
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
function readObjectPath(text, at, keys) {
|
|
339
|
+
const skipString = (j) => {
|
|
340
|
+
const quote = text[j];
|
|
341
|
+
for (j++; j < text.length && text[j] !== quote; j++)
|
|
342
|
+
if (text[j] === '\\')
|
|
343
|
+
j++;
|
|
344
|
+
return j + 1;
|
|
345
|
+
};
|
|
346
|
+
const skipValue = (j) => {
|
|
347
|
+
let depth = 0;
|
|
348
|
+
for (; j < text.length; j++) {
|
|
349
|
+
const ch = text[j];
|
|
350
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
351
|
+
j = skipString(j) - 1;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (ch === '{' || ch === '[' || ch === '(')
|
|
355
|
+
depth++;
|
|
356
|
+
else if (ch === '}' || ch === ']' || ch === ')') {
|
|
357
|
+
if (depth === 0)
|
|
358
|
+
return j;
|
|
359
|
+
depth--;
|
|
360
|
+
}
|
|
361
|
+
else if (ch === ',' && depth === 0)
|
|
362
|
+
return j;
|
|
363
|
+
}
|
|
364
|
+
return j;
|
|
365
|
+
};
|
|
366
|
+
let i = at + 1;
|
|
367
|
+
while (i < text.length) {
|
|
368
|
+
const m = /^\s*(?:([A-Za-z_$][\w$]*)|["']([^"']+)["'])\s*:\s*/.exec(text.slice(i));
|
|
369
|
+
if (!m) {
|
|
370
|
+
const next = skipValue(i);
|
|
371
|
+
if (text[next] !== ',')
|
|
372
|
+
return null;
|
|
373
|
+
i = next + 1;
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
const key = m[1] ?? m[2];
|
|
377
|
+
const valueAt = i + m[0].length;
|
|
378
|
+
if (key === keys[0]) {
|
|
379
|
+
if (keys.length === 1) {
|
|
380
|
+
const lit = /^(["'])((?:\\.|(?!\1).)*)\1/.exec(text.slice(valueAt));
|
|
381
|
+
return lit ? lit[2] : null;
|
|
382
|
+
}
|
|
383
|
+
return text[valueAt] === '{' ? readObjectPath(text, valueAt, keys.slice(1)) : null;
|
|
384
|
+
}
|
|
385
|
+
const end = skipValue(valueAt);
|
|
386
|
+
if (text[end] !== ',')
|
|
387
|
+
return null;
|
|
388
|
+
i = end + 1;
|
|
389
|
+
}
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
function lazyModuleFile(spec, fromFile, context) {
|
|
393
|
+
const language = scriptLanguage(fromFile);
|
|
394
|
+
return (0, import_resolver_1.resolveImportPath)(spec, fromFile, language, context) ??
|
|
395
|
+
(language === 'typescript' ? null : (0, import_resolver_1.resolveImportPath)(spec, fromFile, 'typescript', context));
|
|
396
|
+
}
|
|
397
|
+
function lazyRouteComponent(spec, fromFile, context, reads) {
|
|
398
|
+
const file = lazyModuleFile(spec, fromFile, context);
|
|
399
|
+
if (!file)
|
|
400
|
+
return null;
|
|
401
|
+
return exportedComponent(file, 'default', context, new Set(), reads) ??
|
|
402
|
+
exportedComponent(file, 'Component', context, new Set(), reads);
|
|
403
|
+
}
|
|
404
|
+
function lazyRouteFiles(spec, fromFile, context) {
|
|
405
|
+
const reads = new Set();
|
|
406
|
+
lazyRouteComponent(spec, fromFile, context, reads);
|
|
407
|
+
return [...reads];
|
|
408
|
+
}
|
|
409
|
+
function pickedExport(spec, name, fromFile, context, reads) {
|
|
410
|
+
const file = lazyModuleFile(spec, fromFile, context);
|
|
411
|
+
return file ? exportedComponent(file, name, context, new Set(), reads) : null;
|
|
412
|
+
}
|
|
413
|
+
function isReactRouteRef(ref) {
|
|
414
|
+
return (ref.language === 'tsx' || ref.language === 'jsx') && ref.fromNodeId.startsWith(`route:${ref.filePath}:`);
|
|
415
|
+
}
|
|
416
|
+
const EXPORTED_COMPONENT_KINDS = new Set(['function', 'component', 'class', 'constant', 'variable']);
|
|
417
|
+
const MAX_REEXPORT_HOPS = 4;
|
|
418
|
+
function exportedComponent(file, name, context, visited = new Set(), reads) {
|
|
419
|
+
if (visited.has(file) || visited.size > MAX_REEXPORT_HOPS)
|
|
420
|
+
return null;
|
|
421
|
+
reads?.add(file);
|
|
422
|
+
const language = scriptLanguage(file);
|
|
423
|
+
const through = new Set(visited).add(file);
|
|
424
|
+
const forwarded = (source, exported) => {
|
|
425
|
+
const target = (0, import_resolver_1.resolveImportPath)(source, file, language, context);
|
|
426
|
+
return target ? exportedComponent(target, exported, context, through, reads) : null;
|
|
427
|
+
};
|
|
428
|
+
const code = (0, strip_comments_1.stripCommentsForRegex)(context.readFile(file) ?? '', 'typescript');
|
|
429
|
+
const local = ownExport(code, name);
|
|
430
|
+
if (local) {
|
|
431
|
+
const nodes = context.getNodesInFile(file);
|
|
432
|
+
const declaredAs = (binding) => {
|
|
433
|
+
const named = nodes.filter((n) => n.name === binding && EXPORTED_COMPONENT_KINDS.has(n.kind));
|
|
434
|
+
return named.find((n) => n.qualifiedName === binding) ?? named[0];
|
|
435
|
+
};
|
|
436
|
+
const exported = declaredAs(local);
|
|
437
|
+
let binding = local;
|
|
438
|
+
let declared = exported;
|
|
439
|
+
for (let hop = 0; declared && hop < MAX_REEXPORT_HOPS; hop++) {
|
|
440
|
+
const held = declared.kind === 'constant' ? heldBinding(declared, context) : null;
|
|
441
|
+
if (!held)
|
|
442
|
+
break;
|
|
443
|
+
binding = held;
|
|
444
|
+
declared = declaredAs(held);
|
|
445
|
+
}
|
|
446
|
+
if (declared) {
|
|
447
|
+
const wrapped = declared.kind === 'constant' || declared.kind === 'variable' ? wrappedComponent(declared, context)
|
|
448
|
+
: declared.kind === 'component' ? handedComponent(declared, context) : null;
|
|
449
|
+
return (wrapped ?? declared).id;
|
|
450
|
+
}
|
|
451
|
+
if (binding === local && name === 'default' && !exportsBinding(code, local))
|
|
452
|
+
return null;
|
|
453
|
+
const imported = context.getImportMappings(file, language).find((m) => m.localName === binding);
|
|
454
|
+
const id = imported && !imported.isNamespace ? forwarded(imported.source, imported.isDefault ? 'default' : imported.exportedName) : null;
|
|
455
|
+
return id ?? exported?.id ?? null;
|
|
456
|
+
}
|
|
457
|
+
const reExports = context.getReExports?.(file, language) ?? [];
|
|
458
|
+
for (const re of reExports) {
|
|
459
|
+
if (re.kind === 'named' && re.exportedName === name)
|
|
460
|
+
return forwarded(re.source, re.originalName);
|
|
461
|
+
}
|
|
462
|
+
if (name === 'default')
|
|
463
|
+
return null;
|
|
464
|
+
let found = null;
|
|
465
|
+
for (const re of reExports) {
|
|
466
|
+
if (re.kind !== 'wildcard')
|
|
467
|
+
continue;
|
|
468
|
+
const id = forwarded(re.source, name);
|
|
469
|
+
if (id && found && id !== found)
|
|
470
|
+
return null;
|
|
471
|
+
found ??= id;
|
|
472
|
+
}
|
|
473
|
+
return found;
|
|
474
|
+
}
|
|
475
|
+
function ownExport(source, name) {
|
|
476
|
+
if (name === 'default') {
|
|
477
|
+
const declared = defaultExportedName(source);
|
|
478
|
+
if (declared)
|
|
479
|
+
return declared;
|
|
480
|
+
}
|
|
481
|
+
else if (new RegExp(String.raw `\bexport\s+(?:async\s+)?(?:const|let|var|function|class)\s+${(0, utils_1.escapeRegExp)(name)}(?![\w$])`).test(source)) {
|
|
482
|
+
return name;
|
|
483
|
+
}
|
|
484
|
+
return (0, alias_binding_1.extractLocalExportAliases)(source).find((a) => a.exportedName === name)?.localName ?? null;
|
|
485
|
+
}
|
|
486
|
+
function defaultExportedName(source) {
|
|
487
|
+
const at = /\bexport\s+default\s+/.exec(source);
|
|
488
|
+
if (!at)
|
|
489
|
+
return null;
|
|
490
|
+
const rest = source.slice(at.index + at[0].length);
|
|
491
|
+
const named = /^(?:async\s+)?(?:function\s*\*?\s*|class\s+)([A-Za-z_$][\w$]*)/.exec(rest) ??
|
|
492
|
+
/^([A-Za-z_$][\w$]*)(?:[ \t]*(?:;|\r?\n|$)|\s+(?:as|satisfies)\s)/.exec(rest);
|
|
493
|
+
return named ? named[1] : wrappedName(rest.slice(0, statementEnd(rest, 0)));
|
|
494
|
+
}
|
|
495
|
+
function wrappedName(expression) {
|
|
496
|
+
const s = expression.trim();
|
|
497
|
+
const callee = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*\s*(?:<[^()]*>)?\s*(?=\()/.exec(s);
|
|
498
|
+
if (!callee)
|
|
499
|
+
return null;
|
|
500
|
+
let end = callee[0].length;
|
|
501
|
+
let args = [];
|
|
502
|
+
for (let open = end; s[open] === '(';) {
|
|
503
|
+
const close = (0, object_literal_1.matchBracket)(s, open);
|
|
504
|
+
if (close < 0)
|
|
505
|
+
return null;
|
|
506
|
+
args = topLevelItems(s.slice(open + 1, close));
|
|
507
|
+
end = close + 1;
|
|
508
|
+
for (open = end; /\s/.test(s[open] ?? '');)
|
|
509
|
+
open++;
|
|
510
|
+
}
|
|
511
|
+
if (!/^(?:\s+(?:as|satisfies)\s[\s\S]*)?$/.test(s.slice(end)))
|
|
512
|
+
return null;
|
|
513
|
+
const first = args[0] ?? '';
|
|
514
|
+
if (args.length > 1 && !/^[A-Z]/.test(first))
|
|
515
|
+
return null;
|
|
516
|
+
return /^[A-Za-z_$][\w$]*$/.test(first) ? first : first ? wrappedName(first) : null;
|
|
517
|
+
}
|
|
518
|
+
function exportsBinding(source, local) {
|
|
519
|
+
return (0, alias_binding_1.defaultExportBinding)(source) === local;
|
|
520
|
+
}
|
|
521
|
+
function declaredComponent(name, filePath, context) {
|
|
522
|
+
const declaration = declaredValue(name, filePath, context);
|
|
523
|
+
if (!declaration)
|
|
524
|
+
return undefined;
|
|
525
|
+
const loaded = valueLoader(declaration, context);
|
|
526
|
+
if (!loaded)
|
|
527
|
+
return { declaration, component: wrappedComponent(declaration, context) };
|
|
528
|
+
const id = loaded.member === 'default'
|
|
529
|
+
? lazyRouteComponent(loaded.spec, filePath, context)
|
|
530
|
+
: pickedExport(loaded.spec, loaded.member, filePath, context);
|
|
531
|
+
return { declaration, component: id ? context.getNodeById?.(id) ?? null : null };
|
|
532
|
+
}
|
|
533
|
+
function declaredLoader(name, filePath, context) {
|
|
534
|
+
const declaration = declaredValue(name, filePath, context);
|
|
535
|
+
return declaration ? valueLoader(declaration, context) : undefined;
|
|
536
|
+
}
|
|
537
|
+
function lazyValueModules(filePath, context) {
|
|
538
|
+
const reads = new Set();
|
|
539
|
+
for (const node of context.getNodesInFile(filePath)) {
|
|
540
|
+
if ((node.kind !== 'constant' && node.kind !== 'variable') || node.qualifiedName !== node.name || !isPascalCase(node.name))
|
|
541
|
+
continue;
|
|
542
|
+
const loaded = valueLoader(node, context);
|
|
543
|
+
if (!loaded)
|
|
544
|
+
continue;
|
|
545
|
+
if (loaded.member === 'default')
|
|
546
|
+
lazyRouteComponent(loaded.spec, filePath, context, reads);
|
|
547
|
+
else
|
|
548
|
+
pickedExport(loaded.spec, loaded.member, filePath, context, reads);
|
|
549
|
+
}
|
|
550
|
+
return [...reads];
|
|
551
|
+
}
|
|
552
|
+
function declaredValue(name, filePath, context) {
|
|
553
|
+
return (context.getNodesInFileNamed?.(filePath, name) ?? context.getNodesInFile(filePath).filter((n) => n.name === name))
|
|
554
|
+
.find((n) => (n.kind === 'constant' || n.kind === 'variable') && n.qualifiedName === name);
|
|
555
|
+
}
|
|
556
|
+
function valueLoader(declaration, context) {
|
|
557
|
+
const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(declaration, context), 'typescript');
|
|
558
|
+
const init = initializerAt(code, declaration.name.length);
|
|
559
|
+
const loader = init < 0 ? null : loaderOf(code.slice(init));
|
|
560
|
+
if (!loader)
|
|
561
|
+
return null;
|
|
562
|
+
const page = loadedPage(loaderValue(loader, new Map()));
|
|
563
|
+
if (page)
|
|
564
|
+
return page;
|
|
565
|
+
const fn = functionParts(loader);
|
|
566
|
+
const spec = fn && !fn.block ? FIRST_IMPORT.exec(fn.body)?.[1] : undefined;
|
|
567
|
+
return spec ? { spec, member: 'default' } : null;
|
|
568
|
+
}
|
|
569
|
+
function loaderOf(text) {
|
|
570
|
+
const s = text.trim();
|
|
571
|
+
const call = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*\s*(?:<[^()]*>)?\s*\(/.exec(s);
|
|
572
|
+
if (!call)
|
|
573
|
+
return conditionalLoader(s);
|
|
574
|
+
const open = call[0].length - 1;
|
|
575
|
+
const close = (0, object_literal_1.matchBracket)(s, open);
|
|
576
|
+
if (close < 0)
|
|
577
|
+
return null;
|
|
578
|
+
for (const arg of topLevelItems(s.slice(open + 1, close))) {
|
|
579
|
+
const item = arg.trim();
|
|
580
|
+
if (!item)
|
|
581
|
+
continue;
|
|
582
|
+
if (functionParts(item))
|
|
583
|
+
return item;
|
|
584
|
+
if (item.startsWith('{')) {
|
|
585
|
+
const loader = (0, object_literal_1.matchBracket)(item, 0) === item.length - 1 ? objectEntries(item.slice(1, -1)).props.get('loader') : undefined;
|
|
586
|
+
if (loader !== undefined && functionParts(loader))
|
|
587
|
+
return loader;
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
const inner = loaderOf(item);
|
|
591
|
+
if (inner)
|
|
592
|
+
return inner;
|
|
593
|
+
}
|
|
594
|
+
return conditionalLoader(s);
|
|
595
|
+
}
|
|
596
|
+
function conditionalLoader(text) {
|
|
597
|
+
const branches = conditionalBranches(text);
|
|
598
|
+
const loaders = branches ? branches.map(loaderOf).filter((l) => l !== null) : [];
|
|
599
|
+
return loaders.length === 1 ? loaders[0] : null;
|
|
600
|
+
}
|
|
601
|
+
function conditionalBranches(text) {
|
|
602
|
+
let question = -1;
|
|
603
|
+
let open = 0;
|
|
604
|
+
for (let i = 0; i < text.length; i++) {
|
|
605
|
+
const ch = text[i];
|
|
606
|
+
if (ch === '"' || ch === "'" || ch === '`' || ch === '{' || ch === '(' || ch === '[') {
|
|
607
|
+
i = ch === '{' || ch === '(' || ch === '[' ? (0, object_literal_1.matchBracket)(text, i) : (0, object_literal_1.skipString)(text, i);
|
|
608
|
+
if (i < 0)
|
|
609
|
+
return null;
|
|
610
|
+
}
|
|
611
|
+
else if (ch === '?') {
|
|
612
|
+
if (text[i + 1] === '?' || (text[i + 1] === '.' && !/\d/.test(text[i + 2] ?? '')))
|
|
613
|
+
i++;
|
|
614
|
+
else if (open++ === 0)
|
|
615
|
+
question = i;
|
|
616
|
+
}
|
|
617
|
+
else if (ch === ':' && open > 0 && --open === 0) {
|
|
618
|
+
return [text.slice(question + 1, i), text.slice(i + 1)];
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
function loadedPage(value) {
|
|
624
|
+
if (value?.kind === 'module')
|
|
625
|
+
return { spec: value.spec, member: 'default' };
|
|
626
|
+
if (value?.kind === 'export')
|
|
627
|
+
return { spec: value.spec, member: value.name };
|
|
628
|
+
if (value?.kind !== 'object')
|
|
629
|
+
return null;
|
|
630
|
+
const inner = objectEntries(value.text).props.get('default');
|
|
631
|
+
return inner === undefined ? null : loadedPage(valueOf(inner, value.scope));
|
|
632
|
+
}
|
|
633
|
+
function declarationText(node, context) {
|
|
634
|
+
const lines = (context.getFileLines?.(node.filePath) ?? context.readFile(node.filePath)?.split(/\r?\n/) ?? [])
|
|
635
|
+
.slice(node.startLine - 1, node.endLine);
|
|
636
|
+
if (lines.length === 0)
|
|
637
|
+
return '';
|
|
638
|
+
if (node.endColumn > 0)
|
|
639
|
+
lines[lines.length - 1] = lines[lines.length - 1].slice(0, node.endColumn);
|
|
640
|
+
lines[0] = lines[0].slice(node.startColumn);
|
|
641
|
+
return lines.join('\n');
|
|
642
|
+
}
|
|
643
|
+
function wrappedComponent(value, context) {
|
|
644
|
+
const nodes = context.getNodesInFile(value.filePath);
|
|
645
|
+
const inner = nodes.filter((n) => COMPONENT_KINDS.has(n.kind) &&
|
|
646
|
+
n.qualifiedName === `${value.qualifiedName}::${n.name}` && n.startLine >= value.startLine && n.endLine <= value.endLine);
|
|
647
|
+
const held = inner.find((n) => n.name === value.name) ??
|
|
648
|
+
(inner.length === 1 && inner[0].endLine === value.endLine ? inner[0] : null);
|
|
649
|
+
if (held || inner.length > 0)
|
|
650
|
+
return held;
|
|
651
|
+
return handedComponent(value, context, nodes);
|
|
652
|
+
}
|
|
653
|
+
function heldBinding(value, context) {
|
|
654
|
+
const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(value, context), 'typescript');
|
|
655
|
+
const init = initializerAt(code, value.name.length);
|
|
656
|
+
if (init < 0)
|
|
657
|
+
return null;
|
|
658
|
+
const held = /^\s*([A-Za-z_$][\w$]*)\s*(?:$|(?:as|satisfies)\s)/.exec(code.slice(init, statementEnd(code, init)));
|
|
659
|
+
return held && held[1] !== value.name ? held[1] : null;
|
|
660
|
+
}
|
|
661
|
+
function handedComponent(value, context, nodes = context.getNodesInFile(value.filePath)) {
|
|
662
|
+
const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(value, context), 'typescript');
|
|
663
|
+
const init = initializerAt(code, value.name.length);
|
|
664
|
+
const handed = init < 0 ? null : wrappedName(code.slice(init, statementEnd(code, init)));
|
|
665
|
+
return handed && isPascalCase(handed) && handed !== value.name
|
|
666
|
+
? nodes.find((n) => n.name === handed && n.qualifiedName === handed && COMPONENT_KINDS.has(n.kind)) ?? null
|
|
667
|
+
: null;
|
|
668
|
+
}
|
|
669
|
+
function wrappedComponentName(component, context) {
|
|
670
|
+
const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(component, context), 'typescript');
|
|
671
|
+
const init = initializerAt(code, component.name.length);
|
|
672
|
+
if (init < 0)
|
|
673
|
+
return null;
|
|
674
|
+
const expression = code.slice(init, statementEnd(code, init)).trim();
|
|
675
|
+
const styled = /^styled\s*\(\s*([A-Za-z_$][\w$]*)\s*[,)]/.exec(expression);
|
|
676
|
+
const name = styled ? styled[1]
|
|
677
|
+
: /^(?:React\s*\.\s*)?(?:memo|forwardRef)\b/.test(expression) ? wrappedName(expression) : null;
|
|
678
|
+
return name && isPascalCase(name) && name !== component.name ? name : null;
|
|
679
|
+
}
|
|
680
|
+
function layoutComponent(spec, ref, context) {
|
|
681
|
+
if (spec.startsWith(LAZY_ROUTE_PREFIX))
|
|
682
|
+
return lazyRouteComponent(spec.slice(LAZY_ROUTE_PREFIX.length), ref.filePath, context);
|
|
683
|
+
const picked = isReactRouteRef(ref) ? PICKED_EXPORT.exec(spec) : null;
|
|
684
|
+
if (picked)
|
|
685
|
+
return pickedExport(picked[1], picked[2], ref.filePath, context);
|
|
686
|
+
const mapping = context.getImportMappings(ref.filePath, ref.language).find((m) => m.localName === spec);
|
|
687
|
+
if (!mapping) {
|
|
688
|
+
const own = declaredComponent(spec, ref.filePath, context);
|
|
689
|
+
if (own)
|
|
690
|
+
return (own.component ?? own.declaration).id;
|
|
691
|
+
return resolveComponent(spec, ref.filePath, context);
|
|
692
|
+
}
|
|
693
|
+
const viaImport = context.resolveImport?.({ ...ref, referenceName: spec })?.targetNodeId;
|
|
694
|
+
if (viaImport)
|
|
695
|
+
return viaImport;
|
|
696
|
+
if (mapping.isDefault || mapping.exportedName === 'default')
|
|
697
|
+
return lazyRouteComponent(mapping.source, ref.filePath, context);
|
|
698
|
+
const file = (0, import_resolver_1.resolveImportPath)(mapping.source, ref.filePath, ref.language, context);
|
|
699
|
+
return file ? context.getNodesInFile(file).find((n) => n.name === mapping.exportedName && COMPONENT_KINDS.has(n.kind))?.id ?? null : null;
|
|
700
|
+
}
|
|
701
|
+
const ROUTER_CALL = /\b(?:createBrowserRouter|createHashRouter|createMemoryRouter|createRoutesFromElements|useRoutes)\b/;
|
|
702
|
+
const ROUTER_ELEMENT = /^(?:Browser|Hash|Memory|Native|Static|History|unstable_History)?Router$/;
|
|
703
|
+
const NAMED_ENTRY = /^(?:\.\.\.\s*)?([A-Za-z_$][\w$]*)\s*(\([\s\S]*\))?$/;
|
|
125
704
|
function scanRouteDeclarations(source, allowJsx) {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
705
|
+
const objects = ROUTER_CALL.test(source);
|
|
706
|
+
if (!objects && !/<Route\b/.test(source))
|
|
707
|
+
return [];
|
|
708
|
+
return scanRoutes(source, allowJsx, { objects }).routes;
|
|
709
|
+
}
|
|
710
|
+
function scanRoutes(source, allowJsx, options) {
|
|
711
|
+
const scopes = [];
|
|
712
|
+
const names = [];
|
|
713
|
+
const sites = [];
|
|
714
|
+
const routeTags = [];
|
|
715
|
+
const routers = [];
|
|
716
|
+
const objects = Boolean(options.objects || options.table);
|
|
130
717
|
const literal = (value) => {
|
|
131
718
|
const match = /^(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)')$/.exec(value.trim());
|
|
132
719
|
return match ? match[1] ?? match[2] : undefined;
|
|
133
720
|
};
|
|
721
|
+
const WRAPPER = /^(?:Suspense|ErrorBoundary|\w*(?:Guard|Provider|Wrapper|Route)|(?:Protected|Private|Auth|Require\w*)\w*)$/;
|
|
134
722
|
const componentName = (value, jsx) => {
|
|
135
723
|
if (!value)
|
|
136
724
|
return undefined;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
725
|
+
if (!jsx)
|
|
726
|
+
return /^\s*([A-Z][\w]*)\s*$/.exec(value)?.[1];
|
|
727
|
+
const inner = value.replace(/^\s*(?:\(\s*)?/, '');
|
|
728
|
+
if (!/^<\s*[A-Z]/.test(inner))
|
|
729
|
+
return undefined;
|
|
730
|
+
const { own, props } = elementTags(inner);
|
|
731
|
+
const content = (t) => !WRAPPER.test(t) && t !== 'Outlet';
|
|
732
|
+
return own.find(content) ?? props.find(content) ?? [...own].reverse().find((t) => t !== 'Outlet') ?? own[0];
|
|
141
733
|
};
|
|
142
|
-
|
|
143
|
-
|
|
734
|
+
const elementTag = (value) => componentName(value, true);
|
|
735
|
+
const elementPage = (value) => elementTag(value)?.replace(/^Outlet$/, '') || undefined;
|
|
144
736
|
const tokenBefore = (at) => {
|
|
145
737
|
let j = at - 1;
|
|
146
738
|
while (j >= 0 && /\s/.test(source[j]))
|
|
@@ -166,7 +758,54 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
166
758
|
}
|
|
167
759
|
return at;
|
|
168
760
|
};
|
|
169
|
-
|
|
761
|
+
const routerCall = (at) => {
|
|
762
|
+
if (!options.uses)
|
|
763
|
+
return null;
|
|
764
|
+
let j = at - 1;
|
|
765
|
+
while (j >= 0 && /\s/.test(source[j]))
|
|
766
|
+
j--;
|
|
767
|
+
if (source[j] !== 's' && source[j] !== 'r' && source[j] !== 'p')
|
|
768
|
+
return null;
|
|
769
|
+
const before = source.slice(Math.max(0, at - 64), at);
|
|
770
|
+
if (/(?:^|[^\w$.])(?:useRoutes|create(?:Browser|Hash|Memory)Router)\s*$/.test(before))
|
|
771
|
+
return {};
|
|
772
|
+
const map = /(?:^|[^\w$.])([A-Za-z_$][\w$]*)\s*\??\.\s*map\s*$/.exec(before);
|
|
773
|
+
if (!map)
|
|
774
|
+
return null;
|
|
775
|
+
return { map: { name: map[1], call: false, at: at - before.length + map.index + map[0].indexOf(map[1]) } };
|
|
776
|
+
};
|
|
777
|
+
const routesFromElements = (at) => {
|
|
778
|
+
let j = at - 1;
|
|
779
|
+
while (j >= 0 && /\s/.test(source[j]))
|
|
780
|
+
j--;
|
|
781
|
+
if (source[j] !== 's' && source[j] !== 'n')
|
|
782
|
+
return false;
|
|
783
|
+
return /(?:^|[^\w$.])createRoutesFrom(?:Elements|Children)\s*$/.test(source.slice(Math.max(0, at - 40), at));
|
|
784
|
+
};
|
|
785
|
+
const settle = (call, open, close) => {
|
|
786
|
+
const argAt = trivia(open + 1);
|
|
787
|
+
if (argAt >= close)
|
|
788
|
+
return;
|
|
789
|
+
if (call.map) {
|
|
790
|
+
const tags = routeTags.filter((t) => t.at > argAt && t.at < close);
|
|
791
|
+
if (tags.length > 0 && mapsRouteFields(source.slice(argAt, close), tags))
|
|
792
|
+
sites.push({ name: call.map, at: open });
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
if (source[argAt] === '[' || source[argAt] === '{') {
|
|
796
|
+
sites.push({ literal: argAt, at: open });
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const id = /^[A-Za-z_$][\w$]*/.exec(source.slice(argAt, close));
|
|
800
|
+
if (!id || /^createRoutesFrom(?:Elements|Children)$/.test(id[0]))
|
|
801
|
+
return;
|
|
802
|
+
const next = trivia(argAt + id[0].length);
|
|
803
|
+
if (next === close || source[next] === ',')
|
|
804
|
+
sites.push({ name: { name: id[0], call: false, at: argAt }, at: open });
|
|
805
|
+
else if (source[next] === '(')
|
|
806
|
+
sites.push({ name: { name: id[0], call: true, at: argAt }, at: open });
|
|
807
|
+
};
|
|
808
|
+
function unit(at, routeList = false) {
|
|
170
809
|
const ch = source[at];
|
|
171
810
|
if (ch === '"' || ch === "'" || ch === '`') {
|
|
172
811
|
let i = at + 1;
|
|
@@ -185,7 +824,6 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
185
824
|
}
|
|
186
825
|
return i;
|
|
187
826
|
}
|
|
188
|
-
// A regex can contain braces or JSX-looking text without ending an expression.
|
|
189
827
|
if (ch === '/') {
|
|
190
828
|
const before = tokenBefore(at);
|
|
191
829
|
if (!before || /[=(:,[!&|?{};]$/.test(before) || /\b(?:return|throw|case|yield)\s*$/.test(before)) {
|
|
@@ -210,79 +848,161 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
210
848
|
}
|
|
211
849
|
if (allowJsx && ch === '<' && /^<(?:[A-Za-z][\w.:-]*|>)/.test(source.slice(at))) {
|
|
212
850
|
const before = tokenBefore(at);
|
|
213
|
-
// `count<limit` and `factory<Type>()` are not JSX opening tags.
|
|
214
851
|
if (!/[\w$)\]'"]$/.test(before) || /\breturn$/.test(before))
|
|
215
852
|
return jsx(at);
|
|
216
853
|
}
|
|
217
854
|
const close = ch === '{' ? '}' : ch === '[' ? ']' : ch === '(' ? ')' : undefined;
|
|
218
855
|
if (!close)
|
|
219
856
|
return at + 1;
|
|
857
|
+
const call = ch === '(' ? routerCall(at) : null;
|
|
858
|
+
const router = ch === '(' && routesFromElements(at);
|
|
220
859
|
let i = at + 1;
|
|
221
860
|
const fields = new Map();
|
|
222
861
|
while ((i = trivia(i)) < source.length && source[i] !== close) {
|
|
223
|
-
// A property must start at an object entry, never inside its value.
|
|
224
862
|
const key = ch === '{' ? /^(?:([A-Za-z_$][\w$]*)|["']([^"']+)["'])\s*:/.exec(source.slice(i)) : null;
|
|
225
863
|
if (key) {
|
|
864
|
+
const name = key[1] ?? key[2];
|
|
226
865
|
const start = i;
|
|
227
866
|
const valueAt = trivia(i + key[0].length);
|
|
867
|
+
const children = objects && name === 'children';
|
|
228
868
|
i = valueAt;
|
|
229
869
|
let valueEnd = i;
|
|
230
870
|
while ((i = trivia(i)) < source.length && source[i] !== ',' && source[i] !== close) {
|
|
231
|
-
i = unit(i);
|
|
871
|
+
i = unit(i, children);
|
|
232
872
|
valueEnd = i;
|
|
233
873
|
}
|
|
234
|
-
|
|
874
|
+
const value = source.slice(valueAt, valueEnd).trim();
|
|
875
|
+
fields.set(name, { value, at: start });
|
|
876
|
+
if (children && /^[A-Za-z_$][\w$]*$/.test(value))
|
|
877
|
+
names.push({ name: value, call: false, at: valueAt });
|
|
235
878
|
}
|
|
236
879
|
else {
|
|
237
|
-
|
|
880
|
+
const entry = i;
|
|
238
881
|
while ((i = trivia(i)) < source.length && source[i] !== ',' && source[i] !== close)
|
|
239
882
|
i = unit(i);
|
|
883
|
+
const method = objects && ch === '{' ? /^(async\s+)?lazy\s*\(/.exec(source.slice(entry, entry + 32)) : null;
|
|
884
|
+
if (method) {
|
|
885
|
+
fields.set('lazy', { value: `${method[1] ?? ''}function ${source.slice(entry + method[0].length - 1, i).trim()}`, at: entry });
|
|
886
|
+
}
|
|
887
|
+
if (routeList && ch === '[') {
|
|
888
|
+
const text = source.slice(entry, i).replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, '').trim();
|
|
889
|
+
const named = NAMED_ENTRY.exec(text);
|
|
890
|
+
const args = named?.[2] ? text.length - named[2].length : -1;
|
|
891
|
+
if (named && (args < 0 || (0, object_literal_1.matchBracket)(text, args) === text.length - 1)) {
|
|
892
|
+
names.push({ name: named[1], call: args >= 0, at: entry });
|
|
893
|
+
}
|
|
894
|
+
}
|
|
240
895
|
}
|
|
241
896
|
if (source[i] === ',')
|
|
242
897
|
i++;
|
|
243
898
|
}
|
|
244
|
-
if (
|
|
899
|
+
if (objects && ch === '{' && source[i] === close) {
|
|
245
900
|
const pathField = fields.get('path');
|
|
246
901
|
const path = pathField && literal(pathField.value);
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
902
|
+
const expr = pathField && path === undefined && /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(pathField.value) ? pathField.value : undefined;
|
|
903
|
+
const shown = elementTag(fields.get('element')?.value) ?? componentName(fields.get('Component')?.value, false);
|
|
904
|
+
const loaded = lazyRouteReference(fields.get('lazy')?.value, elementTag);
|
|
905
|
+
const outlet = (shown ?? loaded) === OUTLET && path !== '';
|
|
906
|
+
const component = shown === OUTLET ? undefined : shown;
|
|
907
|
+
const lazy = loaded === OUTLET ? undefined : loaded;
|
|
908
|
+
const index = fields.get('index');
|
|
909
|
+
if (pathField && (path !== undefined || expr)) {
|
|
910
|
+
scopes.push({ part: path !== undefined ? { lit: path } : { expr }, at: pathField.at, start: at, end: i, component, lazy, outlet });
|
|
911
|
+
}
|
|
912
|
+
else if (!pathField && index?.value === 'true') {
|
|
913
|
+
scopes.push({ part: { lit: '' }, at: index.at, start: at, end: i, component, lazy });
|
|
914
|
+
}
|
|
915
|
+
else if (!pathField && (component || lazy) && fields.has('children')) {
|
|
916
|
+
scopes.push({ part: { lit: '' }, at, start: at, end: i, component, lazy, pathless: true });
|
|
917
|
+
}
|
|
251
918
|
}
|
|
919
|
+
if (call && i < source.length)
|
|
920
|
+
settle(call, at, i);
|
|
921
|
+
if (router)
|
|
922
|
+
routers.push({ start: at, end: i });
|
|
252
923
|
return i < source.length ? i + 1 : i;
|
|
253
924
|
}
|
|
254
925
|
function jsx(at) {
|
|
255
926
|
const tag = /^<([\w.:-]*)/.exec(source.slice(at));
|
|
256
927
|
let i = at + tag[0].length;
|
|
257
928
|
const attrs = new Map();
|
|
929
|
+
const spreads = [];
|
|
258
930
|
while ((i = trivia(i)) < source.length && source[i] !== '>' && !source.startsWith('/>', i)) {
|
|
259
931
|
const attr = /^[\w:-]+/.exec(source.slice(i));
|
|
260
932
|
if (!attr) {
|
|
933
|
+
const from = i;
|
|
261
934
|
i = unit(i);
|
|
935
|
+
const spread = /^\{\s*\.\.\.\s*([A-Za-z_$][\w$]*)\s*\}$/.exec(source.slice(from, i));
|
|
936
|
+
if (spread)
|
|
937
|
+
spreads.push(spread[1]);
|
|
262
938
|
continue;
|
|
263
939
|
}
|
|
264
940
|
i = trivia(i + attr[0].length);
|
|
265
|
-
if (source[i] !== '=')
|
|
941
|
+
if (source[i] !== '=') {
|
|
942
|
+
attrs.set(attr[0], '{true}');
|
|
266
943
|
continue;
|
|
944
|
+
}
|
|
267
945
|
i = trivia(i + 1);
|
|
268
946
|
const start = i;
|
|
269
947
|
i = unit(i);
|
|
270
948
|
attrs.set(attr[0], source.slice(start, i));
|
|
271
949
|
}
|
|
950
|
+
let scope;
|
|
951
|
+
let addressless;
|
|
952
|
+
const router = ROUTER_ELEMENT.test(tag[1]) ? { start: at, end: source.length } : undefined;
|
|
953
|
+
if (router)
|
|
954
|
+
routers.push(router);
|
|
272
955
|
if (tag[1] === 'Route' && i < source.length) {
|
|
273
|
-
const
|
|
956
|
+
const pathText = attrs.get('path');
|
|
274
957
|
const expression = (name) => attrs.get(name)?.replace(/^\{([\s\S]*)\}$/, '$1');
|
|
275
|
-
const
|
|
958
|
+
const path = literal(pathText ?? '') ?? literal(expression('path') ?? '');
|
|
959
|
+
routeTags.push({ at, spreads, path: expression('path')?.trim() });
|
|
960
|
+
const element = elementPage(expression('element'));
|
|
961
|
+
const component = componentName(expression('component'), false) ?? element;
|
|
962
|
+
const loaded = lazyRouteReference(expression('lazy'), elementTag);
|
|
963
|
+
const lazy = loaded === OUTLET ? undefined : loaded;
|
|
964
|
+
const route = { part: { lit: path ?? '' }, at, start: at, end: source.length, component, lazy, jsx: true };
|
|
276
965
|
if (path)
|
|
277
|
-
|
|
966
|
+
scope = route;
|
|
967
|
+
else if (pathText === undefined || path === '') {
|
|
968
|
+
if (/^\{\s*true\s*\}$/.test(attrs.get('index') ?? '')) {
|
|
969
|
+
if (component || lazy)
|
|
970
|
+
scope = { ...route, index: true };
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
addressless = { scope: route, tags: routeTags.length, page: path === '' && Boolean(element || lazy) };
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
scope = { ...route, opaque: true };
|
|
978
|
+
}
|
|
979
|
+
if (scope)
|
|
980
|
+
scopes.push(scope);
|
|
278
981
|
}
|
|
982
|
+
const close = (end) => {
|
|
983
|
+
if (scope)
|
|
984
|
+
scope.end = end;
|
|
985
|
+
if (router)
|
|
986
|
+
router.end = end;
|
|
987
|
+
if (addressless) {
|
|
988
|
+
const { scope: route, tags, page } = addressless;
|
|
989
|
+
route.end = end;
|
|
990
|
+
if (routeTags.length > tags) {
|
|
991
|
+
if (route.component || route.lazy)
|
|
992
|
+
scopes.push({ ...route, pathless: true });
|
|
993
|
+
}
|
|
994
|
+
else if (page)
|
|
995
|
+
scopes.push({ ...route, index: true });
|
|
996
|
+
}
|
|
997
|
+
return end;
|
|
998
|
+
};
|
|
279
999
|
if (source.startsWith('/>', i))
|
|
280
|
-
return i + 2;
|
|
1000
|
+
return close(i + 2);
|
|
281
1001
|
i++;
|
|
282
1002
|
while (i < source.length) {
|
|
283
1003
|
if (source.startsWith('</', i)) {
|
|
284
1004
|
const end = source.indexOf('>', i + 2);
|
|
285
|
-
return end < 0 ? source.length : end + 1;
|
|
1005
|
+
return close(end < 0 ? source.length : end + 1);
|
|
286
1006
|
}
|
|
287
1007
|
if (source[i] === '<' && /^<(?:[A-Za-z]|>)/.test(source.slice(i)))
|
|
288
1008
|
i = jsx(i);
|
|
@@ -291,22 +1011,906 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
291
1011
|
else
|
|
292
1012
|
i++;
|
|
293
1013
|
}
|
|
294
|
-
return i;
|
|
1014
|
+
return close(i);
|
|
1015
|
+
}
|
|
1016
|
+
if (options.table)
|
|
1017
|
+
unit(trivia(options.table.at), true);
|
|
1018
|
+
else {
|
|
1019
|
+
let at = 0;
|
|
1020
|
+
while ((at = trivia(at)) < source.length)
|
|
1021
|
+
at = unit(at);
|
|
295
1022
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
1023
|
+
const prefix = options.table?.prefix ?? [];
|
|
1024
|
+
const inherited = options.table?.layouts ?? [];
|
|
1025
|
+
const renders = (s) => Boolean(s.component || s.lazy);
|
|
1026
|
+
const holds = (outer, start, end) => outer.start < start && outer.end >= end;
|
|
1027
|
+
const around = (start, end) => scopes.filter((outer) => holds(outer, start, end)).sort((a, b) => a.start - b.start);
|
|
1028
|
+
const shown = (p) => p.lit ?? `{${p.expr}}`;
|
|
1029
|
+
const layoutOf = (s) => (s.component ?? s.lazy);
|
|
1030
|
+
const partsOf = new Map();
|
|
1031
|
+
const pathOf = new Map();
|
|
1032
|
+
for (const scope of scopes) {
|
|
1033
|
+
const parts = [...prefix, ...around(scope.start, scope.end).map((c) => c.part), scope.part];
|
|
1034
|
+
partsOf.set(scope, parts);
|
|
1035
|
+
pathOf.set(scope, composeRoutePath(parts.map(shown)));
|
|
1036
|
+
}
|
|
1037
|
+
const inRouter = (s) => routers.some((r) => r.start < s.start && r.end >= s.end);
|
|
1038
|
+
const addressed = (s) => {
|
|
1039
|
+
if (!s.index)
|
|
1040
|
+
return true;
|
|
1041
|
+
const outer = around(s.start, s.end);
|
|
1042
|
+
return !outer.some((c) => c.opaque) && (outer.some((c) => Boolean(c.part.lit || c.part.expr)) || inRouter(s));
|
|
1043
|
+
};
|
|
1044
|
+
const pages = new Set(scopes.filter((s) => !s.pathless && !s.opaque && (s.jsx || s.outlet || renders(s)) && addressed(s)));
|
|
1045
|
+
const layout = (c) => renders(c) && !c.opaque;
|
|
1046
|
+
const routes = [];
|
|
1047
|
+
for (const scope of pages) {
|
|
1048
|
+
const path = pathOf.get(scope);
|
|
1049
|
+
if (scopes.some((inner) => pages.has(inner) && !inner.jsx === !scope.jsx && renders(inner) &&
|
|
1050
|
+
holds(scope, inner.start, inner.end) && pathOf.get(inner) === path))
|
|
1051
|
+
continue;
|
|
1052
|
+
const layouts = [...inherited, ...around(scope.start, scope.end)
|
|
1053
|
+
.filter((c) => layout(c) && (scope.jsx || !c.jsx))
|
|
1054
|
+
.map(layoutOf)];
|
|
1055
|
+
routes.push({ path, parts: partsOf.get(scope), component: scope.component, lazy: scope.lazy, layouts, at: scope.at });
|
|
1056
|
+
}
|
|
1057
|
+
const mount = (at) => {
|
|
1058
|
+
const outer = around(at, at);
|
|
1059
|
+
return { parts: outer.map((c) => c.part), layouts: outer.filter(layout).map(layoutOf) };
|
|
1060
|
+
};
|
|
1061
|
+
return {
|
|
1062
|
+
routes: routes.sort((a, b) => a.at - b.at),
|
|
1063
|
+
names: names.map((n) => {
|
|
1064
|
+
const { parts, layouts } = mount(n.at);
|
|
1065
|
+
return { ...n, prefix: [...prefix, ...parts], layouts: [...inherited, ...layouts] };
|
|
1066
|
+
}),
|
|
1067
|
+
uses: sites.map((s) => {
|
|
1068
|
+
const { parts, layouts } = mount(s.at);
|
|
1069
|
+
return { name: s.name, literal: s.literal, prefix: parts, layouts };
|
|
1070
|
+
}),
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
function mapsRouteFields(callback, tags) {
|
|
1074
|
+
const head = /^(?:async\s+)?(?:function\b[^(]*)?\(\s*/.exec(callback);
|
|
1075
|
+
let param;
|
|
1076
|
+
const rest = new Set();
|
|
1077
|
+
const paths = new Set();
|
|
1078
|
+
const bind = (pattern) => {
|
|
1079
|
+
for (const entry of topLevelEntries(pattern.slice(1, -1))) {
|
|
1080
|
+
const spread = /^\.\.\.\s*([A-Za-z_$][\w$]*)$/.exec(entry);
|
|
1081
|
+
if (spread)
|
|
1082
|
+
rest.add(spread[1]);
|
|
1083
|
+
const path = /^path\s*(?::\s*([A-Za-z_$][\w$]*))?\s*(?:=[\s\S]*)?$/.exec(entry);
|
|
1084
|
+
if (path)
|
|
1085
|
+
paths.add(path[1] ?? 'path');
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
if (head) {
|
|
1089
|
+
const at = head[0].length;
|
|
1090
|
+
if (callback[at] === '{') {
|
|
1091
|
+
const close = (0, object_literal_1.matchBracket)(callback, at);
|
|
1092
|
+
if (close < 0)
|
|
1093
|
+
return false;
|
|
1094
|
+
bind(callback.slice(at, close + 1));
|
|
1095
|
+
}
|
|
1096
|
+
else
|
|
1097
|
+
param = /^[A-Za-z_$][\w$]*/.exec(callback.slice(at))?.[0];
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
param = /^(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/.exec(callback)?.[1];
|
|
1101
|
+
}
|
|
1102
|
+
if (param) {
|
|
1103
|
+
const destructured = new RegExp(`\\b(?:const|let|var)\\s*(\\{[^{}]*\\})\\s*=\\s*${param.replace(/\$/g, '\\$')}\\s*[;\\n]`, 'g');
|
|
1104
|
+
for (const m of callback.matchAll(destructured))
|
|
1105
|
+
bind(m[1]);
|
|
1106
|
+
}
|
|
1107
|
+
const ownPath = param ? new RegExp(`^${param.replace(/\$/g, '\\$')}\\s*\\??\\.\\s*path$`) : null;
|
|
1108
|
+
return tags.some((t) => t.spreads.some((s) => s === param || rest.has(s)) ||
|
|
1109
|
+
(t.path !== undefined && (ownPath?.test(t.path) || paths.has(t.path))));
|
|
1110
|
+
}
|
|
1111
|
+
function elementTags(text) {
|
|
1112
|
+
const own = [];
|
|
1113
|
+
const props = [];
|
|
1114
|
+
for (let i = 0; i < text.length; i++) {
|
|
1115
|
+
if (text[i] !== '<')
|
|
1116
|
+
continue;
|
|
1117
|
+
const open = /^<\s*([A-Za-z][\w.:-]*)(?=[\s/>])/.exec(text.slice(i));
|
|
1118
|
+
if (!open)
|
|
1119
|
+
continue;
|
|
1120
|
+
if (/^[A-Z]\w*$/.test(open[1]))
|
|
1121
|
+
own.push(open[1]);
|
|
1122
|
+
let j = i + open[0].length;
|
|
1123
|
+
let attr = '';
|
|
1124
|
+
while (j < text.length && text[j] !== '>') {
|
|
1125
|
+
const ch = text[j];
|
|
1126
|
+
const name = /^[A-Za-z_$][\w$:-]*/.exec(text.slice(j, j + 64));
|
|
1127
|
+
if (name) {
|
|
1128
|
+
attr = name[0];
|
|
1129
|
+
j += name[0].length;
|
|
1130
|
+
continue;
|
|
1131
|
+
}
|
|
1132
|
+
const end = ch === '{' ? (0, object_literal_1.matchBracket)(text, j) : ch === '"' || ch === "'" ? (0, object_literal_1.skipString)(text, j) : j;
|
|
1133
|
+
if (end < 0)
|
|
1134
|
+
break;
|
|
1135
|
+
if (ch === '{' && /^(?:component|element|page)$/i.test(attr)) {
|
|
1136
|
+
for (const m of text.slice(j, end).matchAll(/<\s*([A-Z]\w*)(?=[\s/>])/g))
|
|
1137
|
+
props.push(m[1]);
|
|
1138
|
+
}
|
|
1139
|
+
if (ch === '{' || ch === '"' || ch === "'")
|
|
1140
|
+
attr = '';
|
|
1141
|
+
j = end + 1;
|
|
1142
|
+
}
|
|
1143
|
+
i = j;
|
|
1144
|
+
}
|
|
1145
|
+
return { own, props };
|
|
1146
|
+
}
|
|
1147
|
+
function topLevelEntries(text) {
|
|
1148
|
+
return topLevelItems(text).filter(Boolean);
|
|
1149
|
+
}
|
|
1150
|
+
function topLevelItems(text) {
|
|
1151
|
+
const out = [];
|
|
1152
|
+
let depth = 0;
|
|
1153
|
+
let from = 0;
|
|
1154
|
+
for (let i = 0; i < text.length; i++) {
|
|
1155
|
+
const ch = text[i];
|
|
1156
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
1157
|
+
const end = (0, object_literal_1.skipString)(text, i);
|
|
1158
|
+
if (end < 0)
|
|
1159
|
+
break;
|
|
1160
|
+
i = end;
|
|
1161
|
+
}
|
|
1162
|
+
else if (ch === '{' || ch === '[' || ch === '(')
|
|
1163
|
+
depth++;
|
|
1164
|
+
else if (ch === '}' || ch === ']' || ch === ')')
|
|
1165
|
+
depth--;
|
|
1166
|
+
else if (ch === ',' && depth === 0) {
|
|
1167
|
+
out.push(text.slice(from, i).trim());
|
|
1168
|
+
from = i + 1;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
const last = text.slice(from).trim();
|
|
1172
|
+
if (last)
|
|
1173
|
+
out.push(last);
|
|
1174
|
+
return out;
|
|
1175
|
+
}
|
|
1176
|
+
const FIRST_IMPORT = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/;
|
|
1177
|
+
function lazyRouteReference(loader, elementTag) {
|
|
1178
|
+
if (!loader)
|
|
1179
|
+
return undefined;
|
|
1180
|
+
const code = (0, strip_comments_1.stripCommentsForRegex)(loader, 'typescript').trim();
|
|
1181
|
+
const rendered = code.startsWith('{') ? lazyPropertiesRender(code) : routeRender(loaderValue(code, new Map()), elementTag);
|
|
1182
|
+
if (rendered === null)
|
|
1183
|
+
return undefined;
|
|
1184
|
+
if (rendered !== undefined)
|
|
1185
|
+
return rendered;
|
|
1186
|
+
const spec = FIRST_IMPORT.exec(code)?.[1];
|
|
1187
|
+
return spec ? LAZY_ROUTE_PREFIX + spec : undefined;
|
|
1188
|
+
}
|
|
1189
|
+
function routeRender(value, elementTag) {
|
|
1190
|
+
if (value?.kind === 'module')
|
|
1191
|
+
return LAZY_ROUTE_PREFIX + value.spec;
|
|
1192
|
+
if (value?.kind !== 'object')
|
|
1193
|
+
return undefined;
|
|
1194
|
+
const { props, spreads } = objectEntries(value.text);
|
|
1195
|
+
const component = props.get('Component');
|
|
1196
|
+
const element = props.get('element');
|
|
1197
|
+
const shown = component ?? element;
|
|
1198
|
+
if (shown !== undefined) {
|
|
1199
|
+
const held = component !== undefined ? valueOf(component, value.scope) : null;
|
|
1200
|
+
const named = pageReference(held);
|
|
1201
|
+
if (named)
|
|
1202
|
+
return named;
|
|
1203
|
+
const loaded = loadedExports(shown, value.scope);
|
|
1204
|
+
if (loaded.length === 1)
|
|
1205
|
+
return pageReference(loaded[0]);
|
|
1206
|
+
const tag = component === undefined && loaded.length === 0 ? elementTag(element) : undefined;
|
|
1207
|
+
if ((held?.kind === 'name' && held.name === OUTLET) || tag === OUTLET)
|
|
1208
|
+
return OUTLET;
|
|
1209
|
+
return tag ? pageReference(nameValue(tag, value.scope)) : undefined;
|
|
1210
|
+
}
|
|
1211
|
+
if (spreads.length === 0)
|
|
1212
|
+
return null;
|
|
1213
|
+
const spread = spreads.length === 1 ? valueOf(spreads[0], value.scope) : null;
|
|
1214
|
+
return spread?.kind === 'module' ? LAZY_ROUTE_PREFIX + spread.spec : undefined;
|
|
1215
|
+
}
|
|
1216
|
+
function lazyPropertiesRender(code) {
|
|
1217
|
+
if ((0, object_literal_1.matchBracket)(code, 0) !== code.length - 1)
|
|
1218
|
+
return undefined;
|
|
1219
|
+
const component = objectEntries(code.slice(1, -1)).props.get('Component');
|
|
1220
|
+
if (component === undefined)
|
|
1221
|
+
return null;
|
|
1222
|
+
const page = pageReference(loaderValue(component, new Map()));
|
|
1223
|
+
if (page)
|
|
1224
|
+
return page;
|
|
1225
|
+
const spec = FIRST_IMPORT.exec(component)?.[1];
|
|
1226
|
+
return spec ? LAZY_ROUTE_PREFIX + spec : undefined;
|
|
1227
|
+
}
|
|
1228
|
+
function loadedExports(text, scope) {
|
|
1229
|
+
const found = new Map();
|
|
1230
|
+
for (const m of text.matchAll(/(?<![\w$.])([A-Za-z_$][\w$]*)(?:\s*\??\.\s*([A-Za-z_$][\w$]*))?/g)) {
|
|
1231
|
+
const bound = scope.get(m[1]);
|
|
1232
|
+
const value = bound?.kind === 'module' && m[2] ? memberOf(bound, m[2]) : bound;
|
|
1233
|
+
if (value?.kind === 'export')
|
|
1234
|
+
found.set(`${value.spec}#${value.name}`, value);
|
|
1235
|
+
}
|
|
1236
|
+
return [...found.values()];
|
|
1237
|
+
}
|
|
1238
|
+
function pageReference(value) {
|
|
1239
|
+
if (value?.kind === 'export')
|
|
1240
|
+
return `import:${value.spec}#${value.name}`;
|
|
1241
|
+
if (value?.kind === 'name' && /^[A-Z]/.test(value.name) && value.name !== 'Outlet')
|
|
1242
|
+
return value.name;
|
|
1243
|
+
return undefined;
|
|
1244
|
+
}
|
|
1245
|
+
function loaderValue(text, outer, param = null) {
|
|
1246
|
+
const fn = functionParts(text);
|
|
1247
|
+
if (!fn)
|
|
1248
|
+
return null;
|
|
1249
|
+
const scope = new Map(outer);
|
|
1250
|
+
topLevelItems(fn.params).forEach((p, i) => bindPattern(scope, parameterPattern(p), i === 0 ? param : null));
|
|
1251
|
+
return fn.block ? blockValue(fn.body, scope) : valueOf(fn.body, scope);
|
|
1252
|
+
}
|
|
1253
|
+
function functionParts(text) {
|
|
1254
|
+
let s = text.trim().replace(/^async\b\s*/, '');
|
|
1255
|
+
const keyword = /^function\b\s*\*?\s*(?:[A-Za-z_$][\w$]*\s*)?/.exec(s);
|
|
1256
|
+
if (keyword)
|
|
1257
|
+
s = s.slice(keyword[0].length);
|
|
1258
|
+
let params;
|
|
1259
|
+
let rest;
|
|
1260
|
+
if (s.startsWith('(')) {
|
|
1261
|
+
const close = (0, object_literal_1.matchBracket)(s, 0);
|
|
1262
|
+
if (close < 0)
|
|
1263
|
+
return null;
|
|
1264
|
+
params = s.slice(1, close);
|
|
1265
|
+
rest = s.slice(close + 1).trimStart();
|
|
1266
|
+
}
|
|
1267
|
+
else {
|
|
1268
|
+
const id = keyword ? null : /^[A-Za-z_$][\w$]*/.exec(s);
|
|
1269
|
+
if (!id)
|
|
1270
|
+
return null;
|
|
1271
|
+
params = id[0];
|
|
1272
|
+
rest = s.slice(id[0].length).trimStart();
|
|
1273
|
+
}
|
|
1274
|
+
if (!keyword && rest.startsWith(':')) {
|
|
1275
|
+
const arrow = arrowAt(rest);
|
|
1276
|
+
if (arrow < 0)
|
|
1277
|
+
return null;
|
|
1278
|
+
rest = rest.slice(arrow);
|
|
1279
|
+
}
|
|
1280
|
+
if (keyword) {
|
|
1281
|
+
return rest.startsWith('{') && (0, object_literal_1.matchBracket)(rest, 0) === rest.length - 1 ? { params, body: rest.slice(1, -1), block: true } : null;
|
|
1282
|
+
}
|
|
1283
|
+
if (!rest.startsWith('=>'))
|
|
1284
|
+
return null;
|
|
1285
|
+
const body = rest.slice(2).trim();
|
|
1286
|
+
if (!body.startsWith('{'))
|
|
1287
|
+
return { params, body, block: false };
|
|
1288
|
+
return (0, object_literal_1.matchBracket)(body, 0) === body.length - 1 ? { params, body: body.slice(1, -1), block: true } : null;
|
|
1289
|
+
}
|
|
1290
|
+
function arrowAt(text) {
|
|
1291
|
+
for (let i = 0; i < text.length; i++) {
|
|
1292
|
+
const ch = text[i];
|
|
1293
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
1294
|
+
i = (0, object_literal_1.skipString)(text, i);
|
|
1295
|
+
if (i < 0)
|
|
1296
|
+
return -1;
|
|
1297
|
+
}
|
|
1298
|
+
else if (ch === '{' || ch === '(' || ch === '[') {
|
|
1299
|
+
i = (0, object_literal_1.matchBracket)(text, i);
|
|
1300
|
+
if (i < 0)
|
|
1301
|
+
return -1;
|
|
1302
|
+
}
|
|
1303
|
+
else if (ch === '=' && text[i + 1] === '>')
|
|
1304
|
+
return i;
|
|
1305
|
+
}
|
|
1306
|
+
return -1;
|
|
1307
|
+
}
|
|
1308
|
+
function parameterPattern(param) {
|
|
1309
|
+
param = param.replace(/^\.\.\.\s*/, '');
|
|
1310
|
+
if (param.startsWith('{') || param.startsWith('[')) {
|
|
1311
|
+
const close = (0, object_literal_1.matchBracket)(param, 0);
|
|
1312
|
+
return close < 0 ? '' : param.slice(0, close + 1);
|
|
1313
|
+
}
|
|
1314
|
+
return /^[A-Za-z_$][\w$]*/.exec(param)?.[0] ?? '';
|
|
1315
|
+
}
|
|
1316
|
+
function blockValue(body, scope) {
|
|
1317
|
+
const word = /[A-Za-z_$][\w$]*/y;
|
|
1318
|
+
for (let i = 0; i < body.length;) {
|
|
1319
|
+
const ch = body[i];
|
|
1320
|
+
if (ch === '"' || ch === "'" || ch === '`' || ch === '{' || ch === '(' || ch === '[') {
|
|
1321
|
+
const end = ch === '{' || ch === '(' || ch === '[' ? (0, object_literal_1.matchBracket)(body, i) : (0, object_literal_1.skipString)(body, i);
|
|
1322
|
+
if (end < 0)
|
|
1323
|
+
return null;
|
|
1324
|
+
i = end + 1;
|
|
1325
|
+
continue;
|
|
1326
|
+
}
|
|
1327
|
+
word.lastIndex = i;
|
|
1328
|
+
const w = word.exec(body)?.[0];
|
|
1329
|
+
if (!w) {
|
|
1330
|
+
i++;
|
|
1331
|
+
continue;
|
|
1332
|
+
}
|
|
1333
|
+
const after = i + w.length;
|
|
1334
|
+
const statement = i === 0 || !/[\w$.]/.test(body[i - 1]);
|
|
1335
|
+
i = after;
|
|
1336
|
+
if (!statement)
|
|
1337
|
+
continue;
|
|
1338
|
+
if (w === 'return')
|
|
1339
|
+
return valueOf(body.slice(after, statementEnd(body, after)), scope);
|
|
1340
|
+
if (w === 'const' || w === 'let' || w === 'var')
|
|
1341
|
+
i = declare(body, after, scope);
|
|
1342
|
+
else if (w === 'function' || w === 'class') {
|
|
1343
|
+
const name = /^\s*\*?\s*([A-Za-z_$][\w$]*)/.exec(body.slice(after, after + 128));
|
|
1344
|
+
if (name)
|
|
1345
|
+
scope.set(name[1], null);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
return null;
|
|
1349
|
+
}
|
|
1350
|
+
function declare(body, at, scope) {
|
|
1351
|
+
for (let i = at;;) {
|
|
1352
|
+
while (/\s/.test(body[i] ?? ''))
|
|
1353
|
+
i++;
|
|
1354
|
+
let end;
|
|
1355
|
+
if (body[i] === '{' || body[i] === '[')
|
|
1356
|
+
end = (0, object_literal_1.matchBracket)(body, i) + 1;
|
|
1357
|
+
else
|
|
1358
|
+
end = i + (/^[A-Za-z_$][\w$]*/.exec(body.slice(i, i + 128))?.[0].length ?? 0);
|
|
1359
|
+
if (end <= i)
|
|
1360
|
+
return Math.max(end, i + 1);
|
|
1361
|
+
const pattern = body.slice(i, end);
|
|
1362
|
+
const init = initializerAt(body, end);
|
|
1363
|
+
let stop = end;
|
|
1364
|
+
if (init < 0)
|
|
1365
|
+
bindPattern(scope, pattern, null);
|
|
1366
|
+
else {
|
|
1367
|
+
stop = statementEnd(body, init, true);
|
|
1368
|
+
bindPattern(scope, pattern, valueOf(body.slice(init, stop), scope));
|
|
1369
|
+
}
|
|
1370
|
+
while (/\s/.test(body[stop] ?? ''))
|
|
1371
|
+
stop++;
|
|
1372
|
+
if (body[stop] !== ',')
|
|
1373
|
+
return stop;
|
|
1374
|
+
i = stop + 1;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
function initializerAt(body, at) {
|
|
1378
|
+
for (let i = at; i < body.length; i++) {
|
|
1379
|
+
const ch = body[i];
|
|
1380
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
1381
|
+
i = (0, object_literal_1.skipString)(body, i);
|
|
1382
|
+
if (i < 0)
|
|
1383
|
+
return -1;
|
|
1384
|
+
}
|
|
1385
|
+
else if (ch === '{' || ch === '(' || ch === '[') {
|
|
1386
|
+
i = (0, object_literal_1.matchBracket)(body, i);
|
|
1387
|
+
if (i < 0)
|
|
1388
|
+
return -1;
|
|
1389
|
+
}
|
|
1390
|
+
else if (ch === '=') {
|
|
1391
|
+
if (body[i + 1] === '>' || body[i + 1] === '=')
|
|
1392
|
+
i++;
|
|
1393
|
+
else
|
|
1394
|
+
return i + 1;
|
|
1395
|
+
}
|
|
1396
|
+
else if (ch === ';' || ch === ',' || ch === '}' || ch === ')')
|
|
1397
|
+
return -1;
|
|
1398
|
+
}
|
|
1399
|
+
return -1;
|
|
1400
|
+
}
|
|
1401
|
+
function statementEnd(text, from, comma = false) {
|
|
1402
|
+
let last = '';
|
|
1403
|
+
for (let i = from; i < text.length; i++) {
|
|
1404
|
+
const ch = text[i];
|
|
1405
|
+
if (ch === '"' || ch === "'" || ch === '`' || ch === '{' || ch === '(' || ch === '[') {
|
|
1406
|
+
const end = ch === '{' || ch === '(' || ch === '[' ? (0, object_literal_1.matchBracket)(text, i) : (0, object_literal_1.skipString)(text, i);
|
|
1407
|
+
if (end < 0)
|
|
1408
|
+
return text.length;
|
|
1409
|
+
i = end;
|
|
1410
|
+
last = text[end];
|
|
1411
|
+
continue;
|
|
1412
|
+
}
|
|
1413
|
+
if (ch === ';' || ch === '}' || ch === ')' || ch === ']' || (comma && ch === ','))
|
|
1414
|
+
return i;
|
|
1415
|
+
if (ch === '\n') {
|
|
1416
|
+
let j = i + 1;
|
|
1417
|
+
while (j < text.length && /\s/.test(text[j]))
|
|
1418
|
+
j++;
|
|
1419
|
+
if (last && !/[=(,[{?:&|+\-*/%<>!.]/.test(last) && !/[.?:&|+\-*/%=<>,([]/.test(text[j] ?? ''))
|
|
1420
|
+
return i;
|
|
1421
|
+
continue;
|
|
1422
|
+
}
|
|
1423
|
+
if (!/\s/.test(ch))
|
|
1424
|
+
last = ch;
|
|
1425
|
+
}
|
|
1426
|
+
return text.length;
|
|
1427
|
+
}
|
|
1428
|
+
function valueOf(text, scope) {
|
|
1429
|
+
let s = text.trim();
|
|
1430
|
+
for (let before = ''; before !== s;) {
|
|
1431
|
+
before = s;
|
|
1432
|
+
s = s.replace(/^await\b\s*/, '');
|
|
1433
|
+
if (s.startsWith('(') && (0, object_literal_1.matchBracket)(s, 0) === s.length - 1)
|
|
1434
|
+
s = s.slice(1, -1).trim();
|
|
1435
|
+
}
|
|
1436
|
+
if (s.startsWith('{') || s.startsWith('[')) {
|
|
1437
|
+
if ((0, object_literal_1.matchBracket)(s, 0) !== s.length - 1)
|
|
1438
|
+
return null;
|
|
1439
|
+
const inside = s.slice(1, -1);
|
|
1440
|
+
return s[0] === '{'
|
|
1441
|
+
? { kind: 'object', text: inside, scope }
|
|
1442
|
+
: { kind: 'array', items: topLevelItems(inside).map((item) => (item ? valueOf(item, scope) : null)) };
|
|
1443
|
+
}
|
|
1444
|
+
const head = /^(?:(import)\s*\(|(Promise)\s*\.\s*all\s*\(|([A-Za-z_$][\w$]*)|\()/.exec(s);
|
|
1445
|
+
if (!head)
|
|
1446
|
+
return null;
|
|
1447
|
+
let value;
|
|
1448
|
+
let i;
|
|
1449
|
+
if (head[3]) {
|
|
1450
|
+
value = nameValue(head[3], scope);
|
|
1451
|
+
i = head[0].length;
|
|
1452
|
+
}
|
|
1453
|
+
else {
|
|
1454
|
+
const open = head[0].length - 1;
|
|
1455
|
+
const close = (0, object_literal_1.matchBracket)(s, open);
|
|
1456
|
+
if (close < 0)
|
|
1457
|
+
return null;
|
|
1458
|
+
const inside = s.slice(open + 1, close);
|
|
1459
|
+
if (head[1]) {
|
|
1460
|
+
const spec = /^\s*(["'])([^"'`]+)\1\s*$/.exec(inside)?.[2];
|
|
1461
|
+
value = spec ? { kind: 'module', spec } : null;
|
|
1462
|
+
}
|
|
1463
|
+
else if (head[2]) {
|
|
1464
|
+
const all = valueOf(inside, scope);
|
|
1465
|
+
value = all?.kind === 'array' ? all : null;
|
|
1466
|
+
}
|
|
1467
|
+
else
|
|
1468
|
+
value = valueOf(inside, scope);
|
|
1469
|
+
i = close + 1;
|
|
1470
|
+
}
|
|
1471
|
+
while (value && i < s.length) {
|
|
1472
|
+
const rest = s.slice(i);
|
|
1473
|
+
const then = /^\s*\??\.\s*then\s*\(/.exec(rest);
|
|
1474
|
+
if (then) {
|
|
1475
|
+
const open = i + then[0].length - 1;
|
|
1476
|
+
const close = (0, object_literal_1.matchBracket)(s, open);
|
|
1477
|
+
if (close < 0 || value.kind !== 'module')
|
|
1478
|
+
return null;
|
|
1479
|
+
const callback = topLevelItems(s.slice(open + 1, close))[0];
|
|
1480
|
+
value = callback ? loaderValue(callback, scope, value) : null;
|
|
1481
|
+
i = close + 1;
|
|
1482
|
+
continue;
|
|
1483
|
+
}
|
|
1484
|
+
const dot = /^\s*\??\.\s*([A-Za-z_$][\w$]*)/.exec(rest);
|
|
1485
|
+
const bracket = dot ? null : /^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(rest);
|
|
1486
|
+
const name = dot?.[1] ?? bracket?.[2];
|
|
1487
|
+
if (name === undefined)
|
|
1488
|
+
return null;
|
|
1489
|
+
value = memberOf(value, name);
|
|
1490
|
+
i += (dot ?? bracket)[0].length;
|
|
1491
|
+
}
|
|
1492
|
+
return value;
|
|
1493
|
+
}
|
|
1494
|
+
function nameValue(name, scope) {
|
|
1495
|
+
return scope.has(name) ? scope.get(name) ?? null : { kind: 'name', name };
|
|
1496
|
+
}
|
|
1497
|
+
function memberOf(value, key) {
|
|
1498
|
+
if (value?.kind === 'module')
|
|
1499
|
+
return { kind: 'export', spec: value.spec, name: key };
|
|
1500
|
+
if (value?.kind !== 'object')
|
|
1501
|
+
return null;
|
|
1502
|
+
const text = objectEntries(value.text).props.get(key);
|
|
1503
|
+
return text === undefined ? null : valueOf(text, value.scope);
|
|
1504
|
+
}
|
|
1505
|
+
function bindPattern(scope, pattern, value) {
|
|
1506
|
+
const p = pattern.trim();
|
|
1507
|
+
if (!p)
|
|
1508
|
+
return;
|
|
1509
|
+
if (/^[A-Za-z_$][\w$]*$/.test(p)) {
|
|
1510
|
+
scope.set(p, value);
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const close = p.startsWith('{') || p.startsWith('[') ? (0, object_literal_1.matchBracket)(p, 0) : -1;
|
|
1514
|
+
if (close !== p.length - 1) {
|
|
1515
|
+
for (const name of p.matchAll(/[A-Za-z_$][\w$]*/g))
|
|
1516
|
+
scope.set(name[0], null);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
const items = topLevelItems(p.slice(1, -1));
|
|
1520
|
+
items.forEach((item, index) => {
|
|
1521
|
+
if (!item)
|
|
1522
|
+
return;
|
|
1523
|
+
const rest = /^\.\.\.\s*([\s\S]*)$/.exec(item);
|
|
1524
|
+
if (rest)
|
|
1525
|
+
return bindPattern(scope, rest[1], null);
|
|
1526
|
+
if (p[0] === '[') {
|
|
1527
|
+
return bindPattern(scope, item.replace(/\s*=(?![=>])[\s\S]*$/, ''), value?.kind === 'array' ? value.items[index] ?? null : null);
|
|
1528
|
+
}
|
|
1529
|
+
const prop = /^(?:([A-Za-z_$][\w$]*)|(["'])([^"']*)\2)\s*(?::\s*([\s\S]+?))?\s*(?:=(?![=>])[\s\S]*)?$/.exec(item);
|
|
1530
|
+
if (!prop)
|
|
1531
|
+
return bindPattern(scope, item.replace(/^[^:]*:/, ''), null);
|
|
1532
|
+
const key = prop[1] ?? prop[3];
|
|
1533
|
+
bindPattern(scope, prop[4] ?? key, memberOf(value, key));
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
function objectEntries(text) {
|
|
1537
|
+
const props = new Map();
|
|
1538
|
+
const spreads = [];
|
|
1539
|
+
for (const entry of topLevelEntries(text)) {
|
|
1540
|
+
const spread = /^\.\.\.\s*([\s\S]+)$/.exec(entry);
|
|
1541
|
+
const pair = spread ? null : /^(?:([A-Za-z_$][\w$]*)|(["'])([A-Za-z_$][\w$]*)\2)\s*:\s*([\s\S]+)$/.exec(entry);
|
|
1542
|
+
const method = spread || pair ? null : /^(async\s+)?([A-Za-z_$][\w$]*)\s*\(/.exec(entry);
|
|
1543
|
+
if (spread)
|
|
1544
|
+
spreads.push(spread[1]);
|
|
1545
|
+
else if (pair)
|
|
1546
|
+
props.set(pair[1] ?? pair[3], pair[4]);
|
|
1547
|
+
else if (method)
|
|
1548
|
+
props.set(method[2], `${method[1] ?? ''}function ${entry.slice(method[0].length - 1)}`);
|
|
1549
|
+
else if (/^[A-Za-z_$][\w$]*$/.test(entry))
|
|
1550
|
+
props.set(entry, entry);
|
|
1551
|
+
}
|
|
1552
|
+
return { props, spreads };
|
|
1553
|
+
}
|
|
1554
|
+
const ROUTER_PACKAGES = ['react-router-dom', 'react-router', 'react-router-native'];
|
|
1555
|
+
const MAX_TABLES = 512;
|
|
1556
|
+
const CONSUMER_HINT = /\buseRoutes\b|\bcreate(?:Browser|Hash|Memory)Router\b|<Route\b/;
|
|
1557
|
+
function isTableRoute(node) {
|
|
1558
|
+
return node.kind === 'route' && node.id.startsWith(`route:${node.filePath}:${node.startLine}:table:`);
|
|
1559
|
+
}
|
|
1560
|
+
function routeReferences(route, fromNodeId, filePath, line) {
|
|
1561
|
+
const language = filePath.endsWith('.tsx') ? 'tsx' : 'jsx';
|
|
1562
|
+
const ref = (referenceName) => ({ fromNodeId, referenceName, referenceKind: 'references', line, column: 0, filePath, language });
|
|
1563
|
+
const refs = [];
|
|
1564
|
+
const target = route.component ?? route.lazy;
|
|
1565
|
+
if (target)
|
|
1566
|
+
refs.push(ref(target));
|
|
1567
|
+
for (const layout of route.layouts)
|
|
1568
|
+
refs.push(ref(LAYOUT_PREFIX + layout));
|
|
1569
|
+
return refs;
|
|
1570
|
+
}
|
|
1571
|
+
function tableRoutes(context) {
|
|
1572
|
+
const nodes = [];
|
|
1573
|
+
const references = [];
|
|
1574
|
+
const consumers = new Set();
|
|
1575
|
+
for (const pkg of ROUTER_PACKAGES) {
|
|
1576
|
+
for (const n of context.getNodesByName(pkg)) {
|
|
1577
|
+
if (n.kind === 'import' && !(0, query_utils_1.isTestPath)(n.filePath))
|
|
1578
|
+
consumers.add(n.filePath);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
if (consumers.size === 0)
|
|
1582
|
+
return { nodes, references };
|
|
1583
|
+
const queue = [];
|
|
1584
|
+
const queued = new Set();
|
|
1585
|
+
const enqueue = (table, prefix, from, layouts) => {
|
|
1586
|
+
if (!table || queued.size >= MAX_TABLES)
|
|
1587
|
+
return;
|
|
1588
|
+
const key = `${table.file}\0${table.at}\0${prefix.join('\0')}`;
|
|
1589
|
+
if (queued.has(key))
|
|
1590
|
+
return;
|
|
1591
|
+
queued.add(key);
|
|
1592
|
+
queue.push({ ...table, prefix, layouts: table.file === from ? layouts : [] });
|
|
1593
|
+
};
|
|
1594
|
+
for (const file of [...consumers].sort()) {
|
|
1595
|
+
const source = context.readFile(file);
|
|
1596
|
+
if (!source || !CONSUMER_HINT.test(source))
|
|
1597
|
+
continue;
|
|
1598
|
+
const scan = scanRoutes(source, allowsJsx(file), { objects: ROUTER_CALL.test(source), uses: true });
|
|
1599
|
+
for (const use of scan.uses) {
|
|
1600
|
+
const tables = use.literal !== undefined ? [{ file, at: use.literal }] : tableNamed(use.name, file, context);
|
|
1601
|
+
const prefix = pathValues(use.prefix, file, context);
|
|
1602
|
+
for (const table of tables)
|
|
1603
|
+
enqueue(table, prefix, file, use.layouts);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
const made = new Set();
|
|
1607
|
+
const now = Date.now();
|
|
1608
|
+
for (let next = queue.shift(); next; next = queue.shift()) {
|
|
1609
|
+
const { file, at, prefix, layouts } = next;
|
|
1610
|
+
const source = context.readFile(file);
|
|
1611
|
+
if (!source)
|
|
1612
|
+
continue;
|
|
1613
|
+
const scan = scanRoutes(source, allowsJsx(file), { table: { at, prefix: prefix.map((lit) => ({ lit })), layouts } });
|
|
1614
|
+
for (const named of scan.names) {
|
|
1615
|
+
const prefix = pathValues(named.prefix, file, context);
|
|
1616
|
+
for (const table of tableNamed(named, file, context))
|
|
1617
|
+
enqueue(table, prefix, file, named.layouts);
|
|
1618
|
+
}
|
|
1619
|
+
if (ROUTER_CALL.test(source))
|
|
1620
|
+
continue;
|
|
1621
|
+
const lineAt = (0, synth_utils_1.makeLineAt)(source, 1);
|
|
1622
|
+
for (const route of scan.routes) {
|
|
1623
|
+
const line = lineAt(route.at);
|
|
1624
|
+
const id = `route:${file}:${line}:table:${route.path}`;
|
|
1625
|
+
if (made.has(id))
|
|
1626
|
+
continue;
|
|
1627
|
+
made.add(id);
|
|
1628
|
+
const values = route.parts.map((p) => p.lit ?? (p.expr ? constantPathValue(p.expr, file, context) : null));
|
|
1629
|
+
nodes.push({
|
|
1630
|
+
id,
|
|
1631
|
+
kind: 'route',
|
|
1632
|
+
name: values.every((v) => v !== null) ? composeRoutePath(values) : route.path,
|
|
1633
|
+
qualifiedName: `${file}::route:${route.path}`,
|
|
1634
|
+
filePath: file,
|
|
1635
|
+
startLine: line,
|
|
1636
|
+
endLine: line,
|
|
1637
|
+
startColumn: 0,
|
|
1638
|
+
endColumn: 0,
|
|
1639
|
+
language: file.endsWith('.tsx') ? 'tsx' : 'jsx',
|
|
1640
|
+
updatedAt: now,
|
|
1641
|
+
});
|
|
1642
|
+
references.push(...routeReferences(route, id, file, line));
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
return { nodes, references };
|
|
1646
|
+
}
|
|
1647
|
+
function pathValues(parts, fromFile, context) {
|
|
1648
|
+
return parts.map((p) => p.lit ?? (p.expr ? constantPathValue(p.expr, fromFile, context) : null) ?? `{${p.expr}}`);
|
|
1649
|
+
}
|
|
1650
|
+
function allowsJsx(filePath) {
|
|
1651
|
+
return !/\.(?:ts|mts|cts)$/.test(filePath);
|
|
1652
|
+
}
|
|
1653
|
+
function scriptLanguage(filePath) {
|
|
1654
|
+
return /\.tsx$/.test(filePath) ? 'tsx' : /\.[cm]?ts$/.test(filePath) ? 'typescript' : /\.jsx$/.test(filePath) ? 'jsx' : 'javascript';
|
|
1655
|
+
}
|
|
1656
|
+
function tableNamed(named, file, context, depth = 0) {
|
|
1657
|
+
const source = context.readFile(file);
|
|
1658
|
+
if (!source)
|
|
1659
|
+
return [];
|
|
1660
|
+
const safe = (0, strip_comments_1.stripCommentsForRegex)(source, 'typescript');
|
|
1661
|
+
const local = declaredTable(safe, named.name, named.call, visibleAt(named.at, safe, file, context));
|
|
1662
|
+
if (local.length > 0)
|
|
1663
|
+
return tablesAt(local, file, context, depth);
|
|
1664
|
+
const language = scriptLanguage(file);
|
|
1665
|
+
const mapping = context.getImportMappings(file, language).find((m) => m.localName === named.name);
|
|
1666
|
+
if (!mapping || mapping.isNamespace || depth > 3)
|
|
1667
|
+
return [];
|
|
1668
|
+
const target = (0, import_resolver_1.resolveImportPath)(mapping.source, file, language, context);
|
|
1669
|
+
if (!target)
|
|
1670
|
+
return [];
|
|
1671
|
+
return exportedTable(target, mapping.isDefault ? 'default' : mapping.exportedName, named.call, context, depth + 1);
|
|
1672
|
+
}
|
|
1673
|
+
function tablesAt(sites, file, context, depth) {
|
|
1674
|
+
return sites.flatMap((site) => typeof site === 'number' ? [{ file, at: site }] : depth > 3 ? [] : tableNamed(site, file, context, depth + 1));
|
|
1675
|
+
}
|
|
1676
|
+
function exportedTable(file, exported, call, context, depth) {
|
|
1677
|
+
const source = context.readFile(file);
|
|
1678
|
+
if (!source)
|
|
1679
|
+
return [];
|
|
1680
|
+
const safe = (0, strip_comments_1.stripCommentsForRegex)(source, 'typescript');
|
|
1681
|
+
let local = exported;
|
|
1682
|
+
if (exported === 'default') {
|
|
1683
|
+
const m = /\bexport\s+default\s+/.exec(safe);
|
|
1684
|
+
if (m) {
|
|
1685
|
+
const after = m.index + m[0].length;
|
|
1686
|
+
const inline = call ? returnedTables(safe, after) : heldTable(safe, after);
|
|
1687
|
+
if (inline.length > 0)
|
|
1688
|
+
return tablesAt(inline, file, context, depth);
|
|
1689
|
+
local = /^([A-Za-z_$][\w$]*)\s*(?:;|\n|$)/.exec(safe.slice(after))?.[1] ?? '';
|
|
1690
|
+
}
|
|
1691
|
+
else
|
|
1692
|
+
local = /\bexport\s*\{[^}]*?\b([A-Za-z_$][\w$]*)\s+as\s+default\b/.exec(safe)?.[1] ?? '';
|
|
1693
|
+
}
|
|
1694
|
+
else {
|
|
1695
|
+
const alias = new RegExp(`\\bexport\\s*\\{[^}]*?\\b([A-Za-z_$][\\w$]*)\\s+as\\s+${(0, utils_1.escapeRegExp)(exported)}\\b`).exec(safe);
|
|
1696
|
+
if (alias)
|
|
1697
|
+
local = alias[1];
|
|
1698
|
+
}
|
|
1699
|
+
const declared = local ? declaredTable(safe, local, call, visibleAt(undefined, safe, file, context)) : [];
|
|
1700
|
+
if (declared.length > 0)
|
|
1701
|
+
return tablesAt(declared, file, context, depth);
|
|
1702
|
+
if (depth > 3)
|
|
1703
|
+
return [];
|
|
1704
|
+
const language = scriptLanguage(file);
|
|
1705
|
+
for (const re of context.getReExports?.(file, language) ?? []) {
|
|
1706
|
+
if (re.kind === 'named' && re.exportedName !== exported)
|
|
1707
|
+
continue;
|
|
1708
|
+
const target = (0, import_resolver_1.resolveImportPath)(re.source, file, language, context);
|
|
1709
|
+
if (!target)
|
|
1710
|
+
continue;
|
|
1711
|
+
const found = exportedTable(target, re.kind === 'named' ? re.originalName : exported, call, context, depth + 1);
|
|
1712
|
+
if (found.length > 0)
|
|
1713
|
+
return found;
|
|
1714
|
+
}
|
|
1715
|
+
return [];
|
|
1716
|
+
}
|
|
1717
|
+
function declaredTable(safe, name, call, visible) {
|
|
1718
|
+
const id = (0, utils_1.escapeRegExp)(name);
|
|
1719
|
+
const decls = [...safe.matchAll(new RegExp(`(?:^|[^\\w$.])((?:const|let|var)\\s+${id}\\s*(?::[^=;]*)?=\\s*)`, 'g'))];
|
|
1720
|
+
const chosen = decls.length > 0 ? visible(decls.map((d) => d.index + d[0].length - d[1].length)) : undefined;
|
|
1721
|
+
const decl = chosen === undefined ? undefined : decls[chosen];
|
|
1722
|
+
if (decl) {
|
|
1723
|
+
const after = decl.index + decl[0].length;
|
|
1724
|
+
return call ? returnedTables(safe, after) : heldTable(safe, after);
|
|
1725
|
+
}
|
|
1726
|
+
if (!call)
|
|
1727
|
+
return [];
|
|
1728
|
+
const fn = new RegExp(`(?:^|[^\\w$.])function\\s+${id}\\s*\\(`).exec(safe);
|
|
1729
|
+
return fn ? returnedTables(safe, fn.index + fn[0].indexOf('function')) : [];
|
|
1730
|
+
}
|
|
1731
|
+
function heldTable(safe, at) {
|
|
1732
|
+
while (safe[at] === '(')
|
|
1733
|
+
at = skipSpace(safe, at + 1);
|
|
1734
|
+
if (safe[at] === '[' || safe[at] === '{')
|
|
1735
|
+
return [at];
|
|
1736
|
+
const memo = /(?:React\s*\.\s*)?useMemo\s*(?:<[^()]*>)?\s*\(\s*/y;
|
|
1737
|
+
memo.lastIndex = at;
|
|
1738
|
+
if (memo.test(safe)) {
|
|
1739
|
+
const handed = /([A-Za-z_$][\w$]*)\s*,/y;
|
|
1740
|
+
handed.lastIndex = memo.lastIndex;
|
|
1741
|
+
const fn = handed.exec(safe);
|
|
1742
|
+
return fn ? [{ name: fn[1], call: true, at: memo.lastIndex }] : returnedTables(safe, memo.lastIndex);
|
|
1743
|
+
}
|
|
1744
|
+
const call = /(await\s+)?([A-Za-z_$][\w$]*)\s*\(/y;
|
|
1745
|
+
call.lastIndex = at;
|
|
1746
|
+
const m = call.exec(safe);
|
|
1747
|
+
return m ? [{ name: m[2], call: true, at: at + (m[1]?.length ?? 0) }] : [];
|
|
1748
|
+
}
|
|
1749
|
+
function visibleAt(use, safe, file, context) {
|
|
1750
|
+
return (keywords) => {
|
|
1751
|
+
const lineStarts = [0];
|
|
1752
|
+
for (let i = safe.indexOf('\n'); i !== -1; i = safe.indexOf('\n', i + 1))
|
|
1753
|
+
lineStarts.push(i + 1);
|
|
1754
|
+
const offset = (line, column) => (lineStarts[line - 1] ?? safe.length) + column;
|
|
1755
|
+
const fns = context.getNodesInFile(file)
|
|
1756
|
+
.filter((n) => synth_utils_1.FN_KINDS.has(n.kind))
|
|
1757
|
+
.map((n) => ({ start: offset(n.startLine, n.startColumn), end: offset(n.endLine, n.endColumn) }));
|
|
1758
|
+
const around = (at) => fns.filter((f) => f.start < at && f.end > at);
|
|
1759
|
+
const scopes = new Set(use === undefined ? [] : around(use));
|
|
1760
|
+
let best;
|
|
1761
|
+
let depth = -1;
|
|
1762
|
+
keywords.forEach((at, i) => {
|
|
1763
|
+
const encl = around(at);
|
|
1764
|
+
if (!encl.every((f) => scopes.has(f)))
|
|
1765
|
+
return;
|
|
1766
|
+
if (encl.length > depth || (encl.length === depth && use !== undefined && at < use)) {
|
|
1767
|
+
best = i;
|
|
1768
|
+
depth = encl.length;
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
return best;
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
function returnedTables(safe, at) {
|
|
1775
|
+
const body = functionBody(safe, at);
|
|
1776
|
+
if (!body)
|
|
1777
|
+
return [];
|
|
1778
|
+
if (!body.block)
|
|
1779
|
+
return heldTable(safe, body.start);
|
|
1780
|
+
return ownReturns(safe, body.start, body.end).flatMap((value) => heldTable(safe, value));
|
|
1781
|
+
}
|
|
1782
|
+
function functionBody(safe, at) {
|
|
1783
|
+
let i = skipSpace(safe, at);
|
|
1784
|
+
const keyword = (word) => {
|
|
1785
|
+
const re = new RegExp(`${word}\\b`, 'y');
|
|
1786
|
+
re.lastIndex = i;
|
|
1787
|
+
if (!re.test(safe))
|
|
1788
|
+
return false;
|
|
1789
|
+
i = skipSpace(safe, re.lastIndex);
|
|
1790
|
+
return true;
|
|
1791
|
+
};
|
|
1792
|
+
keyword('async');
|
|
1793
|
+
const arrow = !keyword('function');
|
|
1794
|
+
const name = /\*?\s*[A-Za-z_$][\w$]*/y;
|
|
1795
|
+
if (!arrow) {
|
|
1796
|
+
name.lastIndex = i;
|
|
1797
|
+
if (name.test(safe))
|
|
1798
|
+
i = skipSpace(safe, name.lastIndex);
|
|
1799
|
+
}
|
|
1800
|
+
if (safe[i] === '(') {
|
|
1801
|
+
const close = (0, object_literal_1.matchBracket)(safe, i);
|
|
1802
|
+
if (close < 0)
|
|
1803
|
+
return null;
|
|
1804
|
+
i = skipSpace(safe, close + 1);
|
|
1805
|
+
}
|
|
1806
|
+
else {
|
|
1807
|
+
const param = /[A-Za-z_$][\w$]*/y;
|
|
1808
|
+
param.lastIndex = i;
|
|
1809
|
+
if (!arrow || !param.test(safe))
|
|
1810
|
+
return null;
|
|
1811
|
+
i = skipSpace(safe, param.lastIndex);
|
|
1812
|
+
}
|
|
1813
|
+
if (safe[i] === ':') {
|
|
1814
|
+
const stop = safe.indexOf(arrow ? '=>' : '{', i);
|
|
1815
|
+
if (stop < 0)
|
|
1816
|
+
return null;
|
|
1817
|
+
i = stop;
|
|
1818
|
+
}
|
|
1819
|
+
if (arrow) {
|
|
1820
|
+
if (!safe.startsWith('=>', i))
|
|
1821
|
+
return null;
|
|
1822
|
+
i = skipSpace(safe, i + 2);
|
|
1823
|
+
if (safe[i] !== '{')
|
|
1824
|
+
return { block: false, start: i, end: i };
|
|
1825
|
+
}
|
|
1826
|
+
if (safe[i] !== '{')
|
|
1827
|
+
return null;
|
|
1828
|
+
const end = blockEnd(safe, i);
|
|
1829
|
+
return end < 0 ? null : { block: true, start: i, end };
|
|
1830
|
+
}
|
|
1831
|
+
const BLOCK_HEADS = new Set(['if', 'for', 'while', 'switch', 'catch', 'with']);
|
|
1832
|
+
function ownReturns(safe, open, close) {
|
|
1833
|
+
const values = [];
|
|
1834
|
+
const pastBody = (paren) => {
|
|
1835
|
+
const params = paren < 0 ? -1 : (0, object_literal_1.matchBracket)(safe, paren);
|
|
1836
|
+
if (params < 0)
|
|
1837
|
+
return -1;
|
|
1838
|
+
let i = skipSpace(safe, params + 1);
|
|
1839
|
+
if (safe[i] === ':')
|
|
1840
|
+
i = safe.indexOf('{', i);
|
|
1841
|
+
return i >= 0 && safe[i] === '{' ? blockEnd(safe, i) : -1;
|
|
1842
|
+
};
|
|
1843
|
+
for (let i = open + 1; i < close; i++) {
|
|
1844
|
+
const ch = safe[i];
|
|
1845
|
+
if (opensString(safe, i)) {
|
|
1846
|
+
const end = (0, object_literal_1.skipString)(safe, i);
|
|
1847
|
+
if (end < 0)
|
|
1848
|
+
break;
|
|
1849
|
+
i = end;
|
|
1850
|
+
}
|
|
1851
|
+
else if (ch === '=' && safe[i + 1] === '>') {
|
|
1852
|
+
const body = skipSpace(safe, i + 2);
|
|
1853
|
+
const end = safe[body] === '{' ? blockEnd(safe, body) : -1;
|
|
1854
|
+
i = end < 0 ? i + 1 : end;
|
|
1855
|
+
}
|
|
1856
|
+
else if (/[A-Za-z_$]/.test(ch) && !/[\w$.]/.test(safe[i - 1] ?? '')) {
|
|
1857
|
+
const word = /[A-Za-z_$][\w$]*/y;
|
|
1858
|
+
word.lastIndex = i;
|
|
1859
|
+
word.test(safe);
|
|
1860
|
+
const name = safe.slice(i, word.lastIndex);
|
|
1861
|
+
const next = skipSpace(safe, word.lastIndex);
|
|
1862
|
+
if (name === 'return') {
|
|
1863
|
+
values.push(next);
|
|
1864
|
+
}
|
|
1865
|
+
else if (name === 'function') {
|
|
1866
|
+
const end = pastBody(safe.indexOf('(', next));
|
|
1867
|
+
if (end > 0) {
|
|
1868
|
+
i = end;
|
|
1869
|
+
continue;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
else if (safe[next] === '(' && !BLOCK_HEADS.has(name)) {
|
|
1873
|
+
const end = pastBody(next);
|
|
1874
|
+
if (end > 0) {
|
|
1875
|
+
i = end;
|
|
1876
|
+
continue;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
i = word.lastIndex - 1;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return values;
|
|
1883
|
+
}
|
|
1884
|
+
function blockEnd(safe, open) {
|
|
1885
|
+
let depth = 0;
|
|
1886
|
+
for (let i = open; i < safe.length; i++) {
|
|
1887
|
+
if (opensString(safe, i)) {
|
|
1888
|
+
const end = (0, object_literal_1.skipString)(safe, i);
|
|
1889
|
+
if (end < 0)
|
|
1890
|
+
return -1;
|
|
1891
|
+
i = end;
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1894
|
+
const ch = safe[i];
|
|
1895
|
+
if (ch === '{' || ch === '(' || ch === '[')
|
|
1896
|
+
depth++;
|
|
1897
|
+
else if ((ch === '}' || ch === ')' || ch === ']') && --depth === 0)
|
|
1898
|
+
return i;
|
|
1899
|
+
}
|
|
1900
|
+
return -1;
|
|
1901
|
+
}
|
|
1902
|
+
function opensString(safe, i) {
|
|
1903
|
+
const ch = safe[i];
|
|
1904
|
+
return ch === '`' || ((ch === '"' || ch === "'") && !/[\w$]/.test(safe[i - 1] ?? ''));
|
|
1905
|
+
}
|
|
1906
|
+
function skipSpace(safe, i) {
|
|
1907
|
+
while (/\s/.test(safe[i] ?? ''))
|
|
1908
|
+
i++;
|
|
1909
|
+
return i;
|
|
300
1910
|
}
|
|
301
|
-
/**
|
|
302
|
-
* Check if string is PascalCase
|
|
303
|
-
*/
|
|
304
1911
|
function isPascalCase(str) {
|
|
305
1912
|
return /^[A-Z][a-zA-Z0-9]*$/.test(str);
|
|
306
1913
|
}
|
|
307
|
-
/**
|
|
308
|
-
* Check if name is a built-in type
|
|
309
|
-
*/
|
|
310
1914
|
function isBuiltInType(name) {
|
|
311
1915
|
return BUILT_IN_TYPES.has(name);
|
|
312
1916
|
}
|
|
@@ -316,9 +1920,14 @@ const BUILT_IN_TYPES = new Set([
|
|
|
316
1920
|
'React', 'Component', 'Fragment', 'Suspense', 'StrictMode',
|
|
317
1921
|
]);
|
|
318
1922
|
const COMPONENT_KINDS = new Set(['component', 'function', 'class']);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
1923
|
+
function ownDeclarations(name, filePath, context) {
|
|
1924
|
+
return (context.getNodesInFileNamed?.(filePath, name) ?? context.getNodesInFile(filePath).filter((n) => n.name === name))
|
|
1925
|
+
.filter((n) => n.qualifiedName === name && n.kind !== 'import' && n.kind !== 'export' && n.kind !== 'file');
|
|
1926
|
+
}
|
|
1927
|
+
function namesType(ref) {
|
|
1928
|
+
return ref.referenceKind === 'implements' ||
|
|
1929
|
+
(ref.referenceKind === 'references' && !ref.fromNodeId.startsWith('route:'));
|
|
1930
|
+
}
|
|
322
1931
|
function resolveComponent(name, fromFile, context) {
|
|
323
1932
|
const candidates = context.getNodesByName(name);
|
|
324
1933
|
if (candidates.length === 0)
|
|
@@ -326,45 +1935,44 @@ function resolveComponent(name, fromFile, context) {
|
|
|
326
1935
|
const components = candidates.filter((n) => COMPONENT_KINDS.has(n.kind));
|
|
327
1936
|
if (components.length === 0)
|
|
328
1937
|
return null;
|
|
329
|
-
|
|
330
|
-
const fromDir = fromFile.substring(0, fromFile.lastIndexOf('/'));
|
|
331
|
-
const sameDir = components.filter((n) => n.filePath.startsWith(fromDir));
|
|
1938
|
+
const sameDir = (0, component_folder_1.inReferencingFolder)(fromFile, components, (n) => n.filePath);
|
|
332
1939
|
if (sameDir.length > 0)
|
|
333
1940
|
return sameDir[0].id;
|
|
334
|
-
// Prefer component directories
|
|
335
1941
|
const COMPONENT_DIRS = ['/components/', '/src/components/', '/app/components/', '/pages/', '/src/pages/', '/views/', '/src/views/'];
|
|
336
1942
|
const preferred = components.filter((n) => COMPONENT_DIRS.some((d) => n.filePath.includes(d)));
|
|
337
1943
|
if (preferred.length > 0)
|
|
338
1944
|
return preferred[0].id;
|
|
339
|
-
// No positional signal: only an UNAMBIGUOUS name may resolve. Returning
|
|
340
|
-
// components[0] here picked an arbitrary same-named class anywhere in the
|
|
341
|
-
// repo (#764) — let the name-matcher's proximity scoring decide instead.
|
|
342
1945
|
return components.length === 1 ? components[0].id : null;
|
|
343
1946
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
function resolveHook(name, context) {
|
|
1947
|
+
function isEsmLanguage(language) {
|
|
1948
|
+
return language === 'typescript' || language === 'tsx' || language === 'javascript' || language === 'jsx';
|
|
1949
|
+
}
|
|
1950
|
+
function resolveHook(name, fromFile, context, language) {
|
|
348
1951
|
const candidates = context.getNodesByName(name);
|
|
349
1952
|
if (candidates.length === 0)
|
|
350
1953
|
return null;
|
|
351
|
-
const
|
|
1954
|
+
const nested = (n) => context.getNodesInFile(n.filePath).some((f) => f.id !== n.id && (f.kind === 'function' || f.kind === 'method') && f.startLine <= n.startLine && f.endLine >= n.endLine &&
|
|
1955
|
+
(f.startLine < n.startLine || f.endLine > n.endLine));
|
|
1956
|
+
const hooks = candidates.filter((n) => n.kind === 'function' && n.name.startsWith('use') && !nested(n));
|
|
352
1957
|
if (hooks.length === 0)
|
|
353
1958
|
return null;
|
|
354
|
-
|
|
1959
|
+
const sameFile = hooks.find((n) => n.filePath === fromFile);
|
|
1960
|
+
if (sameFile)
|
|
1961
|
+
return sameFile.id;
|
|
1962
|
+
if (isEsmLanguage(language))
|
|
1963
|
+
return null;
|
|
355
1964
|
const HOOK_DIRS = ['/hooks/', '/src/hooks/', '/lib/hooks/', '/utils/hooks/'];
|
|
356
1965
|
const preferred = hooks.filter((n) => HOOK_DIRS.some((d) => n.filePath.includes(d)));
|
|
357
1966
|
if (preferred.length > 0)
|
|
358
1967
|
return preferred[0].id;
|
|
359
1968
|
return hooks[0].id;
|
|
360
1969
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
1970
|
+
function resolveContext(name, ref, context) {
|
|
1971
|
+
if (isEsmLanguage(ref.language)) {
|
|
1972
|
+
return context.getNodesByName(name).find((n) => n.filePath === ref.filePath)?.id ?? null;
|
|
1973
|
+
}
|
|
365
1974
|
const candidates = context.getNodesByName(name);
|
|
366
1975
|
if (candidates.length === 0) {
|
|
367
|
-
// Try without Context/Provider suffix
|
|
368
1976
|
const baseName = name.replace(/Context$|Provider$/, '');
|
|
369
1977
|
if (baseName !== name) {
|
|
370
1978
|
const baseCandidates = context.getNodesByName(baseName);
|
|
@@ -373,7 +1981,6 @@ function resolveContext(name, context) {
|
|
|
373
1981
|
}
|
|
374
1982
|
return null;
|
|
375
1983
|
}
|
|
376
|
-
// Prefer context directories
|
|
377
1984
|
const CONTEXT_DIRS = ['/context/', '/contexts/', '/src/context/', '/src/contexts/', '/providers/', '/src/providers/'];
|
|
378
1985
|
const preferred = candidates.filter((n) => CONTEXT_DIRS.some((d) => n.filePath.includes(d)));
|
|
379
1986
|
if (preferred.length > 0)
|