@blazediff/core-native 8.0.0 → 8.1.1
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/README.md +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -8
- package/dist/index.mjs +2 -2
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -141,7 +141,7 @@ type NativeDiffResult =
|
|
|
141
141
|
| { kind: "io-error"; path?: string; message: string };
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
Invalid options or buffers throw a `BlazeDiffError` (re-exported from `@blazediff/core`) with a `code`: `invalid-image`, `invalid-output`, `invalid-mask` or `invalid-option`.
|
|
144
|
+
Invalid options or buffers throw a `BlazeDiffError` (re-exported from `@blazediff/contract`, the same class `@blazediff/core` throws) with a `code`: `invalid-image`, `invalid-output`, `invalid-mask` or `invalid-option`.
|
|
145
145
|
|
|
146
146
|
#### Encoded Buffer Inputs
|
|
147
147
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Image, DiffOptions, DiffResult } from '@blazediff/
|
|
2
|
-
export { BlazeDiffError, DiffOptions, DiffResult, Image } from '@blazediff/
|
|
1
|
+
import { Image, DiffOptions, DiffResult } from '@blazediff/contract';
|
|
2
|
+
export { BlazeDiffError, DiffOptions, DiffResult, Image } from '@blazediff/contract';
|
|
3
3
|
|
|
4
4
|
/** A file path, encoded PNG, JPEG or QOI bytes, or raw RGBA pixels. */
|
|
5
5
|
type NativeInput = Image | string | Uint8Array;
|
package/dist/index.js
CHANGED
|
@@ -30,14 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
BlazeDiffError: () =>
|
|
33
|
+
BlazeDiffError: () => import_contract2.BlazeDiffError,
|
|
34
34
|
diff: () => diff,
|
|
35
35
|
getBinaryPath: () => getBinaryPath,
|
|
36
36
|
hasNativeBinding: () => hasNativeBinding
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
|
-
// ../../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.0_postcss@8.5.
|
|
40
|
+
// ../../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.0_postcss@8.5.23_tsx@4.20.6_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
41
41
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
42
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
43
43
|
|
|
@@ -49,8 +49,8 @@ var import_node_os = __toESM(require("os"));
|
|
|
49
49
|
var import_node_path = __toESM(require("path"));
|
|
50
50
|
var import_node_url = require("url");
|
|
51
51
|
var import_node_util = require("util");
|
|
52
|
-
var
|
|
53
|
-
var
|
|
52
|
+
var import_contract = require("@blazediff/contract");
|
|
53
|
+
var import_contract2 = require("@blazediff/contract");
|
|
54
54
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
55
55
|
var PLATFORM_PACKAGES = {
|
|
56
56
|
"darwin-arm64": {
|
|
@@ -172,7 +172,7 @@ function asBytes(data) {
|
|
|
172
172
|
return data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
173
173
|
}
|
|
174
174
|
function toNapiOptions(options) {
|
|
175
|
-
(0,
|
|
175
|
+
(0, import_contract.assertOptions)(options);
|
|
176
176
|
const { threshold, antialiasing, metric, mask, window, render } = options;
|
|
177
177
|
return {
|
|
178
178
|
threshold,
|
|
@@ -187,7 +187,7 @@ function toNapiOptions(options) {
|
|
|
187
187
|
function toNapiInput(input, name) {
|
|
188
188
|
if (typeof input === "string") return { path: input };
|
|
189
189
|
if (isBytes(input)) return { encoded: asBytes(input) };
|
|
190
|
-
(0,
|
|
190
|
+
(0, import_contract.assertImage)(input, name, "invalid-image");
|
|
191
191
|
return {
|
|
192
192
|
image: {
|
|
193
193
|
data: asBytes(input.data),
|
|
@@ -200,7 +200,7 @@ function toNapiOutput(output) {
|
|
|
200
200
|
if (output === void 0) return null;
|
|
201
201
|
if (typeof output === "string") return { path: output };
|
|
202
202
|
if ("path" in output) return output;
|
|
203
|
-
(0,
|
|
203
|
+
(0, import_contract.assertImage)(output, "output", "invalid-output");
|
|
204
204
|
return { image: asBytes(output.data) };
|
|
205
205
|
}
|
|
206
206
|
function errorCode(message) {
|
|
@@ -295,7 +295,7 @@ async function diff(a, b, options = {}) {
|
|
|
295
295
|
} catch (err) {
|
|
296
296
|
const { code, message } = err;
|
|
297
297
|
if (code === "InvalidArg" && message)
|
|
298
|
-
throw new
|
|
298
|
+
throw new import_contract.BlazeDiffError(errorCode(message), message);
|
|
299
299
|
throw err;
|
|
300
300
|
}
|
|
301
301
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
assertImage,
|
|
11
11
|
assertOptions,
|
|
12
12
|
BlazeDiffError
|
|
13
|
-
} from "@blazediff/
|
|
14
|
-
import { BlazeDiffError as BlazeDiffError2 } from "@blazediff/
|
|
13
|
+
} from "@blazediff/contract";
|
|
14
|
+
import { BlazeDiffError as BlazeDiffError2 } from "@blazediff/contract";
|
|
15
15
|
var execFileAsync = promisify(execFile);
|
|
16
16
|
var PLATFORM_PACKAGES = {
|
|
17
17
|
"darwin-arm64": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazediff/core-native",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "Native Rust binaries for blazediff - the fastest image diff in the world",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@blazediff/
|
|
23
|
+
"@blazediff/contract": "1.0.0"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@blazediff/core-native-darwin-arm64": "8.
|
|
27
|
-
"@blazediff/core-native-darwin-x64": "8.
|
|
28
|
-
"@blazediff/core-native-linux-arm64": "8.
|
|
29
|
-
"@blazediff/core-native-linux-x64": "8.
|
|
30
|
-
"@blazediff/core-native-win32-arm64": "8.
|
|
31
|
-
"@blazediff/core-native-win32-x64": "8.
|
|
26
|
+
"@blazediff/core-native-darwin-arm64": "8.1.1",
|
|
27
|
+
"@blazediff/core-native-darwin-x64": "8.1.1",
|
|
28
|
+
"@blazediff/core-native-linux-arm64": "8.1.1",
|
|
29
|
+
"@blazediff/core-native-linux-x64": "8.1.1",
|
|
30
|
+
"@blazediff/core-native-win32-arm64": "8.1.1",
|
|
31
|
+
"@blazediff/core-native-win32-x64": "8.1.1"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [
|
|
34
34
|
"image",
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"pngjs": "^7.0.0",
|
|
54
54
|
"tsup": "8.5.0",
|
|
55
55
|
"typescript": "5.9.2",
|
|
56
|
-
"vitest": "^3.2.4"
|
|
56
|
+
"vitest": "^3.2.4",
|
|
57
|
+
"@blazediff/core": "2.0.2"
|
|
57
58
|
},
|
|
58
59
|
"scripts": {
|
|
59
60
|
"typecheck": "tsc --noEmit",
|