relative location refinement

This commit is contained in:
guybedford 2013-10-30 09:23:06 +02:00
parent e79cecb1ec
commit f6bf4b1cc3
4 changed files with 7 additions and 5 deletions

View File

@ -350,9 +350,10 @@
// module names starting with '#' are never normalized
// useful for plugins where the import doesn't represent a real path
if (name.substr(0, 1) != '#') {
console.log(name);
console.log(referer && referer.name);
// location relative normalization
if (name.substr(0, 2) == './' && referer && referer.name && referer.name.indexOf(':') != -1)
if (name.substr(0, 2) == './' && referer && referer.name && referer.name.indexOf(':') != -1 && referer.name.indexOf('/') == -1)
name = referer.name.substr(0, referer.name.indexOf(':') + 1) + name.substr(2);
// do standard normalization (resolve relative module name)
@ -361,7 +362,7 @@
// do map config
name = applyMap(name, parentName);
console.log(name);
}
if (pluginName)

View File

@ -120,10 +120,9 @@
'mypath': './tests'
}
});
jspm.import(['mypath:path'], complete);
jspm.import(['mypath:path', 'mypath:deep/deep'], complete);
},
confirm: function(m) {
console.log(m);
if (m != 'path')
return 'module not loaded';
}

View File

@ -0,0 +1 @@
define({});

1
test/tests/deep/deep.js Normal file
View File

@ -0,0 +1 @@
require('./deep-dep');