Initializes a new instance of the FileWorker class, using the given options to configure its mergeContext
Options object used to configure this worker's context.
Initializes a new instance of the FileWorker class, using the given context object.
Context object to be used throughout merging operations.
Gets the declaration (d.ts) file array to be merged.
Gets the number of files currently in the work queue.
Gets the javascript (.js) file array to be merged.
Gets the timer object that keeps track of the time spent while working.
Gets an array with the files that were not saved during write because their name and/or path were not specified.
Adds a declaration (d.ts) file to the file worker object.
Path to file or file object to be added.
Adds a single file to the worker object.
String with the path to the file to be added.
Adds multiple files to the worker object.
One or more strings with the paths to be added.
Adds all files that matches the given glob patterns.
A function callback to be used when the files matching the pattern are finished being added; this function may accept a parameter with the list of files added.
One or more string with glob patterns containing files to be added.
Adds all files that matches the given glob patterns, synchronously.
One or more string with glob patterns containing files to be added.
An array with the files added to the work queue.
Adds a javascript (.js) file to the file worker object.
Path to file or file object to be added.
Performs the processing of all the files in the file worker queue, and retrieves the resulting files through the asynchronous callback.
A function to be called once the work is done.
Performs the processing of all the files in the file worker queue, and retrieves the resulting files synchronously.
Generated using TypeDoc
Represents worker objects that are able to control merging processors for multiple files, scripts and declarations alike.
Using this object is probably the best way to work with multiple file mergings while avoiding clogging Node's heap due to the heavy nature of this plugin.
Sync:
var tsmerge = require("ts-merge"); var worker = new tsmerge.FileWorker({ outDir: "dist/postbuild" }); worker.addFiles("myfile.d.ts", "myfile2.js", "myfile3.js") worker.workSync(); worker.write();
Async:
var tsmerge = require("ts-merge"); var worker = new tsmerge.FileWorker({ outDir: "dist/postbuild" }); worker.addFiles("myfile.d.ts", "myfile2.js", "myfile3.js") worker.work(function(files) { for (var i = 0; i < files.length; i++) { console.log(files[i].name); } // Output: // myfile.merged.d.ts // myfile2.merged.js // myfile3.merged.js worker.write(); })