[workspace]
resolver = "2"
members = [
    "crates/fresh-editor",
    "crates/fresh-gui",
    "crates/fresh-core",
    "crates/fresh-parser-js",
    "crates/fresh-languages",
    "crates/fresh-plugin-runtime",
    "crates/fresh-plugin-api-macros",
    "crates/fresh-winterm",
    "crates/fresh-input-parser",
    "crates/fresh-update",
]
default-members = [
    "crates/fresh-editor",
    "crates/fresh-core",
    "crates/fresh-parser-js",
    "crates/fresh-languages",
    "crates/fresh-plugin-runtime",
    "crates/fresh-plugin-api-macros",
    "crates/fresh-winterm",
    "crates/fresh-input-parser",
    "crates/fresh-update",
]

[workspace.package]
version = "0.4.7"
authors = ["Noam Lewis"]
edition = "2021"
license = "GPL-2.0"
repository = "https://github.com/sinelaw/fresh"
homepage = "https://sinelaw.github.io/fresh/"
documentation = "https://docs.rs/fresh-editor"

[workspace.dependencies]
# Local crates
fresh-core = { version = "0.4.7", path = "crates/fresh-core" }
fresh-gui = { version = "0.4.7", path = "crates/fresh-gui" }
fresh-parser-js = { version = "0.4.7", path = "crates/fresh-parser-js" }
fresh-languages = { version = "0.4.7", path = "crates/fresh-languages" }
fresh-plugin-runtime = { version = "0.4.7", path = "crates/fresh-plugin-runtime" }
fresh-plugin-api-macros = { version = "0.4.7", path = "crates/fresh-plugin-api-macros" }
fresh-winterm = { version = "0.4.7", path = "crates/fresh-winterm" }
fresh-input-parser = { version = "0.4.7", path = "crates/fresh-input-parser" }
fresh-update = { version = "0.4.7", path = "crates/fresh-update" }

# External crates
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
jsonc-parser = { version = "0.32", features = ["serde", "serde_json", "cst"] }
anyhow = { version = "1.0.100", default-features = false }
tokio = { version = "1.49", features = ["fs", "io-util", "process", "rt", "rt-multi-thread", "sync", "time", "macros"] }
once_cell = "1.20"
tracing = "0.1"
rust-i18n = "3.1.5"
schemars = { version = "1.2", features = ["preserve_order"] }
rquickjs = { version = "0.11", features = ["futures", "macro"] }
rquickjs-serde = "0.5"
oxc_allocator = "0.128.0"
oxc_ast = "0.128.0"
oxc_parser = "0.128.0"
oxc_transformer = "0.128.0"
oxc_codegen = { version = "0.128.0", default-features = false }
oxc_span = "0.128.0"
oxc_semantic = "0.128.0"
oxc_diagnostics = "0.128.0"
oxc_isolated_declarations = "0.128.0"
tree-sitter = "0.26.5"
tree-sitter-highlight = "0.26.3"
crossterm = "0.29"
winit = "0.30"
wgpu = "28.0"
lsp-types = "0.97"
ts-rs = { version = "12.0", features = ["serde_json", "no-serde-warnings"] }
# Add more as needed during refactor

[profile.release]
debug = 0
lto = "fat"
codegen-units = 1
opt-level = "z"

# The profile that 'dist' will build with
[profile.dist]
inherits = "release"

# Size-optimized profile for producing a minimal `fresh` binary.
#
# Inherits everything from `release` (opt-level = "z", fat LTO,
# codegen-units = 1, no debug info) and adds the two flags that trade a
# little runtime/ergonomics for a smaller binary:
#
#   * panic = "abort" — drops the unwinding tables and landing pads. The
#     only `catch_unwind` in the tree is in `#[cfg(test)]` code, and the
#     plugin runtime signals errors without relying on Rust unwinding, so
#     aborting on panic does not change editor behaviour.
#   * strip = true     — strips symbols + debuginfo from the final binary.
#
# This profile does NOT change the normal `release` build. Pair it with a
# trimmed feature set for the smallest result, e.g.:
#
#   cargo build --profile min-size --no-default-features --features runtime
#
# which drops plugins, embedded plugins and all tree-sitter grammars while
# keeping syntect-based highlighting. See `crates/fresh-editor/Cargo.toml`.
[profile.min-size]
inherits = "release"
panic = "abort"
strip = true

# Optimize the critical dependencies in the plugin-load path at -O3 even
# in dev/test builds. These are the only deps where unoptimized code
# materially slows test wall time:
#
#   * oxc_*  — TypeScript→JS transpile + isolated-declarations emit,
#              dominant cost inside prepare_plugin.
#   * rquickjs / rquickjs-sys — the JavaScript runtime that runs every
#              plugin's top-level during plugin_exec.
#
# Our own crates still compile at -O0 + debug-info so incremental
# rebuilds stay fast. We avoid the wildcard `package."*"` form because
# rebuilding *every* transitive dep at -O3 was prohibitively slow on a
# cold build.
[profile.dev.package.oxc_allocator]
opt-level = 3
[profile.dev.package.oxc_ast]
opt-level = 3
[profile.dev.package.oxc_codegen]
opt-level = 3
[profile.dev.package.oxc_diagnostics]
opt-level = 3
[profile.dev.package.oxc_isolated_declarations]
opt-level = 3
[profile.dev.package.oxc_parser]
opt-level = 3
[profile.dev.package.oxc_semantic]
opt-level = 3
[profile.dev.package.oxc_span]
opt-level = 3
[profile.dev.package.oxc_transformer]
opt-level = 3
[profile.dev.package.rquickjs]
opt-level = 3
[profile.dev.package.rquickjs-sys]
opt-level = 3
[profile.dev.package.rquickjs-serde]
opt-level = 3

# Mirror the same overrides into the test profile, which `cargo test`
# and `cargo nextest run` use.
[profile.test.package.oxc_allocator]
opt-level = 3
[profile.test.package.oxc_ast]
opt-level = 3
[profile.test.package.oxc_codegen]
opt-level = 3
[profile.test.package.oxc_diagnostics]
opt-level = 3
[profile.test.package.oxc_isolated_declarations]
opt-level = 3
[profile.test.package.oxc_parser]
opt-level = 3
[profile.test.package.oxc_semantic]
opt-level = 3
[profile.test.package.oxc_span]
opt-level = 3
[profile.test.package.oxc_transformer]
opt-level = 3
[profile.test.package.rquickjs]
opt-level = 3
[profile.test.package.rquickjs-sys]
opt-level = 3
[profile.test.package.rquickjs-serde]
opt-level = 3
