diegohaz / generact

Generate React components by replicating your own
https://git.io/generact
MIT License
1.48k stars 64 forks source link

Alternative pattern for matching local imports #22

Closed Xarvalus closed 6 years ago

Xarvalus commented 6 years ago

Closes #14

Hi, I've managed some time to try to solve your issue, hope will be useful :)

Current solution is far from being perfect, nonetheless as alternative, matches local imports in one .replace() cycle and passes assumed tests.

Drawbacks:

There is possibility for making it more readable/customisable by running multiple .replace(), but it would suffer from performance penalty and unexpected overwriting.

Let me know about your thoughts on my contribution, thanks!

codecov-io commented 6 years ago

Codecov Report

Merging #22 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #22   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          57     57           
  Branches        8      8           
=====================================
  Hits           57     57
Impacted Files Coverage Δ
src/utils.js 100% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 91a1e77...f0ba630. Read the comment docs.

Xarvalus commented 6 years ago

Fair point, after change regexp supports now both single and doublequotes in import.

diegohaz commented 6 years ago

Thank you, @Xarvalus