lightdrift-libraw 1.0.0-alpha.5 → 1.0.0-alpha.6
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/index.d.ts +641 -647
- package/lib/index.js +46 -21
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2,30 +2,55 @@ const path = require("path");
|
|
|
2
2
|
const sharp = require("sharp");
|
|
3
3
|
|
|
4
4
|
let librawAddon;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
|
|
6
|
+
// Try to load the native addon with multiple strategies
|
|
7
|
+
function loadAddon() {
|
|
8
|
+
const loadAttempts = [
|
|
9
|
+
// Try node-gyp-build first (for prebuilt binaries)
|
|
10
|
+
() => {
|
|
11
|
+
try {
|
|
12
|
+
return require('node-gyp-build')(path.join(__dirname, '..'));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
// Try standard build locations
|
|
18
|
+
() => require("../build/Release/libraw_addon"),
|
|
19
|
+
() => require("../build/Debug/libraw_addon"),
|
|
20
|
+
// Try alternative names (in case of renaming issues)
|
|
21
|
+
() => require("../build/Release/libraw_addon.node"),
|
|
22
|
+
() => require("../build/Debug/libraw_addon.node"),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
let lastError;
|
|
26
|
+
for (const attempt of loadAttempts) {
|
|
27
|
+
try {
|
|
28
|
+
const addon = attempt();
|
|
29
|
+
if (addon) return addon;
|
|
30
|
+
} catch (err) {
|
|
31
|
+
lastError = err;
|
|
32
|
+
}
|
|
26
33
|
}
|
|
34
|
+
|
|
35
|
+
throw new Error(
|
|
36
|
+
"LibRaw addon not built. Please ensure the native module is compiled.\n" +
|
|
37
|
+
"\n" +
|
|
38
|
+
"If using Docker/pnpm, try:\n" +
|
|
39
|
+
" pnpm rebuild lightdrift-libraw\n" +
|
|
40
|
+
"Or set enable-pre-post-scripts=true in .npmrc\n" +
|
|
41
|
+
"\n" +
|
|
42
|
+
"If on Linux/Mac, ensure LibRaw is installed:\n" +
|
|
43
|
+
" Alpine: apk add libraw-dev\n" +
|
|
44
|
+
" Debian: apt-get install libraw-dev\n" +
|
|
45
|
+
" Mac: brew install libraw\n" +
|
|
46
|
+
"\n" +
|
|
47
|
+
"Build error: " +
|
|
48
|
+
(lastError ? lastError.message : "Unknown error")
|
|
49
|
+
);
|
|
27
50
|
}
|
|
28
51
|
|
|
52
|
+
librawAddon = loadAddon();
|
|
53
|
+
|
|
29
54
|
class LibRaw {
|
|
30
55
|
constructor() {
|
|
31
56
|
this._wrapper = new librawAddon.LibRawWrapper();
|
package/package.json
CHANGED