diff --git a/.cargo/config.toml b/.cargo/config.toml index 7b6e1c4..ad52f7f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,26 +5,17 @@ tu = "run -p cargo-rst -- update" [target.x86_64-apple-darwin] -rustflags = [ - "-C", "link-arg=-undefined", - "-C", "link-arg=dynamic_lookup", -] +rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"] [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" [target.aarch64-unknown-linux-musl] linker = "aarch64-linux-musl-gcc" rustflags = ["-C", "target-feature=-crt-static"] [target.aarch64-apple-darwin] -rustflags = [ - "-C", "link-arg=-undefined", - "-C", "link-arg=dynamic_lookup", -] +rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"] [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" [target.x86_64-unknown-linux-musl] -rustflags = [ - "-C", - "target-feature=-crt-static", -] +rustflags = ["-C", "target-feature=-crt-static"] diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..709644b --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,9 @@ +include = [ + "Cargo.toml", + "crates/*/*.toml", + "tasks/*/*.toml", +] + +[formatting] +align_entries = true +column_width = 120 diff --git a/Cargo.toml b/Cargo.toml index b98b44b..080d351 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,22 +1,16 @@ cargo-features = ["strip"] [workspace] -members = ["crates/*", "tasks/*"] +members = ["crates/*", "tasks/*"] resolver = "2" [workspace.features] serializable = ["serde"] [workspace.dependencies] -markdown = "=1.0.0-alpha.16" -serde = { version = "1.0.130" } -swc_core = { version = "0.79.0", features = [ - "ecma_ast", - "ecma_visit", - "ecma_codegen", - "ecma_parser", - "common", -] } -pretty_assertions="1.3.0" -serde_yaml = "0.9.19" -serde_json = "1.0.70" \ No newline at end of file +markdown = "=1.0.0-alpha.16" +serde = { version = "1.0.130" } +swc_core = { version = "0.79.0", features = ["ecma_ast", "ecma_visit", "ecma_codegen", "ecma_parser", "common"] } +pretty_assertions = "1.3.0" +serde_yaml = "0.9.19" +serde_json = "1.0.70" diff --git a/crates/binding/Cargo.toml b/crates/binding/Cargo.toml index f6ea0c8..de83e23 100644 --- a/crates/binding/Cargo.toml +++ b/crates/binding/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mdx_rs_binding" +name = "mdx_rs_binding" version = "0.1.0" edition = "2021" @@ -17,14 +17,14 @@ mimalloc-rust = { version = "0.2", features = ["local-dynamic-tls"] } [dependencies] mdx_rs = { path = "../mdx_rs" } # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi = { version = "2.9.1", default-features = false, features = ["napi7"] } -napi-derive = "2.9.1" +napi = { version = "2.9.1", default-features = false, features = ["napi7"] } +napi-derive = "2.9.1" crossbeam-channel = "0.5.6" -mdx_plugin_toc = { path = "../plugin_toc" } +mdx_plugin_toc = { path = "../plugin_toc" } [build-dependencies] napi-build = "2.0.1" [profile.release] -lto = true +lto = true codegen-units = 1 diff --git a/crates/hast/Cargo.toml b/crates/hast/Cargo.toml index c4261ab..9f679f9 100644 --- a/crates/hast/Cargo.toml +++ b/crates/hast/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "hast" +name = "hast" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -markdown = { workspace = true } +markdown = { workspace = true } pretty_assertions = { workspace = true } diff --git a/crates/mdx_rs/Cargo.toml b/crates/mdx_rs/Cargo.toml index 13d0ae0..b42e739 100644 --- a/crates/mdx_rs/Cargo.toml +++ b/crates/mdx_rs/Cargo.toml @@ -1,22 +1,22 @@ [package] -name = "mdx_rs" +name = "mdx_rs" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -mdx_plugin_code_block = { path = "../plugin_code_block" } -mdx_plugin_highlighter = { path = "../plugin_highlighter" } -mdx_plugin_container = { path = "../plugin_container" } -mdx_plugin_external_link = { path = "../plugin_external_link" } -mdx_plugin_frontmatter = { path = "../plugin_frontmatter" } -mdx_plugin_header_anchor = { path = "../plugin_header_anchor" } +mdx_plugin_code_block = { path = "../plugin_code_block" } +mdx_plugin_highlighter = { path = "../plugin_highlighter" } +mdx_plugin_container = { path = "../plugin_container" } +mdx_plugin_external_link = { path = "../plugin_external_link" } +mdx_plugin_frontmatter = { path = "../plugin_frontmatter" } +mdx_plugin_header_anchor = { path = "../plugin_header_anchor" } mdx_plugin_normalize_link = { path = "../plugin_normalize_link" } -mdx_plugin_toc = { path = "../plugin_toc" } -mdx_plugin_html = { path = "../plugin_html" } -hast = { path = "../hast" } -markdown = { workspace = true } -pretty_assertions = { workspace = true } -swc_core = { workspace = true } -slugger = { path = "../slugger" } \ No newline at end of file +mdx_plugin_toc = { path = "../plugin_toc" } +mdx_plugin_html = { path = "../plugin_html" } +hast = { path = "../hast" } +markdown = { workspace = true } +pretty_assertions = { workspace = true } +swc_core = { workspace = true } +slugger = { path = "../slugger" } diff --git a/crates/plugin_code_block/Cargo.toml b/crates/plugin_code_block/Cargo.toml index 686ac0f..2dd6a5f 100644 --- a/crates/plugin_code_block/Cargo.toml +++ b/crates/plugin_code_block/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "mdx_plugin_code_block" +name = "mdx_plugin_code_block" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hast = { path = "../hast" } -swc_core = { workspace = true } \ No newline at end of file +hast = { path = "../hast" } +swc_core = { workspace = true } diff --git a/crates/plugin_container/Cargo.toml b/crates/plugin_container/Cargo.toml index 29cceda..56ce6ec 100644 --- a/crates/plugin_container/Cargo.toml +++ b/crates/plugin_container/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "mdx_plugin_container" -version = "0.1.0" -edition = "2021" +name = "mdx_plugin_container" +version = "0.1.0" +edition = "2021" keywords = ["markdown", "mdx", "compile"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hast = { path = "../hast" } \ No newline at end of file +hast = { path = "../hast" } diff --git a/crates/plugin_external_link/Cargo.toml b/crates/plugin_external_link/Cargo.toml index 65a33e3..c948ed1 100644 --- a/crates/plugin_external_link/Cargo.toml +++ b/crates/plugin_external_link/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "mdx_plugin_external_link" +name = "mdx_plugin_external_link" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hast = { path = "../hast" } \ No newline at end of file +hast = { path = "../hast" } diff --git a/crates/plugin_frontmatter/Cargo.toml b/crates/plugin_frontmatter/Cargo.toml index 7092d18..1db5c2e 100644 --- a/crates/plugin_frontmatter/Cargo.toml +++ b/crates/plugin_frontmatter/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "mdx_plugin_frontmatter" +name = "mdx_plugin_frontmatter" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -markdown = { workspace = true } +markdown = { workspace = true } serde_json = { workspace = true } -serde_yaml = { workspace = true } \ No newline at end of file +serde_yaml = { workspace = true } diff --git a/crates/plugin_header_anchor/Cargo.toml b/crates/plugin_header_anchor/Cargo.toml index 67661f4..206d1f8 100644 --- a/crates/plugin_header_anchor/Cargo.toml +++ b/crates/plugin_header_anchor/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "mdx_plugin_header_anchor" +name = "mdx_plugin_header_anchor" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hast = { path = "../hast" } +hast = { path = "../hast" } slugger = { path = "../slugger" } -utils = { path = "../utils" } \ No newline at end of file +utils = { path = "../utils" } diff --git a/crates/plugin_highlighter/Cargo.toml b/crates/plugin_highlighter/Cargo.toml index d04e776..d5946ae 100644 --- a/crates/plugin_highlighter/Cargo.toml +++ b/crates/plugin_highlighter/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "mdx_plugin_highlighter" +name = "mdx_plugin_highlighter" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -markdown = { workspace = true } \ No newline at end of file +markdown = { workspace = true } diff --git a/crates/plugin_html/Cargo.toml b/crates/plugin_html/Cargo.toml index ef225da..b18c398 100644 --- a/crates/plugin_html/Cargo.toml +++ b/crates/plugin_html/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "mdx_plugin_html" +name = "mdx_plugin_html" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hast = { path = "../hast" } \ No newline at end of file +hast = { path = "../hast" } diff --git a/crates/plugin_normalize_link/Cargo.toml b/crates/plugin_normalize_link/Cargo.toml index dd6f1dd..3f48259 100644 --- a/crates/plugin_normalize_link/Cargo.toml +++ b/crates/plugin_normalize_link/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "mdx_plugin_normalize_link" +name = "mdx_plugin_normalize_link" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hast = { path = "../hast" } +hast = { path = "../hast" } markdown = { workspace = true } diff --git a/crates/plugin_toc/Cargo.toml b/crates/plugin_toc/Cargo.toml index f57778d..365caa7 100644 --- a/crates/plugin_toc/Cargo.toml +++ b/crates/plugin_toc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mdx_plugin_toc" +name = "mdx_plugin_toc" version = "0.1.0" edition = "2021" @@ -7,5 +7,5 @@ edition = "2021" [dependencies] markdown = { workspace = true } -slugger = { path = "../slugger" } -utils = { path = "../utils" } +slugger = { path = "../slugger" } +utils = { path = "../utils" } diff --git a/crates/slugger/Cargo.toml b/crates/slugger/Cargo.toml index e39f927..f3c80c5 100644 --- a/crates/slugger/Cargo.toml +++ b/crates/slugger/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "slugger" +name = "slugger" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -regex = "1.5.4" -lazy_static = "1.4.0" \ No newline at end of file +regex = "1.5.4" +lazy_static = "1.4.0" diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index e1b7905..e3ed23f 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "utils" +name = "utils" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] \ No newline at end of file +[dependencies] diff --git a/justfile b/justfile new file mode 100644 index 0000000..31096e8 --- /dev/null +++ b/justfile @@ -0,0 +1,46 @@ +#!/usr/bin/env -S just --justfile + +# https://github.com/oxc-project/oxc/blob/main/justfile +_default: + just --list -u + +alias r := ready +alias c := codecov +alias t := test + +# Initialize the project by installing all the necessary tools. +# Make sure you have cargo-binstall installed. +# You can download the pre-compiled binary from +# or install via `cargo install cargo-binstall` +init: + cargo binstall cargo-nextest cargo-watch cargo-insta cargo-edit typos-cli taplo-cli cargo-llvm-cov -y + +# When ready, run the same CI commands +ready: + typos + cargo fmt + just check + just test + just lint + git status + +# Format all files +fmt: + cargo fmt + taplo format + +# Run cargo check +check: + cargo check --workspace --all-targets --all-features --locked + +# Run all the tests +test: + cargo nextest run + +# Lint the whole project +lint: + cargo clippy --workspace --all-targets --all-features -- --deny warnings + +# Get code coverage +codecov: + cargo codecov --html \ No newline at end of file diff --git a/tasks/benchmark/Cargo.toml b/tasks/benchmark/Cargo.toml index 830a5cc..59322d9 100644 --- a/tasks/benchmark/Cargo.toml +++ b/tasks/benchmark/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "mdx_rs_benchmark" -version = "0.0.0" -publish = false +name = "mdx_rs_benchmark" +version = "0.0.0" +publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -mdx_rs = { path = "../../crates/mdx_rs" } +mdx_rs = { path = "../../crates/mdx_rs" } criterion = { version = "0.5.1", default-features = false } -pico-args = {version = "0.5.0"} \ No newline at end of file +pico-args = { version = "0.5.0" }