Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

less-loader

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

less-loader - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

stringify.loader.js

49

index.js

@@ -17,4 +17,10 @@ /*

var errored = false;
less.Parser.importer = function (file, paths, callback, env) {
var context = path.dirname(env._parentFilename || env.filename);
less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
var newFileInfo = {
relativeUrls: env.relativeUrls,
entryPath: currentFileInfo.entryPath,
rootpath: currentFileInfo.rootpath,
rootFilename: currentFileInfo.rootFilename
};
var context = currentFileInfo.currentDirectory;
var moduleName = urlToRequire(file)

@@ -29,22 +35,14 @@ if(cb) {

}
loaderContext.dependency && loaderContext.dependency(filename);
newFileInfo.filename = filename;
newFileInfo.currentDirectory = path.dirname(filename);
// The default (asynchron)
fs.readFile(filename, 'utf-8', function(e, data) {
if (e) return callback(e);
loaderContext.loadModule("-!" + __dirname + "/stringify.loader.js!" + filename, function(err, data) {
if(err) {
if(!errored)
loaderContext.callback(err);
errored = true;
return;
}
try {
new(less.Parser)({
_parentFilename: filename,
paths: [],
compress: env.compress
}).parse(data, function (e, root) {
callback(e, root, data);
});
} catch(e) {
try {
callback(e);
} catch(e) {
loaderContext.callback(formatLessError(e, filename));
}
}
callback(null, JSON.parse(data), filename, newFileInfo);
});

@@ -54,12 +52,9 @@ });

var filename = loaderContext.resolveSync(context, moduleName);
loaderContext.dependency && loaderContext.dependency(filename);
newFileInfo.filename = filename;
newFileInfo.currentDirectory = path.dirname(filename);
// Make it synchron
try {
var data = fs.readFileSync(filename, 'utf-8');
new(less.Parser)({
_parentFilename: filename,
paths: [],
compress: env.compress
}).parse(data, function (e, root) {
callback(e, root, data);
});
callback(null, data, filename, newFileInfo);
} catch(e) {

@@ -66,0 +61,0 @@ try {

{
"name": "less-loader",
"version": "0.6.0",
"version": "0.6.1",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "less loader module for webpack",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc