mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-25 14:57:38 +00:00
instead of loader opting out of defaultExtension, let meta handle this
This commit is contained in:
parent
70624566c9
commit
f8922eecb9
@ -171,14 +171,15 @@
|
||||
function toPackagePath(pkgName, pkg, basePath, subPath, isPlugin) {
|
||||
var normalized = pkgName + '/' + basePath + subPath;
|
||||
|
||||
var hasLoadMeta = isPlugin;
|
||||
var hasExtensionMeta = isPlugin;
|
||||
if (pkg.meta)
|
||||
getMetaMatches(pkg.meta, basePath, pkgName, normalized, function(matchMeta, matchDepth) {
|
||||
if (matchMeta.loader || matchDepth == 0)
|
||||
hasLoadMeta = true;
|
||||
getMetaMatches(pkg.meta, basePath, pkgName, normalized, function(metaPattern, matchMeta, matchDepth) {
|
||||
// exact meta or meta with any content after the last wildcard skips extension
|
||||
if (matchDepth == 0 || metaPattern.lastIndexOf('*') != metaPattern.length - 1)
|
||||
hasExtensionMeta = true;
|
||||
});
|
||||
|
||||
return normalized + (hasLoadMeta ? '' : getDefaultExtension(pkg, subPath));
|
||||
return normalized + (hasExtensionMeta ? '' : getDefaultExtension(pkg, subPath));
|
||||
}
|
||||
|
||||
function getDefaultExtension(pkg, subPath) {
|
||||
@ -380,14 +381,14 @@
|
||||
|
||||
if (basePath + module.substr(0, wildcardIndex) === normalized.substr(pkgName.length + 1, wildcardIndex + basePath.length)
|
||||
&& module.substr(wildcardIndex + 1) === normalized.substr(normalized.length - module.length + wildcardIndex + 1)) {
|
||||
matchFn(pkgMeta[dotRel + module], module.split('/').length);
|
||||
matchFn(module, pkgMeta[dotRel + module], module.split('/').length);
|
||||
}
|
||||
}
|
||||
// exact meta
|
||||
var metaName = normalized.substr(pkgName.length + basePath.length + 1);
|
||||
var exactMeta = pkgMeta[metaName] || pkgMeta['./' + metaName];
|
||||
if (exactMeta && normalized.substr(pkgName.length + 1, basePath.length) == basePath)
|
||||
matchFn(exactMeta, 0);
|
||||
matchFn(exactMeta, exactMeta, 0);
|
||||
}
|
||||
|
||||
hook('locate', function(locate) {
|
||||
@ -408,7 +409,7 @@
|
||||
var meta = {};
|
||||
if (pkg.meta) {
|
||||
var bestDepth = 0;
|
||||
getMetaMatches(pkg.meta, basePath, pkgName, load.name, function(matchMeta, matchDepth) {
|
||||
getMetaMatches(pkg.meta, basePath, pkgName, load.name, function(metaPattern, matchMeta, matchDepth) {
|
||||
if (matchDepth > bestDepth)
|
||||
bestDepth = matchDepth;
|
||||
extendMeta(meta, matchMeta, matchDepth && bestDepth > matchDepth);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user