diff --git a/dojo.js b/dojo.js index 7fc1a2d1ee..11fa8c770f 100644 --- a/dojo.js +++ b/dojo.js @@ -714,7 +714,7 @@ getModule = function(mid, referenceModule, fromRequire){ // compute and optionally construct (if necessary) the module implied by the mid with respect to referenceModule - var match, plugin, pluginResource, result, existing, pqn, syntheticMid; + var match, plugin, pluginResource, result, existing, pqn; match = mid.match(/^(.+?)\!(.*)$/); //TODO: change the regex above to this and test...match= mid.match(/^([^\!]+)\!(.+)$/); if(match){ @@ -725,10 +725,9 @@ return modules[pqn] || (modules[pqn] = {plugin:plugin, mid:pluginResource, req:(referenceModule ? createRequire(referenceModule) : req), pqn:pqn}); }else{ if(fromRequire && /^.*[^\/\.]+\.[^\/\.]+$/.test(mid)){ - // anything* anything-other-than-a-dot+ dot anything-other-than-a-dot+ => a url that ends with a filetype - syntheticMid = uid(), - pqn = "*" + syntheticMid; - return modules[pqn]= makeModuleInfo(0, syntheticMid, pqn, 0, mid, mid); + // anything* anything-other-than-a-dot+ dot anything-other-than-a-dot-or-slash+ => a url that ends with a filetype + pqn = "*" + mid; + return modules[pqn]= modules[pqn] || makeModuleInfo(0, mid, pqn, 0, mid, mid); } result = getModuleInfo(mid, referenceModule, packs, modules, req.baseUrl, packageMapProg, pathsMapProg); return modules[result.pqn] || (modules[result.pqn] = result); @@ -1112,6 +1111,9 @@ } } }); + if(!isFunction(def) && !deps.length){ + mix(module, {result:def, executed:executed}); + } // resolve deps with respect to pid for(var i = 0; i < deps.length; i++){ diff --git a/package.json b/package.json index bac8610bf7..69543f06e5 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "amd": "return /\\.js$/.test(name) && !/\\/nls\\//.test(name) && !/_base\\/config.+/.test(name) && !/OpenAjax\\.js$/.test(name) && !/resources\\/_modules\\.js/.test(name);" }, "trees": [ - [".", ".", "/\\.", "/dojo/_base/_loader/", "/dojo/lib/"] + [".", ".", "/\\.", "~$"] ] } -} \ No newline at end of file +} diff --git a/text.js b/text.js index d699a71003..e836ced081 100644 --- a/text.js +++ b/text.js @@ -30,7 +30,7 @@ define(["./_base/kernel", "./_base/xhr", "require", "./has"], function(dojo, xhr var theCache= {}, - getCacheId= function(resourceId) { + getCacheId= function(resourceId, require) { if(require.toAbsMid){ var match= resourceId.match(/(.+)(\.[^\/\.]+)$/); return match ? require.toAbsMid(match[1]) + match[2] : require.toAbsMid(resourceId); @@ -69,7 +69,7 @@ define(["./_base/kernel", "./_base/xhr", "require", "./has"], function(dojo, xhr var parts= id.split("!"), resourceId= parts[0], - cacheId= getCacheId(resourceId), + cacheId= getCacheId(resourceId, require), stripFlag= parts.length>1, url; if(cacheId in theCache){ @@ -81,10 +81,20 @@ define(["./_base/kernel", "./_base/xhr", "require", "./has"], function(dojo, xhr load(stripFlag ? strip(theCache[url]) : theCache[url]); return; } - getText(url, !require.async, function(text){ - cache(cacheId, url, text); - load(stripFlag ? strip(theCache[url]) : theCache[url]); - }); + var + inject= function(text){ + cache(cacheId, url, text); + load(stripFlag ? strip(theCache[url]) : theCache[url]); + }, + text; + try{ + text= require("*text/" + cacheId); + if(text!==undefined){ + inject(text); + return; + } + }catch(e){} + getText(url, !require.async, inject); }, cache:function(cacheId, mid, type, value) {