@oxc-parser/wasm
Advanced tools
Comparing version
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function __wbg_parseresult_free(a: number): void; | ||
export function __wbg_parseresult_free(a: number, b: number): void; | ||
export function __wbg_get_parseresult_program(a: number): number; | ||
@@ -6,0 +6,0 @@ export function __wbg_get_parseresult_errors(a: number, b: number): void; |
@@ -1205,5 +1205,5 @@ /* tslint:disable */ | ||
type: "CallExpression"; | ||
arguments: Argument[]; | ||
callee: Expression; | ||
typeParameters: TSTypeParameterInstantiation | null; | ||
arguments: Argument[]; | ||
optional: boolean; | ||
@@ -1312,3 +1312,3 @@ } | ||
export type ReferenceId = number; | ||
export type ReferenceFlag = { | ||
export type ReferenceFlags = { | ||
None: 0, | ||
@@ -1315,0 +1315,0 @@ Read: 0b1, |
@@ -0,1 +1,2 @@ | ||
let imports = {}; | ||
@@ -30,9 +31,9 @@ imports['__wbindgen_placeholder__'] = module.exports; | ||
let cachedUint8Memory0 = null; | ||
let cachedUint8ArrayMemory0 = null; | ||
function getUint8Memory0() { | ||
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { | ||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
function getUint8ArrayMemory0() { | ||
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { | ||
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachedUint8Memory0; | ||
return cachedUint8ArrayMemory0; | ||
} | ||
@@ -42,3 +43,3 @@ | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); | ||
} | ||
@@ -77,3 +78,3 @@ | ||
const ptr = malloc(buf.length, 1) >>> 0; | ||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); | ||
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); | ||
WASM_VECTOR_LEN = buf.length; | ||
@@ -86,3 +87,3 @@ return ptr; | ||
const mem = getUint8Memory0(); | ||
const mem = getUint8ArrayMemory0(); | ||
@@ -102,3 +103,3 @@ let offset = 0; | ||
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; | ||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len); | ||
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); | ||
const ret = encodeString(arg, view); | ||
@@ -118,9 +119,9 @@ | ||
let cachedInt32Memory0 = null; | ||
let cachedDataViewMemory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
function getDataViewMemory0() { | ||
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { | ||
cachedDataViewMemory0 = new DataView(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
return cachedDataViewMemory0; | ||
} | ||
@@ -193,18 +194,8 @@ | ||
let cachedUint32Memory0 = null; | ||
function getUint32Memory0() { | ||
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) { | ||
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer); | ||
} | ||
return cachedUint32Memory0; | ||
} | ||
function getArrayJsValueFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
const mem = getUint32Memory0(); | ||
const slice = mem.subarray(ptr / 4, ptr / 4 + len); | ||
const mem = getDataViewMemory0(); | ||
const result = []; | ||
for (let i = 0; i < slice.length; i++) { | ||
result.push(takeObject(slice[i])); | ||
for (let i = ptr; i < ptr + 4 * len; i += 4) { | ||
result.push(takeObject(mem.getUint32(i, true))); | ||
} | ||
@@ -232,5 +223,5 @@ return result; | ||
wasm.parseSync(retptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); | ||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); | ||
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); | ||
if (r2) { | ||
@@ -255,3 +246,3 @@ throw takeObject(r1); | ||
? { register: () => {}, unregister: () => {} } | ||
: new FinalizationRegistry(ptr => wasm.__wbg_parseresult_free(ptr >>> 0)); | ||
: new FinalizationRegistry(ptr => wasm.__wbg_parseresult_free(ptr >>> 0, 1)); | ||
/** | ||
@@ -278,3 +269,3 @@ */ | ||
const ptr = this.__destroy_into_raw(); | ||
wasm.__wbg_parseresult_free(ptr); | ||
wasm.__wbg_parseresult_free(ptr, 0); | ||
} | ||
@@ -295,4 +286,4 @@ /** | ||
wasm.__wbg_get_parseresult_errors(retptr, this.__wbg_ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); | ||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); | ||
var v1 = getArrayJsValueFromWasm0(r0, r1).slice(); | ||
@@ -337,4 +328,4 @@ wasm.__wbindgen_export_2(r0, r1 * 4, 4); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); | ||
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); | ||
}; | ||
@@ -394,4 +385,4 @@ | ||
const len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); | ||
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); | ||
}; | ||
@@ -398,0 +389,0 @@ |
{ | ||
"name": "@oxc-parser/wasm", | ||
"version": "0.24.3", | ||
"version": "0.25.0", | ||
"description": "Wasm target for the oxc parser.", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
}, | ||
"packageManager": "pnpm@9.7.1+sha512.faf344af2d6ca65c4c5c8c2224ea77a81a5e8859cbc4e06b1511ddce2f0151512431dd19e6aff31f2c6a8f5f2aced9bd2273e1fed7dd4de1868984059d2c4247" | ||
"packageManager": "pnpm@9.8.0+sha512.8e4c3550fb500e808dbc30bb0ce4dd1eb614e30b1c55245f211591ec2cdf9c611cabd34e1364b42f564bd54b3945ed0f49d61d1bbf2ec9bd74b866fcdc723276" | ||
} |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function __wbg_parseresult_free(a: number): void; | ||
export function __wbg_parseresult_free(a: number, b: number): void; | ||
export function __wbg_get_parseresult_program(a: number): number; | ||
@@ -6,0 +6,0 @@ export function __wbg_get_parseresult_errors(a: number, b: number): void; |
@@ -1205,5 +1205,5 @@ /* tslint:disable */ | ||
type: "CallExpression"; | ||
arguments: Argument[]; | ||
callee: Expression; | ||
typeParameters: TSTypeParameterInstantiation | null; | ||
arguments: Argument[]; | ||
optional: boolean; | ||
@@ -1312,3 +1312,3 @@ } | ||
export type ReferenceId = number; | ||
export type ReferenceFlag = { | ||
export type ReferenceFlags = { | ||
None: 0, | ||
@@ -1375,3 +1375,3 @@ Read: 0b1, | ||
readonly memory: WebAssembly.Memory; | ||
readonly __wbg_parseresult_free: (a: number) => void; | ||
readonly __wbg_parseresult_free: (a: number, b: number) => void; | ||
readonly __wbg_get_parseresult_program: (a: number) => number; | ||
@@ -1392,7 +1392,7 @@ readonly __wbg_get_parseresult_errors: (a: number, b: number) => void; | ||
* | ||
* @param {SyncInitInput} module | ||
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. | ||
* | ||
* @returns {InitOutput} | ||
*/ | ||
export function initSync(module: SyncInitInput): InitOutput; | ||
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; | ||
@@ -1403,6 +1403,6 @@ /** | ||
* | ||
* @param {InitInput | Promise<InitInput>} module_or_path | ||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>; | ||
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>; |
@@ -27,9 +27,9 @@ let wasm; | ||
let cachedUint8Memory0 = null; | ||
let cachedUint8ArrayMemory0 = null; | ||
function getUint8Memory0() { | ||
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { | ||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
function getUint8ArrayMemory0() { | ||
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { | ||
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachedUint8Memory0; | ||
return cachedUint8ArrayMemory0; | ||
} | ||
@@ -39,3 +39,3 @@ | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); | ||
} | ||
@@ -74,3 +74,3 @@ | ||
const ptr = malloc(buf.length, 1) >>> 0; | ||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); | ||
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); | ||
WASM_VECTOR_LEN = buf.length; | ||
@@ -83,3 +83,3 @@ return ptr; | ||
const mem = getUint8Memory0(); | ||
const mem = getUint8ArrayMemory0(); | ||
@@ -99,3 +99,3 @@ let offset = 0; | ||
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; | ||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len); | ||
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); | ||
const ret = encodeString(arg, view); | ||
@@ -115,9 +115,9 @@ | ||
let cachedInt32Memory0 = null; | ||
let cachedDataViewMemory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
function getDataViewMemory0() { | ||
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { | ||
cachedDataViewMemory0 = new DataView(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
return cachedDataViewMemory0; | ||
} | ||
@@ -190,18 +190,8 @@ | ||
let cachedUint32Memory0 = null; | ||
function getUint32Memory0() { | ||
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) { | ||
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer); | ||
} | ||
return cachedUint32Memory0; | ||
} | ||
function getArrayJsValueFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
const mem = getUint32Memory0(); | ||
const slice = mem.subarray(ptr / 4, ptr / 4 + len); | ||
const mem = getDataViewMemory0(); | ||
const result = []; | ||
for (let i = 0; i < slice.length; i++) { | ||
result.push(takeObject(slice[i])); | ||
for (let i = ptr; i < ptr + 4 * len; i += 4) { | ||
result.push(takeObject(mem.getUint32(i, true))); | ||
} | ||
@@ -229,5 +219,5 @@ return result; | ||
wasm.parseSync(retptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); | ||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); | ||
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); | ||
if (r2) { | ||
@@ -252,3 +242,3 @@ throw takeObject(r1); | ||
? { register: () => {}, unregister: () => {} } | ||
: new FinalizationRegistry(ptr => wasm.__wbg_parseresult_free(ptr >>> 0)); | ||
: new FinalizationRegistry(ptr => wasm.__wbg_parseresult_free(ptr >>> 0, 1)); | ||
/** | ||
@@ -275,3 +265,3 @@ */ | ||
const ptr = this.__destroy_into_raw(); | ||
wasm.__wbg_parseresult_free(ptr); | ||
wasm.__wbg_parseresult_free(ptr, 0); | ||
} | ||
@@ -292,4 +282,4 @@ /** | ||
wasm.__wbg_get_parseresult_errors(retptr, this.__wbg_ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); | ||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); | ||
var v1 = getArrayJsValueFromWasm0(r0, r1).slice(); | ||
@@ -362,4 +352,4 @@ wasm.__wbindgen_export_2(r0, r1 * 4, 4); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); | ||
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); | ||
}; | ||
@@ -408,4 +398,4 @@ imports.wbg.__wbindgen_number_new = function(arg0) { | ||
const len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); | ||
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); | ||
}; | ||
@@ -419,3 +409,3 @@ imports.wbg.__wbindgen_throw = function(arg0, arg1) { | ||
function __wbg_init_memory(imports, maybe_memory) { | ||
function __wbg_init_memory(imports, memory) { | ||
@@ -427,7 +417,7 @@ } | ||
__wbg_init.__wbindgen_wasm_module = module; | ||
cachedInt32Memory0 = null; | ||
cachedUint32Memory0 = null; | ||
cachedUint8Memory0 = null; | ||
cachedDataViewMemory0 = null; | ||
cachedUint8ArrayMemory0 = null; | ||
return wasm; | ||
@@ -439,2 +429,8 @@ } | ||
if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype) | ||
({module} = module) | ||
else | ||
console.warn('using deprecated parameters for `initSync()`; pass a single object instead') | ||
const imports = __wbg_get_imports(); | ||
@@ -453,12 +449,18 @@ | ||
async function __wbg_init(input) { | ||
async function __wbg_init(module_or_path) { | ||
if (wasm !== undefined) return wasm; | ||
if (typeof input === 'undefined') { | ||
input = new URL('oxc_parser_wasm_bg.wasm', import.meta.url); | ||
if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) | ||
({module_or_path} = module_or_path) | ||
else | ||
console.warn('using deprecated parameters for the initialization function; pass a single object instead') | ||
if (typeof module_or_path === 'undefined') { | ||
module_or_path = new URL('oxc_parser_wasm_bg.wasm', import.meta.url); | ||
} | ||
const imports = __wbg_get_imports(); | ||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { | ||
input = fetch(input); | ||
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { | ||
module_or_path = fetch(module_or_path); | ||
} | ||
@@ -468,3 +470,3 @@ | ||
const { instance, module } = await __wbg_load(await input, imports); | ||
const { instance, module } = await __wbg_load(await module_or_path, imports); | ||
@@ -474,3 +476,3 @@ return __wbg_finalize_init(instance, module); | ||
export { initSync } | ||
export { initSync }; | ||
export default __wbg_init; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1448425
12.55%3015
-0.3%