MiniME - Directives
By default MiniME takes the low risk approach of only obfuscating symbols it knows can't be used externally. This includes local variables, parameter names and nested function names.
Often however, there are additional symbols that are internal to your script that don't need to be publicly accessible. In these cases, MiniME requires you to explicitly opt-in if you want those symbols obfuscated.
// private:<symbolspecifier> // public:<symbolspecifier>
The follow sections provide examples of symbol specifiers.
Obfuscating a Specific Global Scope Symbol
By default, MiniME doesn't obfuscate variable or function declarations at the global scope.
You can change this behaviour with the
This directive also works inside a function scopes for controlling the accessibility of local variables, parameters and nested functions (though generally it's not needed).
Obfuscating a set of Global Scope Symbols with Wildcards
A wildcard symbol specifier allows selection of a set of symbols:
For a symbol to be enabled for obfuscation when using wildcards, it must be declared
in the current scope, using either
function. Unknown symbols, or symbols
declared in inner scopes won't be selected for obfuscation by wildcard directives.
Wildcards support "
*" to match any sequence of characters and "
?" to match any character. For
more complex symbol matching, regular expressions can be used by surrounding the expression with
forward slashes "
Obfuscating Properties and Methods
By default, MiniME never obfuscates object property or method names (ie: "members"). MiniME doesn't attempt or pretend to understand object types and as such never obfuscates object members - unless you use directives to explicitly declare those that are internal and are therefore safe for obfuscation.
The simplest way to declare a member for obfuscation is with a
where the symbol specifier is prefixed by a period.
Wildcards and regular expressions are also allowed, for example:
For a symbol to be selected for obfuscation by wildcard member directives, it must appear on the left hand side of an assignment somewhere in the containing scope, for example:
Members can also be selected for obfuscation by assignment of an object literal, for example:
Obfuscating Members of a Target
You can select for all members of a target symbol to be obfuscated with a
private directive where
the specifier is suffixed with a period, for example:
This is a handy way to declare a set of private prototype members, for example:
Scope of Directives
Directives only apply within the containing scope in which they're declared. Using the same directive in two different scopes will probably result in the same symbol being allocated a different obfuscated symbols in each scope.
If Closure1 and Closure2 above need to share private variables, move the directive to the next outer scope (ie:global scope).
Order of Directives
When a symbol matches multiple wildcard directives, the order of the directives is important with the most recent directive applied first. For example:
Non-wildcard directives are always apply first, so in this example the order of m_public is irrelevant:
Using the above directives it is fairly easy to declare private member properties and methods. The main thing to remember is that once a member has been selected for obfuscation, all references to it will be obfuscated - regardless of what's on the left-hand side of the period.
To prevent obfuscation, use a string index: