Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/core-bridge/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
artifacts.json
index.node
target/
27 changes: 24 additions & 3 deletions packages/core-bridge/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ const targets = [
'aarch64-apple-darwin',
'x86_64-unknown-linux-gnu',
'aarch64-unknown-linux-gnu',
'x86_64-unknown-linux-musl',
'aarch64-unknown-linux-musl',
// TODO: this is not supported on macos
'x86_64-pc-windows-msvc',
'x86_64-pc-windows-gnu',
];

const archAlias = { x64: 'x86_64', arm64: 'aarch64' };
const platformMapping = { darwin: 'apple-darwin', linux: 'unknown-linux-gnu', win32: 'pc-windows-msvc' };
const platformMapping = {
darwin: 'apple-darwin',
linux: 'unknown-linux-gnu',
linux_musl: 'unknown-linux-musl',
win32: 'pc-windows-msvc',
};

class PrebuildError extends Error {
constructor(message) {
Expand All @@ -29,12 +36,18 @@ class PrebuildError extends Error {
}
}

function isMuslSystem() {
return process.report.getReport().sharedObjects.some((lib) => lib.includes('musl'));
}

function getPrebuiltTargetName() {
const arch = archAlias[os.arch()];
if (arch === undefined) {
throw new PrebuildError(`No prebuilt module for arch ${os.arch()}`);
}
const platform = platformMapping[os.platform()];

const platform = isMuslSystem() ? platformMapping[`${os.platform()}_musl`] : platformMapping[os.platform()];

if (platform === undefined) {
throw new PrebuildError(`No prebuilt module for platform ${os.platform()}`);
}
Expand All @@ -50,4 +63,12 @@ function getPrebuiltPath() {
}
}

module.exports = { targets, archAlias, platformMapping, PrebuildError, getPrebuiltPath, getPrebuiltTargetName };
module.exports = {
targets,
archAlias,
platformMapping,
PrebuildError,
getPrebuiltPath,
getPrebuiltTargetName,
isMuslSystem,
};
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
89 changes: 32 additions & 57 deletions packages/docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.