Permalink
Browse files

Improved require functionality in node and error output for cli when …

…options aren't present
  • Loading branch information...
1 parent bb27551 commit 3875aa15aab93d5bb418a1d1b814304daa49d6da @alex-seville committed Mar 23, 2013
View
@@ -109,13 +109,18 @@ Thanks to the following people:
* [tmrudick](https://github.com/tmrudick)
* [wpreul](https://github.com/wpreul)
* [xzyfer](https://github.com/xzyfer)
+* [hasankhan](https://github.com/hasankhan)
+* [mohamedmansour](https://github.com/mohamedmansour)
* [flrent](https://github.com/flrent)
And thanks also to: [RequireJS](http://requirejs.org/), [Esprima](http://esprima.org/), [node-falafel](https://github.com/substack/node-falafel), [Mocha](http://visionmedia.github.com/mocha/), [Qunit](http://qunitjs.com/).
## Revision History
+Mar 22-13 - 1.0.9
+Blanket is not run on require in node now. Update to component version for bower. Branch tracking reporting fix. Preserve filenames in Node.
+
Mar 14-13 - 1.0.8
Improvement to branch tracking
View
@@ -1,5 +1,5 @@
{
"name": "blanket",
- "version": "1.0.8",
+ "version": "1.0.9",
"main": ["./dist/qunit/blanket.js"]
}
@@ -1,4 +1,4 @@
-/*! blanket - v1.0.8 */
+/*! blanket - v1.0.9 */
(function(define){
@@ -4420,6 +4420,14 @@ _blanket.extend({
_blanket.blanketSession = null;
}
coverage_data.files = window._$blanket;
+
+ // Check if we have any covered files that requires reporting
+ // otherwise just exit gracefully.
+ if (!coverage_data.files || !coverage_data.files.length) {
+ if (_blanket.options("debug")) {console.log("BLANKET-Reporting No files were instrumented.");}
+ return;
+ }
+
if (typeof coverage_data.files.branchFcn !== "undefined"){
delete coverage_data.files.branchFcn;
}
@@ -4549,7 +4557,7 @@ _blanket.extend({
if (typeof requirejs !== "undefined"){blanket.options("existingRequireJS",true);}else{if (typeof window["define"] !== "undefined"){window["__blanket_old_define"]=window["define"];window["define"]=void 0;}
/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * @license RequireJS 2.1.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
@@ -4562,7 +4570,7 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
- version = '2.1.5',
+ version = '2.1.4',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
@@ -4741,21 +4749,15 @@ var requirejs, require, define;
var inCheckLoaded, Module, context, handlers,
checkLoadedTimeoutId,
config = {
- //Defaults. Do not set a default for map
- //config to speed up normalize(), which
- //will run faster if there is no default.
waitSeconds: 7,
baseUrl: './',
paths: {},
pkgs: {},
shim: {},
+ map: {},
config: {}
},
registry = {},
- //registry of just enabled modules, to speed
- //cycle breaking code when lots of modules
- //are registered, but not activated.
- enabledRegistry = {},
undefEvents = {},
defQueue = [],
defined = {},
@@ -4851,7 +4853,7 @@ var requirejs, require, define;
}
//Apply map config if available.
- if (applyMap && map && (baseParts || starMap)) {
+ if (applyMap && (baseParts || starMap) && map) {
nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) {
@@ -5132,7 +5134,6 @@ var requirejs, require, define;
function cleanRegistry(id) {
//Clean up machinery used for waiting modules.
delete registry[id];
- delete enabledRegistry[id];
}
function breakCycle(mod, traced, processed) {
@@ -5181,7 +5182,7 @@ var requirejs, require, define;
inCheckLoaded = true;
//Figure out the state of all the modules.
- eachProp(enabledRegistry, function (mod) {
+ eachProp(registry, function (mod) {
map = mod.map;
modId = map.id;
@@ -5362,7 +5363,7 @@ var requirejs, require, define;
},
/**
- * Checks if the module is ready to define itself, and if so,
+ * Checks is the module is ready to define itself, and if so,
* define it.
*/
check: function () {
@@ -5440,7 +5441,7 @@ var requirejs, require, define;
}
//Clean up
- cleanRegistry(id);
+ delete registry[id];
this.defined = true;
}
@@ -5606,7 +5607,6 @@ var requirejs, require, define;
},
enable: function () {
- enabledRegistry[this.map.id] = this;
this.enabled = true;
//Set flag mentioning that the module is enabling,
@@ -5766,7 +5766,6 @@ var requirejs, require, define;
Module: Module,
makeModuleMap: makeModuleMap,
nextTick: req.nextTick,
- onError: onError,
/**
* Set a configuration for the context.
@@ -5793,9 +5792,6 @@ var requirejs, require, define;
eachProp(cfg, function (value, prop) {
if (objs[prop]) {
if (prop === 'map') {
- if (!config.map) {
- config.map = {};
- }
mixin(config[prop], value, true, true);
} else {
mixin(config[prop], value, true);
@@ -5907,7 +5903,7 @@ var requirejs, require, define;
//Synchronous access to one module. If require.get is
//available (as in the Node adapter), prefer that.
if (req.get) {
- return req.get(context, deps, relMap, localRequire);
+ return req.get(context, deps, relMap);
}
//Normalize module name, if it contains . or ..
@@ -5958,7 +5954,7 @@ var requirejs, require, define;
* plain URLs like nameToUrl.
*/
toUrl: function (moduleNamePlusExt) {
- var ext,
+ var ext, url,
index = moduleNamePlusExt.lastIndexOf('.'),
segment = moduleNamePlusExt.split('/')[0],
isRelative = segment === '.' || segment === '..';
@@ -5970,8 +5966,9 @@ var requirejs, require, define;
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
}
- return context.nameToUrl(normalize(moduleNamePlusExt,
- relMap && relMap.id, true), ext, true);
+ url = context.nameToUrl(normalize(moduleNamePlusExt,
+ relMap && relMap.id, true), ext || '.fake');
+ return ext ? url : url.substring(0, url.length - 5);
},
defined: function (id) {
@@ -6090,7 +6087,7 @@ var requirejs, require, define;
* it is assumed to have already been normalized. This is an
* internal API, not a public one. Use toUrl for the public API.
*/
- nameToUrl: function (moduleName, ext, skipExt) {
+ nameToUrl: function (moduleName, ext) {
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
parentPath;
@@ -6139,7 +6136,7 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/');
- url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
+ url += (ext || (/\?/.test(url) ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
}
@@ -6378,7 +6375,7 @@ var requirejs, require, define;
node.attachEvent('onreadystatechange', context.onScriptLoad);
//It would be great to add an error handler here to catch
//404s in IE9+. However, onreadystatechange will fire before
- //the error handler, so that does not help. If addEventListener
+ //the error handler, so that does not help. If addEvenListener
//is used, then IE will fire error before load, but we cannot
//use that pathway given the connect.microsoft.com issue
//mentioned above about not doing the 'script execute,
@@ -6407,24 +6404,16 @@ var requirejs, require, define;
return node;
} else if (isWebWorker) {
- try {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- } catch (e) {
- context.onError(makeError('importscripts',
- 'importScripts failed for ' +
- moduleName + ' at ' + url,
- e,
- [moduleName]));
- }
+ //In a web worker, use importScripts. This is not a very
+ //efficient use of importScripts, importScripts will block until
+ //its script is downloaded and evaluated. However, if web workers
+ //are in play, the expectation that a build has been done so that
+ //only one script needs to be loaded anyway. This may need to be
+ //reevaluated if other use cases become common.
+ importScripts(url);
+
+ //Account for anonymous modules
+ context.completeLoad(moduleName);
}
};
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 3875aa1

Please sign in to comment.