@pbk20191/icodec 0.7.0 → 0.8.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 +48 -43
- package/dist/avif-dec.wasm +0 -0
- package/dist/avif-enc.wasm +0 -0
- package/dist/heic-enc.js +1 -1
- package/dist/mozjpeg.wasm +0 -0
- package/dist/pngquant.js +241 -259
- package/dist/pngquant_bg.wasm +0 -0
- package/dist/vvic-dec.js +2 -0
- package/dist/vvic-dec.wasm +0 -0
- package/dist/vvic-enc.js +2 -0
- package/dist/vvic-enc.wasm +0 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/node.js +2 -5
- package/lib/vvic.d.ts +25 -0
- package/lib/vvic.js +30 -0
- package/package.json +1 -1
- package/versions.json +1 -1
package/dist/pngquant.js
CHANGED
|
@@ -1,42 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
-
let numBytesDecoded = 0;
|
|
18
|
-
function decodeText(ptr, len) {
|
|
19
|
-
numBytesDecoded += len;
|
|
20
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
-
cachedTextDecoder.decode();
|
|
23
|
-
numBytesDecoded = len;
|
|
24
|
-
}
|
|
25
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1
|
+
/**
|
|
2
|
+
* @param {Uint8Array} data
|
|
3
|
+
* @param {number} width
|
|
4
|
+
* @param {number} height
|
|
5
|
+
* @param {any} options
|
|
6
|
+
* @returns {Uint8Array}
|
|
7
|
+
*/
|
|
8
|
+
export function optimize(data, width, height, options) {
|
|
9
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
10
|
+
const len0 = WASM_VECTOR_LEN;
|
|
11
|
+
const ret = wasm.optimize(ptr0, len0, width, height, options);
|
|
12
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
13
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
14
|
+
return v2;
|
|
26
15
|
}
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Decode PNG image into 8-bit RGBA data, return only the buffer and width,
|
|
19
|
+
* but height can be calculated by `data.byteLength / width / 4`
|
|
20
|
+
* @param {Uint8Array} data
|
|
21
|
+
* @returns {Array<any>}
|
|
22
|
+
*/
|
|
23
|
+
export function png_to_rgba(data) {
|
|
24
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
25
|
+
const len0 = WASM_VECTOR_LEN;
|
|
26
|
+
const ret = wasm.png_to_rgba(ptr0, len0);
|
|
27
|
+
return ret;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @param {Uint8Array} data
|
|
32
|
+
* @param {number} width
|
|
33
|
+
* @param {number} height
|
|
34
|
+
* @param {any} options
|
|
35
|
+
* @returns {Uint8Array}
|
|
36
|
+
*/
|
|
37
|
+
export function quantize(data, width, height, options) {
|
|
38
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
39
|
+
const len0 = WASM_VECTOR_LEN;
|
|
40
|
+
const ret = wasm.quantize(ptr0, len0, width, height, options);
|
|
41
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
42
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
43
|
+
return v2;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
function
|
|
39
|
-
|
|
46
|
+
function __wbg_get_imports() {
|
|
47
|
+
const import0 = {
|
|
48
|
+
__proto__: null,
|
|
49
|
+
__wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
|
|
50
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
51
|
+
return ret;
|
|
52
|
+
},
|
|
53
|
+
__wbg_Number_a5a435bd7bbec835: function(arg0) {
|
|
54
|
+
const ret = Number(arg0);
|
|
55
|
+
return ret;
|
|
56
|
+
},
|
|
57
|
+
__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
|
|
58
|
+
const v = arg0;
|
|
59
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
60
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
61
|
+
},
|
|
62
|
+
__wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
|
|
63
|
+
const ret = debugString(arg1);
|
|
64
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
65
|
+
const len1 = WASM_VECTOR_LEN;
|
|
66
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
67
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
68
|
+
},
|
|
69
|
+
__wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
|
|
70
|
+
const ret = arg0 in arg1;
|
|
71
|
+
return ret;
|
|
72
|
+
},
|
|
73
|
+
__wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
|
|
74
|
+
const val = arg0;
|
|
75
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
76
|
+
return ret;
|
|
77
|
+
},
|
|
78
|
+
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
79
|
+
const ret = arg0 === undefined;
|
|
80
|
+
return ret;
|
|
81
|
+
},
|
|
82
|
+
__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
|
|
83
|
+
const ret = arg0 == arg1;
|
|
84
|
+
return ret;
|
|
85
|
+
},
|
|
86
|
+
__wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
|
|
87
|
+
const obj = arg1;
|
|
88
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
89
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
90
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
91
|
+
},
|
|
92
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
93
|
+
const obj = arg1;
|
|
94
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
95
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
+
var len1 = WASM_VECTOR_LEN;
|
|
97
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
98
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
99
|
+
},
|
|
100
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
101
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
102
|
+
},
|
|
103
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
104
|
+
const ret = arg0[arg1];
|
|
105
|
+
return ret;
|
|
106
|
+
},
|
|
107
|
+
__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
|
|
108
|
+
let result;
|
|
109
|
+
try {
|
|
110
|
+
result = arg0 instanceof ArrayBuffer;
|
|
111
|
+
} catch (_) {
|
|
112
|
+
result = false;
|
|
113
|
+
}
|
|
114
|
+
const ret = result;
|
|
115
|
+
return ret;
|
|
116
|
+
},
|
|
117
|
+
__wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
|
|
118
|
+
let result;
|
|
119
|
+
try {
|
|
120
|
+
result = arg0 instanceof Uint8Array;
|
|
121
|
+
} catch (_) {
|
|
122
|
+
result = false;
|
|
123
|
+
}
|
|
124
|
+
const ret = result;
|
|
125
|
+
return ret;
|
|
126
|
+
},
|
|
127
|
+
__wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
|
|
128
|
+
const ret = Number.isSafeInteger(arg0);
|
|
129
|
+
return ret;
|
|
130
|
+
},
|
|
131
|
+
__wbg_length_ea16607d7b61445b: function(arg0) {
|
|
132
|
+
const ret = arg0.length;
|
|
133
|
+
return ret;
|
|
134
|
+
},
|
|
135
|
+
__wbg_new_5f486cdf45a04d78: function(arg0) {
|
|
136
|
+
const ret = new Uint8Array(arg0);
|
|
137
|
+
return ret;
|
|
138
|
+
},
|
|
139
|
+
__wbg_new_from_slice_d16553cb630d3573: function(arg0, arg1) {
|
|
140
|
+
const ret = new Uint8ClampedArray(getArrayU8FromWasm0(arg0, arg1));
|
|
141
|
+
return ret;
|
|
142
|
+
},
|
|
143
|
+
__wbg_of_8fd5dd402bc67165: function(arg0, arg1, arg2) {
|
|
144
|
+
const ret = Array.of(arg0, arg1, arg2);
|
|
145
|
+
return ret;
|
|
146
|
+
},
|
|
147
|
+
__wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
|
|
148
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
149
|
+
},
|
|
150
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
151
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
152
|
+
const ret = arg0;
|
|
153
|
+
return ret;
|
|
154
|
+
},
|
|
155
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
156
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
157
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
158
|
+
return ret;
|
|
159
|
+
},
|
|
160
|
+
__wbindgen_init_externref_table: function() {
|
|
161
|
+
const table = wasm.__wbindgen_externrefs;
|
|
162
|
+
const offset = table.grow(4);
|
|
163
|
+
table.set(0, undefined);
|
|
164
|
+
table.set(offset + 0, undefined);
|
|
165
|
+
table.set(offset + 1, null);
|
|
166
|
+
table.set(offset + 2, true);
|
|
167
|
+
table.set(offset + 3, false);
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
__proto__: null,
|
|
172
|
+
"./pngquant_bg.js": import0,
|
|
173
|
+
};
|
|
40
174
|
}
|
|
41
175
|
|
|
42
176
|
function debugString(val) {
|
|
@@ -104,23 +238,44 @@ function debugString(val) {
|
|
|
104
238
|
return className;
|
|
105
239
|
}
|
|
106
240
|
|
|
107
|
-
|
|
241
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
242
|
+
ptr = ptr >>> 0;
|
|
243
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
244
|
+
}
|
|
108
245
|
|
|
109
|
-
|
|
246
|
+
let cachedDataViewMemory0 = null;
|
|
247
|
+
function getDataViewMemory0() {
|
|
248
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
249
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
250
|
+
}
|
|
251
|
+
return cachedDataViewMemory0;
|
|
252
|
+
}
|
|
110
253
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
254
|
+
function getStringFromWasm0(ptr, len) {
|
|
255
|
+
ptr = ptr >>> 0;
|
|
256
|
+
return decodeText(ptr, len);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let cachedUint8ArrayMemory0 = null;
|
|
260
|
+
function getUint8ArrayMemory0() {
|
|
261
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
262
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
119
263
|
}
|
|
264
|
+
return cachedUint8ArrayMemory0;
|
|
120
265
|
}
|
|
121
266
|
|
|
122
|
-
function
|
|
267
|
+
function isLikeNone(x) {
|
|
268
|
+
return x === undefined || x === null;
|
|
269
|
+
}
|
|
123
270
|
|
|
271
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
272
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
273
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
274
|
+
WASM_VECTOR_LEN = arg.length;
|
|
275
|
+
return ptr;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
124
279
|
if (realloc === undefined) {
|
|
125
280
|
const buf = cachedTextEncoder.encode(arg);
|
|
126
281
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -141,7 +296,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
141
296
|
if (code > 0x7F) break;
|
|
142
297
|
mem[ptr + offset] = code;
|
|
143
298
|
}
|
|
144
|
-
|
|
145
299
|
if (offset !== len) {
|
|
146
300
|
if (offset !== 0) {
|
|
147
301
|
arg = arg.slice(offset);
|
|
@@ -158,249 +312,85 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
158
312
|
return ptr;
|
|
159
313
|
}
|
|
160
314
|
|
|
161
|
-
let
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
315
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
316
|
+
cachedTextDecoder.decode();
|
|
317
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
318
|
+
let numBytesDecoded = 0;
|
|
319
|
+
function decodeText(ptr, len) {
|
|
320
|
+
numBytesDecoded += len;
|
|
321
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
322
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
323
|
+
cachedTextDecoder.decode();
|
|
324
|
+
numBytesDecoded = len;
|
|
166
325
|
}
|
|
167
|
-
return
|
|
326
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
168
327
|
}
|
|
169
328
|
|
|
170
|
-
|
|
171
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
172
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
173
|
-
WASM_VECTOR_LEN = arg.length;
|
|
174
|
-
return ptr;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @param {Uint8Array} data
|
|
178
|
-
* @param {number} width
|
|
179
|
-
* @param {number} height
|
|
180
|
-
* @param {any} options
|
|
181
|
-
* @returns {Uint8Array}
|
|
182
|
-
*/
|
|
183
|
-
export function optimize(data, width, height, options) {
|
|
184
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
185
|
-
const len0 = WASM_VECTOR_LEN;
|
|
186
|
-
const ret = wasm.optimize(ptr0, len0, width, height, options);
|
|
187
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
188
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
189
|
-
return v2;
|
|
190
|
-
}
|
|
329
|
+
const cachedTextEncoder = new TextEncoder();
|
|
191
330
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const len0 = WASM_VECTOR_LEN;
|
|
202
|
-
const ret = wasm.quantize(ptr0, len0, width, height, options);
|
|
203
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
204
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
205
|
-
return v2;
|
|
331
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
332
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
333
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
334
|
+
view.set(buf);
|
|
335
|
+
return {
|
|
336
|
+
read: arg.length,
|
|
337
|
+
written: buf.length
|
|
338
|
+
};
|
|
339
|
+
};
|
|
206
340
|
}
|
|
207
341
|
|
|
208
|
-
|
|
209
|
-
* Decode PNG image into 8-bit RGBA data, return only the buffer and width,
|
|
210
|
-
* but height can be calculated by `data.byteLength / width / 4`
|
|
211
|
-
* @param {Uint8Array} data
|
|
212
|
-
* @returns {Array<any>}
|
|
213
|
-
*/
|
|
214
|
-
export function png_to_rgba(data) {
|
|
215
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
216
|
-
const len0 = WASM_VECTOR_LEN;
|
|
217
|
-
const ret = wasm.png_to_rgba(ptr0, len0);
|
|
218
|
-
return ret;
|
|
219
|
-
}
|
|
342
|
+
let WASM_VECTOR_LEN = 0;
|
|
220
343
|
|
|
221
|
-
|
|
344
|
+
let wasmModule, wasm;
|
|
345
|
+
function __wbg_finalize_init(instance, module) {
|
|
346
|
+
wasm = instance.exports;
|
|
347
|
+
wasmModule = module;
|
|
348
|
+
cachedDataViewMemory0 = null;
|
|
349
|
+
cachedUint8ArrayMemory0 = null;
|
|
350
|
+
wasm.__wbindgen_start();
|
|
351
|
+
return wasm;
|
|
352
|
+
}
|
|
222
353
|
|
|
223
354
|
async function __wbg_load(module, imports) {
|
|
224
355
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
225
356
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
226
357
|
try {
|
|
227
358
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
228
|
-
|
|
229
359
|
} catch (e) {
|
|
230
|
-
const validResponse = module.ok &&
|
|
360
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
231
361
|
|
|
232
362
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
233
363
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
234
364
|
|
|
235
|
-
} else {
|
|
236
|
-
throw e;
|
|
237
|
-
}
|
|
365
|
+
} else { throw e; }
|
|
238
366
|
}
|
|
239
367
|
}
|
|
240
368
|
|
|
241
369
|
const bytes = await module.arrayBuffer();
|
|
242
370
|
return await WebAssembly.instantiate(bytes, imports);
|
|
243
|
-
|
|
244
371
|
} else {
|
|
245
372
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
246
373
|
|
|
247
374
|
if (instance instanceof WebAssembly.Instance) {
|
|
248
375
|
return { instance, module };
|
|
249
|
-
|
|
250
376
|
} else {
|
|
251
377
|
return instance;
|
|
252
378
|
}
|
|
253
379
|
}
|
|
254
|
-
}
|
|
255
380
|
|
|
256
|
-
function
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
imports.wbg.__wbg_Error_e17e777aac105295 = function(arg0, arg1) {
|
|
260
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
261
|
-
return ret;
|
|
262
|
-
};
|
|
263
|
-
imports.wbg.__wbg_Number_998bea33bd87c3e0 = function(arg0) {
|
|
264
|
-
const ret = Number(arg0);
|
|
265
|
-
return ret;
|
|
266
|
-
};
|
|
267
|
-
imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
|
|
268
|
-
const ret = arg0[arg1];
|
|
269
|
-
return ret;
|
|
270
|
-
};
|
|
271
|
-
imports.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd = function(arg0) {
|
|
272
|
-
let result;
|
|
273
|
-
try {
|
|
274
|
-
result = arg0 instanceof ArrayBuffer;
|
|
275
|
-
} catch (_) {
|
|
276
|
-
result = false;
|
|
277
|
-
}
|
|
278
|
-
const ret = result;
|
|
279
|
-
return ret;
|
|
280
|
-
};
|
|
281
|
-
imports.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7 = function(arg0) {
|
|
282
|
-
let result;
|
|
283
|
-
try {
|
|
284
|
-
result = arg0 instanceof Uint8Array;
|
|
285
|
-
} catch (_) {
|
|
286
|
-
result = false;
|
|
381
|
+
function expectedResponseType(type) {
|
|
382
|
+
switch (type) {
|
|
383
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
287
384
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
};
|
|
291
|
-
imports.wbg.__wbg_isSafeInteger_1c0d1af5542e102a = function(arg0) {
|
|
292
|
-
const ret = Number.isSafeInteger(arg0);
|
|
293
|
-
return ret;
|
|
294
|
-
};
|
|
295
|
-
imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
|
|
296
|
-
const ret = arg0.length;
|
|
297
|
-
return ret;
|
|
298
|
-
};
|
|
299
|
-
imports.wbg.__wbg_new_638ebfaedbf32a5e = function(arg0) {
|
|
300
|
-
const ret = new Uint8Array(arg0);
|
|
301
|
-
return ret;
|
|
302
|
-
};
|
|
303
|
-
imports.wbg.__wbg_newfromslice_550eeea99b5190f9 = function(arg0, arg1) {
|
|
304
|
-
const ret = new Uint8ClampedArray(getArrayU8FromWasm0(arg0, arg1));
|
|
305
|
-
return ret;
|
|
306
|
-
};
|
|
307
|
-
imports.wbg.__wbg_of_26ef42cc9a4270a1 = function(arg0, arg1, arg2) {
|
|
308
|
-
const ret = Array.of(arg0, arg1, arg2);
|
|
309
|
-
return ret;
|
|
310
|
-
};
|
|
311
|
-
imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
|
|
312
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
313
|
-
};
|
|
314
|
-
imports.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746 = function(arg0) {
|
|
315
|
-
const v = arg0;
|
|
316
|
-
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
317
|
-
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
318
|
-
};
|
|
319
|
-
imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
|
|
320
|
-
const ret = debugString(arg1);
|
|
321
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
322
|
-
const len1 = WASM_VECTOR_LEN;
|
|
323
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
324
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
325
|
-
};
|
|
326
|
-
imports.wbg.__wbg_wbindgenin_d7a1ee10933d2d55 = function(arg0, arg1) {
|
|
327
|
-
const ret = arg0 in arg1;
|
|
328
|
-
return ret;
|
|
329
|
-
};
|
|
330
|
-
imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function(arg0) {
|
|
331
|
-
const val = arg0;
|
|
332
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
333
|
-
return ret;
|
|
334
|
-
};
|
|
335
|
-
imports.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
|
|
336
|
-
const ret = arg0 === undefined;
|
|
337
|
-
return ret;
|
|
338
|
-
};
|
|
339
|
-
imports.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1 = function(arg0, arg1) {
|
|
340
|
-
const ret = arg0 == arg1;
|
|
341
|
-
return ret;
|
|
342
|
-
};
|
|
343
|
-
imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
|
|
344
|
-
const obj = arg1;
|
|
345
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
346
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
347
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
348
|
-
};
|
|
349
|
-
imports.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
|
|
350
|
-
const obj = arg1;
|
|
351
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
352
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
353
|
-
var len1 = WASM_VECTOR_LEN;
|
|
354
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
355
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
356
|
-
};
|
|
357
|
-
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
|
358
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
359
|
-
};
|
|
360
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
361
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
362
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
363
|
-
return ret;
|
|
364
|
-
};
|
|
365
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
366
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
367
|
-
const ret = arg0;
|
|
368
|
-
return ret;
|
|
369
|
-
};
|
|
370
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
371
|
-
const table = wasm.__wbindgen_export_2;
|
|
372
|
-
const offset = table.grow(4);
|
|
373
|
-
table.set(0, undefined);
|
|
374
|
-
table.set(offset + 0, undefined);
|
|
375
|
-
table.set(offset + 1, null);
|
|
376
|
-
table.set(offset + 2, true);
|
|
377
|
-
table.set(offset + 3, false);
|
|
378
|
-
;
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
return imports;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function __wbg_init_memory(imports, memory) {
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function __wbg_finalize_init(instance, module) {
|
|
389
|
-
wasm = instance.exports;
|
|
390
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
391
|
-
cachedDataViewMemory0 = null;
|
|
392
|
-
cachedUint8ArrayMemory0 = null;
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
wasm.__wbindgen_start();
|
|
396
|
-
return wasm;
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
397
387
|
}
|
|
398
388
|
|
|
399
389
|
function initSync(module) {
|
|
400
390
|
if (wasm !== undefined) return wasm;
|
|
401
391
|
|
|
402
392
|
|
|
403
|
-
if (
|
|
393
|
+
if (module !== undefined) {
|
|
404
394
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
405
395
|
({module} = module)
|
|
406
396
|
} else {
|
|
@@ -409,15 +399,10 @@ function initSync(module) {
|
|
|
409
399
|
}
|
|
410
400
|
|
|
411
401
|
const imports = __wbg_get_imports();
|
|
412
|
-
|
|
413
|
-
__wbg_init_memory(imports);
|
|
414
|
-
|
|
415
402
|
if (!(module instanceof WebAssembly.Module)) {
|
|
416
403
|
module = new WebAssembly.Module(module);
|
|
417
404
|
}
|
|
418
|
-
|
|
419
405
|
const instance = new WebAssembly.Instance(module, imports);
|
|
420
|
-
|
|
421
406
|
return __wbg_finalize_init(instance, module);
|
|
422
407
|
}
|
|
423
408
|
|
|
@@ -425,7 +410,7 @@ async function __wbg_init(module_or_path) {
|
|
|
425
410
|
if (wasm !== undefined) return wasm;
|
|
426
411
|
|
|
427
412
|
|
|
428
|
-
if (
|
|
413
|
+
if (module_or_path !== undefined) {
|
|
429
414
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
430
415
|
({module_or_path} = module_or_path)
|
|
431
416
|
} else {
|
|
@@ -433,7 +418,7 @@ async function __wbg_init(module_or_path) {
|
|
|
433
418
|
}
|
|
434
419
|
}
|
|
435
420
|
|
|
436
|
-
if (
|
|
421
|
+
if (module_or_path === undefined) {
|
|
437
422
|
module_or_path = new URL('pngquant_bg.wasm', import.meta.url);
|
|
438
423
|
}
|
|
439
424
|
const imports = __wbg_get_imports();
|
|
@@ -442,12 +427,9 @@ async function __wbg_init(module_or_path) {
|
|
|
442
427
|
module_or_path = fetch(module_or_path);
|
|
443
428
|
}
|
|
444
429
|
|
|
445
|
-
__wbg_init_memory(imports);
|
|
446
|
-
|
|
447
430
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
448
431
|
|
|
449
432
|
return __wbg_finalize_init(instance, module);
|
|
450
433
|
}
|
|
451
434
|
|
|
452
|
-
export { initSync };
|
|
453
|
-
export default __wbg_init;
|
|
435
|
+
export { initSync, __wbg_init as default };
|
package/dist/pngquant_bg.wasm
CHANGED
|
Binary file
|