///
///
import { EventEmitter } from 'events';
import * as Vinyl from 'vinyl';
import { ParserOptions } from './Parser';
export declare type LinkerOptions = ParserOptions;
interface Linker {
on(event: 'file', listener: (file: Vinyl, requirements: string[]) => void): this;
on(event: 'build', listener: () => void): this;
emit(event: 'file', file: Vinyl, requirements: string[]): boolean;
emit(event: 'build'): boolean;
}
declare class Linker extends EventEmitter {
private options;
private parser;
private buildListeners;
/** Contains the paths to all modules that have been imported. */
private history;
/** The number of files that have been imported but are not emitted yet. */
private queueLength;
/** Contains all paths to all files. */
private paths;
constructor(options: LinkerOptions);
/**
* Parses the file and imports external dependencies.
* The returned promise resolves to an array of Vinyl file objects representing the dependencies.
* All importet files will also be emitted in the "file" event.
* @param origin - The file to parse.
*/
update(origin: Vinyl): Promise;
build(): Promise;
/**
* Adds a listener for the "build" event. Removes the old listener if one exists for the same origin.
* Returns true if an old listener was removed.
* @param origin - The file that will be emitted by the listener.
* @param listener - A function that will be executed when the build event is emitted.
*/
private listenForBuild(origin, listener);
private verifyRequirements(files);
/**
* Returns a vinyl object representing the exported file of the module
* @param fileHandle - An object representing the location of the module.
*/
private import(fileHandle);
/**
* Wraps the contents of the file into a registerModule() function.
* @param requirements - An array of arrays representing the requirements for the file.
* @param file - A vinyl object representing the file.
*/
private wrap(requirements, file);
}
export default Linker;