parcel-bundler / parcel-bundler/lightningcss
`RuleExit` doesn't work for custom at-rules
Open
Nobody has claimed this yet.
pending triage
- Dominant language
- Rust
- Stars
- 7.7k
- Forks
- 302
- PR merge metrics
- No merged PRs in 30d
Description
This pretty much summarizes it:
@global {
h1 {
color: red;
}
}
let inGlobal = 0;
lightningcss.transform({
code: Buffer.from(content),
filename: ctx.ns,
minify: true,
targets: lightningcss.browserslistToTargets(browserslist(ctx.opts.browserslist || 'defaults')),
drafts: {
nesting: true,
customMedia: true,
},
customAtRules: {
global: {
body: 'rule-list',
},
},
visitor: {
Rule: {
custom: {
global() {
inGlobal += 1;
},
},
},
RuleExit: {
custom: {
global() {
inGlobal -= 1;
},
},
},
},
});
console.log(inGlobal); // 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the lightningcss.transform visitor API shown in the report, especially the Rule and RuleExit handlers for custom at-rules and the customAtRules global configuration. Reproduce the example and trace why RuleExit does not run for the custom rule; done means the displayed input balances the callbacks and produces inGlobal as 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100