merfix 0.1.61 → 0.1.63

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/merfix.d.ts CHANGED
@@ -13,6 +13,7 @@ export enum ExifRemovalStatus {
13
13
  export class ExifRemovalResult {
14
14
  private constructor();
15
15
  free(): void;
16
+ [Symbol.dispose](): void;
16
17
  status(): string;
17
18
  is_error(): boolean;
18
19
  get_data(): Uint8Array | undefined;
package/merfix.js CHANGED
@@ -9,16 +9,16 @@ function getUint8ArrayMemory0() {
9
9
  return cachedUint8ArrayMemory0;
10
10
  }
11
11
 
12
- let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
13
 
14
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
14
+ cachedTextDecoder.decode();
15
15
 
16
16
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
17
  let numBytesDecoded = 0;
18
18
  function decodeText(ptr, len) {
19
19
  numBytesDecoded += len;
20
20
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
- cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
21
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
22
  cachedTextDecoder.decode();
23
23
  numBytesDecoded = len;
24
24
  }
@@ -114,20 +114,18 @@ export function detect_image_extension(data) {
114
114
  return v2;
115
115
  }
116
116
 
117
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
117
+ const cachedTextEncoder = new TextEncoder();
118
118
 
119
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
120
- ? function (arg, view) {
121
- return cachedTextEncoder.encodeInto(arg, view);
119
+ if (!('encodeInto' in cachedTextEncoder)) {
120
+ cachedTextEncoder.encodeInto = function (arg, view) {
121
+ const buf = cachedTextEncoder.encode(arg);
122
+ view.set(buf);
123
+ return {
124
+ read: arg.length,
125
+ written: buf.length
126
+ };
127
+ }
122
128
  }
123
- : function (arg, view) {
124
- const buf = cachedTextEncoder.encode(arg);
125
- view.set(buf);
126
- return {
127
- read: arg.length,
128
- written: buf.length
129
- };
130
- });
131
129
 
132
130
  function passStringToWasm0(arg, malloc, realloc) {
133
131
 
@@ -158,7 +156,7 @@ function passStringToWasm0(arg, malloc, realloc) {
158
156
  }
159
157
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
160
158
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
161
- const ret = encodeString(arg, view);
159
+ const ret = cachedTextEncoder.encodeInto(arg, view);
162
160
 
163
161
  offset += ret.written;
164
162
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -277,6 +275,7 @@ export class ExifRemovalResult {
277
275
  return v1;
278
276
  }
279
277
  }
278
+ if (Symbol.dispose) ExifRemovalResult.prototype[Symbol.dispose] = ExifRemovalResult.prototype.free;
280
279
 
281
280
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
282
281
 
@@ -316,7 +315,7 @@ async function __wbg_load(module, imports) {
316
315
  function __wbg_get_imports() {
317
316
  const imports = {};
318
317
  imports.wbg = {};
319
- imports.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf = function(arg0, arg1) {
318
+ imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
320
319
  throw new Error(getStringFromWasm0(arg0, arg1));
321
320
  };
322
321
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
package/merfix_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "merfix",
3
3
  "type": "module",
4
4
  "description": "Utility to remove EXIF metadata from images from browser",
5
- "version": "0.1.61",
5
+ "version": "0.1.63",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",