hackmud-script-manager v0.20.2
Hackmud Script Manager
Command made for hackmud-environment, which is a scripting environment for hackmud with minification, autocompletes / intellisense, and TypeScript support.
Install
- Install Node.js
- Run
npm install -g hackmud-script-manager
Usage
- Run
#dir
in game, thencd
to that folder - Name your source script file to
<name>.src.js
- Run
hsm golf <name>.src.js
and it will create a minified script file called<name>.js
Features
- Minification
- This includes auto quine cheating.
- Supported types are null, numbers, strings, and JSON compatible objects and arrays.
- Non JSON compatible object keys are quine cheated.
- Member expressions are converted to index notation so the index string can be quine cheated.
- And template literals are converted to string concatenation so the strings can be quine cheated.
- Global variable aliasing.
- Convert function declarations to arrow function assigned to variable hoisted to the top of the block (
function foo() { ... }
->let foo = () => ...
). - Convert
_START
and_TIMEOUT
to_ST
and_TO
. - Remove unused parameters from the main function expression.
- This includes auto quine cheating.
- Modern Javascript Syntax and Features
- Exponentiation Operator, Object Rest Spread, Optional Catch Binding, JSON strings, Nullish Coalescing Operator, Optional Chaining, Logical Assignment Operators, Numeric Seperators, Class Properties, Class Static Block, Private Property
in
Object. - Bigint literals are converted to
BigInt()
calls. - Hackmud already supports all modern regular expression features.
- Exponentiation Operator, Object Rest Spread, Optional Catch Binding, JSON strings, Nullish Coalescing Operator, Optional Chaining, Logical Assignment Operators, Numeric Seperators, Class Properties, Class Static Block, Private Property
- Future JavaScript Syntax and Features
- Warning: TypeScript doesn't support any of these features and these features may change or not actually make it into JavaScript.
- Decorators, Do Expressions, Function Bind, Function Sent, Partial Application, Pipeline Operator (using the hack proposal and
%
as the topic token), Throw Expression, Record and Tuple (hash#
syntax type).
- TypeScript Support
- This command/module does not do type checking, it simply removes type annotations so you'll need to rely on your IDE or run
tsc
seperatly withnoEmit
.
- This command/module does not do type checking, it simply removes type annotations so you'll need to rely on your IDE or run
- And “Cool” Unnecessary Features.
- Variables declared outside the main function expression automatically become
#G
global variables. - Any code outside the function expression will only run once per top level script execution (
#FMCL
). - Basic seclevel verification.
- Declaring
// @seclevel HIGHSEC
or any other seclevel before all of your code stops you from accidentally using#ls.
or#ns.
.
- Declaring
- Import
node_modules
modules into your script usingimport { 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.- This saves characters compared to
context.this_script.split(".")[0]
.
- This saves characters compared to
_SCRIPT_NAME
is like_SCRIPT_USER
but for the name of the script.- Saves characters compared to
context.this_script.split(".")[1]
.
- Saves characters compared to
_FULL_SCRIPT_NAME
is replaced with what would becontext.this_script
.#s.
can be used and it'll automatically have the seclevel inserted.- Subscript and
#db
methods names are verified. - All references to preprocessor syntax functions not being called are turned into arrow function wrappers e.g.
let debug = #D;
->let debug = v => #D(v);
. _SECLEVEL
is replaced with a number (0
to4
) representing the seclevel of the script.- When
export
s are present in the script, it becomes a script that returns an object of theexport
ed values._EXPORTS
becomes an array of the names of the exported values.
- Variables declared outside the main function expression automatically become
- And Neat Weird Fixes
- Like
.__proto__
and.prototype
being converted to["__proto__"]
and["prototype"]
. - Illegal and unsafe strings.
- Appearences of
_SC
and friends are either renamed or have an escape inserted so that script is legal. - Preprocessor syntax in strings are escaped so hackmud doesn't recognise them as preprocessor syntax.
- And appearences of
//
in strings and regexes have a backslash inserted between to stop hackmud's overagressive comment remover from removing half the line of code.
- Appearences of
- Classes are actually usable now, this module replaces instances of
this
with a variable referencing what would bethis
. Function.prototype
can be referenced (but only the.prototype
property, nothing else).Object.getPrototypeOf
andObject.setPrototypeOf
are replaced with equivalent functions.
- Like
4 days ago
4 days ago
4 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
5 days ago
6 days ago
6 days ago
7 days ago
7 days ago
9 days ago
9 days ago
9 days ago
11 days ago
11 days ago
11 days ago
11 days ago
14 days ago
15 days ago
15 days ago
15 days ago
16 days ago
15 days ago
17 days ago
18 days ago
18 days ago
18 days ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
8 months ago
10 months ago
10 months ago
10 months ago
10 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago