Skip to content

More control over parser's matchTag behavior #3508

Description

@devfive

Description

matchTag function set up via configure in parser:before plugin is being called only if parser doesn't mark a component as a Panda component. https://github.com/chakra-ui/panda/blob/bc2b8d7e098b0bd4a9b8f215c5205b8bd83b3e55/packages/parser/src/parser.ts#L68C52-L68C60

Problem Statement/Justification

I'm working on the migration from @chakra-ui/react to Panda CSS. There are a lot of components with the same names, leading to Panda CSS parser taking @chakra-ui components as Panda components, which leads to a lot of unnecessary CSS being produced.

Proposed Solution or API

I managed to write a plugin that parses imports in a file and checks whether it's imported from Panda outDir or another library. It covers most of the edge-cases in our codebase. What I would need tho is to give 100% of control to matchTag function, no matter if Panda parser thinks it's a Panda component or not.

Due to breaking changes, we can have 2 approaches:

  1. options.matchPandaComponents boolean flag - true by default but would let user to opt-out from that behavior
  2. options.matchAllTags - separate function that would be called instead of matchTag

Alternatives

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions