Rename resize package

Without this, it was creating files in `pkg` prefixed with `squooshresize`, which were ignored by Git.
This commit is contained in:
Ingvar Stepanyan
2019-08-02 14:44:47 +01:00
parent 0a2a4122dc
commit 68177b7590
5 changed files with 80 additions and 89 deletions

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "squooshresize" name = "resize"
version = "0.1.0" version = "0.1.0"
authors = ["Surma <surma@surma.link>"] authors = ["Surma <surma@surma.link>"]

View File

@@ -1,13 +1,24 @@
/* tslint:disable */ /* tslint:disable */
/** /**
* @param {Uint8Array} arg0 * @param {Uint8Array} input_image
* @param {number} arg1 * @param {number} input_width
* @param {number} arg2 * @param {number} input_height
* @param {number} arg3 * @param {number} output_width
* @param {number} arg4 * @param {number} output_height
* @param {number} arg5 * @param {number} typ_idx
* @param {boolean} arg6 * @param {boolean} premultiply
* @param {boolean} arg7 * @param {boolean} color_space_conversion
* @returns {Uint8Array} * @returns {Uint8Array}
*/ */
export function resize(arg0: Uint8Array, arg1: number, arg2: number, arg3: number, arg4: number, arg5: number, arg6: boolean, arg7: boolean): Uint8Array; export function resize(input_image: Uint8Array, input_width: number, input_height: number, output_width: number, output_height: number, typ_idx: number, premultiply: boolean, color_space_conversion: boolean): Uint8Array;
/**
* If `module_or_path` is {RequestInfo}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path
*
* @returns {Promise<any>}
*/
export default function init (module_or_path: RequestInfo | BufferSource | WebAssembly.Module): Promise<any>;

View File

@@ -1,7 +1,6 @@
(function() { (function() {
var wasm;
const __exports = {}; const __exports = {};
let wasm;
let cachegetUint8Memory = null; let cachegetUint8Memory = null;
function getUint8Memory() { function getUint8Memory() {
@@ -20,95 +19,77 @@
return ptr; return ptr;
} }
let cachegetInt32Memory = null;
function getInt32Memory() {
if (cachegetInt32Memory === null || cachegetInt32Memory.buffer !== wasm.memory.buffer) {
cachegetInt32Memory = new Int32Array(wasm.memory.buffer);
}
return cachegetInt32Memory;
}
function getArrayU8FromWasm(ptr, len) { function getArrayU8FromWasm(ptr, len) {
return getUint8Memory().subarray(ptr / 1, ptr / 1 + len); return getUint8Memory().subarray(ptr / 1, ptr / 1 + len);
} }
let cachedGlobalArgumentPtr = null;
function globalArgumentPtr() {
if (cachedGlobalArgumentPtr === null) {
cachedGlobalArgumentPtr = wasm.__wbindgen_global_argument_ptr();
}
return cachedGlobalArgumentPtr;
}
let cachegetUint32Memory = null;
function getUint32Memory() {
if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== wasm.memory.buffer) {
cachegetUint32Memory = new Uint32Array(wasm.memory.buffer);
}
return cachegetUint32Memory;
}
/** /**
* @param {Uint8Array} arg0 * @param {Uint8Array} input_image
* @param {number} arg1 * @param {number} input_width
* @param {number} arg2 * @param {number} input_height
* @param {number} arg3 * @param {number} output_width
* @param {number} arg4 * @param {number} output_height
* @param {number} arg5 * @param {number} typ_idx
* @param {boolean} arg6 * @param {boolean} premultiply
* @param {boolean} arg7 * @param {boolean} color_space_conversion
* @returns {Uint8Array} * @returns {Uint8Array}
*/ */
__exports.resize = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { __exports.resize = function(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {
const ptr0 = passArray8ToWasm(arg0); const retptr = 8;
const len0 = WASM_VECTOR_LEN; const ret = wasm.resize(retptr, passArray8ToWasm(input_image), WASM_VECTOR_LEN, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);
const retptr = globalArgumentPtr(); const memi32 = getInt32Memory();
wasm.resize(retptr, ptr0, len0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); const v0 = getArrayU8FromWasm(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1]).slice();
const mem = getUint32Memory(); wasm.__wbindgen_free(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1] * 1);
const rustptr = mem[retptr / 4]; return v0;
const rustlen = mem[retptr / 4 + 1];
const realRet = getArrayU8FromWasm(rustptr, rustlen).slice();
wasm.__wbindgen_free(rustptr, rustlen * 1);
return realRet;
}; };
const heap = new Array(32); function init(module) {
heap.fill(undefined); let result;
const imports = {};
heap.push(undefined, null, true, false); if (module instanceof URL || typeof module === 'string' || module instanceof Request) {
let heap_next = heap.length; const response = fetch(module);
if (typeof WebAssembly.instantiateStreaming === 'function') {
function dropObject(idx) { result = WebAssembly.instantiateStreaming(response, imports)
if (idx < 36) return; .catch(e => {
heap[idx] = heap_next; console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
heap_next = idx; return response
} .then(r => r.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports));
__exports.__wbindgen_object_drop_ref = function(i) { dropObject(i); }; });
} else {
function init(path_or_module) { result = response
let instantiation;
const imports = { './resize': __exports };
if (path_or_module instanceof WebAssembly.Module) {
instantiation = WebAssembly.instantiate(path_or_module, imports)
.then(instance => {
return { instance, module: path_or_module }
});
} else {
const data = fetch(path_or_module);
if (typeof WebAssembly.instantiateStreaming === 'function') {
instantiation = WebAssembly.instantiateStreaming(data, imports)
.catch(e => {
console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
return data
.then(r => r.arrayBuffer()) .then(r => r.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports)); .then(bytes => WebAssembly.instantiate(bytes, imports));
}); }
} else { } else {
instantiation = data
.then(response => response.arrayBuffer())
.then(buffer => WebAssembly.instantiate(buffer, imports));
}
}
return instantiation.then(({instance}) => {
wasm = init.wasm = instance.exports;
}); result = WebAssembly.instantiate(module, imports)
}; .then(result => {
self.wasm_bindgen = Object.assign(init, __exports); if (result instanceof WebAssembly.Instance) {
return { instance: result, module };
} else {
return result;
}
});
}
return result.then(({instance, module}) => {
wasm = instance.exports;
init.__wbindgen_wasm_module = module;
return wasm;
});
}
self.wasm_bindgen = Object.assign(init, __exports);
})(); })();

View File

@@ -1,6 +1,5 @@
/* tslint:disable */ /* tslint:disable */
export const memory: WebAssembly.Memory; export const memory: WebAssembly.Memory;
export function __wbindgen_global_argument_ptr(): number;
export function __wbindgen_malloc(a: number): number; export function __wbindgen_malloc(a: number): number;
export function __wbindgen_free(a: number, b: number): void; export function __wbindgen_free(a: number, b: number): void;
export function resize(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void; export function resize(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;

Binary file not shown.