New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browserify-css

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-css - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

examples/deduped-modules/package.json

52

css-transform.js

@@ -9,2 +9,3 @@ 'use strict';

var concat = require('concat-stream');
var findNodeModules = require('find-node-modules');

@@ -23,34 +24,27 @@ var isExternalURL = function(path) {

// Resolves the import path that starts with node_modules.
// Finds the the import path from parent node_modules.
// @see {@link https://github.com/cheton/browserify-css/pull/21} for further information.
var resolveNodeModuleDir = function(baseDir, importPath) {
var findImportPathInNodeModules = function(baseDir, importPath) {
var parts = importPath.split('/');
var resolvePath = baseDir;
var modulePath = '';
var pathname = path.join(baseDir, importPath);
if (parts[0] === 'node_modules') {
modulePath = _.rest(parts).join('/'); // Gets all but the first element of array
// Gets all but the first element of array (i.e. node_modules).
importPath = _.rest(parts).join('/');
}
if (!modulePath) {
return path.join(baseDir, importPath);
}
// Returns an array of all parent node_modules directories.
var dirs = findNodeModules({
cwd: baseDir,
relative: false
});
resolvePath = path.join(resolvePath, 'node_modules');
while (1) {
if (fs.existsSync(path.join(resolvePath, modulePath))) {
return path.join(resolvePath, modulePath);
_.forEach(dirs, function(dir) {
if (fs.existsSync(path.join(dir, importPath))) {
pathname = path.join(dir, importPath);
return false; // Exits iteration by returning false.
}
});
resolvePath = path.resolve(resolvePath, '..');
// move up the chain until we are no longer in a node module
if (!(resolvePath.match(/node_modules/))) {
break;
}
}
return path.join(baseDir, importPath);
return pathname;
};

@@ -152,3 +146,3 @@

var dirname = path.dirname(filename);
var absFilename;
var pathname;

@@ -158,14 +152,14 @@ // if the path starts with node_modules, search up the tree to find the module

if (isNodeModulePath(url)) {
absFilename = resolveNodeModuleDir(dirname, url);
pathname = findImportPathInNodeModules(dirname, url);
} else if (isRelativePath(url)) { // relative path
absFilename = path.resolve(dirname, url);
pathname = path.resolve(dirname, url);
} else { // absolute path
absFilename = path.join(rootDir, url);
pathname = path.join(rootDir, url);
}
if (that && typeof that.emit === 'function') {
that.emit('file', absFilename);
that.emit('file', pathname);
}
parseCSSFile(absFilename);
parseCSSFile(pathname);

@@ -172,0 +166,0 @@ } else {

{
"name": "browserify-css",
"version": "0.8.0",
"version": "0.8.1",
"description": "A Browserify transform for bundling, rebasing, inlining, and minifying CSS files",

@@ -33,2 +33,3 @@ "main": "./index.js",

"css": "1.6.x",
"find-node-modules": "^1.0.1",
"lodash": "3.6.x",

@@ -35,0 +36,0 @@ "through2": "0.6.x"

Sorry, the diff of this file is too big to display

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