Parses the file for import statements.

@private
@param {String} data - The file contents.
@param {String} file - The path of the source file.
@param {Object} extensions - Extensions of imports that shall be inlined.
@return {Promise} A promise.
function parseImports(data, file, extensions) {

	const imports = [];

	let result = importRegExp.exec(data);
	let encoding;

	while(result !== null) {

		encoding = extensions[path.extname(result[2])];

		// Filter irrelevant imports.
		if(encoding !== undefined) {

			imports.push(new FileImport(
				result.index,
				importRegExp.lastIndex,
				result[1],
				path.resolve(path.dirname(file), result[2]),
				encoding
			));

		}

		result = importRegExp.exec(data);

	}

	return Promise.resolve([imports, data]);

}