code: function insertQueue(queue, resource) {
      let len = queue.length;
      let curResource;
      let insertPosition = queue.length;
      let requires;
      let attr;
  
      if (resource.type === 'js') {
          requires = resource.requiredModules;
          attr = 'requiredModules';
      } else if (resource.type === 'css') {
          attr = 'requiredCSS';
          requires = resource.requiredCSS;
      }
  
      for (let i = 0; i < len; ++i) {
          curResource = queue[i];
          // 遇到资源依赖项
          if (requires.indexOf(curResource.id) > -1) {
              insertPosition = i + 1;
              continue;
          }
          // 遇到依赖资源项
          if (curResource[attr].indexOf(resource.id) > -1) {
              insertPosition = i;
              break;
          }
      }
  
      queue.splice(insertPosition, 0, resource);
  }
docs: 插入打包的队列结构
  @param {Array} queue
  @param {Resource} resource