Socket
Socket
Sign inDemoInstall

node-sass

Package Overview
Dependencies
Maintainers
5
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 1.2.2 to 1.2.3

3

lib/index.js

@@ -11,4 +11,3 @@ var fs = require('fs'),

function getBinding() {
var v8 = 'v8-' + /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0];
var name = process.platform + '-' + process.arch + '-' + v8;
var name = process.platform + '-' + process.arch;
var candidates = [

@@ -15,0 +14,0 @@ path.join(__dirname, '..', 'build', 'Release', 'binding.node'),

{
"name": "node-sass",
"version": "1.2.2",
"version": "1.2.3",
"description": "Wrapper around libsass",

@@ -47,4 +47,2 @@ "license": "MIT",

"cross-spawn": "^0.2.3",
"download": "^3.1.2",
"download-status": "^2.1.0",
"gaze": "^0.5.1",

@@ -56,3 +54,6 @@ "get-stdin": "^3.0.0",

"nan": "^1.3.0",
"object-assign": "^1.0.0"
"object-assign": "^1.0.0",
"replace-ext": "0.0.1",
"request": "^2.48.0",
"shelljs": "^0.3.0"
},

@@ -59,0 +60,0 @@ "devDependencies": {

@@ -85,4 +85,3 @@ var fs = require('fs'),

arch: process.arch,
platform: process.platform,
v8: /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0]
platform: process.platform
};

@@ -114,46 +113,45 @@

function testBinary(options) {
options.bin = [
options.platform + '-' + options.arch,
'-v8-' + options.v8
].join('');
options.bin = options.platform + '-' + options.arch;
if (options.force) {
if (options.force || process.env.SASS_FORCE_BUILD) {
return build(options);
}
if (!process.env.SKIP_NODE_SASS_TESTS) {
fs.stat(path.join(__dirname, '..', 'vendor', options.bin, 'binding.node'), function (err) {
if (err) {
return build(options);
}
if (process.env.SKIP_NODE_SASS_TESTS) {
return;
}
console.log('`' + options.bin + '` exists; testing');
fs.stat(path.join(__dirname, '..', 'vendor', options.bin, 'binding.node'), function (err) {
if (err) {
return build(options);
}
var total;
var failures;
var mocha = new Mocha({
ui: 'bdd',
timeout: 999999,
reporter: function(stats) {
total = stats.total;
failures = stats.failures;
}
});
console.log('`' + options.bin + '` exists; testing');
mocha.addFile(path.resolve(__dirname, '..', 'test', 'api.js'));
mocha.run(function () {
if ((total - failures) * 100 / total < 90) {
console.log([
'Problem with the binary: ' + failures + ' of ' + total + ' tests are failing.',
'Manual build incoming.',
'Please consider contributing the release binary to https://github.com/sass/node-sass-binaries for npm distribution.'
].join('\n'));
var total;
var failures;
var mocha = new Mocha({
ui: 'bdd',
timeout: 999999,
reporter: function(stats) {
total = stats.total;
failures = stats.failures;
}
});
return build(options);
}
mocha.addFile(path.resolve(__dirname, '..', 'test', 'api.js'));
mocha.run(function () {
if ((total - failures) * 100 / total < 90) {
console.log([
'Problem with the binary: ' + failures + ' of ' + total + ' tests are failing.',
'Manual build incoming.',
'Please consider contributing the release binary to https://github.com/sass/node-sass-binaries for npm distribution.'
].join('\n'));
console.log('Binary is fine; exiting');
});
return build(options);
}
console.log('Binary is fine; exiting');
});
}
});
}

@@ -160,0 +158,0 @@

var fs = require('fs'),
path = require('path'),
Download = require('download'),
status = require('download-status');
request = require('request'),
mkdirp = require('mkdirp'),
exec = require('shelljs').exec;
/**
* Download file, if succeeds save, if not delete
*
* @param {String} url
* @param {String} dest
* @param {function} cb
* @api private
*/
function download(url, dest, cb) {
var file = fs.createWriteStream(dest);
var options = { proxy: getProxy() };
var returnError = function(err) {
fs.unlink(dest);
cb(typeof err.message === 'string' ? err.message : err);
};
var req = request.get(url, options).on('response', function(response) {
if (response.statusCode < 200 || response.statusCode >= 300) {
returnError('Can not download file from ' + url);
return;
}
response.pipe(file);
file.on('finish', function() {
file.close(cb);
});
}).on('error', returnError);
req.end();
req.on('error', returnError);
};
/**
* Get proxy settings
*
* @api private
*/
function getProxy() {
var result;
['https-proxy', 'proxy', 'http-proxy'].map(function(config) {
var proxy = exec('npm config get ' + config, {silent: true});
var output = proxy.output.trim();
if (proxy.code === 0 && output !== 'undefined' && output !== 'null') {
result = proxy.output;
return;
}
});
if (result) {
return result;
}
var env = process.env;
return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy
}
/**
* Check if binaries exists

@@ -13,4 +73,3 @@ *

function exists() {
var v8 = 'v8-' + /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0];
var name = process.platform + '-' + process.arch + '-' + v8;
var name = process.platform + '-' + process.arch;

@@ -34,8 +93,2 @@ fs.exists(path.join(__dirname, '..', 'vendor', name), function (exists) {

function fetch(name) {
var download = new Download({
extract: true,
mode: '777',
strip: 1
});
var url = [

@@ -46,14 +99,19 @@ 'https://raw.githubusercontent.com/sass/node-sass-binaries/v',

].join('');
var dir = path.join(__dirname, '..', 'vendor', name);
var dest = path.join(dir, 'binding.node');
download.get(url);
download.dest(path.join(__dirname, '..', 'vendor', name));
download.use(status());
download.run(function(err) {
mkdirp(dir, function(err) {
if (err) {
console.error(err.message);
console.error(err);
return;
}
console.log('Binary installed in ' + download.dest());
download(url, dest, function(err) {
if (err) {
console.error(err);
return;
}
console.log('Binary downloaded and installed at ' + dest);
});
});

@@ -66,3 +124,3 @@ }

if (process.env.CI || process.env.APPVEYOR) {
if (process.env.SKIP_SASS_BINARY_DOWNLOAD_FOR_CI) {
console.log('Skipping downloading binaries on CI builds');

@@ -69,0 +127,0 @@ return;

@@ -184,2 +184,22 @@ var assert = require('assert'),

});
it('should contain all included files in stats when data is passed', function(done) {
var src = fixture('include-files/index.scss');
var stats = {};
var expected = [
fixture('include-files/bar.scss').replace(/\\/g, '/'),
fixture('include-files/foo.scss').replace(/\\/g, '/'),
'stdin'
];
sass.render({
data: read(src, 'utf8'),
includePaths: [fixture('include-files')],
stats: stats,
success: function() {
assert.deepEqual(stats.includedFiles, expected);
done();
}
});
});
});

@@ -360,5 +380,3 @@

assert.equal(stats.includedFiles[0], expected[0]);
assert.equal(stats.includedFiles[1], expected[1]);
assert.equal(stats.includedFiles[2], expected[2]);
assert.deepEqual(stats.includedFiles, expected);
done();

@@ -365,0 +383,0 @@ });

@@ -25,16 +25,2 @@ var assert = require('assert'),

it('should write to disk when using --output', function(done) {
var src = fs.createReadStream(fixture('simple/index.scss'));
var dest = fixture('simple/build.css');
var bin = spawn(cli, ['--output', dest]);
bin.on('close', function() {
assert(fs.existsSync(dest));
fs.unlinkSync(dest);
done();
});
src.pipe(bin.stdin);
});
it('should compile sass using the --indented-syntax option', function(done) {

@@ -167,2 +153,27 @@ var src = fs.createReadStream(fixture('indent/index.sass'));

});
it('should render all watched files', function(done) {
fs.writeFileSync(fixture('simple/foo.scss'), '');
fs.writeFileSync(fixture('simple/bar.scss'), '');
var src = fixture('simple/foo.scss');
var watched = fixture('simple/bar.scss');
var bin = spawn(cli, [
src, '--stdout', '--watch', watched,
'--output-style', 'compressed'
]);
bin.stdout.setEncoding('utf8');
bin.stdout.on('data', function(data) {
assert(data.trim() === 'body{background:white}');
bin.kill();
fs.unlinkSync(src);
fs.unlinkSync(watched);
done();
});
setTimeout(function() {
fs.appendFileSync(watched, 'body{background:white}');
}, 500);
});
});

@@ -173,4 +184,4 @@

var src = fixture('simple/index.scss');
var dest = fixture('simple/build.css');
var bin = spawn(cli, [src, '--output', dest]);
var dest = fixture('simple/index.css');
var bin = spawn(cli, [src, '--output', path.dirname(dest)]);

@@ -186,6 +197,6 @@ bin.on('close', function() {

var src = fixture('source-map/index.scss');
var dest = fixture('source-map/build.css');
var dest = fixture('source-map/index.css');
var expected = read(fixture('source-map/expected.css'), 'utf8').trim().replace(/\r\n/g, '\n');
var map = fixture('source-map/index.map');
var bin = spawn(cli, [src, '--output', dest, '--source-map', map]);
var bin = spawn(cli, [src, '--output', path.dirname(dest), '--source-map', map]);

@@ -203,5 +214,8 @@ bin.on('close', function () {

var src = fixture('source-map/index.scss');
var dest = fixture('source-map/build.css');
var dest = fixture('source-map/index.css');
var map = fixture('source-map/index.map');
var bin = spawn(cli, [src, '--output', dest, '--source-map', map, '--omit-source-map-url']);
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--source-map', map, '--omit-source-map-url'
]);

@@ -208,0 +222,0 @@ bin.on('close', function () {

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