• @DrAzzy: Thank you! Aha, simple trick but works :) So it appears it's sending

    • echo(0);
    • Modules.removeAllCached();
    • Modules.addCached(<moduleName>, <moduleCode>) for every module, where moduleCode is the minified module as a string. This is recursive (i.e. includes modules required by modules).
    • The contents of the editor window
    • echo(1);

    Looking back with the up-arrow shows the code from the editor not in one chunk but in several chunks, where each function or each top-level line of code is one chunk... but it seems there's nothing special about sending code that way, it seems to be only related to retrieving code from the command history with the up-arrow. How do I know? Well, if I copy a js file to the espruino tty device, it's certainly sent in one chunk but yet it also appears as several chunks in the command history.

    So... how should I parse code for require? The easiest thing would be a regular expression just scanning for the word and what's between the brackets. However, that would also require a module when the require has been commented out. And the developer might do crazy things like moduleName="foo"; require(foo); which would need a semantical parser. I'm not sure how smart that parser should really be, but I guess it would be nice if it did the same that the WebIDE does...


Avatar for Dennis @Dennis started