-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
split off DiagnosticReport + reporters into their own library? #25
Comments
lol apparently miette went from 18kb to 118kb when I added the reporter. And I think that's on top of the extra deps 😩 |
What would |
Yes, that's the idea: That said, the 118kb was actually because I was including images in the package--oops! I'm not too fussed about it for now. I did give this a shot and it turned out to be Very Hard, Actually, so I just gave up. I couldn't find a way to export the derive macro both from |
I think |
I think I'm just not gonna do this for the foreseeable future. The crate isn't that big anyway and there's been no asks for this to be a "minimal" crate of any sort. |
Just wanted to drop in and mention that I think this would be a great idea moving forward. I'm wrestling with adding That being said, I realize that this could be a somewhat difficult and disruptive change, as it would split (Thanks for all of the great work!) |
Reopening this because it's been bothering me again, and I think you're totally right. Especially now that I've picked up even more dependencies while styling the reports nicely. |
@olson-sean-k what do you think of the idea of having all the fancy reporter stuff be optional, behind a single feature flag that's enabled by default? |
Yeah, I think that would work well enough, though it would require a bit more diligence from users since it only takes one dependency specification that forgets to disable default features for such a feature to activate in a build. I think separating these concerns at crate boundaries is the better long-term solution, but I'm guessing that adding a feature would be much quicker and easier to implement. Maybe the feature could be a transitional thing? Then any crate decomposition can be handled later (or abandoned if it turns out it just won't work as well as I had hoped). |
BREAKING CHANGE: The default fancy reporter is no longer available unless you enable the "fancy" feature. This also means you will not be pulling in a bunch of deps if you are using miette for a library Fixes: #25
I've gone the feature route (see bc495e6) and I'm overall pretty happy with it. I've also made the feature disabled by default. |
note: I also tried, again, to split this off into a separate crate, and it really didn't work very well because of a combination of circular dependency stuff and the fact that the derive macro specifically needs a crate called |
Awesome! Thanks for putting this together. I like making this an opt-in rather than an opt-out feature too. I think this solves the underlying issue I described (without needing to carve things up, no less). 🎉 Once the feature change lands I'd consider the dependency issue closed, but I hope you don't mind if we continue to discuss spinning off crates a bit. 😄 I'm generally a fan of that approach, though I admit that it probably wouldn't be the most immediately useful or practical change. Please feel free to ignore everything below!
I see. Perhaps As individual dependencies: [dependencies]
miette = "^3.0.0" # Composes `miette-core` and `miette-derive`.
miette-report = "^1.0.0" # Provides a reporter and error type definitions. use miette::Diagnostic;
use miette_report::Result;
#[derive(Diagnostic)]
#[diagnostic(...)]
pub struct Error { ... }
fn main() -> Result<()> { ... } Using a feature that composes all of the first-party crates (a bit like the incoming feature change): [dependencies.miette]
version = "^3.0.0"
features = ["report"] # Composes `miette-core`, `miette-derive`, and `miette-report`. // `miette_report` items are re-exported inside `miette`.
use miette::{Diagnostic, Result};
... With that arrangement, users would never interact directly with |
I mean that might work, but I'm not sure what the ultimate benefit would be. I do like small crates, but miette, without all those console dependencies, is actually pretty tiny? |
Considering that Yeah, that's kinda vague and not terribly compelling. Feature gating the reporter is probably all that's needed here. 👍🏽 Sorry for the noise! |
BREAKING CHANGE: The default fancy reporter is no longer available unless you enable the "fancy" feature. This also means you will not be pulling in a bunch of deps if you are using miette for a library Fixes: #25
I think I missed something important here that I've run into lately: fundamental traits like From a quick glance at time of writing, it looks like A AFAICT, breaking releases that have not changed the protocol have been published in the recent past, so perhaps this is worth revisiting. Any thoughts? Thanks! |
I mean, my answer is pretty much the same as I gave in #25 (comment), which is that everything worked out kinda janky when I tried to spin it off into its own crate. In general, I've been very conservative about breaking changes to the core protocol, but I think it's also worth noting that, most of the time, people will use the protocol through |
For the derive macro stuff, many derive macros provide a way to simply override the "backend" crate name. |
No rush, I think, because the intention is very much that anyone using miette will also probably be using the reporter, but I'm hoping people write their own bespoke reporters against the "protocol".
...maybe that means we need
miette-protocol
, andmiette
is the Big Chonker library? That would let us do this refactor without being semver-breaking. 🤔The text was updated successfully, but these errors were encountered: