Skip to content

Commit

Permalink
feat: enable handling of grit files
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Nov 6, 2024
1 parent 041e825 commit 1733332
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/repository_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build WASM module for the web
run: wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --profiling --scope biomejs crates/biome_wasm --features experimental-html,experimental-grit
run: wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --profiling --scope biomejs crates/biome_wasm --features experimental-html

# https://github.com/actions/cache/issues/342
- name: Clear old wasm-pack cache
Expand Down
109 changes: 54 additions & 55 deletions crates/biome_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
authors.workspace = true
authors.workspace = true
categories.workspace = true
description = "Biome's command line interface"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_cli"
publish = false
description = "Biome's command line interface"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_cli"
publish = false
repository.workspace = true
version = "0.0.0"
version = "0.0.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -18,47 +18,47 @@ name = "biome"
path = "src/main.rs"

[dependencies]
anyhow = { workspace = true }
biome_analyze = { workspace = true }
biome_configuration = { workspace = true }
biome_console = { workspace = true }
biome_deserialize = { workspace = true }
anyhow = { workspace = true }
biome_analyze = { workspace = true }
biome_configuration = { workspace = true }
biome_console = { workspace = true }
biome_deserialize = { workspace = true }
biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
biome_flags = { workspace = true }
biome_formatter = { workspace = true }
biome_fs = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_formatter = { workspace = true }
biome_json_formatter = { workspace = true }
biome_json_parser = { workspace = true }
biome_json_syntax = { workspace = true }
biome_lsp = { workspace = true }
biome_migrate = { workspace = true }
biome_rowan = { workspace = true }
biome_service = { workspace = true }
biome_text_edit = { workspace = true }
bpaf = { workspace = true, features = ["bright-color"] }
crossbeam = { workspace = true }
dashmap = { workspace = true }
hdrhistogram = { version = "7.5.4", default-features = false }
indexmap = { workspace = true }
path-absolutize = { version = "3.1.1", optional = false, features = ["use_unix_paths_on_wasm"] }
quick-junit = "0.5.0"
rayon = { workspace = true }
regex = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
smallvec = { workspace = true }
tokio = { workspace = true, features = ["io-std", "io-util", "net", "time", "rt", "sync", "rt-multi-thread", "macros"] }
tracing = { workspace = true }
tracing-appender = "0.2.3"
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
tracing-tree = "0.4.0"
biome_diagnostics = { workspace = true }
biome_flags = { workspace = true }
biome_formatter = { workspace = true }
biome_fs = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_formatter = { workspace = true }
biome_json_formatter = { workspace = true }
biome_json_parser = { workspace = true }
biome_json_syntax = { workspace = true }
biome_lsp = { workspace = true }
biome_migrate = { workspace = true }
biome_rowan = { workspace = true }
biome_service = { workspace = true }
biome_text_edit = { workspace = true }
bpaf = { workspace = true, features = ["bright-color"] }
crossbeam = { workspace = true }
dashmap = { workspace = true }
hdrhistogram = { version = "7.5.4", default-features = false }
indexmap = { workspace = true }
path-absolutize = { version = "3.1.1", optional = false, features = ["use_unix_paths_on_wasm"] }
quick-junit = "0.5.0"
rayon = { workspace = true }
regex = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
smallvec = { workspace = true }
tokio = { workspace = true, features = ["io-std", "io-util", "net", "time", "rt", "sync", "rt-multi-thread", "macros"] }
tracing = { workspace = true }
tracing-appender = "0.2.3"
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
tracing-tree = "0.4.0"

[target.'cfg(unix)'.dependencies]
libc = "0.2.161"
libc = "0.2.161"
tokio = { workspace = true, features = ["process"] }

[target.'cfg(windows)'.dependencies]
Expand All @@ -68,17 +68,16 @@ mimalloc = "0.1.43"
tikv-jemallocator = "0.6.0"

[dev-dependencies]
biome_css_formatter = { workspace = true }
biome_js_formatter = { workspace = true }
biome_css_formatter = { workspace = true }
biome_js_formatter = { workspace = true }
biome_json_formatter = { workspace = true }
biome_json_parser = { workspace = true }
insta = { workspace = true }
regex = { workspace = true }
tokio = { workspace = true, features = ["io-util"] }
biome_json_parser = { workspace = true }
insta = { workspace = true }
regex = { workspace = true }
tokio = { workspace = true, features = ["io-util"] }

[features]
docgen = ["bpaf/docgen"]
experimental-grit = ["biome_service/experimental-grit"]
docgen = ["bpaf/docgen"]
experimental-html = ["biome_service/experimental-html"]

[lints]
Expand Down
40 changes: 20 additions & 20 deletions crates/biome_grit_formatter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
[package]
authors.workspace = true
authors.workspace = true
categories.workspace = true
description = "Biome's GritQL formatter"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_grit_formatter"
description = "Biome's GritQL formatter"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_grit_formatter"
repository.workspace = true
version = "0.0.0"
version = "0.0.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
biome_formatter = { workspace = true }
biome_formatter = { workspace = true }
biome_grit_syntax = { workspace = true }
biome_rowan = { workspace = true }
biome_rowan = { workspace = true }

[dev-dependencies]
biome_configuration = { path = "../biome_configuration" }
biome_configuration = { path = "../biome_configuration" }
biome_formatter_test = { path = "../biome_formatter_test" }
biome_fs = { path = "../biome_fs" }
biome_grit_factory = { path = "../biome_grit_factory" }
biome_grit_parser = { path = "../biome_grit_parser" }
biome_parser = { path = "../biome_parser" }
biome_service = { path = "../biome_service", features = ["experimental-grit"] }
countme = { workspace = true, features = ["enable"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tests_macros = { path = "../tests_macros" }
biome_fs = { path = "../biome_fs" }
biome_grit_factory = { path = "../biome_grit_factory" }
biome_grit_parser = { path = "../biome_grit_parser" }
biome_parser = { path = "../biome_parser" }
biome_service = { path = "../biome_service" }
countme = { workspace = true, features = ["enable"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tests_macros = { path = "../tests_macros" }
# cargo-workspaces metadata
[package.metadata.workspaces]
independent = true
Expand Down
146 changes: 72 additions & 74 deletions crates/biome_service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,93 +1,91 @@
[package]
authors.workspace = true
authors.workspace = true
categories.workspace = true
description = "Biome's core functionality"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_service"
publish = false
description = "Biome's core functionality"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_service"
publish = false
repository.workspace = true
version = "0.0.0"
version = "0.0.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
biome_analyze = { workspace = true, features = ["serde"] }
biome_configuration = { workspace = true, features = ["schema"] }
biome_console = { workspace = true }
biome_css_analyze = { workspace = true }
biome_css_formatter = { workspace = true }
biome_css_parser = { workspace = true }
biome_css_syntax = { workspace = true }
biome_deserialize = { workspace = true }
biome_analyze = { workspace = true, features = ["serde"] }
biome_configuration = { workspace = true, features = ["schema"] }
biome_console = { workspace = true }
biome_css_analyze = { workspace = true }
biome_css_formatter = { workspace = true }
biome_css_parser = { workspace = true }
biome_css_syntax = { workspace = true }
biome_deserialize = { workspace = true }
biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
biome_flags = { workspace = true }
biome_formatter = { workspace = true, features = ["serde"] }
biome_fs = { workspace = true, features = ["serde"] }
biome_graphql_analyze = { workspace = true }
biome_graphql_formatter = { workspace = true }
biome_graphql_parser = { workspace = true }
biome_graphql_syntax = { workspace = true }
biome_grit_formatter = { workspace = true }
biome_grit_parser = { workspace = true }
biome_grit_patterns = { workspace = true }
biome_grit_syntax = { workspace = true }
biome_html_formatter = { workspace = true }
biome_html_parser = { workspace = true }
biome_html_syntax = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_factory = { workspace = true, optional = true }
biome_js_formatter = { workspace = true, features = ["serde"] }
biome_js_parser = { workspace = true }
biome_js_semantic = { workspace = true }
biome_js_syntax = { workspace = true, features = ["schema"] }
biome_json_analyze = { workspace = true }
biome_json_formatter = { workspace = true, features = ["serde"] }
biome_json_parser = { workspace = true }
biome_json_syntax = { workspace = true }
biome_parser = { workspace = true }
biome_project = { workspace = true }
biome_rowan = { workspace = true, features = ["serde"] }
biome_string_case = { workspace = true }
biome_text_edit = { workspace = true }
bpaf = { workspace = true }
dashmap = { workspace = true }
enumflags2 = { workspace = true, features = ["serde"] }
getrandom = { workspace = true, features = ["js"] }
ignore = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
oxc_resolver = { workspace = true }
regex = { workspace = true }
rustc-hash = { workspace = true }
schemars = { workspace = true, features = ["indexmap1"], optional = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["raw_value"] }
slotmap = { workspace = true, features = ["serde"] }
smallvec = { workspace = true, features = ["serde"] }
tracing = { workspace = true, features = ["attributes", "log"] }
biome_diagnostics = { workspace = true }
biome_flags = { workspace = true }
biome_formatter = { workspace = true, features = ["serde"] }
biome_fs = { workspace = true, features = ["serde"] }
biome_graphql_analyze = { workspace = true }
biome_graphql_formatter = { workspace = true }
biome_graphql_parser = { workspace = true }
biome_graphql_syntax = { workspace = true }
biome_grit_formatter = { workspace = true }
biome_grit_parser = { workspace = true }
biome_grit_patterns = { workspace = true }
biome_grit_syntax = { workspace = true }
biome_html_formatter = { workspace = true }
biome_html_parser = { workspace = true }
biome_html_syntax = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_factory = { workspace = true, optional = true }
biome_js_formatter = { workspace = true, features = ["serde"] }
biome_js_parser = { workspace = true }
biome_js_semantic = { workspace = true }
biome_js_syntax = { workspace = true, features = ["schema"] }
biome_json_analyze = { workspace = true }
biome_json_formatter = { workspace = true, features = ["serde"] }
biome_json_parser = { workspace = true }
biome_json_syntax = { workspace = true }
biome_parser = { workspace = true }
biome_project = { workspace = true }
biome_rowan = { workspace = true, features = ["serde"] }
biome_string_case = { workspace = true }
biome_text_edit = { workspace = true }
bpaf = { workspace = true }
dashmap = { workspace = true }
enumflags2 = { workspace = true, features = ["serde"] }
getrandom = { workspace = true, features = ["js"] }
ignore = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
oxc_resolver = { workspace = true }
regex = { workspace = true }
rustc-hash = { workspace = true }
schemars = { workspace = true, features = ["indexmap1"], optional = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["raw_value"] }
slotmap = { workspace = true, features = ["serde"] }
smallvec = { workspace = true, features = ["serde"] }
tracing = { workspace = true, features = ["attributes", "log"] }

[features]
experimental-grit = []
experimental-html = []

schema = [
"dep:schemars",
"biome_js_analyze/schema",
"biome_formatter/serde",
"biome_js_factory",
"biome_text_edit/schemars",
"biome_json_syntax/schema",
"biome_css_syntax/schema",
"biome_graphql_syntax/schema",
"biome_grit_syntax/schema",

"dep:schemars",
"biome_js_analyze/schema",
"biome_formatter/serde",
"biome_js_factory",
"biome_text_edit/schemars",
"biome_json_syntax/schema",
"biome_css_syntax/schema",
"biome_graphql_syntax/schema",
"biome_grit_syntax/schema",
]

[dev-dependencies]
insta = { workspace = true }
insta = { workspace = true }
tests_macros = { workspace = true }

[lints]
Expand Down
6 changes: 2 additions & 4 deletions crates/biome_service/src/file_handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ impl DocumentFileSource {
return Ok(file_source.into());
}

#[cfg(feature = "experimental-grit")]
if let Ok(file_source) = GritFileSource::try_from_extension(extension) {
return Ok(file_source.into());
}
Expand Down Expand Up @@ -192,7 +191,6 @@ impl DocumentFileSource {
if let Ok(file_source) = HtmlFileSource::try_from_language_id(language_id) {
return Ok(file_source.into());
}
#[cfg(feature = "experimental-grit")]
if let Ok(file_source) = GritFileSource::try_from_language_id(language_id) {
return Ok(file_source.into());
}
Expand Down Expand Up @@ -350,9 +348,9 @@ impl DocumentFileSource {
},
DocumentFileSource::Css(_)
| DocumentFileSource::Graphql(_)
| DocumentFileSource::Json(_) => true,
| DocumentFileSource::Json(_)
| DocumentFileSource::Grit(_) => true,
DocumentFileSource::Html(_) => cfg!(feature = "experimental-html"),
DocumentFileSource::Grit(_) => cfg!(feature = "experimental-grit"),
DocumentFileSource::Unknown => false,
}
}
Expand Down
Loading

0 comments on commit 1733332

Please sign in to comment.