This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ var ExtractedModule = require("./ExtractedModule");
99var Chunk = require ( "webpack/lib/Chunk" ) ;
1010var OrderUndefinedError = require ( "./OrderUndefinedError" ) ;
1111var loaderUtils = require ( "loader-utils" ) ;
12+ var schemaTester = require ( './schema/valid' ) ;
1213
1314var NS = fs . realpathSync ( __dirname ) ;
1415
@@ -104,6 +105,7 @@ function getOrder(a, b) {
104105}
105106
106107function ExtractTextPlugin ( options ) {
108+ schemaTester ( options ) ;
107109 if ( arguments . length > 1 ) {
108110 throw new Error ( "Breaking change: ExtractTextPlugin now only takes a single argument. Either an options " +
109111 "object *or* the name of the result file.\n" +
Original file line number Diff line number Diff line change 1212 "webpack-sources" : " ^0.1.0"
1313 },
1414 "devDependencies" : {
15+ "ajv" : " ^4.11.2" ,
1516 "codecov.io" : " ^0.1.2" ,
1617 "coveralls" : " ^2.11.2" ,
1718 "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+ "allChunks" : {
6+ "description" : " " ,
7+ "type" : " boolean"
8+ },
9+ "disable" : {
10+ "description" : " " ,
11+ "type" : " boolean"
12+ },
13+ "fallbackLoader" : {
14+ "description" : " A loader that webpack can fall back to if the original one fails." ,
15+ "type" : " string"
16+ },
17+ "filename" : {
18+ "description" : " The filename and path that ExtractTextPlugin will extract to." ,
19+ "type" : " string"
20+ },
21+ "loader" : {
22+ "description" : " The loader that ExtractTextPlugin will attempt to load through." ,
23+ "type" : " string"
24+ },
25+ "publicPath" : {
26+ "description" : " " ,
27+ "type" : " string"
28+ }
29+ },
30+ "required" : [" loader" ]
31+ }
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+ "allChunks" : { "type" : " boolean" },
3+ "disable" : { "type" : " boolean" },
4+ "fallbackLoader" : { "type" : " string" },
5+ "filename" : { "type" : " string" },
6+ "loader" : { "type" : " string" },
7+ "publicPath" : { "type" : " string" }
8+ }
You can’t perform that action at this time.
0 commit comments