From f8417224eb9cbc2e4ae134ae197670a0bc53df2e Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Wed, 16 Oct 2024 12:41:55 -0700 Subject: [PATCH] fix: use syntect for deno doc html generation (#26322) --- Cargo.lock | 180 +++++++++++++------------------------------------ cli/Cargo.toml | 2 +- 2 files changed, 46 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12c0f9375d..e3a6556904 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1509,9 +1509,9 @@ dependencies = [ [[package]] name = "deno_doc" -version = "0.153.0" +version = "0.154.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6925db7ad16bee4bdcb7e654d2475e2fbd5e1d7dd4c6ee5f030ee858b4a2a8ee" +checksum = "17e204e45b0d79750880114e37b34abe19ad0710d8435a8da8f23a528fe98de4" dependencies = [ "anyhow", "cfg-if", @@ -1528,18 +1528,8 @@ dependencies = [ "regex", "serde", "serde_json", + "syntect", "termcolor", - "tree-sitter-bash", - "tree-sitter-css", - "tree-sitter-highlight", - "tree-sitter-html", - "tree-sitter-javascript", - "tree-sitter-json", - "tree-sitter-md", - "tree-sitter-regex", - "tree-sitter-rust", - "tree-sitter-typescript", - "tree-sitter-xml", ] [[package]] @@ -4766,6 +4756,28 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "onig" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" +dependencies = [ + "bitflags 1.3.2", + "libc", + "once_cell", + "onig_sys", +] + +[[package]] +name = "onig_sys" +version = "69.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "opaque-debug" version = "0.3.1" @@ -7054,6 +7066,26 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "syntect" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" +dependencies = [ + "bincode", + "bitflags 1.3.2", + "flate2", + "fnv", + "once_cell", + "onig", + "regex-syntax", + "serde", + "serde_derive", + "serde_json", + "thiserror", + "walkdir", +] + [[package]] name = "tap" version = "1.0.1" @@ -7491,128 +7523,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tree-sitter" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca" -dependencies = [ - "cc", - "regex", -] - -[[package]] -name = "tree-sitter-bash" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5244703ad2e08a616d859a0557d7aa290adcd5e0990188a692e628ffe9dce40" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-css" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e08e324b1cf60fd3291774b49724c66de2ce8fcf4d358d0b4b82e37b41b1c9b" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-highlight" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaca0fe34fa96eec6aaa8e63308dbe1bafe65a6317487c287f93938959b21907" -dependencies = [ - "lazy_static", - "regex", - "thiserror", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-html" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8766b5ad3721517f8259e6394aefda9c686aebf7a8c74ab8624f2c3b46902fd5" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-javascript" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8710a71bc6779e33811a8067bdda3ed08bed1733296ff915e44faf60f8c533d7" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-json" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b737dcb73c35d74b7d64a5f3dde158113c86a012bf3cee2bfdf2150d23b05db" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-md" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c3cfd068f2527250bbd8ff407431164e12b17863e7eafb76e311dd3f96965a" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-regex" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ff1286fe9651b2797484839ffa37aa76c8618d4ccb6836d7e31765dfd60c0d5" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-rust" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277690f420bf90741dea984f3da038ace46c4fe6047cba57a66822226cde1c93" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-typescript" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecb35d98a688378e56c18c9c159824fd16f730ccbea19aacf4f206e5d5438ed9" -dependencies = [ - "cc", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-xml" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c3a1b08e9842143f84fde1a18ac40ee77ca80a80b14077e4ca67a3b4808b8b" -dependencies = [ - "cc", - "tree-sitter", -] - [[package]] name = "triomphe" version = "0.1.13" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 837f98f5b7..8f733fc796 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -72,7 +72,7 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposa deno_cache_dir = { workspace = true } deno_config = { version = "=0.37.1", features = ["workspace", "sync"] } deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } -deno_doc = { version = "0.153.0", features = ["html"] } +deno_doc = { version = "0.154.0", default-features = false, features = ["rust", "html", "syntect"] } deno_graph = { version = "=0.83.3" } deno_lint = { version = "=0.67.0", features = ["docs"] } deno_lockfile.workspace = true