minify-html-wasm
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -9,47 +9,19 @@ /* tslint:disable */ | ||
export function minify(code: Uint8Array, config: Config): Uint8Array; | ||
/** | ||
*/ | ||
export class Config { | ||
free(): void; | ||
/** | ||
*/ | ||
do_not_minify_doctype?: boolean; | ||
/** | ||
*/ | ||
ensure_spec_compliant_unquoted_attribute_values?: boolean; | ||
/** | ||
*/ | ||
keep_closing_tags?: boolean; | ||
/** | ||
*/ | ||
keep_comments?: boolean; | ||
/** | ||
*/ | ||
keep_html_and_head_opening_tags?: boolean; | ||
/** | ||
*/ | ||
keep_spaces_between_attributes?: boolean; | ||
/** | ||
*/ | ||
minify_css?: boolean; | ||
/** | ||
*/ | ||
minify_css_level_1?: boolean; | ||
/** | ||
*/ | ||
minify_css_level_2?: boolean; | ||
/** | ||
*/ | ||
minify_css_level_3?: boolean; | ||
/** | ||
*/ | ||
minify_js?: boolean; | ||
/** | ||
*/ | ||
remove_bangs?: boolean; | ||
/** | ||
*/ | ||
remove_processing_instructions?: boolean; | ||
export interface Config { | ||
do_not_minify_doctype?: boolean; | ||
ensure_spec_compliant_unquoted_attribute_values?: boolean; | ||
keep_closing_tags?: boolean; | ||
keep_html_and_head_opening_tags?: boolean; | ||
keep_spaces_between_attributes?: boolean; | ||
keep_comments?: boolean; | ||
minify_css?: boolean; | ||
minify_css_level_1?: boolean; | ||
minify_css_level_2?: boolean; | ||
minify_css_level_3?: boolean; | ||
minify_js?: boolean; | ||
remove_bangs?: boolean; | ||
remove_processing_instructions?: boolean; | ||
} | ||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
@@ -59,33 +31,8 @@ | ||
readonly memory: WebAssembly.Memory; | ||
readonly __wbg_config_free: (a: number) => void; | ||
readonly __wbg_get_config_do_not_minify_doctype: (a: number) => number; | ||
readonly __wbg_set_config_do_not_minify_doctype: (a: number, b: number) => void; | ||
readonly __wbg_get_config_ensure_spec_compliant_unquoted_attribute_values: (a: number) => number; | ||
readonly __wbg_set_config_ensure_spec_compliant_unquoted_attribute_values: (a: number, b: number) => void; | ||
readonly __wbg_get_config_keep_closing_tags: (a: number) => number; | ||
readonly __wbg_set_config_keep_closing_tags: (a: number, b: number) => void; | ||
readonly __wbg_get_config_keep_html_and_head_opening_tags: (a: number) => number; | ||
readonly __wbg_set_config_keep_html_and_head_opening_tags: (a: number, b: number) => void; | ||
readonly __wbg_get_config_keep_spaces_between_attributes: (a: number) => number; | ||
readonly __wbg_set_config_keep_spaces_between_attributes: (a: number, b: number) => void; | ||
readonly __wbg_get_config_keep_comments: (a: number) => number; | ||
readonly __wbg_set_config_keep_comments: (a: number, b: number) => void; | ||
readonly __wbg_get_config_minify_css: (a: number) => number; | ||
readonly __wbg_set_config_minify_css: (a: number, b: number) => void; | ||
readonly __wbg_get_config_minify_css_level_1: (a: number) => number; | ||
readonly __wbg_set_config_minify_css_level_1: (a: number, b: number) => void; | ||
readonly __wbg_get_config_minify_css_level_2: (a: number) => number; | ||
readonly __wbg_set_config_minify_css_level_2: (a: number, b: number) => void; | ||
readonly __wbg_get_config_minify_css_level_3: (a: number) => number; | ||
readonly __wbg_set_config_minify_css_level_3: (a: number, b: number) => void; | ||
readonly __wbg_get_config_minify_js: (a: number) => number; | ||
readonly __wbg_set_config_minify_js: (a: number, b: number) => void; | ||
readonly __wbg_get_config_remove_bangs: (a: number) => number; | ||
readonly __wbg_set_config_remove_bangs: (a: number, b: number) => void; | ||
readonly __wbg_get_config_remove_processing_instructions: (a: number) => number; | ||
readonly __wbg_set_config_remove_processing_instructions: (a: number, b: number) => void; | ||
readonly minify: (a: number, b: number, c: number, d: number) => void; | ||
readonly __wbindgen_malloc: (a: number, b: number) => number; | ||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; | ||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | ||
readonly __wbindgen_malloc: (a: number, b: number) => number; | ||
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
} | ||
@@ -92,0 +39,0 @@ |
let wasm; | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
const heap = new Array(128).fill(undefined); | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
heap.push(undefined, null, true, false); | ||
function getObject(idx) { return heap[idx]; } | ||
let heap_next = heap.length; | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
function dropObject(idx) { | ||
if (idx < 132) return; | ||
heap[idx] = heap_next; | ||
heap_next = idx; | ||
} | ||
function takeObject(idx) { | ||
const ret = getObject(idx); | ||
dropObject(idx); | ||
return ret; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedUint8Memory0 = null; | ||
@@ -16,25 +43,57 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' | ||
? function (arg, view) { | ||
return cachedTextEncoder.encodeInto(arg, view); | ||
} | ||
: function (arg, view) { | ||
const buf = cachedTextEncoder.encode(arg); | ||
view.set(buf); | ||
return { | ||
read: arg.length, | ||
written: buf.length | ||
}; | ||
}); | ||
let WASM_VECTOR_LEN = 0; | ||
function passStringToWasm0(arg, malloc, realloc) { | ||
function passArray8ToWasm0(arg, malloc) { | ||
const ptr = malloc(arg.length * 1, 1) >>> 0; | ||
getUint8Memory0().set(arg, ptr / 1); | ||
WASM_VECTOR_LEN = arg.length; | ||
if (realloc === undefined) { | ||
const buf = cachedTextEncoder.encode(arg); | ||
const ptr = malloc(buf.length, 1) >>> 0; | ||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); | ||
WASM_VECTOR_LEN = buf.length; | ||
return ptr; | ||
} | ||
let len = arg.length; | ||
let ptr = malloc(len, 1) >>> 0; | ||
const mem = getUint8Memory0(); | ||
let offset = 0; | ||
for (; offset < len; offset++) { | ||
const code = arg.charCodeAt(offset); | ||
if (code > 0x7F) break; | ||
mem[ptr + offset] = code; | ||
} | ||
if (offset !== len) { | ||
if (offset !== 0) { | ||
arg = arg.slice(offset); | ||
} | ||
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; | ||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len); | ||
const ret = encodeString(arg, view); | ||
offset += ret.written; | ||
} | ||
WASM_VECTOR_LEN = offset; | ||
return ptr; | ||
} | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
@@ -51,2 +110,18 @@ | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function passArray8ToWasm0(arg, malloc) { | ||
const ptr = malloc(arg.length * 1, 1) >>> 0; | ||
getUint8Memory0().set(arg, ptr / 1); | ||
WASM_VECTOR_LEN = arg.length; | ||
return ptr; | ||
} | ||
function getArrayU8FromWasm0(ptr, len) { | ||
@@ -66,4 +141,3 @@ ptr = ptr >>> 0; | ||
const len0 = WASM_VECTOR_LEN; | ||
_assertClass(config, Config); | ||
wasm.minify(retptr, ptr0, len0, config.__wbg_ptr); | ||
wasm.minify(retptr, ptr0, len0, addHeapObject(config)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -79,186 +153,8 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
*/ | ||
export class Config { | ||
__destroy_into_raw() { | ||
const ptr = this.__wbg_ptr; | ||
this.__wbg_ptr = 0; | ||
return ptr; | ||
function handleError(f, args) { | ||
try { | ||
return f.apply(this, args); | ||
} catch (e) { | ||
wasm.__wbindgen_exn_store(addHeapObject(e)); | ||
} | ||
free() { | ||
const ptr = this.__destroy_into_raw(); | ||
wasm.__wbg_config_free(ptr); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get do_not_minify_doctype() { | ||
const ret = wasm.__wbg_get_config_do_not_minify_doctype(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set do_not_minify_doctype(arg0) { | ||
wasm.__wbg_set_config_do_not_minify_doctype(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get ensure_spec_compliant_unquoted_attribute_values() { | ||
const ret = wasm.__wbg_get_config_ensure_spec_compliant_unquoted_attribute_values(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set ensure_spec_compliant_unquoted_attribute_values(arg0) { | ||
wasm.__wbg_set_config_ensure_spec_compliant_unquoted_attribute_values(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get keep_closing_tags() { | ||
const ret = wasm.__wbg_get_config_keep_closing_tags(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set keep_closing_tags(arg0) { | ||
wasm.__wbg_set_config_keep_closing_tags(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get keep_html_and_head_opening_tags() { | ||
const ret = wasm.__wbg_get_config_keep_html_and_head_opening_tags(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set keep_html_and_head_opening_tags(arg0) { | ||
wasm.__wbg_set_config_keep_html_and_head_opening_tags(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get keep_spaces_between_attributes() { | ||
const ret = wasm.__wbg_get_config_keep_spaces_between_attributes(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set keep_spaces_between_attributes(arg0) { | ||
wasm.__wbg_set_config_keep_spaces_between_attributes(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get keep_comments() { | ||
const ret = wasm.__wbg_get_config_keep_comments(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set keep_comments(arg0) { | ||
wasm.__wbg_set_config_keep_comments(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get minify_css() { | ||
const ret = wasm.__wbg_get_config_minify_css(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set minify_css(arg0) { | ||
wasm.__wbg_set_config_minify_css(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get minify_css_level_1() { | ||
const ret = wasm.__wbg_get_config_minify_css_level_1(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set minify_css_level_1(arg0) { | ||
wasm.__wbg_set_config_minify_css_level_1(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get minify_css_level_2() { | ||
const ret = wasm.__wbg_get_config_minify_css_level_2(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set minify_css_level_2(arg0) { | ||
wasm.__wbg_set_config_minify_css_level_2(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get minify_css_level_3() { | ||
const ret = wasm.__wbg_get_config_minify_css_level_3(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set minify_css_level_3(arg0) { | ||
wasm.__wbg_set_config_minify_css_level_3(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get minify_js() { | ||
const ret = wasm.__wbg_get_config_minify_js(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set minify_js(arg0) { | ||
wasm.__wbg_set_config_minify_js(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get remove_bangs() { | ||
const ret = wasm.__wbg_get_config_remove_bangs(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set remove_bangs(arg0) { | ||
wasm.__wbg_set_config_remove_bangs(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
/** | ||
* @returns {boolean | undefined} | ||
*/ | ||
get remove_processing_instructions() { | ||
const ret = wasm.__wbg_get_config_remove_processing_instructions(this.__wbg_ptr); | ||
return ret === 0xFFFFFF ? undefined : ret !== 0; | ||
} | ||
/** | ||
* @param {boolean | undefined} arg0 | ||
*/ | ||
set remove_processing_instructions(arg0) { | ||
wasm.__wbg_set_config_remove_processing_instructions(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0 ? 1 : 0); | ||
} | ||
} | ||
@@ -300,2 +196,25 @@ | ||
imports.wbg = {}; | ||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_stringify_e25465938f3f611f = function() { return handleError(function (arg0) { | ||
const ret = JSON.stringify(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
imports.wbg.__wbindgen_throw = function(arg0, arg1) { | ||
@@ -302,0 +221,0 @@ throw new Error(getStringFromWasm0(arg0, arg1)); |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"files": [ | ||
@@ -10,0 +10,0 @@ "minify_html_wasm_bg.wasm", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
875039
263
2