File tree Expand file tree Collapse file tree 5 files changed +105
-0
lines changed Expand file tree Collapse file tree 5 files changed +105
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ var ExtractedModule = require("./ExtractedModule");
9
9
var Chunk = require ( "webpack/lib/Chunk" ) ;
10
10
var OrderUndefinedError = require ( "./OrderUndefinedError" ) ;
11
11
var loaderUtils = require ( "loader-utils" ) ;
12
+ var schemaTester = require ( './schema/valid' ) ;
12
13
13
14
var NS = fs . realpathSync ( __dirname ) ;
14
15
@@ -104,6 +105,7 @@ function getOrder(a, b) {
104
105
}
105
106
106
107
function ExtractTextPlugin ( options ) {
108
+ schemaTester ( options ) ;
107
109
if ( arguments . length > 1 ) {
108
110
throw new Error ( "Breaking change: ExtractTextPlugin now only takes a single argument. Either an options " +
109
111
"object *or* the name of the result file.\n" +
Original file line number Diff line number Diff line change 12
12
"webpack-sources" : " ^0.1.0"
13
13
},
14
14
"devDependencies" : {
15
+ "ajv" : " ^4.11.2" ,
15
16
"codecov.io" : " ^0.1.2" ,
16
17
"coveralls" : " ^2.11.2" ,
17
18
"css-loader" : " ^0.21.0" ,
Original file line number Diff line number Diff line change
1
+ {
2
+ "$schema" : " http://json-schema.org/draft-04/schema#" ,
3
+ "type" : " object" ,
4
+ "properties" : {
5
+ "fallbackLoader" : {
6
+ "type" : " object" ,
7
+ "properties" : {
8
+ "type" : {
9
+ "type" : " string"
10
+ }
11
+ },
12
+ "required" : [
13
+ " type"
14
+ ]
15
+ },
16
+ "loader" : {
17
+ "type" : " object" ,
18
+ "properties" : {
19
+ "type" : {
20
+ "type" : " string"
21
+ }
22
+ },
23
+ "required" : [
24
+ " type"
25
+ ]
26
+ },
27
+ "publicPath" : {
28
+ "type" : " object" ,
29
+ "properties" : {
30
+ "type" : {
31
+ "type" : " string"
32
+ }
33
+ },
34
+ "required" : [
35
+ " type"
36
+ ]
37
+ },
38
+ "disable" : {
39
+ "type" : " object" ,
40
+ "properties" : {
41
+ "type" : {
42
+ "type" : " string"
43
+ }
44
+ },
45
+ "required" : [
46
+ " type"
47
+ ]
48
+ },
49
+ "allChunks" : {
50
+ "type" : " object" ,
51
+ "properties" : {
52
+ "type" : {
53
+ "type" : " string"
54
+ }
55
+ },
56
+ "required" : [
57
+ " type"
58
+ ]
59
+ },
60
+ "filename" : {
61
+ "type" : " object" ,
62
+ "properties" : {
63
+ "type" : {
64
+ "type" : " string"
65
+ }
66
+ },
67
+ "required" : [
68
+ " type"
69
+ ]
70
+ }
71
+ },
72
+ "required" : [
73
+ " fallbackLoader" ,
74
+ " loader" ,
75
+ " publicPath" ,
76
+ " disable" ,
77
+ " allChunks" ,
78
+ " filename"
79
+ ]
80
+ }
Original file line number Diff line number Diff line change
1
+ var Ajv = require ( 'ajv' ) ;
2
+ var ajv = new Ajv ( { allErrors : true } ) ;
3
+ var json = require ( './schema.json' ) ;
4
+
5
+ module . exports = function validate ( data ) {
6
+ var validSchema = ajv . compile ( json ) ;
7
+ var valid = validSchema ( data ) ;
8
+
9
+ if ( ! valid ) {
10
+ throw new Error ( "Your ExtractTextPlugin config is not correct. Please double check." ) ;
11
+ } else {
12
+ console . log ( 'your stuff works' ) ;
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "fallbackLoader" : { "type" : " string" },
3
+ "loader" : { "type" : " string" },
4
+ "publicPath" : { "type" : " string" },
5
+ "disable" : { "type" : " boolean" },
6
+ "allChunks" : { "type" : " boolean" },
7
+ "filename" : { "type" : " string" }
8
+ }
You can’t perform that action at this time.
0 commit comments