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

Commit

Permalink
canonicalized arithmetic syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jan 18, 2016
1 parent 085e1b6 commit e6896cf
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/arithmetic.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ function parseExpression(expressionString) {
if (singleModule)
moduleName = moduleName.substr(1, moduleName.length - 2);

var canonicalized = moduleName.substr(0, 1) == '`' && moduleName.substr(moduleName.length - 1, 1) == '`';
if (canonicalized)
moduleName = moduleName.substr(1, moduleName.length - 2);

operations.push({
operator: operator,
moduleName: moduleName,
singleModule: singleModule
singleModule: singleModule,
canonicalized: canonicalized
});
}

Expand Down Expand Up @@ -82,18 +87,23 @@ function expandGlobAndCanonicalize(builder, operation) {
var loader = builder.loader;

// no glob -> just canonicalize
if (operation.moduleName.indexOf('*') == -1)
if (operation.moduleName.indexOf('*') == -1) {
if (operation.canonicalized)
return [operation];

return loader.normalize(operation.moduleName)
.then(function(normalized) {
operation.moduleName = builder.getCanonicalName(normalized);
return [operation];
});
}

// globbing
var metadata = {};
var globSuffix = operation.moduleName[operation.moduleName.length - 1] == '*';
var pluginSyntax = operation.moduleName.indexOf('!') != -1;
return loader.normalize(operation.moduleName)

return Promise.resolve(operation.canonicalized ? loader.decanonicalize(operation.moduleName) : loader.normalize(operation.moduleName))
.then(function(normalized) {
// remove ALL extension adding when globbing
if (globSuffix) {
Expand Down

0 comments on commit e6896cf

Please sign in to comment.