获取html页面所有的异步请求的模块（包括模块的依赖）

@inner
@param {arrFile} 异步模块文件id组成的数组
@param {context} context对象
@return {Array} 所有依赖的异步模块的file对象组成的数组
15740
function getDepAsynScripts(arrFile,context){
    var existsMap = {};
    var output = [];
    while(arrFile.length){
        var file = arrFile.shift();
        if(existsMap[file]){
            continue;
        }
        var fileObj = context.fileIdMap[file];
        if(!fileObj){
            fis.log.warn('file[%s] is not in context.fileIdMap',file);
            continue;
        }
        output.push(fileObj);

        if(fileObj.requires){
            var arrRequires = fileObj.requires;
           if(!Array.isArray(arrRequires)){
                arrRequires = [arrRequires];
            }
            arrFile = arrFile.concat(arrRequires);
        }
    }

    return output; 
}
20461
function(context) {
        var node = this.createElementDefaultNS("General");

        // optional Window element
        if(context.size) {
            node.appendChild(this.createElementDefaultNS(
                "Window", null,
                {
                    width: context.size.w,
                    height: context.size.h
                }
            ));
        }
        
        // required BoundingBox element
        var bounds = context.bounds;
        node.appendChild(this.createElementDefaultNS(
            "BoundingBox", null,
            {
                minx: bounds.left.toPrecision(18),
                miny: bounds.bottom.toPrecision(18),
                maxx: bounds.right.toPrecision(18),
                maxy: bounds.top.toPrecision(18),
                SRS: context.projection
            }
        ));

        // required Title element
        node.appendChild(this.createElementDefaultNS(
            "Title", context.title
        ));
        
         // optional KeywordList element
         if (context.keywords) {
             node.appendChild(this.write_wmc_KeywordList(context.keywords));
         }

         // optional Abstract element
         if (context["abstract"]) {
             node.appendChild(this.createElementDefaultNS(
                 "Abstract", context["abstract"]
             ));
         }

         // Optional LogoURL element
         if (context.logo) {
             node.appendChild(this.write_wmc_URLType("LogoURL", context.logo.href, context.logo));
         }

         // Optional DescriptionURL element
         if (context.descriptionURL) {
             node.appendChild(this.write_wmc_URLType("DescriptionURL", context.descriptionURL));
         }

         // Optional ContactInformation element
         if (context.contactInformation) {
             node.appendChild(this.write_wmc_ContactInformation(context.contactInformation));
         }

        // OpenLayers specific map properties
        node.appendChild(this.write_ol_MapExtension(context));
        
        return node;
    }
398156
function combineFileContent(pkg, toMergeFiles, context) {
    var content = '';
    var has = [];
    var isPackBundles = !! pkg.isPackBundles;
    toMergeFiles.forEach(function (file) {
        has.push(file.id);
        if(isPackBundles){
            if(file.packBundlesTo){
                fis.log.error('file [%s] has packBundlesTo[%s],can not packBundles more than once!',file.id,pkg.id);
                return;
            }
            file.packBundlesTo = pkg.subpath;
        }
        // 把要合并的文件的依赖信息添加到打包文件里
        addDependenceResource(pkg, 'addLink', file.links,context);
        addDependenceResource(pkg, 'addRequire', file.requires,context);
        addDependenceResource(pkg, 'addAsyncRequire', file.asyncs,context);

        var c;
        if(!isPackBundles && file.packBundlesTo){
            //已经合并在Bundles里面的模块不用打包到pkg里面，只需要pathmap里设置为Bundles文件的moduleId即可
            c = '';
        }else{
            c = file.getContent();
        }

        
       /* if (c && file.isCssLike && file !== pkg) {
            c = updateCSSContentUrl(c, file, pkg, context);
        }*/

        if (c) {
            if (file.isCssLike) {
                c = c.replace(CSS_CHARSET_REGEXP, '');
            }

            /**
             * @event pack:file 触发打包事件
             */
            fis.emit('pack:file', {
                file: file,
                content: c,
                pkg: pkg
            });

            content += c + '\n';
        }
    });

    return {
        content: content,
        has: has
    };
}
1202391
function _buildContext(filename, languageId) {
        var ctx = {};
        if (filename) {
            ctx.path = filename;
        } else {
            ctx.path = currentFilename;
        }
        if (languageId) {
            ctx.language = languageId;
        } else {
            ctx.language = currentLanguageId;
        }
        ctx.scopeOrder = _includeProjectScope(ctx.path) ?
                        scopeOrderWithProject :
                        scopeOrderWithoutProject;
        return ctx;
    }
1269217
function createPackItem(options, context) {
    var packTarget = createPackTargetFile(options, context);
    if (packTarget.referPkg) {
        // 按页面合并时候，可能存在同样的异步模块要合并
        var packItem = context.findPackItemById(packTarget.referPkg);
        var preLoadPages = getPreLoadPage(options, context) || [];
        packItem.load = util.union(preLoadPages, packItem.load || []);
        return;
    }

    // 初始化要合并的文件
    var toMergeFiles = options.rawCombines || [];
    if (packTarget.useExistedPack && toMergeFiles.indexOf(packTarget) === -1) {
        toMergeFiles.push(packTarget);
        options.rawCombines = toMergeFiles;
    }

    var includeFiles = options.files || [];
    var ignoreFiles = [];
    var depPackIds = [];
    includeFiles = includeFiles.map(function (item) {
        if (_.isString(item)) {
            var isNegative = /^!/.test(item);
            if (isNegative) {
                item = item.substr(1);
            }

            if (PKG_REGEXP.test(item)) {
                var packId = RegExp.$1;
                depPackIds.indexOf(packId) === -1 && depPackIds.push(packId);
                item = function (subpath) {
                    return context.isInPkg(subpath, packId);
                };
            }
            else {
                item = _.glob(item);
            }
        }

        isNegative && ignoreFiles.push(item);
        return isNegative ? null : item;
    }).filter(function (item) {
        return item;
    });

    if (!toMergeFiles.length && !includeFiles.length) {
        return;
    }

    options.depPackIds = depPackIds;
    options.includeFiles = includeFiles;
    options.ignoreFiles = ignoreFiles;
    options.packTarget = packTarget;
    options.load = getPreLoadPage(options, context);

    return options;
}
772273
function(context, descriptor, args) {
		var path = args[0],
			values = (typeof path === 'string') ? context.get(path) : path;
		if (values && values.length) {
			var template = args[1];
			for (var i = 0, len = values.length; i < len; ++i)
				template.toHTMLString(new Context(values[i], context), descriptor);
		} else if (args[2])
			args[2].toHTMLString(context, descriptor);
	}
706210
function(context, descriptor, args) {
		var path = args[0],
			template = args[1];
		var ctx = new Context(typeof path === 'string' ? context.get(path) : path, context, path);
		template.toHTMLString(ctx, descriptor);
	}
948088
function getPreLoadPage(options, context) {
    var load = options.load;
    if (!load) {
        return;
    }

    if (load === true && options.host) {
        load = [options.host];
    }
    else {
        if (!Array.isArray(load)) {
            load = [load];
        }

        if (_.isString(load[0])) {
            load = context.findFileByPattern(load);
        }
    }
    return load;
}
275469
function getImgDataDataFromContext (context) {
  return context.getImageData(0, 0, context.canvas.width, context.canvas.height)
    .data;
}
1146392
function prettyUrl(file) {
  file.extname = ".html";

  if (file.basename !== "index") {
    file.dirname = path.join(file.dirname, file.basename);
    file.basename = "index";
  }

  return file;
}
1053457
async function getPage(file) {
  config = config || (await asyncConfig());
  if (config.verbosity > 3) {
    log.dim(`Getting info for: ${file}`);
  }

  const url = path
    .relative(config.srcDir, file)
    .replace('.md', '.html')
    .split('/')
    .map(x => x.replace(/^[0-9]*-/, '')) // Removing number prefix `05-item` => `item`
    .join('/');
  const fileContents = await readFile(file, 'utf8');

  // https://www.npmjs.com/package/front-matter
  const { attributes, body, frontmatter } = fm(fileContents);

  const dirTree = url.split('/');

  let depth = url.split('/').filter(x => x !== 'index.html').length;

  let parent = dirTree[depth - 2];

  // Don't do it for homepage
  if (url === 'index.html') depth = 1;

  const page = {
    srcPath: file,
    url,
    depth,
    parent,
    meta: attributes,
    body: file.endsWith('.md') ? marked(body) : body,
  };

  return page;
}
124844
function Context(name, files, ignore) {
    this.name = name;
    this.files = files || {};
    this.ingore = ignore || [];
}
828591
function() {
			var content = '', files = [];
			if (this.$element[0].files === undefined) {
				files[0] = {
					'name' : this.$element[0] && this.$element[0].value
				};
			} else {
				files = this.$element[0].files;
			}

			for (var i = 0; i < files.length; i++) {
				content += files[i].name.split("\\").pop() + ', ';
			}

			if (content !== '') {
				this.$elementFilestyle.find(':text').val(content.replace(/\, $/g, ''));
			} else {
				this.$elementFilestyle.find(':text').val('');
			}
			
			return files;
		}
710145
function(file) {
			var id = typeof(file) === 'string' ? file : file.id;

			for (var i = files.length - 1; i >= 0; i--) {
				if (files[i].id === id) {
					return this.splice(i, 1)[0];
				}
			}
		}
821957
function buildElementsTree(contexts) {

	contexts = contexts || [document];

	var queriesArray = Object.keys(queries).map(function(key) {
		return queries[key];
	});

	var selector = queriesArray.map(function(query) {
		return query._selector;
	}).join(',');

	var elements = [];
	contexts.forEach(function(context) {
		for (var node = context.parentNode; node; node = node.parentNode) {
			// Skip nested contexts
			if (contexts.indexOf(node) !== -1) {
				return;
			}
		}
		if (context !== document && elementMatchesSelector(context, selector)) {
			elements.push(context);
		}
		elements.push.apply(elements, arrayFrom(context.querySelectorAll(selector)));
	});

	var tree = [];
	var treeCache = createCacheMap();

	elements.forEach(function(element) {

		if (element === documentElement) {
			return;
		}

		var treeNode = {
			_element: element,
			_children: [],
			_queries: [],
			_changes: [],
			_done: false,
		};

		var children = tree;
		for (var node = element.parentNode; node; node = node.parentNode) {
			if (treeCache.get(node)) {
				children = treeCache.get(node)._children;
				break;
			}
		}

		treeCache.set(element, treeNode);

		children.push(treeNode);

		queriesArray.forEach(function(query) {
			if (elementMatchesSelector(element, query._selector)) {
				treeNode._queries.push(query);
			}
		});

	});

	return tree;

}
844119
private String getContextPath() {
    ClassLoader loader = getClass().getClassLoader();
    if(loader == null)
     return null;
    URL url = loader.getResource("/");
    if (url != null) {
      String[] elements = url.toString().split("/");
      for (int i = elements.length - 1; i > 0; --i) {
        // URLs look like this: file:/.../ImageServer/WEB-INF/classes/
        // And we want that part that's just before WEB-INF
        if ("WEB-INF".equals(elements[i])) {
          return elements[i - 1];
        }
      }
    }
    return null;
  }
1018176
function getDockerfileContext(context) {
  const fs = require('fs');
  let files = [];
  let dockerfile = exports.resolveDockerfile(context);
  let file = fs.readFileSync(dockerfile, {encoding: 'utf8'});
  for (let line of file.split('\n')) {
    if (line.match(/^\s*(ADD|COPY).*$/)) {
      let entries = line.split(' ')
        .splice(1)
        .map(val => val.trim())
        .filter(val => val !== '')
        .filter(val => !val.startsWith('http'));
      if (entries[0].startsWith('--chown')) {
        entries = entries.splice(1);
      }

      // Array mode
      if (line.indexOf('[') !== -1 && line.indexOf(']') !== -1) {
        let args = JSON.parse(entries.join(' '));
        args.splice(-1);
        files = args
      }
      // Default mode
      else {
        entries.splice(-1);
        files = entries;
      }
    }
  }

  let resolvedFiles = [];
  for (let file of files) {
    resolvedFiles = resolvedFiles.concat(glob.sync(path.join(path.dirname(context), file)));
  }

  return { context, src: ['Dockerfile', ...resolvedFiles] };
}