kristerkari / react-native-svg-transformer

Import SVG files in your React Native project the same way that you would in a Web application.
MIT License
1.54k stars 116 forks source link

Forward all parameters of transform to the upstream transfoemer #354

Closed kmagiera closed 1 month ago

kmagiera commented 1 month ago

This PR fixes an issue where plugins parameter is not forwarded properly to the original transformer when svg-transformer is configured.

See https://github.com/facebook/react-native/blob/main/packages/react-native-babel-transformer/src/index.js#L184 for the full list of attributes of the object that upstream transformer takes. And specifically note that except from src, filename and options, also plugins is listed there.

Before this PR the list or attributes was limited to explicitely listed src, filename, and options, while plugins was missing. Since this transformer only uses src and filename directly, we replace the remaining part rest spread and forward it to the upstream transformer. This solution also makes this implementation more future proof in case new parameters are added.

kristerkari commented 1 month ago

Thanks!