Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
5521bb6b
Commit
5521bb6b
authored
Dec 18, 2016
by
Lachlan Donald
Committed by
Michael Mifsud
Dec 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a platform variant for installing a musl binary (#1836)
Add a platform variant for installing a musl binary
parent
3c17b033
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
3 deletions
+41
-3
extensions.js
lib/extensions.js
+41
-3
No files found.
lib/extensions.js
View file @
5521bb6b
...
...
@@ -23,6 +23,7 @@ function getHumanPlatform(platform) {
case
'darwin'
:
return
'OS X'
;
case
'freebsd'
:
return
'FreeBSD'
;
case
'linux'
:
return
'Linux'
;
case
'linux_musl'
:
return
'Linux/musl'
;
case
'win32'
:
return
'Windows'
;
default
:
return
false
;
}
...
...
@@ -171,7 +172,9 @@ function getArgument(name, args) {
*/
function
getBinaryName
()
{
var
binaryName
;
var
binaryName
,
variant
,
platform
=
process
.
platform
;
if
(
getArgument
(
'--sass-binary-name'
))
{
binaryName
=
getArgument
(
'--sass-binary-name'
);
...
...
@@ -182,8 +185,13 @@ function getBinaryName() {
}
else
if
(
pkg
.
nodeSassConfig
&&
pkg
.
nodeSassConfig
.
binaryName
)
{
binaryName
=
pkg
.
nodeSassConfig
.
binaryName
;
}
else
{
variant
=
getPlatformVariant
();
if
(
variant
)
{
platform
+=
'_'
+
variant
;
}
binaryName
=
[
p
rocess
.
p
latform
,
'-'
,
platform
,
'-'
,
process
.
arch
,
'-'
,
process
.
versions
.
modules
].
join
(
''
);
...
...
@@ -256,7 +264,7 @@ function getBinaryPath() {
}
else
if
(
pkg
.
nodeSassConfig
&&
pkg
.
nodeSassConfig
.
binaryPath
)
{
binaryPath
=
pkg
.
nodeSassConfig
.
binaryPath
;
}
else
{
binaryPath
=
path
.
join
(
defaultBinaryPath
,
getBinaryName
().
replace
(
/_/
,
'/'
));
binaryPath
=
path
.
join
(
defaultBinaryPath
,
getBinaryName
().
replace
(
/_
(?=
binding
\.
node
)
/
,
'/'
));
}
return
binaryPath
;
...
...
@@ -359,6 +367,36 @@ function getVersionInfo(binding) {
].
join
(
eol
);
}
/**
* Gets the platform variant, currently either an empty string or 'musl' for Linux/musl platforms.
*
* @api public
*/
function
getPlatformVariant
()
{
var
contents
=
''
;
if
(
process
.
platform
!==
'linux'
)
{
return
''
;
}
try
{
contents
=
fs
.
readFileSync
(
process
.
execPath
);
// Buffer.indexOf was added in v1.5.0 so cast to string for old node
// Delay contents.toStrings because it's expensive
if
(
!
contents
.
indexOf
)
{
contents
=
contents
.
toString
();
}
if
(
contents
.
indexOf
(
'libc.musl-x86_64.so.1'
)
!==
-
1
)
{
return
'musl'
;
}
}
catch
(
err
)
{
}
// eslint-disable-line no-empty
return
''
;
}
module
.
exports
.
hasBinary
=
hasBinary
;
module
.
exports
.
getBinaryUrl
=
getBinaryUrl
;
module
.
exports
.
getBinaryName
=
getBinaryName
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment