From 2b4c0216e91c10c91b9ac4205f891c64c93abca2 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Wed, 5 Jun 2024 11:07:49 -0600 Subject: [PATCH 1/5] PoC of LSP in Rover --- Cargo.lock | 465 +++++++++++++++++++++++++++++++++++++- Cargo.toml | 12 +- src/cli.rs | 4 + src/command/lsp/README.md | 14 ++ src/command/lsp/input.txt | 9 + src/command/lsp/mod.rs | 162 +++++++++++++ src/command/mod.rs | 2 + src/error/mod.rs | 12 + 8 files changed, 676 insertions(+), 4 deletions(-) create mode 100644 src/command/lsp/README.md create mode 100644 src/command/lsp/input.txt create mode 100644 src/command/lsp/mod.rs diff --git a/Cargo.lock b/Cargo.lock index e7702f044..e27969f9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,17 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.11" @@ -35,6 +46,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -140,6 +152,37 @@ version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" +[[package]] +name = "apollo-compiler" +version = "1.0.0-beta.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6feccaf8fab00732a73dd3a40e4aaa7a1106ceef3c0bfbc591c4e0ba27e07774" +dependencies = [ + "ahash 0.8.11", + "apollo-parser 0.8.2", + "ariadne", + "indexmap 2.5.0", + "rowan", + "serde", + "serde_json_bytes", + "thiserror", + "triomphe", + "typed-arena", + "uuid", +] + +[[package]] +name = "apollo-composition" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b66ac0639701b5dcf6004d5df0030a7836cbb334f80713f644562e5c37559fa" +dependencies = [ + "apollo-compiler", + "apollo-federation", + "apollo-federation-types", + "either", +] + [[package]] name = "apollo-encoder" version = "0.8.0" @@ -150,6 +193,33 @@ dependencies = [ "thiserror", ] +[[package]] +name = "apollo-federation" +version = "2.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ca57e70fa00d8c0f8f01152dd79c648313e78b06c9cf455c4c49bba3a2b1e4" +dependencies = [ + "apollo-compiler", + "derive_more", + "either", + "http 0.2.12", + "indexmap 2.5.0", + "itertools 0.13.0", + "lazy_static", + "multimap", + "nom", + "petgraph", + "serde", + "serde_json", + "serde_json_bytes", + "strum", + "strum_macros", + "thiserror", + "time", + "tracing", + "url", +] + [[package]] name = "apollo-federation-types" version = "0.14.1" @@ -167,6 +237,34 @@ dependencies = [ "url", ] +[[package]] +name = "apollo-language-server" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efb3d9bed62dab8e13c42a740754c4cbfa9c303343161095d9fb91073c153b54" +dependencies = [ + "apollo-compiler", + "apollo-composition", + "apollo-federation", + "apollo-federation-types", + "apollo-parser 0.8.2", + "debounced", + "futures", + "indexmap 2.5.0", + "itertools 0.13.0", + "lsp-types", + "memoize", + "once_cell", + "ropey", + "semver", + "serde", + "serde_json", + "tokio", + "tower-lsp", + "tracing", + "url", +] + [[package]] name = "apollo-parser" version = "0.7.7" @@ -210,6 +308,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44055e597c674aef7cb903b2b9f6e4cba1277ed0d2d61dae7cd52d7ffa81f8e2" dependencies = [ + "concolor", "unicode-width", "yansi 1.0.1", ] @@ -563,6 +662,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "autocfg" version = "1.3.0" @@ -819,7 +929,7 @@ version = "0.49.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8e463fceca5674287f32d252fb1d94083758b8709c160efae66d263e5f4eba" dependencies = [ - "ahash", + "ahash 0.8.11", "cached_proc_macro", "cached_proc_macro_types", "hashbrown 0.14.5", @@ -1050,6 +1160,26 @@ dependencies = [ "unreachable", ] +[[package]] +name = "concolor" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b946244a988c390a94667ae0e3958411fa40cc46ea496a929b263d883f5f9c3" +dependencies = [ + "bitflags 1.3.2", + "concolor-query", + "is-terminal", +] + +[[package]] +name = "concolor-query" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" +dependencies = [ + "windows-sys 0.45.0", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1078,6 +1208,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "cookie" version = "0.17.0" @@ -1498,6 +1634,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "debounced" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "107e5cd9b5163c19751e53eef634cae25cf5ed5f6d0c81125feaa92e43703cc7" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "deflate64" version = "0.1.9" @@ -1572,6 +1718,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.77", +] + [[package]] name = "dialoguer" version = "0.11.0" @@ -2318,6 +2477,9 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] [[package]] name = "hashbrown" @@ -2325,7 +2487,7 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash", + "ahash 0.8.11", "allocator-api2", ] @@ -2932,6 +3094,19 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonpath-rust" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06cc127b7c3d270be504572364f9569761a180b981919dd0d87693a7f5fb7829" +dependencies = [ + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror", +] + [[package]] name = "jsonwebtoken" version = "9.3.0" @@ -3189,6 +3364,15 @@ dependencies = [ "logos-codegen", ] +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown 0.12.3", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -3198,6 +3382,19 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "lsp-types" +version = "0.94.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" +dependencies = [ + "bitflags 1.3.2", + "serde", + "serde_json", + "serde_repr", + "url", +] + [[package]] name = "lychee-lib" version = "0.15.1" @@ -3315,6 +3512,29 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memoize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df4051db13d0816cf23196d3baa216385ae099339f5d0645a8d9ff2305e82b8" +dependencies = [ + "lazy_static", + "lru", + "memoize-inner", +] + +[[package]] +name = "memoize-inner" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bdece7e91f0d1e33df7b46ec187a93ea0d4e642113a1039ac8bfdd4a3273ac" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "mime" version = "0.3.17" @@ -3420,6 +3640,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" +dependencies = [ + "serde", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -3621,6 +3850,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "object" version = "0.36.4" @@ -3902,6 +4140,51 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "664d22978e2815783adbdd2c588b455b1bd625299ce36b2a99881ac9627e6d8d" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d5487022d5d33f4c30d91c22afa240ce2a644e87fe08caad974d4eab6badbe" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "pest_meta" +version = "2.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0091754bbd0ea592c4deb3a122ce8ecbb0753b738aa82bc055fcc2eccc8d8174" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.6.5" @@ -3910,6 +4193,8 @@ checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", "indexmap 2.5.0", + "serde", + "serde_derive", ] [[package]] @@ -4473,12 +4758,23 @@ dependencies = [ "uuid", ] +[[package]] +name = "ropey" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5" +dependencies = [ + "smallvec", + "str_indices", +] + [[package]] name = "rover" version = "0.26.2" dependencies = [ "anyhow", "apollo-federation-types", + "apollo-language-server", "apollo-parser 0.8.2", "assert-json-diff", "assert_cmd", @@ -4548,6 +4844,7 @@ dependencies = [ "tokio-stream", "toml", "tower 0.5.1", + "tower-lsp", "tracing", "tracing-test", "url", @@ -4939,12 +5236,28 @@ version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ + "indexmap 2.5.0", "itoa", "memchr", "ryu", "serde", ] +[[package]] +name = "serde_json_bytes" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ecd92a088fb2500b2f146c9ddc5da9950bb7264d3f00932cd2a6fb369c26c46" +dependencies = [ + "ahash 0.8.11", + "bytes", + "indexmap 2.5.0", + "jsonpath-rust", + "regex", + "serde", + "serde_json", +] + [[package]] name = "serde_json_traversal" version = "0.2.0" @@ -4971,6 +5284,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "serde_spanned" version = "0.6.7" @@ -5321,6 +5645,18 @@ dependencies = [ "wsl", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "str_indices" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9557cb6521e8d009c51a8666f09356f4b817ba9ba0981a305bd86aee47bd35c" + [[package]] name = "str_inflector" version = "0.12.0" @@ -5622,7 +5958,9 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "libc", "num-conv", + "num_threads", "powerfmt", "serde", "time-core", @@ -5860,6 +6198,40 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" +[[package]] +name = "tower-lsp" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ba052b54a6627628d9b3c34c176e7eda8359b7da9acd497b9f20998d118508" +dependencies = [ + "async-trait", + "auto_impl", + "bytes", + "dashmap", + "futures", + "httparse", + "lsp-types", + "memchr", + "serde", + "serde_json", + "tokio", + "tokio-util", + "tower 0.4.13", + "tower-lsp-macros", + "tracing", +] + +[[package]] +name = "tower-lsp-macros" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "tower-service" version = "0.3.3" @@ -5964,6 +6336,16 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "triomphe" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" +dependencies = [ + "serde", + "stable_deref_trait", +] + [[package]] name = "trust-dns-proto" version = "0.21.2" @@ -6034,6 +6416,12 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typed-builder" version = "0.18.2" @@ -6060,6 +6448,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "unicase" version = "2.7.0" @@ -6155,6 +6549,7 @@ checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", "serde", + "wasm-bindgen", ] [[package]] @@ -6418,6 +6813,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -6445,6 +6849,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -6476,6 +6895,12 @@ dependencies = [ "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -6488,6 +6913,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -6500,6 +6931,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -6518,6 +6955,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -6530,6 +6973,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -6542,6 +6991,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -6554,6 +7009,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/Cargo.toml b/Cargo.toml index da2593e4e..4258cb4b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,12 @@ apollo-encoder = "0.8" # https://github.com/apollographql/federation-rs apollo-federation-types = "0.14.1" +# apollo-federation-types = { path = "../federation-rs/apollo-federation-types" } +# apollo-federation-types = { git = "https://github.com/apollographql/federation-rs.git", branch = "connectors"} + +# https://github.com/mdg-private/language-server +apollo-language-server = { version = "0.1.0", default-features = false, features = ["tokio"] } +# apollo-language-server = { path = "../language-server/crates/language-server-core", default-features = false, features = ["tokio"] } # crates.io dependencies anyhow = "1" @@ -165,10 +171,11 @@ zip = "2.0" ### rover specific dependencies [dependencies] anyhow = { workspace = true } -assert_fs = { workspace = true } -async-trait = { workspace = true } apollo-federation-types = { workspace = true } +apollo-language-server = { workspace = true } apollo-parser = { workspace = true } +assert_fs = { workspace = true } +async-trait = { workspace = true } billboard = { workspace = true } binstall = { workspace = true } buildstructor = { workspace = true } @@ -217,6 +224,7 @@ tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros", "proc tokio-stream = { workspace = true } toml = { workspace = true } tower = { workspace = true } +tower-lsp = { version = "0.20.0" } tracing = { workspace = true } which = { workspace = true } uuid = { workspace = true } diff --git a/src/cli.rs b/src/cli.rs index 89a204865..8ddfe8b4e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -235,6 +235,7 @@ impl Rover { Command::Explain(command) => command.run(), Command::PersistedQueries(command) => command.run(self.get_client_config()?).await, Command::License(command) => command.run(self.get_client_config()?).await, + Command::Lsp(command) => command.run(self.get_client_config()?).await, } } @@ -437,6 +438,9 @@ pub enum Command { /// Commands for fetching offline licenses License(command::License), + + /// Start the language server + Lsp(command::Lsp), } #[derive(Default, ValueEnum, Debug, Serialize, Clone, Copy, Eq, PartialEq)] diff --git a/src/command/lsp/README.md b/src/command/lsp/README.md new file mode 100644 index 000000000..355e93584 --- /dev/null +++ b/src/command/lsp/README.md @@ -0,0 +1,14 @@ +# Build / configuration + +1. Clone mdg-private/language-server repo (adjacent to this repo, the language + server dependency is currently specified as a path in Cargo.toml) + > apollo-language-server-core = { path = "../language-server/crates/language-server-core" } +2. From this repo, run `cargo update -p apollo-language-server-core` to + build/rebuild changes made to the language server. +3. To rebuild the rover binary, run `cargo build` +4. Build is located at `target/debug/rover` + +In case you're looking to sanity check the binary, there's a sample `input.txt` +file you can paste into stdin to see if the binary is working as expected. I'm +not sure why it breaks when I try to redirect the input from a file, but it +works as expected when I paste the contents of the file into stdin. diff --git a/src/command/lsp/input.txt b/src/command/lsp/input.txt new file mode 100644 index 000000000..bc938633e --- /dev/null +++ b/src/command/lsp/input.txt @@ -0,0 +1,9 @@ +Content-Length: 75 + +{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{}},"id":0}Content-Length: 185 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///path/to/file","version":1,"languageId":"apollo-graphql","text":"type Query { hello: Strin }"}}}Content-Length: 180 + +{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///path/to/file","version":2},"contentChanges":[{"text":"type Query { hello: String! }"}]}}Content-Length: 178 + +{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///path/to/file","version":3},"contentChanges":[{"text":"type Query { hello: Strin }"}]}}Content-Length: 0 \ No newline at end of file diff --git a/src/command/lsp/mod.rs b/src/command/lsp/mod.rs new file mode 100644 index 000000000..96c5166a0 --- /dev/null +++ b/src/command/lsp/mod.rs @@ -0,0 +1,162 @@ +use core::panic; + +use apollo_federation_types::{ + config::{FederationVersion, SupergraphConfig}, + javascript::SubgraphDefinition, + rover::BuildErrors, +}; +use apollo_language_server::{ApolloLanguageServer, Config}; +use clap::Parser; +use futures::{channel::mpsc::Receiver, StreamExt}; +use serde::Serialize; +use tower_lsp::Server; + +use super::supergraph::compose::Compose; +use crate::{ + options::PluginOpts, + utils::{ + client::StudioClientConfig, parsers::FileDescriptorType, + supergraph_config::resolve_supergraph_yaml, + }, + RoverOutput, RoverResult, +}; + +#[derive(Debug, Serialize, Parser)] +pub struct Lsp { + #[clap(flatten)] + pub(crate) opts: LspOpts, +} + +#[derive(Clone, Debug, Serialize, Parser)] +pub struct LspOpts { + #[clap(flatten)] + pub plugin_opts: PluginOpts, + + /// The relative path to the supergraph configuration file. You can pass `-` to use stdin instead of a file. + #[serde(skip_serializing)] + #[arg(long = "supergraph-config")] + supergraph_yaml: Option, +} + +impl Lsp { + pub async fn run(&self, client_config: StudioClientConfig) -> RoverResult { + self.opts + .plugin_opts + .prompt_for_license_accept(&client_config)?; + + run_lsp(client_config, &self.opts).await; + Ok(RoverOutput::EmptySuccess) + } +} + +async fn run_lsp(client_config: StudioClientConfig, lsp_opts: &LspOpts) { + let (service, socket, receiver) = ApolloLanguageServer::build_service(Config { + root_uri: "".into(), + enable_auto_composition: true, + force_federation: false, + disable_telemetry: false, + }); + + let language_server = service.inner().clone(); + + tokio::spawn(run_composer_in_thread( + receiver, + lsp_opts.clone(), + client_config, + language_server, + )); + + let stdin = tokio::io::stdin(); + let stdout = tokio::io::stdout(); + let server = Server::new(stdin, stdout, socket); + server.serve(service).await; +} + +async fn run_composer_in_thread( + mut receiver: Receiver>, + lsp_opts: LspOpts, + client_config: StudioClientConfig, + language_server: ApolloLanguageServer, +) { + let composer = Compose::new(lsp_opts.plugin_opts.clone()); + let federation_version = + dbg!(get_federation_version(lsp_opts.clone(), client_config.clone()).await); + match composer + .maybe_install_supergraph(None, client_config.clone(), federation_version.clone()) + .await + { + Ok(_) => {} + Err(err) => { + panic!("Failed to install supergraph plugin: {:?}", err); + } + }; + + while let Some(mut definitions) = receiver.next().await { + while let Some(next_definitions) = receiver.try_next().ok().flatten() { + definitions = next_definitions + } + tracing::info!("Received message: {:?}", definitions); + dbg!(&definitions); + + let mut supergraph_config = SupergraphConfig::from(definitions); + supergraph_config.set_federation_version(federation_version.clone()); + + match composer + .compose(None, client_config.clone(), &mut supergraph_config, None) + .await + { + Ok(RoverOutput::CompositionResult(composition_output)) => { + dbg!(&composition_output); + language_server + .composition_did_update( + Some(composition_output.supergraph_sdl), + composition_output + .hints + .into_iter() + .map(Into::into) + .collect(), + None, + ) + .await + } + Err(rover_error) => { + dbg!(&rover_error); + let build_errors: BuildErrors = rover_error.into(); + dbg!(&build_errors); + language_server + .composition_did_update( + None, + build_errors.into_iter().map(Into::into).collect(), + None, + ) + .await + } + _ => panic!("Expected CompositionResult"), + } + } +} + +async fn get_federation_version( + lsp_opts: LspOpts, + client_config: StudioClientConfig, +) -> FederationVersion { + if let Some(supergraph_yaml) = &lsp_opts.supergraph_yaml { + if let Ok(supergraph_config) = resolve_supergraph_yaml( + supergraph_yaml, + client_config.clone(), + &lsp_opts.plugin_opts.profile, + true, + ) + .await + { + supergraph_config + .get_federation_version() + .unwrap_or(FederationVersion::LatestFedTwo) + } else { + tracing::warn!("Failed to resolve supergraph yaml"); + FederationVersion::LatestFedTwo + } + } else { + FederationVersion::LatestFedTwo + } +} diff --git a/src/command/mod.rs b/src/command/mod.rs index 481cb9487..fbfb787cc 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -9,6 +9,7 @@ mod graph; mod info; pub(crate) mod install; mod license; +mod lsp; pub(crate) mod output; mod persisted_queries; mod readme; @@ -28,6 +29,7 @@ pub use graph::Graph; pub use info::Info; pub use install::Install; pub use license::License; +pub use lsp::Lsp; pub use output::RoverOutput; pub use persisted_queries::PersistedQueries; pub use readme::Readme; diff --git a/src/error/mod.rs b/src/error/mod.rs index 2ed9a0611..a00e80c9c 100644 --- a/src/error/mod.rs +++ b/src/error/mod.rs @@ -156,3 +156,15 @@ impl> From for RoverError { Self::new(error) } } + +impl From for BuildErrors { + fn from(rover_error: RoverError) -> Self { + match rover_error.error.downcast_ref::() { + Some(RoverClientError::BuildErrors { source, .. }) => BuildErrors { + build_errors: source.build_errors.clone(), + is_config: source.is_config, + }, + _ => panic!("Expected RoverClientError::BuildErrors"), + } + } +} From 88d7f6cd9c2306fd187c43d90f360f54af30ad00 Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Mon, 16 Sep 2024 10:03:07 -0700 Subject: [PATCH 2/5] update als --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e27969f9b..279f2fe6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "apollo-language-server" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb3d9bed62dab8e13c42a740754c4cbfa9c303343161095d9fb91073c153b54" +checksum = "4cbc734271268fcf9e542e0793f63db202036609ec562fce517075313a3cb4b7" dependencies = [ "apollo-compiler", "apollo-composition", diff --git a/Cargo.toml b/Cargo.toml index 4258cb4b7..1d4fc3f0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ apollo-federation-types = "0.14.1" # apollo-federation-types = { git = "https://github.com/apollographql/federation-rs.git", branch = "connectors"} # https://github.com/mdg-private/language-server -apollo-language-server = { version = "0.1.0", default-features = false, features = ["tokio"] } +apollo-language-server = { version = "0.1.1", default-features = false, features = ["tokio"] } # apollo-language-server = { path = "../language-server/crates/language-server-core", default-features = false, features = ["tokio"] } # crates.io dependencies From 11855d002c658f068867403daf7e4ce16aff5323 Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Mon, 16 Sep 2024 14:25:41 -0700 Subject: [PATCH 3/5] release: v0.27.0-alpha.0 --- Cargo.lock | 53 ++++++++----------- Cargo.toml | 2 +- crates/rover-client/package-lock.json | 18 +++---- installers/binstall/scripts/nix/install.sh | 2 +- .../binstall/scripts/windows/install.ps1 | 2 +- installers/npm/package-lock.json | 16 +++--- installers/npm/package.json | 2 +- 7 files changed, 44 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 279f2fe6c..5c24dec98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,9 +148,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "apollo-compiler" @@ -310,7 +310,7 @@ checksum = "44055e597c674aef7cb903b2b9f6e4cba1277ed0d2d61dae7cd52d7ffa81f8e2" dependencies = [ "concolor", "unicode-width", - "yansi 1.0.1", + "yansi", ] [[package]] @@ -503,9 +503,9 @@ dependencies = [ [[package]] name = "async-process" -version = "2.2.4" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel 2.3.1", "async-io", @@ -518,7 +518,6 @@ dependencies = [ "futures-lite", "rustix", "tracing", - "windows-sys 0.59.0", ] [[package]] @@ -1009,9 +1008,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.18" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" dependencies = [ "jobserver", "libc", @@ -2842,9 +2841,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3021,9 +3020,9 @@ checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "iri-string" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f5f6c2df22c009ac44f6f1499308e7a3ac7ba42cd2378475cc691510e1eef1b" +checksum = "3e0f755bd3806e06ad4f366f92639415d99a339a2c7ecf8c26ccea2097c11cb6" dependencies = [ "memchr", "serde", @@ -3998,9 +3997,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.1+3.3.1" +version = "300.3.2+3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" dependencies = [ "cc", ] @@ -4386,12 +4385,12 @@ dependencies = [ [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", - "yansi 0.5.1", + "yansi", ] [[package]] @@ -4552,9 +4551,9 @@ checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags 2.6.0", ] @@ -4770,7 +4769,7 @@ dependencies = [ [[package]] name = "rover" -version = "0.26.2" +version = "0.27.0-alpha.0" dependencies = [ "anyhow", "apollo-federation-types", @@ -5044,9 +5043,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.36" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -6471,9 +6470,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -7128,12 +7127,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "yansi" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 1d4fc3f0c..c469553b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license-file = "./LICENSE" name = "rover" readme = "README.md" repository = "https://github.com/apollographql/rover/" -version = "0.26.2" +version = "0.27.0-alpha.0" default-run = "rover" publish = false diff --git a/crates/rover-client/package-lock.json b/crates/rover-client/package-lock.json index 0937ec0ec..2671aab9e 100644 --- a/crates/rover-client/package-lock.json +++ b/crates/rover-client/package-lock.json @@ -448,9 +448,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", - "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", + "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", "dev": true, "license": "MIT", "engines": { @@ -1101,9 +1101,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "version": "22.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", + "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", "dev": true, "license": "MIT", "dependencies": { @@ -1511,9 +1511,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.18", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.18.tgz", - "integrity": "sha512-1OfuVACu+zKlmjsNdcJuVQuVE61sZOLbNM4JAQ1Rvh6EOj0/EUKhMJjRH73InPlXSh8HIJk1cVZ8pyOV/FMdUQ==", + "version": "1.5.23", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.23.tgz", + "integrity": "sha512-mBhODedOXg4v5QWwl21DjM5amzjmI1zw9EPrPK/5Wx7C8jt33bpZNrC7OhHUG3pxRtbLpr3W2dXT+Ph1SsfRZA==", "dev": true, "license": "ISC", "peer": true diff --git a/installers/binstall/scripts/nix/install.sh b/installers/binstall/scripts/nix/install.sh index db4b54d79..410d8931e 100755 --- a/installers/binstall/scripts/nix/install.sh +++ b/installers/binstall/scripts/nix/install.sh @@ -20,7 +20,7 @@ BINARY_DOWNLOAD_PREFIX="https://github.com/apollographql/rover/releases/download # Rover version defined in root cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -PACKAGE_VERSION="v0.26.2" +PACKAGE_VERSION="v0.27.0-alpha.0" download_binary_and_run_installer() { downloader --check diff --git a/installers/binstall/scripts/windows/install.ps1 b/installers/binstall/scripts/windows/install.ps1 index 543f74d6e..90163ef42 100644 --- a/installers/binstall/scripts/windows/install.ps1 +++ b/installers/binstall/scripts/windows/install.ps1 @@ -14,7 +14,7 @@ # version found in Rover's Cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -$package_version = 'v0.26.2' +$package_version = 'v0.27.0-alpha.0' function Install-Binary($rover_install_args) { $old_erroractionpreference = $ErrorActionPreference diff --git a/installers/npm/package-lock.json b/installers/npm/package-lock.json index 164c61bbd..c2f5065c7 100644 --- a/installers/npm/package-lock.json +++ b/installers/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "@apollo/rover", - "version": "0.26.2", + "version": "0.27.0-alpha.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@apollo/rover", - "version": "0.26.2", + "version": "0.27.0-alpha.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -1238,9 +1238,9 @@ } }, "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "version": "22.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", + "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", "dev": true, "license": "MIT", "dependencies": { @@ -1916,9 +1916,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.18", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.18.tgz", - "integrity": "sha512-1OfuVACu+zKlmjsNdcJuVQuVE61sZOLbNM4JAQ1Rvh6EOj0/EUKhMJjRH73InPlXSh8HIJk1cVZ8pyOV/FMdUQ==", + "version": "1.5.23", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.23.tgz", + "integrity": "sha512-mBhODedOXg4v5QWwl21DjM5amzjmI1zw9EPrPK/5Wx7C8jt33bpZNrC7OhHUG3pxRtbLpr3W2dXT+Ph1SsfRZA==", "dev": true, "license": "ISC" }, diff --git a/installers/npm/package.json b/installers/npm/package.json index a878e5392..daae9c41b 100644 --- a/installers/npm/package.json +++ b/installers/npm/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/rover", - "version": "0.26.2", + "version": "0.27.0-alpha.0", "description": "The new Apollo CLI", "main": "index.js", "bin": { From 62a06acd2c2cbf01e2ea2ce1e11ff02cfc73377e Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Mon, 16 Sep 2024 14:34:58 -0700 Subject: [PATCH 4/5] only build lsp mod with composition-js enabled --- src/cli.rs | 2 ++ src/command/mod.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index 8ddfe8b4e..79508e4cb 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -235,6 +235,7 @@ impl Rover { Command::Explain(command) => command.run(), Command::PersistedQueries(command) => command.run(self.get_client_config()?).await, Command::License(command) => command.run(self.get_client_config()?).await, + #[cfg(feature = "composition-js")] Command::Lsp(command) => command.run(self.get_client_config()?).await, } } @@ -440,6 +441,7 @@ pub enum Command { License(command::License), /// Start the language server + #[cfg(feature = "composition-js")] Lsp(command::Lsp), } diff --git a/src/command/mod.rs b/src/command/mod.rs index fbfb787cc..43b98059f 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -9,6 +9,7 @@ mod graph; mod info; pub(crate) mod install; mod license; +#[cfg(feature = "composition-js")] mod lsp; pub(crate) mod output; mod persisted_queries; @@ -29,6 +30,7 @@ pub use graph::Graph; pub use info::Info; pub use install::Install; pub use license::License; +#[cfg(feature = "composition-js")] pub use lsp::Lsp; pub use output::RoverOutput; pub use persisted_queries::PersistedQueries; From b011c6cbc751a40a5b6953d2a5426fae5ddb323a Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Mon, 16 Sep 2024 15:16:27 -0700 Subject: [PATCH 5/5] security + openssl fixes --- Cargo.lock | 4 ++-- deny.toml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c24dec98..ca04c6379 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3997,9 +3997,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.2+3.3.2" +version = "300.3.1+3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" dependencies = [ "cc", ] diff --git a/deny.toml b/deny.toml index 708521cef..aca4b27bd 100644 --- a/deny.toml +++ b/deny.toml @@ -58,6 +58,24 @@ version = "*" expression = "(Apache-2.0 OR MIT) AND BSD-3-Clause" license-files = [{ path = "COPYRIGHT", hash = 0x39f8ad31 }] +[[licenses.clarify]] +name = "apollo-language-server" +version = "*" +expression = "Elastic-2.0" +license-files = [{ path = "LICENSE.md", hash = 0x5fc4a573 }] + +[[licenses.exceptions]] +name = "apollo-language-server" +allow = ["Elastic-2.0"] + +[[licenses.exceptions]] +name = "apollo-federation" +allow = ["Elastic-2.0"] + +[[licenses.exceptions]] +name = "apollo-composition" +allow = ["Elastic-2.0"] + # This section is considered when running `cargo deny check bans`. # More documentation about the 'bans' section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html