@ohos-ports/sharp 0.34.5-beta.3 → 0.34.5-beta.5
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-openharmony-arm64.node +0 -0
- package/lib/sharp.js +14 -23
- package/package.json +1 -1
|
Binary file
|
package/lib/sharp.js
CHANGED
|
@@ -10,38 +10,29 @@ const { familySync, versionSync } = require('detect-libc');
|
|
|
10
10
|
const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = require('./libvips');
|
|
11
11
|
const runtimePlatform = runtimePlatformArch();
|
|
12
12
|
|
|
13
|
-
// OpenHarmony:
|
|
14
|
-
//
|
|
15
|
-
//
|
|
13
|
+
// OpenHarmony: create soname symlink for transitive .so dependency
|
|
14
|
+
// sharp.node NEEDED is patched to use full filename (libvips-cpp.so.42.20.3),
|
|
15
|
+
// but libvips-cpp.so.42.20.3 still NEEDED libvips.so.42 (soname).
|
|
16
|
+
// The libvips package only ships libvips.so.42.20.3, no soname symlink.
|
|
16
17
|
try {
|
|
18
|
+
const path = require('node:path');
|
|
19
|
+
const fs = require('node:fs');
|
|
17
20
|
const libvipsLibPath = require(`@ohos-ports/img-sharp-libvips-${runtimePlatform}/lib`);
|
|
18
21
|
if (libvipsLibPath) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
}
|
|
22
|
+
for (const file of fs.readdirSync(libvipsLibPath)) {
|
|
23
|
+
const m = file.match(/^(.+\.so\.\d+)\.\d+\.\d+$/);
|
|
24
|
+
if (m) {
|
|
25
|
+
const soname = path.join(libvipsLibPath, m[1]);
|
|
26
|
+
if (!fs.existsSync(soname)) {
|
|
27
|
+
try { fs.symlinkSync(file, soname); } catch (_) {}
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
|
-
} catch (_) {}
|
|
37
|
-
const currentLdPath = process.env.LD_LIBRARY_PATH || '';
|
|
38
|
-
if (!currentLdPath.includes(libvipsLibPath)) {
|
|
39
|
-
process.env.LD_LIBRARY_PATH = `${libvipsLibPath}:${currentLdPath}`;
|
|
40
30
|
}
|
|
41
31
|
}
|
|
42
|
-
} catch (_e) { /*
|
|
32
|
+
} catch (_e) { /* skip */ }
|
|
43
33
|
|
|
44
34
|
const paths = [
|
|
35
|
+
`./sharp-${runtimePlatform}.node`,
|
|
45
36
|
`../src/build/Release/sharp-${runtimePlatform}.node`,
|
|
46
37
|
'../src/build/Release/sharp-wasm32.node',
|
|
47
38
|
`@ohos-ports/img-sharp-${runtimePlatform}/sharp.node`,
|
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.
|
|
4
|
+
"version": "0.34.5-beta.5",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|
|
7
7
|
"contributors": [
|