@cpchain-foundation/cdl-compiler-node
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -8,1 +8,6 @@ /* tslint:disable */ | ||
export function greet(name: string): string; | ||
/** | ||
* @param {string} cdl | ||
* @returns {string} | ||
*/ | ||
export function compile_cdl(cdl: string): string; |
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextEncoder, TextDecoder } = require(`util`); | ||
const { TextDecoder, TextEncoder } = require(`util`); | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
let cachedUint8Memory0 = null; | ||
@@ -16,2 +19,9 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
@@ -78,11 +88,2 @@ | ||
} | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
/** | ||
@@ -111,2 +112,29 @@ * @param {string} name | ||
/** | ||
* @param {string} cdl | ||
* @returns {string} | ||
*/ | ||
module.exports.compile_cdl = function(cdl) { | ||
let deferred2_0; | ||
let deferred2_1; | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passStringToWasm0(cdl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.compile_cdl(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
deferred2_0 = r0; | ||
deferred2_1 = r1; | ||
return getStringFromWasm0(r0, r1); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); | ||
} | ||
}; | ||
module.exports.__wbindgen_throw = function(arg0, arg1) { | ||
throw new Error(getStringFromWasm0(arg0, arg1)); | ||
}; | ||
const path = require('path').join(__dirname, 'cdl-compiler-node_bg.wasm'); | ||
@@ -113,0 +141,0 @@ const bytes = require('fs').readFileSync(path); |
{ | ||
"name": "@cpchain-foundation/cdl-compiler-node", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "cdl-compiler-node_bg.wasm", |
@@ -7,2 +7,4 @@ # Compiler WASM | ||
rustup target add wasm32-unknown-unknown | ||
cargo install wasm-pack | ||
@@ -9,0 +11,0 @@ |
Sorry, the diff of this file is not supported yet
1189832
132
17