customizr 2.0.0 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/testing.yml +29 -0
- package/LICENSE +21 -21
- package/README.md +258 -259
- package/bin/customizr +71 -71
- package/build/modernizr-custom.js +6 -6
- package/build/modernizr-exclude.js +438 -73
- package/build/modernizr-package.js +6 -6
- package/build/modernizr-prefixed.js +9 -10
- package/build/modernizr-select.js +11 -12
- package/cache/options.json +14 -1
- package/package.json +62 -60
- package/src/builder.js +118 -118
- package/src/crawler.js +298 -298
- package/src/index.js +64 -64
- package/src/metadata.js +33 -33
- package/src/settings.json +34 -34
- package/src/utils.js +226 -226
- package/test/css/should-ignore.scss +9 -9
- package/test/css/vanilla.css +174 -161
- package/test/js/amd.js +23 -3
- package/test/js/vanilla.js +23 -3
- package/test/pretest.js +133 -133
- package/test/runner.js +17 -17
- package/test/settings/cache-invalidate.json +9 -9
- package/test/settings/custom.json +8 -8
- package/test/settings/exclude.json +14 -14
- package/test/settings/prefixed.json +10 -10
- package/test/settings/select.json +15 -15
- package/test/tests.js +415 -415
package/src/index.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
module.exports = function (settings, callback) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
// Dependencies
|
|
5
|
-
var fs = require("fs"),
|
|
6
|
-
path = require("path");
|
|
7
|
-
|
|
8
|
-
// Deferreds
|
|
9
|
-
var promise = require("promised-io/promise");
|
|
10
|
-
|
|
11
|
-
// Modernizr
|
|
12
|
-
var modernizrPath = path.join(__dirname, "..", "node_modules", "modernizr");
|
|
13
|
-
|
|
14
|
-
var Customizr = function () {
|
|
15
|
-
return this.init();
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Customizr.prototype = {
|
|
19
|
-
init : function () {
|
|
20
|
-
|
|
21
|
-
// Store settings
|
|
22
|
-
this.utils.storeSettings(settings);
|
|
23
|
-
|
|
24
|
-
// Sequentially return promises
|
|
25
|
-
promise.seq([
|
|
26
|
-
|
|
27
|
-
// Use Modernizr to fetch metadata from each feature detect
|
|
28
|
-
this.metadata.init.bind(this),
|
|
29
|
-
|
|
30
|
-
// Look in the current project for references to tests
|
|
31
|
-
this.crawler.init.bind(this),
|
|
32
|
-
|
|
33
|
-
// Construct a list with matching positives, tell Modernizr to build a custom suite
|
|
34
|
-
this.builder.init.bind(this),
|
|
35
|
-
|
|
36
|
-
// Send done callback
|
|
37
|
-
this.finalize.bind(this)
|
|
38
|
-
|
|
39
|
-
]);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
finalize : function (obj) {
|
|
43
|
-
// Store the current options.
|
|
44
|
-
// If a subsequent build matches the options,
|
|
45
|
-
// we can assume the cached version will do fine.
|
|
46
|
-
this.utils.saveOptions(obj.options);
|
|
47
|
-
|
|
48
|
-
// All done.
|
|
49
|
-
return (callback || function () {})(obj);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Import modules
|
|
54
|
-
fs.readdirSync(__dirname).filter(function (file) {
|
|
55
|
-
return path.extname(file) === ".js";
|
|
56
|
-
}).filter(function (file) {
|
|
57
|
-
return file !== path.basename(__filename);
|
|
58
|
-
}).forEach(function (file) {
|
|
59
|
-
var _import = path.basename(file, ".js");
|
|
60
|
-
Customizr.prototype[_import] = require(path.join(__dirname, _import))(modernizrPath);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return new Customizr();
|
|
64
|
-
};
|
|
1
|
+
module.exports = function (settings, callback) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Dependencies
|
|
5
|
+
var fs = require("fs"),
|
|
6
|
+
path = require("path");
|
|
7
|
+
|
|
8
|
+
// Deferreds
|
|
9
|
+
var promise = require("promised-io/promise");
|
|
10
|
+
|
|
11
|
+
// Modernizr
|
|
12
|
+
var modernizrPath = path.join(__dirname, "..", "node_modules", "modernizr");
|
|
13
|
+
|
|
14
|
+
var Customizr = function () {
|
|
15
|
+
return this.init();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Customizr.prototype = {
|
|
19
|
+
init : function () {
|
|
20
|
+
|
|
21
|
+
// Store settings
|
|
22
|
+
this.utils.storeSettings(settings);
|
|
23
|
+
|
|
24
|
+
// Sequentially return promises
|
|
25
|
+
promise.seq([
|
|
26
|
+
|
|
27
|
+
// Use Modernizr to fetch metadata from each feature detect
|
|
28
|
+
this.metadata.init.bind(this),
|
|
29
|
+
|
|
30
|
+
// Look in the current project for references to tests
|
|
31
|
+
this.crawler.init.bind(this),
|
|
32
|
+
|
|
33
|
+
// Construct a list with matching positives, tell Modernizr to build a custom suite
|
|
34
|
+
this.builder.init.bind(this),
|
|
35
|
+
|
|
36
|
+
// Send done callback
|
|
37
|
+
this.finalize.bind(this)
|
|
38
|
+
|
|
39
|
+
]);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
finalize : function (obj) {
|
|
43
|
+
// Store the current options.
|
|
44
|
+
// If a subsequent build matches the options,
|
|
45
|
+
// we can assume the cached version will do fine.
|
|
46
|
+
this.utils.saveOptions(obj.options);
|
|
47
|
+
|
|
48
|
+
// All done.
|
|
49
|
+
return (callback || function () {})(obj);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Import modules
|
|
54
|
+
fs.readdirSync(__dirname).filter(function (file) {
|
|
55
|
+
return path.extname(file) === ".js";
|
|
56
|
+
}).filter(function (file) {
|
|
57
|
+
return file !== path.basename(__filename);
|
|
58
|
+
}).forEach(function (file) {
|
|
59
|
+
var _import = path.basename(file, ".js");
|
|
60
|
+
Customizr.prototype[_import] = require(path.join(__dirname, _import))(modernizrPath);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return new Customizr();
|
|
64
|
+
};
|
package/src/metadata.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
module.exports = function (modernizrPath) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
// Deferreds
|
|
5
|
-
var promise = require("promised-io/promise");
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
init : function () {
|
|
9
|
-
var deferred = new promise.Deferred();
|
|
10
|
-
var modernizr = require("modernizr");
|
|
11
|
-
|
|
12
|
-
modernizr.metadata(function (metadata) {
|
|
13
|
-
var modRegExp = new RegExp(modernizrPath + "/?");
|
|
14
|
-
|
|
15
|
-
var mappings = metadata.map(function (map) {
|
|
16
|
-
var cleanname = map.name.replace(modRegExp, ""),
|
|
17
|
-
testpath = map.amdPath.replace(modRegExp, "").replace("feature-detects", "test");
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
"path": testpath.replace(".js", ""),
|
|
21
|
-
"name": cleanname,
|
|
22
|
-
"property": map.property,
|
|
23
|
-
"cssclass": map.cssclass
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return deferred.resolve(mappings);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return deferred.promise;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
};
|
|
1
|
+
module.exports = function (modernizrPath) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Deferreds
|
|
5
|
+
var promise = require("promised-io/promise");
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
init : function () {
|
|
9
|
+
var deferred = new promise.Deferred();
|
|
10
|
+
var modernizr = require("modernizr");
|
|
11
|
+
|
|
12
|
+
modernizr.metadata(function (metadata) {
|
|
13
|
+
var modRegExp = new RegExp(modernizrPath + "/?");
|
|
14
|
+
|
|
15
|
+
var mappings = metadata.map(function (map) {
|
|
16
|
+
var cleanname = map.name.replace(modRegExp, ""),
|
|
17
|
+
testpath = map.amdPath.replace(modRegExp, "").replace("feature-detects", "test");
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
"path": testpath.replace(".js", ""),
|
|
21
|
+
"name": cleanname,
|
|
22
|
+
"property": map.property,
|
|
23
|
+
"cssclass": map.cssclass
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return deferred.resolve(mappings);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return deferred.promise;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
package/src/settings.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"defaults": {
|
|
3
|
-
"cache" : true,
|
|
4
|
-
"devFile" : false,
|
|
5
|
-
"dest" : false,
|
|
6
|
-
"options" : [
|
|
7
|
-
"setClasses",
|
|
8
|
-
"addTest",
|
|
9
|
-
"html5printshiv",
|
|
10
|
-
"testProp"
|
|
11
|
-
],
|
|
12
|
-
"quiet": false,
|
|
13
|
-
"uglify" : true,
|
|
14
|
-
"tests" : [],
|
|
15
|
-
"excludeTests": [],
|
|
16
|
-
"crawl" : true,
|
|
17
|
-
"useBuffers": false,
|
|
18
|
-
"files" : {
|
|
19
|
-
"src": [
|
|
20
|
-
"*[^(g|G)runt(file)?].{js,css,scss}",
|
|
21
|
-
"**[^node_modules]/**/*.{js,css,scss}",
|
|
22
|
-
"!lib/**/*"
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
"customTests" : [],
|
|
26
|
-
"classPrefix" : ""
|
|
27
|
-
},
|
|
28
|
-
"private": {
|
|
29
|
-
"url" : {
|
|
30
|
-
"github" : "https://github.com/Modernizr/grunt-modernizr",
|
|
31
|
-
"domain" : "http://modernizr.com"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"defaults": {
|
|
3
|
+
"cache" : true,
|
|
4
|
+
"devFile" : false,
|
|
5
|
+
"dest" : false,
|
|
6
|
+
"options" : [
|
|
7
|
+
"setClasses",
|
|
8
|
+
"addTest",
|
|
9
|
+
"html5printshiv",
|
|
10
|
+
"testProp"
|
|
11
|
+
],
|
|
12
|
+
"quiet": false,
|
|
13
|
+
"uglify" : true,
|
|
14
|
+
"tests" : [],
|
|
15
|
+
"excludeTests": [],
|
|
16
|
+
"crawl" : true,
|
|
17
|
+
"useBuffers": false,
|
|
18
|
+
"files" : {
|
|
19
|
+
"src": [
|
|
20
|
+
"*[^(g|G)runt(file)?].{js,css,scss}",
|
|
21
|
+
"**[^node_modules]/**/*.{js,css,scss}",
|
|
22
|
+
"!lib/**/*"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"customTests" : [],
|
|
26
|
+
"classPrefix" : ""
|
|
27
|
+
},
|
|
28
|
+
"private": {
|
|
29
|
+
"url" : {
|
|
30
|
+
"github" : "https://github.com/Modernizr/grunt-modernizr",
|
|
31
|
+
"domain" : "http://modernizr.com"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|