jcjolley / muddler Goto Github PK
View Code? Open in Web Editor NEWTranspile, test, and minify your hackmud scripts.
Transpile, test, and minify your hackmud scripts.
When testing, it's reasonable to assume that the temp file will be written beside the script you're transpiling. Currently, it's being written next to the output file.
It doesn't matter whether tests exist, but when using --skip-tests muddling simply terminates after it has generated the .temp.js file.
> muddle harvest.js --skip-tests --out-file harvest_mud.js
Muddling harvest.js
>
> muddle harvest.js --out-file harvest_mud.js
Muddling harvest.js
Success - harvest_mud_mud.js
>
There seems to be an encoding issue with special characters. See below for the original and muddled versions.
var corruptRegex = /`\w[¡¢£¤¥¦§¨©ª]`/g
l=/`\w[\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa]`/g
I'm assuming it's just not handling utf-8 encoding/decoding properly?
EDIT: I guess it's more of a problem specific to hackmud, now that I think about it. The output from hackmud is as follows:
{retval:"PARSE ERROR my.script (line 0 char 261): cannot use \\u00XX or \\u{00XX} unicode identifiers in ascii range in scripts. Please use hex escape (\\xXX)",success:false}
I should add support for testing using TypeScript.
I couldn't find anything regarding this (unless I didn't look hard enough), but is there a way to script muddling scriptors and calls to them?
Below is an example of what currently happens.
var d = #fs.dtr.lib()
var m = d.pp(args)
becomes
var g=#fs.h.lib()
var j=g.l(b)
When I try to use stuff like #D, #FMCL or #G in my script, muddler throws out:
Muddling C:\Users\uname\AppData\Roaming\hackmud\gname\scripts\crack.js
==========================================
C:/Users/uname/AppData/Roaming/hackmud/gname/scripts/crack.temp.js:14: ERROR - Parse error. '}' expected
#D("EZ_21")
^
1 error(s), 0 warning(s)
==========================================
This is what the code looks like:
if(l.includes('EZ_21')) {
#D("EZ_21")
for(var i=0;i<EZ.length;++i) {
g["ez_21"]=EZ[i]
c()
if(!f.includes('LOCK_ERROR')){
#D("Cracked")
l_num = l_num + 1
break
}
}
}
(Yes, it's a lock cracker)
This is probably over kill, but I can see this being useful.
Running muddler produces this error:
env: node\r: No such file or directory
This is due to /usr/local/bin/muddle
(or muddle.js
) having line endings in the DOS format. A similar issue can be seen here.
The fix is to simply convert the line endings from DOS to unix, at which point it should be compatible across all platforms.
A long term solution to this might be a simple as adding a .gitattributes
file that does the formatting on it's own, as seen here.
Full command/parameters I'm using right now:
muddle --watch-dir ~/.config/hackmud/scripts_dev --test-dir ~/.config/hackmud/scripts_dev/tests --out-dir ~/.config/hackmud/user/scripts
This seems to script tests (named script.test.js
) in scripts_dev/tests
, but works fine if I move the tests to the same directory where the scripts themselves are, so it's almost like it's not taking --test-dir
in to account at all?
If I'm doing something wrong here, let me know, since I'm still struggling trying to get even a simple test to run. :)
Probably not related, but I can't seem to get any further than this when testing:
function (context, args) {
^
SyntaxError: Unexpected token (
EDIT: Not sure if it matters, but I don't use TypeScript at all, just JavaScript.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.