wasm-image-processor 0.2.0 → 0.3.0

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
@@ -146,9 +146,9 @@ The codebase is structured to easily add new image processing functions:
146
146
 
147
147
  **Near Term:**
148
148
  - [ ] Stable API design
149
- - [ ] npm package publication
149
+ - [x] npm package publication
150
150
  - [ ] Comprehensive documentation
151
- - [ ] CI/CD pipeline
151
+ - [x] CI/CD pipeline
152
152
 
153
153
  **Future Features:**
154
154
  - [ ] Image format conversion (PNG ↔ JPEG ↔ WebP)
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Stanley Masinde <hello@stanleymasinde.com>"
6
6
  ],
7
7
  "description": "High-performance client-side image processing toolkit powered by Rust and WebAssembly",
8
- "version": "0.2.0",
8
+ "version": "0.3.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -4,6 +4,12 @@ export function __wbg_set_wasm(val) {
4
4
  }
5
5
 
6
6
 
7
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
8
+
9
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
10
+
11
+ cachedTextDecoder.decode();
12
+
7
13
  let cachedUint8ArrayMemory0 = null;
8
14
 
9
15
  function getUint8ArrayMemory0() {
@@ -13,6 +19,11 @@ function getUint8ArrayMemory0() {
13
19
  return cachedUint8ArrayMemory0;
14
20
  }
15
21
 
22
+ function getStringFromWasm0(ptr, len) {
23
+ ptr = ptr >>> 0;
24
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
+ }
26
+
16
27
  let WASM_VECTOR_LEN = 0;
17
28
 
18
29
  function passArray8ToWasm0(arg, malloc) {
@@ -22,6 +33,12 @@ function passArray8ToWasm0(arg, malloc) {
22
33
  return ptr;
23
34
  }
24
35
 
36
+ function takeFromExternrefTable0(idx) {
37
+ const value = wasm.__wbindgen_export_0.get(idx);
38
+ wasm.__externref_table_dealloc(idx);
39
+ return value;
40
+ }
41
+
25
42
  function getArrayU8FromWasm0(ptr, len) {
26
43
  ptr = ptr >>> 0;
27
44
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -41,6 +58,9 @@ export function resize_square(image_data, side) {
41
58
  const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
42
59
  const len0 = WASM_VECTOR_LEN;
43
60
  const ret = wasm.resize_square(ptr0, len0, side);
61
+ if (ret[3]) {
62
+ throw takeFromExternrefTable0(ret[2]);
63
+ }
44
64
  var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
45
65
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
46
66
  return v2;
@@ -57,3 +77,8 @@ export function __wbindgen_init_externref_table() {
57
77
  ;
58
78
  };
59
79
 
80
+ export function __wbindgen_string_new(arg0, arg1) {
81
+ const ret = getStringFromWasm0(arg0, arg1);
82
+ return ret;
83
+ };
84
+
Binary file