Socket
Socket
Sign inDemoInstall

node-sass

Package Overview
Dependencies
Maintainers
7
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-sass - npm Package Compare versions

Comparing version 3.5.0-beta.1 to 3.5.1

lib/errors.js

158

lib/extensions.js

@@ -5,10 +5,72 @@ /*!

var flags = {},
var eol = require('os').EOL,
fs = require('fs'),
pkg = require('../package.json'),
path = require('path');
path = require('path'),
defaultBinaryPath = path.join(__dirname, '..', 'vendor');
function getHumanPlatform(arg) {
switch (arg || process.platform) {
case 'darwin': return 'OS X';
case 'freebsd': return 'FreeBSD';
case 'linux': return 'Linux';
case 'win32': return 'Windows';
default: return false;
}
}
function getHumanArchitecture(arg) {
switch (arg || process.arch) {
case 'ia32': return '32-bit';
case 'x86': return '32-bit';
case 'x64': return '64-bit';
default: return false;
}
}
function getHumanNodeVersion(arg) {
switch (parseInt(arg || process.versions.modules, 10)) {
case 11: return 'Node 0.10.x';
case 14: return 'Node 0.12.x';
case 42: return 'io.js 1.x';
case 43: return 'io.js 1.1.x';
case 44: return 'io.js 2.x';
case 45: return 'io.js 3.x';
case 46: return 'Node.js 4.x';
case 47: return 'Node.js 5.x';
default: return false;
}
}
function getHumanEnvironment(env) {
var parts = env.replace(/_binding\.node$/, '').split('-');
if (parts.length !== 3) {
return 'Unknown environment';
}
return [
getHumanPlatform(parts[0]),
getHumanArchitecture(parts[1]),
'with',
getHumanNodeVersion(parts[2]),
].join(' ');
}
function getInstalledBinaries() {
return fs.readdirSync(defaultBinaryPath);
}
function isSupportedEnvironment() {
return (
false !== getHumanPlatform() &&
false !== getHumanArchitecture() &&
false !== getHumanNodeVersion()
);
}
/**
* Collect Arguments
* Get the value of a CLI argument
*
* @param {String} name
* @param {Array} args

@@ -18,11 +80,11 @@ * @api private

function collectArguments(args) {
for (var i = 0; i < args.length; i += 2) {
if (args[i].lastIndexOf('--', 0) !== 0) {
--i;
continue;
}
function getArgument(name, args) {
var flags = args || process.argv.slice(2),
index = flags.lastIndexOf(name);
flags[args[i]] = args[i + 1];
if (index === -1 || index + 1 >= flags.length) {
return null;
}
return flags[index + 1];
}

@@ -38,3 +100,3 @@

*
* @api private
* @api public
*/

@@ -45,4 +107,4 @@

if (flags['--sass-binary-name']) {
binaryName = flags['--sass-binary-name'];
if (getArgument('--sass-binary-name')) {
binaryName = getArgument('--sass-binary-name');
} else if (process.env.SASS_BINARY_NAME) {

@@ -70,3 +132,3 @@ binaryName = process.env.SASS_BINARY_NAME;

* the environment variable SASS_BINARY_SITE,
* .npmrc variable sass_binary_site or
* .npmrc variable sass_binary_site or
* or a command line option --sass-binary-site:

@@ -89,7 +151,7 @@ *

*
* @api private
* @api public
*/
function getBinaryUrl() {
var site = flags['--sass-binary-site'] ||
var site = getArgument('--sass-binary-site') ||
process.env.SASS_BINARY_SITE ||

@@ -100,13 +162,5 @@ process.env.npm_config_sass_binary_site ||

return [site, 'v' + pkg.version, sass.binaryName].join('/');
return [site, 'v' + pkg.version, getBinaryName()].join('/');
}
collectArguments(process.argv.slice(2));
var sass = process.sass = {};
sass.binaryName = getBinaryName();
sass.binaryUrl = getBinaryUrl();
/**

@@ -123,11 +177,10 @@ * Get binary path.

*
* @param {Boolean} throwIfNotExists
* @api private
* @api public
*/
sass.getBinaryPath = function(throwIfNotExists) {
function getBinaryPath() {
var binaryPath;
if (flags['--sass-binary-path']) {
binaryPath = flags['--sass-binary-path'];
if (getArgument('--sass-binary-path')) {
binaryPath = getArgument('--sass-binary-path');
} else if (process.env.SASS_BINARY_PATH) {

@@ -140,16 +193,39 @@ binaryPath = process.env.SASS_BINARY_PATH;

} else {
binaryPath = path.join(__dirname, '..', 'vendor', sass.binaryName.replace(/_/, '/'));
binaryPath = path.join(defaultBinaryPath, getBinaryName().replace(/_/, '/'));
}
if (!fs.existsSync(binaryPath) && throwIfNotExists) {
throw new Error([
['The `libsass` binding was not found in', binaryPath].join(' '),
['This usually happens because your node version has changed.'],
['Run `npm rebuild node-sass` to build the binding for your current node version.'],
].join('\n'));
}
return binaryPath;
};
}
sass.binaryPath = sass.getBinaryPath();
/**
* Does the supplied binary path exist
*
* @param {String} binaryPath
* @api public
*/
function hasBinary(binaryPath) {
return fs.existsSync(binaryPath);
}
/**
* Get Sass version information
*
* @api public
*/
function getVersionInfo(binding) {
return [
['node-sass', pkg.version, '(Wrapper)', '[JavaScript]'].join('\t'),
['libsass ', binding.libsassVersion(), '(Sass Compiler)', '[C/C++]'].join('\t'),
].join(eol);
}
module.exports.hasBinary = hasBinary;
module.exports.getBinaryUrl = getBinaryUrl;
module.exports.getBinaryName = getBinaryName;
module.exports.getBinaryPath = getBinaryPath;
module.exports.getVersionInfo = getVersionInfo;
module.exports.getHumanEnvironment = getHumanEnvironment;
module.exports.getInstalledBinaries = getInstalledBinaries;
module.exports.isSupportedEnvironment = isSupportedEnvironment;

@@ -5,9 +5,16 @@ /*!

var eol = require('os').EOL,
path = require('path'),
var path = require('path'),
util = require('util'),
pkg = require('../package.json');
errors = require('./errors'),
sass = require('./extensions');
require('./extensions');
if (!sass.hasBinary(sass.getBinaryPath())) {
if (!sass.isSupportedEnvironment()) {
throw new Error(errors.unsupportedEnvironment());
} else {
throw new Error(errors.missingBinary());
}
}
/**

@@ -17,18 +24,5 @@ * Require binding

var binding = require(process.sass.getBinaryPath(true));
var binding = require(sass.getBinaryPath());
/**
* Get Sass version information
*
* @api private
*/
function getVersionInfo(binding) {
return [
['node-sass', pkg.version, '(Wrapper)', '[JavaScript]'].join('\t'),
['libsass ', binding.libsassVersion(), '(Sass Compiler)', '[C/C++]'].join('\t'),
].join(eol);
}
/**
* Get input file

@@ -348,3 +342,3 @@ *

var result = tryCallback(cb.callback, args.concat(done));
var result = tryCallback(cb.callback.bind(options.context), args.concat(done));

@@ -406,3 +400,3 @@ if (result) {

options.functions[cb.signature] = function() {
return tryCallback(cb.callback, arguments);
return tryCallback(cb.callback.bind(options.context), arguments);
};

@@ -437,4 +431,3 @@ });

process.sass.versionInfo = getVersionInfo(binding);
module.exports.info = process.sass.versionInfo;
module.exports.info = sass.getVersionInfo(binding);

@@ -449,1 +442,19 @@ /**

module.exports.NULL = binding.types.Null.NULL;
/**
* Polyfill the old API
*
* TODO: remove for 4.0
*/
function processSassDeprecationMessage() {
console.log('Deprecation warning: `process.sass` is an undocumented internal that will be removed in future versions of Node Sass.');
}
process.sass = process.sass || {
get versionInfo() { processSassDeprecationMessage(); return module.exports.info; },
get binaryName() { processSassDeprecationMessage(); return sass.getBinaryName(); },
get binaryUrl() { processSassDeprecationMessage(); return sass.getBinaryUrl(); },
get binaryPath() { processSassDeprecationMessage(); return sass.getBinaryPath(); },
get getBinaryPath() { processSassDeprecationMessage(); return sass.getBinaryPath; },
};
{
"name": "node-sass",
"version": "3.5.0-beta.1",
"libsass": "3.3.3",
"version": "3.5.1",
"libsass": "3.3.5",
"description": "Wrapper around libsass",
"license": "MIT",
"bugs": "https://github.com/sass/node-sass/issues",
"homepage": "https://github.com/sass/node-sass",

@@ -34,3 +35,4 @@ "repository": {

"test": "node_modules/.bin/mocha test",
"build": "node scripts/build.js --force"
"build": "node scripts/build.js --force",
"prepublish": "not-in-install && node scripts/prepublish.js || in-install"
},

@@ -42,3 +44,4 @@ "files": [

"scripts",
"src"
"src",
"vendor"
],

@@ -56,22 +59,22 @@ "keywords": [

"chalk": "^1.1.1",
"cross-spawn": "^2.0.0",
"gaze": "^0.5.1",
"cross-spawn-async": "^2.1.9",
"gaze": "^1.0.0",
"get-stdin": "^4.0.1",
"glob": "^6.0.2",
"got": "^5.4.1",
"meow": "^3.3.0",
"glob": "^7.0.3",
"got": "^5.5.0",
"meow": "^3.7.0",
"in-publish": "^2.0.0",
"mkdirp": "^0.5.1",
"nan": "^2.0.8",
"node-gyp": "^3.0.1",
"npmconf": "^2.1.2",
"sass-graph": "^2.0.1"
"nan": "^2.2.0",
"node-gyp": "^3.3.1",
"sass-graph": "^2.1.1"
},
"devDependencies": {
"coveralls": "^2.11.4",
"istanbul": "^0.4.1",
"jshint": "^2.8.0",
"mocha": "^2.3.4",
"mocha-lcov-reporter": "^1.0.0",
"rimraf": "^2.4.2"
"coveralls": "^2.11.8",
"istanbul": "^0.4.2",
"jshint": "^2.9.1",
"mocha": "^2.4.5",
"mocha-lcov-reporter": "^1.2.0",
"rimraf": "^2.5.2"
}
}

@@ -107,3 +107,3 @@ # node-sass

* importer can be an array of functions, which will be called by LibSass in the order of their occurrence in array. This helps user specify special importer for particular kind of path (filesystem, http). If an importer does not want to handle a particular path, it should return `sass.NULL`. See [functions section](#functions--v300) for more details on Sass types.
* importer can be an array of functions, which will be called by LibSass in the order of their occurrence in array. This helps user specify special importer for particular kind of path (filesystem, http). If an importer does not want to handle a particular path, it should return `null`. See [functions section](#functions--v300) for more details on Sass types.

@@ -474,3 +474,3 @@ ### functions (>= v3.0.0) - _experimental_

Output will be saved with the same name as input Sass file into the current working directory if the `--output` flag is omitted.
Output will be sent to stdout if the `--output` flag is omitted.

@@ -481,2 +481,6 @@ ### Usage

Example:
`node-sass src/style.scss dest/style.css`
**Options:**

@@ -483,0 +487,0 @@

@@ -10,6 +10,5 @@ /*!

path = require('path'),
spawn = require('cross-spawn');
spawn = require('cross-spawn-async'),
sass = require('../lib/extensions');
require('../lib/extensions');
/**

@@ -23,3 +22,3 @@ * After build

function afterBuild(options) {
var install = process.sass.binaryPath;
var install = sass.getBinaryPath();
var target = path.join(__dirname, '..', 'build',

@@ -47,3 +46,3 @@ options.debug ? 'Debug' : process.config.target_defaults.default_configuration,

console.log('Installed in `', install, '`');
console.log('Installed in "' + install + '"');
});

@@ -203,9 +202,7 @@ });

try {
process.sass.getBinaryPath(true);
} catch (e) {
if (!sass.hasBinary(sass.getBinaryPath())) {
return build(options);
}
console.log('`', process.sass.binaryPath, '` exists.', eol, 'testing binary.');
console.log('"' + sass.getBinaryPath() + '" exists.', eol, 'testing binary.');

@@ -219,3 +216,3 @@ try {

} catch (e) {
console.log(['Problem with the binary.', 'Manual build incoming.'].join(eol));
console.log(['Problem with the binary:', e, 'Manual build incoming.'].join(eol));

@@ -222,0 +219,0 @@ return build(options);

@@ -8,9 +8,7 @@ /*!

mkdir = require('mkdirp'),
npmconf = require('npmconf'),
path = require('path'),
got = require('got'),
pkg = require('../package.json');
pkg = require('../package.json'),
sass = require('../lib/extensions');
require('../lib/extensions');
/**

@@ -67,21 +65,13 @@ * Download file, if succeeds save, if not delete

function applyProxy(options, cb) {
npmconf.load({}, function (er, conf) {
var proxyUrl;
var env = process.env;
if (!er) {
proxyUrl = conf.get('https-proxy') ||
conf.get('proxy') ||
conf.get('http-proxy');
}
options.proxy = env.npm_config_https_proxy ||
env.npm_config_proxy ||
env.npm_config_http_proxy ||
env.HTTPS_PROXY ||
env.https_proxy ||
env.HTTP_PROXY ||
env.http_proxy;
var env = process.env;
options.proxy = proxyUrl ||
env.HTTPS_PROXY ||
env.https_proxy ||
env.HTTP_PROXY ||
env.http_proxy;
cb(options);
});
cb(options);
}

@@ -96,8 +86,7 @@

function checkAndDownloadBinary() {
try {
process.sass.getBinaryPath(true);
if (sass.hasBinary(sass.getBinaryPath())) {
return;
} catch (e) { }
}
mkdir(path.dirname(process.sass.binaryPath), function(err) {
mkdir(path.dirname(sass.getBinaryPath()), function(err) {
if (err) {

@@ -108,3 +97,3 @@ console.error(err);

download(process.sass.binaryUrl, process.sass.binaryPath, function(err) {
download(sass.getBinaryUrl(), sass.getBinaryPath(), function(err) {
if (err) {

@@ -115,3 +104,3 @@ console.error(err);

console.log('Binary downloaded and installed at', process.sass.binaryPath);
console.log('Binary downloaded and installed at', sass.getBinaryPath());
});

@@ -131,5 +120,5 @@ });

/**
* If binary does not exsit, download it
* If binary does not exist, download it
*/
checkAndDownloadBinary();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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