node-av 7.0.2 → 7.0.3

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.
Files changed (2) hide show
  1. package/install/check.js +12 -4
  2. package/package.json +9 -9
package/install/check.js CHANGED
@@ -10,8 +10,7 @@ const require = createRequire(import.meta.url);
10
10
 
11
11
  const tryLoadPrebuilt = () => {
12
12
  // Try to load from platform-specific package (optionalDependencies)
13
- const platform = process.platform;
14
- const arch = process.arch;
13
+ const { platform, arch, musl } = installTarget();
15
14
 
16
15
  if (platform === 'win32') {
17
16
  // MinGW builds are discontinued, Windows ships MSVC only
@@ -42,7 +41,7 @@ const tryLoadPrebuilt = () => {
42
41
  }
43
42
  } else {
44
43
  // musl (Alpine) has its own build, a glibc one doesn't load there
45
- const packageName = `@seydx/node-av-${platform}-${arch}${isMuslLibc() ? '-musl' : ''}`;
44
+ const packageName = `@seydx/node-av-${platform}-${arch}${musl ? '-musl' : ''}`;
46
45
 
47
46
  try {
48
47
  // Check if the package is installed (don't check for .node file yet - it may be extracted by postinstall)
@@ -66,6 +65,14 @@ const tryLoadPrebuilt = () => {
66
65
  return false;
67
66
  };
68
67
 
68
+ // A cross build (npm --os/--cpu/--libc) installs the target's package, not the build host's
69
+ const installTarget = () => {
70
+ const platform = process.env.npm_config_os || process.platform;
71
+ const arch = process.env.npm_config_cpu || process.arch;
72
+ const libc = process.env.npm_config_libc || (isMuslLibc() ? 'musl' : 'glibc');
73
+ return { platform, arch, musl: platform === 'linux' && libc === 'musl' };
74
+ };
75
+
69
76
  const isMuslLibc = () => {
70
77
  if (process.platform !== 'linux') {
71
78
  return false;
@@ -80,8 +87,9 @@ const isMuslLibc = () => {
80
87
  };
81
88
 
82
89
  const noPrebuiltError = () => {
90
+ const { platform, arch, musl } = installTarget();
83
91
  log('');
84
- log(`No prebuilt binary available for ${process.platform}-${process.arch}${isMuslLibc() ? ' (musl)' : ''}.`);
92
+ log(`No prebuilt binary available for ${platform}-${arch}${musl ? ' (musl)' : ''}.`);
85
93
  log('The published npm package does not contain the native sources,');
86
94
  log('so it cannot be built from source inside node_modules.');
87
95
  log('To build from source, clone the repository and follow the build instructions:');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-av",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "description": "FFmpeg bindings for Node.js",
5
5
  "author": "seydx (https://github.com/seydx/node-av)",
6
6
  "type": "module",
@@ -91,14 +91,14 @@
91
91
  "update": "updates --update ./"
92
92
  },
93
93
  "optionalDependencies": {
94
- "@seydx/node-av-darwin-arm64": "7.0.2",
95
- "@seydx/node-av-darwin-x64": "7.0.2",
96
- "@seydx/node-av-linux-arm64": "7.0.2",
97
- "@seydx/node-av-linux-arm64-musl": "7.0.2",
98
- "@seydx/node-av-linux-x64": "7.0.2",
99
- "@seydx/node-av-linux-x64-musl": "7.0.2",
100
- "@seydx/node-av-win32-arm64-msvc": "7.0.2",
101
- "@seydx/node-av-win32-x64-msvc": "7.0.2"
94
+ "@seydx/node-av-darwin-arm64": "7.0.3",
95
+ "@seydx/node-av-darwin-x64": "7.0.3",
96
+ "@seydx/node-av-linux-arm64": "7.0.3",
97
+ "@seydx/node-av-linux-arm64-musl": "7.0.3",
98
+ "@seydx/node-av-linux-x64": "7.0.3",
99
+ "@seydx/node-av-linux-x64-musl": "7.0.3",
100
+ "@seydx/node-av-win32-arm64-msvc": "7.0.3",
101
+ "@seydx/node-av-win32-x64-msvc": "7.0.3"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "@seydx/node-av-ffmpeg": "*",