Hi,
I'm building a 'command-line-script' to download an application to multiple Bangle.js 2 devices using Espruino Tools on Linux. I ran into a strange problem.
Consider this (isolated) piece of code :
var dummy = 123;
console.log(`dummy = ${dummy}`);
When minifying this is the Web IDE, no problems (of course...).
When running minification with the Espruino Tools, a strange error is reported (line 62 below):
root@ubuntu:~# espruino --verbose --board BANGLEJS2 --config MINIFICATION_LEVEL=ESPRIMA --config MODULE_MINIFICATION_LEVEL=ESPRIMA --config PRETOKENISE=true --config SAVE_ON_SEND=1 --minify SmartBracelet/software/projects/esprima.js -o SmartBracelet/software/es.js
0.1.38
Espruino Command-line Tool 0.1.38
-----------------------------------
Acorn library not found - you''ll need it for compiled code
Found /usr/local/lib/node_modules/espruino/libs/targz.js
...
Found /usr/local/lib/node_modules/espruino/core/serial_winnus.js
Not on Windows, Winnus not needed
Found /usr/local/lib/node_modules/espruino/core/terminal.js
Found /usr/local/lib/node_modules/espruino/core/utils.js
Found /usr/local/lib/node_modules/espruino/plugins/assembler.js
Found /usr/local/lib/node_modules/espruino/plugins/boardJSON.js
Found /usr/local/lib/node_modules/espruino/plugins/compiler.js
Found /usr/local/lib/node_modules/espruino/plugins/getGitHub.js
Found /usr/local/lib/node_modules/espruino/plugins/localModules.js
Found /usr/local/lib/node_modules/espruino/plugins/minify.js
Found /usr/local/lib/node_modules/espruino/plugins/pretokenise.js
Found /usr/local/lib/node_modules/espruino/plugins/saveOnSend.js
Found /usr/local/lib/node_modules/espruino/plugins/setTime.js
Found /usr/local/lib/node_modules/espruino/plugins/unicode.js
UTF8 Library loaded successfully
Found /usr/local/lib/node_modules/espruino/plugins/versionChecker.js
Initialising CodeWriter
Initialising Config
Initialising Env
Initialising Flasher
Initialising FlasherESP8266
Initialising Modules
Initialising Notifications
Initialising Serial
- Initialising Serial Noble Bluetooth LE
- Initialising Serial Node Socket
- Initialising Serial Web Audio
- Initialising Serial Web Bluetooth
- Initialising Serial Web Serial
Initialising Utils
Initialising Status
Initialising Assembler
Initialising BoardJSON
Initialising Compiler
Initialising GetGitHub
Initialising LocalModules
Initialising Minify
Initialising Pretokenise
Initialising SaveOnSend
Initialising SetTime
Initialising Unicode
Initialising VersionChecker
Initialising CoreModules
Command-line option set Espruino.Config.MINIFICATION_LEVEL to "ESPRIMA"
Command-line option set Espruino.Config.MODULE_MINIFICATION_LEVEL to "ESPRIMA"
Command-line option set Espruino.Config.PRETOKENISE to true
Command-line option set Espruino.Config.SAVE_ON_SEND to 1
Explicit board JSON supplied: "BANGLEJS2"
Loading http://www.espruino.com/json/BANGLEJS2.json
Board JSON loaded
Manual board JSON load complete
No port supplied, but output file listed - not connecting
Minifying
TypeError: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at Controller.traverse (/usr/local/lib/node_modules/espruino/node_modules/esmangle/node_modules/estraverse/estraverse.js:411:38)
at Object.traverse (/usr/local/lib/node_modules/espruino/node_modules/esmangle/node_modules/estraverse/estraverse.js:556:27)
at annotateDirective (/usr/local/lib/node_modules/espruino/node_modules/esmangle/lib/annotate-directive.js:131:16)
at Object.optimize (/usr/local/lib/node_modules/espruino/node_modules/esmangle/lib/esmangle.js:159:16)
at obfuscate (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:117:23)
at minifyCodeEsprima (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:98:18)
at minify (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:212:23)
at Array.eval (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:60:7)
at cb (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:98:15)
at compileCode (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:154:7)
Minification complete
Since Acorn 8.0.0, options.ecmaVersion is required.
Defaulting to 2020, but this will stop working in the future.
Uploading 45 bytes to flash
Writing output to SmartBracelet/software/es.js
Done
Platform is Ubuntu 18.04, Node version is V8.10.0, espruino (tools) is V0.1.38.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I'm building a 'command-line-script' to download an application to multiple Bangle.js 2 devices using Espruino Tools on Linux. I ran into a strange problem.
Consider this (isolated) piece of code :
When minifying this is the Web IDE, no problems (of course...).
When running minification with the Espruino Tools, a strange error is reported (line 62 below):
Platform is Ubuntu 18.04, Node version is V8.10.0, espruino (tools) is V0.1.38.