@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +507 -702
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.js +1 -57
- 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 +654 -34
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1466 -1470
- 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 +51 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +76 -530
- 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 +35 -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 +11 -101
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +27 -1
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +70 -206
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/commonjs-requires.js +0 -31
- package/lib/dist/extraction/commonjs-requires.js.map +1 -1
- 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 +157 -207
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.js +0 -165
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +73 -4
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +160 -431
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +208 -7
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +594 -1383
- 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 +48 -135
- 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.d.ts +5 -1
- package/lib/dist/extraction/kernel/loader.d.ts.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 +125 -28
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +789 -856
- 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.js +3 -55
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts +129 -0
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +517 -162
- 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 +11 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +43 -197
- 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.d.ts +9 -0
- package/lib/dist/extraction/languages/php.d.ts.map +1 -1
- package/lib/dist/extraction/languages/php.js +207 -44
- 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-macro-calls.d.ts +32 -0
- package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
- package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
- package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
- package/lib/dist/extraction/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.js +3 -47
- 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 +64 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +73 -49
- 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 +42 -7
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
- package/lib/dist/extraction/parse-budget.js +39 -15
- package/lib/dist/extraction/parse-budget.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +29 -17
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +49 -193
- 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 +5 -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 +42 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
- package/lib/dist/extraction/sfc-script.js +32 -31
- package/lib/dist/extraction/sfc-script.js.map +1 -1
- 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 +1 -38
- package/lib/dist/extraction/store-worker.js.map +1 -1
- package/lib/dist/extraction/store-writer.js +2 -34
- 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 +11 -87
- 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 +4 -152
- 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 +518 -10
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +2118 -2554
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +13 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +52 -92
- package/lib/dist/extraction/vue-extractor.js.map +1 -1
- package/lib/dist/extraction/vue-options-api.js +0 -32
- package/lib/dist/extraction/vue-options-api.js.map +1 -1
- 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-dart.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +18 -89
- 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.map +1 -1
- package/lib/dist/graph/branch-guards.js +4 -251
- 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/file-drift.d.ts +35 -0
- package/lib/dist/graph/file-drift.d.ts.map +1 -0
- package/lib/dist/graph/file-drift.js +46 -0
- package/lib/dist/graph/file-drift.js.map +1 -0
- package/lib/dist/graph/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 +82 -223
- 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 +6 -3
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +4 -137
- 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/symbol-references.d.ts +86 -0
- package/lib/dist/graph/symbol-references.d.ts.map +1 -0
- package/lib/dist/graph/symbol-references.js +304 -0
- package/lib/dist/graph/symbol-references.js.map +1 -0
- package/lib/dist/graph/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 +33 -0
- package/lib/dist/graph/test-code.d.ts.map +1 -0
- package/lib/dist/graph/test-code.js +104 -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 +96 -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 +214 -26
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +736 -1112
- 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 +13 -6
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +27 -160
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +16 -1
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +10 -38
- 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.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +1 -103
- 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 +83 -13
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +201 -131
- 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 +2 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +9 -85
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-proof.d.ts +19 -0
- package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-proof.js +126 -0
- package/lib/dist/mcp/daemon-proof.js.map +1 -0
- package/lib/dist/mcp/daemon-registry.d.ts +47 -2
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +188 -139
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +69 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +186 -376
- 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 +24 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +47 -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.d.ts +6 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
- package/lib/dist/mcp/explore-diagnostics.js +8 -116
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
- package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
- package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
- package/lib/dist/mcp/explore-one-symbol.js +431 -0
- package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +0 -129
- package/lib/dist/mcp/explore-session-state.js.map +1 -1
- package/lib/dist/mcp/hook-client.d.ts +44 -0
- package/lib/dist/mcp/hook-client.d.ts.map +1 -0
- package/lib/dist/mcp/hook-client.js +202 -0
- package/lib/dist/mcp/hook-client.js.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.js +1 -6
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
- package/lib/dist/mcp/index-freshness.js +0 -15
- 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 +29 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +131 -300
- 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/opencode-tool-names.d.ts +32 -0
- package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
- package/lib/dist/mcp/opencode-tool-names.js +24 -0
- package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
- package/lib/dist/mcp/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 +6 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
- package/lib/dist/mcp/project-lifecycle.js +70 -19
- package/lib/dist/mcp/project-lifecycle.js.map +1 -1
- package/lib/dist/mcp/prompt-explore.d.ts +19 -0
- package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
- package/lib/dist/mcp/prompt-explore.js +6 -0
- package/lib/dist/mcp/prompt-explore.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +25 -7
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +145 -274
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +52 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +114 -123
- 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.d.ts +18 -0
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +12 -32
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +46 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +70 -132
- 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 +157 -18
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +797 -3621
- 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.d.ts +20 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +31 -140
- 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 +7 -56
- 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 +48 -1
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
- 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 +19 -5
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1395 -1343
- 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 +17 -68
- 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/event-emitter-synthesizer.d.ts +39 -0
- package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
- package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
- package/lib/dist/resolution/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.map +1 -1
- package/lib/dist/resolution/frameworks/angular-router.js +41 -208
- package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/astro.js +4 -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 +85 -102
- 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/elysia.d.ts +38 -0
- package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/elysia.js +683 -0
- package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.js +9 -190
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/express.d.ts +48 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +193 -199
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.js +1 -104
- 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 +14 -43
- 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 +14 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +16 -50
- 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 +203 -129
- 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 +71 -136
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
- package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +2 -199
- 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 +10 -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.js +0 -14
- package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/play.js +26 -34
- package/lib/dist/resolution/frameworks/play.js.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +5 -102
- 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 +13 -4
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.js +10 -82
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/react.d.ts +57 -0
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +1449 -191
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +1 -61
- 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 +35 -56
- 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 +7 -75
- 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.js +0 -97
- 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.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.js +11 -134
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue.js +42 -114
- 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 +278 -29
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +1825 -1396
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +517 -6
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +1604 -1042
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +23 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
- package/lib/dist/resolution/js-builtins.js +34 -14
- 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 +210 -0
- package/lib/dist/resolution/module-importers.d.ts.map +1 -0
- package/lib/dist/resolution/module-importers.js +673 -0
- package/lib/dist/resolution/module-importers.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +986 -7
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +24176 -6745
- 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/php-web-root.d.ts +39 -0
- package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
- package/lib/dist/resolution/php-web-root.js +141 -0
- package/lib/dist/resolution/php-web-root.js.map +1 -0
- package/lib/dist/resolution/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/python-overloads.d.ts +10 -0
- package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
- package/lib/dist/resolution/python-overloads.js +75 -0
- package/lib/dist/resolution/python-overloads.js.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.js +3 -55
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +23 -2
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +43 -111
- 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 +8 -37
- 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.map +1 -1
- package/lib/dist/resolution/swift-type-visibility.js +62 -104
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
- 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.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.js +35 -177
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
- package/lib/dist/resolution/type-parameters.d.ts +23 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
- package/lib/dist/resolution/type-parameters.js +52 -54
- package/lib/dist/resolution/type-parameters.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +192 -11
- 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 +573 -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 +7 -2
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +24 -97
- 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 +15 -135
- 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.js +0 -111
- package/lib/dist/ui-server/api/effects.js.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.js +0 -142
- 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.map +1 -1
- package/lib/dist/ui-server/api/map.js +4 -317
- package/lib/dist/ui-server/api/map.js.map +1 -1
- package/lib/dist/ui-server/api/node.js +0 -111
- 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.map +1 -1
- package/lib/dist/ui-server/api/route-roots.js +2 -44
- package/lib/dist/ui-server/api/route-roots.js.map +1 -1
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
- package/lib/dist/ui-server/api/routes.js +4 -60
- 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 +4 -174
- 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 +5 -381
- 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 +19 -94
- package/lib/dist/ui-server/api/trails.js.map +1 -1
- package/lib/dist/ui-server/api/when.js +0 -36
- 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.js +0 -25
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
- package/lib/dist/ui-server/highlight/index.js +1 -132
- 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.js +0 -5
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
- 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 +18 -5
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +73 -229
- 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/worker-teardown.js +0 -47
- package/lib/dist/worker-teardown.js.map +1 -1
- 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,65 +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;
|
|
10
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;
|
|
11
12
|
const package_deps_1 = require("./package-deps");
|
|
12
13
|
const import_resolver_1 = require("../import-resolver");
|
|
13
|
-
|
|
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");
|
|
14
21
|
const REACT_SCRIPT_LANGUAGES = new Set(['typescript', 'javascript', 'tsx', 'jsx']);
|
|
15
22
|
exports.reactResolver = {
|
|
16
23
|
name: 'react',
|
|
17
|
-
// Includes 'tsx'/'jsx' so route extraction runs on JSX files (where
|
|
18
|
-
// `<Route element={<X/>}>` routes live) — without them the .tsx/.jsx grammars
|
|
19
|
-
// were filtered out of the extract pass and those routes were never indexed.
|
|
20
|
-
// (resolve() is unaffected — it runs for every detected framework regardless
|
|
21
|
-
// of language; only the extract pass filters on `languages`.)
|
|
22
24
|
languages: ['javascript', 'typescript', 'tsx', 'jsx'],
|
|
23
25
|
detect(context) {
|
|
24
|
-
// React in a package.json — the root's, or a workspace's (`frontend/`, `apps/web/`).
|
|
25
26
|
if ((0, package_deps_1.dependsOn)(context, 'react', 'next', 'react-native'))
|
|
26
27
|
return true;
|
|
27
|
-
// Check for .jsx/.tsx files
|
|
28
28
|
const allFiles = context.getAllFiles();
|
|
29
29
|
return allFiles.some((f) => f.endsWith('.jsx') || f.endsWith('.tsx'));
|
|
30
30
|
},
|
|
31
|
-
// A data-router `lazy: () => import('./routes/x')` route names a module, not a symbol.
|
|
32
31
|
claimsReference(name) {
|
|
33
|
-
return name.startsWith(LAZY_ROUTE_PREFIX);
|
|
32
|
+
return name.startsWith(LAZY_ROUTE_PREFIX) || name.startsWith(LAYOUT_PREFIX) || PICKED_EXPORT.test(name);
|
|
34
33
|
},
|
|
35
34
|
resolve(ref, context) {
|
|
36
|
-
// Components, hooks and contexts are a script's: halo's Java
|
|
37
|
-
// `import org.springframework…SecurityContext` is no React context.
|
|
38
35
|
if (!REACT_SCRIPT_LANGUAGES.has(ref.language))
|
|
39
36
|
return null;
|
|
40
37
|
if (ref.referenceName.startsWith(LAZY_ROUTE_PREFIX)) {
|
|
41
38
|
const target = lazyRouteComponent(ref.referenceName.slice(LAZY_ROUTE_PREFIX.length), ref.filePath, context);
|
|
42
39
|
return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework' } : null;
|
|
43
40
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
}
|
|
49
50
|
if (context.getImportMappings?.(ref.filePath, ref.language)?.some((m) => m.localName === ref.referenceName)) {
|
|
50
51
|
return null;
|
|
51
52
|
}
|
|
52
|
-
// Pattern 1: Component references (PascalCase). Only from JSX-capable
|
|
53
|
-
// files — a component is USED in markup, which only parses in .tsx/.jsx.
|
|
54
|
-
// Without this gate, every PascalCase TYPE reference in plain .ts files
|
|
55
|
-
// went through component resolution: in a monorepo with same-named
|
|
56
|
-
// classes per package (#764, amplication), a `.ts` GraphQL-types file's
|
|
57
|
-
// own `Account` type alias lost to an arbitrary `Account` CLASS in
|
|
58
|
-
// another package (the framework's 0.8 outranked the name-matcher's
|
|
59
|
-
// proximity-correct 0.7).
|
|
60
53
|
if ((ref.language === 'tsx' || ref.language === 'jsx') &&
|
|
61
54
|
isPascalCase(ref.referenceName) &&
|
|
62
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;
|
|
63
72
|
const result = resolveComponent(ref.referenceName, ref.filePath, context);
|
|
64
73
|
if (result) {
|
|
65
74
|
return {
|
|
@@ -70,7 +79,6 @@ exports.reactResolver = {
|
|
|
70
79
|
};
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
|
-
// Pattern 2: Hook references (use*)
|
|
74
82
|
if (ref.referenceName.startsWith('use') && ref.referenceName.length > 3) {
|
|
75
83
|
const result = resolveHook(ref.referenceName, ref.filePath, context, ref.language);
|
|
76
84
|
if (result) {
|
|
@@ -82,7 +90,6 @@ exports.reactResolver = {
|
|
|
82
90
|
};
|
|
83
91
|
}
|
|
84
92
|
}
|
|
85
|
-
// Pattern 3: Context references
|
|
86
93
|
if (ref.referenceName.endsWith('Context') || ref.referenceName.endsWith('Provider')) {
|
|
87
94
|
const result = resolveContext(ref.referenceName, ref, context);
|
|
88
95
|
if (result) {
|
|
@@ -100,20 +107,9 @@ exports.reactResolver = {
|
|
|
100
107
|
const nodes = [];
|
|
101
108
|
const references = [];
|
|
102
109
|
const now = Date.now();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// (`forwardRef`/`memo`/`styled`) as `component` nodes (#841), and `useX`
|
|
107
|
-
// hooks as `function` nodes. Re-deriving them here with regex only ran on
|
|
108
|
-
// .ts/.js anyway (this resolver's `languages` didn't include the 'tsx'/'jsx'
|
|
109
|
-
// grammars), and it DUPLICATED those tree-sitter nodes (e.g. a `useAuth`
|
|
110
|
-
// ended up as two `function` nodes). This `extract` now contributes only
|
|
111
|
-
// what tree-sitter can't: route nodes (React Router + Next.js conventions),
|
|
112
|
-
// which is why 'tsx'/'jsx' are now in `languages` — `<Route>`/`element={<X/>}`
|
|
113
|
-
// routes live in JSX files and were previously skipped entirely.
|
|
114
|
-
// Read only each opening tag's own attributes, including expression values.
|
|
115
|
-
const declarations = scanRouteDeclarations(content, !/\.(?:ts|mts|cts)$/.test(filePath));
|
|
116
|
-
for (const { path: routePath, parts, component, lazy, at } of declarations) {
|
|
110
|
+
const declarations = scanRouteDeclarations(content, allowsJsx(filePath));
|
|
111
|
+
for (const route of declarations) {
|
|
112
|
+
const { path: routePath, parts, at } = route;
|
|
117
113
|
const line = content.slice(0, at).split('\n').length;
|
|
118
114
|
const routeNode = {
|
|
119
115
|
id: `route:${filePath}:${line}:${routePath}`,
|
|
@@ -127,32 +123,13 @@ exports.reactResolver = {
|
|
|
127
123
|
endColumn: 0,
|
|
128
124
|
language: filePath.endsWith('.tsx') ? 'tsx' : 'jsx',
|
|
129
125
|
updatedAt: now,
|
|
130
|
-
// A path built from a constant (`paths.app.root.path`) is named in postExtract.
|
|
131
126
|
...(parts.some((p) => p.expr) ? { signature: ROUTE_PARTS_PREFIX + JSON.stringify(parts) } : {}),
|
|
132
127
|
};
|
|
133
128
|
nodes.push(routeNode);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
references.push({
|
|
137
|
-
fromNodeId: routeNode.id,
|
|
138
|
-
referenceName: target,
|
|
139
|
-
referenceKind: 'references',
|
|
140
|
-
line,
|
|
141
|
-
column: 0,
|
|
142
|
-
filePath,
|
|
143
|
-
language: filePath.endsWith('.tsx') ? 'tsx' : 'jsx',
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// Next.js pages and route handlers are `frameworks/nextjs.ts`'s.
|
|
129
|
+
references.push(...routeReferences(route, routeNode.id, filePath, line));
|
|
130
|
+
}
|
|
148
131
|
return { nodes, references };
|
|
149
132
|
},
|
|
150
|
-
/**
|
|
151
|
-
* Name the routes whose path is built from a constant — bulletproof-react's
|
|
152
|
-
* `path: paths.app.discussions.path` under `path: paths.app.root.path` is
|
|
153
|
-
* `/app/discussions` — by reading the constant's object literal where it is
|
|
154
|
-
* declared. Idempotent: the parts ride on the node's signature.
|
|
155
|
-
*/
|
|
156
133
|
postExtract(context) {
|
|
157
134
|
const updates = [];
|
|
158
135
|
for (const route of context.getNodesByKind('route')) {
|
|
@@ -174,10 +151,40 @@ exports.reactResolver = {
|
|
|
174
151
|
}
|
|
175
152
|
return updates;
|
|
176
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
|
+
},
|
|
177
182
|
};
|
|
178
183
|
const LAZY_ROUTE_PREFIX = 'lazy-import:';
|
|
179
184
|
const ROUTE_PARTS_PREFIX = 'route-parts:';
|
|
180
|
-
|
|
185
|
+
const LAYOUT_PREFIX = 'layout:';
|
|
186
|
+
const OUTLET = 'Outlet';
|
|
187
|
+
const PICKED_EXPORT = /^import:(.+)#([A-Za-z_$][\w$]*)$/;
|
|
181
188
|
function composeRoutePath(parts) {
|
|
182
189
|
let path = '';
|
|
183
190
|
for (const part of parts) {
|
|
@@ -188,11 +195,6 @@ function composeRoutePath(parts) {
|
|
|
188
195
|
}
|
|
189
196
|
return ('/' + path.replace(/^\/+/, '')).replace(/\/{2,}/g, '/').replace(/(.)\/$/, '$1');
|
|
190
197
|
}
|
|
191
|
-
/**
|
|
192
|
-
* The string a member expression like `paths.app.root.path` reads from a
|
|
193
|
-
* constant object literal — the constant found through the route file's
|
|
194
|
-
* import of its root name, or in the file itself.
|
|
195
|
-
*/
|
|
196
198
|
function constantPathValue(expr, fromFile, context) {
|
|
197
199
|
const [root, ...keys] = expr.split('.');
|
|
198
200
|
if (!root || keys.length === 0)
|
|
@@ -214,18 +216,9 @@ function constantPathValue(expr, fromFile, context) {
|
|
|
214
216
|
return null;
|
|
215
217
|
const lines = context.readFile(file)?.split('\n') ?? [];
|
|
216
218
|
const text = lines.slice(decl.startLine - 1, decl.endLine).join('\n');
|
|
217
|
-
const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${name}\\b`))));
|
|
219
|
+
const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${(0, utils_1.escapeRegExp)(name)}\\b`))));
|
|
218
220
|
return open < 0 ? null : readObjectPath(text, open, keys);
|
|
219
221
|
}
|
|
220
|
-
/**
|
|
221
|
-
* The href a route-config object names — `paths.app.discussion.getHref(id)`
|
|
222
|
-
* or `paths.app.discussion.path` against `export const paths = { app: {
|
|
223
|
-
* discussion: { path: 'discussions/:discussionId', getHref: (id: string) =>
|
|
224
|
-
* \`/app/discussions/${id}\` } } }` (bulletproof-react's `config/paths.ts`)
|
|
225
|
-
* — as the string or template literal it returns, ready for the href reader.
|
|
226
|
-
* A `${…}` glued to a segment (a `?redirectTo=` suffix) is dropped; one
|
|
227
|
-
* that is a whole segment stays a hole. Null for anything else.
|
|
228
|
-
*/
|
|
229
222
|
function configHrefExpression(expr, fromFile, context) {
|
|
230
223
|
const m = /^\s*([A-Za-z_$][\w$]*)((?:\s*\??\.\s*[A-Za-z_$][\w$]*)+)\s*(\((?:[^()]|\([^()]*\))*\))?\s*$/.exec(expr);
|
|
231
224
|
if (!m)
|
|
@@ -249,13 +242,12 @@ function configHrefExpression(expr, fromFile, context) {
|
|
|
249
242
|
return null;
|
|
250
243
|
const lines = context.readFile(file)?.split('\n') ?? [];
|
|
251
244
|
const text = lines.slice(decl.startLine - 1, decl.endLine).join('\n');
|
|
252
|
-
const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${name}\\b`))));
|
|
245
|
+
const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${(0, utils_1.escapeRegExp)(name)}\\b`))));
|
|
253
246
|
if (open < 0)
|
|
254
247
|
return null;
|
|
255
248
|
let value = readObjectValue(text, open, keys);
|
|
256
249
|
if (value === null)
|
|
257
250
|
return null;
|
|
258
|
-
// A function's value is what it returns: `(id: string) => \`/app/…\``, `() => { return '/'; }`.
|
|
259
251
|
if (m[3] !== undefined) {
|
|
260
252
|
const body = /^(?:async\s+)?(?:\([^()]*(?:\([^()]*\)[^()]*)*\)|[A-Za-z_$][\w$]*)\s*(?::\s*[^=]+?)?=>\s*/.exec(value);
|
|
261
253
|
if (!body)
|
|
@@ -266,10 +258,8 @@ function configHrefExpression(expr, fromFile, context) {
|
|
|
266
258
|
}
|
|
267
259
|
if (!/^[`'"]/.test(value))
|
|
268
260
|
return null;
|
|
269
|
-
// `/auth/login${redirectTo ? … : ''}`: a hole glued to a segment is a suffix, not a segment.
|
|
270
261
|
return value.startsWith('`') ? dropGluedTemplateHoles(value) : value;
|
|
271
262
|
}
|
|
272
|
-
/** Remove each `${…}` of a template literal that is not a whole path segment. */
|
|
273
263
|
function dropGluedTemplateHoles(template) {
|
|
274
264
|
let out = '';
|
|
275
265
|
for (let i = 0; i < template.length; i++) {
|
|
@@ -293,7 +283,6 @@ function dropGluedTemplateHoles(template) {
|
|
|
293
283
|
}
|
|
294
284
|
return out;
|
|
295
285
|
}
|
|
296
|
-
/** Walk `keys` into the object literal opening at `at`; the final value's source text, or null. */
|
|
297
286
|
function readObjectValue(text, at, keys) {
|
|
298
287
|
const skipString = (j) => {
|
|
299
288
|
const quote = text[j];
|
|
@@ -346,7 +335,6 @@ function readObjectValue(text, at, keys) {
|
|
|
346
335
|
}
|
|
347
336
|
return null;
|
|
348
337
|
}
|
|
349
|
-
/** Walk `keys` into the object literal opening at `at`; the string literal at the end, or null. */
|
|
350
338
|
function readObjectPath(text, at, keys) {
|
|
351
339
|
const skipString = (j) => {
|
|
352
340
|
const quote = text[j];
|
|
@@ -401,47 +389,350 @@ function readObjectPath(text, at, keys) {
|
|
|
401
389
|
}
|
|
402
390
|
return null;
|
|
403
391
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
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);
|
|
407
399
|
if (!file)
|
|
408
400
|
return null;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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)
|
|
413
657
|
return null;
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
|
|
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;
|
|
417
700
|
}
|
|
418
|
-
|
|
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]*\))?$/;
|
|
419
704
|
function scanRouteDeclarations(source, allowJsx) {
|
|
420
|
-
const
|
|
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) {
|
|
421
711
|
const scopes = [];
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
712
|
+
const names = [];
|
|
713
|
+
const sites = [];
|
|
714
|
+
const routeTags = [];
|
|
715
|
+
const routers = [];
|
|
716
|
+
const objects = Boolean(options.objects || options.table);
|
|
425
717
|
const literal = (value) => {
|
|
426
718
|
const match = /^(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)')$/.exec(value.trim());
|
|
427
719
|
return match ? match[1] ?? match[2] : undefined;
|
|
428
720
|
};
|
|
429
|
-
|
|
430
|
-
// `<Suspense>`) is not what the route renders; the first element inside it is.
|
|
431
|
-
const WRAPPER = /^(?:Suspense|ErrorBoundary|\w*(?:Guard|Provider)|(?:Protected|Private|Auth|Require\w*)\w*)$/;
|
|
721
|
+
const WRAPPER = /^(?:Suspense|ErrorBoundary|\w*(?:Guard|Provider|Wrapper|Route)|(?:Protected|Private|Auth|Require\w*)\w*)$/;
|
|
432
722
|
const componentName = (value, jsx) => {
|
|
433
723
|
if (!value)
|
|
434
724
|
return undefined;
|
|
435
725
|
if (!jsx)
|
|
436
726
|
return /^\s*([A-Z][\w]*)\s*$/.exec(value)?.[1];
|
|
437
|
-
const inner = value.replace(/^\s
|
|
727
|
+
const inner = value.replace(/^\s*(?:\(\s*)?/, '');
|
|
438
728
|
if (!/^<\s*[A-Z]/.test(inner))
|
|
439
729
|
return undefined;
|
|
440
|
-
const
|
|
441
|
-
|
|
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];
|
|
442
733
|
};
|
|
443
|
-
|
|
444
|
-
|
|
734
|
+
const elementTag = (value) => componentName(value, true);
|
|
735
|
+
const elementPage = (value) => elementTag(value)?.replace(/^Outlet$/, '') || undefined;
|
|
445
736
|
const tokenBefore = (at) => {
|
|
446
737
|
let j = at - 1;
|
|
447
738
|
while (j >= 0 && /\s/.test(source[j]))
|
|
@@ -467,7 +758,54 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
467
758
|
}
|
|
468
759
|
return at;
|
|
469
760
|
};
|
|
470
|
-
|
|
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) {
|
|
471
809
|
const ch = source[at];
|
|
472
810
|
if (ch === '"' || ch === "'" || ch === '`') {
|
|
473
811
|
let i = at + 1;
|
|
@@ -486,7 +824,6 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
486
824
|
}
|
|
487
825
|
return i;
|
|
488
826
|
}
|
|
489
|
-
// A regex can contain braces or JSX-looking text without ending an expression.
|
|
490
827
|
if (ch === '/') {
|
|
491
828
|
const before = tokenBefore(at);
|
|
492
829
|
if (!before || /[=(:,[!&|?{};]$/.test(before) || /\b(?:return|throw|case|yield)\s*$/.test(before)) {
|
|
@@ -511,92 +848,161 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
511
848
|
}
|
|
512
849
|
if (allowJsx && ch === '<' && /^<(?:[A-Za-z][\w.:-]*|>)/.test(source.slice(at))) {
|
|
513
850
|
const before = tokenBefore(at);
|
|
514
|
-
// `count<limit` and `factory<Type>()` are not JSX opening tags.
|
|
515
851
|
if (!/[\w$)\]'"]$/.test(before) || /\breturn$/.test(before))
|
|
516
852
|
return jsx(at);
|
|
517
853
|
}
|
|
518
854
|
const close = ch === '{' ? '}' : ch === '[' ? ']' : ch === '(' ? ')' : undefined;
|
|
519
855
|
if (!close)
|
|
520
856
|
return at + 1;
|
|
857
|
+
const call = ch === '(' ? routerCall(at) : null;
|
|
858
|
+
const router = ch === '(' && routesFromElements(at);
|
|
521
859
|
let i = at + 1;
|
|
522
860
|
const fields = new Map();
|
|
523
861
|
while ((i = trivia(i)) < source.length && source[i] !== close) {
|
|
524
|
-
// A property must start at an object entry, never inside its value.
|
|
525
862
|
const key = ch === '{' ? /^(?:([A-Za-z_$][\w$]*)|["']([^"']+)["'])\s*:/.exec(source.slice(i)) : null;
|
|
526
863
|
if (key) {
|
|
864
|
+
const name = key[1] ?? key[2];
|
|
527
865
|
const start = i;
|
|
528
866
|
const valueAt = trivia(i + key[0].length);
|
|
867
|
+
const children = objects && name === 'children';
|
|
529
868
|
i = valueAt;
|
|
530
869
|
let valueEnd = i;
|
|
531
870
|
while ((i = trivia(i)) < source.length && source[i] !== ',' && source[i] !== close) {
|
|
532
|
-
i = unit(i);
|
|
871
|
+
i = unit(i, children);
|
|
533
872
|
valueEnd = i;
|
|
534
873
|
}
|
|
535
|
-
|
|
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 });
|
|
536
878
|
}
|
|
537
879
|
else {
|
|
538
|
-
|
|
880
|
+
const entry = i;
|
|
539
881
|
while ((i = trivia(i)) < source.length && source[i] !== ',' && source[i] !== close)
|
|
540
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
|
+
}
|
|
541
895
|
}
|
|
542
896
|
if (source[i] === ',')
|
|
543
897
|
i++;
|
|
544
898
|
}
|
|
545
|
-
if (
|
|
899
|
+
if (objects && ch === '{' && source[i] === close) {
|
|
546
900
|
const pathField = fields.get('path');
|
|
547
901
|
const path = pathField && literal(pathField.value);
|
|
548
902
|
const expr = pathField && path === undefined && /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(pathField.value) ? pathField.value : undefined;
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
const
|
|
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');
|
|
552
909
|
if (pathField && (path !== undefined || expr)) {
|
|
553
|
-
scopes.push({ part: path !== undefined ? { lit: path } : { expr }, at: pathField.at, end: i, component, lazy });
|
|
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 });
|
|
554
917
|
}
|
|
555
918
|
}
|
|
919
|
+
if (call && i < source.length)
|
|
920
|
+
settle(call, at, i);
|
|
921
|
+
if (router)
|
|
922
|
+
routers.push({ start: at, end: i });
|
|
556
923
|
return i < source.length ? i + 1 : i;
|
|
557
924
|
}
|
|
558
925
|
function jsx(at) {
|
|
559
926
|
const tag = /^<([\w.:-]*)/.exec(source.slice(at));
|
|
560
927
|
let i = at + tag[0].length;
|
|
561
928
|
const attrs = new Map();
|
|
929
|
+
const spreads = [];
|
|
562
930
|
while ((i = trivia(i)) < source.length && source[i] !== '>' && !source.startsWith('/>', i)) {
|
|
563
931
|
const attr = /^[\w:-]+/.exec(source.slice(i));
|
|
564
932
|
if (!attr) {
|
|
933
|
+
const from = i;
|
|
565
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]);
|
|
566
938
|
continue;
|
|
567
939
|
}
|
|
568
940
|
i = trivia(i + attr[0].length);
|
|
569
|
-
if (source[i] !== '=')
|
|
941
|
+
if (source[i] !== '=') {
|
|
942
|
+
attrs.set(attr[0], '{true}');
|
|
570
943
|
continue;
|
|
944
|
+
}
|
|
571
945
|
i = trivia(i + 1);
|
|
572
946
|
const start = i;
|
|
573
947
|
i = unit(i);
|
|
574
948
|
attrs.set(attr[0], source.slice(start, i));
|
|
575
949
|
}
|
|
576
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);
|
|
577
955
|
if (tag[1] === 'Route' && i < source.length) {
|
|
578
|
-
const
|
|
956
|
+
const pathText = attrs.get('path');
|
|
579
957
|
const expression = (name) => attrs.get(name)?.replace(/^\{([\s\S]*)\}$/, '$1');
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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 };
|
|
965
|
+
if (path)
|
|
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 };
|
|
585
978
|
}
|
|
586
|
-
}
|
|
587
|
-
if (source.startsWith('/>', i)) {
|
|
588
979
|
if (scope)
|
|
589
|
-
scope
|
|
590
|
-
return i + 2;
|
|
980
|
+
scopes.push(scope);
|
|
591
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
|
+
};
|
|
999
|
+
if (source.startsWith('/>', i))
|
|
1000
|
+
return close(i + 2);
|
|
592
1001
|
i++;
|
|
593
1002
|
while (i < source.length) {
|
|
594
1003
|
if (source.startsWith('</', i)) {
|
|
595
1004
|
const end = source.indexOf('>', i + 2);
|
|
596
|
-
|
|
597
|
-
if (scope)
|
|
598
|
-
scope.end = after;
|
|
599
|
-
return after;
|
|
1005
|
+
return close(end < 0 ? source.length : end + 1);
|
|
600
1006
|
}
|
|
601
1007
|
if (source[i] === '<' && /^<(?:[A-Za-z]|>)/.test(source.slice(i)))
|
|
602
1008
|
i = jsx(i);
|
|
@@ -605,36 +1011,906 @@ function scanRouteDeclarations(source, allowJsx) {
|
|
|
605
1011
|
else
|
|
606
1012
|
i++;
|
|
607
1013
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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);
|
|
611
1022
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
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();
|
|
617
1032
|
for (const scope of scopes) {
|
|
618
|
-
|
|
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))
|
|
619
1051
|
continue;
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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;
|
|
1910
|
+
}
|
|
632
1911
|
function isPascalCase(str) {
|
|
633
1912
|
return /^[A-Z][a-zA-Z0-9]*$/.test(str);
|
|
634
1913
|
}
|
|
635
|
-
/**
|
|
636
|
-
* Check if name is a built-in type
|
|
637
|
-
*/
|
|
638
1914
|
function isBuiltInType(name) {
|
|
639
1915
|
return BUILT_IN_TYPES.has(name);
|
|
640
1916
|
}
|
|
@@ -644,9 +1920,14 @@ const BUILT_IN_TYPES = new Set([
|
|
|
644
1920
|
'React', 'Component', 'Fragment', 'Suspense', 'StrictMode',
|
|
645
1921
|
]);
|
|
646
1922
|
const COMPONENT_KINDS = new Set(['component', 'function', 'class']);
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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
|
+
}
|
|
650
1931
|
function resolveComponent(name, fromFile, context) {
|
|
651
1932
|
const candidates = context.getNodesByName(name);
|
|
652
1933
|
if (candidates.length === 0)
|
|
@@ -654,33 +1935,22 @@ function resolveComponent(name, fromFile, context) {
|
|
|
654
1935
|
const components = candidates.filter((n) => COMPONENT_KINDS.has(n.kind));
|
|
655
1936
|
if (components.length === 0)
|
|
656
1937
|
return null;
|
|
657
|
-
|
|
658
|
-
const fromDir = fromFile.substring(0, fromFile.lastIndexOf('/'));
|
|
659
|
-
const sameDir = components.filter((n) => n.filePath.startsWith(fromDir));
|
|
1938
|
+
const sameDir = (0, component_folder_1.inReferencingFolder)(fromFile, components, (n) => n.filePath);
|
|
660
1939
|
if (sameDir.length > 0)
|
|
661
1940
|
return sameDir[0].id;
|
|
662
|
-
// Prefer component directories
|
|
663
1941
|
const COMPONENT_DIRS = ['/components/', '/src/components/', '/app/components/', '/pages/', '/src/pages/', '/views/', '/src/views/'];
|
|
664
1942
|
const preferred = components.filter((n) => COMPONENT_DIRS.some((d) => n.filePath.includes(d)));
|
|
665
1943
|
if (preferred.length > 0)
|
|
666
1944
|
return preferred[0].id;
|
|
667
|
-
// No positional signal: only an UNAMBIGUOUS name may resolve. Returning
|
|
668
|
-
// components[0] here picked an arbitrary same-named class anywhere in the
|
|
669
|
-
// repo (#764) — let the name-matcher's proximity scoring decide instead.
|
|
670
1945
|
return components.length === 1 ? components[0].id : null;
|
|
671
1946
|
}
|
|
672
|
-
/** JS/TS (and their JSX dialects): modules where a cross-file name needs an import. */
|
|
673
1947
|
function isEsmLanguage(language) {
|
|
674
1948
|
return language === 'typescript' || language === 'tsx' || language === 'javascript' || language === 'jsx';
|
|
675
1949
|
}
|
|
676
|
-
/**
|
|
677
|
-
* Resolve a custom hook reference using name-based lookup
|
|
678
|
-
*/
|
|
679
1950
|
function resolveHook(name, fromFile, context, language) {
|
|
680
1951
|
const candidates = context.getNodesByName(name);
|
|
681
1952
|
if (candidates.length === 0)
|
|
682
1953
|
return null;
|
|
683
|
-
// A hook nested inside another function is only callable in there.
|
|
684
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 &&
|
|
685
1955
|
(f.startLine < n.startLine || f.endLine > n.endLine));
|
|
686
1956
|
const hooks = candidates.filter((n) => n.kind === 'function' && n.name.startsWith('use') && !nested(n));
|
|
@@ -689,31 +1959,20 @@ function resolveHook(name, fromFile, context, language) {
|
|
|
689
1959
|
const sameFile = hooks.find((n) => n.filePath === fromFile);
|
|
690
1960
|
if (sameFile)
|
|
691
1961
|
return sameFile.id;
|
|
692
|
-
// A JS/TS module reaches another file's hook only by importing it — the
|
|
693
|
-
// import resolver's to follow (an imported name never gets here) — never
|
|
694
|
-
// by name alone.
|
|
695
1962
|
if (isEsmLanguage(language))
|
|
696
1963
|
return null;
|
|
697
|
-
// Prefer hooks directories
|
|
698
1964
|
const HOOK_DIRS = ['/hooks/', '/src/hooks/', '/lib/hooks/', '/utils/hooks/'];
|
|
699
1965
|
const preferred = hooks.filter((n) => HOOK_DIRS.some((d) => n.filePath.includes(d)));
|
|
700
1966
|
if (preferred.length > 0)
|
|
701
1967
|
return preferred[0].id;
|
|
702
1968
|
return hooks[0].id;
|
|
703
1969
|
}
|
|
704
|
-
/**
|
|
705
|
-
* Resolve a context reference using name-based lookup
|
|
706
|
-
*/
|
|
707
1970
|
function resolveContext(name, ref, context) {
|
|
708
|
-
// In a JS/TS module only the file's own context is in reach by name; another
|
|
709
|
-
// file's comes through an import (trpc's adapters' `createContext?.(…)` is an
|
|
710
|
-
// option, not an example app's `createContext`).
|
|
711
1971
|
if (isEsmLanguage(ref.language)) {
|
|
712
1972
|
return context.getNodesByName(name).find((n) => n.filePath === ref.filePath)?.id ?? null;
|
|
713
1973
|
}
|
|
714
1974
|
const candidates = context.getNodesByName(name);
|
|
715
1975
|
if (candidates.length === 0) {
|
|
716
|
-
// Try without Context/Provider suffix
|
|
717
1976
|
const baseName = name.replace(/Context$|Provider$/, '');
|
|
718
1977
|
if (baseName !== name) {
|
|
719
1978
|
const baseCandidates = context.getNodesByName(baseName);
|
|
@@ -722,7 +1981,6 @@ function resolveContext(name, ref, context) {
|
|
|
722
1981
|
}
|
|
723
1982
|
return null;
|
|
724
1983
|
}
|
|
725
|
-
// Prefer context directories
|
|
726
1984
|
const CONTEXT_DIRS = ['/context/', '/contexts/', '/src/context/', '/src/contexts/', '/providers/', '/src/providers/'];
|
|
727
1985
|
const preferred = candidates.filter((n) => CONTEXT_DIRS.some((d) => n.filePath.includes(d)));
|
|
728
1986
|
if (preferred.length > 0)
|