Skip to content

Commit

Permalink
Merge branch 'master' into update-node-gyp-make-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer committed Dec 28, 2021
2 parents d0f027d + adc2f8b commit 89647dd
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 45 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,13 @@ jobs:
node:
- 12
- 14
- 15
- 16

include:
- node: 12
python: python2
- node: 14
python: python3
- node: 15
python: python3
- node: 16
python: python3
# Node 16 and 17 are perma-red for the tests right now
# - 16
# - 17

steps:
- name: Install Alpine build tools
run: apk add --no-cache ${{ matrix.python }} make git gcc g++
run: apk add --no-cache python3 make git gcc g++

- uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2.4.1
- uses: actions/setup-node@v2

- name: Install packages
run: npm install --unsafe-perm
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
node:
- 12
- 14
- 15
- 16
- 17

include:
- node: 12
Expand All @@ -28,21 +28,21 @@ jobs:
gcc: "gcc-6"
gpp: "g++-6"
os: ubuntu-18.04
- node: 15
gcc: "gcc-6"
gpp: "g++-6"
os: ubuntu-18.04
- node: 16
gcc: "gcc-8"
gpp: "g++-8"
os: ubuntu-18.04
- node: 17
gcc: "gcc-8"
gpp: "g++-8"
os: ubuntu-18.04


steps:
- uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.4.1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
node:
- 12
- 14
- 15
- 16
- 17

steps:
- uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.4.1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
node:
- 12
- 14
- 15
- 16
- 17

architecture:
- x64
Expand All @@ -28,16 +28,16 @@ jobs:
os: windows-2016
- node: 14
os: windows-2016
- node: 15
os: windows-2019
- node: 16
os: windows-2019
- node: 17
os: windows-2019

steps:
- uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.4.1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture }}
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Below is a quick guide for minimum and maximum supported versions of node-sass:

NodeJS | Supported node-sass version | Node Module
--------|-----------------------------|------------
Node 17 | 7.0+ | 102
Node 16 | 6.0+ | 93
Node 15 | 5.0+ | 88
Node 15 | 5.0+, <7.0 | 88
Node 14 | 4.14+ | 83
Node 13 | 4.13+, <5.0 | 79
Node 12 | 4.12+ | 72
Expand Down Expand Up @@ -595,12 +596,13 @@ When compiling a directory `--source-map` can either be a boolean value or a dir

node-sass supports different configuration parameters to change settings related to the sass binary such as binary name, binary path or alternative download path. Following parameters are supported by node-sass:

Variable name | .npmrc parameter | Process argument | Value
-----------------|------------------|--------------------|------
SASS_BINARY_NAME | sass_binary_name | --sass-binary-name | path
SASS_BINARY_SITE | sass_binary_site | --sass-binary-site | URL
SASS_BINARY_PATH | sass_binary_path | --sass-binary-path | path
SASS_BINARY_DIR | sass_binary_dir | --sass-binary-dir | path
Variable name | .npmrc parameter | Process argument | Value
-------------------------|--------------------------|----------------------------|------
SASS_BINARY_NAME | sass_binary_name | --sass-binary-name | path
SASS_BINARY_SITE | sass_binary_site | --sass-binary-site | URL
SASS_BINARY_PATH | sass_binary_path | --sass-binary-path | path
SASS_BINARY_DIR | sass_binary_dir | --sass-binary-dir | path
SASS_REJECT_UNAUTHORIZED | sass_reject_unauthorized | --sass-reject-unauthorized | value

These parameters can be used as environment variable:

Expand All @@ -614,6 +616,8 @@ As a process argument:

* E.g. `npm install node-sass --sass-binary-site=http://example.com/`

If you are using self-signed certificates for your binary then `SASS_REJECT_UNAUTHORIZED` will override (rejectUnauthorized)[https://nodejs.org/docs/latest/api/tls.html#tls_tls_createserver_options_secureconnectionlistener].

## Post-install Build

Install runs only two Mocha tests to see if your machine can use the pre-built [LibSass] which will save some time during install. If any tests fail it will build from source.
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
- nodejs_version: 14
GYP_MSVS_VERSION: 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- nodejs_version: 15
- nodejs_version: 16
GYP_MSVS_VERSION: 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- nodejs_version: 16
- nodejs_version: 17
GYP_MSVS_VERSION: 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

Expand Down
3 changes: 2 additions & 1 deletion lib/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
var eol = require('os').EOL,
fs = require('fs'),
path = require('path'),
trueCasePathSync = require('true-case-path'),
trueCasePathSync = require('true-case-path').trueCasePathSync,
pkg = require('../package.json'),
defaultBinaryDir = path.join(__dirname, '..', 'vendor');

Expand Down Expand Up @@ -81,6 +81,7 @@ function getHumanNodeVersion(abi) {
case 83: return 'Node.js 14.x';
case 88: return 'Node.js 15.x';
case 93: return 'Node.js 16.x';
case 102: return 'Node.js 17.x';
default: return false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-sass",
"version": "6.0.1",
"version": "7.0.1",
"libsass": "3.5.5",
"description": "Wrapper around libsass",
"license": "MIT",
Expand Down Expand Up @@ -63,10 +63,10 @@
"make-fetch-happen": "^9.1.0",
"meow": "^9.0.0",
"nan": "^2.13.2",
"node-gyp": "^7.1.0",
"sass-graph": "2.2.5",
"node-gyp": "^8.4.1",
"sass-graph": "4.0.0",
"stdout-stream": "^1.4.0",
"true-case-path": "^1.0.2"
"true-case-path": "^2.2.1"
},
"devDependencies": {
"eslint": "^8.0.0",
Expand Down
5 changes: 3 additions & 2 deletions scripts/util/downloadoptions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var proxy = require('./proxy'),
userAgent = require('./useragent');
userAgent = require('./useragent'),
rejectUnauthorized = require('./rejectUnauthorized');

/**
* The options passed to make-fetch-happen when downloading the binary
Expand All @@ -9,7 +10,7 @@ var proxy = require('./proxy'),
*/
module.exports = function() {
var options = {
strictSSL: false,
strictSSL: rejectUnauthorized(),
timeout: 60000,
headers: {
'User-Agent': userAgent(),
Expand Down
46 changes: 46 additions & 0 deletions scripts/util/rejectUnauthorized.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
var pkg = require('../../package.json');

/**
* Get the value of a CLI argument
*
* @param {String} name
* @param {Array} args
* @api private
*/
function getArgument(name, args) {
var flags = args || process.argv.slice(2),
index = flags.lastIndexOf(name);

if (index === -1 || index + 1 >= flags.length) {
return null;
}

return flags[index + 1];
}

/**
* Get the value of reject-unauthorized
* If environment variable SASS_REJECT_UNAUTHORIZED is non-zero,
* .npmrc variable sass_reject_unauthorized or
* process argument --sass-reject_unauthorized is provided,
* set rejectUnauthorized to true
* Else set to false by default
*
* @return {Boolean} The value of rejectUnauthorized
* @api private
*/
module.exports = function() {
var rejectUnauthorized = false;

if (getArgument('--sass-reject-unauthorized')) {
rejectUnauthorized = getArgument('--sass-reject-unauthorized');
} else if (process.env.SASS_REJECT_UNAUTHORIZED !== '0') {
rejectUnauthorized = true;
} else if (process.env.npm_config_sass_reject_unauthorized) {
rejectUnauthorized = process.env.npm_config_sass_reject_unauthorized;
} else if (pkg.nodeSassConfig && pkg.nodeSassConfig.rejectUnauthorized) {
rejectUnauthorized = pkg.nodeSassConfig.rejectUnauthorized;
}

return rejectUnauthorized;
};
48 changes: 45 additions & 3 deletions test/downloadoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('util', function() {
describe('without a proxy', function() {
it('should look as we expect', function() {
var expected = {
strictSSL: false,
strictSSL: true,
timeout: 60000,
headers: {
'User-Agent': ua(),
Expand All @@ -32,7 +32,7 @@ describe('util', function() {

it('should look as we expect', function() {
var expected = {
strictSSL: false,
strictSSL: true,
proxy: proxy,
timeout: 60000,
headers: {
Expand All @@ -57,7 +57,7 @@ describe('util', function() {

it('should look as we expect', function() {
var expected = {
strictSSL: false,
strictSSL: true,
timeout: 60000,
headers: {
'User-Agent': ua(),
Expand All @@ -67,5 +67,47 @@ describe('util', function() {
assert.deepStrictEqual(opts(), expected);
});
});

describe('with SASS_REJECT_UNAUTHORIZED set to true', function() {
beforeEach(function() {
process.env.SASS_REJECT_UNAUTHORIZED = '1';
});

it('should look as we expect', function() {
var expected = {
rejectUnauthorized: true,
timeout: 60000,
headers: {
'User-Agent': ua(),
},
encoding: null,
};

assert.deepStrictEqual(opts(), expected);
});
});

describe('with npm_config_sass_reject_unauthorized set to true', function() {
beforeEach(function() {
process.env.npm_config_sass_reject_unauthorized = true;
});

it('should look as we expect', function() {
var expected = {
rejectUnauthorized: true,
timeout: 60000,
headers: {
'User-Agent': ua(),
},
encoding: null,
};

assert.deepStrictEqual(opts(), expected);
});

afterEach(function() {
process.env.npm_config_sass_reject_unauthorized = undefined;
});
});
});
});

0 comments on commit 89647dd

Please sign in to comment.