Squash Version 2.3.588 Annotations Reference

This documentation provides a listing of all pre-defined Squash annotations. These annotations are already defined and ready to use. These annotations may be completely customized or removed, so the information provided here is assuming no customizations were made to any of these annotations. There may be additional annotations installed in your Squash environment that are not listed here.

Annotations Quick Reference
Date
Adds the current date to the output.
Debug
Conditionally includes the code within the scope of this annotation. This is the same as the If annotation, except that if the property name is not specified, it defaults to "DEBUG".
Deployment
Sets the deployment in which the code included in this annotation will be included.
Error
Prints "Error: " followed by the given text to the output when processing.
Export
Sets the target namespace and result set with the given name. Also sets the output file.
ExtendDeployment
Extends a deployment. All identifier references in the extended deployment will be included in the new deployment.
External
Sets variables and/or properties declared within the scope of this annotation to be marked as external so the names will not be obfuscated and warnings will not be generated about them not being used.
ExternalNamespace
Creates a namespace of identifiers that are defined in external files that are not part of the set of obfuscated files.
ExternalProperty
Creates the named property in the target namespace and records it as declared and referenced externally so that errors will not be generated if it is not used. The name of the property will not be obfuscated.
ExternalVariable
Creates the named variable in the target namespace and records it as declared and referenced externally so that errors will not be generated if it is not used. The name of the variable will not be obfuscated.
If
Includes the code within the scope of this annotation if the given property equals the given value.
IfNot
Includes the code within the scope of this annotation if the given property does not equal the given value.
Import
Adds the namespace with the given name as an input namespace so that identifiers within the scope of this annotation may be matched up with the identifiers in the imported namespace.
Include
Include the text at the given URL as if it were inserted in the file at the location of this annotation. It will be obfuscated as usual. See also Insert.
Insert
Insert the text at the given URL into the output without processing with the obfuscation engine. See also Include
InsertResults
Inserts the result set with the given name at the current location in the output.
InsertFileResults
Inserts the result set generated from the file at the given URL in the output.
InsertText
Insert the given text into the output without processing with the obfuscation engine. See also Insert.
Message
Prints the given text to the output when processing.
Namespace
Sets the target namespace to the namespace with the given name.
NotDebug
Conditionally includes the code within the scope of this annotation. With the same arguments, this will have the opposite effect of Debug.
Obfuscate
Obfuscates a text string and outputs a quoted version of the string to the current output.
Output
Sets the output file for the obfuscation results of everything within the scope of this annotation.
Preserve
Adds or removes from the set of types of data that are prevented from stripping, encoding, or obfuscating. Preserved content will appear as it does in the source.
PreserveOnly
Replaces the set of types of data that are prevented from stripping, encoding, or obfuscating. Preserved content will appear as it does in the source.
Private
Sets the target namespace to a local namespace to make in inaccessible from other files.
Property
Creates the given property in the target namespace and gives it the given name. This is a way to force the obfuscated name to be a certain value.
Public
Preserves the identifiers within the scope of this annotation so that they can be accessed from files that are not obfuscated.
PublicProperty
Prevents the obfuscation of the named property in the target namespace, and adds an external reference to the property so that errors will not be generated if it is not used. The property is expected to be declared somewhere in your source code.
PublicVariable
Prevents the obfuscation of the named variable in the target namespace, and adds an external reference to the variable so that errors will not be generated if it is not used. The variable is expected to be declared somewhere in your source code.
RandomSeed
Sets the randomizing seed. Using the same seed each time will result in the same obfuscated variable names as long as nothing else changes.
Select
Selects one of multiple sets blocks of code depending on the value of the given property.
Set
Sets a property with the given name and value. The property is accessible within the scope of this annotation, including within annotations included within this annotation.
Unset
Unsets the property with the given name. This will remove the value of the property set within this annotation. If the property is defined in an annotation that contains this annotation, it will become visible after this call. To guarantee that the property has no value, set it to null instead.
Unused
Everything within the scope of this annotation will be ignored.
ValueOf
Includes the value of the given property into the output.
Variable
Creates the given variable in the target namespace and gives it the given name. This is a way to force the obfuscated name to be a certain value.
Warning
Prints "Warning: " followed by the given text to the output when processing.
Annotations Detailed Descriptions
Date
Adds the current date to the output.
Javascript SyntaxXML Syntax
@Date(format); <annotation:Date text="format"/> <annotation:Date>format</annotation:Date>
Parameters
format optional The format for the date. The following replacements will be made in the format string:
  • %m - month (1-12)
  • %b - Abbreviated month name (Jan, Feb, Mar, ...)
  • %B - Full month name (January, February, ...)
  • %d - day of month (1-31)
  • %y - year (4 digits)
  • %H - hour 0-23
  • %M - minute 0-59
  • %S - second 0-59
If a 0 (zero) is placed between the % and the code, the value will be padded with a leading 0 if less than 10.
Javascript Examples XML Examples
// the following will insert the date that looks // like "06-Feb-2009" into the output @Date("%0d-%b-%y") <annotation:Date format="%0d-%b-%y"/> <annotation:Date>%0d-%b-%y</annotation:Date>
Debug
Conditionally includes the code within the scope of this annotation. This is the same as the If annotation, except that if the property name is not specified, it defaults to "DEBUG".
Javascript SyntaxXML Syntax
@Debug(name,value) { } <annotation:Debug name="name" value="value"> </annotation:Debug>
Parameters
name optional The name of the property to test. If not specified, "DEBUG" is assumed.
value optional The value that the property must have to satisfy the condition. If not specified, only the existence of the property is checked, not its value.
Javascript Examples XML Examples
@Debug { verifyValues(); } @Debug verifyValues(); @Debug("verify") verifyValues(); @Debug("mode", "verify") { verifyValues(); }
Deployment
Sets the deployment in which the code included in this annotation will be included.
Javascript SyntaxXML Syntax
@Deployment(name); <annotation:Deployment name="name"/> <annotation:Deployment>name</annotation:Deployment>
Parameters
name... required One or more deployment names. In XML, this may be supplied as text content instead of the attribute.
Javascript Examples XML Examples
@Deployment("English") <annotation:Deployment name="English"/> <annotation:Deployment>English</annotation:Deployment>
Error
Prints "Error: " followed by the given text to the output when processing.
Javascript SyntaxXML Syntax
@Error(text); <annotation:Error text="text"/> <annotation:Error>text</annotation:Error>
Parameters
text required The error text to display. In XML, this may be supplied as text content instead of the attribute.
Javascript Examples XML Examples
@Error("This must be fixed.") <annotation:Error text="This must be fixed."/> <annotation:Error>This must be fixed.</annotation:Error>
Export
Sets the target namespace and result set with the given name, and the output file to the given href.
Javascript SyntaxXML Syntax
@Export(name,href,encoding)> @Export(name,href,encoding) { } <annotation:Export name="name" href="value" encoding="encoding"> </annotation:Export>
Parameters
name required Any unique name. This name can be used by the Import annotation to import the results, and the InsertResults annotation to include the processed results in another file.
href optional The URL to output the obfuscated results of the code within the context of this annotation.
encoding optional The encoding of the output file. If not specified, the platform default encoding will be used.
Javascript Examples XML Examples
ExtendDeployment
Extends a deployment. All identifier references in the extended deployment will be included in the new deployment. For example, a base deployment may be shared among multiple deployments be extending it.
Javascript SyntaxXML Syntax
@ExtendDeployment(name,base,partial); <annotation:ExtendDeployment name="name" base="base" partial="partial"/>
Parameters
name required The name to give the new deployment.
base required The deployment to extend.
partial optional A boolean value. Set this to true if this new deployment is not a complete deployment, i.e. is only to serve as a common base for other deployments. If true, no warnings will be generated for identifiers that are used but not declared or declared and not used within the new deployment.
Javascript Examples XML Examples
@ExtendDeployment("English", "Common") <annotation:Deployment name="English" base="Common" partial="no"/>
ExternalNamespace
Creates a namespace of identifiers that are defined in external files that are not part of the set of obfuscated files. When this namespace is added as an input namespace, any identifiers from the external namespace will not be obfuscated.
Javascript SyntaxXML Syntax
@ExternalNamespace(name) { } <annotation:ExternalNamespace name="name"> </annotation:ExternalNamespace>
Parameters
name required The name of the namespace.
Javascript Examples XML Examples
ExternalProperty
Creates the named property in the target namespace and records it as declared and referenced externally so that errors will not be generated if it is not used. The name of the property will not be obfuscated.
Javascript SyntaxXML Syntax
@ExternalProperty(name); <annotation:ExternalProperty name="name"/>
Parameters
name required The name of the property to make external.
Javascript Examples XML Examples
@ExternalProperty("id"); <annotation:ExternalProperty name="id"/>
ExternalVariable
Creates the named variable in the target namespace and records it as declared and referenced externally so that errors will not be generated if it is not used. The name of the variable will not be obfuscated.
Javascript SyntaxXML Syntax
@ExternalVariable(name); <annotation:ExternalVariable name="name"/>
Parameters
name required The name of the variable to make external.
Javascript Examples XML Examples
@ExternalVariable("license_id"); <annotation:ExternalVariable name="license_id"/>
If
Includes the code within the scope of this annotation if the given property equals the given value.
Javascript SyntaxXML Syntax
@If(name,value) { } <annotation:If name="name" value="value"> </annotation:If>
Parameters
name required The name of the property to test.
value optional The value that the property must have to satisfy the condition. If not specified, only the existence of the property is checked, not its value.
Javascript Examples XML Examples
@If("verify") { verifyValues(); } @If("verify") verifyValues(); @If("mode", "verify") { verifyValues(); }
IfNot
Includes the code within the scope of this annotation if the given property does not equal the given value.
Javascript SyntaxXML Syntax
@IfNot(name,value) { } <annotation:IfNot name="name" value="value"> </annotation:IfNot>
Parameters
name optional The name of the property to test.
value optional The value that the property must have to satisfy the condition. If not specified, only the existence of the property is checked, not its value.
Javascript Examples XML Examples
@IfNot("production") verify(); @Debug("buildtype", "production") { verifyValues(); }
Import
Adds the namespace with the given name as an input namespace so that identifiers within the scope of this annotation may be matched up with the identifiers in the imported namespace.
Javascript SyntaxXML Syntax
@Import(name) { } <annotation:Import name="name"> </annotation:Import>
Parameters
name required The name of the namespace to import.
Javascript Examples XML Examples
@Import("Graphics")> @Import("Graphics") { } <annotation:Import name="Graphics"> </annotation:Import>
Include
Include the text at the given URL as if it were inserted in the file at the location of this annotation. It will be obfuscated as usual. See also Insert
Javascript SyntaxXML Syntax
@Include(url,encoding); <annotation:Include href="url" encoding="encoding"/>
Parameters
url required The URL to the file to include. If this URL is relative, it will be resolved against the URL of the file where this annotation is evaluated.
encoding optional The encoding of the file at the given URL. If not specified, the platform default encoding will be used unless the file is an XML file and the encoding is specified in the XML header.
Javascript Examples XML Examples
@Include("Graphics.js", "UTF-8"); <annotation:Include href="Graphics.xml" encoding="UTF-8"/>
Insert
Insert the text at the given URL into the output without processing with the obfuscation engine. See also Include
Javascript SyntaxXML Syntax
@Insert(url,encoding); <annotation:Insert href="url" encoding="encoding"/>
Parameters
url required The URL to the file to insert. If this URL is relative, it will be resolved against the URL of the file where this annotation is evaluated.
encoding optional The encoding of the file at the given URL. If not specified, the platform default encoding will be used unless the file is an XML file and the encoding is specified in the XML header.
Javascript Examples XML Examples
@Insert("SpanishText.js", "UTF-8"); <annotation:Insert href="SpanishText.xml" encoding="UTF-8"/>
InsertResults
Inserts the result set with the given name at the current location in the output.
Javascript SyntaxXML Syntax
@InsertResults(name); <annotation:InsertResults name="url"/>
Parameters
name required The name of the result set to include. This is the name given in the Export annotation.
Javascript Examples XML Examples
@InsertResults("GraphicsCommon"); <annotation:Include href="GraphicsCommon"/>
InsertFileResults
Inserts the result set generated from the file at the given URL in the output.
Javascript SyntaxXML Syntax
@IncludeFileResults(url); <annotation:IncludeFileResults href="url"/>
Parameters
url required The URL of the file whose obfuscated results should be included at the location of this annotation. If this URL is relative, it will be resolved against the URL of the file that contains this annotation.
Javascript Examples XML Examples
@IncludeFileResults("Base.js"); <annotation:IncludeFileResults href="Base.xml"/>
InsertText
Insert the given text into the output without processing with the obfuscation engine. See also Insert
Javascript SyntaxXML Syntax
@InsertText(text); <annotation:InsertText text="text"/> <annotation:InsertText>text</annotation:InsertText>
Parameters
text required The text to insert into the output. In XML files, this text may be specified as text context of the element instead of as a property.
Javascript Examples XML Examples
@InsertText('"'); @IncludeText("update()"); @InsertText('"'); <annotation:InsertText text="{copyright}"/> <annotation:InsertText>IdeaReactor, LLC</annotation:InsertText>
Message
Prints the given text to the output when processing.
Javascript SyntaxXML Syntax
@Message(text); <annotation:Message text="text"/> <annotation:Message>text</annotation:Message>
Parameters
text required The text to display while processing.
Javascript Examples XML Examples
@Message("This is a QA build."); <annotation:Message>This is a QA build.</annotation:Message>
Namespace
Sets the target namespace to the namespace with the given name.
Javascript SyntaxXML Syntax
@Namespace(name) { } <annotation:Namespace name="name"> </annotation:Namespace>
Parameters
name required The name of the namespace to set as the target namespace.
Javascript Examples XML Examples
@Namespace("ShoppingCart") { } <annotation:Namespace name="ShoppingCart"> </annotation:Namespace>
NotDebug
Conditionally includes the code within the scope of this annotation. With the same arguments, this will have the opposite effect of Debug
Javascript SyntaxXML Syntax
@NotDebug(name,value) { } <annotation:NotDebug name="name" value="value"> </annotation:NotDebug>
Parameters
name optional The name of the property to test. If not specified, "DEBUG" is assumed.
value optional The value that the property must not have to satisfy the condition. If not specified, only the existence of the property is checked, not its value.
Javascript Examples XML Examples
@NotDebug { quickCheck(); } @NotDebug quickCheck(); @NotDebug("verify") quickCheck(); @NotDebug("mode", "verify") { quickCheck(); }
Obfuscate
Obfuscates a text string and outputs a quoted version of the string to the current output.
Javascript SyntaxXML Syntax
@Obfuscate(text,quotechar) { } <annotation:Obfuscate text="text" quote="quotechar"> </annotation:Obfuscate>
Parameters
text required The text to be evaluated. This text will be obfuscated and replaced with the obfuscated version. In XML, the text may be supplied as content text instead of the text attribute.
quote optional The quote character to use to quote the resulting string, or the string "none" for no quotes. If not specified, a double quote " character will be used. In XML specify "&#34;" for double quotes, or "&#39;" for single quotes.
Javascript Examples XML Examples
eval(@Obfuscate("update()")); <annotation:Obfuscate>update()</annotation:Obfuscate>
Output
Sets the output file for the obfuscation results of everything within the scope of this annotation.
Javascript SyntaxXML Syntax
@Output(url,encoding) { } <annotation:Output href="url" encoding="encoding"> </annotation:Output>
Parameters
url required The URL to the output file. All processed results within the context of this annotation will be sent to this file. If this file is relative, it will be resolved against the current output base URI.
encoding optional The encoding to use for the output. If not specified, the platform default encoding will be used.
Javascript Examples XML Examples
@Output("Graphics.js", "UTF-8")> @Output("Graphics.js", "UTF-8") { } <annotation:Output href="Graphics.js" encoding="UTF-8"> </annotation:Output>
Preserve
Adds or removes from the set of types of data that are prevented from stripping, encoding, or obfuscating. Preserved content will appear as it does in the source.
Javascript SyntaxXML Syntax
@Preserve(types...) { } <annotation:Preserve types="types"> </annotation:Preserve>
Parameters
types required To add a type to preserve, specify one or more of the following: "Variables", "NewVariables", "Properties", "NewProperties", "Newlines", "ScriptWhitespace", "ScriptComments", "XMLComments", "XMLWhitespace", "StringEncoding". To remove a type to preserve, prepend the type with a '!' character. e.g. "!ScriptComments".
In a script environment, the annotation accepts a variable number of arguments. In XML files, separate the type names with a ',' character.
Javascript Examples XML Examples
@Preserve("Newlines", "ScriptWhitespace") { } <annotation:Preserve types="Newlines,ScriptWhitespace"> </annotation:Preserve>
PreserveOnly
Replaces the set of types of data that are prevented from stripping, encoding, or obfuscating. Preserved content will appear as it does in the source.
Javascript SyntaxXML Syntax
@PreserveOnly(types...) { } <annotation:PreserveOnly types="types"> </annotation:PreserveOnly>
Parameters
types required Specify one or more of the following: "Variables", "NewVariables", "Properties", "NewProperties", "Newlines", "ScriptWhitespace", "ScriptComments", "XMLComments", "XMLWhitespace", "StringEncoding".
In a script environment, the annotation accepts a variable number of arguments. In XML files, separate the type names with a ',' character.
Javascript Examples XML Examples
@PreserveOnly("Newlines", "ScriptWhitespace") { } <annotation:PreserveOnly types="Newlines,ScriptWhitespace"> </annotation:PreserveOnly>
Private
Sets the target namespace to a local namespace to make identifiers inaccessible from other files. References to the identifier from other files will generate an error when processed.
Javascript SyntaxXML Syntax
@Private { } <annotation:Private> </annotation:Private>
Javascript Examples XML Examples
@Private function verifyValues() { } @Private var count = 5; var myObject { @Private id: 42, @Public name: "Barcelona" } <annotation:Private> </annotation:Private>
Property
Creates the given property in the target namespace and gives it the given name. This is a way to force the obfuscated name to be a certain value. This only establishes the property in the namespace, it does not declare it or add a reference to it.
Javascript SyntaxXML Syntax
@Property(name,newname) { } <annotation:Property name="name" newname="newname"> </annotation:Property>
Parameters
name required The name of the property.
newname optional The desired obfuscated name.
Javascript Examples XML Examples
@Property("version", "xyz"); <annotation:Property name="version" newname="xyz"/>
Public
Preserves the identifiers within the scope of this annotation so that they can be accessed from files that are not obfuscated.
Javascript SyntaxXML Syntax
@Public { } <annotation:Public> </annotation:Public>
Javascript Examples XML Examples
@Public function verifyValues() { } @Public var count = 5; var myObject { @Private id: 42, @Public name: "Barcelona" } <annotation:Public> </annotation:Public>
PublicProperty
Prevents the obfuscation of the named property in the target namespace, and adds an external reference to the property so that errors will not be generated if the property is not used. The property is expected to be declared somewhere in your source code.
Javascript SyntaxXML Syntax
@PublicProperty(name); <annotation:PublicProperty name="name"/>
Parameters
name required The name of the property to make public.
Javascript Examples XML Examples
@PublicProperty("id"); <annotation:PublicProperty name="id"/>
PublicVariable
Prevents the obfuscation of the named variable in the target namespace, and adds an external reference to the variable so that errors will not be generated if it is not used. The variable is expected to be declared somewhere in your source code.
Javascript SyntaxXML Syntax
@PublicVariable(name); <annotation:PublicVariable name="name"/>
Parameters
name required The name of the variable to make public.
Javascript Examples XML Examples
@PublicVariable("license_id"); <annotation:PublicVariable name="license_id"/>
RandomSeed
Sets the randomizing seed. Using the same seed each time will result in the same obfuscated variable names as long as nothing else changes.
Javascript SyntaxXML Syntax
@RandomSeed(num); <annotation:RandomSeed num="num"/>
Parameters
num required Any 64 bit integer value
Javascript Examples XML Examples
@RandomSeed("501923500"); <annotation:RandomSeed num="501923500"/>
Select
Selects one of multiple sets blocks of code depending on the value of the given property. The first Case annotation that matches the value of the property will be evaluated and all others will be ignored. If no Case annotation matches the value, the contents of the Default annotation will be evaluated if it exists.
Javascript SyntaxXML Syntax
@Select(name) { @Case(value) { } @Case(value) { } @Default { } } <annotation:Select name="name"> <annotation:Case value="value"> </annotation:Case> <annotation:Case value="value"> </annotation:Case> <annotation:Default> </annotation:Default> </annotation:Select>
Parameters
name required The name of the property to test.
value required The value that the property must have to satisfy the condition.
Javascript Examples XML Examples
@Switch("buildtype") { @Case("Development") { } @Case("QA") { } @Case("Production") { } @Default { } } <annotation:Select name="buildtype"> <annotation:Case value="Development"> </annotation:Case> <annotation:Case value="QA"> </annotation:Case> <annotation:Case value="Production"> </annotation:Case> <annotation:Default> </annotation:Default> </annotation:Select>
Set
Sets a property with the given name and value. The property is accessible within the scope of this annotation, including within annotations included within this annotation.
Javascript SyntaxXML Syntax
@Set(name,value) { } <annotation:Set name="name" value="value"> </annotation:Set>
Parameters
name required The name of the property to set.
value required The value to set for the property. In XML files, this can be enclosed in braces {} to evaluate it as Javascript. For example, to set the value to the value of the variable "foo", specify "{foo}" as the attribute value.
Javascript Examples XML Examples
@Set("buildtype", "QA") { @Include("myProject.js"); } <annotation:Set name="buildtype" value="QA"> <annotation:Include href="myProject.xml"/> </annotation:Set>
Unset
Unsets the property with the given name. This will remove the value of the property set within this annotation. If the property is defined in an annotation that contains this annotation, it will become visible after this call. To guarantee that the property has no value, set it to null instead.
Javascript SyntaxXML Syntax
@Unset(name) { } <annotation:Unset name="name"> </annotation:Unset>
Parameters
name required The name of the property to unset.
Javascript Examples XML Examples
@Unset("buildtype") { @Include("myProject.js"); } <annotation:Unset name="buildtype"> <annotation:Include href="myProject.xml"/> </annotation:Unset>
Unused
Everything within the scope of this annotation will be ignored.
Javascript SyntaxXML Syntax
@Unused { } <annotation:Unused> </annotation:Unused>
Javascript Examples XML Examples
@Unused { } <annotation:Unused> </annotation:Unused>
ValueOf
Inserts the value of the given property into the output.
Javascript SyntaxXML Syntax
@ValueOf(name,raw) { } <annotation:ValueOf name="name"/>
Parameters
name required The name of the property.
raw optional If true, the value will not be a quoted string, but will be obfuscated as Javascript code. If false, the value will be inserted as a quoted string. For XML elements, the value is always inserted as a unquoted string, and is not obfuscated.
Javascript Examples XML Examples
@ValueOf("added_code", true); <annotation:ValueOf name="version"/>
Variable
Creates the given variable in the target namespace and gives it the given name. This is a way to force the obfuscated name to be a certain value. This only establishes the variable in the namespace, it does not declare it or add a reference to it.
Javascript SyntaxXML Syntax
@Variable(name,newname) { } <annotation:Variable name="name" newname="newname"> </annotation:Variable>
Parameters
name required The name of the variable.
newname optional The desired obfuscated name.
Javascript Examples XML Examples
@Variable("version", "xyz"); <annotation:Variable name="version" newname="xyz"/>
Warning
Prints "Warning: " followed by the given text to the output when processing.
Javascript SyntaxXML Syntax
@Warning(text); <annotation:Warning text="text"/> <annotation:Warning>text</annotation:Warning>
Parameters
text required The warning text to display. In XML, this may be supplied as text content instead of the attribute.
Javascript Examples XML Examples
@Warning("This should be fixed.") <annotation:Warning text="This should be fixed."/> <annotation:Warning>This should be fixed.</annotation:Warning>