Skip to content

Commit 5fad149

Browse files
committed
Update r-edge.js
1 parent 6486a15 commit 5fad149

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

dist/r-edge.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license r.js 1.0.2+ 20111222 4:10pm Pacific Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
2+
* @license r.js 1.0.2+ 20111222 9:30pm Pacific Copyright (c) 2010-2011, 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,
23-
version = '1.0.2+ 20111222 4:10pm Pacific',
23+
version = '1.0.2+ 1.0.2+ 20111222 9:30pm Pacific',
2424
jsSuffixRegExp = /\.js$/,
2525
commandOption = '',
2626
//Used by jslib/rhino/args.js
@@ -2366,7 +2366,7 @@ define('node/file', ['fs', 'path'], function (fs, path) {
23662366

23672367
function mkDir(dir) {
23682368
if (!exists(dir)) {
2369-
fs.mkdirSync(dir, 0777);
2369+
fs.mkdirSync(dir, 511);
23702370
}
23712371
}
23722372

@@ -2527,6 +2527,13 @@ define('node/file', ['fs', 'path'], function (fs, path) {
25272527
return true; //Boolean
25282528
},
25292529

2530+
/**
2531+
* Renames a file. May fail if "to" already exists or is on another drive.
2532+
*/
2533+
renameFile: function (from, to) {
2534+
return fs.renameSync(from, to);
2535+
},
2536+
25302537
/**
25312538
* Reads a *text* file.
25322539
*/
@@ -2763,6 +2770,13 @@ define('rhino/file', function () {
27632770
return true; //Boolean
27642771
},
27652772

2773+
/**
2774+
* Renames a file. May fail if "to" already exists or is on another drive.
2775+
*/
2776+
renameFile: function (from, to) {
2777+
return (new java.io.File(from)).renameTo((new java.io.File(to)));
2778+
},
2779+
27662780
readFile: function (/*String*/path, /*String?*/encoding) {
27672781
//A file read function that can deal with BOMs
27682782
encoding = encoding || "utf-8";
@@ -8421,9 +8435,22 @@ function (lang, logger, file, parse, optimize, pragma,
84218435

84228436
//Flatten them and collect the build output for each module.
84238437
builtModule = build.flattenModule(module, module.layer, config);
8424-
file.saveUtf8File(module._buildPath, builtModule.text);
8438+
8439+
//Save it to a temp file for now, in case there are other layers that
8440+
//contain optimized content that should not be included in later
8441+
//layer optimizations. See issue #56.
8442+
file.saveUtf8File(module._buildPath + '-temp', builtModule.text);
84258443
buildFileContents += builtModule.buildText;
84268444
});
8445+
8446+
//Now move the build layers to their final position.
8447+
modules.forEach(function (module) {
8448+
var finalPath = module._buildPath;
8449+
if (file.exists(finalPath)) {
8450+
file.deleteFile(finalPath);
8451+
}
8452+
file.renameFile(finalPath + '-temp', finalPath);
8453+
});
84278454
}
84288455

84298456
//Do other optimizations.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy