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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* modernizr v3.
|
|
2
|
+
* modernizr v3.12.0
|
|
3
3
|
* Build https://modernizr.com/download?-cors-input-smil-addtest-printshiv-setclasses-testprop-dontmin-cssclassprefix:prefixed-
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c)
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
* @access public
|
|
36
36
|
*/
|
|
37
37
|
var ModernizrProto = {
|
|
38
|
-
|
|
39
|
-
_version: '3.10.0',
|
|
38
|
+
_version: '3.12.0',
|
|
40
39
|
|
|
41
40
|
// Any settings that don't work as separate modules
|
|
42
41
|
// can go in here as configuration.
|
|
@@ -1157,7 +1156,7 @@
|
|
|
1157
1156
|
|
|
1158
1157
|
ret = callback(div, rule);
|
|
1159
1158
|
// If this is done after page load we don't want to remove the body so check if body exists
|
|
1160
|
-
if (body.fake) {
|
|
1159
|
+
if (body.fake && body.parentNode) {
|
|
1161
1160
|
body.parentNode.removeChild(body);
|
|
1162
1161
|
docElement.style.overflow = docOverflow;
|
|
1163
1162
|
// Trigger layout so kinetic scrolling isn't disabled in iOS6+
|
|
@@ -1173,13 +1172,13 @@
|
|
|
1173
1172
|
;
|
|
1174
1173
|
|
|
1175
1174
|
/**
|
|
1176
|
-
* domToCSS takes a camelCase string and converts it to
|
|
1175
|
+
* domToCSS takes a camelCase string and converts it to hyphen-case
|
|
1177
1176
|
* e.g. boxSizing -> box-sizing
|
|
1178
1177
|
*
|
|
1179
1178
|
* @access private
|
|
1180
1179
|
* @function domToCSS
|
|
1181
1180
|
* @param {string} name - String name of camelCase prop we want to convert
|
|
1182
|
-
* @returns {string} The
|
|
1181
|
+
* @returns {string} The hyphen-case version of the supplied name
|
|
1183
1182
|
*/
|
|
1184
1183
|
function domToCSS(name) {
|
|
1185
1184
|
return name.replace(/([A-Z])/g, function(str, m1) {
|
|
@@ -1268,12 +1267,12 @@
|
|
|
1268
1267
|
;
|
|
1269
1268
|
|
|
1270
1269
|
/**
|
|
1271
|
-
* cssToDOM takes a
|
|
1270
|
+
* cssToDOM takes a hyphen-case string and converts it to camelCase
|
|
1272
1271
|
* e.g. box-sizing -> boxSizing
|
|
1273
1272
|
*
|
|
1274
1273
|
* @access private
|
|
1275
1274
|
* @function cssToDOM
|
|
1276
|
-
* @param {string} name - String name of
|
|
1275
|
+
* @param {string} name - String name of hyphen-case prop we want to convert
|
|
1277
1276
|
* @returns {string} The camelCase version of the supplied name
|
|
1278
1277
|
*/
|
|
1279
1278
|
function cssToDOM(name) {
|
|
@@ -1295,7 +1294,7 @@
|
|
|
1295
1294
|
// on our modernizr element, but instead just testing undefined vs
|
|
1296
1295
|
// empty string.
|
|
1297
1296
|
|
|
1298
|
-
// Property names can be provided in either camelCase or
|
|
1297
|
+
// Property names can be provided in either camelCase or hyphen-case.
|
|
1299
1298
|
|
|
1300
1299
|
function testProps(props, prefixed, value, skipValueTest) {
|
|
1301
1300
|
skipValueTest = is(skipValueTest, 'undefined') ? false : skipValueTest;
|
|
@@ -1380,7 +1379,7 @@
|
|
|
1380
1379
|
|
|
1381
1380
|
/**
|
|
1382
1381
|
* testProp() investigates whether a given style property is recognized
|
|
1383
|
-
* Property names can be provided in either camelCase or
|
|
1382
|
+
* Property names can be provided in either camelCase or hyphen-case.
|
|
1384
1383
|
*
|
|
1385
1384
|
* @memberOf Modernizr
|
|
1386
1385
|
* @name Modernizr.testProp
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* modernizr v3.
|
|
2
|
+
* modernizr v3.12.0
|
|
3
3
|
* Build https://modernizr.com/download?-cssgrid_cssgridlegacy-siblinggeneral-svg-addtest-printshiv-setclasses-testprop-dontmin
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c)
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
* @access public
|
|
36
36
|
*/
|
|
37
37
|
var ModernizrProto = {
|
|
38
|
-
|
|
39
|
-
_version: '3.10.0',
|
|
38
|
+
_version: '3.12.0',
|
|
40
39
|
|
|
41
40
|
// Any settings that don't work as separate modules
|
|
42
41
|
// can go in here as configuration.
|
|
@@ -1157,7 +1156,7 @@
|
|
|
1157
1156
|
|
|
1158
1157
|
ret = callback(div, rule);
|
|
1159
1158
|
// If this is done after page load we don't want to remove the body so check if body exists
|
|
1160
|
-
if (body.fake) {
|
|
1159
|
+
if (body.fake && body.parentNode) {
|
|
1161
1160
|
body.parentNode.removeChild(body);
|
|
1162
1161
|
docElement.style.overflow = docOverflow;
|
|
1163
1162
|
// Trigger layout so kinetic scrolling isn't disabled in iOS6+
|
|
@@ -1173,13 +1172,13 @@
|
|
|
1173
1172
|
;
|
|
1174
1173
|
|
|
1175
1174
|
/**
|
|
1176
|
-
* domToCSS takes a camelCase string and converts it to
|
|
1175
|
+
* domToCSS takes a camelCase string and converts it to hyphen-case
|
|
1177
1176
|
* e.g. boxSizing -> box-sizing
|
|
1178
1177
|
*
|
|
1179
1178
|
* @access private
|
|
1180
1179
|
* @function domToCSS
|
|
1181
1180
|
* @param {string} name - String name of camelCase prop we want to convert
|
|
1182
|
-
* @returns {string} The
|
|
1181
|
+
* @returns {string} The hyphen-case version of the supplied name
|
|
1183
1182
|
*/
|
|
1184
1183
|
function domToCSS(name) {
|
|
1185
1184
|
return name.replace(/([A-Z])/g, function(str, m1) {
|
|
@@ -1268,12 +1267,12 @@
|
|
|
1268
1267
|
;
|
|
1269
1268
|
|
|
1270
1269
|
/**
|
|
1271
|
-
* cssToDOM takes a
|
|
1270
|
+
* cssToDOM takes a hyphen-case string and converts it to camelCase
|
|
1272
1271
|
* e.g. box-sizing -> boxSizing
|
|
1273
1272
|
*
|
|
1274
1273
|
* @access private
|
|
1275
1274
|
* @function cssToDOM
|
|
1276
|
-
* @param {string} name - String name of
|
|
1275
|
+
* @param {string} name - String name of hyphen-case prop we want to convert
|
|
1277
1276
|
* @returns {string} The camelCase version of the supplied name
|
|
1278
1277
|
*/
|
|
1279
1278
|
function cssToDOM(name) {
|
|
@@ -1295,7 +1294,7 @@
|
|
|
1295
1294
|
// on our modernizr element, but instead just testing undefined vs
|
|
1296
1295
|
// empty string.
|
|
1297
1296
|
|
|
1298
|
-
// Property names can be provided in either camelCase or
|
|
1297
|
+
// Property names can be provided in either camelCase or hyphen-case.
|
|
1299
1298
|
|
|
1300
1299
|
function testProps(props, prefixed, value, skipValueTest) {
|
|
1301
1300
|
skipValueTest = is(skipValueTest, 'undefined') ? false : skipValueTest;
|
|
@@ -1380,7 +1379,7 @@
|
|
|
1380
1379
|
|
|
1381
1380
|
/**
|
|
1382
1381
|
* testProp() investigates whether a given style property is recognized
|
|
1383
|
-
* Property names can be provided in either camelCase or
|
|
1382
|
+
* Property names can be provided in either camelCase or hyphen-case.
|
|
1384
1383
|
*
|
|
1385
1384
|
* @memberOf Modernizr
|
|
1386
1385
|
* @name Modernizr.testProp
|
|
@@ -1450,7 +1449,7 @@
|
|
|
1450
1449
|
* @example
|
|
1451
1450
|
*
|
|
1452
1451
|
* Modernizr._domPrefixes is exactly the same as [_prefixes](#modernizr-_prefixes), but rather
|
|
1453
|
-
* than
|
|
1452
|
+
* than hyphen-case properties, all properties are their Capitalized variant
|
|
1454
1453
|
*
|
|
1455
1454
|
* ```js
|
|
1456
1455
|
* Modernizr._domPrefixes === [ "Moz", "O", "ms", "Webkit" ];
|
|
@@ -1565,7 +1564,7 @@
|
|
|
1565
1564
|
* @optionProp testAllProps
|
|
1566
1565
|
* @access public
|
|
1567
1566
|
* @function testAllProps
|
|
1568
|
-
* @param {string} prop - String naming the property to test (either camelCase or
|
|
1567
|
+
* @param {string} prop - String naming the property to test (either camelCase or hyphen-case)
|
|
1569
1568
|
* @param {string} [value] - String of the value to test
|
|
1570
1569
|
* @param {boolean} [skipValueTest=false] - Whether to skip testing that the value is supported when using non-native detection
|
|
1571
1570
|
* @returns {string|boolean} returns the string version of the property, or `false` if it is unsupported
|
package/cache/options.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.0.
|
|
2
|
+
"version": "2.0.3",
|
|
3
3
|
"modernizr": "^3",
|
|
4
4
|
"options": {
|
|
5
5
|
"feature-detects": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"test/blob",
|
|
11
11
|
"test/canvas",
|
|
12
12
|
"test/canvastext",
|
|
13
|
+
"test/clipboard",
|
|
13
14
|
"test/contenteditable",
|
|
14
15
|
"test/contextmenu",
|
|
15
16
|
"test/cookies",
|
|
@@ -56,9 +57,11 @@
|
|
|
56
57
|
"test/queryselector",
|
|
57
58
|
"test/quota-management-api",
|
|
58
59
|
"test/requestanimationframe",
|
|
60
|
+
"test/scrolltooptions",
|
|
59
61
|
"test/serviceworker",
|
|
60
62
|
"test/svg",
|
|
61
63
|
"test/templatestrings",
|
|
64
|
+
"test/textencoding",
|
|
62
65
|
"test/touchevents",
|
|
63
66
|
"test/typed-arrays",
|
|
64
67
|
"test/unicode-range",
|
|
@@ -72,6 +75,8 @@
|
|
|
72
75
|
"test/webgl",
|
|
73
76
|
"test/websockets",
|
|
74
77
|
"test/xdomainrequest",
|
|
78
|
+
"test/a/aping",
|
|
79
|
+
"test/a/areaping",
|
|
75
80
|
"test/a/download",
|
|
76
81
|
"test/audio/autoplay",
|
|
77
82
|
"test/audio/loop",
|
|
@@ -116,6 +121,7 @@
|
|
|
116
121
|
"test/css/flexboxtweener",
|
|
117
122
|
"test/css/flexgap",
|
|
118
123
|
"test/css/flexwrap",
|
|
124
|
+
"test/css/focusvisible",
|
|
119
125
|
"test/css/focuswithin",
|
|
120
126
|
"test/css/fontdisplay",
|
|
121
127
|
"test/css/fontface",
|
|
@@ -199,6 +205,7 @@
|
|
|
199
205
|
"test/es5/undefined",
|
|
200
206
|
"test/es6/array",
|
|
201
207
|
"test/es6/arrow",
|
|
208
|
+
"test/es6/class",
|
|
202
209
|
"test/es6/collections",
|
|
203
210
|
"test/es6/contains",
|
|
204
211
|
"test/es6/generators",
|
|
@@ -214,6 +221,7 @@
|
|
|
214
221
|
"test/es7/array",
|
|
215
222
|
"test/es7/rest-destructuring",
|
|
216
223
|
"test/es7/spread-object",
|
|
224
|
+
"test/es8/object",
|
|
217
225
|
"test/event/deviceorientation-motion",
|
|
218
226
|
"test/event/oninput",
|
|
219
227
|
"test/file/api",
|
|
@@ -230,6 +238,7 @@
|
|
|
230
238
|
"test/iframe/seamless",
|
|
231
239
|
"test/iframe/srcdoc",
|
|
232
240
|
"test/img/apng",
|
|
241
|
+
"test/img/avif",
|
|
233
242
|
"test/img/crossorigin",
|
|
234
243
|
"test/img/jpeg2000",
|
|
235
244
|
"test/img/jpegxr",
|
|
@@ -245,6 +254,7 @@
|
|
|
245
254
|
"test/input/formmethod",
|
|
246
255
|
"test/input/formnovalidate",
|
|
247
256
|
"test/input/formtarget",
|
|
257
|
+
"test/link/prefetch",
|
|
248
258
|
"test/mediaquery/hovermq",
|
|
249
259
|
"test/mediaquery/pointermq",
|
|
250
260
|
"test/network/beacon",
|
|
@@ -263,6 +273,7 @@
|
|
|
263
273
|
"test/script/defer",
|
|
264
274
|
"test/speech/speech-recognition",
|
|
265
275
|
"test/speech/speech-synthesis",
|
|
276
|
+
"test/storage/indexeddb2",
|
|
266
277
|
"test/storage/localstorage",
|
|
267
278
|
"test/storage/sessionstorage",
|
|
268
279
|
"test/storage/websqldatabase",
|
|
@@ -286,11 +297,13 @@
|
|
|
286
297
|
"test/webgl/extensions",
|
|
287
298
|
"test/webrtc/datachannel",
|
|
288
299
|
"test/webrtc/getusermedia",
|
|
300
|
+
"test/webrtc/mediastream",
|
|
289
301
|
"test/webrtc/peerconnection",
|
|
290
302
|
"test/websockets/binary",
|
|
291
303
|
"test/window/atob-btoa",
|
|
292
304
|
"test/window/framed",
|
|
293
305
|
"test/window/matchmedia",
|
|
306
|
+
"test/window/resizeobserver",
|
|
294
307
|
"test/workers/blobworkers",
|
|
295
308
|
"test/workers/dataworkers",
|
|
296
309
|
"test/workers/sharedworkers",
|
package/package.json
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "customizr",
|
|
3
|
-
"description": "Build out a lean, mean Modernizr machine.",
|
|
4
|
-
"version": "2.0.
|
|
5
|
-
"main": "src",
|
|
6
|
-
"bin": {
|
|
7
|
-
"customizr": "bin/customizr"
|
|
8
|
-
},
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"bugs": "https://github.com/Modernizr/customizr/issues",
|
|
11
|
-
"homepage": "https://github.com/Modernizr/customizr",
|
|
12
|
-
"repository": "https://github.com/Modernizr/customizr.git",
|
|
13
|
-
"author": {
|
|
14
|
-
"name": "Modernizr",
|
|
15
|
-
"url": "https://modernizr.com/"
|
|
16
|
-
},
|
|
17
|
-
"contributors": [
|
|
18
|
-
{
|
|
19
|
-
"name": "Richard Herrera",
|
|
20
|
-
"url": "https://twitter.com/doctyper"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"colors": "^1.4.0",
|
|
25
|
-
"cross-spawn": "^7.0.
|
|
26
|
-
"fast-deep-equal": "^3.1.
|
|
27
|
-
"glob": "^7.
|
|
28
|
-
"lodash": "^4.17.
|
|
29
|
-
"mkdirp": "^1.0.4",
|
|
30
|
-
"modernizr": "^3",
|
|
31
|
-
"nopt": "^
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "customizr",
|
|
3
|
+
"description": "Build out a lean, mean Modernizr machine.",
|
|
4
|
+
"version": "2.0.4",
|
|
5
|
+
"main": "src",
|
|
6
|
+
"bin": {
|
|
7
|
+
"customizr": "bin/customizr"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bugs": "https://github.com/Modernizr/customizr/issues",
|
|
11
|
+
"homepage": "https://github.com/Modernizr/customizr",
|
|
12
|
+
"repository": "https://github.com/Modernizr/customizr.git",
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "Modernizr",
|
|
15
|
+
"url": "https://modernizr.com/"
|
|
16
|
+
},
|
|
17
|
+
"contributors": [
|
|
18
|
+
{
|
|
19
|
+
"name": "Richard Herrera",
|
|
20
|
+
"url": "https://twitter.com/doctyper"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"colors": "^1.4.0",
|
|
25
|
+
"cross-spawn": "^7.0.3",
|
|
26
|
+
"fast-deep-equal": "^3.1.3",
|
|
27
|
+
"glob": "^7.2.0",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
29
|
+
"mkdirp": "^1.0.4",
|
|
30
|
+
"modernizr": "^3",
|
|
31
|
+
"nopt": "^5.0.0",
|
|
32
|
+
"promised-io": "^0.3.6"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"chai": "^4.3.6",
|
|
36
|
+
"fs-extra": "^10.0.0",
|
|
37
|
+
"mocha": "^9.2.0",
|
|
38
|
+
"nexpect": "^0.6.0"
|
|
39
|
+
},
|
|
40
|
+
"optionalDependencies": {
|
|
41
|
+
"fsevents": "^2.3.2"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=10"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"modernizr",
|
|
48
|
+
"customizr"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"pretest": "node test/pretest.js",
|
|
52
|
+
"test": "node test/runner.js"
|
|
53
|
+
},
|
|
54
|
+
"customizr": {
|
|
55
|
+
"dest": "build/modernizr-package.js",
|
|
56
|
+
"files": {
|
|
57
|
+
"src": [
|
|
58
|
+
"test/{js,css}/*"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/builder.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
module.exports = function (modernizrPath) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var argv = require("
|
|
5
|
-
|
|
6
|
-
// Config object
|
|
7
|
-
var _force = argv.force;
|
|
8
|
-
|
|
9
|
-
// Deferreds
|
|
10
|
-
var promise = require("promised-io/promise");
|
|
11
|
-
|
|
12
|
-
// Cache utils
|
|
13
|
-
var utils;
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
writeCodeToFile : function (result, config) {
|
|
17
|
-
utils.log.ok(("Success! Saved file to " + config.dest).grey);
|
|
18
|
-
return utils.file.write(config.dest, result);
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
init : function (tests) {
|
|
22
|
-
var deferred = new promise.Deferred(),
|
|
23
|
-
_interval;
|
|
24
|
-
|
|
25
|
-
// Cache utils
|
|
26
|
-
utils = this.utils;
|
|
27
|
-
|
|
28
|
-
// Store the current config
|
|
29
|
-
var settings = utils.getSettings();
|
|
30
|
-
|
|
31
|
-
// Check if we are minifying this build
|
|
32
|
-
var minify = settings.uglify;
|
|
33
|
-
|
|
34
|
-
// Store options
|
|
35
|
-
var options = settings.options;
|
|
36
|
-
|
|
37
|
-
var modernizrOptions = {
|
|
38
|
-
"feature-detects": tests,
|
|
39
|
-
"options": options,
|
|
40
|
-
"minify": minify,
|
|
41
|
-
"dest": settings.dest,
|
|
42
|
-
"classPrefix" : settings.classPrefix
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Perform a series of checks to validify cache
|
|
46
|
-
var useCachedVersion = false;
|
|
47
|
-
|
|
48
|
-
if (!_force) {
|
|
49
|
-
useCachedVersion = utils.checkCacheValidity(settings, modernizrOptions);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (useCachedVersion) {
|
|
53
|
-
|
|
54
|
-
if(!settings.quiet) {
|
|
55
|
-
utils.log.writeln();
|
|
56
|
-
|
|
57
|
-
utils.log.writeln("No config or test changes detected".bold.white);
|
|
58
|
-
utils.log.ok("The build step has been bypassed. Use `--force` to override.".grey);
|
|
59
|
-
|
|
60
|
-
if (settings.dest) {
|
|
61
|
-
utils.log.ok(("Your current file can be found in " + settings.dest).grey);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
setTimeout(function () {
|
|
66
|
-
return deferred.resolve({
|
|
67
|
-
result: useCachedVersion,
|
|
68
|
-
options: modernizrOptions
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return deferred.promise;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Echo settings
|
|
76
|
-
if(!settings.quiet) {
|
|
77
|
-
utils.log.writeln();
|
|
78
|
-
utils.log.ok("Ready to build using these settings:");
|
|
79
|
-
utils.log.ok(options.join(", ").grey);
|
|
80
|
-
|
|
81
|
-
if (minify) {
|
|
82
|
-
utils.log.ok("Your file will be minified with UglifyJS".grey);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
utils.log.writeln();
|
|
86
|
-
utils.log.write("Building your customized Modernizr".bold.white);
|
|
87
|
-
|
|
88
|
-
_interval = setInterval(function () {
|
|
89
|
-
utils.log.write(".".grey);
|
|
90
|
-
}.bind(this), 200);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
var modernizr = require("modernizr");
|
|
94
|
-
|
|
95
|
-
modernizr.build(modernizrOptions, function (result) {
|
|
96
|
-
|
|
97
|
-
if(!settings.quiet) {
|
|
98
|
-
utils.log.write("...".grey);
|
|
99
|
-
utils.log.ok();
|
|
100
|
-
|
|
101
|
-
clearInterval(_interval);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Write code to file
|
|
105
|
-
if (settings.dest) {
|
|
106
|
-
this.builder.writeCodeToFile(result, settings);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return deferred.resolve({
|
|
110
|
-
result: result,
|
|
111
|
-
options: modernizrOptions
|
|
112
|
-
});
|
|
113
|
-
}.bind(this));
|
|
114
|
-
|
|
115
|
-
return deferred.promise;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
};
|
|
1
|
+
module.exports = function (modernizrPath) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var argv = require("yargs").argv;
|
|
5
|
+
|
|
6
|
+
// Config object
|
|
7
|
+
var _force = argv.force;
|
|
8
|
+
|
|
9
|
+
// Deferreds
|
|
10
|
+
var promise = require("promised-io/promise");
|
|
11
|
+
|
|
12
|
+
// Cache utils
|
|
13
|
+
var utils;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
writeCodeToFile : function (result, config) {
|
|
17
|
+
utils.log.ok(("Success! Saved file to " + config.dest).grey);
|
|
18
|
+
return utils.file.write(config.dest, result);
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
init : function (tests) {
|
|
22
|
+
var deferred = new promise.Deferred(),
|
|
23
|
+
_interval;
|
|
24
|
+
|
|
25
|
+
// Cache utils
|
|
26
|
+
utils = this.utils;
|
|
27
|
+
|
|
28
|
+
// Store the current config
|
|
29
|
+
var settings = utils.getSettings();
|
|
30
|
+
|
|
31
|
+
// Check if we are minifying this build
|
|
32
|
+
var minify = settings.uglify;
|
|
33
|
+
|
|
34
|
+
// Store options
|
|
35
|
+
var options = settings.options;
|
|
36
|
+
|
|
37
|
+
var modernizrOptions = {
|
|
38
|
+
"feature-detects": tests,
|
|
39
|
+
"options": options,
|
|
40
|
+
"minify": minify,
|
|
41
|
+
"dest": settings.dest,
|
|
42
|
+
"classPrefix" : settings.classPrefix
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Perform a series of checks to validify cache
|
|
46
|
+
var useCachedVersion = false;
|
|
47
|
+
|
|
48
|
+
if (!_force) {
|
|
49
|
+
useCachedVersion = utils.checkCacheValidity(settings, modernizrOptions);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (useCachedVersion) {
|
|
53
|
+
|
|
54
|
+
if(!settings.quiet) {
|
|
55
|
+
utils.log.writeln();
|
|
56
|
+
|
|
57
|
+
utils.log.writeln("No config or test changes detected".bold.white);
|
|
58
|
+
utils.log.ok("The build step has been bypassed. Use `--force` to override.".grey);
|
|
59
|
+
|
|
60
|
+
if (settings.dest) {
|
|
61
|
+
utils.log.ok(("Your current file can be found in " + settings.dest).grey);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
setTimeout(function () {
|
|
66
|
+
return deferred.resolve({
|
|
67
|
+
result: useCachedVersion,
|
|
68
|
+
options: modernizrOptions
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return deferred.promise;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Echo settings
|
|
76
|
+
if(!settings.quiet) {
|
|
77
|
+
utils.log.writeln();
|
|
78
|
+
utils.log.ok("Ready to build using these settings:");
|
|
79
|
+
utils.log.ok(options.join(", ").grey);
|
|
80
|
+
|
|
81
|
+
if (minify) {
|
|
82
|
+
utils.log.ok("Your file will be minified with UglifyJS".grey);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
utils.log.writeln();
|
|
86
|
+
utils.log.write("Building your customized Modernizr".bold.white);
|
|
87
|
+
|
|
88
|
+
_interval = setInterval(function () {
|
|
89
|
+
utils.log.write(".".grey);
|
|
90
|
+
}.bind(this), 200);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var modernizr = require("modernizr");
|
|
94
|
+
|
|
95
|
+
modernizr.build(modernizrOptions, function (result) {
|
|
96
|
+
|
|
97
|
+
if(!settings.quiet) {
|
|
98
|
+
utils.log.write("...".grey);
|
|
99
|
+
utils.log.ok();
|
|
100
|
+
|
|
101
|
+
clearInterval(_interval);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Write code to file
|
|
105
|
+
if (settings.dest) {
|
|
106
|
+
this.builder.writeCodeToFile(result, settings);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return deferred.resolve({
|
|
110
|
+
result: result,
|
|
111
|
+
options: modernizrOptions
|
|
112
|
+
});
|
|
113
|
+
}.bind(this));
|
|
114
|
+
|
|
115
|
+
return deferred.promise;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
};
|