node-sass
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
14929774
22577
12
18
+ Addedreplace-ext@0.0.1
+ Addedrequest@^2.48.0
+ Addedshelljs@^0.3.0
+ Addedreplace-ext@0.0.1(transitive)
+ Addedshelljs@0.3.0(transitive)
- Removeddownload@^3.1.2
- Removeddownload-status@^2.1.0
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedarray-find-index@1.0.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbl@0.9.51.2.3(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-crc32@0.2.13(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedcamelcase-keys@2.1.0(transitive)
- Removedchalk@1.1.3(transitive)
- Removedclone@0.2.01.0.4(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedco@3.1.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcurrently-unhandled@0.4.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddecompress-tar@2.0.2(transitive)
- Removeddecompress-tarbz2@2.0.2(transitive)
- Removeddecompress-targz@2.1.0(transitive)
- Removeddecompress-unzip@2.1.2(transitive)
- Removeddeep-extend@0.2.11(transitive)
- Removeddefaults@1.0.4(transitive)
- Removeddownload@3.3.0(transitive)
- Removeddownload-status@2.2.1(transitive)
- Removedduplexer@0.1.2(transitive)
- Removedeach-async@1.1.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedfd-slicer@1.1.0(transitive)
- Removedfind-index@0.1.1(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfirst-chunk-stream@1.0.0(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedglob@4.5.3(transitive)
- Removedglob-stream@3.1.18(transitive)
- Removedglob-watcher@0.0.6(transitive)
- Removedglob2base@0.0.12(transitive)
- Removedgraceful-fs@3.0.124.2.11(transitive)
- Removedgulp-rename@1.4.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedindent-string@2.1.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedini@1.3.8(transitive)
- Removedip-regex@1.0.3(transitive)
- Removedis-absolute@0.1.7(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-bzip2@1.0.0(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-gzip@1.0.0(transitive)
- Removedis-integer@1.0.7(transitive)
- Removedis-natural-number@2.1.1(transitive)
- Removedis-relative@0.1.3(transitive)
- Removedis-tar@1.0.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedis-zip@1.0.0(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedlongest@1.0.1(transitive)
- Removedloud-rejection@1.6.0(transitive)
- Removedlpad-align@1.1.2(transitive)
- Removedmeow@3.7.0(transitive)
- Removedminimatch@2.0.10(transitive)
- Removedminimist@0.0.10(transitive)
- Removednatives@1.1.6(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedonetime@1.1.0(transitive)
- Removedordered-read-streams@0.1.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpend@1.2.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedprogress@1.1.8(transitive)
- Removedrc@0.5.5(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedreadable-stream@1.0.341.1.142.3.8(transitive)
- Removedredent@1.0.0(transitive)
- Removedrepeating@2.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedseek-bzip@1.0.6(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-immediate-shim@1.0.1(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstream-combiner@0.2.2(transitive)
- Removedstring_decoder@0.10.311.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-bom@1.0.02.0.0(transitive)
- Removedstrip-dirs@0.1.11.1.1(transitive)
- Removedstrip-indent@1.0.1(transitive)
- Removedstrip-json-comments@0.1.3(transitive)
- Removedsum-up@1.0.3(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtar-stream@0.4.71.6.2(transitive)
- Removedthrough@2.3.8(transitive)
- Removedthrough2@0.6.5(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedtrim-newlines@1.0.0(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedunique-stream@1.0.0(transitive)
- Removedurl-regex@2.1.3(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedvinyl@0.4.6(transitive)
- Removedvinyl-fs@0.3.14(transitive)
- Removedware@1.3.0(transitive)
- Removedwrap-fn@0.1.5(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
- Removedyauzl@2.10.0(transitive)