third_party/es6-module-loader/loader.js
function linkDeclarativeModule(load, loads, loader) {
      if (load.module)
        return;

      var module = load.module = getOrCreateModuleRecord(load.name);
      var moduleObj = load.module.module;

      var registryEntry = load.declare.call(__global, function(name, value) {
        // NB This should be an Object.defineProperty, but that is very slow.
        //    By disaling this module write-protection we gain performance.
        //    It could be useful to allow an option to enable or disable this.

        // bulk export object
        if (typeof name == 'object') {
          for (var p in name)
            moduleObj[p] = name[p];
        }
        // single export name / value pair
        else {
          moduleObj[name] = value;
        }

        for (var i = 0, l = module.importers.length; i < l; i++) {
          var importerModule = module.importers[i];
          if (importerModule.setters) {
            var importerIndex = importerModule.dependencies.indexOf(module);
            if (importerIndex != -1) {
              var setter = importerModule.setters[importerIndex];
              setter(moduleObj);
            }
          }
        }
        return value;
      }, {id: load.name});

      // setup our setters and execution function
      load.module.setters = registryEntry.setters;
      load.module.execute = registryEntry.execute;

      // now link all the module dependencies
      // amending the depMap as we go
      for (var i = 0, l = load.dependencies.length; i < l; i++) {
        var depName = load.dependencies[i].value;
        var depModule = getOrCreateModuleRecord(depName);

        depModule.importers.push(module);

        // if not already a module in the registry, try and link it now
        if (!loader.modules[depName]) {

          // get the dependency load record
          for (var j = 0; j < loads.length; j++) {
            if (loads[j].name != depName)
              continue;

            // only link if already not already started linking (stops at circular / dynamic)
            if (!loads[j].module)
              linkDeclarativeModule(loads[j], loads, loader);
          }
        }

        console.assert(depModule, 'Dependency module not found!');

        module.dependencies.push(depModule);

        // run the setter for this dependency
        if (module.setters[i])
          module.setters[i](depModule.module);
      }

      load.status = 'linked';
    }
function linkDeclarativeModule(load, loads, loader) {
      if (load.module)
        return;

      var module = load.module = getOrCreateModuleRecord(load.name);
      var moduleObj = load.module.module;

      var registryEntry = load.declare.call(__global, function(name, value) {
        // NB This should be an Object.defineProperty, but that is very slow.
        //    By disaling this module write-protection we gain performance.
        //    It could be useful to allow an option to enable or disable this.

        // bulk export object
        if (typeof name == 'object') {
          for (var p in name)
            moduleObj[p] = name[p];
        }
        // single export name / value pair
        else {
          moduleObj[name] = value;
        }

        for (var i = 0, l = module.importers.length; i < l; i++) {
          var importerModule = module.importers[i];
          if (importerModule.setters) {
            var importerIndex = importerModule.dependencies.indexOf(module);
            if (importerIndex != -1) {
              var setter = importerModule.setters[importerIndex];
              setter(moduleObj);
            }
          }
        }
        return value;
      }, {id: load.name});

      // setup our setters and execution function
      load.module.setters = registryEntry.setters;
      load.module.execute = registryEntry.execute;

      // now link all the module dependencies
      // amending the depMap as we go
      for (var i = 0, l = load.dependencies.length; i < l; i++) {
        var depName = load.dependencies[i].value;
        var depModule = getOrCreateModuleRecord(depName);

        depModule.importers.push(module);

        // if not already a module in the registry, try and link it now
        if (!loader.modules[depName]) {

          // get the dependency load record
          for (var j = 0; j < loads.length; j++) {
            if (loads[j].name != depName)
              continue;

            // only link if already not already started linking (stops at circular / dynamic)
            if (!loads[j].module)
              linkDeclarativeModule(loads[j], loads, loader);
          }
        }

        console.assert(depModule, 'Dependency module not found!');

        module.dependencies.push(depModule);

        // run the setter for this dependency
        if (module.setters[i])
          module.setters[i](depModule.module);
      }

      load.status = 'linked';
    }
function linkDeclarativeModule ( load , loads , loader ) { if ( load . module ) return ; var module = load . module = getOrCreateModuleRecord ( load . name ) ; var moduleObj = load . module . module ; var registryEntry = load . declare . call ( __global , function ( name , value ) { // NB This should be an Object.defineProperty, but that is very slow. //    By disaling this module write-protection we gain performance. //    It could be useful to allow an option to enable or disable this. // bulk export object if ( typeof name == 'object' ) { for ( var p in name ) moduleObj [ p ] = name [ p ] ; } // single export name / value pair else { moduleObj [ name ] = value ; } for ( var i = 0 , l = module . importers . length ; i < l ; i ++ ) { var importerModule = module . importers [ i ] ; if ( importerModule . setters ) { var importerIndex = importerModule . dependencies . indexOf ( module ) ; if ( importerIndex != - 1 ) { var setter = importerModule . setters [ importerIndex ] ; setter ( moduleObj ) ; } } } return value ; } , { id : load . name } ) ; // setup our setters and execution function load . module . setters = registryEntry . setters ; load . module . execute = registryEntry . execute ; // now link all the module dependencies // amending the depMap as we go for ( var i = 0 , l = load . dependencies . length ; i < l ; i ++ ) { var depName = load . dependencies [ i ] . value ; var depModule = getOrCreateModuleRecord ( depName ) ; depModule . importers . push ( module ) ; // if not already a module in the registry, try and link it now if ( ! loader . modules [ depName ] ) { // get the dependency load record for ( var j = 0 ; j < loads . length ; j ++ ) { if ( loads [ j ] . name != depName ) continue ; // only link if already not already started linking (stops at circular / dynamic) if ( ! loads [ j ] . module ) linkDeclarativeModule ( loads [ j ] , loads , loader ) ; } } console . assert ( depModule , 'Dependency module not found!' ) ; module . dependencies . push ( depModule ) ; // run the setter for this dependency if ( module . setters [ i ] ) module . setters [ i ] ( depModule . module ) ; } load . status = 'linked' ; }
custom declarative linking function
custom declarative linking function