Conceptual explanation needed for how internal modules are minified #6584
Replies: 1 comment
-
Posted at 2021-10-31 by @allObjects @robin, in the Espruino IDE config you can define what should be loaded when using Posted at 2021-10-31 by Robin Sun 2021.10.31 Thank you for responding @allObjects. Maybe my question should be where is the underlying Http/Wifi Javascript source (or any internal module) and it's corresponding minified resultant code block that is returned to the WebIDE when viewed using dump()? In comparrison, Should I load the 'GPS' module that is available as two sources:
the WebIDE will (based on settings) fetch the .min.js file first, which when exposed using a browser will show the underlying content when using dump().
and when viewed using dump()
Comparing the two, it can be seen that function(a) is the same code that resides in the .min.js file in the online modules folder. The human readable corresponding .js file then, may be used to cross reference. How does one do the same task for the internal modules? *(neopixel, wifi, http)* etc. e.g. where is the human readable source and where/how does that become minified such that using dump() reveals the output as in post #1 ? Posted at 2021-10-31 by Robin Sun 2021.10.31 Contains the .c source to generate the mechanics/functionality the logical repository folder name contains the .py build instructions, not .js scripts
the metadata describing each of the callable functions Posted at 2021-11-01 by @allObjects looks like mentioning modules in a generic way is a bit a mixed fruit salad... Modules in the various contexts and processes how they came to be shows the different genuine fruit flavors... so to speak... There are various types of modules: since we are in the JS world, they are visible in the JS context. Their guts and how they came to be varies a lot:
Some (all?) modules - even though built in- still need a The implementation of the require() and the uploader looking for these (nested) requires (and knowledge ab about what the firmware includes decide what to upload. No minification happens on upload of modules... they are dumped the way they are known to the Modules cache. For the application code in the Espruino IDE editor (right side), the IDE can be configured whether to run the code thru a/the minifier or not. Speaking of objects: everything is (kind) an object - hence allObects ;_), even though some feel more like functions, where others seem to be just data, and some that are actually fully fletched with data and function (state and behavior). Objects can exist as singletons or - with availability of a generally available constructor(s) - as many instances one type or class - or prototype (to be JS specific). PS: @robin, I guess I'm not providing any new insight to you in this post... :\ ... (and it is already documented... may be not in a form to make it obvious 'in one page'... That's why I like the combination of Reference info, Forum, Tutorials, Youtube clips, Instructables... all looking at the same thing from various perspectives...). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-10-30 by Robin
Sat 2021.10.30
Using both the native app and the online WebIDE, even when minification is turned
off
in settings, an internal module request (as in this instance) is returned minified.Results of dump()
From > http://www.espruino.com/Reference#Wifi I am able to locate the .c source that is used to generate the wrap container > https://github.com/espruino/Espruino/blob/master/libs/network/jswrap_wifi.c#L207
I'm struggling with how the WebIDE is returning minified code, when those options are turned off.
Is it that the internal modules are minified and included within the .hex .elf build, such that accessing them is returned as such, (in this case is there a location of the minified .js source at GitHub?)
or,
Is it that the .js content is run through the Esprima minifier real time when the .connect() (in this instance) function is called,
or, . . . other??
> Note: I still haven't been able to run successfully an openOCD session to peek into these files.
Beta Was this translation helpful? Give feedback.
All reactions