Retroactively add reasonable module definition paths to
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Maps defined modules to reasonable names, so you can more easily access internal javascript.

Warning - Usage - API - How It Works - License



plug-modules makes it easy to use's client-side internals. Remember that's internal JavaScript is not meant to be a public API. It changes a lot! Modules that you used yesterday, may not exist tomorrow, so make sure to code very defensively and to fall back gracefully.


If you're writing an extension for use on, the easiest way to use plug-modules is using the require.js loader plugin. First, configure require.js to load plug-modules correctly, and then simply require() the stuff you need:

  paths: {
    'plug-modules': ''

require(['plug-modules!plug/core/Events'], function (Events) {
  Events.trigger('notify', 'icon-plug-dj', 'plug-modules works!');

If you don't like require.js, plug-modules is available on npm so you can bundle something yourself:

$ npm install plug-modules

You can then use it as a CommonJS module, or an AMD module, or just as window.plugModules when loaded in a <script> tag.

After loading plug-modules, you can access modules like:

var SubClass = plugModules.require('plug/core/Class').extend({
  /* class definition */

  .trigger('notify', 'icon-plug-dj', 'Notification text');

Or make yourself an admin locally: (Fun fact! This will make log some more debug info to the console 😄 )

var currentUser = plugModules.require('plug/models/currentUser');
currentUser.set('gRole', 5);

See the Wiki for more examples!

plugModules.require() modules in your browser's developer console or use replug to figure out what the different modules are for, and what you can do with/to them.


require.js plugin

plug-modules can be used as a require.js plugin:

require([ 'plug-modules!plug/core/Events' ], function (Events) {
  Events.trigger('notify', 'icon-plug-dj', 'Hello from plug-modules!');

Initialises plug-modules and computes all the module name mappings. You need to run this before using plugModules.register. It's done for you if you're using the require.js plugin.


Returns a module. You can use any of the remapped module names, as well as original (obfuscated) names.


Defines all the remapped names on the global require() object, so you can use require() to access modules via the remapped names, too. In general, it's better to use plugModules.require instead.


Checks if a module with the given name has been defined. Accepts both remapped and original module names. Note that a module that actually equals undefined also returns false:

define('module', function () { return undefined })
plugModules.isDefined('module') === false


Returns an array of original module names that were not remapped. This is mostly useful for finding more modules to reverse-engineer. Note that this is only useful if you've run all resolvers, otherwise modules that haven't yet been used won't be remapped.

How It Works

plug-modules contains several hundred resolver functions that find different modules by duck-typing. They then associate those modules with a descriptive and readable name each. You can call plugModules.register() to inject all those names back into require.js, so you can use the global require() function on Or better, you can use plugModules.require() if you don't want to contaminate the global module-space.