Rust编写的JavaScript引擎,该项目是一个试验性质的项目。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
6.8 KiB

(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],{
/***/ "./pkg/boa.js":
/*!********************!*\
!*** ./pkg/boa.js ***!
\********************/
/*! exports provided: __wbg_log_a49ab9a10e878c0d, evaluate, __wbindgen_throw */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(TextDecoder, TextEncoder) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_log_a49ab9a10e878c0d\", function() { return __wbg_log_a49ab9a10e878c0d; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"evaluate\", function() { return evaluate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_throw\", function() { return __wbindgen_throw; });\n/* harmony import */ var _boa_bg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boa_bg */ \"./pkg/boa_bg.wasm\");\n\n\nlet cachedTextDecoder = new TextDecoder('utf-8');\n\nlet cachegetUint8Memory = null;\nfunction getUint8Memory() {\n if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n cachegetUint8Memory = new Uint8Array(_boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n }\n return cachegetUint8Memory;\n}\n\nfunction getStringFromWasm(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len));\n}\n\nfunction __wbg_log_a49ab9a10e878c0d(arg0, arg1) {\n let varg0 = getStringFromWasm(arg0, arg1);\n try {\n console.log(varg0);\n } catch (e) {\n let error = (function () {\n try {\n return e instanceof Error\n ? `${e.message}\n\n Stack:\n ${e.stack}`\n : e.toString();\n } catch(_) {\n return \"<failed to stringify thrown value>\";\n }\n }());\n console.error(\"wasm-bindgen: imported JS function `__wbg_log_a49ab9a10e878c0d` that was not marked as `catch` threw an error:\", error);\n throw e;\n}\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedTextEncoder = new TextEncoder('utf-8');\n\nlet passStringToWasm;\nif (typeof cachedTextEncoder.encodeInto === 'function') {\n passStringToWasm = function(arg) {\n\n\n if (typeof(arg) !== 'string') throw new Error('expected a string argument');\n\n let size = arg.length;\n let ptr = _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"](size);\n let offset = 0;\n {\n const mem = getUint8Memory();\n for (; offset < arg.length; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n }\n\n if (offset !== arg.length) {\n arg = arg.slice(offset);\n ptr = _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_realloc\"](ptr, size, size = offset + arg.length * 3);\n const view = getUint8Memory().subarray(ptr + offset, ptr + size);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n if (ret.read != arg.length) throw new Error('failed to pass whole string');\n offset += ret.written;\n }\n WASM_VECTOR_LEN = offset;\n return ptr;\n };\n} else {\n passStringToWasm = function(arg) {\n\n\n if (typeof(arg) !== 'string') throw new Error('expected a string argument');\n\n let size = arg.length;\n let ptr = _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"](size);\n let offset = 0;\n {\n const mem = getUint8Memory();\n for (; offset < arg.length; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n }\n\n if (offset !== arg.length) {\n const buf = cachedTextEncoder.encode(arg.slice(offset));\n ptr = _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_realloc\"](ptr, size, size = offset + buf.length);\n getUint8Memory().set(buf, ptr + offset);\n offset += buf.length;\n }\n WASM_VECTOR_LEN = offset;\n return ptr;\n };\n}\n\nlet cachedGlobalArgumentPtr = null;\nfunction globalArgumentPtr() {\n if (cachedGlobalArgumentPtr === null) {\n cachedGlobalArgumentPtr = _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_global_argument_ptr\"]();\n }\n return cachedGlobalArgumentPtr;\n}\n\nlet cachegetUint32Memory = null;\nfunction getUint32Memory() {\n if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n cachegetUint32Memory = new Uint32Array(_boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n }\n return cachegetUint32Memory;\n}\n/**\n* @param {string} src\n* @returns {string}\n*/\nfunction evaluate(src) {\n const ptr0 = passStringToWasm(src);\n const len0 = WASM_VECTOR_LEN;\n const retptr = globalArgumentPtr();\n try {\n _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"evaluate\"](retptr, ptr0, len0);\n const mem = getUint32Memory();\n const rustptr = mem[retptr / 4];\n const rustlen = mem[retptr / 4 + 1];\n\n const realRet = getStringFromWasm(rustptr, rustlen).slice();\n _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_free\"](rustptr, rustlen * 1);\n return realRet;\n\n\n } finally {\n _boa_bg__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_free\"](ptr0, len0 * 1);\n\n }\n\n}\n\nfunction __wbindgen_throw(ptr, len) {\n throw new Error(getStringFromWasm(ptr, len));\n}\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! text-encoding */ \"./node_modules/text-encoding/index.js\")[\"TextDecoder\"], __webpack_require__(/*! text-encoding */ \"./node_modules/text-encoding/index.js\")[\"TextEncoder\"]))\n\n//# sourceURL=webpack:///./pkg/boa.js?");
/***/ }),
/***/ "./pkg/boa_bg.wasm":
/*!*************************!*\
!*** ./pkg/boa_bg.wasm ***!
\*************************/
/*! exports provided: memory, __rustc_debug_gdb_scripts_section__, __wbindgen_global_argument_ptr, evaluate, __wbindgen_malloc, __wbindgen_realloc, __wbindgen_free */
/***/ (function(module, exports, __webpack_require__) {
eval("\"use strict\";\n// Instantiate WebAssembly module\nvar wasmExports = __webpack_require__.w[module.i];\n__webpack_require__.r(exports);\n// export exports from WebAssembly module\nfor(var name in wasmExports) if(name != \"__webpack_init__\") exports[name] = wasmExports[name];\n// exec imports from WebAssembly module (for esm order)\n/* harmony import */ var m0 = __webpack_require__(/*! ./boa */ \"./pkg/boa.js\");\n\n\n// exec wasm module\nwasmExports[\"__webpack_init__\"]()\n\n//# sourceURL=webpack:///./pkg/boa_bg.wasm?");
/***/ })
}]);