Closed ariya closed 7 years ago
Note that this change removes the need to use jstransform (which has been deprecated and which, IMHO, is a bit overkill for this kind of source transformation) and it also likely supersedes PR #30.
This fork fixed the following error for me when using rollup
+ rollup-plugin-browserify-transform
:
Error transforming /home/test/node_modules/styled-components/dist/styled-components.es.js: Parse Error: Line 1: Illegal import declaration
@hughsk @zertosh Any interest in this PR? If yes, please advise on how to move forward 😸 . Thanks!
Hey @ariya! Thanks very much, sorry for the delayed response — looks good to me :D
Given that this was the only change between 3.4.1 and 4.0.0, and Ariya describes it as "no API change", why was the major version number incremented? To indicate the change in dependencies? If there really were no breaking changes in the API, it seems to me that the major version number should not be incremented. Of course, semver allows an increment, and it's your project Hugh, I just found it confusing.
This is utilizing Esprima's syntax delegate feature to track directly each syntax node as it is being constructed, looking for
process.env.SOMETHING
orprocess.env["SOMETHING"]
, and record the individual source replacement into an array (the whole replacements are applied directly on the source input later on). Thus, there is no need for an additional pass to traverse the syntax tree.There is no API change, all tests pass.