Skip to content
Snippets Groups Projects
Commit ff6244a3 authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Resolve #63 by adding shorthands

parent 1a53d2a3
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@ var mappings = {
'swfobject/{version}/swfobject.': resources.swfobject,
'webfont/{version}/webfont.': resources.webfont,
// Common Shorthand Notations
// Common Shorthand Notations [Deprecated]
'dojo/1/dojo/dojo.': {
path: 'resources/dojo/1.6.1/dojo/dojo.js.dec',
type: 'application/javascript'
......@@ -122,7 +122,7 @@ var mappings = {
'ui/{version}/jquery-ui.js': resources.jQueryUI,
'ui/{version}/jquery-ui.min.js': resources.jQueryUI,
// Common Shorthand Notations
// Common Shorthand Notations [Deprecated]
'jquery-latest.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
......@@ -130,6 +130,46 @@ var mappings = {
'jquery.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.3.min.js': {
path: 'resources/jquery/1.3.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.3.js': {
path: 'resources/jquery/1.3.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.4.min.js': {
path: 'resources/jquery/1.4.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.4.js': {
path: 'resources/jquery/1.4.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.5.min.js': {
path: 'resources/jquery/1.5.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.5.js': {
path: 'resources/jquery/1.5.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.6.min.js': {
path: 'resources/jquery/1.6.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.6.js': {
path: 'resources/jquery/1.6.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.7.min.js': {
path: 'resources/jquery/1.7.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.7.js': {
path: 'resources/jquery/1.7.0/jquery.min.js.dec',
type: 'application/javascript'
}
}
},
......
......@@ -135,6 +135,17 @@ function _findLocalTarget(resourceMappings, basePath, channelPath) {
versionNumber = resourcePath.match(VERSION_EXPRESSION);
resourcePattern = resourcePath.replace(versionNumber, VERSION_PLACEHOLDER);
// Determine if the resource path has a static mapping.
if (resourceMappings[resourcePath]) {
// Prepare and return a local target.
return {
path: resourceMappings[resourcePath].path,
type: resourceMappings[resourcePath].type
};
}
// Determine if the resource path fits into a resource mold.
for (let resourceMold of Object.keys(resourceMappings)) {
if (resourcePattern.startsWith(resourceMold)) {
......
......@@ -281,6 +281,11 @@ exports['test jquery-ui on jquery cdn'] = function (assert) {
assert.equal(target.path, localPaths.jQueryUI, 'Target was determined.');
};
exports['test jquery shorthand on jquery cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('code.jquery.com', '/jquery-1.5.min.js');
assert.equal(target.path, 'resources/jquery/1.5.0/jquery.min.js.dec', 'Target found for jquery shorthand on jquery cdn.');
};
// jsDelivr (MaxCDN)
exports['test angular on jsdelivr'] = function (assert) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment