Skip to content

Commit 714e0fd

Browse files
committed
snapshot
1 parent b3f96ab commit 714e0fd

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

dist/r.js

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license r.js 2.0.2+ Tue, 03 Jul 2012 22:45:51 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2+
* @license r.js 2.0.2+ Wed, 04 Jul 2012 00:44:40 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
33
* Available via the MIT or new BSD license.
44
* see: http://github.com/jrburke/requirejs for details
55
*/
@@ -20,7 +20,7 @@ var requirejs, require, define;
2020

2121
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
2222
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode,
23-
version = '2.0.2+ Tue, 03 Jul 2012 22:45:51 GMT',
23+
version = '2.0.2+ Wed, 04 Jul 2012 00:44:40 GMT',
2424
jsSuffixRegExp = /\.js$/,
2525
commandOption = '',
2626
useLibLoaded = {},
@@ -2718,6 +2718,31 @@ define('node/file', ['fs', 'path'], function (fs, path) {
27182718
fs.unlinkSync(fileName);
27192719
}
27202720
}
2721+
},
2722+
2723+
2724+
/**
2725+
* Deletes any empty directories under the given directory.
2726+
*/
2727+
deleteEmptyDirs: function (startDir) {
2728+
var dirFileArray, i, fileName, filePath, stat;
2729+
2730+
if (file.exists(startDir)) {
2731+
dirFileArray = fs.readdirSync(startDir);
2732+
for (i = 0; i < dirFileArray.length; i++) {
2733+
fileName = dirFileArray[i];
2734+
filePath = path.join(startDir, fileName);
2735+
stat = fs.statSync(filePath);
2736+
if (stat.isDirectory()) {
2737+
file.deleteEmptyDirs(filePath);
2738+
}
2739+
}
2740+
2741+
//If directory is now empty, remove it.
2742+
if (fs.readdirSync(startDir).length === 0) {
2743+
file.deleteFile(startDir);
2744+
}
2745+
}
27212746
}
27222747
};
27232748

@@ -2735,7 +2760,7 @@ if(env === 'rhino') {
27352760
*/
27362761
//Helper functions to deal with file I/O.
27372762

2738-
/*jslint plusplus: false, strict: false */
2763+
/*jslint plusplus: false, strict: true */
27392764
/*global java: false, define: false */
27402765

27412766
define('rhino/file', function () {
@@ -2974,6 +2999,35 @@ define('rhino/file', function () {
29742999
}
29753000
fileObj["delete"]();
29763001
}
3002+
},
3003+
3004+
/**
3005+
* Deletes any empty directories under the given directory.
3006+
* The startDirIsJavaObject is private to this implementation's
3007+
* recursion needs.
3008+
*/
3009+
deleteEmptyDirs: function (startDir, startDirIsJavaObject) {
3010+
var topDir = startDir,
3011+
dirFileArray, i, fileObj;
3012+
3013+
if (!startDirIsJavaObject) {
3014+
topDir = new java.io.File(startDir);
3015+
}
3016+
3017+
if (topDir.exists()) {
3018+
dirFileArray = topDir.listFiles();
3019+
for (i = 0; i < dirFileArray.length; i++) {
3020+
fileObj = dirFileArray[i];
3021+
if (fileObj.isDirectory()) {
3022+
file.deleteEmptyDirs(fileObj, true);
3023+
}
3024+
}
3025+
3026+
//If the directory is empty now, delete it.
3027+
if (topDir.listFiles().length === 0) {
3028+
file.deleteFile(String(topDir.getPath()));
3029+
}
3030+
}
29773031
}
29783032
};
29793033

@@ -14436,6 +14490,12 @@ function (lang, logger, file, parse, optimize, pragma,
1443614490
});
1443714491
}
1443814492

14493+
//If removeCombined in play, remove any empty directories that
14494+
//may now exist because of its use
14495+
if (config.removeCombined && !config.out && config.dir) {
14496+
file.deleteEmptyDirs(config.dir);
14497+
}
14498+
1443914499
//Do other optimizations.
1444014500
if (config.out && !config.cssIn) {
1444114501
//Just need to worry about one JS file.

0 commit comments

Comments
 (0)