bun-image-turbo 1.0.4 → 1.0.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/dist/index.js CHANGED
@@ -66,19 +66,23 @@ function loadNativeBinding() {
66
66
  }
67
67
  break;
68
68
  case "win32":
69
- targetName = "win32-x64-msvc";
69
+ targetName = arch === "arm64" ? "win32-arm64-msvc" : "win32-x64-msvc";
70
70
  break;
71
71
  default:
72
72
  throw new Error(`Unsupported platform: ${platform}-${arch}`);
73
73
  }
74
74
  const currentDir = getCurrentDir();
75
+ const binaryName = `image-turbo.${targetName}.node`;
76
+ const optionalPackageName = `bun-image-turbo-${targetName}`;
75
77
  const possiblePaths = [
76
78
  // Same directory as this file (dist/)
77
- (0, import_path.join)(currentDir, `image-turbo.${targetName}.node`),
79
+ (0, import_path.join)(currentDir, binaryName),
78
80
  // Parent directory (package root)
79
- (0, import_path.join)(currentDir, "..", `image-turbo.${targetName}.node`),
81
+ (0, import_path.join)(currentDir, "..", binaryName),
82
+ // Optional dependency package (installed in node_modules)
83
+ (0, import_path.join)(currentDir, "..", "..", optionalPackageName, binaryName),
80
84
  // CWD (development)
81
- (0, import_path.join)(process.cwd(), `image-turbo.${targetName}.node`)
85
+ (0, import_path.join)(process.cwd(), binaryName)
82
86
  ];
83
87
  for (const modulePath of possiblePaths) {
84
88
  try {
@@ -89,6 +93,10 @@ function loadNativeBinding() {
89
93
  continue;
90
94
  }
91
95
  }
96
+ try {
97
+ return require(optionalPackageName);
98
+ } catch {
99
+ }
92
100
  throw new Error(
93
101
  `Failed to load native binding for ${platform}-${arch}. Tried: ${possiblePaths.join(", ")}`
94
102
  );
package/dist/index.mjs CHANGED
@@ -33,19 +33,23 @@ function loadNativeBinding() {
33
33
  }
34
34
  break;
35
35
  case "win32":
36
- targetName = "win32-x64-msvc";
36
+ targetName = arch === "arm64" ? "win32-arm64-msvc" : "win32-x64-msvc";
37
37
  break;
38
38
  default:
39
39
  throw new Error(`Unsupported platform: ${platform}-${arch}`);
40
40
  }
41
41
  const currentDir = getCurrentDir();
42
+ const binaryName = `image-turbo.${targetName}.node`;
43
+ const optionalPackageName = `bun-image-turbo-${targetName}`;
42
44
  const possiblePaths = [
43
45
  // Same directory as this file (dist/)
44
- join(currentDir, `image-turbo.${targetName}.node`),
46
+ join(currentDir, binaryName),
45
47
  // Parent directory (package root)
46
- join(currentDir, "..", `image-turbo.${targetName}.node`),
48
+ join(currentDir, "..", binaryName),
49
+ // Optional dependency package (installed in node_modules)
50
+ join(currentDir, "..", "..", optionalPackageName, binaryName),
47
51
  // CWD (development)
48
- join(process.cwd(), `image-turbo.${targetName}.node`)
52
+ join(process.cwd(), binaryName)
49
53
  ];
50
54
  for (const modulePath of possiblePaths) {
51
55
  try {
@@ -56,6 +60,10 @@ function loadNativeBinding() {
56
60
  continue;
57
61
  }
58
62
  }
63
+ try {
64
+ return __require(optionalPackageName);
65
+ } catch {
66
+ }
59
67
  throw new Error(
60
68
  `Failed to load native binding for ${platform}-${arch}. Tried: ${possiblePaths.join(", ")}`
61
69
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-image-turbo",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "High-performance image processing for Bun and Node.js - resize, convert, compress with WebP, AVIF, PNG, JPEG support",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -89,12 +89,12 @@
89
89
  "typescript": "^5.9.0"
90
90
  },
91
91
  "optionalDependencies": {
92
- "bun-image-turbo-darwin-arm64": "1.0.4",
93
- "bun-image-turbo-darwin-x64": "1.0.4",
94
- "bun-image-turbo-linux-arm64-gnu": "1.0.4",
95
- "bun-image-turbo-linux-x64-gnu": "1.0.4",
96
- "bun-image-turbo-linux-x64-musl": "1.0.4",
97
- "bun-image-turbo-win32-arm64-msvc": "1.0.4",
98
- "bun-image-turbo-win32-x64-msvc": "1.0.4"
92
+ "bun-image-turbo-darwin-arm64": "1.0.5",
93
+ "bun-image-turbo-darwin-x64": "1.0.5",
94
+ "bun-image-turbo-linux-arm64-gnu": "1.0.5",
95
+ "bun-image-turbo-linux-x64-gnu": "1.0.5",
96
+ "bun-image-turbo-linux-x64-musl": "1.0.5",
97
+ "bun-image-turbo-win32-arm64-msvc": "1.0.5",
98
+ "bun-image-turbo-win32-x64-msvc": "1.0.5"
99
99
  }
100
100
  }