Open DavidHancu opened 2 months ago
I think this is a good idea, but I'm not sure where we should store the metadata, and I'm not sure about the API, either.
I think that a new function on the Parser could do: parse_module_with_metadata
. This would return a struct with a Module field and a Metadata field. In the parser implementation, this would use a const boolean generic to ensure that the compiler optimizes the metadata creation out if it wasn't requested
Describe the feature
When implementing a library that builds on top of SWC, we need to generate intermediary representations. This probably includes HashMaps or Vecs, which can benefit from a performance increase when initialized with the right capacity.
SWC should provide at least the following counts:
Babel plugin or link to the feature description
No response
Additional context
This should not be implemented as a separate pass because it would be wasteful. This should be implemented at the parser level and I'm willing to contribute this.