Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4123804
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:39:32+00:00 2026-05-20T23:39:32+00:00

Google Closure Compiler in advanced optimization mode uses a file to define externs that

  • 0

Google Closure Compiler in advanced optimization mode uses a file to define externs that would prevent variable, property and function names that refer to symbols in an external library to be minified, thereby breaking code. My goal is to compile code that uses the MooTools framework (versions 1.2 and 1.3) yet I am unable to find an “official” extern file that would prevent references to MooTools functions from being obfuscated when my code is fed to the closure compiler. I have come up with the following rather rudimentary custom extern file that successfully processes my file but is there a better alternative (such as auto-generating it from MooTools source)?

//
// Number
//

/**
* @param {number} min
* @param {number} max
* @return {number}
* @nosideeffects
*/
Number.prototype.limit = function (min, max) {}
/**
* @param {number=} precision
* @return {number}
* @nosideeffects
*/
Number.prototype.round = function (precision) {}
Number.prototype.times = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.toFloat = function () {}
/**
* @param {number=} base
* @return {number}
* @nosideeffects
*/
Number.prototype.toInt = function (base) {}

//
// Number.Math
//

/**
* @return {number}
* @nosideeffects
*/
Number.prototype.abs = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.acos = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.asin = function () {}
/**
* @param {number} x
* @return {number}
* @nosideeffects
*/
Number.prototype.atan2 = function (x) {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.ceil = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.cos = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.exp = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.floor = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.log = function () {}
/**
* @param {...number} x
* @return {number}
* @nosideeffects
*/
Number.prototype.max = function (x) {}
/**
* @param {...number} x
* @return {number}
* @nosideeffects
*/
Number.prototype.min = function (x) {}
/**
* @param {number} x
* @return {number}
* @nosideeffects
*/
Number.prototype.pow = function (x) {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.sin = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.sqrt = function () {}
/**
* @return {number}
* @nosideeffects
*/
Number.prototype.tan = function () {}

//
// String
//

/**
* @return {boolean}
* @nosideeffects
*/
String.prototype.test = function () {}
/**
* @return {boolean}
* @nosideeffects
*/
String.prototype.contains = function () {}
/**
* @return {string}
* @nosideeffects
* @suppress {duplicate}
*/
String.prototype.trim = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.clean = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.camelCase = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.hyphenate = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.capitalize = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.escapeRegExp = function () {}
/**
* @return {number}
* @nosideeffects
*/
String.prototype.toInt = function () {}
/**
* @return {number}
* @nosideeffects
*/
String.prototype.toFloat = function () {}
/**
* @return {(string|Array.<number>)}
* @nosideeffects
*/
String.prototype.hexToRgb = function () {}
/**
* @return {(string|Array.<string>)}
* @nosideeffects
*/
String.prototype.rgbToHex = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.substitute = function () {}
/**
* @return {string}
* @nosideeffects
*/
String.prototype.stripScripts = function () {}

//
// Array
//

/**
* @param {function(*, number=, Array=) : undefined} fn
* @param {!Object=} bind
*/
Array.prototype.each = function (fn, bind) {}
Array.prototype.invoke = function () {}
/**
* @param {function(*, number=, Array=) : boolean} fn
* @param {!Object=} bind
* @return {boolean}
* @suppress {duplicate}
*/
Array.prototype.every = function (fn, bind) {}
/**
* @param {function(*, number=, Array=) : boolean} fn
* @param {!Object=} bind
* @return {Array}
* @suppress {duplicate}
*/
Array.prototype.filter = function (fn, bind) {}
/**
* @return Array
*/
Array.prototype.clean = function () {}
/**
* @param {*} item
* @param {number} from
* @return number
* @suppress {duplicate}
*/
Array.prototype.indexOf = function (item, from) {}
/**
* @param {function(*, number=, Array=) : *} fn
* @param {!Object=} bind
* @return {Array}
* @suppress {duplicate}
*/
Array.prototype.map = function (fn, bind) {}
/**
* @param {function(*, number=, Array=) : boolean} fn
* @param {!Object=} bind
* @return {boolean}
* @suppress {duplicate}
*/
Array.prototype.some = function (fn, bind) {}
/**
* @param {Array} obj
* @return {Object}
*/
Array.prototype.associate = function (obj) {}
/**
* @param {Object} obj
* @return {Object}
*/
Array.prototype.link = function (obj) {}
/**
* @param {*} item
* @param {number} from
* @return {boolean}
*/
Array.prototype.contains = function (item, from) {}
/**
* @param {Array} other
* @return {Array}
*/
Array.prototype.append = function (other) {}
/**
* @return {*}
*/
Array.prototype.getLast = function () {}
/**
* @return {*}
*/
Array.prototype.getRandom = function () {}
/**
* @param {*} item
* @return {Array}
*/
Array.prototype.include = function (item) {}
/**
* @param {Array} other
* @return {Array}
*/
Array.prototype.combine = function (other) {}
/**
* @param {*} item
* @return {Array}
*/
Array.prototype.erase = function (item) {}
/**
* @return {Array}
*/
Array.prototype.empty = function () {}
/**
* @return {Array}
*/
Array.prototype.flatten = function () {}
/**
* @return {*}
*/
Array.prototype.pick = function () {}
Array.prototype.hexToRgb = function () {}
Array.prototype.rgbToHex = function () {}

// Class

/**
* @constructor
* @param {(!Object|function())} properties
*/
function Class(properties) { }
/**
* @param {!Object} properties
*/
Class.prototype.implement = function (properties) {}

/**
* @constructor
*/
function Events() { }
/**
* @constructor
*/
function Options() { }

//
// Element
//

/**
* @constructor
* @param {(string|Element)} el
* @param {!Object=} properties
* @suppress {duplicate}
*/
function Element(el, properties) { }
/**
* @param {string} tag
* @return {Element}
*/
Element.prototype.getElement = function (tag) {}
/**
* @param {string} tag
* @return {Elements}
*/
Element.prototype.getElements = function (tag) {}
/**
* @param {string} id
* @return {Element}
*/
Element.prototype.getElementById = function (id) {}
/**
* @param {(string|!Object)} property
* @param {*=} value
* @return {Element}
*/
Element.prototype.set = function (property, value) {}
/**
* @param {string} property
* @return {*}
*/
Element.prototype.get = function (property) {}
/**
* @param {string} property
* @return {*}
*/
Element.prototype.erase = function (property) {}
/**
* @param {(string|Element)} match
* @return {boolean}
*/
Element.prototype.match = function (match) {}
/**
* @param {(string|Element)} el
* @return {boolean}
* @suppress {duplicate}
*/
Element.prototype.contains = function (el) {}
/**
* @param {(string|Element)} el
* @param {string=} where
* @return {Element}
*/
Element.prototype.inject = function (el, where) {}
/**
* @param {(string|Element)} el
* @param {string=} where
* @return {Element}
*/
Element.prototype.grab = function (el, where) {}
/**
* @param {(string|Element|Elements)} el
* @param {...(string|Element|Elements)} var_args
* @return {Element}
*/
Element.prototype.adopt = function (el,var_args) {}
/**
* @param {(string|Element)} el
* @param {string=} where
* @return {Element}
*/
Element.prototype.wraps = function (el, where) {}
/**
* @param {string} text
* @param {string=} where
* @return {Element}
*/
Element.prototype.appendText = function (text, where) {}
/**
* @return {undefined}
*/
Element.prototype.dispose = function () {}
/**
* @param {boolean=} contents
* @param {boolean=} keepid
* @return {Element}
*/
Element.prototype.clone = function (contents, keepid) {}
/**
* @param {(string|Element)} el
* @return {Element}
*/
Element.prototype.replaces = function (el) {}
/**
* @param {string} className
* @return {boolean}
*/
Element.prototype.hasClass = function (className) {}
/**
* @param {string} className
* @return {Element}
*/
Element.prototype.addClass = function (className) {}
/**
* @param {string} className
* @return {Element}
*/
Element.prototype.removeClass = function (className) {}
/**
* @param {string} className
* @param {boolean=} force
* @return {Element}
*/
Element.prototype.toggleClass = function (className, force) {}
/**
* @param {string=} match
* @return {Element}
*/
Element.prototype.getPrevious = function (match) {}
/**
* @param {string=} match
* @return {Elements}
*/
Element.prototype.getAllPrevious = function (match) {}
/**
* @param {string=} match
* @return {Element}
*/
Element.prototype.getNext = function (match) {}
/**
* @param {string=} match
* @return {Elements}
*/
Element.prototype.getAllNext = function (match) {}
/**
* @param {string=} match
* @return {Element}
*/
Element.prototype.getFirst = function (match) {}
/**
* @param {string=} match
* @return {Element}
*/
Element.prototype.getLast = function (match) {}
/**
* @param {string=} match
* @return {Element}
*/
Element.prototype.getParent = function (match) {}
/**
* @param {string=} match
* @return {Elements}
*/
Element.prototype.getParents = function (match) {}
/**
* @param {string=} match
* @return {Elements}
*/
Element.prototype.getSiblings = function (match) {}
/**
* @param {string=} match
* @return {Elements}
*/
Element.prototype.getChildren = function (match) {}
/**
* @return {Element}
*/
Element.prototype.empty = function () {}
Element.prototype.destroy = function () {}
/**
* @return {string}
*/
Element.prototype.toQueryString = function () {}
Element.prototype.getSelected = function () {}
/**
* @param {string} property
* @return {string}
*/
Element.prototype.getProperty = function (property) {}
/**
* @param {Array.<string>} properties
* @return {!Object}
*/
Element.prototype.getProperties = function (properties) {}
/**
* @param {string} property
* @param {*} value
* @return {Element}
*/
Element.prototype.setProperty = function (property, value) {}
/**
* @param {!Object} properties
* @return {Element}
*/
Element.prototype.setProperties = function (properties) {}
/**
* @param {string} property
* @return {Element}
*/
Element.prototype.removeProperty = function (property) {}
/**
* @param {Array.<string>} properties
* @return {Element}
*/
Element.prototype.removeProperties = function (properties) {}
/**
* @param {string} key
* @param {*} value
* @return {Element}
*/
Element.prototype.store = function (key, value) {}
/**
* @param {string} key
* @param {*=} def
* @return {*}
*/
Element.prototype.retrieve = function (key, def) {}
/**
* @param {string} key
* @return {Element}
*/
Element.prototype.eliminate = function (key) {}

/**
* @constructor
* @extends Array
*/
function Elements() { }
/**
* @param {(string|!Object)} property
* @param {*=} value
* @return {Element}
*/
Elements.prototype.set = function (property, value) {}
/**
* @param {string} className
* @return {Element}
*/
Elements.prototype.addClass = function (className) {}
/**
* @param {string} className
* @return {Element}
*/
Elements.prototype.removeClass = function (className) {}
/**
* @param {string} className
* @param {boolean=} force
* @return {Element}
*/
Elements.prototype.toggleClass = function (className, force) {}

/**
* @param {(string|Element)} arg
* @return {Element}
*/
function $(arg) {}
/**
* @param {(string|Array|Element|Elements)} arg
* @param {...Element} var_args
* @return {Elements}
*/
function $$(arg, var_args) {}

//
// Element.Style
//

/**
* @param {string} property
* @return {Element}
*/
Element.prototype.setStyle = function (property, value) {}
/**
* @param {string} property
* @return {string}
*/
Element.prototype.getStyle = function (property) {}
/**
* @param {!Object} styles
* @return {Element}
*/
Element.prototype.setStyles = function (styles) {}
/**
* @param {...string} var_args
*/
Element.prototype.getStyles = function (var_args) {}

//
// Element.Event
//

/**
* @param {string} type
* @param {function()} fn
* @return {Element}
*/
Element.prototype.addEvent = function (type, fn) {}
/**
* @param {string} type
* @param {function()} fn
* @return {Element}
*/
Element.prototype.removeEvent = function (type, fn) {}
/**
* @param {!Object} events
* @return {Element}
*/
Element.prototype.addEvents = function (events) {}
/**
* @param {(string|!Object)=} events
* @return {Element}
*/
Element.prototype.removeEvents = function (events) {}
/**
* @param {string} type
* @param {(Array|Object)=} args
* @param {number=} delay
* @return {Element}
*/
Element.prototype.fireEvent = function (type, args, delay) {}
/**
* @param {Element} from
* @param {string} type
* @return {Element}
*/
Element.prototype.cloneEvents = function (from, type) {}

/**
* @param {string} type
* @param {function()} fn
*/
window.addEvent = function (type, fn) {}
/**
* @param {string} type
* @param {function()} fn
*/
window.removeEvent = function (type, fn) {}
/**
* @param {!Object} events
*/
window.addEvents = function (events) {}
/**
* @param {(string|!Object)=} events
*/
window.removeEvents = function (events) {}
/**
* @param {string} type
* @param {(Array|Object)=} args
* @param {number=} delay
*/
window.fireEvent = function (type, args, delay) {}
/**
* @param {Element} from
* @param {string} type
*/
window.cloneEvents = function (from, type) {}

//
// Element.Dimensions
//

Element.prototype.scrollTo = function () {}
Element.prototype.getSize = function () {}
Element.prototype.getScrollSize = function () {}
Element.prototype.getScroll = function () {}
Element.prototype.getPosition = function () {}
Element.prototype.setPosition = function () {}
Element.prototype.getCoordinates = function () {}
Element.prototype.getOffsetParent = function () {}

window.scrollTo = function () {}
window.getSize = function () {}
window.getScrollSize = function () {}
window.getScroll = function () {}

//
// Fx
//

/**
* @constructor
*/
function Fx() {}
/**
* @constructor
* @param {(string|Element)} el
* @param {!Object=} options
*/
Fx.Tween = function (el, options) { }
Fx.Tween.prototype.set = function () { }
Fx.Tween.prototype.start = function () { }
/**
* @constructor
* @param {(string|Element)} el
* @param {!Object=} options
*/
Fx.Morph = function (el, options) { }
/**
* @param {(string|!Object)} properties
* @return {Fx.Morph}
*/
Fx.Morph.prototype.set = function (properties) { }
/**
* @param {(string|!Object)} properties
* @return {Fx.Morph}
*/
Fx.Morph.prototype.start = function (properties) { }

/**
* @return {Element}
*/
Element.prototype.tween = function () {}
/**
* @return {Element}
*/
Element.prototype.morph = function () {}
/**
* @return {Element}
*/
Element.prototype.fade = function () {}
/**
* @return {Element}
*/
Element.prototype.highlight = function () {}

//
// Fx.Transitions
//

/**
* @constructor
*/
Fx.Transitions = function () {}
Fx.Transitions.linear = function () {}
Fx.Transitions.quad = function () {}
Fx.Transitions.cubic = function () {}
Fx.Transitions.quart = function () {}
Fx.Transitions.quint = function () {}
Fx.Transitions.pow = function () {}
Fx.Transitions.expo = function () {}
Fx.Transitions.circ = function () {}
Fx.Transitions.sine = function () {}
Fx.Transitions.back = function () {}
Fx.Transitions.bounce = function () {}
Fx.Transitions.elastic = function () {}

//
// Request
//

/**
* @constructor
* @param {!Object=} options
*/
function Request(options) { }
Request.prototype.setHeader = function () {}
Request.prototype.getHeader = function () {}
Request.prototype.send = function () {}
Request.prototype.post = function () {}
Request.prototype.get = function () {}
Request.prototype.put = function () {}
Request.prototype.cancel = function () {}
Request.prototype.isRunning = function () {}

Element.prototype.send = function () {}

/**
* @constructor
* @extends Request
* @param {!Object=} options
*/
Request.HTML = function (options) { }
/**
* @constructor
* @extends Request
* @param {!Object=} options
*/
Request.JSON = function (options) { }

//
// JSON
//

/**
* @constructor
*/
function JSON() { }
/**
* @param {Object} obj
* @return {string}
*/
JSON.encode = function (obj) {}
/**
* @param {string} string
* @param {boolean=} secure
*/
JSON.decode = function (string, secure) {}

//
// Swiff
//

/**
* @constructor
* @param {string} path
* @param {!Object} options
*/
function Swiff(path, options) { }

//
// Compat
//

/**
* @param {...*} var_args
* @nosideeffects
*/
function $pick(var_args) { }
/**
* @param {...Object} var_args
* @nosideeffects
*/
function $merge(var_args) { }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:39:32+00:00Added an answer on May 20, 2026 at 11:39 pm

    A comprehensive extens file is just the first step of using the Closure Compiler in Advanced mode. The library itself has to be written (or modified) to be useable.

    An externs file merely prevents one sort of problem only — that of property and function renaming. However, some code constructs may break after compilation if the library code base is not carefully scrubbed.

    For example, dead-code removal can easily remove the wrong code (or leave along code that should be removed). Unintended aliases can prevent most optimizations from happening. “Dangerous use of this” can break code in the most unsuspecting places.

    Therefore, even if your code compiles and work fine with your externs file, it doesn’t mean that other MooTools programs will work fine. Moreover, it doesn’t mean that the next revision of your program will not break when you unknowingly uses a feature that breaks under compilation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm testing google closure-compiler and wanting to compile facebox Plugin with the option Advanced
Possible Duplicate: jQuery compiled with Google Closure Compiler I am using jQuery and I
Does Jammit require YUI Compressor or the Google Closure Compiler to be installed on
Any ideas on how to use Google Closure Compiler to combine multiple JavaScript files
Google results on this one are a bit thin, but suggest that it is
I have a javascript file with a global object that must not be renamed
Google Analytics reads like a seismic chart lately
Google is not being my friend - it's been a long time since my
Google maps in some region can serve traffic information showing the blocked roads and
Google's not coming to my rescue, here, and I just know this is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.