parcel-bundler / parcel-bundler/lightningcss

Add `Clone`, `Copy` & `Debug` to `PrinterOptions`

Open
#1,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

I'd love to see Clone, Copy and Debug implemented for PrinterOptions<'a>.
Especially the first one - it would be very nice to quickly re-use the same options between different to_css invocations.

Clone & Copy

As far as I understand, the main reason this is not implemented, is source_map that is passed as mutable reference. That indeed
prevents us from cloning the printer.

However, note, that this field is behind sourcemap feature. Therefore I would recommend adding:

#[cfg_attr(not(feature = "source map"), derive(Clone, Copy))]

Debug

I don't see a reason why this is not implemented. I guess it was never needed but it is a nice QoL improvement.

Other structures

Other structures would also need the change - at least DependencyOptions and PseudoClasses. It seems that Targets already implements all three traits.

I'd love to create a PR with those improvements.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate PrinterOptions, DependencyOptions, PseudoClasses, and Targets, then compare the trait implementations already present on Targets. Check how the source_map feature affects PrinterOptions and verify that the requested Clone, Copy, and Debug implementations are consistent across these structures.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.