Skip to content

Commit fb4b275

Browse files
committed
Improvement: add schema for profiling plugin options, remove todo item
1 parent 33c907e commit fb4b275

File tree

3 files changed

+16
-89
lines changed

3 files changed

+16
-89
lines changed

lib/debug/ProfilingPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ function createTrace(outPath) {
131131
}
132132

133133
const pluginName = "ProfilingPlugin";
134+
const validateOptions = require("schema-utils");
135+
const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json");
134136

135137
class ProfilingPlugin {
136-
// TODO: Add plugin schema validation here since there are options.
137138
constructor(opts) {
139+
validateOptions(schema, opts || {}, "Profiling plugin");
138140
opts = opts || {};
139141
this.outPath = opts.outPath || "events.json";
140142
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "ProfilingPlugin",
3+
"type": "object",
4+
"additionalProperties": false,
5+
"properties": {
6+
"outPath": {
7+
"description": "Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.",
8+
"type": "string",
9+
"absolutePath": true,
10+
"minLength": 4
11+
}
12+
}
13+
}

schemas/plugins/optimize/CommonsChunkPlugin.json

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)