Merge branch 'minify_online'

pull/363/head
Gordon Williams 2020-04-29 08:41:18 +01:00
commit b7e4476d4d
3 changed files with 33311 additions and 0 deletions

View File

@ -156,6 +156,7 @@
<script src="js/comms.js"></script>
<script src="js/appinfo.js"></script>
<script src="js/index.js"></script>
<script src="js/espruinotools.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="js/pwa.js" defer></script>
</body>

View File

@ -11,6 +11,16 @@ var AppInfo = {
return Promise.resolve(storageFile);
else if (storageFile.url)
return fileGetter(`apps/${app.id}/${storageFile.url}`).then(content => {
if (storageFile.url.endsWith(".js") && !storageFile.url.endsWith(".min.js")) { // if original file ends in '.js'...
return Espruino.transform(content, {
SET_TIME_ON_WRITE : false,
PRETOKENISE : true,
//MINIFICATION_LEVEL : "ESPRIMA", // disable due to https://github.com/espruino/BangleApps/pull/355#issuecomment-620124162
builtinModules : "Flash,Storage,heatshrink,tensorflow,locale"
});
} else
return content;
}).then(content => {
return {
name : storageFile.name,
content : content,

33300
js/espruinotools.js Normal file

File diff suppressed because one or more lines are too long