@pproenca/webcodecs-ffmpeg 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +19 -0
- package/package.json +6 -5
- package/resolve.js +26 -1
package/install.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const os = require('os');
|
|
8
|
+
const fs = require('fs');
|
|
8
9
|
|
|
9
10
|
const TIER_SUFFIX = '';
|
|
10
11
|
|
|
@@ -12,14 +13,32 @@ const PLATFORMS = {
|
|
|
12
13
|
'darwin-arm64': { os: 'darwin', cpu: 'arm64' },
|
|
13
14
|
'darwin-x64': { os: 'darwin', cpu: 'x64' },
|
|
14
15
|
'linux-x64': { os: 'linux', cpu: 'x64' },
|
|
16
|
+
'linux-x64-musl': { os: 'linux', cpu: 'x64', libc: 'musl' },
|
|
15
17
|
'linux-arm64': { os: 'linux', cpu: 'arm64' },
|
|
16
18
|
'win32-x64': { os: 'win32', cpu: 'x64' },
|
|
17
19
|
'win32-arm64': { os: 'win32', cpu: 'arm64' },
|
|
18
20
|
};
|
|
19
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Detect if running on musl libc (Alpine Linux, etc.)
|
|
24
|
+
*/
|
|
25
|
+
function isMusl() {
|
|
26
|
+
if (os.platform() !== 'linux') return false;
|
|
27
|
+
try {
|
|
28
|
+
// Check for musl loader
|
|
29
|
+
const arch = os.arch() === 'x64' ? 'x86_64' : os.arch();
|
|
30
|
+
return fs.existsSync(`/lib/ld-musl-${arch}.so.1`);
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
20
36
|
function getPlatformKey() {
|
|
21
37
|
const platform = os.platform();
|
|
22
38
|
const arch = os.arch();
|
|
39
|
+
if (platform === 'linux' && arch === 'x64' && isMusl()) {
|
|
40
|
+
return 'linux-x64-musl';
|
|
41
|
+
}
|
|
23
42
|
return `${platform}-${arch}`;
|
|
24
43
|
}
|
|
25
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pproenca/webcodecs-ffmpeg",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Prebuilt FFmpeg with LGPL-safe codecs (VP8/9, AV1, Opus, Vorbis, MP3) - auto-selects platform",
|
|
5
5
|
"author": "Pedro Proenca",
|
|
6
6
|
"homepage": "https://github.com/pproenca/webcodecs-ffmpeg",
|
|
@@ -23,10 +23,11 @@
|
|
|
23
23
|
"./package": "./package.json"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@pproenca/webcodecs-ffmpeg-
|
|
27
|
-
"@pproenca/webcodecs-ffmpeg-darwin-
|
|
28
|
-
"@pproenca/webcodecs-ffmpeg-
|
|
29
|
-
"@pproenca/webcodecs-ffmpeg-linux-x64": "0.1.
|
|
26
|
+
"@pproenca/webcodecs-ffmpeg-darwin-arm64": "0.1.2",
|
|
27
|
+
"@pproenca/webcodecs-ffmpeg-darwin-x64": "0.1.2",
|
|
28
|
+
"@pproenca/webcodecs-ffmpeg-linux-arm64": "0.1.2",
|
|
29
|
+
"@pproenca/webcodecs-ffmpeg-linux-x64": "0.1.2",
|
|
30
|
+
"@pproenca/webcodecs-ffmpeg-linux-x64-musl": "0.1.2"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"postinstall": "node install.js"
|
package/resolve.js
CHANGED
|
@@ -6,14 +6,39 @@
|
|
|
6
6
|
* PKG_CONFIG_PATH: "<!(node -p \"require('@pproenca/webcodecs-ffmpeg/resolve').pkgconfig\")"
|
|
7
7
|
*/
|
|
8
8
|
const os = require('os');
|
|
9
|
+
const fs = require('fs');
|
|
9
10
|
const path = require('path');
|
|
10
11
|
|
|
11
12
|
const TIER_SUFFIX = '';
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Detect if running on musl libc (Alpine Linux, etc.)
|
|
16
|
+
*/
|
|
17
|
+
function isMusl() {
|
|
18
|
+
if (os.platform() !== 'linux') return false;
|
|
19
|
+
try {
|
|
20
|
+
const arch = os.arch() === 'x64' ? 'x86_64' : os.arch();
|
|
21
|
+
return fs.existsSync(`/lib/ld-musl-${arch}.so.1`);
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
function getPlatformPkgPath() {
|
|
14
28
|
const platform = os.platform();
|
|
15
29
|
const arch = os.arch();
|
|
16
|
-
|
|
30
|
+
|
|
31
|
+
// Try musl-specific package first on Linux x64
|
|
32
|
+
if (platform === 'linux' && arch === 'x64' && isMusl()) {
|
|
33
|
+
const muslPkg = `@pproenca/webcodecs-ffmpeg-linux-x64-musl${TIER_SUFFIX}`;
|
|
34
|
+
try {
|
|
35
|
+
return path.dirname(require.resolve(`${muslPkg}/lib`));
|
|
36
|
+
} catch {
|
|
37
|
+
// Fall through to glibc package
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const pkgName = `@pproenca/webcodecs-ffmpeg-${platform}-${arch}${TIER_SUFFIX}`;
|
|
17
42
|
try {
|
|
18
43
|
return path.dirname(require.resolve(`${pkgName}/lib`));
|
|
19
44
|
} catch (e) {
|