@ohos-ports/sharp 0.34.5-beta.10 → 0.34.5-beta.11

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/lib/sharp.js CHANGED
@@ -10,7 +10,36 @@ const { familySync, versionSync } = require('detect-libc');
10
10
  const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = require('./libvips');
11
11
  const runtimePlatform = runtimePlatformArch();
12
12
 
13
- // OpenHarmony patch disabled — RPATH + symlinks handle libvips resolution
13
+ // OpenHarmony: set LD_LIBRARY_PATH for libvips before loading native binary
14
+ // The .node binary's RPATH references @img/ namespace but the actual .so
15
+ // files are installed under @ohos-ports/img-sharp-libvips-{platform}/lib
16
+ try {
17
+ const libvipsLibPath = require(`@ohos-ports/img-sharp-libvips-${runtimePlatform}/lib`);
18
+ if (libvipsLibPath) {
19
+ const path = require('node:path');
20
+ const fs = require('node:fs');
21
+ // Create soname symlinks: libXXX.so.Y.Z.W → libXXX.so.Y
22
+ // The .node binary NEEDED entries request sonames (e.g. libvips-cpp.so.42)
23
+ // but the libvips package only ships full-version files (e.g. libvips-cpp.so.42.20.3)
24
+ try {
25
+ for (const file of fs.readdirSync(libvipsLibPath)) {
26
+ const m = file.match(/^(.+\.so\.\d+)\.\d+\.\d+$/);
27
+ if (m) {
28
+ const soname = path.join(libvipsLibPath, m[1]);
29
+ if (!fs.existsSync(soname)) {
30
+ try { fs.symlinkSync(file, soname); } catch (_) {
31
+ try { fs.copyFileSync(path.join(libvipsLibPath, file), soname); } catch (_) {}
32
+ }
33
+ }
34
+ }
35
+ }
36
+ } catch (_) {}
37
+ const currentLdPath = process.env.LD_LIBRARY_PATH || '';
38
+ if (!currentLdPath.includes(libvipsLibPath)) {
39
+ process.env.LD_LIBRARY_PATH = `${libvipsLibPath}:${currentLdPath}`;
40
+ }
41
+ }
42
+ } catch (_e) { /* libvips not available as separate package, skip */ }
14
43
 
15
44
  const paths = [
16
45
  `../src/build/Release/sharp-${runtimePlatform}.node`,
package/lib/utility.js CHANGED
@@ -21,10 +21,6 @@ const libvipsVersion = sharp.libvipsVersion();
21
21
  * @returns {Object}
22
22
  */
23
23
  const format = sharp.format();
24
- /* @ohos-ports patch: native module returns 'jp2' instead of 'jp2k' */
25
- if (!format.jp2k && format.jp2) {
26
- format.jp2k = format.jp2;
27
- }
28
24
  format.heif.output.alias = ['avif', 'heic'];
29
25
  format.jpeg.output.alias = ['jpe', 'jpg'];
30
26
  format.tiff.output.alias = ['tif'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ohos-ports/sharp",
3
3
  "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
4
- "version": "0.34.5-beta.10",
4
+ "version": "0.34.5-beta.11",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
@@ -168,7 +168,7 @@
168
168
  "@img/sharp-win32-arm64": "0.34.5",
169
169
  "@img/sharp-win32-ia32": "0.34.5",
170
170
  "@img/sharp-win32-x64": "0.34.5",
171
- "@ohos-ports/img-sharp-openharmony-arm64": "0.34.5-beta.3"
171
+ "@ohos-ports/img-sharp-openharmony-arm64": "0.34.5-beta.4"
172
172
  },
173
173
  "devDependencies": {
174
174
  "@ohos-ports/biomejs-biome": "^2.3.4-beta.0",