espruino / EspruinoTools

JavaScript library of tools for Espruino - used for the Web IDE, CLI, etc.
Apache License 2.0
150 stars 90 forks source link

fix line splitting for storage file uploads #179

Closed fanoush closed 2 months ago

fanoush commented 3 months ago

Line number setting which is by default true adds something to the beginning and line does not end with semicolon, fix regex to match both issues. Currently for me storage upload via --storage name:name contains something like \u0010\u001b[83drequire(\"Storage\").write( and line ends with something like "),31872)\n .

fanoush commented 3 months ago

However maybe this is already deprecated? When it is enabled it slows down upload to USB devices that otherwise work fine with XON/XOFF and upload much faster.

gfwilliams commented 2 months ago

Wow, interesting, thanks! I think it might be worth looking at why line numbers are being added here though, as they shouldn't really - that's just for when uploading to RAM. I guess when uploading to flash, line numbers should really be added only when the code is pretokenised (or maybe we just shouldn't bother)

gfwilliams commented 2 months ago

...looking into this now