unjs/magicast

Add support for file only imports

Indeedornot opened this issue · 0 comments

Describe the feature

Currently the way to add imports is using mod.imports.$add, which requires an ImportItemInput which requires an imported parameter, whereas it does not allow for generating such expression like
import 'my-global-styles.css'
On giving null or undefined as imported there is an error thrown

In my case it's particularly important for using AST to export custom css-in-jsx styles outside of file

image
image
image

I could take a look at it when pointed what would be the best way to modify it, and whether it's magicast or recast

Additional information

  • Would you be willing to help implement this feature?