Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function resolvers(options, webpackResolver) {
var evaluator = new Evaluator(nodes.null, options);
var whenWebpackResolver = whenNodefn.lift(webpackResolver);
return [
// Stylus's normal resolver for single files.
function(context, path) {
// Stylus adds .styl to paths for normal "paths" lookup if it isn't there.
if (!/.styl$/.test(path)) {
path += '.styl';
}
var found = utils.find(path, options.paths, options.filename)
if (found) {
return normalizePaths(found);
}
},
// Stylus's normal resolver for node_modules packages. Cannot locate paths
// inside a package.
function resolvers(options, webpackResolver) {
var evaluator = new Evaluator(nodes.null, options);
var whenWebpackResolver = whenNodefn.lift(webpackResolver);
// Stylus's normal resolver for single files.
var stylusFile = function(context, path) {
// Stylus adds .styl to paths for normal "paths" lookup if it isn't there.
if (!/.styl$/.test(path)) {
path += '.styl';
}
var paths = options.paths.concat(context);
var found = utils.find(path, paths, options.filename)
if (found) {
return normalizePaths(found);
}
};
function importFile(node, file, literal, index) {
var importStack = this.importStack,
Parser = require("stylus/lib/parser"),
stat
// Handling the `require`
if (node.once) {
if (this.requireHistory[file]) return nodes.null
this.requireHistory[file] = true
if (literal && !this.includeCSS) {
return node
}
}
// Expose imports
node.path = file
node.dirname = path.dirname(file)
// Store the modified time
stat = fs.statSync(file)
node.mtime = stat.mtime
this.paths.push(node.dirname)
// Avoid overflows from importing the same file over again
if (literal && !this.includeCSS) {
return node;
}
}
// Expose imports
node.path = file;
node.dirname = dirname(file);
// Store the modified time
stat = fs.statSync(file);
node.mtime = stat.mtime;
this.paths.push(node.dirname);
// Avoid overflows from importing the same file over again
if (file === importStack[importStack.length - 1]) return nodes.null;
if (this.options._imports) this.options._imports.push(node.clone());
// Parse the file
importStack.push(file);
nodes.filename = file;
var str;
if (this.cache.sources && this.cache.sources[file]) {
str = this.cache.sources[file];
} else {
str = fs.readFileSync(file, 'utf8');
}
if (literal && !this.resolveURL) return new nodes.Literal(str.replace(/\r\n?/g, '\n'));
style.define('deprecate', function (msg) {
const parentSel = last(this.selectorStack)[0]
console.log(chalk.yellow('\nDeprecation: ' + parentSel.filename + ':' + parentSel.lineno + '\n' + msg.val))
return nodes.null
})
}