├── .gitignore ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── NOTICE.md ├── README.md ├── assets └── 1.png ├── docs ├── README.md ├── index.md └── parsers.md ├── examples └── README.md └── src ├── check.rs ├── config.rs ├── formatters ├── mod.rs ├── porcelain.rs ├── single_line.rs └── terminal.rs ├── info.rs ├── lib.rs ├── main.rs ├── parsers ├── javascript │ ├── comment_parser.rs │ ├── mod.rs │ ├── parser.rs │ └── visitor.rs ├── mod.rs ├── rust │ ├── mod.rs │ ├── parser.rs │ ├── tools.rs │ └── visitor.rs └── types.rs ├── sync.rs └── tools.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.0] 4 | 5 | ### Changed 6 | 7 | - Files in .gitignore are no longer checked for out of sync comments 8 | 9 | ## [1.0.0] 10 | 11 | ### Added 12 | 13 | - Added internal database for faster subsequent runs 14 | - Javscript/Typescript support 15 | 16 | ### Changed 17 | 18 | - Changed parser format to take in PathBuf instead of contents of file directly 19 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "Inflector" 7 | version = "0.11.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" 10 | dependencies = [ 11 | "lazy_static", 12 | "regex", 13 | ] 14 | 15 | [[package]] 16 | name = "adler" 17 | version = "1.0.2" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 20 | 21 | [[package]] 22 | name = "ahash" 23 | version = "0.7.6" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 26 | dependencies = [ 27 | "getrandom", 28 | "once_cell", 29 | "version_check", 30 | ] 31 | 32 | [[package]] 33 | name = "aho-corasick" 34 | version = "0.7.18" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" 37 | dependencies = [ 38 | "memchr", 39 | ] 40 | 41 | [[package]] 42 | name = "ansi_colours" 43 | version = "1.1.1" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "32678233b67f9056b0c144b39d46dc3218637e8d84ad6038ded339e08b19620d" 46 | dependencies = [ 47 | "rgb", 48 | ] 49 | 50 | [[package]] 51 | name = "ansi_term" 52 | version = "0.12.1" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 55 | dependencies = [ 56 | "winapi", 57 | ] 58 | 59 | [[package]] 60 | name = "arrayvec" 61 | version = "0.5.2" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 64 | 65 | [[package]] 66 | name = "ast_node" 67 | version = "0.7.7" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "bc4c00309ed1c8104732df4a5fa9acc3b796b6f8531dfbd5ce0078c86f997244" 70 | dependencies = [ 71 | "darling", 72 | "pmutil", 73 | "proc-macro2", 74 | "quote", 75 | "swc_macros_common", 76 | "syn", 77 | ] 78 | 79 | [[package]] 80 | name = "atty" 81 | version = "0.2.14" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 84 | dependencies = [ 85 | "hermit-abi", 86 | "libc", 87 | "winapi", 88 | ] 89 | 90 | [[package]] 91 | name = "autocfg" 92 | version = "1.1.0" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 95 | 96 | [[package]] 97 | name = "base64" 98 | version = "0.13.0" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 101 | 102 | [[package]] 103 | name = "bat" 104 | version = "0.21.0" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "fd1212d80800b3d7614b3725e0b2ee3b45b2b7484805d54b5660c8fa6f706305" 107 | dependencies = [ 108 | "ansi_colours", 109 | "ansi_term", 110 | "atty", 111 | "bincode", 112 | "bugreport", 113 | "bytesize", 114 | "clap 2.34.0", 115 | "clircle", 116 | "console", 117 | "content_inspector", 118 | "dirs-next", 119 | "encoding", 120 | "flate2", 121 | "git2", 122 | "globset", 123 | "grep-cli", 124 | "once_cell", 125 | "path_abs", 126 | "regex", 127 | "semver", 128 | "serde", 129 | "serde_yaml", 130 | "shell-words", 131 | "syntect", 132 | "thiserror", 133 | "unicode-width", 134 | "walkdir", 135 | "wild", 136 | ] 137 | 138 | [[package]] 139 | name = "better_scoped_tls" 140 | version = "0.1.0" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "b73e8ecdec39e98aa3b19e8cd0b8ed8f77ccb86a6b0b2dc7cd86d105438a2123" 143 | dependencies = [ 144 | "scoped-tls", 145 | ] 146 | 147 | [[package]] 148 | name = "bincode" 149 | version = "1.3.3" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 152 | dependencies = [ 153 | "serde", 154 | ] 155 | 156 | [[package]] 157 | name = "bitflags" 158 | version = "1.3.2" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 161 | 162 | [[package]] 163 | name = "bstr" 164 | version = "0.2.17" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" 167 | dependencies = [ 168 | "lazy_static", 169 | "memchr", 170 | "regex-automata", 171 | ] 172 | 173 | [[package]] 174 | name = "bugreport" 175 | version = "0.5.0" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9" 178 | dependencies = [ 179 | "git-version", 180 | "shell-escape", 181 | "sys-info", 182 | ] 183 | 184 | [[package]] 185 | name = "bytecheck" 186 | version = "0.6.8" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "3a31f923c2db9513e4298b72df143e6e655a759b3d6a0966df18f81223fff54f" 189 | dependencies = [ 190 | "bytecheck_derive", 191 | "ptr_meta", 192 | ] 193 | 194 | [[package]] 195 | name = "bytecheck_derive" 196 | version = "0.6.8" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "edb17c862a905d912174daa27ae002326fff56dc8b8ada50a0a5f0976cb174f0" 199 | dependencies = [ 200 | "proc-macro2", 201 | "quote", 202 | "syn", 203 | ] 204 | 205 | [[package]] 206 | name = "bytecount" 207 | version = "0.6.3" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" 210 | 211 | [[package]] 212 | name = "bytemuck" 213 | version = "1.9.1" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" 216 | 217 | [[package]] 218 | name = "bytesize" 219 | version = "1.1.0" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70" 222 | 223 | [[package]] 224 | name = "cc" 225 | version = "1.0.73" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 228 | dependencies = [ 229 | "jobserver", 230 | ] 231 | 232 | [[package]] 233 | name = "cfg-if" 234 | version = "1.0.0" 235 | source = "registry+https://github.com/rust-lang/crates.io-index" 236 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 237 | 238 | [[package]] 239 | name = "clap" 240 | version = "2.34.0" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 243 | dependencies = [ 244 | "ansi_term", 245 | "atty", 246 | "bitflags", 247 | "strsim 0.8.0", 248 | "term_size", 249 | "textwrap 0.11.0", 250 | "unicode-width", 251 | "vec_map", 252 | ] 253 | 254 | [[package]] 255 | name = "clap" 256 | version = "3.2.6" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "9f1fe12880bae935d142c8702d500c63a4e8634b6c3c57ad72bf978fc7b6249a" 259 | dependencies = [ 260 | "atty", 261 | "bitflags", 262 | "clap_lex", 263 | "indexmap", 264 | "strsim 0.10.0", 265 | "termcolor", 266 | "textwrap 0.15.0", 267 | ] 268 | 269 | [[package]] 270 | name = "clap_lex" 271 | version = "0.2.3" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "87eba3c8c7f42ef17f6c659fc7416d0f4758cd3e58861ee63c5fa4a4dde649e4" 274 | dependencies = [ 275 | "os_str_bytes", 276 | ] 277 | 278 | [[package]] 279 | name = "clircle" 280 | version = "0.3.0" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "e68bbd985a63de680ab4d1ad77b6306611a8f961b282c8b5ab513e6de934e396" 283 | dependencies = [ 284 | "cfg-if", 285 | "libc", 286 | "serde", 287 | "winapi", 288 | ] 289 | 290 | [[package]] 291 | name = "colored" 292 | version = "2.0.0" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" 295 | dependencies = [ 296 | "atty", 297 | "lazy_static", 298 | "winapi", 299 | ] 300 | 301 | [[package]] 302 | name = "console" 303 | version = "0.15.0" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31" 306 | dependencies = [ 307 | "encode_unicode", 308 | "libc", 309 | "once_cell", 310 | "regex", 311 | "terminal_size", 312 | "unicode-width", 313 | "winapi", 314 | ] 315 | 316 | [[package]] 317 | name = "content_inspector" 318 | version = "0.2.4" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" 321 | dependencies = [ 322 | "memchr", 323 | ] 324 | 325 | [[package]] 326 | name = "crc32fast" 327 | version = "1.3.2" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 330 | dependencies = [ 331 | "cfg-if", 332 | ] 333 | 334 | [[package]] 335 | name = "darling" 336 | version = "0.10.2" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" 339 | dependencies = [ 340 | "darling_core", 341 | "darling_macro", 342 | ] 343 | 344 | [[package]] 345 | name = "darling_core" 346 | version = "0.10.2" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" 349 | dependencies = [ 350 | "fnv", 351 | "ident_case", 352 | "proc-macro2", 353 | "quote", 354 | "strsim 0.9.3", 355 | "syn", 356 | ] 357 | 358 | [[package]] 359 | name = "darling_macro" 360 | version = "0.10.2" 361 | source = "registry+https://github.com/rust-lang/crates.io-index" 362 | checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" 363 | dependencies = [ 364 | "darling_core", 365 | "quote", 366 | "syn", 367 | ] 368 | 369 | [[package]] 370 | name = "debug_unreachable" 371 | version = "0.1.1" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" 374 | dependencies = [ 375 | "unreachable", 376 | ] 377 | 378 | [[package]] 379 | name = "dirs" 380 | version = "4.0.0" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" 383 | dependencies = [ 384 | "dirs-sys", 385 | ] 386 | 387 | [[package]] 388 | name = "dirs-next" 389 | version = "2.0.0" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" 392 | dependencies = [ 393 | "cfg-if", 394 | "dirs-sys-next", 395 | ] 396 | 397 | [[package]] 398 | name = "dirs-sys" 399 | version = "0.3.7" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 402 | dependencies = [ 403 | "libc", 404 | "redox_users", 405 | "winapi", 406 | ] 407 | 408 | [[package]] 409 | name = "dirs-sys-next" 410 | version = "0.1.2" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" 413 | dependencies = [ 414 | "libc", 415 | "redox_users", 416 | "winapi", 417 | ] 418 | 419 | [[package]] 420 | name = "either" 421 | version = "1.6.1" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" 424 | 425 | [[package]] 426 | name = "encode_unicode" 427 | version = "0.3.6" 428 | source = "registry+https://github.com/rust-lang/crates.io-index" 429 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 430 | 431 | [[package]] 432 | name = "encoding" 433 | version = "0.2.33" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" 436 | dependencies = [ 437 | "encoding-index-japanese", 438 | "encoding-index-korean", 439 | "encoding-index-simpchinese", 440 | "encoding-index-singlebyte", 441 | "encoding-index-tradchinese", 442 | ] 443 | 444 | [[package]] 445 | name = "encoding-index-japanese" 446 | version = "1.20141219.5" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" 449 | dependencies = [ 450 | "encoding_index_tests", 451 | ] 452 | 453 | [[package]] 454 | name = "encoding-index-korean" 455 | version = "1.20141219.5" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" 458 | dependencies = [ 459 | "encoding_index_tests", 460 | ] 461 | 462 | [[package]] 463 | name = "encoding-index-simpchinese" 464 | version = "1.20141219.5" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" 467 | dependencies = [ 468 | "encoding_index_tests", 469 | ] 470 | 471 | [[package]] 472 | name = "encoding-index-singlebyte" 473 | version = "1.20141219.5" 474 | source = "registry+https://github.com/rust-lang/crates.io-index" 475 | checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" 476 | dependencies = [ 477 | "encoding_index_tests", 478 | ] 479 | 480 | [[package]] 481 | name = "encoding-index-tradchinese" 482 | version = "1.20141219.5" 483 | source = "registry+https://github.com/rust-lang/crates.io-index" 484 | checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" 485 | dependencies = [ 486 | "encoding_index_tests", 487 | ] 488 | 489 | [[package]] 490 | name = "encoding_index_tests" 491 | version = "0.1.4" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" 494 | 495 | [[package]] 496 | name = "enum_kind" 497 | version = "0.2.1" 498 | source = "registry+https://github.com/rust-lang/crates.io-index" 499 | checksum = "78b940da354ae81ef0926c5eaa428207b8f4f091d3956c891dfbd124162bed99" 500 | dependencies = [ 501 | "pmutil", 502 | "proc-macro2", 503 | "swc_macros_common", 504 | "syn", 505 | ] 506 | 507 | [[package]] 508 | name = "erasable" 509 | version = "1.2.1" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "5f11890ce181d47a64e5d1eb4b6caba0e7bae911a356723740d058a5d0340b7d" 512 | dependencies = [ 513 | "autocfg", 514 | "scopeguard", 515 | ] 516 | 517 | [[package]] 518 | name = "flate2" 519 | version = "1.0.24" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" 522 | dependencies = [ 523 | "crc32fast", 524 | "miniz_oxide", 525 | ] 526 | 527 | [[package]] 528 | name = "fnv" 529 | version = "1.0.7" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 532 | 533 | [[package]] 534 | name = "form_urlencoded" 535 | version = "1.0.1" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 538 | dependencies = [ 539 | "matches", 540 | "percent-encoding", 541 | ] 542 | 543 | [[package]] 544 | name = "from_variant" 545 | version = "0.1.3" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "0951635027ca477be98f8774abd6f0345233439d63f307e47101acb40c7cc63d" 548 | dependencies = [ 549 | "pmutil", 550 | "proc-macro2", 551 | "swc_macros_common", 552 | "syn", 553 | ] 554 | 555 | [[package]] 556 | name = "getrandom" 557 | version = "0.2.7" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" 560 | dependencies = [ 561 | "cfg-if", 562 | "libc", 563 | "wasi", 564 | ] 565 | 566 | [[package]] 567 | name = "git-version" 568 | version = "0.3.5" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899" 571 | dependencies = [ 572 | "git-version-macro", 573 | "proc-macro-hack", 574 | ] 575 | 576 | [[package]] 577 | name = "git-version-macro" 578 | version = "0.3.5" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f" 581 | dependencies = [ 582 | "proc-macro-hack", 583 | "proc-macro2", 584 | "quote", 585 | "syn", 586 | ] 587 | 588 | [[package]] 589 | name = "git2" 590 | version = "0.14.2" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c" 593 | dependencies = [ 594 | "bitflags", 595 | "libc", 596 | "libgit2-sys", 597 | "log", 598 | "openssl-probe", 599 | "openssl-sys", 600 | "url", 601 | ] 602 | 603 | [[package]] 604 | name = "glob" 605 | version = "0.3.0" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 608 | 609 | [[package]] 610 | name = "globset" 611 | version = "0.4.9" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" 614 | dependencies = [ 615 | "aho-corasick", 616 | "bstr", 617 | "fnv", 618 | "log", 619 | "regex", 620 | ] 621 | 622 | [[package]] 623 | name = "grep-cli" 624 | version = "0.1.6" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "2dd110c34bb4460d0de5062413b773e385cbf8a85a63fc535590110a09e79e8a" 627 | dependencies = [ 628 | "atty", 629 | "bstr", 630 | "globset", 631 | "lazy_static", 632 | "log", 633 | "regex", 634 | "same-file", 635 | "termcolor", 636 | "winapi-util", 637 | ] 638 | 639 | [[package]] 640 | name = "half" 641 | version = "1.8.2" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" 644 | 645 | [[package]] 646 | name = "hashbrown" 647 | version = "0.9.1" 648 | source = "registry+https://github.com/rust-lang/crates.io-index" 649 | checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" 650 | 651 | [[package]] 652 | name = "hashbrown" 653 | version = "0.12.1" 654 | source = "registry+https://github.com/rust-lang/crates.io-index" 655 | checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" 656 | dependencies = [ 657 | "ahash", 658 | ] 659 | 660 | [[package]] 661 | name = "hermit-abi" 662 | version = "0.1.19" 663 | source = "registry+https://github.com/rust-lang/crates.io-index" 664 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 665 | dependencies = [ 666 | "libc", 667 | ] 668 | 669 | [[package]] 670 | name = "ident_case" 671 | version = "1.0.1" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 674 | 675 | [[package]] 676 | name = "idna" 677 | version = "0.2.3" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 680 | dependencies = [ 681 | "matches", 682 | "unicode-bidi", 683 | "unicode-normalization", 684 | ] 685 | 686 | [[package]] 687 | name = "indexmap" 688 | version = "1.9.1" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" 691 | dependencies = [ 692 | "autocfg", 693 | "hashbrown 0.12.1", 694 | ] 695 | 696 | [[package]] 697 | name = "is-macro" 698 | version = "0.2.1" 699 | source = "registry+https://github.com/rust-lang/crates.io-index" 700 | checksum = "1c068d4c6b922cd6284c609cfa6dec0e41615c9c5a1a4ba729a970d8daba05fb" 701 | dependencies = [ 702 | "Inflector", 703 | "pmutil", 704 | "proc-macro2", 705 | "quote", 706 | "syn", 707 | ] 708 | 709 | [[package]] 710 | name = "itoa" 711 | version = "1.0.2" 712 | source = "registry+https://github.com/rust-lang/crates.io-index" 713 | checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" 714 | 715 | [[package]] 716 | name = "jobserver" 717 | version = "0.1.24" 718 | source = "registry+https://github.com/rust-lang/crates.io-index" 719 | checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" 720 | dependencies = [ 721 | "libc", 722 | ] 723 | 724 | [[package]] 725 | name = "lazy_static" 726 | version = "1.4.0" 727 | source = "registry+https://github.com/rust-lang/crates.io-index" 728 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 729 | 730 | [[package]] 731 | name = "lexical" 732 | version = "5.2.2" 733 | source = "registry+https://github.com/rust-lang/crates.io-index" 734 | checksum = "f404a90a744e32e8be729034fc33b90cf2a56418fbf594d69aa3c0214ad414e5" 735 | dependencies = [ 736 | "cfg-if", 737 | "lexical-core 0.7.6", 738 | ] 739 | 740 | [[package]] 741 | name = "lexical" 742 | version = "6.1.1" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6" 745 | dependencies = [ 746 | "lexical-core 0.8.5", 747 | ] 748 | 749 | [[package]] 750 | name = "lexical-core" 751 | version = "0.7.6" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" 754 | dependencies = [ 755 | "arrayvec", 756 | "bitflags", 757 | "cfg-if", 758 | "ryu", 759 | "static_assertions", 760 | ] 761 | 762 | [[package]] 763 | name = "lexical-core" 764 | version = "0.8.5" 765 | source = "registry+https://github.com/rust-lang/crates.io-index" 766 | checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" 767 | dependencies = [ 768 | "lexical-parse-float", 769 | "lexical-parse-integer", 770 | "lexical-util", 771 | "lexical-write-float", 772 | "lexical-write-integer", 773 | ] 774 | 775 | [[package]] 776 | name = "lexical-parse-float" 777 | version = "0.8.5" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" 780 | dependencies = [ 781 | "lexical-parse-integer", 782 | "lexical-util", 783 | "static_assertions", 784 | ] 785 | 786 | [[package]] 787 | name = "lexical-parse-integer" 788 | version = "0.8.6" 789 | source = "registry+https://github.com/rust-lang/crates.io-index" 790 | checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" 791 | dependencies = [ 792 | "lexical-util", 793 | "static_assertions", 794 | ] 795 | 796 | [[package]] 797 | name = "lexical-util" 798 | version = "0.8.5" 799 | source = "registry+https://github.com/rust-lang/crates.io-index" 800 | checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" 801 | dependencies = [ 802 | "static_assertions", 803 | ] 804 | 805 | [[package]] 806 | name = "lexical-write-float" 807 | version = "0.8.5" 808 | source = "registry+https://github.com/rust-lang/crates.io-index" 809 | checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" 810 | dependencies = [ 811 | "lexical-util", 812 | "lexical-write-integer", 813 | "static_assertions", 814 | ] 815 | 816 | [[package]] 817 | name = "lexical-write-integer" 818 | version = "0.8.5" 819 | source = "registry+https://github.com/rust-lang/crates.io-index" 820 | checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" 821 | dependencies = [ 822 | "lexical-util", 823 | "static_assertions", 824 | ] 825 | 826 | [[package]] 827 | name = "libc" 828 | version = "0.2.126" 829 | source = "registry+https://github.com/rust-lang/crates.io-index" 830 | checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" 831 | 832 | [[package]] 833 | name = "libgit2-sys" 834 | version = "0.13.2+1.4.2" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b" 837 | dependencies = [ 838 | "cc", 839 | "libc", 840 | "libssh2-sys", 841 | "libz-sys", 842 | "openssl-sys", 843 | "pkg-config", 844 | ] 845 | 846 | [[package]] 847 | name = "libssh2-sys" 848 | version = "0.2.23" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" 851 | dependencies = [ 852 | "cc", 853 | "libc", 854 | "libz-sys", 855 | "openssl-sys", 856 | "pkg-config", 857 | "vcpkg", 858 | ] 859 | 860 | [[package]] 861 | name = "libz-sys" 862 | version = "1.1.8" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" 865 | dependencies = [ 866 | "cc", 867 | "libc", 868 | "pkg-config", 869 | "vcpkg", 870 | ] 871 | 872 | [[package]] 873 | name = "line-wrap" 874 | version = "0.1.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" 877 | dependencies = [ 878 | "safemem", 879 | ] 880 | 881 | [[package]] 882 | name = "linked-hash-map" 883 | version = "0.5.4" 884 | source = "registry+https://github.com/rust-lang/crates.io-index" 885 | checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" 886 | 887 | [[package]] 888 | name = "lock_api" 889 | version = "0.4.7" 890 | source = "registry+https://github.com/rust-lang/crates.io-index" 891 | checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" 892 | dependencies = [ 893 | "autocfg", 894 | "scopeguard", 895 | ] 896 | 897 | [[package]] 898 | name = "log" 899 | version = "0.4.17" 900 | source = "registry+https://github.com/rust-lang/crates.io-index" 901 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 902 | dependencies = [ 903 | "cfg-if", 904 | ] 905 | 906 | [[package]] 907 | name = "matches" 908 | version = "0.1.9" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 911 | 912 | [[package]] 913 | name = "memchr" 914 | version = "2.5.0" 915 | source = "registry+https://github.com/rust-lang/crates.io-index" 916 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 917 | 918 | [[package]] 919 | name = "minimal-lexical" 920 | version = "0.2.1" 921 | source = "registry+https://github.com/rust-lang/crates.io-index" 922 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 923 | 924 | [[package]] 925 | name = "miniz_oxide" 926 | version = "0.5.3" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" 929 | dependencies = [ 930 | "adler", 931 | ] 932 | 933 | [[package]] 934 | name = "new_debug_unreachable" 935 | version = "1.0.4" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" 938 | 939 | [[package]] 940 | name = "nom" 941 | version = "7.1.1" 942 | source = "registry+https://github.com/rust-lang/crates.io-index" 943 | checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" 944 | dependencies = [ 945 | "memchr", 946 | "minimal-lexical", 947 | ] 948 | 949 | [[package]] 950 | name = "nom_locate" 951 | version = "4.0.0" 952 | source = "registry+https://github.com/rust-lang/crates.io-index" 953 | checksum = "37794436ca3029a3089e0b95d42da1f0b565ad271e4d3bb4bad0c7bb70b10605" 954 | dependencies = [ 955 | "bytecount", 956 | "memchr", 957 | "nom", 958 | ] 959 | 960 | [[package]] 961 | name = "num-bigint" 962 | version = "0.3.3" 963 | source = "registry+https://github.com/rust-lang/crates.io-index" 964 | checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" 965 | dependencies = [ 966 | "autocfg", 967 | "num-integer", 968 | "num-traits", 969 | ] 970 | 971 | [[package]] 972 | name = "num-bigint" 973 | version = "0.4.3" 974 | source = "registry+https://github.com/rust-lang/crates.io-index" 975 | checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" 976 | dependencies = [ 977 | "autocfg", 978 | "num-integer", 979 | "num-traits", 980 | "serde", 981 | ] 982 | 983 | [[package]] 984 | name = "num-integer" 985 | version = "0.1.45" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 988 | dependencies = [ 989 | "autocfg", 990 | "num-traits", 991 | ] 992 | 993 | [[package]] 994 | name = "num-traits" 995 | version = "0.2.15" 996 | source = "registry+https://github.com/rust-lang/crates.io-index" 997 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 998 | dependencies = [ 999 | "autocfg", 1000 | ] 1001 | 1002 | [[package]] 1003 | name = "num_threads" 1004 | version = "0.1.6" 1005 | source = "registry+https://github.com/rust-lang/crates.io-index" 1006 | checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" 1007 | dependencies = [ 1008 | "libc", 1009 | ] 1010 | 1011 | [[package]] 1012 | name = "once_cell" 1013 | version = "1.12.0" 1014 | source = "registry+https://github.com/rust-lang/crates.io-index" 1015 | checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" 1016 | 1017 | [[package]] 1018 | name = "onig" 1019 | version = "6.3.1" 1020 | source = "registry+https://github.com/rust-lang/crates.io-index" 1021 | checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" 1022 | dependencies = [ 1023 | "bitflags", 1024 | "lazy_static", 1025 | "libc", 1026 | "onig_sys", 1027 | ] 1028 | 1029 | [[package]] 1030 | name = "onig_sys" 1031 | version = "69.7.1" 1032 | source = "registry+https://github.com/rust-lang/crates.io-index" 1033 | checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" 1034 | dependencies = [ 1035 | "cc", 1036 | "pkg-config", 1037 | ] 1038 | 1039 | [[package]] 1040 | name = "openssl-probe" 1041 | version = "0.1.5" 1042 | source = "registry+https://github.com/rust-lang/crates.io-index" 1043 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 1044 | 1045 | [[package]] 1046 | name = "openssl-sys" 1047 | version = "0.9.74" 1048 | source = "registry+https://github.com/rust-lang/crates.io-index" 1049 | checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" 1050 | dependencies = [ 1051 | "autocfg", 1052 | "cc", 1053 | "libc", 1054 | "pkg-config", 1055 | "vcpkg", 1056 | ] 1057 | 1058 | [[package]] 1059 | name = "os_str_bytes" 1060 | version = "6.1.0" 1061 | source = "registry+https://github.com/rust-lang/crates.io-index" 1062 | checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" 1063 | 1064 | [[package]] 1065 | name = "parking_lot" 1066 | version = "0.12.1" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 1069 | dependencies = [ 1070 | "lock_api", 1071 | "parking_lot_core", 1072 | ] 1073 | 1074 | [[package]] 1075 | name = "parking_lot_core" 1076 | version = "0.9.3" 1077 | source = "registry+https://github.com/rust-lang/crates.io-index" 1078 | checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" 1079 | dependencies = [ 1080 | "cfg-if", 1081 | "libc", 1082 | "redox_syscall", 1083 | "smallvec", 1084 | "windows-sys", 1085 | ] 1086 | 1087 | [[package]] 1088 | name = "path_abs" 1089 | version = "0.5.1" 1090 | source = "registry+https://github.com/rust-lang/crates.io-index" 1091 | checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3" 1092 | dependencies = [ 1093 | "std_prelude", 1094 | ] 1095 | 1096 | [[package]] 1097 | name = "pathdiff" 1098 | version = "0.2.1" 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" 1100 | checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" 1101 | 1102 | [[package]] 1103 | name = "percent-encoding" 1104 | version = "2.1.0" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 1107 | 1108 | [[package]] 1109 | name = "phf_generator" 1110 | version = "0.10.0" 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" 1112 | checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" 1113 | dependencies = [ 1114 | "phf_shared", 1115 | "rand", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "phf_shared" 1120 | version = "0.10.0" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" 1123 | dependencies = [ 1124 | "siphasher", 1125 | ] 1126 | 1127 | [[package]] 1128 | name = "pickledb" 1129 | version = "0.4.1" 1130 | source = "registry+https://github.com/rust-lang/crates.io-index" 1131 | checksum = "9161694d67f6c5163519d42be942ae36bbdb55f439460144f105bc4f9f7d1d61" 1132 | dependencies = [ 1133 | "bincode", 1134 | "serde", 1135 | "serde_cbor", 1136 | "serde_json", 1137 | "serde_yaml", 1138 | ] 1139 | 1140 | [[package]] 1141 | name = "pin-project-lite" 1142 | version = "0.2.9" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 1145 | 1146 | [[package]] 1147 | name = "pkg-config" 1148 | version = "0.3.25" 1149 | source = "registry+https://github.com/rust-lang/crates.io-index" 1150 | checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" 1151 | 1152 | [[package]] 1153 | name = "plist" 1154 | version = "1.3.1" 1155 | source = "registry+https://github.com/rust-lang/crates.io-index" 1156 | checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" 1157 | dependencies = [ 1158 | "base64", 1159 | "indexmap", 1160 | "line-wrap", 1161 | "serde", 1162 | "time", 1163 | "xml-rs", 1164 | ] 1165 | 1166 | [[package]] 1167 | name = "pmutil" 1168 | version = "0.5.3" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004" 1171 | dependencies = [ 1172 | "proc-macro2", 1173 | "quote", 1174 | "syn", 1175 | ] 1176 | 1177 | [[package]] 1178 | name = "ppv-lite86" 1179 | version = "0.2.16" 1180 | source = "registry+https://github.com/rust-lang/crates.io-index" 1181 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 1182 | 1183 | [[package]] 1184 | name = "precomputed-hash" 1185 | version = "0.1.1" 1186 | source = "registry+https://github.com/rust-lang/crates.io-index" 1187 | checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" 1188 | 1189 | [[package]] 1190 | name = "proc-macro-hack" 1191 | version = "0.5.19" 1192 | source = "registry+https://github.com/rust-lang/crates.io-index" 1193 | checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" 1194 | 1195 | [[package]] 1196 | name = "proc-macro2" 1197 | version = "1.0.40" 1198 | source = "registry+https://github.com/rust-lang/crates.io-index" 1199 | checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" 1200 | dependencies = [ 1201 | "unicode-ident", 1202 | ] 1203 | 1204 | [[package]] 1205 | name = "ptr_meta" 1206 | version = "0.1.4" 1207 | source = "registry+https://github.com/rust-lang/crates.io-index" 1208 | checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" 1209 | dependencies = [ 1210 | "ptr_meta_derive", 1211 | ] 1212 | 1213 | [[package]] 1214 | name = "ptr_meta_derive" 1215 | version = "0.1.4" 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" 1217 | checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" 1218 | dependencies = [ 1219 | "proc-macro2", 1220 | "quote", 1221 | "syn", 1222 | ] 1223 | 1224 | [[package]] 1225 | name = "quote" 1226 | version = "1.0.20" 1227 | source = "registry+https://github.com/rust-lang/crates.io-index" 1228 | checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" 1229 | dependencies = [ 1230 | "proc-macro2", 1231 | ] 1232 | 1233 | [[package]] 1234 | name = "rand" 1235 | version = "0.8.5" 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" 1237 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1238 | dependencies = [ 1239 | "libc", 1240 | "rand_chacha", 1241 | "rand_core", 1242 | ] 1243 | 1244 | [[package]] 1245 | name = "rand_chacha" 1246 | version = "0.3.1" 1247 | source = "registry+https://github.com/rust-lang/crates.io-index" 1248 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1249 | dependencies = [ 1250 | "ppv-lite86", 1251 | "rand_core", 1252 | ] 1253 | 1254 | [[package]] 1255 | name = "rand_core" 1256 | version = "0.6.3" 1257 | source = "registry+https://github.com/rust-lang/crates.io-index" 1258 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 1259 | dependencies = [ 1260 | "getrandom", 1261 | ] 1262 | 1263 | [[package]] 1264 | name = "redox_syscall" 1265 | version = "0.2.13" 1266 | source = "registry+https://github.com/rust-lang/crates.io-index" 1267 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" 1268 | dependencies = [ 1269 | "bitflags", 1270 | ] 1271 | 1272 | [[package]] 1273 | name = "redox_users" 1274 | version = "0.4.3" 1275 | source = "registry+https://github.com/rust-lang/crates.io-index" 1276 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 1277 | dependencies = [ 1278 | "getrandom", 1279 | "redox_syscall", 1280 | "thiserror", 1281 | ] 1282 | 1283 | [[package]] 1284 | name = "regex" 1285 | version = "1.5.6" 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" 1287 | checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" 1288 | dependencies = [ 1289 | "aho-corasick", 1290 | "memchr", 1291 | "regex-syntax", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "regex-automata" 1296 | version = "0.1.10" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 1299 | 1300 | [[package]] 1301 | name = "regex-syntax" 1302 | version = "0.6.26" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" 1305 | 1306 | [[package]] 1307 | name = "rend" 1308 | version = "0.3.6" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95" 1311 | dependencies = [ 1312 | "bytecheck", 1313 | ] 1314 | 1315 | [[package]] 1316 | name = "resync" 1317 | version = "0.2.0" 1318 | dependencies = [ 1319 | "aho-corasick", 1320 | "bat", 1321 | "clap 3.2.6", 1322 | "dirs", 1323 | "git2", 1324 | "nom", 1325 | "nom_locate", 1326 | "pathdiff", 1327 | "pickledb", 1328 | "proc-macro2", 1329 | "quote", 1330 | "rslint_parser", 1331 | "serde", 1332 | "swc_common", 1333 | "swc_ecma_ast", 1334 | "swc_ecma_parser", 1335 | "swc_ecma_visit", 1336 | "syn", 1337 | "walkdir", 1338 | ] 1339 | 1340 | [[package]] 1341 | name = "rgb" 1342 | version = "0.8.33" 1343 | source = "registry+https://github.com/rust-lang/crates.io-index" 1344 | checksum = "c3b221de559e4a29df3b957eec92bc0de6bc8eaf6ca9cfed43e5e1d67ff65a34" 1345 | dependencies = [ 1346 | "bytemuck", 1347 | ] 1348 | 1349 | [[package]] 1350 | name = "rkyv" 1351 | version = "0.7.38" 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" 1353 | checksum = "517a3034eb2b1499714e9d1e49b2367ad567e07639b69776d35e259d9c27cca6" 1354 | dependencies = [ 1355 | "bytecheck", 1356 | "hashbrown 0.12.1", 1357 | "ptr_meta", 1358 | "rend", 1359 | "rkyv_derive", 1360 | "seahash", 1361 | ] 1362 | 1363 | [[package]] 1364 | name = "rkyv_derive" 1365 | version = "0.7.38" 1366 | source = "registry+https://github.com/rust-lang/crates.io-index" 1367 | checksum = "505c209ee04111a006431abf39696e640838364d67a107c559ababaf6fd8c9dd" 1368 | dependencies = [ 1369 | "proc-macro2", 1370 | "quote", 1371 | "syn", 1372 | ] 1373 | 1374 | [[package]] 1375 | name = "rowan" 1376 | version = "0.10.6" 1377 | source = "registry+https://github.com/rust-lang/crates.io-index" 1378 | checksum = "8a0734142c18710f7214dc21908e2f054e973b908dbb1a602a3e6691615aaaae" 1379 | dependencies = [ 1380 | "hashbrown 0.9.1", 1381 | "rustc-hash", 1382 | "smol_str", 1383 | "text-size", 1384 | "triomphe", 1385 | ] 1386 | 1387 | [[package]] 1388 | name = "rslint_errors" 1389 | version = "0.2.0" 1390 | source = "registry+https://github.com/rust-lang/crates.io-index" 1391 | checksum = "9af98fe431564308331574c2a5457d360fd3bc56e9314b8386e9b36f28cf0c3a" 1392 | dependencies = [ 1393 | "colored", 1394 | "rslint_rowan", 1395 | "rslint_text_edit", 1396 | "termcolor", 1397 | "unicode-width", 1398 | ] 1399 | 1400 | [[package]] 1401 | name = "rslint_lexer" 1402 | version = "0.2.0" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "a0c35d2e4bf39c8669dfc24b6d1886e00beb931aacb46b9dba65beb7b8d2ba4f" 1405 | dependencies = [ 1406 | "ansi_term", 1407 | "atty", 1408 | "rslint_errors", 1409 | "rslint_syntax", 1410 | ] 1411 | 1412 | [[package]] 1413 | name = "rslint_parser" 1414 | version = "0.3.1" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "21563e0df87aa30700615a6d1262dd0ce0c8b207e7caec3fb4a1ab455bf891ab" 1417 | dependencies = [ 1418 | "lexical 5.2.2", 1419 | "num-bigint 0.3.3", 1420 | "rslint_errors", 1421 | "rslint_lexer", 1422 | "rslint_rowan", 1423 | "rslint_syntax", 1424 | ] 1425 | 1426 | [[package]] 1427 | name = "rslint_rowan" 1428 | version = "0.10.0" 1429 | source = "registry+https://github.com/rust-lang/crates.io-index" 1430 | checksum = "a2de60577b88df53597d840c39463418df3a1891dab6e0a70b1cea59bdc57329" 1431 | dependencies = [ 1432 | "erasable", 1433 | "rustc-hash", 1434 | "slice-dst", 1435 | "smol_str", 1436 | "text-size", 1437 | ] 1438 | 1439 | [[package]] 1440 | name = "rslint_syntax" 1441 | version = "0.1.4" 1442 | source = "registry+https://github.com/rust-lang/crates.io-index" 1443 | checksum = "ef4e7347949e798c91080a042b3e37f2e135fec3d3170a0ae2bf57d91826a79e" 1444 | 1445 | [[package]] 1446 | name = "rslint_text_edit" 1447 | version = "0.1.0" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "7484b77973d9a416510a5d968c394972b5c6ec548c56ce6361c61b8f6745789f" 1450 | dependencies = [ 1451 | "rowan", 1452 | ] 1453 | 1454 | [[package]] 1455 | name = "rustc-hash" 1456 | version = "1.1.0" 1457 | source = "registry+https://github.com/rust-lang/crates.io-index" 1458 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1459 | 1460 | [[package]] 1461 | name = "ryu" 1462 | version = "1.0.10" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" 1465 | 1466 | [[package]] 1467 | name = "safemem" 1468 | version = "0.3.3" 1469 | source = "registry+https://github.com/rust-lang/crates.io-index" 1470 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 1471 | 1472 | [[package]] 1473 | name = "same-file" 1474 | version = "1.0.6" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1477 | dependencies = [ 1478 | "winapi-util", 1479 | ] 1480 | 1481 | [[package]] 1482 | name = "scoped-tls" 1483 | version = "1.0.0" 1484 | source = "registry+https://github.com/rust-lang/crates.io-index" 1485 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" 1486 | 1487 | [[package]] 1488 | name = "scopeguard" 1489 | version = "1.1.0" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1492 | 1493 | [[package]] 1494 | name = "seahash" 1495 | version = "4.1.0" 1496 | source = "registry+https://github.com/rust-lang/crates.io-index" 1497 | checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" 1498 | 1499 | [[package]] 1500 | name = "semver" 1501 | version = "1.0.10" 1502 | source = "registry+https://github.com/rust-lang/crates.io-index" 1503 | checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" 1504 | 1505 | [[package]] 1506 | name = "serde" 1507 | version = "1.0.137" 1508 | source = "registry+https://github.com/rust-lang/crates.io-index" 1509 | checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" 1510 | dependencies = [ 1511 | "serde_derive", 1512 | ] 1513 | 1514 | [[package]] 1515 | name = "serde_cbor" 1516 | version = "0.11.2" 1517 | source = "registry+https://github.com/rust-lang/crates.io-index" 1518 | checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" 1519 | dependencies = [ 1520 | "half", 1521 | "serde", 1522 | ] 1523 | 1524 | [[package]] 1525 | name = "serde_derive" 1526 | version = "1.0.137" 1527 | source = "registry+https://github.com/rust-lang/crates.io-index" 1528 | checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" 1529 | dependencies = [ 1530 | "proc-macro2", 1531 | "quote", 1532 | "syn", 1533 | ] 1534 | 1535 | [[package]] 1536 | name = "serde_json" 1537 | version = "1.0.81" 1538 | source = "registry+https://github.com/rust-lang/crates.io-index" 1539 | checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" 1540 | dependencies = [ 1541 | "itoa", 1542 | "ryu", 1543 | "serde", 1544 | ] 1545 | 1546 | [[package]] 1547 | name = "serde_yaml" 1548 | version = "0.8.24" 1549 | source = "registry+https://github.com/rust-lang/crates.io-index" 1550 | checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" 1551 | dependencies = [ 1552 | "indexmap", 1553 | "ryu", 1554 | "serde", 1555 | "yaml-rust", 1556 | ] 1557 | 1558 | [[package]] 1559 | name = "shell-escape" 1560 | version = "0.1.5" 1561 | source = "registry+https://github.com/rust-lang/crates.io-index" 1562 | checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" 1563 | 1564 | [[package]] 1565 | name = "shell-words" 1566 | version = "1.1.0" 1567 | source = "registry+https://github.com/rust-lang/crates.io-index" 1568 | checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 1569 | 1570 | [[package]] 1571 | name = "siphasher" 1572 | version = "0.3.10" 1573 | source = "registry+https://github.com/rust-lang/crates.io-index" 1574 | checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" 1575 | 1576 | [[package]] 1577 | name = "slice-dst" 1578 | version = "1.5.1" 1579 | source = "registry+https://github.com/rust-lang/crates.io-index" 1580 | checksum = "ec1a6721a6d7c2997cea654e3eda6a827432c5dd0a0ed923ddd9b1d691203412" 1581 | dependencies = [ 1582 | "autocfg", 1583 | "erasable", 1584 | ] 1585 | 1586 | [[package]] 1587 | name = "smallvec" 1588 | version = "1.8.1" 1589 | source = "registry+https://github.com/rust-lang/crates.io-index" 1590 | checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2" 1591 | 1592 | [[package]] 1593 | name = "smol_str" 1594 | version = "0.1.23" 1595 | source = "registry+https://github.com/rust-lang/crates.io-index" 1596 | checksum = "7475118a28b7e3a2e157ce0131ba8c5526ea96e90ee601d9f6bb2e286a35ab44" 1597 | dependencies = [ 1598 | "serde", 1599 | ] 1600 | 1601 | [[package]] 1602 | name = "stable_deref_trait" 1603 | version = "1.2.0" 1604 | source = "registry+https://github.com/rust-lang/crates.io-index" 1605 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 1606 | 1607 | [[package]] 1608 | name = "static_assertions" 1609 | version = "1.1.0" 1610 | source = "registry+https://github.com/rust-lang/crates.io-index" 1611 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1612 | 1613 | [[package]] 1614 | name = "std_prelude" 1615 | version = "0.2.12" 1616 | source = "registry+https://github.com/rust-lang/crates.io-index" 1617 | checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe" 1618 | 1619 | [[package]] 1620 | name = "string_cache" 1621 | version = "0.8.4" 1622 | source = "registry+https://github.com/rust-lang/crates.io-index" 1623 | checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" 1624 | dependencies = [ 1625 | "new_debug_unreachable", 1626 | "once_cell", 1627 | "parking_lot", 1628 | "phf_shared", 1629 | "precomputed-hash", 1630 | "serde", 1631 | ] 1632 | 1633 | [[package]] 1634 | name = "string_cache_codegen" 1635 | version = "0.5.2" 1636 | source = "registry+https://github.com/rust-lang/crates.io-index" 1637 | checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" 1638 | dependencies = [ 1639 | "phf_generator", 1640 | "phf_shared", 1641 | "proc-macro2", 1642 | "quote", 1643 | ] 1644 | 1645 | [[package]] 1646 | name = "string_enum" 1647 | version = "0.3.1" 1648 | source = "registry+https://github.com/rust-lang/crates.io-index" 1649 | checksum = "f584cc881e9e5f1fd6bf827b0444aa94c30d8fe6378cf241071b5f5700b2871f" 1650 | dependencies = [ 1651 | "pmutil", 1652 | "proc-macro2", 1653 | "quote", 1654 | "swc_macros_common", 1655 | "syn", 1656 | ] 1657 | 1658 | [[package]] 1659 | name = "strsim" 1660 | version = "0.8.0" 1661 | source = "registry+https://github.com/rust-lang/crates.io-index" 1662 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 1663 | 1664 | [[package]] 1665 | name = "strsim" 1666 | version = "0.9.3" 1667 | source = "registry+https://github.com/rust-lang/crates.io-index" 1668 | checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" 1669 | 1670 | [[package]] 1671 | name = "strsim" 1672 | version = "0.10.0" 1673 | source = "registry+https://github.com/rust-lang/crates.io-index" 1674 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1675 | 1676 | [[package]] 1677 | name = "swc_atoms" 1678 | version = "0.2.12" 1679 | source = "registry+https://github.com/rust-lang/crates.io-index" 1680 | checksum = "4447e91cfebfe09f630f909358998fe6621afd10389ba5d6d7711e26105dc87c" 1681 | dependencies = [ 1682 | "once_cell", 1683 | "rustc-hash", 1684 | "serde", 1685 | "string_cache", 1686 | "string_cache_codegen", 1687 | ] 1688 | 1689 | [[package]] 1690 | name = "swc_common" 1691 | version = "0.18.9" 1692 | source = "registry+https://github.com/rust-lang/crates.io-index" 1693 | checksum = "a7fd4917e5f1f563e475d7adf1cb343f9275ffa602f168b896b0ea8f35d70895" 1694 | dependencies = [ 1695 | "ahash", 1696 | "ast_node", 1697 | "better_scoped_tls", 1698 | "cfg-if", 1699 | "debug_unreachable", 1700 | "either", 1701 | "from_variant", 1702 | "num-bigint 0.4.3", 1703 | "once_cell", 1704 | "rkyv", 1705 | "rustc-hash", 1706 | "serde", 1707 | "siphasher", 1708 | "string_cache", 1709 | "swc_eq_ignore_macros", 1710 | "swc_visit", 1711 | "tracing", 1712 | "unicode-width", 1713 | "url", 1714 | ] 1715 | 1716 | [[package]] 1717 | name = "swc_ecma_ast" 1718 | version = "0.79.0" 1719 | source = "registry+https://github.com/rust-lang/crates.io-index" 1720 | checksum = "f559057f0a573fe3575605cdb5f6d6523b090995e0022444c24e4d206eb4bd57" 1721 | dependencies = [ 1722 | "bitflags", 1723 | "is-macro", 1724 | "num-bigint 0.4.3", 1725 | "scoped-tls", 1726 | "serde", 1727 | "string_enum", 1728 | "swc_atoms", 1729 | "swc_common", 1730 | "unicode-id", 1731 | ] 1732 | 1733 | [[package]] 1734 | name = "swc_ecma_parser" 1735 | version = "0.105.7" 1736 | source = "registry+https://github.com/rust-lang/crates.io-index" 1737 | checksum = "02afecfd53063ba53ae7243acdd4e8f4ddc45011b9128d8c2e4cd44c115e6cf4" 1738 | dependencies = [ 1739 | "either", 1740 | "enum_kind", 1741 | "lexical 6.1.1", 1742 | "num-bigint 0.4.3", 1743 | "serde", 1744 | "smallvec", 1745 | "swc_atoms", 1746 | "swc_common", 1747 | "swc_ecma_ast", 1748 | "tracing", 1749 | "typed-arena", 1750 | ] 1751 | 1752 | [[package]] 1753 | name = "swc_ecma_visit" 1754 | version = "0.65.0" 1755 | source = "registry+https://github.com/rust-lang/crates.io-index" 1756 | checksum = "066077ce3279b593cbdbbb379735e230a794df7aef7206ba142850eb7197e91f" 1757 | dependencies = [ 1758 | "num-bigint 0.4.3", 1759 | "swc_atoms", 1760 | "swc_common", 1761 | "swc_ecma_ast", 1762 | "swc_visit", 1763 | "tracing", 1764 | ] 1765 | 1766 | [[package]] 1767 | name = "swc_eq_ignore_macros" 1768 | version = "0.1.0" 1769 | source = "registry+https://github.com/rust-lang/crates.io-index" 1770 | checksum = "8c8f200a2eaed938e7c1a685faaa66e6d42fa9e17da5f62572d3cbc335898f5e" 1771 | dependencies = [ 1772 | "pmutil", 1773 | "proc-macro2", 1774 | "quote", 1775 | "syn", 1776 | ] 1777 | 1778 | [[package]] 1779 | name = "swc_macros_common" 1780 | version = "0.3.5" 1781 | source = "registry+https://github.com/rust-lang/crates.io-index" 1782 | checksum = "d5dca3f08d02da4684c3373150f7c045128f81ea00f0c434b1b012bc65a6cce3" 1783 | dependencies = [ 1784 | "pmutil", 1785 | "proc-macro2", 1786 | "quote", 1787 | "syn", 1788 | ] 1789 | 1790 | [[package]] 1791 | name = "swc_visit" 1792 | version = "0.3.0" 1793 | source = "registry+https://github.com/rust-lang/crates.io-index" 1794 | checksum = "e5c639379dd2a8a0221fa1e12fafbdd594ba53a0cace6560054da52409dfcc1a" 1795 | dependencies = [ 1796 | "either", 1797 | "swc_visit_macros", 1798 | ] 1799 | 1800 | [[package]] 1801 | name = "swc_visit_macros" 1802 | version = "0.3.1" 1803 | source = "registry+https://github.com/rust-lang/crates.io-index" 1804 | checksum = "c3b9b72892df873972549838bf84d6c56234c7502148a7e23b5a3da6e0fedfb8" 1805 | dependencies = [ 1806 | "Inflector", 1807 | "pmutil", 1808 | "proc-macro2", 1809 | "quote", 1810 | "swc_macros_common", 1811 | "syn", 1812 | ] 1813 | 1814 | [[package]] 1815 | name = "syn" 1816 | version = "1.0.98" 1817 | source = "registry+https://github.com/rust-lang/crates.io-index" 1818 | checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" 1819 | dependencies = [ 1820 | "proc-macro2", 1821 | "quote", 1822 | "unicode-ident", 1823 | ] 1824 | 1825 | [[package]] 1826 | name = "syntect" 1827 | version = "5.0.0" 1828 | source = "registry+https://github.com/rust-lang/crates.io-index" 1829 | checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" 1830 | dependencies = [ 1831 | "bincode", 1832 | "bitflags", 1833 | "flate2", 1834 | "fnv", 1835 | "lazy_static", 1836 | "once_cell", 1837 | "onig", 1838 | "plist", 1839 | "regex-syntax", 1840 | "serde", 1841 | "serde_derive", 1842 | "serde_json", 1843 | "thiserror", 1844 | "walkdir", 1845 | "yaml-rust", 1846 | ] 1847 | 1848 | [[package]] 1849 | name = "sys-info" 1850 | version = "0.9.1" 1851 | source = "registry+https://github.com/rust-lang/crates.io-index" 1852 | checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c" 1853 | dependencies = [ 1854 | "cc", 1855 | "libc", 1856 | ] 1857 | 1858 | [[package]] 1859 | name = "term_size" 1860 | version = "0.3.2" 1861 | source = "registry+https://github.com/rust-lang/crates.io-index" 1862 | checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" 1863 | dependencies = [ 1864 | "libc", 1865 | "winapi", 1866 | ] 1867 | 1868 | [[package]] 1869 | name = "termcolor" 1870 | version = "1.1.3" 1871 | source = "registry+https://github.com/rust-lang/crates.io-index" 1872 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 1873 | dependencies = [ 1874 | "winapi-util", 1875 | ] 1876 | 1877 | [[package]] 1878 | name = "terminal_size" 1879 | version = "0.1.17" 1880 | source = "registry+https://github.com/rust-lang/crates.io-index" 1881 | checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" 1882 | dependencies = [ 1883 | "libc", 1884 | "winapi", 1885 | ] 1886 | 1887 | [[package]] 1888 | name = "text-size" 1889 | version = "1.1.0" 1890 | source = "registry+https://github.com/rust-lang/crates.io-index" 1891 | checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a" 1892 | 1893 | [[package]] 1894 | name = "textwrap" 1895 | version = "0.11.0" 1896 | source = "registry+https://github.com/rust-lang/crates.io-index" 1897 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 1898 | dependencies = [ 1899 | "term_size", 1900 | "unicode-width", 1901 | ] 1902 | 1903 | [[package]] 1904 | name = "textwrap" 1905 | version = "0.15.0" 1906 | source = "registry+https://github.com/rust-lang/crates.io-index" 1907 | checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" 1908 | 1909 | [[package]] 1910 | name = "thiserror" 1911 | version = "1.0.31" 1912 | source = "registry+https://github.com/rust-lang/crates.io-index" 1913 | checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" 1914 | dependencies = [ 1915 | "thiserror-impl", 1916 | ] 1917 | 1918 | [[package]] 1919 | name = "thiserror-impl" 1920 | version = "1.0.31" 1921 | source = "registry+https://github.com/rust-lang/crates.io-index" 1922 | checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" 1923 | dependencies = [ 1924 | "proc-macro2", 1925 | "quote", 1926 | "syn", 1927 | ] 1928 | 1929 | [[package]] 1930 | name = "time" 1931 | version = "0.3.11" 1932 | source = "registry+https://github.com/rust-lang/crates.io-index" 1933 | checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217" 1934 | dependencies = [ 1935 | "itoa", 1936 | "libc", 1937 | "num_threads", 1938 | ] 1939 | 1940 | [[package]] 1941 | name = "tinyvec" 1942 | version = "1.6.0" 1943 | source = "registry+https://github.com/rust-lang/crates.io-index" 1944 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1945 | dependencies = [ 1946 | "tinyvec_macros", 1947 | ] 1948 | 1949 | [[package]] 1950 | name = "tinyvec_macros" 1951 | version = "0.1.0" 1952 | source = "registry+https://github.com/rust-lang/crates.io-index" 1953 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1954 | 1955 | [[package]] 1956 | name = "tracing" 1957 | version = "0.1.35" 1958 | source = "registry+https://github.com/rust-lang/crates.io-index" 1959 | checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" 1960 | dependencies = [ 1961 | "cfg-if", 1962 | "pin-project-lite", 1963 | "tracing-attributes", 1964 | "tracing-core", 1965 | ] 1966 | 1967 | [[package]] 1968 | name = "tracing-attributes" 1969 | version = "0.1.21" 1970 | source = "registry+https://github.com/rust-lang/crates.io-index" 1971 | checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" 1972 | dependencies = [ 1973 | "proc-macro2", 1974 | "quote", 1975 | "syn", 1976 | ] 1977 | 1978 | [[package]] 1979 | name = "tracing-core" 1980 | version = "0.1.28" 1981 | source = "registry+https://github.com/rust-lang/crates.io-index" 1982 | checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" 1983 | dependencies = [ 1984 | "once_cell", 1985 | ] 1986 | 1987 | [[package]] 1988 | name = "triomphe" 1989 | version = "0.1.6" 1990 | source = "registry+https://github.com/rust-lang/crates.io-index" 1991 | checksum = "eda0abf5a9b5ad4a5ac1393956ae03fb57033749d3983e2cac9afbfd5ae04ec2" 1992 | dependencies = [ 1993 | "serde", 1994 | "stable_deref_trait", 1995 | ] 1996 | 1997 | [[package]] 1998 | name = "typed-arena" 1999 | version = "2.0.1" 2000 | source = "registry+https://github.com/rust-lang/crates.io-index" 2001 | checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" 2002 | 2003 | [[package]] 2004 | name = "unicode-bidi" 2005 | version = "0.3.8" 2006 | source = "registry+https://github.com/rust-lang/crates.io-index" 2007 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 2008 | 2009 | [[package]] 2010 | name = "unicode-id" 2011 | version = "0.3.2" 2012 | source = "registry+https://github.com/rust-lang/crates.io-index" 2013 | checksum = "69fe8d9274f490a36442acb4edfd0c4e473fdfc6a8b5cd32f28a0235761aedbe" 2014 | 2015 | [[package]] 2016 | name = "unicode-ident" 2017 | version = "1.0.1" 2018 | source = "registry+https://github.com/rust-lang/crates.io-index" 2019 | checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" 2020 | 2021 | [[package]] 2022 | name = "unicode-normalization" 2023 | version = "0.1.19" 2024 | source = "registry+https://github.com/rust-lang/crates.io-index" 2025 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 2026 | dependencies = [ 2027 | "tinyvec", 2028 | ] 2029 | 2030 | [[package]] 2031 | name = "unicode-width" 2032 | version = "0.1.9" 2033 | source = "registry+https://github.com/rust-lang/crates.io-index" 2034 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 2035 | 2036 | [[package]] 2037 | name = "unreachable" 2038 | version = "0.1.1" 2039 | source = "registry+https://github.com/rust-lang/crates.io-index" 2040 | checksum = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" 2041 | dependencies = [ 2042 | "void", 2043 | ] 2044 | 2045 | [[package]] 2046 | name = "url" 2047 | version = "2.2.2" 2048 | source = "registry+https://github.com/rust-lang/crates.io-index" 2049 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 2050 | dependencies = [ 2051 | "form_urlencoded", 2052 | "idna", 2053 | "matches", 2054 | "percent-encoding", 2055 | ] 2056 | 2057 | [[package]] 2058 | name = "vcpkg" 2059 | version = "0.2.15" 2060 | source = "registry+https://github.com/rust-lang/crates.io-index" 2061 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 2062 | 2063 | [[package]] 2064 | name = "vec_map" 2065 | version = "0.8.2" 2066 | source = "registry+https://github.com/rust-lang/crates.io-index" 2067 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 2068 | 2069 | [[package]] 2070 | name = "version_check" 2071 | version = "0.9.4" 2072 | source = "registry+https://github.com/rust-lang/crates.io-index" 2073 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 2074 | 2075 | [[package]] 2076 | name = "void" 2077 | version = "1.0.2" 2078 | source = "registry+https://github.com/rust-lang/crates.io-index" 2079 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 2080 | 2081 | [[package]] 2082 | name = "walkdir" 2083 | version = "2.3.2" 2084 | source = "registry+https://github.com/rust-lang/crates.io-index" 2085 | checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" 2086 | dependencies = [ 2087 | "same-file", 2088 | "winapi", 2089 | "winapi-util", 2090 | ] 2091 | 2092 | [[package]] 2093 | name = "wasi" 2094 | version = "0.11.0+wasi-snapshot-preview1" 2095 | source = "registry+https://github.com/rust-lang/crates.io-index" 2096 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2097 | 2098 | [[package]] 2099 | name = "wild" 2100 | version = "2.0.4" 2101 | source = "registry+https://github.com/rust-lang/crates.io-index" 2102 | checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" 2103 | dependencies = [ 2104 | "glob", 2105 | ] 2106 | 2107 | [[package]] 2108 | name = "winapi" 2109 | version = "0.3.9" 2110 | source = "registry+https://github.com/rust-lang/crates.io-index" 2111 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2112 | dependencies = [ 2113 | "winapi-i686-pc-windows-gnu", 2114 | "winapi-x86_64-pc-windows-gnu", 2115 | ] 2116 | 2117 | [[package]] 2118 | name = "winapi-i686-pc-windows-gnu" 2119 | version = "0.4.0" 2120 | source = "registry+https://github.com/rust-lang/crates.io-index" 2121 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2122 | 2123 | [[package]] 2124 | name = "winapi-util" 2125 | version = "0.1.5" 2126 | source = "registry+https://github.com/rust-lang/crates.io-index" 2127 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 2128 | dependencies = [ 2129 | "winapi", 2130 | ] 2131 | 2132 | [[package]] 2133 | name = "winapi-x86_64-pc-windows-gnu" 2134 | version = "0.4.0" 2135 | source = "registry+https://github.com/rust-lang/crates.io-index" 2136 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2137 | 2138 | [[package]] 2139 | name = "windows-sys" 2140 | version = "0.36.1" 2141 | source = "registry+https://github.com/rust-lang/crates.io-index" 2142 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 2143 | dependencies = [ 2144 | "windows_aarch64_msvc", 2145 | "windows_i686_gnu", 2146 | "windows_i686_msvc", 2147 | "windows_x86_64_gnu", 2148 | "windows_x86_64_msvc", 2149 | ] 2150 | 2151 | [[package]] 2152 | name = "windows_aarch64_msvc" 2153 | version = "0.36.1" 2154 | source = "registry+https://github.com/rust-lang/crates.io-index" 2155 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 2156 | 2157 | [[package]] 2158 | name = "windows_i686_gnu" 2159 | version = "0.36.1" 2160 | source = "registry+https://github.com/rust-lang/crates.io-index" 2161 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 2162 | 2163 | [[package]] 2164 | name = "windows_i686_msvc" 2165 | version = "0.36.1" 2166 | source = "registry+https://github.com/rust-lang/crates.io-index" 2167 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 2168 | 2169 | [[package]] 2170 | name = "windows_x86_64_gnu" 2171 | version = "0.36.1" 2172 | source = "registry+https://github.com/rust-lang/crates.io-index" 2173 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 2174 | 2175 | [[package]] 2176 | name = "windows_x86_64_msvc" 2177 | version = "0.36.1" 2178 | source = "registry+https://github.com/rust-lang/crates.io-index" 2179 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 2180 | 2181 | [[package]] 2182 | name = "xml-rs" 2183 | version = "0.8.4" 2184 | source = "registry+https://github.com/rust-lang/crates.io-index" 2185 | checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" 2186 | 2187 | [[package]] 2188 | name = "yaml-rust" 2189 | version = "0.4.5" 2190 | source = "registry+https://github.com/rust-lang/crates.io-index" 2191 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" 2192 | dependencies = [ 2193 | "linked-hash-map", 2194 | ] 2195 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "resync" 3 | version = "0.2.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | clap = "3.1.6" 10 | quote = "1.0.18" 11 | bat = "0.21.0" 12 | pickledb = " 0.4.1" 13 | dirs = "4.0" 14 | serde = "1.0.137" 15 | git2 = "0.14" 16 | pathdiff = "0.2.1" 17 | aho-corasick = "0.7.18" 18 | rslint_parser = "0.3.1" 19 | swc_common = { version = "0.18.9", features = ["rkyv"] } 20 | swc_ecma_parser = "0.105.7" 21 | swc_ecma_visit = "0.65.0" 22 | swc_ecma_ast = "0.79.0" 23 | walkdir = "2.3.2" 24 | syn = { version = "1.0.91", features = ["full", "extra-traits", "visit", "parsing", "printing"]} 25 | proc-macro2 = { version = "1.0.37", features = ["span-locations"] } 26 | nom = "7.1.1" 27 | nom_locate = "4.0.0" 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /NOTICE.md: -------------------------------------------------------------------------------- 1 | ## Notice 2 | 3 | The `sync.rs` file is from [dura](https://github.com/tkellogg/dura) - a background process that watches your Git repositories and commits your uncommited changes without impacting HEAD, the current branch, or the Git index (staged files). For more information, please see the notice in the `sync.rs` file. 4 | 5 | ### [tkellogg](https://github.com/Tkellogg) - [dura](https://github.com/tkellogg/dura) 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Resync 2 | 3 | ![1](assets/1.png) 4 | 5 | Resync is a multi language comment checker written in rust. It's a CLI tool which uses the git history of your repo to detect out of sync comments. 6 | 7 | Resync looks at things such as the commit dates, and commit consistency to tell if a comment is stale or not. 8 | 9 | Note: resync may not be 100% accurate at identifying out of sync comments, it tries to only show you places where the function has been updated a lot, but the comment hasn't. 10 | 11 | ### Using Resync 12 | 13 | To use resync, simply run `resync` in the root of any source code directory. This will check all files in the directory for out of sync comments. 14 | 15 | You can check a single file by running `resync -i relative/file/location` from the root of a project 16 | 17 | ### Supported Languages 18 | 19 | - [x] Rust 20 | - [x] Javscript 21 | - [x] JavaScript React 22 | - [x] Typescript 23 | - [ ] Typescript React 24 | - [ ] C 25 | - [ ] C++ 26 | - [ ] C# 27 | - [ ] Python 28 | - [ ] PHP 29 | - [ ] Kotlin 30 | - [ ] Java 31 | 32 | ### With Readable 33 | 34 | Resync is automatically downloaded and used with [Readable](https://github.com/ReadableLabs/readable). It lets you find and regenerate out of sync comments from within your IDE. 35 | 36 | ### Installing 37 | 38 | Head over to the [releases](https://github.com/ReadableLabs/resync/releases) page to download resync. If there aren't compiled binaries for your system, then you can compile resync in the following way. 39 | 40 | ``` 41 | git clone git@github.com:ReadableLabs/resync 42 | 43 | cd resync 44 | 45 | cargo install --path . 46 | ``` 47 | 48 | If you want to support a new language, view the [docs](./docs/parsers.md) on how to do so. 49 | 50 | ### FAQ 51 | 52 | - Resync outputs "Searching for out of sync comments..." but nothing else 53 | - Resync didn't find any out of sync comments in your project. 54 | 55 | ### Current 56 | 57 | - Python support 58 | 59 | ### TODO 60 | 61 | - Use [cursive](https://github.com/gyscos/cursive) to make a terminal GUI for resync 62 | - use optional dependencies if you only want to compile for a few languages 63 | - Allow resync to be used on the master branch, without creating resync branch (maybe) 64 | - add tests to mock extension 65 | - add flag which prints all symbol ranges of file to better be used with Readable (probably won't do) 66 | -------------------------------------------------------------------------------- /assets/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ReadableLabs/resync/e8f8e9f2e3687df3822410c00d698c8f5ec3b475/assets/1.png -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## Resync Docs 2 | 3 | `index.md` 4 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | ### Resync - How it works 2 | 3 | Resync is a multi language comment checker. It works by getting comment/symbol pairs from source files, and then checking the git blame info for each of those symbols to see if a comment is out of sync or not. 4 | -------------------------------------------------------------------------------- /docs/parsers.md: -------------------------------------------------------------------------------- 1 | ## Parsers 2 | 3 | Table of Contents 4 | 5 | - About parsers 6 | - Writing a new parser 7 | - FAQ 8 | 9 | ### About parsers 10 | 11 | Resync uses parsers to get comment and symbol pairs from source code. It then checks the ranges of the found symbols to see if a comment is out of sync. The parsers aren't used for getting any specific things such as arguments or function names, they're just used for getting the ranges of both comments, and the symbol that the comment refers to. 12 | 13 | ### Writing a parser 14 | 15 | All parsers implement `Parser` found in `parsers/base.rs`. When you call `get_parser`, the function checks the extension of the file passed in, and matches it to the specific parser. 16 | 17 | To add a parser, implement `Parser`, make sure the parser returns a vector containing a tuple of `SymbolSpan`s. The first `SymbolSpan` in the tuple is the range of the comment, and the second `SymbolSpan` is the range of whichever symbol came below it. 18 | 19 | If you need an example of a parser which implements `Parser`, check `parsers/rust/parser.rs` or `parsers/javascript/parser.rs`. 20 | 21 | Parsers return locations of source code in a 1-indexed format. The first line is 1, line 3 in a `SymbolSpan` would be line 3 in your IDE. 22 | 23 | ### FAQ 24 | 25 | - Which library should I use for parsing? 26 | - Whichever one is easiest (and preferably lightweight) for parsing said language. The rust parser uses syn but for typescript you could use swc. 27 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | ## examples 2 | 3 | A few examples showcasing how to use the api of resync, as well as the language parsers 4 | -------------------------------------------------------------------------------- /src/check.rs: -------------------------------------------------------------------------------- 1 | use aho_corasick::AhoCorasick; 2 | use pathdiff::diff_paths; 3 | use walkdir::WalkDir; 4 | 5 | use crate::tools::{get_latest_line, check_control, unix_time_diff}; 6 | use crate::parsers::get_parser; 7 | use crate::info::{get_line_info, get_commit_diff}; 8 | use std::io::{BufReader, BufRead}; 9 | use std::path::{Path, PathBuf}; 10 | use std::fs::File; 11 | use std::time::{SystemTime, UNIX_EPOCH}; 12 | use git2::{Repository, Oid}; 13 | use crate::parsers::types::SymbolSpan; 14 | use pickledb::PickleDb; 15 | use serde::{Serialize, Deserialize}; 16 | use crate::formatters::get_formatter; 17 | 18 | /// All the flags resync saves for an out of sync comment 19 | #[derive(Serialize, Deserialize)] 20 | pub struct SyncInfo { 21 | time_diff: String, 22 | commit_diff: usize, 23 | function: SymbolSpan, 24 | comment: SymbolSpan 25 | } 26 | 27 | pub struct Checker { 28 | repo: Repository, 29 | working_dir: PathBuf, 30 | ac: AhoCorasick, 31 | porcelain: bool, 32 | db: PickleDb 33 | } 34 | 35 | impl Checker { 36 | pub fn new(repo: Repository, working_dir: PathBuf, ac: AhoCorasick, porcelain: bool, db: PickleDb) -> Self { 37 | Self { repo, working_dir, ac, porcelain, db } 38 | } 39 | 40 | fn should_check(&self, file: &PathBuf) -> bool { 41 | let last_edit = match std::fs::metadata(&file) { 42 | Ok(metadata) => { 43 | let modified = metadata.modified(); 44 | 45 | if modified.is_err() { 46 | let now = SystemTime::now(); 47 | 48 | now 49 | .duration_since(UNIX_EPOCH) 50 | .expect("Time went backwards").as_millis(); 51 | } 52 | 53 | modified 54 | .unwrap() 55 | .duration_since(UNIX_EPOCH) 56 | .unwrap().as_millis() 57 | }, 58 | 59 | Err(e) => { 60 | let now = SystemTime::now(); 61 | 62 | now 63 | .duration_since(UNIX_EPOCH) 64 | .expect("Time went backwards").as_millis() 65 | } 66 | }; 67 | 68 | let key = format!("{}:time", file.display().to_string()); 69 | 70 | let last_checked = match self.db.get::(&key) { 71 | Some(time) => { 72 | time 73 | }, 74 | None => 0, 75 | }; 76 | 77 | if last_edit > last_checked { 78 | return true; 79 | } 80 | 81 | return false; 82 | } 83 | 84 | /// returns sync info 85 | pub fn check_file(&mut self, file: PathBuf, ignore_files: &mut Vec) { 86 | let mut patterns: Vec = vec![".git".to_string(), ".swp".to_string(), "node_modules".to_string(), "target".to_string()]; // TODO: add global pattern list, or read gitignore 87 | patterns.extend(ignore_files.iter().cloned()); 88 | 89 | let file_name = match file.to_str() { 90 | Some(file) => file, 91 | _ => { 92 | return; 93 | } 94 | }; 95 | 96 | // if file_name.is_none() { 97 | // return; 98 | // } 99 | 100 | if self.ac.is_match(file_name) { 101 | return; 102 | } 103 | 104 | let ext = match file.extension() { 105 | Some(ext) => { 106 | match ext.to_str() { 107 | Some(ext_str) => ext_str, 108 | _ => { 109 | return; 110 | } 111 | } 112 | }, 113 | _ => { 114 | return; 115 | } 116 | }; 117 | 118 | let formatter = get_formatter(&self.porcelain); 119 | 120 | let relative_path = diff_paths(&file, self.working_dir.as_path()).unwrap(); 121 | 122 | let parser = match get_parser(&file, &patterns) { 123 | Some(parser) => parser, 124 | _ => { 125 | return; 126 | } 127 | }; 128 | 129 | 130 | if !self.should_check(&file) { 131 | let symbols = match self.db.get::>(&format!("{}:info", &file.display())) { 132 | Some(symbol) => symbol, 133 | None => { 134 | return; 135 | } 136 | }; 137 | 138 | for symbol in symbols { 139 | formatter.output(&symbol.function, &symbol.comment, &file, &ext, &symbol.time_diff, &symbol.commit_diff); 140 | } 141 | 142 | return; 143 | } 144 | 145 | let blame_lines = match get_line_info(&self.repo, &relative_path) { 146 | Ok(lines) => lines, 147 | Err(e) => { 148 | 149 | if self.porcelain != true { 150 | println!("{}", e); 151 | println!("Failed checking {}, continuing", file.display()); 152 | } 153 | return; 154 | } 155 | }; 156 | 157 | let all_funs = match parser.parse(&file) { 158 | Ok(funs) => funs, 159 | Err(_) => { 160 | if self.porcelain == false { 161 | println!("Failed to parse file, Skipping"); 162 | } 163 | return; 164 | } 165 | }; 166 | 167 | let mut all_symbols = Vec::::new(); 168 | 169 | // make a module which checks all of these, checkall, which you can implement 170 | for (comment, function) in all_funs { 171 | // TODO: make these return a result and skip if fail 172 | let comment_idx = get_latest_line(&blame_lines, &comment); 173 | let fun_idx = get_latest_line(&blame_lines, &function); 174 | 175 | let comment_info = blame_lines.get(&comment_idx).expect("Failed to get comment from blame lines"); 176 | let function_info = blame_lines.get(&fun_idx).expect("Failed to get function from blame lines"); 177 | 178 | // if the comment has been edited before, or at the same time as the function has 179 | if function_info.time <= comment_info.time { 180 | continue; 181 | } 182 | 183 | // helps show less false positives by only showing functions which have a lot of different commits 184 | if check_control(&blame_lines, &function) { 185 | continue; 186 | } 187 | 188 | let current_time = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs(); 189 | let time_diff = unix_time_diff(current_time.into(), comment_info.time.into()); 190 | let commit_diff = get_commit_diff(&self.repo, &Oid::from_str(&comment_info.commit).unwrap()).expect("Failed to get commit diff"); 191 | 192 | formatter.output(&function, &comment, &file, &ext, &time_diff, &commit_diff); 193 | 194 | let symbol = SyncInfo { 195 | function, 196 | comment, 197 | commit_diff, 198 | time_diff 199 | }; 200 | 201 | all_symbols.push(symbol); 202 | 203 | } 204 | 205 | let current_time = SystemTime::now() 206 | .duration_since(UNIX_EPOCH) 207 | .unwrap() 208 | .as_millis(); 209 | 210 | let key = format!("{}:time", file.display().to_string()); 211 | self.db.set::(&key, ¤t_time).expect("Failed to set last time"); 212 | 213 | if all_symbols.is_empty() { 214 | return; 215 | } 216 | 217 | self.db.set::>(&format!("{}:info", &file.display()), &all_symbols).expect("Failed to set last time"); 218 | 219 | } 220 | 221 | fn check_gitignore(&self) -> Vec { 222 | let gitignore = Path::join(&self.working_dir, ".gitignore"); 223 | 224 | if !Path::exists(&gitignore) { 225 | return vec![]; 226 | } 227 | 228 | let file = File::open(gitignore).expect("Failed to open gitignore"); 229 | 230 | let buf = BufReader::new(file); 231 | 232 | buf.lines() 233 | .map(|f| f.expect("Failed to read gitignore")) 234 | .collect() 235 | } 236 | 237 | pub fn check_working_dir(&mut self) { 238 | 239 | let mut ignore_files = self.check_gitignore(); 240 | 241 | for file in WalkDir::new(&self.working_dir).into_iter().filter_map(|e| e.ok()) { 242 | self.check_file(file.path().to_path_buf(), &mut ignore_files); 243 | } 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | use std::{path::PathBuf, io::Result, env}; 2 | use crate::formatters::{get_formatter, Formatter}; 3 | use dirs; 4 | use std::fs; 5 | use pickledb::PickleDb; 6 | 7 | pub struct Config { 8 | pub porcelain: bool, 9 | } 10 | 11 | impl Config { 12 | pub fn new(porcelain: bool) -> Self { 13 | return Config { 14 | porcelain: porcelain 15 | }; 16 | } 17 | 18 | /// gets the path and creates if not exist 19 | pub fn get_and_create(&self) -> PathBuf { 20 | match dirs::config_dir() { 21 | Some(dir) => { 22 | if dir.exists() { 23 | return dir.join("resync/"); 24 | } 25 | 26 | if fs::create_dir(&dir).is_err() && self.porcelain == false { 27 | println!("Failed creating resync config dir. Using temp dir"); 28 | return env::temp_dir(); 29 | } 30 | 31 | dir.join("resync/") 32 | }, 33 | 34 | _ => { 35 | if self.porcelain == false { 36 | println!("User config dir not found, using temp dir"); 37 | } 38 | env::temp_dir() 39 | } 40 | } 41 | } 42 | 43 | pub fn get_formatter(&self, porcelain: &bool) -> Box { 44 | get_formatter(porcelain) 45 | } 46 | 47 | pub fn get_db_path(&self) -> PathBuf { 48 | self.get_and_create().join("file_info.db") 49 | } 50 | 51 | pub fn open_db(&self, debug: bool) -> PickleDb { 52 | let file = self.get_db_path(); 53 | if debug == true { 54 | return PickleDb::new( 55 | &file, 56 | pickledb::PickleDbDumpPolicy::AutoDump, 57 | pickledb::SerializationMethod::Json 58 | ); 59 | } 60 | let db = match PickleDb::load( 61 | &file, 62 | pickledb::PickleDbDumpPolicy::AutoDump, 63 | pickledb::SerializationMethod::Json 64 | ) { 65 | Ok(db) => db, 66 | Err(_) => { 67 | PickleDb::new( 68 | &file, 69 | pickledb::PickleDbDumpPolicy::AutoDump, 70 | pickledb::SerializationMethod::Json 71 | ) 72 | } 73 | }; 74 | 75 | return db; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/formatters/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod terminal; 2 | pub mod porcelain; 3 | pub mod single_line; 4 | 5 | use std::path::PathBuf; 6 | 7 | use crate::{formatters::{ 8 | terminal::TerminalFormatter, 9 | single_line::SingleLineFormatter 10 | }, parsers::types::SymbolSpan}; 11 | 12 | pub trait Formatter { 13 | fn output(&self, function: &SymbolSpan, comment: &SymbolSpan, file: &PathBuf, language: &str, time_diff: &String, commit_diff: &usize); 14 | } 15 | 16 | pub fn get_formatter(porcelain: &bool) -> Box< dyn Formatter> { 17 | if *porcelain { 18 | Box::new(SingleLineFormatter {}) 19 | } 20 | 21 | else { 22 | Box::new(TerminalFormatter {}) 23 | } 24 | } -------------------------------------------------------------------------------- /src/formatters/porcelain.rs: -------------------------------------------------------------------------------- 1 | use std::ffi::OsStr; 2 | use std::path::PathBuf; 3 | 4 | use crate::parsers::types::SymbolSpan; 5 | 6 | use crate::formatters::Formatter; 7 | 8 | pub struct PorcelainFormatter; 9 | 10 | impl Formatter for PorcelainFormatter { 11 | fn output(&self, _: &SymbolSpan, comment: &SymbolSpan, file: &PathBuf, _: &str, time_diff: &String, commit_diff: &usize) { 12 | let file_name = file.file_name().and_then(OsStr::to_str).unwrap(); 13 | println!("{}\n{}\n{}\n{}\n{}\n{}", time_diff, commit_diff, file.display(), file_name, comment.start.line, comment.end.line); 14 | } 15 | } -------------------------------------------------------------------------------- /src/formatters/single_line.rs: -------------------------------------------------------------------------------- 1 | use std::{path::PathBuf, ffi::OsStr}; 2 | 3 | use crate::{formatters::Formatter, parsers::types::SymbolSpan}; 4 | 5 | pub struct SingleLineFormatter; 6 | 7 | impl Formatter for SingleLineFormatter { 8 | fn output(&self, _: &SymbolSpan, comment: &SymbolSpan, file: &PathBuf, _: &str, time_diff: &String, commit_diff: &usize) { 9 | let file_name = file.file_name().and_then(OsStr::to_str).unwrap(); 10 | println!("{}\t{}\t{}\t{}\t{}\t{}", time_diff, commit_diff, file.display(), file_name, comment.start.line, comment.end.line); 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/formatters/terminal.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use crate::{formatters::Formatter, parsers::types::SymbolSpan, tools::print_symbol}; 4 | 5 | pub struct TerminalFormatter; 6 | 7 | impl Formatter for TerminalFormatter { 8 | fn output(&self, function: &SymbolSpan, comment: &SymbolSpan, file: &PathBuf, language: &str, time_diff: &String, commit_diff: &usize) { 9 | println!("{}", time_diff); 10 | println!("{} commits since update", commit_diff); // change red green or yellow text changed a lot, little, or changed 11 | println!("{}:{}:{}", file.display(), function.start.line - 1, function.start.character); 12 | print_symbol(&function, &comment, &file, &language, &time_diff, &commit_diff); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/info.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | use std::io::{BufRead, BufReader}; 3 | use std::path::Path; 4 | use git2::{Repository, BlameOptions, Error, BranchType, Oid}; 5 | 6 | pub struct LineInfo { 7 | pub time: u64, 8 | pub commit: String, 9 | } 10 | 11 | pub fn get_line_info(repo: &Repository, file: &Path) -> Result, Error> { 12 | let mut lines: HashMap = HashMap::new(); 13 | 14 | let head = repo.head()?.peel_to_commit()?; 15 | 16 | let branch_name = format!("resync/{}", head.id()); 17 | 18 | let spec = format!("{}:{}", branch_name, file.display()); 19 | 20 | let branch_oid = match repo.find_branch(&branch_name, BranchType::Local) { 21 | Ok(branch) => { 22 | match branch.get().peel_to_commit() { 23 | Ok(commit) => { 24 | commit.id() 25 | }, 26 | _ => { 27 | head.id() 28 | } 29 | } 30 | }, 31 | Err(_) => { 32 | // println!("Failed getting resync branch oid"); 33 | panic!("Failed getting resync branch oid"); 34 | } // maybe this isn't good 35 | }; 36 | 37 | let mut blame_opts = BlameOptions::new(); 38 | blame_opts.newest_commit(branch_oid); 39 | 40 | let blame = repo.blame_file(file, Some(&mut blame_opts))?; 41 | 42 | let object = repo.revparse_single(&spec[..])?; 43 | let blob = repo.find_blob(object.id())?; 44 | 45 | 46 | let reader = BufReader::new(blob.content()); 47 | for (i, _) in reader.lines().enumerate() { 48 | if let Some(hunk) = blame.get_line(i + 1) { 49 | let commit_id = format!("{}", hunk.final_commit_id()); 50 | let time = hunk.final_signature().when().seconds(); 51 | lines.insert( 52 | i.try_into().unwrap(), 53 | LineInfo { 54 | time: time.try_into().unwrap(), 55 | commit: commit_id 56 | } 57 | ); 58 | } 59 | } 60 | 61 | 62 | return Ok(lines); 63 | } 64 | 65 | /// pass in repo for later 66 | pub fn get_commit_diff(repo: &Repository, old: &Oid) -> Result { 67 | let master_commit = repo.head()?.peel_to_commit()?; 68 | 69 | let mut revwalk = repo.revwalk()?; 70 | 71 | revwalk.set_sorting(git2::Sort::TIME)?; 72 | 73 | revwalk.hide(*old)?; 74 | revwalk.push(master_commit.id())?; 75 | 76 | let count = revwalk.count(); 77 | 78 | Ok(count) 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod sync; 2 | pub mod info; 3 | pub mod parsers; 4 | pub mod tools; 5 | pub mod check; 6 | pub mod config; 7 | pub mod formatters; 8 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | pub mod info; 2 | pub mod parsers; 3 | pub mod tools; 4 | pub mod sync; 5 | pub mod config; 6 | pub mod formatters; 7 | 8 | use std::path::Path; 9 | use aho_corasick::AhoCorasick; 10 | use resync::check::Checker; 11 | use resync::config::Config; 12 | use clap::{Arg, Command}; 13 | use git2::Repository; 14 | use std::env::current_dir; 15 | use std::fs::{File, remove_file}; 16 | 17 | fn main() { 18 | let matches = Command::new("Resync") 19 | .version("1.3") 20 | .author("Nevin Puri ") 21 | .about("Easily find out of sync comments") 22 | .arg(Arg::new("sync") 23 | .short('s') 24 | .long("sync") 25 | .help("Updates resync git branch with current working branch information (used with extension)")) 26 | .arg(Arg::new("check-dir") 27 | .short('c') 28 | .long("check-dir") 29 | .help("Checks a specific directory recursively for out of sync comments") 30 | .takes_value(false) 31 | ) 32 | .arg(Arg::new("check-file") 33 | .short('i') 34 | .long("check-file") 35 | .help("Checks a specific file for out of sync comments") 36 | .takes_value(true)) 37 | .arg(Arg::new("porcelain") 38 | .short('p') 39 | .long("porcelain") 40 | .help("Output out of sync comments in format designed for machine consumption")) 41 | .arg(Arg::new("no-resync-branch") 42 | .short('m') 43 | .long("no-resync-branch") 44 | .help("Don't use or create a resync branch (out of sync comments won't be updated until you commit to your own branch)")) 45 | .arg(Arg::new("reset-db") 46 | .short('r') 47 | .long("reset-db") 48 | .help("Resets resyncs internal db")) 49 | .arg(Arg::new("dir") 50 | .help("Sets working dir") 51 | .short('d') 52 | .long("dir") 53 | .takes_value(true)) 54 | .get_matches(); 55 | 56 | let current_dir_pathbuf = current_dir().unwrap(); 57 | let current_dir = current_dir_pathbuf.as_path(); 58 | // get default dir: TODO 59 | let working_dir = match matches.value_of("dir") { 60 | Some(value) => Path::new(value), 61 | None => current_dir, 62 | }; 63 | 64 | let debug = matches.is_present("reset-db"); 65 | 66 | let repo = Repository::discover(working_dir).expect("Failed to open repository"); 67 | let porcelain = matches.is_present("porcelain"); 68 | 69 | let config = Config::new(porcelain); 70 | let db = config.open_db(debug); 71 | 72 | // make .file, sync, and then delete file to make sure branch is made 73 | let temp_file = working_dir.join(".resync"); 74 | 75 | 76 | if File::create(&temp_file).is_err() && porcelain == false { 77 | println!("Failed creating resync temp file. Repo might not be synced"); 78 | }; 79 | 80 | match sync::sync(&repo) { 81 | Ok(_result) => { 82 | }, 83 | Err(e) => { 84 | if porcelain != true { 85 | println!("Failed to sync. Error: {}", e); 86 | } 87 | } 88 | } 89 | 90 | if remove_file(&temp_file).is_err() && porcelain == false { 91 | println!("Failed removing resync temp file. You can remove it manually by deleting '.resync' in the project root."); 92 | }; 93 | 94 | if porcelain == false { 95 | println!("Searching for out of sync comments..."); 96 | } 97 | 98 | let patterns = [".git", ".swp", "node_modules"]; // TODO: add global pattern list, or read gitignore 99 | 100 | let ac = AhoCorasick::new(&patterns); 101 | 102 | let mut checker = Checker::new(repo, working_dir.to_path_buf(), ac, porcelain, db); 103 | 104 | if matches.is_present("check-file") { 105 | let mut ignore_files: Vec = Vec::new(); 106 | let file = matches.value_of("check-file").unwrap(); // file is relative path 107 | let full_path = Path::join(working_dir, file); 108 | 109 | checker.check_file(full_path, &mut ignore_files); 110 | 111 | std::process::exit(0); 112 | } 113 | 114 | checker.check_working_dir(); 115 | } 116 | 117 | -------------------------------------------------------------------------------- /src/parsers/javascript/comment_parser.rs: -------------------------------------------------------------------------------- 1 | use nom::{ 2 | sequence::{preceded, tuple}, IResult, combinator::iterator, bytes::complete::{take_until, take_while, tag}, character::{complete::multispace0, is_alphabetic, is_newline} 3 | }; 4 | use std::collections::HashMap; 5 | use nom_locate::{LocatedSpan, position}; 6 | 7 | use crate::parsers::types::{SymbolSpan, LineSpan}; 8 | 9 | pub type NomSpan<'a> = LocatedSpan<&'a str>; 10 | 11 | fn start(input: NomSpan) -> IResult { 12 | let (input, _) = preceded(take_until("/*"), tag("/*"))(input)?; 13 | let (input, pos) = position(input)?; 14 | Ok((input, pos)) 15 | } 16 | 17 | pub fn body(input: NomSpan) -> IResult { 18 | let (input, _) = take_until("*/")(input)?; 19 | let (input, pos) = position(input)?; 20 | Ok((input, pos)) 21 | } 22 | 23 | pub fn end(input: NomSpan) -> IResult { 24 | let (input, _) = tag("*/")(input)?; 25 | let (input, pos) = position(input)?; 26 | Ok((input, pos)) 27 | } 28 | 29 | pub fn get_docstring(input: NomSpan) -> IResult { 30 | let (input, (start, _, end)) = tuple((start, body, end))(input)?; 31 | let start_line = start.location_line(); 32 | let start_char = start.get_column(); 33 | 34 | let end_line = end.location_line(); 35 | let end_char = end.get_column(); 36 | 37 | let symbol = SymbolSpan { 38 | start: LineSpan { 39 | line: usize::try_from(start_line).unwrap(), 40 | character: start_char 41 | }, 42 | end: LineSpan { 43 | line: usize::try_from(end_line).unwrap(), 44 | character: end_char 45 | } 46 | }; 47 | 48 | Ok((input, symbol)) 49 | } 50 | 51 | pub fn get_inline_start(input: NomSpan) -> IResult { 52 | let (input, start) = preceded(take_until("//"), tag("//"))(input)?; 53 | let (input, pos) = position(input)?; 54 | 55 | Ok((input, pos)) 56 | } 57 | 58 | pub fn get_inline_end(input: NomSpan) -> IResult { 59 | let mut it = iterator( 60 | input, 61 | get_body 62 | ); 63 | 64 | let parsed: Vec = it.collect(); 65 | 66 | let res: IResult<_, _> = it.finish(); 67 | let output = res.unwrap().0; 68 | let (input, end_pos) = position(output)?; 69 | 70 | Ok((input, end_pos)) 71 | } 72 | 73 | pub fn get_body(input: NomSpan) -> IResult { 74 | let (input, next_line) = preceded(take_until("\n"), tag("\n"))(input)?; 75 | let (input, _) = multispace0(input)?; 76 | let (input, comment) = tag("//")(input)?; 77 | 78 | let (input, pos) = position(input)?; 79 | 80 | Ok((input, pos)) 81 | } 82 | 83 | pub fn get_inline(mut input: NomSpan) -> IResult { 84 | let (input, start) = get_inline_start(input)?; 85 | let (input, end) = get_inline_end(input)?; 86 | 87 | let start_line = start.location_line(); 88 | let start_char = start.get_column(); 89 | 90 | let end_line = end.location_line(); 91 | let end_char = end.get_column(); 92 | 93 | let symbol = SymbolSpan { 94 | start: LineSpan { 95 | line: usize::try_from(start_line).unwrap(), 96 | character: start_char 97 | }, 98 | end: LineSpan { 99 | line: usize::try_from(end_line).unwrap(), 100 | character: end_char 101 | } 102 | }; 103 | 104 | Ok((input, symbol)) 105 | } 106 | 107 | pub fn parse_comments(text: &str) -> Vec { 108 | let mut comments: Vec = Vec::new(); 109 | comments.append(&mut parse_docstring(&text)); 110 | comments.append(&mut parse_inline(&text)); 111 | 112 | return comments; 113 | } 114 | 115 | pub fn parse_docstring(text: &str) -> Vec { 116 | let mut input = NomSpan::new(text); 117 | 118 | let it = std::iter::from_fn(move || { 119 | match get_docstring(input) { 120 | Ok((i, comment)) => { 121 | input = i; 122 | Some(comment) 123 | }, 124 | _ => None, 125 | } 126 | }); 127 | 128 | return it.collect(); 129 | } 130 | 131 | pub fn parse_inline(text: &str) -> Vec { 132 | let mut input = NomSpan::new(text); 133 | 134 | let it = std::iter::from_fn(move || { 135 | match get_inline(input) { 136 | Ok((i, comment)) => { 137 | input = i; 138 | Some(comment) 139 | }, 140 | _ => None, 141 | } 142 | }); 143 | 144 | return it.collect(); 145 | } 146 | -------------------------------------------------------------------------------- /src/parsers/javascript/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod parser; 2 | pub mod visitor; 3 | pub mod comment_parser; -------------------------------------------------------------------------------- /src/parsers/javascript/parser.rs: -------------------------------------------------------------------------------- 1 | use std::{path::PathBuf, fs::read_to_string}; 2 | 3 | use swc_common::{sync::Lrc, comments::SingleThreadedComments}; 4 | use swc_common::SourceMap; 5 | use swc_ecma_parser::{lexer::Lexer, Parser as SwcParser, StringInput, Syntax}; 6 | use swc_ecma_visit::Visit; 7 | 8 | use crate::parsers::{Parser, types::SymbolSpan, javascript::{visitor::JsVisitor, comment_parser::parse_comments}}; 9 | 10 | pub struct JsParser { 11 | pub ts: bool, 12 | } 13 | 14 | impl Parser for JsParser { 15 | fn parse(&self, file: &PathBuf) -> Result, &str> { 16 | let text = read_to_string(&file).expect("Failed to read file"); 17 | let comments: SingleThreadedComments = Default::default(); 18 | let cm: Lrc = Default::default(); 19 | let fm = cm.load_file(file).expect("Failed to load file"); 20 | 21 | let syntax = match self.ts { 22 | true => Syntax::Typescript(Default::default()), 23 | false => Syntax::Es(Default::default()) 24 | }; 25 | 26 | let lexer = Lexer::new( 27 | syntax, 28 | // Syntax::Es(Default::default()), 29 | Default::default(), 30 | StringInput::from(&*fm), 31 | Some(&comments) 32 | ); 33 | 34 | let mut parser = SwcParser::new_from(lexer); 35 | 36 | let module = match parser.parse_module() { 37 | Ok(module) => module, 38 | Err(_) => { 39 | return Err("Failed to parse file"); 40 | } 41 | }; //.expect( 42 | let mut visitor = JsVisitor::new(&text); 43 | 44 | visitor.visit_module(&module); 45 | 46 | let comments = parse_comments(&text); 47 | 48 | let mut matched_symbols: Vec<(SymbolSpan, SymbolSpan)> = Vec::new(); 49 | 50 | for comment in &comments { 51 | // println!("comment"); 52 | // println!("{:#?}", comment.start.line); 53 | // println!("{:#?}", comment.end.line); 54 | 55 | for symbol in &visitor.symbols { 56 | if symbol.start.line - 1 == comment.end.line { 57 | matched_symbols.push((comment.clone(), symbol.clone())); 58 | } 59 | 60 | // this will speed up search but will not allow classes to be found 61 | // else if symbol.start.line - 1 > comment.end.line { 62 | // break; 63 | // } 64 | } 65 | } 66 | 67 | // println!("done"); 68 | 69 | Ok(matched_symbols) 70 | } 71 | } 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/parsers/javascript/visitor.rs: -------------------------------------------------------------------------------- 1 | use swc_common::Span; 2 | use swc_ecma_visit::Visit; 3 | 4 | use crate::parsers::types::{SymbolSpan, LineSpan}; 5 | 6 | pub struct JsVisitor<'a> { 7 | pub spans: Vec, 8 | pub symbols: Vec, 9 | pub text: &'a str, 10 | } 11 | 12 | impl<'a> JsVisitor<'a> { 13 | pub fn new(text: &'a str) -> Self { 14 | JsVisitor { 15 | spans: Vec::new(), 16 | symbols: Vec::new(), 17 | text: text 18 | } 19 | } 20 | } 21 | 22 | impl<'a> Visit for JsVisitor<'a> { 23 | fn visit_decl(&mut self, decl: &swc_ecma_ast::Decl) { 24 | // println!("got on decl"); 25 | let span = match decl { 26 | swc_ecma_ast::Decl::Class(ref e) => { 27 | for member in e.class.body.iter() { 28 | self.visit_class_member(member); 29 | } 30 | e.class.span 31 | }, 32 | 33 | swc_ecma_ast::Decl::Fn(ref e) => e.function.span, 34 | swc_ecma_ast::Decl::Var(ref e) => e.span, 35 | swc_ecma_ast::Decl::TsInterface(ref e) => e.span, 36 | swc_ecma_ast::Decl::TsTypeAlias(ref e) => e.span, 37 | swc_ecma_ast::Decl::TsEnum(ref e) => e.span, 38 | swc_ecma_ast::Decl::TsModule(ref e) => e.span, 39 | }; 40 | 41 | self.symbols.push(to_symbol_span(&self.text, span.lo.0, span.hi.0)); 42 | } 43 | 44 | fn visit_expr(&mut self, expr: &swc_ecma_ast::Expr) { 45 | let span = match expr { 46 | swc_ecma_ast::Expr::This(e) => e.span, 47 | swc_ecma_ast::Expr::Array(e) => e.span, 48 | swc_ecma_ast::Expr::Object(e) => e.span, 49 | swc_ecma_ast::Expr::Fn(e) => e.function.span, 50 | swc_ecma_ast::Expr::Unary(e) => e.span, 51 | swc_ecma_ast::Expr::Update(e) => e.span, 52 | swc_ecma_ast::Expr::Bin(e) => e.span, 53 | swc_ecma_ast::Expr::Assign(e) => e.span, 54 | swc_ecma_ast::Expr::Member(e) => e.span, 55 | swc_ecma_ast::Expr::SuperProp(e) => e.span, 56 | swc_ecma_ast::Expr::Cond(e) => e.span, 57 | swc_ecma_ast::Expr::Call(e) => e.span, 58 | swc_ecma_ast::Expr::New(e) => e.span, 59 | swc_ecma_ast::Expr::Seq(e) => e.span, 60 | swc_ecma_ast::Expr::Ident(e) => e.span, 61 | swc_ecma_ast::Expr::Tpl(e) => e.span, 62 | swc_ecma_ast::Expr::TaggedTpl(e) => e.span, 63 | swc_ecma_ast::Expr::Arrow(e) => e.span, 64 | swc_ecma_ast::Expr::Class(e) => e.class.span, 65 | swc_ecma_ast::Expr::Yield(e) => e.span, 66 | swc_ecma_ast::Expr::MetaProp(e) => e.span, 67 | swc_ecma_ast::Expr::Await(e) => e.span, 68 | swc_ecma_ast::Expr::Paren(e) => e.span, 69 | swc_ecma_ast::Expr::JSXMember(e) => e.prop.span, 70 | swc_ecma_ast::Expr::JSXNamespacedName(e) => e.ns.span, 71 | swc_ecma_ast::Expr::JSXEmpty(e) => e.span, 72 | swc_ecma_ast::Expr::JSXElement(e) => e.span, 73 | swc_ecma_ast::Expr::JSXFragment(e) => e.span, 74 | swc_ecma_ast::Expr::TsTypeAssertion(e) => e.span, 75 | swc_ecma_ast::Expr::TsConstAssertion(e) => e.span, 76 | swc_ecma_ast::Expr::TsNonNull(e) => e.span, 77 | swc_ecma_ast::Expr::TsAs(e) => e.span, 78 | swc_ecma_ast::Expr::TsInstantiation(e) => e.span, 79 | swc_ecma_ast::Expr::PrivateName(e) => e.span, 80 | swc_ecma_ast::Expr::OptChain(e) => e.span, 81 | swc_ecma_ast::Expr::Invalid(e) => e.span, 82 | swc_ecma_ast::Expr::Lit(e) => { 83 | match e { 84 | swc_ecma_ast::Lit::Str(n) => n.span, 85 | swc_ecma_ast::Lit::Bool(n) => n.span, 86 | swc_ecma_ast::Lit::Null(n) => n.span, 87 | swc_ecma_ast::Lit::Num(n) => n.span, 88 | swc_ecma_ast::Lit::BigInt(n) => n.span, 89 | swc_ecma_ast::Lit::Regex(n) => n.span, 90 | swc_ecma_ast::Lit::JSXText(n) => n.span, 91 | } 92 | }, 93 | }; 94 | 95 | self.symbols.push(to_symbol_span(&self.text, span.lo.0, span.hi.0)); 96 | } 97 | 98 | fn visit_class_member(&mut self, member: &swc_ecma_ast::ClassMember) { 99 | let span = match member { 100 | swc_ecma_ast::ClassMember::Constructor(ref e) => e.span, 101 | swc_ecma_ast::ClassMember::Method(ref e) => e.span, 102 | swc_ecma_ast::ClassMember::PrivateMethod(e) => e.span, 103 | swc_ecma_ast::ClassMember::ClassProp(e) => e.span, 104 | swc_ecma_ast::ClassMember::PrivateProp(e) => e.span, 105 | swc_ecma_ast::ClassMember::TsIndexSignature(e) => e.span, 106 | swc_ecma_ast::ClassMember::Empty(e) => e.span, 107 | swc_ecma_ast::ClassMember::StaticBlock(e) => e.span, 108 | }; 109 | self.symbols.push(to_symbol_span(&self.text, span.lo.0, span.hi.0)); 110 | // println!("visiting class member"); 111 | } 112 | 113 | } 114 | 115 | fn to_symbol_span(text: &str, start: u32, end: u32) -> SymbolSpan { 116 | return SymbolSpan { 117 | start: to_line_span(&text, usize::try_from(start).unwrap(), true), 118 | end: to_line_span(&text, usize::try_from(end).unwrap(), false)} 119 | } 120 | 121 | 122 | // Make return result 123 | fn to_line_span(text: &str, offset: usize, start: bool) -> LineSpan { 124 | let mut char_idx: usize = 0; 125 | let mut line_idx: usize = 0; 126 | 127 | if start == true { 128 | line_idx += 1; 129 | } 130 | 131 | for (idx, char) in text.chars().enumerate() { 132 | if idx == offset { 133 | return LineSpan { 134 | character: char_idx, 135 | line: line_idx 136 | } 137 | } 138 | char_idx += 1; 139 | if char == '\n' { 140 | char_idx = 0; 141 | line_idx += 1; 142 | } 143 | } 144 | 145 | // this happens if file doesn't have empty line at the end 146 | return LineSpan { 147 | character: char_idx, 148 | line: line_idx 149 | }; 150 | // panic!("Failed to get line span"); 151 | } 152 | -------------------------------------------------------------------------------- /src/parsers/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod types; 2 | pub mod rust; 3 | pub mod javascript; 4 | 5 | use crate::parsers::{ 6 | rust::parser::RsParser, 7 | javascript::parser::JsParser, 8 | types::SymbolSpan}; 9 | use std::{vec::Vec, path::PathBuf}; 10 | use aho_corasick::AhoCorasick; 11 | 12 | pub fn get_parser(file: &PathBuf, ignore_patterns: &Vec) -> Option> { 13 | let ac = AhoCorasick::new(ignore_patterns); 14 | let f = file.to_str().unwrap(); 15 | 16 | if ac.is_match(f) { 17 | return None; 18 | } 19 | 20 | let extension = match file.extension() { 21 | Some(ext) => { 22 | ext.to_str().unwrap() 23 | }, 24 | _ => { 25 | return None; 26 | } 27 | }; 28 | 29 | // just use ecma instead of js or ts or any of these, and do the check in the file 30 | match extension { 31 | "js" => Some(Box::new(JsParser {ts: false})), 32 | "jsx" => Some(Box::new(JsParser {ts: false})), 33 | "ts" => Some(Box::new(JsParser {ts: true})), 34 | /* 35 | "tsx" => Some(Box::new(JsParser {ts: true})), 36 | */ 37 | "rs" => Some(Box::new(RsParser {})), 38 | _ => { 39 | // println!("Language '{}' for {} not supported, continuing.", extension, f); 40 | None 41 | } 42 | } 43 | } 44 | 45 | pub trait Parser { 46 | fn parse(&self, file: &PathBuf) -> Result, &str>; 47 | } -------------------------------------------------------------------------------- /src/parsers/rust/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod parser; 2 | pub mod visitor; 3 | pub mod tools; 4 | -------------------------------------------------------------------------------- /src/parsers/rust/parser.rs: -------------------------------------------------------------------------------- 1 | use std::fs::read_to_string; 2 | use std::{str, path::PathBuf}; 3 | use std::vec::Vec; 4 | use crate::parsers::{ 5 | types::SymbolSpan, 6 | rust:: 7 | visitor::RsVisitor, 8 | Parser}; 9 | use syn::visit::Visit; 10 | 11 | pub struct RsParser; 12 | 13 | impl Parser for RsParser { 14 | fn parse(&self, file: &PathBuf) -> Result, &str> { 15 | let file_input = match read_to_string(&file) { 16 | Ok(read) => read, 17 | Err(_) => { 18 | return Err("Failed to read file"); 19 | } 20 | }; 21 | let ast = match syn::parse_file(&file_input) { 22 | Ok(ast) => ast, 23 | Err(_) => { 24 | return Err("Failed to parse file"); 25 | } 26 | }; 27 | 28 | let mut visitor = RsVisitor { symbols: Vec::new() }; 29 | visitor.visit_file(&ast); 30 | 31 | // for symbol in &visitor.symbols { 32 | // println!("{:#?}", symbol.0); 33 | // } 34 | 35 | Ok(visitor.symbols) 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/parsers/rust/tools.rs: -------------------------------------------------------------------------------- 1 | use syn::{Item, ImplItem, Attribute}; 2 | use crate::parsers::types::{SymbolSpan, LineSpan}; 3 | use proc_macro2::LineColumn; 4 | use std::vec::Vec; 5 | 6 | // will try to get these merged into upstream syn so this code doesn't have to be here. 7 | // Also if you have an idea of how I can walk the entire syntax tree without repetitive code all 8 | // help is welcome 9 | pub fn get_attrs_impl_item(item: &ImplItem) -> Option<&Vec> { 10 | match item { 11 | ImplItem::Const(syn::ImplItemConst { attrs, ..}) 12 | | ImplItem::Method(syn::ImplItemMethod { attrs, ..}) 13 | | ImplItem::Type(syn::ImplItemType { attrs, .. }) 14 | | ImplItem::Macro(syn::ImplItemMacro { attrs, .. }) => { 15 | Some(attrs) 16 | }, 17 | _ => None 18 | } 19 | } 20 | 21 | /// Returns a shared reference to the attributes of the item. 22 | pub fn get_attrs_item(item: &Item) -> Option<&Vec> { 23 | match item { 24 | Item::Const(syn::ItemConst { attrs, .. }) 25 | | Item::Enum(syn::ItemEnum { attrs, .. }) 26 | | Item::ExternCrate(syn::ItemExternCrate { attrs, .. }) 27 | | Item::Fn(syn::ItemFn { attrs, .. }) 28 | | Item::ForeignMod(syn::ItemForeignMod { attrs, .. }) 29 | | Item::Impl(syn::ItemImpl { attrs, .. }) 30 | | Item::Macro(syn::ItemMacro { attrs, .. }) 31 | | Item::Macro2(syn::ItemMacro2 { attrs, .. }) 32 | | Item::Mod(syn::ItemMod { attrs, .. }) 33 | | Item::Static(syn::ItemStatic { attrs, .. }) 34 | | Item::Struct(syn::ItemStruct { attrs, .. }) 35 | | Item::Trait(syn::ItemTrait { attrs, .. }) 36 | | Item::TraitAlias(syn::ItemTraitAlias { attrs, .. }) 37 | | Item::Type(syn::ItemType { attrs, .. }) 38 | | Item::Union(syn::ItemUnion { attrs, .. }) => { 39 | Some(attrs) 40 | }, 41 | _ => None 42 | } 43 | } 44 | 45 | /// Gets the range of a comment, and returns none if there is no comment in the attribute 46 | pub fn get_comment_range(attrs: &Vec) -> Option { 47 | if attrs.len() <= 0 { 48 | return None; 49 | } 50 | 51 | let mut start: Option = None; 52 | 53 | let mut end: Option = None; 54 | 55 | for attr in attrs { 56 | let ident = match attr.path.get_ident() { 57 | Some(i) => i, 58 | _ => { 59 | continue; 60 | } 61 | }; 62 | 63 | if ident.to_string() != "doc" { 64 | continue; 65 | } 66 | 67 | let span = ident.span(); 68 | 69 | match start { 70 | Some(start_val) => { 71 | if span.start().line < start_val.line { 72 | start = Some(span.start()); 73 | } 74 | }, 75 | _ => { 76 | start = Some(span.start()); 77 | }, 78 | } 79 | 80 | match end { 81 | Some(end_val) => { 82 | if span.end().line > end_val.line { 83 | end = Some(span.end()); 84 | } 85 | }, 86 | _ => { 87 | end = Some(span.end()); 88 | } 89 | } 90 | } 91 | 92 | if start.is_none() || end.is_none() { 93 | return None; 94 | } 95 | 96 | return Some(SymbolSpan { 97 | start: LineSpan { 98 | line: start.unwrap().line, 99 | character: start.unwrap().column 100 | }, 101 | end: LineSpan { 102 | line: end.unwrap().line, 103 | character: end.unwrap().column 104 | } 105 | }); 106 | 107 | } 108 | 109 | -------------------------------------------------------------------------------- /src/parsers/rust/visitor.rs: -------------------------------------------------------------------------------- 1 | use crate::parsers::{ 2 | types::{SymbolSpan, LineSpan}, 3 | rust::tools::{get_attrs_item, get_attrs_impl_item, get_comment_range}}; 4 | use syn::{Item, ImplItem, visit::{self, Visit}}; 5 | use syn::spanned::Spanned; 6 | 7 | /// keeps track of all the code + comment pairs 8 | pub struct RsVisitor { 9 | pub symbols: Vec<(SymbolSpan, SymbolSpan)>, 10 | } 11 | 12 | impl<'ast> Visit<'ast> for RsVisitor { 13 | fn visit_item(&mut self, node: &'ast Item) { 14 | 15 | let fun = &node.span(); 16 | // println!("{:#?}", span); 17 | 18 | let attrs = match get_attrs_item(node) { 19 | Some(attrs) => attrs, 20 | _ => { 21 | return visit::visit_item(self, node); 22 | } 23 | }; 24 | 25 | let comment = match get_comment_range(attrs) { 26 | Some(comment) => comment, 27 | _ => { 28 | return visit::visit_item(self, node); 29 | } 30 | }; 31 | 32 | let function = SymbolSpan { 33 | start: LineSpan { 34 | line: comment.end.line + 1, 35 | character: fun.start().column 36 | }, 37 | end: LineSpan { 38 | line: fun.end().line, 39 | character: fun.end().column 40 | } 41 | }; 42 | 43 | self.symbols.push((comment, function)); 44 | 45 | return visit::visit_item(self, node); 46 | } 47 | 48 | fn visit_impl_item(&mut self, node: &'ast ImplItem) { 49 | let fun = node.span(); 50 | 51 | let attrs = match get_attrs_impl_item(node) { 52 | Some(attrs) => attrs, 53 | _ => { 54 | return visit::visit_impl_item(self, node); 55 | } 56 | }; 57 | 58 | let comment = match get_comment_range(attrs) { 59 | Some(comment) => comment, 60 | _ => { 61 | return visit::visit_impl_item(self, node); 62 | } 63 | }; 64 | 65 | let function = SymbolSpan { 66 | start: LineSpan { 67 | line: comment.end.line + 1, 68 | character: fun.start().column 69 | }, 70 | end: LineSpan { 71 | line: fun.end().line, 72 | character: fun.end().column 73 | } 74 | }; 75 | 76 | self.symbols.push((comment, function)); 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /src/parsers/types.rs: -------------------------------------------------------------------------------- 1 | use serde::{Serialize, Deserialize}; 2 | 3 | #[derive(Debug, Serialize, Deserialize, Clone, Copy)] 4 | pub struct LineSpan { 5 | pub line: usize, 6 | pub character: usize, 7 | } 8 | 9 | #[derive(Debug, Serialize, Deserialize, Clone, Copy)] 10 | pub struct SymbolSpan { 11 | pub start: LineSpan, 12 | pub end: LineSpan, 13 | } 14 | -------------------------------------------------------------------------------- /src/sync.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Tim Kellogg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * This code was taken from "dura" - a background process that watches your Git repos and commits 17 | * your uncommited changes without impacting HEAD the current branch, or the Git index. 18 | * 19 | * https://github.com/tkellogg/dura 20 | * Latest commit to file: 4948b965e81aa8cbba02737dca41f218b5b22956 21 | * 22 | * Changes 23 | * - Removed output 24 | * - Changed occurences of "dura" to "resync" 25 | * - Changed "capture" function name to "sync" 26 | * - Removed function "is_repo", "get_git_author", and "get_git_email" 27 | * - Renamed from "snapshot.rs" to "sync.rs" 28 | * - Changed return type from CaptureStatus to boolean 29 | * - Added docstring to "sync" function 30 | * - Removed config using 31 | * - sync takes in a git2::Repository instead of path 32 | */ 33 | 34 | use git2::{BranchType, DiffOptions, Error, IndexAddOption, Repository, Signature}; 35 | use std::path::Path; 36 | 37 | /// Makes a commit to the resync branch with so there are no uncommited changes 38 | /// when we get the out of sync comments. This is also used to constantly keep 39 | /// track of the out of sync comments in the extension 40 | /// 41 | /// Does not impact the head of your repo 42 | pub fn sync(repo: &Repository) -> Result { 43 | let head = repo.head()?.peel_to_commit()?; 44 | let message = "resync auto-sync"; 45 | 46 | // status check 47 | if repo.statuses(None)?.is_empty() { 48 | return Ok(head.id().to_string()); 49 | } 50 | 51 | // add cleanup function, which deletes old branches 52 | let branch_name = format!("resync/{}", head.id()); 53 | let branch_commit = match repo.find_branch(&branch_name, BranchType::Local) { 54 | Ok(mut branch) => { 55 | match branch.get().peel_to_commit() { 56 | Ok(commit) if commit.id() != head.id() => Some(commit), 57 | _ => { 58 | branch.delete()?; 59 | None 60 | } 61 | } 62 | } 63 | Err(_) => None, 64 | }; 65 | let parent_commit = branch_commit.as_ref().unwrap_or(&head); 66 | 67 | // tree 68 | let mut index = repo.index()?; 69 | index.add_all(["*"].iter(), IndexAddOption::DEFAULT, None)?; 70 | 71 | let dirty_diff = repo.diff_tree_to_index( 72 | Some(&parent_commit.tree()?), 73 | Some(&index), 74 | Some(DiffOptions::new().include_untracked(true)), 75 | )?; 76 | if dirty_diff.deltas().len() == 0 { 77 | return Ok(head.id().to_string()); 78 | } 79 | 80 | let tree_oid = index.write_tree()?; 81 | let tree = repo.find_tree(tree_oid)?; 82 | if repo.find_branch(&branch_name, BranchType::Local).is_err() { 83 | repo.branch(branch_name.as_str(), &head, false)?; 84 | } 85 | 86 | let committer = Signature::now("resync", "support@readable.so")?; 87 | let oid = repo.commit( 88 | Some(&format!("refs/heads/{}", &branch_name)), 89 | &committer, 90 | &committer, 91 | message, 92 | &tree, 93 | &[parent_commit], 94 | )?; 95 | 96 | Ok(oid.to_string()) 97 | } 98 | -------------------------------------------------------------------------------- /src/tools.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | use std::str; 3 | use std::path::Path; 4 | use crate::info::LineInfo; 5 | use crate::parsers::types::{SymbolSpan}; 6 | use bat::{ 7 | line_range::{LineRange, LineRanges}, 8 | PrettyPrinter}; 9 | 10 | pub fn get_latest_line(blame_info: &HashMap, symbol: &SymbolSpan) -> usize { 11 | let start = symbol.start.line - 1; // because symbol is 1 indexed 12 | let end = symbol.end.line - 1; 13 | 14 | let mut latest = 0; 15 | let mut time = 0; 16 | for line in start..=end { 17 | // println!("{}", line); 18 | let line_info = blame_info.get(&line).expect("Failed to get line at blame"); 19 | if line_info.time > time { 20 | latest = line; 21 | time = line_info.time; 22 | } 23 | } 24 | 25 | return latest; 26 | // return latest; 27 | } 28 | 29 | /// Checks if one commit makes up more than x percent of a function. 30 | /// 31 | /// Eg: if commit aaaa doesn't make up more than 40% of a function, it returns false 32 | pub fn check_control(blame_info: &HashMap, symbol: &SymbolSpan) -> bool { 33 | let mut map: HashMap = HashMap::new(); 34 | let mut total_lines: f32 = 0.0; 35 | 36 | for line in symbol.start.line..symbol.end.line { 37 | let line_info = blame_info.get(&line).expect("Failed to get line"); 38 | let count = map.entry(line_info.time).or_insert(0.0); 39 | *count += 1.0; 40 | total_lines += 1.0; 41 | } 42 | 43 | for (_time, amount) in &map { 44 | let control = amount / total_lines; 45 | if control > 0.40 { 46 | return true; 47 | } 48 | } 49 | 50 | return false; 51 | } 52 | 53 | pub fn print_symbol(function: &SymbolSpan, comment: &SymbolSpan, file: &Path, language: &str, _: &String, _: &usize) { 54 | let function_start = function.start.line; 55 | let function_end = function.end.line; 56 | 57 | let comment_start = comment.start.line; 58 | let comment_end = comment.end.line; 59 | 60 | let new_function_end = match function_start + 3 >= function_end { 61 | true => function_end, 62 | false => function_start + 3, 63 | }; 64 | 65 | let ranges = vec!( 66 | LineRange::new( 67 | function_start, 68 | new_function_end 69 | ), 70 | LineRange::new( 71 | comment_start, 72 | comment_end 73 | )); 74 | 75 | PrettyPrinter::new() 76 | .input_file(file) 77 | .language(language) 78 | .line_numbers(true) 79 | .line_ranges(LineRanges::from(ranges)) 80 | .print() 81 | .unwrap(); 82 | println!(""); 83 | } 84 | 85 | pub fn unix_time_diff(current: u128, prev: u128) -> String { 86 | let elapsed = current - prev; 87 | 88 | let s_per_min = 60; 89 | let s_per_hour= s_per_min * 60; 90 | let s_per_day= s_per_hour * 24; 91 | let s_per_month= s_per_day * 30; 92 | let s_per_year = s_per_day * 365; 93 | 94 | if elapsed < s_per_min { 95 | return format!("{} seconds ago", elapsed / 1000); 96 | } 97 | 98 | else if elapsed < s_per_hour { 99 | return format!("{} minutes ago", elapsed / s_per_min); 100 | } 101 | 102 | else if elapsed < s_per_day { 103 | return format!("{} hours ago", elapsed / s_per_hour); 104 | } 105 | 106 | else if elapsed < s_per_month { 107 | return format!("{} days ago", elapsed / s_per_day); 108 | } 109 | 110 | else if elapsed < s_per_year { 111 | return format!("{} months ago", elapsed / s_per_month); 112 | } 113 | 114 | else { 115 | return format!("{} years ago", elapsed / s_per_year); 116 | } 117 | } --------------------------------------------------------------------------------