@stll/scan-engine 0.1.0 → 0.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/dist/review.d.ts +2 -1
- package/dist/scan-engine.d.ts +2 -1
- package/dist/scan-engine.js +3 -2
- package/dist/scan-engine.worker.js +3 -2
- package/dist/types.d.ts +2 -1
- package/package.json +3 -3
package/dist/review.d.ts
CHANGED
package/dist/scan-engine.d.ts
CHANGED
package/dist/scan-engine.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ScanEngineError } from "./types.js";
|
|
2
2
|
import { Result } from "better-result";
|
|
3
3
|
import { fetchWithTimeout } from "@stll/fetch";
|
|
4
|
+
import { readBodyWithIdleDeadline } from "@stll/fetch/body-reader";
|
|
4
5
|
import { clean_scan_rgba, initSync } from "../generated/scan_engine.js";
|
|
5
6
|
//#region src/scan-engine.ts
|
|
6
7
|
const WASM_LOAD_TIMEOUT_MS = 1e4;
|
|
7
8
|
const WORKER_REQUEST_TIMEOUT_MS = 1e4;
|
|
8
9
|
const loadWasmBindings = async () => {
|
|
9
10
|
const response = await fetchWithTimeout(new URL("../generated/scan_engine_bg.wasm", import.meta.url), { timeout: {
|
|
10
|
-
type: "
|
|
11
|
+
type: "headers",
|
|
11
12
|
ms: WASM_LOAD_TIMEOUT_MS
|
|
12
13
|
} });
|
|
13
|
-
const module = await WebAssembly.compile(await response
|
|
14
|
+
const module = await WebAssembly.compile(await readBodyWithIdleDeadline(response, { idleMs: WASM_LOAD_TIMEOUT_MS }));
|
|
14
15
|
initSync({ module });
|
|
15
16
|
return { clean_scan_rgba };
|
|
16
17
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fetchWithTimeout } from "@stll/fetch";
|
|
2
|
+
import { readBodyWithIdleDeadline } from "@stll/fetch/body-reader";
|
|
2
3
|
import initWasm, { clean_scan_rgba } from "../generated/scan_engine.js";
|
|
3
4
|
//#region src/scan-engine.worker.ts
|
|
4
5
|
const WASM_LOAD_TIMEOUT_MS = 1e4;
|
|
@@ -8,9 +9,9 @@ const post = (response, transfer = []) => {
|
|
|
8
9
|
let initialized;
|
|
9
10
|
const initialize = async () => {
|
|
10
11
|
initialized ??= fetchWithTimeout(new URL("../generated/scan_engine_bg.wasm", import.meta.url), { timeout: {
|
|
11
|
-
type: "
|
|
12
|
+
type: "headers",
|
|
12
13
|
ms: WASM_LOAD_TIMEOUT_MS
|
|
13
|
-
} }).then(async (response) => await response
|
|
14
|
+
} }).then(async (response) => await readBodyWithIdleDeadline(response, { idleMs: WASM_LOAD_TIMEOUT_MS })).then(async (module_or_path) => {
|
|
14
15
|
await initWasm({ module_or_path });
|
|
15
16
|
});
|
|
16
17
|
await initialized;
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/scan-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Document scan cleanup engine (Rust, WebAssembly): deskew, content crop and binarization off the main thread, plus a per-page review state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"binarization",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"prepack": "bun run build"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@stll/fetch": "^0.
|
|
65
|
+
"@stll/fetch": "^0.2.0",
|
|
66
66
|
"better-result": "3.0.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@stll/typescript-config": "0.0.0",
|
|
70
70
|
"bun-types": "1.4.4",
|
|
71
|
-
"tsdown": "0.23.
|
|
71
|
+
"tsdown": "0.23.1"
|
|
72
72
|
},
|
|
73
73
|
"main": "./dist/scan-engine.js",
|
|
74
74
|
"types": "./dist/scan-engine.d.ts"
|