diff --git a/lib/core.js b/lib/core.js index 2738bfc8..a71df472 100644 --- a/lib/core.js +++ b/lib/core.js @@ -39,13 +39,11 @@ function getMapMatch(map, name) { return bestMatch; } -function setConditional(mode) { +function setProduction(isProduction) { this.set('@system-env', this.newModule({ browser: isBrowser, node: !!this._nodeRequire, - env: mode, - production: mode == 'production', - development: mode == 'development' + production: isProduction })); } @@ -82,7 +80,7 @@ hookConstructor(function(constructor) { // support the empty module, as a concept this.set('@empty', this.newModule({})); - setConditional.call(this, 'development'); + setProduction.call(this, false); }; }); @@ -327,11 +325,8 @@ SystemJSLoader.prototype.config = function(cfg) { if (cfg.pluginFirst) loader.pluginFirst = cfg.pluginFirst; - if (cfg.env) { - if (cfg.env != 'production' && cfg.env != 'development') - throw new TypeError('The config environment must be set to "production" or "development".'); - setConditional.call(loader, cfg.env); - } + if (cfg.production) + setProduction.call(loader, true); if (cfg.paths) { for (var p in cfg.paths) @@ -402,6 +397,9 @@ SystemJSLoader.prototype.config = function(cfg) { throw new TypeError('"' + p + '" is not a valid package name.'); // trailing slash allows paths matches here + // NB deprecate this to just remove trailing / + // as decanonicalize doesn't respond to trailing / + // and paths wildcards should deprecate var prop = loader.decanonicalize(p + (p[p.length - 1] != '/' ? '/' : '')); // allow trailing '/' in package config diff --git a/lib/package.js b/lib/package.js index 7e7fa515..716ac045 100644 --- a/lib/package.js +++ b/lib/package.js @@ -386,11 +386,6 @@ var subPath = normalized.substr(pkgName.length + 1); - // allow for direct package name normalization with trailling "/" (no main) - // that is normalize('pkg/') does not apply main, while normalize('./', 'pkg/') does - if (!subPath && normalized.length == pkgName.length + 1 && name[0] != '.') - return pkgName + subPath; - return applyPackageConfigSync(loader, loader.packages[pkgName] || {}, pkgName, subPath, isPlugin); }; }); @@ -458,11 +453,6 @@ .then(function(pkg) { var subPath = normalized.substr(pkgName.length + 1); - // allow for direct package name normalization with trailling "/" (no main) - // that is normalize('pkg/') does not apply main, while normalize('./', 'pkg/') does - if (!subPath && normalized.length == pkgName.length + 1 && name[0] != '.') - return Promise.resolve(pkgName + subPath); - return applyPackageConfig(loader, pkg, pkgName, subPath, isPlugin); }); });