Sha256: e6513244d93d79587e353c8ea120757474a2e10d51c5aaa14ee83bd0212fc0d6

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

var define, requireModule, require, requirejs;

(function() {
  var registry = {}, seen = {};

  define = function(name, deps, callback) {
    registry[name] = { deps: deps, callback: callback };
  };

  requirejs = require = requireModule = function(name) {
  requirejs._eak_seen = registry;

    if (seen[name]) { return seen[name]; }
    seen[name] = {};

    if (!registry[name]) {
      throw new Error("Could not find module " + name);
    }

    var mod = registry[name],
        deps = mod.deps,
        callback = mod.callback,
        reified = [],
        exports;

    for (var i=0, l=deps.length; i<l; i++) {
      if (deps[i] === 'exports') {
        reified.push(exports = {});
      } else {
        reified.push(requireModule(resolve(deps[i])));
      }
    }

    var value = callback.apply(this, reified);
    return seen[name] = exports || value;

    function resolve(child) {
      if (child.charAt(0) !== '.') { return child; }
      var parts = child.split("/");
      var parentBase = name.split("/").slice(0, -1);

      for (var i=0, l=parts.length; i<l; i++) {
        var part = parts[i];

        if (part === '..') { parentBase.pop(); }
        else if (part === '.') { continue; }
        else { parentBase.push(part); }
      }

      return parentBase.join("/");
    }
  };
})();

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ember-appkit-rails-0.5.0 vendor/assets/javascripts/ember-appkit/loader.js
ember-appkit-rails-0.4.0 vendor/assets/javascripts/ember-appkit/loader.js
ember-appkit-rails-0.3.2 vendor/assets/javascripts/ember-appkit/loader.js
ember-appkit-rails-0.3.1 vendor/assets/javascripts/ember-appkit/loader.js
ember-appkit-rails-0.3.0 vendor/assets/javascripts/ember-appkit/loader.js