Command made for Hackmud Scripting Environment, which is a scripting environment for hackmud with minification, autocompletes / intellisense, and TypeScript support.
You can read about how HSM works in my blog post.
npm install -g hackmud-script-manager
#dir
in game, then cd
to that folder<name>.src.js
hsm golf <name>.src.js
and it will create a minified script file called <name>.js
NOTE: If you get an error message that looks like this:
[...]\AppData\Local\pnpm\hsm.ps1 cannot be loaded because running scripts is disabled on this system. [...]
You will need to run
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
in PowerShell as an administrator. For more information, see Microsoft's page about Execution Policies.
function foo() { ... }
-> let foo = () => ...
)._START
and _TIMEOUT
to _ST
and _TO
.in
Object.BigInt()
calls.%
as the topic token), Throw Expression, Record and Tuple (hash #
syntax type).tsc
seperatly with noEmit
.#G
global variables.#FMCL
).// @seclevel HIGHSEC
or any other seclevel before all of your code stops you from accidentally using #ls.
or #ns.
.node_modules
modules into your script using import { foo } from "bar"
syntax._SOURCE
is replaced with a string of the source code of the script it's in._BUILD_DATE
is replaced with a unix timestamp (Date.now()
) of the build date of the script._SCRIPT_USER
is replaced with a string of the user the script was pushed to.
context.this_script.split(".")[0]
._SCRIPT_NAME
is like _SCRIPT_USER
but for the name of the script.
context.this_script.split(".")[1]
._FULL_SCRIPT_NAME
is replaced with what would be context.this_script
.#s.
can be used and it'll automatically have the seclevel inserted.#db
methods names are verified.let debug = #D;
-> let debug = v => #D(v);
._SECLEVEL
is replaced with a number (0
to 4
) representing the seclevel of the script.export
s are present in the script, it becomes a script that returns an object of the export
ed values.
_EXPORTS
becomes an array of the names of the exported values..__proto__
and .prototype
being converted to ["__proto__"]
and ["prototype"]
._SC
and friends are either renamed or have an escape inserted so that script is legal.//
in strings and regexes have a backslash inserted between to stop hackmud's overagressive comment remover from removing half the line of code.this
with a variable referencing what would be this
.Function.prototype
can be referenced (but only the .prototype
property, nothing else).Object.getPrototypeOf
and Object.setPrototypeOf
are replaced with equivalent functions.