211 lines
6.3 KiB
JavaScript
211 lines
6.3 KiB
JavaScript
|
|
let imports = {};
|
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
|
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
const mem = getDataViewMemory0();
|
|
const result = [];
|
|
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
}
|
|
wasm.__externref_drop_slice(ptr, len);
|
|
return result;
|
|
}
|
|
|
|
let cachedDataViewMemory0 = null;
|
|
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 cachedDataViewMemory0;
|
|
}
|
|
|
|
function getStringFromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
return decodeText(ptr, len);
|
|
}
|
|
|
|
let cachedUint8ArrayMemory0 = null;
|
|
function getUint8ArrayMemory0() {
|
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
}
|
|
return cachedUint8ArrayMemory0;
|
|
}
|
|
|
|
function isLikeNone(x) {
|
|
return x === undefined || x === null;
|
|
}
|
|
|
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
if (realloc === undefined) {
|
|
const buf = cachedTextEncoder.encode(arg);
|
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
getUint8ArrayMemory0().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 = getUint8ArrayMemory0();
|
|
|
|
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 = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
|
|
offset += ret.written;
|
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
}
|
|
|
|
WASM_VECTOR_LEN = offset;
|
|
return ptr;
|
|
}
|
|
|
|
function takeFromExternrefTable0(idx) {
|
|
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
wasm.__externref_table_dealloc(idx);
|
|
return value;
|
|
}
|
|
|
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
cachedTextDecoder.decode();
|
|
function decodeText(ptr, len) {
|
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
}
|
|
|
|
const cachedTextEncoder = new TextEncoder();
|
|
|
|
if (!('encodeInto' in cachedTextEncoder)) {
|
|
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
const buf = cachedTextEncoder.encode(arg);
|
|
view.set(buf);
|
|
return {
|
|
read: arg.length,
|
|
written: buf.length
|
|
};
|
|
}
|
|
}
|
|
|
|
let WASM_VECTOR_LEN = 0;
|
|
|
|
/**
|
|
* Returns an array containing all supported language names.
|
|
* @returns {any[]}
|
|
*/
|
|
function supported_languages() {
|
|
const ret = wasm.supported_languages();
|
|
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
return v1;
|
|
}
|
|
exports.supported_languages = supported_languages;
|
|
|
|
/**
|
|
* Transforms the provided template into a CDK application in the specified
|
|
* language.
|
|
* @param {string} template
|
|
* @param {string} language
|
|
* @param {string} class_name
|
|
* @param {string | null} [class_type]
|
|
* @returns {string}
|
|
*/
|
|
function transmute(template, language, class_name, class_type) {
|
|
let deferred6_0;
|
|
let deferred6_1;
|
|
try {
|
|
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ptr2 = passStringToWasm0(class_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len2 = WASM_VECTOR_LEN;
|
|
var ptr3 = isLikeNone(class_type) ? 0 : passStringToWasm0(class_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
var len3 = WASM_VECTOR_LEN;
|
|
const ret = wasm.transmute(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
var ptr5 = ret[0];
|
|
var len5 = ret[1];
|
|
if (ret[3]) {
|
|
ptr5 = 0; len5 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred6_0 = ptr5;
|
|
deferred6_1 = len5;
|
|
return getStringFromWasm0(ptr5, len5);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
}
|
|
}
|
|
exports.transmute = transmute;
|
|
|
|
function wasm_init() {
|
|
wasm.wasm_init();
|
|
}
|
|
exports.wasm_init = wasm_init;
|
|
|
|
exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
let deferred0_0;
|
|
let deferred0_1;
|
|
try {
|
|
deferred0_0 = arg0;
|
|
deferred0_1 = arg1;
|
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
}
|
|
};
|
|
|
|
exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
const ret = new Error();
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
const ret = arg1.stack;
|
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
};
|
|
|
|
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbindgen_init_externref_table = function() {
|
|
const table = wasm.__wbindgen_externrefs;
|
|
const offset = table.grow(4);
|
|
table.set(0, undefined);
|
|
table.set(offset + 0, undefined);
|
|
table.set(offset + 1, null);
|
|
table.set(offset + 2, true);
|
|
table.set(offset + 3, false);
|
|
};
|
|
|
|
const wasmPath = `${__dirname}/index_bg.wasm`;
|
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
|
|
wasm.__wbindgen_start();
|