Unverified Commit 5889fe57 authored by zoomdong's avatar zoomdong Committed by GitHub

Turbopack: RuleCondition support resourceQuery contains (#83468)

## What?

In utoopack, we have the situation to match modules with query like
following case:

```ts
import styles from './index.less?modules';
```

To deal the case above into css modules(other case the same), so i need
to use the rule condition to match the module with query like:

```rust
RuleCondition::ResourceQueryContains {
    extension: ".less".into(),
    query: "?modules".into(),
},
```
parent 2912b107
......@@ -45,6 +45,7 @@ pub enum RuleCondition {
glob: ReadRef<Glob>,
},
ResourceBasePathGlob(#[turbo_tasks(trace_ignore)] ReadRef<Glob>),
ResourceQueryContains(String),
}
impl RuleCondition {
......@@ -282,6 +283,10 @@ impl RuleCondition {
FileContent::NotFound => return Ok(false),
}
}
RuleCondition::ResourceQueryContains(query) => {
let ident = source.ident().await?;
return Ok(ident.query.contains(query));
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment