From ea16d855cfab33ba1e07dca4a5393edd33966351 Mon Sep 17 00:00:00 2001 From: guybedford Date: Mon, 24 Aug 2015 22:58:05 +0200 Subject: [PATCH] package global map fix --- lib/package.js | 9 ++++----- test/test.js | 3 +++ test/tests/testpkg.json | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/package.js b/lib/package.js index ad42392d..2b8cda58 100644 --- a/lib/package.js +++ b/lib/package.js @@ -204,17 +204,16 @@ if (mapped) { // '.' as a target is the package itself (with package main check) if (mapped == '.') - normalized = loader.normalizeSync(pkgName); + return loader.normalizeSync(pkgName); // internal package map else if (mapped.substr(0, 2) == './') - normalized = pkgName + '/' + basePath + mapped.substr(2); + return pkgName + '/' + basePath + mapped.substr(2); // global package map else - normalized = normalize.call(loader, mapped); + return loader.normalize.call(loader, mapped); } else - normalized = pkgName + '/' + basePath + normalized.substr(pkgName.length + 1) + defaultExtension; - return normalized; + return pkgName + '/' + basePath + normalized.substr(pkgName.length + 1) + defaultExtension; }); } diff --git a/test/test.js b/test/test.js index a29c3ecd..ea8a5dd2 100644 --- a/test/test.js +++ b/test/test.js @@ -884,6 +884,9 @@ asyncTest('Wildcard meta', function() { asyncTest('Package configuration CommonJS config example', function() { System.config({ + map: { + 'global-test': 'tests/testpkg/test.ts' + }, packagePaths: ['tests/testpk*'], packages: { 'tests/testpkg': { diff --git a/test/tests/testpkg.json b/test/tests/testpkg.json index 5d40be28..265d24ed 100644 --- a/test/tests/testpkg.json +++ b/test/tests/testpkg.json @@ -11,7 +11,7 @@ "./json": "./json.json", "./dir/": "./dir/index.js", "./dir2": "./dir2/index.json", - "./dir/test": "./test.ts", + "./dir/test": "global-test", "./env-module": { "browser": "./env-module-browser.js" }