forked from baseballyama/rsvelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
112 lines (102 loc) · 5.89 KB
/
Copy pathCargo.toml
File metadata and controls
112 lines (102 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
[workspace]
resolver = "3"
members = [
"crates/rsvelte_capi",
"crates/rsvelte_core",
"crates/rsvelte_esrap",
"crates/rsvelte_fmt",
"crates/rsvelte_fmt_wasm",
"crates/rsvelte_formatter",
"crates/rsvelte_lint",
"crates/rsvelte_lint_bindings",
"crates/rsvelte_napi",
"crates/rsvelte_preprocess",
"crates/tailwind_class_order",
]
[profile.release]
lto = "fat"
codegen-units = 1
opt-level = 3
strip = false
debug = false
panic = "abort"
# Distribution profile for the artifacts published to npm / GitHub Releases
# (svelte_check, rsvelte-fmt, rsvelte-lint CLIs and the NAPI `.node` cdylib).
# Identical optimization to `release` — same speed — but strips local + debug
# symbols, which measured ~13–16% smaller on every artifact. We keep the shared
# `[profile.release]` at `strip = false` because CodSpeed / profiling builds rely
# on its symbols; release.yml's `cargo build` steps opt into `--profile dist`.
# `strip = "symbols"` preserves the dynamic export table, so the `.node` addon's
# napi registration symbols survive (this is exactly what oxc ships).
[profile.dist]
inherits = "release"
strip = "symbols"
# Distribution profile for the `rsvelte-lint` CLI. It isolates a per-file
# compiler panic via `catch_unwind` (see `crates/rsvelte_lint/src/main.rs`), a
# guarantee that only holds when the binary UNWINDS — the shared `release`/`dist`
# profiles set `panic = "abort"` (smaller/faster), which turns that isolation
# into an immediate `SIGABRT` for the whole run. This profile keeps dist's
# optimization + symbol stripping but restores unwinding, so one pathological
# file can be skipped instead of aborting the entire lint pass. Build the CLI
# with `--profile dist-lint`.
[profile.dist-lint]
inherits = "dist"
panic = "unwind"
[profile.profiling]
inherits = "release"
lto = "thin" # thin LTO keeps profiling builds within the dev box's RAM
codegen-units = 16 # and split codegen so the opt-level-3 lib build does not OOM
debug = "line-tables-only"
strip = false
[profile.bench]
inherits = "release"
debug = true
# Note: the `bench` profile always unwinds (Cargo ignores an explicit `panic`
# setting here), which is exactly what Criterion needs to catch panics — so we
# rely on that default rather than setting `panic` and triggering a manifest warning.
# Workspace-wide lint policy. Every crate opts in via `[lints] workspace = true`,
# so these are the single source of truth for the project's quality gates.
# Keep this table to lints that the whole workspace passes cleanly — CI runs
# `cargo clippy --all-targets --all-features -- -D warnings`, so a regression here
# fails the build rather than emitting a warning.
[workspace.lints.rust]
# Force every `unsafe` operation inside an `unsafe fn` to sit in an explicit
# `unsafe {}` block, so the unsafe surface is always visible at the call site.
unsafe_op_in_unsafe_fn = "deny"
[workspace.lints.clippy]
# Every `unsafe {}` block must carry a `// SAFETY:` comment justifying its
# soundness. This is the project's contract for reviewing unsafe code.
undocumented_unsafe_blocks = "deny"
# Ban the `out.push_str(&format!(...))` anti-pattern: it heap-allocates a throwaway
# `String` per call, which profiling showed dominates the codegen hot path. Use
# `write!`/`writeln!` into the target buffer instead (zero extra allocation).
format_push_string = "deny"
# Intentional, project-wide allowances (centralised here instead of scattered as
# inline `#[allow(...)]`, so the policy is reviewable in one place):
#
# `too_many_arguments` / `type_complexity`: this crate is a line-for-line port of
# the official Svelte compiler, so many functions deliberately mirror upstream
# signatures (and the closure/visitor types they pass around) rather than being
# re-factored into config structs. Refactoring for argument count alone would
# diverge from the reference implementation we verify against.
too_many_arguments = "allow"
type_complexity = "allow"
# SPIKE: redirect every published oxc_* crate to the same git rev so
# rsvelte's AST types unify with oxc_formatter's transitive deps
# (avoids "two Program<'a> types from different source units" errors).
[patch.crates-io]
oxc_allocator = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_parser = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_ast = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_ast_macros = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_ast_visit = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_span = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_diagnostics = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_codegen = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_syntax = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_semantic = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_regular_expression = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_ecmascript = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_estree = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_str = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }
oxc_data_structures = { git = "https://github.com/oxc-project/oxc", rev = "83abe3b49c0913b1a984a7eec5e433a59fd76eae" }