Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
v0.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jun 14, 2015
1 parent e4ac34d commit 81d0471
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions dist/es6-module-loader-dev.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/es6-module-loader-dev.js.map

Large diffs are not rendered by default.

29 changes: 18 additions & 11 deletions dist/es6-module-loader-dev.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,15 +992,24 @@ function logloads(loads) {
// By disaling this module write-protection we gain performance.
// It could be useful to allow an option to enable or disable this.
module.locked = true;
moduleObj[name] = value;

// export({name: value})
if (typeof name == 'object') {
for (var p in name)
moduleObj[p] = name[p];
}
// export(name, value)
else {
moduleObj[name] = value;
}

for (var i = 0, l = module.importers.length; i < l; i++) {
var importerModule = module.importers[i];
if (!importerModule.locked) {
for (var j = 0; j < importerModule.dependencies.length; ++j) {
if (importerModule.dependencies[j] === module) {
importerModule.setters[j](moduleObj);
}
for (var j = 0; j < importerModule.dependencies.length; ++j) {
if (importerModule.dependencies[j] === module) {
importerModule.setters[j](moduleObj);
}
}
}
}
Expand Down Expand Up @@ -1312,12 +1321,12 @@ function SystemLoader() {
}

// NB no specification provided for System.paths, used ideas discussed in https://github.com/jorendorff/js-loaders/issues/25
function applyPaths(loader, name) {
function applyPaths(paths, name) {
// most specific (most number of slashes in path) match wins
var pathMatch = '', wildcard, maxSlashCount = 0;

// check to see if we have a paths entry
for (var p in loader.paths) {
for (var p in paths) {
var pathParts = p.split('*');
if (pathParts.length > 2)
throw new TypeError('Only one wildcard in a path is permitted');
Expand All @@ -1342,7 +1351,7 @@ function applyPaths(loader, name) {
}
}

var outPath = loader.paths[pathMatch] || name;
var outPath = paths[pathMatch] || name;
if (wildcard)
outPath = outPath.replace('*', wildcard);

Expand All @@ -1354,8 +1363,6 @@ function LoaderProto() {}
LoaderProto.prototype = Loader.prototype;
SystemLoader.prototype = new LoaderProto();

var baseURLCache = {};

var absURLRegEx = /^([^\/]+:\/\/|\/)/;

// Normalization with module names as absolute URLs
Expand All @@ -1366,7 +1373,7 @@ SystemLoader.prototype.normalize = function(name, parentName, parentAddress) {

// not absolute or relative -> apply paths (what will be sites)
if (!name.match(absURLRegEx) && name[0] != '.')
name = new URL(applyPaths(this, name), baseURI).href;
name = new URL(applyPaths(this.paths, name), baseURI).href;
// apply parent-relative normalization, parentAddress is already normalized
else
name = new URL(name, parentName || baseURI).href;
Expand Down
4 changes: 2 additions & 2 deletions dist/es6-module-loader.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/es6-module-loader.js.map

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions dist/es6-module-loader.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,12 +979,12 @@ function SystemLoader() {
}

// NB no specification provided for System.paths, used ideas discussed in https://github.com/jorendorff/js-loaders/issues/25
function applyPaths(loader, name) {
function applyPaths(paths, name) {
// most specific (most number of slashes in path) match wins
var pathMatch = '', wildcard, maxSlashCount = 0;

// check to see if we have a paths entry
for (var p in loader.paths) {
for (var p in paths) {
var pathParts = p.split('*');
if (pathParts.length > 2)
throw new TypeError('Only one wildcard in a path is permitted');
Expand All @@ -1009,7 +1009,7 @@ function applyPaths(loader, name) {
}
}

var outPath = loader.paths[pathMatch] || name;
var outPath = paths[pathMatch] || name;
if (wildcard)
outPath = outPath.replace('*', wildcard);

Expand All @@ -1021,8 +1021,6 @@ function LoaderProto() {}
LoaderProto.prototype = Loader.prototype;
SystemLoader.prototype = new LoaderProto();

var baseURLCache = {};

var absURLRegEx = /^([^\/]+:\/\/|\/)/;

// Normalization with module names as absolute URLs
Expand All @@ -1033,7 +1031,7 @@ SystemLoader.prototype.normalize = function(name, parentName, parentAddress) {

// not absolute or relative -> apply paths (what will be sites)
if (!name.match(absURLRegEx) && name[0] != '.')
name = new URL(applyPaths(this, name), baseURI).href;
name = new URL(applyPaths(this.paths, name), baseURI).href;
// apply parent-relative normalization, parentAddress is already normalized
else
name = new URL(name, parentName || baseURI).href;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "es6-module-loader",
"description": "An ES6 Module Loader shim",
"version": "0.17.0",
"version": "0.17.1",
"homepage": "https://github.com/ModuleLoader/es6-module-loader",
"author": {
"name": "Guy Bedford, Luke Hoban, Addy Osmani",
Expand Down

0 comments on commit 81d0471

Please sign in to comment.