Comparing version 0.2.7 to 0.2.8
/** | ||
* almond 0.2.7 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. | ||
* @license almond 0.2.8 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. | ||
* Available via the MIT or new BSD license. | ||
@@ -34,6 +34,7 @@ * see: http://github.com/jrburke/almond for details | ||
function normalize(name, baseName) { | ||
var nameParts, nameSegment, mapValue, foundMap, | ||
var nameParts, nameSegment, mapValue, foundMap, lastIndex, | ||
foundI, foundStarMap, starI, i, j, part, | ||
baseParts = baseName && baseName.split("/"), | ||
map = config.map, | ||
jsSuffixRegExp = /\.js$/, | ||
starMap = (map && map['*']) || {}; | ||
@@ -53,5 +54,13 @@ | ||
baseParts = baseParts.slice(0, baseParts.length - 1); | ||
name = name.split('/'); | ||
lastIndex = name.length - 1; | ||
name = baseParts.concat(name.split("/")); | ||
// Node .js allowance: | ||
if (config.pkgs && hasProp(config.pkgs, baseParts[0]) && | ||
jsSuffixRegExp.test(name[lastIndex])) { | ||
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); | ||
} | ||
name = baseParts.concat(name); | ||
//start trimDots | ||
@@ -324,2 +333,3 @@ for (i = 0; i < name.length; i += 1) { | ||
requirejs = require = req = function (deps, callback, relName, forceSync, alt) { | ||
var i, pkgs; | ||
if (typeof deps === "string") { | ||
@@ -338,2 +348,16 @@ if (handlers[deps]) { | ||
config = deps; | ||
if (config.deps) { | ||
req(config.deps, config.callback); | ||
} | ||
pkgs = config.packages; | ||
if (config.packages) { | ||
config.pkgs = {}; | ||
for (i = 0; i < pkgs.length; i++) { | ||
config.pkgs[pkgs[i].name || pkgs[i]] = true; | ||
} | ||
} | ||
if (!callback) { | ||
return; | ||
} | ||
if (callback.splice) { | ||
@@ -383,7 +407,3 @@ //callback is an array, which means it is a dependency list. | ||
req.config = function (cfg) { | ||
config = cfg; | ||
if (config.deps) { | ||
req(config.deps, config.callback); | ||
} | ||
return req; | ||
return req(cfg); | ||
}; | ||
@@ -390,0 +410,0 @@ |
{ | ||
"name": "almond", | ||
"description": "A minimal AMD API implementation for use in optimized browser builds.", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"homepage": "http://github.com/jrburke/almond", | ||
@@ -6,0 +6,0 @@ "author": "James Burke <jrburke@gmail.com> (http://github.com/jrburke)", |
@@ -37,2 +37,3 @@ #almond | ||
* only have **one** requirejs.config() or require.config() call. | ||
* do not use the `var require = {};` style of [passing config](http://requirejs.org/docs/api.html#config). | ||
* do not use [RequireJS multiversion support/contexts](http://requirejs.org/docs/api.html#multiversion). | ||
@@ -39,0 +40,0 @@ * do not use require.toUrl() or require.nameToUrl(). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27283
7
391
221