Adding format option for Dll Plugin to get a formatted manifest json.
This commit is contained in:
parent
4c461e2e1f
commit
71f9230383
|
@ -13,6 +13,10 @@ export interface DllPluginOptions {
|
|||
* If true, only entry points will be exposed
|
||||
*/
|
||||
entryOnly?: boolean;
|
||||
/**
|
||||
* If true, manifest json file(output) will be formatted
|
||||
*/
|
||||
format?: boolean;
|
||||
/**
|
||||
* Name of the exposed dll function (external name, use value of 'output.library')
|
||||
*/
|
||||
|
|
|
@ -20,6 +20,10 @@ class DllPlugin {
|
|||
constructor(options) {
|
||||
validateOptions(schema, options, "Dll Plugin");
|
||||
this.options = options;
|
||||
|
||||
if (!options.format) {
|
||||
this.options.format = false;
|
||||
}
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
|
|
|
@ -67,7 +67,11 @@ class LibManifestPlugin {
|
|||
return obj;
|
||||
}, Object.create(null))
|
||||
};
|
||||
const content = Buffer.from(JSON.stringify(manifest), "utf8");
|
||||
// Apply formatting to content if format flag is true;
|
||||
const manifestContent = this.options.format
|
||||
? JSON.stringify(manifest, null, 2)
|
||||
: JSON.stringify(manifest);
|
||||
const content = Buffer.from(manifestContent, "utf8");
|
||||
compiler.outputFileSystem.mkdirp(path.dirname(targetPath), err => {
|
||||
if (err) return callback(err);
|
||||
compiler.outputFileSystem.writeFile(
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
"description": "If true, only entry points will be exposed",
|
||||
"type": "boolean"
|
||||
},
|
||||
"format": {
|
||||
"description": "If true, manifest json file (output) will be formatted",
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name of the exposed dll function (external name, use value of 'output.library')",
|
||||
"type": "string",
|
||||
|
|
Loading…
Reference in New Issue