src/deep-core/lib/Generic/require1k.js
function deepLoad(module, callback, parentLocation, id) {
    // If this module is already loading then don't proceed.
    // This is a bug.
    // If a module is requested but not loaded then the module isn't ready,
    // but we callback as if it is. Oh well, 1k!
    if (module.g) {
      return callback(module.e, module);
    }

    var location = module.g = module.l;

    var request = new XMLHttpRequest();
    request.onload = function (deps, count) {
      if (request.status == 200 || module.t) {
        // Should really use an object and then Object.keys to avoid
        // duplicate dependencies. But that costs bytes.
        deps = [];
        (module.t = module.t || request.response).replace(/(?:^|[^\w\$_.])require\s*\(\s*["']([^"']*)["']\s*\)/g, function (_, id) {
          deps.push(id);
        });
        count = deps.length;
        function loaded() {
          // We call loaded straight away below in case there
          // are no dependencies. Putting this check first
          // and the decrement after saves us an `if` for that
          // special case
          if (!count--) {
            callback(undefined, module);
          }
        }
        deps.map(function (dep) {
          deepLoad(
            resolveModuleOrGetExports(module.l, dep),
            loaded,
            // If it doesn't begin with a ".", then we're searching
            // node_modules, so pass in the info to make this
            // possible
            dep[0] != "." ? location + "/../" : undefined,
            dep
          );
        });
        loaded();
      } else {
        // parentLocation is only given if we're searching in node_modules
        if (parentLocation) {
          // Recurse up the tree trying to find the dependency
          // (generating 404s on the way)
          deepLoad(
            module.n = resolveModuleOrGetExports(parentLocation += "../", id),
            callback,
            parentLocation,
            id
          );
        } else {
          module.e = request;
          callback(request, module);
        }
      }
    };

    // If the module already has text because we're using a factory
    // function, then there's no need to load the file!
    if (module.t) {
      request.onload();
    } else {
      request.open("GET", location, true);
      request.send();
    }
  }
function deepLoad(module, callback, parentLocation, id) {
    // If this module is already loading then don't proceed.
    // This is a bug.
    // If a module is requested but not loaded then the module isn't ready,
    // but we callback as if it is. Oh well, 1k!
    if (module.g) {
      return callback(module.e, module);
    }

    var location = module.g = module.l;

    var request = new XMLHttpRequest();
    request.onload = function (deps, count) {
      if (request.status == 200 || module.t) {
        // Should really use an object and then Object.keys to avoid
        // duplicate dependencies. But that costs bytes.
        deps = [];
        (module.t = module.t || request.response).replace(/(?:^|[^\w\$_.])require\s*\(\s*["']([^"']*)["']\s*\)/g, function (_, id) {
          deps.push(id);
        });
        count = deps.length;
        function loaded() {
          // We call loaded straight away below in case there
          // are no dependencies. Putting this check first
          // and the decrement after saves us an `if` for that
          // special case
          if (!count--) {
            callback(undefined, module);
          }
        }
        deps.map(function (dep) {
          deepLoad(
            resolveModuleOrGetExports(module.l, dep),
            loaded,
            // If it doesn't begin with a ".", then we're searching
            // node_modules, so pass in the info to make this
            // possible
            dep[0] != "." ? location + "/../" : undefined,
            dep
          );
        });
        loaded();
      } else {
        // parentLocation is only given if we're searching in node_modules
        if (parentLocation) {
          // Recurse up the tree trying to find the dependency
          // (generating 404s on the way)
          deepLoad(
            module.n = resolveModuleOrGetExports(parentLocation += "../", id),
            callback,
            parentLocation,
            id
          );
        } else {
          module.e = request;
          callback(request, module);
        }
      }
    };

    // If the module already has text because we're using a factory
    // function, then there's no need to load the file!
    if (module.t) {
      request.onload();
    } else {
      request.open("GET", location, true);
      request.send();
    }
  }
function deepLoad ( module , callback , parentLocation , id ) { // If this module is already loading then don't proceed. // This is a bug. // If a module is requested but not loaded then the module isn't ready, // but we callback as if it is. Oh well, 1k! if ( module . g ) { return callback ( module . e , module ) ; } var location = module . g = module . l ; var request = new XMLHttpRequest ( ) ; request . onload = function ( deps , count ) { if ( request . status == 200 || module . t ) { // Should really use an object and then Object.keys to avoid // duplicate dependencies. But that costs bytes. deps = [ ] ; ( module . t = module . t || request . response ) . replace ( / (?:^|[^\w\$_.])require\s*\(\s*["']([^"']*)["']\s*\) / g , function ( _ , id ) { deps . push ( id ) ; } ) ; count = deps . length ; function loaded ( ) { // We call loaded straight away below in case there // are no dependencies. Putting this check first // and the decrement after saves us an `if` for that // special case if ( ! count -- ) { callback ( undefined , module ) ; } } deps . map ( function ( dep ) { deepLoad ( resolveModuleOrGetExports ( module . l , dep ) , loaded , // If it doesn't begin with a ".", then we're searching // node_modules, so pass in the info to make this // possible dep [ 0 ] != "." ? location + "/../" : undefined , dep ) ; } ) ; loaded ( ) ; } else { // parentLocation is only given if we're searching in node_modules if ( parentLocation ) { // Recurse up the tree trying to find the dependency // (generating 404s on the way) deepLoad ( module . n = resolveModuleOrGetExports ( parentLocation += "../" , id ) , callback , parentLocation , id ) ; } else { module . e = request ; callback ( request , module ) ; } } } ; // If the module already has text because we're using a factory // function, then there's no need to load the file! if ( module . t ) { request . onload ( ) ; } else { request . open ( "GET" , location , true ) ; request . send ( ) ; } }
Loads the given module and all of it dependencies, recursively - module         The module object - callback       Called when everything has been loaded - parentLocation Location of the parent directory to look in. Only given for non-relative dependencies - id             The name of the dependency. Only used for non-relative dependencies
Loads the given module and all of it dependencies recursively - module The module object - callback Called when everything has been loaded - parentLocation Location of the parent directory to look in . Only given for non - relative dependencies - id The name of the dependency . Only used for non - relative dependencies