1 | /**
|
2 | * CarteBlanche Webpack Plugin
|
3 | *
|
4 | * The plugin is instantiated and the emitted carte-blanche.html file is
|
5 | * generated here.
|
6 | */
|
7 |
|
8 | import apply from './src/apply';
|
9 | import validateOptions from './src/validateOptions';
|
10 |
|
11 | /**
|
12 | * Instantiates the plugin
|
13 | *
|
14 | * @param {Object} options The options
|
15 | */
|
16 | let id = -1;
|
17 | function CarteBlanche(options) {
|
18 | // Allow for multiple instances of the plugin
|
19 | this.id = (++id);
|
20 | // Default and validate the options
|
21 | validateOptions(options || {});
|
22 | this.options = options;
|
23 | }
|
24 |
|
25 | // This method is the meat of our plugin, it does most of the work
|
26 | CarteBlanche.prototype.apply = apply;
|
27 |
|
28 | module.exports = CarteBlanche;
|