-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.js
605 lines (538 loc) · 22.8 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
'use strict';
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
const assert = require('assert');
const minimatch = require('minimatch');
const glob = require('glob');
const slash = require('slash'); // fixes slashes in file paths for windows
const PLUGIN_NAME = 'HtmlWebpackTagsPlugin';
const IS = {
isDefined: v => v !== undefined,
isObject: v => v !== null && v !== undefined && typeof v === 'object' && !Array.isArray(v),
isBoolean: v => v === true || v === false,
isNumber: v => v !== undefined && (typeof v === 'number' || v instanceof Number) && isFinite(v),
isString: v => v !== null && v !== undefined && (typeof v === 'string' || v instanceof String),
isArray: v => Array.isArray(v),
isFunction: v => typeof v === 'function'
};
const { isDefined, isObject, isBoolean, isNumber, isString, isArray, isFunction } = IS;
const DEFAULT_OPTIONS = {
append: true,
prependExternals: true,
useHash: false,
addHash: (assetPath, hash) => assetPath + '?' + hash,
usePublicPath: true,
addPublicPath: (assetPath, publicPath) => (publicPath !== '' && !publicPath.endsWith('/') && !assetPath.startsWith('/')) ? publicPath + '/' + assetPath : publicPath + assetPath,
jsExtensions: ['.js'],
cssExtensions: ['.css'],
tags: [],
links: [],
scripts: []
};
const ASSET_TYPE_CSS = 'css';
const ASSET_TYPE_JS = 'js';
const ASSET_TYPES = [ASSET_TYPE_CSS, ASSET_TYPE_JS];
const ATTRIBUTES_TEXT = 'strings, booleans or numbers';
const isValidAttributeValue = v => isString(v) || isBoolean(v) || isNumber(v);
const isType = type => ASSET_TYPES.indexOf(type) !== -1;
const isTypeCss = type => type === ASSET_TYPE_CSS;
const isFunctionReturningString = v => isFunction(v) && isString(v('', ''));
const isArrayOfString = v => isArray(v) && v.every(i => isString(i));
const createExtensionsRegex = extensions => new RegExp(`.*(${extensions.join('|')})$`);
const getExtensions = (options, optionExtensionName, optionPath) => {
let extensions = DEFAULT_OPTIONS[optionExtensionName];
if (isDefined(options[optionExtensionName])) {
if (isString(options[optionExtensionName])) {
extensions = [options[optionExtensionName]];
} else {
extensions = options[optionExtensionName];
assert(isArray(extensions), `${optionPath}.${optionExtensionName} should be a string or array of strings (${extensions})`);
extensions.forEach(function (extension) {
assert(isString(extension), `${optionPath}.${optionExtensionName} array should only contain strings (${extension})`);
});
}
}
return extensions;
};
const getHasExtensions = (options, optionExtensionName, optionPath) => {
const regexp = createExtensionsRegex(getExtensions(options, optionExtensionName, optionPath));
return value => regexp.test(value);
};
const getAssetTypeCheckers = (options, optionPath) => {
const hasJsExtensions = getHasExtensions(options, 'jsExtensions', optionPath);
const hasCssExtensions = getHasExtensions(options, 'cssExtensions', optionPath);
return {
isAssetTypeCss (value) {
return hasCssExtensions(value);
},
isAssetTypeJs (value) {
return hasJsExtensions(value);
}
};
};
const splitLinkScriptTags = (tagObjects, options, optionName, optionPath) => {
const linkObjects = [];
const scriptObjects = [];
const { isAssetTypeCss, isAssetTypeJs } = getAssetTypeCheckers(options, optionPath);
tagObjects.forEach(tagObject => {
if (isDefined(tagObject.type)) {
const { type, ...others } = tagObject;
assert(isType(type), `${optionPath}.${optionName} type must be css or js (${type})`);
(isTypeCss(type) ? linkObjects : scriptObjects).push({
...others
});
} else {
const { path } = tagObject;
if (isAssetTypeCss(path)) {
linkObjects.push(tagObject);
} else if (isAssetTypeJs(path)) {
scriptObjects.push(tagObject);
} else {
assert(false, `${optionPath}.${optionName} could not determine asset type for (${path})`);
}
}
});
return [linkObjects, scriptObjects];
};
const getTagObjects = (tag, optionName, optionPath, isMetaTag = false) => {
let tagObjects;
if (isMetaTag) {
assert(isObject(tag), `${optionPath}.${optionName} items must be an object`);
} else {
assert(isString(tag) || isObject(tag), `${optionPath}.${optionName} items must be an object or string`);
}
if (!isMetaTag && isString(tag)) {
tagObjects = [{
path: tag
}];
} else {
if (isMetaTag) {
if (isDefined(tag.path)) {
assert(isString(tag.path), `${optionPath}.${optionName} object should have a string path property`);
}
} else {
assert(isString(tag.path), `${optionPath}.${optionName} object must have a string path property`);
}
if (isDefined(tag.sourcePath)) {
assert(isString(tag.sourcePath), `${optionPath}.${optionName} object should have a string sourcePath property`);
}
if (isMetaTag) {
assert(isDefined(tag.attributes), `${optionPath}.${optionName} object must have an object attributes property`);
assert(Object.keys(tag.attributes).length > 0, `${optionPath}.${optionName} object must have a non empty object attributes property`);
}
if (isDefined(tag.attributes)) {
const { attributes } = tag;
assert(isObject(attributes), `${optionPath}.${optionName} object should have an object attributes property`);
Object.keys(attributes).forEach(attribute => {
const value = attributes[attribute];
assert(isValidAttributeValue(value), `${optionPath}.${optionName} object attribute values should be ` + ATTRIBUTES_TEXT);
});
}
tag = getValidatedMainOptions(tag, `${optionPath}.${optionName}`, {});
if (isDefined(tag.glob) || isDefined(tag.globPath) || isDefined(tag.globFlatten)) {
if (isMetaTag) {
assert(isDefined(tag.path), `${optionPath}.${optionName} object must have a path property when glob is used`);
}
const { glob: assetGlob, globPath, globFlatten, ...otherAssetProperties } = tag;
assert(isString(assetGlob), `${optionPath}.${optionName} object should have a string glob property`);
assert(isString(globPath), `${optionPath}.${optionName} object should have a string globPath property`);
if (isDefined(globFlatten)) {
assert(isBoolean(globFlatten), `${optionPath}.${optionName} object should have a boolean globFlatten property`);
}
const flatten = isDefined(globFlatten) ? globFlatten : false;
const globAssets = glob.sync(assetGlob, { cwd: globPath });
const globAssetPaths = globAssets.map(globAsset => slash(path.join(tag.path, flatten ? path.basename(globAsset) : globAsset)));
assert(globAssetPaths.length > 0, `${optionPath}.${optionName} object glob found no files (${tag.path} ${assetGlob} ${globPath})`);
tagObjects = [];
globAssetPaths.forEach(globAssetPath => {
tagObjects.push({
...otherAssetProperties,
path: globAssetPath
});
});
} else {
tagObjects = [tag];
}
}
return tagObjects;
};
const getValidatedTagObjects = (options, optionName, optionPath) => {
let tagObjects;
if (isDefined(options[optionName])) {
const tags = options[optionName];
assert(isString(tags) || isObject(tags) || isArray(tags), `${optionPath}.${optionName} should be a string, object, or array (${tags})`);
if (isArray(tags)) {
tagObjects = [];
tags.forEach(asset => {
tagObjects = tagObjects.concat(getTagObjects(asset, optionName, optionPath));
});
} else {
tagObjects = getTagObjects(tags, optionName, optionPath);
}
}
return tagObjects;
};
const getValidatedMetaObjects = (options, optionName, optionPath) => {
let metaObjects;
if (isDefined(options[optionName])) {
const tags = options[optionName];
assert(isObject(tags) || isArray(tags), `${optionPath}.${optionName} should be an object or array (${tags})`);
if (isArray(tags)) {
metaObjects = [];
tags.forEach(asset => {
metaObjects = metaObjects.concat(getTagObjects(asset, optionName, optionPath, true));
});
} else {
metaObjects = getTagObjects(tags, optionName, optionPath, true);
}
}
return metaObjects;
};
const getValidatedTagObjectExternals = (tagObjects, isScript, optionName, optionPath) => {
return tagObjects.map(tagObject => {
if (isObject(tagObject) && isDefined(tagObject.external)) {
const { external } = tagObject;
if (isScript) {
assert(isObject(external), `${optionPath}.${optionName}.external should be an object`);
const { packageName, variableName } = external;
assert(isString(packageName) || isString(variableName), `${optionPath}.${optionName}.external should have a string packageName and variableName property`);
assert(isString(packageName), `${optionPath}.${optionName}.external should have a string packageName property`);
assert(isString(variableName), `${optionPath}.${optionName}.external should have a string variableName property`);
} else {
assert(false, `${optionPath}.${optionName}.external should not be used on non script tags`);
}
}
return tagObject;
});
};
const getShouldSkip = files => {
let shouldSkip = () => false;
if (isDefined(files)) {
shouldSkip = htmlPluginData => !files.some(function (file) {
return minimatch(htmlPluginData.outputName, file);
});
}
return shouldSkip;
};
const processShortcuts = (options, optionPath, keyShortcut, keyUse, keyAdd, add) => {
const processedOptions = {};
if (isDefined(options[keyUse]) || isDefined(options[keyAdd])) {
assert(!isDefined(options[keyShortcut]), `${optionPath}.${keyShortcut} should not be used with either ${keyUse} or ${keyAdd}`);
if (isDefined(options[keyUse])) {
assert(isBoolean(options[keyUse]), `${optionPath}.${keyUse} should be a boolean`);
processedOptions[keyUse] = options[keyUse];
}
if (isDefined(options[keyAdd])) {
assert(isFunctionReturningString(options[keyAdd]), `${optionPath}.${keyAdd} should be a function that returns a string`);
processedOptions[keyAdd] = options[keyAdd];
}
} else if (isDefined(options[keyShortcut])) {
const shortcut = options[keyShortcut];
assert(isBoolean(shortcut) || isString(shortcut) || isFunctionReturningString(shortcut),
`${optionPath}.${keyShortcut} should be a boolean or a string or a function that returns a string`);
if (isBoolean(shortcut)) {
processedOptions[keyUse] = shortcut;
} else if (isString(shortcut)) {
processedOptions[keyUse] = true;
processedOptions[keyAdd] = path => add(path, shortcut);
} else {
processedOptions[keyUse] = true;
processedOptions[keyAdd] = shortcut;
}
}
return processedOptions;
};
const getValidatedMainOptions = (options, optionPath, defaultOptions = {}) => {
const { append, prependExternals, publicPath, usePublicPath, addPublicPath, hash, useHash, addHash, ...otherOptions } = options;
const validatedOptions = { ...defaultOptions, ...otherOptions };
if (isDefined(append)) {
assert(isBoolean(append), `${optionPath}.append should be a boolean`);
validatedOptions.append = append;
}
if (isDefined(prependExternals)) {
assert(isBoolean(prependExternals), `${optionPath}.prependExternals should be a boolean`);
validatedOptions.prependExternals = prependExternals;
}
const publicPathOptions = processShortcuts(options, optionPath, 'publicPath', 'usePublicPath', 'addPublicPath', DEFAULT_OPTIONS.addPublicPath);
if (isDefined(publicPathOptions.usePublicPath)) {
validatedOptions.usePublicPath = publicPathOptions.usePublicPath;
}
if (isDefined(publicPathOptions.addPublicPath)) {
validatedOptions.addPublicPath = publicPathOptions.addPublicPath;
}
const hashOptions = processShortcuts(options, optionPath, 'hash', 'useHash', 'addHash', DEFAULT_OPTIONS.addHash);
if (isDefined(hashOptions.useHash)) {
validatedOptions.useHash = hashOptions.useHash;
}
if (isDefined(hashOptions.addHash)) {
validatedOptions.addHash = hashOptions.addHash;
}
return validatedOptions;
};
const getValidatedOptions = (options, optionPath, defaultOptions = DEFAULT_OPTIONS) => {
assert(isObject(options), `${optionPath} should be an object`);
let validatedOptions = { ...defaultOptions };
validatedOptions = {
...validatedOptions,
...getValidatedMainOptions(options, optionPath, defaultOptions)
};
const { append: globalAppend, prependExternals } = validatedOptions;
const getAppend = prependExternals ? external => (isDefined(external) ? false : globalAppend) : () => globalAppend;
const isTagPrepend = ({ append, external }) => isDefined(append) ? !append : !getAppend(external);
const isTagAppend = ({ append, external }) => isDefined(append) ? append : getAppend(external);
const hasTags = isDefined(options.tags);
if (hasTags) {
const tagObjects = getValidatedTagObjects(options, 'tags', optionPath);
let [linkObjects, scriptObjects] = splitLinkScriptTags(tagObjects, options, 'tags', optionPath);
linkObjects = getValidatedTagObjectExternals(linkObjects, false, 'tags', optionPath);
scriptObjects = getValidatedTagObjectExternals(scriptObjects, true, 'tags', optionPath);
validatedOptions.links = linkObjects;
validatedOptions.scripts = scriptObjects;
}
if (isDefined(options.links)) {
let linkObjects = getValidatedTagObjects(options, 'links', optionPath);
linkObjects = getValidatedTagObjectExternals(linkObjects, false, 'links', optionPath);
validatedOptions.links = hasTags ? validatedOptions.links.concat(linkObjects) : linkObjects;
}
if (isDefined(options.scripts)) {
let scriptObjects = getValidatedTagObjects(options, 'scripts', optionPath);
scriptObjects = getValidatedTagObjectExternals(scriptObjects, true, 'scripts', optionPath);
validatedOptions.scripts = hasTags ? validatedOptions.scripts.concat(scriptObjects) : scriptObjects;
}
if (isDefined(validatedOptions.links)) {
validatedOptions.linksPrepend = validatedOptions.links.filter(isTagPrepend);
validatedOptions.linksAppend = validatedOptions.links.filter(isTagAppend);
}
if (isDefined(validatedOptions.scripts)) {
validatedOptions.scriptsPrepend = validatedOptions.scripts.filter(isTagPrepend);
validatedOptions.scriptsAppend = validatedOptions.scripts.filter(isTagAppend);
}
if (isDefined(options.metas)) {
let metaObjects = getValidatedMetaObjects(options, 'metas', optionPath);
metaObjects = getValidatedTagObjectExternals(metaObjects, false, 'metas', optionPath);
validatedOptions.metas = metaObjects;
}
return validatedOptions;
};
const getTagPath = (tagObject, options, webpackPublicPath, compilationHash) => {
const mergedOptions = { ...options };
Object.keys(tagObject).filter(key => isDefined(tagObject[key])).forEach(key => {
mergedOptions[key] = tagObject[key];
});
const { usePublicPath, addPublicPath, useHash, addHash } = mergedOptions;
let { path } = tagObject;
if (usePublicPath) {
path = addPublicPath(path, webpackPublicPath);
}
if (useHash) {
path = addHash(path, compilationHash);
}
return slash(path);
};
const getAllValidatedOptions = (options, optionPath) => {
const validatedOptions = getValidatedOptions(options, optionPath);
let { files } = options;
if (isDefined(files)) {
assert((isString(files) || isArrayOfString(files)), `${optionPath}.files should be a string or array of strings`);
if (isString(files)) {
files = [files];
}
return {
...validatedOptions,
files
};
}
return validatedOptions;
};
function HtmlWebpackTagsPlugin (options) {
const validatedOptions = getAllValidatedOptions(options, PLUGIN_NAME + '.options');
const shouldSkip = getShouldSkip(validatedOptions.files);
// Allows tests to be run with html-webpack-plugin v4
const htmlPluginName = isDefined(options.htmlPluginName) ? options.htmlPluginName : 'html-webpack-plugin';
this.options = {
...validatedOptions,
shouldSkip,
htmlPluginName
};
}
HtmlWebpackTagsPlugin.prototype.apply = function (compiler) {
const { options } = this;
const { shouldSkip, htmlPluginName } = options;
const { scripts, scriptsPrepend, scriptsAppend, linksPrepend, linksAppend, metas } = options;
const externals = compiler.options.externals || {};
scripts.forEach(script => {
const { external } = script;
if (isObject(external)) {
externals[external.packageName] = external.variableName;
}
});
compiler.options.externals = externals;
let savedAssetsPublicPath = null;
// Hook into the html-webpack-plugin processing
const onCompilation = compilation => {
const onBeforeHtmlGeneration = (htmlPluginData, callback) => {
if (shouldSkip(htmlPluginData)) {
if (callback) {
return callback(null, htmlPluginData);
} else {
return Promise.resolve(htmlPluginData);
}
}
const { assets } = htmlPluginData;
const pluginPublicPath = savedAssetsPublicPath = assets.publicPath;
const compilationHash = compilation.hash;
const assetPromises = [];
const addAsset = assetPath => {
try {
if (htmlPluginData.plugin && htmlPluginData.plugin.addFileToAssets) {
return htmlPluginData.plugin.addFileToAssets(assetPath, compilation);
} else {
assetPath = path.resolve(compilation.compiler.context, assetPath);
return Promise.all([
new Promise((resolve, reject) => {
fs.stat(assetPath, (err, stats) => {
if (err) {
reject(err);
} else {
resolve(stats);
}
});
}),
new Promise((resolve, reject) => {
fs.readFile(assetPath, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
})
]).then(([stat, source]) => {
const { size } = stat;
const basename = path.basename(assetPath);
source = new webpack.sources.RawSource(source, true);
compilation.fileDependencies.add(assetPath);
compilation.emitAsset(basename, source, { size });
});
}
} catch (err) {
return Promise.reject(err);
}
};
const getPath = tag => {
if (isString(tag.sourcePath)) {
assetPromises.push(addAsset(tag.sourcePath));
}
return getTagPath(tag, options, pluginPublicPath, compilationHash);
};
const jsPrependPaths = scriptsPrepend.map(getPath);
const jsAppendPaths = scriptsAppend.map(getPath);
const cssPrependPaths = linksPrepend.map(getPath);
const cssAppendPaths = linksAppend.map(getPath);
assets.js = jsPrependPaths.concat(assets.js).concat(jsAppendPaths);
assets.css = cssPrependPaths.concat(assets.css).concat(cssAppendPaths);
if (metas) {
metas.forEach(tag => {
if (isString(tag.sourcePath)) {
assetPromises.push(addAsset(tag.sourcePath));
}
});
}
Promise.all(assetPromises).then(
() => {
if (callback) {
callback(null, htmlPluginData);
} else {
return Promise.resolve(htmlPluginData);
}
},
(err) => {
if (callback) {
callback(err);
} else {
return Promise.reject(err);
}
}
);
};
const onAlterAssetTagGroups = (htmlPluginData, callback) => {
if (shouldSkip(htmlPluginData)) {
if (callback) {
return callback(null, htmlPluginData);
} else {
return Promise.resolve(htmlPluginData);
}
}
const pluginHead = htmlPluginData.head ? htmlPluginData.head : htmlPluginData.headTags;
const pluginBody = htmlPluginData.body ? htmlPluginData.body : htmlPluginData.bodyTags;
if (metas) {
const pluginPublicPath = savedAssetsPublicPath;
const compilationHash = compilation.hash;
const getMeta = tag => {
if (isDefined(tag.path)) {
return {
tagName: 'meta',
attributes: {
content: getTagPath(tag, options, pluginPublicPath, compilationHash),
...tag.attributes
}
};
} else {
return {
tagName: 'meta',
attributes: tag.attributes
};
}
};
pluginHead.push(...metas.map(getMeta));
}
const injectOption = htmlPluginData.plugin.options.inject;
const sourceScripts = injectOption === 'body' ? pluginBody : pluginHead;
const pluginLinks = pluginHead.filter(({ tagName }) => tagName === 'link');
const pluginScripts = sourceScripts.filter(({ tagName }) => tagName === 'script');
const headPrepend = pluginLinks.slice(0, linksPrepend.length);
const headAppend = pluginLinks.slice(pluginLinks.length - linksAppend.length);
const bodyPrepend = pluginScripts.slice(0, scriptsPrepend.length);
const bodyAppend = pluginScripts.slice(pluginScripts.length - scriptsAppend.length);
const copyAttributes = (tags, tagObjects) => {
tags.forEach((tag, i) => {
const { attributes } = tagObjects[i];
if (attributes) {
const { attributes: tagAttributes } = tag;
Object.keys(attributes).forEach(attribute => {
tagAttributes[attribute] = attributes[attribute];
});
}
});
};
copyAttributes(headPrepend.concat(headAppend), linksPrepend.concat(linksAppend));
copyAttributes(bodyPrepend.concat(bodyAppend), scriptsPrepend.concat(scriptsAppend));
if (callback) {
callback(null, htmlPluginData);
} else {
return Promise.resolve(htmlPluginData);
}
};
const HtmlWebpackPlugin = require(htmlPluginName);
if (HtmlWebpackPlugin.getHooks) {
const hooks = HtmlWebpackPlugin.getHooks(compilation);
const htmlPlugins = compilation.options.plugins.filter(plugin => plugin instanceof HtmlWebpackPlugin);
if (htmlPlugins.length === 0) {
const message = "Error running html-webpack-tags-plugin, are you sure you have html-webpack-plugin before it in your webpack config's plugins?";
throw new Error(message);
}
hooks.beforeAssetTagGeneration.tapAsync('htmlWebpackTagsPlugin', onBeforeHtmlGeneration);
hooks.alterAssetTagGroups.tapAsync('htmlWebpackTagsPlugin', onAlterAssetTagGroups);
} else {
const message = "Error running html-webpack-tags-plugin, are you sure you have html-webpack-plugin before it in your webpack config's plugins?";
throw new Error(message);
}
};
compiler.hooks.compilation.tap('htmlWebpackTagsPlugin', onCompilation);
};
HtmlWebpackTagsPlugin.api = {
IS,
getValidatedOptions
};
module.exports = HtmlWebpackTagsPlugin;