-
Notifications
You must be signed in to change notification settings - Fork 29
Support pure JS sass
executable
#344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2025 Google LLC. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import * as p from 'path'; | ||
import {getElfInterpreter} from './elf'; | ||
|
||
/** | ||
* Detect if the given binary is linked with musl libc by checking if | ||
* the interpreter basename starts with "ld-musl-" | ||
*/ | ||
function isLinuxMusl(path: string): boolean { | ||
try { | ||
const interpreter = getElfInterpreter(path); | ||
return p.basename(interpreter).startsWith('ld-musl-'); | ||
} catch (error) { | ||
console.warn( | ||
`Warning: Failed to detect linux-musl, fallback to linux-gnu: ${error.message}`, | ||
); | ||
return false; | ||
} | ||
} | ||
|
||
/** The module name for the embedded compiler executable. */ | ||
export const compilerModule = (() => { | ||
const platform = | ||
process.platform === 'linux' && isLinuxMusl(process.execPath) | ||
? 'linux-musl' | ||
: (process.platform as string); | ||
|
||
const arch = process.arch; | ||
|
||
return `sass-embedded-${platform}-${arch}`; | ||
})(); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since these packages behave unusually relative to the binary packages, they should probably have slightly more descriptive READMEs and npm descriptions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. Feel free to further amend the language if you have any other preference. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `sass-embedded-all-unknown` | ||
|
||
This is the **all-unknown** binary for [`sass-embedded`](https://www.npmjs.com/package/sass-embedded) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "sass-embedded-all-unknown", | ||
"version": "1.89.2", | ||
"description": "The all-unknown binary for sass-embedded", | ||
"repository": "sass/embedded-host-node", | ||
"author": "Google Inc.", | ||
"license": "MIT", | ||
"cpu": [ | ||
"!arm", | ||
"!arm64", | ||
"!riscv64", | ||
"!x64" | ||
], | ||
"dependencies": { | ||
"sass": "1.89.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `sass-embedded-unknown-all` | ||
|
||
This is the **unknown-all** binary for [`sass-embedded`](https://www.npmjs.com/package/sass-embedded) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "sass-embedded-unknown-all", | ||
"version": "1.89.2", | ||
"description": "The unknown-all binary for sass-embedded", | ||
"repository": "sass/embedded-host-node", | ||
"author": "Google Inc.", | ||
"license": "MIT", | ||
"os": [ | ||
"!android", | ||
"!darwin", | ||
"!linux", | ||
"!win32" | ||
], | ||
"dependencies": { | ||
"sass": "1.89.2" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to split this into a different module is that
compiler-path
contains IIFE that may throw on load, but in tool scripts, we need to know the compiler-module name to setup dev environment without throwing. Therefore it's moved to a separate file.