@stll/scan-engine 0.1.1 → 0.1.2

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 CHANGED
@@ -119,4 +119,16 @@ bun run build:wasm && bun run check:wasm --check
119
119
  ```
120
120
 
121
121
  Generated bindings in `generated/` are committed and ship in the package next
122
- to `dist/`.
122
+ to `dist/`. CI requires them byte for byte, so `build:wasm` runs only on x86_64
123
+ Linux with the Rust version in `rust-toolchain.toml`. On any other host (macOS,
124
+ ARM64 Linux), run `bun run build:wasm:container`: it runs the same script in
125
+ the official `linux/amd64` Rust image pinned by digest, through Docker or a
126
+ compatible runtime such as OrbStack. Crates, the `wasm-bindgen` CLI and the
127
+ build cache stay in Docker volumes, never in the host's `~/.cargo`. A cold run
128
+ compiles `wasm-bindgen` under emulation and takes several minutes.
129
+
130
+ Update crates with `bun run cargo:update --manifest-path
131
+ packages/scan-engine/Cargo.toml <crate>` from the repository root, never with a
132
+ bare `cargo update`: it keeps every new pin out of the release-age quarantine
133
+ that CI enforces on `Cargo.lock`. `deny.toml` is the crate's `cargo deny`
134
+ policy (licenses, bans, sources and advisories).
package/dist/review.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { CleanScanResult, PhysicalPageSize, RasterizedScanPage, ScanEngine, ScanEngineError, ScanOptions, ScanPageRotation } from "./types.js";
2
2
  import { Result } from "better-result";
3
- //#region src/review.d.ts
4
3
  type CleanedScan = Extract<CleanScanResult, {
5
4
  type: "cleaned";
6
5
  }>;
@@ -47,5 +46,4 @@ export type TargetPageBox = PhysicalPageSize & {
47
46
  rotation: ScanPageRotation;
48
47
  };
49
48
  export declare const targetPageBox: (pageSize: PhysicalPageSize, rotation: ScanPageRotation) => TargetPageBox;
50
- //#endregion
51
49
  export {};
package/dist/review.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Result, panic } from "better-result";
2
- //#region src/review.ts
2
+ // src/review.ts
3
3
  const reviewPage = async ({ engine, pageId, page, options }) => {
4
4
  const result = await engine.clean(page, options);
5
5
  if (result.isErr()) return Result.err(result.error);
@@ -78,5 +78,4 @@ const targetPageBox = (pageSize, rotation) => ({
78
78
  heightPoints: pageSize.heightPoints,
79
79
  rotation
80
80
  });
81
- //#endregion
82
81
  export { applyAll, applyOne, createCleanScanReview, rejectOne, reviewPage, setPageReview, targetPageBox, undoCleanScanReview };
@@ -1,5 +1,4 @@
1
1
  import { RasterizedScanPage, ScanEngine, ScanOptions } from "./types.js";
2
- //#region src/worker-protocol.d.ts
3
2
  type SerializedWasmResult = {
4
3
  status: string;
5
4
  reason: string;
@@ -25,8 +24,6 @@ type WorkerResponse = {
25
24
  errorType: "runtime-trap" | "failure";
26
25
  message: string;
27
26
  };
28
- //#endregion
29
- //#region src/scan-engine.d.ts
30
27
  type WasmScanResult = {
31
28
  free: () => void;
32
29
  readonly status: string;
@@ -54,5 +51,4 @@ type WorkerEngineOptions = {
54
51
  };
55
52
  export declare const createScanEngine: (load?: WasmLoader, workerOptions?: WorkerEngineOptions) => ScanEngine;
56
53
  export declare const scanEngine: ScanEngine;
57
- //#endregion
58
54
  export {};
@@ -3,7 +3,7 @@ import { Result } from "better-result";
3
3
  import { fetchWithTimeout } from "@stll/fetch";
4
4
  import { readBodyWithIdleDeadline } from "@stll/fetch/body-reader";
5
5
  import { clean_scan_rgba, initSync } from "../generated/scan_engine.js";
6
- //#region src/scan-engine.ts
6
+ // src/scan-engine.ts
7
7
  const WASM_LOAD_TIMEOUT_MS = 1e4;
8
8
  const WORKER_REQUEST_TIMEOUT_MS = 1e4;
9
9
  const loadWasmBindings = async () => {
@@ -220,5 +220,4 @@ const createScanEngine = (load, workerOptions) => {
220
220
  }) };
221
221
  };
222
222
  const scanEngine = createScanEngine();
223
- //#endregion
224
223
  export { createScanEngine, scanEngine };
@@ -1,7 +1,7 @@
1
1
  import { fetchWithTimeout } from "@stll/fetch";
2
2
  import { readBodyWithIdleDeadline } from "@stll/fetch/body-reader";
3
3
  import initWasm, { clean_scan_rgba } from "../generated/scan_engine.js";
4
- //#region src/scan-engine.worker.ts
4
+ // src/scan-engine.worker.ts
5
5
  const WASM_LOAD_TIMEOUT_MS = 1e4;
6
6
  const post = (response, transfer = []) => {
7
7
  Reflect.apply(postMessage, globalThis, [response, transfer]);
@@ -58,4 +58,3 @@ addEventListener("message", (event) => {
58
58
  });
59
59
  });
60
60
  });
61
- //#endregion
package/dist/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Result } from "better-result";
2
- //#region src/types.d.ts
3
2
  export type ScanPageRotation = 0 | 90 | 180 | 270;
4
3
  export type PhysicalPageSize = {
5
4
  widthPoints: number;
@@ -69,5 +68,4 @@ export declare class ScanEngineError extends ScanEngineError_base<{
69
68
  export type ScanEngine = {
70
69
  clean: (page: RasterizedScanPage, options: ScanOptions) => Promise<Result<CleanScanResult, ScanEngineError>>;
71
70
  };
72
- //#endregion
73
71
  export {};
package/dist/types.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { TaggedError } from "better-result";
2
- //#region src/types.ts
2
+ // src/types.ts
3
3
  var ScanEngineError = class extends TaggedError("ScanEngineError") {};
4
- //#endregion
5
4
  export { ScanEngineError };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/scan-engine",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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",
@@ -56,6 +56,7 @@
56
56
  "lint:fix": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --type-aware --fix packages/scan-engine",
57
57
  "format:rust": "cargo fmt",
58
58
  "build:wasm": "bash scripts/build-wasm.sh",
59
+ "build:wasm:container": "bash scripts/build-wasm-container.sh",
59
60
  "check:wasm": "bun --preload ../../scripts/offline-network-preload.ts scripts/check-wasm.ts",
60
61
  "generate:fixtures": "bun scripts/generate-fixtures.ts",
61
62
  "check:fixtures": "bun scripts/generate-fixtures.ts --check",