stylus-loader
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -12,3 +12,3 @@ var loaderUtils = require('loader-utils'); | ||
var globalImportsCache = {}; | ||
var globalImportsCaches = {}; | ||
@@ -23,3 +23,4 @@ module.exports = function(source) { | ||
var stylusOptions = this.options.stylus || {}; | ||
var configKey = options.config || 'stylus'; | ||
var stylusOptions = this.options[configKey] || {}; | ||
// Instead of assigning to options, we run them manually later so their side effects apply earlier for | ||
@@ -86,3 +87,4 @@ // resolving paths. | ||
} else { | ||
importsCache = globalImportsCache; | ||
if(!globalImportsCaches[configKey]) globalImportsCaches[configKey] = {}; | ||
importsCache = globalImportsCaches[configKey]; | ||
} | ||
@@ -89,0 +91,0 @@ } |
@@ -145,4 +145,5 @@ // Except for a block in #visitImport, everything here is an exact copy of the | ||
// Lookup | ||
found = this.cache.find(path, this.filename); | ||
index = this.cache.isIndex(path, this.filename); | ||
var dirname = this.paths[this.paths.length - 1]; | ||
found = this.cache.find(path, dirname); | ||
index = this.cache.isIndex(path, dirname); | ||
if (!found) { | ||
@@ -149,0 +150,0 @@ found = utils.find(path, this.paths, this.filename); |
@@ -28,5 +28,5 @@ var path = require('path'); | ||
this.simpleContext = {}; | ||
for (var filename in this.contexts) { | ||
for (var path in this.contexts[filename]) { | ||
this.simpleContext[path] = this.contexts[filename][path]; | ||
for (var dirname in this.contexts) { | ||
for (var path in this.contexts[dirname]) { | ||
this.simpleContext[path] = this.contexts[dirname][path]; | ||
} | ||
@@ -48,5 +48,5 @@ } | ||
// Lookup the path in this cache. | ||
PathCache.prototype.find = function(path, filename) { | ||
if (this.contexts[filename] && this.contexts[filename][path]) { | ||
return this.contexts[filename][path].path; | ||
PathCache.prototype.find = function(path, dirname) { | ||
if (this.contexts[dirname] && this.contexts[dirname][path]) { | ||
return this.contexts[dirname][path].path; | ||
} else if (this.simpleContext[path]) { | ||
@@ -58,3 +58,3 @@ return this.simpleContext[path].path; | ||
// looked for it without .styl. | ||
return this.find(path.replace(/.styl$/, ''), filename); | ||
return this.find(path.replace(/.styl$/, ''), dirname); | ||
} else { | ||
@@ -66,5 +66,5 @@ return undefined; | ||
// Return if the path in this cache is an index file. | ||
PathCache.prototype.isIndex = function(path, filename) { | ||
if (this.contexts[filename] && this.contexts[filename][path]) { | ||
return this.contexts[filename][path].index; | ||
PathCache.prototype.isIndex = function(path, dirname) { | ||
if (this.contexts[dirname] && this.contexts[dirname][path]) { | ||
return this.contexts[dirname][path].index; | ||
} else { | ||
@@ -78,6 +78,6 @@ return undefined; | ||
var deps = []; | ||
for (var filename in this.contexts) { | ||
for (var path in this.contexts[filename]) { | ||
if (this.contexts[filename][path]) { | ||
deps = deps.concat(this.contexts[filename][path].path); | ||
for (var dirname in this.contexts) { | ||
for (var path in this.contexts[dirname]) { | ||
if (this.contexts[dirname][path]) { | ||
deps = deps.concat(this.contexts[dirname][path].path); | ||
} | ||
@@ -213,3 +213,3 @@ } | ||
// but different deps. | ||
contexts[fullPath] = newPaths; | ||
contexts[context] = merge(contexts[context] || {}, newPaths); | ||
return when.map(Object.keys(newPaths), function(key) { | ||
@@ -262,2 +262,10 @@ var found = newPaths[key] && newPaths[key].path; | ||
function merge(a, b) { | ||
var key; | ||
for (key in b) { | ||
a[key] = b[key]; | ||
} | ||
return a; | ||
} | ||
function partial(fn) { | ||
@@ -264,0 +272,0 @@ var args = slice(arguments, 1); |
{ | ||
"name": "stylus-loader", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Stylus loader for webpack", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30710
8
682