Skip to content

Commit 1605c54

Browse files
committed
chore: update version to 1.3.8 and improve include path resolution in symbols.ts
1 parent c371737 commit 1605c54

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zip-bun",
3-
"version": "1.3.7",
3+
"version": "1.3.8",
44
"description": "A high-performance zip archive library for Bun with native C bindings",
55
"main": "dist/index.mjs",
66
"types": "dist/index.d.mts",
@@ -11,13 +11,13 @@
1111
"images"
1212
],
1313
"exports": {
14-
".": {
15-
"import": {
16-
"types": "./dist/index.d.mts",
17-
"default": "./dist/index.mjs"
18-
}
19-
}
20-
},
14+
".": {
15+
"import": {
16+
"types": "./dist/index.d.mts",
17+
"default": "./dist/index.mjs"
18+
}
19+
}
20+
},
2121
"scripts": {
2222
"test": "bun test",
2323
"test:coverage": "bun test --coverage",

src/symbols.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
import { cc } from "bun:ffi";
22
import { join } from "node:path";
33

4-
const includePath = import.meta.dir;
4+
function getIncludePath(): string | null {
5+
// Attempt to get the directory of the current module
6+
if (import.meta && import.meta.dir) {
7+
return import.meta.dir;
8+
}
9+
10+
// Fallback to a default path (adjust as necessary)
11+
const defaultPath = join(process.cwd(), "node_modules/zip-bun/dist");
12+
return defaultPath || null;
13+
}
14+
15+
const includePath = getIncludePath();
16+
if (!includePath) {
17+
throw new Error("Could not determine include path for zip-bun");
18+
}
19+
520
const wrapperPath = join(includePath, "zip_wrapper.c");
621

722
// Compile the C code with all the zip functions

0 commit comments

Comments
 (0)