Skip to content

Commit

Permalink
Merge pull request #183 from tropperstyle/master
Browse files Browse the repository at this point in the history
Adds support for scoped packages to the marko-taglib.json scanner
  • Loading branch information
patrick-steele-idem committed Dec 10, 2015
2 parents 5382e2f + b6ad06a commit be298e8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compiler/taglibs/taglib-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ function tryNodeModules(parent, helper) {
if ((nodeModulesDir = realpathCached(nodeModulesDir))) {
taglibsForNodeModulesDir = [];
var children = fs.readdirSync(nodeModulesDir);
// Add support for npm scoped packages
children.forEach(function(scope, index, arr) {
if (/^\@\w+$/.test(scope)) {
var scoped = fs.readdirSync(nodePath.join(nodeModulesDir, scope));
var splice = [index, 1];
scoped.forEach(function(s) { splice.push(scope + '/' + s) });
Array.prototype.splice.apply(arr, splice);
}
});
children.forEach(function(moduleDirBasename) {
// Fixes https://github.com/marko-js/marko/issues/140
// If the same node_module is found multiple times then only load the first one.
Expand Down Expand Up @@ -182,4 +191,4 @@ exports.clearCaches = function() {
existsCache = {};
findCache = {};
taglibsForNodeModulesDirCache = {};
};
};

0 comments on commit be298e8

Please sign in to comment.