From 2913ba0880787b8ee166cb091536b87deaa3638a Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 2 Dec 2015 00:43:42 +0400 Subject: [PATCH] cleanup --- configs/standalone.js | 4 +++- .../architect-build/build_support/mini_require.js | 3 +-- plugins/c9.static/cdn.js | 13 ++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configs/standalone.js b/configs/standalone.js index d6611bed..bb6f596e 100644 --- a/configs/standalone.js +++ b/configs/standalone.js @@ -40,7 +40,8 @@ module.exports = function(config, optimist) { .describe("setting-path", "The path to store the settings.") .boolean("inProcessLocalFs") .describe("inProcessLocalFs", "Whether to run localfs in same process for debugging.") - .default("inProcessLocalFs", config.inProcessLocalFs); + .default("inProcessLocalFs", config.inProcessLocalFs) + .boolean("useBrowserCache"); } var argv = optimist.argv; @@ -215,6 +216,7 @@ module.exports = function(config, optimist) { /* ### BEGIN #*/ }, { packagePath: "./c9.static/cdn", + useBrowserCache: argv.useBrowserCache, cacheFiles: argv.cache }, { packagePath: "./c9.static/build", diff --git a/node_modules/architect-build/build_support/mini_require.js b/node_modules/architect-build/build_support/mini_require.js index 77864a27..ca4e92f7 100644 --- a/node_modules/architect-build/build_support/mini_require.js +++ b/node_modules/architect-build/build_support/mini_require.js @@ -284,7 +284,7 @@ var config = require.config = function(cfg) { config.paths[p] = cfg.paths[p]; }); - if (cfg.useCache && global.caches) { + if (cfg.useCache && global.caches && !/Firefox/i.test(navigator.userAgent)) { // Firefox promises throw too much recursion error config.useCache = true; checkCache(); } @@ -509,7 +509,6 @@ function checkCache() { if (parts[i]) { var del = ideCache.delete(baseUrl + parts[i]); toDelete.push(del); - console.log(parts[i]); } } }, function(e, t) { diff --git a/plugins/c9.static/cdn.js b/plugins/c9.static/cdn.js index 5de217a9..e46ca2c1 100644 --- a/plugins/c9.static/cdn.js +++ b/plugins/c9.static/cdn.js @@ -70,9 +70,9 @@ function main(options, imports, register) { var buffer = ""; var t = Date.now(); var q = new FsQ(); - var skinChanged = false; + var skinChanged = 0; var requestedSkin = ""; - var requestedSkinChanged = false; + var requestedSkinChanged = -1; q.process = function(e) { var parts = e.split(" "); var id = parts[1]; @@ -96,9 +96,9 @@ function main(options, imports, register) { if (err) { if (!skinChanged && /\.(css|less)/.test(id)) - skinChanged = true; + skinChanged = s ? s.mtime.valueOf() : Infinity; if (requestedSkin == id) - requestedSkinChanged = true; + requestedSkinChanged = s ? s.mtime.valueOf() : 0; res.write(id + "\n"); } q.oneDone(); @@ -106,12 +106,11 @@ function main(options, imports, register) { }; q.end = function() { if (!q.buffer.length && !q.active) { - console.log(skinChanged, requestedSkinChanged, requestedSkin) - if (skinChanged && !requestedSkinChanged && requestedSkin) { + if (skinChanged >= requestedSkinChanged && requestedSkin) { res.write(requestedSkin + "\n"); console.info("Deleting old skin", requestedSkin); return fs.unlink(build.cacheDir + "/" + requestedSkin, function() { - skinChanged = false; + requestedSkin = ""; q.end(); }); }